Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions schema/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
"terminal_release": "terminal/release",
"terminal_wait_for_exit": "terminal/wait_for_exit"
},
"protocolMethods": {
"cancel_request": "$/cancel_request"
},
"version": 1
}
56 changes: 52 additions & 4 deletions schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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.",
Expand Down Expand Up @@ -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": [
Expand All @@ -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": [
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion scripts/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
41 changes: 38 additions & 3 deletions src/schema/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -647,6 +675,7 @@ export type ErrorCode =
| -32601
| -32602
| -32603
| -32800
| -32000
| -32002
| number;
Expand Down Expand Up @@ -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.
*/
Expand All @@ -751,7 +782,9 @@ export type ForkSessionResponse = {
*
* See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
*/
_meta?: unknown;
_meta?: {
[key: string]: unknown;
} | null;
/**
* **UNSTABLE**
*
Expand Down Expand Up @@ -1848,7 +1881,9 @@ export type SessionForkCapabilities = {
*
* See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
*/
_meta?: unknown;
_meta?: {
[key: string]: unknown;
} | null;
};

/**
Expand Down
23 changes: 20 additions & 3 deletions src/schema/zod.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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(),
});

/**
Expand Down Expand Up @@ -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,
});

Expand Down Expand Up @@ -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,
Expand Down