ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / platform / agentHost / test / node / claudeSdkOptions.test.ts 450 строк · изменён 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
import assert from 'assert' ;
import { URI } from '../../../../base/common/uri.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js' ;
import { buildClaudeTelemetryEnv, buildOptions, buildSubprocessEnv, toClaudeMcpServers } from '../../node/claude/claudeSdkOptions.js' ;
import type { ClaudeTransport, IClaudeProxyHandle } from '../../node/claude/claudeProxyService.js' ;
import { McpServerType } from '../../../mcp/common/mcpPlatformTypes.js' ;
import { CustomizationType, McpServerStatus,
IMcpServerDefinition
process env
values Record
key process env key
key value Object values process env key value
key process env key
key value Object
value process env key value
env
assert
runAsNode env
nodeOptions env
anthropicKey env
vscodePid env
vscodeNls env
electronOther env
path env
home env
userProfile env
aiAgent env
runAsNode
nodeOptions
anthropicKey
vscodePid
vscodeNls
electronOther
path
home
userProfile
aiAgent
env
traces endpoint protocol
external endpoint protocol headers authorization
captureContent
resourceAttributes region
traceId
spanId
traceparent
assert env
env
traces endpoint protocol
external endpoint protocol
captureContent
resourceAttributes
assert
trace env
logs env
metrics env
trace
logs
metrics
env
assert env
env
assert
anthropicKey env
oauthToken env
path env
home env
vscodePid env
electronOther env
nodeOptions env
runAsNode env
aiAgent env
anthropicKey
oauthToken
path
home
vscodePid
electronOther
nodeOptions
runAsNode
aiAgent
customization McpServerCustomization
type CustomizationType McpServer
id
uri
name
state kind McpServerStatus Stopped
definition name defaultCwd remote IMcpServerDefinition
name
defaultCwd
uri
configuration remote
type McpServerType url
type McpServerType command name
customization customization name
primary
remotePrimary
relativePrimary
primary
configuration type McpServerType command cwd
satisfies IMcpServerDefinition
normalizedPrimary
primary
configuration type McpServerType command cwd
satisfies IMcpServerDefinition
result
primary
remotePrimary
relativePrimary
normalizedPrimary
configuration type McpServerType transport url
primary
assert Object result servers
assert result servers sse type
assert result skipped
proxyHandle IClaudeProxyHandle
baseUrl
nonce
proxyTransport ClaudeTransport kind handle proxyHandle
pluginUris
sessionId
workingDirectory
model
abortController
permissionMode
behavior updatedInput
action
isResume
mcpServers
pluginUris plugins pluginUris uri uri skipMcpDiscovery
opts
proxyTransport
assert opts plugins
type path fsPath skipMcpDiscovery
type path fsPath skipMcpDiscovery
opts proxyTransport
assert opts plugins
opts proxyTransport
assert opts plugins
opts
deniedMcpServers
serverCommand
serverUrl
proxyTransport
assert opts settings opts settings deniedMcpServers
serverCommand
serverUrl
opts
proxyTransport
hook opts hooks UserPromptSubmit hooks
result hook
hook_event_name
prompt
session_id
transcript_path
cwd
signal signal
assert result
hookSpecificOutput
hookEventName
additionalContext
opts proxyTransport
env opts settings env Record env
assert
baseUrl env
authToken env
nonessential env
aiAgent env
baseUrl
authToken
nonessential
aiAgent
opts kind
env opts settings env Record env
assert
baseUrl env
authToken env
nonessential env
baseUrl
authToken
nonessential
proxyHandle IClaudeProxyHandle
baseUrl
nonce
proxyTransport ClaudeTransport kind handle proxyHandle
isResume resumeSessionAt
sessionId
workingDirectory
model
abortController
permissionMode
behavior updatedInput
action
isResume
mcpServers
resumeSessionAt resumeSessionAt
opts proxyTransport
assert
resume opts resume sessionId opts sessionId resumeSessionAt opts resumeSessionAt
resume sessionId resumeSessionAt
opts proxyTransport
assert
resume opts resume resumeSessionAt opts resumeSessionAt
resume resumeSessionAt
opts proxyTransport
assert
sessionId opts sessionId resume opts resume resumeSessionAt opts resumeSessionAt
sessionId resume resumeSessionAt
proxyHandle IClaudeProxyHandle
baseUrl
nonce
proxyTransport ClaudeTransport kind handle proxyHandle
additionalDirectories
sessionId
workingDirectory
model
abortController
permissionMode
behavior updatedInput
action
isResume
mcpServers
additionalDirectories additionalDirectories
opts proxyTransport
assert
cwd opts cwd additionalDirectories opts additionalDirectories
cwd fsPath additionalDirectories fsPath fsPath
opts proxyTransport
assert
cwd opts cwd additionalDirectories opts additionalDirectories
cwd fsPath additionalDirectories
opts proxyTransport
assert opts additionalDirectories
type
McpServerCustomization
}
from
'../../common/state/protocol/state.js'
;
import
type
{
}
from
'../../../agentPlugins/common/pluginParsers.js'
;
suite
(
'claudeSdkOptions / buildSubprocessEnv'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
SAVED_ENV
=
{
...
.
}
;
const
KNOWN_KEYS
=
[
'ELECTRON_RUN_AS_NODE'
,
'NODE_OPTIONS'
,
'ANTHROPIC_API_KEY'
,
'VSCODE_PID'
,
'VSCODE_NLS_CONFIG'
,
'ELECTRON_NO_ATTACH_CONSOLE'
,
'PATH'
,
'HOME'
,
'USERPROFILE'
,
]
;
function
clearAndSet
(
:
<
string
,
string
>
)
:
void
{
for
(
const
of
KNOWN_KEYS
)
{
delete
.
[
]
;
}
for
(
const
[
,
]
of
.
entries
(
)
)
{
.
[
]
=
;
}
}
teardown
(
(
)
=>
{
for
(
const
of
KNOWN_KEYS
)
{
delete
.
[
]
;
}
for
(
const
[
,
]
of
.
entries
(
SAVED_ENV
)
)
{
if
(
!==
undefined
)
{
.
[
]
=
;
}
}
}
)
;
test
(
'strips unsafe variables and forwards home paths in proxy mode'
,
(
)
=>
{
clearAndSet
(
{
VSCODE_PID
:
'1234'
,
VSCODE_NLS_CONFIG
:
'{}'
,
ELECTRON_NO_ATTACH_CONSOLE
:
'1'
,
NODE_OPTIONS
:
'--inspect'
,
ANTHROPIC_API_KEY
:
'sk-leak'
,
PATH
:
'/usr/bin'
,
HOME
:
'/Users/test'
,
USERPROFILE
:
'C:\\Users\\test'
,
}
)
;
const
=
buildSubprocessEnv
(
)
;
.
deepStrictEqual
(
{
:
.
ELECTRON_RUN_AS_NODE
,
:
.
NODE_OPTIONS
,
:
.
ANTHROPIC_API_KEY
,
:
.
VSCODE_PID
,
:
.
VSCODE_NLS_CONFIG
,
:
.
ELECTRON_NO_ATTACH_CONSOLE
,
:
.
PATH
,
:
.
HOME
,
:
.
USERPROFILE
,
:
.
AI_AGENT
,
}
,
{
:
'1'
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
:
'/Users/test'
,
:
'C:\\Users\\test'
,
:
'github_copilot_vscode_agent'
,
}
)
;
}
)
;
test
(
'maps Agent Host traces to loopback and logs/metrics to the external sink'
,
(
)
=>
{
const
=
buildClaudeTelemetryEnv
(
{
:
{
:
'http://127.0.0.1:4567/v1/traces'
,
:
'http/json'
}
,
:
{
:
'http://collector:4318'
,
:
'http/protobuf'
,
:
{
:
'Bearer test/token'
}
}
,
:
false
,
:
{
'service.namespace'
:
'vscode.agent-host'
,
:
'west us'
}
,
}
,
{
:
'1'
.
repeat
(
32
)
,
:
'2'
.
repeat
(
16
)
,
:
` 00- ${ '1' . repeat ( 32 ) } - ${ '2' . repeat ( 16 ) } -01 `
,
}
)
;
.
deepStrictEqual
(
,
{
CLAUDE_CODE_ENABLE_TELEMETRY
:
'1'
,
OTEL_SERVICE_NAME
:
'claude-code'
,
OTEL_RESOURCE_ATTRIBUTES
:
'service.namespace=vscode.agent-host,region=west%20us'
,
CLAUDE_CODE_ENHANCED_TELEMETRY_BETA
:
'1'
,
OTEL_TRACES_EXPORTER
:
'otlp'
,
OTEL_LOGS_EXPORTER
:
'otlp'
,
OTEL_METRICS_EXPORTER
:
'otlp'
,
OTEL_LOG_USER_PROMPTS
:
'0'
,
OTEL_LOG_ASSISTANT_RESPONSES
:
'0'
,
OTEL_LOG_TOOL_DETAILS
:
'0'
,
OTEL_LOG_TOOL_CONTENT
:
'0'
,
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
:
'http://127.0.0.1:4567/v1/traces'
,
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
:
'http/json'
,
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
:
'http://collector:4318/v1/logs'
,
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL
:
'http/protobuf'
,
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
:
'http://collector:4318/v1/metrics'
,
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL
:
'http/protobuf'
,
OTEL_EXPORTER_OTLP_HEADERS
:
'authorization=Bearer%20test%2Ftoken'
,
TRACEPARENT
:
` 00- ${ '1' . repeat ( 32 ) } - ${ '2' . repeat ( 16 ) } -01 `
,
}
)
;
}
)
;
test
(
'keeps gRPC signal endpoints unchanged'
,
(
)
=>
{
const
=
buildClaudeTelemetryEnv
(
{
:
{
:
'https://collector:4317'
,
:
'grpc'
}
,
:
{
:
'https://collector:4317'
,
:
'grpc'
}
,
:
false
,
:
{
}
,
}
)
;
.
deepStrictEqual
(
{
:
.
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
,
:
.
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
,
:
.
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
,
}
,
{
:
'https://collector:4317'
,
:
'https://collector:4317'
,
:
'https://collector:4317'
,
}
)
;
}
)
;
test
(
'always sets ELECTRON_RUN_AS_NODE=1 even when not present in process.env'
,
(
)
=>
{
clearAndSet
(
{
}
)
;
const
=
buildSubprocessEnv
(
)
;
.
strictEqual
(
.
ELECTRON_RUN_AS_NODE
,
'1'
)
;
}
)
;
test
(
'native mode (proxied=false) inherits auth vars + PATH (SDK replace semantics) while still stripping VSCODE_*/ELECTRON_*/NODE_OPTIONS'
,
(
)
=>
{
clearAndSet
(
{
VSCODE_PID
:
'1234'
,
ELECTRON_NO_ATTACH_CONSOLE
:
'1'
,
NODE_OPTIONS
:
'--inspect'
,
ANTHROPIC_API_KEY
:
'sk-user-key'
,
CLAUDE_CODE_OAUTH_TOKEN
:
'sk-ant-oat-user'
,
PATH
:
'/usr/bin'
,
HOME
:
'/Users/test'
,
}
)
;
const
=
buildSubprocessEnv
(
false
)
;
.
deepStrictEqual
(
{
:
.
ANTHROPIC_API_KEY
,
:
.
CLAUDE_CODE_OAUTH_TOKEN
,
:
.
PATH
,
:
.
HOME
,
:
.
VSCODE_PID
,
:
.
ELECTRON_NO_ATTACH_CONSOLE
,
:
.
NODE_OPTIONS
,
:
.
ELECTRON_RUN_AS_NODE
,
:
.
AI_AGENT
,
}
,
{
:
'sk-user-key'
,
:
'sk-ant-oat-user'
,
:
'/usr/bin'
,
:
'/Users/test'
,
:
undefined
,
:
undefined
,
:
undefined
,
:
'1'
,
:
'github_copilot_vscode_agent'
,
}
)
;
}
)
;
}
)
;
suite
(
'claudeSdkOptions / MCP server projection'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
:
=
{
:
.
,
:
'mcp'
,
:
'file:///mcp'
,
:
'mcp'
,
:
{
:
.
}
,
}
;
const
=
(
:
string
,
:
URI
,
=
false
)
:
=>
(
{
,
,
:
URI
.
file
(
'/mcp.json'
)
,
:
?
{
:
.
REMOTE
,
:
'https://example.com/mcp'
}
:
{
:
.
LOCAL
,
:
}
,
:
{
...
,
}
,
}
)
;
test
(
'keeps primary stdio and all remote servers while skipping additional-root stdio'
,
(
)
=>
{
const
=
URI
.
file
(
'/primary'
)
;
const
=
URI
.
parse
(
'vscode-remote://ssh-remote+linux/primary'
)
;
const
=
{
...
definition
(
'relative-primary'
,
)
,
:
{
:
.
LOCAL
,
:
'relative-primary'
,
:
'.'
}
,
}
;
const
=
{
...
definition
(
'normalized-primary'
,
)
,
:
{
:
.
LOCAL
,
:
'normalized-primary'
,
:
` ${ primary. fsPath} /child/.. `
}
,
}
;
const
=
toClaudeMcpServers
(
[
definition
(
'primary'
,
)
,
definition
(
'remote-primary'
,
)
,
,
,
definition
(
'additional'
,
URI
.
file
(
'/additional'
)
)
,
definition
(
'remote'
,
URI
.
file
(
'/additional'
)
,
true
)
,
{
...
definition
(
'sse'
,
URI
.
file
(
'/additional'
)
,
true
)
,
:
{
:
.
REMOTE
,
:
'sse'
,
:
'https://example.com/sse'
}
,
}
,
]
,
)
;
.
deepStrictEqual
(
.
keys
(
.
)
,
[
'primary'
,
'remote-primary'
,
'relative-primary'
,
'normalized-primary'
,
'remote'
,
'sse'
]
)
;
.
strictEqual
(
.
.
.
,
'sse'
)
;
.
deepStrictEqual
(
.
,
[
'additional'
]
)
;
}
)
;
}
)
;
suite
(
'claudeSdkOptions / buildOptions plugins projection'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
:
=
{
:
'http://127.0.0.1:0'
,
:
'n'
,
dispose
:
(
)
=>
{
}
,
}
;
const
:
=
{
:
'proxy'
,
:
}
;
function
input
(
:
readonly
URI
[
]
|
undefined
)
{
return
{
:
's1'
,
:
URI
.
file
(
'/tmp/x'
)
,
:
undefined
,
:
new
AbortController
(
)
,
:
'default'
as
const
,
canUseTool
:
async
(
)
=>
(
{
:
'allow'
as
const
,
:
{
}
}
)
,
onElicitation
:
async
(
)
=>
(
{
:
'cancel'
as
const
}
)
,
:
false
,
:
undefined
,
...
(
!==
undefined
?
{
:
.
map
(
=>
(
{
,
:
true
}
)
)
}
:
{
}
)
,
}
;
}
test
(
'non-empty plugins project without duplicate SDK MCP discovery'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
[
URI
.
file
(
'/p/a'
)
,
URI
.
file
(
'/p/b'
)
]
)
,
,
(
)
=>
{
}
,
)
;
.
deepStrictEqual
(
.
,
[
{
:
'local'
,
:
URI
.
file
(
'/p/a'
)
.
,
:
true
}
,
{
:
'local'
,
:
URI
.
file
(
'/p/b'
)
.
,
:
true
}
,
]
)
;
}
)
;
test
(
'empty plugins array omits Options.plugins'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
[
]
)
,
,
(
)
=>
{
}
)
;
.
strictEqual
(
.
,
undefined
)
;
}
)
;
test
(
'undefined plugins omits Options.plugins'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
undefined
)
,
,
(
)
=>
{
}
)
;
.
strictEqual
(
.
,
undefined
)
;
}
)
;
test
(
'projects denied workspace MCP servers into startup settings'
,
async
(
)
=>
{
const
=
await
buildOptions
(
{
...
input
(
undefined
)
,
:
[
{
:
[
'node'
,
'server.js'
]
}
,
{
:
'https://disabled.example.com/mcp'
}
,
]
,
}
,
,
(
)
=>
{
}
)
;
.
deepStrictEqual
(
typeof
.
===
'string'
?
undefined
:
.
?.
,
[
{
:
[
'node'
,
'server.js'
]
}
,
{
:
'https://disabled.example.com/mcp'
}
,
]
)
;
}
)
;
test
(
'UserPromptSubmit adds transient host context'
,
async
(
)
=>
{
const
=
await
buildOptions
(
{
...
input
(
undefined
)
,
getUserPromptAdditionalContext
:
(
)
=>
'Rename with exact casing'
,
}
,
,
(
)
=>
{
}
)
;
const
=
.
?.
?.
[
0
]
.
[
0
]
;
const
=
await
?.
(
{
:
'UserPromptSubmit'
,
:
'Keep GitHub casing'
,
:
's1'
,
:
'/tmp/transcript'
,
:
'/tmp/x'
,
}
,
undefined
,
{
:
new
AbortController
(
)
.
}
)
;
.
deepStrictEqual
(
,
{
:
{
:
'UserPromptSubmit'
,
:
'Rename with exact casing'
,
}
,
}
)
;
}
)
;
test
(
'proxy transport sets ANTHROPIC_BASE_URL + per-session ANTHROPIC_AUTH_TOKEN'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
undefined
)
,
,
(
)
=>
{
}
)
;
const
=
(
.
as
{
?
:
<
string
,
string
>
}
)
.
??
{
}
;
.
deepStrictEqual
(
{
:
.
ANTHROPIC_BASE_URL
,
:
.
ANTHROPIC_AUTH_TOKEN
,
:
.
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
,
:
.
AI_AGENT
,
}
,
{
:
'http://127.0.0.1:0'
,
:
'n.s1'
,
:
'1'
,
:
'github_copilot_vscode_agent'
,
}
)
;
}
)
;
test
(
'native transport omits ANTHROPIC_BASE_URL/ANTHROPIC_AUTH_TOKEN (subprocess env carries the user credentials)'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
undefined
)
,
{
:
'native'
}
,
(
)
=>
{
}
)
;
const
=
(
.
as
{
?
:
<
string
,
string
>
}
)
.
??
{
}
;
.
deepStrictEqual
(
{
:
.
ANTHROPIC_BASE_URL
,
:
.
ANTHROPIC_AUTH_TOKEN
,
:
.
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
,
}
,
{
:
undefined
,
:
undefined
,
:
'1'
,
}
)
;
}
)
;
}
)
;
suite
(
'claudeSdkOptions / buildOptions resumeSessionAt projection'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
:
=
{
:
'http://127.0.0.1:0'
,
:
'n'
,
dispose
:
(
)
=>
{
}
,
}
;
const
:
=
{
:
'proxy'
,
:
}
;
function
input
(
:
boolean
,
:
string
|
undefined
)
{
return
{
:
's1'
,
:
URI
.
file
(
'/tmp/x'
)
,
:
undefined
,
:
new
AbortController
(
)
,
:
'default'
as
const
,
canUseTool
:
async
(
)
=>
(
{
:
'allow'
as
const
,
:
{
}
}
)
,
onElicitation
:
async
(
)
=>
(
{
:
'cancel'
as
const
}
)
,
,
:
undefined
,
...
(
!==
undefined
?
{
}
:
{
}
)
,
}
;
}
test
(
'resume + resumeSessionAt projects onto Options.resume and Options.resumeSessionAt'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
true
,
'anchor-uuid'
)
,
,
(
)
=>
{
}
)
;
.
deepStrictEqual
(
{
:
.
,
:
.
,
:
.
}
,
{
:
's1'
,
:
undefined
,
:
'anchor-uuid'
}
,
)
;
}
)
;
test
(
'resume without resumeSessionAt omits Options.resumeSessionAt'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
true
,
undefined
)
,
,
(
)
=>
{
}
)
;
.
deepStrictEqual
(
{
:
.
,
:
.
}
,
{
:
's1'
,
:
undefined
}
,
)
;
}
)
;
test
(
'non-resume startup never carries resumeSessionAt even when provided'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
false
,
'anchor-uuid'
)
,
,
(
)
=>
{
}
)
;
.
deepStrictEqual
(
{
:
.
,
:
.
,
:
.
}
,
{
:
's1'
,
:
undefined
,
:
undefined
}
,
)
;
}
)
;
}
)
;
suite
(
'claudeSdkOptions / buildOptions additionalDirectories projection'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
:
=
{
:
'http://127.0.0.1:0'
,
:
'n'
,
dispose
:
(
)
=>
{
}
,
}
;
const
:
=
{
:
'proxy'
,
:
}
;
function
input
(
:
readonly
URI
[
]
|
undefined
)
{
return
{
:
's1'
,
:
URI
.
file
(
'/tmp/primary'
)
,
:
undefined
,
:
new
AbortController
(
)
,
:
'default'
as
const
,
canUseTool
:
async
(
)
=>
(
{
:
'allow'
as
const
,
:
{
}
}
)
,
onElicitation
:
async
(
)
=>
(
{
:
'cancel'
as
const
}
)
,
:
false
,
:
undefined
,
...
(
!==
undefined
?
{
}
:
{
}
)
,
}
;
}
test
(
'projects cwd from the primary and additionalDirectories from the tail'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
[
URI
.
file
(
'/tmp/b'
)
,
URI
.
file
(
'/tmp/c'
)
]
)
,
,
(
)
=>
{
}
)
;
.
deepStrictEqual
(
{
:
.
,
:
.
}
,
{
:
URI
.
file
(
'/tmp/primary'
)
.
,
:
[
URI
.
file
(
'/tmp/b'
)
.
,
URI
.
file
(
'/tmp/c'
)
.
]
}
,
)
;
}
)
;
test
(
'empty additionalDirectories omits Options.additionalDirectories'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
[
]
)
,
,
(
)
=>
{
}
)
;
.
deepStrictEqual
(
{
:
.
,
:
.
}
,
{
:
URI
.
file
(
'/tmp/primary'
)
.
,
:
undefined
}
,
)
;
}
)
;
test
(
'undefined additionalDirectories omits Options.additionalDirectories'
,
async
(
)
=>
{
const
=
await
buildOptions
(
input
(
undefined
)
,
,
(
)
=>
{
}
)
;
.
strictEqual
(
.
,
undefined
)
;
}
)
;
}
)
;