From bd3b36bbf4de3de9476ff21a507246ae9191e7b3 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:11:36 -0700 Subject: [PATCH 01/23] Bump Copilot CLI packages to @github/copilot@1.0.64-1 and @github/copilot-sdk@1.0.3 --- extensions/copilot/package-lock.json | 170 ++++++--------------------- extensions/copilot/package.json | 2 +- package-lock.json | 150 +++++++---------------- package.json | 4 +- remote/package-lock.json | 150 +++++++---------------- remote/package.json | 4 +- 6 files changed, 126 insertions(+), 354 deletions(-) diff --git a/extensions/copilot/package-lock.json b/extensions/copilot/package-lock.json index 765ab4aee4ee70..04682c7d7cc23b 100644 --- a/extensions/copilot/package-lock.json +++ b/extensions/copilot/package-lock.json @@ -13,7 +13,7 @@ "@anthropic-ai/claude-agent-sdk": "0.2.112", "@anthropic-ai/sdk": "^0.82.0", "@github/blackbird-external-ingest-utils": "^0.3.0", - "@github/copilot": "^1.0.64-0", + "@github/copilot": "^1.0.64-1", "@google/genai": "^1.22.0", "@humanwhocodes/gitignore-to-minimatch": "1.0.2", "@microsoft/tiktokenizer": "^1.0.10", @@ -2948,32 +2948,31 @@ "license": "MIT" }, "node_modules/@github/copilot": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.64-0.tgz", - "integrity": "sha512-PlH7ByBHjmPLqLXS4CE2q8hN6CFEfkCMV6ScBEzW/u73+KYQB4fGNouo8Lr8okL6D5CW5rzPJbsXyISyJqVOZg==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.64-1.tgz", + "integrity": "sha512-lojV4Cb7oT4VJnYPEKBRH8KI3W43Q4Lh0Pc+V6sej+xjPJkoqwm68sNKn73/p3wXPBSTVTzPeCm9WhIisgf1Jw==", "license": "SEE LICENSE IN LICENSE.md", "dependencies": { - "detect-libc": "^2.1.2", - "os-theme": "^0.0.8" + "detect-libc": "^2.1.2" }, "bin": { "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.64-0", - "@github/copilot-darwin-x64": "1.0.64-0", - "@github/copilot-linux-arm64": "1.0.64-0", - "@github/copilot-linux-x64": "1.0.64-0", - "@github/copilot-linuxmusl-arm64": "1.0.64-0", - "@github/copilot-linuxmusl-x64": "1.0.64-0", - "@github/copilot-win32-arm64": "1.0.64-0", - "@github/copilot-win32-x64": "1.0.64-0" + "@github/copilot-darwin-arm64": "1.0.64-1", + "@github/copilot-darwin-x64": "1.0.64-1", + "@github/copilot-linux-arm64": "1.0.64-1", + "@github/copilot-linux-x64": "1.0.64-1", + "@github/copilot-linuxmusl-arm64": "1.0.64-1", + "@github/copilot-linuxmusl-x64": "1.0.64-1", + "@github/copilot-win32-arm64": "1.0.64-1", + "@github/copilot-win32-x64": "1.0.64-1" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.64-0.tgz", - "integrity": "sha512-97DUGiuYrkCYOlSSLWMmr+K0uGzAxz1JOL/GyO/7mNl6V/1xgs6Van1Jj+Dpj4ly96iHE8lUIW8cQNCG66644g==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.64-1.tgz", + "integrity": "sha512-MQHZT9LhmCiq+ogO1E8cPCWrurZ6x+r9lPJfYUSnOyMO+EHbREpiJwOOChxtLHgL2/tKJSZdId2pg3tDgUlcsw==", "cpu": [ "arm64" ], @@ -2987,9 +2986,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.64-0.tgz", - "integrity": "sha512-2PXY4mSFtIjFdRaAt8PakegRgGtf6Sz9z6U/dIgVygNfctVNzaL5FH65PNPm8Y80jaDvEcz1/XY5MiQtxnlzZQ==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.64-1.tgz", + "integrity": "sha512-kOQY7CvI7He0eO3ObQAHePWdkNLWAOegCSzUqUmdcpa1SNVqbZ3GBMsQ7uAZQip2cQxnGZ7pS1v6tKQ0HJdkYw==", "cpu": [ "x64" ], @@ -3003,15 +3002,12 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.64-0.tgz", - "integrity": "sha512-PLP+vR508fOTlCr9CSZiXi9geicHKXuX9jLGdwNqK2TMZO5TqCLz8wP7dBEmkdkeXcFKovMb8nQVB1Toc6xutw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.64-1.tgz", + "integrity": "sha512-hIfuO7Q+pWs0SKfIRYqT+CjMaupudnhp4RMS6XoJ5s/e33rvpj2tkTkXYlHJo1PMDI823vvbqgpEdr+KeewMwg==", "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -3022,15 +3018,12 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.64-0.tgz", - "integrity": "sha512-NvVjQ69zr390ijzo2f75+v0DHm6xnvPbi67ugnKDk7ZPbx8P3vSxVdAnrzrrL4T3T8ng3pJANcC4p+eGbx+UDw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.64-1.tgz", + "integrity": "sha512-VHaE62pha0rDDvuNN3bd97gf0EZ+EJebstM1ejHsMYoPT1IOUkYEXlNfGGHY+GfUGYxAiy/+Uew4xw5mJyy/Sw==", "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -3041,15 +3034,12 @@ } }, "node_modules/@github/copilot-linuxmusl-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.64-0.tgz", - "integrity": "sha512-qCnVF5vIcTO74CukAENZo8e5nqXm4QUshuKN69aiZb5GOhVvyyIKsf5Jo7ikZt54jJBHycAMUKlTA8L3/nK+KA==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.64-1.tgz", + "integrity": "sha512-L/YrZPotRujAP0QERq+DlkR1SLr7abbTSz/56JqKKOqEdjKZPdQW1bUlhL/w1CZg1gXlTNUsNVyKz/fUfrEBgw==", "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -3060,15 +3050,12 @@ } }, "node_modules/@github/copilot-linuxmusl-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.64-0.tgz", - "integrity": "sha512-WDBEmkBk1RulTfdLK5IuttNBadjLOBpvQyonGQ/aLeaetRNNdapoygrSjFU7q1QBSenmCyanXH6D+TS7tP3Qsw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.64-1.tgz", + "integrity": "sha512-AGMjXqR128oyjiJhoI6Gd7JP5ddWkib+P4YH/JoHm05iNn23ZYl4tSc0XihHzeyMI1ix7Aacn8UINYB7lGOGOA==", "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -3079,9 +3066,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.64-0.tgz", - "integrity": "sha512-PC7yuUKcVbhli4bpzWFVT3juxj+v/iONazetNe3tMpHWza3W7MeFRifzAseSErKQCt2fHJth3m8bQAwFN2jfrA==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.64-1.tgz", + "integrity": "sha512-vvv+gnemi9WKaxF41zz7Xmq6a493n8Yjps5UFaOY6a3WR222kKXZXfOpeRvIYsDgnIPHGBHIj1TBOmnHQT4V4w==", "cpu": [ "arm64" ], @@ -3095,9 +3082,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.64-0.tgz", - "integrity": "sha512-d2fnUTIlqNxCqS2PuV+FD99ZOYBaX72OLtAmphbKyz36KyZ6D4ssiu8M4vHVTKWWdyc3TWiLsnIB+ryWdv1gGw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.64-1.tgz", + "integrity": "sha512-mcHvD0fjGDuqr/YXzy8mKuDmah1F+qjPujxoFuGmabmTJZ33cSIJ3nq7RRvxZNIdp8YJ57NkbcW30WvIcOeJ3w==", "cpu": [ "x64" ], @@ -4869,45 +4856,6 @@ "node": ">=14" } }, - "node_modules/@os-theme/darwin-arm64": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@os-theme/darwin-arm64/-/darwin-arm64-0.0.8.tgz", - "integrity": "sha512-gMsOs+8Ju396a5yyMWigkbA0dMTxD78U3HzG3mlpiAyn6hfd5dbyI4VGP+sfTB82KGgWLzIhWWTFX5UYY6iX0A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@os-theme/linux-x64": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@os-theme/linux-x64/-/linux-x64-0.0.8.tgz", - "integrity": "sha512-zvjmBUiSQPjM1RbhpsfCDYMJxW4eLlGmkFPnpteC/03X2lz6CjiX2hfbN2EWLxXjNnIje3Jqaen8IsqEnWrRBg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@os-theme/win32-x64": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@os-theme/win32-x64/-/win32-x64-0.0.8.tgz", - "integrity": "sha512-N3yxKNbVl2IBa/ncDuq55QhwqwUjnYLJxDKMEmYeJbLIV950qZNojPw3scXA6PbfxPZfIiRa8iz1pzNg9XxP8w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@oxc-project/types": { "version": "0.133.0", "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.133.0.tgz", @@ -5100,9 +5048,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5120,9 +5065,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -5140,9 +5082,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5160,9 +5099,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5180,9 +5116,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5200,9 +5133,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -11942,9 +11872,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -11966,9 +11893,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -11990,9 +11914,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -12014,9 +11935,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -13595,20 +13513,6 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/os-theme": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/os-theme/-/os-theme-0.0.8.tgz", - "integrity": "sha512-u1q3bLSv5uMHNIiPItkfDrHXu6ZFs2juwqxWREFM/uVBa+7Kkhy2v49LmJev2JcinGwqiEccElB/XsH9gwasuA==", - "license": "MIT", - "optionalDependencies": { - "@os-theme/darwin-arm64": "0.0.8", - "@os-theme/linux-x64": "0.0.8", - "@os-theme/win32-x64": "0.0.8" - }, - "peerDependencies": { - "typescript": "^5" - } - }, "node_modules/outdent": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/outdent/-/outdent-0.8.0.tgz", diff --git a/extensions/copilot/package.json b/extensions/copilot/package.json index e38fd8751e2077..7f336edf0f6c6f 100644 --- a/extensions/copilot/package.json +++ b/extensions/copilot/package.json @@ -7104,7 +7104,7 @@ "@anthropic-ai/claude-agent-sdk": "0.2.112", "@anthropic-ai/sdk": "^0.82.0", "@github/blackbird-external-ingest-utils": "^0.3.0", - "@github/copilot": "^1.0.64-0", + "@github/copilot": "^1.0.64-1", "@google/genai": "^1.22.0", "@humanwhocodes/gitignore-to-minimatch": "1.0.2", "@microsoft/tiktokenizer": "^1.0.10", diff --git a/package-lock.json b/package-lock.json index 5a343cdc62b701..30ae109be0071b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,8 +11,8 @@ "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.82.0", - "@github/copilot": "^1.0.64-0", - "@github/copilot-sdk": "^1.0.2", + "@github/copilot": "^1.0.64-1", + "@github/copilot-sdk": "^1.0.3", "@microsoft/1ds-core-js": "^3.2.13", "@microsoft/1ds-post-js": "^3.2.13", "@microsoft/dev-tunnels-connections": "^1.3.41", @@ -1085,32 +1085,31 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.64-0.tgz", - "integrity": "sha512-PlH7ByBHjmPLqLXS4CE2q8hN6CFEfkCMV6ScBEzW/u73+KYQB4fGNouo8Lr8okL6D5CW5rzPJbsXyISyJqVOZg==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.64-1.tgz", + "integrity": "sha512-lojV4Cb7oT4VJnYPEKBRH8KI3W43Q4Lh0Pc+V6sej+xjPJkoqwm68sNKn73/p3wXPBSTVTzPeCm9WhIisgf1Jw==", "license": "SEE LICENSE IN LICENSE.md", "dependencies": { - "detect-libc": "^2.1.2", - "os-theme": "^0.0.8" + "detect-libc": "^2.1.2" }, "bin": { "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.64-0", - "@github/copilot-darwin-x64": "1.0.64-0", - "@github/copilot-linux-arm64": "1.0.64-0", - "@github/copilot-linux-x64": "1.0.64-0", - "@github/copilot-linuxmusl-arm64": "1.0.64-0", - "@github/copilot-linuxmusl-x64": "1.0.64-0", - "@github/copilot-win32-arm64": "1.0.64-0", - "@github/copilot-win32-x64": "1.0.64-0" + "@github/copilot-darwin-arm64": "1.0.64-1", + "@github/copilot-darwin-x64": "1.0.64-1", + "@github/copilot-linux-arm64": "1.0.64-1", + "@github/copilot-linux-x64": "1.0.64-1", + "@github/copilot-linuxmusl-arm64": "1.0.64-1", + "@github/copilot-linuxmusl-x64": "1.0.64-1", + "@github/copilot-win32-arm64": "1.0.64-1", + "@github/copilot-win32-x64": "1.0.64-1" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.64-0.tgz", - "integrity": "sha512-97DUGiuYrkCYOlSSLWMmr+K0uGzAxz1JOL/GyO/7mNl6V/1xgs6Van1Jj+Dpj4ly96iHE8lUIW8cQNCG66644g==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.64-1.tgz", + "integrity": "sha512-MQHZT9LhmCiq+ogO1E8cPCWrurZ6x+r9lPJfYUSnOyMO+EHbREpiJwOOChxtLHgL2/tKJSZdId2pg3tDgUlcsw==", "cpu": [ "arm64" ], @@ -1124,9 +1123,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.64-0.tgz", - "integrity": "sha512-2PXY4mSFtIjFdRaAt8PakegRgGtf6Sz9z6U/dIgVygNfctVNzaL5FH65PNPm8Y80jaDvEcz1/XY5MiQtxnlzZQ==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.64-1.tgz", + "integrity": "sha512-kOQY7CvI7He0eO3ObQAHePWdkNLWAOegCSzUqUmdcpa1SNVqbZ3GBMsQ7uAZQip2cQxnGZ7pS1v6tKQ0HJdkYw==", "cpu": [ "x64" ], @@ -1140,15 +1139,12 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.64-0.tgz", - "integrity": "sha512-PLP+vR508fOTlCr9CSZiXi9geicHKXuX9jLGdwNqK2TMZO5TqCLz8wP7dBEmkdkeXcFKovMb8nQVB1Toc6xutw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.64-1.tgz", + "integrity": "sha512-hIfuO7Q+pWs0SKfIRYqT+CjMaupudnhp4RMS6XoJ5s/e33rvpj2tkTkXYlHJo1PMDI823vvbqgpEdr+KeewMwg==", "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -1159,15 +1155,12 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.64-0.tgz", - "integrity": "sha512-NvVjQ69zr390ijzo2f75+v0DHm6xnvPbi67ugnKDk7ZPbx8P3vSxVdAnrzrrL4T3T8ng3pJANcC4p+eGbx+UDw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.64-1.tgz", + "integrity": "sha512-VHaE62pha0rDDvuNN3bd97gf0EZ+EJebstM1ejHsMYoPT1IOUkYEXlNfGGHY+GfUGYxAiy/+Uew4xw5mJyy/Sw==", "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -1178,15 +1171,12 @@ } }, "node_modules/@github/copilot-linuxmusl-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.64-0.tgz", - "integrity": "sha512-qCnVF5vIcTO74CukAENZo8e5nqXm4QUshuKN69aiZb5GOhVvyyIKsf5Jo7ikZt54jJBHycAMUKlTA8L3/nK+KA==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.64-1.tgz", + "integrity": "sha512-L/YrZPotRujAP0QERq+DlkR1SLr7abbTSz/56JqKKOqEdjKZPdQW1bUlhL/w1CZg1gXlTNUsNVyKz/fUfrEBgw==", "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -1197,15 +1187,12 @@ } }, "node_modules/@github/copilot-linuxmusl-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.64-0.tgz", - "integrity": "sha512-WDBEmkBk1RulTfdLK5IuttNBadjLOBpvQyonGQ/aLeaetRNNdapoygrSjFU7q1QBSenmCyanXH6D+TS7tP3Qsw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.64-1.tgz", + "integrity": "sha512-AGMjXqR128oyjiJhoI6Gd7JP5ddWkib+P4YH/JoHm05iNn23ZYl4tSc0XihHzeyMI1ix7Aacn8UINYB7lGOGOA==", "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -1216,12 +1203,12 @@ } }, "node_modules/@github/copilot-sdk": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@github/copilot-sdk/-/copilot-sdk-1.0.2.tgz", - "integrity": "sha512-JJDsGM/bA1LGy1Ro/8iC8RLpKsLmuiFdQ67oFAVfi0Hfxyx289teHwmM70ehK76DXBkrPqqcxcliJi56k1ggFA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@github/copilot-sdk/-/copilot-sdk-1.0.3.tgz", + "integrity": "sha512-ujnH2QVw3+xvjgo9cbpY0wik4fNxAmdMDSFnxGScDSvRuK2vUCL2xWW4V2ANc9pWwRHPBpEpMuNJMtmydmLCIQ==", "license": "MIT", "dependencies": { - "@github/copilot": "^1.0.64-0", + "@github/copilot": "^1.0.64-1", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.6" }, @@ -1239,9 +1226,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.64-0.tgz", - "integrity": "sha512-PC7yuUKcVbhli4bpzWFVT3juxj+v/iONazetNe3tMpHWza3W7MeFRifzAseSErKQCt2fHJth3m8bQAwFN2jfrA==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.64-1.tgz", + "integrity": "sha512-vvv+gnemi9WKaxF41zz7Xmq6a493n8Yjps5UFaOY6a3WR222kKXZXfOpeRvIYsDgnIPHGBHIj1TBOmnHQT4V4w==", "cpu": [ "arm64" ], @@ -1255,9 +1242,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.64-0.tgz", - "integrity": "sha512-d2fnUTIlqNxCqS2PuV+FD99ZOYBaX72OLtAmphbKyz36KyZ6D4ssiu8M4vHVTKWWdyc3TWiLsnIB+ryWdv1gGw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.64-1.tgz", + "integrity": "sha512-mcHvD0fjGDuqr/YXzy8mKuDmah1F+qjPujxoFuGmabmTJZ33cSIJ3nq7RRvxZNIdp8YJ57NkbcW30WvIcOeJ3w==", "cpu": [ "x64" ], @@ -2341,45 +2328,6 @@ "node": ">=8.0.0" } }, - "node_modules/@os-theme/darwin-arm64": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@os-theme/darwin-arm64/-/darwin-arm64-0.0.8.tgz", - "integrity": "sha512-gMsOs+8Ju396a5yyMWigkbA0dMTxD78U3HzG3mlpiAyn6hfd5dbyI4VGP+sfTB82KGgWLzIhWWTFX5UYY6iX0A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@os-theme/linux-x64": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@os-theme/linux-x64/-/linux-x64-0.0.8.tgz", - "integrity": "sha512-zvjmBUiSQPjM1RbhpsfCDYMJxW4eLlGmkFPnpteC/03X2lz6CjiX2hfbN2EWLxXjNnIje3Jqaen8IsqEnWrRBg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@os-theme/win32-x64": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@os-theme/win32-x64/-/win32-x64-0.0.8.tgz", - "integrity": "sha512-N3yxKNbVl2IBa/ncDuq55QhwqwUjnYLJxDKMEmYeJbLIV950qZNojPw3scXA6PbfxPZfIiRa8iz1pzNg9XxP8w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@parcel/watcher": { "version": "2.5.6", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.6.tgz", @@ -15028,20 +14976,6 @@ "node": ">=0.10.0" } }, - "node_modules/os-theme": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/os-theme/-/os-theme-0.0.8.tgz", - "integrity": "sha512-u1q3bLSv5uMHNIiPItkfDrHXu6ZFs2juwqxWREFM/uVBa+7Kkhy2v49LmJev2JcinGwqiEccElB/XsH9gwasuA==", - "license": "MIT", - "optionalDependencies": { - "@os-theme/darwin-arm64": "0.0.8", - "@os-theme/linux-x64": "0.0.8", - "@os-theme/win32-x64": "0.0.8" - }, - "peerDependencies": { - "typescript": "^5" - } - }, "node_modules/os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", diff --git a/package.json b/package.json index afdde577903d6a..e2d6cc1e878302 100644 --- a/package.json +++ b/package.json @@ -95,8 +95,8 @@ }, "dependencies": { "@anthropic-ai/sdk": "^0.82.0", - "@github/copilot": "^1.0.64-0", - "@github/copilot-sdk": "^1.0.2", + "@github/copilot": "^1.0.64-1", + "@github/copilot-sdk": "^1.0.3", "@microsoft/1ds-core-js": "^3.2.13", "@microsoft/1ds-post-js": "^3.2.13", "@microsoft/dev-tunnels-connections": "^1.3.41", diff --git a/remote/package-lock.json b/remote/package-lock.json index a829c6d5946004..c8bcd6e93056fd 100644 --- a/remote/package-lock.json +++ b/remote/package-lock.json @@ -8,8 +8,8 @@ "name": "vscode-reh", "version": "0.0.0", "dependencies": { - "@github/copilot": "^1.0.64-0", - "@github/copilot-sdk": "^1.0.2", + "@github/copilot": "^1.0.64-1", + "@github/copilot-sdk": "^1.0.3", "@microsoft/1ds-core-js": "^3.2.13", "@microsoft/1ds-post-js": "^3.2.13", "@microsoft/mxc-sdk": "0.6.0", @@ -60,32 +60,31 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.64-0.tgz", - "integrity": "sha512-PlH7ByBHjmPLqLXS4CE2q8hN6CFEfkCMV6ScBEzW/u73+KYQB4fGNouo8Lr8okL6D5CW5rzPJbsXyISyJqVOZg==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.64-1.tgz", + "integrity": "sha512-lojV4Cb7oT4VJnYPEKBRH8KI3W43Q4Lh0Pc+V6sej+xjPJkoqwm68sNKn73/p3wXPBSTVTzPeCm9WhIisgf1Jw==", "license": "SEE LICENSE IN LICENSE.md", "dependencies": { - "detect-libc": "^2.1.2", - "os-theme": "^0.0.8" + "detect-libc": "^2.1.2" }, "bin": { "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.64-0", - "@github/copilot-darwin-x64": "1.0.64-0", - "@github/copilot-linux-arm64": "1.0.64-0", - "@github/copilot-linux-x64": "1.0.64-0", - "@github/copilot-linuxmusl-arm64": "1.0.64-0", - "@github/copilot-linuxmusl-x64": "1.0.64-0", - "@github/copilot-win32-arm64": "1.0.64-0", - "@github/copilot-win32-x64": "1.0.64-0" + "@github/copilot-darwin-arm64": "1.0.64-1", + "@github/copilot-darwin-x64": "1.0.64-1", + "@github/copilot-linux-arm64": "1.0.64-1", + "@github/copilot-linux-x64": "1.0.64-1", + "@github/copilot-linuxmusl-arm64": "1.0.64-1", + "@github/copilot-linuxmusl-x64": "1.0.64-1", + "@github/copilot-win32-arm64": "1.0.64-1", + "@github/copilot-win32-x64": "1.0.64-1" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.64-0.tgz", - "integrity": "sha512-97DUGiuYrkCYOlSSLWMmr+K0uGzAxz1JOL/GyO/7mNl6V/1xgs6Van1Jj+Dpj4ly96iHE8lUIW8cQNCG66644g==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.64-1.tgz", + "integrity": "sha512-MQHZT9LhmCiq+ogO1E8cPCWrurZ6x+r9lPJfYUSnOyMO+EHbREpiJwOOChxtLHgL2/tKJSZdId2pg3tDgUlcsw==", "cpu": [ "arm64" ], @@ -99,9 +98,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.64-0.tgz", - "integrity": "sha512-2PXY4mSFtIjFdRaAt8PakegRgGtf6Sz9z6U/dIgVygNfctVNzaL5FH65PNPm8Y80jaDvEcz1/XY5MiQtxnlzZQ==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.64-1.tgz", + "integrity": "sha512-kOQY7CvI7He0eO3ObQAHePWdkNLWAOegCSzUqUmdcpa1SNVqbZ3GBMsQ7uAZQip2cQxnGZ7pS1v6tKQ0HJdkYw==", "cpu": [ "x64" ], @@ -115,15 +114,12 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.64-0.tgz", - "integrity": "sha512-PLP+vR508fOTlCr9CSZiXi9geicHKXuX9jLGdwNqK2TMZO5TqCLz8wP7dBEmkdkeXcFKovMb8nQVB1Toc6xutw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.64-1.tgz", + "integrity": "sha512-hIfuO7Q+pWs0SKfIRYqT+CjMaupudnhp4RMS6XoJ5s/e33rvpj2tkTkXYlHJo1PMDI823vvbqgpEdr+KeewMwg==", "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -134,15 +130,12 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.64-0.tgz", - "integrity": "sha512-NvVjQ69zr390ijzo2f75+v0DHm6xnvPbi67ugnKDk7ZPbx8P3vSxVdAnrzrrL4T3T8ng3pJANcC4p+eGbx+UDw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.64-1.tgz", + "integrity": "sha512-VHaE62pha0rDDvuNN3bd97gf0EZ+EJebstM1ejHsMYoPT1IOUkYEXlNfGGHY+GfUGYxAiy/+Uew4xw5mJyy/Sw==", "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -153,15 +146,12 @@ } }, "node_modules/@github/copilot-linuxmusl-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.64-0.tgz", - "integrity": "sha512-qCnVF5vIcTO74CukAENZo8e5nqXm4QUshuKN69aiZb5GOhVvyyIKsf5Jo7ikZt54jJBHycAMUKlTA8L3/nK+KA==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.64-1.tgz", + "integrity": "sha512-L/YrZPotRujAP0QERq+DlkR1SLr7abbTSz/56JqKKOqEdjKZPdQW1bUlhL/w1CZg1gXlTNUsNVyKz/fUfrEBgw==", "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -172,15 +162,12 @@ } }, "node_modules/@github/copilot-linuxmusl-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.64-0.tgz", - "integrity": "sha512-WDBEmkBk1RulTfdLK5IuttNBadjLOBpvQyonGQ/aLeaetRNNdapoygrSjFU7q1QBSenmCyanXH6D+TS7tP3Qsw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.64-1.tgz", + "integrity": "sha512-AGMjXqR128oyjiJhoI6Gd7JP5ddWkib+P4YH/JoHm05iNn23ZYl4tSc0XihHzeyMI1ix7Aacn8UINYB7lGOGOA==", "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "SEE LICENSE IN LICENSE.md", "optional": true, "os": [ @@ -191,12 +178,12 @@ } }, "node_modules/@github/copilot-sdk": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@github/copilot-sdk/-/copilot-sdk-1.0.2.tgz", - "integrity": "sha512-JJDsGM/bA1LGy1Ro/8iC8RLpKsLmuiFdQ67oFAVfi0Hfxyx289teHwmM70ehK76DXBkrPqqcxcliJi56k1ggFA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@github/copilot-sdk/-/copilot-sdk-1.0.3.tgz", + "integrity": "sha512-ujnH2QVw3+xvjgo9cbpY0wik4fNxAmdMDSFnxGScDSvRuK2vUCL2xWW4V2ANc9pWwRHPBpEpMuNJMtmydmLCIQ==", "license": "MIT", "dependencies": { - "@github/copilot": "^1.0.64-0", + "@github/copilot": "^1.0.64-1", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.6" }, @@ -214,9 +201,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.64-0.tgz", - "integrity": "sha512-PC7yuUKcVbhli4bpzWFVT3juxj+v/iONazetNe3tMpHWza3W7MeFRifzAseSErKQCt2fHJth3m8bQAwFN2jfrA==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.64-1.tgz", + "integrity": "sha512-vvv+gnemi9WKaxF41zz7Xmq6a493n8Yjps5UFaOY6a3WR222kKXZXfOpeRvIYsDgnIPHGBHIj1TBOmnHQT4V4w==", "cpu": [ "arm64" ], @@ -230,9 +217,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.64-0", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.64-0.tgz", - "integrity": "sha512-d2fnUTIlqNxCqS2PuV+FD99ZOYBaX72OLtAmphbKyz36KyZ6D4ssiu8M4vHVTKWWdyc3TWiLsnIB+ryWdv1gGw==", + "version": "1.0.64-1", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.64-1.tgz", + "integrity": "sha512-mcHvD0fjGDuqr/YXzy8mKuDmah1F+qjPujxoFuGmabmTJZ33cSIJ3nq7RRvxZNIdp8YJ57NkbcW30WvIcOeJ3w==", "cpu": [ "x64" ], @@ -312,45 +299,6 @@ "node": ">=18.0.0" } }, - "node_modules/@os-theme/darwin-arm64": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@os-theme/darwin-arm64/-/darwin-arm64-0.0.8.tgz", - "integrity": "sha512-gMsOs+8Ju396a5yyMWigkbA0dMTxD78U3HzG3mlpiAyn6hfd5dbyI4VGP+sfTB82KGgWLzIhWWTFX5UYY6iX0A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@os-theme/linux-x64": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@os-theme/linux-x64/-/linux-x64-0.0.8.tgz", - "integrity": "sha512-zvjmBUiSQPjM1RbhpsfCDYMJxW4eLlGmkFPnpteC/03X2lz6CjiX2hfbN2EWLxXjNnIje3Jqaen8IsqEnWrRBg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@os-theme/win32-x64": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@os-theme/win32-x64/-/win32-x64-0.0.8.tgz", - "integrity": "sha512-N3yxKNbVl2IBa/ncDuq55QhwqwUjnYLJxDKMEmYeJbLIV950qZNojPw3scXA6PbfxPZfIiRa8iz1pzNg9XxP8w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@parcel/watcher": { "version": "2.5.6", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.6.tgz", @@ -1443,20 +1391,6 @@ "ot": "bin/ot" } }, - "node_modules/os-theme": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/os-theme/-/os-theme-0.0.8.tgz", - "integrity": "sha512-u1q3bLSv5uMHNIiPItkfDrHXu6ZFs2juwqxWREFM/uVBa+7Kkhy2v49LmJev2JcinGwqiEccElB/XsH9gwasuA==", - "license": "MIT", - "optionalDependencies": { - "@os-theme/darwin-arm64": "0.0.8", - "@os-theme/linux-x64": "0.0.8", - "@os-theme/win32-x64": "0.0.8" - }, - "peerDependencies": { - "typescript": "^5" - } - }, "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", diff --git a/remote/package.json b/remote/package.json index 879eb7d6593b86..8b10a67c006cc0 100644 --- a/remote/package.json +++ b/remote/package.json @@ -3,8 +3,8 @@ "version": "0.0.0", "private": true, "dependencies": { - "@github/copilot": "^1.0.64-0", - "@github/copilot-sdk": "^1.0.2", + "@github/copilot": "^1.0.64-1", + "@github/copilot-sdk": "^1.0.3", "@microsoft/1ds-core-js": "^3.2.13", "@microsoft/1ds-post-js": "^3.2.13", "@microsoft/mxc-sdk": "0.6.0", From eb6576adc99c59ca0cf56c28f51946320268c786 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:11:47 -0700 Subject: [PATCH 02/23] Resolve Agent Host Copilot CLI through @github/copilot/bin.copilot --- .../agentHost/node/copilot/copilotAgent.ts | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/vs/platform/agentHost/node/copilot/copilotAgent.ts b/src/vs/platform/agentHost/node/copilot/copilotAgent.ts index c81b133cdd0380..c962ef75cdd227 100644 --- a/src/vs/platform/agentHost/node/copilot/copilotAgent.ts +++ b/src/vs/platform/agentHost/node/copilot/copilotAgent.ts @@ -77,6 +77,47 @@ function copilotCliLogLevelFor(level: LogLevel): NonNullable { + try { + await fs.access(filePath); + return true; + } catch { + return false; + } +} + +async function resolveCopilotCliPath(nodeModulesUri: URI): Promise { + const copilotPackageUri = URI.joinPath(nodeModulesUri, '@github', 'copilot'); + const packageJsonPath = URI.joinPath(copilotPackageUri, 'package.json').fsPath; + const fallbackPath = URI.joinPath(copilotPackageUri, 'index.js').fsPath; + + let bin: string | undefined; + try { + const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8')) as ICopilotPackageJson; + bin = typeof packageJson.bin === 'string' ? packageJson.bin : packageJson.bin?.copilot; + } catch { + // Fall back below. Older @github/copilot packages used index.js, while + // 1.0.64-1+ resolves through package.json's bin entry. + } + + if (typeof bin === 'string' && bin.length > 0) { + const binPath = join(copilotPackageUri.fsPath, bin); + if (await fileExists(binPath)) { + return binPath; + } + } + + if (await fileExists(fallbackPath)) { + return fallbackPath; + } + + throw new Error(`Unable to resolve @github/copilot CLI path from ${copilotPackageUri.fsPath}`); +} + interface ICreatedWorktree { readonly repositoryRoot: URI; readonly worktree: URI; @@ -631,7 +672,7 @@ export class CopilotAgent extends Disposable implements IAgent { // because @github/copilot's exports map blocks direct subpath access. // FileAccess.asFileUri('') points to the `out/` directory; node_modules is one level up. const nodeModulesUri = URI.joinPath(FileAccess.asFileUri(''), '..', 'node_modules'); - const cliPath = URI.joinPath(nodeModulesUri, '@github', 'copilot', 'index.js').fsPath; + const cliPath = await resolveCopilotCliPath(nodeModulesUri); // The SDK's sandbox auto-detection looks for `//wxc-exec.exe` // (and the Linux/macOS equivalents). VS Code core ships the MXC sandbox binaries From ab77c40c086bee202f9acb2a4473a397f9804fe4 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:12:00 -0700 Subject: [PATCH 03/23] Materialize @github/copilot/sdk from @github/copilot- in extension postinstall --- extensions/copilot/script/postinstall.ts | 150 ++++++++++++++---- .../test/copilotCLISDKUpgrade.spec.ts | 58 ++++++- 2 files changed, 179 insertions(+), 29 deletions(-) diff --git a/extensions/copilot/script/postinstall.ts b/extensions/copilot/script/postinstall.ts index a3a322b2c59320..a135f4bf529bdf 100644 --- a/extensions/copilot/script/postinstall.ts +++ b/extensions/copilot/script/postinstall.ts @@ -60,9 +60,105 @@ const treeSitterGrammars: ITreeSitterGrammar[] = [ ]; const REPO_ROOT = path.join(__dirname, '..'); +const COPILOT_PACKAGE_DIR = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot'); +const COPILOT_CLI_TOP_LEVEL_DIRS = [ + 'worker', + 'definitions', + 'builtin-skills', + 'builtin', + 'tgrep', + 'queries', + 'prebuilds', + 'ripgrep', + 'foundry-local-sdk', + 'pvrecorder', + 'mxc-bin', + 'clipboard', + 'copilot-sdk', + 'schemas', + 'preloads', +]; + +interface ICopilotPackageJson { + exports?: Record; +} + +function isLinuxMuslRuntime(): boolean { + if (process.platform !== 'linux') { + return false; + } + + const report = process.report?.getReport() as { header?: { glibcVersionRuntime?: string } } | undefined; + return !report?.header?.glibcVersionRuntime; +} + +function getCopilotPlatformPackageCandidates(): string[] { + const arch = process.arch; + + if (process.platform === 'linux') { + const linuxCandidates = [`linux-${arch}`, `linuxmusl-${arch}`]; + return isLinuxMuslRuntime() ? linuxCandidates.reverse() : linuxCandidates; + } + + return [`${process.platform}-${arch}`]; +} + +async function resolveCopilotCliSourceDir(): Promise { + const tried: string[] = []; + for (const platformPackage of getCopilotPlatformPackageCandidates()) { + const sourceDir = path.join(REPO_ROOT, 'node_modules', '@github', `copilot-${platformPackage}`); + tried.push(sourceDir); + if (fs.existsSync(path.join(sourceDir, 'sdk', 'index.js'))) { + return sourceDir; + } + } + + if (fs.existsSync(path.join(COPILOT_PACKAGE_DIR, 'sdk', 'index.js'))) { + return COPILOT_PACKAGE_DIR; + } + + throw new Error(`Could not find @github/copilot SDK files. Tried: ${[COPILOT_PACKAGE_DIR, ...tried].join(', ')}`); +} + +async function ensureCopilotSdkExport() { + const packageJsonPath = path.join(COPILOT_PACKAGE_DIR, 'package.json'); + const packageJson = JSON.parse(await fs.promises.readFile(packageJsonPath, 'utf8')) as ICopilotPackageJson; + packageJson.exports = { + ...(packageJson.exports ?? {}), + './sdk': { + types: './sdk/index.d.ts', + import: './sdk/index.js' + } + }; + + await fs.promises.writeFile(packageJsonPath, `${JSON.stringify(packageJson, undefined, 2)}\n`); +} + +async function materializeCopilotCliSdkLayout(): Promise { + const sourceDir = await resolveCopilotCliSourceDir(); + + if (sourceDir !== COPILOT_PACKAGE_DIR) { + await copyCopilotCLIFolders(path.join(sourceDir, 'sdk'), path.join(COPILOT_PACKAGE_DIR, 'sdk')); + for (const dir of COPILOT_CLI_TOP_LEVEL_DIRS) { + const sourcePath = path.join(sourceDir, dir); + if (fs.existsSync(sourcePath)) { + await copyCopilotCLIFolders(sourcePath, path.join(COPILOT_PACKAGE_DIR, dir)); + } + } + + for (const entry of await fs.promises.readdir(sourceDir)) { + if (entry.startsWith('tree-sitter') && entry.endsWith('.wasm')) { + await fs.promises.copyFile(path.join(sourceDir, entry), path.join(COPILOT_PACKAGE_DIR, entry)); + } + } + } + + await ensureCopilotSdkExport(); + return sourceDir; +} async function removeCopilotCLIShim() { - const shimsPath = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'shims.txt'); + const shimsPath = path.join(COPILOT_PACKAGE_DIR, 'shims.txt'); await fs.promises.rm(shimsPath, { force: true }).catch(() => { /* ignore */ }); } @@ -70,44 +166,44 @@ async function removeCopilotCLIShim() { * @github/copilot/sdk/index.js depends on @github/copilot/worker/*.js files. * We need to copy these files into the sdk directory to ensure they are available at runtime. */ -async function copyCopilotCliWorkerFiles() { - const sourceDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'worker'); - const targetDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'sdk', 'worker'); +async function copyCopilotCliWorkerFiles(copilotCliSourceDir: string) { + const sourceDir = path.join(copilotCliSourceDir, 'worker'); + const targetDir = path.join(COPILOT_PACKAGE_DIR, 'sdk', 'worker'); await copyCopilotCLIFolders(sourceDir, targetDir); } -async function copyCopilotCliTGrepFiles() { - const sourceDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'tgrep'); - const targetDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'sdk', 'tgrep'); +async function copyCopilotCliTGrepFiles(copilotCliSourceDir: string) { + const sourceDir = path.join(copilotCliSourceDir, 'tgrep'); + const targetDir = path.join(COPILOT_PACKAGE_DIR, 'sdk', 'tgrep'); await copyCopilotCLIFolders(sourceDir, targetDir); } -async function copyCopilotCliDefinitionFiles() { - const sourceDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'definitions'); - const targetDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'sdk', 'definitions'); +async function copyCopilotCliDefinitionFiles(copilotCliSourceDir: string) { + const sourceDir = path.join(copilotCliSourceDir, 'definitions'); + const targetDir = path.join(COPILOT_PACKAGE_DIR, 'sdk', 'definitions'); await copyCopilotCLIFolders(sourceDir, targetDir); } -async function copyCopilotCliSkillsFiles() { - const sourceDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'builtin-skills'); - const targetDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'sdk', 'builtin-skills'); +async function copyCopilotCliSkillsFiles(copilotCliSourceDir: string) { + const sourceDir = path.join(copilotCliSourceDir, 'builtin-skills'); + const targetDir = path.join(COPILOT_PACKAGE_DIR, 'sdk', 'builtin-skills'); await copyCopilotCLIFolders(sourceDir, targetDir); } -async function copyCopilotCliQueryFiles() { - const sourceDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'queries'); - const targetDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'sdk', 'queries'); +async function copyCopilotCliQueryFiles(copilotCliSourceDir: string) { + const sourceDir = path.join(copilotCliSourceDir, 'queries'); + const targetDir = path.join(COPILOT_PACKAGE_DIR, 'sdk', 'queries'); await copyCopilotCLIFolders(sourceDir, targetDir); } -async function copyCopilotCliPrebuildFiles() { - const sourceDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'prebuilds'); - const targetDir = path.join(REPO_ROOT, 'node_modules', '@github', 'copilot', 'sdk', 'prebuilds'); +async function copyCopilotCliPrebuildFiles(copilotCliSourceDir: string) { + const sourceDir = path.join(copilotCliSourceDir, 'prebuilds'); + const targetDir = path.join(COPILOT_PACKAGE_DIR, 'sdk', 'prebuilds'); await fs.promises.rm(targetDir, { recursive: true, force: true }); await fs.promises.mkdir(targetDir, { recursive: true }); await fs.promises.cp(sourceDir, targetDir, { @@ -115,9 +211,6 @@ async function copyCopilotCliPrebuildFiles() { try { if (fs.statSync(src).isFile()) { const normalizedSrc = src.split(path.sep).join(path.posix.sep); - if (normalizedSrc.includes('/prebuilds/linuxmusl-')) { - return false; - } return src.endsWith('computer.node') || src.endsWith('runtime.node') || src.endsWith('cli-native.node') @@ -191,13 +284,14 @@ async function main() { 'node_modules/@github/blackbird-external-ingest-utils/pkg/nodejs/external_ingest_utils_bg.wasm', ], 'dist'); + const copilotCliSourceDir = await materializeCopilotCliSdkLayout(); await removeCopilotCLIShim(); - await copyCopilotCliWorkerFiles(); - await copyCopilotCliDefinitionFiles(); - await copyCopilotCliSkillsFiles(); - await copyCopilotCliTGrepFiles(); - await copyCopilotCliQueryFiles(); - await copyCopilotCliPrebuildFiles(); + await copyCopilotCliWorkerFiles(copilotCliSourceDir); + await copyCopilotCliDefinitionFiles(copilotCliSourceDir); + await copyCopilotCliSkillsFiles(copilotCliSourceDir); + await copyCopilotCliTGrepFiles(copilotCliSourceDir); + await copyCopilotCliQueryFiles(copilotCliSourceDir); + await copyCopilotCliPrebuildFiles(copilotCliSourceDir); // Check if the base cache file exists (dev-only sanity check, non-fatal in CI) const baseCachePath = path.join('test', 'simulation', 'cache', 'base.sqlite'); diff --git a/extensions/copilot/src/extension/chatSessions/copilotcli/vscode-node/test/copilotCLISDKUpgrade.spec.ts b/extensions/copilot/src/extension/chatSessions/copilotcli/vscode-node/test/copilotCLISDKUpgrade.spec.ts index d3e0c4f38103af..cd17231496af04 100644 --- a/extensions/copilot/src/extension/chatSessions/copilotcli/vscode-node/test/copilotCLISDKUpgrade.spec.ts +++ b/extensions/copilot/src/extension/chatSessions/copilotcli/vscode-node/test/copilotCLISDKUpgrade.spec.ts @@ -19,7 +19,7 @@ describe('CopilotCLI SDK Upgrade', function () { it('should be able to load the SDK without errors', async function () { await import('@github/copilot/sdk'); - }); + }, 10000); it('should not contain new native binaries nor removed native binaries', async function () { // This is a very basic check to ensure that when the Copilot CLI SDK is upgraded, @@ -224,6 +224,9 @@ describe('CopilotCLI SDK Upgrade', function () { continue; } if (!existingBinaries.has(binary)) { + if (isNonCurrentCopilotPlatformBinary(copilotSDKPath, binary) || isNonCurrentPvRecorderBinary(copilotSDKPath, binary)) { + continue; + } errors.push(`Expected native binary missing from Copilot CLI SDK: ${path.relative(copilotSDKPath, binary)}`); } } @@ -238,6 +241,59 @@ describe('CopilotCLI SDK Upgrade', function () { }); }); +const copilotPlatformArchs = new Set([ + 'darwin-arm64', + 'darwin-x64', + 'linux-arm64', + 'linux-x64', + 'linuxmusl-arm64', + 'linuxmusl-x64', + 'win32-arm64', + 'win32-x64', +]); + +function currentCopilotPlatformArch(): string { + const report = process.report?.getReport() as { header?: { glibcVersionRuntime?: string } } | undefined; + if (process.platform === 'linux' && !report?.header?.glibcVersionRuntime) { + return `linuxmusl-${process.arch}`; + } + + return `${process.platform}-${process.arch}`; +} + +function isNonCurrentCopilotPlatformBinary(copilotSDKPath: string, binary: string): boolean { + const relativeSegments = path.relative(copilotSDKPath, binary).split(path.sep); + const platformArch = relativeSegments.find(segment => copilotPlatformArchs.has(segment)); + return platformArch !== undefined && platformArch !== currentCopilotPlatformArch(); +} + +function isNonCurrentPvRecorderBinary(copilotSDKPath: string, binary: string): boolean { + const relative = path.relative(copilotSDKPath, binary).split(path.sep).join(path.posix.sep); + const pvRecorderPrefix = 'pvrecorder/node_modules/@picovoice/pvrecorder-node/lib/'; + if (!relative.startsWith(pvRecorderPrefix)) { + return false; + } + + const currentPlatformArch = currentCopilotPlatformArch(); + if (relative.startsWith(`${pvRecorderPrefix}mac/arm64/`)) { + return currentPlatformArch !== 'darwin-arm64'; + } + if (relative.startsWith(`${pvRecorderPrefix}mac/x86_64/`)) { + return currentPlatformArch !== 'darwin-x64'; + } + if (relative.startsWith(`${pvRecorderPrefix}linux/x86_64/`)) { + return currentPlatformArch !== 'linux-x64' && currentPlatformArch !== 'linuxmusl-x64'; + } + if (relative.startsWith(`${pvRecorderPrefix}windows/amd64/`)) { + return currentPlatformArch !== 'win32-x64'; + } + if (relative.startsWith(`${pvRecorderPrefix}windows/arm64/`)) { + return currentPlatformArch !== 'win32-arm64'; + } + + return false; +} + async function copyBinaries(extensionPath: string) { const copilotSDKPath = path.join(extensionPath, 'node_modules', '@github', 'copilot'); const vscodeRipgrepPath = path.join(copilotSDKPath, 'ripgrep', 'bin', process.platform + '-' + process.arch); From a7ef46c33d1f5f8383109e61d3f9fa386c2984a9 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:12:08 -0700 Subject: [PATCH 04/23] Package @github/copilot-/copilot for Agent Host and linuxmusl --- build/lib/copilot.ts | 72 +++++++++++++++------------------- build/lib/test/copilot.test.ts | 49 +++++++++++++++++++++++ 2 files changed, 80 insertions(+), 41 deletions(-) create mode 100644 build/lib/test/copilot.test.ts diff --git a/build/lib/copilot.ts b/build/lib/copilot.ts index 74babc798f4e46..131dd6bece87a9 100644 --- a/build/lib/copilot.ts +++ b/build/lib/copilot.ts @@ -13,6 +13,7 @@ import * as path from 'path'; export const copilotPlatforms = [ 'darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64', + 'linuxmusl-arm64', 'linuxmusl-x64', 'win32-arm64', 'win32-x64', ]; @@ -73,6 +74,18 @@ function toCopilotTgrepPlatformArch(platform: string, arch: string): string { return `${nodePlatform}-${nodeArch}`; } +function toCopilotPackagePlatformArch(platform: string, arch: string): string { + if (platform === 'alpine') { + return `linuxmusl-${arch}`; + } + if (arch === 'alpine') { + return 'linuxmusl-x64'; + } + + const { nodePlatform, nodeArch } = toNodePlatformArch(platform, arch); + return `${nodePlatform}-${nodeArch}`; +} + /** * Returns a glob filter that strips @vscode/ripgrep-universal bin directories * for architectures other than the build target. @@ -102,14 +115,13 @@ export function getCopilotTgrepExcludeFilter(platform: string, arch: string): st * Returns a glob filter that strips @github/copilot platform packages * for architectures other than the build target. * - * For platforms the copilot SDK doesn't natively support (e.g. alpine, armhf), - * ALL platform packages are stripped - that's fine because the copilot CLI SDK - * resolves `node-pty` from the embedder (VS Code) first via `hostRequire`, - * falling back to its bundled copy only if the embedder can't provide it. + * Alpine uses the linuxmusl-* packages. Other platform package names follow + * Node's `${process.platform}-${process.arch}` naming. If Copilot does not + * ship the computed platform package (for example linux-arm for armhf builds), + * this strips every known @github/copilot-* platform package. */ export function getCopilotExcludeFilter(platform: string, arch: string): string[] { - const { nodePlatform, nodeArch } = toNodePlatformArch(platform, arch); - const targetPlatformArch = `${nodePlatform}-${nodeArch}`; + const targetPlatformArch = toCopilotPackagePlatformArch(platform, arch); const nonTargetPlatforms = copilotPlatforms.filter(p => p !== targetPlatformArch); // Strip wrong-architecture @github/copilot-{platform} packages. @@ -119,45 +131,22 @@ export function getCopilotExcludeFilter(platform: string, arch: string): string[ } /** - * Returns the public @github/copilot-sdk runtime native addon files that must - * survive app/remote packaging for the target platform. + * Returns the public @github/copilot package files that must survive + * app/remote packaging for the target platform. * - * .moduleignore strips @github/copilot/prebuilds/** globally because the - * internal extension SDK uses a copied sdk/prebuilds layout. Agent Host uses - * the public SDK, whose runtime addon loader expects runtime.node in the root - * prebuilds layout. The SDK's built-in shell tool additionally spawns commands - * through node-pty, whose native binaries live in the same root prebuilds - * layout, so those must be preserved too (otherwise the sandboxed shell fails - * with `Cannot find module './prebuilds//pty.node'` — or conpty.node - * on Windows). + * .moduleignore strips all @github/copilot-* platform packages globally. + * Re-add only the selected package metadata and executable needed by + * @github/copilot/npm-loader.js. Do not re-add platform prebuilds or optional + * native payloads that are not needed by Agent Host. */ export function getCopilotRuntimePrebuildFiles(platform: string, arch: string, nodeModulesRoot = 'node_modules'): string[] { - const { nodePlatform, nodeArch } = toNodePlatformArch(platform, arch); - const targetPlatformArch = `${nodePlatform}-${nodeArch}`; - const prebuildDir = path.posix.join(nodeModulesRoot, '@github', 'copilot', 'prebuilds', targetPlatformArch); + const copilotPackagePlatformArch = toCopilotPackagePlatformArch(platform, arch); + const copilotPlatformPackageDir = path.posix.join(nodeModulesRoot, '@github', `copilot-${copilotPackagePlatformArch}`); - const files = [ - path.posix.join(prebuildDir, 'runtime.node'), + return [ + path.posix.join(copilotPlatformPackageDir, 'package.json'), + path.posix.join(copilotPlatformPackageDir, 'copilot'), ]; - - // node-pty native binaries for the SDK's built-in shell tool. Windows uses - // ConPTY (conpty.node plus the conpty/ helpers); darwin/linux use pty.node, - // and darwin additionally ships the spawn-helper executable. - if (nodePlatform === 'win32') { - files.push( - path.posix.join(prebuildDir, 'conpty.node'), - path.posix.join(prebuildDir, 'conpty_console_list.node'), - path.posix.join(prebuildDir, 'conpty', 'OpenConsole.exe'), - path.posix.join(prebuildDir, 'conpty', 'conpty.dll'), - ); - } else { - files.push(path.posix.join(prebuildDir, 'pty.node')); - if (nodePlatform === 'darwin') { - files.push(path.posix.join(prebuildDir, 'spawn-helper')); - } - } - - return files; } /** @@ -179,6 +168,7 @@ export function getCopilotRuntimePrebuildFiles(platform: string, arch: string, n export function prepareBuiltInCopilotRipgrepShim(platform: string, arch: string, builtInCopilotExtensionDir: string, appNodeModulesDir: string): void { const { nodePlatform, nodeArch } = toNodePlatformArch(platform, arch); const platformArch = `${nodePlatform}-${nodeArch}`; + const copilotPackagePlatformArch = toCopilotPackagePlatformArch(platform, arch); const tgrepPlatformArch = toCopilotTgrepPlatformArch(platform, arch); const extensionNodeModules = path.join(builtInCopilotExtensionDir, 'node_modules'); @@ -187,7 +177,7 @@ export function prepareBuiltInCopilotRipgrepShim(platform: string, arch: string, if (!fs.existsSync(copilotSdkBase)) { throw new Error(`[prepareBuiltInCopilotRipgrepShim] Copilot SDK directory not found at ${copilotSdkBase}`); } - pruneNonTargetCopilotSdkPrebuilds(platformArch, path.join(copilotSdkBase, 'prebuilds'), copilotPlatforms); + pruneNonTargetCopilotSdkPrebuilds(copilotPackagePlatformArch, path.join(copilotSdkBase, 'prebuilds'), copilotPlatforms); pruneNonTargetCopilotSdkPrebuilds(tgrepPlatformArch, path.join(copilotSdkBase, path.join('tgrep', 'bin')), copilotTgrepPlatforms); pruneNonTargetCopilotSdkPrebuilds(tgrepPlatformArch, path.join(copilotBase, path.join('tgrep', 'bin')), copilotTgrepPlatforms); diff --git a/build/lib/test/copilot.test.ts b/build/lib/test/copilot.test.ts new file mode 100644 index 00000000000000..bc3e7de5317902 --- /dev/null +++ b/build/lib/test/copilot.test.ts @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import assert from 'assert'; +import { suite, test } from 'node:test'; +import { copilotPlatforms, getCopilotExcludeFilter, getCopilotRuntimePrebuildFiles } from '../copilot.ts'; + +suite('copilot', () => { + test('keeps the public copilot platform package include list narrow', () => { + const files = getCopilotRuntimePrebuildFiles('linux', 'x64'); + + assert.deepStrictEqual(files, [ + 'node_modules/@github/copilot-linux-x64/package.json', + 'node_modules/@github/copilot-linux-x64/copilot', + ]); + assertNoBundledOptionalCopilotNativeDependencies(files); + }); + + test('uses the linuxmusl package executable for alpine builds', () => { + const files = getCopilotRuntimePrebuildFiles('alpine', 'x64'); + + assert.deepStrictEqual(files, [ + 'node_modules/@github/copilot-linuxmusl-x64/package.json', + 'node_modules/@github/copilot-linuxmusl-x64/copilot', + ]); + assertNoBundledOptionalCopilotNativeDependencies(files); + }); + + test('strips all copilot platform packages for unsupported armhf builds', () => { + assert.deepStrictEqual( + getCopilotExcludeFilter('linux', 'armhf'), + [ + '**', + ...copilotPlatforms.map(platform => `!**/node_modules/@github/copilot-${platform}/**`) + ] + ); + }); +}); + +function assertNoBundledOptionalCopilotNativeDependencies(files: string[]): void { + for (const file of files) { + assert(!file.includes('/clipboard/'), file); + assert(!file.includes('/foundry-local-sdk/'), file); + assert(!file.includes('/mxc-bin/'), file); + assert(!file.includes('/pvrecorder/'), file); + } +} From b200a59beacd71d6519cd754045225ec16a9081e Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:12:14 -0700 Subject: [PATCH 05/23] Exclude Copilot optional native payloads from extension package --- extensions/copilot/.vscodeignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extensions/copilot/.vscodeignore b/extensions/copilot/.vscodeignore index 6ba2b999909191..e1fe34c33bcb71 100644 --- a/extensions/copilot/.vscodeignore +++ b/extensions/copilot/.vscodeignore @@ -22,7 +22,10 @@ assets/walkthroughs/** !node_modules/@vscode/copilot-typescript-server-plugin/dist/*.js node_modules/@github/copilot/index.js node_modules/@github/copilot/clipboard/** +node_modules/@github/copilot/foundry-local-sdk/** +node_modules/@github/copilot/mxc-bin/** node_modules/@github/copilot/prebuilds/** +node_modules/@github/copilot/pvrecorder/** node_modules/@github/copilot/sharp/** !node_modules/@github/copilot/package.json !node_modules/@github/copilot/sdk/**/package.json From 173a9981773a1b9583c6445d8b3025b4ebf2396d Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:12:20 -0700 Subject: [PATCH 06/23] Scan @github/copilot-*/copilot for Linux package dependencies --- build/linux/dependencies-generator.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build/linux/dependencies-generator.ts b/build/linux/dependencies-generator.ts index eb1d73d011ac9a..144d733db49b8d 100644 --- a/build/linux/dependencies-generator.ts +++ b/build/linux/dependencies-generator.ts @@ -46,7 +46,15 @@ export async function getDependencies(packageType: 'deb' | 'rpm', buildDir: stri // Get the files for which we want to find dependencies. const canAsar = false; // TODO@esm ASAR disabled in ESM const nativeModulesPath = path.join(buildDir, 'resources', 'app', canAsar ? 'node_modules.asar.unpacked' : 'node_modules'); - const findResult = spawnSync('find', [nativeModulesPath, '-name', '*.node']); + const findResult = spawnSync('find', [ + nativeModulesPath, + '-type', 'f', + '(', + '-name', '*.node', + '-o', + '-path', path.join(nativeModulesPath, '@github', 'copilot-*', 'copilot'), + ')' + ]); if (findResult.status) { console.error('Error finding files:'); console.error(findResult.stderr.toString()); From 93a7fdcc783b3be73fd40378375345e2878c4b3a Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:12:33 -0700 Subject: [PATCH 07/23] Tighten Copilot SDK 1.0.64-1 attachment and RPC typings --- .../chatSessions/copilotcli/common/copilotCLITools.ts | 6 +++++- .../chatSessions/copilotcli/node/copilotcliSession.ts | 2 +- .../chatSessions/copilotcli/node/permissionHelpers.ts | 2 +- .../platform/agentHost/node/copilot/copilotAgentSession.ts | 3 ++- src/vs/platform/agentHost/node/copilot/mapSessionEvents.ts | 3 +++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/extensions/copilot/src/extension/chatSessions/copilotcli/common/copilotCLITools.ts b/extensions/copilot/src/extension/chatSessions/copilotcli/common/copilotCLITools.ts index 9acd2aa786d68e..603c74457c4929 100644 --- a/extensions/copilot/src/extension/chatSessions/copilotcli/common/copilotCLITools.ts +++ b/extensions/copilot/src/extension/chatSessions/copilotcli/common/copilotCLITools.ts @@ -643,9 +643,13 @@ export function buildChatHistoryFromEvents(sessionId: string, modelId: string | range }); } else if (attachment.type === 'blob') { + if (typeof attachment.data !== 'string') { + return; + } + const data = attachment.data; const binaryDataSupplier = async () => { try { - return decodeBase64(attachment.data).buffer; + return decodeBase64(data).buffer; } catch (error) { logger.error(error, `Failed to decode blob attachment ${attachment.displayName || ''}`); throw error; diff --git a/extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts b/extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts index 6e0634f28de558..54d482b6f9b1c4 100644 --- a/extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts +++ b/extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts @@ -1435,7 +1435,7 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes reportUsage(event.data.inputTokens, event.data.outputTokens); } // Accumulate per-turn credits from SDK copilotUsage data - const copilotUsage = (event.data as Record).copilotUsage; + const copilotUsage = (event.data as unknown as Record).copilotUsage; let copilotUsageNanoAiu: number | undefined; if (copilotUsage && typeof copilotUsage === 'object') { const { totalNanoAiu } = copilotUsage as { totalNanoAiu?: number }; diff --git a/extensions/copilot/src/extension/chatSessions/copilotcli/node/permissionHelpers.ts b/extensions/copilot/src/extension/chatSessions/copilotcli/node/permissionHelpers.ts index 20a47e2e127734..737693658b8bcd 100644 --- a/extensions/copilot/src/extension/chatSessions/copilotcli/node/permissionHelpers.ts +++ b/extensions/copilot/src/extension/chatSessions/copilotcli/node/permissionHelpers.ts @@ -424,7 +424,7 @@ export function getFileBeingEdited(permissionRequest: Extract): string { +function codeBlock(obj: unknown): string { return `\n\n\`\`\`\n${JSON.stringify(obj, null, 2)}\n\`\`\``; } diff --git a/src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts b/src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts index a0c0a765f18cea..de42ef5e8490ff 100644 --- a/src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts +++ b/src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts @@ -1384,10 +1384,11 @@ export class CopilotAgentSession extends Disposable { const mcpRequestId = generateUuid(); this._pendingMcpSamplings.add(requestId); try { + type McpExecuteSamplingParams = Parameters[0]; const result = await this._wrapper.session.rpc.mcp.executeSampling({ requestId, serverName, - mcpRequestId, + mcpRequestId: mcpRequestId as unknown as McpExecuteSamplingParams['mcpRequestId'], request: params, }); if (result.action === 'success') { diff --git a/src/vs/platform/agentHost/node/copilot/mapSessionEvents.ts b/src/vs/platform/agentHost/node/copilot/mapSessionEvents.ts index 93eccbf8718359..5e8534359c4cf4 100644 --- a/src/vs/platform/agentHost/node/copilot/mapSessionEvents.ts +++ b/src/vs/platform/agentHost/node/copilot/mapSessionEvents.ts @@ -521,6 +521,9 @@ function sdkAttachmentToProtocol( }; } case 'blob': { + if (typeof attachment.data !== 'string') { + return undefined; + } if (attachment.mimeType.startsWith('text/plain')) { return { type: MessageAttachmentKind.Simple, From 3a5f8d8402f3124ed55f120f9b9088f5261b42a7 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:18:42 -0700 Subject: [PATCH 08/23] Increase Copilot SDK native binary scan test timeout --- .../copilotcli/vscode-node/test/copilotCLISDKUpgrade.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/copilot/src/extension/chatSessions/copilotcli/vscode-node/test/copilotCLISDKUpgrade.spec.ts b/extensions/copilot/src/extension/chatSessions/copilotcli/vscode-node/test/copilotCLISDKUpgrade.spec.ts index cd17231496af04..d85c85b4a9f62e 100644 --- a/extensions/copilot/src/extension/chatSessions/copilotcli/vscode-node/test/copilotCLISDKUpgrade.spec.ts +++ b/extensions/copilot/src/extension/chatSessions/copilotcli/vscode-node/test/copilotCLISDKUpgrade.spec.ts @@ -234,7 +234,7 @@ describe('CopilotCLI SDK Upgrade', function () { if (errors.length > 0) { throw new Error(errors.join('\n')); } - }); + }, 30000); it('should be able to load the @github/copilot module without errors', async function () { await import('@github/copilot/sdk'); From 7b4223784bc23c01350d22afb4cac6ef2518f38d Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:23:36 -0700 Subject: [PATCH 09/23] Update amd64 deb deps for @github/copilot-linux-x64/copilot --- build/linux/debian/dep-lists.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/linux/debian/dep-lists.ts b/build/linux/debian/dep-lists.ts index 7690e25d5fd31d..90fa00fc2c8d9d 100644 --- a/build/linux/debian/dep-lists.ts +++ b/build/linux/debian/dep-lists.ts @@ -47,7 +47,7 @@ export const referenceGeneratedDepsByArch = { 'libnss3 (>= 2:3.30)', 'libnss3 (>= 3.26)', 'libpango-1.0-0 (>= 1.14.0)', - 'libstdc++6 (>= 6)', + 'libstdc++6 (>= 7)', 'libudev1 (>= 183)', 'libx11-6', 'libx11-6 (>= 2:1.4.99.1)', From 8c61d6c36a0b37dfc9098598f6af452f7e8c282d Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:51:12 -0700 Subject: [PATCH 10/23] Update arm64 rpm deps for Copilot package layout --- build/linux/rpm/dep-lists.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/build/linux/rpm/dep-lists.ts b/build/linux/rpm/dep-lists.ts index e9f414e4c7ef97..93f7dd863e7d48 100644 --- a/build/linux/rpm/dep-lists.ts +++ b/build/linux/rpm/dep-lists.ts @@ -282,7 +282,6 @@ export const referenceGeneratedDepsByArch = { 'libgtk-3.so.0()(64bit)', 'libm.so.6()(64bit)', 'libm.so.6(GLIBC_2.17)(64bit)', - 'libm.so.6(GLIBC_2.27)(64bit)', 'libnspr4.so()(64bit)', 'libnss3.so()(64bit)', 'libnss3.so(NSS_3.11)(64bit)', From a6b3301a90cc7c0c895b9bb1dae6be87b406470f Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 22 Jun 2026 16:55:42 -0700 Subject: [PATCH 11/23] Update x64 rpm deps for @github/copilot-linux-x64/copilot --- build/linux/rpm/dep-lists.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build/linux/rpm/dep-lists.ts b/build/linux/rpm/dep-lists.ts index 93f7dd863e7d48..d5fa034a8065b1 100644 --- a/build/linux/rpm/dep-lists.ts +++ b/build/linux/rpm/dep-lists.ts @@ -72,6 +72,7 @@ export const referenceGeneratedDepsByArch = { 'libgcc_s.so.1()(64bit)', 'libgcc_s.so.1(GCC_3.0)(64bit)', 'libgcc_s.so.1(GCC_3.3)(64bit)', + 'libgcc_s.so.1(GCC_3.4)(64bit)', 'libgcc_s.so.1(GCC_4.0.0)(64bit)', 'libgcc_s.so.1(GCC_4.2.0)(64bit)', 'libgio-2.0.so.0()(64bit)', @@ -111,13 +112,21 @@ export const referenceGeneratedDepsByArch = { 'libssl3.so(NSS_3.28)(64bit)', 'libstdc++.so.6()(64bit)', 'libstdc++.so.6(CXXABI_1.3)(64bit)', + 'libstdc++.so.6(CXXABI_1.3.11)(64bit)', + 'libstdc++.so.6(CXXABI_1.3.5)(64bit)', + 'libstdc++.so.6(CXXABI_1.3.7)(64bit)', 'libstdc++.so.6(CXXABI_1.3.8)(64bit)', 'libstdc++.so.6(CXXABI_1.3.9)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.11)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.14)(64bit)', + 'libstdc++.so.6(GLIBCXX_3.4.15)(64bit)', + 'libstdc++.so.6(GLIBCXX_3.4.17)(64bit)', + 'libstdc++.so.6(GLIBCXX_3.4.18)(64bit)', + 'libstdc++.so.6(GLIBCXX_3.4.19)(64bit)', + 'libstdc++.so.6(GLIBCXX_3.4.20)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.21)(64bit)', - 'libstdc++.so.6(GLIBCXX_3.4.22)(64bit)', + 'libstdc++.so.6(GLIBCXX_3.4.9)(64bit)', 'libudev.so.1()(64bit)', 'libudev.so.1(LIBUDEV_183)(64bit)', 'libutil.so.1()(64bit)', From add1ff7dd77662da5c3ed0cf9011f0e6db5af247 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 07:37:06 -0700 Subject: [PATCH 12/23] Try to fix windows smoke test --- build/lib/copilot.ts | 7 ++++++- build/lib/test/copilot.test.ts | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/build/lib/copilot.ts b/build/lib/copilot.ts index 131dd6bece87a9..4ef466e3a1f91e 100644 --- a/build/lib/copilot.ts +++ b/build/lib/copilot.ts @@ -86,6 +86,10 @@ function toCopilotPackagePlatformArch(platform: string, arch: string): string { return `${nodePlatform}-${nodeArch}`; } +function getCopilotPackageExecutableName(platform: string): string { + return platform === 'win32' ? 'copilot.exe' : 'copilot'; +} + /** * Returns a glob filter that strips @vscode/ripgrep-universal bin directories * for architectures other than the build target. @@ -142,10 +146,11 @@ export function getCopilotExcludeFilter(platform: string, arch: string): string[ export function getCopilotRuntimePrebuildFiles(platform: string, arch: string, nodeModulesRoot = 'node_modules'): string[] { const copilotPackagePlatformArch = toCopilotPackagePlatformArch(platform, arch); const copilotPlatformPackageDir = path.posix.join(nodeModulesRoot, '@github', `copilot-${copilotPackagePlatformArch}`); + const copilotPackageExecutableName = getCopilotPackageExecutableName(platform); return [ path.posix.join(copilotPlatformPackageDir, 'package.json'), - path.posix.join(copilotPlatformPackageDir, 'copilot'), + path.posix.join(copilotPlatformPackageDir, copilotPackageExecutableName), ]; } diff --git a/build/lib/test/copilot.test.ts b/build/lib/test/copilot.test.ts index bc3e7de5317902..cb1f766f031b91 100644 --- a/build/lib/test/copilot.test.ts +++ b/build/lib/test/copilot.test.ts @@ -28,6 +28,18 @@ suite('copilot', () => { assertNoBundledOptionalCopilotNativeDependencies(files); }); + test('uses the .exe package executable for windows builds', () => { + assert.deepStrictEqual(getCopilotRuntimePrebuildFiles('win32', 'x64'), [ + 'node_modules/@github/copilot-win32-x64/package.json', + 'node_modules/@github/copilot-win32-x64/copilot.exe', + ]); + + assert.deepStrictEqual(getCopilotRuntimePrebuildFiles('win32', 'arm64'), [ + 'node_modules/@github/copilot-win32-arm64/package.json', + 'node_modules/@github/copilot-win32-arm64/copilot.exe', + ]); + }); + test('strips all copilot platform packages for unsupported armhf builds', () => { assert.deepStrictEqual( getCopilotExcludeFilter('linux', 'armhf'), From 1b60705ce431bbdc8f24936f6838d83398a3dccc Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 09:18:48 -0700 Subject: [PATCH 13/23] Try to fix platform runtime files for agent host --- build/lib/copilot.ts | 21 ++-- build/lib/test/copilot.test.ts | 102 ++++++++++++++---- .../agentHost/node/copilot/copilotAgent.ts | 20 ++++ 3 files changed, 115 insertions(+), 28 deletions(-) diff --git a/build/lib/copilot.ts b/build/lib/copilot.ts index 4ef466e3a1f91e..94d3bfad0d7bc8 100644 --- a/build/lib/copilot.ts +++ b/build/lib/copilot.ts @@ -86,9 +86,12 @@ function toCopilotPackagePlatformArch(platform: string, arch: string): string { return `${nodePlatform}-${nodeArch}`; } -function getCopilotPackageExecutableName(platform: string): string { - return platform === 'win32' ? 'copilot.exe' : 'copilot'; -} +const copilotOptionalNativePayloadDirs = [ + 'clipboard', + 'foundry-local-sdk', + 'mxc-bin', + 'pvrecorder', +]; /** * Returns a glob filter that strips @vscode/ripgrep-universal bin directories @@ -139,18 +142,18 @@ export function getCopilotExcludeFilter(platform: string, arch: string): string[ * app/remote packaging for the target platform. * * .moduleignore strips all @github/copilot-* platform packages globally. - * Re-add only the selected package metadata and executable needed by - * @github/copilot/npm-loader.js. Do not re-add platform prebuilds or optional - * native payloads that are not needed by Agent Host. + * Re-add the selected runtime package so @github/copilot/npm-loader.js can + * launch the platform executable and the CLI can load its signed runtime + * prebuilds from the product instead of extracting them to the user cache. + * Keep optional native payload trees out of the product build. */ export function getCopilotRuntimePrebuildFiles(platform: string, arch: string, nodeModulesRoot = 'node_modules'): string[] { const copilotPackagePlatformArch = toCopilotPackagePlatformArch(platform, arch); const copilotPlatformPackageDir = path.posix.join(nodeModulesRoot, '@github', `copilot-${copilotPackagePlatformArch}`); - const copilotPackageExecutableName = getCopilotPackageExecutableName(platform); return [ - path.posix.join(copilotPlatformPackageDir, 'package.json'), - path.posix.join(copilotPlatformPackageDir, copilotPackageExecutableName), + path.posix.join(copilotPlatformPackageDir, '**'), + ...copilotOptionalNativePayloadDirs.map(dir => `!${path.posix.join(copilotPlatformPackageDir, dir, '**')}`), ]; } diff --git a/build/lib/test/copilot.test.ts b/build/lib/test/copilot.test.ts index cb1f766f031b91..4f0756800d37a5 100644 --- a/build/lib/test/copilot.test.ts +++ b/build/lib/test/copilot.test.ts @@ -8,36 +8,81 @@ import { suite, test } from 'node:test'; import { copilotPlatforms, getCopilotExcludeFilter, getCopilotRuntimePrebuildFiles } from '../copilot.ts'; suite('copilot', () => { - test('keeps the public copilot platform package include list narrow', () => { + test('keeps the public copilot platform package include list scoped to the selected package', () => { const files = getCopilotRuntimePrebuildFiles('linux', 'x64'); assert.deepStrictEqual(files, [ - 'node_modules/@github/copilot-linux-x64/package.json', - 'node_modules/@github/copilot-linux-x64/copilot', + 'node_modules/@github/copilot-linux-x64/**', + '!node_modules/@github/copilot-linux-x64/clipboard/**', + '!node_modules/@github/copilot-linux-x64/foundry-local-sdk/**', + '!node_modules/@github/copilot-linux-x64/mxc-bin/**', + '!node_modules/@github/copilot-linux-x64/pvrecorder/**', ]); - assertNoBundledOptionalCopilotNativeDependencies(files); + assertCopilotPlatformPackageIncludes(files, 'node_modules/@github/copilot-linux-x64', [ + 'copilot', + 'prebuilds/linux-x64/runtime.node', + 'prebuilds/linux-x64/pty.node', + ]); + assertOptionalCopilotNativeDependenciesExcluded(files, 'node_modules/@github/copilot-linux-x64'); }); - test('uses the linuxmusl package executable for alpine builds', () => { + test('uses the linuxmusl package runtime for alpine builds', () => { const files = getCopilotRuntimePrebuildFiles('alpine', 'x64'); assert.deepStrictEqual(files, [ - 'node_modules/@github/copilot-linuxmusl-x64/package.json', - 'node_modules/@github/copilot-linuxmusl-x64/copilot', + 'node_modules/@github/copilot-linuxmusl-x64/**', + '!node_modules/@github/copilot-linuxmusl-x64/clipboard/**', + '!node_modules/@github/copilot-linuxmusl-x64/foundry-local-sdk/**', + '!node_modules/@github/copilot-linuxmusl-x64/mxc-bin/**', + '!node_modules/@github/copilot-linuxmusl-x64/pvrecorder/**', + ]); + assertCopilotPlatformPackageIncludes(files, 'node_modules/@github/copilot-linuxmusl-x64', [ + 'copilot', + 'prebuilds/linuxmusl-x64/runtime.node', ]); - assertNoBundledOptionalCopilotNativeDependencies(files); + assertOptionalCopilotNativeDependenciesExcluded(files, 'node_modules/@github/copilot-linuxmusl-x64'); }); - test('uses the .exe package executable for windows builds', () => { + test('uses the .exe package runtime for windows builds', () => { assert.deepStrictEqual(getCopilotRuntimePrebuildFiles('win32', 'x64'), [ - 'node_modules/@github/copilot-win32-x64/package.json', - 'node_modules/@github/copilot-win32-x64/copilot.exe', + 'node_modules/@github/copilot-win32-x64/**', + '!node_modules/@github/copilot-win32-x64/clipboard/**', + '!node_modules/@github/copilot-win32-x64/foundry-local-sdk/**', + '!node_modules/@github/copilot-win32-x64/mxc-bin/**', + '!node_modules/@github/copilot-win32-x64/pvrecorder/**', + ]); + assertCopilotPlatformPackageIncludes(getCopilotRuntimePrebuildFiles('win32', 'x64'), 'node_modules/@github/copilot-win32-x64', [ + 'copilot.exe', + 'prebuilds/win32-x64/runtime.node', + 'prebuilds/win32-x64/conpty.node', + 'prebuilds/win32-x64/conpty_console_list.node', + 'prebuilds/win32-x64/conpty/OpenConsole.exe', + 'prebuilds/win32-x64/conpty/conpty.dll', ]); assert.deepStrictEqual(getCopilotRuntimePrebuildFiles('win32', 'arm64'), [ - 'node_modules/@github/copilot-win32-arm64/package.json', - 'node_modules/@github/copilot-win32-arm64/copilot.exe', + 'node_modules/@github/copilot-win32-arm64/**', + '!node_modules/@github/copilot-win32-arm64/clipboard/**', + '!node_modules/@github/copilot-win32-arm64/foundry-local-sdk/**', + '!node_modules/@github/copilot-win32-arm64/mxc-bin/**', + '!node_modules/@github/copilot-win32-arm64/pvrecorder/**', + ]); + assertOptionalCopilotNativeDependenciesExcluded(getCopilotRuntimePrebuildFiles('win32', 'x64'), 'node_modules/@github/copilot-win32-x64'); + }); + + test('keeps macOS runtime prebuilds in the selected platform package', () => { + const files = getCopilotRuntimePrebuildFiles('darwin', 'arm64'); + + assertCopilotPlatformPackageIncludes(files, 'node_modules/@github/copilot-darwin-arm64', [ + 'copilot', + 'index.js', + 'app.js', + 'sea-loader.js', + 'prebuilds/darwin-arm64/runtime.node', + 'prebuilds/darwin-arm64/pty.node', + 'prebuilds/darwin-arm64/spawn-helper', ]); + assertOptionalCopilotNativeDependenciesExcluded(files, 'node_modules/@github/copilot-darwin-arm64'); }); test('strips all copilot platform packages for unsupported armhf builds', () => { @@ -51,11 +96,30 @@ suite('copilot', () => { }); }); -function assertNoBundledOptionalCopilotNativeDependencies(files: string[]): void { - for (const file of files) { - assert(!file.includes('/clipboard/'), file); - assert(!file.includes('/foundry-local-sdk/'), file); - assert(!file.includes('/mxc-bin/'), file); - assert(!file.includes('/pvrecorder/'), file); +function assertCopilotPlatformPackageIncludes(patterns: string[], packageDir: string, relativeFiles: string[]): void { + assert(patterns.includes(`${packageDir}/**`)); + for (const relativeFile of relativeFiles) { + assert(matchesGlob(`${packageDir}/${relativeFile}`, patterns), relativeFile); + } +} + +function assertOptionalCopilotNativeDependenciesExcluded(patterns: string[], packageDir: string): void { + for (const dir of ['clipboard', 'foundry-local-sdk', 'mxc-bin', 'pvrecorder']) { + assert(patterns.includes(`!${packageDir}/${dir}/**`), dir); + assert(!matchesGlob(`${packageDir}/${dir}/index.js`, patterns), dir); + } +} + +function matchesGlob(file: string, patterns: string[]): boolean { + let included = false; + for (const pattern of patterns) { + const isExclude = pattern.startsWith('!'); + const glob = isExclude ? pattern.slice(1) : pattern; + if (glob.endsWith('/**') && file.startsWith(glob.slice(0, -2))) { + included = !isExclude; + } else if (file === glob) { + included = !isExclude; + } } + return included; } diff --git a/src/vs/platform/agentHost/node/copilot/copilotAgent.ts b/src/vs/platform/agentHost/node/copilot/copilotAgent.ts index 7b7a19df07cf11..95db8927efff55 100644 --- a/src/vs/platform/agentHost/node/copilot/copilotAgent.ts +++ b/src/vs/platform/agentHost/node/copilot/copilotAgent.ts @@ -118,6 +118,22 @@ async function resolveCopilotCliPath(nodeModulesUri: URI): Promise { throw new Error(`Unable to resolve @github/copilot CLI path from ${copilotPackageUri.fsPath}`); } +async function resolveCopilotCliDistDir(nodeModulesUri: URI): Promise { + const platformArch = `${process.platform}-${process.arch}`; + const candidatePlatformPackages = process.platform === 'linux' + ? [`copilot-${platformArch}`, `copilot-linuxmusl-${process.arch}`] + : [`copilot-${platformArch}`]; + + for (const packageName of candidatePlatformPackages) { + const packageDir = URI.joinPath(nodeModulesUri, '@github', packageName).fsPath; + if (await fileExists(join(packageDir, 'index.js'))) { + return packageDir; + } + } + + return undefined; +} + interface ICreatedWorktree { readonly repositoryRoot: URI; readonly worktree: URI; @@ -729,6 +745,10 @@ export class CopilotAgent extends Disposable implements IAgent { // FileAccess.asFileUri('') points to the `out/` directory; node_modules is one level up. const nodeModulesUri = URI.joinPath(FileAccess.asFileUri(''), '..', 'node_modules'); const cliPath = await resolveCopilotCliPath(nodeModulesUri); + const cliDistDir = await resolveCopilotCliDistDir(nodeModulesUri); + if (cliDistDir) { + env['COPILOT_CLI_DIST_DIR'] = cliDistDir; + } // The SDK's sandbox auto-detection looks for `//wxc-exec.exe` // (and the Linux/macOS equivalents). VS Code core ships the MXC sandbox binaries From 4f8b1ca6e75dad98431cb62bb4be3fba7de8d12c Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 09:56:10 -0700 Subject: [PATCH 14/23] exclude copilot computer.node from agent host packaging --- build/lib/copilot.ts | 5 +++++ build/lib/test/copilot.test.ts | 27 ++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/build/lib/copilot.ts b/build/lib/copilot.ts index 94d3bfad0d7bc8..187f389740b17d 100644 --- a/build/lib/copilot.ts +++ b/build/lib/copilot.ts @@ -93,6 +93,10 @@ const copilotOptionalNativePayloadDirs = [ 'pvrecorder', ]; +const copilotOptionalNativePayloadFiles = [ + 'prebuilds/*/computer.node', +]; + /** * Returns a glob filter that strips @vscode/ripgrep-universal bin directories * for architectures other than the build target. @@ -154,6 +158,7 @@ export function getCopilotRuntimePrebuildFiles(platform: string, arch: string, n return [ path.posix.join(copilotPlatformPackageDir, '**'), ...copilotOptionalNativePayloadDirs.map(dir => `!${path.posix.join(copilotPlatformPackageDir, dir, '**')}`), + ...copilotOptionalNativePayloadFiles.map(file => `!${path.posix.join(copilotPlatformPackageDir, file)}`), ]; } diff --git a/build/lib/test/copilot.test.ts b/build/lib/test/copilot.test.ts index 4f0756800d37a5..d16997bb6b9a2b 100644 --- a/build/lib/test/copilot.test.ts +++ b/build/lib/test/copilot.test.ts @@ -17,6 +17,7 @@ suite('copilot', () => { '!node_modules/@github/copilot-linux-x64/foundry-local-sdk/**', '!node_modules/@github/copilot-linux-x64/mxc-bin/**', '!node_modules/@github/copilot-linux-x64/pvrecorder/**', + '!node_modules/@github/copilot-linux-x64/prebuilds/*/computer.node', ]); assertCopilotPlatformPackageIncludes(files, 'node_modules/@github/copilot-linux-x64', [ 'copilot', @@ -35,6 +36,7 @@ suite('copilot', () => { '!node_modules/@github/copilot-linuxmusl-x64/foundry-local-sdk/**', '!node_modules/@github/copilot-linuxmusl-x64/mxc-bin/**', '!node_modules/@github/copilot-linuxmusl-x64/pvrecorder/**', + '!node_modules/@github/copilot-linuxmusl-x64/prebuilds/*/computer.node', ]); assertCopilotPlatformPackageIncludes(files, 'node_modules/@github/copilot-linuxmusl-x64', [ 'copilot', @@ -50,6 +52,7 @@ suite('copilot', () => { '!node_modules/@github/copilot-win32-x64/foundry-local-sdk/**', '!node_modules/@github/copilot-win32-x64/mxc-bin/**', '!node_modules/@github/copilot-win32-x64/pvrecorder/**', + '!node_modules/@github/copilot-win32-x64/prebuilds/*/computer.node', ]); assertCopilotPlatformPackageIncludes(getCopilotRuntimePrebuildFiles('win32', 'x64'), 'node_modules/@github/copilot-win32-x64', [ 'copilot.exe', @@ -66,6 +69,7 @@ suite('copilot', () => { '!node_modules/@github/copilot-win32-arm64/foundry-local-sdk/**', '!node_modules/@github/copilot-win32-arm64/mxc-bin/**', '!node_modules/@github/copilot-win32-arm64/pvrecorder/**', + '!node_modules/@github/copilot-win32-arm64/prebuilds/*/computer.node', ]); assertOptionalCopilotNativeDependenciesExcluded(getCopilotRuntimePrebuildFiles('win32', 'x64'), 'node_modules/@github/copilot-win32-x64'); }); @@ -108,6 +112,8 @@ function assertOptionalCopilotNativeDependenciesExcluded(patterns: string[], pac assert(patterns.includes(`!${packageDir}/${dir}/**`), dir); assert(!matchesGlob(`${packageDir}/${dir}/index.js`, patterns), dir); } + assert(patterns.includes(`!${packageDir}/prebuilds/*/computer.node`), 'computer.node'); + assert(!matchesGlob(`${packageDir}/prebuilds/linux-x64/computer.node`, patterns), 'computer.node'); } function matchesGlob(file: string, patterns: string[]): boolean { @@ -115,11 +121,26 @@ function matchesGlob(file: string, patterns: string[]): boolean { for (const pattern of patterns) { const isExclude = pattern.startsWith('!'); const glob = isExclude ? pattern.slice(1) : pattern; - if (glob.endsWith('/**') && file.startsWith(glob.slice(0, -2))) { - included = !isExclude; - } else if (file === glob) { + if (matchesPattern(file, glob)) { included = !isExclude; } } return included; } + +function matchesPattern(file: string, pattern: string): boolean { + if (pattern.endsWith('/**')) { + return file.startsWith(pattern.slice(0, -2)); + } + + if (pattern.includes('*')) { + const regex = new RegExp(`^${pattern.split('*').map(escapeRegExp).join('[^/]+')}$`); + return regex.test(file); + } + + return file === pattern; +} + +function escapeRegExp(value: string): string { + return value.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&'); +} From 7c36b5fd74c4da4ad1d2af66911a050c4817e017 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 11:17:26 -0700 Subject: [PATCH 15/23] Another attempt to try to get packaging right --- build/gulpfile.vscode.ts | 3 +- build/lib/copilot.ts | 108 +++++++++++++++++++++++++++++++-- build/lib/test/copilot.test.ts | 52 +++++++++++++++- 3 files changed, 157 insertions(+), 6 deletions(-) diff --git a/build/gulpfile.vscode.ts b/build/gulpfile.vscode.ts index 53987f88edb1a0..02750e9a856107 100644 --- a/build/gulpfile.vscode.ts +++ b/build/gulpfile.vscode.ts @@ -28,7 +28,7 @@ import minimist from 'minimist'; import { compileBuildWithoutManglingTask, compileBuildWithManglingTask } from './gulpfile.compile.ts'; import { compileNonNativeExtensionsBuildTask, compileNativeExtensionsBuildTask, compileAllExtensionsBuildTask, compileExtensionMediaBuildTask, cleanExtensionsBuildTask, compileCopilotExtensionBuildTask } from './gulpfile.extensions.ts'; import { copyCodiconsTask } from './lib/compilation.ts'; -import { getCopilotExcludeFilter, getCopilotRuntimePrebuildFiles, getCopilotTgrepExcludeFilter, getRipgrepExcludeFilter, prepareBuiltInCopilotRipgrepShim } from './lib/copilot.ts'; +import { ensureCopilotPlatformPackage, getCopilotExcludeFilter, getCopilotRuntimePrebuildFiles, getCopilotTgrepExcludeFilter, getRipgrepExcludeFilter, prepareBuiltInCopilotRipgrepShim } from './lib/copilot.ts'; import { readAgentSdkResults } from './agent-sdk/common.ts'; import { useEsbuildTranspile } from './buildConfig.ts'; import { promisify } from 'util'; @@ -340,6 +340,7 @@ function packageTask(platform: string, arch: string, sourceFolderName: string, d .pipe(filter(depFilterPattern)) .pipe(util.cleanNodeModules(path.join(import.meta.dirname, '.moduleignore'))) .pipe(util.cleanNodeModules(path.join(import.meta.dirname, `.moduleignore.${process.platform}`))); + ensureCopilotPlatformPackage(platform, arch); const copilotRuntimePrebuilds = gulp.src(getCopilotRuntimePrebuildFiles(platform, arch), { base: '.', dot: true, allowEmpty: true }); const deps = es.merge(cleanedDeps, copilotRuntimePrebuilds) .pipe(filter(getCopilotExcludeFilter(platform, arch))) diff --git a/build/lib/copilot.ts b/build/lib/copilot.ts index 187f389740b17d..fb4ae722b31438 100644 --- a/build/lib/copilot.ts +++ b/build/lib/copilot.ts @@ -4,7 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import * as fs from 'fs'; +import { createHash } from 'crypto'; +import { execFileSync } from 'child_process'; +import * as os from 'os'; import * as path from 'path'; +import { extract } from 'tar'; /** * The platforms that @github/copilot ships platform-specific packages for. @@ -93,9 +97,18 @@ const copilotOptionalNativePayloadDirs = [ 'pvrecorder', ]; -const copilotOptionalNativePayloadFiles = [ - 'prebuilds/*/computer.node', -]; +function getCopilotOptionalNativePayloadFiles(platform: string): string[] { + const files = [ + 'prebuilds/*/computer.node', + 'prebuilds/*/keytar.node', + ]; + + if (platform !== 'win32') { + files.push('prebuilds/*/cli-native.node'); + } + + return files; +} /** * Returns a glob filter that strips @vscode/ripgrep-universal bin directories @@ -158,10 +171,97 @@ export function getCopilotRuntimePrebuildFiles(platform: string, arch: string, n return [ path.posix.join(copilotPlatformPackageDir, '**'), ...copilotOptionalNativePayloadDirs.map(dir => `!${path.posix.join(copilotPlatformPackageDir, dir, '**')}`), - ...copilotOptionalNativePayloadFiles.map(file => `!${path.posix.join(copilotPlatformPackageDir, file)}`), + ...getCopilotOptionalNativePayloadFiles(platform).map(file => `!${path.posix.join(copilotPlatformPackageDir, file)}`), ]; } +interface NpmPackageLock { + packages?: Record; +} + +interface EnsureCopilotPlatformPackageOptions { + packPackage?: (packageName: string, version: string, tempDir: string) => string; +} + +/** + * Ensures the selected @github/copilot-{platform} package is present before + * packaging. npm only installs the host-compatible optional dependency, but + * VS Code packaging can cross-build targets such as darwin-x64 on arm64 hosts. + */ +export function ensureCopilotPlatformPackage(platform: string, arch: string, nodeModulesRoot = 'node_modules', options: EnsureCopilotPlatformPackageOptions = {}): void { + const copilotPackagePlatformArch = toCopilotPackagePlatformArch(platform, arch); + if (!copilotPlatforms.includes(copilotPackagePlatformArch)) { + return; + } + + const packageName = `@github/copilot-${copilotPackagePlatformArch}`; + const packageDir = path.join(nodeModulesRoot, '@github', `copilot-${copilotPackagePlatformArch}`); + if (fs.existsSync(packageDir)) { + return; + } + + const lockFilePath = path.join(path.dirname(nodeModulesRoot), 'package-lock.json'); + const lockPackageKey = path.posix.join('node_modules', '@github', `copilot-${copilotPackagePlatformArch}`); + const lockPackage = readNpmPackageLock(lockFilePath).packages?.[lockPackageKey]; + if (!lockPackage?.version) { + throw new Error(`[ensureCopilotPlatformPackage] Missing ${lockPackageKey} in ${lockFilePath}. Run npm install to refresh the lockfile.`); + } + + const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'vscode-copilot-platform-')); + try { + const tarballPath = (options.packPackage ?? packCopilotPlatformPackage)(packageName, lockPackage.version, tempDir); + verifyNpmIntegrity(tarballPath, lockPackage.integrity); + + fs.mkdirSync(packageDir, { recursive: true }); + extract({ file: tarballPath, cwd: packageDir, strip: 1, sync: true }); + console.log(`[ensureCopilotPlatformPackage] Materialized ${packageName}@${lockPackage.version} in ${packageDir}`); + } catch (err) { + fs.rmSync(packageDir, { recursive: true, force: true }); + throw new Error(`[ensureCopilotPlatformPackage] Failed to materialize ${packageName}@${lockPackage.version}: ${err instanceof Error ? err.message : String(err)}`); + } finally { + fs.rmSync(tempDir, { recursive: true, force: true }); + } +} + +function packCopilotPlatformPackage(packageName: string, version: string, tempDir: string): string { + execFileSync(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['pack', `${packageName}@${version}`, '--pack-destination', tempDir, '--silent'], { stdio: 'pipe' }); + + const tarball = fs.readdirSync(tempDir).find(name => name.endsWith('.tgz')); + if (!tarball) { + throw new Error(`npm pack did not produce a tarball in ${tempDir}`); + } + + return path.join(tempDir, tarball); +} + +function readNpmPackageLock(lockFilePath: string): NpmPackageLock { + try { + return JSON.parse(fs.readFileSync(lockFilePath, 'utf8')); + } catch (err) { + throw new Error(`[ensureCopilotPlatformPackage] Failed to read ${lockFilePath}: ${err instanceof Error ? err.message : String(err)}`); + } +} + +function verifyNpmIntegrity(tarballPath: string, integrity: string | undefined): void { + if (!integrity) { + return; + } + + const sha512Integrity = integrity.split(/\s+/).find(entry => entry.startsWith('sha512-')); + if (!sha512Integrity) { + return; + } + + const expected = sha512Integrity.slice('sha512-'.length); + const actual = createHash('sha512').update(fs.readFileSync(tarballPath)).digest('base64'); + if (actual !== expected) { + throw new Error(`integrity mismatch for ${tarballPath}`); + } +} + /** * Materializes the copilot CLI ripgrep shim directly inside the built-in copilot extension. * diff --git a/build/lib/test/copilot.test.ts b/build/lib/test/copilot.test.ts index d16997bb6b9a2b..74489fe83c9526 100644 --- a/build/lib/test/copilot.test.ts +++ b/build/lib/test/copilot.test.ts @@ -4,8 +4,12 @@ *--------------------------------------------------------------------------------------------*/ import assert from 'assert'; +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; import { suite, test } from 'node:test'; -import { copilotPlatforms, getCopilotExcludeFilter, getCopilotRuntimePrebuildFiles } from '../copilot.ts'; +import { create } from 'tar'; +import { copilotPlatforms, ensureCopilotPlatformPackage, getCopilotExcludeFilter, getCopilotRuntimePrebuildFiles } from '../copilot.ts'; suite('copilot', () => { test('keeps the public copilot platform package include list scoped to the selected package', () => { @@ -18,6 +22,8 @@ suite('copilot', () => { '!node_modules/@github/copilot-linux-x64/mxc-bin/**', '!node_modules/@github/copilot-linux-x64/pvrecorder/**', '!node_modules/@github/copilot-linux-x64/prebuilds/*/computer.node', + '!node_modules/@github/copilot-linux-x64/prebuilds/*/keytar.node', + '!node_modules/@github/copilot-linux-x64/prebuilds/*/cli-native.node', ]); assertCopilotPlatformPackageIncludes(files, 'node_modules/@github/copilot-linux-x64', [ 'copilot', @@ -37,6 +43,8 @@ suite('copilot', () => { '!node_modules/@github/copilot-linuxmusl-x64/mxc-bin/**', '!node_modules/@github/copilot-linuxmusl-x64/pvrecorder/**', '!node_modules/@github/copilot-linuxmusl-x64/prebuilds/*/computer.node', + '!node_modules/@github/copilot-linuxmusl-x64/prebuilds/*/keytar.node', + '!node_modules/@github/copilot-linuxmusl-x64/prebuilds/*/cli-native.node', ]); assertCopilotPlatformPackageIncludes(files, 'node_modules/@github/copilot-linuxmusl-x64', [ 'copilot', @@ -53,9 +61,11 @@ suite('copilot', () => { '!node_modules/@github/copilot-win32-x64/mxc-bin/**', '!node_modules/@github/copilot-win32-x64/pvrecorder/**', '!node_modules/@github/copilot-win32-x64/prebuilds/*/computer.node', + '!node_modules/@github/copilot-win32-x64/prebuilds/*/keytar.node', ]); assertCopilotPlatformPackageIncludes(getCopilotRuntimePrebuildFiles('win32', 'x64'), 'node_modules/@github/copilot-win32-x64', [ 'copilot.exe', + 'prebuilds/win32-x64/cli-native.node', 'prebuilds/win32-x64/runtime.node', 'prebuilds/win32-x64/conpty.node', 'prebuilds/win32-x64/conpty_console_list.node', @@ -70,6 +80,7 @@ suite('copilot', () => { '!node_modules/@github/copilot-win32-arm64/mxc-bin/**', '!node_modules/@github/copilot-win32-arm64/pvrecorder/**', '!node_modules/@github/copilot-win32-arm64/prebuilds/*/computer.node', + '!node_modules/@github/copilot-win32-arm64/prebuilds/*/keytar.node', ]); assertOptionalCopilotNativeDependenciesExcluded(getCopilotRuntimePrebuildFiles('win32', 'x64'), 'node_modules/@github/copilot-win32-x64'); }); @@ -89,6 +100,38 @@ suite('copilot', () => { assertOptionalCopilotNativeDependenciesExcluded(files, 'node_modules/@github/copilot-darwin-arm64'); }); + test('materializes missing target platform packages from the lockfile', () => { + const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'vscode-copilot-platform-test-')); + const nodeModulesRoot = path.join(repoRoot, 'node_modules'); + try { + fs.mkdirSync(nodeModulesRoot, { recursive: true }); + fs.writeFileSync(path.join(repoRoot, 'package-lock.json'), JSON.stringify({ + packages: { + 'node_modules/@github/copilot-darwin-x64': { + version: '1.0.64-1', + } + } + })); + + ensureCopilotPlatformPackage('darwin', 'x64', nodeModulesRoot, { + packPackage: (_packageName, _version, tempDir) => { + const packageRoot = path.join(tempDir, 'package'); + fs.mkdirSync(path.join(packageRoot, 'prebuilds', 'darwin-x64'), { recursive: true }); + fs.writeFileSync(path.join(packageRoot, 'copilot'), ''); + fs.writeFileSync(path.join(packageRoot, 'prebuilds', 'darwin-x64', 'runtime.node'), ''); + const tarball = path.join(tempDir, 'copilot-darwin-x64.tgz'); + create({ file: tarball, cwd: tempDir, gzip: true, sync: true }, ['package']); + return tarball; + } + }); + + assert(fs.existsSync(path.join(nodeModulesRoot, '@github', 'copilot-darwin-x64', 'copilot'))); + assert(fs.existsSync(path.join(nodeModulesRoot, '@github', 'copilot-darwin-x64', 'prebuilds', 'darwin-x64', 'runtime.node'))); + } finally { + fs.rmSync(repoRoot, { recursive: true, force: true }); + } + }); + test('strips all copilot platform packages for unsupported armhf builds', () => { assert.deepStrictEqual( getCopilotExcludeFilter('linux', 'armhf'), @@ -114,6 +157,13 @@ function assertOptionalCopilotNativeDependenciesExcluded(patterns: string[], pac } assert(patterns.includes(`!${packageDir}/prebuilds/*/computer.node`), 'computer.node'); assert(!matchesGlob(`${packageDir}/prebuilds/linux-x64/computer.node`, patterns), 'computer.node'); + assert(patterns.includes(`!${packageDir}/prebuilds/*/keytar.node`), 'keytar.node'); + assert(!matchesGlob(`${packageDir}/prebuilds/linux-x64/keytar.node`, patterns), 'keytar.node'); + + if (!packageDir.includes('win32')) { + assert(patterns.includes(`!${packageDir}/prebuilds/*/cli-native.node`), 'cli-native.node'); + assert(!matchesGlob(`${packageDir}/prebuilds/linux-x64/cli-native.node`, patterns), 'cli-native.node'); + } } function matchesGlob(file: string, patterns: string[]): boolean { From 0d13df6801c633d7970b493e1ac86929ad3e6869 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 11:22:58 -0700 Subject: [PATCH 16/23] Should only try to load 1.0.64-1 --- .../agentHost/node/copilot/copilotAgent.ts | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/vs/platform/agentHost/node/copilot/copilotAgent.ts b/src/vs/platform/agentHost/node/copilot/copilotAgent.ts index 95db8927efff55..20f2a7ac8c3a1e 100644 --- a/src/vs/platform/agentHost/node/copilot/copilotAgent.ts +++ b/src/vs/platform/agentHost/node/copilot/copilotAgent.ts @@ -78,7 +78,7 @@ function copilotCliLogLevelFor(level: LogLevel): NonNullable { @@ -93,29 +93,18 @@ async function fileExists(filePath: string): Promise { async function resolveCopilotCliPath(nodeModulesUri: URI): Promise { const copilotPackageUri = URI.joinPath(nodeModulesUri, '@github', 'copilot'); const packageJsonPath = URI.joinPath(copilotPackageUri, 'package.json').fsPath; - const fallbackPath = URI.joinPath(copilotPackageUri, 'index.js').fsPath; - - let bin: string | undefined; - try { - const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8')) as ICopilotPackageJson; - bin = typeof packageJson.bin === 'string' ? packageJson.bin : packageJson.bin?.copilot; - } catch { - // Fall back below. Older @github/copilot packages used index.js, while - // 1.0.64-1+ resolves through package.json's bin entry. - } - - if (typeof bin === 'string' && bin.length > 0) { - const binPath = join(copilotPackageUri.fsPath, bin); - if (await fileExists(binPath)) { - return binPath; - } + const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8')) as ICopilotPackageJson; + const bin = packageJson.bin?.copilot; + if (typeof bin !== 'string' || bin.length === 0) { + throw new Error(`Unable to resolve @github/copilot CLI path. Missing package.json bin.copilot in ${packageJsonPath}`); } - if (await fileExists(fallbackPath)) { - return fallbackPath; + const binPath = join(copilotPackageUri.fsPath, bin); + if (await fileExists(binPath)) { + return binPath; } - throw new Error(`Unable to resolve @github/copilot CLI path from ${copilotPackageUri.fsPath}`); + throw new Error(`Unable to resolve @github/copilot CLI path. package.json bin.copilot points to missing file ${binPath}`); } async function resolveCopilotCliDistDir(nodeModulesUri: URI): Promise { From a900039a54b52839d83bd25793074ca9de589386 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 12:00:26 -0700 Subject: [PATCH 17/23] Try to fix packaing for windows, macos, deb deps --- build/darwin/create-universal-app.ts | 2 +- build/lib/copilot.ts | 2 +- build/linux/debian/dep-lists.ts | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index 459bd55b3500a6..8f907a44259988 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -121,7 +121,7 @@ async function main(buildDir?: string) { outAppPath, force: true, mergeASARs: true, - x64ArchFiles: '{*/kerberos.node,**/extensions/microsoft-authentication/dist/libmsalruntime.dylib,**/extensions/microsoft-authentication/dist/msal-node-runtime.node,**/node_modules/@github/copilot-darwin-*/copilot,**/node_modules/@github/copilot/prebuilds/darwin-*/*,**/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot-darwin-*/copilot,**/node_modules.asar.unpacked/@github/copilot/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/prebuilds/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/ripgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules.asar.unpacked/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules/@microsoft/mxc-sdk/bin/**,**/node_modules.asar.unpacked/@microsoft/mxc-sdk/bin/**}', + x64ArchFiles: '{*/kerberos.node,**/extensions/microsoft-authentication/dist/libmsalruntime.dylib,**/extensions/microsoft-authentication/dist/msal-node-runtime.node,**/node_modules/@github/copilot-darwin-*/copilot,**/node_modules/@github/copilot-darwin-*/prebuilds/darwin-*/*,**/node_modules/@github/copilot/prebuilds/darwin-*/*,**/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot-darwin-*/copilot,**/node_modules.asar.unpacked/@github/copilot-darwin-*/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/prebuilds/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/ripgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules.asar.unpacked/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules/@microsoft/mxc-sdk/bin/**,**/node_modules.asar.unpacked/@microsoft/mxc-sdk/bin/**}', filesToSkipComparison: (file: string) => { for (const expected of filesToSkip) { if (minimatch(file, expected)) { diff --git a/build/lib/copilot.ts b/build/lib/copilot.ts index fb4ae722b31438..2780c774ae90de 100644 --- a/build/lib/copilot.ts +++ b/build/lib/copilot.ts @@ -227,7 +227,7 @@ export function ensureCopilotPlatformPackage(platform: string, arch: string, nod } function packCopilotPlatformPackage(packageName: string, version: string, tempDir: string): string { - execFileSync(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['pack', `${packageName}@${version}`, '--pack-destination', tempDir, '--silent'], { stdio: 'pipe' }); + execFileSync(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['pack', `${packageName}@${version}`, '--pack-destination', tempDir, '--silent'], { stdio: 'pipe', shell: process.platform === 'win32' }); const tarball = fs.readdirSync(tempDir).find(name => name.endsWith('.tgz')); if (!tarball) { diff --git a/build/linux/debian/dep-lists.ts b/build/linux/debian/dep-lists.ts index 90fa00fc2c8d9d..df99a1042e38d9 100644 --- a/build/linux/debian/dep-lists.ts +++ b/build/linux/debian/dep-lists.ts @@ -47,6 +47,7 @@ export const referenceGeneratedDepsByArch = { 'libnss3 (>= 2:3.30)', 'libnss3 (>= 3.26)', 'libpango-1.0-0 (>= 1.14.0)', + 'libstdc++6 (>= 6)', 'libstdc++6 (>= 7)', 'libudev1 (>= 183)', 'libx11-6', @@ -89,6 +90,7 @@ export const referenceGeneratedDepsByArch = { 'libstdc++6 (>= 5)', 'libstdc++6 (>= 5.2)', 'libstdc++6 (>= 6)', + 'libstdc++6 (>= 7)', 'libstdc++6 (>= 9)', 'libudev1 (>= 183)', 'libx11-6', From baab4b8f9de46bdf088faea8baf51a9df820757c Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 12:25:22 -0700 Subject: [PATCH 18/23] Update armhf/arm64 deb and x64 rpm Copilot dependency baselines --- build/linux/debian/dep-lists.ts | 2 +- build/linux/rpm/dep-lists.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build/linux/debian/dep-lists.ts b/build/linux/debian/dep-lists.ts index df99a1042e38d9..7d0d94e83bd0d5 100644 --- a/build/linux/debian/dep-lists.ts +++ b/build/linux/debian/dep-lists.ts @@ -90,7 +90,6 @@ export const referenceGeneratedDepsByArch = { 'libstdc++6 (>= 5)', 'libstdc++6 (>= 5.2)', 'libstdc++6 (>= 6)', - 'libstdc++6 (>= 7)', 'libstdc++6 (>= 9)', 'libudev1 (>= 183)', 'libx11-6', @@ -130,6 +129,7 @@ export const referenceGeneratedDepsByArch = { 'libstdc++6 (>= 5)', 'libstdc++6 (>= 5.2)', 'libstdc++6 (>= 6)', + 'libstdc++6 (>= 7)', 'libstdc++6 (>= 9)', 'libudev1 (>= 183)', 'libx11-6', diff --git a/build/linux/rpm/dep-lists.ts b/build/linux/rpm/dep-lists.ts index d5fa034a8065b1..5014843c857366 100644 --- a/build/linux/rpm/dep-lists.ts +++ b/build/linux/rpm/dep-lists.ts @@ -126,6 +126,7 @@ export const referenceGeneratedDepsByArch = { 'libstdc++.so.6(GLIBCXX_3.4.19)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.20)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.21)(64bit)', + 'libstdc++.so.6(GLIBCXX_3.4.22)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.9)(64bit)', 'libudev.so.1()(64bit)', 'libudev.so.1(LIBUDEV_183)(64bit)', From 3e37de207a70ccbce9f08d85674c2d7b0e11026a Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 13:07:38 -0700 Subject: [PATCH 19/23] Copilot darwin ripgrep universal merge and arm64 rpm deps --- build/darwin/create-universal-app.ts | 2 +- build/linux/rpm/dep-lists.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index 8f907a44259988..dc59fa22d479c8 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -121,7 +121,7 @@ async function main(buildDir?: string) { outAppPath, force: true, mergeASARs: true, - x64ArchFiles: '{*/kerberos.node,**/extensions/microsoft-authentication/dist/libmsalruntime.dylib,**/extensions/microsoft-authentication/dist/msal-node-runtime.node,**/node_modules/@github/copilot-darwin-*/copilot,**/node_modules/@github/copilot-darwin-*/prebuilds/darwin-*/*,**/node_modules/@github/copilot/prebuilds/darwin-*/*,**/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot-darwin-*/copilot,**/node_modules.asar.unpacked/@github/copilot-darwin-*/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/prebuilds/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/ripgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules.asar.unpacked/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules/@microsoft/mxc-sdk/bin/**,**/node_modules.asar.unpacked/@microsoft/mxc-sdk/bin/**}', + x64ArchFiles: '{*/kerberos.node,**/extensions/microsoft-authentication/dist/libmsalruntime.dylib,**/extensions/microsoft-authentication/dist/msal-node-runtime.node,**/node_modules/@github/copilot-darwin-*/copilot,**/node_modules/@github/copilot-darwin-*/prebuilds/darwin-*/*,**/node_modules/@github/copilot-darwin-*/ripgrep/bin/darwin-*/*,**/node_modules/@github/copilot/prebuilds/darwin-*/*,**/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot-darwin-*/copilot,**/node_modules.asar.unpacked/@github/copilot-darwin-*/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot-darwin-*/ripgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/prebuilds/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/ripgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules.asar.unpacked/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules/@microsoft/mxc-sdk/bin/**,**/node_modules.asar.unpacked/@microsoft/mxc-sdk/bin/**}', filesToSkipComparison: (file: string) => { for (const expected of filesToSkip) { if (minimatch(file, expected)) { diff --git a/build/linux/rpm/dep-lists.ts b/build/linux/rpm/dep-lists.ts index 5014843c857366..96035d1fe8a970 100644 --- a/build/linux/rpm/dep-lists.ts +++ b/build/linux/rpm/dep-lists.ts @@ -292,6 +292,7 @@ export const referenceGeneratedDepsByArch = { 'libgtk-3.so.0()(64bit)', 'libm.so.6()(64bit)', 'libm.so.6(GLIBC_2.17)(64bit)', + 'libm.so.6(GLIBC_2.27)(64bit)', 'libnspr4.so()(64bit)', 'libnss3.so()(64bit)', 'libnss3.so(NSS_3.11)(64bit)', @@ -316,13 +317,16 @@ export const referenceGeneratedDepsByArch = { 'libssl3.so(NSS_3.28)(64bit)', 'libstdc++.so.6()(64bit)', 'libstdc++.so.6(CXXABI_1.3)(64bit)', + 'libstdc++.so.6(CXXABI_1.3.11)(64bit)', 'libstdc++.so.6(CXXABI_1.3.5)(64bit)', + 'libstdc++.so.6(CXXABI_1.3.7)(64bit)', 'libstdc++.so.6(CXXABI_1.3.8)(64bit)', 'libstdc++.so.6(CXXABI_1.3.9)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.11)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.14)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.15)(64bit)', + 'libstdc++.so.6(GLIBCXX_3.4.17)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.18)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.19)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.20)(64bit)', From 6a0f68f55e0b8373aabb1628af6221d4442d9cf5 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 13:51:06 -0700 Subject: [PATCH 20/23] Restore target Copilot SDK prebuilds for built-in extension packaging --- build/darwin/create-universal-app.ts | 2 +- build/lib/copilot.ts | 53 +++++++++++++++++++++++++--- build/lib/test/copilot.test.ts | 35 +++++++++++++++++- 3 files changed, 83 insertions(+), 7 deletions(-) diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index dc59fa22d479c8..0162022f50a358 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -121,7 +121,7 @@ async function main(buildDir?: string) { outAppPath, force: true, mergeASARs: true, - x64ArchFiles: '{*/kerberos.node,**/extensions/microsoft-authentication/dist/libmsalruntime.dylib,**/extensions/microsoft-authentication/dist/msal-node-runtime.node,**/node_modules/@github/copilot-darwin-*/copilot,**/node_modules/@github/copilot-darwin-*/prebuilds/darwin-*/*,**/node_modules/@github/copilot-darwin-*/ripgrep/bin/darwin-*/*,**/node_modules/@github/copilot/prebuilds/darwin-*/*,**/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot-darwin-*/copilot,**/node_modules.asar.unpacked/@github/copilot-darwin-*/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot-darwin-*/ripgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/prebuilds/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/ripgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules.asar.unpacked/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules/@microsoft/mxc-sdk/bin/**,**/node_modules.asar.unpacked/@microsoft/mxc-sdk/bin/**}', + x64ArchFiles: '{*/kerberos.node,**/extensions/microsoft-authentication/dist/libmsalruntime.dylib,**/extensions/microsoft-authentication/dist/msal-node-runtime.node,**/node_modules/@github/copilot-darwin-*/**,**/node_modules/@github/copilot/prebuilds/darwin-*/*,**/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot-darwin-*/**,**/node_modules.asar.unpacked/@github/copilot/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/prebuilds/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/ripgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules.asar.unpacked/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules/@microsoft/mxc-sdk/bin/**,**/node_modules.asar.unpacked/@microsoft/mxc-sdk/bin/**}', filesToSkipComparison: (file: string) => { for (const expected of filesToSkip) { if (minimatch(file, expected)) { diff --git a/build/lib/copilot.ts b/build/lib/copilot.ts index 2780c774ae90de..ac89912e272c3b 100644 --- a/build/lib/copilot.ts +++ b/build/lib/copilot.ts @@ -263,13 +263,12 @@ function verifyNpmIntegrity(tarballPath: string, integrity: string | undefined): } /** - * Materializes the copilot CLI ripgrep shim directly inside the built-in copilot extension. + * Materializes target-platform Copilot CLI SDK files directly inside the built-in copilot extension. * * This is used when copilot is shipped as a built-in extension so startup does - * not need to create the shim at runtime. The destination layout matches the - * runtime shim logic in the copilot extension: - * - ripgrep: node_modules/@github/copilot/sdk/ripgrep/bin/{platform-arch} - * - marker: node_modules/@github/copilot/shims.txt + * not need to create the shim at runtime. The Copilot VSIX is built once on the + * Linux x64 host, so product packaging also restores target-platform SDK + * natives from the selected @github/copilot-{platform} package. * * Note: `node-pty` is no longer shimmed. The copilot CLI SDK resolves * `node-pty` from the embedder (VS Code) via `hostRequire` and falls back to @@ -290,6 +289,7 @@ export function prepareBuiltInCopilotRipgrepShim(platform: string, arch: string, if (!fs.existsSync(copilotSdkBase)) { throw new Error(`[prepareBuiltInCopilotRipgrepShim] Copilot SDK directory not found at ${copilotSdkBase}`); } + materializeBuiltInCopilotSdkPlatformFiles(copilotPackagePlatformArch, tgrepPlatformArch, copilotBase, appNodeModulesDir); pruneNonTargetCopilotSdkPrebuilds(copilotPackagePlatformArch, path.join(copilotSdkBase, 'prebuilds'), copilotPlatforms); pruneNonTargetCopilotSdkPrebuilds(tgrepPlatformArch, path.join(copilotSdkBase, path.join('tgrep', 'bin')), copilotTgrepPlatforms); pruneNonTargetCopilotSdkPrebuilds(tgrepPlatformArch, path.join(copilotBase, path.join('tgrep', 'bin')), copilotTgrepPlatforms); @@ -322,6 +322,49 @@ export function prepareBuiltInCopilotRipgrepShim(platform: string, arch: string, } } +function materializeBuiltInCopilotSdkPlatformFiles(copilotPackagePlatformArch: string, tgrepPlatformArch: string, copilotBase: string, appNodeModulesDir: string): void { + if (!copilotPlatforms.includes(copilotPackagePlatformArch)) { + return; + } + + const platformPackageDir = path.join(appNodeModulesDir, '@github', `copilot-${copilotPackagePlatformArch}`); + if (!fs.existsSync(platformPackageDir)) { + throw new Error(`[prepareBuiltInCopilotRipgrepShim] Copilot platform package not found at ${platformPackageDir}`); + } + + copyRequiredDirectory( + path.join(platformPackageDir, 'prebuilds', copilotPackagePlatformArch), + path.join(copilotBase, 'sdk', 'prebuilds', copilotPackagePlatformArch), + `Copilot SDK native prebuilds for ${copilotPackagePlatformArch}` + ); + + if (!copilotTgrepPlatforms.includes(tgrepPlatformArch)) { + return; + } + + const tgrepSource = path.join(platformPackageDir, 'tgrep', 'bin', tgrepPlatformArch); + copyRequiredDirectory( + tgrepSource, + path.join(copilotBase, 'tgrep', 'bin', tgrepPlatformArch), + `Copilot tgrep for ${tgrepPlatformArch}` + ); + copyRequiredDirectory( + tgrepSource, + path.join(copilotBase, 'sdk', 'tgrep', 'bin', tgrepPlatformArch), + `Copilot SDK tgrep for ${tgrepPlatformArch}` + ); +} + +function copyRequiredDirectory(source: string, target: string, description: string): void { + if (!fs.existsSync(source)) { + throw new Error(`[prepareBuiltInCopilotRipgrepShim] ${description} not found at ${source}`); + } + + fs.rmSync(target, { recursive: true, force: true }); + fs.mkdirSync(path.dirname(target), { recursive: true }); + fs.cpSync(source, target, { recursive: true }); +} + function pruneNonTargetCopilotSdkPrebuilds(targetPlatformArch: string, prebuildsDir: string, platformArchs: string[]): void { if (!fs.existsSync(prebuildsDir)) { return; diff --git a/build/lib/test/copilot.test.ts b/build/lib/test/copilot.test.ts index 74489fe83c9526..58bc0f2d02e05b 100644 --- a/build/lib/test/copilot.test.ts +++ b/build/lib/test/copilot.test.ts @@ -9,7 +9,7 @@ import * as os from 'os'; import * as path from 'path'; import { suite, test } from 'node:test'; import { create } from 'tar'; -import { copilotPlatforms, ensureCopilotPlatformPackage, getCopilotExcludeFilter, getCopilotRuntimePrebuildFiles } from '../copilot.ts'; +import { copilotPlatforms, ensureCopilotPlatformPackage, getCopilotExcludeFilter, getCopilotRuntimePrebuildFiles, prepareBuiltInCopilotRipgrepShim } from '../copilot.ts'; suite('copilot', () => { test('keeps the public copilot platform package include list scoped to the selected package', () => { @@ -132,6 +132,39 @@ suite('copilot', () => { } }); + test('materializes target Copilot SDK prebuilds and tgrep for the built-in extension', () => { + const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'vscode-copilot-sdk-prebuild-test-')); + try { + const builtInCopilotExtensionDir = path.join(repoRoot, 'extensions', 'copilot'); + const extensionCopilotDir = path.join(builtInCopilotExtensionDir, 'node_modules', '@github', 'copilot'); + const appNodeModulesDir = path.join(repoRoot, 'node_modules'); + const platformPackageDir = path.join(appNodeModulesDir, '@github', 'copilot-win32-x64'); + + fs.mkdirSync(path.join(extensionCopilotDir, 'sdk', 'prebuilds', 'linux-x64'), { recursive: true }); + fs.writeFileSync(path.join(extensionCopilotDir, 'sdk', 'prebuilds', 'linux-x64', 'runtime.node'), ''); + fs.mkdirSync(path.join(platformPackageDir, 'prebuilds', 'win32-x64', 'conpty'), { recursive: true }); + fs.writeFileSync(path.join(platformPackageDir, 'prebuilds', 'win32-x64', 'runtime.node'), ''); + fs.writeFileSync(path.join(platformPackageDir, 'prebuilds', 'win32-x64', 'conpty.node'), ''); + fs.writeFileSync(path.join(platformPackageDir, 'prebuilds', 'win32-x64', 'conpty', 'OpenConsole.exe'), ''); + fs.mkdirSync(path.join(platformPackageDir, 'tgrep', 'bin', 'win32-x64'), { recursive: true }); + fs.writeFileSync(path.join(platformPackageDir, 'tgrep', 'bin', 'win32-x64', 'tgrep.exe'), ''); + fs.mkdirSync(path.join(appNodeModulesDir, '@vscode', 'ripgrep-universal', 'bin', 'win32-x64'), { recursive: true }); + fs.writeFileSync(path.join(appNodeModulesDir, '@vscode', 'ripgrep-universal', 'bin', 'win32-x64', 'rg.exe'), ''); + + prepareBuiltInCopilotRipgrepShim('win32', 'x64', builtInCopilotExtensionDir, appNodeModulesDir); + + assert(fs.existsSync(path.join(extensionCopilotDir, 'sdk', 'prebuilds', 'win32-x64', 'runtime.node'))); + assert(fs.existsSync(path.join(extensionCopilotDir, 'sdk', 'prebuilds', 'win32-x64', 'conpty.node'))); + assert(fs.existsSync(path.join(extensionCopilotDir, 'sdk', 'prebuilds', 'win32-x64', 'conpty', 'OpenConsole.exe'))); + assert(!fs.existsSync(path.join(extensionCopilotDir, 'sdk', 'prebuilds', 'linux-x64'))); + assert(fs.existsSync(path.join(extensionCopilotDir, 'tgrep', 'bin', 'win32-x64', 'tgrep.exe'))); + assert(fs.existsSync(path.join(extensionCopilotDir, 'sdk', 'tgrep', 'bin', 'win32-x64', 'tgrep.exe'))); + assert(fs.existsSync(path.join(extensionCopilotDir, 'sdk', 'ripgrep', 'bin', 'win32-x64', 'rg.exe'))); + } finally { + fs.rmSync(repoRoot, { recursive: true, force: true }); + } + }); + test('strips all copilot platform packages for unsupported armhf builds', () => { assert.deepStrictEqual( getCopilotExcludeFilter('linux', 'armhf'), From cf74d3b4f542b2ebabb8d045328458c0891579c5 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 14:08:51 -0700 Subject: [PATCH 21/23] see if changes to gulpfile.reh.ts would help --- build/gulpfile.reh.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/gulpfile.reh.ts b/build/gulpfile.reh.ts index b00894781aee62..caf85b4d72c3ba 100644 --- a/build/gulpfile.reh.ts +++ b/build/gulpfile.reh.ts @@ -31,7 +31,7 @@ import log from 'fancy-log'; import buildfile from './buildfile.ts'; import { fetchUrls } from './lib/fetch.ts'; import { downloadFeedPackage } from './lib/azureFeed.ts'; -import { getCopilotExcludeFilter, getCopilotRuntimePrebuildFiles, getCopilotTgrepExcludeFilter, getRipgrepExcludeFilter, prepareBuiltInCopilotRipgrepShim } from './lib/copilot.ts'; +import { ensureCopilotPlatformPackage, getCopilotExcludeFilter, getCopilotRuntimePrebuildFiles, getCopilotTgrepExcludeFilter, getRipgrepExcludeFilter, prepareBuiltInCopilotRipgrepShim } from './lib/copilot.ts'; import { readAgentSdkResults } from './agent-sdk/common.ts'; @@ -442,6 +442,7 @@ function packageTask(type: string, platform: string, arch: string, sourceFolderN .pipe(filter(['**', '!**/package-lock.json', '!**/*.{js,css}.map'])) .pipe(util.cleanNodeModules(path.join(import.meta.dirname, '.moduleignore'))) .pipe(util.cleanNodeModules(path.join(import.meta.dirname, `.moduleignore.${process.platform}`))); + ensureCopilotPlatformPackage(platform, arch, 'remote/node_modules'); const copilotRuntimePrebuilds = gulp.src(getCopilotRuntimePrebuildFiles(platform, arch, 'remote/node_modules'), { base: 'remote', dot: true, allowEmpty: true }); const deps = es.merge(cleanedDeps, copilotRuntimePrebuilds) .pipe(filter(getCopilotExcludeFilter(platform, arch))) From 7be53b227757a5b2088c522ab95e02060c4deade Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 14:20:52 -0700 Subject: [PATCH 22/23] dont mess with formatting --- build/darwin/create-universal-app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index 0162022f50a358..7b6910a05e0e2c 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -121,7 +121,7 @@ async function main(buildDir?: string) { outAppPath, force: true, mergeASARs: true, - x64ArchFiles: '{*/kerberos.node,**/extensions/microsoft-authentication/dist/libmsalruntime.dylib,**/extensions/microsoft-authentication/dist/msal-node-runtime.node,**/node_modules/@github/copilot-darwin-*/**,**/node_modules/@github/copilot/prebuilds/darwin-*/*,**/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot-darwin-*/**,**/node_modules.asar.unpacked/@github/copilot/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/prebuilds/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/ripgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules.asar.unpacked/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules/@microsoft/mxc-sdk/bin/**,**/node_modules.asar.unpacked/@microsoft/mxc-sdk/bin/**}', + x64ArchFiles: '{*/kerberos.node,**/extensions/microsoft-authentication/dist/libmsalruntime.dylib,**/extensions/microsoft-authentication/dist/msal-node-runtime.node,**/node_modules/@github/copilot-darwin-*/**,**/node_modules/@github/copilot/prebuilds/darwin-*/*,**/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot-darwin-*/**,**/node_modules.asar.unpacked/@github/copilot/prebuilds/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules.asar.unpacked/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/prebuilds/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/ripgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/sdk/tgrep/bin/darwin-*/*,**/extensions/copilot/node_modules/@github/copilot/tgrep/bin/darwin-*/*,**/node_modules/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules.asar.unpacked/@vscode/ripgrep-universal/bin/darwin-*/*,**/node_modules/@microsoft/mxc-sdk/bin/**,**/node_modules.asar.unpacked/@microsoft/mxc-sdk/bin/**}', filesToSkipComparison: (file: string) => { for (const expected of filesToSkip) { if (minimatch(file, expected)) { From 2c0a13e65ad306d7764ed651ea2888f8e18ce72f Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 23 Jun 2026 16:53:01 -0700 Subject: [PATCH 23/23] Launch copilot cli from platform index.js and exclude SEA --- build/lib/copilot.ts | 9 +-- build/lib/test/copilot.test.ts | 34 +++++++++-- build/linux/debian/dep-lists.ts | 2 - build/linux/dependencies-generator.ts | 10 +--- build/linux/rpm/dep-lists.ts | 13 ----- .../agentHost/node/copilot/copilotAgent.ts | 57 +++++++++---------- 6 files changed, 61 insertions(+), 64 deletions(-) diff --git a/build/lib/copilot.ts b/build/lib/copilot.ts index ac89912e272c3b..8344512dd307a5 100644 --- a/build/lib/copilot.ts +++ b/build/lib/copilot.ts @@ -159,10 +159,9 @@ export function getCopilotExcludeFilter(platform: string, arch: string): string[ * app/remote packaging for the target platform. * * .moduleignore strips all @github/copilot-* platform packages globally. - * Re-add the selected runtime package so @github/copilot/npm-loader.js can - * launch the platform executable and the CLI can load its signed runtime - * prebuilds from the product instead of extracting them to the user cache. - * Keep optional native payload trees out of the product build. + * Re-add the selected runtime package so Agent Host can launch its index.js + * entrypoint and load runtime prebuilds. Keep the standalone SEA executable + * and optional native payload trees out of the product build. */ export function getCopilotRuntimePrebuildFiles(platform: string, arch: string, nodeModulesRoot = 'node_modules'): string[] { const copilotPackagePlatformArch = toCopilotPackagePlatformArch(platform, arch); @@ -170,6 +169,8 @@ export function getCopilotRuntimePrebuildFiles(platform: string, arch: string, n return [ path.posix.join(copilotPlatformPackageDir, '**'), + `!${path.posix.join(copilotPlatformPackageDir, 'copilot')}`, + `!${path.posix.join(copilotPlatformPackageDir, 'copilot.exe')}`, ...copilotOptionalNativePayloadDirs.map(dir => `!${path.posix.join(copilotPlatformPackageDir, dir, '**')}`), ...getCopilotOptionalNativePayloadFiles(platform).map(file => `!${path.posix.join(copilotPlatformPackageDir, file)}`), ]; diff --git a/build/lib/test/copilot.test.ts b/build/lib/test/copilot.test.ts index 58bc0f2d02e05b..67c9421b10f22d 100644 --- a/build/lib/test/copilot.test.ts +++ b/build/lib/test/copilot.test.ts @@ -17,6 +17,8 @@ suite('copilot', () => { assert.deepStrictEqual(files, [ 'node_modules/@github/copilot-linux-x64/**', + '!node_modules/@github/copilot-linux-x64/copilot', + '!node_modules/@github/copilot-linux-x64/copilot.exe', '!node_modules/@github/copilot-linux-x64/clipboard/**', '!node_modules/@github/copilot-linux-x64/foundry-local-sdk/**', '!node_modules/@github/copilot-linux-x64/mxc-bin/**', @@ -26,10 +28,12 @@ suite('copilot', () => { '!node_modules/@github/copilot-linux-x64/prebuilds/*/cli-native.node', ]); assertCopilotPlatformPackageIncludes(files, 'node_modules/@github/copilot-linux-x64', [ - 'copilot', + 'index.js', + 'app.js', 'prebuilds/linux-x64/runtime.node', 'prebuilds/linux-x64/pty.node', ]); + assertCopilotStandaloneExecutableExcluded(files, 'node_modules/@github/copilot-linux-x64'); assertOptionalCopilotNativeDependenciesExcluded(files, 'node_modules/@github/copilot-linux-x64'); }); @@ -38,6 +42,8 @@ suite('copilot', () => { assert.deepStrictEqual(files, [ 'node_modules/@github/copilot-linuxmusl-x64/**', + '!node_modules/@github/copilot-linuxmusl-x64/copilot', + '!node_modules/@github/copilot-linuxmusl-x64/copilot.exe', '!node_modules/@github/copilot-linuxmusl-x64/clipboard/**', '!node_modules/@github/copilot-linuxmusl-x64/foundry-local-sdk/**', '!node_modules/@github/copilot-linuxmusl-x64/mxc-bin/**', @@ -47,15 +53,19 @@ suite('copilot', () => { '!node_modules/@github/copilot-linuxmusl-x64/prebuilds/*/cli-native.node', ]); assertCopilotPlatformPackageIncludes(files, 'node_modules/@github/copilot-linuxmusl-x64', [ - 'copilot', + 'index.js', + 'app.js', 'prebuilds/linuxmusl-x64/runtime.node', ]); + assertCopilotStandaloneExecutableExcluded(files, 'node_modules/@github/copilot-linuxmusl-x64'); assertOptionalCopilotNativeDependenciesExcluded(files, 'node_modules/@github/copilot-linuxmusl-x64'); }); test('uses the .exe package runtime for windows builds', () => { assert.deepStrictEqual(getCopilotRuntimePrebuildFiles('win32', 'x64'), [ 'node_modules/@github/copilot-win32-x64/**', + '!node_modules/@github/copilot-win32-x64/copilot', + '!node_modules/@github/copilot-win32-x64/copilot.exe', '!node_modules/@github/copilot-win32-x64/clipboard/**', '!node_modules/@github/copilot-win32-x64/foundry-local-sdk/**', '!node_modules/@github/copilot-win32-x64/mxc-bin/**', @@ -64,7 +74,8 @@ suite('copilot', () => { '!node_modules/@github/copilot-win32-x64/prebuilds/*/keytar.node', ]); assertCopilotPlatformPackageIncludes(getCopilotRuntimePrebuildFiles('win32', 'x64'), 'node_modules/@github/copilot-win32-x64', [ - 'copilot.exe', + 'index.js', + 'app.js', 'prebuilds/win32-x64/cli-native.node', 'prebuilds/win32-x64/runtime.node', 'prebuilds/win32-x64/conpty.node', @@ -72,9 +83,12 @@ suite('copilot', () => { 'prebuilds/win32-x64/conpty/OpenConsole.exe', 'prebuilds/win32-x64/conpty/conpty.dll', ]); + assertCopilotStandaloneExecutableExcluded(getCopilotRuntimePrebuildFiles('win32', 'x64'), 'node_modules/@github/copilot-win32-x64'); assert.deepStrictEqual(getCopilotRuntimePrebuildFiles('win32', 'arm64'), [ 'node_modules/@github/copilot-win32-arm64/**', + '!node_modules/@github/copilot-win32-arm64/copilot', + '!node_modules/@github/copilot-win32-arm64/copilot.exe', '!node_modules/@github/copilot-win32-arm64/clipboard/**', '!node_modules/@github/copilot-win32-arm64/foundry-local-sdk/**', '!node_modules/@github/copilot-win32-arm64/mxc-bin/**', @@ -83,13 +97,13 @@ suite('copilot', () => { '!node_modules/@github/copilot-win32-arm64/prebuilds/*/keytar.node', ]); assertOptionalCopilotNativeDependenciesExcluded(getCopilotRuntimePrebuildFiles('win32', 'x64'), 'node_modules/@github/copilot-win32-x64'); + assertCopilotStandaloneExecutableExcluded(getCopilotRuntimePrebuildFiles('win32', 'arm64'), 'node_modules/@github/copilot-win32-arm64'); }); test('keeps macOS runtime prebuilds in the selected platform package', () => { const files = getCopilotRuntimePrebuildFiles('darwin', 'arm64'); assertCopilotPlatformPackageIncludes(files, 'node_modules/@github/copilot-darwin-arm64', [ - 'copilot', 'index.js', 'app.js', 'sea-loader.js', @@ -97,6 +111,7 @@ suite('copilot', () => { 'prebuilds/darwin-arm64/pty.node', 'prebuilds/darwin-arm64/spawn-helper', ]); + assertCopilotStandaloneExecutableExcluded(files, 'node_modules/@github/copilot-darwin-arm64'); assertOptionalCopilotNativeDependenciesExcluded(files, 'node_modules/@github/copilot-darwin-arm64'); }); @@ -117,7 +132,7 @@ suite('copilot', () => { packPackage: (_packageName, _version, tempDir) => { const packageRoot = path.join(tempDir, 'package'); fs.mkdirSync(path.join(packageRoot, 'prebuilds', 'darwin-x64'), { recursive: true }); - fs.writeFileSync(path.join(packageRoot, 'copilot'), ''); + fs.writeFileSync(path.join(packageRoot, 'index.js'), ''); fs.writeFileSync(path.join(packageRoot, 'prebuilds', 'darwin-x64', 'runtime.node'), ''); const tarball = path.join(tempDir, 'copilot-darwin-x64.tgz'); create({ file: tarball, cwd: tempDir, gzip: true, sync: true }, ['package']); @@ -125,7 +140,7 @@ suite('copilot', () => { } }); - assert(fs.existsSync(path.join(nodeModulesRoot, '@github', 'copilot-darwin-x64', 'copilot'))); + assert(fs.existsSync(path.join(nodeModulesRoot, '@github', 'copilot-darwin-x64', 'index.js'))); assert(fs.existsSync(path.join(nodeModulesRoot, '@github', 'copilot-darwin-x64', 'prebuilds', 'darwin-x64', 'runtime.node'))); } finally { fs.rmSync(repoRoot, { recursive: true, force: true }); @@ -183,6 +198,13 @@ function assertCopilotPlatformPackageIncludes(patterns: string[], packageDir: st } } +function assertCopilotStandaloneExecutableExcluded(patterns: string[], packageDir: string): void { + for (const executable of ['copilot', 'copilot.exe']) { + assert(patterns.includes(`!${packageDir}/${executable}`), executable); + assert(!matchesGlob(`${packageDir}/${executable}`, patterns), executable); + } +} + function assertOptionalCopilotNativeDependenciesExcluded(patterns: string[], packageDir: string): void { for (const dir of ['clipboard', 'foundry-local-sdk', 'mxc-bin', 'pvrecorder']) { assert(patterns.includes(`!${packageDir}/${dir}/**`), dir); diff --git a/build/linux/debian/dep-lists.ts b/build/linux/debian/dep-lists.ts index 7d0d94e83bd0d5..7690e25d5fd31d 100644 --- a/build/linux/debian/dep-lists.ts +++ b/build/linux/debian/dep-lists.ts @@ -48,7 +48,6 @@ export const referenceGeneratedDepsByArch = { 'libnss3 (>= 3.26)', 'libpango-1.0-0 (>= 1.14.0)', 'libstdc++6 (>= 6)', - 'libstdc++6 (>= 7)', 'libudev1 (>= 183)', 'libx11-6', 'libx11-6 (>= 2:1.4.99.1)', @@ -129,7 +128,6 @@ export const referenceGeneratedDepsByArch = { 'libstdc++6 (>= 5)', 'libstdc++6 (>= 5.2)', 'libstdc++6 (>= 6)', - 'libstdc++6 (>= 7)', 'libstdc++6 (>= 9)', 'libudev1 (>= 183)', 'libx11-6', diff --git a/build/linux/dependencies-generator.ts b/build/linux/dependencies-generator.ts index 144d733db49b8d..eb1d73d011ac9a 100644 --- a/build/linux/dependencies-generator.ts +++ b/build/linux/dependencies-generator.ts @@ -46,15 +46,7 @@ export async function getDependencies(packageType: 'deb' | 'rpm', buildDir: stri // Get the files for which we want to find dependencies. const canAsar = false; // TODO@esm ASAR disabled in ESM const nativeModulesPath = path.join(buildDir, 'resources', 'app', canAsar ? 'node_modules.asar.unpacked' : 'node_modules'); - const findResult = spawnSync('find', [ - nativeModulesPath, - '-type', 'f', - '(', - '-name', '*.node', - '-o', - '-path', path.join(nativeModulesPath, '@github', 'copilot-*', 'copilot'), - ')' - ]); + const findResult = spawnSync('find', [nativeModulesPath, '-name', '*.node']); if (findResult.status) { console.error('Error finding files:'); console.error(findResult.stderr.toString()); diff --git a/build/linux/rpm/dep-lists.ts b/build/linux/rpm/dep-lists.ts index 96035d1fe8a970..e9f414e4c7ef97 100644 --- a/build/linux/rpm/dep-lists.ts +++ b/build/linux/rpm/dep-lists.ts @@ -72,7 +72,6 @@ export const referenceGeneratedDepsByArch = { 'libgcc_s.so.1()(64bit)', 'libgcc_s.so.1(GCC_3.0)(64bit)', 'libgcc_s.so.1(GCC_3.3)(64bit)', - 'libgcc_s.so.1(GCC_3.4)(64bit)', 'libgcc_s.so.1(GCC_4.0.0)(64bit)', 'libgcc_s.so.1(GCC_4.2.0)(64bit)', 'libgio-2.0.so.0()(64bit)', @@ -112,22 +111,13 @@ export const referenceGeneratedDepsByArch = { 'libssl3.so(NSS_3.28)(64bit)', 'libstdc++.so.6()(64bit)', 'libstdc++.so.6(CXXABI_1.3)(64bit)', - 'libstdc++.so.6(CXXABI_1.3.11)(64bit)', - 'libstdc++.so.6(CXXABI_1.3.5)(64bit)', - 'libstdc++.so.6(CXXABI_1.3.7)(64bit)', 'libstdc++.so.6(CXXABI_1.3.8)(64bit)', 'libstdc++.so.6(CXXABI_1.3.9)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.11)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.14)(64bit)', - 'libstdc++.so.6(GLIBCXX_3.4.15)(64bit)', - 'libstdc++.so.6(GLIBCXX_3.4.17)(64bit)', - 'libstdc++.so.6(GLIBCXX_3.4.18)(64bit)', - 'libstdc++.so.6(GLIBCXX_3.4.19)(64bit)', - 'libstdc++.so.6(GLIBCXX_3.4.20)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.21)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.22)(64bit)', - 'libstdc++.so.6(GLIBCXX_3.4.9)(64bit)', 'libudev.so.1()(64bit)', 'libudev.so.1(LIBUDEV_183)(64bit)', 'libutil.so.1()(64bit)', @@ -317,16 +307,13 @@ export const referenceGeneratedDepsByArch = { 'libssl3.so(NSS_3.28)(64bit)', 'libstdc++.so.6()(64bit)', 'libstdc++.so.6(CXXABI_1.3)(64bit)', - 'libstdc++.so.6(CXXABI_1.3.11)(64bit)', 'libstdc++.so.6(CXXABI_1.3.5)(64bit)', - 'libstdc++.so.6(CXXABI_1.3.7)(64bit)', 'libstdc++.so.6(CXXABI_1.3.8)(64bit)', 'libstdc++.so.6(CXXABI_1.3.9)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.11)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.14)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.15)(64bit)', - 'libstdc++.so.6(GLIBCXX_3.4.17)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.18)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.19)(64bit)', 'libstdc++.so.6(GLIBCXX_3.4.20)(64bit)', diff --git a/src/vs/platform/agentHost/node/copilot/copilotAgent.ts b/src/vs/platform/agentHost/node/copilot/copilotAgent.ts index 20f2a7ac8c3a1e..986cbf05e5653b 100644 --- a/src/vs/platform/agentHost/node/copilot/copilotAgent.ts +++ b/src/vs/platform/agentHost/node/copilot/copilotAgent.ts @@ -77,10 +77,6 @@ function copilotCliLogLevelFor(level: LogLevel): NonNullable { try { await fs.access(filePath); @@ -90,37 +86,42 @@ async function fileExists(filePath: string): Promise { } } -async function resolveCopilotCliPath(nodeModulesUri: URI): Promise { - const copilotPackageUri = URI.joinPath(nodeModulesUri, '@github', 'copilot'); - const packageJsonPath = URI.joinPath(copilotPackageUri, 'package.json').fsPath; - const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8')) as ICopilotPackageJson; - const bin = packageJson.bin?.copilot; - if (typeof bin !== 'string' || bin.length === 0) { - throw new Error(`Unable to resolve @github/copilot CLI path. Missing package.json bin.copilot in ${packageJsonPath}`); - } - - const binPath = join(copilotPackageUri.fsPath, bin); - if (await fileExists(binPath)) { - return binPath; +function isLinuxMuslRuntime(): boolean { + if (process.platform !== 'linux') { + return false; } - throw new Error(`Unable to resolve @github/copilot CLI path. package.json bin.copilot points to missing file ${binPath}`); + const report = process.report?.getReport() as { header?: { glibcVersionRuntime?: string } } | undefined; + return !report?.header?.glibcVersionRuntime; } -async function resolveCopilotCliDistDir(nodeModulesUri: URI): Promise { +function getCopilotPlatformPackageCandidates(): string[] { const platformArch = `${process.platform}-${process.arch}`; - const candidatePlatformPackages = process.platform === 'linux' - ? [`copilot-${platformArch}`, `copilot-linuxmusl-${process.arch}`] - : [`copilot-${platformArch}`]; + if (process.platform !== 'linux') { + return [platformArch]; + } - for (const packageName of candidatePlatformPackages) { - const packageDir = URI.joinPath(nodeModulesUri, '@github', packageName).fsPath; - if (await fileExists(join(packageDir, 'index.js'))) { - return packageDir; + const linuxCandidates = [`linux-${process.arch}`, `linuxmusl-${process.arch}`]; + return isLinuxMuslRuntime() ? linuxCandidates.reverse() : linuxCandidates; +} + +async function resolveCopilotCliPath(nodeModulesUri: URI): Promise { + const tried: string[] = []; + for (const platformPackage of getCopilotPlatformPackageCandidates()) { + const cliPath = URI.joinPath(nodeModulesUri, '@github', `copilot-${platformPackage}`, 'index.js').fsPath; + tried.push(cliPath); + if (await fileExists(cliPath)) { + return cliPath; } } - return undefined; + const oldTopLevelPath = URI.joinPath(nodeModulesUri, '@github', 'copilot', 'index.js').fsPath; + tried.push(oldTopLevelPath); + if (await fileExists(oldTopLevelPath)) { + return oldTopLevelPath; + } + + throw new Error(`Unable to resolve @github/copilot CLI path. Tried: ${tried.join(', ')}`); } interface ICreatedWorktree { @@ -734,10 +735,6 @@ export class CopilotAgent extends Disposable implements IAgent { // FileAccess.asFileUri('') points to the `out/` directory; node_modules is one level up. const nodeModulesUri = URI.joinPath(FileAccess.asFileUri(''), '..', 'node_modules'); const cliPath = await resolveCopilotCliPath(nodeModulesUri); - const cliDistDir = await resolveCopilotCliDistDir(nodeModulesUri); - if (cliDistDir) { - env['COPILOT_CLI_DIST_DIR'] = cliDistDir; - } // The SDK's sandbox auto-detection looks for `//wxc-exec.exe` // (and the Linux/macOS equivalents). VS Code core ships the MXC sandbox binaries