Compare commits

...

1 Commits

Author SHA1 Message Date
pakrym-oai
10ed8d6a42 TUI app-server 2026-02-23 08:31:57 -08:00
116 changed files with 9136 additions and 928 deletions

1
codex-rs/Cargo.lock generated
View File

@@ -2255,6 +2255,7 @@ dependencies = [
"chrono",
"clap",
"codex-ansi-escape",
"codex-app-server",
"codex-app-server-protocol",
"codex-arg0",
"codex-backend-client",

View File

@@ -338,6 +338,9 @@
}
]
},
"CustomPromptListParams": {
"type": "object"
},
"DynamicToolSpec": {
"properties": {
"description": {
@@ -563,6 +566,40 @@
],
"type": "string"
},
"HistoryAppendParams": {
"properties": {
"text": {
"type": "string"
},
"threadId": {
"type": "string"
}
},
"required": [
"text",
"threadId"
],
"type": "object"
},
"HistoryEntryReadParams": {
"properties": {
"logId": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
},
"offset": {
"format": "uint",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"logId",
"offset"
],
"type": "object"
},
"InitializeCapabilities": {
"description": "Client-declared capabilities negotiated during initialize.",
"properties": {
@@ -791,6 +828,9 @@
],
"type": "object"
},
"McpToolsListParams": {
"type": "object"
},
"MergeStrategy": {
"enum": [
"replace",
@@ -1808,6 +1848,107 @@
],
"type": "object"
},
"ThreadConfigReloadParams": {
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"type": "object"
},
"ThreadContextUpdateParams": {
"properties": {
"approvalPolicy": {
"anyOf": [
{
"$ref": "#/definitions/AskForApproval"
},
{
"type": "null"
}
]
},
"cwd": {
"type": [
"string",
"null"
]
},
"effort": {
"anyOf": [
{
"anyOf": [
{
"$ref": "#/definitions/ReasoningEffort"
},
{
"type": "null"
}
]
},
{
"type": "null"
}
]
},
"model": {
"type": [
"string",
"null"
]
},
"personality": {
"anyOf": [
{
"$ref": "#/definitions/Personality"
},
{
"type": "null"
}
]
},
"sandboxPolicy": {
"anyOf": [
{
"$ref": "#/definitions/SandboxPolicy"
},
{
"type": "null"
}
]
},
"summary": {
"anyOf": [
{
"$ref": "#/definitions/ReasoningSummary"
},
{
"type": "null"
}
]
},
"threadId": {
"type": "string"
},
"windowsSandboxLevel": {
"anyOf": [
{
"$ref": "#/definitions/WindowsSandboxLevel"
},
{
"type": "null"
}
]
}
},
"required": [
"threadId"
],
"type": "object"
},
"ThreadForkParams": {
"description": "There are two ways to fork a thread: 1. By thread_id: load the thread from disk by thread_id and fork it into a new thread. 2. By path: load the thread from disk by path and fork it into a new thread.\n\nIf using path, the thread_id param will be ignored.\n\nPrefer using thread_id whenever possible.",
"properties": {
@@ -1965,6 +2106,28 @@
},
"type": "object"
},
"ThreadMemoriesDropParams": {
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"type": "object"
},
"ThreadMemoriesUpdateParams": {
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"type": "object"
},
"ThreadReadParams": {
"properties": {
"includeTurns": {
@@ -2094,6 +2257,17 @@
],
"type": "object"
},
"ThreadShutdownParams": {
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"type": "object"
},
"ThreadSortKey": {
"enum": [
"created_at",
@@ -2205,6 +2379,32 @@
],
"type": "object"
},
"ThreadUndoParams": {
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"type": "object"
},
"ThreadUserShellCommandRunParams": {
"properties": {
"command": {
"type": "string"
},
"threadId": {
"type": "string"
}
},
"required": [
"command",
"threadId"
],
"type": "object"
},
"TurnInterruptParams": {
"properties": {
"threadId": {
@@ -2554,6 +2754,14 @@
}
]
},
"WindowsSandboxLevel": {
"enum": [
"disabled",
"restricted-token",
"elevated"
],
"type": "string"
},
"WindowsSandboxSetupMode": {
"enum": [
"elevated",
@@ -2792,6 +3000,174 @@
"title": "Thread/rollbackRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"thread/context/update"
],
"title": "Thread/context/updateRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/ThreadContextUpdateParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Thread/context/updateRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"thread/shutdown"
],
"title": "Thread/shutdownRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/ThreadShutdownParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Thread/shutdownRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"thread/undo"
],
"title": "Thread/undoRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/ThreadUndoParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Thread/undoRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"thread/config/reload"
],
"title": "Thread/config/reloadRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/ThreadConfigReloadParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Thread/config/reloadRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"thread/memories/drop"
],
"title": "Thread/memories/dropRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/ThreadMemoriesDropParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Thread/memories/dropRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"thread/memories/update"
],
"title": "Thread/memories/updateRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/ThreadMemoriesUpdateParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Thread/memories/updateRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"thread/userShellCommand/run"
],
"title": "Thread/userShellCommand/runRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/ThreadUserShellCommandRunParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Thread/userShellCommand/runRequest",
"type": "object"
},
{
"properties": {
"id": {
@@ -2864,6 +3240,102 @@
"title": "Thread/readRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"customPrompt/list"
],
"title": "CustomPrompt/listRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/CustomPromptListParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "CustomPrompt/listRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"mcpTools/list"
],
"title": "McpTools/listRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/McpToolsListParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "McpTools/listRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"history/append"
],
"title": "History/appendRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/HistoryAppendParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "History/appendRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"history/entry/read"
],
"title": "History/entry/readRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/HistoryEntryReadParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "History/entry/readRequest",
"type": "object"
},
{
"properties": {
"id": {

View File

@@ -0,0 +1,38 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"RequestId": {
"anyOf": [
{
"type": "string"
},
{
"format": "int64",
"type": "integer"
}
]
}
},
"properties": {
"message": {
"type": "string"
},
"requestId": {
"$ref": "#/definitions/RequestId"
},
"serverName": {
"type": "string"
},
"threadId": {
"type": "string"
}
},
"required": [
"message",
"requestId",
"serverName",
"threadId"
],
"title": "McpElicitationRequestParams",
"type": "object"
}

View File

@@ -0,0 +1,23 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"McpElicitationDecision": {
"enum": [
"accept",
"decline",
"cancel"
],
"type": "string"
}
},
"properties": {
"decision": {
"$ref": "#/definitions/McpElicitationDecision"
}
},
"required": [
"decision"
],
"title": "McpElicitationRequestResponse",
"type": "object"
}

View File

