Skip to content

Commit 210392b

Browse files
authored
feat: Update to 0.10.1 of the schema (#36)
1 parent 16262ef commit 210392b

File tree

5 files changed

+114
-11
lines changed

5 files changed

+114
-11
lines changed

schema/meta.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@
2222
"terminal_release": "terminal/release",
2323
"terminal_wait_for_exit": "terminal/wait_for_exit"
2424
},
25+
"protocolMethods": {
26+
"cancel_request": "$/cancel_request"
27+
},
2528
"version": 1
2629
}

schema/schema.json

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,28 @@
458458
"x-method": "session/cancel",
459459
"x-side": "agent"
460460
},
461+
"CancelRequestNotification": {
462+
"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)",
463+
"properties": {
464+
"_meta": {
465+
"additionalProperties": true,
466+
"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)",
467+
"type": ["object", "null"]
468+
},
469+
"requestId": {
470+
"allOf": [
471+
{
472+
"$ref": "#/$defs/RequestId"
473+
}
474+
],
475+
"description": "The ID of the request to cancel."
476+
}
477+
},
478+
"required": ["requestId"],
479+
"type": "object",
480+
"x-method": "$/cancel_request",
481+
"x-side": "protocol"
482+
},
461483
"ClientCapabilities": {
462484
"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)",
463485
"properties": {
@@ -1037,6 +1059,12 @@
10371059
"format": "int32",
10381060
"type": "integer"
10391061
},
1062+
{
1063+
"const": -32800,
1064+
"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.",
1065+
"format": "int32",
1066+
"type": "integer"
1067+
},
10401068
{
10411069
"const": -32000,
10421070
"description": "**Authentication required**: Authentication is required before this operation can be performed.",
@@ -1091,7 +1119,9 @@
10911119
"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.",
10921120
"properties": {
10931121
"_meta": {
1094-
"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)"
1122+
"additionalProperties": true,
1123+
"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)",
1124+
"type": ["object", "null"]
10951125
},
10961126
"sessionId": {
10971127
"allOf": [
@@ -1111,7 +1141,9 @@
11111141
"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.",
11121142
"properties": {
11131143
"_meta": {
1114-
"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)"
1144+
"additionalProperties": true,
1145+
"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)",
1146+
"type": ["object", "null"]
11151147
},
11161148
"models": {
11171149
"anyOf": [
@@ -2284,7 +2316,9 @@
22842316
"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.",
22852317
"properties": {
22862318
"_meta": {
2287-
"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)"
2319+
"additionalProperties": true,
2320+
"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)",
2321+
"type": ["object", "null"]
22882322
}
22892323
},
22902324
"type": "object"
@@ -3279,6 +3313,20 @@
32793313
},
32803314
"required": ["jsonrpc"],
32813315
"type": "object"
3316+
},
3317+
{
3318+
"anyOf": [
3319+
{
3320+
"allOf": [
3321+
{
3322+
"$ref": "#/$defs/CancelRequestNotification"
3323+
}
3324+
],
3325+
"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)"
3326+
}
3327+
],
3328+
"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."
32823329
}
3283-
]
3330+
],
3331+
"title": "Agent Client Protocol"
32843332
}

scripts/generate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as fs from "fs/promises";
55
import { dirname } from "path";
66
import * as prettier from "prettier";
77

8-
const CURRENT_SCHEMA_RELEASE = "v0.10.0";
8+
const CURRENT_SCHEMA_RELEASE = "v0.10.1";
99

1010
await main();
1111

src/schema/types.gen.ts

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,34 @@ export type CancelNotification = {
287287
sessionId: SessionId;
288288
};
289289

290+
/**
291+
* **UNSTABLE**
292+
*
293+
* This capability is not part of the spec yet, and may be removed or changed at any point.
294+
*
295+
* Notification to cancel an ongoing request.
296+
*
297+
* See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
298+
*
299+
* @experimental
300+
*/
301+
export type CancelRequestNotification = {
302+
/**
303+
* The _meta property is reserved by ACP to allow clients and agents to attach additional
304+
* metadata to their interactions. Implementations MUST NOT make assumptions about values at
305+
* these keys.
306+
*
307+
* See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
308+
*/
309+
_meta?: {
310+
[key: string]: unknown;
311+
} | null;
312+
/**
313+
* The ID of the request to cancel.
314+
*/
315+
requestId: RequestId;
316+
};
317+
290318
/**
291319
* Capabilities supported by the client.
292320
*
@@ -647,6 +675,7 @@ export type ErrorCode =
647675
| -32601
648676
| -32602
649677
| -32603
678+
| -32800
650679
| -32000
651680
| -32002
652681
| number;
@@ -727,7 +756,9 @@ export type ForkSessionRequest = {
727756
*
728757
* See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
729758
*/
730-
_meta?: unknown;
759+
_meta?: {
760+
[key: string]: unknown;
761+
} | null;
731762
/**
732763
* The ID of the session to fork.
733764
*/
@@ -751,7 +782,9 @@ export type ForkSessionResponse = {
751782
*
752783
* See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
753784
*/
754-
_meta?: unknown;
785+
_meta?: {
786+
[key: string]: unknown;
787+
} | null;
755788
/**
756789
* **UNSTABLE**
757790
*
@@ -1848,7 +1881,9 @@ export type SessionForkCapabilities = {
18481881
*
18491882
* See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
18501883
*/
1851-
_meta?: unknown;
1884+
_meta?: {
1885+
[key: string]: unknown;
1886+
} | null;
18521887
};
18531888

18541889
/**

src/schema/zod.gen.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const zErrorCode = z.union([
8282
z.literal(-32601),
8383
z.literal(-32602),
8484
z.literal(-32603),
85+
z.literal(-32800),
8586
z.literal(-32000),
8687
z.literal(-32002),
8788
z.number().int(),
@@ -455,6 +456,22 @@ export const zReleaseTerminalResponse = z.object({
455456
*/
456457
export const zRequestId = z.union([z.null(), z.coerce.bigint(), z.string()]);
457458

459+
/**
460+
* **UNSTABLE**
461+
*
462+
* This capability is not part of the spec yet, and may be removed or changed at any point.
463+
*
464+
* Notification to cancel an ongoing request.
465+
*
466+
* See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
467+
*
468+
* @experimental
469+
*/
470+
export const zCancelRequestNotification = z.object({
471+
_meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(),
472+
requestId: zRequestId,
473+
});
474+
458475
/**
459476
* The sender or recipient of messages and data in a conversation.
460477
*/
@@ -547,7 +564,7 @@ export const zRequestPermissionResponse = z.object({
547564
* @experimental
548565
*/
549566
export const zSessionForkCapabilities = z.object({
550-
_meta: z.unknown().optional(),
567+
_meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(),
551568
});
552569

553570
/**
@@ -605,7 +622,7 @@ export const zCreateTerminalRequest = z.object({
605622
* @experimental
606623
*/
607624
export const zForkSessionRequest = z.object({
608-
_meta: z.unknown().optional(),
625+
_meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(),
609626
sessionId: zSessionId,
610627
});
611628

@@ -821,7 +838,7 @@ export const zSessionModelState = z.object({
821838
* @experimental
822839
*/
823840
export const zForkSessionResponse = z.object({
824-
_meta: z.unknown().optional(),
841+
_meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(),
825842
models: z.union([zSessionModelState, z.null()]).optional(),
826843
modes: z.union([zSessionModeState, z.null()]).optional(),
827844
sessionId: zSessionId,

0 commit comments

Comments
 (0)