diff --git a/release-please-config.json b/release-please-config.json index 3d9c62a..3ab3965 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -3,11 +3,11 @@ ".": { "changelog-path": "CHANGELOG.md", "release-type": "node", - "bump-minor-pre-major": false, - "bump-patch-for-minor-pre-major": false, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, "draft": false, "prerelease": true } }, "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" -} \ No newline at end of file +} diff --git a/schema/meta.json b/schema/meta.json index b67f1f3..e58853e 100644 --- a/schema/meta.json +++ b/schema/meta.json @@ -8,6 +8,7 @@ "session_load": "session/load", "session_new": "session/new", "session_prompt": "session/prompt", + "session_resume": "session/resume", "session_set_mode": "session/set_mode", "session_set_model": "session/set_model" }, diff --git a/schema/schema.json b/schema/schema.json index 86675b0..0c97d63 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -211,6 +211,9 @@ { "$ref": "#/$defs/ForkSessionResponse" }, + { + "$ref": "#/$defs/ResumeSessionResponse" + }, { "$ref": "#/$defs/SetSessionModeResponse" }, @@ -606,6 +609,14 @@ ], "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nForks an existing session to create a new independent session.\n\nThis method is only available if the agent advertises the `session.fork` capability.\n\nThe agent should create a new session with the same conversation context as the\noriginal, allowing operations like generating summaries without affecting the\noriginal session's history." }, + { + "allOf": [ + { + "$ref": "#/$defs/ResumeSessionRequest" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResumes an existing session without returning previous messages.\n\nThis method is only available if the agent advertises the `session.resume` capability.\n\nThe agent should resume the session context, allowing the conversation to continue\nwithout replaying the message history (unlike `session/load`)." + }, { "allOf": [ { @@ -1123,6 +1134,17 @@ "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"] }, + "cwd": { + "description": "The working directory for this session.", + "type": "string" + }, + "mcpServers": { + "description": "List of MCP servers to connect to for this session.", + "items": { + "$ref": "#/$defs/McpServer" + }, + "type": "array" + }, "sessionId": { "allOf": [ { @@ -1132,7 +1154,7 @@ "description": "The ID of the session to fork." } }, - "required": ["sessionId"], + "required": ["sessionId", "cwd"], "type": "object", "x-method": "session/fork", "x-side": "agent" @@ -2254,6 +2276,74 @@ "required": ["name", "uri"], "type": "object" }, + "ResumeSessionRequest": { + "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 resuming an existing session.\n\nResumes an existing session without returning previous messages (unlike `session/load`).\nThis is useful for agents that can resume sessions but don't implement full session loading.\n\nOnly available if the Agent supports the `session.resume` 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"] + }, + "cwd": { + "description": "The working directory for this session.", + "type": "string" + }, + "mcpServers": { + "description": "List of MCP servers to connect to for this session.", + "items": { + "$ref": "#/$defs/McpServer" + }, + "type": "array" + }, + "sessionId": { + "allOf": [ + { + "$ref": "#/$defs/SessionId" + } + ], + "description": "The ID of the session to resume." + } + }, + "required": ["sessionId", "cwd"], + "type": "object", + "x-method": "session/resume", + "x-side": "agent" + }, + "ResumeSessionResponse": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from resuming an existing 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"] + }, + "models": { + "anyOf": [ + { + "$ref": "#/$defs/SessionModelState" + }, + { + "type": "null" + } + ], + "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" + }, + "modes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionModeState" + }, + { + "type": "null" + } + ], + "description": "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)" + } + }, + "type": "object", + "x-method": "session/resume", + "x-side": "agent" + }, "Role": { "description": "The sender or recipient of messages and data in a conversation.", "enum": ["assistant", "user"], @@ -2308,6 +2398,17 @@ } ], "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/list`." + }, + "resume": { + "anyOf": [ + { + "$ref": "#/$defs/SessionResumeCapabilities" + }, + { + "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/resume`." } }, "type": "object" @@ -2479,6 +2580,17 @@ "x-method": "session/update", "x-side": "client" }, + "SessionResumeCapabilities": { + "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/resume` method.\n\nBy supplying `{}` it means that the agent supports resuming of sessions.", + "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" + }, "SessionUpdate": { "description": "Different types of updates that can be sent during session processing.\n\nThese updates provide real-time feedback about the agent's progress.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)", "discriminator": { diff --git a/scripts/generate.js b/scripts/generate.js index 839c4fd..5c3f88c 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.1"; +const CURRENT_SCHEMA_RELEASE = "v0.10.2"; await main(); diff --git a/src/schema/index.ts b/src/schema/index.ts index aa444b6..2256c51 100644 --- a/src/schema/index.ts +++ b/src/schema/index.ts @@ -11,6 +11,7 @@ export const AGENT_METHODS = { session_load: "session/load", session_new: "session/new", session_prompt: "session/prompt", + session_resume: "session/resume", 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 d2e3405..a94726b 100644 --- a/src/schema/types.gen.ts +++ b/src/schema/types.gen.ts @@ -78,6 +78,7 @@ export type AgentResponse = | LoadSessionResponse | ListSessionsResponse | ForkSessionResponse + | ResumeSessionResponse | SetSessionModeResponse | PromptResponse | SetSessionModelResponse @@ -360,6 +361,7 @@ export type ClientRequest = { | LoadSessionRequest | ListSessionsRequest | ForkSessionRequest + | ResumeSessionRequest | SetSessionModeRequest | PromptRequest | SetSessionModelRequest @@ -759,6 +761,14 @@ export type ForkSessionRequest = { _meta?: { [key: string]: unknown; } | null; + /** + * The working directory for this session. + */ + cwd: string; + /** + * List of MCP servers to connect to for this session. + */ + mcpServers?: Array; /** * The ID of the session to fork. */ @@ -1793,6 +1803,83 @@ export type ResourceLink = { uri: string; }; +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Request parameters for resuming an existing session. + * + * Resumes an existing session without returning previous messages (unlike `session/load`). + * This is useful for agents that can resume sessions but don't implement full session loading. + * + * Only available if the Agent supports the `session.resume` capability. + * + * @experimental + */ +export type ResumeSessionRequest = { + /** + * 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 working directory for this session. + */ + cwd: string; + /** + * List of MCP servers to connect to for this session. + */ + mcpServers?: Array; + /** + * The ID of the session to resume. + */ + sessionId: SessionId; +}; + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Response from resuming an existing session. + * + * @experimental + */ +export type ResumeSessionResponse = { + /** + * 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; + /** + * **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 + * + * @experimental + */ + models?: SessionModelState | null; + /** + * Initial mode state if supported by the Agent + * + * See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) + */ + modes?: SessionModeState | null; +}; + /** * The sender or recipient of messages and data in a conversation. */ @@ -1860,6 +1947,16 @@ export type SessionCapabilities = { * @experimental */ list?: SessionListCapabilities | null; + /** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Whether the agent supports `session/resume`. + * + * @experimental + */ + resume?: SessionResumeCapabilities | null; }; /** @@ -2062,6 +2159,30 @@ export type SessionNotification = { update: SessionUpdate; }; +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Capabilities for the `session/resume` method. + * + * By supplying `{}` it means that the agent supports resuming of sessions. + * + * @experimental + */ +export type SessionResumeCapabilities = { + /** + * 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; +}; + /** * Different types of updates that can be sent during session processing. * diff --git a/src/schema/zod.gen.ts b/src/schema/zod.gen.ts index 876a3a8..70e1230 100644 --- a/src/schema/zod.gen.ts +++ b/src/schema/zod.gen.ts @@ -623,6 +623,8 @@ export const zCreateTerminalRequest = z.object({ */ export const zForkSessionRequest = z.object({ _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + cwd: z.string(), + mcpServers: z.array(zMcpServer).optional(), sessionId: zSessionId, }); @@ -671,6 +673,27 @@ export const zReleaseTerminalRequest = z.object({ terminalId: z.string(), }); +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Request parameters for resuming an existing session. + * + * Resumes an existing session without returning previous messages (unlike `session/load`). + * This is useful for agents that can resume sessions but don't implement full session loading. + * + * Only available if the Agent supports the `session.resume` capability. + * + * @experimental + */ +export const zResumeSessionRequest = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + cwd: z.string(), + mcpServers: z.array(zMcpServer).optional(), + sessionId: zSessionId, +}); + /** * **UNSTABLE** * @@ -714,69 +737,6 @@ export const zSessionListCapabilities = z.object({ _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), }); -/** - * Session capabilities supported by the agent. - * - * As a baseline, all Agents **MUST** support `session/new`, `session/prompt`, `session/cancel`, and `session/update`. - * - * Optionally, they **MAY** support other session methods and notifications by specifying additional capabilities. - * - * Note: `session/load` is still handled by the top-level `load_session` capability. This will be unified in future versions of the protocol. - * - * See protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities) - */ -export const zSessionCapabilities = z.object({ - _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), - fork: z.union([zSessionForkCapabilities, z.null()]).optional(), - list: z.union([zSessionListCapabilities, z.null()]).optional(), -}); - -/** - * Capabilities supported by the agent. - * - * Advertised during initialization to inform the client about - * available features and content types. - * - * See protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/initialization#agent-capabilities) - */ -export const zAgentCapabilities = z.object({ - _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), - loadSession: z.boolean().optional().default(false), - mcpCapabilities: zMcpCapabilities - .optional() - .default({ http: false, sse: false }), - promptCapabilities: zPromptCapabilities.optional().default({ - audio: false, - embeddedContext: false, - image: false, - }), - sessionCapabilities: zSessionCapabilities.optional().default({}), -}); - -/** - * Response to the `initialize` method. - * - * Contains the negotiated protocol version and agent capabilities. - * - * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) - */ -export const zInitializeResponse = z.object({ - _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), - agentCapabilities: zAgentCapabilities.optional().default({ - loadSession: false, - mcpCapabilities: { http: false, sse: false }, - promptCapabilities: { - audio: false, - embeddedContext: false, - image: false, - }, - sessionCapabilities: {}, - }), - agentInfo: z.union([zImplementation, z.null()]).optional(), - authMethods: z.array(zAuthMethod).optional().default([]), - protocolVersion: zProtocolVersion, -}); - /** * Unique identifier for a Session Mode. */ @@ -865,6 +825,100 @@ export const zNewSessionResponse = z.object({ sessionId: zSessionId, }); +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Response from resuming an existing session. + * + * @experimental + */ +export const zResumeSessionResponse = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + models: z.union([zSessionModelState, z.null()]).optional(), + modes: z.union([zSessionModeState, z.null()]).optional(), +}); + +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Capabilities for the `session/resume` method. + * + * By supplying `{}` it means that the agent supports resuming of sessions. + * + * @experimental + */ +export const zSessionResumeCapabilities = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), +}); + +/** + * Session capabilities supported by the agent. + * + * As a baseline, all Agents **MUST** support `session/new`, `session/prompt`, `session/cancel`, and `session/update`. + * + * Optionally, they **MAY** support other session methods and notifications by specifying additional capabilities. + * + * Note: `session/load` is still handled by the top-level `load_session` capability. This will be unified in future versions of the protocol. + * + * See protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities) + */ +export const zSessionCapabilities = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + fork: z.union([zSessionForkCapabilities, z.null()]).optional(), + list: z.union([zSessionListCapabilities, z.null()]).optional(), + resume: z.union([zSessionResumeCapabilities, z.null()]).optional(), +}); + +/** + * Capabilities supported by the agent. + * + * Advertised during initialization to inform the client about + * available features and content types. + * + * See protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/initialization#agent-capabilities) + */ +export const zAgentCapabilities = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + loadSession: z.boolean().optional().default(false), + mcpCapabilities: zMcpCapabilities + .optional() + .default({ http: false, sse: false }), + promptCapabilities: zPromptCapabilities.optional().default({ + audio: false, + embeddedContext: false, + image: false, + }), + sessionCapabilities: zSessionCapabilities.optional().default({}), +}); + +/** + * Response to the `initialize` method. + * + * Contains the negotiated protocol version and agent capabilities. + * + * See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) + */ +export const zInitializeResponse = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + agentCapabilities: zAgentCapabilities.optional().default({ + loadSession: false, + mcpCapabilities: { http: false, sse: false }, + promptCapabilities: { + audio: false, + embeddedContext: false, + image: false, + }, + sessionCapabilities: {}, + }), + agentInfo: z.union([zImplementation, z.null()]).optional(), + authMethods: z.array(zAuthMethod).optional().default([]), + protocolVersion: zProtocolVersion, +}); + /** * Request parameters for setting a session mode. */ @@ -942,6 +996,7 @@ export const zAgentResponse = z.union([ zLoadSessionResponse, zListSessionsResponse, zForkSessionResponse, + zResumeSessionResponse, zSetSessionModeResponse, zPromptResponse, zSetSessionModelResponse, @@ -1115,6 +1170,7 @@ export const zClientRequest = z.object({ zLoadSessionRequest, zListSessionsRequest, zForkSessionRequest, + zResumeSessionRequest, zSetSessionModeRequest, zPromptRequest, zSetSessionModelRequest,