diff --git a/codex-rs/app-server-protocol/schema/json/ClientNotification.json b/codex-rs/app-server-protocol/schema/json/ClientNotification.json index dde0b31fbd..bd2be8fd82 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientNotification.json +++ b/codex-rs/app-server-protocol/schema/json/ClientNotification.json @@ -1,5 +1,104 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "ModelRequestError": { + "properties": { + "code": { + "type": [ + "string", + "null" + ] + }, + "message": { + "type": "string" + }, + "param": { + "type": [ + "string", + "null" + ] + }, + "type": { + "type": "string" + } + }, + "required": [ + "message", + "type" + ], + "type": "object" + }, + "ModelRequestFailedNotification": { + "properties": { + "error": { + "$ref": "#/definitions/ModelRequestError" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "error", + "requestId", + "threadId", + "turnId" + ], + "type": "object" + }, + "ModelStreamEventNotification": { + "properties": { + "event": true, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "event", + "requestId", + "threadId", + "turnId" + ], + "type": "object" + }, + "ModelStreamMetadataNotification": { + "properties": { + "metadata": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "metadata", + "requestId", + "threadId", + "turnId" + ], + "type": "object" + } + }, "oneOf": [ { "properties": { @@ -16,6 +115,66 @@ ], "title": "InitializedNotification", "type": "object" + }, + { + "properties": { + "method": { + "enum": [ + "model/streamMetadata" + ], + "title": "Model/streamMetadataNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ModelStreamMetadataNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Model/streamMetadataNotification", + "type": "object" + }, + { + "properties": { + "method": { + "enum": [ + "model/streamEvent" + ], + "title": "Model/streamEventNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ModelStreamEventNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Model/streamEventNotification", + "type": "object" + }, + { + "properties": { + "method": { + "enum": [ + "model/requestFailed" + ], + "title": "Model/requestFailedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ModelRequestFailedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Model/requestFailedNotification", + "type": "object" } ], "title": "ClientNotification" diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.json index ae8e6fed34..0e679c04ae 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -1243,6 +1243,32 @@ ], "type": "string" }, + "NetworkDelegationConfig": { + "properties": { + "mode": { + "$ref": "#/definitions/NetworkDelegationMode" + }, + "streamIdleTimeoutMs": { + "format": "uint64", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "mode" + ], + "type": "object" + }, + "NetworkDelegationMode": { + "enum": [ + "enabled", + "disabled" + ], + "type": "string" + }, "Personality": { "enum": [ "none", diff --git a/codex-rs/app-server-protocol/schema/json/ModelCompactParams.json b/codex-rs/app-server-protocol/schema/json/ModelCompactParams.json new file mode 100644 index 0000000000..75826430fc --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/ModelCompactParams.json @@ -0,0 +1,961 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "ContentItem": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "input_text" + ], + "title": "InputTextContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "InputTextContentItem", + "type": "object" + }, + { + "properties": { + "image_url": { + "type": "string" + }, + "type": { + "enum": [ + "input_image" + ], + "title": "InputImageContentItemType", + "type": "string" + } + }, + "required": [ + "image_url", + "type" + ], + "title": "InputImageContentItem", + "type": "object" + }, + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "output_text" + ], + "title": "OutputTextContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "OutputTextContentItem", + "type": "object" + } + ] + }, + "FunctionCallOutputBody": { + "anyOf": [ + { + "type": "string" + }, + { + "items": { + "$ref": "#/definitions/FunctionCallOutputContentItem" + }, + "type": "array" + } + ] + }, + "FunctionCallOutputContentItem": { + "description": "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "input_text" + ], + "title": "InputTextFunctionCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "InputTextFunctionCallOutputContentItem", + "type": "object" + }, + { + "properties": { + "detail": { + "anyOf": [ + { + "$ref": "#/definitions/ImageDetail" + }, + { + "type": "null" + } + ] + }, + "image_url": { + "type": "string" + }, + "type": { + "enum": [ + "input_image" + ], + "title": "InputImageFunctionCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "image_url", + "type" + ], + "title": "InputImageFunctionCallOutputContentItem", + "type": "object" + } + ] + }, + "GhostCommit": { + "description": "Details of a ghost commit created from a repository state.", + "properties": { + "id": { + "type": "string" + }, + "parent": { + "type": [ + "string", + "null" + ] + }, + "preexisting_untracked_dirs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "preexisting_untracked_files": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "id", + "preexisting_untracked_dirs", + "preexisting_untracked_files" + ], + "type": "object" + }, + "ImageDetail": { + "enum": [ + "auto", + "low", + "high", + "original" + ], + "type": "string" + }, + "LocalShellAction": { + "oneOf": [ + { + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array" + }, + "env": { + "additionalProperties": { + "type": "string" + }, + "type": [ + "object", + "null" + ] + }, + "timeout_ms": { + "format": "uint64", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "type": { + "enum": [ + "exec" + ], + "title": "ExecLocalShellActionType", + "type": "string" + }, + "user": { + "type": [ + "string", + "null" + ] + }, + "working_directory": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "command", + "type" + ], + "title": "ExecLocalShellAction", + "type": "object" + } + ] + }, + "LocalShellStatus": { + "enum": [ + "completed", + "in_progress", + "incomplete" + ], + "type": "string" + }, + "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" + } + ] + }, + "ModelCompactEnvelope": { + "properties": { + "input": { + "items": { + "$ref": "#/definitions/ResponseItem" + }, + "type": "array" + }, + "instructions": { + "type": "string" + }, + "model": { + "type": "string" + }, + "parallelToolCalls": { + "type": "boolean" + }, + "reasoning": true, + "requestHeaders": { + "additionalProperties": { + "type": "string" + }, + "type": [ + "object", + "null" + ] + }, + "text": true, + "tools": { + "items": true, + "type": "array" + } + }, + "required": [ + "input", + "instructions", + "model", + "parallelToolCalls", + "tools" + ], + "type": "object" + }, + "ReasoningItemContent": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "reasoning_text" + ], + "title": "ReasoningTextReasoningItemContentType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "ReasoningTextReasoningItemContent", + "type": "object" + }, + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "text" + ], + "title": "TextReasoningItemContentType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "TextReasoningItemContent", + "type": "object" + } + ] + }, + "ReasoningItemReasoningSummary": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "summary_text" + ], + "title": "SummaryTextReasoningItemReasoningSummaryType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "SummaryTextReasoningItemReasoningSummary", + "type": "object" + } + ] + }, + "ResponseItem": { + "oneOf": [ + { + "properties": { + "content": { + "items": { + "$ref": "#/definitions/ContentItem" + }, + "type": "array" + }, + "end_turn": { + "type": [ + "boolean", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "phase": { + "anyOf": [ + { + "$ref": "#/definitions/MessagePhase" + }, + { + "type": "null" + } + ] + }, + "role": { + "type": "string" + }, + "type": { + "enum": [ + "message" + ], + "title": "MessageResponseItemType", + "type": "string" + } + }, + "required": [ + "content", + "role", + "type" + ], + "title": "MessageResponseItem", + "type": "object" + }, + { + "properties": { + "content": { + "default": null, + "items": { + "$ref": "#/definitions/ReasoningItemContent" + }, + "type": [ + "array", + "null" + ] + }, + "encrypted_content": { + "type": [ + "string", + "null" + ] + }, + "summary": { + "items": { + "$ref": "#/definitions/ReasoningItemReasoningSummary" + }, + "type": "array" + }, + "type": { + "enum": [ + "reasoning" + ], + "title": "ReasoningResponseItemType", + "type": "string" + } + }, + "required": [ + "summary", + "type" + ], + "title": "ReasoningResponseItem", + "type": "object" + }, + { + "properties": { + "action": { + "$ref": "#/definitions/LocalShellAction" + }, + "call_id": { + "description": "Set when using the Responses API.", + "type": [ + "string", + "null" + ] + }, + "id": { + "description": "Legacy id field retained for compatibility with older payloads.", + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "$ref": "#/definitions/LocalShellStatus" + }, + "type": { + "enum": [ + "local_shell_call" + ], + "title": "LocalShellCallResponseItemType", + "type": "string" + } + }, + "required": [ + "action", + "status", + "type" + ], + "title": "LocalShellCallResponseItem", + "type": "object" + }, + { + "properties": { + "arguments": { + "type": "string" + }, + "call_id": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "name": { + "type": "string" + }, + "namespace": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "function_call" + ], + "title": "FunctionCallResponseItemType", + "type": "string" + } + }, + "required": [ + "arguments", + "call_id", + "name", + "type" + ], + "title": "FunctionCallResponseItem", + "type": "object" + }, + { + "properties": { + "arguments": true, + "call_id": { + "type": [ + "string", + "null" + ] + }, + "execution": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "tool_search_call" + ], + "title": "ToolSearchCallResponseItemType", + "type": "string" + } + }, + "required": [ + "arguments", + "execution", + "type" + ], + "title": "ToolSearchCallResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "output": { + "$ref": "#/definitions/FunctionCallOutputBody" + }, + "type": { + "enum": [ + "function_call_output" + ], + "title": "FunctionCallOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "output", + "type" + ], + "title": "FunctionCallOutputResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "input": { + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "custom_tool_call" + ], + "title": "CustomToolCallResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "input", + "name", + "type" + ], + "title": "CustomToolCallResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "output": { + "$ref": "#/definitions/FunctionCallOutputBody" + }, + "type": { + "enum": [ + "custom_tool_call_output" + ], + "title": "CustomToolCallOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "output", + "type" + ], + "title": "CustomToolCallOutputResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": [ + "string", + "null" + ] + }, + "execution": { + "type": "string" + }, + "status": { + "type": "string" + }, + "tools": { + "items": true, + "type": "array" + }, + "type": { + "enum": [ + "tool_search_output" + ], + "title": "ToolSearchOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "execution", + "status", + "tools", + "type" + ], + "title": "ToolSearchOutputResponseItem", + "type": "object" + }, + { + "properties": { + "action": { + "anyOf": [ + { + "$ref": "#/definitions/ResponsesApiWebSearchAction" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "web_search_call" + ], + "title": "WebSearchCallResponseItemType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "WebSearchCallResponseItem", + "type": "object" + }, + { + "properties": { + "id": { + "type": "string" + }, + "result": { + "type": "string" + }, + "revised_prompt": { + "type": [ + "string", + "null" + ] + }, + "status": { + "type": "string" + }, + "type": { + "enum": [ + "image_generation_call" + ], + "title": "ImageGenerationCallResponseItemType", + "type": "string" + } + }, + "required": [ + "id", + "result", + "status", + "type" + ], + "title": "ImageGenerationCallResponseItem", + "type": "object" + }, + { + "properties": { + "ghost_commit": { + "$ref": "#/definitions/GhostCommit" + }, + "type": { + "enum": [ + "ghost_snapshot" + ], + "title": "GhostSnapshotResponseItemType", + "type": "string" + } + }, + "required": [ + "ghost_commit", + "type" + ], + "title": "GhostSnapshotResponseItem", + "type": "object" + }, + { + "properties": { + "encrypted_content": { + "type": "string" + }, + "type": { + "enum": [ + "compaction" + ], + "title": "CompactionResponseItemType", + "type": "string" + } + }, + "required": [ + "encrypted_content", + "type" + ], + "title": "CompactionResponseItem", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "other" + ], + "title": "OtherResponseItemType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "OtherResponseItem", + "type": "object" + } + ] + }, + "ResponsesApiWebSearchAction": { + "oneOf": [ + { + "properties": { + "queries": { + "items": { + "type": "string" + }, + "type": [ + "array", + "null" + ] + }, + "query": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "search" + ], + "title": "SearchResponsesApiWebSearchActionType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "SearchResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "open_page" + ], + "title": "OpenPageResponsesApiWebSearchActionType", + "type": "string" + }, + "url": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type" + ], + "title": "OpenPageResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "pattern": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "find_in_page" + ], + "title": "FindInPageResponsesApiWebSearchActionType", + "type": "string" + }, + "url": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type" + ], + "title": "FindInPageResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "other" + ], + "title": "OtherResponsesApiWebSearchActionType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "OtherResponsesApiWebSearchAction", + "type": "object" + } + ] + } + }, + "properties": { + "request": { + "$ref": "#/definitions/ModelCompactEnvelope" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "request", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelCompactParams", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/ModelCompactResponse.json b/codex-rs/app-server-protocol/schema/json/ModelCompactResponse.json new file mode 100644 index 0000000000..d830d585f4 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/ModelCompactResponse.json @@ -0,0 +1,910 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "ContentItem": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "input_text" + ], + "title": "InputTextContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "InputTextContentItem", + "type": "object" + }, + { + "properties": { + "image_url": { + "type": "string" + }, + "type": { + "enum": [ + "input_image" + ], + "title": "InputImageContentItemType", + "type": "string" + } + }, + "required": [ + "image_url", + "type" + ], + "title": "InputImageContentItem", + "type": "object" + }, + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "output_text" + ], + "title": "OutputTextContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "OutputTextContentItem", + "type": "object" + } + ] + }, + "FunctionCallOutputBody": { + "anyOf": [ + { + "type": "string" + }, + { + "items": { + "$ref": "#/definitions/FunctionCallOutputContentItem" + }, + "type": "array" + } + ] + }, + "FunctionCallOutputContentItem": { + "description": "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "input_text" + ], + "title": "InputTextFunctionCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "InputTextFunctionCallOutputContentItem", + "type": "object" + }, + { + "properties": { + "detail": { + "anyOf": [ + { + "$ref": "#/definitions/ImageDetail" + }, + { + "type": "null" + } + ] + }, + "image_url": { + "type": "string" + }, + "type": { + "enum": [ + "input_image" + ], + "title": "InputImageFunctionCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "image_url", + "type" + ], + "title": "InputImageFunctionCallOutputContentItem", + "type": "object" + } + ] + }, + "GhostCommit": { + "description": "Details of a ghost commit created from a repository state.", + "properties": { + "id": { + "type": "string" + }, + "parent": { + "type": [ + "string", + "null" + ] + }, + "preexisting_untracked_dirs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "preexisting_untracked_files": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "id", + "preexisting_untracked_dirs", + "preexisting_untracked_files" + ], + "type": "object" + }, + "ImageDetail": { + "enum": [ + "auto", + "low", + "high", + "original" + ], + "type": "string" + }, + "LocalShellAction": { + "oneOf": [ + { + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array" + }, + "env": { + "additionalProperties": { + "type": "string" + }, + "type": [ + "object", + "null" + ] + }, + "timeout_ms": { + "format": "uint64", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "type": { + "enum": [ + "exec" + ], + "title": "ExecLocalShellActionType", + "type": "string" + }, + "user": { + "type": [ + "string", + "null" + ] + }, + "working_directory": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "command", + "type" + ], + "title": "ExecLocalShellAction", + "type": "object" + } + ] + }, + "LocalShellStatus": { + "enum": [ + "completed", + "in_progress", + "incomplete" + ], + "type": "string" + }, + "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" + } + ] + }, + "ReasoningItemContent": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "reasoning_text" + ], + "title": "ReasoningTextReasoningItemContentType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "ReasoningTextReasoningItemContent", + "type": "object" + }, + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "text" + ], + "title": "TextReasoningItemContentType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "TextReasoningItemContent", + "type": "object" + } + ] + }, + "ReasoningItemReasoningSummary": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "summary_text" + ], + "title": "SummaryTextReasoningItemReasoningSummaryType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "SummaryTextReasoningItemReasoningSummary", + "type": "object" + } + ] + }, + "ResponseItem": { + "oneOf": [ + { + "properties": { + "content": { + "items": { + "$ref": "#/definitions/ContentItem" + }, + "type": "array" + }, + "end_turn": { + "type": [ + "boolean", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "phase": { + "anyOf": [ + { + "$ref": "#/definitions/MessagePhase" + }, + { + "type": "null" + } + ] + }, + "role": { + "type": "string" + }, + "type": { + "enum": [ + "message" + ], + "title": "MessageResponseItemType", + "type": "string" + } + }, + "required": [ + "content", + "role", + "type" + ], + "title": "MessageResponseItem", + "type": "object" + }, + { + "properties": { + "content": { + "default": null, + "items": { + "$ref": "#/definitions/ReasoningItemContent" + }, + "type": [ + "array", + "null" + ] + }, + "encrypted_content": { + "type": [ + "string", + "null" + ] + }, + "summary": { + "items": { + "$ref": "#/definitions/ReasoningItemReasoningSummary" + }, + "type": "array" + }, + "type": { + "enum": [ + "reasoning" + ], + "title": "ReasoningResponseItemType", + "type": "string" + } + }, + "required": [ + "summary", + "type" + ], + "title": "ReasoningResponseItem", + "type": "object" + }, + { + "properties": { + "action": { + "$ref": "#/definitions/LocalShellAction" + }, + "call_id": { + "description": "Set when using the Responses API.", + "type": [ + "string", + "null" + ] + }, + "id": { + "description": "Legacy id field retained for compatibility with older payloads.", + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "$ref": "#/definitions/LocalShellStatus" + }, + "type": { + "enum": [ + "local_shell_call" + ], + "title": "LocalShellCallResponseItemType", + "type": "string" + } + }, + "required": [ + "action", + "status", + "type" + ], + "title": "LocalShellCallResponseItem", + "type": "object" + }, + { + "properties": { + "arguments": { + "type": "string" + }, + "call_id": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "name": { + "type": "string" + }, + "namespace": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "function_call" + ], + "title": "FunctionCallResponseItemType", + "type": "string" + } + }, + "required": [ + "arguments", + "call_id", + "name", + "type" + ], + "title": "FunctionCallResponseItem", + "type": "object" + }, + { + "properties": { + "arguments": true, + "call_id": { + "type": [ + "string", + "null" + ] + }, + "execution": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "tool_search_call" + ], + "title": "ToolSearchCallResponseItemType", + "type": "string" + } + }, + "required": [ + "arguments", + "execution", + "type" + ], + "title": "ToolSearchCallResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "output": { + "$ref": "#/definitions/FunctionCallOutputBody" + }, + "type": { + "enum": [ + "function_call_output" + ], + "title": "FunctionCallOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "output", + "type" + ], + "title": "FunctionCallOutputResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "input": { + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "custom_tool_call" + ], + "title": "CustomToolCallResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "input", + "name", + "type" + ], + "title": "CustomToolCallResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "output": { + "$ref": "#/definitions/FunctionCallOutputBody" + }, + "type": { + "enum": [ + "custom_tool_call_output" + ], + "title": "CustomToolCallOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "output", + "type" + ], + "title": "CustomToolCallOutputResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": [ + "string", + "null" + ] + }, + "execution": { + "type": "string" + }, + "status": { + "type": "string" + }, + "tools": { + "items": true, + "type": "array" + }, + "type": { + "enum": [ + "tool_search_output" + ], + "title": "ToolSearchOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "execution", + "status", + "tools", + "type" + ], + "title": "ToolSearchOutputResponseItem", + "type": "object" + }, + { + "properties": { + "action": { + "anyOf": [ + { + "$ref": "#/definitions/ResponsesApiWebSearchAction" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "web_search_call" + ], + "title": "WebSearchCallResponseItemType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "WebSearchCallResponseItem", + "type": "object" + }, + { + "properties": { + "id": { + "type": "string" + }, + "result": { + "type": "string" + }, + "revised_prompt": { + "type": [ + "string", + "null" + ] + }, + "status": { + "type": "string" + }, + "type": { + "enum": [ + "image_generation_call" + ], + "title": "ImageGenerationCallResponseItemType", + "type": "string" + } + }, + "required": [ + "id", + "result", + "status", + "type" + ], + "title": "ImageGenerationCallResponseItem", + "type": "object" + }, + { + "properties": { + "ghost_commit": { + "$ref": "#/definitions/GhostCommit" + }, + "type": { + "enum": [ + "ghost_snapshot" + ], + "title": "GhostSnapshotResponseItemType", + "type": "string" + } + }, + "required": [ + "ghost_commit", + "type" + ], + "title": "GhostSnapshotResponseItem", + "type": "object" + }, + { + "properties": { + "encrypted_content": { + "type": "string" + }, + "type": { + "enum": [ + "compaction" + ], + "title": "CompactionResponseItemType", + "type": "string" + } + }, + "required": [ + "encrypted_content", + "type" + ], + "title": "CompactionResponseItem", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "other" + ], + "title": "OtherResponseItemType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "OtherResponseItem", + "type": "object" + } + ] + }, + "ResponsesApiWebSearchAction": { + "oneOf": [ + { + "properties": { + "queries": { + "items": { + "type": "string" + }, + "type": [ + "array", + "null" + ] + }, + "query": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "search" + ], + "title": "SearchResponsesApiWebSearchActionType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "SearchResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "open_page" + ], + "title": "OpenPageResponsesApiWebSearchActionType", + "type": "string" + }, + "url": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type" + ], + "title": "OpenPageResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "pattern": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "find_in_page" + ], + "title": "FindInPageResponsesApiWebSearchActionType", + "type": "string" + }, + "url": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type" + ], + "title": "FindInPageResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "other" + ], + "title": "OtherResponsesApiWebSearchActionType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "OtherResponsesApiWebSearchAction", + "type": "object" + } + ] + } + }, + "properties": { + "output": { + "items": { + "$ref": "#/definitions/ResponseItem" + }, + "type": "array" + } + }, + "required": [ + "output" + ], + "title": "ModelCompactResponse", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/ModelRequestParams.json b/codex-rs/app-server-protocol/schema/json/ModelRequestParams.json new file mode 100644 index 0000000000..9d3b1afea7 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/ModelRequestParams.json @@ -0,0 +1,992 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "ContentItem": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "input_text" + ], + "title": "InputTextContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "InputTextContentItem", + "type": "object" + }, + { + "properties": { + "image_url": { + "type": "string" + }, + "type": { + "enum": [ + "input_image" + ], + "title": "InputImageContentItemType", + "type": "string" + } + }, + "required": [ + "image_url", + "type" + ], + "title": "InputImageContentItem", + "type": "object" + }, + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "output_text" + ], + "title": "OutputTextContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "OutputTextContentItem", + "type": "object" + } + ] + }, + "FunctionCallOutputBody": { + "anyOf": [ + { + "type": "string" + }, + { + "items": { + "$ref": "#/definitions/FunctionCallOutputContentItem" + }, + "type": "array" + } + ] + }, + "FunctionCallOutputContentItem": { + "description": "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "input_text" + ], + "title": "InputTextFunctionCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "InputTextFunctionCallOutputContentItem", + "type": "object" + }, + { + "properties": { + "detail": { + "anyOf": [ + { + "$ref": "#/definitions/ImageDetail" + }, + { + "type": "null" + } + ] + }, + "image_url": { + "type": "string" + }, + "type": { + "enum": [ + "input_image" + ], + "title": "InputImageFunctionCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "image_url", + "type" + ], + "title": "InputImageFunctionCallOutputContentItem", + "type": "object" + } + ] + }, + "GhostCommit": { + "description": "Details of a ghost commit created from a repository state.", + "properties": { + "id": { + "type": "string" + }, + "parent": { + "type": [ + "string", + "null" + ] + }, + "preexisting_untracked_dirs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "preexisting_untracked_files": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "id", + "preexisting_untracked_dirs", + "preexisting_untracked_files" + ], + "type": "object" + }, + "ImageDetail": { + "enum": [ + "auto", + "low", + "high", + "original" + ], + "type": "string" + }, + "LocalShellAction": { + "oneOf": [ + { + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array" + }, + "env": { + "additionalProperties": { + "type": "string" + }, + "type": [ + "object", + "null" + ] + }, + "timeout_ms": { + "format": "uint64", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "type": { + "enum": [ + "exec" + ], + "title": "ExecLocalShellActionType", + "type": "string" + }, + "user": { + "type": [ + "string", + "null" + ] + }, + "working_directory": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "command", + "type" + ], + "title": "ExecLocalShellAction", + "type": "object" + } + ] + }, + "LocalShellStatus": { + "enum": [ + "completed", + "in_progress", + "incomplete" + ], + "type": "string" + }, + "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" + } + ] + }, + "ModelRequestEnvelope": { + "properties": { + "include": { + "items": { + "type": "string" + }, + "type": "array" + }, + "input": { + "items": { + "$ref": "#/definitions/ResponseItem" + }, + "type": "array" + }, + "instructions": { + "type": "string" + }, + "model": { + "type": "string" + }, + "parallelToolCalls": { + "type": "boolean" + }, + "promptCacheKey": { + "type": [ + "string", + "null" + ] + }, + "reasoning": true, + "requestHeaders": { + "additionalProperties": { + "type": "string" + }, + "type": [ + "object", + "null" + ] + }, + "serviceTier": { + "type": [ + "string", + "null" + ] + }, + "store": { + "type": "boolean" + }, + "stream": { + "type": "boolean" + }, + "text": true, + "toolChoice": { + "type": "string" + }, + "tools": { + "items": true, + "type": "array" + } + }, + "required": [ + "include", + "input", + "instructions", + "model", + "parallelToolCalls", + "store", + "stream", + "toolChoice", + "tools" + ], + "type": "object" + }, + "ReasoningItemContent": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "reasoning_text" + ], + "title": "ReasoningTextReasoningItemContentType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "ReasoningTextReasoningItemContent", + "type": "object" + }, + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "text" + ], + "title": "TextReasoningItemContentType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "TextReasoningItemContent", + "type": "object" + } + ] + }, + "ReasoningItemReasoningSummary": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "summary_text" + ], + "title": "SummaryTextReasoningItemReasoningSummaryType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "SummaryTextReasoningItemReasoningSummary", + "type": "object" + } + ] + }, + "ResponseItem": { + "oneOf": [ + { + "properties": { + "content": { + "items": { + "$ref": "#/definitions/ContentItem" + }, + "type": "array" + }, + "end_turn": { + "type": [ + "boolean", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "phase": { + "anyOf": [ + { + "$ref": "#/definitions/MessagePhase" + }, + { + "type": "null" + } + ] + }, + "role": { + "type": "string" + }, + "type": { + "enum": [ + "message" + ], + "title": "MessageResponseItemType", + "type": "string" + } + }, + "required": [ + "content", + "role", + "type" + ], + "title": "MessageResponseItem", + "type": "object" + }, + { + "properties": { + "content": { + "default": null, + "items": { + "$ref": "#/definitions/ReasoningItemContent" + }, + "type": [ + "array", + "null" + ] + }, + "encrypted_content": { + "type": [ + "string", + "null" + ] + }, + "summary": { + "items": { + "$ref": "#/definitions/ReasoningItemReasoningSummary" + }, + "type": "array" + }, + "type": { + "enum": [ + "reasoning" + ], + "title": "ReasoningResponseItemType", + "type": "string" + } + }, + "required": [ + "summary", + "type" + ], + "title": "ReasoningResponseItem", + "type": "object" + }, + { + "properties": { + "action": { + "$ref": "#/definitions/LocalShellAction" + }, + "call_id": { + "description": "Set when using the Responses API.", + "type": [ + "string", + "null" + ] + }, + "id": { + "description": "Legacy id field retained for compatibility with older payloads.", + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "$ref": "#/definitions/LocalShellStatus" + }, + "type": { + "enum": [ + "local_shell_call" + ], + "title": "LocalShellCallResponseItemType", + "type": "string" + } + }, + "required": [ + "action", + "status", + "type" + ], + "title": "LocalShellCallResponseItem", + "type": "object" + }, + { + "properties": { + "arguments": { + "type": "string" + }, + "call_id": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "name": { + "type": "string" + }, + "namespace": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "function_call" + ], + "title": "FunctionCallResponseItemType", + "type": "string" + } + }, + "required": [ + "arguments", + "call_id", + "name", + "type" + ], + "title": "FunctionCallResponseItem", + "type": "object" + }, + { + "properties": { + "arguments": true, + "call_id": { + "type": [ + "string", + "null" + ] + }, + "execution": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "tool_search_call" + ], + "title": "ToolSearchCallResponseItemType", + "type": "string" + } + }, + "required": [ + "arguments", + "execution", + "type" + ], + "title": "ToolSearchCallResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "output": { + "$ref": "#/definitions/FunctionCallOutputBody" + }, + "type": { + "enum": [ + "function_call_output" + ], + "title": "FunctionCallOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "output", + "type" + ], + "title": "FunctionCallOutputResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "input": { + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "custom_tool_call" + ], + "title": "CustomToolCallResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "input", + "name", + "type" + ], + "title": "CustomToolCallResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "output": { + "$ref": "#/definitions/FunctionCallOutputBody" + }, + "type": { + "enum": [ + "custom_tool_call_output" + ], + "title": "CustomToolCallOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "output", + "type" + ], + "title": "CustomToolCallOutputResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": [ + "string", + "null" + ] + }, + "execution": { + "type": "string" + }, + "status": { + "type": "string" + }, + "tools": { + "items": true, + "type": "array" + }, + "type": { + "enum": [ + "tool_search_output" + ], + "title": "ToolSearchOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "execution", + "status", + "tools", + "type" + ], + "title": "ToolSearchOutputResponseItem", + "type": "object" + }, + { + "properties": { + "action": { + "anyOf": [ + { + "$ref": "#/definitions/ResponsesApiWebSearchAction" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "web_search_call" + ], + "title": "WebSearchCallResponseItemType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "WebSearchCallResponseItem", + "type": "object" + }, + { + "properties": { + "id": { + "type": "string" + }, + "result": { + "type": "string" + }, + "revised_prompt": { + "type": [ + "string", + "null" + ] + }, + "status": { + "type": "string" + }, + "type": { + "enum": [ + "image_generation_call" + ], + "title": "ImageGenerationCallResponseItemType", + "type": "string" + } + }, + "required": [ + "id", + "result", + "status", + "type" + ], + "title": "ImageGenerationCallResponseItem", + "type": "object" + }, + { + "properties": { + "ghost_commit": { + "$ref": "#/definitions/GhostCommit" + }, + "type": { + "enum": [ + "ghost_snapshot" + ], + "title": "GhostSnapshotResponseItemType", + "type": "string" + } + }, + "required": [ + "ghost_commit", + "type" + ], + "title": "GhostSnapshotResponseItem", + "type": "object" + }, + { + "properties": { + "encrypted_content": { + "type": "string" + }, + "type": { + "enum": [ + "compaction" + ], + "title": "CompactionResponseItemType", + "type": "string" + } + }, + "required": [ + "encrypted_content", + "type" + ], + "title": "CompactionResponseItem", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "other" + ], + "title": "OtherResponseItemType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "OtherResponseItem", + "type": "object" + } + ] + }, + "ResponsesApiWebSearchAction": { + "oneOf": [ + { + "properties": { + "queries": { + "items": { + "type": "string" + }, + "type": [ + "array", + "null" + ] + }, + "query": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "search" + ], + "title": "SearchResponsesApiWebSearchActionType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "SearchResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "open_page" + ], + "title": "OpenPageResponsesApiWebSearchActionType", + "type": "string" + }, + "url": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type" + ], + "title": "OpenPageResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "pattern": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "find_in_page" + ], + "title": "FindInPageResponsesApiWebSearchActionType", + "type": "string" + }, + "url": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type" + ], + "title": "FindInPageResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "other" + ], + "title": "OtherResponsesApiWebSearchActionType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "OtherResponsesApiWebSearchAction", + "type": "object" + } + ] + } + }, + "properties": { + "request": { + "$ref": "#/definitions/ModelRequestEnvelope" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "request", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelRequestParams", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/ModelRequestResponse.json b/codex-rs/app-server-protocol/schema/json/ModelRequestResponse.json new file mode 100644 index 0000000000..ac9516db09 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/ModelRequestResponse.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "accepted": { + "type": "boolean" + }, + "rejectionReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "accepted" + ], + "title": "ModelRequestResponse", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/ServerRequest.json b/codex-rs/app-server-protocol/schema/json/ServerRequest.json index 1fbbfb1b0a..70c20a59a4 100644 --- a/codex-rs/app-server-protocol/schema/json/ServerRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ServerRequest.json @@ -463,6 +463,70 @@ ], "type": "object" }, + "ContentItem": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "input_text" + ], + "title": "InputTextContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "InputTextContentItem", + "type": "object" + }, + { + "properties": { + "image_url": { + "type": "string" + }, + "type": { + "enum": [ + "input_image" + ], + "title": "InputImageContentItemType", + "type": "string" + } + }, + "required": [ + "image_url", + "type" + ], + "title": "InputImageContentItem", + "type": "object" + }, + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "output_text" + ], + "title": "OutputTextContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "OutputTextContentItem", + "type": "object" + } + ] + }, "DynamicToolCallParams": { "properties": { "arguments": true, @@ -638,6 +702,179 @@ ], "type": "object" }, + "FunctionCallOutputBody": { + "anyOf": [ + { + "type": "string" + }, + { + "items": { + "$ref": "#/definitions/FunctionCallOutputContentItem" + }, + "type": "array" + } + ] + }, + "FunctionCallOutputContentItem": { + "description": "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.", + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "input_text" + ], + "title": "InputTextFunctionCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "InputTextFunctionCallOutputContentItem", + "type": "object" + }, + { + "properties": { + "detail": { + "anyOf": [ + { + "$ref": "#/definitions/ImageDetail" + }, + { + "type": "null" + } + ] + }, + "image_url": { + "type": "string" + }, + "type": { + "enum": [ + "input_image" + ], + "title": "InputImageFunctionCallOutputContentItemType", + "type": "string" + } + }, + "required": [ + "image_url", + "type" + ], + "title": "InputImageFunctionCallOutputContentItem", + "type": "object" + } + ] + }, + "GhostCommit": { + "description": "Details of a ghost commit created from a repository state.", + "properties": { + "id": { + "type": "string" + }, + "parent": { + "type": [ + "string", + "null" + ] + }, + "preexisting_untracked_dirs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "preexisting_untracked_files": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "id", + "preexisting_untracked_dirs", + "preexisting_untracked_files" + ], + "type": "object" + }, + "ImageDetail": { + "enum": [ + "auto", + "low", + "high", + "original" + ], + "type": "string" + }, + "LocalShellAction": { + "oneOf": [ + { + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array" + }, + "env": { + "additionalProperties": { + "type": "string" + }, + "type": [ + "object", + "null" + ] + }, + "timeout_ms": { + "format": "uint64", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "type": { + "enum": [ + "exec" + ], + "title": "ExecLocalShellActionType", + "type": "string" + }, + "user": { + "type": [ + "string", + "null" + ] + }, + "working_directory": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "command", + "type" + ], + "title": "ExecLocalShellAction", + "type": "object" + } + ] + }, + "LocalShellStatus": { + "enum": [ + "completed", + "in_progress", + "incomplete" + ], + "type": "string" + }, "MacOsAutomationPermission": { "oneOf": [ { @@ -1286,6 +1523,186 @@ ], "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" + } + ] + }, + "ModelCompactEnvelope": { + "properties": { + "input": { + "items": { + "$ref": "#/definitions/ResponseItem" + }, + "type": "array" + }, + "instructions": { + "type": "string" + }, + "model": { + "type": "string" + }, + "parallelToolCalls": { + "type": "boolean" + }, + "reasoning": true, + "requestHeaders": { + "additionalProperties": { + "type": "string" + }, + "type": [ + "object", + "null" + ] + }, + "text": true, + "tools": { + "items": true, + "type": "array" + } + }, + "required": [ + "input", + "instructions", + "model", + "parallelToolCalls", + "tools" + ], + "type": "object" + }, + "ModelCompactParams": { + "properties": { + "request": { + "$ref": "#/definitions/ModelCompactEnvelope" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "request", + "requestId", + "threadId", + "turnId" + ], + "type": "object" + }, + "ModelRequestEnvelope": { + "properties": { + "include": { + "items": { + "type": "string" + }, + "type": "array" + }, + "input": { + "items": { + "$ref": "#/definitions/ResponseItem" + }, + "type": "array" + }, + "instructions": { + "type": "string" + }, + "model": { + "type": "string" + }, + "parallelToolCalls": { + "type": "boolean" + }, + "promptCacheKey": { + "type": [ + "string", + "null" + ] + }, + "reasoning": true, + "requestHeaders": { + "additionalProperties": { + "type": "string" + }, + "type": [ + "object", + "null" + ] + }, + "serviceTier": { + "type": [ + "string", + "null" + ] + }, + "store": { + "type": "boolean" + }, + "stream": { + "type": "boolean" + }, + "text": true, + "toolChoice": { + "type": "string" + }, + "tools": { + "items": true, + "type": "array" + } + }, + "required": [ + "include", + "input", + "instructions", + "model", + "parallelToolCalls", + "store", + "stream", + "toolChoice", + "tools" + ], + "type": "object" + }, + "ModelRequestParams": { + "properties": { + "request": { + "$ref": "#/definitions/ModelRequestEnvelope" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "request", + "requestId", + "threadId", + "turnId" + ], + "type": "object" + }, "NetworkApprovalContext": { "properties": { "host": { @@ -1472,6 +1889,74 @@ ], "type": "object" }, + "ReasoningItemContent": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "reasoning_text" + ], + "title": "ReasoningTextReasoningItemContentType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "ReasoningTextReasoningItemContent", + "type": "object" + }, + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "text" + ], + "title": "TextReasoningItemContentType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "TextReasoningItemContent", + "type": "object" + } + ] + }, + "ReasoningItemReasoningSummary": { + "oneOf": [ + { + "properties": { + "text": { + "type": "string" + }, + "type": { + "enum": [ + "summary_text" + ], + "title": "SummaryTextReasoningItemReasoningSummaryType", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "title": "SummaryTextReasoningItemReasoningSummary", + "type": "object" + } + ] + }, "RequestId": { "anyOf": [ { @@ -1509,6 +1994,574 @@ }, "type": "object" }, + "ResponseItem": { + "oneOf": [ + { + "properties": { + "content": { + "items": { + "$ref": "#/definitions/ContentItem" + }, + "type": "array" + }, + "end_turn": { + "type": [ + "boolean", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "phase": { + "anyOf": [ + { + "$ref": "#/definitions/MessagePhase" + }, + { + "type": "null" + } + ] + }, + "role": { + "type": "string" + }, + "type": { + "enum": [ + "message" + ], + "title": "MessageResponseItemType", + "type": "string" + } + }, + "required": [ + "content", + "role", + "type" + ], + "title": "MessageResponseItem", + "type": "object" + }, + { + "properties": { + "content": { + "default": null, + "items": { + "$ref": "#/definitions/ReasoningItemContent" + }, + "type": [ + "array", + "null" + ] + }, + "encrypted_content": { + "type": [ + "string", + "null" + ] + }, + "summary": { + "items": { + "$ref": "#/definitions/ReasoningItemReasoningSummary" + }, + "type": "array" + }, + "type": { + "enum": [ + "reasoning" + ], + "title": "ReasoningResponseItemType", + "type": "string" + } + }, + "required": [ + "summary", + "type" + ], + "title": "ReasoningResponseItem", + "type": "object" + }, + { + "properties": { + "action": { + "$ref": "#/definitions/LocalShellAction" + }, + "call_id": { + "description": "Set when using the Responses API.", + "type": [ + "string", + "null" + ] + }, + "id": { + "description": "Legacy id field retained for compatibility with older payloads.", + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "$ref": "#/definitions/LocalShellStatus" + }, + "type": { + "enum": [ + "local_shell_call" + ], + "title": "LocalShellCallResponseItemType", + "type": "string" + } + }, + "required": [ + "action", + "status", + "type" + ], + "title": "LocalShellCallResponseItem", + "type": "object" + }, + { + "properties": { + "arguments": { + "type": "string" + }, + "call_id": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "name": { + "type": "string" + }, + "namespace": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "function_call" + ], + "title": "FunctionCallResponseItemType", + "type": "string" + } + }, + "required": [ + "arguments", + "call_id", + "name", + "type" + ], + "title": "FunctionCallResponseItem", + "type": "object" + }, + { + "properties": { + "arguments": true, + "call_id": { + "type": [ + "string", + "null" + ] + }, + "execution": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "tool_search_call" + ], + "title": "ToolSearchCallResponseItemType", + "type": "string" + } + }, + "required": [ + "arguments", + "execution", + "type" + ], + "title": "ToolSearchCallResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "output": { + "$ref": "#/definitions/FunctionCallOutputBody" + }, + "type": { + "enum": [ + "function_call_output" + ], + "title": "FunctionCallOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "output", + "type" + ], + "title": "FunctionCallOutputResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "input": { + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "custom_tool_call" + ], + "title": "CustomToolCallResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "input", + "name", + "type" + ], + "title": "CustomToolCallResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": "string" + }, + "output": { + "$ref": "#/definitions/FunctionCallOutputBody" + }, + "type": { + "enum": [ + "custom_tool_call_output" + ], + "title": "CustomToolCallOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "call_id", + "output", + "type" + ], + "title": "CustomToolCallOutputResponseItem", + "type": "object" + }, + { + "properties": { + "call_id": { + "type": [ + "string", + "null" + ] + }, + "execution": { + "type": "string" + }, + "status": { + "type": "string" + }, + "tools": { + "items": true, + "type": "array" + }, + "type": { + "enum": [ + "tool_search_output" + ], + "title": "ToolSearchOutputResponseItemType", + "type": "string" + } + }, + "required": [ + "execution", + "status", + "tools", + "type" + ], + "title": "ToolSearchOutputResponseItem", + "type": "object" + }, + { + "properties": { + "action": { + "anyOf": [ + { + "$ref": "#/definitions/ResponsesApiWebSearchAction" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": [ + "string", + "null" + ], + "writeOnly": true + }, + "status": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "web_search_call" + ], + "title": "WebSearchCallResponseItemType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "WebSearchCallResponseItem", + "type": "object" + }, + { + "properties": { + "id": { + "type": "string" + }, + "result": { + "type": "string" + }, + "revised_prompt": { + "type": [ + "string", + "null" + ] + }, + "status": { + "type": "string" + }, + "type": { + "enum": [ + "image_generation_call" + ], + "title": "ImageGenerationCallResponseItemType", + "type": "string" + } + }, + "required": [ + "id", + "result", + "status", + "type" + ], + "title": "ImageGenerationCallResponseItem", + "type": "object" + }, + { + "properties": { + "ghost_commit": { + "$ref": "#/definitions/GhostCommit" + }, + "type": { + "enum": [ + "ghost_snapshot" + ], + "title": "GhostSnapshotResponseItemType", + "type": "string" + } + }, + "required": [ + "ghost_commit", + "type" + ], + "title": "GhostSnapshotResponseItem", + "type": "object" + }, + { + "properties": { + "encrypted_content": { + "type": "string" + }, + "type": { + "enum": [ + "compaction" + ], + "title": "CompactionResponseItemType", + "type": "string" + } + }, + "required": [ + "encrypted_content", + "type" + ], + "title": "CompactionResponseItem", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "other" + ], + "title": "OtherResponseItemType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "OtherResponseItem", + "type": "object" + } + ] + }, + "ResponsesApiWebSearchAction": { + "oneOf": [ + { + "properties": { + "queries": { + "items": { + "type": "string" + }, + "type": [ + "array", + "null" + ] + }, + "query": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "search" + ], + "title": "SearchResponsesApiWebSearchActionType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "SearchResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "open_page" + ], + "title": "OpenPageResponsesApiWebSearchActionType", + "type": "string" + }, + "url": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type" + ], + "title": "OpenPageResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "pattern": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "find_in_page" + ], + "title": "FindInPageResponsesApiWebSearchActionType", + "type": "string" + }, + "url": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type" + ], + "title": "FindInPageResponsesApiWebSearchAction", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "other" + ], + "title": "OtherResponsesApiWebSearchActionType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "OtherResponsesApiWebSearchAction", + "type": "object" + } + ] + }, "ThreadId": { "type": "string" }, @@ -1720,6 +2773,54 @@ "title": "Item/permissions/requestApprovalRequest", "type": "object" }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "model/request" + ], + "title": "Model/requestRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ModelRequestParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "Model/requestRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "model/compact" + ], + "title": "Model/compactRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ModelCompactParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "Model/compactRequest", + "type": "object" + }, { "description": "Execute a dynamic tool call on the client.", "properties": { diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index e20953a231..902b6d48c0 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -250,6 +250,66 @@ ], "title": "InitializedNotification", "type": "object" + }, + { + "properties": { + "method": { + "enum": [ + "model/streamMetadata" + ], + "title": "Model/streamMetadataNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/ModelStreamMetadataNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Model/streamMetadataNotification", + "type": "object" + }, + { + "properties": { + "method": { + "enum": [ + "model/streamEvent" + ], + "title": "Model/streamEventNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/ModelStreamEventNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Model/streamEventNotification", + "type": "object" + }, + { + "properties": { + "method": { + "enum": [ + "model/requestFailed" + ], + "title": "Model/requestFailedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/ModelRequestFailedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Model/requestFailedNotification", + "type": "object" } ], "title": "ClientNotification" @@ -3071,6 +3131,206 @@ "title": "McpServerElicitationRequestResponse", "type": "object" }, + "ModelCompactEnvelope": { + "properties": { + "input": { + "items": { + "$ref": "#/definitions/v2/ResponseItem" + }, + "type": "array" + }, + "instructions": { + "type": "string" + }, + "model": { + "type": "string" + }, + "parallelToolCalls": { + "type": "boolean" + }, + "reasoning": true, + "requestHeaders": { + "additionalProperties": { + "type": "string" + }, + "type": [ + "object", + "null" + ] + }, + "text": true, + "tools": { + "items": true, + "type": "array" + } + }, + "required": [ + "input", + "instructions", + "model", + "parallelToolCalls", + "tools" + ], + "type": "object" + }, + "ModelCompactParams": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "request": { + "$ref": "#/definitions/ModelCompactEnvelope" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "request", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelCompactParams", + "type": "object" + }, + "ModelCompactResponse": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "output": { + "items": { + "$ref": "#/definitions/v2/ResponseItem" + }, + "type": "array" + } + }, + "required": [ + "output" + ], + "title": "ModelCompactResponse", + "type": "object" + }, + "ModelRequestEnvelope": { + "properties": { + "include": { + "items": { + "type": "string" + }, + "type": "array" + }, + "input": { + "items": { + "$ref": "#/definitions/v2/ResponseItem" + }, + "type": "array" + }, + "instructions": { + "type": "string" + }, + "model": { + "type": "string" + }, + "parallelToolCalls": { + "type": "boolean" + }, + "promptCacheKey": { + "type": [ + "string", + "null" + ] + }, + "reasoning": true, + "requestHeaders": { + "additionalProperties": { + "type": "string" + }, + "type": [ + "object", + "null" + ] + }, + "serviceTier": { + "type": [ + "string", + "null" + ] + }, + "store": { + "type": "boolean" + }, + "stream": { + "type": "boolean" + }, + "text": true, + "toolChoice": { + "type": "string" + }, + "tools": { + "items": true, + "type": "array" + } + }, + "required": [ + "include", + "input", + "instructions", + "model", + "parallelToolCalls", + "store", + "stream", + "toolChoice", + "tools" + ], + "type": "object" + }, + "ModelRequestParams": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "request": { + "$ref": "#/definitions/ModelRequestEnvelope" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "request", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelRequestParams", + "type": "object" + }, + "ModelRequestResponse": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "accepted": { + "type": "boolean" + }, + "rejectionReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "accepted" + ], + "title": "ModelRequestResponse", + "type": "object" + }, "NetworkApprovalContext": { "properties": { "host": { @@ -4507,6 +4767,54 @@ "title": "Item/permissions/requestApprovalRequest", "type": "object" }, + { + "properties": { + "id": { + "$ref": "#/definitions/v2/RequestId" + }, + "method": { + "enum": [ + "model/request" + ], + "title": "Model/requestRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ModelRequestParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "Model/requestRequest", + "type": "object" + }, + { + "properties": { + "id": { + "$ref": "#/definitions/v2/RequestId" + }, + "method": { + "enum": [ + "model/compact" + ], + "title": "Model/compactRequestMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ModelCompactParams" + } + }, + "required": [ + "id", + "method", + "params" + ], + "title": "Model/compactRequest", + "type": "object" + }, { "description": "Execute a dynamic tool call on the client.", "properties": { @@ -8872,6 +9180,58 @@ "title": "ModelListResponse", "type": "object" }, + "ModelRequestError": { + "properties": { + "code": { + "type": [ + "string", + "null" + ] + }, + "message": { + "type": "string" + }, + "param": { + "type": [ + "string", + "null" + ] + }, + "type": { + "type": "string" + } + }, + "required": [ + "message", + "type" + ], + "type": "object" + }, + "ModelRequestFailedNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "error": { + "$ref": "#/definitions/v2/ModelRequestError" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "error", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelRequestFailedNotification", + "type": "object" + }, "ModelRerouteReason": { "enum": [ "highRiskCyberActivity" @@ -8907,6 +9267,57 @@ "title": "ModelReroutedNotification", "type": "object" }, + "ModelStreamEventNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "event": true, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "event", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelStreamEventNotification", + "type": "object" + }, + "ModelStreamMetadataNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "metadata": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "metadata", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelStreamMetadataNotification", + "type": "object" + }, "ModelUpgradeInfo": { "properties": { "migrationMarkdown": { @@ -8943,6 +9354,32 @@ ], "type": "string" }, + "NetworkDelegationConfig": { + "properties": { + "mode": { + "$ref": "#/definitions/v2/NetworkDelegationMode" + }, + "streamIdleTimeoutMs": { + "format": "uint64", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "mode" + ], + "type": "object" + }, + "NetworkDelegationMode": { + "enum": [ + "enabled", + "disabled" + ], + "type": "string" + }, "NetworkRequirements": { "properties": { "allowLocalBinding": { diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index cb7b2c3a0a..f2a27b1326 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -5660,6 +5660,58 @@ "title": "ModelListResponse", "type": "object" }, + "ModelRequestError": { + "properties": { + "code": { + "type": [ + "string", + "null" + ] + }, + "message": { + "type": "string" + }, + "param": { + "type": [ + "string", + "null" + ] + }, + "type": { + "type": "string" + } + }, + "required": [ + "message", + "type" + ], + "type": "object" + }, + "ModelRequestFailedNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "error": { + "$ref": "#/definitions/ModelRequestError" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "error", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelRequestFailedNotification", + "type": "object" + }, "ModelRerouteReason": { "enum": [ "highRiskCyberActivity" @@ -5695,6 +5747,57 @@ "title": "ModelReroutedNotification", "type": "object" }, + "ModelStreamEventNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "event": true, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "event", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelStreamEventNotification", + "type": "object" + }, + "ModelStreamMetadataNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "metadata": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "metadata", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelStreamMetadataNotification", + "type": "object" + }, "ModelUpgradeInfo": { "properties": { "migrationMarkdown": { @@ -5731,6 +5834,32 @@ ], "type": "string" }, + "NetworkDelegationConfig": { + "properties": { + "mode": { + "$ref": "#/definitions/NetworkDelegationMode" + }, + "streamIdleTimeoutMs": { + "format": "uint64", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "mode" + ], + "type": "object" + }, + "NetworkDelegationMode": { + "enum": [ + "enabled", + "disabled" + ], + "type": "string" + }, "NetworkRequirements": { "properties": { "allowLocalBinding": { diff --git a/codex-rs/app-server-protocol/schema/json/v2/ModelRequestFailedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ModelRequestFailedNotification.json new file mode 100644 index 0000000000..170ccf0d96 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/ModelRequestFailedNotification.json @@ -0,0 +1,54 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "ModelRequestError": { + "properties": { + "code": { + "type": [ + "string", + "null" + ] + }, + "message": { + "type": "string" + }, + "param": { + "type": [ + "string", + "null" + ] + }, + "type": { + "type": "string" + } + }, + "required": [ + "message", + "type" + ], + "type": "object" + } + }, + "properties": { + "error": { + "$ref": "#/definitions/ModelRequestError" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "error", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelRequestFailedNotification", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/ModelStreamEventNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ModelStreamEventNotification.json new file mode 100644 index 0000000000..a3e6a407ab --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/ModelStreamEventNotification.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "event": true, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "event", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelStreamEventNotification", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/ModelStreamMetadataNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ModelStreamMetadataNotification.json new file mode 100644 index 0000000000..935475fad6 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/ModelStreamMetadataNotification.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "metadata": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "requestId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": "string" + } + }, + "required": [ + "metadata", + "requestId", + "threadId", + "turnId" + ], + "title": "ModelStreamMetadataNotification", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkParams.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkParams.json index a8fa95e2e9..93ae6f67b1 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkParams.json @@ -59,6 +59,32 @@ } ] }, + "NetworkDelegationConfig": { + "properties": { + "mode": { + "$ref": "#/definitions/NetworkDelegationMode" + }, + "streamIdleTimeoutMs": { + "format": "uint64", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "mode" + ], + "type": "object" + }, + "NetworkDelegationMode": { + "enum": [ + "enabled", + "disabled" + ], + "type": "string" + }, "SandboxMode": { "enum": [ "read-only", diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json index 3c8eb552ae..7267073cd6 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json @@ -315,6 +315,32 @@ } ] }, + "NetworkDelegationConfig": { + "properties": { + "mode": { + "$ref": "#/definitions/NetworkDelegationMode" + }, + "streamIdleTimeoutMs": { + "format": "uint64", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "mode" + ], + "type": "object" + }, + "NetworkDelegationMode": { + "enum": [ + "enabled", + "disabled" + ], + "type": "string" + }, "Personality": { "enum": [ "none", diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json index b4391c7ab5..ac2137ba55 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json @@ -79,6 +79,32 @@ ], "type": "object" }, + "NetworkDelegationConfig": { + "properties": { + "mode": { + "$ref": "#/definitions/NetworkDelegationMode" + }, + "streamIdleTimeoutMs": { + "format": "uint64", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "mode" + ], + "type": "object" + }, + "NetworkDelegationMode": { + "enum": [ + "enabled", + "disabled" + ], + "type": "string" + }, "Personality": { "enum": [ "none", diff --git a/codex-rs/app-server-protocol/schema/typescript/ClientNotification.ts b/codex-rs/app-server-protocol/schema/typescript/ClientNotification.ts index 8ce2839108..f777fcbb2d 100644 --- a/codex-rs/app-server-protocol/schema/typescript/ClientNotification.ts +++ b/codex-rs/app-server-protocol/schema/typescript/ClientNotification.ts @@ -1,5 +1,8 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ModelRequestFailedNotification } from "./v2/ModelRequestFailedNotification"; +import type { ModelStreamEventNotification } from "./v2/ModelStreamEventNotification"; +import type { ModelStreamMetadataNotification } from "./v2/ModelStreamMetadataNotification"; -export type ClientNotification = { "method": "initialized" }; +export type ClientNotification = { "method": "initialized" } | { "method": "model/streamMetadata", "params": ModelStreamMetadataNotification } | { "method": "model/streamEvent", "params": ModelStreamEventNotification } | { "method": "model/requestFailed", "params": ModelRequestFailedNotification }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ServerRequest.ts b/codex-rs/app-server-protocol/schema/typescript/ServerRequest.ts index 13d04b0be7..c1d4807727 100644 --- a/codex-rs/app-server-protocol/schema/typescript/ServerRequest.ts +++ b/codex-rs/app-server-protocol/schema/typescript/ServerRequest.ts @@ -9,10 +9,12 @@ import type { CommandExecutionRequestApprovalParams } from "./v2/CommandExecutio import type { DynamicToolCallParams } from "./v2/DynamicToolCallParams"; import type { FileChangeRequestApprovalParams } from "./v2/FileChangeRequestApprovalParams"; import type { McpServerElicitationRequestParams } from "./v2/McpServerElicitationRequestParams"; +import type { ModelCompactParams } from "./v2/ModelCompactParams"; +import type { ModelRequestParams } from "./v2/ModelRequestParams"; import type { PermissionsRequestApprovalParams } from "./v2/PermissionsRequestApprovalParams"; import type { ToolRequestUserInputParams } from "./v2/ToolRequestUserInputParams"; /** * Request initiated from the server and sent to the client. */ -export type ServerRequest = { "method": "item/commandExecution/requestApproval", id: RequestId, params: CommandExecutionRequestApprovalParams, } | { "method": "item/fileChange/requestApproval", id: RequestId, params: FileChangeRequestApprovalParams, } | { "method": "item/tool/requestUserInput", id: RequestId, params: ToolRequestUserInputParams, } | { "method": "mcpServer/elicitation/request", id: RequestId, params: McpServerElicitationRequestParams, } | { "method": "item/permissions/requestApproval", id: RequestId, params: PermissionsRequestApprovalParams, } | { "method": "item/tool/call", id: RequestId, params: DynamicToolCallParams, } | { "method": "account/chatgptAuthTokens/refresh", id: RequestId, params: ChatgptAuthTokensRefreshParams, } | { "method": "applyPatchApproval", id: RequestId, params: ApplyPatchApprovalParams, } | { "method": "execCommandApproval", id: RequestId, params: ExecCommandApprovalParams, }; +export type ServerRequest = { "method": "item/commandExecution/requestApproval", id: RequestId, params: CommandExecutionRequestApprovalParams, } | { "method": "item/fileChange/requestApproval", id: RequestId, params: FileChangeRequestApprovalParams, } | { "method": "item/tool/requestUserInput", id: RequestId, params: ToolRequestUserInputParams, } | { "method": "mcpServer/elicitation/request", id: RequestId, params: McpServerElicitationRequestParams, } | { "method": "item/permissions/requestApproval", id: RequestId, params: PermissionsRequestApprovalParams, } | { "method": "model/request", id: RequestId, params: ModelRequestParams, } | { "method": "model/compact", id: RequestId, params: ModelCompactParams, } | { "method": "item/tool/call", id: RequestId, params: DynamicToolCallParams, } | { "method": "account/chatgptAuthTokens/refresh", id: RequestId, params: ChatgptAuthTokensRefreshParams, } | { "method": "applyPatchApproval", id: RequestId, params: ApplyPatchApprovalParams, } | { "method": "execCommandApproval", id: RequestId, params: ExecCommandApprovalParams, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ModelCompactEnvelope.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ModelCompactEnvelope.ts new file mode 100644 index 0000000000..8b5f85e289 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ModelCompactEnvelope.ts @@ -0,0 +1,7 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ResponseItem } from "../ResponseItem"; +import type { JsonValue } from "../serde_json/JsonValue"; + +export type ModelCompactEnvelope = { model: string, input: Array, instructions: string, tools: Array, parallelToolCalls: boolean, reasoning: JsonValue | null, text: JsonValue | null, requestHeaders: { [key in string]?: string } | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ModelCompactParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ModelCompactParams.ts new file mode 100644 index 0000000000..14722d59ae --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ModelCompactParams.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ModelCompactEnvelope } from "./ModelCompactEnvelope"; + +export type ModelCompactParams = { threadId: string, turnId: string, requestId: string, request: ModelCompactEnvelope, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ModelCompactResponse.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ModelCompactResponse.ts new file mode 100644 index 0000000000..dcf950c56e --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ModelCompactResponse.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ResponseItem } from "../ResponseItem"; + +export type ModelCompactResponse = { output: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestEnvelope.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestEnvelope.ts new file mode 100644 index 0000000000..46d4de4ef9 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestEnvelope.ts @@ -0,0 +1,7 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ResponseItem } from "../ResponseItem"; +import type { JsonValue } from "../serde_json/JsonValue"; + +export type ModelRequestEnvelope = { model: string, instructions: string, input: Array, tools: Array, toolChoice: string, parallelToolCalls: boolean, reasoning: JsonValue | null, store: boolean, stream: boolean, include: Array, serviceTier: string | null, promptCacheKey: string | null, text: JsonValue | null, requestHeaders: { [key in string]?: string } | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestError.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestError.ts new file mode 100644 index 0000000000..e675e5d657 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestError.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ModelRequestError = { type: string, code: string | null, param: string | null, message: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestFailedNotification.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestFailedNotification.ts new file mode 100644 index 0000000000..e2090a8758 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestFailedNotification.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ModelRequestError } from "./ModelRequestError"; + +export type ModelRequestFailedNotification = { threadId: string, turnId: string, requestId: string, error: ModelRequestError, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestParams.ts new file mode 100644 index 0000000000..ce50876387 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestParams.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ModelRequestEnvelope } from "./ModelRequestEnvelope"; + +export type ModelRequestParams = { threadId: string, turnId: string, requestId: string, request: ModelRequestEnvelope, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestResponse.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestResponse.ts new file mode 100644 index 0000000000..a5180c4fa6 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ModelRequestResponse.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ModelRequestResponse = { accepted: boolean, rejectionReason: string | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ModelStreamEventNotification.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ModelStreamEventNotification.ts new file mode 100644 index 0000000000..28c193a431 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ModelStreamEventNotification.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { JsonValue } from "../serde_json/JsonValue"; + +export type ModelStreamEventNotification = { threadId: string, turnId: string, requestId: string, event: JsonValue, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ModelStreamMetadataNotification.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ModelStreamMetadataNotification.ts new file mode 100644 index 0000000000..11d0ebfaef --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ModelStreamMetadataNotification.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ModelStreamMetadataNotification = { threadId: string, turnId: string, requestId: string, metadata: { [key in string]?: string }, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/NetworkDelegationConfig.ts b/codex-rs/app-server-protocol/schema/typescript/v2/NetworkDelegationConfig.ts new file mode 100644 index 0000000000..7d11861a32 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/NetworkDelegationConfig.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { NetworkDelegationMode } from "./NetworkDelegationMode"; + +export type NetworkDelegationConfig = { mode: NetworkDelegationMode, streamIdleTimeoutMs: bigint | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/NetworkDelegationMode.ts b/codex-rs/app-server-protocol/schema/typescript/v2/NetworkDelegationMode.ts new file mode 100644 index 0000000000..8baa34baea --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/NetworkDelegationMode.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type NetworkDelegationMode = "enabled" | "disabled"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts index 3dcf98ae3c..641e5aa43e 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts @@ -180,14 +180,26 @@ export type { MemoryCitationEntry } from "./MemoryCitationEntry"; export type { MergeStrategy } from "./MergeStrategy"; export type { Model } from "./Model"; export type { ModelAvailabilityNux } from "./ModelAvailabilityNux"; +export type { ModelCompactEnvelope } from "./ModelCompactEnvelope"; +export type { ModelCompactParams } from "./ModelCompactParams"; +export type { ModelCompactResponse } from "./ModelCompactResponse"; export type { ModelListParams } from "./ModelListParams"; export type { ModelListResponse } from "./ModelListResponse"; +export type { ModelRequestEnvelope } from "./ModelRequestEnvelope"; +export type { ModelRequestError } from "./ModelRequestError"; +export type { ModelRequestFailedNotification } from "./ModelRequestFailedNotification"; +export type { ModelRequestParams } from "./ModelRequestParams"; +export type { ModelRequestResponse } from "./ModelRequestResponse"; export type { ModelRerouteReason } from "./ModelRerouteReason"; export type { ModelReroutedNotification } from "./ModelReroutedNotification"; +export type { ModelStreamEventNotification } from "./ModelStreamEventNotification"; +export type { ModelStreamMetadataNotification } from "./ModelStreamMetadataNotification"; export type { ModelUpgradeInfo } from "./ModelUpgradeInfo"; export type { NetworkAccess } from "./NetworkAccess"; export type { NetworkApprovalContext } from "./NetworkApprovalContext"; export type { NetworkApprovalProtocol } from "./NetworkApprovalProtocol"; +export type { NetworkDelegationConfig } from "./NetworkDelegationConfig"; +export type { NetworkDelegationMode } from "./NetworkDelegationMode"; export type { NetworkPolicyAmendment } from "./NetworkPolicyAmendment"; export type { NetworkPolicyRuleAction } from "./NetworkPolicyRuleAction"; export type { NetworkRequirements } from "./NetworkRequirements"; diff --git a/codex-rs/app-server-protocol/src/protocol/common.rs b/codex-rs/app-server-protocol/src/protocol/common.rs index 0726dfd774..6083227243 100644 --- a/codex-rs/app-server-protocol/src/protocol/common.rs +++ b/codex-rs/app-server-protocol/src/protocol/common.rs @@ -555,7 +555,16 @@ macro_rules! server_request_definitions { ),* $(,)? ) => { /// Request initiated from the server and sent to the client. - #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] + #[derive( + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + JsonSchema, + TS, + ExperimentalApi, + )] #[allow(clippy::large_enum_variant)] #[serde(tag = "method", rename_all = "camelCase")] pub enum ServerRequest { @@ -701,7 +710,16 @@ macro_rules! client_notification_definitions { $variant:ident $( ( $payload:ty ) )? ),* $(,)? ) => { - #[derive(Serialize, Deserialize, Debug, Clone, JsonSchema, TS, Display)] + #[derive( + Serialize, + Deserialize, + Debug, + Clone, + JsonSchema, + TS, + Display, + ExperimentalApi, + )] #[serde(tag = "method", content = "params", rename_all = "camelCase")] #[strum(serialize_all = "camelCase")] pub enum ClientNotification { @@ -711,12 +729,20 @@ macro_rules! client_notification_definitions { )* } + impl TryFrom for ClientNotification { + type Error = serde_json::Error; + + fn try_from(value: JSONRPCNotification) -> Result { + serde_json::from_value(serde_json::to_value(value)?) + } + } + pub fn export_client_notification_schemas( _out_dir: &::std::path::Path, ) -> ::anyhow::Result> { - let schemas = Vec::new(); - $( $(schemas.push(crate::export::write_json_schema::<$payload>(_out_dir, stringify!($payload))?);)? )* - Ok(schemas) + Ok(vec![ + $( $(crate::export::write_json_schema::<$payload>(_out_dir, stringify!($payload))?,)? )* + ]) } }; } @@ -763,6 +789,18 @@ server_request_definitions! { response: v2::PermissionsRequestApprovalResponse, }, + #[experimental("thread/start.networkDelegation")] + ModelRequest => "model/request" { + params: v2::ModelRequestParams, + response: v2::ModelRequestResponse, + }, + + #[experimental("thread/start.networkDelegation")] + ModelCompact => "model/compact" { + params: v2::ModelCompactParams, + response: v2::ModelCompactResponse, + }, + /// Execute a dynamic tool call on the client. DynamicToolCall => "item/tool/call" { params: v2::DynamicToolCallParams, @@ -942,6 +980,21 @@ server_notification_definitions! { client_notification_definitions! { Initialized, + #[experimental("thread/start.networkDelegation")] + #[serde(rename = "model/streamMetadata")] + #[ts(rename = "model/streamMetadata")] + #[strum(serialize = "model/streamMetadata")] + ModelStreamMetadata(v2::ModelStreamMetadataNotification), + #[experimental("thread/start.networkDelegation")] + #[serde(rename = "model/streamEvent")] + #[ts(rename = "model/streamEvent")] + #[strum(serialize = "model/streamEvent")] + ModelStreamEvent(v2::ModelStreamEventNotification), + #[experimental("thread/start.networkDelegation")] + #[serde(rename = "model/requestFailed")] + #[ts(rename = "model/requestFailed")] + #[strum(serialize = "model/requestFailed")] + ModelRequestFailed(v2::ModelRequestFailedNotification), } #[cfg(test)] diff --git a/codex-rs/app-server-protocol/src/protocol/v2.rs b/codex-rs/app-server-protocol/src/protocol/v2.rs index b534510b7c..037c61a664 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -2447,6 +2447,22 @@ pub enum CommandExecOutputStream { Stderr, } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct NetworkDelegationConfig { + pub mode: NetworkDelegationMode, + pub stream_idle_timeout_ms: Option, +} + +#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub enum NetworkDelegationMode { + Enabled, + Disabled, +} + // === Threads, Turns, and Items === // Thread APIs #[derive( @@ -2490,6 +2506,9 @@ pub struct ThreadStartParams { pub personality: Option, #[ts(optional = nullable)] pub ephemeral: Option, + #[experimental("thread/start.networkDelegation")] + #[ts(optional = nullable)] + pub network_delegation: Option, #[experimental("thread/start.dynamicTools")] #[ts(optional = nullable)] pub dynamic_tools: Option>, @@ -2606,6 +2625,9 @@ pub struct ThreadResumeParams { pub developer_instructions: Option, #[ts(optional = nullable)] pub personality: Option, + #[experimental("thread/resume.networkDelegation")] + #[ts(optional = nullable)] + pub network_delegation: Option, /// If true, persist additional rollout EventMsg variants required to /// reconstruct a richer thread history on subsequent resume/fork/read. #[experimental("thread/resume.persistFullHistory")] @@ -2681,6 +2703,9 @@ pub struct ThreadForkParams { pub base_instructions: Option, #[ts(optional = nullable)] pub developer_instructions: Option, + #[experimental("thread/fork.networkDelegation")] + #[ts(optional = nullable)] + pub network_delegation: Option, #[serde(default, skip_serializing_if = "std::ops::Not::not")] pub ephemeral: bool, /// If true, persist additional rollout EventMsg variants required to @@ -2707,6 +2732,117 @@ pub struct ThreadForkResponse { pub reasoning_effort: Option, } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ModelRequestParams { + pub thread_id: String, + pub turn_id: String, + pub request_id: String, + pub request: ModelRequestEnvelope, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ModelRequestEnvelope { + pub model: String, + pub instructions: String, + pub input: Vec, + pub tools: Vec, + pub tool_choice: String, + pub parallel_tool_calls: bool, + pub reasoning: Option, + pub store: bool, + pub stream: bool, + pub include: Vec, + pub service_tier: Option, + pub prompt_cache_key: Option, + pub text: Option, + pub request_headers: Option>, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ModelRequestResponse { + pub accepted: bool, + pub rejection_reason: Option, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ModelCompactParams { + pub thread_id: String, + pub turn_id: String, + pub request_id: String, + pub request: ModelCompactEnvelope, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ModelCompactEnvelope { + pub model: String, + pub input: Vec, + pub instructions: String, + pub tools: Vec, + pub parallel_tool_calls: bool, + pub reasoning: Option, + pub text: Option, + pub request_headers: Option>, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ModelCompactResponse { + pub output: Vec, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ModelStreamMetadataNotification { + pub thread_id: String, + pub turn_id: String, + pub request_id: String, + pub metadata: HashMap, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ModelStreamEventNotification { + pub thread_id: String, + pub turn_id: String, + pub request_id: String, + pub event: serde_json::Value, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ModelRequestFailedNotification { + pub thread_id: String, + pub turn_id: String, + pub request_id: String, + pub error: ModelRequestError, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ModelRequestError { + #[serde(rename = "type")] + #[ts(rename = "type")] + pub error_type: String, + pub code: Option, + pub param: Option, + pub message: String, +} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] diff --git a/codex-rs/app-server/tests/suite/v2/skills_list.rs b/codex-rs/app-server/tests/suite/v2/skills_list.rs index 6bd862eb62..8df09e5903 100644 --- a/codex-rs/app-server/tests/suite/v2/skills_list.rs +++ b/codex-rs/app-server/tests/suite/v2/skills_list.rs @@ -241,6 +241,7 @@ async fn skills_changed_notification_is_emitted_after_skill_change() -> Result<( developer_instructions: None, personality: None, ephemeral: None, + network_delegation: None, dynamic_tools: None, mock_experimental_field: None, experimental_raw_events: false,