Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
// Force shell integration on so tests that rely on exit code / output
// reporting are not dependent on prior test suites or user settings.
const
=
.
.
getConfiguration
(
'terminal.integrated'
)
;
=
.
get<boolean>
(
'shellIntegration.enabled'
)
;
await
.
update
(
'shellIntegration.enabled'
,
true
,
.
.
)
;
if
(
)
{
=
.
get<boolean>
(
'windowsUseConptyDll'
)
;
await
.
update
(
'windowsUseConptyDll'
,
true
,
.
.
)
;
}
// Register a dummy default model required for participant requests.
// The test extension contributes both `test-lm-vendor` and `copilot`; focused
// chat runs may select either vendor before the participant request is routed.
const
:
.
=
{
async
provideLanguageModelChatInformation
(
,
)
{
return
[
{
:
'test-lm'
,
:
'test-lm'
,
:
'test'
,
:
'1.0.0'
,
:
100
,
:
100
,
:
true
,
:
true
,
:
{
}
}
]
;
}
,
async
provideLanguageModelChatResponse
(
,
,
,
,
)
{
return
undefined
;
}
,
async
provideTokenCount
(
,
,
)
{
return
1
;
}
,
}
;
.
push
(
.
.
registerLanguageModelChatProvider
(
'test-lm-vendor'
,
)
,
.
.
registerLanguageModelChatProvider
(
'copilot'
,
)
,
)
;
// Enable global auto-approve + skip the confirmation dialog via test-mode context key
const
=
.
.
getConfiguration
(
'chat.tools.global'
)
;
await
.
update
(
'autoApprove'
,
true
,
.
.
)
;
await
.
.
executeCommand
(
'setContext'
,
'vscode.chat.tools.global.autoApprove.testMode'
,
true
)
;
}
)
;
teardown
(
async
(
)
=>
{
assertNoRpc
(
)
;
await
closeAllEditors
(
)
;
disposeAll
(
)
;
=
false
;
=
undefined
;
=
undefined
;
=
undefined
;
const
=
.
.
getConfiguration
(
'chat.tools.global'
)
;
await
.
update
(
'autoApprove'
,
undefined
,
.
.
)
;
await
.
.
executeCommand
(
'setContext'
,
'vscode.chat.tools.global.autoApprove.testMode'
,
undefined
)
;
// Restore terminal settings
const
=
.
.
getConfiguration
(
'terminal.integrated'
)
;
await
.
update
(
'shellIntegration.enabled'
,
,
.
.
)
;
if
(
)
{
await
.
update
(
'windowsUseConptyDll'
,
,
.
.
)
;
}
}
)
;
/**
* Helper: invokes run_in_terminal via a chat participant and returns the tool result text.
* Each call creates a new chat session to avoid participant re-registration issues.
*/
interface
RunInTerminalOptions
{
?
:
number
;
?
:
boolean
;
?
:
string
;
?
:
boolean
;
}
let
=
false
;
let
:
<
.
>
|
undefined
;
let
:
string
|
undefined
;
let
:
|
undefined
;
function
setupParticipant
(
)
{
if
(
)
{
return
;
}
=
true
;
const
=
.
.
createChatParticipant
(
'api-test.participant'
,
async
(
,
,
,
)
=>
{
if
(
!
||
!
)
{
return
{
}
;
}
const
=
;
const
=
;
const
=
??
{
}
;
=
undefined
;
=
undefined
;
=
undefined
;
try
{
const
=
await
.
.
invokeTool
(
'run_in_terminal'
,
{
:
{
:
,
:
'Integration test command'
,
:
'Test run_in_terminal output'
,
:
false
,
:
.
??
15000
,
...
.
?
{
:
true
,
:
.
,
}
:
{
}
,
}
,
:
.
,
}
)
;
.
complete
(
)
;
}
catch
(
)
{
.
error
(
)
;
}
return
{
}
;
}
)
;
.
push
(
)
;
}
async
function
invokeRunInTerminal
(
:
string
,
?
:
)
:
Promise
<
string
>
;
async
function
invokeRunInTerminal
(
:
string
,
?
:
number
)
:
Promise
<
string
>
;
async
function
invokeRunInTerminal
(
:
string
,
?
:
|
number
)
:
Promise
<
string
>
{
setupParticipant
(
)
;
const
:
=
typeof
===
'number'
?
{
:
}
:
??
{
}
;
const
=
new
DeferredPromise<vscode.LanguageModelToolResult>
(
)
;
=
;
=
;
=
;
let
:
<
typeof
>
|
undefined
;
const
acceptPendingConfirmation
=
async
(
)
=>
{
try
{
await
.
.
executeCommand
(
'workbench.action.chat.acceptTool'
)
;
await
.
.
executeCommand
(
'workbench.action.chat.acceptElicitation'
)
;
}
catch
{
// The commands are no-ops when no confirmation is visible.
}
}
;
try
{
await
.
.
executeCommand
(
'workbench.action.chat.newLocalChat'
)
;
if
(
.
)
{
=
setInterval
(
(
)
=>
void
acceptPendingConfirmation
(
)
,
200
)
;
}
await
.
.
executeCommand
(
'workbench.action.chat.open'
,
{
:
'@participant test'
}
)
;
const
=
await
.
;
return
extractTextContent
(
)
;
}
finally
{
if
(
)
{
clearInterval
(
)
;
}
}
}
test
(
'tool should be registered with expected schema'
,
async
function
(
)
{
this
.
timeout
(
15000
)
;
// The run_in_terminal tool is registered asynchronously (it needs to
// resolve terminal profiles), so poll until it appears.
let
:
.
|
undefined
;
for
(
let
=
0
;
<
50
;
++
)
{
=
.
.
.
find
(
=>
.
===
'run_in_terminal'
)
;
if
(
)
{
break
;
}
await
new
Promise
(
=>
setTimeout
(
,
200
)
)
;
}
.
ok
(
,
'run_in_terminal tool should be registered'
)
;
.
ok
(
.
,
'Tool should have an input schema'
)
;
const
=
.
as
{
?
:
<
string
,
unknown
>
}
;
.
ok
(
.
?.
[
'command'
]
,
'Schema should have a command property'
)
;
.
ok
(
.
?.
[
'explanation'
]
,
'Schema should have an explanation property'
)
;
.
ok
(
.
?.
[
'goal'
]
,
'Schema should have a goal property'
)
;
.
ok
(
.
?.
[
'mode'
]
,
'Schema should have a mode property'
)
;
}
)
;
// --- Sandbox OFF tests ---
suite
(
'sandbox off'
,
(
)
=>
{
.
skip
(
'echo command returns exactly the echoed text'
,
async
function
(
)
{
this
.
timeout
(
60000
)
;
const
=
`MARKER_${Date.now()}_ECHO`
;
const
=
await
invokeRunInTerminal
(
`echo ${marker}`
)
;
.
strictEqual
(
.
trim
(
)
,
)
;
}
)
;
test
(
'no-output command reports empty output, not prompt echo (issue #303531)'
,
async
function
(
)
{
this
.
timeout
(
60000
)
;
// `true` on Unix exits 0 with no output; `cmd /c rem` on Windows is a no-op
const
=
?
'cmd /c rem'
:
'true'
;
const
=
await
invokeRunInTerminal
(
)
;
.
strictEqual
(
.
trim
(
)
,
'Command produced no output'
)
;
}
)
;
.
skip
(
'multi-line output preserves all lines in order'
,
async
function
(
)
{
this
.
timeout
(
60000
)
;
const
=
`M1_${Date.now()}`
;
const
=
`M2_${Date.now()}`
;
const
=
`M3_${Date.now()}`
;
// Use `;` on Windows (PowerShell) since `&&` is rewritten to `;`
const
=
?
';'
:
'&&'
;
const
=
await
invokeRunInTerminal
(
`echo ${m1}${sep} echo ${m2}${sep} echo ${m3}`
)
;
.
strictEqual
(
.
trim
(
)
,
`${m1}\n${m2}\n${m3}`
)
;
}
)
;
(
?
:
.
)
(
'&& operators are converted to ; on PowerShell'
,
async
function
(
)
{
this
.
timeout
(
60000
)
;
const
=
`CHAIN_${Date.now()}_A`
;
const
=
`CHAIN_${Date.now()}_B`
;
const
=
await
invokeRunInTerminal
(
`echo ${m1} && echo ${m2}`
)
;
// The rewriter prepends a note explaining the simplification
const
=
.
trim
(
)
;
.
ok
(
.
startsWith
(
'Note: The tool simplified the command to'
)
,
`Expected rewrite note, got: ${trimmed}`
)
;
.
ok
(
.
endsWith
(
`${m1}\n${m2}`
)
,
`Expected markers at end, got: ${trimmed}`
)
;
}
)
;
// Flaky: #313601
.
skip
(
'non-zero exit code is reported'
,
async
function
(
)
{
this
.
timeout
(
60000
)
;
// Use a subshell so we don't kill the shared terminal
const
=
?
'cmd /c exit 42'
:
'bash -c "exit 42"'
;
const
=
await
invokeRunInTerminal
(
)
;
// On Windows with shell integration, `cmd /c exit 42` may report
// exit code 1 instead of 42 due to how PowerShell propagates
// cmd.exe exit codes through shell integration sequences.
const
=
[
'Command produced no output\nCommand exited with code 42'
,
...
(
?
[
'Command produced no output\nCommand exited with code 1'