66 * Generates SDK protocol version constants for all SDK languages.
77 *
88 * Reads from sdk-protocol-version.json and generates:
9+ * - nodejs/src/sdkProtocolVersion.ts
910 * - go/sdk_protocol_version.go
1011 * - python/copilot/sdk_protocol_version.py
1112 * - dotnet/src/SdkProtocolVersion.cs
@@ -26,8 +27,32 @@ const version = versionFile.version;
2627
2728console . log ( `Generating SDK protocol version constants for version ${ version } ...` ) ;
2829
30+ // Generate TypeScript
31+ const tsCode = `/*---------------------------------------------------------------------------------------------
32+ * Copyright (c) Microsoft Corporation. All rights reserved.
33+ *--------------------------------------------------------------------------------------------*/
34+
35+ // Code generated by update-protocol-version.ts. DO NOT EDIT.
36+
37+ /**
38+ * The SDK protocol version.
39+ * This must match the version expected by the copilot-agent-runtime server.
40+ */
41+ export const SDK_PROTOCOL_VERSION = ${ version } ;
42+
43+ /**
44+ * Gets the SDK protocol version.
45+ * @returns The protocol version number
46+ */
47+ export function getSdkProtocolVersion(): number {
48+ return SDK_PROTOCOL_VERSION;
49+ }
50+ ` ;
51+ fs . writeFileSync ( path . join ( rootDir , "nodejs" , "src" , "sdkProtocolVersion.ts" ) , tsCode ) ;
52+ console . log ( " ✓ nodejs/src/sdkProtocolVersion.ts" ) ;
53+
2954// Generate Go
30- const goCode = `// Code generated by generate -protocol-version.ts. DO NOT EDIT.
55+ const goCode = `// Code generated by update -protocol-version.ts. DO NOT EDIT.
3156
3257package copilot
3358
@@ -44,7 +69,7 @@ fs.writeFileSync(path.join(rootDir, "go", "sdk_protocol_version.go"), goCode);
4469console . log ( " ✓ go/sdk_protocol_version.go" ) ;
4570
4671// Generate Python
47- const pythonCode = `# Code generated by generate -protocol-version.ts. DO NOT EDIT.
72+ const pythonCode = `# Code generated by update -protocol-version.ts. DO NOT EDIT.
4873
4974"""
5075SDK Protocol Version for the Copilot SDK.
@@ -68,7 +93,7 @@ fs.writeFileSync(path.join(rootDir, "python", "copilot", "sdk_protocol_version.p
6893console . log ( " ✓ python/copilot/sdk_protocol_version.py" ) ;
6994
7095// Generate C#
71- const csharpCode = `// Code generated by generate -protocol-version.ts. DO NOT EDIT.
96+ const csharpCode = `// Code generated by update -protocol-version.ts. DO NOT EDIT.
7297
7398namespace GitHub.Copilot.SDK;
7499
0 commit comments