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 / agentHostPromptRegistry.test.ts 434 строк · изменён 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
import assert from 'assert' ;
import type { SectionOverride, SystemMessageConfig, SystemMessageSection } from '@github/copilot-sdk' ;
import { CopilotCliConfigKey, copilotCliConfigSchema, normalizeModelFamilyAlias, resolveModelCapabilityOverrideField } from '../../common/copilotCliConfig.js' ;
import type { SchemaValues } from '../../common/agentHostSchema.js' ;
import type { ModelSelection } from '../../common/state/protocol/state.js' ;
import { AgentHostPromptRegistry, agentHostPromptRegistry, type IAgentHostPromptContext } from
BrowserChatToolReferenceName
ensureNoDisposablesAreLeakedInTestSuite
settings SchemaValues copilotCliConfigSchema definition tools workspaceless toolSearchActive IAgentHostPromptContext
toolNames tools
key settings key
name toolNames name
workspaceless
toolSearchActive
withUniversalAgentHostInstructions config SystemMessageConfig SystemMessageConfig
configWithToolInstructions config mode
config content
config
content configWithToolInstructions content
configWithToolInstructions mode configWithToolInstructions sections tool_instructions
configWithToolInstructions content
configWithToolInstructions
sections
configWithToolInstructions sections
tool_instructions action content satisfies SectionOverride
content
registry
assert registry
registry
assert registry id
registry
registry
familyPrefixes
assert
registry id
mode content
registry
registry
familyPrefixes
resolved registry
id
assert resolved mode
assert resolved content
registry
registry
familyPrefixes
Partial Record SystemMessageSection SectionOverride
guidelines action content
assert
registry id
mode
sections
identity sections identity
guidelines action content
registry
registry
familyPrefixes
Partial Record SystemMessageSection SectionOverride
identity action content
assert
registry id
mode sections identity action content
registry
registry
familyPrefixes
Partial Record SystemMessageSection SectionOverride
assert
registry id
registry
registry
familyPrefixes
model ModelSelection
model id
assert
registry id
mode content
registry
registry
familyPrefixes
_model ModelSelection ctx IAgentHostPromptContext Partial Record SystemMessageSection SectionOverride
ctx CopilotCliConfigKey Opus48Prompt tone action content
assert
registry id CopilotCliConfigKey Opus48Prompt
mode
sections
identity sections identity
tone action content
assert
registry id
opusModel ModelSelection id
enabled
agentHostPromptRegistry opusModel enabled CopilotCliConfigKey Opus48Prompt enabled
assert
assert
assert mode
overrides family
family overrides value value value
result agentHostPromptRegistry
id family id family
CopilotCliConfigKey Opus48Prompt
assert result mode
registry
assert
registry
mode
sections
sections
tool_instructions action content
content
registry
assert
registry
registry
registry
familyPrefixes
Partial Record SystemMessageSection SectionOverride
guidelines action content
assert
registry id
mode
sections
identity sections identity
guidelines action content
tool_instructions action content
content
registry
registry
familyPrefixes
assert
registry id
mode content
browserTools BrowserChatToolReferenceName OpenBrowserPage BrowserChatToolReferenceName ReadPage
registry
assert registry id
registry
assert
registry id CopilotCliConfigKey SubagentModelGuidance
registry id CopilotCliConfigKey SubagentModelGuidance
mode
sections
identity sections identity
tool_instructions action content
registry
assert
registry id browserTools
mode
sections
identity sections identity
tool_instructions action content
registry
registry
familyPrefixes
Partial Record SystemMessageSection SectionOverride
tool_instructions action content
assert
registry id browserTools
mode
sections
identity sections identity
tool_instructions action content
registry
registry
familyPrefixes
Partial Record SystemMessageSection SectionOverride
tool_instructions action content
assert
registry id
mode
sections
identity sections identity
tool_instructions action content
registry
registry
familyPrefixes
assert
registry id browserTools
mode content
registry
assert
registry id
mode
sections
identity sections identity
tool_instructions action content
registry
assert
registry id
registry
assert
registry id
registry
registry
familyPrefixes
Partial Record SystemMessageSection SectionOverride
tool_instructions action content
assert
registry id
mode
sections
identity sections identity
tool_instructions action content
'../../node/copilot/prompts/promptRegistry.js'
;
import
{
COPILOT_AGENT_HOST_FILE_LINK_INSTRUCTIONS
,
COPILOT_AGENT_HOST_WORKSPACELESS_INSTRUCTIONS
,
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
}
from
'../../node/copilot/prompts/systemMessage.js'
;
import
{
COPILOT_AGENT_HOST_LARGE_OUTPUT_TOOL_INSTRUCTION
,
COPILOT_AGENT_HOST_SUBAGENT_TOOL_INSTRUCTIONS
}
from
'../../node/copilot/prompts/toolInstructions.js'
;
import
{
}
from
'../../../browserView/common/browserChatToolReferenceNames.js'
;
import
{
CLIENT_TOOL_SEARCH_REFERENCE_NAME
}
from
'../../common/toolSearchConstants.js'
;
import
{
}
from
'../../../../base/test/common/utils.js'
;
import
'../../node/copilot/prompts/allPrompts.js'
;
function
context
(
:
<
typeof
.
>
=
{
}
,
:
readonly
string
[
]
=
[
]
,
=
false
,
=
false
)
:
{
const
=
new
Set
(
)
;
return
{
getSetting
:
=>
[
]
,
hasClientTool
:
=>
.
has
(
)
,
,
,
}
;
}
suite
(
'AgentHostPromptRegistry'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
LARGE_OUTPUT_LINE
=
COPILOT_AGENT_HOST_LARGE_OUTPUT_TOOL_INSTRUCTION
;
const
UNCONDITIONAL_TOOL_INSTRUCTIONS
=
LARGE_OUTPUT_LINE
;
const
=
(
:
)
:
=>
{
const
=
.
===
'replace'
?
{
...
,
:
` ${ config. content} \n\n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } `
}
:
;
const
=
.
?
` ${ configWithToolInstructions. content} \n\n ${ COPILOT_AGENT_HOST_FILE_LINK_INSTRUCTIONS } `
:
COPILOT_AGENT_HOST_FILE_LINK_INSTRUCTIONS
;
if
(
.
!==
'customize'
||
.
?.
)
{
return
{
...
,
}
;
}
return
{
...
,
:
{
...
.
,
:
{
:
'append'
,
:
` \n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } `
}
,
}
,
,
}
;
}
;
test
(
'falls back to the default system message when no model is provided'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
undefined
,
context
(
)
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
)
;
}
)
;
test
(
'falls back to the default when no contributor matches the model'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'unknown-model'
}
,
context
(
)
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
)
;
}
)
;
test
(
'a contributor can fully replace the system prompt (replace mode, universal appends survive)'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'gpt-5'
]
;
resolveFullSystemPrompt
(
)
:
string
{
return
'FULL PROMPT'
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'gpt-5-mini'
}
,
context
(
)
)
,
withUniversalAgentHostInstructions
(
{
:
'replace'
,
:
'FULL PROMPT'
}
)
)
;
}
)
;
test
(
'a replacement prompt retains active tool-search guidance'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'gpt-5'
]
;
resolveFullSystemPrompt
(
)
:
string
{
return
'FULL PROMPT'
;
}
}
)
;
const
=
.
resolveSystemMessageConfig
(
{
:
'gpt-5-mini'
}
,
context
(
{
}
,
[
CLIENT_TOOL_SEARCH_REFERENCE_NAME
]
,
false
,
true
)
)
;
.
strictEqual
(
.
,
'replace'
)
;
.
ok
(
.
.
includes
(
'Most tools are deferred and hidden until you search for them.'
)
)
;
}
)
;
test
(
'a contributor can override individual sections (customize mode, default identity composed underneath)'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'claude'
]
;
resolveSectionOverrides
(
)
:
<
<
,
>>
{
return
{
:
{
:
'append'
,
:
'Be concise.'
}
}
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'claude-sonnet'
}
,
context
(
)
)
,
withUniversalAgentHostInstructions
(
{
:
'customize'
,
:
{
:
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
.
.
,
:
{
:
'append'
,
:
'Be concise.'
}
,
}
,
}
)
)
;
}
)
;
test
(
'a contributor identity override wins over the composed default identity'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'claude'
]
;
resolveSectionOverrides
(
)
:
<
<
,
>>
{
return
{
:
{
:
'replace'
,
:
'CUSTOM IDENTITY'
}
}
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'claude-sonnet'
}
,
context
(
)
)
,
withUniversalAgentHostInstructions
(
{
:
'customize'
,
:
{
:
{
:
'replace'
,
:
'CUSTOM IDENTITY'
}
}
}
)
)
;
}
)
;
test
(
'treats empty section overrides as no override (falls back to default)'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'claude'
]
;
resolveSectionOverrides
(
)
:
<
<
,
>>
{
return
{
}
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'claude-sonnet'
}
,
context
(
)
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
)
;
}
)
;
test
(
'matchesModel takes precedence over family prefixes'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
:
readonly
string
[
]
=
[
]
;
static
matchesModel
(
:
)
:
boolean
{
return
.
.
includes
(
'codex'
)
;
}
resolveFullSystemPrompt
(
)
:
string
{
return
'CODEX'
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'gpt-5-codex'
}
,
context
(
)
)
,
withUniversalAgentHostInstructions
(
{
:
'replace'
,
:
'CODEX'
}
)
)
;
}
)
;
test
(
'contributors gate on the prompt context'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'claude'
]
;
resolveSectionOverrides
(
:
,
:
)
:
<
<
,
>>
|
undefined
{
return
.
getSetting
(
.
)
===
true
?
{
:
{
:
'append'
,
:
'GATED'
}
}
:
undefined
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'claude-x'
}
,
context
(
{
[
.
]
:
true
}
)
)
,
withUniversalAgentHostInstructions
(
{
:
'customize'
,
:
{
:
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
.
.
,
:
{
:
'append'
,
:
'GATED'
}
,
}
,
}
)
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'claude-x'
}
,
context
(
)
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
)
;
}
)
;
suite
(
'Opus contributor (registered via allPrompts)'
,
(
)
=>
{
const
:
=
{
:
'claude-opus-4-8'
}
;
function
resolveOpus
(
:
boolean
|
undefined
)
{
return
.
resolveSystemMessageConfig
(
,
context
(
===
undefined
?
{
}
:
{
[
.
]
:
}
)
)
;
}
test
(
'applies customize overrides only when enabled'
,
(
)
=>
{
.
deepStrictEqual
(
resolveOpus
(
undefined
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
)
;
.
deepStrictEqual
(
resolveOpus
(
false
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
)
;
.
strictEqual
(
resolveOpus
(
true
)
.
,
'customize'
)
;
}
)
;
}
)
;
suite
(
'model capability overrides (family alias)'
,
(
)
=>
{
test
(
'an aliased preview model routes to the family contributor'
,
(
)
=>
{
const
=
{
'preview-model-x'
:
{
:
'claude-opus-4.8'
}
}
;
const
=
resolveModelCapabilityOverrideField
(
,
'preview-model-x'
,
'family'
,
(
)
:
is
string
=>
normalizeModelFamilyAlias
(
)
!==
undefined
)
;
const
=
.
resolveSystemMessageConfig
(
{
:
'preview-model-x'
,
...
(
?
{
:
}
:
{
}
)
}
,
context
(
{
[
.
]
:
true
}
)
)
;
.
strictEqual
(
.
,
'customize'
)
;
}
)
;
}
)
;
suite
(
'workspace-less scratch/repoless wiring'
,
(
)
=>
{
test
(
'appends the scratch instructions to the default config for a workspace-less chat'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
undefined
,
context
(
{
}
,
[
]
,
true
)
)
,
{
:
'customize'
,
:
{
...
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
.
,
:
{
:
'append'
,
:
` \n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } `
}
,
}
,
:
` ${ COPILOT_AGENT_HOST_WORKSPACELESS_INSTRUCTIONS } \n\n ${ COPILOT_AGENT_HOST_FILE_LINK_INSTRUCTIONS } `
,
}
)
;
}
)
;
test
(
'is a no-op for a workspace-bound session'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
undefined
,
context
(
{
}
,
[
]
,
false
)
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
)
;
}
)
;
test
(
'composes with per-model customize content for a workspace-less chat'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'claude'
]
;
resolveSectionOverrides
(
)
:
<
<
,
>>
{
return
{
:
{
:
'append'
,
:
'Be concise.'
}
}
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'claude-sonnet'
}
,
context
(
{
}
,
[
]
,
true
)
)
,
{
:
'customize'
,
:
{
:
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
.
.
,
:
{
:
'append'
,
:
'Be concise.'
}
,
:
{
:
'append'
,
:
` \n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } `
}
,
}
,
:
` ${ COPILOT_AGENT_HOST_WORKSPACELESS_INSTRUCTIONS } \n\n ${ COPILOT_AGENT_HOST_FILE_LINK_INSTRUCTIONS } `
,
}
)
;
}
)
;
test
(
'appends scratch instructions after a full replace prompt'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'gpt-5'
]
;
resolveFullSystemPrompt
(
)
:
string
{
return
'FULL PROMPT'
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'gpt-5-mini'
}
,
context
(
{
}
,
[
]
,
true
)
)
,
{
:
'replace'
,
:
` FULL PROMPT\n\n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } \n\n ${ COPILOT_AGENT_HOST_WORKSPACELESS_INSTRUCTIONS } \n\n ${ COPILOT_AGENT_HOST_FILE_LINK_INSTRUCTIONS } `
}
)
;
}
)
;
}
)
;
suite
(
'universal tool instructions wiring'
,
(
)
=>
{
const
BROWSER_LINE
=
'Use the browser tools (openBrowserPage, readPage, etc.) when beneficial for front-end tasks, such as when visualizing or validating UI changes.'
;
const
=
[
.
,
.
]
;
test
(
'layers the unconditional tool instructions onto the default config'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'm'
}
,
context
(
{
}
,
[
'anyTool'
]
)
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
)
;
}
)
;
test
(
'layers the subagent model guidance only when its setting is enabled'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
deepStrictEqual
(
[
.
resolveSystemMessageConfig
(
{
:
'm'
}
,
context
(
{
[
.
]
:
true
}
)
)
,
.
resolveSystemMessageConfig
(
{
:
'm'
}
,
context
(
{
[
.
]
:
false
}
)
)
,
]
,
[
withUniversalAgentHostInstructions
(
{
:
'customize'
,
:
{
:
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
.
.
,
:
{
:
'append'
,
:
` \n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } \n ${ COPILOT_AGENT_HOST_SUBAGENT_TOOL_INSTRUCTIONS } `
}
,
}
,
}
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
,
]
)
;
}
)
;
test
(
'layers the browser tool_instructions onto the default config when browser tools are present'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'm'
}
,
context
(
{
}
,
)
)
,
withUniversalAgentHostInstructions
(
{
:
'customize'
,
:
{
:
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
.
.
,
:
{
:
'append'
,
:
` \n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } \n ${ BROWSER_LINE } `
}
,
}
,
}
)
)
;
}
)
;
test
(
'composes the browser line with a per-model tool_instructions override'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'claude'
]
;
resolveSectionOverrides
(
)
:
<
<
,
>>
{
return
{
:
{
:
'append'
,
:
'Always prefer ripgrep.'
}
}
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'claude-x'
}
,
context
(
{
}
,
)
)
,
withUniversalAgentHostInstructions
(
{
:
'customize'
,
:
{
:
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
.
.
,
:
{
:
'append'
,
:
` \nAlways prefer ripgrep.\n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } \n ${ BROWSER_LINE } `
}
,
}
,
}
)
)
;
}
)
;
test
(
'composes the unconditional tool instructions with a per-model override'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'claude'
]
;
resolveSectionOverrides
(
)
:
<
<
,
>>
{
return
{
:
{
:
'append'
,
:
'Always prefer ripgrep.'
}
}
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'claude-x'
}
,
context
(
{
}
,
[
'anyTool'
]
)
)
,
withUniversalAgentHostInstructions
(
{
:
'customize'
,
:
{
:
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
.
.
,
:
{
:
'append'
,
:
` \nAlways prefer ripgrep.\n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } `
}
,
}
,
}
)
)
;
}
)
;
test
(
'appends the browser line after a full replace prompt'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'gpt-5'
]
;
resolveFullSystemPrompt
(
)
:
string
{
return
'FULL PROMPT'
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'gpt-5-mini'
}
,
context
(
{
}
,
)
)
,
{
:
'replace'
,
:
` FULL PROMPT\n\n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } \n ${ BROWSER_LINE } \n\n ${ COPILOT_AGENT_HOST_FILE_LINK_INSTRUCTIONS } `
}
)
;
}
)
;
}
)
;
suite
(
'tool search instructions wiring'
,
(
)
=>
{
const
TOOL_SEARCH_LINE
=
` Most tools are deferred and hidden until you search for them. Before calling a tool that has not already been loaded, ALWAYS use tool search first with a short description of the capability you need, then call the specific tool it returns; tools it returns are immediately available and must not be searched for again. `
;
test
(
'layers the tool-search line onto the default config when active and the tool-search tool is present'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'm'
}
,
context
(
{
}
,
[
CLIENT_TOOL_SEARCH_REFERENCE_NAME
]
,
false
,
true
)
)
,
withUniversalAgentHostInstructions
(
{
:
'customize'
,
:
{
:
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
.
.
,
:
{
:
'append'
,
:
` \n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } \n ${ TOOL_SEARCH_LINE } `
}
,
}
,
}
)
)
;
}
)
;
test
(
'does not add the tool-search instruction when tool search is inactive'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'm'
}
,
context
(
{
}
,
[
CLIENT_TOOL_SEARCH_REFERENCE_NAME
]
,
false
,
false
)
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
)
;
}
)
;
test
(
'does not add the tool-search instruction when the client tool is unavailable'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'm'
}
,
context
(
{
}
,
[
'anyTool'
]
,
false
,
true
)
)
,
withUniversalAgentHostInstructions
(
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
)
)
;
}
)
;
test
(
'composes the tool-search line with a per-model tool_instructions override'
,
(
)
=>
{
const
=
new
AgentHostPromptRegistry
(
)
;
.
registerPrompt
(
class
{
static
readonly
=
[
'claude'
]
;
resolveSectionOverrides
(
)
:
<
<
,
>>
{
return
{
:
{
:
'append'
,
:
'Always prefer ripgrep.'
}
}
;
}
}
)
;
.
deepStrictEqual
(
.
resolveSystemMessageConfig
(
{
:
'claude-x'
}
,
context
(
{
}
,
[
CLIENT_TOOL_SEARCH_REFERENCE_NAME
]
,
false
,
true
)
)
,
withUniversalAgentHostInstructions
(
{
:
'customize'
,
:
{
:
COPILOT_AGENT_HOST_SYSTEM_MESSAGE
.
.
,
:
{
:
'append'
,
:
` \nAlways prefer ripgrep.\n ${ UNCONDITIONAL_TOOL_INSTRUCTIONS } \n ${ TOOL_SEARCH_LINE } `
}
,
}
,
}
)
)
;
}
)
;
}
)
;
}
)
;