@@ -364,6 +364,25 @@
}
]
},
"BackgroundEventNotification": {
"properties": {
"message": {
"type": "string"
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"message",
"threadId",
"turnId"
],
"type": "object"
},
"ByteRange": {
"properties": {
"end": {
@@ -995,6 +1014,139 @@
],
"type": "object"
},
"McpServerStartupCompletedNotification": {
"properties": {
"cancelled": {
"items": {
"type": "string"
},
"type": "array"
},
"failed": {
"items": {
"$ref": "#/definitions/McpServerStartupFailure"
},
"type": "array"
},
"ready": {
"items": {
"type": "string"
},
"type": "array"
},
"threadId": {
"type": "string"
}
},
"required": [
"cancelled",
"failed",
"ready",
"threadId"
],
"type": "object"
},
"McpServerStartupFailure": {
"properties": {
"error": {
"type": "string"
},
"server": {
"type": "string"
}
},
"required": [
"error",
"server"
],
"type": "object"
},
"McpServerStartupStatus": {
"oneOf": [
{
"properties": {
"state": {
"enum": [
"starting"
],
"type": "string"
}
},
"required": [
"state"
],
"title": "StartingMcpServerStartupStatus",
"type": "object"
},
{
"properties": {
"state": {
"enum": [
"ready"
],
"type": "string"
}
},
"required": [
"state"
],
"title": "ReadyMcpServerStartupStatus",
"type": "object"
},
{
"properties": {
"error": {
"type": "string"
},
"state": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"error",
"state"
],
"type": "object"
},
{
"properties": {
"state": {
"enum": [
"cancelled"
],
"type": "string"
}
},
"required": [
"state"
],
"title": "CancelledMcpServerStartupStatus",
"type": "object"
}
]
},
"McpServerStartupUpdatedNotification": {
"properties": {
"server": {
"type": "string"
},
"status": {
"$ref": "#/definitions/McpServerStartupStatus"
},
"threadId": {
"type": "string"
}
},
"required": [
"server",
"status",
"threadId"
],
"type": "object"
},
"McpToolCallError": {
"properties": {
"message": {
@@ -1397,6 +1549,36 @@
}
]
},
"SkillsUpdatedNotification": {
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"type": "object"
},
"StreamErrorNotification": {
"properties": {
"error": {
"$ref": "#/definitions/TurnError"
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"error",
"threadId",
"turnId"
],
"type": "object"
},
"SubAgentSource": {
"oneOf": [
{
@@ -2177,6 +2359,17 @@
],
"type": "object"
},
"ThreadShutdownCompletedNotification": {
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"type": "object"
},
"ThreadStartedNotification": {
"properties": {
"thread": {
@@ -2330,6 +2523,52 @@
],
"type": "object"
},
"ThreadUndoCompletedNotification": {
"properties": {
"message": {
"type": [
"string",
"null"
]
},
"success": {
"type": "boolean"
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"success",
"threadId",
"turnId"
],
"type": "object"
},
"ThreadUndoStartedNotification": {
"properties": {
"message": {
"type": [
"string",
"null"
]
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"threadId",
"turnId"
],
"type": "object"
},
"TokenUsageBreakdown": {
"properties": {
"cachedInputTokens": {
@@ -2654,6 +2893,25 @@
}
]
},
"WarningNotification": {
"properties": {
"message": {
"type": "string"
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"message",
"threadId",
"turnId"
],
"type": "object"
},
"WebSearchAction": {
"oneOf": [
{
@@ -2831,6 +3089,26 @@
"title": "ErrorNotification",
"type": "object"
},
{
"properties": {
"method": {
"enum": [
"warning"
],
"title": "WarningNotificationMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/WarningNotification"
}
},
"required": [
"method",
"params"
],
"title": "WarningNotification",
"type": "object"
},
{
"properties": {
"method": {
@@ -2951,6 +3229,66 @@
"title": "Thread/tokenUsage/updatedNotification",
"type": "object"
},
{
"properties": {
"method": {
"enum": [
"thread/shutdown/completed"
],
"title": "Thread/shutdown/completedNotificationMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/ThreadShutdownCompletedNotification"
}
},
"required": [
"method",
"params"
],
"title": "Thread/shutdown/completedNotification",
"type": "object"
},
{
"properties": {
"method": {
"enum": [
"thread/undo/started"
],
"title": "Thread/undo/startedNotificationMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/ThreadUndoStartedNotification"
}
},
"required": [
"method",
"params"
],
"title": "Thread/undo/startedNotification",
"type": "object"
},
{
"properties": {
"method": {
"enum": [
"thread/undo/completed"
],
"title": "Thread/undo/completedNotificationMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/ThreadUndoCompletedNotification"
}
},
"required": [
"method",
"params"
],
"title": "Thread/undo/completedNotification",
"type": "object"
},
{
"properties": {
"method": {
@@ -2991,6 +3329,26 @@
"title": "Turn/completedNotification",
"type": "object"
},
{
"properties": {
"method": {
"enum": [
"turn/streamError"
],
"title": "Turn/streamErrorNotificationMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/StreamErrorNotification"
}
},
"required": [
"method",
"params"
],
"title": "Turn/streamErrorNotification",
"type": "object"
},
{
"properties": {
"method": {
@@ -3192,6 +3550,46 @@
"title": "Item/mcpToolCall/progressNotification",
"type": "object"
},
{
"properties": {
"method": {
"enum": [
"mcpServer/startup/updated"
],
"title": "McpServer/startup/updatedNotificationMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/McpServerStartupUpdatedNotification"
}
},
"required": [
"method",
"params"
],
"title": "McpServer/startup/updatedNotification",
"type": "object"
},
{
"properties": {
"method": {
"enum": [
"mcpServer/startup/completed"
],
"title": "McpServer/startup/completedNotificationMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/McpServerStartupCompletedNotification"
}
},
"required": [
"method",
"params"
],
"title": "McpServer/startup/completedNotification",
"type": "object"
},
{
"properties": {
"method": {
@@ -3212,6 +3610,26 @@
"title": "McpServer/oauthLogin/completedNotification",
"type": "object"
},
{
"properties": {
"method": {
"enum": [
"skills/updated"
],
"title": "Skills/updatedNotificationMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/SkillsUpdatedNotification"
}
},
"required": [
"method",
"params"
],
"title": "Skills/updatedNotification",
"type": "object"
},
{
"properties": {
"method": {
@@ -3393,6 +3811,26 @@
"title": "DeprecationNoticeNotification",
"type": "object"
},
{
"properties": {
"method": {
"enum": [
"backgroundEvent"
],
"title": "BackgroundEventNotificationMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/BackgroundEventNotification"
}
},
"required": [
"method",
"params"
],
"title": "BackgroundEventNotification",
"type": "object"
},
{
"properties": {
"method": {

View File

@@ -430,6 +430,29 @@
],
"type": "object"
},
"McpElicitationRequestParams": {
"properties": {
"message": {
"type": "string"
},
"requestId": {
"$ref": "#/definitions/RequestId"
},
"serverName": {
"type": "string"
},
"threadId": {
"type": "string"
}
},
"required": [
"message",
"requestId",
"serverName",
"threadId"
],
"type": "object"
},
"NetworkApprovalContext": {
"properties": {
"host": {
@@ -737,6 +760,31 @@
"title": "Item/tool/requestUserInputRequest",
"type": "object"
},
{
"description": "Request the user to resolve an MCP elicitation prompt.",
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
},
"method": {
"enum": [
"item/mcpElicitation/requestDecision"
],
"title": "Item/mcpElicitation/requestDecisionRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/McpElicitationRequestParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Item/mcpElicitation/requestDecisionRequest",
"type": "object"
},
{
"description": "Execute a dynamic tool call on the client.",
"properties": {

View File

@@ -0,0 +1,21 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"message": {
"type": "string"
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"message",
"threadId",
"turnId"
],
"title": "BackgroundEventNotification",
"type": "object"
}

View File

@@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "CustomPromptListParams",
"type": "object"
}

View File

@@ -0,0 +1,49 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"CustomPrompt": {
"properties": {
"argumentHint": {
"type": [
"string",
"null"
]
},
"content": {
"type": "string"
},
"description": {
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
},
"path": {
"type": "string"
}
},
"required": [
"content",
"name",
"path"
],
"type": "object"
}
},
"properties": {
"data": {
"items": {
"$ref": "#/definitions/CustomPrompt"
},
"type": "array"
}
},
"required": [
"data"
],
"title": "CustomPromptListResponse",
"type": "object"
}

View File

@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"text": {
"type": "string"
},
"threadId": {
"type": "string"
}
},
"required": [
"text",
"threadId"
],
"title": "HistoryAppendParams",
"type": "object"
}

View File

@@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "HistoryAppendResponse",
"type": "object"
}

View File

@@ -0,0 +1,21 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"logId": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
},
"offset": {
"format": "uint",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"logId",
"offset"
],
"title": "HistoryEntryReadParams",
"type": "object"
}

View File

@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"HistoryEntry": {
"properties": {
"conversationId": {
"type": "string"
},
"text": {
"type": "string"
},
"ts": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"conversationId",
"text",
"ts"
],
"type": "object"
}
},
"properties": {
"entry": {
"anyOf": [
{
"$ref": "#/definitions/HistoryEntry"
},
{
"type": "null"
}
]
},
"logId": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
},
"offset": {
"format": "uint",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"logId",
"offset"
],
"title": "HistoryEntryReadResponse",
"type": "object"
}

View File

@@ -0,0 +1,51 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"McpServerStartupFailure": {
"properties": {
"error": {
"type": "string"
},
"server": {
"type": "string"
}
},
"required": [
"error",
"server"
],
"type": "object"
}
},
"properties": {
"cancelled": {
"items": {
"type": "string"
},
"type": "array"
},
"failed": {
"items": {
"$ref": "#/definitions/McpServerStartupFailure"
},
"type": "array"
},
"ready": {
"items": {
"type": "string"
},
"type": "array"
},
"threadId": {
"type": "string"
}
},
"required": [
"cancelled",
"failed",
"ready",
"threadId"
],
"title": "McpServerStartupCompletedNotification",
"type": "object"
}

View File

@@ -0,0 +1,90 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"McpServerStartupStatus": {
"oneOf": [
{
"properties": {
"state": {
"enum": [
"starting"
],
"type": "string"
}
},
"required": [
"state"
],
"title": "StartingMcpServerStartupStatus",
"type": "object"
},
{
"properties": {
"state": {
"enum": [
"ready"
],
"type": "string"
}
},
"required": [
"state"
],
"title": "ReadyMcpServerStartupStatus",
"type": "object"
},
{
"properties": {
"error": {
"type": "string"
},
"state": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"error",
"state"
],
"type": "object"
},
{
"properties": {
"state": {
"enum": [
"cancelled"
],
"type": "string"
}
},
"required": [
"state"
],
"title": "CancelledMcpServerStartupStatus",
"type": "object"
}
]
}
},
"properties": {
"server": {
"type": "string"
},
"status": {
"$ref": "#/definitions/McpServerStartupStatus"
},
"threadId": {
"type": "string"
}
},
"required": [
"server",
"status",
"threadId"
],
"title": "McpServerStartupUpdatedNotification",
"type": "object"
}

View File

@@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "McpToolsListParams",
"type": "object"
}

View File

@@ -0,0 +1,179 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"McpAuthStatus": {
"enum": [
"unsupported",
"not_logged_in",
"bearer_token",
"o_auth"
],
"type": "string"
},
"Resource": {
"description": "A known resource that the server is capable of reading.",
"properties": {
"_meta": true,
"annotations": true,
"description": {
"type": [
"string",
"null"
]
},
"icons": {
"items": true,
"type": [
"array",
"null"
]
},
"mimeType": {
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
},
"size": {
"format": "int64",
"type": [
"integer",
"null"
]
},
"title": {
"type": [
"string",
"null"
]
},
"uri": {
"type": "string"
}
},
"required": [
"name",
"uri"
],
"type": "object"
},
"ResourceTemplate": {
"description": "A template description for resources available on the server.",
"properties": {
"annotations": true,
"description": {
"type": [
"string",
"null"
]
},
"mimeType": {
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
},
"title": {
"type": [
"string",
"null"
]
},
"uriTemplate": {
"type": "string"
}
},
"required": [
"name",
"uriTemplate"
],
"type": "object"
},
"Tool": {
"description": "Definition for a tool the client can call.",
"properties": {
"_meta": true,
"annotations": true,
"description": {
"type": [
"string",
"null"
]
},
"icons": {
"items": true,
"type": [
"array",
"null"
]
},
"inputSchema": true,
"name": {
"type": "string"
},
"outputSchema": true,
"title": {
"type": [
"string",
"null"
]
}
},
"required": [
"inputSchema",
"name"
],
"type": "object"
}
},
"properties": {
"authStatuses": {
"additionalProperties": {
"$ref": "#/definitions/McpAuthStatus"
},
"description": "Authentication status for each configured MCP server.",
"type": "object"
},
"resourceTemplates": {
"additionalProperties": {
"items": {
"$ref": "#/definitions/ResourceTemplate"
},
"type": "array"
},
"description": "Known resource templates grouped by server name.",
"type": "object"
},
"resources": {
"additionalProperties": {
"items": {
"$ref": "#/definitions/Resource"
},
"type": "array"
},
"description": "Known resources grouped by server name.",
"type": "object"
},
"tools": {
"additionalProperties": {
"$ref": "#/definitions/Tool"
},
"description": "Fully qualified tool name -> tool definition.",
"type": "object"
}
},
"required": [
"authStatuses",
"resourceTemplates",
"resources",
"tools"
],
"title": "McpToolsListResponse",
"type": "object"
}

View File

@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"title": "SkillsUpdatedNotification",
"type": "object"
}

View File

@@ -0,0 +1,165 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"CodexErrorInfo": {
"description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",
"oneOf": [
{
"enum": [
"contextWindowExceeded",
"usageLimitExceeded",
"serverOverloaded",
"internalServerError",
"unauthorized",
"badRequest",
"threadRollbackFailed",
"sandboxError",
"other"
],
"type": "string"
},
{
"additionalProperties": false,
"properties": {
"httpConnectionFailed": {
"properties": {
"httpStatusCode": {
"format": "uint16",
"minimum": 0.0,
"type": [
"integer",
"null"
]
}
},
"type": "object"
}
},
"required": [
"httpConnectionFailed"
],
"title": "HttpConnectionFailedCodexErrorInfo",
"type": "object"
},
{
"additionalProperties": false,
"description": "Failed to connect to the response SSE stream.",
"properties": {
"responseStreamConnectionFailed": {
"properties": {
"httpStatusCode": {
"format": "uint16",
"minimum": 0.0,
"type": [
"integer",
"null"
]
}
},
"type": "object"
}
},
"required": [
"responseStreamConnectionFailed"
],
"title": "ResponseStreamConnectionFailedCodexErrorInfo",
"type": "object"
},
{
"additionalProperties": false,
"description": "The response SSE stream disconnected in the middle of a turn before completion.",
"properties": {
"responseStreamDisconnected": {
"properties": {
"httpStatusCode": {
"format": "uint16",
"minimum": 0.0,
"type": [
"integer",
"null"
]
}
},
"type": "object"
}
},
"required": [
"responseStreamDisconnected"
],
"title": "ResponseStreamDisconnectedCodexErrorInfo",
"type": "object"
},
{
"additionalProperties": false,
"description": "Reached the retry limit for responses.",
"properties": {
"responseTooManyFailedAttempts": {
"properties": {
"httpStatusCode": {
"format": "uint16",
"minimum": 0.0,
"type": [
"integer",
"null"
]
}
},
"type": "object"
}
},
"required": [
"responseTooManyFailedAttempts"
],
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
"type": "object"
}
]
},
"TurnError": {
"properties": {
"additionalDetails": {
"default": null,
"type": [
"string",
"null"
]
},
"codexErrorInfo": {
"anyOf": [
{
"$ref": "#/definitions/CodexErrorInfo"
},
{
"type": "null"
}
]
},
"message": {
"type": "string"
}
},
"required": [
"message"
],
"type": "object"
}
},
"properties": {
"error": {
"$ref": "#/definitions/TurnError"
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"error",
"threadId",
"turnId"
],
"title": "StreamErrorNotification",
"type": "object"
}

View File

@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"title": "ThreadConfigReloadParams",
"type": "object"
}

View File

@@ -0,0 +1,283 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"AbsolutePathBuf": {
"description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.",
"type": "string"
},
"AskForApproval": {
"oneOf": [
{
"enum": [
"untrusted",
"on-failure",
"on-request",
"never"
],
"type": "string"
},
{
"additionalProperties": false,
"properties": {
"reject": {
"properties": {
"mcp_elicitations": {
"type": "boolean"
},
"rules": {
"type": "boolean"
},
"sandbox_approval": {
"type": "boolean"
}
},
"required": [
"mcp_elicitations",
"rules",
"sandbox_approval"
],
"type": "object"
}
},
"required": [
"reject"
],
"title": "RejectAskForApproval",
"type": "object"
}
]
},
"NetworkAccess": {
"enum": [
"restricted",
"enabled"
],
"type": "string"
},
"ReadOnlyAccess": {
"oneOf": [
{
"properties": {
"includePlatformDefaults": {
"default": true,
"type": "boolean"
},
"readableRoots": {
"default": [],
"items": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": "array"
},
"type": {
"enum": [
"restricted"
],
"title": "RestrictedReadOnlyAccessType",
"type": "string"
}
},
"required": [
"type"
],
"title": "RestrictedReadOnlyAccess",
"type": "object"
},
{
"properties": {
"type": {
"enum": [
"fullAccess"
],
"title": "FullAccessReadOnlyAccessType",
"type": "string"
}
},
"required": [
"type"
],
"title": "FullAccessReadOnlyAccess",
"type": "object"
}
]
},
"ReasoningEffort": {
"description": "See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#get-started-with-reasoning",
"enum": [
"none",
"minimal",
"low",
"medium",
"high",
"xhigh"
],
"type": "string"
},
"SandboxPolicy": {
"oneOf": [
{
"properties": {
"type": {
"enum": [
"dangerFullAccess"
],
"title": "DangerFullAccessSandboxPolicyType",
"type": "string"
}
},
"required": [
"type"
],
"title": "DangerFullAccessSandboxPolicy",
"type": "object"
},
{
"properties": {
"access": {
"allOf": [
{
"$ref": "#/definitions/ReadOnlyAccess"
}
],
"default": {
"type": "fullAccess"
}
},
"type": {
"enum": [
"readOnly"
],
"title": "ReadOnlySandboxPolicyType",
"type": "string"
}
},
"required": [
"type"
],
"title": "ReadOnlySandboxPolicy",
"type": "object"
},
{
"properties": {
"networkAccess": {
"allOf": [
{
"$ref": "#/definitions/NetworkAccess"
}
],
"default": "restricted"
},
"type": {
"enum": [
"externalSandbox"
],
"title": "ExternalSandboxSandboxPolicyType",
"type": "string"
}
},
"required": [
"type"
],
"title": "ExternalSandboxSandboxPolicy",
"type": "object"
},
{
"properties": {
"excludeSlashTmp": {
"default": false,
"type": "boolean"
},
"excludeTmpdirEnvVar": {
"default": false,
"type": "boolean"
},
"networkAccess": {
"default": false,
"type": "boolean"
},
"readOnlyAccess": {
"allOf": [
{
"$ref": "#/definitions/ReadOnlyAccess"
}
],
"default": {
"type": "fullAccess"
}
},
"type": {
"enum": [
"workspaceWrite"
],
"title": "WorkspaceWriteSandboxPolicyType",
"type": "string"
},
"writableRoots": {
"default": [],
"items": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": "array"
}
},
"required": [
"type"
],
"title": "WorkspaceWriteSandboxPolicy",
"type": "object"
}
]
},
"ThreadContextSnapshot": {
"properties": {
"approvalPolicy": {
"$ref": "#/definitions/AskForApproval"
},
"cwd": {
"type": "string"
},
"model": {
"type": "string"
},
"modelProvider": {
"type": "string"
},
"reasoningEffort": {
"anyOf": [
{
"$ref": "#/definitions/ReasoningEffort"
},
{
"type": "null"
}
]
},
"sandbox": {
"$ref": "#/definitions/SandboxPolicy"
},
"threadId": {
"type": "string"
}
},
"required": [
"approvalPolicy",
"cwd",
"model",
"modelProvider",
"sandbox",
"threadId"
],
"type": "object"
}
},
"properties": {
"context": {
"$ref": "#/definitions/ThreadContextSnapshot"
}
},
"required": [
"context"
],
"title": "ThreadConfigReloadResponse",
"type": "object"
}

View File

@@ -0,0 +1,409 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"AbsolutePathBuf": {
"description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.",
"type": "string"
},
"AskForApproval": {
"oneOf": [
{
"enum": [
"untrusted",
"on-failure",
"on-request",
"never"
],
"type": "string"
},
{
"additionalProperties": false,
"properties": {
"reject": {
"properties": {
"mcp_elicitations": {
"type": "boolean"
},
"rules": {
"type": "boolean"
},
"sandbox_approval": {
"type": "boolean"
}
},
"required": [
"mcp_elicitations",
"rules",
"sandbox_approval"
],
"type": "object"
}
},
"required": [
"reject"
],
"title": "RejectAskForApproval",
"type": "object"
}
]
},
"CollaborationMode": {
"description": "Collaboration mode for a Codex session.",
"properties": {
"mode": {
"$ref": "#/definitions/ModeKind"
},
"settings": {
"$ref": "#/definitions/Settings"
}
},
"required": [
"mode",
"settings"
],
"type": "object"
},
"ModeKind": {
"description": "Initial collaboration mode to use when the TUI starts.",
"enum": [
"plan",
"default"
],
"type": "string"
},
"NetworkAccess": {
"enum": [
"restricted",
"enabled"
],
"type": "string"
},
"Personality": {
"enum": [
"none",
"friendly",
"pragmatic"
],
"type": "string"
},
"ReadOnlyAccess": {
"oneOf": [
{
"properties": {
"includePlatformDefaults": {
"default": true,
"type": "boolean"
},
"readableRoots": {
"default": [],
"items": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": "array"
},
"type": {
"enum": [
"restricted"
],
"title": "RestrictedReadOnlyAccessType",
"type": "string"
}
},
"required": [
"type"
],
"title": "RestrictedReadOnlyAccess",
"type": "object"
},
{
"properties": {
"type": {
"enum": [
"fullAccess"
],
"title": "FullAccessReadOnlyAccessType",
"type": "string"
}
},
"required": [
"type"
],
"title": "FullAccessReadOnlyAccess",
"type": "object"
}
]
},
"ReasoningEffort": {
"description": "See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#get-started-with-reasoning",
"enum": [
"none",
"minimal",
"low",
"medium",
"high",
"xhigh"
],
"type": "string"
},
"ReasoningSummary": {
"description": "A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries",
"oneOf": [
{
"enum": [
"auto",
"concise",
"detailed"
],
"type": "string"
},
{
"description": "Option to disable reasoning summaries.",
"enum": [
"none"
],
"type": "string"
}
]
},
"SandboxPolicy": {
"oneOf": [
{
"properties": {
"type": {
"enum": [
"dangerFullAccess"
],
"title": "DangerFullAccessSandboxPolicyType",
"type": "string"
}
},
"required": [
"type"
],
"title": "DangerFullAccessSandboxPolicy",
"type": "object"
},
{
"properties": {
"access": {
"allOf": [
{
"$ref": "#/definitions/ReadOnlyAccess"
}
],
"default": {
"type": "fullAccess"
}
},
"type": {
"enum": [
"readOnly"
],
"title": "ReadOnlySandboxPolicyType",
"type": "string"
}
},
"required": [
"type"
],
"title": "ReadOnlySandboxPolicy",
"type": "object"
},
{
"properties": {
"networkAccess": {
"allOf": [
{
"$ref": "#/definitions/NetworkAccess"
}
],
"default": "restricted"
},
"type": {
"enum": [
"externalSandbox"
],
"title": "ExternalSandboxSandboxPolicyType",
"type": "string"
}
},
"required": [
"type"
],
"title": "ExternalSandboxSandboxPolicy",
"type": "object"
},
{
"properties": {
"excludeSlashTmp": {
"default": false,
"type": "boolean"
},
"excludeTmpdirEnvVar": {
"default": false,
"type": "boolean"
},
"networkAccess": {
"default": false,
"type": "boolean"
},
"readOnlyAccess": {
"allOf": [
{
"$ref": "#/definitions/ReadOnlyAccess"
}
],
"default": {
"type": "fullAccess"
}
},
"type": {
"enum": [
"workspaceWrite"
],
"title": "WorkspaceWriteSandboxPolicyType",
"type": "string"
},
"writableRoots": {
"default": [],
"items": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": "array"
}
},
"required": [
"type"
],
"title": "WorkspaceWriteSandboxPolicy",
"type": "object"
}
]
},
"Settings": {
"description": "Settings for a collaboration mode.",
"properties": {
"developer_instructions": {
"type": [
"string",
"null"
]
},
"model": {
"type": "string"
},
"reasoning_effort": {
"anyOf": [
{
"$ref": "#/definitions/ReasoningEffort"
},
{
"type": "null"
}
]
}
},
"required": [
"model"
],
"type": "object"
},
"WindowsSandboxLevel": {
"enum": [
"disabled",
"restricted-token",
"elevated"
],
"type": "string"
}
},
"properties": {
"approvalPolicy": {
"anyOf": [
{
"$ref": "#/definitions/AskForApproval"
},
{
"type": "null"
}
]
},
"cwd": {
"type": [
"string",
"null"
]
},
"effort": {
"anyOf": [
{
"anyOf": [
{
"$ref": "#/definitions/ReasoningEffort"
},
{
"type": "null"
}
]
},
{
"type": "null"
}
]
},
"model": {
"type": [
"string",
"null"
]
},
"personality": {
"anyOf": [
{
"$ref": "#/definitions/Personality"
},
{
"type": "null"
}
]
},
"sandboxPolicy": {
"anyOf": [
{
"$ref": "#/definitions/SandboxPolicy"
},
{
"type": "null"
}
]
},
"summary": {
"anyOf": [
{
"$ref": "#/definitions/ReasoningSummary"
},
{
"type": "null"
}
]
},
"threadId": {
"type": "string"
},
"windowsSandboxLevel": {
"anyOf": [
{
"$ref": "#/definitions/WindowsSandboxLevel"
},
{
"type": "null"
}
]
}
},
"required": [
"threadId"
],
"title": "ThreadContextUpdateParams",
"type": "object"
}

View File

