From 577a3c5406cac0004aa95e1fed08639162ab4093 Mon Sep 17 00:00:00 2001 From: Richard Chien Date: Thu, 25 Dec 2025 13:58:59 +0800 Subject: [PATCH 1/2] feat: bump acp schema version to 0.10.5 Signed-off-by: Richard Chien --- schema/VERSION | 2 +- schema/meta.json | 1 + schema/schema.json | 356 ++++++++++++++++++++ scripts/gen_schema.py | 3 +- src/acp/agent/connection.py | 2 + src/acp/interfaces.py | 2 + src/acp/meta.py | 3 +- src/acp/schema.py | 655 ++++++++++++++++++++++++------------ 8 files changed, 807 insertions(+), 217 deletions(-) diff --git a/schema/VERSION b/schema/VERSION index babc878..801f529 100644 --- a/schema/VERSION +++ b/schema/VERSION @@ -1 +1 @@ -refs/tags/v0.10.3 +refs/tags/v0.10.5 diff --git a/schema/meta.json b/schema/meta.json index e58853e..507c21d 100644 --- a/schema/meta.json +++ b/schema/meta.json @@ -9,6 +9,7 @@ "session_new": "session/new", "session_prompt": "session/prompt", "session_resume": "session/resume", + "session_set_config_option": "session/set_config_option", "session_set_mode": "session/set_mode", "session_set_model": "session/set_model" }, diff --git a/schema/schema.json b/schema/schema.json index 9d1f974..4f45ef0 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -225,6 +225,9 @@ { "$ref": "#/$defs/SetSessionModeResponse" }, + { + "$ref": "#/$defs/SetSessionConfigOptionResponse" + }, { "$ref": "#/$defs/PromptResponse" }, @@ -709,6 +712,14 @@ ], "description": "Sets the current mode for a session.\n\nAllows switching between different agent modes (e.g., \"ask\", \"architect\", \"code\")\nthat affect system prompts, tool availability, and permission behaviors.\n\nThe mode must be one of the modes advertised in `availableModes` during session\ncreation or loading. Agents may also change modes autonomously and notify the\nclient via `current_mode_update` notifications.\n\nThis method can be called at any time during a session, whether the Agent is\nidle or actively generating a response.\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" }, + { + "allOf": [ + { + "$ref": "#/$defs/SetSessionConfigOptionRequest" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSets the current value for a session configuration option." + }, { "allOf": [ { @@ -813,6 +824,30 @@ ], "x-docs-ignore": true }, + "ConfigOptionUpdate": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSession configuration options have been updated.", + "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" + ] + }, + "configOptions": { + "description": "The full set of configuration options and their current values.", + "items": { + "$ref": "#/$defs/SessionConfigOption" + }, + "type": "array" + } + }, + "required": [ + "configOptions" + ], + "type": "object" + }, "Content": { "description": "Standard content block (text, images, resources).", "properties": { @@ -1337,6 +1372,16 @@ "null" ] }, + "configOptions": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + "items": { + "$ref": "#/$defs/SessionConfigOption" + }, + "type": [ + "array", + "null" + ] + }, "models": { "anyOf": [ { @@ -1756,6 +1801,16 @@ "null" ] }, + "configOptions": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + "items": { + "$ref": "#/$defs/SessionConfigOption" + }, + "type": [ + "array", + "null" + ] + }, "models": { "anyOf": [ { @@ -2049,6 +2104,16 @@ "null" ] }, + "configOptions": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + "items": { + "$ref": "#/$defs/SessionConfigOption" + }, + "type": [ + "array", + "null" + ] + }, "models": { "anyOf": [ { @@ -2710,6 +2775,16 @@ "null" ] }, + "configOptions": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + "items": { + "$ref": "#/$defs/SessionConfigOption" + }, + "type": [ + "array", + "null" + ] + }, "models": { "anyOf": [ { @@ -2817,6 +2892,198 @@ }, "type": "object" }, + "SessionConfigGroupId": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for a session configuration option value group.", + "type": "string" + }, + "SessionConfigId": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for a session configuration option.", + "type": "string" + }, + "SessionConfigOption": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA session configuration option selector and its current state.", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "allOf": [ + { + "$ref": "#/$defs/SessionConfigSelect" + } + ], + "description": "Single-value selector (dropdown).", + "properties": { + "type": { + "const": "select", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "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" + ] + }, + "description": { + "description": "Optional description for the Client to display to the user.", + "type": [ + "string", + "null" + ] + }, + "id": { + "allOf": [ + { + "$ref": "#/$defs/SessionConfigId" + } + ], + "description": "Unique identifier for the configuration option." + }, + "name": { + "description": "Human-readable label for the option.", + "type": "string" + } + }, + "required": [ + "id", + "name" + ], + "type": "object" + }, + "SessionConfigSelect": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA single-value selector (dropdown) session configuration option payload.", + "properties": { + "currentValue": { + "allOf": [ + { + "$ref": "#/$defs/SessionConfigValueId" + } + ], + "description": "The currently selected value." + }, + "options": { + "allOf": [ + { + "$ref": "#/$defs/SessionConfigSelectOptions" + } + ], + "description": "The set of selectable options." + } + }, + "required": [ + "currentValue", + "options" + ], + "type": "object" + }, + "SessionConfigSelectGroup": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA group of possible values for a session configuration option.", + "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" + ] + }, + "group": { + "allOf": [ + { + "$ref": "#/$defs/SessionConfigGroupId" + } + ], + "description": "Unique identifier for this group." + }, + "name": { + "description": "Human-readable label for this group.", + "type": "string" + }, + "options": { + "description": "The set of option values in this group.", + "items": { + "$ref": "#/$defs/SessionConfigSelectOption" + }, + "type": "array" + } + }, + "required": [ + "group", + "name", + "options" + ], + "type": "object" + }, + "SessionConfigSelectOption": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA possible value for a session configuration option.", + "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" + ] + }, + "description": { + "description": "Optional description for this option value.", + "type": [ + "string", + "null" + ] + }, + "name": { + "description": "Human-readable label for this option value.", + "type": "string" + }, + "value": { + "allOf": [ + { + "$ref": "#/$defs/SessionConfigValueId" + } + ], + "description": "Unique identifier for this option value." + } + }, + "required": [ + "value", + "name" + ], + "type": "object" + }, + "SessionConfigSelectOptions": { + "anyOf": [ + { + "description": "A flat list of options with no grouping.", + "items": { + "$ref": "#/$defs/SessionConfigSelectOption" + }, + "type": "array" + }, + { + "description": "A list of options grouped under headers.", + "items": { + "$ref": "#/$defs/SessionConfigSelectGroup" + }, + "type": "array" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nPossible values for a session configuration option." + }, + "SessionConfigValueId": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for a session configuration option value.", + "type": "string" + }, "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": { @@ -3221,6 +3488,24 @@ ], "type": "object" }, + { + "allOf": [ + { + "$ref": "#/$defs/ConfigOptionUpdate" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSession configuration options have been updated.", + "properties": { + "sessionUpdate": { + "const": "config_option_update", + "type": "string" + } + }, + "required": [ + "sessionUpdate" + ], + "type": "object" + }, { "allOf": [ { @@ -3241,6 +3526,77 @@ } ] }, + "SetSessionConfigOptionRequest": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for setting a session configuration option.", + "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" + ] + }, + "configId": { + "allOf": [ + { + "$ref": "#/$defs/SessionConfigId" + } + ], + "description": "The ID of the configuration option to set." + }, + "sessionId": { + "allOf": [ + { + "$ref": "#/$defs/SessionId" + } + ], + "description": "The ID of the session to set the configuration option for." + }, + "value": { + "allOf": [ + { + "$ref": "#/$defs/SessionConfigValueId" + } + ], + "description": "The ID of the configuration option value to set." + } + }, + "required": [ + "sessionId", + "configId", + "value" + ], + "type": "object", + "x-method": "session/set_config_option", + "x-side": "agent" + }, + "SetSessionConfigOptionResponse": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `session/set_config_option` method.", + "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" + ] + }, + "configOptions": { + "description": "The full set of configuration options and their current values.", + "items": { + "$ref": "#/$defs/SessionConfigOption" + }, + "type": "array" + } + }, + "required": [ + "configOptions" + ], + "type": "object", + "x-method": "session/set_config_option", + "x-side": "agent" + }, "SetSessionModeRequest": { "description": "Request parameters for setting a session mode.", "properties": { diff --git a/scripts/gen_schema.py b/scripts/gen_schema.py index 2a951a2..dde5724 100644 --- a/scripts/gen_schema.py +++ b/scripts/gen_schema.py @@ -61,7 +61,8 @@ "SessionUpdate6": "AgentPlanUpdate", "SessionUpdate7": "AvailableCommandsUpdate", "SessionUpdate8": "CurrentModeUpdate", - "SessionUpdate9": "SessionInfoUpdate", + "SessionUpdate9": "ConfigOptionUpdate", + "SessionUpdate10": "SessionInfoUpdate", "ToolCallContent1": "ContentToolCallContent", "ToolCallContent2": "FileEditToolCallContent", "ToolCallContent3": "TerminalToolCallContent", diff --git a/src/acp/agent/connection.py b/src/acp/agent/connection.py index 587ad43..9fc55f2 100644 --- a/src/acp/agent/connection.py +++ b/src/acp/agent/connection.py @@ -12,6 +12,7 @@ AgentPlanUpdate, AgentThoughtChunk, AvailableCommandsUpdate, + ConfigOptionUpdate, CreateTerminalRequest, CreateTerminalResponse, CurrentModeUpdate, @@ -85,6 +86,7 @@ async def session_update( | AgentPlanUpdate | AvailableCommandsUpdate | CurrentModeUpdate + | ConfigOptionUpdate | SessionInfoUpdate, **kwargs: Any, ) -> None: diff --git a/src/acp/interfaces.py b/src/acp/interfaces.py index 74c2fe5..6d143fe 100644 --- a/src/acp/interfaces.py +++ b/src/acp/interfaces.py @@ -12,6 +12,7 @@ AvailableCommandsUpdate, CancelNotification, ClientCapabilities, + ConfigOptionUpdate, CreateTerminalRequest, CreateTerminalResponse, CurrentModeUpdate, @@ -88,6 +89,7 @@ async def session_update( | AgentPlanUpdate | AvailableCommandsUpdate | CurrentModeUpdate + | ConfigOptionUpdate | SessionInfoUpdate, **kwargs: Any, ) -> None: ... diff --git a/src/acp/meta.py b/src/acp/meta.py index d5512a1..142f2f1 100644 --- a/src/acp/meta.py +++ b/src/acp/meta.py @@ -1,5 +1,5 @@ # Generated from schema/meta.json. Do not edit by hand. -# Schema ref: refs/tags/v0.10.3 +# Schema ref: refs/tags/v0.10.5 AGENT_METHODS = { "authenticate": "authenticate", "initialize": "initialize", @@ -10,6 +10,7 @@ "session_new": "session/new", "session_prompt": "session/prompt", "session_resume": "session/resume", + "session_set_config_option": "session/set_config_option", "session_set_mode": "session/set_mode", "session_set_model": "session/set_model", } diff --git a/src/acp/schema.py b/src/acp/schema.py index aaa7c6a..663a3f2 100644 --- a/src/acp/schema.py +++ b/src/acp/schema.py @@ -1,5 +1,5 @@ # Generated from schema/schema.json. Do not edit by hand. -# Schema ref: refs/tags/v0.10.3 +# Schema ref: refs/tags/v0.10.5 from __future__ import annotations @@ -651,6 +651,36 @@ class SessionInfoUpdate(_SessionInfoUpdate): session_update: Annotated[Literal["session_info_update"], Field(alias="sessionUpdate")] +class SetSessionConfigOptionRequest(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 configuration option to set. + config_id: Annotated[ + str, + Field(alias="configId", description="The ID of the configuration option to set."), + ] + # The ID of the session to set the configuration option for. + session_id: Annotated[ + str, + Field( + alias="sessionId", + description="The ID of the session to set the configuration option for.", + ), + ] + # The ID of the configuration option value to set. + value: Annotated[str, Field(description="The ID of the configuration option value to set.")] + + class SetSessionModeRequest(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 @@ -1564,6 +1594,27 @@ class SessionCapabilities(BaseModel): ] = None +class SessionConfigSelectOption(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 + # Optional description for this option value. + description: Annotated[Optional[str], Field(description="Optional description for this option value.")] = None + # Human-readable label for this option value. + name: Annotated[str, Field(description="Human-readable label for this option value.")] + # Unique identifier for this option value. + value: Annotated[str, Field(description="Unique identifier for this option value.")] + + class SessionMode(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 @@ -1863,49 +1914,6 @@ class ForkSessionRequest(BaseModel): session_id: Annotated[str, Field(alias="sessionId", description="The ID of the session to fork.")] -class ForkSessionResponse(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. - # - # Initial model state if supported by the Agent - models: Annotated[ - Optional[SessionModelState], - Field( - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent" - ), - ] = None - # Initial mode state if supported by the Agent - # - # See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) - modes: Annotated[ - Optional[SessionModeState], - Field( - description="Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" - ), - ] = None - # Unique identifier for the newly created forked session. - session_id: Annotated[ - str, - Field( - alias="sessionId", - description="Unique identifier for the newly created forked session.", - ), - ] - - 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 @@ -1987,86 +1995,6 @@ class LoadSessionRequest(BaseModel): session_id: Annotated[str, Field(alias="sessionId", description="The ID of the session to load.")] -class LoadSessionResponse(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. - # - # Initial model state if supported by the Agent - models: Annotated[ - Optional[SessionModelState], - Field( - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent" - ), - ] = None - # Initial mode state if supported by the Agent - # - # See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) - modes: Annotated[ - Optional[SessionModeState], - Field( - description="Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" - ), - ] = None - - -class NewSessionResponse(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. - # - # Initial model state if supported by the Agent - models: Annotated[ - Optional[SessionModelState], - Field( - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent" - ), - ] = None - # Initial mode state if supported by the Agent - # - # See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) - modes: Annotated[ - Optional[SessionModeState], - Field( - description="Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" - ), - ] = None - # Unique identifier for the created session. - # - # Used in all subsequent requests for this conversation. - session_id: Annotated[ - str, - Field( - alias="sessionId", - description="Unique identifier for the created session.\n\nUsed in all subsequent requests for this conversation.", - ), - ] - - 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 @@ -2092,7 +2020,7 @@ class Plan(BaseModel): ] -class ResumeSessionResponse(BaseModel): +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 # these keys. @@ -2105,26 +2033,15 @@ class ResumeSessionResponse(BaseModel): description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", ), ] = None - # **UNSTABLE** - # - # This capability is not part of the spec yet, and may be removed or changed at any point. - # - # Initial model state if supported by the Agent - models: Annotated[ - Optional[SessionModelState], - Field( - description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent" - ), - ] = None - # Initial mode state if supported by the Agent - # - # See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) - modes: Annotated[ - Optional[SessionModeState], - Field( - description="Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" - ), - ] = None + # Unique identifier for this group. + group: Annotated[str, Field(description="Unique identifier for this group.")] + # Human-readable label for this group. + name: Annotated[str, Field(description="Human-readable label for this group.")] + # The set of option values in this group. + options: Annotated[ + List[SessionConfigSelectOption], + Field(description="The set of option values in this group."), + ] class AgentPlanUpdate(Plan): @@ -2135,52 +2052,6 @@ class AvailableCommandsUpdate(_AvailableCommandsUpdate): session_update: Annotated[Literal["available_commands_update"], Field(alias="sessionUpdate")] -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] - # - # 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. - # - # [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." - ), - ] = None - # All possible responses that an agent can send to a client. - # - # This enum is used internally for routing RPC responses. You typically won't need - # to use this directly - the responses are handled automatically by the connection. - # - # These are responses to the corresponding `ClientRequest` variants. - result: Annotated[ - Union[ - InitializeResponse, - AuthenticateResponse, - NewSessionResponse, - LoadSessionResponse, - ListSessionsResponse, - ForkSessionResponse, - ResumeSessionResponse, - SetSessionModeResponse, - PromptResponse, - SetSessionModelResponse, - Any, - ], - Field( - 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." - ), - ] - - -class AgentResponse(RootModel[Union[AgentResponseMessage, AgentErrorMessage]]): - root: Union[AgentResponseMessage, AgentErrorMessage] - - class EmbeddedResourceContentBlock(EmbeddedResource): type: Literal["resource"] @@ -2257,6 +2128,16 @@ class PromptRequest(BaseModel): ] +class SessionConfigSelect(BaseModel): + # The currently selected value. + current_value: Annotated[str, Field(alias="currentValue", description="The currently selected value.")] + # The set of selectable options. + options: Annotated[ + Union[List[SessionConfigSelectOption], List[SessionConfigSelectGroup]], + Field(description="The set of selectable options."), + ] + + class UserMessageChunk(ContentChunk): session_update: Annotated[Literal["user_message_chunk"], Field(alias="sessionUpdate")] @@ -2296,6 +2177,7 @@ class ClientRequest(BaseModel): ForkSessionRequest, ResumeSessionRequest, SetSessionModeRequest, + SetSessionConfigOptionRequest, PromptRequest, SetSessionModelRequest, Any, @@ -2325,11 +2207,7 @@ class Content(BaseModel): ] -class ContentToolCallContent(Content): - type: Literal["content"] - - -class ToolCallUpdate(BaseModel): +class SessionConfigOption1(SessionConfigSelect): # 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. @@ -2342,24 +2220,91 @@ class ToolCallUpdate(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 - # Replace the content collection. - content: Annotated[ - Optional[List[Union[ContentToolCallContent, FileEditToolCallContent, TerminalToolCallContent]]], - Field(description="Replace the content collection."), - ] = None - # Update the tool kind. - kind: Annotated[Optional[ToolKind], Field(description="Update the tool kind.")] = None - # Replace the locations collection. - locations: Annotated[ - Optional[List[ToolCallLocation]], - Field(description="Replace the locations collection."), + # Optional description for the Client to display to the user. + description: Annotated[ + Optional[str], + Field(description="Optional description for the Client to display to the user."), ] = None - # Update the raw input. - raw_input: Annotated[Optional[Any], Field(alias="rawInput", description="Update the raw input.")] = None - # Update the raw output. - raw_output: Annotated[Optional[Any], Field(alias="rawOutput", description="Update the raw output.")] = None - # Update the execution status. - status: Annotated[Optional[ToolCallStatus], Field(description="Update the execution status.")] = None + # Unique identifier for the configuration option. + id: Annotated[str, Field(description="Unique identifier for the configuration option.")] + # Human-readable label for the option. + name: Annotated[str, Field(description="Human-readable label for the option.")] + type: Literal["select"] + + +class SessionConfigOption(RootModel[SessionConfigOption1]): + # **UNSTABLE** + # + # This capability is not part of the spec yet, and may be removed or changed at any point. + # + # A session configuration option selector and its current state. + root: Annotated[ + SessionConfigOption1, + Field( + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA session configuration option selector and its current state.", + discriminator="type", + ), + ] + + +class SetSessionConfigOptionResponse(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 full set of configuration options and their current values. + config_options: Annotated[ + List[SessionConfigOption], + Field( + alias="configOptions", + description="The full set of configuration options and their current values.", + ), + ] + + +class ContentToolCallContent(Content): + type: Literal["content"] + + +class ToolCallUpdate(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 + # Replace the content collection. + content: Annotated[ + Optional[List[Union[ContentToolCallContent, FileEditToolCallContent, TerminalToolCallContent]]], + Field(description="Replace the content collection."), + ] = None + # Update the tool kind. + kind: Annotated[Optional[ToolKind], Field(description="Update the tool kind.")] = None + # Replace the locations collection. + locations: Annotated[ + Optional[List[ToolCallLocation]], + Field(description="Replace the locations collection."), + ] = None + # Update the raw input. + raw_input: Annotated[Optional[Any], Field(alias="rawInput", description="Update the raw input.")] = None + # Update the raw output. + raw_output: Annotated[Optional[Any], Field(alias="rawOutput", description="Update the raw output.")] = None + # Update the execution status. + status: Annotated[Optional[ToolCallStatus], Field(description="Update the execution status.")] = None # Update the human-readable title. title: Annotated[Optional[str], Field(description="Update the human-readable title.")] = None # The ID of the tool call being updated. @@ -2369,6 +2314,188 @@ class ToolCallUpdate(BaseModel): ] +class _ConfigOptionUpdate(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 full set of configuration options and their current values. + config_options: Annotated[ + List[SessionConfigOption], + Field( + alias="configOptions", + description="The full set of configuration options and their current values.", + ), + ] + + +class ForkSessionResponse(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. + # + # Initial session configuration options if supported by the Agent. + config_options: Annotated[ + Optional[List[SessionConfigOption]], + Field( + alias="configOptions", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + ), + ] = None + # **UNSTABLE** + # + # This capability is not part of the spec yet, and may be removed or changed at any point. + # + # Initial model state if supported by the Agent + models: Annotated[ + Optional[SessionModelState], + Field( + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent" + ), + ] = None + # Initial mode state if supported by the Agent + # + # See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) + modes: Annotated[ + Optional[SessionModeState], + Field( + description="Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" + ), + ] = None + # Unique identifier for the newly created forked session. + session_id: Annotated[ + str, + Field( + alias="sessionId", + description="Unique identifier for the newly created forked session.", + ), + ] + + +class LoadSessionResponse(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. + # + # Initial session configuration options if supported by the Agent. + config_options: Annotated[ + Optional[List[SessionConfigOption]], + Field( + alias="configOptions", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + ), + ] = None + # **UNSTABLE** + # + # This capability is not part of the spec yet, and may be removed or changed at any point. + # + # Initial model state if supported by the Agent + models: Annotated[ + Optional[SessionModelState], + Field( + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent" + ), + ] = None + # Initial mode state if supported by the Agent + # + # See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) + modes: Annotated[ + Optional[SessionModeState], + Field( + description="Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" + ), + ] = None + + +class NewSessionResponse(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. + # + # Initial session configuration options if supported by the Agent. + config_options: Annotated[ + Optional[List[SessionConfigOption]], + Field( + alias="configOptions", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + ), + ] = None + # **UNSTABLE** + # + # This capability is not part of the spec yet, and may be removed or changed at any point. + # + # Initial model state if supported by the Agent + models: Annotated[ + Optional[SessionModelState], + Field( + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent" + ), + ] = None + # Initial mode state if supported by the Agent + # + # See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) + modes: Annotated[ + Optional[SessionModeState], + Field( + description="Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" + ), + ] = None + # Unique identifier for the created session. + # + # Used in all subsequent requests for this conversation. + session_id: Annotated[ + str, + Field( + alias="sessionId", + description="Unique identifier for the created session.\n\nUsed in all subsequent requests for this conversation.", + ), + ] + + class RequestPermissionRequest(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 @@ -2399,10 +2526,61 @@ class RequestPermissionRequest(BaseModel): ] +class ResumeSessionResponse(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. + # + # Initial session configuration options if supported by the Agent. + config_options: Annotated[ + Optional[List[SessionConfigOption]], + Field( + alias="configOptions", + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.", + ), + ] = None + # **UNSTABLE** + # + # This capability is not part of the spec yet, and may be removed or changed at any point. + # + # Initial model state if supported by the Agent + models: Annotated[ + Optional[SessionModelState], + Field( + description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent" + ), + ] = None + # Initial mode state if supported by the Agent + # + # See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) + modes: Annotated[ + Optional[SessionModeState], + Field( + description="Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" + ), + ] = None + + class ToolCallProgress(ToolCallUpdate): session_update: Annotated[Literal["tool_call_update"], Field(alias="sessionUpdate")] +class ConfigOptionUpdate(_ConfigOptionUpdate): + session_update: Annotated[Literal["config_option_update"], Field(alias="sessionUpdate")] + + class ToolCall(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 @@ -2494,6 +2672,53 @@ class AgentRequest(BaseModel): ] = None +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] + # + # 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. + # + # [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." + ), + ] = None + # All possible responses that an agent can send to a client. + # + # This enum is used internally for routing RPC responses. You typically won't need + # to use this directly - the responses are handled automatically by the connection. + # + # These are responses to the corresponding `ClientRequest` variants. + result: Annotated[ + Union[ + InitializeResponse, + AuthenticateResponse, + NewSessionResponse, + LoadSessionResponse, + ListSessionsResponse, + ForkSessionResponse, + ResumeSessionResponse, + SetSessionModeResponse, + SetSessionConfigOptionResponse, + PromptResponse, + SetSessionModelResponse, + Any, + ], + Field( + 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." + ), + ] + + +class AgentResponse(RootModel[Union[AgentResponseMessage, AgentErrorMessage]]): + root: Union[AgentResponseMessage, AgentErrorMessage] + + class ToolCallStart(ToolCall): session_update: Annotated[Literal["tool_call"], Field(alias="sessionUpdate")] @@ -2530,6 +2755,7 @@ class SessionNotification(BaseModel): AgentPlanUpdate, AvailableCommandsUpdate, CurrentModeUpdate, + ConfigOptionUpdate, SessionInfoUpdate, ], Field(description="The actual update content.", discriminator="session_update"), @@ -2556,6 +2782,7 @@ class AgentNotification(BaseModel): RequestPermissionOutcome1 = DeniedOutcome RequestPermissionOutcome2 = AllowedOutcome SessionUpdate1 = UserMessageChunk +SessionUpdate10 = SessionInfoUpdate SessionUpdate2 = AgentMessageChunk SessionUpdate3 = AgentThoughtChunk SessionUpdate4 = ToolCallStart @@ -2563,7 +2790,7 @@ class AgentNotification(BaseModel): SessionUpdate6 = AgentPlanUpdate SessionUpdate7 = AvailableCommandsUpdate SessionUpdate8 = CurrentModeUpdate -SessionUpdate9 = SessionInfoUpdate +SessionUpdate9 = ConfigOptionUpdate ToolCallContent1 = ContentToolCallContent ToolCallContent2 = FileEditToolCallContent ToolCallContent3 = TerminalToolCallContent From 8216c09db9a9863bc97448af0746c15b05d5e218 Mon Sep 17 00:00:00 2001 From: Richard Chien Date: Thu, 25 Dec 2025 16:29:36 +0800 Subject: [PATCH 2/2] add tests and renaming Signed-off-by: Richard Chien --- scripts/gen_schema.py | 1 + src/acp/schema.py | 7 ++- tests/conftest.py | 2 + .../session_update_config_option_update.json | 55 +++++++++++++++++++ .../set_session_config_option_request.json | 5 ++ .../set_session_config_option_response.json | 20 +++++++ tests/test_golden.py | 6 ++ 7 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 tests/golden/session_update_config_option_update.json create mode 100644 tests/golden/set_session_config_option_request.json create mode 100644 tests/golden/set_session_config_option_response.json diff --git a/scripts/gen_schema.py b/scripts/gen_schema.py index dde5724..62a7657 100644 --- a/scripts/gen_schema.py +++ b/scripts/gen_schema.py @@ -53,6 +53,7 @@ "McpServer2": "SseMcpServer", "RequestPermissionOutcome1": "DeniedOutcome", "RequestPermissionOutcome2": "AllowedOutcome", + "SessionConfigOption1": "SessionConfigOptionSelect", "SessionUpdate1": "UserMessageChunk", "SessionUpdate2": "AgentMessageChunk", "SessionUpdate3": "AgentThoughtChunk", diff --git a/src/acp/schema.py b/src/acp/schema.py index 663a3f2..141adf3 100644 --- a/src/acp/schema.py +++ b/src/acp/schema.py @@ -2207,7 +2207,7 @@ class Content(BaseModel): ] -class SessionConfigOption1(SessionConfigSelect): +class SessionConfigOptionSelect(SessionConfigSelect): # 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. @@ -2232,14 +2232,14 @@ class SessionConfigOption1(SessionConfigSelect): type: Literal["select"] -class SessionConfigOption(RootModel[SessionConfigOption1]): +class SessionConfigOption(RootModel[SessionConfigOptionSelect]): # **UNSTABLE** # # This capability is not part of the spec yet, and may be removed or changed at any point. # # A session configuration option selector and its current state. root: Annotated[ - SessionConfigOption1, + SessionConfigOptionSelect, Field( description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA session configuration option selector and its current state.", discriminator="type", @@ -2781,6 +2781,7 @@ class AgentNotification(BaseModel): McpServer2 = SseMcpServer RequestPermissionOutcome1 = DeniedOutcome RequestPermissionOutcome2 = AllowedOutcome +SessionConfigOption1 = SessionConfigOptionSelect SessionUpdate1 = UserMessageChunk SessionUpdate10 = SessionInfoUpdate SessionUpdate2 = AgentMessageChunk diff --git a/tests/conftest.py b/tests/conftest.py index 654b8d1..6cce0b1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,6 +34,7 @@ AudioContentBlock, AvailableCommandsUpdate, ClientCapabilities, + ConfigOptionUpdate, CurrentModeUpdate, DeniedOutcome, EmbeddedResourceContentBlock, @@ -173,6 +174,7 @@ async def session_update( | AgentPlanUpdate | AvailableCommandsUpdate | CurrentModeUpdate + | ConfigOptionUpdate | SessionInfoUpdate, **kwargs: Any, ) -> None: diff --git a/tests/golden/session_update_config_option_update.json b/tests/golden/session_update_config_option_update.json new file mode 100644 index 0000000..84fb2b8 --- /dev/null +++ b/tests/golden/session_update_config_option_update.json @@ -0,0 +1,55 @@ +{ + "sessionUpdate": "config_option_update", + "configOptions": [ + { + "type": "select", + "id": "model", + "name": "Model", + "description": "Choose a model", + "currentValue": "gpt-4o-mini", + "options": [ + { + "name": "GPT-4o Mini", + "value": "gpt-4o-mini" + }, + { + "name": "GPT-4o", + "value": "gpt-4o", + "description": "Highest quality" + } + ] + }, + { + "type": "select", + "id": "mode", + "name": "Mode", + "currentValue": "fast", + "options": [ + { + "group": "speed", + "name": "Speed", + "options": [ + { + "name": "Fast", + "value": "fast" + }, + { + "name": "Balanced", + "value": "balanced" + } + ] + }, + { + "group": "quality", + "name": "Quality", + "options": [ + { + "name": "High", + "value": "high" + } + ] + } + ] + } + ] +} diff --git a/tests/golden/set_session_config_option_request.json b/tests/golden/set_session_config_option_request.json new file mode 100644 index 0000000..fddd447 --- /dev/null +++ b/tests/golden/set_session_config_option_request.json @@ -0,0 +1,5 @@ +{ + "sessionId": "sess-123", + "configId": "model", + "value": "gpt-4o-mini" +} diff --git a/tests/golden/set_session_config_option_response.json b/tests/golden/set_session_config_option_response.json new file mode 100644 index 0000000..9c6564d --- /dev/null +++ b/tests/golden/set_session_config_option_response.json @@ -0,0 +1,20 @@ +{ + "configOptions": [ + { + "type": "select", + "id": "mode", + "name": "Mode", + "currentValue": "balanced", + "options": [ + { + "name": "Fast", + "value": "fast" + }, + { + "name": "Balanced", + "value": "balanced" + } + ] + } + ] +} diff --git a/tests/test_golden.py b/tests/test_golden.py index 430bd04..181945f 100644 --- a/tests/test_golden.py +++ b/tests/test_golden.py @@ -35,6 +35,7 @@ AllowedOutcome, AudioContentBlock, CancelNotification, + ConfigOptionUpdate, ContentToolCallContent, DeniedOutcome, EmbeddedResourceContentBlock, @@ -50,6 +51,8 @@ RequestPermissionRequest, RequestPermissionResponse, ResourceContentBlock, + SetSessionConfigOptionRequest, + SetSessionConfigOptionResponse, TerminalToolCallContent, TextContentBlock, ToolCallLocation, @@ -84,6 +87,7 @@ "request_permission_response_selected": RequestPermissionResponse, "session_update_agent_message_chunk": AgentMessageChunk, "session_update_agent_thought_chunk": AgentThoughtChunk, + "session_update_config_option_update": ConfigOptionUpdate, "session_update_plan": AgentPlanUpdate, "session_update_tool_call": ToolCallStart, "session_update_tool_call_edit": ToolCallStart, @@ -92,6 +96,8 @@ "session_update_tool_call_update_content": ToolCallProgress, "session_update_tool_call_update_more_fields": ToolCallProgress, "session_update_user_message_chunk": UserMessageChunk, + "set_session_config_option_request": SetSessionConfigOptionRequest, + "set_session_config_option_response": SetSessionConfigOptionResponse, "tool_content_content_text": ContentToolCallContent, "tool_content_diff": FileEditToolCallContent, "tool_content_diff_no_old": FileEditToolCallContent,