@@ -5,7 +5,7 @@ import { generate } from "ts-to-zod";
55import * as fs from "fs/promises" ;
66import { dirname } from "path" ;
77
8- const CURRENT_SCHEMA_RELEASE = "v0.6.3 " ;
8+ const CURRENT_SCHEMA_RELEASE = "v0.8.0 " ;
99
1010await downloadSchemas ( CURRENT_SCHEMA_RELEASE ) ;
1111
@@ -39,8 +39,8 @@ async function downloadFile(url, outputPath) {
3939async 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
6060const tsSrc = await compile ( jsonSchema , "Agent Client Protocol" , {
6161 additionalProperties : false ,
62- bannerComment : false ,
62+ strictIndexSignatures : true ,
6363} ) ;
6464
6565const zodGenerator = generate ( {
@@ -70,15 +70,15 @@ const zodGenerator = generate({
7070const zodSchemas = zodGenerator . getZodSchemasFile ( ) ;
7171
7272const schemaTs = `
73+ import { z } from "zod";
74+
7375export const AGENT_METHODS = ${ JSON . stringify ( metadata . agentMethods , null , 2 ) } as const;
7476
7577export const CLIENT_METHODS = ${ JSON . stringify ( metadata . clientMethods , null , 2 ) } as const;
7678
7779export 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 ( / t y p e o f g e n e r a t e d ./ 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 ] * ?\* \* U N S T A B L E \* \* [ \s \S ] * ?) ( \n \s * ) \* \/ / g,
99+ "$1$2*$2* @experimental$2*/" ,
100+ ) ;
109101
110102 return result ;
111103}
0 commit comments