@ashx-j/lunr 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -1
- package/README.md +2 -2
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +0 -2
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/lunr-todos.d.ts +6 -5
- package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-todos.js +9 -7
- package/dist/builtin-extensions/lunr-todos.js.map +1 -1
- package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts +6 -4
- package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-intercom/broker/spawn.js +114 -61
- package/dist/builtin-extensions/pi-intercom/broker/spawn.js.map +1 -1
- package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-intercom/index.js +360 -351
- package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js +2 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +8 -6
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +128 -57
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts +18 -8
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +38 -13
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -3
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +24 -14
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +8 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +247 -18
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts +29 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js +179 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts +89 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js +541 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +11 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +38 -12
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js +3 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +35 -8
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts +7 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js +26 -4
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js +55 -38
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts +100 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +46 -31
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +3 -6
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +64 -5
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts +15 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js +14 -4
- package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +2 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +21 -8
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +0 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +71 -25
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js +75 -18
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts +13 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +67 -11
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +3 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +7 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +13 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js +5 -10
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js +3 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts +3 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +68 -11
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts +12 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js +21 -2
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +21 -4
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts +7 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +11 -7
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +6 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +46 -29
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +46 -4
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +407 -450
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts +2 -13
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js +5 -91
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js.map +1 -1
- package/dist/core/customize.d.ts +2 -0
- package/dist/core/customize.d.ts.map +1 -1
- package/dist/core/customize.js +3 -0
- package/dist/core/customize.js.map +1 -1
- package/dist/core/permissions.d.ts +1 -0
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +8 -4
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +0 -5
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/runtime-bridges.d.ts.map +1 -1
- package/dist/core/runtime-bridges.js +0 -2
- package/dist/core/runtime-bridges.js.map +1 -1
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +11 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/subagent-cancellation.d.ts +21 -0
- package/dist/core/subagent-cancellation.d.ts.map +1 -0
- package/dist/core/subagent-cancellation.js +53 -0
- package/dist/core/subagent-cancellation.js.map +1 -0
- package/dist/core/subagent-spinner-setting.d.ts +6 -0
- package/dist/core/subagent-spinner-setting.d.ts.map +1 -0
- package/dist/core/subagent-spinner-setting.js +12 -0
- package/dist/core/subagent-spinner-setting.js.map +1 -0
- package/dist/core/subagent-spinner.d.ts +4 -0
- package/dist/core/subagent-spinner.d.ts.map +1 -0
- package/dist/core/subagent-spinner.js +6 -0
- package/dist/core/subagent-spinner.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +12 -18
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +73 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +12 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/extension-widget-order.d.ts +8 -0
- package/dist/modes/interactive/extension-widget-order.d.ts.map +1 -0
- package/dist/modes/interactive/extension-widget-order.js +37 -0
- package/dist/modes/interactive/extension-widget-order.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +44 -22
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/node-runtime/{agent-session-services-35WNVGMR.js → agent-session-services-C743TYQE.js} +6 -5
- package/dist/node-runtime/{builtin-extensions-322XDDEM.js → builtin-extensions-JCOPAAB5.js} +3 -2
- package/dist/node-runtime/{chunk-XATUM2HK.js → chunk-25I2BHAA.js} +1 -1
- package/dist/node-runtime/{chunk-TXHKBRHZ.js → chunk-2BUAYZ7K.js} +136 -53
- package/dist/node-runtime/chunk-5ZH3ZFIZ.js +308 -0
- package/dist/node-runtime/{chunk-J26TSGDL.js → chunk-6N22HULO.js} +8 -5
- package/dist/node-runtime/chunk-A3KMVBZV.js +60 -0
- package/dist/node-runtime/{chunk-4FX25LWP.js → chunk-AWVD5IEY.js} +20 -421
- package/dist/node-runtime/{chunk-ZRCBN365.js → chunk-GB2MGFLI.js} +12 -12
- package/dist/node-runtime/chunk-LISUTZS3.js +19 -0
- package/dist/node-runtime/{chunk-PNJSG3IZ.js → chunk-LTYWTR3V.js} +1 -369
- package/dist/node-runtime/{chunk-TFBIJTM3.js → chunk-PDNXVXMD.js} +13 -13
- package/dist/node-runtime/{chunk-MCUNIRD5.js → chunk-SY2TFMLO.js} +532 -261
- package/dist/node-runtime/{chunk-HQCKFM2O.js → chunk-VGYZ3APQ.js} +3 -0
- package/dist/node-runtime/{chunk-4DJ6HEGH.js → chunk-VZR3NCM7.js} +3 -3
- package/dist/node-runtime/chunk-W3SILANP.js +24 -0
- package/dist/node-runtime/{chunk-CBGB57XT.js → chunk-WLLDXJRT.js} +10 -0
- package/dist/node-runtime/{chunk-ATGA2WLC.js → chunk-XI77KVKA.js} +399 -36
- package/dist/node-runtime/{chunk-4CSFRBCN.js → chunk-Y5KOEMBH.js} +1 -1
- package/dist/node-runtime/{chunk-AROOY4BB.js → chunk-YMEAYRBE.js} +1 -1
- package/dist/node-runtime/{command-DWUM5X3U.js → command-P4NYCJ2M.js} +1 -1
- package/dist/node-runtime/{customize-XEXL2DGQ.js → customize-LF5VST47.js} +1 -1
- package/dist/node-runtime/{gateway-UZXMFGWY.js → gateway-BM6NLOH4.js} +2 -2
- package/dist/node-runtime/index.js +16 -13
- package/dist/node-runtime/{interactive-mode-QT5IKGQ5.js → interactive-mode-EVVBA64D.js} +11 -8
- package/dist/node-runtime/{lunr-cron-QPBTKBGI.js → lunr-cron-4VHP4E4B.js} +2 -2
- package/dist/node-runtime/main.js +14 -12
- package/dist/node-runtime/{package-manager-cli-7RKSZGEN.js → package-manager-cli-N37546V5.js} +5 -4
- package/dist/node-runtime/{pi-intercom-EEMBGQID.js → pi-intercom-NV2LW6X7.js} +108 -87
- package/dist/node-runtime/{pi-subagents-7YJ3I4VE.js → pi-subagents-6MUIFNDM.js} +1262 -599
- package/dist/node-runtime/rpc-entry.js +14 -12
- package/dist/node-runtime/{runtime-bridges-3RKBDLNA.js → runtime-bridges-2VQTLPOZ.js} +3 -5
- package/dist/node-runtime/{settings-manager-GHPTUN7R.js → settings-manager-CUGAZWAB.js} +2 -1
- package/dist/node-runtime/{subagent-executor-5Q5A4HJ2.js → subagent-executor-MH4A7CCF.js} +181 -294
- package/dist/node-runtime/{update-cli-L3JIBH2U.js → update-cli-XTZMZGOL.js} +2 -1
- package/docs/features.md +22 -4
- package/docs/keybindings.md +3 -1
- package/docs/settings.md +3 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
- package/dist/builtin-extensions/lunr-settings-tools.d.ts +0 -4
- package/dist/builtin-extensions/lunr-settings-tools.d.ts.map +0 -1
- package/dist/builtin-extensions/lunr-settings-tools.js +0 -120
- package/dist/builtin-extensions/lunr-settings-tools.js.map +0 -1
- package/dist/core/settings-tools-bridge.d.ts +0 -35
- package/dist/core/settings-tools-bridge.d.ts.map +0 -1
- package/dist/core/settings-tools-bridge.js +0 -56
- package/dist/core/settings-tools-bridge.js.map +0 -1
- package/dist/node-runtime/chunk-3NMWLTPV.js +0 -64
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
PI_CODING_AGENT_PACKAGE_ROOT_ENV,
|
|
15
15
|
RESULTS_DIR,
|
|
16
16
|
SUBAGENT_ACTIONS,
|
|
17
|
+
SUBAGENT_ASYNC_GUIDANCE,
|
|
17
18
|
SUBAGENT_ASYNC_STARTED_EVENT,
|
|
18
19
|
SUBAGENT_CONTROL_EVENT,
|
|
19
20
|
SUBAGENT_CONTROL_INTERCOM_EVENT,
|
|
@@ -21,7 +22,6 @@ import {
|
|
|
21
22
|
SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
|
|
22
23
|
Semaphore,
|
|
23
24
|
TEMP_ROOT_DIR,
|
|
24
|
-
THINKING_LEVELS,
|
|
25
25
|
acceptChildWatchdogEvent,
|
|
26
26
|
acceptanceFailureMessage,
|
|
27
27
|
aggregateAcceptanceReport,
|
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
appendTurnBudgetSystemPrompt,
|
|
31
31
|
applyIntercomBridgeToAgent,
|
|
32
32
|
applyThinkingSuffix,
|
|
33
|
-
assertSafeNestedId,
|
|
34
33
|
attachNestedChildrenToResultChildren,
|
|
35
34
|
attachRootChildrenToSteps,
|
|
36
35
|
buildChainInstructions,
|
|
@@ -69,11 +68,9 @@ import {
|
|
|
69
68
|
expectsImplementationMutation,
|
|
70
69
|
extractTextFromContent,
|
|
71
70
|
extractToolArgsPreview,
|
|
72
|
-
findAsyncRunPrefixMatches,
|
|
73
71
|
findLatestSessionFile,
|
|
74
72
|
findModelInfo,
|
|
75
73
|
findNestedRouteForRootId,
|
|
76
|
-
findNestedRunMatchesById,
|
|
77
74
|
flatToLogicalStepIndex,
|
|
78
75
|
formatAcceptancePrompt,
|
|
79
76
|
formatActivityLabel,
|
|
@@ -116,7 +113,6 @@ import {
|
|
|
116
113
|
normalizeChildSpec,
|
|
117
114
|
normalizeParallelGroups,
|
|
118
115
|
normalizeSkillInput,
|
|
119
|
-
parseWatchdogThinkingInput,
|
|
120
116
|
projectNestedRegistryForRoot,
|
|
121
117
|
readChildToolDiagnosticError,
|
|
122
118
|
readNestedControlResults,
|
|
@@ -140,6 +136,7 @@ import {
|
|
|
140
136
|
resolveEffectiveAcceptance,
|
|
141
137
|
resolveEffectiveSubagentModel,
|
|
142
138
|
resolveEffectiveThinking,
|
|
139
|
+
resolveExecutableChildModel,
|
|
143
140
|
resolveInheritedNestedRouteFromEnv,
|
|
144
141
|
resolveIntercomBridge,
|
|
145
142
|
resolveIntercomSessionTarget,
|
|
@@ -148,22 +145,25 @@ import {
|
|
|
148
145
|
resolveNestedAsyncDir,
|
|
149
146
|
resolveNestedParentAddressFromEnv,
|
|
150
147
|
resolveParallelBehaviors,
|
|
151
|
-
resolveRequiredTierModel,
|
|
152
148
|
resolveSkillsWithFallback,
|
|
153
149
|
resolveStepBehavior,
|
|
154
150
|
resolveSubagentIntercomTarget,
|
|
151
|
+
resolveSubagentRequestParams,
|
|
155
152
|
resolveSubagentResultStatus,
|
|
153
|
+
resolveSubagentRunId,
|
|
156
154
|
resolveTopLevelParallelConcurrency,
|
|
157
155
|
resolveTopLevelParallelMaxTasks,
|
|
158
156
|
resolveTurnBudgetConfig,
|
|
159
157
|
resolveWatchdogConfig,
|
|
160
158
|
resolveWatchdogModelInput,
|
|
159
|
+
restorePersistedAcceptance,
|
|
161
160
|
shouldAbortForTurnBudget,
|
|
162
161
|
shouldNotifyControlEvent,
|
|
163
162
|
splitKnownThinkingSuffix,
|
|
164
163
|
splitThinkingSuffix,
|
|
165
164
|
stripAcceptanceReport,
|
|
166
165
|
stripDetailsOutputsForIntercomReceipt,
|
|
166
|
+
subagentLaunchRunsAsync,
|
|
167
167
|
sumResultsCost,
|
|
168
168
|
sumResultsUsage,
|
|
169
169
|
suppressProgressForReadOnlyTask,
|
|
@@ -186,14 +186,13 @@ import {
|
|
|
186
186
|
writeMetadata,
|
|
187
187
|
writeNestedControlRequest,
|
|
188
188
|
writeNestedEvent,
|
|
189
|
-
writePrivateAtomicJson
|
|
190
|
-
|
|
191
|
-
} from "./chunk-MCUNIRD5.js";
|
|
189
|
+
writePrivateAtomicJson
|
|
190
|
+
} from "./chunk-SY2TFMLO.js";
|
|
192
191
|
import {
|
|
193
192
|
PLAN_MODE_WRITE_SPAWN_ERROR,
|
|
194
193
|
resolveChildPermissions,
|
|
195
194
|
snapshotParentPermissionMode
|
|
196
|
-
} from "./chunk-
|
|
195
|
+
} from "./chunk-25I2BHAA.js";
|
|
197
196
|
import "./chunk-WKDK4C5P.js";
|
|
198
197
|
import "./chunk-53YJI7JU.js";
|
|
199
198
|
import "./chunk-KBKMCJDU.js";
|
|
@@ -203,7 +202,7 @@ import {
|
|
|
203
202
|
} from "./chunk-GKLEQ3I4.js";
|
|
204
203
|
import "./chunk-FVDOXRUD.js";
|
|
205
204
|
import "./chunk-AD6VXAO7.js";
|
|
206
|
-
import "./chunk-
|
|
205
|
+
import "./chunk-6N22HULO.js";
|
|
207
206
|
import "./chunk-M3LZLQW2.js";
|
|
208
207
|
import "./chunk-RQ2Q5IYR.js";
|
|
209
208
|
import "./chunk-DDWHZ633.js";
|
|
@@ -214,8 +213,8 @@ import "./chunk-BRJX2PRC.js";
|
|
|
214
213
|
|
|
215
214
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js
|
|
216
215
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
217
|
-
import * as
|
|
218
|
-
import * as
|
|
216
|
+
import * as fs15 from "node:fs";
|
|
217
|
+
import * as path15 from "node:path";
|
|
219
218
|
|
|
220
219
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.js
|
|
221
220
|
import { matchesKey, visibleWidth, truncateToWidth } from "@ashx-j/lunr-tui";
|
|
@@ -898,34 +897,6 @@ var ChainClarifyComponent = class {
|
|
|
898
897
|
}
|
|
899
898
|
};
|
|
900
899
|
|
|
901
|
-
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js
|
|
902
|
-
var LAUNCH_COMPATIBLE_ACTIONS = /* @__PURE__ */ new Set(["schedule", "append-step", "resume", "steer"]);
|
|
903
|
-
function omitExecutionModeActionAlias(params) {
|
|
904
|
-
let action = params.action?.toLowerCase();
|
|
905
|
-
if (action === "single" && params.task !== void 0) {
|
|
906
|
-
let rest = { ...params };
|
|
907
|
-
return delete rest.action, rest;
|
|
908
|
-
}
|
|
909
|
-
if ((action === "parallel" || action === "tasks") && (params.tasks?.length ?? 0) > 0) {
|
|
910
|
-
let rest = { ...params };
|
|
911
|
-
return delete rest.action, rest;
|
|
912
|
-
}
|
|
913
|
-
return params;
|
|
914
|
-
}
|
|
915
|
-
function hasLaunchFields(params) {
|
|
916
|
-
return params.task !== void 0 || Array.isArray(params.tasks) && params.tasks.length > 0 || Array.isArray(params.chain) && params.chain.length > 0;
|
|
917
|
-
}
|
|
918
|
-
function omitConflictingControlAction(params) {
|
|
919
|
-
let action = params.action?.toLowerCase();
|
|
920
|
-
if (!action || LAUNCH_COMPATIBLE_ACTIONS.has(action) || !hasLaunchFields(params))
|
|
921
|
-
return params;
|
|
922
|
-
let rest = { ...params };
|
|
923
|
-
return delete rest.action, typeof rest.task == "string" && rest.task.length > 0 && (delete rest.tasks, delete rest.chain), rest;
|
|
924
|
-
}
|
|
925
|
-
function resolveSubagentRequestParams(params) {
|
|
926
|
-
return omitConflictingControlAction(omitExecutionModeActionAlias(params));
|
|
927
|
-
}
|
|
928
|
-
|
|
929
900
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js
|
|
930
901
|
import * as fs7 from "node:fs";
|
|
931
902
|
import * as path6 from "node:path";
|
|
@@ -1227,7 +1198,7 @@ function hasMutationToolCall(messages) {
|
|
|
1227
1198
|
return !1;
|
|
1228
1199
|
}
|
|
1229
1200
|
function evaluateCompletionMutationGuard(input) {
|
|
1230
|
-
let expectedMutation = hasMutationToolCapability(input.tools, input.mcpDirectTools) ? expectsImplementationMutation(input.
|
|
1201
|
+
let expectedMutation = hasMutationToolCapability(input.tools, input.mcpDirectTools) ? expectsImplementationMutation(input.permissions, input.task) : !1, attemptedMutation = hasMutationToolCall(input.messages);
|
|
1231
1202
|
return {
|
|
1232
1203
|
expectedMutation,
|
|
1233
1204
|
attemptedMutation,
|
|
@@ -1260,20 +1231,20 @@ function resolvePiPackageRoot() {
|
|
|
1260
1231
|
return;
|
|
1261
1232
|
}
|
|
1262
1233
|
}
|
|
1263
|
-
function isRunnableNodeScript(filePath,
|
|
1264
|
-
return
|
|
1234
|
+
function isRunnableNodeScript(filePath, existsSync11) {
|
|
1235
|
+
return existsSync11(filePath) ? /\.(?:mjs|cjs|js)$/i.test(filePath) : !1;
|
|
1265
1236
|
}
|
|
1266
1237
|
function normalizePath(filePath) {
|
|
1267
1238
|
return path2.isAbsolute(filePath) ? filePath : path2.resolve(filePath);
|
|
1268
1239
|
}
|
|
1269
1240
|
function resolvePiCliScript(deps = {}) {
|
|
1270
|
-
let
|
|
1241
|
+
let existsSync11 = deps.existsSync ?? fs2.existsSync, realpathSync5 = deps.realpathSync ?? fs2.realpathSync, readFileSync8 = deps.readFileSync ?? ((filePath, encoding) => fs2.readFileSync(filePath, encoding)), argv1 = deps.argv1 ?? process.argv[1];
|
|
1271
1242
|
if (argv1) {
|
|
1272
1243
|
let argvPath = normalizePath(argv1);
|
|
1273
|
-
if (isRunnableNodeScript(argvPath,
|
|
1244
|
+
if (isRunnableNodeScript(argvPath, existsSync11))
|
|
1274
1245
|
try {
|
|
1275
1246
|
let canonicalArgvPath = realpathSync5(argvPath);
|
|
1276
|
-
if (isRunnableNodeScript(canonicalArgvPath,
|
|
1247
|
+
if (isRunnableNodeScript(canonicalArgvPath, existsSync11) && findPiPackageRootFromEntry(canonicalArgvPath))
|
|
1277
1248
|
return canonicalArgvPath;
|
|
1278
1249
|
} catch {
|
|
1279
1250
|
}
|
|
@@ -1291,7 +1262,7 @@ function resolvePiCliScript(deps = {}) {
|
|
|
1291
1262
|
if (!binPath)
|
|
1292
1263
|
return;
|
|
1293
1264
|
let candidate = path2.resolve(path2.dirname(packageJsonPath), binPath);
|
|
1294
|
-
if (isRunnableNodeScript(candidate,
|
|
1265
|
+
if (isRunnableNodeScript(candidate, existsSync11))
|
|
1295
1266
|
return candidate;
|
|
1296
1267
|
} catch {
|
|
1297
1268
|
return;
|
|
@@ -2164,7 +2135,7 @@ ${fullOutput}` : timeoutMessage;
|
|
|
2164
2135
|
${fullOutput}` : note;
|
|
2165
2136
|
}
|
|
2166
2137
|
if ((result2.exitCode === 0 && !result2.error ? evaluateCompletionMutationGuard({
|
|
2167
|
-
|
|
2138
|
+
permissions: spec.effectivePermissions,
|
|
2168
2139
|
task: shared.originalTask ?? task,
|
|
2169
2140
|
messages: result2.messages,
|
|
2170
2141
|
tools: spec.effectivePermissions === "read-only" ? ["read", "grep", "find", "ls", "bash"] : void 0
|
|
@@ -3294,10 +3265,13 @@ function resolveChainToolBudget(input) {
|
|
|
3294
3265
|
return { toolBudget: resolved.budget, error: resolved.error };
|
|
3295
3266
|
}
|
|
3296
3267
|
async function runParallelChainTasks(input) {
|
|
3297
|
-
let concurrency = input.step.concurrency ?? MAX_CONCURRENCY, failFast = input.step.failFast ?? !1, aborted = !1, effectiveModels = input.step.parallel.map((task) => {
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3268
|
+
let concurrency = input.step.concurrency ?? MAX_CONCURRENCY, failFast = input.step.failFast ?? !1, aborted = !1, effectiveModels = input.step.parallel.map((task) => resolveExecutableChildModel({
|
|
3269
|
+
model: task.model,
|
|
3270
|
+
tier: task.tier,
|
|
3271
|
+
thinking: task.thinking,
|
|
3272
|
+
availableModels: input.availableModels,
|
|
3273
|
+
preferredProvider: input.ctx.model?.provider
|
|
3274
|
+
}));
|
|
3301
3275
|
for (let taskIndex = 0; taskIndex < input.step.parallel.length; taskIndex++) {
|
|
3302
3276
|
let task = input.step.parallel[taskIndex];
|
|
3303
3277
|
input.sessionFileForTask?.(task.agent, input.globalTaskIndex + taskIndex, effectiveModels[taskIndex]);
|
|
@@ -3327,9 +3301,10 @@ async function runParallelChainTasks(input) {
|
|
|
3327
3301
|
task: taskStr,
|
|
3328
3302
|
description: task.description,
|
|
3329
3303
|
permissions: task.permissions,
|
|
3330
|
-
model:
|
|
3304
|
+
model: task.model,
|
|
3331
3305
|
tier: task.tier,
|
|
3332
|
-
|
|
3306
|
+
thinking: task.thinking,
|
|
3307
|
+
modelSelection: captureModelSelection({ model: task.model, tier: task.tier }),
|
|
3333
3308
|
skill: task.skill,
|
|
3334
3309
|
cwd: taskCwd,
|
|
3335
3310
|
output: task.output,
|
|
@@ -3834,7 +3809,13 @@ ${failureSummary}`;
|
|
|
3834
3809
|
stepTask = stepTask.replace(/\{task\}/g, originalTask), stepTask = stepTask.replace(/\{previous\}/g, prev), stepTask = stepTask.replace(/\{chain_dir\}/g, chainDir);
|
|
3835
3810
|
let cleanTask = stepTask;
|
|
3836
3811
|
stepTask = prefix + stepTask + suffix;
|
|
3837
|
-
let effectiveModel =
|
|
3812
|
+
let effectiveModel = resolveExecutableChildModel({
|
|
3813
|
+
model: seqStep.model,
|
|
3814
|
+
tier: seqStep.tier,
|
|
3815
|
+
thinking: seqStep.thinking,
|
|
3816
|
+
availableModels,
|
|
3817
|
+
preferredProvider: ctx.model?.provider
|
|
3818
|
+
}), outputPath = typeof behavior.output == "string" ? path6.isAbsolute(behavior.output) ? behavior.output : path6.join(chainDir, behavior.output) : void 0;
|
|
3838
3819
|
stepTask = injectSingleOutputInstruction(stepTask, outputPath, agentConfig);
|
|
3839
3820
|
let validationError = validateFileOnlyOutputMode(behavior.outputMode, outputPath, `Chain step ${stepIndex + 1} (${seqStep.agent})`);
|
|
3840
3821
|
if (validationError)
|
|
@@ -3863,9 +3844,10 @@ ${failureSummary}`;
|
|
|
3863
3844
|
task: stepTask,
|
|
3864
3845
|
description: seqStep.description,
|
|
3865
3846
|
permissions: seqStep.permissions,
|
|
3866
|
-
model:
|
|
3847
|
+
model: seqStep.model,
|
|
3867
3848
|
tier: seqStep.tier,
|
|
3868
|
-
|
|
3849
|
+
thinking: seqStep.thinking,
|
|
3850
|
+
modelSelection: captureModelSelection({ model: seqStep.model, tier: seqStep.tier }),
|
|
3869
3851
|
skill: seqStep.skill,
|
|
3870
3852
|
cwd: seqStep.cwd,
|
|
3871
3853
|
output: seqStep.output,
|
|
@@ -4026,9 +4008,8 @@ function formatAsyncStartedMessage(headline) {
|
|
|
4026
4008
|
return [
|
|
4027
4009
|
headline,
|
|
4028
4010
|
"",
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
'Use subagent({ action: "status", id: "..." }) when you need a one-shot status/result or to inspect a blocked/stale run. To block until completion, prefer subagent_wait(). Do not poll in a loop just to wait.'
|
|
4011
|
+
SUBAGENT_ASYNC_GUIDANCE,
|
|
4012
|
+
'For one-time inspection or recovery of a blocked or stale run, use subagent({ action: "status", id: "..." }).'
|
|
4032
4013
|
].join(`
|
|
4033
4014
|
`);
|
|
4034
4015
|
}
|
|
@@ -4264,7 +4245,14 @@ ${injection}` : injection;
|
|
|
4264
4245
|
taskTemplate = taskTemplate.replace(/\{task\}/g, originalTask ?? ""), taskTemplate = taskTemplate.replace(/\{chain_dir\}/g, runnerCwd);
|
|
4265
4246
|
let taskText = `${readInstructions.prefix}${taskTemplate}${progressInstructions.suffix}`, task = namespaceOutputPath ? taskText : injectSingleOutputInstruction(taskText, outputPath, {
|
|
4266
4247
|
tools: spec.effectivePermissions === "read-only" ? ["read", "grep", "find", "ls", "bash"] : void 0
|
|
4267
|
-
}), primaryModel =
|
|
4248
|
+
}), primaryModel = resolveExecutableChildModel({
|
|
4249
|
+
modelSelection: spec.modelSelection,
|
|
4250
|
+
model: spec.model,
|
|
4251
|
+
tier: spec.tier,
|
|
4252
|
+
thinking: spec.thinking,
|
|
4253
|
+
availableModels,
|
|
4254
|
+
preferredProvider: ctx.currentModelProvider
|
|
4255
|
+
}), thinkingOverride = flatIndex === void 0 ? void 0 : thinkingOverridesByFlatIndex?.[flatIndex], effectiveThinking = thinkingOverride, model = applyThinkingSuffix(primaryModel, effectiveThinking, thinkingOverride !== void 0);
|
|
4268
4256
|
return {
|
|
4269
4257
|
parentSessionId: ctx.parentSessionId ?? ctx.currentSessionId,
|
|
4270
4258
|
parentPermissionMode: snapshotParentPermissionMode(ctx.parentSessionId ?? ctx.currentSessionId),
|
|
@@ -4556,6 +4544,16 @@ function executeAsyncChain(id, params) {
|
|
|
4556
4544
|
details: { mode: resultMode, runId: id, results: [], asyncId: id, asyncDir, workflowGraph, ...params.timeoutMs !== void 0 ? { timeoutMs: params.timeoutMs, deadlineAt } : {}, ...params.turnBudget ? { turnBudget: params.turnBudget } : {}, ...params.toolBudget ? { toolBudget: params.toolBudget } : {} }
|
|
4557
4545
|
};
|
|
4558
4546
|
}
|
|
4547
|
+
function resolveAsyncSingleAcceptance(input) {
|
|
4548
|
+
return input.restoredAcceptance ? input.restoredAcceptance : resolveEffectiveAcceptance({
|
|
4549
|
+
explicit: input.launchAcceptance,
|
|
4550
|
+
agentName: input.agentName,
|
|
4551
|
+
permissions: input.permissions,
|
|
4552
|
+
task: input.task,
|
|
4553
|
+
mode: "single",
|
|
4554
|
+
async: !0
|
|
4555
|
+
});
|
|
4556
|
+
}
|
|
4559
4557
|
function executeAsyncSingle(id, params) {
|
|
4560
4558
|
let { spec, ctx, cwd, maxOutput, artifactsDir, artifactConfig, shareEnabled, sessionRoot, sessionFile, maxSubagentDepth, worktreeSetupHook, worktreeSetupHookTimeoutMs, worktreeBaseDir, controlConfig, controlIntercomTarget, childIntercomTarget, nestedRoute } = params, agent = spec.description, task = spec.task, runnerCwd = resolveChildCwd(ctx.cwd, cwd), skillNames = params.skills ?? (spec.skill === !1 ? [] : normalizeSkillInput(spec.skill) ?? []), availableModels = params.availableModels, { resolved: resolvedSkills, missing: missingSkills } = resolveSkillsWithFallback(skillNames, runnerCwd, ctx.cwd, void 0, runnerCwd);
|
|
4561
4559
|
if (missingSkills.includes("pi-subagents"))
|
|
@@ -4583,19 +4581,25 @@ ${injection}` : injection;
|
|
|
4583
4581
|
let outputMode = params.outputMode ?? spec.outputMode ?? "inline", validationError = validateFileOnlyOutputMode(outputMode, outputPath, `Async single run (${agent})`);
|
|
4584
4582
|
if (validationError)
|
|
4585
4583
|
return formatAsyncStartError("single", validationError);
|
|
4586
|
-
let taskWithOutputInstruction = injectSingleOutputInstruction(task, outputPath, childToolShape), primaryModel =
|
|
4584
|
+
let taskWithOutputInstruction = injectSingleOutputInstruction(task, outputPath, childToolShape), primaryModel = resolveExecutableChildModel({
|
|
4585
|
+
modelSelection: spec.modelSelection,
|
|
4586
|
+
model: spec.model,
|
|
4587
|
+
tier: spec.tier,
|
|
4588
|
+
thinking: spec.thinking,
|
|
4589
|
+
availableModels,
|
|
4590
|
+
preferredProvider: ctx.currentModelProvider
|
|
4591
|
+
}), effectiveThinking = params.thinkingOverride, model = applyThinkingSuffix(primaryModel, effectiveThinking, params.thinkingOverride !== void 0), toolBudgetInput = params.toolBudget ?? spec.toolBudget ?? params.configToolBudget, resolvedToolBudget = validateToolBudgetConfig(toolBudgetInput, params.toolBudget || spec.toolBudget ? "toolBudget" : "config.toolBudget");
|
|
4587
4592
|
if (resolvedToolBudget.error)
|
|
4588
4593
|
return formatAsyncStartError("single", resolvedToolBudget.error);
|
|
4589
4594
|
let deadlineAt = params.absoluteDeadlineAt ?? (params.timeoutMs !== void 0 ? Date.now() + params.timeoutMs : void 0), timeoutMs = params.absoluteDeadlineAt !== void 0 && deadlineAt !== void 0 ? deadlineAt - Date.now() : params.timeoutMs;
|
|
4590
4595
|
if (timeoutMs !== void 0 && timeoutMs <= 0)
|
|
4591
4596
|
return formatAsyncStartError("single", "The source run's absolute deadline expired before recovery could launch.");
|
|
4592
|
-
let initialTurnBudget = params.turnBudget ? initialTurnBudgetState(params.turnBudget) : void 0, resolvedSessionDir = params.sessionDir ?? (sessionRoot ? path7.join(sessionRoot, `async-${id}`) : void 0), resolvedAcceptance =
|
|
4593
|
-
|
|
4597
|
+
let initialTurnBudget = params.turnBudget ? initialTurnBudgetState(params.turnBudget) : void 0, resolvedSessionDir = params.sessionDir ?? (sessionRoot ? path7.join(sessionRoot, `async-${id}`) : void 0), resolvedAcceptance = resolveAsyncSingleAcceptance({
|
|
4598
|
+
restoredAcceptance: params.restoredAcceptance,
|
|
4599
|
+
launchAcceptance: params.acceptance ?? spec.acceptance,
|
|
4594
4600
|
agentName: agent,
|
|
4595
4601
|
permissions: spec.effectivePermissions,
|
|
4596
|
-
task
|
|
4597
|
-
mode: "single",
|
|
4598
|
-
async: !0
|
|
4602
|
+
task
|
|
4599
4603
|
}), recoveryDescriptor = {
|
|
4600
4604
|
version: 4,
|
|
4601
4605
|
lifecycleArtifactVersion: SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
|
|
@@ -4607,8 +4611,8 @@ ${injection}` : injection;
|
|
|
4607
4611
|
...sessionFile ? { sessionFile } : {},
|
|
4608
4612
|
cwd: runnerCwd,
|
|
4609
4613
|
...model ? { model } : {},
|
|
4610
|
-
tier: spec.tier,
|
|
4611
|
-
...effectiveThinking ? { thinking: resolveEffectiveThinking(model, effectiveThinking) } : {},
|
|
4614
|
+
...spec.tier ? { tier: spec.tier } : {},
|
|
4615
|
+
...effectiveThinking || spec.thinking ? { thinking: resolveEffectiveThinking(model, effectiveThinking ?? spec.thinking) } : {},
|
|
4612
4616
|
...spec.modelSelection ? { modelSelection: spec.modelSelection } : {},
|
|
4613
4617
|
...resolvedSkills.length ? { skills: resolvedSkills.map((skill) => skill.name) } : {},
|
|
4614
4618
|
...outputPath ? { outputPath } : {},
|
|
@@ -4643,6 +4647,7 @@ ${injection}` : injection;
|
|
|
4643
4647
|
permissions: spec.effectivePermissions,
|
|
4644
4648
|
agent,
|
|
4645
4649
|
task: taskWithOutputInstruction,
|
|
4650
|
+
completionTask: params.completionTask ?? task,
|
|
4646
4651
|
cwd: runnerCwd,
|
|
4647
4652
|
model,
|
|
4648
4653
|
thinking: resolveEffectiveThinking(model, effectiveThinking),
|
|
@@ -4887,62 +4892,13 @@ function result(text, isError = !1) {
|
|
|
4887
4892
|
function messageFromError(error) {
|
|
4888
4893
|
return error instanceof Error ? error.message : String(error);
|
|
4889
4894
|
}
|
|
4890
|
-
function parseScope(raw) {
|
|
4891
|
-
if (raw === void 0 || raw === "session")
|
|
4892
|
-
return "session";
|
|
4893
|
-
if (raw === "user" || raw === "project")
|
|
4894
|
-
return raw;
|
|
4895
|
-
throw new Error("watchdog.configure scope must be 'session', 'user', or 'project'.");
|
|
4896
|
-
}
|
|
4897
|
-
function parseTarget(params) {
|
|
4898
|
-
let target = params.target ?? "main";
|
|
4899
|
-
if (target === "main")
|
|
4900
|
-
return { kind: "main" };
|
|
4901
|
-
if (target === "children")
|
|
4902
|
-
return { kind: "children" };
|
|
4903
|
-
if (target === "child") {
|
|
4904
|
-
if (!params.agent?.trim())
|
|
4905
|
-
throw new Error("watchdog.configure target='child' requires agent.");
|
|
4906
|
-
return { kind: "child", agent: params.agent.trim() };
|
|
4907
|
-
}
|
|
4908
|
-
throw new Error("watchdog.configure target must be 'main', 'children', or 'child'.");
|
|
4909
|
-
}
|
|
4910
|
-
function parseThinking(raw) {
|
|
4911
|
-
if (raw !== void 0)
|
|
4912
|
-
return raw === "inherit" ? null : parseWatchdogThinkingInput(raw, "watchdog.configure thinking") ?? void 0;
|
|
4913
|
-
}
|
|
4914
|
-
function resolveConfiguredValue(ctx, params) {
|
|
4915
|
-
let thinking = parseThinking(params.thinking), rawModel = params.model?.trim();
|
|
4916
|
-
if (!rawModel) {
|
|
4917
|
-
if (thinking === void 0)
|
|
4918
|
-
throw new Error("watchdog.configure requires model, thinking, or both.");
|
|
4919
|
-
return { thinking, description: `thinking ${thinking === null ? "inherit" : thinking === !1 ? "off" : thinking}` };
|
|
4920
|
-
}
|
|
4921
|
-
if (rawModel === "inherit")
|
|
4922
|
-
return { model: null, thinking: thinking ?? null, description: "inherit" };
|
|
4923
|
-
if (rawModel === "recommended") {
|
|
4924
|
-
let recommendation = recommendStrongWatchdogModel(ctx);
|
|
4925
|
-
return {
|
|
4926
|
-
model: recommendation.model,
|
|
4927
|
-
thinking: recommendation.thinking,
|
|
4928
|
-
description: `${recommendation.model}:${recommendation.thinking}`
|
|
4929
|
-
};
|
|
4930
|
-
}
|
|
4931
|
-
let resolved = resolveWatchdogModelInput(ctx, rawModel);
|
|
4932
|
-
return {
|
|
4933
|
-
model: resolved.model,
|
|
4934
|
-
thinking: resolved.thinking ?? thinking,
|
|
4935
|
-
description: `${resolved.model}${resolved.thinking ?? thinking ? `:${resolved.thinking ?? thinking}` : ""}`
|
|
4936
|
-
};
|
|
4937
|
-
}
|
|
4938
4895
|
function buildRecommendationText(ctx) {
|
|
4939
4896
|
let recommendation = recommendStrongWatchdogModel(ctx);
|
|
4940
4897
|
return [
|
|
4941
4898
|
"Subagent watchdog recommended model",
|
|
4942
4899
|
`Recommended: ${recommendation.model}:${recommendation.thinking}`,
|
|
4943
4900
|
`Reason: ${recommendation.reason}`,
|
|
4944
|
-
|
|
4945
|
-
'Persist with scope: "project" or scope: "user" only when the user asks for that scope.'
|
|
4901
|
+
"Watchdog settings are user-managed through /subagents-watchdog."
|
|
4946
4902
|
].join(`
|
|
4947
4903
|
`);
|
|
4948
4904
|
}
|
|
@@ -4969,44 +4925,14 @@ function buildCheckText(runtime, ctx) {
|
|
|
4969
4925
|
return lines.join(`
|
|
4970
4926
|
`);
|
|
4971
4927
|
}
|
|
4972
|
-
function handleWatchdogToolAction(action,
|
|
4928
|
+
function handleWatchdogToolAction(action, _params, ctx, runtime) {
|
|
4973
4929
|
try {
|
|
4974
|
-
|
|
4975
|
-
return runtime ? result(buildWatchdogStatus(runtime.getSnapshot(ctx.cwd), ctx)) : result("Subagent watchdog runtime is unavailable.", !0);
|
|
4976
|
-
if (action === "watchdog.recommend-model")
|
|
4977
|
-
return result(buildRecommendationText(ctx));
|
|
4978
|
-
if (action === "watchdog.check")
|
|
4979
|
-
return result(buildCheckText(runtime, ctx));
|
|
4980
|
-
if (action !== "watchdog.configure")
|
|
4981
|
-
return result(`Unknown watchdog action: ${action}`, !0);
|
|
4982
|
-
let scope = parseScope(params.scope), target = parseTarget(params), value = resolveConfiguredValue(ctx, params);
|
|
4983
|
-
if (scope === "session")
|
|
4984
|
-
return runtime ? target.kind !== "main" ? result("Session-scoped watchdog.configure currently supports target='main' only.", !0) : (runtime.setSessionModel({ model: value.model, thinking: value.thinking }, ctx.cwd), result([
|
|
4985
|
-
`Subagent watchdog session model configured: ${value.description}.`,
|
|
4986
|
-
"No settings files were changed.",
|
|
4987
|
-
"",
|
|
4988
|
-
buildWatchdogStatus(runtime.getSnapshot(ctx.cwd), ctx)
|
|
4989
|
-
].join(`
|
|
4990
|
-
`))) : result("Subagent watchdog runtime is unavailable.", !0);
|
|
4991
|
-
let settingsPath = writeWatchdogModelSettings({
|
|
4992
|
-
scope,
|
|
4993
|
-
cwd: ctx.cwd,
|
|
4994
|
-
target,
|
|
4995
|
-
model: value.model,
|
|
4996
|
-
thinking: value.thinking
|
|
4997
|
-
});
|
|
4998
|
-
runtime?.refreshConfig(ctx.cwd);
|
|
4999
|
-
let targetLabel = target.kind === "child" ? `child ${target.agent}` : target.kind;
|
|
5000
|
-
return result([
|
|
5001
|
-
`Subagent watchdog ${targetLabel} model configured: ${value.description}.`,
|
|
5002
|
-
`Updated: ${settingsPath}`
|
|
5003
|
-
].join(`
|
|
5004
|
-
`));
|
|
4930
|
+
return action === "watchdog.status" ? runtime ? result(buildWatchdogStatus(runtime.getSnapshot(ctx.cwd), ctx)) : result("Subagent watchdog runtime is unavailable.", !0) : action === "watchdog.recommend-model" ? result(buildRecommendationText(ctx)) : action === "watchdog.check" ? result(buildCheckText(runtime, ctx)) : result(`Unknown watchdog action: ${action}`, !0);
|
|
5005
4931
|
} catch (error) {
|
|
5006
4932
|
return result(`Subagent watchdog action failed: ${messageFromError(error)}`, !0);
|
|
5007
4933
|
}
|
|
5008
4934
|
}
|
|
5009
|
-
var WATCHDOG_TOOL_ACTIONS = ["watchdog.status", "watchdog.check", "watchdog.
|
|
4935
|
+
var WATCHDOG_TOOL_ACTIONS = ["watchdog.status", "watchdog.check", "watchdog.recommend-model"];
|
|
5010
4936
|
|
|
5011
4937
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/chain-append.js
|
|
5012
4938
|
import { randomUUID } from "node:crypto";
|
|
@@ -5488,81 +5414,11 @@ function resolveAsyncRootResultPath(resultsDir, runId) {
|
|
|
5488
5414
|
return path13.join(resultsDir, `${runId}.json`);
|
|
5489
5415
|
}
|
|
5490
5416
|
|
|
5491
|
-
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/run-
|
|
5417
|
+
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js
|
|
5492
5418
|
import * as fs14 from "node:fs";
|
|
5493
5419
|
import * as path14 from "node:path";
|
|
5494
|
-
function exactAsyncLocation(id, asyncDirRoot, resultsDir) {
|
|
5495
|
-
let asyncDir = path14.join(asyncDirRoot, id), resultPath = path14.join(resultsDir, `${id}.json`);
|
|
5496
|
-
if (!(!fs14.existsSync(asyncDir) && !fs14.existsSync(resultPath)))
|
|
5497
|
-
return {
|
|
5498
|
-
asyncDir: fs14.existsSync(asyncDir) ? asyncDir : null,
|
|
5499
|
-
resultPath: fs14.existsSync(resultPath) ? resultPath : null,
|
|
5500
|
-
resolvedId: id
|
|
5501
|
-
};
|
|
5502
|
-
}
|
|
5503
|
-
function foregroundIds(state) {
|
|
5504
|
-
if (!state)
|
|
5505
|
-
return [];
|
|
5506
|
-
let remembered = state.currentSessionId ? [...state.foregroundRuns?.values() ?? []].filter((run) => run.sessionId === state.currentSessionId).map((run) => run.runId) : [];
|
|
5507
|
-
return [.../* @__PURE__ */ new Set([...state.foregroundControls.keys(), ...remembered])];
|
|
5508
|
-
}
|
|
5509
|
-
function hasExactForegroundId(state, id) {
|
|
5510
|
-
if (!state)
|
|
5511
|
-
return !1;
|
|
5512
|
-
if (state.foregroundControls.has(id))
|
|
5513
|
-
return !0;
|
|
5514
|
-
let remembered = state.foregroundRuns?.get(id);
|
|
5515
|
-
return !!(remembered && state.currentSessionId && remembered.sessionId === state.currentSessionId);
|
|
5516
|
-
}
|
|
5517
|
-
function nestedScopeFromState(state) {
|
|
5518
|
-
if (!state)
|
|
5519
|
-
return;
|
|
5520
|
-
let routes = [], seen = /* @__PURE__ */ new Set(), add = (route) => {
|
|
5521
|
-
if (!route)
|
|
5522
|
-
return;
|
|
5523
|
-
let key = `${route.rootRunId}:${route.eventSink}:${route.controlInbox}`;
|
|
5524
|
-
seen.has(key) || (seen.add(key), routes.push(route));
|
|
5525
|
-
};
|
|
5526
|
-
for (let control of state.foregroundControls.values())
|
|
5527
|
-
add(control.nestedRoute);
|
|
5528
|
-
for (let job of state.asyncJobs.values())
|
|
5529
|
-
add(job.nestedRoute);
|
|
5530
|
-
return { routes };
|
|
5531
|
-
}
|
|
5532
|
-
function asyncPrefixMatches(prefix, asyncDirRoot, resultsDir) {
|
|
5533
|
-
return findAsyncRunPrefixMatches(prefix, asyncDirRoot, resultsDir);
|
|
5534
|
-
}
|
|
5535
|
-
function resolveSubagentRunId(id, deps = {}) {
|
|
5536
|
-
assertSafeNestedId("id", id);
|
|
5537
|
-
let asyncDirRoot = deps.asyncDirRoot ?? ASYNC_DIR, resultsDir = deps.resultsDir ?? RESULTS_DIR, nestedScope = deps.nested ?? nestedScopeFromState(deps.state);
|
|
5538
|
-
if (hasExactForegroundId(deps.state, id))
|
|
5539
|
-
return { kind: "foreground", id };
|
|
5540
|
-
let exactAsync = exactAsyncLocation(id, asyncDirRoot, resultsDir);
|
|
5541
|
-
if (exactAsync)
|
|
5542
|
-
return { kind: "async", id, location: exactAsync };
|
|
5543
|
-
let exactNested = findNestedRunMatchesById(id, nestedScope ? { scope: nestedScope } : {});
|
|
5544
|
-
if (exactNested.length > 1)
|
|
5545
|
-
throw new Error(`Nested run id '${id}' is ambiguous across authorized registries. Provide the full id after stale registries are cleaned up.`);
|
|
5546
|
-
if (exactNested[0])
|
|
5547
|
-
return { kind: "nested", id, match: exactNested[0] };
|
|
5548
|
-
let matches = [];
|
|
5549
|
-
for (let foregroundId of foregroundIds(deps.state).filter((candidate) => candidate.startsWith(id)))
|
|
5550
|
-
matches.push({ kind: "foreground", id: foregroundId });
|
|
5551
|
-
for (let match of asyncPrefixMatches(id, asyncDirRoot, resultsDir))
|
|
5552
|
-
matches.push({ kind: "async", id: match.id, location: match.location });
|
|
5553
|
-
for (let match of findNestedRunMatchesById(id, nestedScope ? { prefix: !0, scope: nestedScope } : { prefix: !0 }))
|
|
5554
|
-
matches.push({ kind: "nested", id: match.run.id, match });
|
|
5555
|
-
let values = [...new Map(matches.map((match) => [`${match.kind}:${match.id}`, match])).values()];
|
|
5556
|
-
if (values.length > 1)
|
|
5557
|
-
throw new Error(`Ambiguous subagent run id prefix '${id}' matched: ${values.map((match) => `${match.kind}:${match.id}`).join(", ")}. Provide a longer id.`);
|
|
5558
|
-
return values[0];
|
|
5559
|
-
}
|
|
5560
|
-
|
|
5561
|
-
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js
|
|
5562
|
-
import * as fs15 from "node:fs";
|
|
5563
|
-
import * as path15 from "node:path";
|
|
5564
5420
|
function hasExistingSessionFile(value) {
|
|
5565
|
-
return typeof value == "string" &&
|
|
5421
|
+
return typeof value == "string" && fs14.existsSync(value);
|
|
5566
5422
|
}
|
|
5567
5423
|
function formatResumeGuidance(runId, children, fallbackSessionFile, options = {}) {
|
|
5568
5424
|
if (options.stopped)
|
|
@@ -5598,9 +5454,9 @@ function formatSteeringSummary(input) {
|
|
|
5598
5454
|
}
|
|
5599
5455
|
function rememberedForegroundChildOutput(child) {
|
|
5600
5456
|
let outputPath = child.artifactPaths?.outputPath ?? child.savedOutputPath;
|
|
5601
|
-
if (outputPath &&
|
|
5457
|
+
if (outputPath && fs14.existsSync(outputPath))
|
|
5602
5458
|
try {
|
|
5603
|
-
let artifactOutput =
|
|
5459
|
+
let artifactOutput = fs14.readFileSync(outputPath, "utf-8").trim();
|
|
5604
5460
|
if (artifactOutput)
|
|
5605
5461
|
return artifactOutput;
|
|
5606
5462
|
} catch {
|
|
@@ -5773,7 +5629,7 @@ function inspectSubagentStatus(params, deps = {}) {
|
|
|
5773
5629
|
details: { mode: "single", results: [] }
|
|
5774
5630
|
};
|
|
5775
5631
|
}
|
|
5776
|
-
let status = reconciliation.status, effectiveRunId = status?.runId ?? resolvedId ?? "unknown", logPath =
|
|
5632
|
+
let status = reconciliation.status, effectiveRunId = status?.runId ?? resolvedId ?? "unknown", logPath = path14.join(asyncDir, `subagent-log-${effectiveRunId}.md`), eventsPath = path14.join(asyncDir, "events.jsonl");
|
|
5777
5633
|
if (status) {
|
|
5778
5634
|
if (params.view === "transcript") {
|
|
5779
5635
|
if (currentSessionId && status.sessionId !== currentSessionId)
|
|
@@ -5817,22 +5673,22 @@ function inspectSubagentStatus(params, deps = {}) {
|
|
|
5817
5673
|
`Dir: ${asyncDir}`,
|
|
5818
5674
|
outputPath ? `Output: ${outputPath}` : void 0,
|
|
5819
5675
|
reconciliation.message ? `Diagnosis: ${reconciliation.message}` : void 0,
|
|
5820
|
-
reconciliation.resultPath &&
|
|
5676
|
+
reconciliation.resultPath && fs14.existsSync(reconciliation.resultPath) ? `Result: ${reconciliation.resultPath}` : void 0
|
|
5821
5677
|
].filter((line) => !!line);
|
|
5822
5678
|
for (let [index, step] of (status.steps ?? []).entries()) {
|
|
5823
5679
|
let stepActivityText = step.status === "running" ? formatActivityLabel(step.lastActivityAt, step.activityState) : void 0, modelThinking = formatModelSelection(step.modelSelection, step.model, step.thinking), modelText = modelThinking ? ` (${modelThinking})` : "", steeringText2 = formatSteeringSummary(step), steeringSuffix = steeringText2 ? `, steering: ${steeringText2}` : "", errorText2 = step.error ? `, error: ${step.error}` : "", acceptanceText = step.acceptance?.status ? `, acceptance: ${step.acceptance.status}` : "", budgetText = step.turnBudget ? `, turn budget: ${step.turnBudget.turnCount}/${step.turnBudget.maxTurns}+${step.turnBudget.graceTurns} (${step.turnBudget.outcome})` : "", display = step.label ? `${step.label} (${step.agent})` : step.agent, phase = step.phase ? `[${step.phase}] ` : "";
|
|
5824
5680
|
lines.push(`${stepLineLabel(status, index)}: ${phase}${display} ${step.status}${modelText}${stepActivityText ? `, ${stepActivityText}` : ""}${steeringSuffix}${acceptanceText}${budgetText}${errorText2}`), lines.push(...formatNestedRunStatusLines(step.children, { indent: " ", commandHints: !0, maxLines: 20 }));
|
|
5825
|
-
let stepOutputPath =
|
|
5826
|
-
stepOutputPath !== outputPath &&
|
|
5681
|
+
let stepOutputPath = path14.join(asyncDir, `output-${index}.log`);
|
|
5682
|
+
stepOutputPath !== outputPath && fs14.existsSync(stepOutputPath) && lines.push(` Output: ${stepOutputPath}`), step.status === "running" && (lines.push(` Intercom target: ${resolveSubagentIntercomTarget(status.runId, step.childId ?? step.agent, index)} (if registered)`), lines.push(` Steer: subagent({ action: "steer", id: "${status.runId}", index: ${index}, message: "..." })`));
|
|
5827
5683
|
}
|
|
5828
5684
|
let attached = new Set((status.steps ?? []).flatMap((step) => step.children?.map((child) => child.id) ?? [])), unattached = nestedChildren.filter((child) => !attached.has(child.id));
|
|
5829
|
-
return lines.push(...formatNestedRunStatusLines(unattached, { indent: "", commandHints: !0, maxLines: 20 })), nestedWarning && lines.push(`Warning: ${nestedWarning}`), status.sessionFile && lines.push(`Session: ${status.sessionFile}`), status.state === "running" && lines.push(`Steer running child: subagent({ action: "steer", id: "${status.runId}", message: "..." })`), status.state !== "running" && lines.push(formatResumeGuidance(status.runId, status.steps ?? [], status.sessionFile, { stopped: status.state === "stopped" || status.stopped === !0 })),
|
|
5685
|
+
return lines.push(...formatNestedRunStatusLines(unattached, { indent: "", commandHints: !0, maxLines: 20 })), nestedWarning && lines.push(`Warning: ${nestedWarning}`), status.sessionFile && lines.push(`Session: ${status.sessionFile}`), status.state === "running" && lines.push(`Steer running child: subagent({ action: "steer", id: "${status.runId}", message: "..." })`), status.state !== "running" && lines.push(formatResumeGuidance(status.runId, status.steps ?? [], status.sessionFile, { stopped: status.state === "stopped" || status.stopped === !0 })), fs14.existsSync(logPath) && lines.push(`Log: ${logPath}`), fs14.existsSync(eventsPath) && lines.push(`Events: ${eventsPath}`), { content: [{ type: "text", text: lines.join(`
|
|
5830
5686
|
`) }], details: { mode: "single", results: [] } };
|
|
5831
5687
|
}
|
|
5832
5688
|
}
|
|
5833
5689
|
if (resultPath)
|
|
5834
5690
|
try {
|
|
5835
|
-
let raw =
|
|
5691
|
+
let raw = fs14.readFileSync(resultPath, "utf-8"), data = JSON.parse(raw);
|
|
5836
5692
|
if (params.view === "transcript")
|
|
5837
5693
|
try {
|
|
5838
5694
|
return { content: [{ type: "text", text: formatAsyncResultTranscript(data, resultPath, { index: params.index, lines: params.lines }) }], details: { mode: "single", results: [] } };
|
|
@@ -5856,15 +5712,10 @@ function inspectSubagentStatus(params, deps = {}) {
|
|
|
5856
5712
|
};
|
|
5857
5713
|
}
|
|
5858
5714
|
|
|
5859
|
-
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js
|
|
5860
|
-
function applyForceTopLevelAsyncOverride(params, depth, forceTopLevelAsync) {
|
|
5861
|
-
return params.foregroundOnly || !(depth === 0 && forceTopLevelAsync) ? params : { ...params, async: !0, clarify: !1 };
|
|
5862
|
-
}
|
|
5863
|
-
|
|
5864
5715
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js
|
|
5865
|
-
var MUTATING_MANAGEMENT_ACTIONS = /* @__PURE__ */ new Set(["create", "update", "delete", "eject", "disable", "enable", "reset"
|
|
5716
|
+
var MUTATING_MANAGEMENT_ACTIONS = /* @__PURE__ */ new Set(["create", "update", "delete", "eject", "disable", "enable", "reset"]);
|
|
5866
5717
|
function resolveRequestedCwd(runtimeCwd, requestedCwd) {
|
|
5867
|
-
return requestedCwd ?
|
|
5718
|
+
return requestedCwd ? path15.resolve(runtimeCwd, requestedCwd) : runtimeCwd;
|
|
5868
5719
|
}
|
|
5869
5720
|
function getForegroundControl(state, runId) {
|
|
5870
5721
|
if (runId)
|
|
@@ -5896,7 +5747,7 @@ function nestedResolutionScopeForExecutor(deps) {
|
|
|
5896
5747
|
};
|
|
5897
5748
|
}
|
|
5898
5749
|
function trustedSessionRootsForStatus(ctx, deps) {
|
|
5899
|
-
let roots = deps.config.defaultSessionDir ? [
|
|
5750
|
+
let roots = deps.config.defaultSessionDir ? [path15.resolve(deps.expandTilde(deps.config.defaultSessionDir))] : [], parentSessionFile = ctx.sessionManager.getSessionFile() ?? null;
|
|
5900
5751
|
return parentSessionFile && roots.push(deps.getSubagentSessionRoot(parentSessionFile)), [...new Set(roots)];
|
|
5901
5752
|
}
|
|
5902
5753
|
function reserveSubagentSpawns(input) {
|
|
@@ -6043,10 +5894,10 @@ function resolveForegroundResumeTarget(params, state) {
|
|
|
6043
5894
|
let child = run.children[index];
|
|
6044
5895
|
if (!child.sessionFile)
|
|
6045
5896
|
throw new Error(`Foreground run '${run.runId}' child ${index} does not have a persisted session file to resume from.`);
|
|
6046
|
-
if (
|
|
5897
|
+
if (path15.extname(child.sessionFile) !== ".jsonl")
|
|
6047
5898
|
throw new Error(`Foreground run '${run.runId}' child ${index} session file must be a .jsonl file: ${child.sessionFile}`);
|
|
6048
|
-
let sessionFile =
|
|
6049
|
-
if (!
|
|
5899
|
+
let sessionFile = path15.resolve(child.sessionFile);
|
|
5900
|
+
if (!fs15.existsSync(sessionFile))
|
|
6050
5901
|
throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}`);
|
|
6051
5902
|
return { runId: run.runId, mode: run.mode, state: "complete", agent: child.agent, index, intercomTarget: resolveSubagentIntercomTarget(run.runId, child.agent, index), cwd: run.cwd, sessionFile };
|
|
6052
5903
|
}
|
|
@@ -6101,7 +5952,7 @@ function resolveResumeTarget(params, state, options = {}) {
|
|
|
6101
5952
|
function getAsyncInterruptTarget(state, runId, location, options = {}) {
|
|
6102
5953
|
if (location?.asyncDir)
|
|
6103
5954
|
return {
|
|
6104
|
-
asyncId: location.resolvedId ?? runId ??
|
|
5955
|
+
asyncId: location.resolvedId ?? runId ?? path15.basename(location.asyncDir),
|
|
6105
5956
|
asyncDir: location.asyncDir
|
|
6106
5957
|
};
|
|
6107
5958
|
if (runId) {
|
|
@@ -6366,27 +6217,27 @@ function nestedRunAgent(run) {
|
|
|
6366
6217
|
return run.agent ?? run.agents?.[0] ?? (run.steps?.length === 1 ? run.steps[0]?.agent : void 0);
|
|
6367
6218
|
}
|
|
6368
6219
|
function pathWithin(base, candidate) {
|
|
6369
|
-
let resolvedBase =
|
|
6370
|
-
return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${
|
|
6220
|
+
let resolvedBase = path15.resolve(base), resolvedCandidate = path15.resolve(candidate);
|
|
6221
|
+
return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${path15.sep}`);
|
|
6371
6222
|
}
|
|
6372
6223
|
function validateNestedSessionFile(run, trustedSessionRoots) {
|
|
6373
6224
|
let sessionFile = nestedRunSessionFile(run);
|
|
6374
6225
|
if (!sessionFile)
|
|
6375
6226
|
throw new Error(`Nested run '${run.id}' does not have a persisted session file to resume from.`);
|
|
6376
|
-
if (
|
|
6227
|
+
if (path15.extname(sessionFile) !== ".jsonl")
|
|
6377
6228
|
throw new Error(`Nested run '${run.id}' session file must be a .jsonl file: ${sessionFile}`);
|
|
6378
|
-
let resolved =
|
|
6379
|
-
if (!
|
|
6229
|
+
let resolved = path15.resolve(sessionFile);
|
|
6230
|
+
if (!path15.isAbsolute(sessionFile))
|
|
6380
6231
|
throw new Error(`Nested run '${run.id}' session file must be absolute: ${sessionFile}`);
|
|
6381
|
-
if (!
|
|
6232
|
+
if (!fs15.existsSync(resolved))
|
|
6382
6233
|
throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}`);
|
|
6383
|
-
let stat =
|
|
6234
|
+
let stat = fs15.lstatSync(resolved);
|
|
6384
6235
|
if (!stat.isFile() || stat.isSymbolicLink())
|
|
6385
6236
|
throw new Error(`Nested run '${run.id}' session file is not a regular file: ${sessionFile}`);
|
|
6386
|
-
let realSessionFile =
|
|
6387
|
-
if (!trustedSessionRoots.filter((root) =>
|
|
6237
|
+
let realSessionFile = fs15.realpathSync(resolved);
|
|
6238
|
+
if (!trustedSessionRoots.filter((root) => fs15.existsSync(root)).map((root) => fs15.realpathSync(root)).some((root) => pathWithin(root, realSessionFile)))
|
|
6388
6239
|
throw new Error(`Nested run '${run.id}' session file is outside trusted nested session roots: ${sessionFile}`);
|
|
6389
|
-
if (!realSessionFile.split(
|
|
6240
|
+
if (!realSessionFile.split(path15.sep).includes(run.id))
|
|
6390
6241
|
throw new Error(`Nested run '${run.id}' session file is not under that nested run's session directory: ${sessionFile}`);
|
|
6391
6242
|
return realSessionFile;
|
|
6392
6243
|
}
|
|
@@ -6406,7 +6257,7 @@ function resolveNestedResumeTarget(match, trustedSessionRoots) {
|
|
|
6406
6257
|
agent,
|
|
6407
6258
|
index: 0,
|
|
6408
6259
|
intercomTarget: resolveSubagentIntercomTarget(run.id, agent, 0),
|
|
6409
|
-
cwd: asyncDir ?
|
|
6260
|
+
cwd: asyncDir ? path15.dirname(asyncDir) : void 0,
|
|
6410
6261
|
sessionFile: validateNestedSessionFile(run, trustedSessionRoots)
|
|
6411
6262
|
};
|
|
6412
6263
|
}
|
|
@@ -6433,7 +6284,7 @@ function directNestedAsyncInterrupt(target) {
|
|
|
6433
6284
|
let run = target.match.run, asyncDir = resolveNestedAsyncDir(target.match.rootRunId, run);
|
|
6434
6285
|
if (!asyncDir)
|
|
6435
6286
|
return;
|
|
6436
|
-
let status = reconcileAsyncRun(asyncDir, { resultsDir:
|
|
6287
|
+
let status = reconcileAsyncRun(asyncDir, { resultsDir: path15.join(RESULTS_DIR, "nested", target.match.rootRunId) }).status, pid = typeof status?.pid == "number" && status.pid > 0 ? status.pid : run.pid;
|
|
6437
6288
|
if (!(!status || status.state !== "running" || typeof pid != "number" || pid <= 0))
|
|
6438
6289
|
try {
|
|
6439
6290
|
return deliverInterruptRequest({ asyncDir, pid, source: "nested-interrupt" }), { content: [{ type: "text", text: `Interrupt requested for nested async run ${run.id}.` }], details: { mode: "management", results: [] } };
|
|
@@ -6446,7 +6297,7 @@ async function directNestedAsyncSteer(input) {
|
|
|
6446
6297
|
let run = input.target.match.run, asyncDir = resolveNestedAsyncDir(input.target.match.rootRunId, run);
|
|
6447
6298
|
if (!asyncDir)
|
|
6448
6299
|
return;
|
|
6449
|
-
let status = reconcileAsyncRun(asyncDir, { resultsDir:
|
|
6300
|
+
let status = reconcileAsyncRun(asyncDir, { resultsDir: path15.join(RESULTS_DIR, "nested", input.target.match.rootRunId) }).status;
|
|
6450
6301
|
if (!status || status.state !== "running" && status.state !== "queued")
|
|
6451
6302
|
return;
|
|
6452
6303
|
let steps = status.steps ?? [];
|
|
@@ -6540,7 +6391,7 @@ async function resumeAsyncRun(input) {
|
|
|
6540
6391
|
if (resolved.match.run.state === "running" || resolved.match.run.state === "queued")
|
|
6541
6392
|
return resumeLiveNestedRun({ target: resolved, message: followUp });
|
|
6542
6393
|
let trustedSessionRoots = [
|
|
6543
|
-
...input.deps.config.defaultSessionDir ? [
|
|
6394
|
+
...input.deps.config.defaultSessionDir ? [path15.resolve(input.deps.expandTilde(input.deps.config.defaultSessionDir))] : [],
|
|
6544
6395
|
...parentSessionFile ? [input.deps.getSubagentSessionRoot(parentSessionFile)] : []
|
|
6545
6396
|
];
|
|
6546
6397
|
target = resolveNestedResumeTarget(resolved, trustedSessionRoots);
|
|
@@ -6605,7 +6456,7 @@ ${followUp}`, 500, { source: "async-resume", runId: target.runId, agent: target.
|
|
|
6605
6456
|
goal,
|
|
6606
6457
|
attachRoot: {
|
|
6607
6458
|
runId: target.runId,
|
|
6608
|
-
asyncDir: target.asyncDir ??
|
|
6459
|
+
asyncDir: target.asyncDir ?? path15.join(ASYNC_DIR, target.runId),
|
|
6609
6460
|
resultPath: resolveAsyncRootResultPath(RESULTS_DIR, target.runId),
|
|
6610
6461
|
index: target.index,
|
|
6611
6462
|
agent: target.agent,
|
|
@@ -6651,32 +6502,43 @@ ${followUp}`, 500, { source: "async-resume", runId: target.runId, agent: target.
|
|
|
6651
6502
|
return { content: [{ type: "text", text: formatAsyncStartedMessage(lines2.join(`
|
|
6652
6503
|
`)) }], details: result3.details };
|
|
6653
6504
|
}
|
|
6654
|
-
let runId = randomUUID4().slice(0, 8), artifactConfig = recoveryDescriptor?.artifactConfig ?? { ...DEFAULT_ARTIFACT_CONFIG, enabled: input.params.artifacts !== !1 }, artifactsDir = recoveryDescriptor?.artifactsDir ?? getArtifactsDir(parentSessionFile, effectiveCwd), availableModels = input.ctx.modelRegistry.getAvailable().map(toModelInfo),
|
|
6505
|
+
let runId = randomUUID4().slice(0, 8), artifactConfig = recoveryDescriptor?.artifactConfig ?? { ...DEFAULT_ARTIFACT_CONFIG, enabled: input.params.artifacts !== !1 }, artifactsDir = recoveryDescriptor?.artifactsDir ?? getArtifactsDir(parentSessionFile, effectiveCwd), availableModels = input.ctx.modelRegistry.getAvailable().map(toModelInfo), restoredAcceptance;
|
|
6506
|
+
if (recoveryDescriptor?.acceptance !== void 0 && input.params.acceptance === void 0)
|
|
6507
|
+
try {
|
|
6508
|
+
restoredAcceptance = restorePersistedAcceptance(recoveryDescriptor.acceptance, "recoveryDescriptor.acceptance");
|
|
6509
|
+
} catch (error) {
|
|
6510
|
+
return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: !0, details: { mode: "management", results: [] } };
|
|
6511
|
+
}
|
|
6512
|
+
let recoverySpec;
|
|
6655
6513
|
try {
|
|
6514
|
+
let recoverySelection = recoveryDescriptor?.modelSelection ?? target.modelSelection, recoveryIsExplicitModel = recoverySelection?.kind === "model";
|
|
6656
6515
|
recoverySpec = normalizeChildSpec({
|
|
6657
6516
|
task: buildRevivedAsyncTask(target, followUp),
|
|
6658
6517
|
description: recoveryDescriptor?.description ?? target.description ?? target.agent,
|
|
6659
6518
|
permissions: recoveryDescriptor?.permissions ?? target.permissions ?? "read-only",
|
|
6660
|
-
model: recoveryDescriptor?.model ?? target.model,
|
|
6661
|
-
tier: input.params.tier ??
|
|
6662
|
-
|
|
6519
|
+
model: recoveryIsExplicitModel ? recoverySelection.model ?? recoveryDescriptor?.model ?? target.model : void 0,
|
|
6520
|
+
tier: recoveryIsExplicitModel ? void 0 : input.params.tier ?? recoverySelection?.tier ?? recoveryDescriptor?.tier,
|
|
6521
|
+
thinking: recoveryIsExplicitModel ? recoveryDescriptor?.thinking ?? target.thinking : void 0,
|
|
6522
|
+
modelSelection: recoverySelection,
|
|
6663
6523
|
skill: recoveryDescriptor?.skills,
|
|
6664
6524
|
cwd: effectiveCwd,
|
|
6665
6525
|
output: recoveryDescriptor?.outputPath,
|
|
6666
6526
|
outputMode: recoveryDescriptor?.outputMode,
|
|
6667
|
-
acceptance: input.params.acceptance
|
|
6527
|
+
acceptance: input.params.acceptance,
|
|
6668
6528
|
toolBudget: recoveryDescriptor?.initialToolBudget
|
|
6669
6529
|
}, {
|
|
6670
6530
|
parentMode: snapshotParentPermissionMode(input.deps.state.currentSessionId),
|
|
6671
6531
|
runId,
|
|
6672
6532
|
index: 0,
|
|
6673
|
-
childId: recoveryDescriptor?.childId ?? target.childId ?? `${runId}-0
|
|
6533
|
+
childId: recoveryDescriptor?.childId ?? target.childId ?? `${runId}-0`,
|
|
6534
|
+
resolvedModelIsRuntime: !recoveryIsExplicitModel && !!(recoveryDescriptor?.model ?? target.model)
|
|
6674
6535
|
});
|
|
6675
6536
|
} catch (error) {
|
|
6676
6537
|
return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: !0, details: { mode: "management", results: [] } };
|
|
6677
6538
|
}
|
|
6678
6539
|
let result2 = executeAsyncSingle(runId, {
|
|
6679
6540
|
spec: recoverySpec,
|
|
6541
|
+
completionTask: followUp,
|
|
6680
6542
|
goal: followUp,
|
|
6681
6543
|
ctx: {
|
|
6682
6544
|
pi: input.deps.pi,
|
|
@@ -6716,7 +6578,7 @@ ${followUp}`, 500, { source: "async-resume", runId: target.runId, agent: target.
|
|
|
6716
6578
|
output: recoveryDescriptor?.outputPath,
|
|
6717
6579
|
outputMode: recoveryDescriptor?.outputMode,
|
|
6718
6580
|
...recoveryDescriptor?.skills ? { skills: [...recoveryDescriptor.skills] } : {},
|
|
6719
|
-
...
|
|
6581
|
+
...restoredAcceptance ? { restoredAcceptance } : {},
|
|
6720
6582
|
...input.params.timeoutMs !== void 0 ? { timeoutMs: input.params.timeoutMs } : {},
|
|
6721
6583
|
...input.absoluteDeadlineAt !== void 0 ? { absoluteDeadlineAt: input.absoluteDeadlineAt } : {},
|
|
6722
6584
|
...input.params.turnBudget !== void 0 ? { turnBudget: input.params.turnBudget } : {},
|
|
@@ -6984,6 +6846,7 @@ function internalizePromptDrivenChildren(params, options) {
|
|
|
6984
6846
|
cwd: params.cwd,
|
|
6985
6847
|
model: params.model,
|
|
6986
6848
|
tier: params.tier,
|
|
6849
|
+
thinking: params.thinking,
|
|
6987
6850
|
skill: params.skill,
|
|
6988
6851
|
output: params.output,
|
|
6989
6852
|
outputMode: params.outputMode,
|
|
@@ -7328,13 +7191,21 @@ function runAsyncPath(data, deps) {
|
|
|
7328
7191
|
isError: !0,
|
|
7329
7192
|
details: { mode: "single", results: [] }
|
|
7330
7193
|
};
|
|
7331
|
-
let rawOutput = params.output !== void 0 ? params.output : a.output, effectiveOutput = normalizeSingleOutputOverride(rawOutput, a.output), effectiveOutputMode = params.outputMode ?? "inline", normalizedSkills = normalizeSkillInput(params.skill), skills = normalizedSkills === !1 ? [] : normalizedSkills, maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, a.maxSubagentDepth),
|
|
7194
|
+
let rawOutput = params.output !== void 0 ? params.output : a.output, effectiveOutput = normalizeSingleOutputOverride(rawOutput, a.output), effectiveOutputMode = params.outputMode ?? "inline", normalizedSkills = normalizeSkillInput(params.skill), skills = normalizedSkills === !1 ? [] : normalizedSkills, maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, a.maxSubagentDepth), modelSelection = captureModelSelection({ model: params.model, tier: params.tier }), modelOverride = resolveExecutableChildModel({
|
|
7195
|
+
modelSelection,
|
|
7196
|
+
model: params.model,
|
|
7197
|
+
tier: params.tier,
|
|
7198
|
+
thinking: params.thinking,
|
|
7199
|
+
availableModels,
|
|
7200
|
+
preferredProvider: currentProvider
|
|
7201
|
+
}), spec = normalizeChildSpec({
|
|
7332
7202
|
task: shouldForkAgent(contextPolicy, params.agent) ? wrapForkTask(params.task ?? "") : params.task ?? "",
|
|
7333
7203
|
description: params.description,
|
|
7334
7204
|
permissions: params.permissions,
|
|
7335
|
-
model:
|
|
7205
|
+
model: params.model,
|
|
7336
7206
|
tier: params.tier,
|
|
7337
|
-
|
|
7207
|
+
thinking: params.thinking,
|
|
7208
|
+
modelSelection,
|
|
7338
7209
|
skill: params.skill,
|
|
7339
7210
|
cwd: effectiveCwd,
|
|
7340
7211
|
output: effectiveOutput,
|
|
@@ -7520,7 +7391,7 @@ function buildParallelWorktreeTaskCwdError(tasks, sharedCwd) {
|
|
|
7520
7391
|
return formatWorktreeTaskCwdConflict(conflict, sharedCwd);
|
|
7521
7392
|
}
|
|
7522
7393
|
function resolveSingleRunOutputBaseDir(deps, artifactsDir, runId) {
|
|
7523
|
-
return deps.config.singleRunOutputBaseDir ?
|
|
7394
|
+
return deps.config.singleRunOutputBaseDir ? path15.resolve(deps.expandTilde(deps.config.singleRunOutputBaseDir)) : path15.join(artifactsDir, "outputs", runId);
|
|
7524
7395
|
}
|
|
7525
7396
|
function buildChainWorktreeTaskCwdError(chain, sharedCwd) {
|
|
7526
7397
|
for (let stepIndex = 0; stepIndex < chain.length; stepIndex++) {
|
|
@@ -7540,7 +7411,7 @@ function resolveParallelTaskCwd(task, paramsCwd, worktreeSetup, index) {
|
|
|
7540
7411
|
function buildParallelWorktreeSuffix(worktreeSetup, artifactsDir, tasks) {
|
|
7541
7412
|
if (!worktreeSetup)
|
|
7542
7413
|
return "";
|
|
7543
|
-
let diffsDir =
|
|
7414
|
+
let diffsDir = path15.join(artifactsDir, "worktree-diffs"), diffs = diffWorktrees(worktreeSetup, tasks.map((task) => task.agent), diffsDir);
|
|
7544
7415
|
return formatWorktreeDiffSummary(diffs);
|
|
7545
7416
|
}
|
|
7546
7417
|
function findDuplicateParallelOutputPath(input) {
|
|
@@ -7563,13 +7434,16 @@ async function runForegroundParallelTasks(input) {
|
|
|
7563
7434
|
input.sessionFileForTask(input.tasks[i].agent, i, input.modelOverrides[i]);
|
|
7564
7435
|
return mapConcurrent(input.tasks, input.concurrencyLimit, async (task, index) => {
|
|
7565
7436
|
let behavior = input.behaviors[index], effectiveSkills = behavior?.skills, taskCwd = resolveParallelTaskCwd(task, input.paramsCwd, input.worktreeSetup, index), readInstructions = behavior ? buildChainInstructions({ ...behavior, output: !1, progress: !1 }, taskCwd, !1) : { prefix: "", suffix: "" }, progressInstructions = behavior ? buildChainInstructions({ ...behavior, output: !1, reads: !1 }, input.progressDir, index === input.firstProgressIndex) : { prefix: "", suffix: "" }, outputPath = resolveSingleOutputPath(behavior?.output, input.ctx.cwd, taskCwd, input.outputBaseDir), agentConfig = input.agents.find((agent) => agent.name === task.agent), taskText = injectSingleOutputInstruction(`${readInstructions.prefix}${input.taskTexts[index]}${progressInstructions.suffix}`, outputPath, agentConfig), interruptController = new AbortController();
|
|
7566
|
-
|
|
7437
|
+
input.foregroundControl && (input.foregroundControl.currentAgent = task.description || task.agent, input.foregroundControl.currentChildId = task.agent, input.foregroundControl.currentIndex = index, input.foregroundControl.currentActivityState = void 0, input.foregroundControl.updatedAt = Date.now(), input.foregroundControl.interrupt = () => interruptController.signal.aborted ? !1 : (interruptController.abort(), input.foregroundControl.currentActivityState = void 0, input.foregroundControl.updatedAt = Date.now(), !0));
|
|
7438
|
+
let modelSelection = input.modelSelections[index] ?? captureModelSelection({ model: task.model, tier: task.tier });
|
|
7439
|
+
return runSync(input.ctx.cwd, normalizeChildSpec({
|
|
7567
7440
|
task: taskText,
|
|
7568
7441
|
description: task.description,
|
|
7569
7442
|
permissions: task.permissions,
|
|
7570
|
-
model:
|
|
7443
|
+
model: task.model,
|
|
7571
7444
|
tier: task.tier,
|
|
7572
|
-
|
|
7445
|
+
thinking: task.thinking,
|
|
7446
|
+
modelSelection,
|
|
7573
7447
|
skill: task.skill,
|
|
7574
7448
|
cwd: taskCwd,
|
|
7575
7449
|
output: task.output,
|
|
@@ -7674,7 +7548,14 @@ async function runParallelPath(data, deps) {
|
|
|
7674
7548
|
...task.reads !== void 0 && task.reads !== !0 ? { reads: task.reads } : {},
|
|
7675
7549
|
...task.progress !== void 0 ? { progress: task.progress } : {},
|
|
7676
7550
|
...skillOverrides[index] !== void 0 ? { skills: skillOverrides[index] } : {}
|
|
7677
|
-
})),
|
|
7551
|
+
})), modelSelections = tasks.map((task) => captureModelSelection({ model: task.model, tier: task.tier })), modelOverrides = tasks.map((task, index) => resolveExecutableChildModel({
|
|
7552
|
+
modelSelection: modelSelections[index],
|
|
7553
|
+
model: task.model,
|
|
7554
|
+
tier: task.tier,
|
|
7555
|
+
thinking: task.thinking,
|
|
7556
|
+
availableModels,
|
|
7557
|
+
preferredProvider: currentProvider
|
|
7558
|
+
}));
|
|
7678
7559
|
if (params.clarify === !0 && ctx.hasUI) {
|
|
7679
7560
|
let behaviors2 = agentConfigs.map((_c, i) => resolveStepBehavior(behaviorOverrides[i])), availableSkills = discoverAvailableSkills(effectiveCwd), result2 = await ctx.ui.custom((tui, theme, _kb, done) => new ChainClarifyComponent(tui, theme, agentConfigs, taskTexts, "", void 0, behaviors2, availableModels, currentProvider, availableSkills, done, "parallel"), { overlay: !0, overlayOptions: { anchor: "center", width: 84, maxHeight: "80%" } });
|
|
7680
7561
|
if (!result2 || !result2.confirmed)
|
|
@@ -7750,7 +7631,7 @@ async function runParallelPath(data, deps) {
|
|
|
7750
7631
|
if (errorResult)
|
|
7751
7632
|
return errorResult;
|
|
7752
7633
|
try {
|
|
7753
|
-
let outputBaseDir =
|
|
7634
|
+
let outputBaseDir = path15.join(artifactsDir, "outputs", runId), duplicateOutputError = findDuplicateParallelOutputPath({
|
|
7754
7635
|
tasks,
|
|
7755
7636
|
behaviors,
|
|
7756
7637
|
paramsCwd: effectiveCwd,
|
|
@@ -7765,7 +7646,7 @@ async function runParallelPath(data, deps) {
|
|
|
7765
7646
|
if (validationError)
|
|
7766
7647
|
return buildParallelModeError(validationError);
|
|
7767
7648
|
}
|
|
7768
|
-
let parallelProgressPrecreated = firstProgressIndex !== -1, parallelProgressDir =
|
|
7649
|
+
let parallelProgressPrecreated = firstProgressIndex !== -1, parallelProgressDir = path15.join(artifactsDir, "progress", runId);
|
|
7769
7650
|
parallelProgressPrecreated && writeInitialProgressFile(parallelProgressDir);
|
|
7770
7651
|
for (let i = 0; i < taskTexts.length; i++)
|
|
7771
7652
|
shouldForkAgent(contextPolicy, tasks[i].agent) && (taskTexts[i] = wrapForkTask(taskTexts[i]));
|
|
@@ -7883,7 +7764,9 @@ async function runSinglePath(data, deps) {
|
|
|
7883
7764
|
task: params.task,
|
|
7884
7765
|
description: params.description,
|
|
7885
7766
|
permissions: params.permissions,
|
|
7767
|
+
model: params.model,
|
|
7886
7768
|
tier: params.tier,
|
|
7769
|
+
thinking: params.thinking,
|
|
7887
7770
|
skill: params.skill,
|
|
7888
7771
|
cwd: effectiveCwd,
|
|
7889
7772
|
output: params.output,
|
|
@@ -7912,7 +7795,14 @@ async function runSinglePath(data, deps) {
|
|
|
7912
7795
|
}, effectiveToolBudget = resolveEffectiveToolBudget({ runBudget: data.toolBudget, agentBudget: spec.toolBudget, configBudget: data.configToolBudget });
|
|
7913
7796
|
if (effectiveToolBudget.error)
|
|
7914
7797
|
return toExecutionErrorResult(params, new Error(effectiveToolBudget.error));
|
|
7915
|
-
let currentProvider = ctx.model?.provider, availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo), task = params.task ?? "",
|
|
7798
|
+
let currentProvider = ctx.model?.provider, availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo), task = params.task ?? "", modelSelection = captureModelSelection({ model: params.model, tier: params.tier }), modelOverride = resolveExecutableChildModel({
|
|
7799
|
+
modelSelection,
|
|
7800
|
+
model: params.model,
|
|
7801
|
+
tier: params.tier,
|
|
7802
|
+
thinking: params.thinking,
|
|
7803
|
+
availableModels,
|
|
7804
|
+
preferredProvider: currentProvider
|
|
7805
|
+
}), skillOverride = normalizeSkillInput(params.skill), rawOutput = params.output !== void 0 ? params.output : agentConfig.output, effectiveOutput = normalizeSingleOutputOverride(rawOutput, agentConfig.output), effectiveOutputMode = params.outputMode ?? "inline", currentMaxSubagentDepth = resolveCurrentMaxSubagentDepth(deps.config.maxSubagentDepth), maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, agentConfig.maxSubagentDepth);
|
|
7916
7806
|
if (params.clarify === !0 && ctx.hasUI) {
|
|
7917
7807
|
let behavior = resolveStepBehavior({ output: effectiveOutput, skills: skillOverride }), availableSkills = discoverAvailableSkills(effectiveCwd), result2 = await ctx.ui.custom((tui, theme, _kb, done) => new ChainClarifyComponent(tui, theme, [agentConfig], [task], task, void 0, [behavior], availableModels, currentProvider, availableSkills, done, "single"), { overlay: !0, overlayOptions: { anchor: "center", width: 84, maxHeight: "80%" } });
|
|
7918
7808
|
if (!result2 || !result2.confirmed)
|
|
@@ -8084,7 +7974,7 @@ function foregroundCapacityResult(params, inFlight, limit) {
|
|
|
8084
7974
|
return {
|
|
8085
7975
|
content: [{
|
|
8086
7976
|
type: "text",
|
|
8087
|
-
text: `Foreground subagent capacity reached (${inFlight}/${limit} running). Wait for a child to finish,
|
|
7977
|
+
text: `Foreground subagent capacity reached (${inFlight}/${limit} running). Wait for a child to finish, combine work in ONE tasks call, or launch without async:false or clarify:true when foreground execution is unnecessary.`
|
|
8088
7978
|
}],
|
|
8089
7979
|
isError: !0,
|
|
8090
7980
|
details: { mode: inferExecutionMode(params), results: [] }
|
|
@@ -8174,7 +8064,7 @@ function createSubagentExecutor(deps) {
|
|
|
8174
8064
|
let targetRunId = paramsWithResolvedCwd.runId ?? paramsWithResolvedCwd.id;
|
|
8175
8065
|
if (paramsWithResolvedCwd.dir)
|
|
8176
8066
|
try {
|
|
8177
|
-
let location = resolveAsyncRunLocation(paramsWithResolvedCwd, ASYNC_DIR, RESULTS_DIR), runId2 = location.resolvedId ?? targetRunId ??
|
|
8067
|
+
let location = resolveAsyncRunLocation(paramsWithResolvedCwd, ASYNC_DIR, RESULTS_DIR), runId2 = location.resolvedId ?? targetRunId ?? path15.basename(location.asyncDir ?? paramsWithResolvedCwd.dir);
|
|
8178
8068
|
return steerAsyncRun({ state: deps.state, runId: runId2, message, index: paramsWithResolvedCwd.index, kill: deps.kill, location, signal, recover: ({ absoluteDeadlineAt, ...limits }) => resumeAsyncRun({ params: { ...limits, action: "resume", id: runId2, message }, requestCwd, ctx, deps, absoluteDeadlineAt }) });
|
|
8179
8069
|
} catch (error) {
|
|
8180
8070
|
return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: !0, details: { mode: "management", results: [] } };
|
|
@@ -8202,7 +8092,7 @@ function createSubagentExecutor(deps) {
|
|
|
8202
8092
|
if (paramsWithResolvedCwd.dir)
|
|
8203
8093
|
try {
|
|
8204
8094
|
let location = resolveAsyncRunLocation(paramsWithResolvedCwd, ASYNC_DIR, RESULTS_DIR);
|
|
8205
|
-
return stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ??
|
|
8095
|
+
return stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ?? path15.basename(location.asyncDir ?? paramsWithResolvedCwd.dir), deps.kill, location);
|
|
8206
8096
|
} catch (error) {
|
|
8207
8097
|
return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: !0, details: { mode: "management", results: [] } };
|
|
8208
8098
|
}
|
|
@@ -8272,7 +8162,7 @@ function createSubagentExecutor(deps) {
|
|
|
8272
8162
|
let normalized = normalizeRepeatedParallelCounts(paramsWithResolvedCwd);
|
|
8273
8163
|
if (normalized.error)
|
|
8274
8164
|
return normalized.error;
|
|
8275
|
-
let
|
|
8165
|
+
let effectiveParams = normalized.params, runToolBudget = resolveToolBudget(effectiveParams.toolBudget, "toolBudget");
|
|
8276
8166
|
if (runToolBudget.error)
|
|
8277
8167
|
return buildRequestedModeError(effectiveParams, runToolBudget.error);
|
|
8278
8168
|
let configToolBudget = resolveToolBudget(deps.config.toolBudget, "config.toolBudget");
|
|
@@ -8323,23 +8213,23 @@ function createSubagentExecutor(deps) {
|
|
|
8323
8213
|
} catch (error) {
|
|
8324
8214
|
return toExecutionErrorResult(effectiveParams, error);
|
|
8325
8215
|
}
|
|
8326
|
-
let
|
|
8216
|
+
let backgroundRequestedWhileClarifying = (hasChain || hasTasks) && effectiveParams.async === !0 && effectiveParams.clarify === !0, effectiveAsync = subagentLaunchRunsAsync(effectiveParams), controlConfig = resolveControlConfig(deps.config.control, effectiveParams.control), artifactConfig = {
|
|
8327
8217
|
...DEFAULT_ARTIFACT_CONFIG,
|
|
8328
8218
|
enabled: effectiveParams.artifacts !== !1
|
|
8329
8219
|
}, artifactsDir = getArtifactsDir(parentSessionFile, effectiveCwd), sessionRoot;
|
|
8330
8220
|
if (effectiveParams.sessionDir)
|
|
8331
|
-
sessionRoot =
|
|
8221
|
+
sessionRoot = path15.resolve(deps.expandTilde(effectiveParams.sessionDir));
|
|
8332
8222
|
else {
|
|
8333
|
-
let baseSessionRoot = deps.config.defaultSessionDir ?
|
|
8334
|
-
sessionRoot =
|
|
8223
|
+
let baseSessionRoot = deps.config.defaultSessionDir ? path15.resolve(deps.expandTilde(deps.config.defaultSessionDir)) : deps.getSubagentSessionRoot(parentSessionFile);
|
|
8224
|
+
sessionRoot = path15.join(baseSessionRoot, runId);
|
|
8335
8225
|
}
|
|
8336
8226
|
try {
|
|
8337
|
-
|
|
8227
|
+
fs15.mkdirSync(sessionRoot, { recursive: !0 });
|
|
8338
8228
|
} catch (error) {
|
|
8339
8229
|
let message = error instanceof Error ? error.message : String(error);
|
|
8340
8230
|
return toExecutionErrorResult(effectiveParams, new Error(`Failed to create session directory '${sessionRoot}': ${message}`));
|
|
8341
8231
|
}
|
|
8342
|
-
let sessionDirForIndex = (idx) =>
|
|
8232
|
+
let sessionDirForIndex = (idx) => path15.join(sessionRoot, `run-${idx ?? 0}`), forkSessionFileForTask = (agentName, idx = 0, modelOverride) => {
|
|
8343
8233
|
if (shouldForkAgent(contextPolicy, agentName))
|
|
8344
8234
|
return prepareForkThinking(agentName, idx, modelOverride), forkSessionFileForIndex(idx);
|
|
8345
8235
|
}, forkThinkingOverrideForTask = (agentName, idx = 0, modelOverride) => {
|
|
@@ -8348,7 +8238,7 @@ function createSubagentExecutor(deps) {
|
|
|
8348
8238
|
prepareForkThinking(agentName, idx, modelOverride);
|
|
8349
8239
|
let override = forkThinkingOverrideForIndex(idx);
|
|
8350
8240
|
return override === "off" && forkThinkingDowngrades.set(idx, agentName), override;
|
|
8351
|
-
}, childSessionFileForTask = (agentName, idx, modelOverride) => forkSessionFileForTask(agentName, idx, modelOverride) ??
|
|
8241
|
+
}, childSessionFileForTask = (agentName, idx, modelOverride) => forkSessionFileForTask(agentName, idx, modelOverride) ?? path15.join(sessionDirForIndex(idx), "session.jsonl"), childSessionFileForIndex = (idx) => path15.join(sessionDirForIndex(idx), "session.jsonl");
|
|
8352
8242
|
try {
|
|
8353
8243
|
effectiveParams.clarify === !0 && ctx.hasUI || preflightForkSessionsForStaticTasks(effectiveParams, contextPolicy, forkSessionFileForTask, deps.config.chain?.dynamicFanout?.maxItems);
|
|
8354
8244
|
} catch (error) {
|
|
@@ -8478,10 +8368,7 @@ function createSubagentExecutor(deps) {
|
|
|
8478
8368
|
};
|
|
8479
8369
|
return { execute: async (id, params, signal, onUpdate, ctx) => {
|
|
8480
8370
|
let requestParams = resolveSubagentRequestParams(params);
|
|
8481
|
-
if (requestParams.action)
|
|
8482
|
-
return execute(id, requestParams, signal, onUpdate, ctx);
|
|
8483
|
-
let { depth } = checkSubagentDepth(deps.config.maxSubagentDepth), dispatchParams = applyForceTopLevelAsyncOverride(requestParams, depth, deps.config.forceTopLevelAsync === !0);
|
|
8484
|
-
if (!(dispatchParams.clarify === !0 || (dispatchParams.async ?? deps.asyncByDefault) !== !0))
|
|
8371
|
+
if (requestParams.action || !!subagentLaunchRunsAsync(requestParams))
|
|
8485
8372
|
return execute(id, requestParams, signal, onUpdate, ctx);
|
|
8486
8373
|
let limit = resolveTopLevelParallelConcurrency(void 0, deps.config.parallel?.concurrency), inFlight = deps.state.foregroundSubagentInFlight ?? 0;
|
|
8487
8374
|
if (inFlight >= limit)
|