From b936af15c1a8e9531305bc39f81b04cbf64512b2 Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Sat, 7 Feb 2026 15:39:43 +0000 Subject: [PATCH 1/2] feat: bump agentclientprotocol to 0.10.8 Signed-off-by: Chojan Shang --- schema/VERSION | 2 +- schema/meta.json | 2 +- schema/schema.json | 525 ++++++++++++++++++++++++++++++----- scripts/gen_schema.py | 1 + src/acp/agent/connection.py | 5 +- src/acp/client/connection.py | 1 - src/acp/interfaces.py | 4 +- src/acp/meta.py | 2 +- src/acp/schema.py | 126 +++++++-- 9 files changed, 560 insertions(+), 108 deletions(-) diff --git a/schema/VERSION b/schema/VERSION index 801f529..3222b17 100644 --- a/schema/VERSION +++ b/schema/VERSION @@ -1 +1 @@ -refs/tags/v0.10.5 +refs/tags/v0.10.8 diff --git a/schema/meta.json b/schema/meta.json index 507c21d..1fbc720 100644 --- a/schema/meta.json +++ b/schema/meta.json @@ -28,4 +28,4 @@ "cancel_request": "$/cancel_request" }, "version": 1 -} +} \ No newline at end of file diff --git a/schema/schema.json b/schema/schema.json index 4f45ef0..ff79698 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -67,7 +67,8 @@ "$ref": "#/$defs/SessionNotification" } ], - "description": "Handles session update notifications from the agent.\n\nThis is a notification endpoint (no response expected) that receives\nreal-time updates about session progress, including message chunks,\ntool calls, and execution plans.\n\nNote: Clients SHOULD continue accepting tool call updates even after\nsending a `session/cancel` notification, as the agent may send final\nupdates before responding with the cancelled stop reason.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)" + "description": "Handles session update notifications from the agent.\n\nThis is a notification endpoint (no response expected) that receives\nreal-time updates about session progress, including message chunks,\ntool calls, and execution plans.\n\nNote: Clients SHOULD continue accepting tool call updates even after\nsending a `session/cancel` notification, as the agent may send final\nupdates before responding with the cancelled stop reason.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)", + "title": "SessionNotification" }, { "allOf": [ @@ -75,7 +76,8 @@ "$ref": "#/$defs/ExtNotification" } ], - "description": "Handles extension notifications from the agent.\n\nAllows the Agent to send an arbitrary notification that is not part of the ACP spec.\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)" + "description": "Handles extension notifications from the agent.\n\nAllows the Agent to send an arbitrary notification that is not part of the ACP spec.\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", + "title": "ExtNotification" } ], "description": "All possible notifications that an agent can send to a client.\n\nThis enum is used internally for routing RPC notifications. You typically won't need\nto use this directly - use the notification methods on the [`Client`] trait instead.\n\nNotifications do not expect a response." @@ -110,7 +112,8 @@ "$ref": "#/$defs/WriteTextFileRequest" } ], - "description": "Writes content to a text file in the client's file system.\n\nOnly available if the client advertises the `fs.writeTextFile` capability.\nAllows the agent to create or modify files within the client's environment.\n\nSee protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)" + "description": "Writes content to a text file in the client's file system.\n\nOnly available if the client advertises the `fs.writeTextFile` capability.\nAllows the agent to create or modify files within the client's environment.\n\nSee protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)", + "title": "WriteTextFileRequest" }, { "allOf": [ @@ -118,7 +121,8 @@ "$ref": "#/$defs/ReadTextFileRequest" } ], - "description": "Reads content from a text file in the client's file system.\n\nOnly available if the client advertises the `fs.readTextFile` capability.\nAllows the agent to access file contents within the client's environment.\n\nSee protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)" + "description": "Reads content from a text file in the client's file system.\n\nOnly available if the client advertises the `fs.readTextFile` capability.\nAllows the agent to access file contents within the client's environment.\n\nSee protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)", + "title": "ReadTextFileRequest" }, { "allOf": [ @@ -126,7 +130,8 @@ "$ref": "#/$defs/RequestPermissionRequest" } ], - "description": "Requests permission from the user for a tool call operation.\n\nCalled by the agent when it needs user authorization before executing\na potentially sensitive operation. The client should present the options\nto the user and return their decision.\n\nIf the client cancels the prompt turn via `session/cancel`, it MUST\nrespond to this request with `RequestPermissionOutcome::Cancelled`.\n\nSee protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)" + "description": "Requests permission from the user for a tool call operation.\n\nCalled by the agent when it needs user authorization before executing\na potentially sensitive operation. The client should present the options\nto the user and return their decision.\n\nIf the client cancels the prompt turn via `session/cancel`, it MUST\nrespond to this request with `RequestPermissionOutcome::Cancelled`.\n\nSee protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)", + "title": "RequestPermissionRequest" }, { "allOf": [ @@ -134,7 +139,8 @@ "$ref": "#/$defs/CreateTerminalRequest" } ], - "description": "Executes a command in a new terminal\n\nOnly available if the `terminal` Client capability is set to `true`.\n\nReturns a `TerminalId` that can be used with other terminal methods\nto get the current output, wait for exit, and kill the command.\n\nThe `TerminalId` can also be used to embed the terminal in a tool call\nby using the `ToolCallContent::Terminal` variant.\n\nThe Agent is responsible for releasing the terminal by using the `terminal/release`\nmethod.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)" + "description": "Executes a command in a new terminal\n\nOnly available if the `terminal` Client capability is set to `true`.\n\nReturns a `TerminalId` that can be used with other terminal methods\nto get the current output, wait for exit, and kill the command.\n\nThe `TerminalId` can also be used to embed the terminal in a tool call\nby using the `ToolCallContent::Terminal` variant.\n\nThe Agent is responsible for releasing the terminal by using the `terminal/release`\nmethod.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", + "title": "CreateTerminalRequest" }, { "allOf": [ @@ -142,7 +148,8 @@ "$ref": "#/$defs/TerminalOutputRequest" } ], - "description": "Gets the terminal output and exit status\n\nReturns the current content in the terminal without waiting for the command to exit.\nIf the command has already exited, the exit status is included.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)" + "description": "Gets the terminal output and exit status\n\nReturns the current content in the terminal without waiting for the command to exit.\nIf the command has already exited, the exit status is included.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", + "title": "TerminalOutputRequest" }, { "allOf": [ @@ -150,7 +157,8 @@ "$ref": "#/$defs/ReleaseTerminalRequest" } ], - "description": "Releases a terminal\n\nThe command is killed if it hasn't exited yet. Use `terminal/wait_for_exit`\nto wait for the command to exit before releasing the terminal.\n\nAfter release, the `TerminalId` can no longer be used with other `terminal/*` methods,\nbut tool calls that already contain it, continue to display its output.\n\nThe `terminal/kill` method can be used to terminate the command without releasing\nthe terminal, allowing the Agent to call `terminal/output` and other methods.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)" + "description": "Releases a terminal\n\nThe command is killed if it hasn't exited yet. Use `terminal/wait_for_exit`\nto wait for the command to exit before releasing the terminal.\n\nAfter release, the `TerminalId` can no longer be used with other `terminal/*` methods,\nbut tool calls that already contain it, continue to display its output.\n\nThe `terminal/kill` method can be used to terminate the command without releasing\nthe terminal, allowing the Agent to call `terminal/output` and other methods.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", + "title": "ReleaseTerminalRequest" }, { "allOf": [ @@ -158,7 +166,8 @@ "$ref": "#/$defs/WaitForTerminalExitRequest" } ], - "description": "Waits for the terminal command to exit and return its exit status\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)" + "description": "Waits for the terminal command to exit and return its exit status\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", + "title": "WaitForTerminalExitRequest" }, { "allOf": [ @@ -166,7 +175,8 @@ "$ref": "#/$defs/KillTerminalCommandRequest" } ], - "description": "Kills the terminal command without releasing the terminal\n\nWhile `terminal/release` will also kill the command, this method will keep\nthe `TerminalId` valid so it can be used with other methods.\n\nThis method can be helpful when implementing command timeouts which terminate\nthe command as soon as elapsed, and then get the final output so it can be sent\nto the model.\n\nNote: `terminal/release` when `TerminalId` is no longer needed.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)" + "description": "Kills the terminal command without releasing the terminal\n\nWhile `terminal/release` will also kill the command, this method will keep\nthe `TerminalId` valid so it can be used with other methods.\n\nThis method can be helpful when implementing command timeouts which terminate\nthe command as soon as elapsed, and then get the final output so it can be sent\nto the model.\n\nNote: `terminal/release` when `TerminalId` is no longer needed.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", + "title": "KillTerminalCommandRequest" }, { "allOf": [ @@ -174,7 +184,8 @@ "$ref": "#/$defs/ExtRequest" } ], - "description": "Handles extension method requests from the agent.\n\nAllows the Agent to send an arbitrary request that is not part of the ACP spec.\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)" + "description": "Handles extension method requests from the agent.\n\nAllows the Agent to send an arbitrary request that is not part of the ACP spec.\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", + "title": "ExtMethodRequest" } ], "description": "All possible requests that an agent can send to a client.\n\nThis enum is used internally for routing RPC requests. You typically won't need\nto use this directly - instead, use the methods on the [`Client`] trait.\n\nThis enum encompasses all method calls from agent to client." @@ -202,40 +213,100 @@ "result": { "anyOf": [ { - "$ref": "#/$defs/InitializeResponse" + "allOf": [ + { + "$ref": "#/$defs/InitializeResponse" + } + ], + "title": "InitializeResponse" }, { - "$ref": "#/$defs/AuthenticateResponse" + "allOf": [ + { + "$ref": "#/$defs/AuthenticateResponse" + } + ], + "title": "AuthenticateResponse" }, { - "$ref": "#/$defs/NewSessionResponse" + "allOf": [ + { + "$ref": "#/$defs/NewSessionResponse" + } + ], + "title": "NewSessionResponse" }, { - "$ref": "#/$defs/LoadSessionResponse" + "allOf": [ + { + "$ref": "#/$defs/LoadSessionResponse" + } + ], + "title": "LoadSessionResponse" }, { - "$ref": "#/$defs/ListSessionsResponse" + "allOf": [ + { + "$ref": "#/$defs/ListSessionsResponse" + } + ], + "title": "ListSessionsResponse" }, { - "$ref": "#/$defs/ForkSessionResponse" + "allOf": [ + { + "$ref": "#/$defs/ForkSessionResponse" + } + ], + "title": "ForkSessionResponse" }, { - "$ref": "#/$defs/ResumeSessionResponse" + "allOf": [ + { + "$ref": "#/$defs/ResumeSessionResponse" + } + ], + "title": "ResumeSessionResponse" }, { - "$ref": "#/$defs/SetSessionModeResponse" + "allOf": [ + { + "$ref": "#/$defs/SetSessionModeResponse" + } + ], + "title": "SetSessionModeResponse" }, { - "$ref": "#/$defs/SetSessionConfigOptionResponse" + "allOf": [ + { + "$ref": "#/$defs/SetSessionConfigOptionResponse" + } + ], + "title": "SetSessionConfigOptionResponse" }, { - "$ref": "#/$defs/PromptResponse" + "allOf": [ + { + "$ref": "#/$defs/PromptResponse" + } + ], + "title": "PromptResponse" }, { - "$ref": "#/$defs/SetSessionModelResponse" + "allOf": [ + { + "$ref": "#/$defs/SetSessionModelResponse" + } + ], + "title": "SetSessionModelResponse" }, { - "$ref": "#/$defs/ExtResponse" + "allOf": [ + { + "$ref": "#/$defs/ExtResponse" + } + ], + "title": "ExtMethodResponse" } ], "description": "All possible responses that an agent can send to a client.\n\nThis enum is used internally for routing RPC responses. You typically won't need\nto use this directly - the responses are handled automatically by the connection.\n\nThese are responses to the corresponding `ClientRequest` variants." @@ -245,6 +316,7 @@ "id", "result" ], + "title": "Result", "type": "object" }, { @@ -260,6 +332,7 @@ "id", "error" ], + "title": "Error", "type": "object" } ], @@ -452,7 +525,8 @@ "$ref": "#/$defs/UnstructuredCommandInput" } ], - "description": "All text that was typed after the command name is provided as input." + "description": "All text that was typed after the command name is provided as input.", + "title": "unstructured" } ], "description": "The input specification for a command." @@ -611,7 +685,8 @@ "$ref": "#/$defs/CancelNotification" } ], - "description": "Cancels ongoing operations for a session.\n\nThis is a notification sent by the client to cancel an ongoing prompt turn.\n\nUpon receiving this notification, the Agent SHOULD:\n- Stop all language model requests as soon as possible\n- Abort all tool call invocations in progress\n- Send any pending `session/update` notifications\n- Respond to the original `session/prompt` request with `StopReason::Cancelled`\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)" + "description": "Cancels ongoing operations for a session.\n\nThis is a notification sent by the client to cancel an ongoing prompt turn.\n\nUpon receiving this notification, the Agent SHOULD:\n- Stop all language model requests as soon as possible\n- Abort all tool call invocations in progress\n- Send any pending `session/update` notifications\n- Respond to the original `session/prompt` request with `StopReason::Cancelled`\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)", + "title": "CancelNotification" }, { "allOf": [ @@ -619,7 +694,8 @@ "$ref": "#/$defs/ExtNotification" } ], - "description": "Handles extension notifications from the client.\n\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)" + "description": "Handles extension notifications from the client.\n\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", + "title": "ExtNotification" } ], "description": "All possible notifications that a client can send to an agent.\n\nThis enum is used internally for routing RPC notifications. You typically won't need\nto use this directly - use the notification methods on the [`Agent`] trait instead.\n\nNotifications do not expect a response." @@ -654,7 +730,8 @@ "$ref": "#/$defs/InitializeRequest" } ], - "description": "Establishes the connection with a client and negotiates protocol capabilities.\n\nThis method is called once at the beginning of the connection to:\n- Negotiate the protocol version to use\n- Exchange capability information between client and agent\n- Determine available authentication methods\n\nThe agent should respond with its supported protocol version and capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)" + "description": "Establishes the connection with a client and negotiates protocol capabilities.\n\nThis method is called once at the beginning of the connection to:\n- Negotiate the protocol version to use\n- Exchange capability information between client and agent\n- Determine available authentication methods\n\nThe agent should respond with its supported protocol version and capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)", + "title": "InitializeRequest" }, { "allOf": [ @@ -662,7 +739,8 @@ "$ref": "#/$defs/AuthenticateRequest" } ], - "description": "Authenticates the client using the specified authentication method.\n\nCalled when the agent requires authentication before allowing session creation.\nThe client provides the authentication method ID that was advertised during initialization.\n\nAfter successful authentication, the client can proceed to create sessions with\n`new_session` without receiving an `auth_required` error.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)" + "description": "Authenticates the client using the specified authentication method.\n\nCalled when the agent requires authentication before allowing session creation.\nThe client provides the authentication method ID that was advertised during initialization.\n\nAfter successful authentication, the client can proceed to create sessions with\n`new_session` without receiving an `auth_required` error.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)", + "title": "AuthenticateRequest" }, { "allOf": [ @@ -670,7 +748,8 @@ "$ref": "#/$defs/NewSessionRequest" } ], - "description": "Creates a new conversation session with the agent.\n\nSessions represent independent conversation contexts with their own history and state.\n\nThe agent should:\n- Create a new session context\n- Connect to any specified MCP servers\n- Return a unique session ID for future requests\n\nMay return an `auth_required` error if the agent requires authentication.\n\nSee protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup)" + "description": "Creates a new conversation session with the agent.\n\nSessions represent independent conversation contexts with their own history and state.\n\nThe agent should:\n- Create a new session context\n- Connect to any specified MCP servers\n- Return a unique session ID for future requests\n\nMay return an `auth_required` error if the agent requires authentication.\n\nSee protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup)", + "title": "NewSessionRequest" }, { "allOf": [ @@ -678,7 +757,8 @@ "$ref": "#/$defs/LoadSessionRequest" } ], - "description": "Loads an existing session to resume a previous conversation.\n\nThis method is only available if the agent advertises the `loadSession` capability.\n\nThe agent should:\n- Restore the session context and conversation history\n- Connect to the specified MCP servers\n- Stream the entire conversation history back to the client via notifications\n\nSee protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)" + "description": "Loads an existing session to resume a previous conversation.\n\nThis method is only available if the agent advertises the `loadSession` capability.\n\nThe agent should:\n- Restore the session context and conversation history\n- Connect to the specified MCP servers\n- Stream the entire conversation history back to the client via notifications\n\nSee protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)", + "title": "LoadSessionRequest" }, { "allOf": [ @@ -686,7 +766,8 @@ "$ref": "#/$defs/ListSessionsRequest" } ], - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nLists existing sessions known to the agent.\n\nThis method is only available if the agent advertises the `listSessions` capability.\n\nThe agent should return metadata about sessions with optional filtering and pagination support." + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nLists existing sessions known to the agent.\n\nThis method is only available if the agent advertises the `listSessions` capability.\n\nThe agent should return metadata about sessions with optional filtering and pagination support.", + "title": "ListSessionsRequest" }, { "allOf": [ @@ -694,7 +775,8 @@ "$ref": "#/$defs/ForkSessionRequest" } ], - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nForks an existing session to create a new independent session.\n\nThis method is only available if the agent advertises the `session.fork` capability.\n\nThe agent should create a new session with the same conversation context as the\noriginal, allowing operations like generating summaries without affecting the\noriginal session's history." + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nForks an existing session to create a new independent session.\n\nThis method is only available if the agent advertises the `session.fork` capability.\n\nThe agent should create a new session with the same conversation context as the\noriginal, allowing operations like generating summaries without affecting the\noriginal session's history.", + "title": "ForkSessionRequest" }, { "allOf": [ @@ -702,7 +784,8 @@ "$ref": "#/$defs/ResumeSessionRequest" } ], - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResumes an existing session without returning previous messages.\n\nThis method is only available if the agent advertises the `session.resume` capability.\n\nThe agent should resume the session context, allowing the conversation to continue\nwithout replaying the message history (unlike `session/load`)." + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResumes an existing session without returning previous messages.\n\nThis method is only available if the agent advertises the `session.resume` capability.\n\nThe agent should resume the session context, allowing the conversation to continue\nwithout replaying the message history (unlike `session/load`).", + "title": "ResumeSessionRequest" }, { "allOf": [ @@ -710,7 +793,8 @@ "$ref": "#/$defs/SetSessionModeRequest" } ], - "description": "Sets the current mode for a session.\n\nAllows switching between different agent modes (e.g., \"ask\", \"architect\", \"code\")\nthat affect system prompts, tool availability, and permission behaviors.\n\nThe mode must be one of the modes advertised in `availableModes` during session\ncreation or loading. Agents may also change modes autonomously and notify the\nclient via `current_mode_update` notifications.\n\nThis method can be called at any time during a session, whether the Agent is\nidle or actively generating a response.\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" + "description": "Sets the current mode for a session.\n\nAllows switching between different agent modes (e.g., \"ask\", \"architect\", \"code\")\nthat affect system prompts, tool availability, and permission behaviors.\n\nThe mode must be one of the modes advertised in `availableModes` during session\ncreation or loading. Agents may also change modes autonomously and notify the\nclient via `current_mode_update` notifications.\n\nThis method can be called at any time during a session, whether the Agent is\nidle or actively generating a response.\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", + "title": "SetSessionModeRequest" }, { "allOf": [ @@ -718,7 +802,8 @@ "$ref": "#/$defs/SetSessionConfigOptionRequest" } ], - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSets the current value for a session configuration option." + "description": "Sets the current value for a session configuration option.", + "title": "SetSessionConfigOptionRequest" }, { "allOf": [ @@ -726,7 +811,8 @@ "$ref": "#/$defs/PromptRequest" } ], - "description": "Processes a user prompt within a session.\n\nThis method handles the whole lifecycle of a prompt:\n- Receives user messages with optional context (files, images, etc.)\n- Processes the prompt using language models\n- Reports language model content and tool calls to the Clients\n- Requests permission to run tools\n- Executes any requested tool calls\n- Returns when the turn is complete with a stop reason\n\nSee protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn)" + "description": "Processes a user prompt within a session.\n\nThis method handles the whole lifecycle of a prompt:\n- Receives user messages with optional context (files, images, etc.)\n- Processes the prompt using language models\n- Reports language model content and tool calls to the Clients\n- Requests permission to run tools\n- Executes any requested tool calls\n- Returns when the turn is complete with a stop reason\n\nSee protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn)", + "title": "PromptRequest" }, { "allOf": [ @@ -734,7 +820,8 @@ "$ref": "#/$defs/SetSessionModelRequest" } ], - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSelect a model for a given session." + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSelect a model for a given session.", + "title": "SetSessionModelRequest" }, { "allOf": [ @@ -742,7 +829,8 @@ "$ref": "#/$defs/ExtRequest" } ], - "description": "Handles extension method requests from the client.\n\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)" + "description": "Handles extension method requests from the client.\n\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", + "title": "ExtMethodRequest" } ], "description": "All possible requests that a client can send to an agent.\n\nThis enum is used internally for routing RPC requests. You typically won't need\nto use this directly - instead, use the methods on the [`Agent`] trait.\n\nThis enum encompasses all method calls from client to agent." @@ -770,31 +858,76 @@ "result": { "anyOf": [ { - "$ref": "#/$defs/WriteTextFileResponse" + "allOf": [ + { + "$ref": "#/$defs/WriteTextFileResponse" + } + ], + "title": "WriteTextFileResponse" }, { - "$ref": "#/$defs/ReadTextFileResponse" + "allOf": [ + { + "$ref": "#/$defs/ReadTextFileResponse" + } + ], + "title": "ReadTextFileResponse" }, { - "$ref": "#/$defs/RequestPermissionResponse" + "allOf": [ + { + "$ref": "#/$defs/RequestPermissionResponse" + } + ], + "title": "RequestPermissionResponse" }, { - "$ref": "#/$defs/CreateTerminalResponse" + "allOf": [ + { + "$ref": "#/$defs/CreateTerminalResponse" + } + ], + "title": "CreateTerminalResponse" }, { - "$ref": "#/$defs/TerminalOutputResponse" + "allOf": [ + { + "$ref": "#/$defs/TerminalOutputResponse" + } + ], + "title": "TerminalOutputResponse" }, { - "$ref": "#/$defs/ReleaseTerminalResponse" + "allOf": [ + { + "$ref": "#/$defs/ReleaseTerminalResponse" + } + ], + "title": "ReleaseTerminalResponse" }, { - "$ref": "#/$defs/WaitForTerminalExitResponse" + "allOf": [ + { + "$ref": "#/$defs/WaitForTerminalExitResponse" + } + ], + "title": "WaitForTerminalExitResponse" }, { - "$ref": "#/$defs/KillTerminalCommandResponse" + "allOf": [ + { + "$ref": "#/$defs/KillTerminalCommandResponse" + } + ], + "title": "KillTerminalResponse" }, { - "$ref": "#/$defs/ExtResponse" + "allOf": [ + { + "$ref": "#/$defs/ExtResponse" + } + ], + "title": "ExtMethodResponse" } ], "description": "All possible responses that a client can send to an agent.\n\nThis enum is used internally for routing RPC responses. You typically won't need\nto use this directly - the responses are handled automatically by the connection.\n\nThese are responses to the corresponding `AgentRequest` variants." @@ -804,6 +937,7 @@ "id", "result" ], + "title": "Result", "type": "object" }, { @@ -819,13 +953,14 @@ "id", "error" ], + "title": "Error", "type": "object" } ], "x-docs-ignore": true }, "ConfigOptionUpdate": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSession configuration options have been updated.", + "description": "Session configuration options have been updated.", "properties": { "_meta": { "additionalProperties": true, @@ -996,6 +1131,25 @@ ], "type": "object" }, + "Cost": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCost information for a session.", + "properties": { + "amount": { + "description": "Total cumulative cost for session.", + "format": "double", + "type": "number" + }, + "currency": { + "description": "ISO 4217 currency code (e.g., \"USD\", \"EUR\").", + "type": "string" + } + }, + "required": [ + "amount", + "currency" + ], + "type": "object" + }, "CreateTerminalRequest": { "description": "Request to create a new terminal and execute a command.", "properties": { @@ -1172,10 +1326,20 @@ "EmbeddedResourceResource": { "anyOf": [ { - "$ref": "#/$defs/TextResourceContents" + "allOf": [ + { + "$ref": "#/$defs/TextResourceContents" + } + ], + "title": "TextResourceContents" }, { - "$ref": "#/$defs/BlobResourceContents" + "allOf": [ + { + "$ref": "#/$defs/BlobResourceContents" + } + ], + "title": "BlobResourceContents" } ], "description": "Resource content that can be embedded in a message." @@ -1237,53 +1401,62 @@ "const": -32700, "description": "**Parse error**: Invalid JSON was received by the server.\nAn error occurred on the server while parsing the JSON text.", "format": "int32", + "title": "Parse error", "type": "integer" }, { "const": -32600, "description": "**Invalid request**: The JSON sent is not a valid Request object.", "format": "int32", + "title": "Invalid request", "type": "integer" }, { "const": -32601, "description": "**Method not found**: The method does not exist or is not available.", "format": "int32", + "title": "Method not found", "type": "integer" }, { "const": -32602, "description": "**Invalid params**: Invalid method parameter(s).", "format": "int32", + "title": "Invalid params", "type": "integer" }, { "const": -32603, "description": "**Internal error**: Internal JSON-RPC error.\nReserved for implementation-defined server errors.", "format": "int32", + "title": "Internal error", "type": "integer" }, { "const": -32800, "description": "**Request cancelled**: **UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nExecution of the method was aborted either due to a cancellation request from the caller or\nbecause of resource constraints or shutdown.", "format": "int32", + "title": "Request cancelled", "type": "integer" }, { "const": -32000, "description": "**Authentication required**: Authentication is required before this operation can be performed.", "format": "int32", + "title": "Authentication required", "type": "integer" }, { "const": -32002, "description": "**Resource not found**: A given resource, such as a file, was not found.", "format": "int32", + "title": "Resource not found", "type": "integer" }, { "description": "Other undefined error code.", "format": "int32", + "title": "Other", "type": "integer" } ], @@ -1373,7 +1546,7 @@ ] }, "configOptions": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + "description": "Initial session configuration options if supported by the Agent.", "items": { "$ref": "#/$defs/SessionConfigOption" }, @@ -1802,7 +1975,7 @@ ] }, "configOptions": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + "description": "Initial session configuration options if supported by the Agent.", "items": { "$ref": "#/$defs/SessionConfigOption" }, @@ -1906,7 +2079,8 @@ "$ref": "#/$defs/McpServerStdio" } ], - "description": "Stdio transport configuration\n\nAll Agents MUST support this transport." + "description": "Stdio transport configuration\n\nAll Agents MUST support this transport.", + "title": "stdio" } ], "description": "Configuration for connecting to an MCP (Model Context Protocol) server.\n\nMCP servers provide tools and context that the agent can use when\nprocessing prompts.\n\nSee protocol docs: [MCP Servers](https://agentclientprotocol.com/protocol/session-setup#mcp-servers)" @@ -2105,7 +2279,7 @@ ] }, "configOptions": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + "description": "Initial session configuration options if supported by the Agent.", "items": { "$ref": "#/$defs/SessionConfigOption" }, @@ -2405,6 +2579,17 @@ } ], "description": "Indicates why the agent stopped processing the turn." + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/Usage" + }, + { + "type": "null" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage for this turn (optional)." } }, "required": [ @@ -2544,13 +2729,16 @@ "RequestId": { "anyOf": [ { + "title": "Null", "type": "null" }, { "format": "int64", + "title": "Number", "type": "integer" }, { + "title": "Str", "type": "string" } ], @@ -2776,7 +2964,7 @@ ] }, "configOptions": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + "description": "Initial session configuration options if supported by the Agent.", "items": { "$ref": "#/$defs/SessionConfigOption" }, @@ -2893,15 +3081,15 @@ "type": "object" }, "SessionConfigGroupId": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for a session configuration option value group.", + "description": "Unique identifier for a session configuration option value group.", "type": "string" }, "SessionConfigId": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for a session configuration option.", + "description": "Unique identifier for a session configuration option.", "type": "string" }, "SessionConfigOption": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA session configuration option selector and its current state.", + "description": "A session configuration option selector and its current state.", "discriminator": { "propertyName": "type" }, @@ -2934,6 +3122,17 @@ "null" ] }, + "category": { + "anyOf": [ + { + "$ref": "#/$defs/SessionConfigOptionCategory" + }, + { + "type": "null" + } + ], + "description": "Optional semantic category for this option (UX only)." + }, "description": { "description": "Optional description for the Client to display to the user.", "type": [ @@ -2960,8 +3159,33 @@ ], "type": "object" }, + "SessionConfigOptionCategory": { + "anyOf": [ + { + "const": "mode", + "description": "Session mode selector.", + "type": "string" + }, + { + "const": "model", + "description": "Model selector.", + "type": "string" + }, + { + "const": "thought_level", + "description": "Thought/reasoning level selector.", + "type": "string" + }, + { + "description": "Unknown / uncategorized selector.", + "title": "other", + "type": "string" + } + ], + "description": "Semantic category for a session configuration option.\n\nThis is intended to help Clients distinguish broadly common selectors (e.g. model selector vs\nsession mode selector vs thought/reasoning level) for UX purposes (keyboard shortcuts, icons,\nplacement). It MUST NOT be required for correctness. Clients MUST handle missing or unknown\ncategories gracefully.\n\nCategory names beginning with `_` are free for custom use, like other ACP extension methods.\nCategory names that do not begin with `_` are reserved for the ACP spec." + }, "SessionConfigSelect": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA single-value selector (dropdown) session configuration option payload.", + "description": "A single-value selector (dropdown) session configuration option payload.", "properties": { "currentValue": { "allOf": [ @@ -2987,7 +3211,7 @@ "type": "object" }, "SessionConfigSelectGroup": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA group of possible values for a session configuration option.", + "description": "A group of possible values for a session configuration option.", "properties": { "_meta": { "additionalProperties": true, @@ -3025,7 +3249,7 @@ "type": "object" }, "SessionConfigSelectOption": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA possible value for a session configuration option.", + "description": "A possible value for a session configuration option.", "properties": { "_meta": { "additionalProperties": true, @@ -3068,6 +3292,7 @@ "items": { "$ref": "#/$defs/SessionConfigSelectOption" }, + "title": "Ungrouped", "type": "array" }, { @@ -3075,13 +3300,14 @@ "items": { "$ref": "#/$defs/SessionConfigSelectGroup" }, + "title": "Grouped", "type": "array" } ], - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nPossible values for a session configuration option." + "description": "Possible values for a session configuration option." }, "SessionConfigValueId": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for a session configuration option value.", + "description": "Unique identifier for a session configuration option value.", "type": "string" }, "SessionForkCapabilities": { @@ -3494,7 +3720,7 @@ "$ref": "#/$defs/ConfigOptionUpdate" } ], - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSession configuration options have been updated.", + "description": "Session configuration options have been updated.", "properties": { "sessionUpdate": { "const": "config_option_update", @@ -3523,11 +3749,29 @@ "sessionUpdate" ], "type": "object" + }, + { + "allOf": [ + { + "$ref": "#/$defs/UsageUpdate" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nContext window and cost update for the session.", + "properties": { + "sessionUpdate": { + "const": "usage_update", + "type": "string" + } + }, + "required": [ + "sessionUpdate" + ], + "type": "object" } ] }, "SetSessionConfigOptionRequest": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for setting a session configuration option.", + "description": "Request parameters for setting a session configuration option.", "properties": { "_meta": { "additionalProperties": true, @@ -3572,7 +3816,7 @@ "x-side": "agent" }, "SetSessionConfigOptionResponse": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `session/set_config_option` method.", + "description": "Response to `session/set_config_option` method.", "properties": { "_meta": { "additionalProperties": true, @@ -4254,6 +4498,103 @@ ], "type": "object" }, + "Usage": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage information for a prompt turn.", + "properties": { + "cachedReadTokens": { + "description": "Total cache read tokens.", + "format": "uint64", + "minimum": 0, + "type": [ + "integer", + "null" + ] + }, + "cachedWriteTokens": { + "description": "Total cache write tokens.", + "format": "uint64", + "minimum": 0, + "type": [ + "integer", + "null" + ] + }, + "inputTokens": { + "description": "Total input tokens across all turns.", + "format": "uint64", + "minimum": 0, + "type": "integer" + }, + "outputTokens": { + "description": "Total output tokens across all turns.", + "format": "uint64", + "minimum": 0, + "type": "integer" + }, + "thoughtTokens": { + "description": "Total thought/reasoning tokens", + "format": "uint64", + "minimum": 0, + "type": [ + "integer", + "null" + ] + }, + "totalTokens": { + "description": "Sum of all token types across session.", + "format": "uint64", + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "totalTokens", + "inputTokens", + "outputTokens" + ], + "type": "object" + }, + "UsageUpdate": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nContext window and cost update for a session.", + "properties": { + "_meta": { + "additionalProperties": true, + "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", + "type": [ + "object", + "null" + ] + }, + "cost": { + "anyOf": [ + { + "$ref": "#/$defs/Cost" + }, + { + "type": "null" + } + ], + "description": "Cumulative session cost (optional)." + }, + "size": { + "description": "Total context window size in tokens.", + "format": "uint64", + "minimum": 0, + "type": "integer" + }, + "used": { + "description": "Tokens currently in context.", + "format": "uint64", + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "used", + "size" + ], + "type": "object" + }, "WaitForTerminalExitRequest": { "description": "Request to wait for a terminal command to exit.", "properties": { @@ -4377,13 +4718,28 @@ { "anyOf": [ { - "$ref": "#/$defs/AgentRequest" + "allOf": [ + { + "$ref": "#/$defs/AgentRequest" + } + ], + "title": "Request" }, { - "$ref": "#/$defs/AgentResponse" + "allOf": [ + { + "$ref": "#/$defs/AgentResponse" + } + ], + "title": "Response" }, { - "$ref": "#/$defs/AgentNotification" + "allOf": [ + { + "$ref": "#/$defs/AgentNotification" + } + ], + "title": "Notification" } ], "description": "A message (request, response, or notification) with `\"jsonrpc\": \"2.0\"` specified as\n[required by JSON-RPC 2.0 Specification][1].\n\n[1]: https://www.jsonrpc.org/specification#compatibility", @@ -4398,18 +4754,34 @@ "required": [ "jsonrpc" ], + "title": "Agent", "type": "object" }, { "anyOf": [ { - "$ref": "#/$defs/ClientRequest" + "allOf": [ + { + "$ref": "#/$defs/ClientRequest" + } + ], + "title": "Request" }, { - "$ref": "#/$defs/ClientResponse" + "allOf": [ + { + "$ref": "#/$defs/ClientResponse" + } + ], + "title": "Response" }, { - "$ref": "#/$defs/ClientNotification" + "allOf": [ + { + "$ref": "#/$defs/ClientNotification" + } + ], + "title": "Notification" } ], "description": "A message (request, response, or notification) with `\"jsonrpc\": \"2.0\"` specified as\n[required by JSON-RPC 2.0 Specification][1].\n\n[1]: https://www.jsonrpc.org/specification#compatibility", @@ -4424,6 +4796,7 @@ "required": [ "jsonrpc" ], + "title": "Client", "type": "object" }, { @@ -4434,11 +4807,13 @@ "$ref": "#/$defs/CancelRequestNotification" } ], - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or\nchanged at any point.\n\nCancels an ongoing request.\n\nThis is a notification sent by the the side that sent a request to cancel that request.\n\nUpon receiving this notification, the receiver:\n\n1. MUST cancel the corresponding request activity and all nested activities\n2. MAY send any pending notifications.\n3. MUST send one of these responses for the original request:\n - Valid response with appropriate data (partial results or cancellation marker)\n - Error response with code `-32800` (Cancelled)\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)" + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or\nchanged at any point.\n\nCancels an ongoing request.\n\nThis is a notification sent by the the side that sent a request to cancel that request.\n\nUpon receiving this notification, the receiver:\n\n1. MUST cancel the corresponding request activity and all nested activities\n2. MAY send any pending notifications.\n3. MUST send one of these responses for the original request:\n - Valid response with appropriate data (partial results or cancellation marker)\n - Error response with code `-32800` (Cancelled)\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)", + "title": "CancelRequestNotification" } ], - "description": "General protocol-level notifications that all sides are expected to\nimplement.\n\nNotifications whose methods start with '$/' are messages which\nare protocol implementation dependent and might not be implementable in all\nclients or agents. For example if the implementation uses a single threaded\nsynchronous programming language then there is little it can do to react to\na `$/cancel_request` notification. If an agent or client receives\nnotifications starting with '$/' it is free to ignore the notification.\n\nNotifications do not expect a response." + "description": "General protocol-level notifications that all sides are expected to\nimplement.\n\nNotifications whose methods start with '$/' are messages which\nare protocol implementation dependent and might not be implementable in all\nclients or agents. For example if the implementation uses a single threaded\nsynchronous programming language then there is little it can do to react to\na `$/cancel_request` notification. If an agent or client receives\nnotifications starting with '$/' it is free to ignore the notification.\n\nNotifications do not expect a response.", + "title": "ProtocolLevel" } ], "title": "Agent Client Protocol" -} +} \ No newline at end of file diff --git a/scripts/gen_schema.py b/scripts/gen_schema.py index 36cbda7..74a8790 100644 --- a/scripts/gen_schema.py +++ b/scripts/gen_schema.py @@ -62,6 +62,7 @@ "SessionUpdate8": "CurrentModeUpdate", "SessionUpdate9": "ConfigOptionUpdate", "SessionUpdate10": "SessionInfoUpdate", + "SessionUpdate11": "UsageUpdate", "ToolCallContent1": "ContentToolCallContent", "ToolCallContent2": "FileEditToolCallContent", "ToolCallContent3": "TerminalToolCallContent", diff --git a/src/acp/agent/connection.py b/src/acp/agent/connection.py index 30b1092..c85d9d3 100644 --- a/src/acp/agent/connection.py +++ b/src/acp/agent/connection.py @@ -33,6 +33,7 @@ ToolCallProgress, ToolCallStart, ToolCallUpdate, + usage_update UserMessageChunk, WaitForTerminalExitRequest, WaitForTerminalExitResponse, @@ -88,7 +89,8 @@ async def session_update( | AvailableCommandsUpdate | CurrentModeUpdate | ConfigOptionUpdate - | SessionInfoUpdate, + | SessionInfoUpdate + | UsageUpdate, **kwargs: Any, ) -> None: await notify_model( @@ -216,5 +218,4 @@ async def __aexit__(self, exc_type, exc, tb) -> None: await self.close() def on_connect(self, conn: Agent) -> None: - # A dummy method to match the Client protocol pass diff --git a/src/acp/client/connection.py b/src/acp/client/connection.py index c71da96..ac0d34f 100644 --- a/src/acp/client/connection.py +++ b/src/acp/client/connection.py @@ -225,5 +225,4 @@ async def __aexit__(self, exc_type, exc, tb) -> None: await self.close() def on_connect(self, conn: Client) -> None: - # A dummy method to match the Agent protocol pass diff --git a/src/acp/interfaces.py b/src/acp/interfaces.py index 5cc45ff..457dfe7 100644 --- a/src/acp/interfaces.py +++ b/src/acp/interfaces.py @@ -59,6 +59,7 @@ ToolCallProgress, ToolCallStart, ToolCallUpdate, + UsageUpdate, UserMessageChunk, WaitForTerminalExitRequest, WaitForTerminalExitResponse, @@ -89,7 +90,8 @@ async def session_update( | AvailableCommandsUpdate | CurrentModeUpdate | ConfigOptionUpdate - | SessionInfoUpdate, + | SessionInfoUpdate + | UsageUpdate, **kwargs: Any, ) -> None: ... diff --git a/src/acp/meta.py b/src/acp/meta.py index 142f2f1..82aae7e 100644 --- a/src/acp/meta.py +++ b/src/acp/meta.py @@ -1,5 +1,5 @@ # Generated from schema/meta.json. Do not edit by hand. -# Schema ref: refs/tags/v0.10.5 +# Schema ref: refs/tags/v0.10.8 AGENT_METHODS = { "authenticate": "authenticate", "initialize": "initialize", diff --git a/src/acp/schema.py b/src/acp/schema.py index 314ccd9..e449e4a 100644 --- a/src/acp/schema.py +++ b/src/acp/schema.py @@ -1,5 +1,5 @@ # Generated from schema/schema.json. Do not edit by hand. -# Schema ref: refs/tags/v0.10.5 +# Schema ref: refs/tags/v0.10.8 from __future__ import annotations @@ -111,6 +111,13 @@ class BlobResourceContents(BaseModel): uri: str +class Cost(BaseModel): + # Total cumulative cost for session. + amount: Annotated[float, Field(description="Total cumulative cost for session.")] + # ISO 4217 currency code (e.g., "USD", "EUR"). + currency: Annotated[str, Field(description='ISO 4217 currency code (e.g., "USD", "EUR").')] + + class CreateTerminalResponse(BaseModel): # The _meta property is reserved by ACP to allow clients and agents to attach additional # metadata to their interactions. Implementations MUST NOT make assumptions about values at @@ -900,6 +907,72 @@ class UnstructuredCommandInput(BaseModel): ] +class Usage(BaseModel): + # Total cache read tokens. + cached_read_tokens: Annotated[ + Optional[int], + Field(alias="cachedReadTokens", description="Total cache read tokens.", ge=0), + ] = None + # Total cache write tokens. + cached_write_tokens: Annotated[ + Optional[int], + Field(alias="cachedWriteTokens", description="Total cache write tokens.", ge=0), + ] = None + # Total input tokens across all turns. + input_tokens: Annotated[ + int, + Field( + alias="inputTokens", + description="Total input tokens across all turns.", + ge=0, + ), + ] + # Total output tokens across all turns. + output_tokens: Annotated[ + int, + Field( + alias="outputTokens", + description="Total output tokens across all turns.", + ge=0, + ), + ] + # Total thought/reasoning tokens + thought_tokens: Annotated[ + Optional[int], + Field(alias="thoughtTokens", description="Total thought/reasoning tokens", ge=0), + ] = None + # Sum of all token types across session. + total_tokens: Annotated[ + int, + Field( + alias="totalTokens", + description="Sum of all token types across session.", + ge=0, + ), + ] + + +class _UsageUpdate(BaseModel): + # The _meta property is reserved by ACP to allow clients and agents to attach additional + # metadata to their interactions. Implementations MUST NOT make assumptions about values at + # these keys. + # + # See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility) + field_meta: Annotated[ + Optional[Dict[str, Any]], + Field( + alias="_meta", + description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", + ), + ] = None + # Cumulative session cost (optional). + cost: Annotated[Optional[Cost], Field(description="Cumulative session cost (optional).")] = None + # Total context window size in tokens. + size: Annotated[int, Field(description="Total context window size in tokens.", ge=0)] + # Tokens currently in context. + used: Annotated[int, Field(description="Tokens currently in context.", ge=0)] + + class WaitForTerminalExitRequest(BaseModel): # The _meta property is reserved by ACP to allow clients and agents to attach additional # metadata to their interactions. Implementations MUST NOT make assumptions about values at @@ -1423,6 +1496,17 @@ class PromptResponse(BaseModel): description="Indicates why the agent stopped processing the turn.", ), ] + # **UNSTABLE** + # + # This capability is not part of the spec yet, and may be removed or changed at any point. + # + # Token usage for this turn (optional). + usage: Annotated[ + Optional[Usage], + Field( + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage for this turn (optional)." + ), + ] = None class ReadTextFileRequest(BaseModel): @@ -1666,6 +1750,10 @@ class CurrentModeUpdate(_CurrentModeUpdate): session_update: Annotated[Literal["current_mode_update"], Field(alias="sessionUpdate")] +class UsageUpdate(_UsageUpdate): + session_update: Annotated[Literal["usage_update"], Field(alias="sessionUpdate")] + + class TextContent(BaseModel): # The _meta property is reserved by ACP to allow clients and agents to attach additional # metadata to their interactions. Implementations MUST NOT make assumptions about values at @@ -2220,6 +2308,11 @@ class SessionConfigOptionSelect(SessionConfigSelect): description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", ), ] = None + # Optional semantic category for this option (UX only). + category: Annotated[ + Optional[str], + Field(description="Optional semantic category for this option (UX only)."), + ] = None # Optional description for the Client to display to the user. description: Annotated[ Optional[str], @@ -2233,15 +2326,11 @@ class SessionConfigOptionSelect(SessionConfigSelect): class SessionConfigOption(RootModel[SessionConfigOptionSelect]): - # **UNSTABLE** - # - # This capability is not part of the spec yet, and may be removed or changed at any point. - # # A session configuration option selector and its current state. root: Annotated[ SessionConfigOptionSelect, Field( - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA session configuration option selector and its current state.", + description="A session configuration option selector and its current state.", discriminator="type", ), ] @@ -2350,16 +2439,12 @@ class ForkSessionResponse(BaseModel): description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", ), ] = None - # **UNSTABLE** - # - # This capability is not part of the spec yet, and may be removed or changed at any point. - # # Initial session configuration options if supported by the Agent. config_options: Annotated[ Optional[List[SessionConfigOption]], Field( alias="configOptions", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + description="Initial session configuration options if supported by the Agent.", ), ] = None # **UNSTABLE** @@ -2405,16 +2490,12 @@ class LoadSessionResponse(BaseModel): description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", ), ] = None - # **UNSTABLE** - # - # This capability is not part of the spec yet, and may be removed or changed at any point. - # # Initial session configuration options if supported by the Agent. config_options: Annotated[ Optional[List[SessionConfigOption]], Field( alias="configOptions", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + description="Initial session configuration options if supported by the Agent.", ), ] = None # **UNSTABLE** @@ -2452,16 +2533,12 @@ class NewSessionResponse(BaseModel): description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", ), ] = None - # **UNSTABLE** - # - # This capability is not part of the spec yet, and may be removed or changed at any point. - # # Initial session configuration options if supported by the Agent. config_options: Annotated[ Optional[List[SessionConfigOption]], Field( alias="configOptions", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + description="Initial session configuration options if supported by the Agent.", ), ] = None # **UNSTABLE** @@ -2539,16 +2616,12 @@ class ResumeSessionResponse(BaseModel): description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", ), ] = None - # **UNSTABLE** - # - # This capability is not part of the spec yet, and may be removed or changed at any point. - # # Initial session configuration options if supported by the Agent. config_options: Annotated[ Optional[List[SessionConfigOption]], Field( alias="configOptions", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + description="Initial session configuration options if supported by the Agent.", ), ] = None # **UNSTABLE** @@ -2757,6 +2830,7 @@ class SessionNotification(BaseModel): CurrentModeUpdate, ConfigOptionUpdate, SessionInfoUpdate, + UsageUpdate, ], Field(description="The actual update content.", discriminator="session_update"), ] From b2f2a97c510ce04d11e6b2206eaa43c8a5200d16 Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Sat, 7 Feb 2026 15:41:35 +0000 Subject: [PATCH 2/2] fix: minor fix Signed-off-by: Chojan Shang --- schema/meta.json | 2 +- schema/schema.json | 2 +- src/acp/agent/connection.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/schema/meta.json b/schema/meta.json index 1fbc720..507c21d 100644 --- a/schema/meta.json +++ b/schema/meta.json @@ -28,4 +28,4 @@ "cancel_request": "$/cancel_request" }, "version": 1 -} \ No newline at end of file +} diff --git a/schema/schema.json b/schema/schema.json index ff79698..ba61b43 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -4816,4 +4816,4 @@ } ], "title": "Agent Client Protocol" -} \ No newline at end of file +} diff --git a/src/acp/agent/connection.py b/src/acp/agent/connection.py index c85d9d3..b3b0351 100644 --- a/src/acp/agent/connection.py +++ b/src/acp/agent/connection.py @@ -33,7 +33,7 @@ ToolCallProgress, ToolCallStart, ToolCallUpdate, - usage_update + UsageUpdate, UserMessageChunk, WaitForTerminalExitRequest, WaitForTerminalExitResponse,