diff --git a/pyproject.toml b/pyproject.toml index eaab0e0..6432be2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "agent-client-protocol" -version = "0.10.1" +version = "0.11.0" description = "A Python implement of Agent Client Protocol (ACP, by Zed Industries)" authors = [ { name = "Chojan Shang", email = "psiace@apache.org" }, diff --git a/schema/VERSION b/schema/VERSION index f1d3366..2a50c94 100644 --- a/schema/VERSION +++ b/schema/VERSION @@ -1 +1 @@ -refs/tags/v0.12.2 +refs/tags/v0.13.3 diff --git a/schema/meta.json b/schema/meta.json index 6d1dd24..5775e36 100644 --- a/schema/meta.json +++ b/schema/meta.json @@ -8,6 +8,7 @@ "document_did_save": "document/didSave", "initialize": "initialize", "logout": "logout", + "mcp_message": "mcp/message", "nes_accept": "nes/accept", "nes_close": "nes/close", "nes_reject": "nes/reject", @@ -18,6 +19,7 @@ "providers_set": "providers/set", "session_cancel": "session/cancel", "session_close": "session/close", + "session_delete": "session/delete", "session_fork": "session/fork", "session_list": "session/list", "session_load": "session/load", @@ -33,6 +35,9 @@ "elicitation_create": "elicitation/create", "fs_read_text_file": "fs/read_text_file", "fs_write_text_file": "fs/write_text_file", + "mcp_connect": "mcp/connect", + "mcp_disconnect": "mcp/disconnect", + "mcp_message": "mcp/message", "session_request_permission": "session/request_permission", "session_update": "session/update", "terminal_create": "terminal/create", diff --git a/schema/schema.json b/schema/schema.json index 709a0d9..80b2cbf 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -33,7 +33,7 @@ "x-side": "agent" }, "AgentAuthCapabilities": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication-related capabilities supported by the agent.", + "description": "Authentication-related capabilities supported by the agent.", "properties": { "_meta": { "additionalProperties": true, @@ -75,7 +75,7 @@ } ], "default": {}, - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication-related capabilities supported by the agent." + "description": "Authentication-related capabilities supported by the agent." }, "loadSession": { "default": false, @@ -89,6 +89,7 @@ } ], "default": { + "acp": false, "http": false, "sse": false }, @@ -178,6 +179,15 @@ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nNotification that a URL-based elicitation has completed.", "title": "CompleteElicitationNotification" }, + { + "allOf": [ + { + "$ref": "#/$defs/MessageMcpNotification" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nReceives an MCP-over-ACP notification.", + "title": "MessageMcpNotification" + }, { "allOf": [ { @@ -188,7 +198,7 @@ "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." + "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.\n\nNotifications do not expect a response." }, { "type": "null" @@ -295,6 +305,33 @@ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequests structured user input via a form or URL.", "title": "CreateElicitationRequest" }, + { + "allOf": [ + { + "$ref": "#/$defs/ConnectMcpRequest" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nOpens an MCP-over-ACP connection.", + "title": "ConnectMcpRequest" + }, + { + "allOf": [ + { + "$ref": "#/$defs/MessageMcpRequest" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nExchanges an MCP-over-ACP message.", + "title": "MessageMcpRequest" + }, + { + "allOf": [ + { + "$ref": "#/$defs/DisconnectMcpRequest" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCloses an MCP-over-ACP connection.", + "title": "DisconnectMcpRequest" + }, { "allOf": [ { @@ -305,7 +342,7 @@ "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." + "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.\n\nThis enum encompasses all method calls from agent to client." }, { "type": "null" @@ -356,18 +393,18 @@ { "allOf": [ { - "$ref": "#/$defs/SetProvidersResponse" + "$ref": "#/$defs/SetProviderResponse" } ], - "title": "SetProvidersResponse" + "title": "SetProviderResponse" }, { "allOf": [ { - "$ref": "#/$defs/DisableProvidersResponse" + "$ref": "#/$defs/DisableProviderResponse" } ], - "title": "DisableProvidersResponse" + "title": "DisableProviderResponse" }, { "allOf": [ @@ -401,6 +438,14 @@ ], "title": "ListSessionsResponse" }, + { + "allOf": [ + { + "$ref": "#/$defs/DeleteSessionResponse" + } + ], + "title": "DeleteSessionResponse" + }, { "allOf": [ { @@ -488,6 +533,14 @@ } ], "title": "ExtMethodResponse" + }, + { + "allOf": [ + { + "$ref": "#/$defs/MessageMcpResponse" + } + ], + "title": "MessageMcpResponse" } ], "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." @@ -1248,6 +1301,15 @@ "description": "**UNSTABLE**\n\nNotification sent when a suggestion is rejected.", "title": "RejectNesNotification" }, + { + "allOf": [ + { + "$ref": "#/$defs/MessageMcpNotification" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSends an MCP-over-ACP notification.", + "title": "MessageMcpNotification" + }, { "allOf": [ { @@ -1258,7 +1320,7 @@ "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." + "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.\n\nNotifications do not expect a response." }, { "type": "null" @@ -1314,20 +1376,20 @@ { "allOf": [ { - "$ref": "#/$defs/SetProvidersRequest" + "$ref": "#/$defs/SetProviderRequest" } ], "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nReplaces the configuration for a provider.", - "title": "SetProvidersRequest" + "title": "SetProviderRequest" }, { "allOf": [ { - "$ref": "#/$defs/DisableProvidersRequest" + "$ref": "#/$defs/DisableProviderRequest" } ], "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nDisables a provider.", - "title": "DisableProvidersRequest" + "title": "DisableProviderRequest" }, { "allOf": [ @@ -1335,7 +1397,7 @@ "$ref": "#/$defs/LogoutRequest" } ], - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nLogs out of the current authenticated state.\n\nAfter a successful logout, all new sessions will require authentication.\nThere is no guarantee about the behavior of already running sessions.", + "description": "Logs out of the current authenticated state.\n\nAfter a successful logout, all new sessions will require authentication.\nThere is no guarantee about the behavior of already running sessions.", "title": "LogoutRequest" }, { @@ -1365,6 +1427,15 @@ "description": "Lists existing sessions known to the agent.\n\nThis method is only available if the agent advertises the `sessionCapabilities.list` capability.\n\nThe agent should return metadata about sessions with optional filtering and pagination support.", "title": "ListSessionsRequest" }, + { + "allOf": [ + { + "$ref": "#/$defs/DeleteSessionRequest" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nDeletes an existing session from `session/list`.\n\nThis method is only available if the agent advertises the `sessionCapabilities.delete` capability.", + "title": "DeleteSessionRequest" + }, { "allOf": [ { @@ -1455,6 +1526,15 @@ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCloses an active NES session and frees up any resources associated with it.\n\nThe agent must cancel any ongoing work and then free up any resources\nassociated with the NES session.", "title": "CloseNesRequest" }, + { + "allOf": [ + { + "$ref": "#/$defs/MessageMcpRequest" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nExchanges an MCP-over-ACP message.", + "title": "MessageMcpRequest" + }, { "allOf": [ { @@ -1465,7 +1545,7 @@ "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." + "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.\n\nThis enum encompasses all method calls from client to agent." }, { "type": "null" @@ -1561,6 +1641,22 @@ ], "title": "CreateElicitationResponse" }, + { + "allOf": [ + { + "$ref": "#/$defs/ConnectMcpResponse" + } + ], + "title": "ConnectMcpResponse" + }, + { + "allOf": [ + { + "$ref": "#/$defs/DisconnectMcpResponse" + } + ], + "title": "DisconnectMcpResponse" + }, { "allOf": [ { @@ -1568,6 +1664,14 @@ } ], "title": "ExtMethodResponse" + }, + { + "allOf": [ + { + "$ref": "#/$defs/MessageMcpResponse" + } + ], + "title": "MessageMcpResponse" } ], "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." @@ -1736,6 +1840,60 @@ ], "type": "object" }, + "ConnectMcpRequest": { + "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 `mcp/connect`.", + "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" + ] + }, + "acpId": { + "allOf": [ + { + "$ref": "#/$defs/McpServerAcpId" + } + ], + "description": "The ACP MCP server ID that was provided by the component declaring the MCP server." + } + }, + "required": [ + "acpId" + ], + "type": "object", + "x-method": "mcp/connect", + "x-side": "client" + }, + "ConnectMcpResponse": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `mcp/connect`.", + "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" + ] + }, + "connectionId": { + "allOf": [ + { + "$ref": "#/$defs/McpConnectionId" + } + ], + "description": "The unique identifier for this MCP-over-ACP connection." + } + }, + "required": [ + "connectionId" + ], + "type": "object", + "x-method": "mcp/connect", + "x-side": "client" + }, "Content": { "description": "Standard content block (text, images, resources).", "properties": { @@ -2149,6 +2307,49 @@ ], "type": "object" }, + "DeleteSessionRequest": { + "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 deleting an existing session from `session/list`.\n\nOnly available if the Agent supports the `sessionCapabilities.delete` capability.", + "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" + ] + }, + "sessionId": { + "allOf": [ + { + "$ref": "#/$defs/SessionId" + } + ], + "description": "The ID of the session to delete." + } + }, + "required": [ + "sessionId" + ], + "type": "object", + "x-method": "session/delete", + "x-side": "agent" + }, + "DeleteSessionResponse": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from deleting 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" + ] + } + }, + "type": "object", + "x-method": "session/delete", + "x-side": "agent" + }, "DidChangeDocumentNotification": { "description": "Notification sent when a file is edited.", "properties": { @@ -2396,7 +2597,7 @@ ], "type": "object" }, - "DisableProvidersRequest": { + "DisableProviderRequest": { "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 `providers/disable`.", "properties": { "_meta": { @@ -2419,7 +2620,7 @@ "x-method": "providers/disable", "x-side": "agent" }, - "DisableProvidersResponse": { + "DisableProviderResponse": { "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `providers/disable`.", "properties": { "_meta": { @@ -2435,6 +2636,49 @@ "x-method": "providers/disable", "x-side": "agent" }, + "DisconnectMcpRequest": { + "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 `mcp/disconnect`.", + "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" + ] + }, + "connectionId": { + "allOf": [ + { + "$ref": "#/$defs/McpConnectionId" + } + ], + "description": "The MCP-over-ACP connection to close." + } + }, + "required": [ + "connectionId" + ], + "type": "object", + "x-method": "mcp/disconnect", + "x-side": "client" + }, + "DisconnectMcpResponse": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `mcp/disconnect`.", + "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" + ] + } + }, + "type": "object", + "x-method": "mcp/disconnect", + "x-side": "client" + }, "ElicitationAcceptAction": { "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe user accepted the elicitation and provided content.", "properties": { @@ -3346,6 +3590,7 @@ "auth": {}, "loadSession": false, "mcpCapabilities": { + "acp": false, "http": false, "sse": false }, @@ -3538,13 +3783,6 @@ "null" ] }, - "additionalDirectories": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nFilter sessions by the exact ordered additional workspace roots. Each path must be absolute.\n\nThis filter applies only when the field is present and non-empty. When\nomitted or empty, no additional-root filter is applied.", - "items": { - "type": "string" - }, - "type": "array" - }, "cursor": { "description": "Opaque cursor token from a previous response's nextCursor field for cursor-based pagination", "type": [ @@ -3644,7 +3882,7 @@ ] }, "additionalDirectories": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the loaded\nsession.", + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the loaded\nsession. It may differ from any previously used or reported list as long as\nthe request `cwd` matches the session's `cwd`.", "items": { "type": "string" }, @@ -3728,7 +3966,7 @@ "x-side": "agent" }, "LogoutCapabilities": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nLogout capabilities supported by the agent.\n\nBy supplying `{}` it means that the agent supports the logout method.", + "description": "Logout capabilities supported by the agent.\n\nBy supplying `{}` it means that the agent supports the logout method.", "properties": { "_meta": { "additionalProperties": true, @@ -3742,7 +3980,7 @@ "type": "object" }, "LogoutRequest": { - "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 the logout method.\n\nTerminates the current authenticated session.", + "description": "Request parameters for the logout method.\n\nTerminates the current authenticated session.", "properties": { "_meta": { "additionalProperties": true, @@ -3758,7 +3996,7 @@ "x-side": "agent" }, "LogoutResponse": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to the `logout` method.", + "description": "Response to the `logout` method.", "properties": { "_meta": { "additionalProperties": true, @@ -3784,6 +4022,11 @@ "null" ] }, + "acp": { + "default": false, + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAgent supports [`McpServer::Acp`].", + "type": "boolean" + }, "http": { "default": false, "description": "Agent supports [`McpServer::Http`].", @@ -3797,6 +4040,10 @@ }, "type": "object" }, + "McpConnectionId": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for an active MCP-over-ACP connection.", + "type": "string" + }, "McpServer": { "anyOf": [ { @@ -3835,6 +4082,24 @@ ], "type": "object" }, + { + "allOf": [ + { + "$ref": "#/$defs/McpServerAcp" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nACP transport configuration\n\nOnly available when the Agent capabilities indicate `mcp_capabilities.acp` is `true`.\nThe MCP server is provided by an ACP component and communicates over the ACP channel.", + "properties": { + "type": { + "const": "acp", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + }, { "allOf": [ { @@ -3847,6 +4112,40 @@ ], "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)" }, + "McpServerAcp": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nACP transport configuration for MCP.\n\nThe MCP server is provided by an ACP component and communicates over the ACP channel\nusing `mcp/connect`, `mcp/message`, and `mcp/disconnect`.", + "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" + ] + }, + "id": { + "allOf": [ + { + "$ref": "#/$defs/McpServerAcpId" + } + ], + "description": "Unique identifier for this MCP server, generated by the component providing it.\n\nProviders MUST NOT reuse an ID for multiple ACP-transport MCP servers that are visible\non the same ACP connection." + }, + "name": { + "description": "Human-readable name identifying this MCP server.", + "type": "string" + } + }, + "required": [ + "name", + "id" + ], + "type": "object" + }, + "McpServerAcpId": { + "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 an MCP server using the ACP transport.\n\nThe value is opaque and generated by the ACP component providing the MCP server. It is\nused by `mcp/connect` to route connection requests back to the component that declared the\nserver.", + "type": "string" + }, "McpServerHttp": { "description": "HTTP transport configuration for MCP.", "properties": { @@ -3957,6 +4256,91 @@ ], "type": "object" }, + "MessageMcpNotification": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nNotification parameters for `mcp/message`.\n\nThis is used when the wrapped MCP message is a notification and the outer JSON-RPC\nenvelope has no `id`.", + "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" + ] + }, + "connectionId": { + "allOf": [ + { + "$ref": "#/$defs/McpConnectionId" + } + ], + "description": "The MCP-over-ACP connection this message is sent on." + }, + "method": { + "description": "The inner MCP method name.", + "type": "string" + }, + "params": { + "additionalProperties": true, + "description": "Optional inner MCP params.\n\nIf omitted or set to `null`, the inner MCP message has no params.", + "type": [ + "object", + "null" + ] + } + }, + "required": [ + "connectionId", + "method" + ], + "type": "object", + "x-method": "mcp/message", + "x-side": "both" + }, + "MessageMcpRequest": { + "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 `mcp/message`.", + "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" + ] + }, + "connectionId": { + "allOf": [ + { + "$ref": "#/$defs/McpConnectionId" + } + ], + "description": "The MCP-over-ACP connection this message is sent on." + }, + "method": { + "description": "The inner MCP method name.", + "type": "string" + }, + "params": { + "additionalProperties": true, + "description": "Optional inner MCP params.\n\nIf omitted or set to `null`, the inner MCP message has no params.", + "type": [ + "object", + "null" + ] + } + }, + "required": [ + "connectionId", + "method" + ], + "type": "object", + "x-method": "mcp/message", + "x-side": "both" + }, + "MessageMcpResponse": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `mcp/message`.\n\nThis is the inner MCP response result payload. Any JSON value is valid.", + "x-method": "mcp/message", + "x-side": "both" + }, "ModelId": { "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for a model.", "type": "string" @@ -5884,7 +6268,7 @@ "type": "string" } ], - "description": "JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." + "description": "JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \\[1\\] and Numbers SHOULD NOT contain fractional parts \\[2\\]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n\\[1\\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n\\[2\\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." }, "RequestPermissionOutcome": { "description": "The outcome of a permission request.", @@ -6067,7 +6451,7 @@ ] }, "additionalDirectories": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the resumed\nsession.", + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the resumed\nsession. It may differ from any previously used or reported list as long as\nthe request `cwd` matches the session's `cwd`.", "items": { "type": "string" }, @@ -6183,7 +6567,7 @@ "type": "object" }, "SessionAdditionalDirectoriesCapabilities": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for additional session directories support.\n\nBy supplying `{}` it means that the agent supports the `additionalDirectories` field on\nsupported session lifecycle requests and `session/list`.", + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for additional session directories support.\n\nBy supplying `{}` it means that the agent supports the `additionalDirectories`\nfield on supported session lifecycle requests. Agents that also support\n`session/list` may return `SessionInfo.additionalDirectories` to report the\ncomplete ordered additional-root list associated with a listed session.", "properties": { "_meta": { "additionalProperties": true, @@ -6216,7 +6600,7 @@ "type": "null" } ], - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `additionalDirectories` on supported session lifecycle requests and `session/list`." + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `additionalDirectories` on supported session lifecycle requests.\n\nAgents that also support `session/list` may return\n`SessionInfo.additionalDirectories` to report the complete ordered\nadditional-root list associated with a listed session." }, "close": { "anyOf": [ @@ -6229,6 +6613,17 @@ ], "description": "Whether the agent supports `session/close`." }, + "delete": { + "anyOf": [ + { + "$ref": "#/$defs/SessionDeleteCapabilities" + }, + { + "type": "null" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/delete`.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports deleting sessions from `session/list`." + }, "fork": { "anyOf": [ { @@ -6540,6 +6935,20 @@ "description": "Unique identifier for a session configuration option value.", "type": "string" }, + "SessionDeleteCapabilities": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/delete` method.\n\nSupplying `{}` means the agent supports deleting sessions from `session/list`.", + "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" + ] + } + }, + "type": "object" + }, "SessionForkCapabilities": { "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/fork` method.\n\nBy supplying `{}` it means that the agent supports forking of sessions.", "properties": { @@ -6570,7 +6979,7 @@ ] }, "additionalDirectories": { - "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthoritative ordered additional workspace roots for this session. Each path must be absolute.\n\nWhen omitted or empty, there are no additional roots for the session.", + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots reported for this session. Each path must be absolute.\n\nWhen present, this is the complete ordered additional-root list reported\nby the Agent. Omitted and empty values are equivalent: the response\nreports no additional roots.", "items": { "type": "string" }, @@ -7007,7 +7416,7 @@ } ] }, - "SetProvidersRequest": { + "SetProviderRequest": { "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 `providers/set`.\n\nReplaces the full configuration for one provider id.", "properties": { "_meta": { @@ -7051,7 +7460,7 @@ "x-method": "providers/set", "x-side": "agent" }, - "SetProvidersResponse": { + "SetProviderResponse": { "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `providers/set`.", "properties": { "_meta": { diff --git a/scripts/gen_schema.py b/scripts/gen_schema.py index 9a78b26..3c9206e 100644 --- a/scripts/gen_schema.py +++ b/scripts/gen_schema.py @@ -49,6 +49,7 @@ "ContentBlock5": "EmbeddedResourceContentBlock", "McpServer1": "HttpMcpServer", "McpServer2": "SseMcpServer", + "McpServer3": "AcpMcpServer", "RequestPermissionOutcome1": "DeniedOutcome", "RequestPermissionOutcome2": "AllowedOutcome", "AuthMethod1": "EnvVarAuthMethod", diff --git a/src/acp/client/connection.py b/src/acp/client/connection.py index 024884a..d46a717 100644 --- a/src/acp/client/connection.py +++ b/src/acp/client/connection.py @@ -8,6 +8,7 @@ from ..interfaces import Agent, Client from ..meta import AGENT_METHODS from ..schema import ( + AcpMcpServer, AudioContentBlock, AuthenticateRequest, AuthenticateResponse, @@ -101,7 +102,7 @@ async def new_session( self, cwd: str, additional_directories: list[str] | None = None, - mcp_servers: list[HttpMcpServer | SseMcpServer | McpServerStdio] | None = None, + mcp_servers: list[HttpMcpServer | SseMcpServer | AcpMcpServer | McpServerStdio] | None = None, **kwargs: Any, ) -> NewSessionResponse: resolved_mcp_servers = mcp_servers or [] @@ -123,7 +124,7 @@ async def load_session( cwd: str, session_id: str, additional_directories: list[str] | None = None, - mcp_servers: list[HttpMcpServer | SseMcpServer | McpServerStdio] | None = None, + mcp_servers: list[HttpMcpServer | SseMcpServer | AcpMcpServer | McpServerStdio] | None = None, **kwargs: Any, ) -> LoadSessionResponse: resolved_mcp_servers = mcp_servers or [] @@ -142,18 +143,12 @@ async def load_session( @param_model(ListSessionsRequest) async def list_sessions( - self, - additional_directories: list[str] | None = None, - cursor: str | None = None, - cwd: str | None = None, - **kwargs: Any, + self, cursor: str | None = None, cwd: str | None = None, **kwargs: Any ) -> ListSessionsResponse: return await request_model_from_dict( self._conn, AGENT_METHODS["session_list"], - ListSessionsRequest( - additional_directories=additional_directories, cursor=cursor, cwd=cwd, field_meta=kwargs or None - ), + ListSessionsRequest(cursor=cursor, cwd=cwd, field_meta=kwargs or None), ListSessionsResponse, ) @@ -228,7 +223,7 @@ async def fork_session( cwd: str, session_id: str, additional_directories: list[str] | None = None, - mcp_servers: list[HttpMcpServer | SseMcpServer | McpServerStdio] | None = None, + mcp_servers: list[HttpMcpServer | SseMcpServer | AcpMcpServer | McpServerStdio] | None = None, **kwargs: Any, ) -> ForkSessionResponse: return await request_model( @@ -250,7 +245,7 @@ async def resume_session( cwd: str, session_id: str, additional_directories: list[str] | None = None, - mcp_servers: list[HttpMcpServer | SseMcpServer | McpServerStdio] | None = None, + mcp_servers: list[HttpMcpServer | SseMcpServer | AcpMcpServer | McpServerStdio] | None = None, **kwargs: Any, ) -> ResumeSessionResponse: return await request_model( diff --git a/src/acp/interfaces.py b/src/acp/interfaces.py index 0568731..248db56 100644 --- a/src/acp/interfaces.py +++ b/src/acp/interfaces.py @@ -3,6 +3,7 @@ from typing import Any, Protocol from .schema import ( + AcpMcpServer, AgentMessageChunk, AgentPlanUpdate, AgentThoughtChunk, @@ -160,7 +161,7 @@ async def new_session( self, cwd: str, additional_directories: list[str] | None = None, - mcp_servers: list[HttpMcpServer | SseMcpServer | McpServerStdio] | None = None, + mcp_servers: list[HttpMcpServer | SseMcpServer | AcpMcpServer | McpServerStdio] | None = None, **kwargs: Any, ) -> NewSessionResponse: ... @@ -170,17 +171,13 @@ async def load_session( cwd: str, session_id: str, additional_directories: list[str] | None = None, - mcp_servers: list[HttpMcpServer | SseMcpServer | McpServerStdio] | None = None, + mcp_servers: list[HttpMcpServer | SseMcpServer | AcpMcpServer | McpServerStdio] | None = None, **kwargs: Any, ) -> LoadSessionResponse | None: ... @param_model(ListSessionsRequest) async def list_sessions( - self, - additional_directories: list[str] | None = None, - cursor: str | None = None, - cwd: str | None = None, - **kwargs: Any, + self, cursor: str | None = None, cwd: str | None = None, **kwargs: Any ) -> ListSessionsResponse: ... @param_model(SetSessionModeRequest) @@ -220,7 +217,7 @@ async def fork_session( cwd: str, session_id: str, additional_directories: list[str] | None = None, - mcp_servers: list[HttpMcpServer | SseMcpServer | McpServerStdio] | None = None, + mcp_servers: list[HttpMcpServer | SseMcpServer | AcpMcpServer | McpServerStdio] | None = None, **kwargs: Any, ) -> ForkSessionResponse: ... @@ -230,7 +227,7 @@ async def resume_session( cwd: str, session_id: str, additional_directories: list[str] | None = None, - mcp_servers: list[HttpMcpServer | SseMcpServer | McpServerStdio] | None = None, + mcp_servers: list[HttpMcpServer | SseMcpServer | AcpMcpServer | McpServerStdio] | None = None, **kwargs: Any, ) -> ResumeSessionResponse: ... diff --git a/src/acp/meta.py b/src/acp/meta.py index ed9a25f..604d98e 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.12.2 +# Schema ref: refs/tags/v0.13.3 AGENT_METHODS = { "authenticate": "authenticate", "document_did_change": "document/didChange", @@ -9,6 +9,7 @@ "document_did_save": "document/didSave", "initialize": "initialize", "logout": "logout", + "mcp_message": "mcp/message", "nes_accept": "nes/accept", "nes_close": "nes/close", "nes_reject": "nes/reject", @@ -19,6 +20,7 @@ "providers_set": "providers/set", "session_cancel": "session/cancel", "session_close": "session/close", + "session_delete": "session/delete", "session_fork": "session/fork", "session_list": "session/list", "session_load": "session/load", @@ -34,6 +36,9 @@ "elicitation_create": "elicitation/create", "fs_read_text_file": "fs/read_text_file", "fs_write_text_file": "fs/write_text_file", + "mcp_connect": "mcp/connect", + "mcp_disconnect": "mcp/disconnect", + "mcp_message": "mcp/message", "session_request_permission": "session/request_permission", "session_update": "session/update", "terminal_create": "terminal/create", diff --git a/src/acp/schema.py b/src/acp/schema.py index 614c7ed..1862a53 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.12.2 +# Schema ref: refs/tags/v0.13.3 from __future__ import annotations @@ -346,6 +346,21 @@ class CreateTerminalResponse(BaseModel): ] +class DeleteSessionResponse(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 + + class Diff(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 @@ -370,7 +385,7 @@ class Diff(BaseModel): path: Annotated[str, Field(description="The file path being modified.")] -class DisableProvidersRequest(BaseModel): +class DisableProviderRequest(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. @@ -387,7 +402,22 @@ class DisableProvidersRequest(BaseModel): id: Annotated[str, Field(description="Provider id to disable.")] -class DisableProvidersResponse(BaseModel): +class DisableProviderResponse(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 + + +class DisconnectMcpResponse(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. @@ -621,21 +651,6 @@ class ListSessionsRequest(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. - # - # Filter sessions by the exact ordered additional workspace roots. Each path must be absolute. - # - # This filter applies only when the field is present and non-empty. When - # omitted or empty, no additional-root filter is applied. - additional_directories: Annotated[ - Optional[List[str]], - Field( - alias="additionalDirectories", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nFilter sessions by the exact ordered additional workspace roots. Each path must be absolute.\n\nThis filter applies only when the field is present and non-empty. When\nomitted or empty, no additional-root filter is applied.", - ), - ] = None # Opaque cursor token from a previous response's nextCursor field for cursor-based pagination cursor: Annotated[ Optional[str], @@ -708,6 +723,17 @@ class McpCapabilities(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. + # + # Agent supports [`McpServer::Acp`]. + acp: Annotated[ + Optional[bool], + Field( + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAgent supports [`McpServer::Acp`]." + ), + ] = False # Agent supports [`McpServer::Http`]. http: Annotated[Optional[bool], Field(description="Agent supports [`McpServer::Http`].")] = False # Agent supports [`McpServer::Sse`]. @@ -791,6 +817,74 @@ class McpServerStdio(BaseModel): name: Annotated[str, Field(description="Human-readable name identifying this MCP server.")] +class MessageMcpNotification(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 + # The MCP-over-ACP connection this message is sent on. + connection_id: Annotated[ + str, + Field( + alias="connectionId", + description="The MCP-over-ACP connection this message is sent on.", + ), + ] + # The inner MCP method name. + method: Annotated[str, Field(description="The inner MCP method name.")] + # Optional inner MCP params. + # + # If omitted or set to `null`, the inner MCP message has no params. + params: Annotated[ + Optional[Dict[str, Any]], + Field( + description="Optional inner MCP params.\n\nIf omitted or set to `null`, the inner MCP message has no params." + ), + ] = None + + +class MessageMcpRequest(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 + # The MCP-over-ACP connection this message is sent on. + connection_id: Annotated[ + str, + Field( + alias="connectionId", + description="The MCP-over-ACP connection this message is sent on.", + ), + ] + # The inner MCP method name. + method: Annotated[str, Field(description="The inner MCP method name.")] + # Optional inner MCP params. + # + # If omitted or set to `null`, the inner MCP message has no params. + params: Annotated[ + Optional[Dict[str, Any]], + Field( + description="Optional inner MCP params.\n\nIf omitted or set to `null`, the inner MCP message has no params." + ), + ] = None + + class ModelInfo(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 @@ -1331,6 +1425,21 @@ class SessionConfigBoolean(BaseModel): ] +class SessionDeleteCapabilities(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 + + class SessionForkCapabilities(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 @@ -1363,14 +1472,16 @@ class SessionInfo(BaseModel): # # This capability is not part of the spec yet, and may be removed or changed at any point. # - # Authoritative ordered additional workspace roots for this session. Each path must be absolute. + # Additional workspace roots reported for this session. Each path must be absolute. # - # When omitted or empty, there are no additional roots for the session. + # When present, this is the complete ordered additional-root list reported + # by the Agent. Omitted and empty values are equivalent: the response + # reports no additional roots. additional_directories: Annotated[ Optional[List[str]], Field( alias="additionalDirectories", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthoritative ordered additional workspace roots for this session. Each path must be absolute.\n\nWhen omitted or empty, there are no additional roots for the session.", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots reported for this session. Each path must be absolute.\n\nWhen present, this is the complete ordered additional-root list reported\nby the Agent. Omitted and empty values are equivalent: the response\nreports no additional roots.", ), ] = None # The working directory for this session. Must be an absolute path. @@ -1479,7 +1590,7 @@ class SessionInfoUpdate(_SessionInfoUpdate): session_update: Annotated[Literal["session_info_update"], Field(alias="sessionUpdate")] -class SetProvidersRequest(BaseModel): +class SetProviderRequest(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. @@ -1514,7 +1625,7 @@ class SetProvidersRequest(BaseModel): id: Annotated[str, Field(description="Provider id to configure.")] -class SetProvidersResponse(BaseModel): +class SetProviderResponse(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. @@ -2295,6 +2406,52 @@ class CompleteElicitationNotification(BaseModel): ] +class ConnectMcpRequest(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 + # The ACP MCP server ID that was provided by the component declaring the MCP server. + acp_id: Annotated[ + str, + Field( + alias="acpId", + description="The ACP MCP server ID that was provided by the component declaring the MCP server.", + ), + ] + + +class ConnectMcpResponse(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 + # The unique identifier for this MCP-over-ACP connection. + connection_id: Annotated[ + str, + Field( + alias="connectionId", + description="The unique identifier for this MCP-over-ACP connection.", + ), + ] + + class AudioContentBlock(AudioContent): type: Literal["audio"] @@ -2379,6 +2536,23 @@ class _CurrentModeUpdate(BaseModel): current_mode_id: Annotated[str, Field(alias="currentModeId", description="The ID of the current mode")] +class DeleteSessionRequest(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 + # The ID of the session to delete. + session_id: Annotated[str, Field(alias="sessionId", description="The ID of the session to delete.")] + + class DidChangeDocumentNotification(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 @@ -2520,6 +2694,26 @@ class DidSaveDocumentNotification(BaseModel): uri: Annotated[str, Field(description="The URI of the saved document.")] +class DisconnectMcpRequest(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 + # The MCP-over-ACP connection to close. + connection_id: Annotated[ + str, + Field(alias="connectionId", description="The MCP-over-ACP connection to close."), + ] + + class ElicitationCapabilities(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 @@ -2737,6 +2931,33 @@ class SseMcpServer(McpServerSse): type: Literal["sse"] +class McpServerAcp(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 + # Unique identifier for this MCP server, generated by the component providing it. + # + # Providers MUST NOT reuse an ID for multiple ACP-transport MCP servers that are visible + # on the same ACP connection. + id: Annotated[ + str, + Field( + description="Unique identifier for this MCP server, generated by the component providing it.\n\nProviders MUST NOT reuse an ID for multiple ACP-transport MCP servers that are visible\non the same ACP connection." + ), + ] + # Human-readable name identifying this MCP server. + name: Annotated[str, Field(description="Human-readable name identifying this MCP server.")] + + class MultiSelectPropertySchema(BaseModel): # Default selected values. default: Annotated[Optional[List[str]], Field(description="Default selected values.")] = None @@ -3004,50 +3225,6 @@ class NesUserAction(BaseModel): uri: Annotated[str, Field(description="The URI of the file where the action occurred.")] -class NewSessionRequest(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 - # **UNSTABLE** - # - # This capability is not part of the spec yet, and may be removed or changed at any point. - # - # Additional workspace roots for this session. Each path must be absolute. - # - # These expand the session's filesystem scope without changing `cwd`, which - # remains the base for relative paths. When omitted or empty, no - # additional roots are activated for the new session. - additional_directories: Annotated[ - Optional[List[str]], - Field( - alias="additionalDirectories", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots for this session. Each path must be absolute.\n\nThese expand the session's filesystem scope without changing `cwd`, which\nremains the base for relative paths. When omitted or empty, no\nadditional roots are activated for the new session.", - ), - ] = None - # The working directory for this session. Must be an absolute path. - cwd: Annotated[ - str, - Field(description="The working directory for this session. Must be an absolute path."), - ] - # List of MCP (Model Context Protocol) servers the agent should connect to. - mcp_servers: Annotated[ - List[Union[HttpMcpServer, SseMcpServer, McpServerStdio]], - Field( - alias="mcpServers", - description="List of MCP (Model Context Protocol) servers the agent should connect to.", - ), - ] - - class PermissionOption(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 @@ -3273,7 +3450,7 @@ class ResourceLink(BaseModel): uri: str -class ResumeSessionRequest(BaseModel): +class SessionCapabilities(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. @@ -3290,62 +3467,37 @@ class ResumeSessionRequest(BaseModel): # # This capability is not part of the spec yet, and may be removed or changed at any point. # - # Additional workspace roots to activate for this session. Each path must be absolute. + # Whether the agent supports `additionalDirectories` on supported session lifecycle requests. # - # When omitted or empty, no additional roots are activated. When non-empty, - # this is the complete resulting additional-root list for the resumed - # session. + # Agents that also support `session/list` may return + # `SessionInfo.additionalDirectories` to report the complete ordered + # additional-root list associated with a listed session. additional_directories: Annotated[ - Optional[List[str]], + Optional[SessionAdditionalDirectoriesCapabilities], Field( alias="additionalDirectories", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the resumed\nsession.", - ), - ] = None - # The working directory for this session. - cwd: Annotated[str, Field(description="The working directory for this session.")] - # List of MCP servers to connect to for this session. - mcp_servers: Annotated[ - Optional[List[Union[HttpMcpServer, SseMcpServer, McpServerStdio]]], - Field( - alias="mcpServers", - description="List of MCP servers to connect to for this session.", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `additionalDirectories` on supported session lifecycle requests.\n\nAgents that also support `session/list` may return\n`SessionInfo.additionalDirectories` to report the complete ordered\nadditional-root list associated with a listed session.", ), ] = None - # The ID of the session to resume. - session_id: Annotated[str, Field(alias="sessionId", description="The ID of the session to resume.")] - - -class SessionCapabilities(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)", - ), + # Whether the agent supports `session/close`. + close: Annotated[ + Optional[SessionCloseCapabilities], + Field(description="Whether the agent supports `session/close`."), ] = None # **UNSTABLE** # # This capability is not part of the spec yet, and may be removed or changed at any point. # - # Whether the agent supports `additionalDirectories` on supported session lifecycle requests and `session/list`. - additional_directories: Annotated[ - Optional[SessionAdditionalDirectoriesCapabilities], + # Whether the agent supports `session/delete`. + # + # Optional. Omitted or `null` both mean the agent does not advertise support. + # Supplying `{}` means the agent supports deleting sessions from `session/list`. + delete: Annotated[ + Optional[SessionDeleteCapabilities], Field( - alias="additionalDirectories", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `additionalDirectories` on supported session lifecycle requests and `session/list`.", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/delete`.\n\nOptional. Omitted or `null` both mean the agent does not advertise support.\nSupplying `{}` means the agent supports deleting sessions from `session/list`." ), ] = None - # Whether the agent supports `session/close`. - close: Annotated[ - Optional[SessionCloseCapabilities], - Field(description="Whether the agent supports `session/close`."), - ] = None # **UNSTABLE** # # This capability is not part of the spec yet, and may be removed or changed at any point. @@ -3526,17 +3678,17 @@ class AgentErrorMessage(BaseModel): error: Error # JSON RPC Request Id # - # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2] + # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \[1\] and Numbers SHOULD NOT contain fractional parts \[2\] # # The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects. # - # [1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. + # \[1\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. # - # [2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. + # \[2\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. id: Annotated[ Optional[Union[int, str]], Field( - description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." + description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \\[1\\] and Numbers SHOULD NOT contain fractional parts \\[2\\]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n\\[1\\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n\\[2\\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." ), ] = None @@ -3676,6 +3828,7 @@ class ClientNotification(BaseModel): DidFocusDocumentNotification, AcceptNesNotification, RejectNesNotification, + MessageMcpNotification, Any, ] ] = None @@ -3684,17 +3837,17 @@ class ClientNotification(BaseModel): class ClientResponseMessage(BaseModel): # JSON RPC Request Id # - # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2] + # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \[1\] and Numbers SHOULD NOT contain fractional parts \[2\] # # The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects. # - # [1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. + # \[1\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. # - # [2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. + # \[2\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. id: Annotated[ Optional[Union[int, str]], Field( - description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." + description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \\[1\\] and Numbers SHOULD NOT contain fractional parts \\[2\\]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n\\[1\\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n\\[2\\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." ), ] = None # All possible responses that a client can send to an agent. @@ -3713,6 +3866,8 @@ class ClientResponseMessage(BaseModel): ReleaseTerminalResponse, WaitForTerminalExitResponse, KillTerminalResponse, + ConnectMcpResponse, + DisconnectMcpResponse, Union[ AcceptElicitationResponse, DeclineElicitationResponse, @@ -3730,17 +3885,17 @@ class ClientErrorMessage(BaseModel): error: Error # JSON RPC Request Id # - # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2] + # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \[1\] and Numbers SHOULD NOT contain fractional parts \[2\] # # The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects. # - # [1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. + # \[1\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. # - # [2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. + # \[2\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. id: Annotated[ Optional[Union[int, str]], Field( - description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." + description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \\[1\\] and Numbers SHOULD NOT contain fractional parts \\[2\\]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n\\[1\\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n\\[2\\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." ), ] = None @@ -3837,49 +3992,6 @@ class EmbeddedResource(BaseModel): ] -class ForkSessionRequest(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 - # **UNSTABLE** - # - # This capability is not part of the spec yet, and may be removed or changed at any point. - # - # Additional workspace roots to activate for this session. Each path must be absolute. - # - # When omitted or empty, no additional roots are activated. When non-empty, - # this is the complete resulting additional-root list for the forked - # session. - additional_directories: Annotated[ - Optional[List[str]], - Field( - alias="additionalDirectories", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the forked\nsession.", - ), - ] = None - # The working directory for this session. - cwd: Annotated[str, Field(description="The working directory for this session.")] - # List of MCP servers to connect to for this session. - mcp_servers: Annotated[ - Optional[List[Union[HttpMcpServer, SseMcpServer, McpServerStdio]]], - Field( - alias="mcpServers", - description="List of MCP servers to connect to for this session.", - ), - ] = None - # The ID of the session to fork. - session_id: Annotated[str, Field(alias="sessionId", description="The ID of the session to fork.")] - - class InitializeRequest(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 @@ -3937,47 +4049,8 @@ def _coerce_protocol_version(cls, value: Any) -> int: return 1 -class LoadSessionRequest(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 - # **UNSTABLE** - # - # This capability is not part of the spec yet, and may be removed or changed at any point. - # - # Additional workspace roots to activate for this session. Each path must be absolute. - # - # When omitted or empty, no additional roots are activated. When non-empty, - # this is the complete resulting additional-root list for the loaded - # session. - additional_directories: Annotated[ - Optional[List[str]], - Field( - alias="additionalDirectories", - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the loaded\nsession.", - ), - ] = None - # The working directory for this session. - cwd: Annotated[str, Field(description="The working directory for this session.")] - # List of MCP servers to connect to for this session. - mcp_servers: Annotated[ - List[Union[HttpMcpServer, SseMcpServer, McpServerStdio]], - Field( - alias="mcpServers", - description="List of MCP servers to connect to for this session.", - ), - ] - # The ID of the session to load. - session_id: Annotated[str, Field(alias="sessionId", description="The ID of the session to load.")] +class AcpMcpServer(McpServerAcp): + type: Literal["acp"] class NesCapabilities(BaseModel): @@ -4074,6 +4147,50 @@ class NesEditSuggestionVariant(NesEditSuggestion): kind: Literal["edit"] +class NewSessionRequest(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 + # **UNSTABLE** + # + # This capability is not part of the spec yet, and may be removed or changed at any point. + # + # Additional workspace roots for this session. Each path must be absolute. + # + # These expand the session's filesystem scope without changing `cwd`, which + # remains the base for relative paths. When omitted or empty, no + # additional roots are activated for the new session. + additional_directories: Annotated[ + Optional[List[str]], + Field( + alias="additionalDirectories", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots for this session. Each path must be absolute.\n\nThese expand the session's filesystem scope without changing `cwd`, which\nremains the base for relative paths. When omitted or empty, no\nadditional roots are activated for the new session.", + ), + ] = None + # The working directory for this session. Must be an absolute path. + cwd: Annotated[ + str, + Field(description="The working directory for this session. Must be an absolute path."), + ] + # List of MCP (Model Context Protocol) servers the agent should connect to. + mcp_servers: Annotated[ + List[Union[HttpMcpServer, SseMcpServer, AcpMcpServer, McpServerStdio]], + Field( + alias="mcpServers", + description="List of MCP (Model Context Protocol) servers the agent should connect to.", + ), + ] + + class Plan(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 @@ -4099,6 +4216,50 @@ class Plan(BaseModel): ] +class ResumeSessionRequest(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 + # **UNSTABLE** + # + # This capability is not part of the spec yet, and may be removed or changed at any point. + # + # Additional workspace roots to activate for this session. Each path must be absolute. + # + # When omitted or empty, no additional roots are activated. When non-empty, + # this is the complete resulting additional-root list for the resumed + # session. It may differ from any previously used or reported list as long as + # the request `cwd` matches the session's `cwd`. + additional_directories: Annotated[ + Optional[List[str]], + Field( + alias="additionalDirectories", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the resumed\nsession. It may differ from any previously used or reported list as long as\nthe request `cwd` matches the session's `cwd`.", + ), + ] = None + # The working directory for this session. + cwd: Annotated[str, Field(description="The working directory for this session.")] + # List of MCP servers to connect to for this session. + mcp_servers: Annotated[ + Optional[List[Union[HttpMcpServer, SseMcpServer, AcpMcpServer, McpServerStdio]]], + Field( + alias="mcpServers", + description="List of MCP servers to connect to for this session.", + ), + ] = None + # The ID of the session to resume. + session_id: Annotated[str, Field(alias="sessionId", description="The ID of the session to resume.")] + + class SessionConfigSelectGroup(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 @@ -4206,16 +4367,10 @@ class AgentCapabilities(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. - # # Authentication-related capabilities supported by the agent. auth: Annotated[ Optional[AgentAuthCapabilities], - Field( - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication-related capabilities supported by the agent." - ), + Field(description="Authentication-related capabilities supported by the agent."), ] = {} # Whether the agent supports `session/load`. load_session: Annotated[ @@ -4360,6 +4515,49 @@ class ElicitationFormMode(RootModel[Union[ElicitationFormSessionMode, Elicitatio ] +class ForkSessionRequest(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 + # **UNSTABLE** + # + # This capability is not part of the spec yet, and may be removed or changed at any point. + # + # Additional workspace roots to activate for this session. Each path must be absolute. + # + # When omitted or empty, no additional roots are activated. When non-empty, + # this is the complete resulting additional-root list for the forked + # session. + additional_directories: Annotated[ + Optional[List[str]], + Field( + alias="additionalDirectories", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the forked\nsession.", + ), + ] = None + # The working directory for this session. + cwd: Annotated[str, Field(description="The working directory for this session.")] + # List of MCP servers to connect to for this session. + mcp_servers: Annotated[ + Optional[List[Union[HttpMcpServer, SseMcpServer, AcpMcpServer, McpServerStdio]]], + Field( + alias="mcpServers", + description="List of MCP servers to connect to for this session.", + ), + ] = None + # The ID of the session to fork. + session_id: Annotated[str, Field(alias="sessionId", description="The ID of the session to fork.")] + + class InitializeResponse(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 @@ -4414,6 +4612,50 @@ class InitializeResponse(BaseModel): ] +class LoadSessionRequest(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 + # **UNSTABLE** + # + # This capability is not part of the spec yet, and may be removed or changed at any point. + # + # Additional workspace roots to activate for this session. Each path must be absolute. + # + # When omitted or empty, no additional roots are activated. When non-empty, + # this is the complete resulting additional-root list for the loaded + # session. It may differ from any previously used or reported list as long as + # the request `cwd` matches the session's `cwd`. + additional_directories: Annotated[ + Optional[List[str]], + Field( + alias="additionalDirectories", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdditional workspace roots to activate for this session. Each path must be absolute.\n\nWhen omitted or empty, no additional roots are activated. When non-empty,\nthis is the complete resulting additional-root list for the loaded\nsession. It may differ from any previously used or reported list as long as\nthe request `cwd` matches the session's `cwd`.", + ), + ] = None + # The working directory for this session. + cwd: Annotated[str, Field(description="The working directory for this session.")] + # List of MCP servers to connect to for this session. + mcp_servers: Annotated[ + List[Union[HttpMcpServer, SseMcpServer, AcpMcpServer, McpServerStdio]], + Field( + alias="mcpServers", + description="List of MCP servers to connect to for this session.", + ), + ] + # The ID of the session to load. + session_id: Annotated[str, Field(alias="sessionId", description="The ID of the session to load.")] + + class PromptRequest(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 @@ -4505,17 +4747,17 @@ class AgentThoughtChunk(ContentChunk): class ClientRequest(BaseModel): # JSON RPC Request Id # - # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2] + # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \[1\] and Numbers SHOULD NOT contain fractional parts \[2\] # # The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects. # - # [1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. + # \[1\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. # - # [2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. + # \[2\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. id: Annotated[ Optional[Union[int, str]], Field( - description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." + description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \\[1\\] and Numbers SHOULD NOT contain fractional parts \\[2\\]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n\\[1\\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n\\[2\\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." ), ] = None method: str @@ -4524,12 +4766,13 @@ class ClientRequest(BaseModel): InitializeRequest, AuthenticateRequest, ListProvidersRequest, - SetProvidersRequest, - DisableProvidersRequest, + SetProviderRequest, + DisableProviderRequest, LogoutRequest, NewSessionRequest, LoadSessionRequest, ListSessionsRequest, + DeleteSessionRequest, ForkSessionRequest, ResumeSessionRequest, CloseSessionRequest, @@ -4539,6 +4782,7 @@ class ClientRequest(BaseModel): StartNesRequest, SuggestNesRequest, CloseNesRequest, + MessageMcpRequest, Union[SetSessionConfigOptionBooleanRequest, SetSessionConfigOptionSelectRequest], Any, ] @@ -4998,17 +5242,17 @@ class ToolCall(BaseModel): class AgentRequest(BaseModel): # JSON RPC Request Id # - # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2] + # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \[1\] and Numbers SHOULD NOT contain fractional parts \[2\] # # The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects. # - # [1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. + # \[1\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. # - # [2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. + # \[2\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. id: Annotated[ Optional[Union[int, str]], Field( - description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." + description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \\[1\\] and Numbers SHOULD NOT contain fractional parts \\[2\\]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n\\[1\\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n\\[2\\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." ), ] = None method: str @@ -5022,6 +5266,9 @@ class AgentRequest(BaseModel): ReleaseTerminalRequest, WaitForTerminalExitRequest, KillTerminalRequest, + ConnectMcpRequest, + MessageMcpRequest, + DisconnectMcpRequest, Union[CreateFormElicitationRequest, CreateUrlElicitationRequest], Any, ] @@ -5031,17 +5278,17 @@ class AgentRequest(BaseModel): class AgentResponseMessage(BaseModel): # JSON RPC Request Id # - # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2] + # An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \[1\] and Numbers SHOULD NOT contain fractional parts \[2\] # # The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects. # - # [1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. + # \[1\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling. # - # [2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. + # \[2\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions. id: Annotated[ Optional[Union[int, str]], Field( - description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." + description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \\[1\\] and Numbers SHOULD NOT contain fractional parts \\[2\\]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n\\[1\\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n\\[2\\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions." ), ] = None # All possible responses that an agent can send to a client. @@ -5055,12 +5302,13 @@ class AgentResponseMessage(BaseModel): InitializeResponse, AuthenticateResponse, ListProvidersResponse, - SetProvidersResponse, - DisableProvidersResponse, + SetProviderResponse, + DisableProviderResponse, LogoutResponse, NewSessionResponse, LoadSessionResponse, ListSessionsResponse, + DeleteSessionResponse, ForkSessionResponse, ResumeSessionResponse, CloseSessionResponse, @@ -5129,4 +5377,11 @@ class SessionNotification(BaseModel): class AgentNotification(BaseModel): method: str - params: Optional[Union[SessionNotification, CompleteElicitationNotification, Any]] = None + params: Optional[ + Union[ + SessionNotification, + CompleteElicitationNotification, + MessageMcpNotification, + Any, + ] + ] = None diff --git a/tests/test_rpc.py b/tests/test_rpc.py index be5e06c..528fb87 100644 --- a/tests/test_rpc.py +++ b/tests/test_rpc.py @@ -377,12 +377,11 @@ async def load_session( async def list_sessions( self, - additional_directories: list[str] | None = None, cursor: str | None = None, cwd: str | None = None, **kwargs: Any, ) -> ListSessionsResponse: - self.calls["list"] = additional_directories + self.calls["list"] = None return ListSessionsResponse(sessions=[]) async def fork_session( @@ -425,14 +424,14 @@ async def resume_session( await client_side.new_session(cwd="/workspace", additional_directories=directories) await client_side.load_session(cwd="/workspace", session_id="sess", additional_directories=directories) - await client_side.list_sessions(cwd="/workspace", additional_directories=directories) + await client_side.list_sessions(cwd="/workspace") await client_side.fork_session(cwd="/workspace", session_id="sess", additional_directories=directories) await client_side.resume_session(cwd="/workspace", session_id="sess", additional_directories=directories) assert agent.calls == { "new": directories, "load": directories, - "list": directories, + "list": None, "fork": directories, "resume": directories, } diff --git a/uv.lock b/uv.lock index c5f8a66..57d5a91 100644 --- a/uv.lock +++ b/uv.lock @@ -4,7 +4,7 @@ requires-python = ">=3.10, <3.15" [[package]] name = "agent-client-protocol" -version = "0.10.1" +version = "0.11.0" source = { editable = "." } dependencies = [ { name = "pydantic" },