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 0c97d63..09273fd 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -217,6 +217,9 @@ { "$ref": "#/$defs/SetSessionModeResponse" }, + { + "$ref": "#/$defs/SetSessionConfigOptionResponse" + }, { "$ref": "#/$defs/PromptResponse" }, @@ -625,6 +628,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": [ { @@ -720,6 +731,25 @@ ], "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": { @@ -1167,6 +1197,13 @@ "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": "**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": [ { @@ -1514,6 +1551,13 @@ "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": "**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": [ { @@ -1760,6 +1804,13 @@ "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": "**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": [ { @@ -2317,6 +2368,13 @@ "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": "**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": [ { @@ -2413,6 +2471,168 @@ }, "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": { @@ -2460,6 +2680,25 @@ "required": ["sessionId", "cwd"], "type": "object" }, + "SessionInfoUpdate": { + "description": "Update to session metadata. All fields are optional to support partial updates.\n\nAgents send this notification to update session information like title or custom metadata.\nThis allows clients to display dynamic session names and track session state changes.", + "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"] + }, + "title": { + "description": "Human-readable title for the session. Set to null to clear.", + "type": ["string", "null"] + }, + "updatedAt": { + "description": "ISO 8601 timestamp of last activity. Set to null to clear.", + "type": ["string", "null"] + } + }, + "type": "object" + }, "SessionListCapabilities": { "description": "Capabilities for the `session/list` method.\n\nBy supplying `{}` it means that the agent supports listing of sessions.\n\nFurther capabilities can be added in the future for other means of filtering or searching the list.", "properties": { @@ -2724,9 +2963,100 @@ }, "required": ["sessionUpdate"], "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": [ + { + "$ref": "#/$defs/SessionInfoUpdate" + } + ], + "description": "Session metadata has been updated (title, timestamps, custom metadata)", + "properties": { + "sessionUpdate": { + "const": "session_info_update", + "type": "string" + } + }, + "required": ["sessionUpdate"], + "type": "object" } ] }, + "SetSessionConfigOptionRequest": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for setting a session configuration option.", + "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/generate.js b/scripts/generate.js index 5c3f88c..5ff3e47 100644 --- a/scripts/generate.js +++ b/scripts/generate.js @@ -5,7 +5,7 @@ import * as fs from "fs/promises"; import { dirname } from "path"; import * as prettier from "prettier"; -const CURRENT_SCHEMA_RELEASE = "v0.10.2"; +const CURRENT_SCHEMA_RELEASE = "v0.10.4"; await main(); diff --git a/src/schema/index.ts b/src/schema/index.ts index 2256c51..55fb3c5 100644 --- a/src/schema/index.ts +++ b/src/schema/index.ts @@ -12,6 +12,7 @@ export const AGENT_METHODS = { 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", } as const; diff --git a/src/schema/types.gen.ts b/src/schema/types.gen.ts index a94726b..a110fcf 100644 --- a/src/schema/types.gen.ts +++ b/src/schema/types.gen.ts @@ -80,6 +80,7 @@ export type AgentResponse = | ForkSessionResponse | ResumeSessionResponse | SetSessionModeResponse + | SetSessionConfigOptionResponse | PromptResponse | SetSessionModelResponse | ExtResponse; @@ -363,6 +364,7 @@ export type ClientRequest = { | ForkSessionRequest | ResumeSessionRequest | SetSessionModeRequest + | SetSessionConfigOptionRequest | PromptRequest | SetSessionModelRequest | ExtRequest @@ -396,6 +398,32 @@ export type ClientResponse = id: RequestId; }; +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Session configuration options have been updated. + * + * @experimental + */ +export type ConfigOptionUpdate = { + /** + * 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) + */ + _meta?: { + [key: string]: unknown; + } | null; + /** + * The full set of configuration options and their current values. + */ + configOptions: Array; +}; + /** * Standard content block (text, images, resources). */ @@ -795,6 +823,16 @@ export type ForkSessionResponse = { _meta?: { [key: string]: unknown; } | null; + /** + * **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. + * + * @experimental + */ + configOptions?: Array | null; /** * **UNSTABLE** * @@ -1120,6 +1158,16 @@ export type LoadSessionResponse = { _meta?: { [key: string]: unknown; } | null; + /** + * **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. + * + * @experimental + */ + configOptions?: Array | null; /** * **UNSTABLE** * @@ -1354,6 +1402,16 @@ export type NewSessionResponse = { _meta?: { [key: string]: unknown; } | null; + /** + * **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. + * + * @experimental + */ + configOptions?: Array | null; /** * **UNSTABLE** * @@ -1862,6 +1920,16 @@ export type ResumeSessionResponse = { _meta?: { [key: string]: unknown; } | null; + /** + * **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. + * + * @experimental + */ + configOptions?: Array | null; /** * **UNSTABLE** * @@ -1959,6 +2027,167 @@ export type SessionCapabilities = { resume?: SessionResumeCapabilities | null; }; +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Unique identifier for a session configuration option value group. + * + * @experimental + */ +export type SessionConfigGroupId = string; + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Unique identifier for a session configuration option. + * + * @experimental + */ +export type SessionConfigId = string; + +export type SessionConfigOption = SessionConfigSelect & { + type: "select"; +} & { + /** + * 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) + */ + _meta?: { + [key: string]: unknown; + } | null; + /** + * Optional description for the Client to display to the user. + */ + description?: string | null; + /** + * Unique identifier for the configuration option. + */ + id: SessionConfigId; + /** + * Human-readable label for the option. + */ + name: string; +}; + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * A single-value selector (dropdown) session configuration option payload. + * + * @experimental + */ +export type SessionConfigSelect = { + /** + * The currently selected value. + */ + currentValue: SessionConfigValueId; + /** + * The set of selectable options. + */ + options: SessionConfigSelectOptions; +}; + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * A group of possible values for a session configuration option. + * + * @experimental + */ +export type SessionConfigSelectGroup = { + /** + * 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) + */ + _meta?: { + [key: string]: unknown; + } | null; + /** + * Unique identifier for this group. + */ + group: SessionConfigGroupId; + /** + * Human-readable label for this group. + */ + name: string; + /** + * The set of option values in this group. + */ + options: Array; +}; + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * A possible value for a session configuration option. + * + * @experimental + */ +export type SessionConfigSelectOption = { + /** + * 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) + */ + _meta?: { + [key: string]: unknown; + } | null; + /** + * Optional description for this option value. + */ + description?: string | null; + /** + * Human-readable label for this option value. + */ + name: string; + /** + * Unique identifier for this option value. + */ + value: SessionConfigValueId; +}; + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Possible values for a session configuration option. + * + * @experimental + */ +export type SessionConfigSelectOptions = + | Array + | Array; + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Unique identifier for a session configuration option value. + * + * @experimental + */ +export type SessionConfigValueId = string; + /** * **UNSTABLE** * @@ -2031,6 +2260,33 @@ export type SessionInfo = { updatedAt?: string | null; }; +/** + * Update to session metadata. All fields are optional to support partial updates. + * + * Agents send this notification to update session information like title or custom metadata. + * This allows clients to display dynamic session names and track session state changes. + */ +export type SessionInfoUpdate = { + /** + * 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) + */ + _meta?: { + [key: string]: unknown; + } | null; + /** + * Human-readable title for the session. Set to null to clear. + */ + title?: string | null; + /** + * ISO 8601 timestamp of last activity. Set to null to clear. + */ + updatedAt?: string | null; +}; + /** * Capabilities for the `session/list` method. * @@ -2214,8 +2470,74 @@ export type SessionUpdate = }) | (CurrentModeUpdate & { sessionUpdate: "current_mode_update"; + }) + | (ConfigOptionUpdate & { + sessionUpdate: "config_option_update"; + }) + | (SessionInfoUpdate & { + sessionUpdate: "session_info_update"; }); +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Request parameters for setting a session configuration option. + * + * @experimental + */ +export type SetSessionConfigOptionRequest = { + /** + * 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) + */ + _meta?: { + [key: string]: unknown; + } | null; + /** + * The ID of the configuration option to set. + */ + configId: SessionConfigId; + /** + * The ID of the session to set the configuration option for. + */ + sessionId: SessionId; + /** + * The ID of the configuration option value to set. + */ + value: SessionConfigValueId; +}; + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Response to `session/set_config_option` method. + * + * @experimental + */ +export type SetSessionConfigOptionResponse = { + /** + * 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) + */ + _meta?: { + [key: string]: unknown; + } | null; + /** + * The full set of configuration options and their current values. + */ + configOptions: Array; +}; + /** * Request parameters for setting a session mode. */ diff --git a/src/schema/zod.gen.ts b/src/schema/zod.gen.ts index 70e1230..7fdbda5 100644 --- a/src/schema/zod.gen.ts +++ b/src/schema/zod.gen.ts @@ -552,6 +552,128 @@ export const zRequestPermissionResponse = z.object({ outcome: zRequestPermissionOutcome, }); +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Unique identifier for a session configuration option value group. + * + * @experimental + */ +export const zSessionConfigGroupId = z.string(); + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Unique identifier for a session configuration option. + * + * @experimental + */ +export const zSessionConfigId = z.string(); + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Unique identifier for a session configuration option value. + * + * @experimental + */ +export const zSessionConfigValueId = z.string(); + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * A possible value for a session configuration option. + * + * @experimental + */ +export const zSessionConfigSelectOption = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + description: z.union([z.string(), z.null()]).optional(), + name: z.string(), + value: zSessionConfigValueId, +}); + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * A group of possible values for a session configuration option. + * + * @experimental + */ +export const zSessionConfigSelectGroup = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + group: zSessionConfigGroupId, + name: z.string(), + options: z.array(zSessionConfigSelectOption), +}); + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Possible values for a session configuration option. + * + * @experimental + */ +export const zSessionConfigSelectOptions = z.union([ + z.array(zSessionConfigSelectOption), + z.array(zSessionConfigSelectGroup), +]); + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * A single-value selector (dropdown) session configuration option payload. + * + * @experimental + */ +export const zSessionConfigSelect = z.object({ + currentValue: zSessionConfigValueId, + options: zSessionConfigSelectOptions, +}); + +export const zSessionConfigOption = zSessionConfigSelect + .and( + z.object({ + type: z.literal("select"), + }), + ) + .and( + z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + description: z.union([z.string(), z.null()]).optional(), + id: zSessionConfigId, + name: z.string(), + }), + ); + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Session configuration options have been updated. + * + * @experimental + */ +export const zConfigOptionUpdate = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + configOptions: z.array(zSessionConfigOption), +}); + /** * **UNSTABLE** * @@ -726,6 +848,18 @@ export const zListSessionsResponse = z.object({ sessions: z.array(zSessionInfo), }); +/** + * Update to session metadata. All fields are optional to support partial updates. + * + * Agents send this notification to update session information like title or custom metadata. + * This allows clients to display dynamic session names and track session state changes. + */ +export const zSessionInfoUpdate = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + title: z.union([z.string(), z.null()]).optional(), + updatedAt: z.union([z.string(), z.null()]).optional(), +}); + /** * Capabilities for the `session/list` method. * @@ -799,6 +933,7 @@ export const zSessionModelState = z.object({ */ export const zForkSessionResponse = z.object({ _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + configOptions: z.union([z.array(zSessionConfigOption), z.null()]).optional(), models: z.union([zSessionModelState, z.null()]).optional(), modes: z.union([zSessionModeState, z.null()]).optional(), sessionId: zSessionId, @@ -809,6 +944,7 @@ export const zForkSessionResponse = z.object({ */ export const zLoadSessionResponse = z.object({ _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + configOptions: z.union([z.array(zSessionConfigOption), z.null()]).optional(), models: z.union([zSessionModelState, z.null()]).optional(), modes: z.union([zSessionModeState, z.null()]).optional(), }); @@ -820,6 +956,7 @@ export const zLoadSessionResponse = z.object({ */ export const zNewSessionResponse = z.object({ _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + configOptions: z.union([z.array(zSessionConfigOption), z.null()]).optional(), models: z.union([zSessionModelState, z.null()]).optional(), modes: z.union([zSessionModeState, z.null()]).optional(), sessionId: zSessionId, @@ -836,6 +973,7 @@ export const zNewSessionResponse = z.object({ */ export const zResumeSessionResponse = z.object({ _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + configOptions: z.union([z.array(zSessionConfigOption), z.null()]).optional(), models: z.union([zSessionModelState, z.null()]).optional(), modes: z.union([zSessionModeState, z.null()]).optional(), }); @@ -919,6 +1057,36 @@ export const zInitializeResponse = z.object({ protocolVersion: zProtocolVersion, }); +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Request parameters for setting a session configuration option. + * + * @experimental + */ +export const zSetSessionConfigOptionRequest = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + configId: zSessionConfigId, + sessionId: zSessionId, + value: zSessionConfigValueId, +}); + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Response to `session/set_config_option` method. + * + * @experimental + */ +export const zSetSessionConfigOptionResponse = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + configOptions: z.array(zSessionConfigOption), +}); + /** * Request parameters for setting a session mode. */ @@ -998,6 +1166,7 @@ export const zAgentResponse = z.union([ zForkSessionResponse, zResumeSessionResponse, zSetSessionModeResponse, + zSetSessionConfigOptionResponse, zPromptResponse, zSetSessionModelResponse, zExtResponse, @@ -1172,6 +1341,7 @@ export const zClientRequest = z.object({ zForkSessionRequest, zResumeSessionRequest, zSetSessionModeRequest, + zSetSessionConfigOptionRequest, zPromptRequest, zSetSessionModelRequest, zExtRequest, @@ -1394,6 +1564,16 @@ export const zSessionUpdate = z.union([ sessionUpdate: z.literal("current_mode_update"), }), ), + zConfigOptionUpdate.and( + z.object({ + sessionUpdate: z.literal("config_option_update"), + }), + ), + zSessionInfoUpdate.and( + z.object({ + sessionUpdate: z.literal("session_info_update"), + }), + ), ]); /**