Skip to content

Commit b062afb

Browse files
committed
chore: Update to v0.8.0 of the JSON Schema
1 parent fd28121 commit b062afb

File tree

6 files changed

+2713
-2504
lines changed

6 files changed

+2713
-2504
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default [
1414
"*.min.js",
1515
"*.config.js",
1616
".github/",
17+
"src/schema.ts",
1718
],
1819
},
1920
js.configs.recommended,

schema/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"authenticate": "authenticate",
44
"initialize": "initialize",
55
"session_cancel": "session/cancel",
6+
"session_list": "session/list",
67
"session_load": "session/load",
78
"session_new": "session/new",
89
"session_prompt": "session/prompt",

schema/schema.json

Lines changed: 1295 additions & 828 deletions
Large diffs are not rendered by default.

scripts/generate.js

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { generate } from "ts-to-zod";
55
import * as fs from "fs/promises";
66
import { dirname } from "path";
77

8-
const CURRENT_SCHEMA_RELEASE = "v0.6.3";
8+
const CURRENT_SCHEMA_RELEASE = "v0.8.0";
99

1010
await downloadSchemas(CURRENT_SCHEMA_RELEASE);
1111

@@ -39,8 +39,8 @@ async function downloadFile(url, outputPath) {
3939
async function downloadSchemas(tag) {
4040
const baseUrl = `https://github.com/agentclientprotocol/agent-client-protocol/releases/download/${tag}`;
4141
const files = [
42-
{ url: `${baseUrl}/schema.json`, path: "./schema/schema.json" },
43-
{ url: `${baseUrl}/meta.json`, path: "./schema/meta.json" },
42+
{ url: `${baseUrl}/schema.unstable.json`, path: "./schema/schema.json" },
43+
{ url: `${baseUrl}/meta.unstable.json`, path: "./schema/meta.json" },
4444
];
4545

4646
console.log(`Downloading schemas from release ${tag}...`);
@@ -59,7 +59,7 @@ const metadata = JSON.parse(await fs.readFile("./schema/meta.json", "utf8"));
5959

6060
const tsSrc = await compile(jsonSchema, "Agent Client Protocol", {
6161
additionalProperties: false,
62-
bannerComment: false,
62+
strictIndexSignatures: true,
6363
});
6464

6565
const zodGenerator = generate({
@@ -70,15 +70,15 @@ const zodGenerator = generate({
7070
const zodSchemas = zodGenerator.getZodSchemasFile();
7171

7272
const schemaTs = `
73+
import { z } from "zod";
74+
7375
export const AGENT_METHODS = ${JSON.stringify(metadata.agentMethods, null, 2)} as const;
7476
7577
export const CLIENT_METHODS = ${JSON.stringify(metadata.clientMethods, null, 2)} as const;
7678
7779
export const PROTOCOL_VERSION = ${metadata.version};
7880
79-
import { z } from "zod";
80-
81-
${markSpecificTypesAsInternal(tsSrc)}
81+
${markSpecificTypes(tsSrc)}
8282
8383
${markZodSchemasAsInternal(fixGeneratedZod(zodSchemas))}
8484
`;
@@ -90,22 +90,14 @@ function fixGeneratedZod(src) {
9090
.replace(/typeof generated./g, "typeof ");
9191
}
9292

93-
function markSpecificTypesAsInternal(src) {
94-
const typesToExclude = [
95-
"AgentRequest",
96-
"AgentResponse",
97-
"AgentNotification",
98-
"ClientRequest",
99-
"ClientResponse",
100-
"ClientNotification",
101-
];
102-
93+
function markSpecificTypes(src) {
10394
let result = src;
10495

105-
for (const typeName of typesToExclude) {
106-
const regex = new RegExp(`(export type ${typeName}\\b)`, "g");
107-
result = result.replace(regex, "/** @internal */\n$1");
108-
}
96+
// Replace UNSTABLE comments with @experimental at the end of the comment block
97+
result = result.replace(
98+
/(\/\*\*[\s\S]*?\*\*UNSTABLE\*\*[\s\S]*?)(\n\s*)\*\//g,
99+
"$1$2*$2* @experimental$2*/",
100+
);
109101

110102
return result;
111103
}

src/acp.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ export class TerminalHandle {
379379
*
380380
* Useful for implementing timeouts or cancellation.
381381
*/
382-
async kill(): Promise<schema.KillTerminalResponse> {
382+
async kill(): Promise<schema.KillTerminalCommandResponse> {
383383
return (
384384
(await this.#connection.sendRequest(schema.CLIENT_METHODS.terminal_kill, {
385385
sessionId: this.#sessionId,
@@ -640,6 +640,8 @@ export class ClientSideConnection implements Agent {
640640
* This capability is not part of the spec yet, and may be removed or changed at any point.
641641
*
642642
* Select a model for a given session.
643+
*
644+
* @experimental
643645
*/
644646
async setSessionModel(
645647
params: schema.SetSessionModelRequest,
@@ -1296,7 +1298,7 @@ export interface Client {
12961298
*/
12971299
killTerminal?(
12981300
params: schema.KillTerminalCommandRequest,
1299-
): Promise<schema.KillTerminalResponse | void>;
1301+
): Promise<schema.KillTerminalCommandResponse | void>;
13001302

13011303
/**
13021304
* Extension method
@@ -1400,6 +1402,8 @@ export interface Agent {
14001402
* This capability is not part of the spec yet, and may be removed or changed at any point.
14011403
*
14021404
* Select a model for a given session.
1405+
*
1406+
* @experimental
14031407
*/
14041408
setSessionModel?(
14051409
params: schema.SetSessionModelRequest,

0 commit comments

Comments
 (0)