Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
// Set up testing services with a mock extension context that has globalStorageUri
const
=
createExtensionUnitTestingServices
(
)
;
const
=
.
join
(
.
tmpdir
(
)
,
'plan-agent-test-'
+
.
now
(
)
)
;
.
define
(
,
new
SyncDescriptor
(
,
[
]
)
)
;
=
.
createTestingAccessor
(
)
;
.
add
(
)
;
=
.
get
(
)
;
=
.
get
(
)
as
;
=
.
get
(
)
;
}
)
;
afterEach
(
(
)
=>
{
.
dispose
(
)
;
}
)
;
function
createProvider
(
)
{
const
=
.
createInstance
(
)
;
.
add
(
)
;
return
;
}
async
function
getAgentContent
(
:
.
)
:
Promise
<
string
>
{
const
=
await
.
readFile
(
.
)
;
return
new
TextDecoder
(
)
.
decode
(
)
;
}
test
(
'provideCustomAgents() returns a Plan agent with correct structure'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
.
ok
(
[
0
]
.
,
'Agent should have a URI'
)
;
.
ok
(
[
0
]
.
.
.
endsWith
(
'.agent.md'
)
,
'Agent URI should end with .agent.md'
)
;
}
)
;
test
(
'returns agent content with base frontmatter when no settings configured'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should contain base tools
.
ok
(
.
includes
(
'github/issue_read'
)
)
;
.
ok
(
.
includes
(
'agent'
)
)
;
.
ok
(
.
includes
(
'search'
)
)
;
.
ok
(
.
includes
(
'read'
)
)
;
.
ok
(
.
includes
(
'memory'
)
)
;
// Should not have model override (not in base content)
.
ok
(
.
includes
(
'name: Plan'
)
)
;
.
ok
(
.
includes
(
'description: Researches and outlines multi-step plans'
)
)
;
}
)
;
test
(
'merges additionalTools setting with base tools'
,
async
(
)
=>
{
await
.
setConfig
(
.
,
[
'customTool1'
,
'customTool2'
]
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should contain base tools
.
ok
(
.
includes
(
'github/issue_read'
)
)
;
.
ok
(
.
includes
(
'agent'
)
)
;
// Should contain additional tools
.
ok
(
.
includes
(
'customTool1'
)
)
;
.
ok
(
.
includes
(
'customTool2'
)
)
;
}
)
;
test
(
'deduplicates tools when additionalTools overlaps with base tools'
,
async
(
)
=>
{
// Add a tool that already exists in base
await
.
setConfig
(
.
,
[
'agent'
,
'newTool'
]
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Count occurrences of 'agent' in tools list (flow-style array)
// Should appear only once due to deduplication
const
=
.
match
(
/tools: \[([^\]]+)\]/
)
;
.
ok
(
,
'Tools list not found in agent content'
)
;
const
=
[
1
]
;
const
=
(
.
match
(
/'agent'/g
)
||
[
]
)
.
;
.
equal
(
,
1
,
'agent tool should appear only once after deduplication'
)
;
// Should contain new tool
.
ok
(
.
includes
(
'newTool'
)
)
;
}
)
;
test
(
'applies model override from settings'
,
async
(
)
=>
{
await
.
setConfig
(
.
.
,
'Claude Haiku 4.5 (copilot)'
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should contain model override
.
ok
(
.
includes
(
'model: Claude Haiku 4.5 (copilot)'
)
)
;
}
)
;
test
(
'applies core default model when configured'
,
async
(
)
=>
{
await
.
setNonExtensionConfig
(
'chat.planAgent.defaultModel'
,
'Claude Haiku 4.5 (copilot)'
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should contain model override from core setting
.
ok
(
.
includes
(
'model: Claude Haiku 4.5 (copilot)'
)
)
;
}
)
;
test
(
'prefers core default model over extension setting'
,
async
(
)
=>
{
await
.
setNonExtensionConfig
(
'chat.planAgent.defaultModel'
,
'core-model'
)
;
await
.
setConfig
(
.
.
,
'extension-model'
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should contain core model override
.
ok
(
.
includes
(
'model: core-model'
)
)
;
.
ok
(
!
.
includes
(
'model: extension-model'
)
)
;
}
)
;
test
(
'applies both additionalTools and model settings together'
,
async
(
)
=>
{
await
.
setConfig
(
.
,
[
'extraTool'
]
)
;
await
.
setConfig
(
.
.
,
'claude-3-sonnet'
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should contain additional tool
.
ok
(
.
includes
(
'extraTool'
)
)
;
// Should contain model override
.
ok
(
.
includes
(
'model: claude-3-sonnet'
)
)
;
}
)
;
test
(
'fires onDidChangeCustomAgents when additionalTools setting changes'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
let
=
false
;
.
onDidChangeCustomAgents
(
(
)
=>
{
=
true
;
}
)
;
await
.
setConfig
(
.
,
[
'newTool'
]
)
;
.
equal
(
,
true
)
;
}
)
;
test
(
'fires onDidChangeCustomAgents when model setting changes'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
let
=
false
;
.
onDidChangeCustomAgents
(
(
)
=>
{
=
true
;
}
)
;
await
.
setConfig
(
.
.
,
'new-model'
)
;
.
equal
(
,
true
)
;
}
)
;
test
(
'fires onDidChangeCustomAgents when core default model changes'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
let
=
false
;
.
onDidChangeCustomAgents
(
(
)
=>
{
=
true
;
}
)
;
await
.
setNonExtensionConfig
(
'chat.planAgent.defaultModel'
,
'core-model'
)
;
.
equal
(
,
true
)
;
}
)
;
test
(
'does not fire onDidChangeCustomAgents for unrelated setting changes'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
let
=
false
;
.
onDidChangeCustomAgents
(
(
)
=>
{
=
true
;
}
)
;
// Set an unrelated config (using a different config key)
await
.
setConfig
(
.
.
,
true
)
;
.
equal
(
,
false
)
;
}
)
;
test
(
'always includes askQuestions tool in generated content'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
.
ok
(
.
includes
(
'vscode/askQuestions'
)
)
;
}
)
;
test
(
'exposes only default read tools plus agent and askQuestions in plan mode by default'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
const
=
.
match
(
/tools: \[([^\]]+)\]/
)
;
.
ok
(
,
'Tools list not found in agent content'
)
;
const
=
(
[
1
]
.
match
(
/'([^']+)'/g
)
||
[
]
)
.
map
(
=>
.
slice
(
1
,
-
1
)
)
.
sort
(
)
;
const
=
[
...
DEFAULT_READ_TOOLS
,
'agent'
,
'vscode/askQuestions'
]
.
sort
(
)
;
.
deepStrictEqual
(
,
)
;
.
ok
(
!
.
includes
(
'edit'
)
)
;
.
ok
(
!
.
includes
(
'createFile'
)
)
;
.
ok
(
!
.
includes
(
'apply_patch'
)
)
;
}
)
;
test
(
'has correct label property'
,
(
)
=>
{
const
=
createProvider
(
)
;
.
ok
(
.
.
includes
(
'Plan'
)
)
;
}
)
;
test
(
'preserves body content after frontmatter when applying settings'
,
async
(
)
=>
{
await
.
setConfig
(
.
.
,
'test-model'
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should preserve body content
.
ok
(
.
includes
(
'You are a PLANNING AGENT, pairing with the user'
)
)
;
.
ok
(
.
includes
(
'Your SOLE responsibility is planning. NEVER start implementation.'
)
)
;
}
)
;
test
(
'handles empty additionalTools array gracefully'
,
async
(
)
=>
{
await
.
setConfig
(
.
,
[
]
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should have base tools only
.
ok
(
.
includes
(
'github/issue_read'
)
)
;
.
ok
(
.
includes
(
'agent'
)
)
;
}
)
;
test
(
'handles empty model string gracefully'
,
async
(
)
=>
{
await
.
setConfig
(
.
.
,
''
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should not have model field added
.
ok
(
!
.
includes
(
'model:'
)
)
;
}
)
;
test
(
'falls back to extension setting when core default model is empty string'
,
async
(
)
=>
{
await
.
setNonExtensionConfig
(
'chat.planAgent.defaultModel'
,
''
)
;
await
.
setConfig
(
.
.
,
'fallback-model'
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Empty core setting should fall through to extension setting
.
ok
(
.
includes
(
'model: fallback-model'
)
)
;
}
)
;
test
(
'includes handoffs in generated content'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should contain handoffs
.
ok
(
.
includes
(
'handoffs:'
)
)
;
.
ok
(
.
includes
(
'label: Start Implementation'
)
)
;
.
ok
(
.
includes
(
'label: Open in Editor'
)
)
;
.
ok
(
.
includes
(
'agent: agent'
)
)
;
.
ok
(
.
includes
(
'send: true'
)
)
;
}
)
;
test
(
'applies ImplementAgentModel to Start Implementation handoff'
,
async
(
)
=>
{
await
.
setConfig
(
.
,
'Claude Haiku 4.5 (copilot)'
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
.
equal
(
.
,
1
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should contain Start Implementation handoff with model override
.
ok
(
.
includes
(
'label: Start Implementation'
)
)
;
.
ok
(
.
includes
(
'model: Claude Haiku 4.5 (copilot)'
)
)
;
}
)
;
test
(
'does not include model in handoff when ImplementAgentModel is not set'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Find the Start Implementation handoff section
const
=
.
indexOf
(
'handoffs:'
)
;
const
=
.
slice
(
,
.
indexOf
(
'---'
,
)
)
;
// Should not contain model field in handoffs when not configured
.
ok
(
!
.
includes
(
'model:'
)
,
'Should not have model field in handoffs when ImplementAgentModel is not set'
)
;
}
)
;
test
(
'fires onDidChangeCustomAgents when ImplementAgentModel setting changes'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
let
=
false
;
.
onDidChangeCustomAgents
(
(
)
=>
{
=
true
;
}
)
;
await
.
setConfig
(
.
,
'new-model'
)
;
.
equal
(
,
true
)
;
}
)
;
test
(
'fires onDidChangeCustomAgents when SearchSubagentToolEnabled setting changes'
,
async
(
)
=>
{
const
=
createProvider
(
)
;
let
=
false
;
.
onDidChangeCustomAgents
(
(
)
=>
{
=
true
;
}
)
;
await
.
setConfig
(
.
.
,
true
)
;
.
equal
(
,
true
)
;
}
)
;
test
(
'buildAgentBody uses Explore discovery when explore is enabled'
,
(
)
=>
{
const
=
.
buildAgentBody
(
true
,
true
)
;
.
ok
(
.
includes
(
'Run the *Explore* subagent'
)
)
;
.
ok
(
!
.
includes
(
'#tool:searchSubagent'
)
)
;
}
)
;
test
(
'buildAgentBody uses search subagent discovery when explore is disabled but search is enabled'
,
(
)
=>
{
const
=
.
buildAgentBody
(
false
,
true
)
;
.
ok
(
.
includes
(
'#tool:searchSubagent'
)
)
;
.
ok
(
!
.
includes
(
'Run the *Explore* subagent'
)
)
;
}
)
;
test
(
'buildAgentBody uses generic discovery when both explore and search are disabled'
,
(
)
=>
{
const
=
.
buildAgentBody
(
false
,
false
)
;
.
ok
(
.
includes
(
'Search the codebase to gather context'
)
)
;
.
ok
(
!
.
includes
(
'Run the *Explore* subagent'
)
)
;
.
ok
(
!
.
includes
(
'#tool:searchSubagent'
)
)
;
}
)
;
test
(
'excludes agent tool and Explore subagent when explore is disabled'
,
async
(
)
=>
{
await
.
setConfig
(
.
,
false
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should not have the 'agent' tool
const
=
.
match
(
/tools: \[([^\]]+)\]/
)
;
.
ok
(
)
;
.
ok
(
!
[
1
]
.
includes
(
'\'agent\''
)
,
'Should not include agent tool when explore is disabled'
)
;
// Should not have agents field
.
ok
(
!
.
includes
(
'agents:'
)
,
'Should not include agents field when explore is disabled'
)
;
}
)
;
test
(
'includes agent tool and Explore subagent when explore is enabled'
,
async
(
)
=>
{
await
.
setConfig
(
.
,
true
)
;
const
=
createProvider
(
)
;
const
=
await
.
provideCustomAgents
(
{
}
,
{
}
as
any
)
;
const
=
await
getAgentContent
(
[
0
]
)
;
// Should have the 'agent' tool
const
=
.
match
(
/tools: \[([^\]]+)\]/
)
;
.
ok
(
)
;
.
ok
(
[
1
]
.
includes
(
'\'agent\''
)
,
'Should include agent tool when explore is enabled'
)
;
// Should have agents field with Explore
.
ok
(
.
includes
(
'agents:'
)
,
'Should include agents field when explore is enabled'
)
;
}
)
;
}
)
;
suite
(
'buildAgentMarkdown'
,
(
)
=>
{
test
(
'generates expected full content for Plan agent (snapshot test)'
,
(
)
=>
{
// This test outputs the full generated content for easy visual review of format changes
const
=
{
:
'Plan'
,
:
'Researches and outlines multi-step plans'
,
:
'Outline the goal or problem to research'
,
:
[
'github/issue_read'
,
'agent'
,
'search'
,
'memory'
]
,
:
'Claude Haiku 4.5 (copilot)'
,
:
[
{
:
'Start Implementation'
,
:
'agent'
,
:
'Start implementation'
,
:
true
}
]
,
:
'You are a PLANNING AGENT.'
}
;
const
=
buildAgentMarkdown
(
)
;
.
deepStrictEqual
(
,
`---
name: Plan
description: Researches and outlines multi-step plans
argument-hint: Outline the goal or problem to research
model: Claude Haiku 4.5 (copilot)
tools: ['github/issue_read', 'agent', 'search', 'memory']
handoffs:
- label: Start Implementation
agent: agent
prompt: 'Start implementation'
send: true
---
You are a PLANNING AGENT.`
)
;
}
)
;
test
(
'generates valid YAML frontmatter with basic config'