Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dotnet/src/SdkProtocolVersion.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by generate-protocol-version.ts. DO NOT EDIT.
// Code generated by update-protocol-version.ts. DO NOT EDIT.

namespace GitHub.Copilot.SDK;

Expand Down
2 changes: 1 addition & 1 deletion go/sdk_protocol_version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"lint:fix": "eslint --fix \"src/**/*.ts\" \"test/**/*.ts\"",
"typecheck": "tsc --noEmit",
"generate:session-types": "tsx scripts/generate-session-types.ts",
"update:protocol-version": "tsx scripts/generate-protocol-version.ts",
"update:protocol-version": "tsx scripts/update-protocol-version.ts",
"prepublishOnly": "npm run build",
"package": "npm run clean && npm run build && node scripts/set-version.js && npm pack && npm version 0.1.0 --no-git-tag-version --allow-same-version"
},
Expand Down
31 changes: 28 additions & 3 deletions nodejs/scripts/update-protocol-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Generates SDK protocol version constants for all SDK languages.
*
* Reads from sdk-protocol-version.json and generates:
* - nodejs/src/sdkProtocolVersion.ts
* - go/sdk_protocol_version.go
* - python/copilot/sdk_protocol_version.py
* - dotnet/src/SdkProtocolVersion.cs
Expand All @@ -26,8 +27,32 @@ const version = versionFile.version;

console.log(`Generating SDK protocol version constants for version ${version}...`);

// Generate TypeScript
const tsCode = `/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/

// Code generated by update-protocol-version.ts. DO NOT EDIT.

/**
* The SDK protocol version.
* This must match the version expected by the copilot-agent-runtime server.
*/
export const SDK_PROTOCOL_VERSION = ${version};

/**
* Gets the SDK protocol version.
* @returns The protocol version number
*/
export function getSdkProtocolVersion(): number {
return SDK_PROTOCOL_VERSION;
}
`;
fs.writeFileSync(path.join(rootDir, "nodejs", "src", "sdkProtocolVersion.ts"), tsCode);
console.log(" ✓ nodejs/src/sdkProtocolVersion.ts");

// Generate Go
const goCode = `// Code generated by generate-protocol-version.ts. DO NOT EDIT.
const goCode = `// Code generated by update-protocol-version.ts. DO NOT EDIT.

package copilot

Expand All @@ -44,7 +69,7 @@ fs.writeFileSync(path.join(rootDir, "go", "sdk_protocol_version.go"), goCode);
console.log(" ✓ go/sdk_protocol_version.go");

// Generate Python
const pythonCode = `# Code generated by generate-protocol-version.ts. DO NOT EDIT.
const pythonCode = `# Code generated by update-protocol-version.ts. DO NOT EDIT.

"""
SDK Protocol Version for the Copilot SDK.
Expand All @@ -68,7 +93,7 @@ fs.writeFileSync(path.join(rootDir, "python", "copilot", "sdk_protocol_version.p
console.log(" ✓ python/copilot/sdk_protocol_version.py");

// Generate C#
const csharpCode = `// Code generated by generate-protocol-version.ts. DO NOT EDIT.
const csharpCode = `// Code generated by update-protocol-version.ts. DO NOT EDIT.

namespace GitHub.Copilot.SDK;

Expand Down
12 changes: 9 additions & 3 deletions nodejs/src/sdkProtocolVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/

import sdkProtocolVersion from "../../sdk-protocol-version.json";
// Code generated by update-protocol-version.ts. DO NOT EDIT.

/**
* Gets the SDK protocol version from sdk-protocol-version.json.
* The SDK protocol version.
* This must match the version expected by the copilot-agent-runtime server.
*/
export const SDK_PROTOCOL_VERSION = 1;

/**
* Gets the SDK protocol version.
* @returns The protocol version number
*/
export function getSdkProtocolVersion(): number {
return sdkProtocolVersion.version;
return SDK_PROTOCOL_VERSION;
}
2 changes: 1 addition & 1 deletion python/copilot/sdk_protocol_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Code generated by generate-protocol-version.ts. DO NOT EDIT.
# Code generated by update-protocol-version.ts. DO NOT EDIT.

"""
SDK Protocol Version for the Copilot SDK.
Expand Down
Loading