@@ -0,0 +1,283 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"AbsolutePathBuf": {
"description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.",
"type": "string"
},
"AskForApproval": {
"oneOf": [
{
"enum": [
"untrusted",
"on-failure",
"on-request",
"never"
],
"type": "string"
},
{
"additionalProperties": false,
"properties": {
"reject": {
"properties": {
"mcp_elicitations": {
"type": "boolean"
},
"rules": {
"type": "boolean"
},
"sandbox_approval": {
"type": "boolean"
}
},
"required": [
"mcp_elicitations",
"rules",
"sandbox_approval"
],
"type": "object"
}
},
"required": [
"reject"
],
"title": "RejectAskForApproval",
"type": "object"
}
]
},
"NetworkAccess": {
"enum": [
"restricted",
"enabled"
],
"type": "string"
},
"ReadOnlyAccess": {
"oneOf": [
{
"properties": {
"includePlatformDefaults": {
"default": true,
"type": "boolean"
},
"readableRoots": {
"default": [],
"items": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": "array"
},
"type": {
"enum": [
"restricted"
],
"title": "RestrictedReadOnlyAccessType",
"type": "string"
}
},
"required": [
"type"
],
"title": "RestrictedReadOnlyAccess",
"type": "object"
},
{
"properties": {
"type": {
"enum": [
"fullAccess"
],
"title": "FullAccessReadOnlyAccessType",
"type": "string"
}
},
"required": [
"type"
],
"title": "FullAccessReadOnlyAccess",
"type": "object"
}
]
},
"ReasoningEffort": {
"description": "See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#get-started-with-reasoning",
"enum": [
"none",
"minimal",
"low",
"medium",
"high",
"xhigh"
],
"type": "string"
},
"SandboxPolicy": {
"oneOf": [
{
"properties": {
"type": {
"enum": [
"dangerFullAccess"
],
"title": "DangerFullAccessSandboxPolicyType",
"type": "string"
}
},
"required": [
"type"
],
"title": "DangerFullAccessSandboxPolicy",
"type": "object"
},
{
"properties": {
"access": {
"allOf": [
{
"$ref": "#/definitions/ReadOnlyAccess"
}
],
"default": {
"type": "fullAccess"
}
},
"type": {
"enum": [
"readOnly"
],
"title": "ReadOnlySandboxPolicyType",
"type": "string"
}
},
"required": [
"type"
],
"title": "ReadOnlySandboxPolicy",
"type": "object"
},
{
"properties": {
"networkAccess": {
"allOf": [
{
"$ref": "#/definitions/NetworkAccess"
}
],
"default": "restricted"
},
"type": {
"enum": [
"externalSandbox"
],
"title": "ExternalSandboxSandboxPolicyType",
"type": "string"
}
},
"required": [
"type"
],
"title": "ExternalSandboxSandboxPolicy",
"type": "object"
},
{
"properties": {
"excludeSlashTmp": {
"default": false,
"type": "boolean"
},
"excludeTmpdirEnvVar": {
"default": false,
"type": "boolean"
},
"networkAccess": {
"default": false,
"type": "boolean"
},
"readOnlyAccess": {
"allOf": [
{
"$ref": "#/definitions/ReadOnlyAccess"
}
],
"default": {
"type": "fullAccess"
}
},
"type": {
"enum": [
"workspaceWrite"
],
"title": "WorkspaceWriteSandboxPolicyType",
"type": "string"
},
"writableRoots": {
"default": [],
"items": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": "array"
}
},
"required": [
"type"
],
"title": "WorkspaceWriteSandboxPolicy",
"type": "object"
}
]
},
"ThreadContextSnapshot": {
"properties": {
"approvalPolicy": {
"$ref": "#/definitions/AskForApproval"
},
"cwd": {
"type": "string"
},
"model": {
"type": "string"
},
"modelProvider": {
"type": "string"
},
"reasoningEffort": {
"anyOf": [
{
"$ref": "#/definitions/ReasoningEffort"
},
{
"type": "null"
}
]
},
"sandbox": {
"$ref": "#/definitions/SandboxPolicy"
},
"threadId": {
"type": "string"
}
},
"required": [
"approvalPolicy",
"cwd",
"model",
"modelProvider",
"sandbox",
"threadId"
],
"type": "object"
}
},
"properties": {
"context": {
"$ref": "#/definitions/ThreadContextSnapshot"
}
},
"required": [
"context"
],
"title": "ThreadContextUpdateResponse",
"type": "object"
}

View File

@@ -686,6 +686,25 @@
}
]
},
"SessionNetworkProxyRuntime": {
"properties": {
"adminAddr": {
"type": "string"
},
"httpAddr": {
"type": "string"
},
"socksAddr": {
"type": "string"
}
},
"required": [
"adminAddr",
"httpAddr",
"socksAddr"
],
"type": "object"
},
"SessionSource": {
"oneOf": [
{
@@ -1777,12 +1796,38 @@
"cwd": {
"type": "string"
},
"forkedFromThreadId": {
"type": [
"string",
"null"
]
},
"historyEntryCount": {
"format": "uint",
"minimum": 0.0,
"type": "integer"
},
"historyLogId": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
},
"model": {
"type": "string"
},
"modelProvider": {
"type": "string"
},
"networkProxy": {
"anyOf": [
{
"$ref": "#/definitions/SessionNetworkProxyRuntime"
},
{
"type": "null"
}
]
},
"reasoningEffort": {
"anyOf": [
{
@@ -1803,6 +1848,8 @@
"required": [
"approvalPolicy",
"cwd",
"historyEntryCount",
"historyLogId",
"model",
"modelProvider",
"sandbox",

View File

@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"title": "ThreadMemoriesDropParams",
"type": "object"
}

View File

@@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ThreadMemoriesDropResponse",
"type": "object"
}

View File

@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"title": "ThreadMemoriesUpdateParams",
"type": "object"
}

View File

@@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ThreadMemoriesUpdateResponse",
"type": "object"
}

View File

@@ -686,6 +686,25 @@
}
]
},
"SessionNetworkProxyRuntime": {
"properties": {
"adminAddr": {
"type": "string"
},
"httpAddr": {
"type": "string"
},
"socksAddr": {
"type": "string"
}
},
"required": [
"adminAddr",
"httpAddr",
"socksAddr"
],
"type": "object"
},
"SessionSource": {
"oneOf": [
{
@@ -1777,12 +1796,38 @@
"cwd": {
"type": "string"
},
"forkedFromThreadId": {
"type": [
"string",
"null"
]
},
"historyEntryCount": {
"format": "uint",
"minimum": 0.0,
"type": "integer"
},
"historyLogId": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
},
"model": {
"type": "string"
},
"modelProvider": {
"type": "string"
},
"networkProxy": {
"anyOf": [
{
"$ref": "#/definitions/SessionNetworkProxyRuntime"
},
{
"type": "null"
}
]
},
"reasoningEffort": {
"anyOf": [
{
@@ -1803,6 +1848,8 @@
"required": [
"approvalPolicy",
"cwd",
"historyEntryCount",
"historyLogId",
"model",
"modelProvider",
"sandbox",

View File

@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"title": "ThreadShutdownCompletedNotification",
"type": "object"
}

View File

@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"title": "ThreadShutdownParams",
"type": "object"
}

View File

@@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ThreadShutdownResponse",
"type": "object"
}

View File

@@ -686,6 +686,25 @@
}
]
},
"SessionNetworkProxyRuntime": {
"properties": {
"adminAddr": {
"type": "string"
},
"httpAddr": {
"type": "string"
},
"socksAddr": {
"type": "string"
}
},
"required": [
"adminAddr",
"httpAddr",
"socksAddr"
],
"type": "object"
},
"SessionSource": {
"oneOf": [
{
@@ -1777,12 +1796,38 @@
"cwd": {
"type": "string"
},
"forkedFromThreadId": {
"type": [
"string",
"null"
]
},
"historyEntryCount": {
"format": "uint",
"minimum": 0.0,
"type": "integer"
},
"historyLogId": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
},
"model": {
"type": "string"
},
"modelProvider": {
"type": "string"
},
"networkProxy": {
"anyOf": [
{
"$ref": "#/definitions/SessionNetworkProxyRuntime"
},
{
"type": "null"
}
]
},
"reasoningEffort": {
"anyOf": [
{
@@ -1803,6 +1848,8 @@
"required": [
"approvalPolicy",
"cwd",
"historyEntryCount",
"historyLogId",
"model",
"modelProvider",
"sandbox",

View File

@@ -0,0 +1,27 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"message": {
"type": [
"string",
"null"
]
},
"success": {
"type": "boolean"
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"success",
"threadId",
"turnId"
],
"title": "ThreadUndoCompletedNotification",
"type": "object"
}

View File

@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"title": "ThreadUndoParams",
"type": "object"
}

View File

@@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ThreadUndoResponse",
"type": "object"
}

View File

@@ -0,0 +1,23 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"message": {
"type": [
"string",
"null"
]
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"threadId",
"turnId"
],
"title": "ThreadUndoStartedNotification",
"type": "object"
}

View File

@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"command": {
"type": "string"
},
"threadId": {
"type": "string"
}
},
"required": [
"command",
"threadId"
],
"title": "ThreadUserShellCommandRunParams",
"type": "object"
}

View File

@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"turnId": {
"type": "string"
}
},
"required": [
"turnId"
],
"title": "ThreadUserShellCommandRunResponse",
"type": "object"
}

View File

@@ -0,0 +1,21 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"message": {
"type": "string"
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"message",
"threadId",
"turnId"
],
"title": "WarningNotification",
"type": "object"
}

File diff suppressed because one or more lines are too long

View File

@@ -11,6 +11,7 @@ import type { AccountRateLimitsUpdatedNotification } from "./v2/AccountRateLimit
import type { AccountUpdatedNotification } from "./v2/AccountUpdatedNotification";
import type { AgentMessageDeltaNotification } from "./v2/AgentMessageDeltaNotification";
import type { AppListUpdatedNotification } from "./v2/AppListUpdatedNotification";
import type { BackgroundEventNotification } from "./v2/BackgroundEventNotification";
import type { CommandExecutionOutputDeltaNotification } from "./v2/CommandExecutionOutputDeltaNotification";
import type { ConfigWarningNotification } from "./v2/ConfigWarningNotification";
import type { ContextCompactedNotification } from "./v2/ContextCompactedNotification";
@@ -20,6 +21,8 @@ import type { FileChangeOutputDeltaNotification } from "./v2/FileChangeOutputDel
import type { ItemCompletedNotification } from "./v2/ItemCompletedNotification";
import type { ItemStartedNotification } from "./v2/ItemStartedNotification";
import type { McpServerOauthLoginCompletedNotification } from "./v2/McpServerOauthLoginCompletedNotification";
import type { McpServerStartupCompletedNotification } from "./v2/McpServerStartupCompletedNotification";
import type { McpServerStartupUpdatedNotification } from "./v2/McpServerStartupUpdatedNotification";
import type { McpToolCallProgressNotification } from "./v2/McpToolCallProgressNotification";
import type { ModelReroutedNotification } from "./v2/ModelReroutedNotification";
import type { PlanDeltaNotification } from "./v2/PlanDeltaNotification";
@@ -27,21 +30,27 @@ import type { RawResponseItemCompletedNotification } from "./v2/RawResponseItemC
import type { ReasoningSummaryPartAddedNotification } from "./v2/ReasoningSummaryPartAddedNotification";
import type { ReasoningSummaryTextDeltaNotification } from "./v2/ReasoningSummaryTextDeltaNotification";
import type { ReasoningTextDeltaNotification } from "./v2/ReasoningTextDeltaNotification";
import type { SkillsUpdatedNotification } from "./v2/SkillsUpdatedNotification";
import type { StreamErrorNotification } from "./v2/StreamErrorNotification";
import type { TerminalInteractionNotification } from "./v2/TerminalInteractionNotification";
import type { ThreadArchivedNotification } from "./v2/ThreadArchivedNotification";
import type { ThreadNameUpdatedNotification } from "./v2/ThreadNameUpdatedNotification";
import type { ThreadShutdownCompletedNotification } from "./v2/ThreadShutdownCompletedNotification";
import type { ThreadStartedNotification } from "./v2/ThreadStartedNotification";
import type { ThreadStatusChangedNotification } from "./v2/ThreadStatusChangedNotification";
import type { ThreadTokenUsageUpdatedNotification } from "./v2/ThreadTokenUsageUpdatedNotification";
import type { ThreadUnarchivedNotification } from "./v2/ThreadUnarchivedNotification";
import type { ThreadUndoCompletedNotification } from "./v2/ThreadUndoCompletedNotification";
import type { ThreadUndoStartedNotification } from "./v2/ThreadUndoStartedNotification";
import type { TurnCompletedNotification } from "./v2/TurnCompletedNotification";
import type { TurnDiffUpdatedNotification } from "./v2/TurnDiffUpdatedNotification";
import type { TurnPlanUpdatedNotification } from "./v2/TurnPlanUpdatedNotification";
import type { TurnStartedNotification } from "./v2/TurnStartedNotification";
import type { WarningNotification } from "./v2/WarningNotification";
import type { WindowsSandboxSetupCompletedNotification } from "./v2/WindowsSandboxSetupCompletedNotification";
import type { WindowsWorldWritableWarningNotification } from "./v2/WindowsWorldWritableWarningNotification";
/**
* Notification sent from the server to the client.
*/
export type ServerNotification = { "method": "error", "params": ErrorNotification } | { "method": "thread/started", "params": ThreadStartedNotification } | { "method": "thread/status/changed", "params": ThreadStatusChangedNotification } | { "method": "thread/archived", "params": ThreadArchivedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/tokenUsage/updated", "params": ThreadTokenUsageUpdatedNotification } | { "method": "turn/started", "params": TurnStartedNotification } | { "method": "turn/completed", "params": TurnCompletedNotification } | { "method": "turn/diff/updated", "params": TurnDiffUpdatedNotification } | { "method": "turn/plan/updated", "params": TurnPlanUpdatedNotification } | { "method": "item/started", "params": ItemStartedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "item/reasoning/summaryTextDelta", "params": ReasoningSummaryTextDeltaNotification } | { "method": "item/reasoning/summaryPartAdded", "params": ReasoningSummaryPartAddedNotification } | { "method": "item/reasoning/textDelta", "params": ReasoningTextDeltaNotification } | { "method": "thread/compacted", "params": ContextCompactedNotification } | { "method": "model/rerouted", "params": ModelReroutedNotification } | { "method": "deprecationNotice", "params": DeprecationNoticeNotification } | { "method": "configWarning", "params": ConfigWarningNotification } | { "method": "fuzzyFileSearch/sessionUpdated", "params": FuzzyFileSearchSessionUpdatedNotification } | { "method": "fuzzyFileSearch/sessionCompleted", "params": FuzzyFileSearchSessionCompletedNotification } | { "method": "windows/worldWritableWarning", "params": WindowsWorldWritableWarningNotification } | { "method": "windowsSandbox/setupCompleted", "params": WindowsSandboxSetupCompletedNotification } | { "method": "account/login/completed", "params": AccountLoginCompletedNotification } | { "method": "authStatusChange", "params": AuthStatusChangeNotification } | { "method": "loginChatGptComplete", "params": LoginChatGptCompleteNotification } | { "method": "sessionConfigured", "params": SessionConfiguredNotification };
export type ServerNotification = { "method": "error", "params": ErrorNotification } | { "method": "warning", "params": WarningNotification } | { "method": "thread/started", "params": ThreadStartedNotification } | { "method": "thread/status/changed", "params": ThreadStatusChangedNotification } | { "method": "thread/archived", "params": ThreadArchivedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/tokenUsage/updated", "params": ThreadTokenUsageUpdatedNotification } | { "method": "thread/shutdown/completed", "params": ThreadShutdownCompletedNotification } | { "method": "thread/undo/started", "params": ThreadUndoStartedNotification } | { "method": "thread/undo/completed", "params": ThreadUndoCompletedNotification } | { "method": "turn/started", "params": TurnStartedNotification } | { "method": "turn/completed", "params": TurnCompletedNotification } | { "method": "turn/streamError", "params": StreamErrorNotification } | { "method": "turn/diff/updated", "params": TurnDiffUpdatedNotification } | { "method": "turn/plan/updated", "params": TurnPlanUpdatedNotification } | { "method": "item/started", "params": ItemStartedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/startup/updated", "params": McpServerStartupUpdatedNotification } | { "method": "mcpServer/startup/completed", "params": McpServerStartupCompletedNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "skills/updated", "params": SkillsUpdatedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "item/reasoning/summaryTextDelta", "params": ReasoningSummaryTextDeltaNotification } | { "method": "item/reasoning/summaryPartAdded", "params": ReasoningSummaryPartAddedNotification } | { "method": "item/reasoning/textDelta", "params": ReasoningTextDeltaNotification } | { "method": "thread/compacted", "params": ContextCompactedNotification } | { "method": "model/rerouted", "params": ModelReroutedNotification } | { "method": "deprecationNotice", "params": DeprecationNoticeNotification } | { "method": "backgroundEvent", "params": BackgroundEventNotification } | { "method": "configWarning", "params": ConfigWarningNotification } | { "method": "fuzzyFileSearch/sessionUpdated", "params": FuzzyFileSearchSessionUpdatedNotification } | { "method": "fuzzyFileSearch/sessionCompleted", "params": FuzzyFileSearchSessionCompletedNotification } | { "method": "windows/worldWritableWarning", "params": WindowsWorldWritableWarningNotification } | { "method": "windowsSandbox/setupCompleted", "params": WindowsSandboxSetupCompletedNotification } | { "method": "account/login/completed", "params": AccountLoginCompletedNotification } | { "method": "authStatusChange", "params": AuthStatusChangeNotification } | { "method": "loginChatGptComplete", "params": LoginChatGptCompleteNotification } | { "method": "sessionConfigured", "params": SessionConfiguredNotification };

View File

@@ -8,9 +8,10 @@ import type { ChatgptAuthTokensRefreshParams } from "./v2/ChatgptAuthTokensRefre
import type { CommandExecutionRequestApprovalParams } from "./v2/CommandExecutionRequestApprovalParams";
import type { DynamicToolCallParams } from "./v2/DynamicToolCallParams";
import type { FileChangeRequestApprovalParams } from "./v2/FileChangeRequestApprovalParams";
import type { McpElicitationRequestParams } from "./v2/McpElicitationRequestParams";
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": "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": "item/mcpElicitation/requestDecision", id: RequestId, params: McpElicitationRequestParams, } | { "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, };

