feat(mcp): разрешить автономное выполнение планов сервисным ключом
Docker images / prepare-release (push) Successful in 14s
Docker images / backend-test (push) Failing after 3m16s
Docker images / backend-image (push) Skipped
Docker images / frontend-image (push) Successful in 2m47s
Docker images / updater-image (push) Successful in 39s
Docker images / netflow-agent-image (push) Successful in 32s
Docker images / publish-release (push) Skipped
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 14s
Docker images / backend-test (push) Failing after 3m16s
Docker images / backend-image (push) Skipped
Docker images / frontend-image (push) Successful in 2m47s
Docker images / updater-image (push) Successful in 39s
Docker images / netflow-agent-image (push) Successful in 32s
Docker images / publish-release (push) Skipped
Docker images / notify-webhook (push) Skipped
This commit is contained in:
1 parent
26249e1a4d
commit
79ab7b45aa
18 files changed
+184
-60
No files matched your search
@@ -35,6 +35,7 @@ export const mcpConnectionPolicySchema = z.object({
|
||||
version: z.number().int().positive(),
|
||||
status: z.enum(["active", "paused", "revoked"]),
|
||||
authority: z.literal("service").optional(),
|
||||
allowUnattendedPlans: z.literal(true).optional(),
|
||||
expiresAt: instant,
|
||||
mode: mcpModeSchema,
|
||||
permissions: uniqueStrings,
|
||||
@@ -42,8 +43,9 @@ export const mcpConnectionPolicySchema = z.object({
|
||||
dangerousPolicy: z.enum(["approval", "explicit-allow"]).default("approval"),
|
||||
autonomousDangerousOperationIds: uniqueStrings.default([]),
|
||||
limits: mcpLimitsSchema.default(() => mcpLimitsSchema.parse({})),
|
||||
}).strict().refine(policy => policy.authority !== "service" ||
|
||||
policy.expiresAt === MCP_SERVICE_EXPIRATION && policy.mode === "autonomous" && policy.dangerousPolicy === "approval" && !policy.autonomousDangerousOperationIds.length,
|
||||
}).strict().refine(policy => policy.authority === "service"
|
||||
? policy.expiresAt === MCP_SERVICE_EXPIRATION && policy.mode === "autonomous" && policy.dangerousPolicy === "approval" && !policy.autonomousDangerousOperationIds.length
|
||||
: !policy.allowUnattendedPlans,
|
||||
"Некорректная политика сервисного подключения")
|
||||
|
||||
export const mcpTargetSchema = z.discriminatedUnion("scope", [
|
||||
@@ -133,6 +135,7 @@ export type McpPolicyReasonCode = z.infer<typeof mcpPolicyReasonCodeSchema>
|
||||
export const mcpConnectionCreateSchema = z.object({
|
||||
name: z.string().trim().min(1).max(100),
|
||||
authority: z.literal("service").optional(),
|
||||
allowUnattendedPlans: z.literal(true).optional(),
|
||||
expiresAt: instant.nullable(),
|
||||
mode: mcpModeSchema.default("observer"),
|
||||
permissions: uniqueStrings,
|
||||
@@ -143,7 +146,7 @@ export const mcpConnectionCreateSchema = z.object({
|
||||
limits: mcpLimitsSchema.default(() => mcpLimitsSchema.parse({})),
|
||||
}).strict().refine(input => input.authority === "service"
|
||||
? input.expiresAt === null && input.mode === "autonomous" && input.dangerousPolicy === "approval" && !input.autonomousDangerousOperationIds.length
|
||||
: input.expiresAt !== null, "Для сервисного подключения выберите автономный режим с подтверждением опасных действий. Для личного подключения укажите срок действия.")
|
||||
: input.expiresAt !== null && !input.allowUnattendedPlans, "Опция доступна только бессрочному сервисному подключению. Для личного подключения укажите срок действия.")
|
||||
.refine(input => !input.selectAllServers || !input.scope.serverIds.length, "Выберите все серверы или укажите конкретные ID")
|
||||
export const mcpConnectionSchema = z.object({
|
||||
id: z.string().uuid(), name: z.string(), ownerId: z.string(),
|
||||
|
||||
Reference in new issue
Block a user