diff --git a/extensions/voice-call/src/config.ts b/extensions/voice-call/src/config.ts index 4096e46317ce..108749a36818 100644 --- a/extensions/voice-call/src/config.ts +++ b/extensions/voice-call/src/config.ts @@ -272,20 +272,9 @@ const VoiceCallRealtimeConfigSchema = z toolPolicy: "safe-read-only", consultPolicy: "auto", tools: [], - fastContext: { - enabled: false, - timeoutMs: 800, - maxResults: 3, - sources: ["memory", "sessions"], - fallbackToConsult: false, - }, - agentContext: { - enabled: false, - maxChars: 6000, - includeIdentity: true, - includeWorkspaceFiles: true, - files: ["SOUL.md", "IDENTITY.md", "USER.md"], - }, + // Keep outer defaults' arrays independent of the inner object defaults. + fastContext: VoiceCallRealtimeFastContextConfigSchema.parse({}), + agentContext: VoiceCallRealtimeAgentContextConfigSchema.parse({}), providers: {}, }); export type VoiceCallRealtimeConfig = z.infer; diff --git a/packages/gateway-protocol/src/schema/audit-run.ts b/packages/gateway-protocol/src/schema/audit-run.ts index 7980502c45b0..31daab60b330 100644 --- a/packages/gateway-protocol/src/schema/audit-run.ts +++ b/packages/gateway-protocol/src/schema/audit-run.ts @@ -18,10 +18,7 @@ const ExecutionIdentityContextCoverageStateSchema = Type.Union([ ]); const ExecutionIdentityDecisionCoverageStateSchema = Type.Union([ Type.Literal("enforced"), - Type.Literal("attribution-only"), - Type.Literal("unattributed"), - Type.Literal("unknown"), - Type.Literal("unsupported"), + ...ExecutionIdentityContextCoverageStateSchema.anyOf, ]); const ExecutionIdentityRefArraySchema = Type.Array(ExecutionIdentityRefSchema, { maxItems: 16 }); diff --git a/packages/gateway-protocol/src/schema/config.ts b/packages/gateway-protocol/src/schema/config.ts index 6efbe9f05cb3..393f91743d10 100644 --- a/packages/gateway-protocol/src/schema/config.ts +++ b/packages/gateway-protocol/src/schema/config.ts @@ -316,9 +316,7 @@ const ConfigSchemaLookupChildSchema = closedObject({ export const ConfigSchemaLookupResultSchema = closedObject({ path: NonEmptyString, schema: Type.Unknown(), - reloadKind: Type.Optional( - Type.Union([Type.Literal("restart"), Type.Literal("hot"), Type.Literal("none")]), - ), + reloadKind: ConfigSchemaLookupChildSchema.properties.reloadKind, hint: Type.Optional(ConfigUiHintSchema), hintPath: Type.Optional(Type.String()), children: Type.Array(ConfigSchemaLookupChildSchema), diff --git a/packages/gateway-protocol/src/schema/cron.ts b/packages/gateway-protocol/src/schema/cron.ts index 3eb96731a4d9..f498c8c7f58e 100644 --- a/packages/gateway-protocol/src/schema/cron.ts +++ b/packages/gateway-protocol/src/schema/cron.ts @@ -245,10 +245,7 @@ const CronPayloadSchema = Type.Union([ /** Reported payloads include the Gateway-owned heartbeat monitor. */ const CronReportedPayloadSchema = Type.Union([ - CronSystemEventPayloadSchema, - CronAgentTurnPayloadSchema, - CronCommandPayloadSchema, - CronScriptPayloadSchema, + ...CronPayloadSchema.anyOf, closedObject({ kind: Type.Literal("heartbeat") }), ]); @@ -583,9 +580,7 @@ export const CronScratchSetParamsSchema = cronIdOrJobIdParams({ export const CronScratchSetResultSchema = Type.Union([ closedObject({ ok: Type.Literal(true), - scratch: Type.Union([CronScratchSchema, Type.Null()]), - currentRevision: Type.Integer({ minimum: 0 }), - maxBytes: Type.Integer({ minimum: 1 }), + ...CronScratchGetResultSchema.properties, }), closedObject({ ok: Type.Literal(false), diff --git a/packages/gateway-protocol/src/schema/session-placement.ts b/packages/gateway-protocol/src/schema/session-placement.ts index 890a220612df..49743760a544 100644 --- a/packages/gateway-protocol/src/schema/session-placement.ts +++ b/packages/gateway-protocol/src/schema/session-placement.ts @@ -309,18 +309,15 @@ export const SessionsDispatchResultSchema = closedObject({ }); /** Stops a worker or explicitly recovers one failed placement onto the Gateway. */ -export const SessionsReclaimParamsSchema = Type.Object( - { - key: NonEmptyString, - agentId: Type.Optional(NonEmptyString), - recoverToGateway: Type.Optional( - closedObject({ - expectedGeneration: Type.Integer({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER }), - }), - ), - }, - { additionalProperties: false }, -); +export const SessionsReclaimParamsSchema = closedObject({ + key: NonEmptyString, + agentId: Type.Optional(NonEmptyString), + recoverToGateway: Type.Optional( + closedObject({ + expectedGeneration: Type.Integer({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER }), + }), + ), +}); /** Terminal placement returned after a worker reclaim operation. */ export const SessionsReclaimResultPlacementSchema = Type.Union([ @@ -329,15 +326,12 @@ export const SessionsReclaimResultPlacementSchema = Type.Union([ ]); /** Result returned once worker ownership is reclaimed or a failed placement is cleared. */ -export const SessionsReclaimResultSchema = Type.Object( - { - ok: Type.Literal(true), - key: NonEmptyString, - sessionId: NonEmptyString, - placement: SessionsReclaimResultPlacementSchema, - }, - { additionalProperties: false }, -); +export const SessionsReclaimResultSchema = closedObject({ + ok: Type.Literal(true), + key: NonEmptyString, + sessionId: NonEmptyString, + placement: SessionsReclaimResultPlacementSchema, +}); /** Exact active source observed before a session placement move. */ export const SessionMoveExpectedSourceSchema = closedObject({ diff --git a/src/agents/tools/agents-list-tool.ts b/src/agents/tools/agents-list-tool.ts index 7af6ae68d08d..d8a9b3f015ec 100644 --- a/src/agents/tools/agents-list-tool.ts +++ b/src/agents/tools/agents-list-tool.ts @@ -1,4 +1,5 @@ import { Type, type Static } from "typebox"; +import { GatewayAgentRuntimeSchema } from "../../../packages/gateway-protocol/src/schema/model-runtime-options.js"; import { getRuntimeConfig } from "../../config/config.js"; import { normalizeAgentId } from "../../routing/session-key.js"; import { resolveModelAgentRuntimeMetadata } from "../agent-runtime-metadata.js"; @@ -12,16 +13,6 @@ import { jsonResult } from "./common.js"; import { resolveInternalSessionKey, resolveMainSessionAlias } from "./sessions-helpers.js"; const AgentsListToolSchema = Type.Object({}); -const AgentRuntimeSourceSchema = Type.Union([ - Type.Literal("env"), - Type.Literal("agent"), - Type.Literal("defaults"), - Type.Literal("model"), - Type.Literal("provider"), - Type.Literal("implicit"), - Type.Literal("session"), - Type.Literal("session-key"), -]); const AgentsListOutputSchema = Type.Object( { requester: Type.String(), @@ -37,7 +28,7 @@ const AgentsListOutputSchema = Type.Object( Type.Object( { id: Type.String(), - source: AgentRuntimeSourceSchema, + source: GatewayAgentRuntimeSchema.properties.source, }, { additionalProperties: false }, ), diff --git a/src/config/schema.lookup.ts b/src/config/schema.lookup.ts index f186b0ea9bac..ff898cd93e91 100644 --- a/src/config/schema.lookup.ts +++ b/src/config/schema.lookup.ts @@ -1,4 +1,5 @@ import type { ConfigSchemaLookupResult as ProtocolConfigSchemaLookupResult } from "../../packages/gateway-protocol/src/schema/config.js"; +import { isBlockedObjectKey } from "../infra/prototype-keys.js"; import { parseConfigPathArrayIndex } from "../shared/path-array-index.js"; import type { ConfigUiHints } from "./schema.hints.js"; import { @@ -11,7 +12,6 @@ import { type JsonSchemaNode = Record; -const FORBIDDEN_LOOKUP_SEGMENTS = new Set(["__proto__", "prototype", "constructor"]); const LOOKUP_SCHEMA_STRING_KEYS = new Set([ "$id", "$schema", @@ -89,7 +89,7 @@ function resolveLookupChildSchema( schema: JsonSchemaObject, segment: string, ): JsonSchemaObject | null { - if (FORBIDDEN_LOOKUP_SEGMENTS.has(segment)) { + if (isBlockedObjectKey(segment)) { return null; } diff --git a/src/config/validation-plugin-config.ts b/src/config/validation-plugin-config.ts index 0d4063607a0e..4645fce4406e 100644 --- a/src/config/validation-plugin-config.ts +++ b/src/config/validation-plugin-config.ts @@ -180,9 +180,7 @@ export function validateExplicitPluginConfig(params: { if ( resolvedLoadPath && normalizePluginId(path.basename(resolvedLoadPath)) === normalizedPluginId && - (sourcePath === resolvedLoadPath || - isPathInside(resolvedLoadPath, sourcePath) || - isPathInside(sourcePath, resolvedLoadPath)) + (isPathInside(resolvedLoadPath, sourcePath) || isPathInside(sourcePath, resolvedLoadPath)) ) { return true; }