View File

@@ -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 WindowsSandboxLevel = "disabled" | "restricted-token" | "elevated";

View File

@@ -239,4 +239,5 @@ export type { WebSearchBeginEvent } from "./WebSearchBeginEvent";
export type { WebSearchEndEvent } from "./WebSearchEndEvent";
export type { WebSearchItem } from "./WebSearchItem";
export type { WebSearchMode } from "./WebSearchMode";
export type { WindowsSandboxLevel } from "./WindowsSandboxLevel";
export * as v2 from "./v2";

View File

@@ -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 BackgroundEventNotification = { threadId: string, turnId: string, message: string, };

View File

@@ -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 CustomPrompt = { name: string, path: string, content: string, description: string | null, argumentHint: string | null, };

View File

@@ -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 CustomPromptListParams = Record<string, never>;

View File

@@ -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 { CustomPrompt } from "./CustomPrompt";
export type CustomPromptListResponse = { data: Array<CustomPrompt>, };

View File

@@ -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 HistoryAppendParams = { threadId: string, text: string, };

View File

@@ -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 HistoryAppendResponse = Record<string, never>;

View File

@@ -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 HistoryEntry = { conversationId: string, ts: number, text: string, };

View File

@@ -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 HistoryEntryReadParams = { logId: number, offset: number, };

View File

@@ -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 { HistoryEntry } from "./HistoryEntry";
export type HistoryEntryReadResponse = { logId: number, offset: number, entry: HistoryEntry | null, };

View File

@@ -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 McpElicitationDecision = "accept" | "decline" | "cancel";

View File

@@ -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 McpElicitationRequestParams = { threadId: string, serverName: string, requestId: string | number, message: string, };

View File

@@ -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 { McpElicitationDecision } from "./McpElicitationDecision";
export type McpElicitationRequestResponse = { decision: McpElicitationDecision, };

View File

@@ -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 { McpServerStartupFailure } from "./McpServerStartupFailure";
export type McpServerStartupCompletedNotification = { threadId: string, ready: Array<string>, failed: Array<McpServerStartupFailure>, cancelled: Array<string>, };

View File

@@ -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 McpServerStartupFailure = { server: string, error: string, };

View File

@@ -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 McpServerStartupStatus = { "state": "starting" } | { "state": "ready" } | { "state": "failed", error: string, } | { "state": "cancelled" };

View File

@@ -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 { McpServerStartupStatus } from "./McpServerStartupStatus";
export type McpServerStartupUpdatedNotification = { threadId: string, server: string, status: McpServerStartupStatus, };

View File

@@ -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 McpToolsListParams = Record<string, never>;

View File

@@ -0,0 +1,25 @@
// 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 { McpAuthStatus } from "../McpAuthStatus";
import type { Resource } from "../Resource";
import type { ResourceTemplate } from "../ResourceTemplate";
import type { Tool } from "../Tool";
export type McpToolsListResponse = {
/**
* Fully qualified tool name -> tool definition.
*/
tools: { [key in string]?: Tool },
/**
* Known resources grouped by server name.
*/
resources: { [key in string]?: Array<Resource> },
/**
* Known resource templates grouped by server name.
*/
resourceTemplates: { [key in string]?: Array<ResourceTemplate> },
/**
* Authentication status for each configured MCP server.
*/
authStatuses: { [key in string]?: McpAuthStatus }, };

View File

@@ -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 SessionNetworkProxyRuntime = { httpAddr: string, socksAddr: string, adminAddr: string, };

View File

@@ -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 SkillsUpdatedNotification = { threadId: string, };

View File

@@ -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 { TurnError } from "./TurnError";
export type StreamErrorNotification = { threadId: string, turnId: string, error: TurnError, };

View File

@@ -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 ThreadConfigReloadParams = { threadId: string, };

View File

@@ -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 { ThreadContextSnapshot } from "./ThreadContextSnapshot";
export type ThreadConfigReloadResponse = { context: ThreadContextSnapshot, };

View File

@@ -0,0 +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 { ReasoningEffort } from "../ReasoningEffort";
import type { AskForApproval } from "./AskForApproval";
import type { SandboxPolicy } from "./SandboxPolicy";
export type ThreadContextSnapshot = { threadId: string, model: string, modelProvider: string, cwd: string, approvalPolicy: AskForApproval, sandbox: SandboxPolicy, reasoningEffort: ReasoningEffort | null, };

View File

@@ -0,0 +1,11 @@
// 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 { Personality } from "../Personality";
import type { ReasoningEffort } from "../ReasoningEffort";
import type { ReasoningSummary } from "../ReasoningSummary";
import type { WindowsSandboxLevel } from "../WindowsSandboxLevel";
import type { AskForApproval } from "./AskForApproval";
import type { SandboxPolicy } from "./SandboxPolicy";
export type ThreadContextUpdateParams = {threadId: string, cwd?: string | null, approvalPolicy?: AskForApproval | null, sandboxPolicy?: SandboxPolicy | null, windowsSandboxLevel?: WindowsSandboxLevel | null, model?: string | null, effort?: ReasoningEffort | null | null, summary?: ReasoningSummary | null, personality?: Personality | null};

View File

@@ -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 { ThreadContextSnapshot } from "./ThreadContextSnapshot";
export type ThreadContextUpdateResponse = { context: ThreadContextSnapshot, };

View File

@@ -4,6 +4,7 @@
import type { ReasoningEffort } from "../ReasoningEffort";
import type { AskForApproval } from "./AskForApproval";
import type { SandboxPolicy } from "./SandboxPolicy";
import type { SessionNetworkProxyRuntime } from "./SessionNetworkProxyRuntime";
import type { Thread } from "./Thread";
export type ThreadForkResponse = { thread: Thread, model: string, modelProvider: string, cwd: string, approvalPolicy: AskForApproval, sandbox: SandboxPolicy, reasoningEffort: ReasoningEffort | null, };
export type ThreadForkResponse = { thread: Thread, model: string, modelProvider: string, cwd: string, approvalPolicy: AskForApproval, sandbox: SandboxPolicy, reasoningEffort: ReasoningEffort | null, historyLogId: number, historyEntryCount: number, forkedFromThreadId: string | null, networkProxy: SessionNetworkProxyRuntime | null, };

View File

@@ -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 ThreadMemoriesDropParams = { threadId: string, };

View File

@@ -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 ThreadMemoriesDropResponse = Record<string, never>;

View File

@@ -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 ThreadMemoriesUpdateParams = { threadId: string, };

View File

@@ -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 ThreadMemoriesUpdateResponse = Record<string, never>;

View File

@@ -4,6 +4,7 @@
import type { ReasoningEffort } from "../ReasoningEffort";
import type { AskForApproval } from "./AskForApproval";
import type { SandboxPolicy } from "./SandboxPolicy";
import type { SessionNetworkProxyRuntime } from "./SessionNetworkProxyRuntime";
import type { Thread } from "./Thread";
export type ThreadResumeResponse = { thread: Thread, model: string, modelProvider: string, cwd: string, approvalPolicy: AskForApproval, sandbox: SandboxPolicy, reasoningEffort: ReasoningEffort | null, };
export type ThreadResumeResponse = { thread: Thread, model: string, modelProvider: string, cwd: string, approvalPolicy: AskForApproval, sandbox: SandboxPolicy, reasoningEffort: ReasoningEffort | null, historyLogId: number, historyEntryCount: number, forkedFromThreadId: string | null, networkProxy: SessionNetworkProxyRuntime | null, };

View File

@@ -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 ThreadShutdownCompletedNotification = { threadId: string, };

View File

@@ -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 ThreadShutdownParams = { threadId: string, };

View File

@@ -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 ThreadShutdownResponse = Record<string, never>;

View File

@@ -4,6 +4,7 @@
import type { ReasoningEffort } from "../ReasoningEffort";
import type { AskForApproval } from "./AskForApproval";
import type { SandboxPolicy } from "./SandboxPolicy";
import type { SessionNetworkProxyRuntime } from "./SessionNetworkProxyRuntime";
import type { Thread } from "./Thread";
export type ThreadStartResponse = { thread: Thread, model: string, modelProvider: string, cwd: string, approvalPolicy: AskForApproval, sandbox: SandboxPolicy, reasoningEffort: ReasoningEffort | null, };
export type ThreadStartResponse = { thread: Thread, model: string, modelProvider: string, cwd: string, approvalPolicy: AskForApproval, sandbox: SandboxPolicy, reasoningEffort: ReasoningEffort | null, historyLogId: number, historyEntryCount: number, forkedFromThreadId: string | null, networkProxy: SessionNetworkProxyRuntime | null, };

View File

@@ -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 ThreadUndoCompletedNotification = { threadId: string, turnId: string, success: boolean, message: string | null, };

View File

@@ -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 ThreadUndoParams = { threadId: string, };

View File

@@ -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 ThreadUndoResponse = Record<string, never>;

View File

@@ -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 ThreadUndoStartedNotification = { threadId: string, turnId: string, message: string | null, };

View File

@@ -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 ThreadUserShellCommandRunParams = { threadId: string, command: string, };

View File

@@ -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 ThreadUserShellCommandRunResponse = { turnId: string, };

View File

@@ -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 WarningNotification = { threadId: string, turnId: string, message: string, };

View File

@@ -19,6 +19,7 @@ export type { AppsDefaultConfig } from "./AppsDefaultConfig";
export type { AppsListParams } from "./AppsListParams";
export type { AppsListResponse } from "./AppsListResponse";
export type { AskForApproval } from "./AskForApproval";
export type { BackgroundEventNotification } from "./BackgroundEventNotification";
export type { ByteRange } from "./ByteRange";
export type { CancelLoginAccountParams } from "./CancelLoginAccountParams";
export type { CancelLoginAccountResponse } from "./CancelLoginAccountResponse";
@@ -54,6 +55,9 @@ export type { ConfigWarningNotification } from "./ConfigWarningNotification";
export type { ConfigWriteResponse } from "./ConfigWriteResponse";
export type { ContextCompactedNotification } from "./ContextCompactedNotification";
export type { CreditsSnapshot } from "./CreditsSnapshot";
export type { CustomPrompt } from "./CustomPrompt";
export type { CustomPromptListParams } from "./CustomPromptListParams";
export type { CustomPromptListResponse } from "./CustomPromptListResponse";
export type { DeprecationNoticeNotification } from "./DeprecationNoticeNotification";
export type { DynamicToolCallOutputContentItem } from "./DynamicToolCallOutputContentItem";
export type { DynamicToolCallParams } from "./DynamicToolCallParams";
@@ -77,6 +81,11 @@ export type { GetAccountRateLimitsResponse } from "./GetAccountRateLimitsRespons
export type { GetAccountResponse } from "./GetAccountResponse";
export type { GitInfo } from "./GitInfo";
export type { HazelnutScope } from "./HazelnutScope";
export type { HistoryAppendParams } from "./HistoryAppendParams";
export type { HistoryAppendResponse } from "./HistoryAppendResponse";
export type { HistoryEntry } from "./HistoryEntry";
export type { HistoryEntryReadParams } from "./HistoryEntryReadParams";
export type { HistoryEntryReadResponse } from "./HistoryEntryReadResponse";
export type { ItemCompletedNotification } from "./ItemCompletedNotification";
export type { ItemStartedNotification } from "./ItemStartedNotification";
export type { ListMcpServerStatusParams } from "./ListMcpServerStatusParams";
@@ -85,15 +94,24 @@ export type { LoginAccountParams } from "./LoginAccountParams";
export type { LoginAccountResponse } from "./LoginAccountResponse";
export type { LogoutAccountResponse } from "./LogoutAccountResponse";
export type { McpAuthStatus } from "./McpAuthStatus";
export type { McpElicitationDecision } from "./McpElicitationDecision";
export type { McpElicitationRequestParams } from "./McpElicitationRequestParams";
export type { McpElicitationRequestResponse } from "./McpElicitationRequestResponse";
export type { McpServerOauthLoginCompletedNotification } from "./McpServerOauthLoginCompletedNotification";
export type { McpServerOauthLoginParams } from "./McpServerOauthLoginParams";
export type { McpServerOauthLoginResponse } from "./McpServerOauthLoginResponse";
export type { McpServerRefreshResponse } from "./McpServerRefreshResponse";
export type { McpServerStartupCompletedNotification } from "./McpServerStartupCompletedNotification";
export type { McpServerStartupFailure } from "./McpServerStartupFailure";
export type { McpServerStartupStatus } from "./McpServerStartupStatus";
export type { McpServerStartupUpdatedNotification } from "./McpServerStartupUpdatedNotification";
export type { McpServerStatus } from "./McpServerStatus";
export type { McpToolCallError } from "./McpToolCallError";
export type { McpToolCallProgressNotification } from "./McpToolCallProgressNotification";
export type { McpToolCallResult } from "./McpToolCallResult";
export type { McpToolCallStatus } from "./McpToolCallStatus";
export type { McpToolsListParams } from "./McpToolsListParams";
export type { McpToolsListResponse } from "./McpToolsListResponse";
export type { MergeStrategy } from "./MergeStrategy";
export type { Model } from "./Model";
export type { ModelListParams } from "./ModelListParams";
@@ -127,6 +145,7 @@ export type { ReviewTarget } from "./ReviewTarget";
export type { SandboxMode } from "./SandboxMode";
export type { SandboxPolicy } from "./SandboxPolicy";
export type { SandboxWorkspaceWrite } from "./SandboxWorkspaceWrite";
export type { SessionNetworkProxyRuntime } from "./SessionNetworkProxyRuntime";
export type { SessionSource } from "./SessionSource";
export type { SkillDependencies } from "./SkillDependencies";
export type { SkillErrorInfo } from "./SkillErrorInfo";
@@ -144,6 +163,8 @@ export type { SkillsRemoteReadParams } from "./SkillsRemoteReadParams";
export type { SkillsRemoteReadResponse } from "./SkillsRemoteReadResponse";
export type { SkillsRemoteWriteParams } from "./SkillsRemoteWriteParams";
export type { SkillsRemoteWriteResponse } from "./SkillsRemoteWriteResponse";
export type { SkillsUpdatedNotification } from "./SkillsUpdatedNotification";
export type { StreamErrorNotification } from "./StreamErrorNotification";
export type { TerminalInteractionNotification } from "./TerminalInteractionNotification";
export type { TextElement } from "./TextElement";
export type { TextPosition } from "./TextPosition";
@@ -155,6 +176,11 @@ export type { ThreadArchiveResponse } from "./ThreadArchiveResponse";
export type { ThreadArchivedNotification } from "./ThreadArchivedNotification";
export type { ThreadCompactStartParams } from "./ThreadCompactStartParams";
export type { ThreadCompactStartResponse } from "./ThreadCompactStartResponse";
export type { ThreadConfigReloadParams } from "./ThreadConfigReloadParams";
export type { ThreadConfigReloadResponse } from "./ThreadConfigReloadResponse";
export type { ThreadContextSnapshot } from "./ThreadContextSnapshot";
export type { ThreadContextUpdateParams } from "./ThreadContextUpdateParams";
export type { ThreadContextUpdateResponse } from "./ThreadContextUpdateResponse";
export type { ThreadForkParams } from "./ThreadForkParams";
export type { ThreadForkResponse } from "./ThreadForkResponse";
export type { ThreadItem } from "./ThreadItem";
@@ -162,6 +188,10 @@ export type { ThreadListParams } from "./ThreadListParams";
export type { ThreadListResponse } from "./ThreadListResponse";
export type { ThreadLoadedListParams } from "./ThreadLoadedListParams";
export type { ThreadLoadedListResponse } from "./ThreadLoadedListResponse";
export type { ThreadMemoriesDropParams } from "./ThreadMemoriesDropParams";
export type { ThreadMemoriesDropResponse } from "./ThreadMemoriesDropResponse";
export type { ThreadMemoriesUpdateParams } from "./ThreadMemoriesUpdateParams";
export type { ThreadMemoriesUpdateResponse } from "./ThreadMemoriesUpdateResponse";
export type { ThreadNameUpdatedNotification } from "./ThreadNameUpdatedNotification";
export type { ThreadReadParams } from "./ThreadReadParams";
export type { ThreadReadResponse } from "./ThreadReadResponse";
@@ -171,6 +201,9 @@ export type { ThreadRollbackParams } from "./ThreadRollbackParams";
export type { ThreadRollbackResponse } from "./ThreadRollbackResponse";
export type { ThreadSetNameParams } from "./ThreadSetNameParams";
export type { ThreadSetNameResponse } from "./ThreadSetNameResponse";
export type { ThreadShutdownCompletedNotification } from "./ThreadShutdownCompletedNotification";
export type { ThreadShutdownParams } from "./ThreadShutdownParams";
export type { ThreadShutdownResponse } from "./ThreadShutdownResponse";
export type { ThreadSortKey } from "./ThreadSortKey";
export type { ThreadSourceKind } from "./ThreadSourceKind";
export type { ThreadStartParams } from "./ThreadStartParams";
@@ -183,6 +216,12 @@ export type { ThreadTokenUsageUpdatedNotification } from "./ThreadTokenUsageUpda
export type { ThreadUnarchiveParams } from "./ThreadUnarchiveParams";
export type { ThreadUnarchiveResponse } from "./ThreadUnarchiveResponse";
export type { ThreadUnarchivedNotification } from "./ThreadUnarchivedNotification";
export type { ThreadUndoCompletedNotification } from "./ThreadUndoCompletedNotification";
export type { ThreadUndoParams } from "./ThreadUndoParams";
export type { ThreadUndoResponse } from "./ThreadUndoResponse";
export type { ThreadUndoStartedNotification } from "./ThreadUndoStartedNotification";
export type { ThreadUserShellCommandRunParams } from "./ThreadUserShellCommandRunParams";
export type { ThreadUserShellCommandRunResponse } from "./ThreadUserShellCommandRunResponse";
export type { TokenUsageBreakdown } from "./TokenUsageBreakdown";
export type { ToolRequestUserInputAnswer } from "./ToolRequestUserInputAnswer";
export type { ToolRequestUserInputOption } from "./ToolRequestUserInputOption";
@@ -206,6 +245,7 @@ export type { TurnStatus } from "./TurnStatus";
export type { TurnSteerParams } from "./TurnSteerParams";
export type { TurnSteerResponse } from "./TurnSteerResponse";
export type { UserInput } from "./UserInput";
export type { WarningNotification } from "./WarningNotification";
export type { WebSearchAction } from "./WebSearchAction";
export type { WindowsSandboxSetupCompletedNotification } from "./WindowsSandboxSetupCompletedNotification";
export type { WindowsSandboxSetupMode } from "./WindowsSandboxSetupMode";

