From 3282d0cb09d57e7b3666fac1e281afe86303d5e2 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Tue, 9 Dec 2025 15:56:11 +0100 Subject: [PATCH] feat: Update to 0.10.1 of the schema --- schema/meta.json | 3 +++ schema/schema.json | 56 ++++++++++++++++++++++++++++++++++++++--- scripts/generate.js | 2 +- src/schema/types.gen.ts | 41 +++++++++++++++++++++++++++--- src/schema/zod.gen.ts | 23 ++++++++++++++--- 5 files changed, 114 insertions(+), 11 deletions(-) diff --git a/schema/meta.json b/schema/meta.json index 8d38112..b67f1f3 100644 --- a/schema/meta.json +++ b/schema/meta.json @@ -22,5 +22,8 @@ "terminal_release": "terminal/release", "terminal_wait_for_exit": "terminal/wait_for_exit" }, + "protocolMethods": { + "cancel_request": "$/cancel_request" + }, "version": 1 } diff --git a/schema/schema.json b/schema/schema.json index 30b01be..86675b0 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -458,6 +458,28 @@ "x-method": "session/cancel", "x-side": "agent" }, + "CancelRequestNotification": { + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nNotification to cancel an ongoing request.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)", + "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"] + }, + "requestId": { + "allOf": [ + { + "$ref": "#/$defs/RequestId" + } + ], + "description": "The ID of the request to cancel." + } + }, + "required": ["requestId"], + "type": "object", + "x-method": "$/cancel_request", + "x-side": "protocol" + }, "ClientCapabilities": { "description": "Capabilities supported by the client.\n\nAdvertised during initialization to inform the agent about\navailable features and methods.\n\nSee protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/initialization#client-capabilities)", "properties": { @@ -1037,6 +1059,12 @@ "format": "int32", "type": "integer" }, + { + "const": -32800, + "description": "**Request cancelled**: **UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nExecution of the method was aborted either due to a cancellation request from the caller or\nbecause of resource constraints or shutdown.", + "format": "int32", + "type": "integer" + }, { "const": -32000, "description": "**Authentication required**: Authentication is required before this operation can be performed.", @@ -1091,7 +1119,9 @@ "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 forking an existing session.\n\nCreates a new session based on the context of an existing one, allowing\noperations like generating summaries without affecting the original session's history.\n\nOnly available if the Agent supports the `session.fork` capability.", "properties": { "_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)" + "additionalProperties": true, + "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", + "type": ["object", "null"] }, "sessionId": { "allOf": [ @@ -1111,7 +1141,9 @@ "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from forking an existing session.", "properties": { "_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)" + "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": [ @@ -2284,7 +2316,9 @@ "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": { "_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)" + "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" @@ -3279,6 +3313,20 @@ }, "required": ["jsonrpc"], "type": "object" + }, + { + "anyOf": [ + { + "allOf": [ + { + "$ref": "#/$defs/CancelRequestNotification" + } + ], + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or\nchanged at any point.\n\nCancels an ongoing request.\n\nThis is a notification sent by the the side that sent a request to cancel that request.\n\nUpon receiving this notification, the receiver:\n\n1. MUST cancel the corresponding request activity and all nested activities\n2. MAY send any pending notifications.\n3. MUST send one of these responses for the original request:\n - Valid response with appropriate data (partial results or cancellation marker)\n - Error response with code `-32800` (Cancelled)\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)" + } + ], + "description": "General protocol-level notifications that all sides are expected to\nimplement.\n\nNotifications whose methods start with '$/' are messages which\nare protocol implementation dependent and might not be implementable in all\nclients or agents. For example if the implementation uses a single threaded\nsynchronous programming language then there is little it can do to react to\na `$/cancel_request` notification. If an agent or client receives\nnotifications starting with '$/' it is free to ignore the notification.\n\nNotifications do not expect a response." } - ] + ], + "title": "Agent Client Protocol" } diff --git a/scripts/generate.js b/scripts/generate.js index af36ee7..839c4fd 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.0"; +const CURRENT_SCHEMA_RELEASE = "v0.10.1"; await main(); diff --git a/src/schema/types.gen.ts b/src/schema/types.gen.ts index f3bc787..d2e3405 100644 --- a/src/schema/types.gen.ts +++ b/src/schema/types.gen.ts @@ -287,6 +287,34 @@ export type CancelNotification = { sessionId: SessionId; }; +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Notification to cancel an ongoing request. + * + * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation) + * + * @experimental + */ +export type CancelRequestNotification = { + /** + * 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 request to cancel. + */ + requestId: RequestId; +}; + /** * Capabilities supported by the client. * @@ -647,6 +675,7 @@ export type ErrorCode = | -32601 | -32602 | -32603 + | -32800 | -32000 | -32002 | number; @@ -727,7 +756,9 @@ export type ForkSessionRequest = { * * See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility) */ - _meta?: unknown; + _meta?: { + [key: string]: unknown; + } | null; /** * The ID of the session to fork. */ @@ -751,7 +782,9 @@ export type ForkSessionResponse = { * * See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility) */ - _meta?: unknown; + _meta?: { + [key: string]: unknown; + } | null; /** * **UNSTABLE** * @@ -1848,7 +1881,9 @@ export type SessionForkCapabilities = { * * See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility) */ - _meta?: unknown; + _meta?: { + [key: string]: unknown; + } | null; }; /** diff --git a/src/schema/zod.gen.ts b/src/schema/zod.gen.ts index 28a3f1d..876a3a8 100644 --- a/src/schema/zod.gen.ts +++ b/src/schema/zod.gen.ts @@ -82,6 +82,7 @@ export const zErrorCode = z.union([ z.literal(-32601), z.literal(-32602), z.literal(-32603), + z.literal(-32800), z.literal(-32000), z.literal(-32002), z.number().int(), @@ -455,6 +456,22 @@ export const zReleaseTerminalResponse = z.object({ */ export const zRequestId = z.union([z.null(), z.coerce.bigint(), z.string()]); +/** + * **UNSTABLE** + * + * This capability is not part of the spec yet, and may be removed or changed at any point. + * + * Notification to cancel an ongoing request. + * + * See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation) + * + * @experimental + */ +export const zCancelRequestNotification = z.object({ + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), + requestId: zRequestId, +}); + /** * The sender or recipient of messages and data in a conversation. */ @@ -547,7 +564,7 @@ export const zRequestPermissionResponse = z.object({ * @experimental */ export const zSessionForkCapabilities = z.object({ - _meta: z.unknown().optional(), + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), }); /** @@ -605,7 +622,7 @@ export const zCreateTerminalRequest = z.object({ * @experimental */ export const zForkSessionRequest = z.object({ - _meta: z.unknown().optional(), + _meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(), sessionId: zSessionId, }); @@ -821,7 +838,7 @@ export const zSessionModelState = z.object({ * @experimental */ export const zForkSessionResponse = z.object({ - _meta: z.unknown().optional(), + _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(), sessionId: zSessionId,