Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
import*as vscode from'vscode';import*as cp from'child_process';import*as fs from'fs';import*as path from'path';import{ ApprovalPolicy, OrchestratorConfig }from'../util/config';import{ GitClient }from'../git/gitClient';import{CACHEABLE_TOOLS, ToolCache }from'./cache';import{ HarnessRunner }from'../harness/runner';import{ logInfo }from'../util/log'
name
description
inputSchema Record
mutating
name
input Record
nodeId
cwd
ok
output
denied
tool ToolDef input Record preview nodeId
ToolDef
name
description
mutating
inputSchema
type
properties path type description
required
name
description
mutating
inputSchema
type
properties
path type description
pattern type description
name
description
mutating
inputSchema
type
properties
query type
pattern type description
regex type
required
name
description
mutating
inputSchema
type
properties
query type
pattern type description
regex type
required
name
description
mutating
inputSchema
type
properties
path type description
pattern type description
name
description
mutating
inputSchema
type
properties
path type
content type
required
name
description
mutating
inputSchema
type
properties path type
required
name
description
mutating
inputSchema
type
properties command type
required
name
description
mutating
inputSchema
type
properties
task type description
agent type description
timeoutMs type description
required
name
description
mutating
inputSchema
type
properties path type description
name
description
mutating
inputSchema
type
properties
worktree type
branch type
baseCommit type
required
name
description
mutating
inputSchema
type
properties
worktree type
branch type
workspaceRoot type
required
name
description
mutating
inputSchema
type
properties cwd type message type
required
name
description
mutating
inputSchema
type
properties cwd type from type to type
required
name
description
mutating
inputSchema
type
properties cwd type sourceBranch type message type
required
name
description
mutating
inputSchema
type
properties cwd type
required
name
description
mutating
inputSchema
type
properties cwd type
required
name
description
mutating
inputSchema
type
properties cwd type base type runBranch type
required
name
description
mutating
inputSchema
type
properties cwd type runBranch type
required
name
description
mutating
inputSchema
type
properties cwd type ref type path type
required
name
description
mutating
inputSchema
type
properties
name
description
mutating
inputSchema
type
properties
name
description
mutating
inputSchema
type
properties suite type description
name
description
mutating
inputSchema
type
properties filter type description
config OrchestratorConfig
approvalHandler ApprovalHandler
git GitClient
cache ToolCache
harness HarnessRunner
gitconfiggitPath
config OrchestratorConfig
config config
gitconfiggitPath
call ToolCallInput ToolResult
def t tname callname
def
ok output
def callinput callnodeId
ok output denied
cacheKey def call
cacheKey
hit cachecacheKey
hit
ok output hit
output defname callinput callcwd
cacheKey
cachecacheKey defname output
ok output
err
ok output err errmessage err
def ToolDef call ToolCallInput
cache defmutating defname
base callcwd
commit gitbase
commit
dirty gitbase
ToolCachedefname callinput commit dirty
def ToolDef input Record nodeId
policy ApprovalPolicy configapprovals
policy defmutating
defmutating policy
defname policy
command inputcommand
configterminalAllowlistprefix commandprefix
def input def input nodeId
def ToolDef input Record
defname
content inputcontent
input
name input Record cwd
name
inputpath cwd
inputpath inputpattern inputpattern cwd
inputquery inputpattern inputpattern inputregex cwd
inputquery inputpattern inputpattern inputregex cwd
inputpath inputpath inputpattern inputpattern cwd
inputpath inputcontent cwd
inputpath cwd
inputcommand cwd inputtimeoutMs
input cwd
inputpath inputpath
input
input
input
input
input
input
input
input
input
input
cwd
inputsuite inputsuite cwd
inputfilter inputfilter cwd
input Record
root
gitroot
isolated reason
worktree inputworktree
branch inputbranch
baseCommit inputbaseCommit gitroot
gitroot worktree branch baseCommit
fspathworktree recursive
isolated worktree branch
input Record
root inputworkspaceRoot
worktree inputworktree
branch inputbranch
gitroot worktree branch
gitroot
removed worktree branch branch
input Record
cwd inputcwd
message inputmessage
info gitcwd message
info
input Record
cwd inputcwd
stat gitcwd inputfrom inputto
diffStat stat
input Record
cwd inputcwd
info gitcwd inputsourceBranch inputmessage
info
input Record
cwd inputcwd
gitcwd
input Record
cwd inputcwd
gitcwd
aborted
input Record
cwd inputcwd
base inputbase
runBranch inputrunBranch
stat files diff
gitcwd base runBranch
gitcwd base runBranch
gitcwd base runBranch
stat files diff
input Record
cwd inputcwd
info gitcwd inputrunBranch
info
input Record
cwd inputcwd
content gitcwd inputref inputpath
content
vscodeUri
folder vscodeworkspaceworkspaceFolders
folder
folderuri
cwd
harness
root cwd
tasks harnessroot
tasks
tool args cwd
harness
result harnesstool args cwd
output resultstdout resultstderr
resultcode
output
output
fsPath
input Record cwd
task inputtask
task
commands vscodecommands
commands
timeoutMs MathMathinputtimeoutMs
title task
heartbeat
vscodecommands
state
session statesessionsitem itemtitle title
session
uptime sessionstartedAt MathDate sessionstartedAt
result ok exitCode error output
result vscodecommands
agent inputagent inputagent
task
cwd cwd
title
timeoutMs
heartbeat
result
output resultoutput
tail outputlength output
resultok
tail
cwd
root path
cwd
root
normalized pathcwd
normalized root normalizedroot pathsep
normalized
target
target
normalized pathtarget
root path
normalized root normalizedroot pathsep
normalized
relativePath cwd vscodeUri
base cwd
target pathpathrelativePath relativePath pathbase relativePath
target base targetbase pathsep
vscodeUritarget
relativePath cwd
uri relativePath cwd
bytes vscodeworkspacefsuri
text Bufferbytes
textlength text text
relativePath pattern cwd
base vscodeUricwd
glob pattern relativePath
uris vscodeworkspace base glob
urisu pathbasefsPath ufsPath
query pattern regex cwd
query
base pathcwd
files vscodeworkspacepattern
needle regex query
hits
file files
hitslength
text Buffer vscodeworkspacefsfile
lines text
i i lineslength i
matched needle needlelinesi linesiquery
matched
rel pathbase filefsPath
hits
hitslength
hits
relativePath pattern cwd
base pathcwd
glob pattern relativePath
files vscodeworkspace vscodeUribase glob
symbolPattern
out
file files
outlength
text
text Buffer vscodeworkspacefsfile
rel pathbase filefsPath
lines text
i i lineslength i
match symbolPatternlinesi
match
out
outlength
out
relativePath content cwd
uri relativePath cwd
edit
edituri ignoreIfNotExists
edituri ignoreIfExists
edituri content
applied vscodeworkspaceedit
applied
doc vscodeworkspaceuri
doc
relativePath cwd
uri relativePath cwd
vscodeworkspacefsuri recursive useTrash
command cwd timeoutMs
dir cwd
timeout timeoutMs MathMath timeoutMs
resolve
cpcommand cwd dir timeout maxBuffer error stdout stderr
out
stdout
out stdout
stderr
out out stderr
error
out
outlength
head out
tail out
out
out
relativePath
root
all vscodelanguages
lines
uri items all
itemslength
rel pathrootfsPath urifsPath
relativePath relrelativePath
d items
severity dseverity
lines
lineslength
lines
/** true = инструмент меняет состояние (запись, терминал) */
:
boolean
;
}
export
interface
ToolCallInput
{
:
string
;
:
<
string
,
unknown
>
;
/** Узел графа, который просит инструмент: нужен, чтобы пометить его карточку. */
?
:
string
;
/** Рабочее дерево узла (Этап 4.1). Пусто — инструмент работает в корне workspace. */
?
:
string
;
}
export
interface
ToolResult
{
:
boolean
;
:
string
;
?
:
boolean
;
}
/** Колбэк аппрува: UI (панель/модалка) решает — разрешить вызов или нет. */
export
type
ApprovalHandler
=
(
:
,
:
<
string
,
unknown
>
,
:
string
,
?
:
string
)
=>
Promise
<
boolean
>
;
const
OUTPUT_LIMIT
=
8000
;
const
TERMINAL_TIMEOUT_MS
=
180_000
;
const
CLI_AGENT_TIMEOUT_MS
=
600_000
;
export
const
TOOL_DEFS
:
[
]
=
[
{
:
'fs.readFile'
,
:
'Read a UTF-8 text file from the workspace. Returns file content (truncated if huge).'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
,
:
'Workspace-relative path'
}
}
,
:
[
'path'
]
,
}
,
}
,
{
:
'fs.listFiles'
,
:
'List files in a workspace directory (non-recursive or glob pattern).'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
,
:
'Workspace-relative directory, default root'
}
,
:
{
:
'string'
,
:
'Optional glob like **/*.ts'
}
,
}
,
}
,
}
,
{
:
'fs.search'
,
:
'Search file contents in the workspace by substring or regex.'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
,
:
'Optional glob to limit files'
}
,
:
{
:
'boolean'
}
,
}
,
:
[
'query'
]
,
}
,
}
,
{
:
'grep'
,
:
'Search file contents by substring or regex (same as fs.search; cached by commit).'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
,
:
'Optional glob to limit files'
}
,
:
{
:
'boolean'
}
,
}
,
:
[
'query'
]
,
}
,
}
,
{
:
'symbols.list'
,
:
'List top-level symbols (functions/classes/types) per file, with file:line.'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
,
:
'Optional workspace-relative directory to limit the scan'
}
,
:
{
:
'string'
,
:
'Optional glob like **/*.ts'
}
,
}
,
}
,
}
,
{
:
'fs.writeFile'
,
:
'Write (create or overwrite) a UTF-8 text file in the workspace. Requires approval.'
,
:
true
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
}
,
}
,
:
[
'path'
,
'content'
]
,
}
,
}
,
{
:
'fs.delete'
,
:
'Delete a file or directory inside the workspace. Dangerous — guarded by an interrupt.'
,
:
true
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
}
,
:
[
'path'
]
,
}
,
}
,
{
:
'terminal.run'
,
:
'Run a shell command in the workspace root (tests, linters). Output is truncated.'
,
:
true
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
}
,
:
[
'command'
]
,
}
,
}
,
{
:
'agent.cli'
,
:
'Delegate a self-contained coding task to an external CLI agent (Claude Code, Codex, Gemini CLI, Qwen Code, OpenCode, Aider) via the Orca plugin. Runs headless in the workspace (or node worktree) and returns its final output. Use for large, well-specified subtasks.'
,
:
true
,
:
{
:
'object'
,
:
{
:
{
:
'string'
,
:
'Full task description for the CLI agent.'
}
,
:
{
:
'string'
,
enum
:
[
'claude'
,
'codex'
,
'gemini'
,
'qwen'
,
'opencode'
,
'aider'
,
'custom'
]
,
:
'Which CLI to use. Omit to use the Orca default.'
}
,
:
{
:
'number'
,
:
'Max run time in ms (default 600000).'
}
,
}
,
:
[
'task'
]
,
}
,
}
,
{
:
'diagnostics.get'
,
:
'Get current IDE diagnostics (errors/warnings) for workspace files.'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
,
:
'Optional workspace-relative path filter'
}
}
,
}
,
}
,
// --- Изоляция воркеров (Этап 4.1): git-операции исполняет расширение ---
{
:
'git.worktreeAdd'
,
:
'Create a git worktree + branch for a worker node from the run base commit.'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
}
,
:
{
:
'string'
}
,
}
,
:
[
'worktree'
,
'branch'
]
,
}
,
}
,
{
:
'git.worktreeRemove'
,
:
'Remove a worker worktree and its branch (cleanup on reject/cancel).'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
}
,
:
{
:
'string'
}
,
}
,
:
[
'worktree'
]
,
}
,
}
,
{
:
'git.commitWorktree'
,
:
'Commit all changes inside a worker worktree onto its branch.'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
}
}
,
:
[
'cwd'
]
,
}
,
}
,
{
:
'git.diffStat'
,
:
'Diffstat between two refs inside a worktree — a short reference for results.'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
}
,
:
{
:
'string'
}
}
,
:
[
'cwd'
,
'from'
,
'to'
]
,
}
,
}
,
// --- Merge узлов в run-ветку (Этап 4.3) и финальный патч (Этап 4.5) ---
{
:
'git.mergeNode'
,
:
'Merge one node branch into the run branch. A conflict returns the file list, not an auto-resolve.'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
}
,
:
{
:
'string'
}
}
,
:
[
'cwd'
,
'sourceBranch'
]
,
}
,
}
,
{
:
'git.mergeContinue'
,
:
'Finish a merge after the human resolved conflicts in the run worktree.'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
}
,
:
[
'cwd'
]
,
}
,
}
,
{
:
'git.mergeAbort'
,
:
'Abort an unfinished merge (reject/rollback).'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
}
,
:
[
'cwd'
]
,
}
,
}
,
{
:
'git.finalPatch'
,
:
'Unified diff, stat and file list of the run branch against the base commit.'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
}
,
:
{
:
'string'
}
}
,
:
[
'cwd'
,
'base'
,
'runBranch'
]
,
}
,
}
,
{
:
'git.applyPatch'
,
:
'Merge the run branch into the user current branch (apply the final patch).'
,
:
true
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
}
}
,
:
[
'cwd'
,
'runBranch'
]
,
}
,
}
,
{
:
'git.readRef'
,
:
'Read a file content at a git ref (for the multi-diff editor).'
,
:
false
,
:
{
:
'object'
,
:
{
:
{
:
'string'
}
,
:
{
:
'string'
}
,
:
{
:
'string'
}
}
,
:
[
'ref'
,
'path'
]
,
}
,
}
,
{
:
'harness.tasks'
,
:
'List the Agent Harness task queue of the project (.agent-state/tasks.json): statuses, owners, attempts, evidence.'
,
:
false
,
:
{
:
'object'
,
:
{
}
,
}
,
}
,
{
:
'harness.doctor'
,
:
'Run the Agent Harness environment check (tools/doctor.mjs) and return its report.'
,
:
false
,
:
{
:
'object'
,
:
{
}
,
}
,
}
,
{
:
'harness.gates'
,
:
'Run Agent Harness quality gates (tools/gates.mjs: e2e/a11y/visual/perf) in the workspace. Optionally pass a single suite name.'
,
:
true
,
:
{
:
'object'
,
:
{
:
{
:
'string'
,
:
'Optional gate suite, e.g. e2e or a11y'
}
}
,
}
,
}
,
{
:
'harness.journeys'
,
:
'Run Agent Harness scenario journeys (tools/journeys.mjs) in the workspace. Optionally pass a journey filter substring.'
,
:
true
,
:
{
:
'object'
,
:
{
:
{
:
'string'
,
:
'Optional journey name filter'
}
}
,
}
,
}
,
]
;
export
class
ToolExecutor
{
constructor
(
private
:
,
private
:
,
private
:
=
new
GitClient
(
)
,
/** Кэш read-only тулов (Этап 5.3). Без него всё работает как раньше. */
private
?
:
,
/** Мост к Agent Harness (Этап harness): без него harness.* честно отвечают отказом. */
private
?
:
,
)
{
this
.
.
setPath
(
this
.
.
)
;
}
updateConfig
(
:
)
:
void
{
this
.
=
;
this
.
.
setPath
(
.
)
;
}
async
run
(
:
)
:
Promise
<
>
{
const
=
TOOL_DEFS
.
find
(
=>
.
===
.
)
;
if
(
!
)
{
return
{
:
false
,
:
`unknown tool: ${call.name}`
}
;
}
if
(
!
await
this
.
isAllowed
(
,
.
,
.
)
)
{
return
{
:
false
,
:
'denied by user or policy'
,
:
true
}
;
}
const
=
await
this
.
cacheKeyFor
(
,
)
;
if
(
)
{
const
=
this
.
?.
get
(
)
;
if
(
!==
undefined
)
{
// Повторный read-only вызов в том же коммите не трогает файлы/git.
logInfo
(
`tool ${def.name} cache hit`
)
;
return
{
:
true
,
:
}
;
}
}
try
{
const
=
await
this
.
execute
(
.
,
.
,
.
)
;
logInfo
(
`tool ${def.name} ok (${output.length} chars)`
)
;
if
(
)
{
this
.
?.
set
(
,
.
,
)
;
}
return
{
:
true
,
}
;
}
catch
(
)
{
return
{
:
false
,
:
instanceof
Error
?
.
:
String
(
)
}
;
}
}
/**
* Ключ кэша для read-only тула: инструмент + аргументы + коммит + грязность
* дерева. Вне git (нет sha) не кэшируем: ключ не смог бы инвалидироваться.
*/
/** Рабочее дерево узла в .aura/worktrees — заводится только для write-узлов. */
private
async
worktreeAdd
(
:
<
string
,
unknown
>
)
:
Promise
<
string
>
{
const
=
this
.
workspaceRootFs
(
)
;
if
(
!
await
this
.
.
isRepo
(
)
)
{
// Не репозиторий — изоляция выключается, воркер работает в корне.
return
JSON
.
stringify
(
{
:
false
,
:
'not a git repository'
}
)
;
}
const
=
this
.
assertInsideWorkspace
(
String
(
.
??
''
)
)
;
const
=
String
(
.
??
''
)
;
const
=
String
(
.
??
''
)
||
await
this
.
.
head
(
)
;
await
this
.
.
worktreeAdd
(
,
,
,
)
;
.
mkdirSync
(
.
dirname
(
)
,
{
:
true
}
)
;
return
JSON
.
stringify
(
{
:
true
,
,
}
)
;
}
private
async
worktreeRemove
(
:
<
string
,
unknown
>
)
:
Promise
<
string
>
{
const
=
String
(
.
??
''
)
||
this
.
workspaceRootFs
(
)
;
const
=
this
.
assertInsideWorkspace
(
String
(
.
??
''
)
)
;
const
=
String
(
.
??
''
)
||
undefined
;
await
this
.
.
worktreeRemove
(
,
,
)
;
await
this
.
.
prune
(
)
;
return
JSON
.
stringify
(
{
:
true
,
,
:
??
''
}
)
;
}
private
async
commitWorktree
(
:
<
string
,
unknown
>
)
:
Promise
<
string
>
{
const
=
this
.
assertInsideWorkspace
(
String
(
.
??
''
)
)
;
const
=
String
(
.
??
'aura orchestrator: node result'
)
;
const
=
await
this
.
.
commitAll
(
,
)
;
return
JSON
.
stringify
(
)
;
}
private
async
diffStat
(
:
<
string
,
unknown
>
)
:
Promise
<
string
>
{
const
=
this
.
assertInsideWorkspace
(
String
(
.
??
''
)
)
;
const
=
await
this
.
.
diffStat
(
,
String
(
.
??
'HEAD'
)
,
String
(
.
??
'HEAD'
)
)
;
return
JSON
.
stringify
(
{
:
}
)
;
}
/** Merge одного узла в run-ветку. Конфликт — файлы наружу, без авто-резолва. */
private
async
mergeNode
(
:
<
string
,
unknown
>
)
:
Promise
<
string
>
{
const
=
this
.
assertInsideWorkspace
(
String
(
.
??
''
)
)
;
const
=
await
this
.
.
mergeBranch
(
,
String
(
.
??
''
)
,
String
(
.
??
''
)
)
;
return
JSON
.
stringify
(
)
;
}
private
async
mergeContinue
(
:
<
string
,
unknown
>
)
:
Promise
<
string
>
{
const
=
this
.
assertInsideWorkspace
(
String
(
.
??
''
)
)
;
return
JSON
.
stringify
(
await
this
.
.
mergeContinue
(
)
)
;
}
private
async
mergeAbort
(
:
<
string
,
unknown
>
)
:
Promise
<
string
>
{
const
=
this
.
assertInsideWorkspace
(
String
(
.
??
''
)
)
;
await
this
.
.
mergeAbort
(
)
;
return
JSON
.
stringify
(
{
:
true
}
)
;
}
private
async
finalPatch
(
:
<
string
,
unknown
>
)
:
Promise
<
string
>
{
const
=
this
.
assertInsideWorkspace
(
String
(
.
??
''
)
)
;
const
=
String
(
.
??
''
)
;
const
=
String
(
.
??
''
)
;
const
[
,
,
]
=
await
Promise
.
all
(
[
this
.
.
diffStat
(
,
,
)
,
this
.
.
filesChanged
(
,
,
)
,
this
.
.
diff
(
,
,
)
,
]
)
;
return
JSON
.
stringify
(
{
,
,
}
)
;
}
/**
* Применить финальный патч: run-ветка вливается в текущую ветку пользователя.
* Конфликт не разрешаем сами — возвращаем список файлов на решение человека.
*/
private
async
applyPatch
(
:
<
string
,
unknown
>
)
:
Promise
<
string
>
{
const
=
String
(
.
??
''
)
||
this
.
workspaceRootFs
(
)
;
const
=
await
this
.
.
mergeBranch
(
,
String
(
.
??
''
)
,
'aura orchestrator: apply run patch'
)
;
return
JSON
.
stringify
(
)
;
}
/** Содержимое файла на конкретной ссылке — для multi-diff редактора. */
private
async
readRef
(
:
<
string
,
unknown
>
)
:
Promise
<
string
>
{
const
=
String
(
.
??
''
)
||
this
.
workspaceRootFs
(
)
;
const
=
await
this
.
.
showFile
(
,
String
(
.
??
''
)
,
String
(
.
??
''
)
)
;
return
;
}
// ---- fs ----
private
workspaceRoot
(
)
:
.
{
const
=
.
.
?.
[
0
]
;
if
(
!
)
{
throw
new
Error
(
'no workspace folder open'
)
;
}
return
.
;
}
// ---- Agent Harness (мост через aura-harness или ~/.agent-harness) ----
private
async
harnessTasks
(
?
:
string
)
:
Promise
<
string
>
{
if
(
!
this
.
)
{
throw
new
Error
(
'Agent Harness недоступен: плагин aura-harness не подключён'
)
;
}
const
=
??
this
.
workspaceRootFs
(
)
;
const
=
await
this
.
.
listTasks
(
)
;
return
JSON
.
stringify
(
{
}
,
null
,
2
)
;
}
private
async
harnessTool
(
:
string
,
:
string
[
]
,
?
:
string
)
:
Promise
<
string
>
{
if
(
!
this
.
)
{
throw
new
Error
(
'Agent Harness недоступен: плагин aura-harness не подключён'
)
;
}
const
=
await
this
.
.
run
(
,
,
)
;
const
=
(
.
+
.
)
.
trim
(
)
;
if
(
.
!==
0
)
{
throw
new
Error
(
||
`${tool} exited ${result.code}`
)
;
}
return
;
}
private
workspaceRootFs
(
)
:
string
{
return
this
.
workspaceRoot
(
)
.
;
}
/**
* База для относительных путей: рабочее дерево узла (cwd) или корень workspace.
* cwd обязан лежать внутри workspace — иначе это выход за пределы песочницы.
*/
/** Делегировать задачу CLI-агенту через плагин Orca (auraOrca.runHeadless). */
private
async
runCliAgent
(
:
<
string
,
unknown
>
,
?
:
string
)
:
Promise
<
string
>
{
const
=
String
(
.
??
''
)
.
trim
(
)
;
if
(
!
)
{
throw
new
Error
(
'agent.cli: task is required'
)
;
}
const
=
await
.
.
getCommands
(
true
)
;
if
(
!
.
includes
(
'auraOrca.runHeadless'
)
)
{
throw
new
Error
(
'agent.cli: the Orca plugin is not installed or disabled (Market → Orca)'
)
;
}
const
=
.
min
(
.
max
(
Number
(
.
)
||
CLI_AGENT_TIMEOUT_MS
,
10_000
)
,
3_600_000
)
;
const
=
.
slice
(
0
,
60
)
;
// AURA-033: долгий headless-запуск молчал — живой агент не отличался от
// зависшего. Пока ждём результат, раз в 20 с пишем в лог аптайм и объём
// вывода сессии Orca (матчим по точному заголовку, который сами же задали).