Skip to content

Commit e8721b7

Browse files
authored
fix(unstable): Fixes for session/close capabilities (#85)
1 parent 2dd1c28 commit e8721b7

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed

schema/schema.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2863,6 +2863,17 @@
28632863
"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)",
28642864
"type": ["object", "null"]
28652865
},
2866+
"close": {
2867+
"anyOf": [
2868+
{
2869+
"$ref": "#/$defs/SessionCloseCapabilities"
2870+
},
2871+
{
2872+
"type": "null"
2873+
}
2874+
],
2875+
"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/close`."
2876+
},
28662877
"fork": {
28672878
"anyOf": [
28682879
{
@@ -2895,17 +2906,6 @@
28952906
}
28962907
],
28972908
"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`."
2898-
},
2899-
"stop": {
2900-
"anyOf": [
2901-
{
2902-
"$ref": "#/$defs/SessionCloseCapabilities"
2903-
},
2904-
{
2905-
"type": "null"
2906-
}
2907-
],
2908-
"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/close`."
29092909
}
29102910
},
29112911
"type": "object"

scripts/generate.js

Lines changed: 18 additions & 3 deletions
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.11.1";
8+
const CURRENT_SCHEMA_RELEASE = "v0.11.2";
99

1010
await main();
1111

@@ -51,9 +51,24 @@ async function main() {
5151
.replace(`from "zod"`, `from "zod/v4"`)
5252
// Weird type issue
5353
.replaceAll(
54-
"_meta: z.union([z.record(z.unknown()), z.null()]).optional()",
55-
"_meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional()",
54+
"_meta: z.record(z.unknown()).nullish()",
55+
"_meta: z.record(z.string(), z.unknown()).nullish()",
56+
)
57+
.replaceAll("z.record(z.string())", "z.record(z.string(), z.string())")
58+
.replaceAll(
59+
/z\.coerce\s*\.bigint\(\)\s*\.min\(BigInt\("-9223372036854775808"\),\s*\{\s*message:\s*"Invalid value: Expected int64 to be >= -9223372036854775808",\s*\}\s*\)\s*\.max\(BigInt\("9223372036854775807"\),\s*\{\s*message:\s*"Invalid value: Expected int64 to be <= 9223372036854775807",\s*\}\s*\)/gm,
60+
"z.number()",
61+
)
62+
.replaceAll(
63+
/z\.coerce\s*\.bigint\(\)\s*\.gte\(BigInt\(0\)\)\s*\.max\(BigInt\("18446744073709551615"\),\s*\{\s*message:\s*"Invalid value: Expected uint64 to be <= 18446744073709551615",\s*\}\s*\)/gm,
64+
"z.number()",
5665
),
66+
67+
// .replaceAll(
68+
// /z\s*\.coerce\s*\.bigint\(\)\s*\.min\([\s\S]+?\)\s*\.max\([\s\S]+?\)/gm,
69+
70+
// "z.number()",
71+
// ),
5772
),
5873
);
5974

src/schema/types.gen.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,35 +2281,35 @@ export type SessionCapabilities = {
22812281
*
22822282
* This capability is not part of the spec yet, and may be removed or changed at any point.
22832283
*
2284-
* Whether the agent supports `session/fork`.
2284+
* Whether the agent supports `session/close`.
22852285
*
22862286
* @experimental
22872287
*/
2288-
fork?: SessionForkCapabilities | null;
2289-
/**
2290-
* Whether the agent supports `session/list`.
2291-
*/
2292-
list?: SessionListCapabilities | null;
2288+
close?: SessionCloseCapabilities | null;
22932289
/**
22942290
* **UNSTABLE**
22952291
*
22962292
* This capability is not part of the spec yet, and may be removed or changed at any point.
22972293
*
2298-
* Whether the agent supports `session/resume`.
2294+
* Whether the agent supports `session/fork`.
22992295
*
23002296
* @experimental
23012297
*/
2302-
resume?: SessionResumeCapabilities | null;
2298+
fork?: SessionForkCapabilities | null;
2299+
/**
2300+
* Whether the agent supports `session/list`.
2301+
*/
2302+
list?: SessionListCapabilities | null;
23032303
/**
23042304
* **UNSTABLE**
23052305
*
23062306
* This capability is not part of the spec yet, and may be removed or changed at any point.
23072307
*
2308-
* Whether the agent supports `session/close`.
2308+
* Whether the agent supports `session/resume`.
23092309
*
23102310
* @experimental
23112311
*/
2312-
stop?: SessionCloseCapabilities | null;
2312+
resume?: SessionResumeCapabilities | null;
23132313
};
23142314

23152315
/**

src/schema/zod.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,10 +1156,10 @@ export const zSessionResumeCapabilities = z.object({
11561156
*/
11571157
export const zSessionCapabilities = z.object({
11581158
_meta: z.record(z.string(), z.unknown()).nullish(),
1159+
close: zSessionCloseCapabilities.nullish(),
11591160
fork: zSessionForkCapabilities.nullish(),
11601161
list: zSessionListCapabilities.nullish(),
11611162
resume: zSessionResumeCapabilities.nullish(),
1162-
stop: zSessionCloseCapabilities.nullish(),
11631163
});
11641164

11651165
/**

0 commit comments

Comments
 (0)