View File

@@ -223,6 +223,35 @@ client_request_definitions! {
params: v2::ThreadRollbackParams,
response: v2::ThreadRollbackResponse,
},
ThreadContextUpdate => "thread/context/update" {
params: v2::ThreadContextUpdateParams,
inspect_params: true,
response: v2::ThreadContextUpdateResponse,
},
ThreadShutdown => "thread/shutdown" {
params: v2::ThreadShutdownParams,
response: v2::ThreadShutdownResponse,
},
ThreadUndo => "thread/undo" {
params: v2::ThreadUndoParams,
response: v2::ThreadUndoResponse,
},
ThreadConfigReload => "thread/config/reload" {
params: v2::ThreadConfigReloadParams,
response: v2::ThreadConfigReloadResponse,
},
ThreadMemoriesDrop => "thread/memories/drop" {
params: v2::ThreadMemoriesDropParams,
response: v2::ThreadMemoriesDropResponse,
},
ThreadMemoriesUpdate => "thread/memories/update" {
params: v2::ThreadMemoriesUpdateParams,
response: v2::ThreadMemoriesUpdateResponse,
},
ThreadUserShellCommandRun => "thread/userShellCommand/run" {
params: v2::ThreadUserShellCommandRunParams,
response: v2::ThreadUserShellCommandRunResponse,
},
ThreadList => "thread/list" {
params: v2::ThreadListParams,
response: v2::ThreadListResponse,
@@ -235,6 +264,22 @@ client_request_definitions! {
params: v2::ThreadReadParams,
response: v2::ThreadReadResponse,
},
CustomPromptList => "customPrompt/list" {
params: v2::CustomPromptListParams,
response: v2::CustomPromptListResponse,
},
McpToolsList => "mcpTools/list" {
params: v2::McpToolsListParams,
response: v2::McpToolsListResponse,
},
HistoryAppend => "history/append" {
params: v2::HistoryAppendParams,
response: v2::HistoryAppendResponse,
},
HistoryEntryRead => "history/entry/read" {
params: v2::HistoryEntryReadParams,
response: v2::HistoryEntryReadResponse,
},
SkillsList => "skills/list" {
params: v2::SkillsListParams,
response: v2::SkillsListResponse,
@@ -671,6 +716,12 @@ server_request_definitions! {
response: v2::ToolRequestUserInputResponse,
},
/// Request the user to resolve an MCP elicitation prompt.
McpElicitationRequest => "item/mcpElicitation/requestDecision" {
params: v2::McpElicitationRequestParams,
response: v2::McpElicitationRequestResponse,
},
/// Execute a dynamic tool call on the client.
DynamicToolCall => "item/tool/call" {
params: v2::DynamicToolCallParams,
@@ -773,14 +824,19 @@ pub struct FuzzyFileSearchSessionCompletedNotification {
server_notification_definitions! {
/// NEW NOTIFICATIONS
Error => "error" (v2::ErrorNotification),
Warning => "warning" (v2::WarningNotification),
ThreadStarted => "thread/started" (v2::ThreadStartedNotification),
ThreadStatusChanged => "thread/status/changed" (v2::ThreadStatusChangedNotification),
ThreadArchived => "thread/archived" (v2::ThreadArchivedNotification),
ThreadUnarchived => "thread/unarchived" (v2::ThreadUnarchivedNotification),
ThreadNameUpdated => "thread/name/updated" (v2::ThreadNameUpdatedNotification),
ThreadTokenUsageUpdated => "thread/tokenUsage/updated" (v2::ThreadTokenUsageUpdatedNotification),
ThreadShutdownCompleted => "thread/shutdown/completed" (v2::ThreadShutdownCompletedNotification),
ThreadUndoStarted => "thread/undo/started" (v2::ThreadUndoStartedNotification),
ThreadUndoCompleted => "thread/undo/completed" (v2::ThreadUndoCompletedNotification),
TurnStarted => "turn/started" (v2::TurnStartedNotification),
TurnCompleted => "turn/completed" (v2::TurnCompletedNotification),
StreamError => "turn/streamError" (v2::StreamErrorNotification),
TurnDiffUpdated => "turn/diff/updated" (v2::TurnDiffUpdatedNotification),
TurnPlanUpdated => "turn/plan/updated" (v2::TurnPlanUpdatedNotification),
ItemStarted => "item/started" (v2::ItemStartedNotification),
@@ -794,7 +850,10 @@ server_notification_definitions! {
TerminalInteraction => "item/commandExecution/terminalInteraction" (v2::TerminalInteractionNotification),
FileChangeOutputDelta => "item/fileChange/outputDelta" (v2::FileChangeOutputDeltaNotification),
McpToolCallProgress => "item/mcpToolCall/progress" (v2::McpToolCallProgressNotification),
McpServerStartupUpdated => "mcpServer/startup/updated" (v2::McpServerStartupUpdatedNotification),
McpServerStartupCompleted => "mcpServer/startup/completed" (v2::McpServerStartupCompletedNotification),
McpServerOauthLoginCompleted => "mcpServer/oauthLogin/completed" (v2::McpServerOauthLoginCompletedNotification),
SkillsUpdated => "skills/updated" (v2::SkillsUpdatedNotification),
AccountUpdated => "account/updated" (v2::AccountUpdatedNotification),
AccountRateLimitsUpdated => "account/rateLimits/updated" (v2::AccountRateLimitsUpdatedNotification),
AppListUpdated => "app/list/updated" (v2::AppListUpdatedNotification),
@@ -805,6 +864,7 @@ server_notification_definitions! {
ContextCompacted => "thread/compacted" (v2::ContextCompactedNotification),
ModelRerouted => "model/rerouted" (v2::ModelReroutedNotification),
DeprecationNotice => "deprecationNotice" (v2::DeprecationNoticeNotification),
BackgroundEvent => "backgroundEvent" (v2::BackgroundEventNotification),
ConfigWarning => "configWarning" (v2::ConfigWarningNotification),
FuzzyFileSearchSessionUpdated => "fuzzyFileSearch/sessionUpdated" (FuzzyFileSearchSessionUpdatedNotification),
FuzzyFileSearchSessionCompleted => "fuzzyFileSearch/sessionCompleted" (FuzzyFileSearchSessionCompletedNotification),

View File

@@ -1,9 +1,11 @@
use std::collections::HashMap;
use std::path::PathBuf;
use crate::RequestId;
use crate::protocol::common::AuthMode;
use codex_experimental_api_macros::ExperimentalApi;
use codex_protocol::account::PlanType;
use codex_protocol::approvals::ElicitationAction as CoreElicitationAction;
use codex_protocol::approvals::ExecPolicyAmendment as CoreExecPolicyAmendment;
use codex_protocol::approvals::NetworkApprovalContext as CoreNetworkApprovalContext;
use codex_protocol::approvals::NetworkApprovalProtocol as CoreNetworkApprovalProtocol;
@@ -15,11 +17,14 @@ use codex_protocol::config_types::ReasoningSummary;
use codex_protocol::config_types::SandboxMode as CoreSandboxMode;
use codex_protocol::config_types::Verbosity;
use codex_protocol::config_types::WebSearchMode;
use codex_protocol::config_types::WindowsSandboxLevel;
use codex_protocol::custom_prompts::CustomPrompt as CoreCustomPrompt;
use codex_protocol::items::AgentMessageContent as CoreAgentMessageContent;
use codex_protocol::items::TurnItem as CoreTurnItem;
use codex_protocol::mcp::Resource as McpResource;
use codex_protocol::mcp::ResourceTemplate as McpResourceTemplate;
use codex_protocol::mcp::Tool as McpTool;
use codex_protocol::message_history::HistoryEntry as CoreHistoryEntry;
use codex_protocol::models::MessagePhase;
use codex_protocol::models::ResponseItem;
use codex_protocol::openai_models::InputModality;
@@ -33,6 +38,10 @@ use codex_protocol::protocol::AskForApproval as CoreAskForApproval;
use codex_protocol::protocol::CodexErrorInfo as CoreCodexErrorInfo;
use codex_protocol::protocol::CreditsSnapshot as CoreCreditsSnapshot;
use codex_protocol::protocol::ExecCommandStatus as CoreExecCommandStatus;
use codex_protocol::protocol::McpAuthStatus as CoreMcpAuthStatus;
use codex_protocol::protocol::McpListToolsResponseEvent as CoreMcpListToolsResponseEvent;
use codex_protocol::protocol::McpStartupFailure as CoreMcpStartupFailure;
use codex_protocol::protocol::McpStartupStatus as CoreMcpStartupStatus;
use codex_protocol::protocol::ModelRerouteReason as CoreModelRerouteReason;
use codex_protocol::protocol::NetworkAccess as CoreNetworkAccess;
use codex_protocol::protocol::PatchApplyStatus as CorePatchApplyStatus;
@@ -40,6 +49,7 @@ use codex_protocol::protocol::RateLimitSnapshot as CoreRateLimitSnapshot;
use codex_protocol::protocol::RateLimitWindow as CoreRateLimitWindow;
use codex_protocol::protocol::ReadOnlyAccess as CoreReadOnlyAccess;
use codex_protocol::protocol::RejectConfig as CoreRejectConfig;
use codex_protocol::protocol::SessionNetworkProxyRuntime as CoreSessionNetworkProxyRuntime;
use codex_protocol::protocol::SessionSource as CoreSessionSource;
use codex_protocol::protocol::SkillDependencies as CoreSkillDependencies;
use codex_protocol::protocol::SkillErrorInfo as CoreSkillErrorInfo;
@@ -1616,6 +1626,12 @@ pub struct ThreadStartResponse {
pub approval_policy: AskForApproval,
pub sandbox: SandboxPolicy,
pub reasoning_effort: Option<ReasoningEffort>,
#[ts(type = "number")]
pub history_log_id: u64,
#[ts(type = "number")]
pub history_entry_count: usize,
pub forked_from_thread_id: Option<String>,
pub network_proxy: Option<SessionNetworkProxyRuntime>,
}
#[derive(
@@ -1685,6 +1701,12 @@ pub struct ThreadResumeResponse {
pub approval_policy: AskForApproval,
pub sandbox: SandboxPolicy,
pub reasoning_effort: Option<ReasoningEffort>,
#[ts(type = "number")]
pub history_log_id: u64,
#[ts(type = "number")]
pub history_entry_count: usize,
pub forked_from_thread_id: Option<String>,
pub network_proxy: Option<SessionNetworkProxyRuntime>,
}
#[derive(
@@ -1743,6 +1765,12 @@ pub struct ThreadForkResponse {
pub approval_policy: AskForApproval,
pub sandbox: SandboxPolicy,
pub reasoning_effort: Option<ReasoningEffort>,
#[ts(type = "number")]
pub history_log_id: u64,
#[ts(type = "number")]
pub history_entry_count: usize,
pub forked_from_thread_id: Option<String>,
pub network_proxy: Option<SessionNetworkProxyRuntime>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
@@ -1962,6 +1990,269 @@ pub struct ThreadReadResponse {
pub thread: Thread,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct SessionNetworkProxyRuntime {
pub http_addr: String,
pub socks_addr: String,
pub admin_addr: String,
}
impl From<CoreSessionNetworkProxyRuntime> for SessionNetworkProxyRuntime {
fn from(value: CoreSessionNetworkProxyRuntime) -> Self {
Self {
http_addr: value.http_addr,
socks_addr: value.socks_addr,
admin_addr: value.admin_addr,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadContextSnapshot {
pub thread_id: String,
pub model: String,
pub model_provider: String,
pub cwd: PathBuf,
pub approval_policy: AskForApproval,
pub sandbox: SandboxPolicy,
pub reasoning_effort: Option<ReasoningEffort>,
}
#[derive(
Serialize, Deserialize, Debug, Default, Clone, PartialEq, JsonSchema, TS, ExperimentalApi,
)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadContextUpdateParams {
pub thread_id: String,
#[ts(optional = nullable)]
pub cwd: Option<PathBuf>,
#[ts(optional = nullable)]
pub approval_policy: Option<AskForApproval>,
#[ts(optional = nullable)]
pub sandbox_policy: Option<SandboxPolicy>,
#[ts(optional = nullable)]
pub windows_sandbox_level: Option<WindowsSandboxLevel>,
#[ts(optional = nullable)]
pub model: Option<String>,
#[ts(optional = nullable)]
pub effort: Option<Option<ReasoningEffort>>,
#[ts(optional = nullable)]
pub summary: Option<ReasoningSummary>,
#[ts(optional = nullable)]
pub personality: Option<Personality>,
#[experimental("thread/context/update.collaborationMode")]
#[ts(optional = nullable)]
pub collaboration_mode: Option<CollaborationMode>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadContextUpdateResponse {
pub context: ThreadContextSnapshot,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadShutdownParams {
pub thread_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, Default)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadShutdownResponse {}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadUndoParams {
pub thread_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, Default)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadUndoResponse {}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadConfigReloadParams {
pub thread_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadConfigReloadResponse {
pub context: ThreadContextSnapshot,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadMemoriesDropParams {
pub thread_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, Default)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadMemoriesDropResponse {}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadMemoriesUpdateParams {
pub thread_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, Default)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadMemoriesUpdateResponse {}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadUserShellCommandRunParams {
pub thread_id: String,
pub command: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadUserShellCommandRunResponse {
pub turn_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct HistoryAppendParams {
pub thread_id: String,
pub text: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, Default)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct HistoryAppendResponse {}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct HistoryEntryReadParams {
#[ts(type = "number")]
pub log_id: u64,
#[ts(type = "number")]
pub offset: usize,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct HistoryEntry {
pub conversation_id: String,
#[ts(type = "number")]
pub ts: u64,
pub text: String,
}
impl From<CoreHistoryEntry> for HistoryEntry {
fn from(value: CoreHistoryEntry) -> Self {
Self {
conversation_id: value.conversation_id,
ts: value.ts,
text: value.text,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct HistoryEntryReadResponse {
#[ts(type = "number")]
pub log_id: u64,
#[ts(type = "number")]
pub offset: usize,
pub entry: Option<HistoryEntry>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, Default)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct CustomPromptListParams {}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct CustomPrompt {
pub name: String,
pub path: PathBuf,
pub content: String,
pub description: Option<String>,
pub argument_hint: Option<String>,
}
impl From<CoreCustomPrompt> for CustomPrompt {
fn from(value: CoreCustomPrompt) -> Self {
Self {
name: value.name,
path: value.path,
content: value.content,
description: value.description,
argument_hint: value.argument_hint,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct CustomPromptListResponse {
pub data: Vec<CustomPrompt>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, Default)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct McpToolsListParams {}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct McpToolsListResponse {
/// Fully qualified tool name -> tool definition.
pub tools: HashMap<String, McpTool>,
/// Known resources grouped by server name.
pub resources: HashMap<String, Vec<McpResource>>,
/// Known resource templates grouped by server name.
pub resource_templates: HashMap<String, Vec<McpResourceTemplate>>,
/// Authentication status for each configured MCP server.
pub auth_statuses: HashMap<String, CoreMcpAuthStatus>,
}
impl From<CoreMcpListToolsResponseEvent> for McpToolsListResponse {
fn from(value: CoreMcpListToolsResponseEvent) -> Self {
Self {
tools: value.tools,
resources: value.resources,
resource_templates: value.resource_templates,
auth_statuses: value.auth_statuses,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
@@ -3350,6 +3641,124 @@ pub struct WindowsSandboxSetupCompletedNotification {
pub error: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct WarningNotification {
pub thread_id: String,
pub turn_id: String,
pub message: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct BackgroundEventNotification {
pub thread_id: String,
pub turn_id: String,
pub message: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct StreamErrorNotification {
pub thread_id: String,
pub turn_id: String,
pub error: TurnError,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadUndoStartedNotification {
pub thread_id: String,
pub turn_id: String,
pub message: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadUndoCompletedNotification {
pub thread_id: String,
pub turn_id: String,
pub success: bool,
pub message: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase", tag = "state")]
#[ts(rename_all = "camelCase", tag = "state")]
#[ts(export_to = "v2/")]
pub enum McpServerStartupStatus {
Starting,
Ready,
Failed { error: String },
Cancelled,
}
impl From<CoreMcpStartupStatus> for McpServerStartupStatus {
fn from(value: CoreMcpStartupStatus) -> Self {
match value {
CoreMcpStartupStatus::Starting => Self::Starting,
CoreMcpStartupStatus::Ready => Self::Ready,
CoreMcpStartupStatus::Failed { error } => Self::Failed { error },
CoreMcpStartupStatus::Cancelled => Self::Cancelled,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct McpServerStartupFailure {
pub server: String,
pub error: String,
}
impl From<CoreMcpStartupFailure> for McpServerStartupFailure {
fn from(value: CoreMcpStartupFailure) -> Self {
Self {
server: value.server,
error: value.error,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct McpServerStartupUpdatedNotification {
pub thread_id: String,
pub server: String,
pub status: McpServerStartupStatus,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct McpServerStartupCompletedNotification {
pub thread_id: String,
pub ready: Vec<String>,
pub failed: Vec<McpServerStartupFailure>,
pub cancelled: Vec<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct SkillsUpdatedNotification {
pub thread_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadShutdownCompletedNotification {
pub thread_id: String,
}
/// Deprecated: Use `ContextCompaction` item type instead.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
@@ -3525,6 +3934,54 @@ pub struct ToolRequestUserInputResponse {
pub answers: HashMap<String, ToolRequestUserInputAnswer>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub enum McpElicitationDecision {
Accept,
Decline,
Cancel,
}
impl McpElicitationDecision {
pub fn to_core(self) -> CoreElicitationAction {
match self {
Self::Accept => CoreElicitationAction::Accept,
Self::Decline => CoreElicitationAction::Decline,
Self::Cancel => CoreElicitationAction::Cancel,
}
}
}
impl From<CoreElicitationAction> for McpElicitationDecision {
fn from(value: CoreElicitationAction) -> Self {
match value {
CoreElicitationAction::Accept => Self::Accept,
CoreElicitationAction::Decline => Self::Decline,
CoreElicitationAction::Cancel => Self::Cancel,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct McpElicitationRequestParams {
pub thread_id: String,
pub server_name: String,
#[ts(type = "string | number")]
pub request_id: RequestId,
pub message: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct McpElicitationRequestResponse {
pub decision: McpElicitationDecision,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]

View File

@@ -40,6 +40,11 @@ use codex_app_server_protocol::InterruptConversationResponse;
use codex_app_server_protocol::ItemCompletedNotification;
use codex_app_server_protocol::ItemStartedNotification;
use codex_app_server_protocol::JSONRPCErrorError;
use codex_app_server_protocol::McpElicitationDecision;
use codex_app_server_protocol::McpElicitationRequestParams;
use codex_app_server_protocol::McpElicitationRequestResponse;
use codex_app_server_protocol::McpServerStartupCompletedNotification;
use codex_app_server_protocol::McpServerStartupUpdatedNotification;
use codex_app_server_protocol::McpToolCallError;
use codex_app_server_protocol::McpToolCallResult;
use codex_app_server_protocol::McpToolCallStatus;
@@ -51,14 +56,20 @@ use codex_app_server_protocol::RawResponseItemCompletedNotification;
use codex_app_server_protocol::ReasoningSummaryPartAddedNotification;
use codex_app_server_protocol::ReasoningSummaryTextDeltaNotification;
use codex_app_server_protocol::ReasoningTextDeltaNotification;
use codex_app_server_protocol::RequestId as AppServerRequestId;
use codex_app_server_protocol::ServerNotification;
use codex_app_server_protocol::ServerRequestPayload;
use codex_app_server_protocol::SkillsUpdatedNotification;
use codex_app_server_protocol::StreamErrorNotification;
use codex_app_server_protocol::TerminalInteractionNotification;
use codex_app_server_protocol::ThreadItem;
use codex_app_server_protocol::ThreadNameUpdatedNotification;
use codex_app_server_protocol::ThreadRollbackResponse;
use codex_app_server_protocol::ThreadShutdownCompletedNotification;
use codex_app_server_protocol::ThreadTokenUsage;
use codex_app_server_protocol::ThreadTokenUsageUpdatedNotification;
use codex_app_server_protocol::ThreadUndoCompletedNotification;
use codex_app_server_protocol::ThreadUndoStartedNotification;
use codex_app_server_protocol::ToolRequestUserInputOption;
use codex_app_server_protocol::ToolRequestUserInputParams;
use codex_app_server_protocol::ToolRequestUserInputQuestion;
@@ -71,6 +82,7 @@ use codex_app_server_protocol::TurnInterruptResponse;
use codex_app_server_protocol::TurnPlanStep;
use codex_app_server_protocol::TurnPlanUpdatedNotification;
use codex_app_server_protocol::TurnStatus;
use codex_app_server_protocol::WarningNotification;
use codex_app_server_protocol::build_turns_from_rollout_items;
use codex_app_server_protocol::convert_patch_changes;
use codex_core::CodexThread;
@@ -79,6 +91,7 @@ use codex_core::find_thread_name_by_id;
use codex_core::review_format::format_review_findings_block;
use codex_core::review_prompts;
use codex_protocol::ThreadId;
use codex_protocol::approvals::ElicitationRequestEvent;
use codex_protocol::dynamic_tools::DynamicToolCallOutputContentItem as CoreDynamicToolCallOutputContentItem;
use codex_protocol::dynamic_tools::DynamicToolResponse as CoreDynamicToolResponse;
use codex_protocol::plan_tool::UpdatePlanArgs;
@@ -151,7 +164,18 @@ pub(crate) async fn apply_bespoke_event_handling(
.await;
handle_turn_complete(conversation_id, event_turn_id, &outgoing, &thread_state).await;
}
EventMsg::Warning(_warning_event) => {}
EventMsg::Warning(warning_event) => {
if let ApiVersion::V2 = api_version {
let notification = WarningNotification {
thread_id: conversation_id.to_string(),
turn_id: event_turn_id.clone(),
message: warning_event.message,
};
outgoing
.send_server_notification(ServerNotification::Warning(notification))
.await;
}
}
EventMsg::ModelReroute(event) => {
if let ApiVersion::V2 = api_version {
let notification = ModelReroutedNotification {
@@ -361,6 +385,43 @@ pub(crate) async fn apply_bespoke_event_handling(
}
}
}
EventMsg::ElicitationRequest(ElicitationRequestEvent {
server_name,
id,
message,
}) => {
if matches!(api_version, ApiVersion::V2) {
let permission_guard = thread_watch_manager
.note_permission_requested(&conversation_id.to_string())
.await;
let params = McpElicitationRequestParams {
thread_id: conversation_id.to_string(),
server_name: server_name.clone(),
request_id: match id.clone() {
codex_protocol::mcp::RequestId::String(value) => {
AppServerRequestId::String(value)
}
codex_protocol::mcp::RequestId::Integer(value) => {
AppServerRequestId::Integer(value)
}
},
message,
};
let rx = outgoing
.send_request(ServerRequestPayload::McpElicitationRequest(params))
.await;
tokio::spawn(async move {
on_mcp_elicitation_response(
server_name,
id,
rx,
conversation,
permission_guard,
)
.await;
});
}
}
EventMsg::RequestUserInput(request) => {
if matches!(api_version, ApiVersion::V2) {
let user_input_guard = thread_watch_manager
@@ -863,12 +924,101 @@ pub(crate) async fn apply_bespoke_event_handling(
};
outgoing
.send_server_notification(ServerNotification::Error(ErrorNotification {
error: turn_error,
error: turn_error.clone(),
will_retry: true,
thread_id: conversation_id.to_string(),
turn_id: event_turn_id.clone(),
}))
.await;
if let ApiVersion::V2 = api_version {
outgoing
.send_server_notification(ServerNotification::StreamError(
StreamErrorNotification {
thread_id: conversation_id.to_string(),
turn_id: event_turn_id.clone(),
error: turn_error,
},
))
.await;
}
}
EventMsg::McpStartupUpdate(ev) => {
if let ApiVersion::V2 = api_version {
outgoing
.send_server_notification(ServerNotification::McpServerStartupUpdated(
McpServerStartupUpdatedNotification {
thread_id: conversation_id.to_string(),
server: ev.server,
status: ev.status.into(),
},
))
.await;
}
}
EventMsg::McpStartupComplete(ev) => {
if let ApiVersion::V2 = api_version {
outgoing
.send_server_notification(ServerNotification::McpServerStartupCompleted(
McpServerStartupCompletedNotification {
thread_id: conversation_id.to_string(),
ready: ev.ready,
failed: ev.failed.into_iter().map(Into::into).collect(),
cancelled: ev.cancelled,
},
))
.await;
}
}
EventMsg::BackgroundEvent(ev) => {
if let ApiVersion::V2 = api_version {
outgoing
.send_server_notification(ServerNotification::BackgroundEvent(
codex_app_server_protocol::BackgroundEventNotification {
thread_id: conversation_id.to_string(),
turn_id: event_turn_id.clone(),
message: ev.message,
},
))
.await;
}
}
EventMsg::UndoStarted(ev) => {
if let ApiVersion::V2 = api_version {
outgoing
.send_server_notification(ServerNotification::ThreadUndoStarted(
ThreadUndoStartedNotification {
thread_id: conversation_id.to_string(),
turn_id: event_turn_id.clone(),
message: ev.message,
},
))
.await;
}
}
EventMsg::UndoCompleted(ev) => {
if let ApiVersion::V2 = api_version {
outgoing
.send_server_notification(ServerNotification::ThreadUndoCompleted(
ThreadUndoCompletedNotification {
thread_id: conversation_id.to_string(),
turn_id: event_turn_id.clone(),
success: ev.success,
message: ev.message,
},
))
.await;
}
}
EventMsg::SkillsUpdateAvailable => {
if let ApiVersion::V2 = api_version {
outgoing
.send_server_notification(ServerNotification::SkillsUpdated(
SkillsUpdatedNotification {
thread_id: conversation_id.to_string(),
},
))
.await;
}
}
EventMsg::ViewImageToolCall(view_image_event) => {
let item = ThreadItem::ImageView {
@@ -1306,6 +1456,15 @@ pub(crate) async fn apply_bespoke_event_handling(
thread_watch_manager
.note_thread_shutdown(&conversation_id.to_string())
.await;
if let ApiVersion::V2 = api_version {
outgoing
.send_server_notification(ServerNotification::ThreadShutdownCompleted(
ThreadShutdownCompletedNotification {
thread_id: conversation_id.to_string(),
},
))
.await;
}
}
_ => {}
@@ -1734,6 +1893,45 @@ async fn on_request_user_input_response(
}
}
async fn on_mcp_elicitation_response(
server_name: String,
request_id: codex_protocol::mcp::RequestId,
receiver: oneshot::Receiver<ClientRequestResult>,
conversation: Arc<CodexThread>,
permission_guard: ThreadWatchActiveGuard,
) {
let response = receiver.await;
drop(permission_guard);
let decision = match response {
Ok(Ok(value)) => serde_json::from_value::<McpElicitationRequestResponse>(value)
.map(|response| response.decision)
.unwrap_or_else(|err| {
error!("failed to deserialize McpElicitationRequestResponse: {err}");
McpElicitationDecision::Cancel
}),
Ok(Err(err)) => {
error!("elicitation request failed with client error: {err:?}");
McpElicitationDecision::Cancel
}
Err(err) => {
error!("elicitation request failed: {err:?}");
McpElicitationDecision::Cancel
}
};
if let Err(err) = conversation
.submit(Op::ResolveElicitation {
server_name,
request_id,
decision: decision.to_core(),
})
.await
{
error!("failed to submit ResolveElicitation: {err}");
}
}
const REVIEW_FALLBACK_MESSAGE: &str = "Reviewer failed to output a response.";
fn render_review_output_text(output: &ReviewOutputEvent) -> String {

View File

@@ -39,6 +39,8 @@ use codex_app_server_protocol::CollaborationModeListResponse;
use codex_app_server_protocol::CommandExecParams;
use codex_app_server_protocol::ConversationGitInfo;
use codex_app_server_protocol::ConversationSummary;
use codex_app_server_protocol::CustomPromptListParams;
use codex_app_server_protocol::CustomPromptListResponse;
use codex_app_server_protocol::DynamicToolSpec as ApiDynamicToolSpec;
use codex_app_server_protocol::ExecOneOffCommandResponse;
use codex_app_server_protocol::ExperimentalFeature as ApiExperimentalFeature;
@@ -69,6 +71,10 @@ use codex_app_server_protocol::GetUserSavedConfigResponse;
use codex_app_server_protocol::GitDiffToRemoteResponse;
use codex_app_server_protocol::GitInfo as ApiGitInfo;
use codex_app_server_protocol::HazelnutScope as ApiHazelnutScope;
use codex_app_server_protocol::HistoryAppendParams;
use codex_app_server_protocol::HistoryAppendResponse;
use codex_app_server_protocol::HistoryEntryReadParams;
use codex_app_server_protocol::HistoryEntryReadResponse;
use codex_app_server_protocol::InputItem as WireInputItem;
use codex_app_server_protocol::InterruptConversationParams;
use codex_app_server_protocol::JSONRPCErrorError;
@@ -89,6 +95,8 @@ use codex_app_server_protocol::McpServerOauthLoginParams;
use codex_app_server_protocol::McpServerOauthLoginResponse;
use codex_app_server_protocol::McpServerRefreshResponse;
use codex_app_server_protocol::McpServerStatus;
use codex_app_server_protocol::McpToolsListParams;
use codex_app_server_protocol::McpToolsListResponse;
use codex_app_server_protocol::MockExperimentalMethodParams;
use codex_app_server_protocol::MockExperimentalMethodResponse;
use codex_app_server_protocol::ModelListParams;
@@ -129,6 +137,11 @@ use codex_app_server_protocol::ThreadBackgroundTerminalsCleanParams;
use codex_app_server_protocol::ThreadBackgroundTerminalsCleanResponse;
use codex_app_server_protocol::ThreadCompactStartParams;
use codex_app_server_protocol::ThreadCompactStartResponse;
use codex_app_server_protocol::ThreadConfigReloadParams;
use codex_app_server_protocol::ThreadConfigReloadResponse;
use codex_app_server_protocol::ThreadContextSnapshot;
use codex_app_server_protocol::ThreadContextUpdateParams;
use codex_app_server_protocol::ThreadContextUpdateResponse;
use codex_app_server_protocol::ThreadForkParams;
use codex_app_server_protocol::ThreadForkResponse;
use codex_app_server_protocol::ThreadItem;
@@ -143,6 +156,8 @@ use codex_app_server_protocol::ThreadResumeResponse;
use codex_app_server_protocol::ThreadRollbackParams;
use codex_app_server_protocol::ThreadSetNameParams;
use codex_app_server_protocol::ThreadSetNameResponse;
use codex_app_server_protocol::ThreadShutdownParams;
use codex_app_server_protocol::ThreadShutdownResponse;
use codex_app_server_protocol::ThreadSortKey;
use codex_app_server_protocol::ThreadSourceKind;
use codex_app_server_protocol::ThreadStartParams;
@@ -152,6 +167,10 @@ use codex_app_server_protocol::ThreadStatus;
use codex_app_server_protocol::ThreadUnarchiveParams;
use codex_app_server_protocol::ThreadUnarchiveResponse;
use codex_app_server_protocol::ThreadUnarchivedNotification;
use codex_app_server_protocol::ThreadUndoParams;
use codex_app_server_protocol::ThreadUndoResponse;
use codex_app_server_protocol::ThreadUserShellCommandRunParams;
use codex_app_server_protocol::ThreadUserShellCommandRunResponse;
use codex_app_server_protocol::Turn;
use codex_app_server_protocol::TurnInterruptParams;
use codex_app_server_protocol::TurnStartParams;
@@ -208,6 +227,7 @@ use codex_core::find_thread_path_by_id_str;
use codex_core::git_info::git_diff_to_remote;
use codex_core::mcp::collect_mcp_snapshot;
use codex_core::mcp::group_tools_by_server;
use codex_core::message_history;
use codex_core::parse_cursor;
use codex_core::read_head_for_summary;
use codex_core::read_session_meta_line;
@@ -574,6 +594,34 @@ impl CodexMessageProcessor {
self.thread_rollback(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadContextUpdate { request_id, params } => {
self.thread_context_update(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadShutdown { request_id, params } => {
self.thread_shutdown(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadUndo { request_id, params } => {
self.thread_undo(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadConfigReload { request_id, params } => {
self.thread_config_reload(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadMemoriesDrop { request_id, params } => {
self.thread_memories_drop(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadMemoriesUpdate { request_id, params } => {
self.thread_memories_update(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadUserShellCommandRun { request_id, params } => {
self.thread_user_shell_command_run(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::ThreadList { request_id, params } => {
self.thread_list(to_connection_request_id(request_id), params)
.await;
@@ -586,6 +634,22 @@ impl CodexMessageProcessor {
self.thread_read(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::CustomPromptList { request_id, params } => {
self.custom_prompt_list(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::McpToolsList { request_id, params } => {
self.mcp_tools_list(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::HistoryAppend { request_id, params } => {
self.history_append(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::HistoryEntryRead { request_id, params } => {
self.history_entry_read(to_connection_request_id(request_id), params)
.await;
}
ClientRequest::SkillsList { request_id, params } => {
self.skills_list(to_connection_request_id(request_id), params)
.await;
@@ -2069,6 +2133,12 @@ impl CodexMessageProcessor {
approval_policy: config_snapshot.approval_policy.into(),
sandbox: config_snapshot.sandbox_policy.into(),
reasoning_effort: config_snapshot.reasoning_effort,
history_log_id: session_configured.history_log_id,
history_entry_count: session_configured.history_entry_count,
forked_from_thread_id: session_configured
.forked_from_id
.map(|thread_id| thread_id.to_string()),
network_proxy: session_configured.network_proxy.map(Into::into),
};
self.outgoing.send_response(request_id, response).await;
@@ -2454,6 +2524,337 @@ impl CodexMessageProcessor {
}
}
async fn thread_context_update(
&self,
request_id: ConnectionRequestId,
params: ThreadContextUpdateParams,
) {
let ThreadContextUpdateParams {
thread_id,
cwd,
approval_policy,
sandbox_policy,
windows_sandbox_level,
model,
effort,
summary,
personality,
collaboration_mode,
} = params;
let (thread_id, thread) = match self.load_thread(&thread_id).await {
Ok(v) => v,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
return;
}
};
let collaboration_mode = collaboration_mode.map(|mode| {
// Reuse the same normalization logic as `turn/start`.
self.normalize_turn_start_collaboration_mode(mode)
});
let submit_result = thread
.submit(Op::OverrideTurnContext {
cwd,
approval_policy: approval_policy.map(AskForApproval::to_core),
sandbox_policy: sandbox_policy.map(|policy| policy.to_core()),
windows_sandbox_level,
model,
effort,
summary,
collaboration_mode,
personality,
})
.await;
if let Err(err) = submit_result {
self.send_internal_error(
request_id,
format!("failed to update thread context: {err}"),
)
.await;
return;
}
let config_snapshot = thread.config_snapshot().await;
let ThreadConfigSnapshot {
model,
model_provider_id,
approval_policy,
sandbox_policy,
cwd,
reasoning_effort,
..
} = config_snapshot;
let response = ThreadContextUpdateResponse {
context: ThreadContextSnapshot {
thread_id: thread_id.to_string(),
model,
model_provider: model_provider_id,
cwd,
approval_policy: approval_policy.into(),
sandbox: sandbox_policy.into(),
reasoning_effort,
},
};
self.outgoing.send_response(request_id, response).await;
}
async fn thread_shutdown(&self, request_id: ConnectionRequestId, params: ThreadShutdownParams) {
let ThreadShutdownParams { thread_id } = params;
let (_, thread) = match self.load_thread(&thread_id).await {
Ok(v) => v,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
return;
}
};
match thread.submit(Op::Shutdown).await {
Ok(_) => {
self.outgoing
.send_response(request_id, ThreadShutdownResponse {})
.await;
}
Err(err) => {
self.send_internal_error(request_id, format!("failed to shut down thread: {err}"))
.await;
}
}
}
async fn thread_undo(&self, request_id: ConnectionRequestId, params: ThreadUndoParams) {
let ThreadUndoParams { thread_id } = params;
let (_, thread) = match self.load_thread(&thread_id).await {
Ok(v) => v,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
return;
}
};
match thread.submit(Op::Undo).await {
Ok(_) => {
self.outgoing
.send_response(request_id, ThreadUndoResponse {})
.await;
}
Err(err) => {
self.send_internal_error(request_id, format!("failed to start undo: {err}"))
.await;
}
}
}
async fn thread_config_reload(
&self,
request_id: ConnectionRequestId,
params: ThreadConfigReloadParams,
) {
let ThreadConfigReloadParams { thread_id } = params;
let (thread_id, thread) = match self.load_thread(&thread_id).await {
Ok(v) => v,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
return;
}
};
let submit_result = thread.submit(Op::ReloadUserConfig).await;
if let Err(err) = submit_result {
self.send_internal_error(request_id, format!("failed to reload thread config: {err}"))
.await;
return;
}
let config_snapshot = thread.config_snapshot().await;
let ThreadConfigSnapshot {
model,
model_provider_id,
approval_policy,
sandbox_policy,
cwd,
reasoning_effort,
..
} = config_snapshot;
let response = ThreadConfigReloadResponse {
context: ThreadContextSnapshot {
thread_id: thread_id.to_string(),
model,
model_provider: model_provider_id,
cwd,
approval_policy: approval_policy.into(),
sandbox: sandbox_policy.into(),
reasoning_effort,
},
};
self.outgoing.send_response(request_id, response).await;
}
async fn thread_memories_drop(
&self,
request_id: ConnectionRequestId,
params: codex_app_server_protocol::ThreadMemoriesDropParams,
) {
let codex_app_server_protocol::ThreadMemoriesDropParams { thread_id } = params;
let (_, thread) = match self.load_thread(&thread_id).await {
Ok(v) => v,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
return;
}
};
match thread.submit(Op::DropMemories).await {
Ok(_) => {
self.outgoing
.send_response(
request_id,
codex_app_server_protocol::ThreadMemoriesDropResponse {},
)
.await;
}
Err(err) => {
self.send_internal_error(request_id, format!("failed to drop memories: {err}"))
.await;
}
}
}
async fn thread_memories_update(
&self,
request_id: ConnectionRequestId,
params: codex_app_server_protocol::ThreadMemoriesUpdateParams,
) {
let codex_app_server_protocol::ThreadMemoriesUpdateParams { thread_id } = params;
let (_, thread) = match self.load_thread(&thread_id).await {
Ok(v) => v,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
return;
}
};
match thread.submit(Op::UpdateMemories).await {
Ok(_) => {
self.outgoing
.send_response(
request_id,
codex_app_server_protocol::ThreadMemoriesUpdateResponse {},
)
.await;
}
Err(err) => {
self.send_internal_error(request_id, format!("failed to update memories: {err}"))
.await;
}
}
}
async fn thread_user_shell_command_run(
&self,
request_id: ConnectionRequestId,
params: ThreadUserShellCommandRunParams,
) {
let ThreadUserShellCommandRunParams { thread_id, command } = params;
let (_, thread) = match self.load_thread(&thread_id).await {
Ok(v) => v,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
return;
}
};
match thread.submit(Op::RunUserShellCommand { command }).await {
Ok(turn_id) => {
self.outgoing
.send_response(request_id, ThreadUserShellCommandRunResponse { turn_id })
.await;
}
Err(err) => {
self.send_internal_error(
request_id,
format!("failed to run user shell command: {err}"),
)
.await;
}
}
}
async fn custom_prompt_list(
&self,
request_id: ConnectionRequestId,
_params: CustomPromptListParams,
) {
let data = if let Some(dir) = codex_core::custom_prompts::default_prompts_dir() {
codex_core::custom_prompts::discover_prompts_in(&dir)
.await
.into_iter()
.map(Into::into)
.collect()
} else {
Vec::new()
};
self.outgoing
.send_response(request_id, CustomPromptListResponse { data })
.await;
}
async fn mcp_tools_list(&self, request_id: ConnectionRequestId, _params: McpToolsListParams) {
let snapshot = collect_mcp_snapshot(self.config.as_ref()).await;
self.outgoing
.send_response(request_id, McpToolsListResponse::from(snapshot))
.await;
}
async fn history_append(&self, request_id: ConnectionRequestId, params: HistoryAppendParams) {
let HistoryAppendParams { thread_id, text } = params;
let thread_id = match ThreadId::from_string(&thread_id) {
Ok(thread_id) => thread_id,
Err(err) => {
self.send_invalid_request_error(request_id, format!("invalid thread id: {err}"))
.await;
return;
}
};
match message_history::append_entry(&text, &thread_id, self.config.as_ref()).await {
Ok(()) => {
self.outgoing
.send_response(request_id, HistoryAppendResponse {})
.await;
}
Err(err) => {
self.send_internal_error(request_id, format!("failed to append history: {err}"))
.await;
}
}
}
async fn history_entry_read(
&self,
request_id: ConnectionRequestId,
params: HistoryEntryReadParams,
) {
let HistoryEntryReadParams { log_id, offset } = params;
let entry = message_history::lookup(log_id, offset, self.config.as_ref()).map(|entry| {
codex_app_server_protocol::HistoryEntry {
conversation_id: entry.session_id,
ts: entry.ts,
text: entry.text,
}
});
self.outgoing
.send_response(
request_id,
HistoryEntryReadResponse {
log_id,
offset,
entry,
},
)
.await;
}
async fn thread_compact_start(
&self,
request_id: ConnectionRequestId,
@@ -2971,6 +3372,12 @@ impl CodexMessageProcessor {
approval_policy: session_configured.approval_policy.into(),
sandbox: session_configured.sandbox_policy.into(),
reasoning_effort: session_configured.reasoning_effort,
history_log_id: session_configured.history_log_id,
history_entry_count: session_configured.history_entry_count,
forked_from_thread_id: session_configured
.forked_from_id
.map(|thread_id| thread_id.to_string()),
network_proxy: session_configured.network_proxy.map(Into::into),
};
self.outgoing.send_response(request_id, response).await;
@@ -3499,6 +3906,12 @@ impl CodexMessageProcessor {
approval_policy: session_configured.approval_policy.into(),
sandbox: session_configured.sandbox_policy.into(),
reasoning_effort: session_configured.reasoning_effort,
history_log_id: session_configured.history_log_id,
history_entry_count: session_configured.history_entry_count,
forked_from_thread_id: session_configured
.forked_from_id
.map(|thread_id| thread_id.to_string()),
network_proxy: session_configured.network_proxy.map(Into::into),
};
self.outgoing.send_response(request_id, response).await;
@@ -5872,6 +6285,7 @@ impl CodexMessageProcessor {
let fallback_model_provider = self.config.model_provider_id.clone();
let single_client_mode = self.single_client_mode;
let codex_home = self.config.codex_home.clone();
let config_for_task = self.config.clone();
tokio::spawn(async move {
loop {
tokio::select! {
@@ -5888,30 +6302,6 @@ impl CodexMessageProcessor {
}
};
// For now, we send a notification for every event,
// JSON-serializing the `Event` as-is, but these should
// be migrated to be variants of `ServerNotification`
// instead.
let event_formatted = match &event.msg {
EventMsg::TurnStarted(_) => "task_started",
EventMsg::TurnComplete(_) => "task_complete",
_ => &event.msg.to_string(),
};
let mut params = match serde_json::to_value(event.clone()) {
Ok(serde_json::Value::Object(map)) => map,
Ok(_) => {
error!("event did not serialize to an object");
continue;
}
Err(err) => {
error!("failed to serialize event: {err}");
continue;
}
};
params.insert(
"conversationId".to_string(),
conversation_id.to_string().into(),
);
let (subscribed_connection_ids, raw_events_enabled) = {
let mut thread_state = thread_state.lock().await;
if !single_client_mode {
@@ -5927,6 +6317,26 @@ impl CodexMessageProcessor {
}
if !subscribed_connection_ids.is_empty() {
let event_formatted = match &event.msg {
EventMsg::TurnStarted(_) => "task_started",
EventMsg::TurnComplete(_) => "task_complete",
_ => &event.msg.to_string(),
};
let mut params = match serde_json::to_value(event.clone()) {
Ok(serde_json::Value::Object(map)) => map,
Ok(_) => {
error!("event did not serialize to an object");
continue;
}
Err(err) => {
error!("failed to serialize event: {err}");
continue;
}
};
params.insert(
"conversationId".to_string(),
conversation_id.to_string().into(),
);
outgoing_for_task
.send_notification_to_connections(
&subscribed_connection_ids,
@@ -5966,6 +6376,7 @@ impl CodexMessageProcessor {
) => {
handle_pending_thread_resume_request(
conversation_id,
config_for_task.as_ref(),
codex_home.as_path(),
&thread_state,
&thread_watch_manager,
@@ -6286,6 +6697,7 @@ impl CodexMessageProcessor {
async fn handle_pending_thread_resume_request(
conversation_id: ThreadId,
config: &Config,
codex_home: &Path,
thread_state: &Arc<Mutex<ThreadState>>,
thread_watch_manager: &ThreadWatchManager,
@@ -6352,6 +6764,7 @@ async fn handle_pending_thread_resume_request(
Ok(thread_name) => thread.name = thread_name,
Err(err) => warn!("Failed to read thread name for {conversation_id}: {err}"),
}
let (history_log_id, history_entry_count) = message_history::history_metadata(config).await;
let ThreadConfigSnapshot {
model,
@@ -6370,6 +6783,10 @@ async fn handle_pending_thread_resume_request(
approval_policy: approval_policy.into(),
sandbox: sandbox_policy.into(),
reasoning_effort,
history_log_id,
history_entry_count,
forked_from_thread_id: None,
network_proxy: None,
};
outgoing.send_response(request_id, response).await;
thread_state.lock().await.add_connection(connection_id);

View File

@@ -0,0 +1,330 @@
use std::collections::HashMap;
use std::sync::Arc;
use std::sync::RwLock;
use std::sync::atomic::AtomicI64;
use std::sync::atomic::Ordering;
use codex_app_server_protocol::ClientRequest;
use codex_app_server_protocol::JSONRPCErrorError;
use codex_app_server_protocol::RequestId;
use codex_app_server_protocol::ServerNotification;
use codex_app_server_protocol::ServerRequest;
use codex_app_server_protocol::ThreadForkParams;
use codex_app_server_protocol::ThreadForkResponse;
use codex_app_server_protocol::ThreadResumeParams;
use codex_app_server_protocol::ThreadResumeResponse;
use codex_app_server_protocol::ThreadStartParams;
use codex_app_server_protocol::ThreadStartResponse;
use codex_cloud_requirements::cloud_requirements_loader;
use codex_core::AuthManager;
use codex_core::ThreadManager;
use codex_core::config::Config;
use codex_feedback::CodexFeedback;
use serde::Serialize;
use serde::de::DeserializeOwned;
use tokio::sync::broadcast;
use tokio::sync::mpsc;
use tokio::sync::oneshot;
use toml::Value as TomlValue;
use tracing::warn;
use crate::codex_message_processor::CodexMessageProcessor;
use crate::codex_message_processor::CodexMessageProcessorArgs;
use crate::error_code::INTERNAL_ERROR_CODE;
use crate::outgoing_message::ConnectionId;
use crate::outgoing_message::OutgoingEnvelope;
use crate::outgoing_message::OutgoingMessage;
use crate::outgoing_message::OutgoingMessageSender;
use crate::transport::CHANNEL_CAPACITY;
const EMBEDDED_CONNECTION_ID: ConnectionId = ConnectionId(1);
#[derive(Debug, Clone)]
pub struct EmbeddedServerRequest {
pub request_id: RequestId,
pub request: ServerRequest,
}
#[derive(Debug, Clone)]
pub enum EmbeddedSessionMessage {
Notification(ServerNotification),
Request(EmbeddedServerRequest),
}
#[derive(Clone)]
pub struct EmbeddedSessionClient {
inbound_tx: mpsc::Sender<EmbeddedInbound>,
messages_tx: broadcast::Sender<EmbeddedSessionMessage>,
next_request_id: Arc<AtomicI64>,
}
pub struct EmbeddedSessionClientArgs {
pub auth_manager: Arc<AuthManager>,
pub thread_manager: Arc<ThreadManager>,
pub config: Config,
pub cli_overrides: Vec<(String, TomlValue)>,
pub feedback: CodexFeedback,
}
enum EmbeddedInbound {
ClientRequest {
request: ClientRequest,
reply_tx: oneshot::Sender<std::result::Result<serde_json::Value, JSONRPCErrorError>>,
},
ServerResponse {
request_id: RequestId,
result: serde_json::Value,
},
ServerError {
request_id: RequestId,
error: JSONRPCErrorError,
},
}
impl EmbeddedSessionClient {
pub fn new(args: EmbeddedSessionClientArgs) -> Self {
let EmbeddedSessionClientArgs {
auth_manager,
thread_manager,
config,
cli_overrides,
feedback,
} = args;
let config = Arc::new(config);
let cloud_requirements = cloud_requirements_loader(
auth_manager.clone(),
config.chatgpt_base_url.clone(),
config.codex_home.clone(),
);
let (outgoing_tx, outgoing_rx) = mpsc::channel(CHANNEL_CAPACITY);
let outgoing = Arc::new(OutgoingMessageSender::new(outgoing_tx));
let processor = CodexMessageProcessor::new(CodexMessageProcessorArgs {
auth_manager,
thread_manager,
outgoing: outgoing.clone(),
codex_linux_sandbox_exe: config.codex_linux_sandbox_exe.clone(),
config: config.clone(),
cli_overrides,
cloud_requirements: Arc::new(RwLock::new(cloud_requirements)),
single_client_mode: true,
feedback,
});
let (inbound_tx, inbound_rx) = mpsc::channel(CHANNEL_CAPACITY);
let (messages_tx, _) = broadcast::channel(CHANNEL_CAPACITY);
tokio::spawn(run_embedded_session_loop(
processor,
outgoing,
outgoing_rx,
inbound_rx,
messages_tx.clone(),
));
Self {
inbound_tx,
messages_tx,
next_request_id: Arc::new(AtomicI64::new(1)),
}
}
pub fn subscribe(&self) -> broadcast::Receiver<EmbeddedSessionMessage> {
self.messages_tx.subscribe()
}
pub async fn thread_start(
&self,
params: ThreadStartParams,
) -> std::result::Result<ThreadStartResponse, JSONRPCErrorError> {
self.request(|request_id| ClientRequest::ThreadStart { request_id, params })
.await
}
pub async fn thread_resume(
&self,
params: ThreadResumeParams,
) -> std::result::Result<ThreadResumeResponse, JSONRPCErrorError> {
self.request(|request_id| ClientRequest::ThreadResume { request_id, params })
.await
}
pub async fn thread_fork(
&self,
params: ThreadForkParams,
) -> std::result::Result<ThreadForkResponse, JSONRPCErrorError> {
self.request(|request_id| ClientRequest::ThreadFork { request_id, params })
.await
}
pub async fn respond<T: Serialize>(
&self,
request_id: RequestId,
response: T,
) -> std::result::Result<(), JSONRPCErrorError> {
let result = serde_json::to_value(response).map_err(serialize_error)?;
self.inbound_tx
.send(EmbeddedInbound::ServerResponse { request_id, result })
.await
.map_err(channel_closed_error)?;
Ok(())
}
pub async fn respond_error(
&self,
request_id: RequestId,
error: JSONRPCErrorError,
) -> std::result::Result<(), JSONRPCErrorError> {
self.inbound_tx
.send(EmbeddedInbound::ServerError { request_id, error })
.await
.map_err(channel_closed_error)?;
Ok(())
}
pub async fn request<T, F>(&self, build: F) -> std::result::Result<T, JSONRPCErrorError>
where
T: DeserializeOwned,
F: FnOnce(RequestId) -> ClientRequest,
{
let request_id = RequestId::Integer(self.next_request_id.fetch_add(1, Ordering::Relaxed));
let request = build(request_id);
let (reply_tx, reply_rx) = oneshot::channel();
self.inbound_tx
.send(EmbeddedInbound::ClientRequest { request, reply_tx })
.await
.map_err(channel_closed_error)?;
let response = reply_rx.await.map_err(channel_closed_error)??;
serde_json::from_value(response).map_err(serialize_error)
}
}
async fn run_embedded_session_loop(
mut processor: CodexMessageProcessor,
outgoing: Arc<OutgoingMessageSender>,
mut outgoing_rx: mpsc::Receiver<OutgoingEnvelope>,
mut inbound_rx: mpsc::Receiver<EmbeddedInbound>,
messages_tx: broadcast::Sender<EmbeddedSessionMessage>,
) {
let mut pending_client_requests: HashMap<
RequestId,
oneshot::Sender<std::result::Result<serde_json::Value, JSONRPCErrorError>>,
> = HashMap::new();
loop {
tokio::select! {
maybe_inbound = inbound_rx.recv() => {
let Some(inbound) = maybe_inbound else {
break;
};
match inbound {
EmbeddedInbound::ClientRequest { request, reply_tx } => {
let request_id = match extract_client_request_id(&request) {
Ok(request_id) => request_id,
Err(err) => {
let _ = reply_tx.send(Err(err));
continue;
}
};
pending_client_requests.insert(request_id, reply_tx);
processor.process_request(EMBEDDED_CONNECTION_ID, request).await;
}
EmbeddedInbound::ServerResponse { request_id, result } => {
outgoing.notify_client_response(request_id, result).await;
}
EmbeddedInbound::ServerError { request_id, error } => {
outgoing.notify_client_error(request_id, error).await;
}
}
}
maybe_outgoing = outgoing_rx.recv() => {
let Some(envelope) = maybe_outgoing else {
break;
};
let message = match envelope {
OutgoingEnvelope::ToConnection { connection_id, message } => {
if connection_id != EMBEDDED_CONNECTION_ID {
continue;
}
message
}
OutgoingEnvelope::Broadcast { message } => message,
};
match message {
OutgoingMessage::Response(response) => {
if let Some(reply_tx) = pending_client_requests.remove(&response.id) {
let _ = reply_tx.send(Ok(response.result));
} else {
warn!("embedded session dropped unmatched response {:?}", response.id);
}
}
OutgoingMessage::Error(error) => {
if let Some(reply_tx) = pending_client_requests.remove(&error.id) {
let _ = reply_tx.send(Err(error.error));
} else {
warn!("embedded session dropped unmatched error {:?}", error.id);
}
}
OutgoingMessage::AppServerNotification(notification) => {
let _ = messages_tx.send(EmbeddedSessionMessage::Notification(notification));
}
OutgoingMessage::Request(request) => match extract_server_request_id(&request) {
Ok(request_id) => {
let _ = messages_tx.send(EmbeddedSessionMessage::Request(
EmbeddedServerRequest { request_id, request },
));
}
Err(err) => {
warn!("failed to extract embedded server request id: {err:?}");
}
},
OutgoingMessage::Notification(_legacy_notification) => {
// Embedded TUI clients should rely on typed app-server notifications.
}
}
}
}
}
}
fn extract_client_request_id(
request: &ClientRequest,
) -> std::result::Result<RequestId, JSONRPCErrorError> {
extract_request_id(serde_json::to_value(request).map_err(serialize_error)?)
}
fn extract_server_request_id(
request: &ServerRequest,
) -> std::result::Result<RequestId, JSONRPCErrorError> {
extract_request_id(serde_json::to_value(request).map_err(serialize_error)?)
}
fn extract_request_id(
value: serde_json::Value,
) -> std::result::Result<RequestId, JSONRPCErrorError> {
let id = value
.get("id")
.cloned()
.ok_or_else(|| internal_error("missing id on request".to_string()))?;
serde_json::from_value(id).map_err(serialize_error)
}
fn serialize_error(err: serde_json::Error) -> JSONRPCErrorError {
internal_error(format!("serialization error: {err}"))
}
fn channel_closed_error<T>(err: T) -> JSONRPCErrorError
where
T: std::fmt::Display,
{
internal_error(format!("embedded session channel closed: {err}"))
}
fn internal_error(message: String) -> JSONRPCErrorError {
JSONRPCErrorError {
code: INTERNAL_ERROR_CODE,
message,
data: None,
}
}

View File

@@ -56,6 +56,7 @@ mod bespoke_event_handling;
mod codex_message_processor;
mod config_api;
mod dynamic_tools;
mod embedded_session;
mod error_code;
mod filters;
mod fuzzy_file_search;
@@ -67,6 +68,9 @@ mod thread_status;
mod transport;
pub use crate::transport::AppServerTransport;
pub use embedded_session::EmbeddedSessionClient;
pub use embedded_session::EmbeddedSessionClientArgs;
pub use embedded_session::EmbeddedSessionMessage;
const LOG_FORMAT_ENV_VAR: &str = "LOG_FORMAT";

View File

@@ -51,7 +51,7 @@ pub use mcp_connection_manager::SandboxState;
mod mcp_tool_call;
mod memories;
mod mentions;
mod message_history;
pub mod message_history;
mod model_provider_info;
pub mod path_utils;
pub mod personality_migration;

View File

@@ -69,11 +69,7 @@ fn history_filepath(config: &Config) -> PathBuf {
/// Append a `text` entry associated with `conversation_id` to the history file. Uses
/// advisory file locking to ensure that concurrent writes do not interleave,
/// which entails a small amount of blocking I/O internally.
pub(crate) async fn append_entry(
text: &str,
conversation_id: &ThreadId,
config: &Config,
) -> Result<()> {
pub async fn append_entry(text: &str, conversation_id: &ThreadId, config: &Config) -> Result<()> {
match config.history.persistence {
HistoryPersistence::SaveAll => {
// Save everything: proceed.
@@ -245,7 +241,7 @@ fn trim_target_bytes(max_bytes: u64, newest_entry_len: u64) -> u64 {
/// Asynchronously fetch the history file's *identifier* (inode on Unix) and
/// the current number of entries by counting newline characters.
pub(crate) async fn history_metadata(config: &Config) -> (u64, usize) {
pub async fn history_metadata(config: &Config) -> (u64, usize) {
let path = history_filepath(config);
history_metadata_for_file(&path).await
}
@@ -258,7 +254,7 @@ pub(crate) async fn history_metadata(config: &Config) -> (u64, usize) {
///
/// Note this function is not async because it uses a sync advisory file
/// locking API.
pub(crate) fn lookup(log_id: u64, offset: usize, config: &Config) -> Option<HistoryEntry> {
pub fn lookup(log_id: u64, offset: usize, config: &Config) -> Option<HistoryEntry> {
let path = history_filepath(config);
lookup_history_entry(&path, log_id, offset)
}

View File

@@ -27,6 +27,7 @@ base64 = { workspace = true }
chrono = { workspace = true, features = ["serde"] }
clap = { workspace = true, features = ["derive"] }
codex-ansi-escape = { workspace = true }
codex-app-server = { workspace = true }
codex-app-server-protocol = { workspace = true }
codex-arg0 = { workspace = true }
codex-backend-client = { workspace = true }

View File

@@ -0,0 +1,105 @@
use std::path::PathBuf;
use codex_protocol::approvals::ElicitationAction;
use codex_protocol::config_types::CollaborationMode;
use codex_protocol::config_types::Personality;
use codex_protocol::config_types::ReasoningSummary as ReasoningSummaryConfig;
use codex_protocol::config_types::WindowsSandboxLevel;
use codex_protocol::dynamic_tools::DynamicToolResponse;
use codex_protocol::mcp::RequestId as McpRequestId;
use codex_protocol::openai_models::ReasoningEffort as ReasoningEffortConfig;
use codex_protocol::protocol::AskForApproval;
use codex_protocol::protocol::ReviewDecision;
use codex_protocol::protocol::ReviewRequest;
use codex_protocol::protocol::SandboxPolicy;
use codex_protocol::request_user_input::RequestUserInputResponse;
use codex_protocol::user_input::UserInput;
use serde::Deserialize;
use serde::Serialize;
use serde_json::Value;
/// TUI-side agent commands routed over the in-process app-server.
///
/// This replaces direct `codex_protocol::protocol::Op` usage in the TUI.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
#[allow(clippy::large_enum_variant)]
pub(crate) enum AgentCommand {
Interrupt,
CleanBackgroundTerminals,
UserTurn {
items: Vec<UserInput>,
cwd: PathBuf,
approval_policy: AskForApproval,
sandbox_policy: SandboxPolicy,
model: String,
effort: Option<ReasoningEffortConfig>,
summary: ReasoningSummaryConfig,
final_output_json_schema: Option<Value>,
collaboration_mode: Option<CollaborationMode>,
personality: Option<Personality>,
},
OverrideTurnContext {
cwd: Option<PathBuf>,
approval_policy: Option<AskForApproval>,
sandbox_policy: Option<SandboxPolicy>,
windows_sandbox_level: Option<WindowsSandboxLevel>,
model: Option<String>,
effort: Option<Option<ReasoningEffortConfig>>,
summary: Option<ReasoningSummaryConfig>,
collaboration_mode: Option<CollaborationMode>,
personality: Option<Personality>,
},
ExecApproval {
id: String,
turn_id: Option<String>,
decision: ReviewDecision,
},
PatchApproval {
id: String,
decision: ReviewDecision,
},
ResolveElicitation {
server_name: String,
request_id: McpRequestId,
decision: ElicitationAction,
},
UserInputAnswer {
id: String,
response: RequestUserInputResponse,
},
DynamicToolResponse {
id: String,
response: DynamicToolResponse,
},
AddToHistory {
text: String,
},
GetHistoryEntryRequest {
offset: usize,
log_id: u64,
},
ListMcpTools,
ReloadUserConfig,
ListCustomPrompts,
ListSkills {
cwds: Vec<PathBuf>,
force_reload: bool,
},
Compact,
DropMemories,
UpdateMemories,
SetThreadName {
name: String,
},
Undo,
ThreadRollback {
num_turns: u32,
},
Review {
review_request: ReviewRequest,
},
Shutdown,
RunUserShellCommand {
command: String,
},
}

Some files were not shown because too many files have changed in this diff Show More