ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / build / lib / test / copilot.test.ts 460 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
import assert from 'assert' ;
import { createHash } from 'crypto' ;
import * as fs from 'fs' ;
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, getMxcExcludeFilter, prepareBuiltInCopilotRipgrepShim
dir tarball integrity
stage fs path dir
packageRoot path stage
fs path packageRoot recursive
fs path packageRoot recursive
fs path packageRoot version
fs path packageRoot
fs path packageRoot
tarball path stage
file tarball cwd stage gzip sync
integrity fs tarball
tarball integrity
files
assert files
files
files
files
files
files
assert files
files
files
files
files
assert
assert
files
files
files
files
files
repoRoot fs path os
nodeModulesRoot path repoRoot
fs nodeModulesRoot recursive
fs path repoRoot
packages
version
nodeModulesRoot
_packageName _version tempDir
packageRoot path tempDir
fs path packageRoot recursive
fs path packageRoot
fs path packageRoot
tarball path tempDir
file tarball cwd tempDir gzip sync
tarball
fs path nodeModulesRoot
fs path nodeModulesRoot
fs repoRoot recursive force
files
files
files
files
assert files file file
repoRoot fs path os
builtInCopilotExtensionDir path repoRoot
extensionCopilotDir path builtInCopilotExtensionDir
appNodeModulesDir path repoRoot
platformPackageDir path appNodeModulesDir
fs path extensionCopilotDir recursive
fs path extensionCopilotDir
fs path extensionCopilotDir version
fs path platformPackageDir recursive
fs path platformPackageDir version
fs path platformPackageDir recursive
fs path platformPackageDir
fs path platformPackageDir
fs path platformPackageDir
fs path platformPackageDir
fs path platformPackageDir
fs path platformPackageDir
fs path platformPackageDir
fs path platformPackageDir
fs path platformPackageDir recursive
fs path platformPackageDir
fs path appNodeModulesDir recursive
fs path appNodeModulesDir
builtInCopilotExtensionDir appNodeModulesDir
fs path extensionCopilotDir
fs path extensionCopilotDir
fs path extensionCopilotDir
fs path extensionCopilotDir
fs path extensionCopilotDir
fs path extensionCopilotDir
fs path extensionCopilotDir
fs path extensionCopilotDir
fs path extensionCopilotDir
fs path extensionCopilotDir
fs path extensionCopilotDir
fs repoRoot recursive force
repoRoot fs path os
builtInCopilotExtensionDir path repoRoot
extensionCopilotDir path builtInCopilotExtensionDir
appNodeModulesDir path repoRoot
platformPackageDir path appNodeModulesDir
fs path extensionCopilotDir recursive
fs path extensionCopilotDir version
fs path platformPackageDir recursive
fs path platformPackageDir version
fs path platformPackageDir
fs path platformPackageDir recursive
fs path platformPackageDir
fs path appNodeModulesDir recursive
fs path appNodeModulesDir
tarball integrity repoRoot
extensionLockfilePath path builtInCopilotExtensionDir
fs extensionLockfilePath
packages version integrity
packCalls packageName version
builtInCopilotExtensionDir appNodeModulesDir
extensionLockfilePath
packageName version
packCalls packageName version
tarball
assert packCalls packageName version
assert
fs path extensionCopilotDir
assert
fs path extensionCopilotDir
fs repoRoot recursive force
repoRoot fs path os
builtInCopilotExtensionDir path repoRoot
extensionCopilotDir path builtInCopilotExtensionDir
appNodeModulesDir path repoRoot
fs path extensionCopilotDir recursive
fs path extensionCopilotDir version
fs path appNodeModulesDir recursive
fs path appNodeModulesDir
tarball repoRoot
extensionLockfilePath path builtInCopilotExtensionDir
fs extensionLockfilePath
packages version integrity
assert builtInCopilotExtensionDir appNodeModulesDir
extensionLockfilePath
tarball
fs repoRoot recursive force
assert
copilotPlatforms platform
assert
assert
assert
patterns packageDir relativeFiles
patterns
relativeFile relativeFiles
patterns relativeFile
patterns packageDir
executable
patterns executable
patterns executable
patterns packageDir
executable
patterns executable
patterns executable
patterns packageDir
dir
patterns dir
patterns dir
patterns
patterns
patterns
patterns
patterns
patterns
patterns
patterns
patterns
patterns
packageDir
patterns
patterns
file patterns
included
pattern patterns
isExclude pattern
glob isExclude pattern pattern
file glob
included isExclude
included
file pattern
pattern pattern
file pattern
pattern
regex
regex file
file pattern
value
value
}
from
'../copilot.ts'
;
function
createPinnedCopilotWin32Tarball
(
:
string
)
:
{
:
string
;
:
string
}
{
const
=
.
mkdtempSync
(
.
join
(
,
'pkg-'
)
)
;
const
=
.
join
(
,
'package'
)
;
.
mkdirSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
)
,
{
:
true
}
)
;
.
mkdirSync
(
.
join
(
,
'tgrep'
,
'bin'
,
'win32-x64'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'package.json'
)
,
JSON
.
stringify
(
{
:
'1.0.73'
}
)
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'runtime.node'
)
,
'EXT-NATIVE-1.0.73'
)
;
.
writeFileSync
(
.
join
(
,
'tgrep'
,
'bin'
,
'win32-x64'
,
'tgrep.exe'
)
,
'EXT-TGREP-1.0.73'
)
;
const
=
.
join
(
,
'copilot-win32-x64.tgz'
)
;
create
(
{
:
,
:
,
:
true
,
:
true
}
,
[
'package'
]
)
;
const
=
'sha512-'
+
createHash
(
'sha512'
)
.
update
(
.
readFileSync
(
)
)
.
digest
(
'base64'
)
;
return
{
,
}
;
}
suite
(
'copilot'
,
(
)
=>
{
test
(
'keeps the public copilot platform package include list scoped to the selected package'
,
(
)
=>
{
const
=
getCopilotRuntimePrebuildFiles
(
'linux'
,
'x64'
)
;
.
deepStrictEqual
(
,
[
'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/prebuilds/*/copilot-runtime'
,
'!node_modules/@github/copilot-linux-x64/prebuilds/*/copilot-runtime-bin'
,
'!node_modules/@github/copilot-linux-x64/prebuilds/*/copilot-runtime.exe'
,
'!node_modules/@github/copilot-linux-x64/prebuilds/*/copilot-runtime-bin.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/**'
,
'!node_modules/@github/copilot-linux-x64/pvrecorder/**'
,
'!node_modules/@github/copilot-linux-x64/webview/**'
,
'!node_modules/@github/copilot-linux-x64/plugins/computer-use/**'
,
'!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/*/mediaremote-adapter/**'
,
'!node_modules/@github/copilot-linux-x64/prebuilds/*/cli-native.node'
,
]
)
;
assertCopilotPlatformPackageIncludes
(
,
'node_modules/@github/copilot-linux-x64'
,
[
'index.js'
,
'app.js'
,
'prebuilds/linux-x64/runtime.node'
,
'prebuilds/linux-x64/pty.node'
,
]
)
;
assertCopilotStandaloneExecutableExcluded
(
,
'node_modules/@github/copilot-linux-x64'
)
;
assertCopilotOutOfProcessRuntimeExecutablesExcluded
(
,
'node_modules/@github/copilot-linux-x64'
)
;
assertOptionalCopilotNativeDependenciesExcluded
(
,
'node_modules/@github/copilot-linux-x64'
)
;
}
)
;
test
(
'uses the linuxmusl package runtime for alpine builds'
,
(
)
=>
{
const
=
getCopilotRuntimePrebuildFiles
(
'alpine'
,
'x64'
)
;
.
deepStrictEqual
(
,
[
'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/prebuilds/*/copilot-runtime'
,
'!node_modules/@github/copilot-linuxmusl-x64/prebuilds/*/copilot-runtime-bin'
,
'!node_modules/@github/copilot-linuxmusl-x64/prebuilds/*/copilot-runtime.exe'
,
'!node_modules/@github/copilot-linuxmusl-x64/prebuilds/*/copilot-runtime-bin.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/**'
,
'!node_modules/@github/copilot-linuxmusl-x64/pvrecorder/**'
,
'!node_modules/@github/copilot-linuxmusl-x64/webview/**'
,
'!node_modules/@github/copilot-linuxmusl-x64/plugins/computer-use/**'
,
'!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/*/mediaremote-adapter/**'
,
'!node_modules/@github/copilot-linuxmusl-x64/prebuilds/*/cli-native.node'
,
]
)
;
assertCopilotPlatformPackageIncludes
(
,
'node_modules/@github/copilot-linuxmusl-x64'
,
[
'index.js'
,
'app.js'
,
'prebuilds/linuxmusl-x64/runtime.node'
,
]
)
;
assertCopilotStandaloneExecutableExcluded
(
,
'node_modules/@github/copilot-linuxmusl-x64'
)
;
assertCopilotOutOfProcessRuntimeExecutablesExcluded
(
,
'node_modules/@github/copilot-linuxmusl-x64'
)
;
assertOptionalCopilotNativeDependenciesExcluded
(
,
'node_modules/@github/copilot-linuxmusl-x64'
)
;
}
)
;
test
(
'uses the .exe package runtime for windows builds'
,
(
)
=>
{
.
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/prebuilds/*/copilot-runtime'
,
'!node_modules/@github/copilot-win32-x64/prebuilds/*/copilot-runtime-bin'
,
'!node_modules/@github/copilot-win32-x64/prebuilds/*/copilot-runtime.exe'
,
'!node_modules/@github/copilot-win32-x64/prebuilds/*/copilot-runtime-bin.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/**'
,
'!node_modules/@github/copilot-win32-x64/pvrecorder/**'
,
'!node_modules/@github/copilot-win32-x64/webview/**'
,
'!node_modules/@github/copilot-win32-x64/plugins/computer-use/**'
,
'!node_modules/@github/copilot-win32-x64/prebuilds/*/computer.node'
,
'!node_modules/@github/copilot-win32-x64/prebuilds/*/keytar.node'
,
'!node_modules/@github/copilot-win32-x64/prebuilds/*/mediaremote-adapter/**'
,
]
)
;
assertCopilotPlatformPackageIncludes
(
getCopilotRuntimePrebuildFiles
(
'win32'
,
'x64'
)
,
'node_modules/@github/copilot-win32-x64'
,
[
'index.js'
,
'app.js'
,
'prebuilds/win32-x64/cli-native.node'
,
'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'
,
]
)
;
assertCopilotStandaloneExecutableExcluded
(
getCopilotRuntimePrebuildFiles
(
'win32'
,
'x64'
)
,
'node_modules/@github/copilot-win32-x64'
)
;
assertCopilotOutOfProcessRuntimeExecutablesExcluded
(
getCopilotRuntimePrebuildFiles
(
'win32'
,
'x64'
)
,
'node_modules/@github/copilot-win32-x64'
)
;
.
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/prebuilds/*/copilot-runtime'
,
'!node_modules/@github/copilot-win32-arm64/prebuilds/*/copilot-runtime-bin'
,
'!node_modules/@github/copilot-win32-arm64/prebuilds/*/copilot-runtime.exe'
,
'!node_modules/@github/copilot-win32-arm64/prebuilds/*/copilot-runtime-bin.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/**'
,
'!node_modules/@github/copilot-win32-arm64/pvrecorder/**'
,
'!node_modules/@github/copilot-win32-arm64/webview/**'
,
'!node_modules/@github/copilot-win32-arm64/plugins/computer-use/**'
,
'!node_modules/@github/copilot-win32-arm64/prebuilds/*/computer.node'
,
'!node_modules/@github/copilot-win32-arm64/prebuilds/*/keytar.node'
,
'!node_modules/@github/copilot-win32-arm64/prebuilds/*/mediaremote-adapter/**'
,
]
)
;
assertOptionalCopilotNativeDependenciesExcluded
(
getCopilotRuntimePrebuildFiles
(
'win32'
,
'x64'
)
,
'node_modules/@github/copilot-win32-x64'
)
;
assertCopilotStandaloneExecutableExcluded
(
getCopilotRuntimePrebuildFiles
(
'win32'
,
'arm64'
)
,
'node_modules/@github/copilot-win32-arm64'
)
;
assertCopilotOutOfProcessRuntimeExecutablesExcluded
(
getCopilotRuntimePrebuildFiles
(
'win32'
,
'arm64'
)
,
'node_modules/@github/copilot-win32-arm64'
)
;
}
)
;
test
(
'keeps macOS runtime prebuilds in the selected platform package'
,
(
)
=>
{
const
=
getCopilotRuntimePrebuildFiles
(
'darwin'
,
'arm64'
)
;
assertCopilotPlatformPackageIncludes
(
,
'node_modules/@github/copilot-darwin-arm64'
,
[
'index.js'
,
'app.js'
,
'sdk/index.js'
,
'sea-loader.js'
,
'prebuilds/darwin-arm64/runtime.node'
,
'prebuilds/darwin-arm64/pty.node'
,
'prebuilds/darwin-arm64/spawn-helper'
,
]
)
;
assertCopilotStandaloneExecutableExcluded
(
,
'node_modules/@github/copilot-darwin-arm64'
)
;
assertCopilotOutOfProcessRuntimeExecutablesExcluded
(
,
'node_modules/@github/copilot-darwin-arm64'
)
;
assertOptionalCopilotNativeDependenciesExcluded
(
,
'node_modules/@github/copilot-darwin-arm64'
)
;
}
)
;
test
(
'materializes missing target platform packages from the lockfile'
,
(
)
=>
{
const
=
.
mkdtempSync
(
.
join
(
.
tmpdir
(
)
,
'vscode-copilot-platform-test-'
)
)
;
const
=
.
join
(
,
'node_modules'
)
;
try
{
.
mkdirSync
(
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'package-lock.json'
)
,
JSON
.
stringify
(
{
:
{
'node_modules/@github/copilot-darwin-x64'
:
{
:
'1.0.64-1'
,
}
}
}
)
)
;
ensureCopilotPlatformPackage
(
'darwin'
,
'x64'
,
,
{
packPackage
:
(
,
,
)
=>
{
const
=
.
join
(
,
'package'
)
;
.
mkdirSync
(
.
join
(
,
'prebuilds'
,
'darwin-x64'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'index.js'
)
,
''
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'darwin-x64'
,
'runtime.node'
)
,
''
)
;
const
=
.
join
(
,
'copilot-darwin-x64.tgz'
)
;
create
(
{
:
,
:
,
:
true
,
:
true
}
,
[
'package'
]
)
;
return
;
}
}
)
;
assert
(
.
existsSync
(
.
join
(
,
'@github'
,
'copilot-darwin-x64'
,
'index.js'
)
)
)
;
assert
(
.
existsSync
(
.
join
(
,
'@github'
,
'copilot-darwin-x64'
,
'prebuilds'
,
'darwin-x64'
,
'runtime.node'
)
)
)
;
}
finally
{
.
rmSync
(
,
{
:
true
,
:
true
}
)
;
}
}
)
;
test
(
'excludes standalone copilot executables from the platform package dependency stream'
,
(
)
=>
{
const
=
getCopilotExcludeFilter
(
'linux'
,
'x64'
)
;
assert
(
.
includes
(
'**'
)
)
;
assert
(
.
includes
(
'!**/node_modules/@github/copilot-*/copilot'
)
)
;
assert
(
.
includes
(
'!**/node_modules/@github/copilot-*/copilot.exe'
)
)
;
.
deepStrictEqual
(
.
filter
(
=>
.
includes
(
'/prebuilds/*/copilot-runtime'
)
)
,
[
'!**/node_modules/@github/copilot-*/prebuilds/*/copilot-runtime'
,
'!**/node_modules/@github/copilot-*/prebuilds/*/copilot-runtime-bin'
,
'!**/node_modules/@github/copilot-*/prebuilds/*/copilot-runtime.exe'
,
'!**/node_modules/@github/copilot-*/prebuilds/*/copilot-runtime-bin.exe'
,
]
)
;
}
)
;
test
(
'materializes target Copilot SDK prebuilds and tgrep for the built-in extension'
,
(
)
=>
{
const
=
.
mkdtempSync
(
.
join
(
.
tmpdir
(
)
,
'vscode-copilot-sdk-prebuild-test-'
)
)
;
try
{
const
=
.
join
(
,
'extensions'
,
'copilot'
)
;
const
=
.
join
(
,
'node_modules'
,
'@github'
,
'copilot'
)
;
const
=
.
join
(
,
'node_modules'
)
;
const
=
.
join
(
,
'@github'
,
'copilot-win32-x64'
)
;
.
mkdirSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'linux-x64'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'linux-x64'
,
'runtime.node'
)
,
''
)
;
.
writeFileSync
(
.
join
(
,
'package.json'
)
,
JSON
.
stringify
(
{
:
'1.0.73'
}
)
)
;
.
mkdirSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'conpty'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'package.json'
)
,
JSON
.
stringify
(
{
:
'1.0.73'
}
)
)
;
.
mkdirSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'mediaremote-adapter'
,
'MediaRemoteAdapter.framework'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'runtime.node'
)
,
''
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'copilot-runtime.exe'
)
,
''
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'copilot-runtime-bin.exe'
)
,
''
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'OneAuthInterop.dll'
)
,
''
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'conpty.node'
)
,
''
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'conpty'
,
'OpenConsole.exe'
)
,
''
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'mediaremote-adapter'
,
'mediaremote-adapter.pl'
)
,
''
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'mediaremote-adapter'
,
'MediaRemoteAdapter.framework'
,
'MediaRemoteAdapter'
)
,
''
)
;
.
mkdirSync
(
.
join
(
,
'tgrep'
,
'bin'
,
'win32-x64'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'tgrep'
,
'bin'
,
'win32-x64'
,
'tgrep.exe'
)
,
''
)
;
.
mkdirSync
(
.
join
(
,
'@vscode'
,
'ripgrep-universal'
,
'bin'
,
'win32-x64'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'@vscode'
,
'ripgrep-universal'
,
'bin'
,
'win32-x64'
,
'rg.exe'
)
,
''
)
;
prepareBuiltInCopilotRipgrepShim
(
'win32'
,
'x64'
,
,
)
;
assert
(
.
existsSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'win32-x64'
,
'runtime.node'
)
)
)
;
assert
(
!
.
existsSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'win32-x64'
,
'copilot-runtime.exe'
)
)
)
;
assert
(
!
.
existsSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'win32-x64'
,
'copilot-runtime-bin.exe'
)
)
)
;
assert
(
.
existsSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'win32-x64'
,
'OneAuthInterop.dll'
)
)
)
;
assert
(
.
existsSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'win32-x64'
,
'conpty.node'
)
)
)
;
assert
(
.
existsSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'win32-x64'
,
'conpty'
,
'OpenConsole.exe'
)
)
)
;
assert
(
!
.
existsSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'win32-x64'
,
'mediaremote-adapter'
)
)
)
;
assert
(
!
.
existsSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'linux-x64'
)
)
)
;
assert
(
.
existsSync
(
.
join
(
,
'tgrep'
,
'bin'
,
'win32-x64'
,
'tgrep.exe'
)
)
)
;
assert
(
.
existsSync
(
.
join
(
,
'sdk'
,
'tgrep'
,
'bin'
,
'win32-x64'
,
'tgrep.exe'
)
)
)
;
assert
(
.
existsSync
(
.
join
(
,
'sdk'
,
'ripgrep'
,
'bin'
,
'win32-x64'
,
'rg.exe'
)
)
)
;
}
finally
{
.
rmSync
(
,
{
:
true
,
:
true
}
)
;
}
}
)
;
test
(
'materializes a version-matched native when app-root diverges from the pinned extension'
,
(
)
=>
{
const
=
.
mkdtempSync
(
.
join
(
.
tmpdir
(
)
,
'vscode-copilot-sdk-pinned-test-'
)
)
;
try
{
const
=
.
join
(
,
'extensions'
,
'copilot'
)
;
const
=
.
join
(
,
'node_modules'
,
'@github'
,
'copilot'
)
;
const
=
.
join
(
,
'node_modules'
)
;
const
=
.
join
(
,
'@github'
,
'copilot-win32-x64'
)
;
.
mkdirSync
(
.
join
(
,
'sdk'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'package.json'
)
,
JSON
.
stringify
(
{
:
'1.0.73'
}
)
)
;
.
mkdirSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'package.json'
)
,
JSON
.
stringify
(
{
:
'9.9.9-canary'
}
)
)
;
.
writeFileSync
(
.
join
(
,
'prebuilds'
,
'win32-x64'
,
'runtime.node'
)
,
'CANARY-NATIVE'
)
;
.
mkdirSync
(
.
join
(
,
'tgrep'
,
'bin'
,
'win32-x64'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'tgrep'
,
'bin'
,
'win32-x64'
,
'tgrep.exe'
)
,
'CANARY-TGREP'
)
;
.
mkdirSync
(
.
join
(
,
'@vscode'
,
'ripgrep-universal'
,
'bin'
,
'win32-x64'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'@vscode'
,
'ripgrep-universal'
,
'bin'
,
'win32-x64'
,
'rg.exe'
)
,
''
)
;
const
{
,
}
=
createPinnedCopilotWin32Tarball
(
)
;
const
=
.
join
(
,
'package-lock.json'
)
;
.
writeFileSync
(
,
JSON
.
stringify
(
{
:
{
'node_modules/@github/copilot-win32-x64'
:
{
:
'1.0.73'
,
}
}
}
)
)
;
const
:
{
:
string
;
:
string
}
[
]
=
[
]
;
prepareBuiltInCopilotRipgrepShim
(
'win32'
,
'x64'
,
,
,
{
,
packPackage
:
(
,
)
=>
{
.
push
(
{
,
}
)
;
return
;
}
}
)
;
.
deepStrictEqual
(
,
[
{
:
'@github/copilot-win32-x64'
,
:
'1.0.73'
}
]
)
;
.
strictEqual
(
.
readFileSync
(
.
join
(
,
'sdk'
,
'prebuilds'
,
'win32-x64'
,
'runtime.node'
)
,
'utf8'
)
,
'EXT-NATIVE-1.0.73'
)
;
.
strictEqual
(
.
readFileSync
(
.
join
(
,
'sdk'
,
'tgrep'
,
'bin'
,
'win32-x64'
,
'tgrep.exe'
)
,
'utf8'
)
,
'EXT-TGREP-1.0.73'
)
;
}
finally
{
.
rmSync
(
,
{
:
true
,
:
true
}
)
;
}
}
)
;
test
(
'refuses to ship a fetched native that does not match the pinned extension lockfile integrity'
,
(
)
=>
{
const
=
.
mkdtempSync
(
.
join
(
.
tmpdir
(
)
,
'vscode-copilot-sdk-integrity-test-'
)
)
;
try
{
const
=
.
join
(
,
'extensions'
,
'copilot'
)
;
const
=
.
join
(
,
'node_modules'
,
'@github'
,
'copilot'
)
;
const
=
.
join
(
,
'node_modules'
)
;
.
mkdirSync
(
.
join
(
,
'sdk'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'package.json'
)
,
JSON
.
stringify
(
{
:
'1.0.73'
}
)
)
;
.
mkdirSync
(
.
join
(
,
'@vscode'
,
'ripgrep-universal'
,
'bin'
,
'win32-x64'
)
,
{
:
true
}
)
;
.
writeFileSync
(
.
join
(
,
'@vscode'
,
'ripgrep-universal'
,
'bin'
,
'win32-x64'
,
'rg.exe'
)
,
''
)
;
const
{
}
=
createPinnedCopilotWin32Tarball
(
)
;
const
=
.
join
(
,
'package-lock.json'
)
;
.
writeFileSync
(
,
JSON
.
stringify
(
{
:
{
'node_modules/@github/copilot-win32-x64'
:
{
:
'1.0.73'
,
:
` sha512- ${ 'A' . repeat ( 88 ) } `
}
}
}
)
)
;
.
throws
(
(
)
=>
prepareBuiltInCopilotRipgrepShim
(
'win32'
,
'x64'
,
,
,
{
,
packPackage
:
(
)
=>
}
)
,
/ integrity mismatch /
)
;
}
finally
{
.
rmSync
(
,
{
:
true
,
:
true
}
)
;
}
}
)
;
test
(
'strips all copilot platform packages for unsupported armhf builds'
,
(
)
=>
{
.
deepStrictEqual
(
getCopilotExcludeFilter
(
'linux'
,
'armhf'
)
,
[
'**'
,
...
.
map
(
=>
` !**/node_modules/@github/copilot- ${ platform} /** `
)
,
'!**/node_modules/@github/copilot-*/copilot'
,
'!**/node_modules/@github/copilot-*/copilot.exe'
,
'!**/node_modules/@github/copilot-*/prebuilds/*/copilot-runtime'
,
'!**/node_modules/@github/copilot-*/prebuilds/*/copilot-runtime-bin'
,
'!**/node_modules/@github/copilot-*/prebuilds/*/copilot-runtime.exe'
,
'!**/node_modules/@github/copilot-*/prebuilds/*/copilot-runtime-bin.exe'
,
]
)
;
}
)
;
test
(
'keeps only the target architecture of @microsoft/mxc-sdk'
,
(
)
=>
{
.
deepStrictEqual
(
getMxcExcludeFilter
(
'x64'
)
,
[
'**'
,
'!**/node_modules/@microsoft/mxc-sdk/bin/arm64/**'
,
]
)
;
.
deepStrictEqual
(
getMxcExcludeFilter
(
'arm64'
)
,
[
'**'
,
'!**/node_modules/@microsoft/mxc-sdk/bin/x64/**'
,
]
)
;
}
)
;
test
(
'strips every @microsoft/mxc-sdk architecture for unsupported armhf builds'
,
(
)
=>
{
.
deepStrictEqual
(
getMxcExcludeFilter
(
'armhf'
)
,
[
'**'
,
'!**/node_modules/@microsoft/mxc-sdk/bin/x64/**'
,
'!**/node_modules/@microsoft/mxc-sdk/bin/arm64/**'
,
]
)
;
}
)
;
}
)
;
function
assertCopilotPlatformPackageIncludes
(
:
string
[
]
,
:
string
,
:
string
[
]
)
:
void
{
assert
(
.
includes
(
` ${ packageDir} /** `
)
)
;
for
(
const
of
)
{
assert
(
matchesGlob
(
` ${ packageDir} / ${ relativeFile} `
,
)
,
)
;
}
}
function
assertCopilotStandaloneExecutableExcluded
(
:
string
[
]
,
:
string
)
:
void
{
for
(
const
of
[
'copilot'
,
'copilot.exe'
]
)
{
assert
(
.
includes
(
` ! ${ packageDir} / ${ executable} `
)
,
)
;
assert
(
!
matchesGlob
(
` ${ packageDir} / ${ executable} `
,
)
,
)
;
}
}
function
assertCopilotOutOfProcessRuntimeExecutablesExcluded
(
:
string
[
]
,
:
string
)
:
void
{
for
(
const
of
[
'copilot-runtime'
,
'copilot-runtime-bin'
,
'copilot-runtime.exe'
,
'copilot-runtime-bin.exe'
]
)
{
assert
(
.
includes
(
` ! ${ packageDir} /prebuilds/*/ ${ executable} `
)
,
)
;
assert
(
!
matchesGlob
(
` ${ packageDir} /prebuilds/test-platform/ ${ executable} `
,
)
,
)
;
}
}
function
assertOptionalCopilotNativeDependenciesExcluded
(
:
string
[
]
,
:
string
)
:
void
{
for
(
const
of
[
'clipboard'
,
'foundry-local-sdk'
,
'mxc-bin'
,
'pvrecorder'
,
'webview'
]
)
{
assert
(
.
includes
(
` ! ${ packageDir} / ${ dir} /** `
)
,
)
;
assert
(
!
matchesGlob
(
` ${ packageDir} / ${ dir} /index.js `
,
)
,
)
;
}
assert
(
.
includes
(
` ! ${ packageDir} /plugins/computer-use/** `
)
,
'plugins/computer-use'
)
;
assert
(
!
matchesGlob
(
` ${ packageDir} /plugins/computer-use/computer-use-mcp.exe `
,
)
,
'plugins/computer-use-mcp.exe'
)
;
assert
(
!
matchesGlob
(
` ${ packageDir} /plugins/computer-use/CopilotComputerUse.exe `
,
)
,
'plugins/CopilotComputerUse.exe'
)
;
assert
(
!
matchesGlob
(
` ${ packageDir} /plugins/computer-use/Copilot Computer Use.app/Contents/MacOS/Copilot Computer Use `
,
)
,
'plugins/Copilot Computer Use.app'
)
;
assert
(
.
includes
(
` ! ${ packageDir} /prebuilds/*/computer.node `
)
,
'computer.node'
)
;
assert
(
!
matchesGlob
(
` ${ packageDir} /prebuilds/linux-x64/computer.node `
,
)
,
'computer.node'
)
;
assert
(
.
includes
(
` ! ${ packageDir} /prebuilds/*/keytar.node `
)
,
'keytar.node'
)
;
assert
(
!
matchesGlob
(
` ${ packageDir} /prebuilds/linux-x64/keytar.node `
,
)
,
'keytar.node'
)
;
assert
(
.
includes
(
` ! ${ packageDir} /prebuilds/*/mediaremote-adapter/** `
)
,
'mediaremote-adapter'
)
;
assert
(
!
matchesGlob
(
` ${ packageDir} /prebuilds/darwin-arm64/mediaremote-adapter/MediaRemoteAdapter.framework/MediaRemoteAdapter `
,
)
,
'mediaremote-adapter'
)
;
if
(
!
.
includes
(
'win32'
)
)
{
assert
(
.
includes
(
` ! ${ packageDir} /prebuilds/*/cli-native.node `
)
,
'cli-native.node'
)
;
assert
(
!
matchesGlob
(
` ${ packageDir} /prebuilds/linux-x64/cli-native.node `
,
)
,
'cli-native.node'
)
;
}
}
function
matchesGlob
(
:
string
,
:
string
[
]
)
:
boolean
{
let
=
false
;
for
(
const
of
)
{
const
=
.
startsWith
(
'!'
)
;
const
=
?
.
slice
(
1
)
:
;
if
(
matchesPattern
(
,
)
)
{
=
!
;
}
}
return
;
}
function
matchesPattern
(
:
string
,
:
string
)
:
boolean
{
if
(
.
endsWith
(
'/**'
)
&&
!
.
slice
(
0
,
-
3
)
.
includes
(
'*'
)
)
{
return
.
startsWith
(
.
slice
(
0
,
-
2
)
)
;
}
if
(
.
includes
(
'*'
)
)
{
const
=
new
RegExp
(
` ^ ${ pattern. split ( '**' ) . map ( part => part. split ( '*' ) . map ( escapeRegExp) . join ( '[^/]+' ) ) . join ( '.*' ) } $ `
)
;
return
.
test
(
)
;
}
return
===
;
}
function
escapeRegExp
(
:
string
)
:
string
{
return
.
replace
(
/ [ \\ ^$.*+?()[\] {}|] / g
,
'\\$&'
)
;
}