From 8738fe1354613e32fdf130010313cbef1bb192e3 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 1 Aug 2026 05:32:37 -0700 Subject: [PATCH] refactor(codex): deduplicate generated protocol schemas (#117382) --- .../v2/CodexAppServerProtocolDefinitions.json | 2840 +++++++++++++++++ .../json/v2/ErrorNotification.json | 177 +- .../json/v2/GetAccountResponse.json | 89 +- .../json/v2/ModelListResponse.json | 214 +- .../json/v2/ThreadResumeResponse.json | 2567 +-------------- .../json/v2/ThreadStartResponse.json | 2539 +-------------- .../json/v2/TurnCompletedNotification.json | 1883 +---------- .../json/v2/TurnStartResponse.json | 1883 +---------- .../src/app-server/protocol-validators.ts | 105 +- scripts/check-codex-app-server-protocol.ts | 58 +- .../lib/codex-app-server-protocol-source.ts | 159 + scripts/sync-codex-app-server-protocol.ts | 13 +- .../codex-app-server-protocol-source.test.ts | 85 + 13 files changed, 3266 insertions(+), 9346 deletions(-) create mode 100644 extensions/codex/src/app-server/protocol-generated/json/v2/CodexAppServerProtocolDefinitions.json diff --git a/extensions/codex/src/app-server/protocol-generated/json/v2/CodexAppServerProtocolDefinitions.json b/extensions/codex/src/app-server/protocol-generated/json/v2/CodexAppServerProtocolDefinitions.json new file mode 100644 index 000000000000..fb5946a2400c --- /dev/null +++ b/extensions/codex/src/app-server/protocol-generated/json/v2/CodexAppServerProtocolDefinitions.json @@ -0,0 +1,2840 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "AbsolutePathBuf": { + "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + "type": "string" + }, + "Account": { + "oneOf": [ + { + "properties": { + "type": { + "enum": [ + "apiKey" + ], + "title": "ApiKeyAccountType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "ApiKeyAccount", + "type": "object" + }, + { + "properties": { + "email": { + "type": [ + "string", + "null" + ] + }, + "planType": { + "$ref": "#/definitions/PlanType" + }, + "type": { + "enum": [ + "chatgpt" + ], + "title": "ChatgptAccountType", + "type": "string" + } + }, + "required": [ + "email", + "planType", + "type" + ], + "title": "ChatgptAccount", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "amazonBedrock" + ], + "title": "AmazonBedrockAccountType", + "type": "string" + }, + "usesCodexManagedCredentials": { + "default": false, + "type": "boolean" + } + }, + "required": [ + "type" + ], + "title": "AmazonBedrockAccount", + "type": "object" + } + ] + }, + "ActivePermissionProfile": { + "properties": { + "extends": { + "default": null, + "description": "Parent profile identifier from the selected permissions profile's `extends` setting, when present.", + "type": [ + "string", + "null" + ] + }, + "id": { + "description": "Identifier from `default_permissions` or the implicit built-in default, such as `:workspace` or a user-defined `[permissions.]` profile.", + "type": "string" + } + }, + "required": [ + "id" + ], + "type": "object" + }, + "AgentPath": { + "type": "string" + }, + "ApprovalsReviewer": { + "description": "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", + "enum": [ + "user", + "auto_review", + "guardian_subagent" + ], + "type": "string" + }, + "AskForApproval": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "granular": { + "properties": { + "mcp_elicitations": { + "type": "boolean" + }, + "request_permissions": { + "default": false, + "type": "boolean" + }, + "rules": { + "type": "boolean" + }, + "sandbox_approval": { + "type": "boolean" + }, + "skill_approval": { + "default": false, + "type": "boolean" + } + }, + "required": [ + "mcp_elicitations", + "rules", + "sandbox_approval" + ], + "type": "object" + } + }, + "required": [ + "granular" + ], + "title": "GranularAskForApproval", + "type": "object" + }, + { + "enum": [ + "untrusted", + "on-request", + "never" + ], + "type": "string" + } + ] + }, + "ByteRange": { + "properties": { + "end": { + "format": "uint", + "minimum": 0, + "type": "integer" + }, + "start": { + "format": "uint", + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "end", + "start" + ], + "type": "object" + }, + "CodexErrorInfo": { + "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "httpConnectionFailed": { + "properties": { + "httpStatusCode": { + "format": "uint16", + "minimum": 0, + "type": [ + "integer", + "null" + ] + } + }, + "type": "object" + } + }, + "required": [ + "httpConnectionFailed" + ], + "title": "HttpConnectionFailedCodexErrorInfo", + "type": "object" + }, + { + "additionalProperties": false, + "description": "Failed to connect to the response SSE stream.", + "properties": { + "responseStreamConnectionFailed": { + "properties": { + "httpStatusCode": { + "format": "uint16", + "minimum": 0, + "type": [ + "integer", + "null" + ] + } + }, + "type": "object" + } + }, + "required": [ + "responseStreamConnectionFailed" + ], + "title": "ResponseStreamConnectionFailedCodexErrorInfo", + "type": "object" + }, + { + "additionalProperties": false, + "description": "The response SSE stream disconnected in the middle of a turn before completion.", + "properties": { + "responseStreamDisconnected": { + "properties": { + "httpStatusCode": { + "format": "uint16", + "minimum": 0, + "type": [ + "integer", + "null" + ] + } + }, + "type": "object" + } + }, + "required": [ + "responseStreamDisconnected" + ], + "title": "ResponseStreamDisconnectedCodexErrorInfo", + "type": "object" + }, + { + "additionalProperties": false, + "description": "Reached the retry limit for responses.", + "properties": { + "responseTooManyFailedAttempts": { + "properties": { + "httpStatusCode": { + "format": "uint16", + "minimum": 0, + "type": [ + "integer", + "null" + ] + } + }, + "type": "object" + } + }, + "required": [ + "responseTooManyFailedAttempts" + ], + "title": "ResponseTooManyFailedAttemptsCodexErrorInfo", + "type": "object" + }, + { + "additionalProperties": false, + "description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", + "properties": { + "activeTurnNotSteerable": { + "properties": { + "turnKind": { + "$ref": "#/definitions/NonSteerableTurnKind" + } + }, + "required": [ + "turnKind" + ], + "type": "object" + } + }, + "required": [ + "activeTurnNotSteerable" + ], + "title": "ActiveTurnNotSteerableCodexErrorInfo", + "type": "object" + }, + { + "enum": [ + "contextWindowExceeded", + "sessionBudgetExceeded", + "usageLimitExceeded", + "serverOverloaded", + "cyberPolicy", + "internalServerError", + "unauthorized", + "badRequest", + "threadRollbackFailed", + "sandboxError", + "other" + ], + "type": "string" + } + ] + }, + "CollabAgentState": { + "properties": { + "message": { + "type": [ + "string", + "null" + ] + }, + "status": { + "$ref": "#/definitions/CollabAgentStatus" + } + }, + "required": [ + "status" + ], + "type": "object" + }, + "CollabAgentStatus": { + "enum": [ + "pendingInit", + "running", + "interrupted", + "completed", + "errored", + "shutdown", + "notFound" + ], + "type": "string" + }, + "CollabAgentTool": { + "enum": [ + "spawnAgent", + "sendInput", + "resumeAgent", + "wait", + "closeAgent" + ], + "type": "string" + }, + "CollabAgentToolCallStatus": { + "enum": [ + "inProgress", + "completed", + "failed" + ], + "type": "string" + }, + "CommandAction": { + "oneOf": [ + { + "properties": { + "command": { + "type": "string" + }, + "name": { + "type": "string" + }, + "path": { + "$ref": "#/definitions/AbsolutePathBuf" + }, + "type": { + "enum": [ + "read" + ], + "title": "ReadCommandActionType", + "type": "string" + } + }, + "required": [ + "command", + "name", + "path", + "type" + ], + "title": "ReadCommandAction", + "type": "object" + }, + { + "properties": { + "command": { + "type": "string" + }, + "path": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "listFiles" + ], + "title": "ListFilesCommandActionType", + "type": "string" + } + }, + "required": [ + "command", + "type" + ], + "title": "ListFilesCommandAction", + "type": "object" + }, + { + "properties": { + "command": { + "type": "string" + }, + "path": { + "type": [ + "string", + "null" + ] + }, + "query": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "search" + ], + "title": "SearchCommandActionType", + "type": "string" + } + }, + "required": [ + "command", + "type" + ], + "title": "SearchCommandAction", + "type": "object" + }, + { + "properties": { + "command": { + "type": "string" + }, + "type": { + "enum": [ + "unknown" + ], + "title": "UnknownCommandActionType", + "type": "string" + } + }, + "required": [ + "command", + "type" + ], + "title": "UnknownCommandAction", + "type": "object" + } + ] + }, + "CommandExecutionSource": { + "enum": [ + "agent", + "userShell", + "unifiedExecStartup", + "unifiedExecInteraction" + ], + "type": "string" + }, + "CommandExecutionStatus": { + "enum": [ + "inProgress", + "completed", + "failed", + "declined" + ], + "type": "string" + }, + "DynamicToolCallOutputContentItem": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "inputText" + ], + "title": "InputTextDynamicToolCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "InputTextDynamicToolCallOutputContentItem", + "type": "object" + }, + { + "properties": { + "imageUrl": { + "type": "string" + }, + "type": { + "enum": [ + "inputImage" + ], + "title": "InputImageDynamicToolCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "imageUrl", + "type" + ], + "title": "InputImageDynamicToolCallOutputContentItem", + "type": "object" + }, + { + "properties": { + "audioUrl": { + "type": "string" + }, + "type": { + "enum": [ + "inputAudio" + ], + "title": "InputAudioDynamicToolCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "audioUrl", + "type" + ], + "title": "InputAudioDynamicToolCallOutputContentItem", + "type": "object" + } + ] + }, + "DynamicToolCallStatus": { + "enum": [ + "inProgress", + "completed", + "failed" + ], + "type": "string" + }, + "FileUpdateChange": { + "properties": { + "diff": { + "type": "string" + }, + "kind": { + "$ref": "#/definitions/PatchChangeKind" + }, + "path": { + "type": "string" + } + }, + "required": [ + "diff", + "kind", + "path" + ], + "type": "object" + }, + "GitInfo": { + "properties": { + "branch": { + "type": [ + "string", + "null" + ] + }, + "originUrl": { + "type": [ + "string", + "null" + ] + }, + "sha": { + "type": [ + "string", + "null" + ] + } + }, + "type": "object" + }, + "HookPromptFragment": { + "properties": { + "hookRunId": { + "type": "string" + }, + "text": { + "type": "string" + } + }, + "required": [ + "hookRunId", + "text" + ], + "type": "object" + }, + "ImageDetail": { + "enum": [ + "auto", + "low", + "high", + "original" + ], + "type": "string" + }, + "InputModality": { + "description": "Canonical user-input modality tags advertised by a model.", + "oneOf": [ + { + "description": "Plain text turns and tool payloads.", + "enum": [ + "text" + ], + "type": "string" + }, + { + "description": "Image attachments included in user turns.", + "enum": [ + "image" + ], + "type": "string" + }, + { + "description": "Audio attachments included in user turns.", + "enum": [ + "audio" + ], + "type": "string" + } + ] + }, + "LegacyAppPathString": { + "type": "string" + }, + "McpToolCallAppContext": { + "properties": { + "actionName": { + "type": [ + "string", + "null" + ] + }, + "appName": { + "type": [ + "string", + "null" + ] + }, + "connectorId": { + "type": "string" + }, + "linkId": { + "type": [ + "string", + "null" + ] + }, + "resourceUri": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "connectorId" + ], + "type": "object" + }, + "McpToolCallError": { + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ], + "type": "object" + }, + "McpToolCallResult": { + "properties": { + "_meta": true, + "content": { + "items": true, + "type": "array" + }, + "structuredContent": true + }, + "required": [ + "content" + ], + "type": "object" + }, + "McpToolCallStatus": { + "enum": [ + "inProgress", + "completed", + "failed" + ], + "type": "string" + }, + "MemoryCitation": { + "properties": { + "entries": { + "items": { + "$ref": "#/definitions/MemoryCitationEntry" + }, + "type": "array" + }, + "threadIds": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "entries", + "threadIds" + ], + "type": "object" + }, + "MemoryCitationEntry": { + "properties": { + "lineEnd": { + "format": "uint32", + "minimum": 0, + "type": "integer" + }, + "lineStart": { + "format": "uint32", + "minimum": 0, + "type": "integer" + }, + "note": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "required": [ + "lineEnd", + "lineStart", + "note", + "path" + ], + "type": "object" + }, + "MessagePhase": { + "description": "Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as \"phase unknown\" and keep compatibility behavior for legacy models.", + "oneOf": [ + { + "description": "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", + "enum": [ + "commentary" + ], + "type": "string" + }, + { + "description": "The assistant's terminal answer text for the current turn.", + "enum": [ + "final_answer" + ], + "type": "string" + } + ] + }, + "Model": { + "properties": { + "additionalSpeedTiers": { + "default": [], + "description": "Deprecated: use `serviceTiers` instead.", + "items": { + "type": "string" + }, + "type": "array" + }, + "availabilityNux": { + "anyOf": [ + { + "$ref": "#/definitions/ModelAvailabilityNux" + }, + { + "type": "null" + } + ] + }, + "defaultReasoningEffort": { + "$ref": "#/definitions/ReasoningEffort" + }, + "defaultServiceTier": { + "default": null, + "description": "Catalog default service tier id for this model, when one is configured.", + "type": [ + "string", + "null" + ] + }, + "description": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "inputModalities": { + "default": [ + "text", + "image" + ], + "items": { + "$ref": "#/definitions/InputModality" + }, + "type": "array" + }, + "isDefault": { + "type": "boolean" + }, + "model": { + "type": "string" + }, + "serviceTiers": { + "default": [], + "items": { + "$ref": "#/definitions/ModelServiceTier" + }, + "type": "array" + }, + "supportedReasoningEfforts": { + "items": { + "$ref": "#/definitions/ReasoningEffortOption" + }, + "type": "array" + }, + "supportsPersonality": { + "default": false, + "type": "boolean" + }, + "upgrade": { + "type": [ + "string", + "null" + ] + }, + "upgradeInfo": { + "anyOf": [ + { + "$ref": "#/definitions/ModelUpgradeInfo" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "defaultReasoningEffort", + "description", + "displayName", + "hidden", + "id", + "isDefault", + "model", + "supportedReasoningEfforts" + ], + "type": "object" + }, + "ModelAvailabilityNux": { + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ], + "type": "object" + }, + "ModelServiceTier": { + "properties": { + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "description", + "id", + "name" + ], + "type": "object" + }, + "ModelUpgradeInfo": { + "properties": { + "migrationMarkdown": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": "string" + }, + "modelLink": { + "type": [ + "string", + "null" + ] + }, + "upgradeCopy": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "model" + ], + "type": "object" + }, + "MultiAgentMode": { + "description": "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "custom": { + "type": "string" + } + }, + "required": [ + "custom" + ], + "title": "CustomMultiAgentMode", + "type": "object" + }, + { + "enum": [ + "explicitRequestOnly", + "proactive" + ], + "type": "string" + } + ] + }, + "NetworkAccess": { + "enum": [ + "restricted", + "enabled" + ], + "type": "string" + }, + "NonSteerableTurnKind": { + "enum": [ + "review", + "compact" + ], + "type": "string" + }, + "PatchApplyStatus": { + "enum": [ + "inProgress", + "completed", + "failed", + "declined" + ], + "type": "string" + }, + "PatchChangeKind": { + "oneOf": [ + { + "properties": { + "type": { + "enum": [ + "add" + ], + "title": "AddPatchChangeKindType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "AddPatchChangeKind", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "delete" + ], + "title": "DeletePatchChangeKindType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "DeletePatchChangeKind", + "type": "object" + }, + { + "properties": { + "move_path": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "update" + ], + "title": "UpdatePatchChangeKindType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "UpdatePatchChangeKind", + "type": "object" + } + ] + }, + "PlanType": { + "enum": [ + "free", + "go", + "plus", + "pro", + "prolite", + "team", + "self_serve_business_usage_based", + "business", + "ent26", + "enterprise_cbp_usage_based", + "enterprise", + "edu", + "unknown" + ], + "type": "string" + }, + "ReasoningEffort": { + "description": "A non-empty reasoning effort value advertised by the model.", + "minLength": 1, + "type": "string" + }, + "ReasoningEffortOption": { + "properties": { + "description": { + "type": "string" + }, + "reasoningEffort": { + "$ref": "#/definitions/ReasoningEffort" + } + }, + "required": [ + "description", + "reasoningEffort" + ], + "type": "object" + }, + "SandboxPolicy": { + "oneOf": [ + { + "properties": { + "type": { + "enum": [ + "dangerFullAccess" + ], + "title": "DangerFullAccessSandboxPolicyType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "DangerFullAccessSandboxPolicy", + "type": "object" + }, + { + "properties": { + "networkAccess": { + "default": false, + "type": "boolean" + }, + "type": { + "enum": [ + "readOnly" + ], + "title": "ReadOnlySandboxPolicyType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "ReadOnlySandboxPolicy", + "type": "object" + }, + { + "properties": { + "networkAccess": { + "allOf": [ + { + "$ref": "#/definitions/NetworkAccess" + } + ], + "default": "restricted" + }, + "type": { + "enum": [ + "externalSandbox" + ], + "title": "ExternalSandboxSandboxPolicyType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "ExternalSandboxSandboxPolicy", + "type": "object" + }, + { + "properties": { + "excludeSlashTmp": { + "default": false, + "type": "boolean" + }, + "excludeTmpdirEnvVar": { + "default": false, + "type": "boolean" + }, + "networkAccess": { + "default": false, + "type": "boolean" + }, + "type": { + "enum": [ + "workspaceWrite" + ], + "title": "WorkspaceWriteSandboxPolicyType", + "type": "string" + }, + "writableRoots": { + "default": [], + "items": { + "$ref": "#/definitions/AbsolutePathBuf" + }, + "type": "array" + } + }, + "required": [ + "type" + ], + "title": "WorkspaceWriteSandboxPolicy", + "type": "object" + } + ] + }, + "SessionSource": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "custom": { + "type": "string" + } + }, + "required": [ + "custom" + ], + "title": "CustomSessionSource", + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "subAgent": { + "$ref": "#/definitions/SubAgentSource" + } + }, + "required": [ + "subAgent" + ], + "title": "SubAgentSessionSource", + "type": "object" + }, + { + "enum": [ + "cli", + "vscode", + "exec", + "appServer", + "unknown" + ], + "type": "string" + } + ] + }, + "SubAgentActivityKind": { + "enum": [ + "started", + "interacted", + "interrupted" + ], + "type": "string" + }, + "SubAgentSource": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "thread_spawn": { + "properties": { + "agent_nickname": { + "default": null, + "type": [ + "string", + "null" + ] + }, + "agent_path": { + "anyOf": [ + { + "$ref": "#/definitions/AgentPath" + }, + { + "type": "null" + } + ], + "default": null + }, + "agent_role": { + "default": null, + "type": [ + "string", + "null" + ] + }, + "depth": { + "format": "int32", + "type": "integer" + }, + "parent_thread_id": { + "$ref": "#/definitions/ThreadId" + } + }, + "required": [ + "depth", + "parent_thread_id" + ], + "type": "object" + } + }, + "required": [ + "thread_spawn" + ], + "title": "ThreadSpawnSubAgentSource", + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "other": { + "type": "string" + } + }, + "required": [ + "other" + ], + "title": "OtherSubAgentSource", + "type": "object" + }, + { + "enum": [ + "review", + "compact", + "memory_consolidation" + ], + "type": "string" + } + ] + }, + "TextElement": { + "properties": { + "byteRange": { + "allOf": [ + { + "$ref": "#/definitions/ByteRange" + } + ], + "description": "Byte range in the parent `text` buffer that this element occupies." + }, + "placeholder": { + "description": "Optional human-readable placeholder for the element, displayed in the UI.", + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "byteRange" + ], + "type": "object" + }, + "Thread": { + "properties": { + "agentNickname": { + "description": "Optional random unique nickname assigned to an AgentControl-spawned sub-agent.", + "type": [ + "string", + "null" + ] + }, + "agentRole": { + "description": "Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.", + "type": [ + "string", + "null" + ] + }, + "canAcceptDirectInput": { + "description": "Whether the app server accepts direct turn input for this loaded thread. `None` means the capability is unavailable, such as for an unloaded stored thread.", + "type": [ + "boolean", + "null" + ] + }, + "cliVersion": { + "description": "Version of the CLI that created the thread.", + "type": "string" + }, + "createdAt": { + "description": "Unix timestamp (in seconds) when the thread was created.", + "format": "int64", + "type": "integer" + }, + "cwd": { + "allOf": [ + { + "$ref": "#/definitions/AbsolutePathBuf" + } + ], + "description": "Working directory captured for the thread." + }, + "ephemeral": { + "description": "Whether the thread is ephemeral and should not be materialized on disk.", + "type": "boolean" + }, + "extra": { + "anyOf": [ + { + "$ref": "#/definitions/ThreadExtra" + }, + { + "type": "null" + } + ], + "description": "Optional implementation-specific thread data." + }, + "forkedFromId": { + "description": "Source thread id when this thread was created by forking another thread.", + "type": [ + "string", + "null" + ] + }, + "gitInfo": { + "anyOf": [ + { + "$ref": "#/definitions/GitInfo" + }, + { + "type": "null" + } + ], + "description": "Optional Git metadata captured when the thread was created." + }, + "historyMode": { + "allOf": [ + { + "$ref": "#/definitions/ThreadHistoryMode" + } + ], + "default": "legacy", + "description": "Persisted thread history contract selected when this thread was created." + }, + "id": { + "description": "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", + "type": "string" + }, + "isPinned": { + "default": false, + "description": "Whether the thread has been pinned by the user.", + "type": "boolean" + }, + "modelProvider": { + "description": "Model provider used for this thread (for example, 'openai').", + "type": "string" + }, + "name": { + "description": "Optional user-facing thread title.", + "type": [ + "string", + "null" + ] + }, + "parentThreadId": { + "description": "The ID of the parent thread. This will only be set if this thread is a subagent.", + "type": [ + "string", + "null" + ] + }, + "path": { + "description": "[UNSTABLE] Path to the thread on disk.", + "type": [ + "string", + "null" + ] + }, + "preview": { + "description": "Usually the first user message in the thread, if available.", + "type": "string" + }, + "recencyAt": { + "description": "Unix timestamp (in seconds) used for thread recency ordering.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "sessionId": { + "description": "Session id shared by threads that belong to the same session tree.", + "type": "string" + }, + "source": { + "allOf": [ + { + "$ref": "#/definitions/SessionSource" + } + ], + "description": "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.)." + }, + "status": { + "allOf": [ + { + "$ref": "#/definitions/ThreadStatus" + } + ], + "description": "Current runtime status for the thread." + }, + "threadSource": { + "anyOf": [ + { + "$ref": "#/definitions/ThreadSource" + }, + { + "type": "null" + } + ], + "description": "Optional analytics source classification for this thread." + }, + "turns": { + "description": "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", + "items": { + "$ref": "#/definitions/Turn" + }, + "type": "array" + }, + "updatedAt": { + "description": "Unix timestamp (in seconds) when the thread was last updated.", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "cliVersion", + "createdAt", + "cwd", + "ephemeral", + "id", + "modelProvider", + "preview", + "sessionId", + "source", + "status", + "turns", + "updatedAt" + ], + "type": "object" + }, + "ThreadActiveFlag": { + "enum": [ + "waitingOnApproval", + "waitingOnUserInput" + ], + "type": "string" + }, + "ThreadExtra": { + "description": "Extra app-server data for a thread.", + "type": "object" + }, + "ThreadHistoryMode": { + "enum": [ + "legacy", + "paginated" + ], + "type": "string" + }, + "ThreadId": { + "type": "string" + }, + "ThreadItem": { + "oneOf": [ + { + "properties": { + "clientId": { + "type": [ + "string", + "null" + ] + }, + "content": { + "items": { + "$ref": "#/definitions/UserInput" + }, + "type": "array" + }, + "id": { + "type": "string" + }, + "type": { + "enum": [ + "userMessage" + ], + "title": "UserMessageThreadItemType", + "type": "string" + } + }, + "required": [ + "content", + "id", + "type" + ], + "title": "UserMessageThreadItem", + "type": "object" + }, + { + "properties": { + "fragments": { + "items": { + "$ref": "#/definitions/HookPromptFragment" + }, + "type": "array" + }, + "id": { + "type": "string" + }, + "type": { + "enum": [ + "hookPrompt" + ], + "title": "HookPromptThreadItemType", + "type": "string" + } + }, + "required": [ + "fragments", + "id", + "type" + ], + "title": "HookPromptThreadItem", + "type": "object" + }, + { + "properties": { + "id": { + "type": "string" + }, + "memoryCitation": { + "anyOf": [ + { + "$ref": "#/definitions/MemoryCitation" + }, + { + "type": "null" + } + ], + "default": null + }, + "phase": { + "anyOf": [ + { + "$ref": "#/definitions/MessagePhase" + }, + { + "type": "null" + } + ], + "default": null + }, + "text": { + "type": "string" + }, + "type": { + "enum": [ + "agentMessage" + ], + "title": "AgentMessageThreadItemType", + "type": "string" + } + }, + "required": [ + "id", + "text", + "type" + ], + "title": "AgentMessageThreadItem", + "type": "object" + }, + { + "description": "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", + "properties": { + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "enum": [ + "plan" + ], + "title": "PlanThreadItemType", + "type": "string" + } + }, + "required": [ + "id", + "text", + "type" + ], + "title": "PlanThreadItem", + "type": "object" + }, + { + "properties": { + "content": { + "default": [], + "items": { + "type": "string" + }, + "type": "array" + }, + "id": { + "type": "string" + }, + "summary": { + "default": [], + "items": { + "type": "string" + }, + "type": "array" + }, + "type": { + "enum": [ + "reasoning" + ], + "title": "ReasoningThreadItemType", + "type": "string" + } + }, + "required": [ + "id", + "type" + ], + "title": "ReasoningThreadItem", + "type": "object" + }, + { + "properties": { + "aggregatedOutput": { + "description": "The command's output, aggregated from stdout and stderr.", + "type": [ + "string", + "null" + ] + }, + "command": { + "description": "The command to be executed.", + "type": "string" + }, + "commandActions": { + "description": "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", + "items": { + "$ref": "#/definitions/CommandAction" + }, + "type": "array" + }, + "cwd": { + "allOf": [ + { + "$ref": "#/definitions/LegacyAppPathString" + } + ], + "description": "The command's working directory." + }, + "durationMs": { + "description": "The duration of the command execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "exitCode": { + "description": "The command's exit code.", + "format": "int32", + "type": [ + "integer", + "null" + ] + }, + "id": { + "type": "string" + }, + "pluginId": { + "default": null, + "description": "Trusted first-party plugin id when this command resolves to one plugin script.", + "type": [ + "string", + "null" + ] + }, + "processId": { + "description": "Identifier for the underlying PTY process (when available).", + "type": [ + "string", + "null" + ] + }, + "scriptPath": { + "default": null, + "description": "Safe plugin-relative path when this command resolves to one plugin script.", + "type": [ + "string", + "null" + ] + }, + "source": { + "allOf": [ + { + "$ref": "#/definitions/CommandExecutionSource" + } + ], + "default": "agent" + }, + "status": { + "$ref": "#/definitions/CommandExecutionStatus" + }, + "type": { + "enum": [ + "commandExecution" + ], + "title": "CommandExecutionThreadItemType", + "type": "string" + } + }, + "required": [ + "command", + "commandActions", + "cwd", + "id", + "status", + "type" + ], + "title": "CommandExecutionThreadItem", + "type": "object" + }, + { + "properties": { + "changes": { + "items": { + "$ref": "#/definitions/FileUpdateChange" + }, + "type": "array" + }, + "id": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/PatchApplyStatus" + }, + "type": { + "enum": [ + "fileChange" + ], + "title": "FileChangeThreadItemType", + "type": "string" + } + }, + "required": [ + "changes", + "id", + "status", + "type" + ], + "title": "FileChangeThreadItem", + "type": "object" + }, + { + "properties": { + "appContext": { + "anyOf": [ + { + "$ref": "#/definitions/McpToolCallAppContext" + }, + { + "type": "null" + } + ] + }, + "arguments": true, + "durationMs": { + "description": "The duration of the MCP tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "error": { + "anyOf": [ + { + "$ref": "#/definitions/McpToolCallError" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": "string" + }, + "mcpAppResourceUri": { + "description": "Deprecated: use `appContext.resourceUri` instead.", + "type": [ + "string", + "null" + ] + }, + "pluginId": { + "type": [ + "string", + "null" + ] + }, + "result": { + "anyOf": [ + { + "$ref": "#/definitions/McpToolCallResult" + }, + { + "type": "null" + } + ] + }, + "server": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/McpToolCallStatus" + }, + "tool": { + "type": "string" + }, + "type": { + "enum": [ + "mcpToolCall" + ], + "title": "McpToolCallThreadItemType", + "type": "string" + } + }, + "required": [ + "arguments", + "id", + "server", + "status", + "tool", + "type" + ], + "title": "McpToolCallThreadItem", + "type": "object" + }, + { + "properties": { + "arguments": true, + "contentItems": { + "items": { + "$ref": "#/definitions/DynamicToolCallOutputContentItem" + }, + "type": [ + "array", + "null" + ] + }, + "durationMs": { + "description": "The duration of the dynamic tool call in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "id": { + "type": "string" + }, + "namespace": { + "type": [ + "string", + "null" + ] + }, + "status": { + "$ref": "#/definitions/DynamicToolCallStatus" + }, + "success": { + "type": [ + "boolean", + "null" + ] + }, + "tool": { + "type": "string" + }, + "type": { + "enum": [ + "dynamicToolCall" + ], + "title": "DynamicToolCallThreadItemType", + "type": "string" + } + }, + "required": [ + "arguments", + "id", + "status", + "tool", + "type" + ], + "title": "DynamicToolCallThreadItem", + "type": "object" + }, + { + "properties": { + "agentsStates": { + "additionalProperties": { + "$ref": "#/definitions/CollabAgentState" + }, + "description": "Last known status of the target agents, when available.", + "type": "object" + }, + "id": { + "description": "Unique identifier for this collab tool call.", + "type": "string" + }, + "model": { + "description": "Model requested for the spawned agent, when applicable.", + "type": [ + "string", + "null" + ] + }, + "prompt": { + "description": "Prompt text sent as part of the collab tool call, when available.", + "type": [ + "string", + "null" + ] + }, + "reasoningEffort": { + "anyOf": [ + { + "$ref": "#/definitions/ReasoningEffort" + }, + { + "type": "null" + } + ], + "description": "Reasoning effort requested for the spawned agent, when applicable." + }, + "receiverThreadIds": { + "description": "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", + "items": { + "type": "string" + }, + "type": "array" + }, + "senderThreadId": { + "description": "Thread ID of the agent issuing the collab request.", + "type": "string" + }, + "status": { + "allOf": [ + { + "$ref": "#/definitions/CollabAgentToolCallStatus" + } + ], + "description": "Current status of the collab tool call." + }, + "tool": { + "allOf": [ + { + "$ref": "#/definitions/CollabAgentTool" + } + ], + "description": "Name of the collab tool that was invoked." + }, + "type": { + "enum": [ + "collabAgentToolCall" + ], + "title": "CollabAgentToolCallThreadItemType", + "type": "string" + } + }, + "required": [ + "agentsStates", + "id", + "receiverThreadIds", + "senderThreadId", + "status", + "tool", + "type" + ], + "title": "CollabAgentToolCallThreadItem", + "type": "object" + }, + { + "properties": { + "agentPath": { + "type": "string" + }, + "agentThreadId": { + "type": "string" + }, + "id": { + "type": "string" + }, + "kind": { + "$ref": "#/definitions/SubAgentActivityKind" + }, + "type": { + "enum": [ + "subAgentActivity" + ], + "title": "SubAgentActivityThreadItemType", + "type": "string" + } + }, + "required": [ + "agentPath", + "agentThreadId", + "id", + "kind", + "type" + ], + "title": "SubAgentActivityThreadItem", + "type": "object" + }, + { + "properties": { + "action": { + "anyOf": [ + { + "$ref": "#/definitions/WebSearchAction" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": "string" + }, + "query": { + "type": "string" + }, + "results": { + "default": null, + "description": "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", + "items": true, + "type": [ + "array", + "null" + ] + }, + "type": { + "enum": [ + "webSearch" + ], + "title": "WebSearchThreadItemType", + "type": "string" + } + }, + "required": [ + "id", + "query", + "type" + ], + "title": "WebSearchThreadItem", + "type": "object" + }, + { + "properties": { + "id": { + "type": "string" + }, + "path": { + "$ref": "#/definitions/LegacyAppPathString" + }, + "type": { + "enum": [ + "imageView" + ], + "title": "ImageViewThreadItemType", + "type": "string" + } + }, + "required": [ + "id", + "path", + "type" + ], + "title": "ImageViewThreadItem", + "type": "object" + }, + { + "description": "Display item emitted by the interruptible `clock.sleep` tool.", + "properties": { + "durationMs": { + "format": "uint64", + "minimum": 0, + "type": "integer" + }, + "id": { + "type": "string" + }, + "type": { + "enum": [ + "sleep" + ], + "title": "SleepThreadItemType", + "type": "string" + } + }, + "required": [ + "durationMs", + "id", + "type" + ], + "title": "SleepThreadItem", + "type": "object" + }, + { + "properties": { + "id": { + "type": "string" + }, + "result": { + "type": "string" + }, + "revisedPrompt": { + "type": [ + "string", + "null" + ] + }, + "savedPath": { + "anyOf": [ + { + "$ref": "#/definitions/AbsolutePathBuf" + }, + { + "type": "null" + } + ] + }, + "status": { + "type": "string" + }, + "type": { + "enum": [ + "imageGeneration" + ], + "title": "ImageGenerationThreadItemType", + "type": "string" + } + }, + "required": [ + "id", + "result", + "status", + "type" + ], + "title": "ImageGenerationThreadItem", + "type": "object" + }, + { + "properties": { + "id": { + "type": "string" + }, + "review": { + "type": "string" + }, + "type": { + "enum": [ + "enteredReviewMode" + ], + "title": "EnteredReviewModeThreadItemType", + "type": "string" + } + }, + "required": [ + "id", + "review", + "type" + ], + "title": "EnteredReviewModeThreadItem", + "type": "object" + }, + { + "properties": { + "id": { + "type": "string" + }, + "review": { + "type": "string" + }, + "type": { + "enum": [ + "exitedReviewMode" + ], + "title": "ExitedReviewModeThreadItemType", + "type": "string" + } + }, + "required": [ + "id", + "review", + "type" + ], + "title": "ExitedReviewModeThreadItem", + "type": "object" + }, + { + "properties": { + "id": { + "type": "string" + }, + "type": { + "enum": [ + "contextCompaction" + ], + "title": "ContextCompactionThreadItemType", + "type": "string" + } + }, + "required": [ + "id", + "type" + ], + "title": "ContextCompactionThreadItem", + "type": "object" + } + ] + }, + "ThreadSource": { + "type": "string" + }, + "ThreadStatus": { + "oneOf": [ + { + "properties": { + "type": { + "enum": [ + "notLoaded" + ], + "title": "NotLoadedThreadStatusType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "NotLoadedThreadStatus", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "idle" + ], + "title": "IdleThreadStatusType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "IdleThreadStatus", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "systemError" + ], + "title": "SystemErrorThreadStatusType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "SystemErrorThreadStatus", + "type": "object" + }, + { + "properties": { + "activeFlags": { + "items": { + "$ref": "#/definitions/ThreadActiveFlag" + }, + "type": "array" + }, + "type": { + "enum": [ + "active" + ], + "title": "ActiveThreadStatusType", + "type": "string" + } + }, + "required": [ + "activeFlags", + "type" + ], + "title": "ActiveThreadStatus", + "type": "object" + } + ] + }, + "Turn": { + "properties": { + "completedAt": { + "description": "Unix timestamp (in seconds) when the turn completed.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "Duration between turn start and completion in milliseconds, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "error": { + "anyOf": [ + { + "$ref": "#/definitions/TurnError" + }, + { + "type": "null" + } + ], + "description": "Only populated when the Turn's status is failed." + }, + "id": { + "description": "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", + "type": "string" + }, + "items": { + "description": "Thread items currently included in this turn payload.", + "items": { + "$ref": "#/definitions/ThreadItem" + }, + "type": "array" + }, + "itemsView": { + "allOf": [ + { + "$ref": "#/definitions/TurnItemsView" + } + ], + "default": "full", + "description": "Describes how much of `items` has been loaded for this turn." + }, + "startedAt": { + "description": "Unix timestamp (in seconds) when the turn started.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "status": { + "$ref": "#/definitions/TurnStatus" + } + }, + "required": [ + "id", + "items", + "status" + ], + "type": "object" + }, + "TurnError": { + "properties": { + "additionalDetails": { + "default": null, + "type": [ + "string", + "null" + ] + }, + "codexErrorInfo": { + "anyOf": [ + { + "$ref": "#/definitions/CodexErrorInfo" + }, + { + "type": "null" + } + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ], + "type": "object" + }, + "TurnItemsView": { + "oneOf": [ + { + "description": "`items` was not loaded for this turn. The field is intentionally empty.", + "enum": [ + "notLoaded" + ], + "type": "string" + }, + { + "description": "`items` contains only a display summary for this turn.", + "enum": [ + "summary" + ], + "type": "string" + }, + { + "description": "`items` contains every ThreadItem available from persisted app-server history for this turn.", + "enum": [ + "full" + ], + "type": "string" + } + ] + }, + "TurnStatus": { + "enum": [ + "completed", + "interrupted", + "failed", + "inProgress" + ], + "type": "string" + }, + "TurnsPage": { + "properties": { + "backwardsCursor": { + "type": [ + "string", + "null" + ] + }, + "data": { + "items": { + "$ref": "#/definitions/Turn" + }, + "type": "array" + }, + "nextCursor": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "data" + ], + "type": "object" + }, + "UserInput": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "text_elements": { + "default": [], + "description": "UI-defined spans within `text` used to render or persist special elements.", + "items": { + "$ref": "#/definitions/TextElement" + }, + "type": "array" + }, + "type": { + "enum": [ + "text" + ], + "title": "TextUserInputType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "TextUserInput", + "type": "object" + }, + { + "properties": { + "detail": { + "anyOf": [ + { + "$ref": "#/definitions/ImageDetail" + }, + { + "type": "null" + } + ], + "default": null + }, + "type": { + "enum": [ + "image" + ], + "title": "ImageUserInputType", + "type": "string" + }, + "url": { + "type": "string" + } + }, + "required": [ + "type", + "url" + ], + "title": "ImageUserInput", + "type": "object" + }, + { + "properties": { + "detail": { + "anyOf": [ + { + "$ref": "#/definitions/ImageDetail" + }, + { + "type": "null" + } + ], + "default": null + }, + "path": { + "type": "string" + }, + "type": { + "enum": [ + "localImage" + ], + "title": "LocalImageUserInputType", + "type": "string" + } + }, + "required": [ + "path", + "type" + ], + "title": "LocalImageUserInput", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "audio" + ], + "title": "AudioUserInputType", + "type": "string" + }, + "url": { + "type": "string" + } + }, + "required": [ + "type", + "url" + ], + "title": "AudioUserInput", + "type": "object" + }, + { + "properties": { + "path": { + "type": "string" + }, + "type": { + "enum": [ + "localAudio" + ], + "title": "LocalAudioUserInputType", + "type": "string" + } + }, + "required": [ + "path", + "type" + ], + "title": "LocalAudioUserInput", + "type": "object" + }, + { + "properties": { + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "type": { + "enum": [ + "skill" + ], + "title": "SkillUserInputType", + "type": "string" + } + }, + "required": [ + "name", + "path", + "type" + ], + "title": "SkillUserInput", + "type": "object" + }, + { + "properties": { + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "type": { + "enum": [ + "mention" + ], + "title": "MentionUserInputType", + "type": "string" + } + }, + "required": [ + "name", + "path", + "type" + ], + "title": "MentionUserInput", + "type": "object" + } + ] + }, + "WebSearchAction": { + "oneOf": [ + { + "properties": { + "queries": { + "items": { + "type": "string" + }, + "type": [ + "array", + "null" + ] + }, + "query": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "search" + ], + "title": "SearchWebSearchActionType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "SearchWebSearchAction", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "openPage" + ], + "title": "OpenPageWebSearchActionType", + "type": "string" + }, + "url": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type" + ], + "title": "OpenPageWebSearchAction", + "type": "object" + }, + { + "properties": { + "pattern": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "findInPage" + ], + "title": "FindInPageWebSearchActionType", + "type": "string" + }, + "url": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type" + ], + "title": "FindInPageWebSearchAction", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "other" + ], + "title": "OtherWebSearchActionType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "OtherWebSearchAction", + "type": "object" + } + ] + } + }, + "title": "CodexAppServerProtocolDefinitions", + "type": "object" +} diff --git a/extensions/codex/src/app-server/protocol-generated/json/v2/ErrorNotification.json b/extensions/codex/src/app-server/protocol-generated/json/v2/ErrorNotification.json index 239ce068efcd..176cd3aedf35 100644 --- a/extensions/codex/src/app-server/protocol-generated/json/v2/ErrorNotification.json +++ b/extensions/codex/src/app-server/protocol-generated/json/v2/ErrorNotification.json @@ -1,183 +1,8 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "CodexErrorInfo": { - "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "httpConnectionFailed": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "httpConnectionFailed" - ], - "title": "HttpConnectionFailedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Failed to connect to the response SSE stream.", - "properties": { - "responseStreamConnectionFailed": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseStreamConnectionFailed" - ], - "title": "ResponseStreamConnectionFailedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "The response SSE stream disconnected in the middle of a turn before completion.", - "properties": { - "responseStreamDisconnected": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseStreamDisconnected" - ], - "title": "ResponseStreamDisconnectedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Reached the retry limit for responses.", - "properties": { - "responseTooManyFailedAttempts": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseTooManyFailedAttempts" - ], - "title": "ResponseTooManyFailedAttemptsCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", - "properties": { - "activeTurnNotSteerable": { - "properties": { - "turnKind": { - "$ref": "#/definitions/NonSteerableTurnKind" - } - }, - "required": [ - "turnKind" - ], - "type": "object" - } - }, - "required": [ - "activeTurnNotSteerable" - ], - "title": "ActiveTurnNotSteerableCodexErrorInfo", - "type": "object" - }, - { - "enum": [ - "contextWindowExceeded", - "sessionBudgetExceeded", - "usageLimitExceeded", - "serverOverloaded", - "cyberPolicy", - "internalServerError", - "unauthorized", - "badRequest", - "threadRollbackFailed", - "sandboxError", - "other" - ], - "type": "string" - } - ] - }, - "NonSteerableTurnKind": { - "enum": [ - "review", - "compact" - ], - "type": "string" - }, - "TurnError": { - "properties": { - "additionalDetails": { - "default": null, - "type": [ - "string", - "null" - ] - }, - "codexErrorInfo": { - "anyOf": [ - { - "$ref": "#/definitions/CodexErrorInfo" - }, - { - "type": "null" - } - ] - }, - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - }, "properties": { "error": { - "$ref": "#/definitions/TurnError" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/TurnError" }, "threadId": { "type": "string" diff --git a/extensions/codex/src/app-server/protocol-generated/json/v2/GetAccountResponse.json b/extensions/codex/src/app-server/protocol-generated/json/v2/GetAccountResponse.json index fed423bb8d77..8de91b709332 100644 --- a/extensions/codex/src/app-server/protocol-generated/json/v2/GetAccountResponse.json +++ b/extensions/codex/src/app-server/protocol-generated/json/v2/GetAccountResponse.json @@ -1,97 +1,10 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "Account": { - "oneOf": [ - { - "properties": { - "type": { - "enum": [ - "apiKey" - ], - "title": "ApiKeyAccountType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "ApiKeyAccount", - "type": "object" - }, - { - "properties": { - "email": { - "type": [ - "string", - "null" - ] - }, - "planType": { - "$ref": "#/definitions/PlanType" - }, - "type": { - "enum": [ - "chatgpt" - ], - "title": "ChatgptAccountType", - "type": "string" - } - }, - "required": [ - "email", - "planType", - "type" - ], - "title": "ChatgptAccount", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "amazonBedrock" - ], - "title": "AmazonBedrockAccountType", - "type": "string" - }, - "usesCodexManagedCredentials": { - "default": false, - "type": "boolean" - } - }, - "required": [ - "type" - ], - "title": "AmazonBedrockAccount", - "type": "object" - } - ] - }, - "PlanType": { - "enum": [ - "free", - "go", - "plus", - "pro", - "prolite", - "team", - "self_serve_business_usage_based", - "business", - "ent26", - "enterprise_cbp_usage_based", - "enterprise", - "edu", - "unknown" - ], - "type": "string" - } - }, "properties": { "account": { "anyOf": [ { - "$ref": "#/definitions/Account" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Account" }, { "type": "null" diff --git a/extensions/codex/src/app-server/protocol-generated/json/v2/ModelListResponse.json b/extensions/codex/src/app-server/protocol-generated/json/v2/ModelListResponse.json index 992bfba02a16..4008269a4ee9 100644 --- a/extensions/codex/src/app-server/protocol-generated/json/v2/ModelListResponse.json +++ b/extensions/codex/src/app-server/protocol-generated/json/v2/ModelListResponse.json @@ -1,221 +1,9 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "InputModality": { - "description": "Canonical user-input modality tags advertised by a model.", - "oneOf": [ - { - "description": "Plain text turns and tool payloads.", - "enum": [ - "text" - ], - "type": "string" - }, - { - "description": "Image attachments included in user turns.", - "enum": [ - "image" - ], - "type": "string" - }, - { - "description": "Audio attachments included in user turns.", - "enum": [ - "audio" - ], - "type": "string" - } - ] - }, - "Model": { - "properties": { - "additionalSpeedTiers": { - "default": [], - "description": "Deprecated: use `serviceTiers` instead.", - "items": { - "type": "string" - }, - "type": "array" - }, - "availabilityNux": { - "anyOf": [ - { - "$ref": "#/definitions/ModelAvailabilityNux" - }, - { - "type": "null" - } - ] - }, - "defaultReasoningEffort": { - "$ref": "#/definitions/ReasoningEffort" - }, - "defaultServiceTier": { - "default": null, - "description": "Catalog default service tier id for this model, when one is configured.", - "type": [ - "string", - "null" - ] - }, - "description": { - "type": "string" - }, - "displayName": { - "type": "string" - }, - "hidden": { - "type": "boolean" - }, - "id": { - "type": "string" - }, - "inputModalities": { - "default": [ - "text", - "image" - ], - "items": { - "$ref": "#/definitions/InputModality" - }, - "type": "array" - }, - "isDefault": { - "type": "boolean" - }, - "model": { - "type": "string" - }, - "serviceTiers": { - "default": [], - "items": { - "$ref": "#/definitions/ModelServiceTier" - }, - "type": "array" - }, - "supportedReasoningEfforts": { - "items": { - "$ref": "#/definitions/ReasoningEffortOption" - }, - "type": "array" - }, - "supportsPersonality": { - "default": false, - "type": "boolean" - }, - "upgrade": { - "type": [ - "string", - "null" - ] - }, - "upgradeInfo": { - "anyOf": [ - { - "$ref": "#/definitions/ModelUpgradeInfo" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "defaultReasoningEffort", - "description", - "displayName", - "hidden", - "id", - "isDefault", - "model", - "supportedReasoningEfforts" - ], - "type": "object" - }, - "ModelAvailabilityNux": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - }, - "ModelServiceTier": { - "properties": { - "description": { - "type": "string" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "description", - "id", - "name" - ], - "type": "object" - }, - "ModelUpgradeInfo": { - "properties": { - "migrationMarkdown": { - "type": [ - "string", - "null" - ] - }, - "model": { - "type": "string" - }, - "modelLink": { - "type": [ - "string", - "null" - ] - }, - "upgradeCopy": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "model" - ], - "type": "object" - }, - "ReasoningEffort": { - "description": "A non-empty reasoning effort value advertised by the model.", - "minLength": 1, - "type": "string" - }, - "ReasoningEffortOption": { - "properties": { - "description": { - "type": "string" - }, - "reasoningEffort": { - "$ref": "#/definitions/ReasoningEffort" - } - }, - "required": [ - "description", - "reasoningEffort" - ], - "type": "object" - } - }, "properties": { "data": { "items": { - "$ref": "#/definitions/Model" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Model" }, "type": "array" }, diff --git a/extensions/codex/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json b/extensions/codex/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json index c53fdaa9e3bf..2718262c0f8b 100644 --- a/extensions/codex/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json +++ b/extensions/codex/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json @@ -1,2555 +1,10 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "AbsolutePathBuf": { - "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - "type": "string" - }, - "ActivePermissionProfile": { - "properties": { - "extends": { - "default": null, - "description": "Parent profile identifier from the selected permissions profile's `extends` setting, when present.", - "type": [ - "string", - "null" - ] - }, - "id": { - "description": "Identifier from `default_permissions` or the implicit built-in default, such as `:workspace` or a user-defined `[permissions.]` profile.", - "type": "string" - } - }, - "required": [ - "id" - ], - "type": "object" - }, - "AgentPath": { - "type": "string" - }, - "ApprovalsReviewer": { - "description": "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", - "enum": [ - "user", - "auto_review", - "guardian_subagent" - ], - "type": "string" - }, - "AskForApproval": { - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "granular": { - "properties": { - "mcp_elicitations": { - "type": "boolean" - }, - "request_permissions": { - "default": false, - "type": "boolean" - }, - "rules": { - "type": "boolean" - }, - "sandbox_approval": { - "type": "boolean" - }, - "skill_approval": { - "default": false, - "type": "boolean" - } - }, - "required": [ - "mcp_elicitations", - "rules", - "sandbox_approval" - ], - "type": "object" - } - }, - "required": [ - "granular" - ], - "title": "GranularAskForApproval", - "type": "object" - }, - { - "enum": [ - "untrusted", - "on-request", - "never" - ], - "type": "string" - } - ] - }, - "ByteRange": { - "properties": { - "end": { - "format": "uint", - "minimum": 0, - "type": "integer" - }, - "start": { - "format": "uint", - "minimum": 0, - "type": "integer" - } - }, - "required": [ - "end", - "start" - ], - "type": "object" - }, - "CodexErrorInfo": { - "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "httpConnectionFailed": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "httpConnectionFailed" - ], - "title": "HttpConnectionFailedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Failed to connect to the response SSE stream.", - "properties": { - "responseStreamConnectionFailed": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseStreamConnectionFailed" - ], - "title": "ResponseStreamConnectionFailedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "The response SSE stream disconnected in the middle of a turn before completion.", - "properties": { - "responseStreamDisconnected": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseStreamDisconnected" - ], - "title": "ResponseStreamDisconnectedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Reached the retry limit for responses.", - "properties": { - "responseTooManyFailedAttempts": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseTooManyFailedAttempts" - ], - "title": "ResponseTooManyFailedAttemptsCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", - "properties": { - "activeTurnNotSteerable": { - "properties": { - "turnKind": { - "$ref": "#/definitions/NonSteerableTurnKind" - } - }, - "required": [ - "turnKind" - ], - "type": "object" - } - }, - "required": [ - "activeTurnNotSteerable" - ], - "title": "ActiveTurnNotSteerableCodexErrorInfo", - "type": "object" - }, - { - "enum": [ - "contextWindowExceeded", - "sessionBudgetExceeded", - "usageLimitExceeded", - "serverOverloaded", - "cyberPolicy", - "internalServerError", - "unauthorized", - "badRequest", - "threadRollbackFailed", - "sandboxError", - "other" - ], - "type": "string" - } - ] - }, - "CollabAgentState": { - "properties": { - "message": { - "type": [ - "string", - "null" - ] - }, - "status": { - "$ref": "#/definitions/CollabAgentStatus" - } - }, - "required": [ - "status" - ], - "type": "object" - }, - "CollabAgentStatus": { - "enum": [ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound" - ], - "type": "string" - }, - "CollabAgentTool": { - "enum": [ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent" - ], - "type": "string" - }, - "CollabAgentToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "CommandAction": { - "oneOf": [ - { - "properties": { - "command": { - "type": "string" - }, - "name": { - "type": "string" - }, - "path": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "type": { - "enum": [ - "read" - ], - "title": "ReadCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "name", - "path", - "type" - ], - "title": "ReadCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "path": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "listFiles" - ], - "title": "ListFilesCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "ListFilesCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "path": { - "type": [ - "string", - "null" - ] - }, - "query": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "search" - ], - "title": "SearchCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "SearchCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "type": { - "enum": [ - "unknown" - ], - "title": "UnknownCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "UnknownCommandAction", - "type": "object" - } - ] - }, - "CommandExecutionSource": { - "enum": [ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction" - ], - "type": "string" - }, - "CommandExecutionStatus": { - "enum": [ - "inProgress", - "completed", - "failed", - "declined" - ], - "type": "string" - }, - "DynamicToolCallOutputContentItem": { - "oneOf": [ - { - "properties": { - "text": { - "type": "string" - }, - "type": { - "enum": [ - "inputText" - ], - "title": "InputTextDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "text", - "type" - ], - "title": "InputTextDynamicToolCallOutputContentItem", - "type": "object" - }, - { - "properties": { - "imageUrl": { - "type": "string" - }, - "type": { - "enum": [ - "inputImage" - ], - "title": "InputImageDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "imageUrl", - "type" - ], - "title": "InputImageDynamicToolCallOutputContentItem", - "type": "object" - }, - { - "properties": { - "audioUrl": { - "type": "string" - }, - "type": { - "enum": [ - "inputAudio" - ], - "title": "InputAudioDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "audioUrl", - "type" - ], - "title": "InputAudioDynamicToolCallOutputContentItem", - "type": "object" - } - ] - }, - "DynamicToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "FileUpdateChange": { - "properties": { - "diff": { - "type": "string" - }, - "kind": { - "$ref": "#/definitions/PatchChangeKind" - }, - "path": { - "type": "string" - } - }, - "required": [ - "diff", - "kind", - "path" - ], - "type": "object" - }, - "GitInfo": { - "properties": { - "branch": { - "type": [ - "string", - "null" - ] - }, - "originUrl": { - "type": [ - "string", - "null" - ] - }, - "sha": { - "type": [ - "string", - "null" - ] - } - }, - "type": "object" - }, - "HookPromptFragment": { - "properties": { - "hookRunId": { - "type": "string" - }, - "text": { - "type": "string" - } - }, - "required": [ - "hookRunId", - "text" - ], - "type": "object" - }, - "ImageDetail": { - "enum": [ - "auto", - "low", - "high", - "original" - ], - "type": "string" - }, - "LegacyAppPathString": { - "type": "string" - }, - "McpToolCallAppContext": { - "properties": { - "actionName": { - "type": [ - "string", - "null" - ] - }, - "appName": { - "type": [ - "string", - "null" - ] - }, - "connectorId": { - "type": "string" - }, - "linkId": { - "type": [ - "string", - "null" - ] - }, - "resourceUri": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "connectorId" - ], - "type": "object" - }, - "McpToolCallError": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - }, - "McpToolCallResult": { - "properties": { - "_meta": true, - "content": { - "items": true, - "type": "array" - }, - "structuredContent": true - }, - "required": [ - "content" - ], - "type": "object" - }, - "McpToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "MemoryCitation": { - "properties": { - "entries": { - "items": { - "$ref": "#/definitions/MemoryCitationEntry" - }, - "type": "array" - }, - "threadIds": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - "required": [ - "entries", - "threadIds" - ], - "type": "object" - }, - "MemoryCitationEntry": { - "properties": { - "lineEnd": { - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "lineStart": { - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "note": { - "type": "string" - }, - "path": { - "type": "string" - } - }, - "required": [ - "lineEnd", - "lineStart", - "note", - "path" - ], - "type": "object" - }, - "MessagePhase": { - "description": "Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as \"phase unknown\" and keep compatibility behavior for legacy models.", - "oneOf": [ - { - "description": "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", - "enum": [ - "commentary" - ], - "type": "string" - }, - { - "description": "The assistant's terminal answer text for the current turn.", - "enum": [ - "final_answer" - ], - "type": "string" - } - ] - }, - "MultiAgentMode": { - "description": "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "custom": { - "type": "string" - } - }, - "required": [ - "custom" - ], - "title": "CustomMultiAgentMode", - "type": "object" - }, - { - "enum": [ - "explicitRequestOnly", - "proactive" - ], - "type": "string" - } - ] - }, - "NetworkAccess": { - "enum": [ - "restricted", - "enabled" - ], - "type": "string" - }, - "NonSteerableTurnKind": { - "enum": [ - "review", - "compact" - ], - "type": "string" - }, - "PatchApplyStatus": { - "enum": [ - "inProgress", - "completed", - "failed", - "declined" - ], - "type": "string" - }, - "PatchChangeKind": { - "oneOf": [ - { - "properties": { - "type": { - "enum": [ - "add" - ], - "title": "AddPatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "AddPatchChangeKind", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "delete" - ], - "title": "DeletePatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "DeletePatchChangeKind", - "type": "object" - }, - { - "properties": { - "move_path": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "update" - ], - "title": "UpdatePatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "UpdatePatchChangeKind", - "type": "object" - } - ] - }, - "ReasoningEffort": { - "description": "A non-empty reasoning effort value advertised by the model.", - "minLength": 1, - "type": "string" - }, - "SandboxPolicy": { - "oneOf": [ - { - "properties": { - "type": { - "enum": [ - "dangerFullAccess" - ], - "title": "DangerFullAccessSandboxPolicyType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "DangerFullAccessSandboxPolicy", - "type": "object" - }, - { - "properties": { - "networkAccess": { - "default": false, - "type": "boolean" - }, - "type": { - "enum": [ - "readOnly" - ], - "title": "ReadOnlySandboxPolicyType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "ReadOnlySandboxPolicy", - "type": "object" - }, - { - "properties": { - "networkAccess": { - "allOf": [ - { - "$ref": "#/definitions/NetworkAccess" - } - ], - "default": "restricted" - }, - "type": { - "enum": [ - "externalSandbox" - ], - "title": "ExternalSandboxSandboxPolicyType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "ExternalSandboxSandboxPolicy", - "type": "object" - }, - { - "properties": { - "excludeSlashTmp": { - "default": false, - "type": "boolean" - }, - "excludeTmpdirEnvVar": { - "default": false, - "type": "boolean" - }, - "networkAccess": { - "default": false, - "type": "boolean" - }, - "type": { - "enum": [ - "workspaceWrite" - ], - "title": "WorkspaceWriteSandboxPolicyType", - "type": "string" - }, - "writableRoots": { - "default": [], - "items": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "type": "array" - } - }, - "required": [ - "type" - ], - "title": "WorkspaceWriteSandboxPolicy", - "type": "object" - } - ] - }, - "SessionSource": { - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "custom": { - "type": "string" - } - }, - "required": [ - "custom" - ], - "title": "CustomSessionSource", - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "subAgent": { - "$ref": "#/definitions/SubAgentSource" - } - }, - "required": [ - "subAgent" - ], - "title": "SubAgentSessionSource", - "type": "object" - }, - { - "enum": [ - "cli", - "vscode", - "exec", - "appServer", - "unknown" - ], - "type": "string" - } - ] - }, - "SubAgentActivityKind": { - "enum": [ - "started", - "interacted", - "interrupted" - ], - "type": "string" - }, - "SubAgentSource": { - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "thread_spawn": { - "properties": { - "agent_nickname": { - "default": null, - "type": [ - "string", - "null" - ] - }, - "agent_path": { - "anyOf": [ - { - "$ref": "#/definitions/AgentPath" - }, - { - "type": "null" - } - ], - "default": null - }, - "agent_role": { - "default": null, - "type": [ - "string", - "null" - ] - }, - "depth": { - "format": "int32", - "type": "integer" - }, - "parent_thread_id": { - "$ref": "#/definitions/ThreadId" - } - }, - "required": [ - "depth", - "parent_thread_id" - ], - "type": "object" - } - }, - "required": [ - "thread_spawn" - ], - "title": "ThreadSpawnSubAgentSource", - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "other": { - "type": "string" - } - }, - "required": [ - "other" - ], - "title": "OtherSubAgentSource", - "type": "object" - }, - { - "enum": [ - "review", - "compact", - "memory_consolidation" - ], - "type": "string" - } - ] - }, - "TextElement": { - "properties": { - "byteRange": { - "allOf": [ - { - "$ref": "#/definitions/ByteRange" - } - ], - "description": "Byte range in the parent `text` buffer that this element occupies." - }, - "placeholder": { - "description": "Optional human-readable placeholder for the element, displayed in the UI.", - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "byteRange" - ], - "type": "object" - }, - "Thread": { - "properties": { - "agentNickname": { - "description": "Optional random unique nickname assigned to an AgentControl-spawned sub-agent.", - "type": [ - "string", - "null" - ] - }, - "agentRole": { - "description": "Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.", - "type": [ - "string", - "null" - ] - }, - "canAcceptDirectInput": { - "description": "Whether the app server accepts direct turn input for this loaded thread. `None` means the capability is unavailable, such as for an unloaded stored thread.", - "type": [ - "boolean", - "null" - ] - }, - "cliVersion": { - "description": "Version of the CLI that created the thread.", - "type": "string" - }, - "createdAt": { - "description": "Unix timestamp (in seconds) when the thread was created.", - "format": "int64", - "type": "integer" - }, - "cwd": { - "allOf": [ - { - "$ref": "#/definitions/AbsolutePathBuf" - } - ], - "description": "Working directory captured for the thread." - }, - "ephemeral": { - "description": "Whether the thread is ephemeral and should not be materialized on disk.", - "type": "boolean" - }, - "extra": { - "anyOf": [ - { - "$ref": "#/definitions/ThreadExtra" - }, - { - "type": "null" - } - ], - "description": "Optional implementation-specific thread data." - }, - "forkedFromId": { - "description": "Source thread id when this thread was created by forking another thread.", - "type": [ - "string", - "null" - ] - }, - "gitInfo": { - "anyOf": [ - { - "$ref": "#/definitions/GitInfo" - }, - { - "type": "null" - } - ], - "description": "Optional Git metadata captured when the thread was created." - }, - "historyMode": { - "allOf": [ - { - "$ref": "#/definitions/ThreadHistoryMode" - } - ], - "default": "legacy", - "description": "Persisted thread history contract selected when this thread was created." - }, - "id": { - "description": "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", - "type": "string" - }, - "isPinned": { - "default": false, - "description": "Whether the thread has been pinned by the user.", - "type": "boolean" - }, - "modelProvider": { - "description": "Model provider used for this thread (for example, 'openai').", - "type": "string" - }, - "name": { - "description": "Optional user-facing thread title.", - "type": [ - "string", - "null" - ] - }, - "parentThreadId": { - "description": "The ID of the parent thread. This will only be set if this thread is a subagent.", - "type": [ - "string", - "null" - ] - }, - "path": { - "description": "[UNSTABLE] Path to the thread on disk.", - "type": [ - "string", - "null" - ] - }, - "preview": { - "description": "Usually the first user message in the thread, if available.", - "type": "string" - }, - "recencyAt": { - "description": "Unix timestamp (in seconds) used for thread recency ordering.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "sessionId": { - "description": "Session id shared by threads that belong to the same session tree.", - "type": "string" - }, - "source": { - "allOf": [ - { - "$ref": "#/definitions/SessionSource" - } - ], - "description": "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.)." - }, - "status": { - "allOf": [ - { - "$ref": "#/definitions/ThreadStatus" - } - ], - "description": "Current runtime status for the thread." - }, - "threadSource": { - "anyOf": [ - { - "$ref": "#/definitions/ThreadSource" - }, - { - "type": "null" - } - ], - "description": "Optional analytics source classification for this thread." - }, - "turns": { - "description": "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", - "items": { - "$ref": "#/definitions/Turn" - }, - "type": "array" - }, - "updatedAt": { - "description": "Unix timestamp (in seconds) when the thread was last updated.", - "format": "int64", - "type": "integer" - } - }, - "required": [ - "cliVersion", - "createdAt", - "cwd", - "ephemeral", - "id", - "modelProvider", - "preview", - "sessionId", - "source", - "status", - "turns", - "updatedAt" - ], - "type": "object" - }, - "ThreadActiveFlag": { - "enum": [ - "waitingOnApproval", - "waitingOnUserInput" - ], - "type": "string" - }, - "ThreadExtra": { - "description": "Extra app-server data for a thread.", - "type": "object" - }, - "ThreadHistoryMode": { - "enum": [ - "legacy", - "paginated" - ], - "type": "string" - }, - "ThreadId": { - "type": "string" - }, - "ThreadItem": { - "oneOf": [ - { - "properties": { - "clientId": { - "type": [ - "string", - "null" - ] - }, - "content": { - "items": { - "$ref": "#/definitions/UserInput" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "userMessage" - ], - "title": "UserMessageThreadItemType", - "type": "string" - } - }, - "required": [ - "content", - "id", - "type" - ], - "title": "UserMessageThreadItem", - "type": "object" - }, - { - "properties": { - "fragments": { - "items": { - "$ref": "#/definitions/HookPromptFragment" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "hookPrompt" - ], - "title": "HookPromptThreadItemType", - "type": "string" - } - }, - "required": [ - "fragments", - "id", - "type" - ], - "title": "HookPromptThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "memoryCitation": { - "anyOf": [ - { - "$ref": "#/definitions/MemoryCitation" - }, - { - "type": "null" - } - ], - "default": null - }, - "phase": { - "anyOf": [ - { - "$ref": "#/definitions/MessagePhase" - }, - { - "type": "null" - } - ], - "default": null - }, - "text": { - "type": "string" - }, - "type": { - "enum": [ - "agentMessage" - ], - "title": "AgentMessageThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "text", - "type" - ], - "title": "AgentMessageThreadItem", - "type": "object" - }, - { - "description": "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", - "properties": { - "id": { - "type": "string" - }, - "text": { - "type": "string" - }, - "type": { - "enum": [ - "plan" - ], - "title": "PlanThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "text", - "type" - ], - "title": "PlanThreadItem", - "type": "object" - }, - { - "properties": { - "content": { - "default": [], - "items": { - "type": "string" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "summary": { - "default": [], - "items": { - "type": "string" - }, - "type": "array" - }, - "type": { - "enum": [ - "reasoning" - ], - "title": "ReasoningThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "type" - ], - "title": "ReasoningThreadItem", - "type": "object" - }, - { - "properties": { - "aggregatedOutput": { - "description": "The command's output, aggregated from stdout and stderr.", - "type": [ - "string", - "null" - ] - }, - "command": { - "description": "The command to be executed.", - "type": "string" - }, - "commandActions": { - "description": "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", - "items": { - "$ref": "#/definitions/CommandAction" - }, - "type": "array" - }, - "cwd": { - "allOf": [ - { - "$ref": "#/definitions/LegacyAppPathString" - } - ], - "description": "The command's working directory." - }, - "durationMs": { - "description": "The duration of the command execution in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "exitCode": { - "description": "The command's exit code.", - "format": "int32", - "type": [ - "integer", - "null" - ] - }, - "id": { - "type": "string" - }, - "pluginId": { - "default": null, - "description": "Trusted first-party plugin id when this command resolves to one plugin script.", - "type": [ - "string", - "null" - ] - }, - "processId": { - "description": "Identifier for the underlying PTY process (when available).", - "type": [ - "string", - "null" - ] - }, - "scriptPath": { - "default": null, - "description": "Safe plugin-relative path when this command resolves to one plugin script.", - "type": [ - "string", - "null" - ] - }, - "source": { - "allOf": [ - { - "$ref": "#/definitions/CommandExecutionSource" - } - ], - "default": "agent" - }, - "status": { - "$ref": "#/definitions/CommandExecutionStatus" - }, - "type": { - "enum": [ - "commandExecution" - ], - "title": "CommandExecutionThreadItemType", - "type": "string" - } - }, - "required": [ - "command", - "commandActions", - "cwd", - "id", - "status", - "type" - ], - "title": "CommandExecutionThreadItem", - "type": "object" - }, - { - "properties": { - "changes": { - "items": { - "$ref": "#/definitions/FileUpdateChange" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/PatchApplyStatus" - }, - "type": { - "enum": [ - "fileChange" - ], - "title": "FileChangeThreadItemType", - "type": "string" - } - }, - "required": [ - "changes", - "id", - "status", - "type" - ], - "title": "FileChangeThreadItem", - "type": "object" - }, - { - "properties": { - "appContext": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallAppContext" - }, - { - "type": "null" - } - ] - }, - "arguments": true, - "durationMs": { - "description": "The duration of the MCP tool call in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "error": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallError" - }, - { - "type": "null" - } - ] - }, - "id": { - "type": "string" - }, - "mcpAppResourceUri": { - "description": "Deprecated: use `appContext.resourceUri` instead.", - "type": [ - "string", - "null" - ] - }, - "pluginId": { - "type": [ - "string", - "null" - ] - }, - "result": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallResult" - }, - { - "type": "null" - } - ] - }, - "server": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/McpToolCallStatus" - }, - "tool": { - "type": "string" - }, - "type": { - "enum": [ - "mcpToolCall" - ], - "title": "McpToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "arguments", - "id", - "server", - "status", - "tool", - "type" - ], - "title": "McpToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "arguments": true, - "contentItems": { - "items": { - "$ref": "#/definitions/DynamicToolCallOutputContentItem" - }, - "type": [ - "array", - "null" - ] - }, - "durationMs": { - "description": "The duration of the dynamic tool call in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "id": { - "type": "string" - }, - "namespace": { - "type": [ - "string", - "null" - ] - }, - "status": { - "$ref": "#/definitions/DynamicToolCallStatus" - }, - "success": { - "type": [ - "boolean", - "null" - ] - }, - "tool": { - "type": "string" - }, - "type": { - "enum": [ - "dynamicToolCall" - ], - "title": "DynamicToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "arguments", - "id", - "status", - "tool", - "type" - ], - "title": "DynamicToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "agentsStates": { - "additionalProperties": { - "$ref": "#/definitions/CollabAgentState" - }, - "description": "Last known status of the target agents, when available.", - "type": "object" - }, - "id": { - "description": "Unique identifier for this collab tool call.", - "type": "string" - }, - "model": { - "description": "Model requested for the spawned agent, when applicable.", - "type": [ - "string", - "null" - ] - }, - "prompt": { - "description": "Prompt text sent as part of the collab tool call, when available.", - "type": [ - "string", - "null" - ] - }, - "reasoningEffort": { - "anyOf": [ - { - "$ref": "#/definitions/ReasoningEffort" - }, - { - "type": "null" - } - ], - "description": "Reasoning effort requested for the spawned agent, when applicable." - }, - "receiverThreadIds": { - "description": "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", - "items": { - "type": "string" - }, - "type": "array" - }, - "senderThreadId": { - "description": "Thread ID of the agent issuing the collab request.", - "type": "string" - }, - "status": { - "allOf": [ - { - "$ref": "#/definitions/CollabAgentToolCallStatus" - } - ], - "description": "Current status of the collab tool call." - }, - "tool": { - "allOf": [ - { - "$ref": "#/definitions/CollabAgentTool" - } - ], - "description": "Name of the collab tool that was invoked." - }, - "type": { - "enum": [ - "collabAgentToolCall" - ], - "title": "CollabAgentToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "agentsStates", - "id", - "receiverThreadIds", - "senderThreadId", - "status", - "tool", - "type" - ], - "title": "CollabAgentToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "agentPath": { - "type": "string" - }, - "agentThreadId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kind": { - "$ref": "#/definitions/SubAgentActivityKind" - }, - "type": { - "enum": [ - "subAgentActivity" - ], - "title": "SubAgentActivityThreadItemType", - "type": "string" - } - }, - "required": [ - "agentPath", - "agentThreadId", - "id", - "kind", - "type" - ], - "title": "SubAgentActivityThreadItem", - "type": "object" - }, - { - "properties": { - "action": { - "anyOf": [ - { - "$ref": "#/definitions/WebSearchAction" - }, - { - "type": "null" - } - ] - }, - "id": { - "type": "string" - }, - "query": { - "type": "string" - }, - "results": { - "default": null, - "description": "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", - "items": true, - "type": [ - "array", - "null" - ] - }, - "type": { - "enum": [ - "webSearch" - ], - "title": "WebSearchThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "query", - "type" - ], - "title": "WebSearchThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "path": { - "$ref": "#/definitions/LegacyAppPathString" - }, - "type": { - "enum": [ - "imageView" - ], - "title": "ImageViewThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "path", - "type" - ], - "title": "ImageViewThreadItem", - "type": "object" - }, - { - "description": "Display item emitted by the interruptible `clock.sleep` tool.", - "properties": { - "durationMs": { - "format": "uint64", - "minimum": 0, - "type": "integer" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "sleep" - ], - "title": "SleepThreadItemType", - "type": "string" - } - }, - "required": [ - "durationMs", - "id", - "type" - ], - "title": "SleepThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "result": { - "type": "string" - }, - "revisedPrompt": { - "type": [ - "string", - "null" - ] - }, - "savedPath": { - "anyOf": [ - { - "$ref": "#/definitions/AbsolutePathBuf" - }, - { - "type": "null" - } - ] - }, - "status": { - "type": "string" - }, - "type": { - "enum": [ - "imageGeneration" - ], - "title": "ImageGenerationThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "result", - "status", - "type" - ], - "title": "ImageGenerationThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "review": { - "type": "string" - }, - "type": { - "enum": [ - "enteredReviewMode" - ], - "title": "EnteredReviewModeThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "review", - "type" - ], - "title": "EnteredReviewModeThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "review": { - "type": "string" - }, - "type": { - "enum": [ - "exitedReviewMode" - ], - "title": "ExitedReviewModeThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "review", - "type" - ], - "title": "ExitedReviewModeThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "type": { - "enum": [ - "contextCompaction" - ], - "title": "ContextCompactionThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "type" - ], - "title": "ContextCompactionThreadItem", - "type": "object" - } - ] - }, - "ThreadSource": { - "type": "string" - }, - "ThreadStatus": { - "oneOf": [ - { - "properties": { - "type": { - "enum": [ - "notLoaded" - ], - "title": "NotLoadedThreadStatusType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "NotLoadedThreadStatus", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "idle" - ], - "title": "IdleThreadStatusType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "IdleThreadStatus", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "systemError" - ], - "title": "SystemErrorThreadStatusType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "SystemErrorThreadStatus", - "type": "object" - }, - { - "properties": { - "activeFlags": { - "items": { - "$ref": "#/definitions/ThreadActiveFlag" - }, - "type": "array" - }, - "type": { - "enum": [ - "active" - ], - "title": "ActiveThreadStatusType", - "type": "string" - } - }, - "required": [ - "activeFlags", - "type" - ], - "title": "ActiveThreadStatus", - "type": "object" - } - ] - }, - "Turn": { - "properties": { - "completedAt": { - "description": "Unix timestamp (in seconds) when the turn completed.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "durationMs": { - "description": "Duration between turn start and completion in milliseconds, if known.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "error": { - "anyOf": [ - { - "$ref": "#/definitions/TurnError" - }, - { - "type": "null" - } - ], - "description": "Only populated when the Turn's status is failed." - }, - "id": { - "description": "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", - "type": "string" - }, - "items": { - "description": "Thread items currently included in this turn payload.", - "items": { - "$ref": "#/definitions/ThreadItem" - }, - "type": "array" - }, - "itemsView": { - "allOf": [ - { - "$ref": "#/definitions/TurnItemsView" - } - ], - "default": "full", - "description": "Describes how much of `items` has been loaded for this turn." - }, - "startedAt": { - "description": "Unix timestamp (in seconds) when the turn started.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "status": { - "$ref": "#/definitions/TurnStatus" - } - }, - "required": [ - "id", - "items", - "status" - ], - "type": "object" - }, - "TurnError": { - "properties": { - "additionalDetails": { - "default": null, - "type": [ - "string", - "null" - ] - }, - "codexErrorInfo": { - "anyOf": [ - { - "$ref": "#/definitions/CodexErrorInfo" - }, - { - "type": "null" - } - ] - }, - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - }, - "TurnItemsView": { - "oneOf": [ - { - "description": "`items` was not loaded for this turn. The field is intentionally empty.", - "enum": [ - "notLoaded" - ], - "type": "string" - }, - { - "description": "`items` contains only a display summary for this turn.", - "enum": [ - "summary" - ], - "type": "string" - }, - { - "description": "`items` contains every ThreadItem available from persisted app-server history for this turn.", - "enum": [ - "full" - ], - "type": "string" - } - ] - }, - "TurnStatus": { - "enum": [ - "completed", - "interrupted", - "failed", - "inProgress" - ], - "type": "string" - }, - "TurnsPage": { - "properties": { - "backwardsCursor": { - "type": [ - "string", - "null" - ] - }, - "data": { - "items": { - "$ref": "#/definitions/Turn" - }, - "type": "array" - }, - "nextCursor": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "data" - ], - "type": "object" - }, - "UserInput": { - "oneOf": [ - { - "properties": { - "text": { - "type": "string" - }, - "text_elements": { - "default": [], - "description": "UI-defined spans within `text` used to render or persist special elements.", - "items": { - "$ref": "#/definitions/TextElement" - }, - "type": "array" - }, - "type": { - "enum": [ - "text" - ], - "title": "TextUserInputType", - "type": "string" - } - }, - "required": [ - "text", - "type" - ], - "title": "TextUserInput", - "type": "object" - }, - { - "properties": { - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/ImageDetail" - }, - { - "type": "null" - } - ], - "default": null - }, - "type": { - "enum": [ - "image" - ], - "title": "ImageUserInputType", - "type": "string" - }, - "url": { - "type": "string" - } - }, - "required": [ - "type", - "url" - ], - "title": "ImageUserInput", - "type": "object" - }, - { - "properties": { - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/ImageDetail" - }, - { - "type": "null" - } - ], - "default": null - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "localImage" - ], - "title": "LocalImageUserInputType", - "type": "string" - } - }, - "required": [ - "path", - "type" - ], - "title": "LocalImageUserInput", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "audio" - ], - "title": "AudioUserInputType", - "type": "string" - }, - "url": { - "type": "string" - } - }, - "required": [ - "type", - "url" - ], - "title": "AudioUserInput", - "type": "object" - }, - { - "properties": { - "path": { - "type": "string" - }, - "type": { - "enum": [ - "localAudio" - ], - "title": "LocalAudioUserInputType", - "type": "string" - } - }, - "required": [ - "path", - "type" - ], - "title": "LocalAudioUserInput", - "type": "object" - }, - { - "properties": { - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "skill" - ], - "title": "SkillUserInputType", - "type": "string" - } - }, - "required": [ - "name", - "path", - "type" - ], - "title": "SkillUserInput", - "type": "object" - }, - { - "properties": { - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "mention" - ], - "title": "MentionUserInputType", - "type": "string" - } - }, - "required": [ - "name", - "path", - "type" - ], - "title": "MentionUserInput", - "type": "object" - } - ] - }, - "WebSearchAction": { - "oneOf": [ - { - "properties": { - "queries": { - "items": { - "type": "string" - }, - "type": [ - "array", - "null" - ] - }, - "query": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "search" - ], - "title": "SearchWebSearchActionType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "SearchWebSearchAction", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "openPage" - ], - "title": "OpenPageWebSearchActionType", - "type": "string" - }, - "url": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type" - ], - "title": "OpenPageWebSearchAction", - "type": "object" - }, - { - "properties": { - "pattern": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "findInPage" - ], - "title": "FindInPageWebSearchActionType", - "type": "string" - }, - "url": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type" - ], - "title": "FindInPageWebSearchAction", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "other" - ], - "title": "OtherWebSearchActionType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "OtherWebSearchAction", - "type": "object" - } - ] - } - }, "properties": { "activePermissionProfile": { "anyOf": [ { - "$ref": "#/definitions/ActivePermissionProfile" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ActivePermissionProfile" }, { "type": "null" @@ -2559,23 +14,23 @@ "description": "Named or implicit built-in profile that produced the active permissions, when known." }, "approvalPolicy": { - "$ref": "#/definitions/AskForApproval" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AskForApproval" }, "approvalsReviewer": { "allOf": [ { - "$ref": "#/definitions/ApprovalsReviewer" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ApprovalsReviewer" } ], "description": "Reviewer currently used for approval requests on this thread." }, "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AbsolutePathBuf" }, "initialTurnsPage": { "anyOf": [ { - "$ref": "#/definitions/TurnsPage" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/TurnsPage" }, { "type": "null" @@ -2588,7 +43,7 @@ "default": [], "description": "Environment-native paths to instruction source files currently loaded for this thread.", "items": { - "$ref": "#/definitions/LegacyAppPathString" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/LegacyAppPathString" }, "type": "array" }, @@ -2609,7 +64,7 @@ "multiAgentMode": { "allOf": [ { - "$ref": "#/definitions/MultiAgentMode" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/MultiAgentMode" } ], "default": "explicitRequestOnly", @@ -2618,7 +73,7 @@ "reasoningEffort": { "anyOf": [ { - "$ref": "#/definitions/ReasoningEffort" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ReasoningEffort" }, { "type": "null" @@ -2629,14 +84,14 @@ "default": [], "description": "Thread-scoped runtime workspace roots used to materialize `:workspace_roots`.", "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AbsolutePathBuf" }, "type": "array" }, "sandbox": { "allOf": [ { - "$ref": "#/definitions/SandboxPolicy" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/SandboxPolicy" } ], "description": "Legacy sandbox policy retained for compatibility. Experimental clients should prefer `activePermissionProfile` for profile provenance." @@ -2648,7 +103,7 @@ ] }, "thread": { - "$ref": "#/definitions/Thread" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Thread" }, "turnsBackwardsCursor": { "default": null, diff --git a/extensions/codex/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json b/extensions/codex/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json index e6c8a3ec3ac3..cbec3fd9b6af 100644 --- a/extensions/codex/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json +++ b/extensions/codex/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json @@ -1,2529 +1,10 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "AbsolutePathBuf": { - "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - "type": "string" - }, - "ActivePermissionProfile": { - "properties": { - "extends": { - "default": null, - "description": "Parent profile identifier from the selected permissions profile's `extends` setting, when present.", - "type": [ - "string", - "null" - ] - }, - "id": { - "description": "Identifier from `default_permissions` or the implicit built-in default, such as `:workspace` or a user-defined `[permissions.]` profile.", - "type": "string" - } - }, - "required": [ - "id" - ], - "type": "object" - }, - "AgentPath": { - "type": "string" - }, - "ApprovalsReviewer": { - "description": "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.", - "enum": [ - "user", - "auto_review", - "guardian_subagent" - ], - "type": "string" - }, - "AskForApproval": { - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "granular": { - "properties": { - "mcp_elicitations": { - "type": "boolean" - }, - "request_permissions": { - "default": false, - "type": "boolean" - }, - "rules": { - "type": "boolean" - }, - "sandbox_approval": { - "type": "boolean" - }, - "skill_approval": { - "default": false, - "type": "boolean" - } - }, - "required": [ - "mcp_elicitations", - "rules", - "sandbox_approval" - ], - "type": "object" - } - }, - "required": [ - "granular" - ], - "title": "GranularAskForApproval", - "type": "object" - }, - { - "enum": [ - "untrusted", - "on-request", - "never" - ], - "type": "string" - } - ] - }, - "ByteRange": { - "properties": { - "end": { - "format": "uint", - "minimum": 0, - "type": "integer" - }, - "start": { - "format": "uint", - "minimum": 0, - "type": "integer" - } - }, - "required": [ - "end", - "start" - ], - "type": "object" - }, - "CodexErrorInfo": { - "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "httpConnectionFailed": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "httpConnectionFailed" - ], - "title": "HttpConnectionFailedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Failed to connect to the response SSE stream.", - "properties": { - "responseStreamConnectionFailed": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseStreamConnectionFailed" - ], - "title": "ResponseStreamConnectionFailedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "The response SSE stream disconnected in the middle of a turn before completion.", - "properties": { - "responseStreamDisconnected": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseStreamDisconnected" - ], - "title": "ResponseStreamDisconnectedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Reached the retry limit for responses.", - "properties": { - "responseTooManyFailedAttempts": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseTooManyFailedAttempts" - ], - "title": "ResponseTooManyFailedAttemptsCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", - "properties": { - "activeTurnNotSteerable": { - "properties": { - "turnKind": { - "$ref": "#/definitions/NonSteerableTurnKind" - } - }, - "required": [ - "turnKind" - ], - "type": "object" - } - }, - "required": [ - "activeTurnNotSteerable" - ], - "title": "ActiveTurnNotSteerableCodexErrorInfo", - "type": "object" - }, - { - "enum": [ - "contextWindowExceeded", - "sessionBudgetExceeded", - "usageLimitExceeded", - "serverOverloaded", - "cyberPolicy", - "internalServerError", - "unauthorized", - "badRequest", - "threadRollbackFailed", - "sandboxError", - "other" - ], - "type": "string" - } - ] - }, - "CollabAgentState": { - "properties": { - "message": { - "type": [ - "string", - "null" - ] - }, - "status": { - "$ref": "#/definitions/CollabAgentStatus" - } - }, - "required": [ - "status" - ], - "type": "object" - }, - "CollabAgentStatus": { - "enum": [ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound" - ], - "type": "string" - }, - "CollabAgentTool": { - "enum": [ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent" - ], - "type": "string" - }, - "CollabAgentToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "CommandAction": { - "oneOf": [ - { - "properties": { - "command": { - "type": "string" - }, - "name": { - "type": "string" - }, - "path": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "type": { - "enum": [ - "read" - ], - "title": "ReadCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "name", - "path", - "type" - ], - "title": "ReadCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "path": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "listFiles" - ], - "title": "ListFilesCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "ListFilesCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "path": { - "type": [ - "string", - "null" - ] - }, - "query": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "search" - ], - "title": "SearchCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "SearchCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "type": { - "enum": [ - "unknown" - ], - "title": "UnknownCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "UnknownCommandAction", - "type": "object" - } - ] - }, - "CommandExecutionSource": { - "enum": [ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction" - ], - "type": "string" - }, - "CommandExecutionStatus": { - "enum": [ - "inProgress", - "completed", - "failed", - "declined" - ], - "type": "string" - }, - "DynamicToolCallOutputContentItem": { - "oneOf": [ - { - "properties": { - "text": { - "type": "string" - }, - "type": { - "enum": [ - "inputText" - ], - "title": "InputTextDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "text", - "type" - ], - "title": "InputTextDynamicToolCallOutputContentItem", - "type": "object" - }, - { - "properties": { - "imageUrl": { - "type": "string" - }, - "type": { - "enum": [ - "inputImage" - ], - "title": "InputImageDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "imageUrl", - "type" - ], - "title": "InputImageDynamicToolCallOutputContentItem", - "type": "object" - }, - { - "properties": { - "audioUrl": { - "type": "string" - }, - "type": { - "enum": [ - "inputAudio" - ], - "title": "InputAudioDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "audioUrl", - "type" - ], - "title": "InputAudioDynamicToolCallOutputContentItem", - "type": "object" - } - ] - }, - "DynamicToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "FileUpdateChange": { - "properties": { - "diff": { - "type": "string" - }, - "kind": { - "$ref": "#/definitions/PatchChangeKind" - }, - "path": { - "type": "string" - } - }, - "required": [ - "diff", - "kind", - "path" - ], - "type": "object" - }, - "GitInfo": { - "properties": { - "branch": { - "type": [ - "string", - "null" - ] - }, - "originUrl": { - "type": [ - "string", - "null" - ] - }, - "sha": { - "type": [ - "string", - "null" - ] - } - }, - "type": "object" - }, - "HookPromptFragment": { - "properties": { - "hookRunId": { - "type": "string" - }, - "text": { - "type": "string" - } - }, - "required": [ - "hookRunId", - "text" - ], - "type": "object" - }, - "ImageDetail": { - "enum": [ - "auto", - "low", - "high", - "original" - ], - "type": "string" - }, - "LegacyAppPathString": { - "type": "string" - }, - "McpToolCallAppContext": { - "properties": { - "actionName": { - "type": [ - "string", - "null" - ] - }, - "appName": { - "type": [ - "string", - "null" - ] - }, - "connectorId": { - "type": "string" - }, - "linkId": { - "type": [ - "string", - "null" - ] - }, - "resourceUri": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "connectorId" - ], - "type": "object" - }, - "McpToolCallError": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - }, - "McpToolCallResult": { - "properties": { - "_meta": true, - "content": { - "items": true, - "type": "array" - }, - "structuredContent": true - }, - "required": [ - "content" - ], - "type": "object" - }, - "McpToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "MemoryCitation": { - "properties": { - "entries": { - "items": { - "$ref": "#/definitions/MemoryCitationEntry" - }, - "type": "array" - }, - "threadIds": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - "required": [ - "entries", - "threadIds" - ], - "type": "object" - }, - "MemoryCitationEntry": { - "properties": { - "lineEnd": { - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "lineStart": { - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "note": { - "type": "string" - }, - "path": { - "type": "string" - } - }, - "required": [ - "lineEnd", - "lineStart", - "note", - "path" - ], - "type": "object" - }, - "MessagePhase": { - "description": "Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as \"phase unknown\" and keep compatibility behavior for legacy models.", - "oneOf": [ - { - "description": "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", - "enum": [ - "commentary" - ], - "type": "string" - }, - { - "description": "The assistant's terminal answer text for the current turn.", - "enum": [ - "final_answer" - ], - "type": "string" - } - ] - }, - "MultiAgentMode": { - "description": "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.", - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "custom": { - "type": "string" - } - }, - "required": [ - "custom" - ], - "title": "CustomMultiAgentMode", - "type": "object" - }, - { - "enum": [ - "explicitRequestOnly", - "proactive" - ], - "type": "string" - } - ] - }, - "NetworkAccess": { - "enum": [ - "restricted", - "enabled" - ], - "type": "string" - }, - "NonSteerableTurnKind": { - "enum": [ - "review", - "compact" - ], - "type": "string" - }, - "PatchApplyStatus": { - "enum": [ - "inProgress", - "completed", - "failed", - "declined" - ], - "type": "string" - }, - "PatchChangeKind": { - "oneOf": [ - { - "properties": { - "type": { - "enum": [ - "add" - ], - "title": "AddPatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "AddPatchChangeKind", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "delete" - ], - "title": "DeletePatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "DeletePatchChangeKind", - "type": "object" - }, - { - "properties": { - "move_path": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "update" - ], - "title": "UpdatePatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "UpdatePatchChangeKind", - "type": "object" - } - ] - }, - "ReasoningEffort": { - "description": "A non-empty reasoning effort value advertised by the model.", - "minLength": 1, - "type": "string" - }, - "SandboxPolicy": { - "oneOf": [ - { - "properties": { - "type": { - "enum": [ - "dangerFullAccess" - ], - "title": "DangerFullAccessSandboxPolicyType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "DangerFullAccessSandboxPolicy", - "type": "object" - }, - { - "properties": { - "networkAccess": { - "default": false, - "type": "boolean" - }, - "type": { - "enum": [ - "readOnly" - ], - "title": "ReadOnlySandboxPolicyType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "ReadOnlySandboxPolicy", - "type": "object" - }, - { - "properties": { - "networkAccess": { - "allOf": [ - { - "$ref": "#/definitions/NetworkAccess" - } - ], - "default": "restricted" - }, - "type": { - "enum": [ - "externalSandbox" - ], - "title": "ExternalSandboxSandboxPolicyType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "ExternalSandboxSandboxPolicy", - "type": "object" - }, - { - "properties": { - "excludeSlashTmp": { - "default": false, - "type": "boolean" - }, - "excludeTmpdirEnvVar": { - "default": false, - "type": "boolean" - }, - "networkAccess": { - "default": false, - "type": "boolean" - }, - "type": { - "enum": [ - "workspaceWrite" - ], - "title": "WorkspaceWriteSandboxPolicyType", - "type": "string" - }, - "writableRoots": { - "default": [], - "items": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "type": "array" - } - }, - "required": [ - "type" - ], - "title": "WorkspaceWriteSandboxPolicy", - "type": "object" - } - ] - }, - "SessionSource": { - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "custom": { - "type": "string" - } - }, - "required": [ - "custom" - ], - "title": "CustomSessionSource", - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "subAgent": { - "$ref": "#/definitions/SubAgentSource" - } - }, - "required": [ - "subAgent" - ], - "title": "SubAgentSessionSource", - "type": "object" - }, - { - "enum": [ - "cli", - "vscode", - "exec", - "appServer", - "unknown" - ], - "type": "string" - } - ] - }, - "SubAgentActivityKind": { - "enum": [ - "started", - "interacted", - "interrupted" - ], - "type": "string" - }, - "SubAgentSource": { - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "thread_spawn": { - "properties": { - "agent_nickname": { - "default": null, - "type": [ - "string", - "null" - ] - }, - "agent_path": { - "anyOf": [ - { - "$ref": "#/definitions/AgentPath" - }, - { - "type": "null" - } - ], - "default": null - }, - "agent_role": { - "default": null, - "type": [ - "string", - "null" - ] - }, - "depth": { - "format": "int32", - "type": "integer" - }, - "parent_thread_id": { - "$ref": "#/definitions/ThreadId" - } - }, - "required": [ - "depth", - "parent_thread_id" - ], - "type": "object" - } - }, - "required": [ - "thread_spawn" - ], - "title": "ThreadSpawnSubAgentSource", - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "other": { - "type": "string" - } - }, - "required": [ - "other" - ], - "title": "OtherSubAgentSource", - "type": "object" - }, - { - "enum": [ - "review", - "compact", - "memory_consolidation" - ], - "type": "string" - } - ] - }, - "TextElement": { - "properties": { - "byteRange": { - "allOf": [ - { - "$ref": "#/definitions/ByteRange" - } - ], - "description": "Byte range in the parent `text` buffer that this element occupies." - }, - "placeholder": { - "description": "Optional human-readable placeholder for the element, displayed in the UI.", - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "byteRange" - ], - "type": "object" - }, - "Thread": { - "properties": { - "agentNickname": { - "description": "Optional random unique nickname assigned to an AgentControl-spawned sub-agent.", - "type": [ - "string", - "null" - ] - }, - "agentRole": { - "description": "Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.", - "type": [ - "string", - "null" - ] - }, - "canAcceptDirectInput": { - "description": "Whether the app server accepts direct turn input for this loaded thread. `None` means the capability is unavailable, such as for an unloaded stored thread.", - "type": [ - "boolean", - "null" - ] - }, - "cliVersion": { - "description": "Version of the CLI that created the thread.", - "type": "string" - }, - "createdAt": { - "description": "Unix timestamp (in seconds) when the thread was created.", - "format": "int64", - "type": "integer" - }, - "cwd": { - "allOf": [ - { - "$ref": "#/definitions/AbsolutePathBuf" - } - ], - "description": "Working directory captured for the thread." - }, - "ephemeral": { - "description": "Whether the thread is ephemeral and should not be materialized on disk.", - "type": "boolean" - }, - "extra": { - "anyOf": [ - { - "$ref": "#/definitions/ThreadExtra" - }, - { - "type": "null" - } - ], - "description": "Optional implementation-specific thread data." - }, - "forkedFromId": { - "description": "Source thread id when this thread was created by forking another thread.", - "type": [ - "string", - "null" - ] - }, - "gitInfo": { - "anyOf": [ - { - "$ref": "#/definitions/GitInfo" - }, - { - "type": "null" - } - ], - "description": "Optional Git metadata captured when the thread was created." - }, - "historyMode": { - "allOf": [ - { - "$ref": "#/definitions/ThreadHistoryMode" - } - ], - "default": "legacy", - "description": "Persisted thread history contract selected when this thread was created." - }, - "id": { - "description": "Identifier for this thread. Codex-generated thread IDs are UUIDv7.", - "type": "string" - }, - "isPinned": { - "default": false, - "description": "Whether the thread has been pinned by the user.", - "type": "boolean" - }, - "modelProvider": { - "description": "Model provider used for this thread (for example, 'openai').", - "type": "string" - }, - "name": { - "description": "Optional user-facing thread title.", - "type": [ - "string", - "null" - ] - }, - "parentThreadId": { - "description": "The ID of the parent thread. This will only be set if this thread is a subagent.", - "type": [ - "string", - "null" - ] - }, - "path": { - "description": "[UNSTABLE] Path to the thread on disk.", - "type": [ - "string", - "null" - ] - }, - "preview": { - "description": "Usually the first user message in the thread, if available.", - "type": "string" - }, - "recencyAt": { - "description": "Unix timestamp (in seconds) used for thread recency ordering.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "sessionId": { - "description": "Session id shared by threads that belong to the same session tree.", - "type": "string" - }, - "source": { - "allOf": [ - { - "$ref": "#/definitions/SessionSource" - } - ], - "description": "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.)." - }, - "status": { - "allOf": [ - { - "$ref": "#/definitions/ThreadStatus" - } - ], - "description": "Current runtime status for the thread." - }, - "threadSource": { - "anyOf": [ - { - "$ref": "#/definitions/ThreadSource" - }, - { - "type": "null" - } - ], - "description": "Optional analytics source classification for this thread." - }, - "turns": { - "description": "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.", - "items": { - "$ref": "#/definitions/Turn" - }, - "type": "array" - }, - "updatedAt": { - "description": "Unix timestamp (in seconds) when the thread was last updated.", - "format": "int64", - "type": "integer" - } - }, - "required": [ - "cliVersion", - "createdAt", - "cwd", - "ephemeral", - "id", - "modelProvider", - "preview", - "sessionId", - "source", - "status", - "turns", - "updatedAt" - ], - "type": "object" - }, - "ThreadActiveFlag": { - "enum": [ - "waitingOnApproval", - "waitingOnUserInput" - ], - "type": "string" - }, - "ThreadExtra": { - "description": "Extra app-server data for a thread.", - "type": "object" - }, - "ThreadHistoryMode": { - "enum": [ - "legacy", - "paginated" - ], - "type": "string" - }, - "ThreadId": { - "type": "string" - }, - "ThreadItem": { - "oneOf": [ - { - "properties": { - "clientId": { - "type": [ - "string", - "null" - ] - }, - "content": { - "items": { - "$ref": "#/definitions/UserInput" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "userMessage" - ], - "title": "UserMessageThreadItemType", - "type": "string" - } - }, - "required": [ - "content", - "id", - "type" - ], - "title": "UserMessageThreadItem", - "type": "object" - }, - { - "properties": { - "fragments": { - "items": { - "$ref": "#/definitions/HookPromptFragment" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "hookPrompt" - ], - "title": "HookPromptThreadItemType", - "type": "string" - } - }, - "required": [ - "fragments", - "id", - "type" - ], - "title": "HookPromptThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "memoryCitation": { - "anyOf": [ - { - "$ref": "#/definitions/MemoryCitation" - }, - { - "type": "null" - } - ], - "default": null - }, - "phase": { - "anyOf": [ - { - "$ref": "#/definitions/MessagePhase" - }, - { - "type": "null" - } - ], - "default": null - }, - "text": { - "type": "string" - }, - "type": { - "enum": [ - "agentMessage" - ], - "title": "AgentMessageThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "text", - "type" - ], - "title": "AgentMessageThreadItem", - "type": "object" - }, - { - "description": "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", - "properties": { - "id": { - "type": "string" - }, - "text": { - "type": "string" - }, - "type": { - "enum": [ - "plan" - ], - "title": "PlanThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "text", - "type" - ], - "title": "PlanThreadItem", - "type": "object" - }, - { - "properties": { - "content": { - "default": [], - "items": { - "type": "string" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "summary": { - "default": [], - "items": { - "type": "string" - }, - "type": "array" - }, - "type": { - "enum": [ - "reasoning" - ], - "title": "ReasoningThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "type" - ], - "title": "ReasoningThreadItem", - "type": "object" - }, - { - "properties": { - "aggregatedOutput": { - "description": "The command's output, aggregated from stdout and stderr.", - "type": [ - "string", - "null" - ] - }, - "command": { - "description": "The command to be executed.", - "type": "string" - }, - "commandActions": { - "description": "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", - "items": { - "$ref": "#/definitions/CommandAction" - }, - "type": "array" - }, - "cwd": { - "allOf": [ - { - "$ref": "#/definitions/LegacyAppPathString" - } - ], - "description": "The command's working directory." - }, - "durationMs": { - "description": "The duration of the command execution in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "exitCode": { - "description": "The command's exit code.", - "format": "int32", - "type": [ - "integer", - "null" - ] - }, - "id": { - "type": "string" - }, - "pluginId": { - "default": null, - "description": "Trusted first-party plugin id when this command resolves to one plugin script.", - "type": [ - "string", - "null" - ] - }, - "processId": { - "description": "Identifier for the underlying PTY process (when available).", - "type": [ - "string", - "null" - ] - }, - "scriptPath": { - "default": null, - "description": "Safe plugin-relative path when this command resolves to one plugin script.", - "type": [ - "string", - "null" - ] - }, - "source": { - "allOf": [ - { - "$ref": "#/definitions/CommandExecutionSource" - } - ], - "default": "agent" - }, - "status": { - "$ref": "#/definitions/CommandExecutionStatus" - }, - "type": { - "enum": [ - "commandExecution" - ], - "title": "CommandExecutionThreadItemType", - "type": "string" - } - }, - "required": [ - "command", - "commandActions", - "cwd", - "id", - "status", - "type" - ], - "title": "CommandExecutionThreadItem", - "type": "object" - }, - { - "properties": { - "changes": { - "items": { - "$ref": "#/definitions/FileUpdateChange" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/PatchApplyStatus" - }, - "type": { - "enum": [ - "fileChange" - ], - "title": "FileChangeThreadItemType", - "type": "string" - } - }, - "required": [ - "changes", - "id", - "status", - "type" - ], - "title": "FileChangeThreadItem", - "type": "object" - }, - { - "properties": { - "appContext": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallAppContext" - }, - { - "type": "null" - } - ] - }, - "arguments": true, - "durationMs": { - "description": "The duration of the MCP tool call in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "error": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallError" - }, - { - "type": "null" - } - ] - }, - "id": { - "type": "string" - }, - "mcpAppResourceUri": { - "description": "Deprecated: use `appContext.resourceUri` instead.", - "type": [ - "string", - "null" - ] - }, - "pluginId": { - "type": [ - "string", - "null" - ] - }, - "result": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallResult" - }, - { - "type": "null" - } - ] - }, - "server": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/McpToolCallStatus" - }, - "tool": { - "type": "string" - }, - "type": { - "enum": [ - "mcpToolCall" - ], - "title": "McpToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "arguments", - "id", - "server", - "status", - "tool", - "type" - ], - "title": "McpToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "arguments": true, - "contentItems": { - "items": { - "$ref": "#/definitions/DynamicToolCallOutputContentItem" - }, - "type": [ - "array", - "null" - ] - }, - "durationMs": { - "description": "The duration of the dynamic tool call in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "id": { - "type": "string" - }, - "namespace": { - "type": [ - "string", - "null" - ] - }, - "status": { - "$ref": "#/definitions/DynamicToolCallStatus" - }, - "success": { - "type": [ - "boolean", - "null" - ] - }, - "tool": { - "type": "string" - }, - "type": { - "enum": [ - "dynamicToolCall" - ], - "title": "DynamicToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "arguments", - "id", - "status", - "tool", - "type" - ], - "title": "DynamicToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "agentsStates": { - "additionalProperties": { - "$ref": "#/definitions/CollabAgentState" - }, - "description": "Last known status of the target agents, when available.", - "type": "object" - }, - "id": { - "description": "Unique identifier for this collab tool call.", - "type": "string" - }, - "model": { - "description": "Model requested for the spawned agent, when applicable.", - "type": [ - "string", - "null" - ] - }, - "prompt": { - "description": "Prompt text sent as part of the collab tool call, when available.", - "type": [ - "string", - "null" - ] - }, - "reasoningEffort": { - "anyOf": [ - { - "$ref": "#/definitions/ReasoningEffort" - }, - { - "type": "null" - } - ], - "description": "Reasoning effort requested for the spawned agent, when applicable." - }, - "receiverThreadIds": { - "description": "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", - "items": { - "type": "string" - }, - "type": "array" - }, - "senderThreadId": { - "description": "Thread ID of the agent issuing the collab request.", - "type": "string" - }, - "status": { - "allOf": [ - { - "$ref": "#/definitions/CollabAgentToolCallStatus" - } - ], - "description": "Current status of the collab tool call." - }, - "tool": { - "allOf": [ - { - "$ref": "#/definitions/CollabAgentTool" - } - ], - "description": "Name of the collab tool that was invoked." - }, - "type": { - "enum": [ - "collabAgentToolCall" - ], - "title": "CollabAgentToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "agentsStates", - "id", - "receiverThreadIds", - "senderThreadId", - "status", - "tool", - "type" - ], - "title": "CollabAgentToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "agentPath": { - "type": "string" - }, - "agentThreadId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kind": { - "$ref": "#/definitions/SubAgentActivityKind" - }, - "type": { - "enum": [ - "subAgentActivity" - ], - "title": "SubAgentActivityThreadItemType", - "type": "string" - } - }, - "required": [ - "agentPath", - "agentThreadId", - "id", - "kind", - "type" - ], - "title": "SubAgentActivityThreadItem", - "type": "object" - }, - { - "properties": { - "action": { - "anyOf": [ - { - "$ref": "#/definitions/WebSearchAction" - }, - { - "type": "null" - } - ] - }, - "id": { - "type": "string" - }, - "query": { - "type": "string" - }, - "results": { - "default": null, - "description": "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", - "items": true, - "type": [ - "array", - "null" - ] - }, - "type": { - "enum": [ - "webSearch" - ], - "title": "WebSearchThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "query", - "type" - ], - "title": "WebSearchThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "path": { - "$ref": "#/definitions/LegacyAppPathString" - }, - "type": { - "enum": [ - "imageView" - ], - "title": "ImageViewThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "path", - "type" - ], - "title": "ImageViewThreadItem", - "type": "object" - }, - { - "description": "Display item emitted by the interruptible `clock.sleep` tool.", - "properties": { - "durationMs": { - "format": "uint64", - "minimum": 0, - "type": "integer" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "sleep" - ], - "title": "SleepThreadItemType", - "type": "string" - } - }, - "required": [ - "durationMs", - "id", - "type" - ], - "title": "SleepThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "result": { - "type": "string" - }, - "revisedPrompt": { - "type": [ - "string", - "null" - ] - }, - "savedPath": { - "anyOf": [ - { - "$ref": "#/definitions/AbsolutePathBuf" - }, - { - "type": "null" - } - ] - }, - "status": { - "type": "string" - }, - "type": { - "enum": [ - "imageGeneration" - ], - "title": "ImageGenerationThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "result", - "status", - "type" - ], - "title": "ImageGenerationThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "review": { - "type": "string" - }, - "type": { - "enum": [ - "enteredReviewMode" - ], - "title": "EnteredReviewModeThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "review", - "type" - ], - "title": "EnteredReviewModeThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "review": { - "type": "string" - }, - "type": { - "enum": [ - "exitedReviewMode" - ], - "title": "ExitedReviewModeThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "review", - "type" - ], - "title": "ExitedReviewModeThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "type": { - "enum": [ - "contextCompaction" - ], - "title": "ContextCompactionThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "type" - ], - "title": "ContextCompactionThreadItem", - "type": "object" - } - ] - }, - "ThreadSource": { - "type": "string" - }, - "ThreadStatus": { - "oneOf": [ - { - "properties": { - "type": { - "enum": [ - "notLoaded" - ], - "title": "NotLoadedThreadStatusType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "NotLoadedThreadStatus", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "idle" - ], - "title": "IdleThreadStatusType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "IdleThreadStatus", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "systemError" - ], - "title": "SystemErrorThreadStatusType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "SystemErrorThreadStatus", - "type": "object" - }, - { - "properties": { - "activeFlags": { - "items": { - "$ref": "#/definitions/ThreadActiveFlag" - }, - "type": "array" - }, - "type": { - "enum": [ - "active" - ], - "title": "ActiveThreadStatusType", - "type": "string" - } - }, - "required": [ - "activeFlags", - "type" - ], - "title": "ActiveThreadStatus", - "type": "object" - } - ] - }, - "Turn": { - "properties": { - "completedAt": { - "description": "Unix timestamp (in seconds) when the turn completed.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "durationMs": { - "description": "Duration between turn start and completion in milliseconds, if known.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "error": { - "anyOf": [ - { - "$ref": "#/definitions/TurnError" - }, - { - "type": "null" - } - ], - "description": "Only populated when the Turn's status is failed." - }, - "id": { - "description": "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", - "type": "string" - }, - "items": { - "description": "Thread items currently included in this turn payload.", - "items": { - "$ref": "#/definitions/ThreadItem" - }, - "type": "array" - }, - "itemsView": { - "allOf": [ - { - "$ref": "#/definitions/TurnItemsView" - } - ], - "default": "full", - "description": "Describes how much of `items` has been loaded for this turn." - }, - "startedAt": { - "description": "Unix timestamp (in seconds) when the turn started.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "status": { - "$ref": "#/definitions/TurnStatus" - } - }, - "required": [ - "id", - "items", - "status" - ], - "type": "object" - }, - "TurnError": { - "properties": { - "additionalDetails": { - "default": null, - "type": [ - "string", - "null" - ] - }, - "codexErrorInfo": { - "anyOf": [ - { - "$ref": "#/definitions/CodexErrorInfo" - }, - { - "type": "null" - } - ] - }, - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - }, - "TurnItemsView": { - "oneOf": [ - { - "description": "`items` was not loaded for this turn. The field is intentionally empty.", - "enum": [ - "notLoaded" - ], - "type": "string" - }, - { - "description": "`items` contains only a display summary for this turn.", - "enum": [ - "summary" - ], - "type": "string" - }, - { - "description": "`items` contains every ThreadItem available from persisted app-server history for this turn.", - "enum": [ - "full" - ], - "type": "string" - } - ] - }, - "TurnStatus": { - "enum": [ - "completed", - "interrupted", - "failed", - "inProgress" - ], - "type": "string" - }, - "UserInput": { - "oneOf": [ - { - "properties": { - "text": { - "type": "string" - }, - "text_elements": { - "default": [], - "description": "UI-defined spans within `text` used to render or persist special elements.", - "items": { - "$ref": "#/definitions/TextElement" - }, - "type": "array" - }, - "type": { - "enum": [ - "text" - ], - "title": "TextUserInputType", - "type": "string" - } - }, - "required": [ - "text", - "type" - ], - "title": "TextUserInput", - "type": "object" - }, - { - "properties": { - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/ImageDetail" - }, - { - "type": "null" - } - ], - "default": null - }, - "type": { - "enum": [ - "image" - ], - "title": "ImageUserInputType", - "type": "string" - }, - "url": { - "type": "string" - } - }, - "required": [ - "type", - "url" - ], - "title": "ImageUserInput", - "type": "object" - }, - { - "properties": { - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/ImageDetail" - }, - { - "type": "null" - } - ], - "default": null - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "localImage" - ], - "title": "LocalImageUserInputType", - "type": "string" - } - }, - "required": [ - "path", - "type" - ], - "title": "LocalImageUserInput", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "audio" - ], - "title": "AudioUserInputType", - "type": "string" - }, - "url": { - "type": "string" - } - }, - "required": [ - "type", - "url" - ], - "title": "AudioUserInput", - "type": "object" - }, - { - "properties": { - "path": { - "type": "string" - }, - "type": { - "enum": [ - "localAudio" - ], - "title": "LocalAudioUserInputType", - "type": "string" - } - }, - "required": [ - "path", - "type" - ], - "title": "LocalAudioUserInput", - "type": "object" - }, - { - "properties": { - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "skill" - ], - "title": "SkillUserInputType", - "type": "string" - } - }, - "required": [ - "name", - "path", - "type" - ], - "title": "SkillUserInput", - "type": "object" - }, - { - "properties": { - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "mention" - ], - "title": "MentionUserInputType", - "type": "string" - } - }, - "required": [ - "name", - "path", - "type" - ], - "title": "MentionUserInput", - "type": "object" - } - ] - }, - "WebSearchAction": { - "oneOf": [ - { - "properties": { - "queries": { - "items": { - "type": "string" - }, - "type": [ - "array", - "null" - ] - }, - "query": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "search" - ], - "title": "SearchWebSearchActionType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "SearchWebSearchAction", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "openPage" - ], - "title": "OpenPageWebSearchActionType", - "type": "string" - }, - "url": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type" - ], - "title": "OpenPageWebSearchAction", - "type": "object" - }, - { - "properties": { - "pattern": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "findInPage" - ], - "title": "FindInPageWebSearchActionType", - "type": "string" - }, - "url": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type" - ], - "title": "FindInPageWebSearchAction", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "other" - ], - "title": "OtherWebSearchActionType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "OtherWebSearchAction", - "type": "object" - } - ] - } - }, "properties": { "activePermissionProfile": { "anyOf": [ { - "$ref": "#/definitions/ActivePermissionProfile" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ActivePermissionProfile" }, { "type": "null" @@ -2533,24 +14,24 @@ "description": "Named or implicit built-in profile that produced the active permissions, when known." }, "approvalPolicy": { - "$ref": "#/definitions/AskForApproval" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AskForApproval" }, "approvalsReviewer": { "allOf": [ { - "$ref": "#/definitions/ApprovalsReviewer" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ApprovalsReviewer" } ], "description": "Reviewer currently used for approval requests on this thread." }, "cwd": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AbsolutePathBuf" }, "instructionSources": { "default": [], "description": "Environment-native paths to instruction source files currently loaded for this thread.", "items": { - "$ref": "#/definitions/LegacyAppPathString" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/LegacyAppPathString" }, "type": "array" }, @@ -2563,7 +44,7 @@ "multiAgentMode": { "allOf": [ { - "$ref": "#/definitions/MultiAgentMode" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/MultiAgentMode" } ], "default": "explicitRequestOnly", @@ -2572,7 +53,7 @@ "reasoningEffort": { "anyOf": [ { - "$ref": "#/definitions/ReasoningEffort" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ReasoningEffort" }, { "type": "null" @@ -2583,14 +64,14 @@ "default": [], "description": "Thread-scoped runtime workspace roots used to materialize `:workspace_roots`.", "items": { - "$ref": "#/definitions/AbsolutePathBuf" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AbsolutePathBuf" }, "type": "array" }, "sandbox": { "allOf": [ { - "$ref": "#/definitions/SandboxPolicy" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/SandboxPolicy" } ], "description": "Legacy sandbox policy retained for compatibility. Experimental clients should prefer `activePermissionProfile` for profile provenance." @@ -2602,7 +83,7 @@ ] }, "thread": { - "$ref": "#/definitions/Thread" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Thread" } }, "required": [ diff --git a/extensions/codex/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json b/extensions/codex/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json index 23c197b85602..88c9f05a90ff 100644 --- a/extensions/codex/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json +++ b/extensions/codex/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json @@ -1,1892 +1,11 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "AbsolutePathBuf": { - "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - "type": "string" - }, - "ByteRange": { - "properties": { - "end": { - "format": "uint", - "minimum": 0, - "type": "integer" - }, - "start": { - "format": "uint", - "minimum": 0, - "type": "integer" - } - }, - "required": [ - "end", - "start" - ], - "type": "object" - }, - "CodexErrorInfo": { - "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "httpConnectionFailed": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "httpConnectionFailed" - ], - "title": "HttpConnectionFailedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Failed to connect to the response SSE stream.", - "properties": { - "responseStreamConnectionFailed": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseStreamConnectionFailed" - ], - "title": "ResponseStreamConnectionFailedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "The response SSE stream disconnected in the middle of a turn before completion.", - "properties": { - "responseStreamDisconnected": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseStreamDisconnected" - ], - "title": "ResponseStreamDisconnectedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Reached the retry limit for responses.", - "properties": { - "responseTooManyFailedAttempts": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseTooManyFailedAttempts" - ], - "title": "ResponseTooManyFailedAttemptsCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", - "properties": { - "activeTurnNotSteerable": { - "properties": { - "turnKind": { - "$ref": "#/definitions/NonSteerableTurnKind" - } - }, - "required": [ - "turnKind" - ], - "type": "object" - } - }, - "required": [ - "activeTurnNotSteerable" - ], - "title": "ActiveTurnNotSteerableCodexErrorInfo", - "type": "object" - }, - { - "enum": [ - "contextWindowExceeded", - "sessionBudgetExceeded", - "usageLimitExceeded", - "serverOverloaded", - "cyberPolicy", - "internalServerError", - "unauthorized", - "badRequest", - "threadRollbackFailed", - "sandboxError", - "other" - ], - "type": "string" - } - ] - }, - "CollabAgentState": { - "properties": { - "message": { - "type": [ - "string", - "null" - ] - }, - "status": { - "$ref": "#/definitions/CollabAgentStatus" - } - }, - "required": [ - "status" - ], - "type": "object" - }, - "CollabAgentStatus": { - "enum": [ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound" - ], - "type": "string" - }, - "CollabAgentTool": { - "enum": [ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent" - ], - "type": "string" - }, - "CollabAgentToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "CommandAction": { - "oneOf": [ - { - "properties": { - "command": { - "type": "string" - }, - "name": { - "type": "string" - }, - "path": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "type": { - "enum": [ - "read" - ], - "title": "ReadCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "name", - "path", - "type" - ], - "title": "ReadCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "path": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "listFiles" - ], - "title": "ListFilesCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "ListFilesCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "path": { - "type": [ - "string", - "null" - ] - }, - "query": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "search" - ], - "title": "SearchCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "SearchCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "type": { - "enum": [ - "unknown" - ], - "title": "UnknownCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "UnknownCommandAction", - "type": "object" - } - ] - }, - "CommandExecutionSource": { - "enum": [ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction" - ], - "type": "string" - }, - "CommandExecutionStatus": { - "enum": [ - "inProgress", - "completed", - "failed", - "declined" - ], - "type": "string" - }, - "DynamicToolCallOutputContentItem": { - "oneOf": [ - { - "properties": { - "text": { - "type": "string" - }, - "type": { - "enum": [ - "inputText" - ], - "title": "InputTextDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "text", - "type" - ], - "title": "InputTextDynamicToolCallOutputContentItem", - "type": "object" - }, - { - "properties": { - "imageUrl": { - "type": "string" - }, - "type": { - "enum": [ - "inputImage" - ], - "title": "InputImageDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "imageUrl", - "type" - ], - "title": "InputImageDynamicToolCallOutputContentItem", - "type": "object" - }, - { - "properties": { - "audioUrl": { - "type": "string" - }, - "type": { - "enum": [ - "inputAudio" - ], - "title": "InputAudioDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "audioUrl", - "type" - ], - "title": "InputAudioDynamicToolCallOutputContentItem", - "type": "object" - } - ] - }, - "DynamicToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "FileUpdateChange": { - "properties": { - "diff": { - "type": "string" - }, - "kind": { - "$ref": "#/definitions/PatchChangeKind" - }, - "path": { - "type": "string" - } - }, - "required": [ - "diff", - "kind", - "path" - ], - "type": "object" - }, - "HookPromptFragment": { - "properties": { - "hookRunId": { - "type": "string" - }, - "text": { - "type": "string" - } - }, - "required": [ - "hookRunId", - "text" - ], - "type": "object" - }, - "ImageDetail": { - "enum": [ - "auto", - "low", - "high", - "original" - ], - "type": "string" - }, - "LegacyAppPathString": { - "type": "string" - }, - "McpToolCallAppContext": { - "properties": { - "actionName": { - "type": [ - "string", - "null" - ] - }, - "appName": { - "type": [ - "string", - "null" - ] - }, - "connectorId": { - "type": "string" - }, - "linkId": { - "type": [ - "string", - "null" - ] - }, - "resourceUri": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "connectorId" - ], - "type": "object" - }, - "McpToolCallError": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - }, - "McpToolCallResult": { - "properties": { - "_meta": true, - "content": { - "items": true, - "type": "array" - }, - "structuredContent": true - }, - "required": [ - "content" - ], - "type": "object" - }, - "McpToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "MemoryCitation": { - "properties": { - "entries": { - "items": { - "$ref": "#/definitions/MemoryCitationEntry" - }, - "type": "array" - }, - "threadIds": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - "required": [ - "entries", - "threadIds" - ], - "type": "object" - }, - "MemoryCitationEntry": { - "properties": { - "lineEnd": { - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "lineStart": { - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "note": { - "type": "string" - }, - "path": { - "type": "string" - } - }, - "required": [ - "lineEnd", - "lineStart", - "note", - "path" - ], - "type": "object" - }, - "MessagePhase": { - "description": "Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as \"phase unknown\" and keep compatibility behavior for legacy models.", - "oneOf": [ - { - "description": "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", - "enum": [ - "commentary" - ], - "type": "string" - }, - { - "description": "The assistant's terminal answer text for the current turn.", - "enum": [ - "final_answer" - ], - "type": "string" - } - ] - }, - "NonSteerableTurnKind": { - "enum": [ - "review", - "compact" - ], - "type": "string" - }, - "PatchApplyStatus": { - "enum": [ - "inProgress", - "completed", - "failed", - "declined" - ], - "type": "string" - }, - "PatchChangeKind": { - "oneOf": [ - { - "properties": { - "type": { - "enum": [ - "add" - ], - "title": "AddPatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "AddPatchChangeKind", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "delete" - ], - "title": "DeletePatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "DeletePatchChangeKind", - "type": "object" - }, - { - "properties": { - "move_path": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "update" - ], - "title": "UpdatePatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "UpdatePatchChangeKind", - "type": "object" - } - ] - }, - "ReasoningEffort": { - "description": "A non-empty reasoning effort value advertised by the model.", - "minLength": 1, - "type": "string" - }, - "SubAgentActivityKind": { - "enum": [ - "started", - "interacted", - "interrupted" - ], - "type": "string" - }, - "TextElement": { - "properties": { - "byteRange": { - "allOf": [ - { - "$ref": "#/definitions/ByteRange" - } - ], - "description": "Byte range in the parent `text` buffer that this element occupies." - }, - "placeholder": { - "description": "Optional human-readable placeholder for the element, displayed in the UI.", - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "byteRange" - ], - "type": "object" - }, - "ThreadItem": { - "oneOf": [ - { - "properties": { - "clientId": { - "type": [ - "string", - "null" - ] - }, - "content": { - "items": { - "$ref": "#/definitions/UserInput" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "userMessage" - ], - "title": "UserMessageThreadItemType", - "type": "string" - } - }, - "required": [ - "content", - "id", - "type" - ], - "title": "UserMessageThreadItem", - "type": "object" - }, - { - "properties": { - "fragments": { - "items": { - "$ref": "#/definitions/HookPromptFragment" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "hookPrompt" - ], - "title": "HookPromptThreadItemType", - "type": "string" - } - }, - "required": [ - "fragments", - "id", - "type" - ], - "title": "HookPromptThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "memoryCitation": { - "anyOf": [ - { - "$ref": "#/definitions/MemoryCitation" - }, - { - "type": "null" - } - ], - "default": null - }, - "phase": { - "anyOf": [ - { - "$ref": "#/definitions/MessagePhase" - }, - { - "type": "null" - } - ], - "default": null - }, - "text": { - "type": "string" - }, - "type": { - "enum": [ - "agentMessage" - ], - "title": "AgentMessageThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "text", - "type" - ], - "title": "AgentMessageThreadItem", - "type": "object" - }, - { - "description": "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", - "properties": { - "id": { - "type": "string" - }, - "text": { - "type": "string" - }, - "type": { - "enum": [ - "plan" - ], - "title": "PlanThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "text", - "type" - ], - "title": "PlanThreadItem", - "type": "object" - }, - { - "properties": { - "content": { - "default": [], - "items": { - "type": "string" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "summary": { - "default": [], - "items": { - "type": "string" - }, - "type": "array" - }, - "type": { - "enum": [ - "reasoning" - ], - "title": "ReasoningThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "type" - ], - "title": "ReasoningThreadItem", - "type": "object" - }, - { - "properties": { - "aggregatedOutput": { - "description": "The command's output, aggregated from stdout and stderr.", - "type": [ - "string", - "null" - ] - }, - "command": { - "description": "The command to be executed.", - "type": "string" - }, - "commandActions": { - "description": "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", - "items": { - "$ref": "#/definitions/CommandAction" - }, - "type": "array" - }, - "cwd": { - "allOf": [ - { - "$ref": "#/definitions/LegacyAppPathString" - } - ], - "description": "The command's working directory." - }, - "durationMs": { - "description": "The duration of the command execution in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "exitCode": { - "description": "The command's exit code.", - "format": "int32", - "type": [ - "integer", - "null" - ] - }, - "id": { - "type": "string" - }, - "pluginId": { - "default": null, - "description": "Trusted first-party plugin id when this command resolves to one plugin script.", - "type": [ - "string", - "null" - ] - }, - "processId": { - "description": "Identifier for the underlying PTY process (when available).", - "type": [ - "string", - "null" - ] - }, - "scriptPath": { - "default": null, - "description": "Safe plugin-relative path when this command resolves to one plugin script.", - "type": [ - "string", - "null" - ] - }, - "source": { - "allOf": [ - { - "$ref": "#/definitions/CommandExecutionSource" - } - ], - "default": "agent" - }, - "status": { - "$ref": "#/definitions/CommandExecutionStatus" - }, - "type": { - "enum": [ - "commandExecution" - ], - "title": "CommandExecutionThreadItemType", - "type": "string" - } - }, - "required": [ - "command", - "commandActions", - "cwd", - "id", - "status", - "type" - ], - "title": "CommandExecutionThreadItem", - "type": "object" - }, - { - "properties": { - "changes": { - "items": { - "$ref": "#/definitions/FileUpdateChange" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/PatchApplyStatus" - }, - "type": { - "enum": [ - "fileChange" - ], - "title": "FileChangeThreadItemType", - "type": "string" - } - }, - "required": [ - "changes", - "id", - "status", - "type" - ], - "title": "FileChangeThreadItem", - "type": "object" - }, - { - "properties": { - "appContext": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallAppContext" - }, - { - "type": "null" - } - ] - }, - "arguments": true, - "durationMs": { - "description": "The duration of the MCP tool call in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "error": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallError" - }, - { - "type": "null" - } - ] - }, - "id": { - "type": "string" - }, - "mcpAppResourceUri": { - "description": "Deprecated: use `appContext.resourceUri` instead.", - "type": [ - "string", - "null" - ] - }, - "pluginId": { - "type": [ - "string", - "null" - ] - }, - "result": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallResult" - }, - { - "type": "null" - } - ] - }, - "server": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/McpToolCallStatus" - }, - "tool": { - "type": "string" - }, - "type": { - "enum": [ - "mcpToolCall" - ], - "title": "McpToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "arguments", - "id", - "server", - "status", - "tool", - "type" - ], - "title": "McpToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "arguments": true, - "contentItems": { - "items": { - "$ref": "#/definitions/DynamicToolCallOutputContentItem" - }, - "type": [ - "array", - "null" - ] - }, - "durationMs": { - "description": "The duration of the dynamic tool call in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "id": { - "type": "string" - }, - "namespace": { - "type": [ - "string", - "null" - ] - }, - "status": { - "$ref": "#/definitions/DynamicToolCallStatus" - }, - "success": { - "type": [ - "boolean", - "null" - ] - }, - "tool": { - "type": "string" - }, - "type": { - "enum": [ - "dynamicToolCall" - ], - "title": "DynamicToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "arguments", - "id", - "status", - "tool", - "type" - ], - "title": "DynamicToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "agentsStates": { - "additionalProperties": { - "$ref": "#/definitions/CollabAgentState" - }, - "description": "Last known status of the target agents, when available.", - "type": "object" - }, - "id": { - "description": "Unique identifier for this collab tool call.", - "type": "string" - }, - "model": { - "description": "Model requested for the spawned agent, when applicable.", - "type": [ - "string", - "null" - ] - }, - "prompt": { - "description": "Prompt text sent as part of the collab tool call, when available.", - "type": [ - "string", - "null" - ] - }, - "reasoningEffort": { - "anyOf": [ - { - "$ref": "#/definitions/ReasoningEffort" - }, - { - "type": "null" - } - ], - "description": "Reasoning effort requested for the spawned agent, when applicable." - }, - "receiverThreadIds": { - "description": "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", - "items": { - "type": "string" - }, - "type": "array" - }, - "senderThreadId": { - "description": "Thread ID of the agent issuing the collab request.", - "type": "string" - }, - "status": { - "allOf": [ - { - "$ref": "#/definitions/CollabAgentToolCallStatus" - } - ], - "description": "Current status of the collab tool call." - }, - "tool": { - "allOf": [ - { - "$ref": "#/definitions/CollabAgentTool" - } - ], - "description": "Name of the collab tool that was invoked." - }, - "type": { - "enum": [ - "collabAgentToolCall" - ], - "title": "CollabAgentToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "agentsStates", - "id", - "receiverThreadIds", - "senderThreadId", - "status", - "tool", - "type" - ], - "title": "CollabAgentToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "agentPath": { - "type": "string" - }, - "agentThreadId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kind": { - "$ref": "#/definitions/SubAgentActivityKind" - }, - "type": { - "enum": [ - "subAgentActivity" - ], - "title": "SubAgentActivityThreadItemType", - "type": "string" - } - }, - "required": [ - "agentPath", - "agentThreadId", - "id", - "kind", - "type" - ], - "title": "SubAgentActivityThreadItem", - "type": "object" - }, - { - "properties": { - "action": { - "anyOf": [ - { - "$ref": "#/definitions/WebSearchAction" - }, - { - "type": "null" - } - ] - }, - "id": { - "type": "string" - }, - "query": { - "type": "string" - }, - "results": { - "default": null, - "description": "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", - "items": true, - "type": [ - "array", - "null" - ] - }, - "type": { - "enum": [ - "webSearch" - ], - "title": "WebSearchThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "query", - "type" - ], - "title": "WebSearchThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "path": { - "$ref": "#/definitions/LegacyAppPathString" - }, - "type": { - "enum": [ - "imageView" - ], - "title": "ImageViewThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "path", - "type" - ], - "title": "ImageViewThreadItem", - "type": "object" - }, - { - "description": "Display item emitted by the interruptible `clock.sleep` tool.", - "properties": { - "durationMs": { - "format": "uint64", - "minimum": 0, - "type": "integer" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "sleep" - ], - "title": "SleepThreadItemType", - "type": "string" - } - }, - "required": [ - "durationMs", - "id", - "type" - ], - "title": "SleepThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "result": { - "type": "string" - }, - "revisedPrompt": { - "type": [ - "string", - "null" - ] - }, - "savedPath": { - "anyOf": [ - { - "$ref": "#/definitions/AbsolutePathBuf" - }, - { - "type": "null" - } - ] - }, - "status": { - "type": "string" - }, - "type": { - "enum": [ - "imageGeneration" - ], - "title": "ImageGenerationThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "result", - "status", - "type" - ], - "title": "ImageGenerationThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "review": { - "type": "string" - }, - "type": { - "enum": [ - "enteredReviewMode" - ], - "title": "EnteredReviewModeThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "review", - "type" - ], - "title": "EnteredReviewModeThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "review": { - "type": "string" - }, - "type": { - "enum": [ - "exitedReviewMode" - ], - "title": "ExitedReviewModeThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "review", - "type" - ], - "title": "ExitedReviewModeThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "type": { - "enum": [ - "contextCompaction" - ], - "title": "ContextCompactionThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "type" - ], - "title": "ContextCompactionThreadItem", - "type": "object" - } - ] - }, - "Turn": { - "properties": { - "completedAt": { - "description": "Unix timestamp (in seconds) when the turn completed.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "durationMs": { - "description": "Duration between turn start and completion in milliseconds, if known.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "error": { - "anyOf": [ - { - "$ref": "#/definitions/TurnError" - }, - { - "type": "null" - } - ], - "description": "Only populated when the Turn's status is failed." - }, - "id": { - "description": "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", - "type": "string" - }, - "items": { - "description": "Thread items currently included in this turn payload.", - "items": { - "$ref": "#/definitions/ThreadItem" - }, - "type": "array" - }, - "itemsView": { - "allOf": [ - { - "$ref": "#/definitions/TurnItemsView" - } - ], - "default": "full", - "description": "Describes how much of `items` has been loaded for this turn." - }, - "startedAt": { - "description": "Unix timestamp (in seconds) when the turn started.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "status": { - "$ref": "#/definitions/TurnStatus" - } - }, - "required": [ - "id", - "items", - "status" - ], - "type": "object" - }, - "TurnError": { - "properties": { - "additionalDetails": { - "default": null, - "type": [ - "string", - "null" - ] - }, - "codexErrorInfo": { - "anyOf": [ - { - "$ref": "#/definitions/CodexErrorInfo" - }, - { - "type": "null" - } - ] - }, - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - }, - "TurnItemsView": { - "oneOf": [ - { - "description": "`items` was not loaded for this turn. The field is intentionally empty.", - "enum": [ - "notLoaded" - ], - "type": "string" - }, - { - "description": "`items` contains only a display summary for this turn.", - "enum": [ - "summary" - ], - "type": "string" - }, - { - "description": "`items` contains every ThreadItem available from persisted app-server history for this turn.", - "enum": [ - "full" - ], - "type": "string" - } - ] - }, - "TurnStatus": { - "enum": [ - "completed", - "interrupted", - "failed", - "inProgress" - ], - "type": "string" - }, - "UserInput": { - "oneOf": [ - { - "properties": { - "text": { - "type": "string" - }, - "text_elements": { - "default": [], - "description": "UI-defined spans within `text` used to render or persist special elements.", - "items": { - "$ref": "#/definitions/TextElement" - }, - "type": "array" - }, - "type": { - "enum": [ - "text" - ], - "title": "TextUserInputType", - "type": "string" - } - }, - "required": [ - "text", - "type" - ], - "title": "TextUserInput", - "type": "object" - }, - { - "properties": { - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/ImageDetail" - }, - { - "type": "null" - } - ], - "default": null - }, - "type": { - "enum": [ - "image" - ], - "title": "ImageUserInputType", - "type": "string" - }, - "url": { - "type": "string" - } - }, - "required": [ - "type", - "url" - ], - "title": "ImageUserInput", - "type": "object" - }, - { - "properties": { - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/ImageDetail" - }, - { - "type": "null" - } - ], - "default": null - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "localImage" - ], - "title": "LocalImageUserInputType", - "type": "string" - } - }, - "required": [ - "path", - "type" - ], - "title": "LocalImageUserInput", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "audio" - ], - "title": "AudioUserInputType", - "type": "string" - }, - "url": { - "type": "string" - } - }, - "required": [ - "type", - "url" - ], - "title": "AudioUserInput", - "type": "object" - }, - { - "properties": { - "path": { - "type": "string" - }, - "type": { - "enum": [ - "localAudio" - ], - "title": "LocalAudioUserInputType", - "type": "string" - } - }, - "required": [ - "path", - "type" - ], - "title": "LocalAudioUserInput", - "type": "object" - }, - { - "properties": { - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "skill" - ], - "title": "SkillUserInputType", - "type": "string" - } - }, - "required": [ - "name", - "path", - "type" - ], - "title": "SkillUserInput", - "type": "object" - }, - { - "properties": { - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "mention" - ], - "title": "MentionUserInputType", - "type": "string" - } - }, - "required": [ - "name", - "path", - "type" - ], - "title": "MentionUserInput", - "type": "object" - } - ] - }, - "WebSearchAction": { - "oneOf": [ - { - "properties": { - "queries": { - "items": { - "type": "string" - }, - "type": [ - "array", - "null" - ] - }, - "query": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "search" - ], - "title": "SearchWebSearchActionType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "SearchWebSearchAction", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "openPage" - ], - "title": "OpenPageWebSearchActionType", - "type": "string" - }, - "url": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type" - ], - "title": "OpenPageWebSearchAction", - "type": "object" - }, - { - "properties": { - "pattern": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "findInPage" - ], - "title": "FindInPageWebSearchActionType", - "type": "string" - }, - "url": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type" - ], - "title": "FindInPageWebSearchAction", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "other" - ], - "title": "OtherWebSearchActionType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "OtherWebSearchAction", - "type": "object" - } - ] - } - }, "properties": { "threadId": { "type": "string" }, "turn": { - "$ref": "#/definitions/Turn" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Turn" } }, "required": [ diff --git a/extensions/codex/src/app-server/protocol-generated/json/v2/TurnStartResponse.json b/extensions/codex/src/app-server/protocol-generated/json/v2/TurnStartResponse.json index 75c1b1f33f26..8ae520eec6b1 100644 --- a/extensions/codex/src/app-server/protocol-generated/json/v2/TurnStartResponse.json +++ b/extensions/codex/src/app-server/protocol-generated/json/v2/TurnStartResponse.json @@ -1,1889 +1,8 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "AbsolutePathBuf": { - "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", - "type": "string" - }, - "ByteRange": { - "properties": { - "end": { - "format": "uint", - "minimum": 0, - "type": "integer" - }, - "start": { - "format": "uint", - "minimum": 0, - "type": "integer" - } - }, - "required": [ - "end", - "start" - ], - "type": "object" - }, - "CodexErrorInfo": { - "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.", - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "httpConnectionFailed": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "httpConnectionFailed" - ], - "title": "HttpConnectionFailedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Failed to connect to the response SSE stream.", - "properties": { - "responseStreamConnectionFailed": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseStreamConnectionFailed" - ], - "title": "ResponseStreamConnectionFailedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "The response SSE stream disconnected in the middle of a turn before completion.", - "properties": { - "responseStreamDisconnected": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseStreamDisconnected" - ], - "title": "ResponseStreamDisconnectedCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Reached the retry limit for responses.", - "properties": { - "responseTooManyFailedAttempts": { - "properties": { - "httpStatusCode": { - "format": "uint16", - "minimum": 0, - "type": [ - "integer", - "null" - ] - } - }, - "type": "object" - } - }, - "required": [ - "responseTooManyFailedAttempts" - ], - "title": "ResponseTooManyFailedAttemptsCodexErrorInfo", - "type": "object" - }, - { - "additionalProperties": false, - "description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.", - "properties": { - "activeTurnNotSteerable": { - "properties": { - "turnKind": { - "$ref": "#/definitions/NonSteerableTurnKind" - } - }, - "required": [ - "turnKind" - ], - "type": "object" - } - }, - "required": [ - "activeTurnNotSteerable" - ], - "title": "ActiveTurnNotSteerableCodexErrorInfo", - "type": "object" - }, - { - "enum": [ - "contextWindowExceeded", - "sessionBudgetExceeded", - "usageLimitExceeded", - "serverOverloaded", - "cyberPolicy", - "internalServerError", - "unauthorized", - "badRequest", - "threadRollbackFailed", - "sandboxError", - "other" - ], - "type": "string" - } - ] - }, - "CollabAgentState": { - "properties": { - "message": { - "type": [ - "string", - "null" - ] - }, - "status": { - "$ref": "#/definitions/CollabAgentStatus" - } - }, - "required": [ - "status" - ], - "type": "object" - }, - "CollabAgentStatus": { - "enum": [ - "pendingInit", - "running", - "interrupted", - "completed", - "errored", - "shutdown", - "notFound" - ], - "type": "string" - }, - "CollabAgentTool": { - "enum": [ - "spawnAgent", - "sendInput", - "resumeAgent", - "wait", - "closeAgent" - ], - "type": "string" - }, - "CollabAgentToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "CommandAction": { - "oneOf": [ - { - "properties": { - "command": { - "type": "string" - }, - "name": { - "type": "string" - }, - "path": { - "$ref": "#/definitions/AbsolutePathBuf" - }, - "type": { - "enum": [ - "read" - ], - "title": "ReadCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "name", - "path", - "type" - ], - "title": "ReadCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "path": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "listFiles" - ], - "title": "ListFilesCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "ListFilesCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "path": { - "type": [ - "string", - "null" - ] - }, - "query": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "search" - ], - "title": "SearchCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "SearchCommandAction", - "type": "object" - }, - { - "properties": { - "command": { - "type": "string" - }, - "type": { - "enum": [ - "unknown" - ], - "title": "UnknownCommandActionType", - "type": "string" - } - }, - "required": [ - "command", - "type" - ], - "title": "UnknownCommandAction", - "type": "object" - } - ] - }, - "CommandExecutionSource": { - "enum": [ - "agent", - "userShell", - "unifiedExecStartup", - "unifiedExecInteraction" - ], - "type": "string" - }, - "CommandExecutionStatus": { - "enum": [ - "inProgress", - "completed", - "failed", - "declined" - ], - "type": "string" - }, - "DynamicToolCallOutputContentItem": { - "oneOf": [ - { - "properties": { - "text": { - "type": "string" - }, - "type": { - "enum": [ - "inputText" - ], - "title": "InputTextDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "text", - "type" - ], - "title": "InputTextDynamicToolCallOutputContentItem", - "type": "object" - }, - { - "properties": { - "imageUrl": { - "type": "string" - }, - "type": { - "enum": [ - "inputImage" - ], - "title": "InputImageDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "imageUrl", - "type" - ], - "title": "InputImageDynamicToolCallOutputContentItem", - "type": "object" - }, - { - "properties": { - "audioUrl": { - "type": "string" - }, - "type": { - "enum": [ - "inputAudio" - ], - "title": "InputAudioDynamicToolCallOutputContentItemType", - "type": "string" - } - }, - "required": [ - "audioUrl", - "type" - ], - "title": "InputAudioDynamicToolCallOutputContentItem", - "type": "object" - } - ] - }, - "DynamicToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "FileUpdateChange": { - "properties": { - "diff": { - "type": "string" - }, - "kind": { - "$ref": "#/definitions/PatchChangeKind" - }, - "path": { - "type": "string" - } - }, - "required": [ - "diff", - "kind", - "path" - ], - "type": "object" - }, - "HookPromptFragment": { - "properties": { - "hookRunId": { - "type": "string" - }, - "text": { - "type": "string" - } - }, - "required": [ - "hookRunId", - "text" - ], - "type": "object" - }, - "ImageDetail": { - "enum": [ - "auto", - "low", - "high", - "original" - ], - "type": "string" - }, - "LegacyAppPathString": { - "type": "string" - }, - "McpToolCallAppContext": { - "properties": { - "actionName": { - "type": [ - "string", - "null" - ] - }, - "appName": { - "type": [ - "string", - "null" - ] - }, - "connectorId": { - "type": "string" - }, - "linkId": { - "type": [ - "string", - "null" - ] - }, - "resourceUri": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "connectorId" - ], - "type": "object" - }, - "McpToolCallError": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - }, - "McpToolCallResult": { - "properties": { - "_meta": true, - "content": { - "items": true, - "type": "array" - }, - "structuredContent": true - }, - "required": [ - "content" - ], - "type": "object" - }, - "McpToolCallStatus": { - "enum": [ - "inProgress", - "completed", - "failed" - ], - "type": "string" - }, - "MemoryCitation": { - "properties": { - "entries": { - "items": { - "$ref": "#/definitions/MemoryCitationEntry" - }, - "type": "array" - }, - "threadIds": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - "required": [ - "entries", - "threadIds" - ], - "type": "object" - }, - "MemoryCitationEntry": { - "properties": { - "lineEnd": { - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "lineStart": { - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "note": { - "type": "string" - }, - "path": { - "type": "string" - } - }, - "required": [ - "lineEnd", - "lineStart", - "note", - "path" - ], - "type": "object" - }, - "MessagePhase": { - "description": "Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as \"phase unknown\" and keep compatibility behavior for legacy models.", - "oneOf": [ - { - "description": "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.", - "enum": [ - "commentary" - ], - "type": "string" - }, - { - "description": "The assistant's terminal answer text for the current turn.", - "enum": [ - "final_answer" - ], - "type": "string" - } - ] - }, - "NonSteerableTurnKind": { - "enum": [ - "review", - "compact" - ], - "type": "string" - }, - "PatchApplyStatus": { - "enum": [ - "inProgress", - "completed", - "failed", - "declined" - ], - "type": "string" - }, - "PatchChangeKind": { - "oneOf": [ - { - "properties": { - "type": { - "enum": [ - "add" - ], - "title": "AddPatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "AddPatchChangeKind", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "delete" - ], - "title": "DeletePatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "DeletePatchChangeKind", - "type": "object" - }, - { - "properties": { - "move_path": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "update" - ], - "title": "UpdatePatchChangeKindType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "UpdatePatchChangeKind", - "type": "object" - } - ] - }, - "ReasoningEffort": { - "description": "A non-empty reasoning effort value advertised by the model.", - "minLength": 1, - "type": "string" - }, - "SubAgentActivityKind": { - "enum": [ - "started", - "interacted", - "interrupted" - ], - "type": "string" - }, - "TextElement": { - "properties": { - "byteRange": { - "allOf": [ - { - "$ref": "#/definitions/ByteRange" - } - ], - "description": "Byte range in the parent `text` buffer that this element occupies." - }, - "placeholder": { - "description": "Optional human-readable placeholder for the element, displayed in the UI.", - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "byteRange" - ], - "type": "object" - }, - "ThreadItem": { - "oneOf": [ - { - "properties": { - "clientId": { - "type": [ - "string", - "null" - ] - }, - "content": { - "items": { - "$ref": "#/definitions/UserInput" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "userMessage" - ], - "title": "UserMessageThreadItemType", - "type": "string" - } - }, - "required": [ - "content", - "id", - "type" - ], - "title": "UserMessageThreadItem", - "type": "object" - }, - { - "properties": { - "fragments": { - "items": { - "$ref": "#/definitions/HookPromptFragment" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "hookPrompt" - ], - "title": "HookPromptThreadItemType", - "type": "string" - } - }, - "required": [ - "fragments", - "id", - "type" - ], - "title": "HookPromptThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "memoryCitation": { - "anyOf": [ - { - "$ref": "#/definitions/MemoryCitation" - }, - { - "type": "null" - } - ], - "default": null - }, - "phase": { - "anyOf": [ - { - "$ref": "#/definitions/MessagePhase" - }, - { - "type": "null" - } - ], - "default": null - }, - "text": { - "type": "string" - }, - "type": { - "enum": [ - "agentMessage" - ], - "title": "AgentMessageThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "text", - "type" - ], - "title": "AgentMessageThreadItem", - "type": "object" - }, - { - "description": "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.", - "properties": { - "id": { - "type": "string" - }, - "text": { - "type": "string" - }, - "type": { - "enum": [ - "plan" - ], - "title": "PlanThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "text", - "type" - ], - "title": "PlanThreadItem", - "type": "object" - }, - { - "properties": { - "content": { - "default": [], - "items": { - "type": "string" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "summary": { - "default": [], - "items": { - "type": "string" - }, - "type": "array" - }, - "type": { - "enum": [ - "reasoning" - ], - "title": "ReasoningThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "type" - ], - "title": "ReasoningThreadItem", - "type": "object" - }, - { - "properties": { - "aggregatedOutput": { - "description": "The command's output, aggregated from stdout and stderr.", - "type": [ - "string", - "null" - ] - }, - "command": { - "description": "The command to be executed.", - "type": "string" - }, - "commandActions": { - "description": "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.", - "items": { - "$ref": "#/definitions/CommandAction" - }, - "type": "array" - }, - "cwd": { - "allOf": [ - { - "$ref": "#/definitions/LegacyAppPathString" - } - ], - "description": "The command's working directory." - }, - "durationMs": { - "description": "The duration of the command execution in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "exitCode": { - "description": "The command's exit code.", - "format": "int32", - "type": [ - "integer", - "null" - ] - }, - "id": { - "type": "string" - }, - "pluginId": { - "default": null, - "description": "Trusted first-party plugin id when this command resolves to one plugin script.", - "type": [ - "string", - "null" - ] - }, - "processId": { - "description": "Identifier for the underlying PTY process (when available).", - "type": [ - "string", - "null" - ] - }, - "scriptPath": { - "default": null, - "description": "Safe plugin-relative path when this command resolves to one plugin script.", - "type": [ - "string", - "null" - ] - }, - "source": { - "allOf": [ - { - "$ref": "#/definitions/CommandExecutionSource" - } - ], - "default": "agent" - }, - "status": { - "$ref": "#/definitions/CommandExecutionStatus" - }, - "type": { - "enum": [ - "commandExecution" - ], - "title": "CommandExecutionThreadItemType", - "type": "string" - } - }, - "required": [ - "command", - "commandActions", - "cwd", - "id", - "status", - "type" - ], - "title": "CommandExecutionThreadItem", - "type": "object" - }, - { - "properties": { - "changes": { - "items": { - "$ref": "#/definitions/FileUpdateChange" - }, - "type": "array" - }, - "id": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/PatchApplyStatus" - }, - "type": { - "enum": [ - "fileChange" - ], - "title": "FileChangeThreadItemType", - "type": "string" - } - }, - "required": [ - "changes", - "id", - "status", - "type" - ], - "title": "FileChangeThreadItem", - "type": "object" - }, - { - "properties": { - "appContext": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallAppContext" - }, - { - "type": "null" - } - ] - }, - "arguments": true, - "durationMs": { - "description": "The duration of the MCP tool call in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "error": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallError" - }, - { - "type": "null" - } - ] - }, - "id": { - "type": "string" - }, - "mcpAppResourceUri": { - "description": "Deprecated: use `appContext.resourceUri` instead.", - "type": [ - "string", - "null" - ] - }, - "pluginId": { - "type": [ - "string", - "null" - ] - }, - "result": { - "anyOf": [ - { - "$ref": "#/definitions/McpToolCallResult" - }, - { - "type": "null" - } - ] - }, - "server": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/McpToolCallStatus" - }, - "tool": { - "type": "string" - }, - "type": { - "enum": [ - "mcpToolCall" - ], - "title": "McpToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "arguments", - "id", - "server", - "status", - "tool", - "type" - ], - "title": "McpToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "arguments": true, - "contentItems": { - "items": { - "$ref": "#/definitions/DynamicToolCallOutputContentItem" - }, - "type": [ - "array", - "null" - ] - }, - "durationMs": { - "description": "The duration of the dynamic tool call in milliseconds.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "id": { - "type": "string" - }, - "namespace": { - "type": [ - "string", - "null" - ] - }, - "status": { - "$ref": "#/definitions/DynamicToolCallStatus" - }, - "success": { - "type": [ - "boolean", - "null" - ] - }, - "tool": { - "type": "string" - }, - "type": { - "enum": [ - "dynamicToolCall" - ], - "title": "DynamicToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "arguments", - "id", - "status", - "tool", - "type" - ], - "title": "DynamicToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "agentsStates": { - "additionalProperties": { - "$ref": "#/definitions/CollabAgentState" - }, - "description": "Last known status of the target agents, when available.", - "type": "object" - }, - "id": { - "description": "Unique identifier for this collab tool call.", - "type": "string" - }, - "model": { - "description": "Model requested for the spawned agent, when applicable.", - "type": [ - "string", - "null" - ] - }, - "prompt": { - "description": "Prompt text sent as part of the collab tool call, when available.", - "type": [ - "string", - "null" - ] - }, - "reasoningEffort": { - "anyOf": [ - { - "$ref": "#/definitions/ReasoningEffort" - }, - { - "type": "null" - } - ], - "description": "Reasoning effort requested for the spawned agent, when applicable." - }, - "receiverThreadIds": { - "description": "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.", - "items": { - "type": "string" - }, - "type": "array" - }, - "senderThreadId": { - "description": "Thread ID of the agent issuing the collab request.", - "type": "string" - }, - "status": { - "allOf": [ - { - "$ref": "#/definitions/CollabAgentToolCallStatus" - } - ], - "description": "Current status of the collab tool call." - }, - "tool": { - "allOf": [ - { - "$ref": "#/definitions/CollabAgentTool" - } - ], - "description": "Name of the collab tool that was invoked." - }, - "type": { - "enum": [ - "collabAgentToolCall" - ], - "title": "CollabAgentToolCallThreadItemType", - "type": "string" - } - }, - "required": [ - "agentsStates", - "id", - "receiverThreadIds", - "senderThreadId", - "status", - "tool", - "type" - ], - "title": "CollabAgentToolCallThreadItem", - "type": "object" - }, - { - "properties": { - "agentPath": { - "type": "string" - }, - "agentThreadId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kind": { - "$ref": "#/definitions/SubAgentActivityKind" - }, - "type": { - "enum": [ - "subAgentActivity" - ], - "title": "SubAgentActivityThreadItemType", - "type": "string" - } - }, - "required": [ - "agentPath", - "agentThreadId", - "id", - "kind", - "type" - ], - "title": "SubAgentActivityThreadItem", - "type": "object" - }, - { - "properties": { - "action": { - "anyOf": [ - { - "$ref": "#/definitions/WebSearchAction" - }, - { - "type": "null" - } - ] - }, - "id": { - "type": "string" - }, - "query": { - "type": "string" - }, - "results": { - "default": null, - "description": "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.", - "items": true, - "type": [ - "array", - "null" - ] - }, - "type": { - "enum": [ - "webSearch" - ], - "title": "WebSearchThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "query", - "type" - ], - "title": "WebSearchThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "path": { - "$ref": "#/definitions/LegacyAppPathString" - }, - "type": { - "enum": [ - "imageView" - ], - "title": "ImageViewThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "path", - "type" - ], - "title": "ImageViewThreadItem", - "type": "object" - }, - { - "description": "Display item emitted by the interruptible `clock.sleep` tool.", - "properties": { - "durationMs": { - "format": "uint64", - "minimum": 0, - "type": "integer" - }, - "id": { - "type": "string" - }, - "type": { - "enum": [ - "sleep" - ], - "title": "SleepThreadItemType", - "type": "string" - } - }, - "required": [ - "durationMs", - "id", - "type" - ], - "title": "SleepThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "result": { - "type": "string" - }, - "revisedPrompt": { - "type": [ - "string", - "null" - ] - }, - "savedPath": { - "anyOf": [ - { - "$ref": "#/definitions/AbsolutePathBuf" - }, - { - "type": "null" - } - ] - }, - "status": { - "type": "string" - }, - "type": { - "enum": [ - "imageGeneration" - ], - "title": "ImageGenerationThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "result", - "status", - "type" - ], - "title": "ImageGenerationThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "review": { - "type": "string" - }, - "type": { - "enum": [ - "enteredReviewMode" - ], - "title": "EnteredReviewModeThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "review", - "type" - ], - "title": "EnteredReviewModeThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "review": { - "type": "string" - }, - "type": { - "enum": [ - "exitedReviewMode" - ], - "title": "ExitedReviewModeThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "review", - "type" - ], - "title": "ExitedReviewModeThreadItem", - "type": "object" - }, - { - "properties": { - "id": { - "type": "string" - }, - "type": { - "enum": [ - "contextCompaction" - ], - "title": "ContextCompactionThreadItemType", - "type": "string" - } - }, - "required": [ - "id", - "type" - ], - "title": "ContextCompactionThreadItem", - "type": "object" - } - ] - }, - "Turn": { - "properties": { - "completedAt": { - "description": "Unix timestamp (in seconds) when the turn completed.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "durationMs": { - "description": "Duration between turn start and completion in milliseconds, if known.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "error": { - "anyOf": [ - { - "$ref": "#/definitions/TurnError" - }, - { - "type": "null" - } - ], - "description": "Only populated when the Turn's status is failed." - }, - "id": { - "description": "Identifier for this turn. Codex-generated turn IDs are UUIDv7.", - "type": "string" - }, - "items": { - "description": "Thread items currently included in this turn payload.", - "items": { - "$ref": "#/definitions/ThreadItem" - }, - "type": "array" - }, - "itemsView": { - "allOf": [ - { - "$ref": "#/definitions/TurnItemsView" - } - ], - "default": "full", - "description": "Describes how much of `items` has been loaded for this turn." - }, - "startedAt": { - "description": "Unix timestamp (in seconds) when the turn started.", - "format": "int64", - "type": [ - "integer", - "null" - ] - }, - "status": { - "$ref": "#/definitions/TurnStatus" - } - }, - "required": [ - "id", - "items", - "status" - ], - "type": "object" - }, - "TurnError": { - "properties": { - "additionalDetails": { - "default": null, - "type": [ - "string", - "null" - ] - }, - "codexErrorInfo": { - "anyOf": [ - { - "$ref": "#/definitions/CodexErrorInfo" - }, - { - "type": "null" - } - ] - }, - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - }, - "TurnItemsView": { - "oneOf": [ - { - "description": "`items` was not loaded for this turn. The field is intentionally empty.", - "enum": [ - "notLoaded" - ], - "type": "string" - }, - { - "description": "`items` contains only a display summary for this turn.", - "enum": [ - "summary" - ], - "type": "string" - }, - { - "description": "`items` contains every ThreadItem available from persisted app-server history for this turn.", - "enum": [ - "full" - ], - "type": "string" - } - ] - }, - "TurnStatus": { - "enum": [ - "completed", - "interrupted", - "failed", - "inProgress" - ], - "type": "string" - }, - "UserInput": { - "oneOf": [ - { - "properties": { - "text": { - "type": "string" - }, - "text_elements": { - "default": [], - "description": "UI-defined spans within `text` used to render or persist special elements.", - "items": { - "$ref": "#/definitions/TextElement" - }, - "type": "array" - }, - "type": { - "enum": [ - "text" - ], - "title": "TextUserInputType", - "type": "string" - } - }, - "required": [ - "text", - "type" - ], - "title": "TextUserInput", - "type": "object" - }, - { - "properties": { - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/ImageDetail" - }, - { - "type": "null" - } - ], - "default": null - }, - "type": { - "enum": [ - "image" - ], - "title": "ImageUserInputType", - "type": "string" - }, - "url": { - "type": "string" - } - }, - "required": [ - "type", - "url" - ], - "title": "ImageUserInput", - "type": "object" - }, - { - "properties": { - "detail": { - "anyOf": [ - { - "$ref": "#/definitions/ImageDetail" - }, - { - "type": "null" - } - ], - "default": null - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "localImage" - ], - "title": "LocalImageUserInputType", - "type": "string" - } - }, - "required": [ - "path", - "type" - ], - "title": "LocalImageUserInput", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "audio" - ], - "title": "AudioUserInputType", - "type": "string" - }, - "url": { - "type": "string" - } - }, - "required": [ - "type", - "url" - ], - "title": "AudioUserInput", - "type": "object" - }, - { - "properties": { - "path": { - "type": "string" - }, - "type": { - "enum": [ - "localAudio" - ], - "title": "LocalAudioUserInputType", - "type": "string" - } - }, - "required": [ - "path", - "type" - ], - "title": "LocalAudioUserInput", - "type": "object" - }, - { - "properties": { - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "skill" - ], - "title": "SkillUserInputType", - "type": "string" - } - }, - "required": [ - "name", - "path", - "type" - ], - "title": "SkillUserInput", - "type": "object" - }, - { - "properties": { - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "type": { - "enum": [ - "mention" - ], - "title": "MentionUserInputType", - "type": "string" - } - }, - "required": [ - "name", - "path", - "type" - ], - "title": "MentionUserInput", - "type": "object" - } - ] - }, - "WebSearchAction": { - "oneOf": [ - { - "properties": { - "queries": { - "items": { - "type": "string" - }, - "type": [ - "array", - "null" - ] - }, - "query": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "search" - ], - "title": "SearchWebSearchActionType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "SearchWebSearchAction", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "openPage" - ], - "title": "OpenPageWebSearchActionType", - "type": "string" - }, - "url": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type" - ], - "title": "OpenPageWebSearchAction", - "type": "object" - }, - { - "properties": { - "pattern": { - "type": [ - "string", - "null" - ] - }, - "type": { - "enum": [ - "findInPage" - ], - "title": "FindInPageWebSearchActionType", - "type": "string" - }, - "url": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type" - ], - "title": "FindInPageWebSearchAction", - "type": "object" - }, - { - "properties": { - "type": { - "enum": [ - "other" - ], - "title": "OtherWebSearchActionType", - "type": "string" - } - }, - "required": [ - "type" - ], - "title": "OtherWebSearchAction", - "type": "object" - } - ] - } - }, "properties": { "turn": { - "$ref": "#/definitions/Turn" + "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Turn" } }, "required": [ diff --git a/extensions/codex/src/app-server/protocol-validators.ts b/extensions/codex/src/app-server/protocol-validators.ts index 2283f34cec1d..2de4c9008420 100644 --- a/extensions/codex/src/app-server/protocol-validators.ts +++ b/extensions/codex/src/app-server/protocol-validators.ts @@ -4,13 +4,14 @@ */ import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime"; import { Compile, type Validator as TypeBoxValidator } from "typebox/compile"; -import dynamicToolCallParamsSchema from "./protocol-generated/json/DynamicToolCallParams.json" with { type: "json" }; -import errorNotificationSchema from "./protocol-generated/json/v2/ErrorNotification.json" with { type: "json" }; -import modelListResponseSchema from "./protocol-generated/json/v2/ModelListResponse.json" with { type: "json" }; -import threadResumeResponseSchema from "./protocol-generated/json/v2/ThreadResumeResponse.json" with { type: "json" }; -import threadStartResponseSchema from "./protocol-generated/json/v2/ThreadStartResponse.json" with { type: "json" }; -import turnCompletedNotificationSchema from "./protocol-generated/json/v2/TurnCompletedNotification.json" with { type: "json" }; -import turnStartResponseSchema from "./protocol-generated/json/v2/TurnStartResponse.json" with { type: "json" }; +import rawDynamicToolCallParamsSchema from "./protocol-generated/json/DynamicToolCallParams.json" with { type: "json" }; +import sharedDefinitionsSchema from "./protocol-generated/json/v2/CodexAppServerProtocolDefinitions.json" with { type: "json" }; +import rawErrorNotificationSchema from "./protocol-generated/json/v2/ErrorNotification.json" with { type: "json" }; +import rawModelListResponseSchema from "./protocol-generated/json/v2/ModelListResponse.json" with { type: "json" }; +import rawThreadResumeResponseSchema from "./protocol-generated/json/v2/ThreadResumeResponse.json" with { type: "json" }; +import rawThreadStartResponseSchema from "./protocol-generated/json/v2/ThreadStartResponse.json" with { type: "json" }; +import rawTurnCompletedNotificationSchema from "./protocol-generated/json/v2/TurnCompletedNotification.json" with { type: "json" }; +import rawTurnStartResponseSchema from "./protocol-generated/json/v2/TurnStartResponse.json" with { type: "json" }; import type { CodexDynamicToolCallParams, CodexErrorNotification, @@ -34,6 +35,96 @@ type CodexValidator = { errors: (value: unknown) => ValidationError[]; }; +const externalDefinitionRefPrefix = "./CodexAppServerProtocolDefinitions.json#/definitions/"; +const rootExternalDefinitionRefPrefix = "./v2/CodexAppServerProtocolDefinitions.json#/definitions/"; +const localDefinitionRefPrefix = "#/definitions/"; + +function materializeCodexSchema( + schema: unknown, + externalRefPrefix = externalDefinitionRefPrefix, +): unknown { + const sharedDefinitions: unknown = sharedDefinitionsSchema.definitions; + if (!isRecord(schema) || !isRecord(sharedDefinitions)) { + return schema; + } + const reachable = collectDefinitionRefs(schema, externalRefPrefix); + const pending = [...reachable]; + while (pending.length > 0) { + const name = pending.pop(); + if (name === undefined) { + continue; + } + const definition = sharedDefinitions[name]; + if (definition === undefined) { + throw new Error(`Missing generated Codex schema definition: ${name}`); + } + for (const dependency of collectDefinitionRefs(definition, localDefinitionRefPrefix)) { + if (!reachable.has(dependency)) { + reachable.add(dependency); + pending.push(dependency); + } + } + } + if (reachable.size === 0) { + return schema; + } + const definitions = Object.fromEntries( + Object.entries(sharedDefinitions).filter(([name]) => reachable.has(name)), + ); + return rewriteDefinitionRefs({ ...schema, definitions }, externalRefPrefix); +} + +function collectDefinitionRefs( + value: unknown, + prefix: string, + names = new Set(), +): Set { + if (Array.isArray(value)) { + for (const entry of value) { + collectDefinitionRefs(entry, prefix, names); + } + } else if (isRecord(value)) { + if (typeof value.$ref === "string" && value.$ref.startsWith(prefix)) { + const name = value.$ref.slice(prefix.length).split("/", 1)[0]; + if (name) { + names.add(name.replaceAll("~1", "/").replaceAll("~0", "~")); + } + } + for (const entry of Object.values(value)) { + collectDefinitionRefs(entry, prefix, names); + } + } + return names; +} + +function rewriteDefinitionRefs(value: unknown, externalRefPrefix: string): unknown { + if (Array.isArray(value)) { + return value.map((entry) => rewriteDefinitionRefs(entry, externalRefPrefix)); + } + if (!isRecord(value)) { + return value; + } + return Object.fromEntries( + Object.entries(value).map(([key, entry]) => [ + key, + key === "$ref" && typeof entry === "string" && entry.startsWith(externalRefPrefix) + ? `${localDefinitionRefPrefix}${entry.slice(externalRefPrefix.length)}` + : rewriteDefinitionRefs(entry, externalRefPrefix), + ]), + ); +} + +const dynamicToolCallParamsSchema = materializeCodexSchema( + rawDynamicToolCallParamsSchema, + rootExternalDefinitionRefPrefix, +); +const errorNotificationSchema = materializeCodexSchema(rawErrorNotificationSchema); +const modelListResponseSchema = materializeCodexSchema(rawModelListResponseSchema); +const threadResumeResponseSchema = materializeCodexSchema(rawThreadResumeResponseSchema); +const threadStartResponseSchema = materializeCodexSchema(rawThreadStartResponseSchema); +const turnCompletedNotificationSchema = materializeCodexSchema(rawTurnCompletedNotificationSchema); +const turnStartResponseSchema = materializeCodexSchema(rawTurnStartResponseSchema); + function compileCodexSchema(schema: unknown): CodexValidator { const validator = Compile(normalizeJsonSchemaNode(schema) as never) as TypeBoxValidator; return { diff --git a/scripts/check-codex-app-server-protocol.ts b/scripts/check-codex-app-server-protocol.ts index 7a415b2e8875..66cd10bcd241 100644 --- a/scripts/check-codex-app-server-protocol.ts +++ b/scripts/check-codex-app-server-protocol.ts @@ -3,6 +3,9 @@ import { spawnSync } from "node:child_process"; import fs from "node:fs/promises"; import path from "node:path"; import { + codexAppServerSharedDefinitionsSchema, + compactCodexAppServerProtocolJsonSchemas, + expandCodexAppServerProtocolJsonSchema, generateExperimentalCodexAppServerProtocolSource, normalizeCodexAppServerProtocolJsonText, selectedCodexAppServerJsonSchemas, @@ -486,27 +489,62 @@ function relativeTypeScriptImport(fromFile: string, toFile: string): string { } async function compareGeneratedProtocolMirror(sourceJsonRoot: string): Promise { + const sourceSchemas = new Map(); for (const schema of selectedCodexAppServerJsonSchemas) { const sourcePath = path.join(sourceJsonRoot, schema); - const targetPath = path.join(generatedRoot, "json", schema); - let sourceValue: string; - let target: string; try { - sourceValue = await fs.readFile(sourcePath, "utf8"); + sourceSchemas.set(schema, JSON.parse(await fs.readFile(sourcePath, "utf8"))); } catch (error) { failures.push( `protocol-generated/json/${schema}: missing upstream schema (${String(error)})`, ); + } + } + if (sourceSchemas.size !== selectedCodexAppServerJsonSchemas.length) { + return; + } + + const expected = compactCodexAppServerProtocolJsonSchemas(sourceSchemas); + const local = new Map(); + for (const [schema, expectedValue] of expected) { + const targetPath = path.join(generatedRoot, "json", schema); + try { + const target = await fs.readFile(targetPath, "utf8"); + local.set(schema, JSON.parse(target)); + if (normalizeJsonSchema(JSON.stringify(expectedValue)) !== normalizeJsonSchema(target)) { + failures.push(`protocol-generated/json/${schema}: differs from compacted source schema`); + } + } catch (error) { + failures.push(`protocol-generated/json/${schema}: missing local schema (${String(error)})`); + } + } + + const sharedSchema = local.get(codexAppServerSharedDefinitionsSchema); + if (sharedSchema === undefined) { + return; + } + for (const schema of selectedCodexAppServerJsonSchemas) { + const compactSchema = local.get(schema); + const sourceSchema = sourceSchemas.get(schema); + if (compactSchema === undefined || sourceSchema === undefined) { continue; } try { - target = await fs.readFile(targetPath, "utf8"); + const expanded = expandCodexAppServerProtocolJsonSchema({ + schema: compactSchema, + schemaPath: schema, + sharedSchema, + }); + if ( + normalizeJsonSchema(JSON.stringify(expanded)) !== + normalizeJsonSchema(JSON.stringify(sourceSchema)) + ) { + failures.push( + `protocol-generated/json/${schema}: compact schema does not expand to its source schema`, + ); + } } catch (error) { - failures.push(`protocol-generated/json/${schema}: missing local schema (${String(error)})`); - continue; - } - if (normalizeJsonSchema(sourceValue) !== normalizeJsonSchema(target)) { - failures.push(`protocol-generated/json/${schema}: differs from source schema`); + failures.push(`protocol-generated/json/${schema}: cannot expand (${String(error)})`); } } } diff --git a/scripts/lib/codex-app-server-protocol-source.ts b/scripts/lib/codex-app-server-protocol-source.ts index b2a21d4bcaf8..f81058b9dece 100644 --- a/scripts/lib/codex-app-server-protocol-source.ts +++ b/scripts/lib/codex-app-server-protocol-source.ts @@ -20,6 +20,10 @@ export const selectedCodexAppServerJsonSchemas = [ "v2/TurnStartResponse.json", ] as const; +export const codexAppServerSharedDefinitionsSchema = "v2/CodexAppServerProtocolDefinitions.json"; + +const localDefinitionRefPrefix = "#/definitions/"; + type GeneratedCodexAppServerProtocolSource = { root: string; codexRepo: string; @@ -404,6 +408,161 @@ export function formatCodexAppServerProtocolJsonText(text: string): string { return `${JSON.stringify(canonicalizeCodexAppServerProtocolJson(JSON.parse(text)), null, 2)}\n`; } +/** + * Factors definitions shared by the selected Codex schemas into one generated + * document. Each compact schema remains standard JSON Schema by referencing + * that sibling document; consumers can expand it back to the upstream shape. + */ +export function compactCodexAppServerProtocolJsonSchemas( + schemas: ReadonlyMap, +): Map { + const sharedDefinitions: Record = {}; + const compacted = new Map(); + + for (const schemaPath of selectedCodexAppServerJsonSchemas) { + const schema = schemas.get(schemaPath); + if (!isPlainObject(schema)) { + throw new Error(`Codex app-server schema ${schemaPath} must be a JSON object`); + } + const definitions = schema.definitions; + if (definitions !== undefined && !isPlainObject(definitions)) { + throw new Error(`Codex app-server schema ${schemaPath} definitions must be an object`); + } + for (const [name, definition] of Object.entries(definitions ?? {})) { + const existing = sharedDefinitions[name]; + if ( + existing !== undefined && + JSON.stringify(canonicalizeCodexAppServerProtocolJson(existing)) !== + JSON.stringify(canonicalizeCodexAppServerProtocolJson(definition)) + ) { + throw new Error(`Codex app-server shared definition ${name} differs across schemas`); + } + sharedDefinitions[name] = definition; + } + + const { definitions: _definitions, ...root } = schema; + const relativeBundlePath = path.posix.relative( + path.posix.dirname(schemaPath), + codexAppServerSharedDefinitionsSchema, + ); + const bundleRefPrefix = `${relativeBundlePath.startsWith(".") ? "" : "./"}${relativeBundlePath}${localDefinitionRefPrefix}`; + compacted.set( + schemaPath, + canonicalizeCodexAppServerProtocolJson( + rewriteSchemaRefs(root, localDefinitionRefPrefix, bundleRefPrefix), + ), + ); + } + + compacted.set( + codexAppServerSharedDefinitionsSchema, + canonicalizeCodexAppServerProtocolJson({ + $schema: "http://json-schema.org/draft-07/schema#", + definitions: sharedDefinitions, + title: "CodexAppServerProtocolDefinitions", + type: "object", + }), + ); + return compacted; +} + +/** Reconstructs one compact schema exactly as emitted by the pinned exporter. */ +export function expandCodexAppServerProtocolJsonSchema(params: { + schema: unknown; + schemaPath: string; + sharedSchema: unknown; +}): unknown { + if (!isPlainObject(params.schema) || !isPlainObject(params.sharedSchema)) { + throw new Error(`Codex app-server compact schema ${params.schemaPath} must be a JSON object`); + } + const sharedDefinitions = params.sharedSchema.definitions; + if (!isPlainObject(sharedDefinitions)) { + throw new Error("Codex app-server shared definitions schema must contain definitions"); + } + + const relativeBundlePath = path.posix.relative( + path.posix.dirname(params.schemaPath), + codexAppServerSharedDefinitionsSchema, + ); + const bundleRefPrefix = `${relativeBundlePath.startsWith(".") ? "" : "./"}${relativeBundlePath}${localDefinitionRefPrefix}`; + const root = rewriteSchemaRefs(params.schema, bundleRefPrefix, localDefinitionRefPrefix); + if (!isPlainObject(root)) { + throw new Error( + `Codex app-server compact schema ${params.schemaPath} must remain a JSON object`, + ); + } + const reachable = collectDefinitionNames(root, localDefinitionRefPrefix); + const pending = [...reachable]; + while (pending.length > 0) { + const name = pending.pop(); + if (name === undefined) { + continue; + } + const definition = sharedDefinitions[name]; + if (definition === undefined) { + throw new Error(`Codex app-server shared definition ${name} is missing`); + } + for (const dependency of collectDefinitionNames(definition, localDefinitionRefPrefix)) { + if (!reachable.has(dependency)) { + reachable.add(dependency); + pending.push(dependency); + } + } + } + + if (reachable.size === 0) { + return canonicalizeCodexAppServerProtocolJson(root); + } + const definitions = Object.fromEntries( + Object.entries(sharedDefinitions).filter(([name]) => reachable.has(name)), + ); + return canonicalizeCodexAppServerProtocolJson({ ...root, definitions }); +} + +function rewriteSchemaRefs(value: unknown, fromPrefix: string, toPrefix: string): unknown { + if (Array.isArray(value)) { + return value.map((entry) => rewriteSchemaRefs(entry, fromPrefix, toPrefix)); + } + if (!isPlainObject(value)) { + return value; + } + return Object.fromEntries( + Object.entries(value).map(([key, entry]) => [ + key, + key === "$ref" && typeof entry === "string" && entry.startsWith(fromPrefix) + ? `${toPrefix}${entry.slice(fromPrefix.length)}` + : rewriteSchemaRefs(entry, fromPrefix, toPrefix), + ]), + ); +} + +function collectDefinitionNames( + value: unknown, + refPrefix: string, + names = new Set(), +): Set { + if (Array.isArray(value)) { + for (const entry of value) { + collectDefinitionNames(entry, refPrefix, names); + } + return names; + } + if (!isPlainObject(value)) { + return names; + } + const reference = value.$ref; + if (typeof reference === "string" && reference.startsWith(refPrefix)) { + const encodedName = reference.slice(refPrefix.length).split("/", 1)[0]; + if (encodedName) { + names.add(encodedName.replaceAll("~1", "/").replaceAll("~0", "~")); + } + } + for (const entry of Object.values(value)) { + collectDefinitionNames(entry, refPrefix, names); + } + return names; +} + function sortCodexProtocolJsonArrayByType(items: unknown[]): unknown[] { if (!items.every(isPlainObject)) { return items; diff --git a/scripts/sync-codex-app-server-protocol.ts b/scripts/sync-codex-app-server-protocol.ts index 0871552b315a..2f0a834c9b0f 100644 --- a/scripts/sync-codex-app-server-protocol.ts +++ b/scripts/sync-codex-app-server-protocol.ts @@ -2,6 +2,7 @@ import fs from "node:fs/promises"; import path from "node:path"; import { + compactCodexAppServerProtocolJsonSchemas, formatCodexAppServerProtocolJsonText, generateExperimentalCodexAppServerProtocolSource, selectedCodexAppServerJsonSchemas, @@ -20,15 +21,21 @@ await main().catch((error: unknown) => { async function main(): Promise { const source = await generateExperimentalCodexAppServerProtocolSource(); try { + const selectedSchemas = new Map(); + for (const schema of selectedCodexAppServerJsonSchemas) { + const schemaSource = await fs.readFile(path.join(source.jsonRoot, schema), "utf8"); + selectedSchemas.set(schema, JSON.parse(schemaSource)); + } + const compactedSchemas = compactCodexAppServerProtocolJsonSchemas(selectedSchemas); + await fs.rm(targetRoot, { recursive: true, force: true }); await fs.mkdir(targetRoot, { recursive: true }); - for (const schema of selectedCodexAppServerJsonSchemas) { + for (const [schema, value] of compactedSchemas) { await fs.mkdir(path.dirname(path.join(targetRoot, "json", schema)), { recursive: true }); - const schemaSource = await fs.readFile(path.join(source.jsonRoot, schema), "utf8"); await fs.writeFile( path.join(targetRoot, "json", schema), - formatCodexAppServerProtocolJsonText(schemaSource), + formatCodexAppServerProtocolJsonText(JSON.stringify(value)), ); } } finally { diff --git a/test/scripts/codex-app-server-protocol-source.test.ts b/test/scripts/codex-app-server-protocol-source.test.ts index e436c59d68c9..bd0ef6494f91 100644 --- a/test/scripts/codex-app-server-protocol-source.test.ts +++ b/test/scripts/codex-app-server-protocol-source.test.ts @@ -6,12 +6,16 @@ import { stageCodexAppServerProtocolArtifacts } from "../../scripts/lib/codex-ap import { buildCodexProtocolExportArgs, canonicalizeCodexAppServerProtocolJson, + codexAppServerSharedDefinitionsSchema, + compactCodexAppServerProtocolJsonSchemas, + expandCodexAppServerProtocolJsonSchema, formatCodexAppServerProtocolJsonText, readCargoWorkspacePackageVersion, resolveCodexAppServerProtocolSource, resolveCodexProtocolCargoTargetDir, resolveCodexProtocolMinFreeBytes, resolveCodexProtocolPnpmCommand, + selectedCodexAppServerJsonSchemas, validateCodexProtocolSourceVersion, validateCodexProtocolGenerationHeadroom, } from "../../scripts/lib/codex-app-server-protocol-source.js"; @@ -350,6 +354,87 @@ describe("Codex app-server protocol JSON canonicalizer", () => { ], }); }); + + it("factors repeated definitions and exactly reconstructs every source schema", () => { + const schemas = new Map( + selectedCodexAppServerJsonSchemas.map((schemaPath) => [ + schemaPath, + { $schema: "http://json-schema.org/draft-07/schema#", title: schemaPath, type: "object" }, + ]), + ); + const shared = { properties: { value: { $ref: "#/definitions/Leaf" } }, type: "object" }; + const leaf = { type: "string" }; + schemas.set("DynamicToolCallParams.json", { + definitions: { Leaf: leaf }, + properties: { arguments: { $ref: "#/definitions/Leaf" } }, + title: "DynamicToolCallParams", + type: "object", + }); + schemas.set("v2/ErrorNotification.json", { + definitions: { Leaf: leaf, Shared: shared }, + properties: { error: { $ref: "#/definitions/Shared" } }, + title: "ErrorNotification", + type: "object", + }); + schemas.set("v2/GetAccountResponse.json", { + definitions: { Leaf: leaf, Shared: shared }, + properties: { account: { $ref: "#/definitions/Shared" } }, + title: "GetAccountResponse", + type: "object", + }); + + const compacted = compactCodexAppServerProtocolJsonSchemas(schemas); + const sharedSchema = compacted.get(codexAppServerSharedDefinitionsSchema); + expect(sharedSchema).toMatchObject({ + definitions: { Leaf: leaf, Shared: shared }, + title: "CodexAppServerProtocolDefinitions", + }); + expect(compacted.get("v2/ErrorNotification.json")).toMatchObject({ + properties: { + error: { + $ref: "./CodexAppServerProtocolDefinitions.json#/definitions/Shared", + }, + }, + }); + expect(compacted.get("DynamicToolCallParams.json")).toMatchObject({ + properties: { + arguments: { + $ref: "./v2/CodexAppServerProtocolDefinitions.json#/definitions/Leaf", + }, + }, + }); + + for (const schemaPath of selectedCodexAppServerJsonSchemas) { + expect( + expandCodexAppServerProtocolJsonSchema({ + schema: compacted.get(schemaPath), + schemaPath, + sharedSchema, + }), + ).toEqual(canonicalizeCodexAppServerProtocolJson(schemas.get(schemaPath))); + } + }); + + it("rejects same-name definitions with different schema semantics", () => { + const schemas = new Map( + selectedCodexAppServerJsonSchemas.map((schemaPath) => [ + schemaPath, + { title: schemaPath, type: "object" }, + ]), + ); + schemas.set("v2/ErrorNotification.json", { + definitions: { Shared: { type: "string" } }, + $ref: "#/definitions/Shared", + }); + schemas.set("v2/GetAccountResponse.json", { + definitions: { Shared: { type: "integer" } }, + $ref: "#/definitions/Shared", + }); + + expect(() => compactCodexAppServerProtocolJsonSchemas(schemas)).toThrow( + /shared definition Shared differs across schemas/, + ); + }); }); function createProtocolSchema(codexRepo: string): void {