From 0e6f7261a10a00f43dbbb6361f834d28725ac54b Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Wed, 11 Mar 2026 11:22:37 +0000 Subject: [PATCH] fix(unstable): Fixes for session/close capabilities --- schema/schema.json | 22 +++++++++++----------- scripts/generate.js | 21 ++++++++++++++++++--- src/schema/types.gen.ts | 20 ++++++++++---------- src/schema/zod.gen.ts | 2 +- 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/schema/schema.json b/schema/schema.json index 684ab92..e179a60 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -2863,6 +2863,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"] }, + "close": { + "anyOf": [ + { + "$ref": "#/$defs/SessionCloseCapabilities" + }, + { + "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/close`." + }, "fork": { "anyOf": [ { @@ -2895,17 +2906,6 @@ } ], "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`." - }, - "stop": { - "anyOf": [ - { - "$ref": "#/$defs/SessionCloseCapabilities" - }, - { - "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/close`." } }, "type": "object" diff --git a/scripts/generate.js b/scripts/generate.js index 32e5c2d..2bfe01a 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.11.1"; +const CURRENT_SCHEMA_RELEASE = "v0.11.2"; await main(); @@ -51,9 +51,24 @@ async function main() { .replace(`from "zod"`, `from "zod/v4"`) // Weird type issue .replaceAll( - "_meta: z.union([z.record(z.unknown()), z.null()]).optional()", - "_meta: z.union([z.record(z.string(), z.unknown()), z.null()]).optional()", + "_meta: z.record(z.unknown()).nullish()", + "_meta: z.record(z.string(), z.unknown()).nullish()", + ) + .replaceAll("z.record(z.string())", "z.record(z.string(), z.string())") + .replaceAll( + /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, + "z.number()", + ) + .replaceAll( + /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, + "z.number()", ), + + // .replaceAll( + // /z\s*\.coerce\s*\.bigint\(\)\s*\.min\([\s\S]+?\)\s*\.max\([\s\S]+?\)/gm, + + // "z.number()", + // ), ), ); diff --git a/src/schema/types.gen.ts b/src/schema/types.gen.ts index 2197421..8f3e4cd 100644 --- a/src/schema/types.gen.ts +++ b/src/schema/types.gen.ts @@ -2281,35 +2281,35 @@ export type SessionCapabilities = { * * This capability is not part of the spec yet, and may be removed or changed at any point. * - * Whether the agent supports `session/fork`. + * Whether the agent supports `session/close`. * * @experimental */ - fork?: SessionForkCapabilities | null; - /** - * Whether the agent supports `session/list`. - */ - list?: SessionListCapabilities | null; + close?: SessionCloseCapabilities | 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`. + * Whether the agent supports `session/fork`. * * @experimental */ - resume?: SessionResumeCapabilities | null; + fork?: SessionForkCapabilities | null; + /** + * Whether the agent supports `session/list`. + */ + 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/close`. + * Whether the agent supports `session/resume`. * * @experimental */ - stop?: SessionCloseCapabilities | null; + resume?: SessionResumeCapabilities | null; }; /** diff --git a/src/schema/zod.gen.ts b/src/schema/zod.gen.ts index 54d4b01..40a3b56 100644 --- a/src/schema/zod.gen.ts +++ b/src/schema/zod.gen.ts @@ -1156,10 +1156,10 @@ export const zSessionResumeCapabilities = z.object({ */ export const zSessionCapabilities = z.object({ _meta: z.record(z.string(), z.unknown()).nullish(), + close: zSessionCloseCapabilities.nullish(), fork: zSessionForkCapabilities.nullish(), list: zSessionListCapabilities.nullish(), resume: zSessionResumeCapabilities.nullish(), - stop: zSessionCloseCapabilities.nullish(), }); /**