@ashx-j/lunr-dev 0.2.16-dev.9.1 → 0.2.21-dev.12.1
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 +67 -1
- package/README.md +7 -1
- package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -0
- package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-thinking.js +44 -19
- package/dist/builtin-extensions/ashxj-thinking.js.map +1 -1
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +1 -2
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/lunr-computer-use.d.ts +3 -0
- package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-computer-use.js +158 -0
- package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
- 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-lsp-extension/src/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js +10 -3
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +5 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +26 -4
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.js +37 -27
- package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +6 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.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 +179 -79
- 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 +44 -15
- 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 +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 +7 -3
- 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/request-params.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js +38 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js.map +1 -0
- 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 +74 -41
- 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/child-tools.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.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 +47 -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 +428 -431
- 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/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.js +103 -102
- package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/computer-use/adapter.d.ts +23 -0
- package/dist/core/computer-use/adapter.d.ts.map +1 -0
- package/dist/core/computer-use/adapter.js +116 -0
- package/dist/core/computer-use/adapter.js.map +1 -0
- package/dist/core/computer-use/image.d.ts +26 -0
- package/dist/core/computer-use/image.d.ts.map +1 -0
- package/dist/core/computer-use/image.js +64 -0
- package/dist/core/computer-use/image.js.map +1 -0
- package/dist/core/computer-use/lease.d.ts +18 -0
- package/dist/core/computer-use/lease.d.ts.map +1 -0
- package/dist/core/computer-use/lease.js +129 -0
- package/dist/core/computer-use/lease.js.map +1 -0
- package/dist/core/computer-use/macos-runtime.d.ts +14 -0
- package/dist/core/computer-use/macos-runtime.d.ts.map +1 -0
- package/dist/core/computer-use/macos-runtime.js +148 -0
- package/dist/core/computer-use/macos-runtime.js.map +1 -0
- package/dist/core/computer-use/policy.d.ts +19 -0
- package/dist/core/computer-use/policy.d.ts.map +1 -0
- package/dist/core/computer-use/policy.js +62 -0
- package/dist/core/computer-use/policy.js.map +1 -0
- package/dist/core/computer-use/release.generated.d.ts +31 -0
- package/dist/core/computer-use/release.generated.d.ts.map +1 -0
- package/dist/core/computer-use/release.generated.js +36 -0
- package/dist/core/computer-use/release.generated.js.map +1 -0
- package/dist/core/computer-use/runtime.d.ts +13 -0
- package/dist/core/computer-use/runtime.d.ts.map +1 -0
- package/dist/core/computer-use/runtime.js +158 -0
- package/dist/core/computer-use/runtime.js.map +1 -0
- package/dist/core/computer-use/schemas.d.ts +91 -0
- package/dist/core/computer-use/schemas.d.ts.map +1 -0
- package/dist/core/computer-use/schemas.js +71 -0
- package/dist/core/computer-use/schemas.js.map +1 -0
- package/dist/core/computer-use/windows-desktop.d.ts +3 -0
- package/dist/core/computer-use/windows-desktop.d.ts.map +1 -0
- package/dist/core/computer-use/windows-desktop.js +48 -0
- package/dist/core/computer-use/windows-desktop.js.map +1 -0
- package/dist/core/computer-use/workflow.d.ts +32 -0
- package/dist/core/computer-use/workflow.d.ts.map +1 -0
- package/dist/core/computer-use/workflow.js +341 -0
- package/dist/core/computer-use/workflow.js.map +1 -0
- 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/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +2 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-runtime.d.ts +0 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +1 -10
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +1 -1
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permissions.d.ts +2 -1
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +31 -11
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +9 -5
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/rollback.d.ts.map +1 -1
- package/dist/core/rollback.js +13 -90
- package/dist/core/rollback.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/session-manager.d.ts +0 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +21 -79
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +10 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +30 -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/dev-cli.js +0 -0
- package/dist/gateway/agent-bridge.d.ts +6 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +23 -6
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/cron.d.ts +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +23 -7
- package/dist/gateway/cron.js.map +1 -1
- 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/footer.d.ts +4 -2
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +23 -32
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/processes-selector.d.ts +2 -3
- package/dist/modes/interactive/components/processes-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/processes-selector.js +5 -10
- package/dist/modes/interactive/components/processes-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +8 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +93 -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 +58 -26
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/thinking-level-slash.d.ts +4 -0
- package/dist/modes/interactive/thinking-level-slash.d.ts.map +1 -0
- package/dist/modes/interactive/thinking-level-slash.js +23 -0
- package/dist/modes/interactive/thinking-level-slash.js.map +1 -0
- package/dist/node-runtime/adapter-AZMY335J.js +279 -0
- package/dist/node-runtime/{agent-session-services-IFJMSX7Z.js → agent-session-services-QANFGM2V.js} +15 -11
- package/dist/node-runtime/{builtin-extensions-LYZ3BFWQ.js → builtin-extensions-SRCYQPZ6.js} +5 -3
- package/dist/node-runtime/chunk-2IDTZAG5.js +1415 -0
- package/dist/node-runtime/chunk-3ONQTOMR.js +68 -0
- package/dist/node-runtime/{chunk-TQNSPERU.js → chunk-5SQDLSZJ.js} +1 -1
- package/dist/node-runtime/chunk-5ZH3ZFIZ.js +308 -0
- package/dist/node-runtime/{chunk-PBC2Y6GS.js → chunk-6UB6NKA3.js} +29 -72
- package/dist/node-runtime/{chunk-A2KQXUJD.js → chunk-7AFOFSDY.js} +1 -1
- package/dist/node-runtime/chunk-A3KMVBZV.js +60 -0
- package/dist/node-runtime/{chunk-N77MY65L.js → chunk-BJ6H7DPI.js} +25 -25
- package/dist/node-runtime/{chunk-PGAJ5MO5.js → chunk-BYQ2MOFI.js} +6 -6
- package/dist/node-runtime/{chunk-QH42CDX3.js → chunk-CZUBYPFP.js} +234 -124
- package/dist/node-runtime/{chunk-LZAW4ZX3.js → chunk-D466UAID.js} +34 -13
- package/dist/node-runtime/{chunk-ZKMFUD3Q.js → chunk-GT5F3OKM.js} +3 -3
- package/dist/node-runtime/chunk-H2BI7G7T.js +73 -0
- package/dist/node-runtime/{chunk-5P7PZMRU.js → chunk-HRS4HMDX.js} +1 -1
- package/dist/node-runtime/{chunk-IPA627GP.js → chunk-HXJS2PJM.js} +4 -4
- package/dist/node-runtime/chunk-JZHEUQRL.js +180 -0
- package/dist/node-runtime/chunk-LISUTZS3.js +19 -0
- package/dist/node-runtime/chunk-LOYUC2ID.js +2185 -0
- package/dist/node-runtime/{chunk-2QKLKMKC.js → chunk-LTXUQJI4.js} +1 -1
- package/dist/node-runtime/{chunk-YF63P5ZT.js → chunk-LTYWTR3V.js} +1 -426
- package/dist/node-runtime/{chunk-MKKH27PH.js → chunk-LWJXTA6Z.js} +274 -2416
- package/dist/node-runtime/chunk-MW2XJZIK.js +108 -0
- package/dist/node-runtime/{chunk-CDFZEWPU.js → chunk-N3PNL74S.js} +537 -262
- package/dist/node-runtime/{chunk-4TLO4PO2.js → chunk-U6C7VTR5.js} +7 -1401
- package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
- package/dist/node-runtime/{chunk-HQCKFM2O.js → chunk-VGYZ3APQ.js} +3 -0
- package/dist/node-runtime/{chunk-AJX357CL.js → chunk-VQ4UBWSA.js} +30 -1013
- package/dist/node-runtime/{chunk-F4VQFJI2.js → chunk-VTGEKB7R.js} +2 -2
- package/dist/node-runtime/{chunk-AD6VXAO7.js → chunk-VTPM5V35.js} +5 -100
- package/dist/node-runtime/chunk-W3SILANP.js +24 -0
- package/dist/node-runtime/{chunk-WOVTOV5P.js → chunk-XAUQOKYK.js} +421 -63
- package/dist/node-runtime/{chunk-ECD5L7YI.js → chunk-XSRCAQK2.js} +390 -16
- package/dist/node-runtime/{chunk-PCGNAY2O.js → chunk-ZOIIMEN6.js} +54 -433
- package/dist/node-runtime/{chunk-EDBJNRSM.js → chunk-ZVSORYRM.js} +1 -1
- package/dist/node-runtime/cli-runtime.js +1 -1
- package/dist/node-runtime/{command-L3LAHDIH.js → command-ZURZJDXF.js} +1 -1
- package/dist/node-runtime/{commands-RL5YBW5I.js → commands-BZGSLIP7.js} +4 -2
- package/dist/node-runtime/{customize-XEXL2DGQ.js → customize-LF5VST47.js} +1 -1
- package/dist/node-runtime/{direct-tool-executor-JVDXTO7A.js → direct-tool-executor-BSZDHIYR.js} +7 -4
- package/dist/node-runtime/{export-html-KR26FOUZ.js → export-html-E4DT6ZJQ.js} +1 -1
- package/dist/node-runtime/{gateway-X2TI5X7F.js → gateway-FWHRIBK5.js} +24 -369
- package/dist/node-runtime/index.js +49 -42
- package/dist/node-runtime/{init-NJV2T55N.js → init-DVJUAOUO.js} +4 -2
- package/dist/node-runtime/{interactive-mode-KOM35YF2.js → interactive-mode-BBASNWHN.js} +23 -17
- package/dist/node-runtime/{interactive-view-U6OILKF3.js → interactive-view-N6F4KUIT.js} +3 -5
- package/dist/node-runtime/lunr-computer-use-TJNDAMWM.js +135 -0
- package/dist/node-runtime/{lunr-cron-YJ5UHYRD.js → lunr-cron-J64I72C6.js} +7 -1
- package/dist/node-runtime/main.js +25 -20
- package/dist/node-runtime/{mcp-auth-flow-QIXHW6QN.js → mcp-auth-flow-YL6RWPYG.js} +2 -1
- package/dist/node-runtime/{package-manager-cli-TZZHJCVI.js → package-manager-cli-VMYX4Y2S.js} +10 -7
- package/dist/node-runtime/{pi-intercom-EEMBGQID.js → pi-intercom-NV2LW6X7.js} +108 -87
- package/dist/node-runtime/{pi-mcp-adapter-QFB37AVN.js → pi-mcp-adapter-JLB5YL2F.js} +31 -25
- package/dist/node-runtime/{pi-subagents-7XJ4H53P.js → pi-subagents-WEHV3W7H.js} +1321 -631
- package/dist/node-runtime/{pi-web-access-DPGAVKOA.js → pi-web-access-FN5YC5T6.js} +67 -64
- package/dist/node-runtime/{proxy-modes-HEEFK4KC.js → proxy-modes-OR7ISBXK.js} +7 -4
- package/dist/node-runtime/rpc-entry.js +25 -20
- package/dist/node-runtime/runtime-3SB5ATHQ.js +21 -0
- package/dist/node-runtime/{runtime-bridges-PPHNBFWL.js → runtime-bridges-2VQTLPOZ.js} +3 -5
- package/dist/node-runtime/{session-manager-MQNBYACL.js → session-manager-QEMZBMTM.js} +3 -5
- package/dist/node-runtime/{session-selector-5AZLJS6U.js → session-selector-URVJLOTK.js} +2 -2
- package/dist/node-runtime/{settings-manager-5LF2VQWC.js → settings-manager-3CCU326G.js} +4 -1
- package/dist/node-runtime/{src-Y7JSCK64.js → src-BPQFJR76.js} +27 -7
- package/dist/node-runtime/{subagent-executor-5RNDEPIJ.js → subagent-executor-CXKXQDHH.js} +189 -284
- package/dist/node-runtime/{update-cli-A253SZ7P.js → update-cli-NM7B4CKL.js} +4 -1
- package/dist/node-runtime/workflow-C26QCUTW.js +468 -0
- package/dist/rpc.d.ts +3 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +18 -0
- package/dist/rpc.js.map +1 -0
- package/dist/startup/interactive-view.d.ts.map +1 -1
- package/dist/startup/interactive-view.js +1 -2
- package/dist/startup/interactive-view.js.map +1 -1
- package/docs/computer-use.md +242 -0
- package/docs/development.md +0 -32
- package/docs/features.md +24 -6
- package/docs/interactive-startup.md +10 -3
- package/docs/keybindings.md +5 -3
- package/docs/settings.md +3 -2
- package/docs/terminal-setup.md +1 -1
- package/docs/usage.md +1 -1
- 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/hidden-thinking-label.ts +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/install-lock/package-lock.json +3827 -0
- package/install-lock/package.json +18 -0
- package/native/computer-use/LICENSE.md +21 -0
- package/npm-shrinkwrap.json +3808 -0
- package/package.json +16 -10
- 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-AHSTJBIB.js +0 -64
- package/dist/startup/interactive-shell.d.ts +0 -55
- package/dist/startup/interactive-shell.d.ts.map +0 -1
- package/dist/startup/interactive-shell.js +0 -264
- package/dist/startup/interactive-shell.js.map +0 -1
- package/dist/node-runtime/{chunk-YSKSB3BJ.js → chunk-CH6OL6P2.js} +2 -2
|
@@ -2,13 +2,16 @@ import { createRequire as __lunrRequire } from "node:module"; const require = __
|
|
|
2
2
|
import {
|
|
3
3
|
PLAN_MODE_WRITE_SPAWN_ERROR,
|
|
4
4
|
resolveChildPermissions
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZVSORYRM.js";
|
|
6
6
|
import {
|
|
7
7
|
createReadOnlyTools
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GT5F3OKM.js";
|
|
9
9
|
import {
|
|
10
10
|
convertToLlm
|
|
11
11
|
} from "./chunk-FVDOXRUD.js";
|
|
12
|
+
import {
|
|
13
|
+
COMPUTER_TOOLS
|
|
14
|
+
} from "./chunk-3ONQTOMR.js";
|
|
12
15
|
|
|
13
16
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/shared/types.js
|
|
14
17
|
import * as os from "node:os";
|
|
@@ -63,7 +66,8 @@ function resolveTempScopeId(options) {
|
|
|
63
66
|
}
|
|
64
67
|
return "shared";
|
|
65
68
|
}
|
|
66
|
-
var MAX_PARALLEL = Number.MAX_SAFE_INTEGER, MAX_CONCURRENCY = Number.MAX_SAFE_INTEGER, TEMP_ROOT_DIR = path.join(os.tmpdir(), `pi-subagents-${resolveTempScopeId()}`), RESULTS_DIR = path.join(TEMP_ROOT_DIR, "async-subagent-results"), ASYNC_DIR = path.join(TEMP_ROOT_DIR, "async-subagent-runs"), CHAIN_RUNS_DIR = path.join(TEMP_ROOT_DIR, "chain-runs"), TEMP_ARTIFACTS_DIR = path.join(TEMP_ROOT_DIR, "artifacts"), WIDGET_KEY = "subagent-async", SLASH_RESULT_TYPE = "subagent-slash-result", SLASH_TEXT_RESULT_TYPE = "subagent-slash-text-result", SLASH_SUBAGENT_REQUEST_EVENT = "subagent:slash:request", SLASH_SUBAGENT_STARTED_EVENT = "subagent:slash:started", SLASH_SUBAGENT_RESPONSE_EVENT = "subagent:slash:response", SLASH_SUBAGENT_UPDATE_EVENT = "subagent:slash:update", SLASH_SUBAGENT_CANCEL_EVENT = "subagent:slash:cancel", POLL_INTERVAL_MS = 250
|
|
69
|
+
var MAX_PARALLEL = Number.MAX_SAFE_INTEGER, MAX_CONCURRENCY = Number.MAX_SAFE_INTEGER, TEMP_ROOT_DIR = path.join(os.tmpdir(), `pi-subagents-${resolveTempScopeId()}`), RESULTS_DIR = path.join(TEMP_ROOT_DIR, "async-subagent-results"), ASYNC_DIR = path.join(TEMP_ROOT_DIR, "async-subagent-runs"), CHAIN_RUNS_DIR = path.join(TEMP_ROOT_DIR, "chain-runs"), TEMP_ARTIFACTS_DIR = path.join(TEMP_ROOT_DIR, "artifacts"), WIDGET_KEY = "subagent-async", SLASH_RESULT_TYPE = "subagent-slash-result", SLASH_TEXT_RESULT_TYPE = "subagent-slash-text-result", SLASH_SUBAGENT_REQUEST_EVENT = "subagent:slash:request", SLASH_SUBAGENT_STARTED_EVENT = "subagent:slash:started", SLASH_SUBAGENT_RESPONSE_EVENT = "subagent:slash:response", SLASH_SUBAGENT_UPDATE_EVENT = "subagent:slash:update", SLASH_SUBAGENT_CANCEL_EVENT = "subagent:slash:cancel", POLL_INTERVAL_MS = 250;
|
|
70
|
+
var DEFAULT_SUBAGENT_MAX_DEPTH = 2, SUBAGENT_ACTIONS = ["status", "interrupt", "resume", "steer", "stop", "append-step", "doctor", "watchdog.status", "watchdog.check", "watchdog.recommend-model", "schedule", "schedule-list", "schedule-status", "schedule-cancel"];
|
|
67
71
|
var DEFAULT_FORK_PREAMBLE = "You are a delegated subagent running from a fork of the parent session. Treat the inherited conversation as reference-only context, not a live thread to continue. Do not continue or answer prior messages as if they are waiting for a reply. Your sole job is to execute the task below and return a focused result for that task using your tools.";
|
|
68
72
|
function normalizeTopLevelParallelValue(value) {
|
|
69
73
|
let parsed = typeof value == "number" ? value : typeof value == "string" ? Number(value) : NaN;
|
|
@@ -420,7 +424,22 @@ function formatModelThinking(model, thinking) {
|
|
|
420
424
|
return [displayModel, formatThinkingLabel(model, thinking)].filter(Boolean).join(" \xB7 ");
|
|
421
425
|
}
|
|
422
426
|
function formatModelSelection(selection, resolvedModel, thinking) {
|
|
423
|
-
|
|
427
|
+
if (selection?.kind === "tier" && selection.tier)
|
|
428
|
+
return [selection.tier, formatThinkingLabel(resolvedModel, thinking)].filter(Boolean).join(" \xB7 ");
|
|
429
|
+
let selectedModel = selection?.kind === "model" ? selection.model : void 0;
|
|
430
|
+
return formatModelThinking(selectedModel || resolvedModel, thinking);
|
|
431
|
+
}
|
|
432
|
+
function formatModelId(model) {
|
|
433
|
+
if (!model)
|
|
434
|
+
return "";
|
|
435
|
+
let displayModel = splitKnownThinkingSuffix(model).baseModel, slashIdx = displayModel.lastIndexOf("/");
|
|
436
|
+
return slashIdx !== -1 && (displayModel = displayModel.slice(slashIdx + 1)), displayModel;
|
|
437
|
+
}
|
|
438
|
+
function formatCompactModelBadge(selection, resolvedModel) {
|
|
439
|
+
if (selection?.kind === "tier" && selection.tier)
|
|
440
|
+
return selection.tier;
|
|
441
|
+
let explicit = selection?.kind === "model" && typeof selection.model == "string" && selection.model.trim() ? selection.model : void 0;
|
|
442
|
+
return formatModelId(explicit ?? resolvedModel);
|
|
424
443
|
}
|
|
425
444
|
function formatUsage(u, model) {
|
|
426
445
|
let parts = [];
|
|
@@ -1911,7 +1930,7 @@ function resolveRuntimeScriptPath(basePathWithoutExt) {
|
|
|
1911
1930
|
let tsPath = `${basePathWithoutExt}.ts`;
|
|
1912
1931
|
return fs9.existsSync(tsPath) ? tsPath : `${basePathWithoutExt}.js`;
|
|
1913
1932
|
}
|
|
1914
|
-
var PROMPT_RUNTIME_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "subagent-prompt-runtime")), FANOUT_CHILD_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "..", "..", "extension", "fanout-child")), SUBAGENT_CHILD_ENV = "PI_SUBAGENT_CHILD", SUBAGENT_ORCHESTRATOR_TARGET_ENV = "PI_SUBAGENT_ORCHESTRATOR_TARGET", SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV = "PI_SUBAGENT_ORCHESTRATOR_SESSION_ID", SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV = "PI_SUBAGENT_SUPERVISOR_CHANNEL_DIR", SUBAGENT_RUN_ID_ENV = "PI_SUBAGENT_RUN_ID", SUBAGENT_CHILD_AGENT_ENV = "PI_SUBAGENT_CHILD_AGENT", SUBAGENT_CHILD_INDEX_ENV = "PI_SUBAGENT_CHILD_INDEX", SUBAGENT_FANOUT_CHILD_ENV = "PI_SUBAGENT_FANOUT_CHILD", SUBAGENT_PARENT_EVENT_SINK_ENV = "PI_SUBAGENT_PARENT_EVENT_SINK", SUBAGENT_PARENT_CONTROL_INBOX_ENV = "PI_SUBAGENT_PARENT_CONTROL_INBOX", SUBAGENT_PARENT_ROOT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_ROOT_RUN_ID", SUBAGENT_PARENT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_RUN_ID", SUBAGENT_PARENT_CHILD_INDEX_ENV = "PI_SUBAGENT_PARENT_CHILD_INDEX", SUBAGENT_PARENT_DEPTH_ENV = "PI_SUBAGENT_PARENT_DEPTH", SUBAGENT_PARENT_PATH_ENV = "PI_SUBAGENT_PARENT_PATH", SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV = "PI_SUBAGENT_PARENT_CAPABILITY_TOKEN", SUBAGENT_PARENT_SESSION_ENV = "PI_SUBAGENT_PARENT_SESSION", SUBAGENT_PARENT_PERMISSION_MODE_ENV = "PI_SUBAGENT_PARENT_PERMISSION_MODE", SUBAGENT_CHILD_PERMISSION_ENV = "PI_SUBAGENT_CHILD_PERMISSION", SUBAGENT_STEER_INBOX_ENV = "PI_SUBAGENT_STEER_INBOX", SUBAGENT_STEER_CAPABILITY_ENV = "PI_SUBAGENT_STEER_CAPABILITY", SUBAGENT_STEER_ACK_DIR_ENV = "PI_SUBAGENT_STEER_ACK_DIR";
|
|
1933
|
+
var PROMPT_RUNTIME_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "subagent-prompt-runtime")), FANOUT_CHILD_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "..", "..", "extension", "fanout-child")), SUBAGENT_CHILD_ENV = "PI_SUBAGENT_CHILD", SUBAGENT_ORCHESTRATOR_TARGET_ENV = "PI_SUBAGENT_ORCHESTRATOR_TARGET", SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV = "PI_SUBAGENT_ORCHESTRATOR_SESSION_ID", SUBAGENT_SUPERVISOR_SESSION_ID_ENV = "PI_SUBAGENT_SUPERVISOR_SESSION_ID", SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV = "PI_SUBAGENT_SUPERVISOR_CHANNEL_DIR", SUBAGENT_RUN_ID_ENV = "PI_SUBAGENT_RUN_ID", SUBAGENT_CHILD_AGENT_ENV = "PI_SUBAGENT_CHILD_AGENT", SUBAGENT_CHILD_INDEX_ENV = "PI_SUBAGENT_CHILD_INDEX", SUBAGENT_FANOUT_CHILD_ENV = "PI_SUBAGENT_FANOUT_CHILD", SUBAGENT_PARENT_EVENT_SINK_ENV = "PI_SUBAGENT_PARENT_EVENT_SINK", SUBAGENT_PARENT_CONTROL_INBOX_ENV = "PI_SUBAGENT_PARENT_CONTROL_INBOX", SUBAGENT_PARENT_ROOT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_ROOT_RUN_ID", SUBAGENT_PARENT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_RUN_ID", SUBAGENT_PARENT_CHILD_INDEX_ENV = "PI_SUBAGENT_PARENT_CHILD_INDEX", SUBAGENT_PARENT_DEPTH_ENV = "PI_SUBAGENT_PARENT_DEPTH", SUBAGENT_PARENT_PATH_ENV = "PI_SUBAGENT_PARENT_PATH", SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV = "PI_SUBAGENT_PARENT_CAPABILITY_TOKEN", SUBAGENT_PARENT_SESSION_ENV = "PI_SUBAGENT_PARENT_SESSION", SUBAGENT_PARENT_PERMISSION_MODE_ENV = "PI_SUBAGENT_PARENT_PERMISSION_MODE", SUBAGENT_CHILD_PERMISSION_ENV = "PI_SUBAGENT_CHILD_PERMISSION", SUBAGENT_STEER_INBOX_ENV = "PI_SUBAGENT_STEER_INBOX", SUBAGENT_STEER_CAPABILITY_ENV = "PI_SUBAGENT_STEER_CAPABILITY", SUBAGENT_STEER_ACK_DIR_ENV = "PI_SUBAGENT_STEER_ACK_DIR";
|
|
1915
1934
|
function sanitizeSupervisorChannelSegment(value) {
|
|
1916
1935
|
return value.trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "unknown";
|
|
1917
1936
|
}
|
|
@@ -1968,9 +1987,9 @@ function buildPiArgs(input) {
|
|
|
1968
1987
|
...input.childAgentName ? { agent: input.childAgentName } : {}
|
|
1969
1988
|
}] : []
|
|
1970
1989
|
];
|
|
1971
|
-
if (env[SUBAGENT_PARENT_EVENT_SINK_ENV] = fanoutAuthorized ? input.parentEventSink ?? process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] ?? "" : "", env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] = fanoutAuthorized ? input.parentControlInbox ?? process.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] ?? "" : "", env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] = fanoutAuthorized ? input.parentRootRunId ?? process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] ?? input.runId ?? "" : "", env[SUBAGENT_PARENT_RUN_ID_ENV] = fanoutAuthorized ? parentRunId : "", env[SUBAGENT_PARENT_CHILD_INDEX_ENV] = fanoutAuthorized ? parentChildIndex : "", env[SUBAGENT_PARENT_DEPTH_ENV] = fanoutAuthorized ? String(parentDepth) : "", env[SUBAGENT_PARENT_PATH_ENV] = fanoutAuthorized ? encodeNestedPathEnv(parentPath) : "", env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] = fanoutAuthorized ? input.parentCapabilityToken ?? process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] ?? "" : "", env.PI_SUBAGENT_INHERIT_PROJECT_CONTEXT = input.inheritProjectContext ? "1" : "0", env.PI_SUBAGENT_INHERIT_SKILLS = input.inheritSkills ? "1" : "0", input.intercomSessionName && (env.PI_SUBAGENT_INTERCOM_SESSION_NAME = input.intercomSessionName), input.orchestratorIntercomTarget && (env[SUBAGENT_ORCHESTRATOR_TARGET_ENV] = input.orchestratorIntercomTarget), input.parentSessionId && (env[SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV] = input.parentSessionId), input.
|
|
1972
|
-
let childIndex = input.childIndex ?? 0, channelDir = supervisorChannelDir(input.runId,
|
|
1973
|
-
fs9.mkdirSync(path10.join(channelDir, "requests"), { recursive: !0 }), fs9.mkdirSync(path10.join(channelDir, "replies"), { recursive: !0 }), env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV] = channelDir;
|
|
1990
|
+
if (env[SUBAGENT_PARENT_EVENT_SINK_ENV] = fanoutAuthorized ? input.parentEventSink ?? process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] ?? "" : "", env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] = fanoutAuthorized ? input.parentControlInbox ?? process.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] ?? "" : "", env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] = fanoutAuthorized ? input.parentRootRunId ?? process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] ?? input.runId ?? "" : "", env[SUBAGENT_PARENT_RUN_ID_ENV] = fanoutAuthorized ? parentRunId : "", env[SUBAGENT_PARENT_CHILD_INDEX_ENV] = fanoutAuthorized ? parentChildIndex : "", env[SUBAGENT_PARENT_DEPTH_ENV] = fanoutAuthorized ? String(parentDepth) : "", env[SUBAGENT_PARENT_PATH_ENV] = fanoutAuthorized ? encodeNestedPathEnv(parentPath) : "", env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] = fanoutAuthorized ? input.parentCapabilityToken ?? process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] ?? "" : "", env.PI_SUBAGENT_INHERIT_PROJECT_CONTEXT = input.inheritProjectContext ? "1" : "0", env.PI_SUBAGENT_INHERIT_SKILLS = input.inheritSkills ? "1" : "0", input.intercomSessionName && (env.PI_SUBAGENT_INTERCOM_SESSION_NAME = input.intercomSessionName), input.orchestratorIntercomTarget && (env[SUBAGENT_ORCHESTRATOR_TARGET_ENV] = input.orchestratorIntercomTarget), input.parentSessionId && (env[SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV] = input.parentSessionId), env[SUBAGENT_SUPERVISOR_SESSION_ID_ENV] = input.supervisorSessionId ?? "", input.parentSessionId && input.runId && (input.childId || input.childAgentName)) {
|
|
1991
|
+
let childIndex = input.childIndex ?? 0, channelAgent = input.childId ?? input.childAgentName, channelDir = supervisorChannelDir(input.runId, channelAgent, childIndex);
|
|
1992
|
+
fs9.mkdirSync(path10.join(channelDir, "requests"), { recursive: !0 }), fs9.mkdirSync(path10.join(channelDir, "replies"), { recursive: !0 }), fs9.mkdirSync(path10.join(channelDir, "questions"), { recursive: !0 }), env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV] = channelDir, env[SUBAGENT_CHILD_INDEX_ENV] = String(childIndex);
|
|
1974
1993
|
}
|
|
1975
1994
|
input.runId && (env[SUBAGENT_RUN_ID_ENV] = input.runId), (input.childId || input.childAgentName) && (env[SUBAGENT_CHILD_AGENT_ENV] = input.childId ?? input.childAgentName), input.childIndex !== void 0 && (env[SUBAGENT_CHILD_INDEX_ENV] = String(input.childIndex)), input.mcpDirectTools?.length ? env.MCP_DIRECT_TOOLS = input.mcpDirectTools.join(",") : env.MCP_DIRECT_TOOLS = "__none__", input.structuredOutput && (env[STRUCTURED_OUTPUT_CAPTURE_ENV] = input.structuredOutput.outputPath, env[STRUCTURED_OUTPUT_SCHEMA_ENV] = input.structuredOutput.schemaPath), input.steerInboxDir && (env[SUBAGENT_STEER_INBOX_ENV] = input.steerInboxDir), input.steerCapabilityPath && (env[SUBAGENT_STEER_CAPABILITY_ENV] = input.steerCapabilityPath), input.steerAckDir && (env[SUBAGENT_STEER_ACK_DIR_ENV] = input.steerAckDir);
|
|
1976
1995
|
let encodedToolBudget = encodeToolBudgetEnv(input.toolBudget);
|
|
@@ -1988,11 +2007,7 @@ function cleanupTempDir(tempDir) {
|
|
|
1988
2007
|
|
|
1989
2008
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js
|
|
1990
2009
|
function splitThinkingSuffix(model) {
|
|
1991
|
-
|
|
1992
|
-
return colonIdx === -1 ? { baseModel: model, thinkingSuffix: "" } : {
|
|
1993
|
-
baseModel: model.substring(0, colonIdx),
|
|
1994
|
-
thinkingSuffix: model.substring(colonIdx)
|
|
1995
|
-
};
|
|
2010
|
+
return splitKnownThinkingSuffix(model);
|
|
1996
2011
|
}
|
|
1997
2012
|
var INHERIT_MODEL = "inherit";
|
|
1998
2013
|
function normalizeModelSegment(segment) {
|
|
@@ -2120,14 +2135,61 @@ function resolveRequiredTierModel(tier, availableModels, preferredProvider) {
|
|
|
2120
2135
|
throw new Error(`Model tier '${String(tier)}' resolves to '${baseModel}', but that model is unavailable or unauthenticated. Configure an available model in /settings.`);
|
|
2121
2136
|
return `${resolvedBase}${thinkingSuffix}`;
|
|
2122
2137
|
}
|
|
2138
|
+
function requestedModelString(model) {
|
|
2139
|
+
return typeof model == "string" && model.trim() && model.trim() !== INHERIT_MODEL ? model.trim() : void 0;
|
|
2140
|
+
}
|
|
2123
2141
|
function requestedTier(tier) {
|
|
2124
2142
|
return tier === "light" || tier === "standard" || tier === "heavy" ? tier : void 0;
|
|
2125
2143
|
}
|
|
2144
|
+
function parseExplicitThinking(value, pathLabel = "thinking") {
|
|
2145
|
+
if (value !== void 0) {
|
|
2146
|
+
if (value === !1 || value === "off")
|
|
2147
|
+
return "off";
|
|
2148
|
+
if (typeof value != "string" || !THINKING_LEVELS.includes(value))
|
|
2149
|
+
throw new Error(`${pathLabel} must be one of ${THINKING_LEVELS.join(", ")}.`);
|
|
2150
|
+
return value;
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2126
2153
|
function captureModelSelection(input) {
|
|
2127
|
-
let tier = requestedTier(input.tier);
|
|
2128
|
-
if (
|
|
2129
|
-
throw new Error('
|
|
2130
|
-
|
|
2154
|
+
let model = typeof input.model == "string" ? input.model.trim() : "", hasModel = !!model, tier = requestedTier(input.tier);
|
|
2155
|
+
if (hasModel && model === INHERIT_MODEL)
|
|
2156
|
+
throw new Error('model "inherit" is not supported; choose tier: "light", "standard", or "heavy", or an explicit provider/model.');
|
|
2157
|
+
if (hasModel && tier)
|
|
2158
|
+
throw new Error("Choose exactly one of tier or model; do not pass both.");
|
|
2159
|
+
if (hasModel)
|
|
2160
|
+
return { kind: "model", model };
|
|
2161
|
+
if (tier)
|
|
2162
|
+
return { kind: "tier", tier };
|
|
2163
|
+
throw new Error('Every executable child requires tier: "light", "standard", or "heavy", or an explicit model when the user names one.');
|
|
2164
|
+
}
|
|
2165
|
+
function resolveRequiredExplicitModel(model, availableModels, preferredProvider, thinking) {
|
|
2166
|
+
let requested = requestedModelString(model);
|
|
2167
|
+
if (!requested)
|
|
2168
|
+
throw new Error('Explicit model selection requires model as "provider/id".');
|
|
2169
|
+
if (!availableModels?.length)
|
|
2170
|
+
throw new Error(`Model '${requested}' cannot launch because no authenticated models are available.`);
|
|
2171
|
+
let { baseModel, thinkingSuffix } = splitThinkingSuffix(requested), resolvedBase = resolveBaseModelCandidate(baseModel, availableModels, preferredProvider);
|
|
2172
|
+
if (!resolvedBase)
|
|
2173
|
+
throw new Error(`Model '${baseModel}' is unavailable or unauthenticated. Choose an available provider/model or a configured tier.`);
|
|
2174
|
+
let fromSuffix = thinkingSuffix ? thinkingSuffix.slice(1) : void 0, fromParam = parseExplicitThinking(thinking);
|
|
2175
|
+
if (fromSuffix && fromParam && fromSuffix !== fromParam)
|
|
2176
|
+
throw new Error(`Conflicting thinking levels '${fromSuffix}' and '${fromParam}' for model '${requested}'.`);
|
|
2177
|
+
let level = fromParam ?? fromSuffix;
|
|
2178
|
+
if (!level)
|
|
2179
|
+
return resolvedBase;
|
|
2180
|
+
let info = availableModels.find((entry) => entry.fullId === resolvedBase), supported = getSupportedThinkingLevels(info);
|
|
2181
|
+
if (!supported.includes(level))
|
|
2182
|
+
throw new Error(`Thinking level '${level}' is not supported by '${resolvedBase}'. Supported: ${supported.join(", ") || "none"}.`);
|
|
2183
|
+
return applyThinkingSuffix(resolvedBase, level, !0) ?? resolvedBase;
|
|
2184
|
+
}
|
|
2185
|
+
function resolveExecutableChildModel(input) {
|
|
2186
|
+
let selection = input.modelSelection ?? captureModelSelection({ model: input.model, tier: input.tier });
|
|
2187
|
+
if (selection.kind === "tier") {
|
|
2188
|
+
if (input.thinking !== void 0)
|
|
2189
|
+
throw new Error("thinking is only valid with an explicit model; tier children use the configured tier thinking level.");
|
|
2190
|
+
return resolveRequiredTierModel(selection.tier, input.availableModels, input.preferredProvider);
|
|
2191
|
+
}
|
|
2192
|
+
return resolveRequiredExplicitModel(input.model, input.availableModels, input.preferredProvider, input.thinking);
|
|
2131
2193
|
}
|
|
2132
2194
|
function buildModelCandidates(primaryModel, fallbackModels, availableModels, preferredProvider, options) {
|
|
2133
2195
|
let seen = /* @__PURE__ */ new Set(), candidates = [], rawCandidates = [primaryModel, ...fallbackModels ?? []];
|
|
@@ -2193,6 +2255,7 @@ function formatModelAttemptNote(attempt, nextModel) {
|
|
|
2193
2255
|
|
|
2194
2256
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js
|
|
2195
2257
|
var PARENT_OWNED_CHILD_TOOLS = [
|
|
2258
|
+
...COMPUTER_TOOLS,
|
|
2196
2259
|
"cron",
|
|
2197
2260
|
"memory_add",
|
|
2198
2261
|
"memory_remove",
|
|
@@ -2272,12 +2335,24 @@ function optionalCount(value) {
|
|
|
2272
2335
|
function isModelSelection(value) {
|
|
2273
2336
|
if (!value || typeof value != "object")
|
|
2274
2337
|
return !1;
|
|
2275
|
-
|
|
2338
|
+
let kind = value.kind;
|
|
2339
|
+
if (kind === "model")
|
|
2340
|
+
return !0;
|
|
2341
|
+
if (kind === "tier") {
|
|
2276
2342
|
let tier = value.tier;
|
|
2277
2343
|
return tier === "light" || tier === "standard" || tier === "heavy";
|
|
2278
2344
|
}
|
|
2279
2345
|
return !1;
|
|
2280
2346
|
}
|
|
2347
|
+
function parseThinking(value, pathLabel) {
|
|
2348
|
+
if (value !== void 0) {
|
|
2349
|
+
if (value === !1)
|
|
2350
|
+
return "off";
|
|
2351
|
+
if (typeof value == "string" && THINKING_LEVELS.includes(value))
|
|
2352
|
+
return value;
|
|
2353
|
+
throw new Error(`${pathLabel}.thinking must be one of ${THINKING_LEVELS.join(", ")}.`);
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2281
2356
|
function normalizeChildSpec(input, options) {
|
|
2282
2357
|
let pathLabel = options.pathLabel ?? "task", description = validateChildDescription(input.description, `${pathLabel}.description`), task = typeof input.task == "string" && input.task.trim() ? input.task : options.defaultTask;
|
|
2283
2358
|
if (typeof task != "string" || !task.trim())
|
|
@@ -2285,21 +2360,40 @@ function normalizeChildSpec(input, options) {
|
|
|
2285
2360
|
let requested = parseChildPermissionsInput(input.permissions, `${pathLabel}.permissions`), resolved = resolveChildPermissions(options.parentMode, requested);
|
|
2286
2361
|
if (!resolved.ok)
|
|
2287
2362
|
throw new Error(resolved.error || PLAN_MODE_WRITE_SPAWN_ERROR);
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2363
|
+
let preservedSelection = isModelSelection(input.modelSelection) ? input.modelSelection : void 0, rawModel = optionalString(input.model);
|
|
2364
|
+
if (rawModel === INHERIT_MODEL)
|
|
2365
|
+
throw new Error(`${pathLabel}.model "inherit" is not supported; choose tier or an explicit provider/model.`);
|
|
2366
|
+
let modelSelection, tier, model, thinking;
|
|
2367
|
+
if (preservedSelection)
|
|
2368
|
+
if (modelSelection = preservedSelection, modelSelection.kind === "tier") {
|
|
2369
|
+
if (tier = modelSelection.tier, model = void 0, input.thinking !== void 0)
|
|
2370
|
+
throw new Error(`${pathLabel}.thinking is only valid with an explicit model selection.`);
|
|
2371
|
+
} else {
|
|
2372
|
+
if (model = rawModel ?? optionalString(modelSelection.model), !model)
|
|
2373
|
+
throw new Error(`${pathLabel}.model is required when modelSelection.kind is "model".`);
|
|
2374
|
+
modelSelection.model || (modelSelection = { kind: "model", model }), thinking = parseThinking(input.thinking, pathLabel);
|
|
2375
|
+
}
|
|
2376
|
+
else if (options.resolvedModelIsRuntime) {
|
|
2377
|
+
let selectedTier = input.tier === "light" || input.tier === "standard" || input.tier === "heavy" ? input.tier : void 0;
|
|
2378
|
+
if (!selectedTier)
|
|
2379
|
+
throw new Error(`${pathLabel}.tier is required to resume a child without a stored modelSelection.`);
|
|
2380
|
+
modelSelection = { kind: "tier", tier: selectedTier }, tier = selectedTier, model = void 0;
|
|
2381
|
+
} else if (modelSelection = captureModelSelection({ model: input.model, tier: input.tier }), modelSelection.kind === "tier") {
|
|
2382
|
+
if (tier = modelSelection.tier, model = void 0, input.thinking !== void 0)
|
|
2383
|
+
throw new Error(`${pathLabel}.thinking is only valid with an explicit model selection.`);
|
|
2384
|
+
} else
|
|
2385
|
+
model = rawModel, !modelSelection.model && model && (modelSelection = { kind: "model", model }), thinking = parseThinking(input.thinking, pathLabel);
|
|
2386
|
+
let outputMode = input.outputMode === "inline" || input.outputMode === "file-only" ? input.outputMode : void 0;
|
|
2294
2387
|
return {
|
|
2295
2388
|
childId: options.childId ?? allocateChildId(options.runId, options.index),
|
|
2296
2389
|
task,
|
|
2297
2390
|
description,
|
|
2298
2391
|
requestedPermissions: resolved.requested,
|
|
2299
2392
|
effectivePermissions: resolved.effective,
|
|
2300
|
-
model
|
|
2393
|
+
model,
|
|
2301
2394
|
tier,
|
|
2302
2395
|
modelSelection,
|
|
2396
|
+
thinking,
|
|
2303
2397
|
skill: optionalSkill(input.skill),
|
|
2304
2398
|
cwd: optionalString(input.cwd),
|
|
2305
2399
|
output: optionalOutput(input.output),
|
|
@@ -2330,9 +2424,6 @@ function formatActivityLabel(lastActivityAt, activityState, now = Date.now()) {
|
|
|
2330
2424
|
function isCompletedStepStatus(status) {
|
|
2331
2425
|
return status === "complete" || status === "completed";
|
|
2332
2426
|
}
|
|
2333
|
-
function aggregateStepStatus(steps) {
|
|
2334
|
-
return steps.some((step) => step.status === "running") ? "running" : steps.some((step) => step.status === "failed") ? "failed" : steps.some((step) => step.status === "stopped") ? "stopped" : steps.some((step) => step.status === "paused") ? "paused" : steps.length > 0 && steps.every((step) => isCompletedStepStatus(step.status)) ? "complete" : "pending";
|
|
2335
|
-
}
|
|
2336
2427
|
function formatAgentRunningLabel(count) {
|
|
2337
2428
|
return count === 1 ? "1 agent running" : `${count} agents running`;
|
|
2338
2429
|
}
|
|
@@ -2416,6 +2507,34 @@ function formatNestedRunStatusLines(children, options = {}) {
|
|
|
2416
2507
|
});
|
|
2417
2508
|
}
|
|
2418
2509
|
|
|
2510
|
+
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js
|
|
2511
|
+
var LAUNCH_COMPATIBLE_ACTIONS = /* @__PURE__ */ new Set(["schedule", "append-step", "resume", "steer"]);
|
|
2512
|
+
function omitExecutionModeActionAlias(params) {
|
|
2513
|
+
let action = params.action?.toLowerCase();
|
|
2514
|
+
if (action === "single" && params.task !== void 0) {
|
|
2515
|
+
let rest = { ...params };
|
|
2516
|
+
return delete rest.action, rest;
|
|
2517
|
+
}
|
|
2518
|
+
if ((action === "parallel" || action === "tasks") && (params.tasks?.length ?? 0) > 0) {
|
|
2519
|
+
let rest = { ...params };
|
|
2520
|
+
return delete rest.action, rest;
|
|
2521
|
+
}
|
|
2522
|
+
return params;
|
|
2523
|
+
}
|
|
2524
|
+
function hasLaunchFields(params) {
|
|
2525
|
+
return params.task !== void 0 || Array.isArray(params.tasks) && params.tasks.length > 0 || Array.isArray(params.chain) && params.chain.length > 0;
|
|
2526
|
+
}
|
|
2527
|
+
function omitConflictingControlAction(params) {
|
|
2528
|
+
let action = params.action?.toLowerCase();
|
|
2529
|
+
if (!action || LAUNCH_COMPATIBLE_ACTIONS.has(action) || !hasLaunchFields(params))
|
|
2530
|
+
return params;
|
|
2531
|
+
let rest = { ...params };
|
|
2532
|
+
return delete rest.action, typeof rest.task == "string" && rest.task.length > 0 && (delete rest.tasks, delete rest.chain), rest;
|
|
2533
|
+
}
|
|
2534
|
+
function resolveSubagentRequestParams(params) {
|
|
2535
|
+
return omitConflictingControlAction(omitExecutionModeActionAlias(params));
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2419
2538
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js
|
|
2420
2539
|
var CONTROL_EVENT_TYPES = ["active_long_running", "needs_attention"], CONTROL_NOTIFICATION_CHANNELS = ["event", "async", "intercom"], DEFAULT_NOTIFY_ON = ["active_long_running", "needs_attention"], DEFAULT_CONTROL_CONFIG = {
|
|
2421
2540
|
enabled: !0,
|
|
@@ -3804,7 +3923,7 @@ var REVIEW_ONLY_PATTERNS = [
|
|
|
3804
3923
|
/\balways\s+(?:edit|modify|change|fix|patch|apply)\b/i,
|
|
3805
3924
|
/\bapply\s+(?:the\s+)?fix(?:es)?\s+directly\b/i,
|
|
3806
3925
|
/\bmake\s+(?:the\s+)?code\s+changes\b/i
|
|
3807
|
-
], NO_EDIT_PROHIBITION_PATTERN = /\b(?:do not|don't|must not)\s+(?:edit|modify|write(?:\s+to)?|touch|change)\b((?:(?!\b(?:but|and|then)\b)[^.;,:!?\n–—-])*)/gi, GENERIC_PROHIBITION_OBJECT = /^\s*(?:(?:any|all|the|these|those|your|our|existing|project|source|sources|repo|repository)[\s/,-]*)*(?:files?|code|codebase|sources?|anything|repo(?:sitory)?)?\s*$/i, SCOPED_NO_EDIT_CONSTRAINT_PATTERNS = [
|
|
3926
|
+
], NO_EDIT_PROHIBITION_PATTERN = /\b(?:do not|don't|must not)\s+(?:implement|edit|modify|write(?:\s+to)?|touch|change)\b((?:(?!\b(?:but|and|then)\b)[^.;,:!?\n–—-])*)/gi, GENERIC_PROHIBITION_OBJECT = /^\s*(?:(?:any|all|the|these|those|your|our|existing|project|source|sources|repo|repository)[\s/,-]*)*(?:files?|code|codebase|sources?|anything|repo(?:sitory)?)?\s*$/i, SCOPED_NO_EDIT_CONSTRAINT_PATTERNS = [
|
|
3808
3927
|
/\bdo not edit files?\s+outside\b/i,
|
|
3809
3928
|
/\bdo not edit\s+outside\b/i,
|
|
3810
3929
|
/\bdo not edit\s+unrelated files?\b/i,
|
|
@@ -3861,17 +3980,14 @@ function taskHasReadOnlyDeliverable(taskText) {
|
|
|
3861
3980
|
function hasImplementationIntent(taskText) {
|
|
3862
3981
|
return GENERAL_IMPLEMENTATION_PATTERNS.some((pattern) => pattern.test(taskText)) || WORKER_IMPLEMENTATION_PATTERNS.some((pattern) => pattern.test(taskText)) || REVIEWER_REQUIRED_EDIT_PATTERNS.some((pattern) => pattern.test(taskText));
|
|
3863
3982
|
}
|
|
3864
|
-
function
|
|
3865
|
-
|
|
3866
|
-
}
|
|
3867
|
-
function classifyTaskMutationIntent(permissionsOrLegacyName, task) {
|
|
3868
|
-
if (isReadOnlyPermission(permissionsOrLegacyName))
|
|
3983
|
+
function classifyTaskMutationIntent(permissions, task) {
|
|
3984
|
+
if (permissions === "read-only")
|
|
3869
3985
|
return { kind: "read-only" };
|
|
3870
3986
|
let taskText = stripFrameworkInstructions(task), taskTextWithoutScopedConstraints = stripPatterns(taskText, SCOPED_NO_EDIT_CONSTRAINT_PATTERNS), prohibitions = analyzeNoEditProhibitions(taskTextWithoutScopedConstraints);
|
|
3871
3987
|
return prohibitions.present ? prohibitions.blanket ? { kind: "read-only" } : hasImplementationIntent(prohibitions.strippedText) ? { kind: "implementation" } : { kind: "read-only" } : hasImplementationIntent(taskText) ? { kind: "implementation" } : RESEARCH_TASK_PATTERNS.some((pattern) => pattern.test(taskText)) && !hasImplementationIntent(taskText) ? { kind: "read-only" } : taskHasReadOnlyDeliverable(taskTextWithoutScopedConstraints) ? { kind: "read-only" } : { kind: "unknown" };
|
|
3872
3988
|
}
|
|
3873
|
-
function expectsImplementationMutation(
|
|
3874
|
-
return
|
|
3989
|
+
function expectsImplementationMutation(permissions, task) {
|
|
3990
|
+
return classifyTaskMutationIntent(permissions, task).kind === "implementation";
|
|
3875
3991
|
}
|
|
3876
3992
|
var MAY_MUTATE_VERB_PATTERN = /\b(?:fix|implement|update|write|edit|modify|migrate|delete|remove|refactor|commit)\b/i;
|
|
3877
3993
|
function taskMayMutate(task) {
|
|
@@ -3896,7 +4012,7 @@ var LEVEL_RANK = {
|
|
|
3896
4012
|
"diff-summary",
|
|
3897
4013
|
"review-findings",
|
|
3898
4014
|
"manual-notes"
|
|
3899
|
-
]), ACCEPTANCE_CONFIG_KEYS = /* @__PURE__ */ new Set(["level", "criteria", "evidence", "verify", "review", "stopRules", "reason"]), ACCEPTANCE_GATE_KEYS = /* @__PURE__ */ new Set(["id", "must", "evidence", "severity"]), ACCEPTANCE_VERIFY_KEYS = /* @__PURE__ */ new Set(["id", "command", "timeoutMs", "cwd", "env", "allowFailure"]), ACCEPTANCE_REVIEW_KEYS = /* @__PURE__ */ new Set(["agent", "focus", "required"]), EXPLICIT_REVIEWED_UNAVAILABLE = "cannot be requested explicitly because this run cannot supply an independent reviewer result; use checked/verified and orchestrate the reviewer separately, or omit acceptance for read-only review tasks.";
|
|
4015
|
+
]), ACCEPTANCE_CONFIG_KEYS = /* @__PURE__ */ new Set(["level", "criteria", "evidence", "verify", "review", "stopRules", "reason"]), PERSISTED_ACCEPTANCE_KEYS = /* @__PURE__ */ new Set([...ACCEPTANCE_CONFIG_KEYS, "explicit", "inferredReason"]), ACCEPTANCE_GATE_KEYS = /* @__PURE__ */ new Set(["id", "must", "evidence", "severity"]), ACCEPTANCE_VERIFY_KEYS = /* @__PURE__ */ new Set(["id", "command", "timeoutMs", "cwd", "env", "allowFailure"]), ACCEPTANCE_REVIEW_KEYS = /* @__PURE__ */ new Set(["agent", "focus", "required"]), EXPLICIT_REVIEWED_UNAVAILABLE = "cannot be requested explicitly because this run cannot supply an independent reviewer result; use checked/verified and orchestrate the reviewer separately, or omit acceptance for read-only review tasks.", RESOLVED_LEVELS = /* @__PURE__ */ new Set(["none", "attested", "checked", "verified", "reviewed"]);
|
|
3900
4016
|
function normalizeLevel(level) {
|
|
3901
4017
|
return level ?? "auto";
|
|
3902
4018
|
}
|
|
@@ -3946,18 +4062,25 @@ function normalizeAcceptanceInput(input) {
|
|
|
3946
4062
|
function explicitAcceptanceCanDisable(explicit) {
|
|
3947
4063
|
return explicit.level === "none" && typeof explicit.reason == "string" && explicit.reason.trim().length > 0;
|
|
3948
4064
|
}
|
|
3949
|
-
function
|
|
4065
|
+
function validateAcceptanceValue(input, pathLabel, mode) {
|
|
3950
4066
|
let errors = [];
|
|
3951
|
-
if (input === void 0
|
|
4067
|
+
if (input === void 0)
|
|
3952
4068
|
return errors;
|
|
3953
|
-
if (
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
4069
|
+
if (mode === "persisted") {
|
|
4070
|
+
if (!input || typeof input != "object" || Array.isArray(input))
|
|
4071
|
+
return errors.push(`${pathLabel} must be a resolved acceptance object.`), errors;
|
|
4072
|
+
} else {
|
|
4073
|
+
if (input === !1)
|
|
4074
|
+
return errors;
|
|
4075
|
+
if (typeof input == "string")
|
|
4076
|
+
return VALID_LEVELS.has(input) ? input === "none" ? errors.push(`${pathLabel} level "none" requires a reason; use { level: "none", reason: "..." }.`) : input === "reviewed" && errors.push(`${pathLabel} ${EXPLICIT_REVIEWED_UNAVAILABLE}`) : errors.push(`${pathLabel} has invalid level '${input}'.`), errors;
|
|
4077
|
+
if (!input || typeof input != "object" || Array.isArray(input))
|
|
4078
|
+
return errors.push(`${pathLabel} must be a string level, false, or an object.`), errors;
|
|
4079
|
+
}
|
|
4080
|
+
let value = input, allowedKeys = mode === "persisted" ? PERSISTED_ACCEPTANCE_KEYS : ACCEPTANCE_CONFIG_KEYS;
|
|
3958
4081
|
for (let key of Object.keys(value))
|
|
3959
|
-
|
|
3960
|
-
if (value.level !== void 0 && (typeof value.level != "string" || !VALID_LEVELS.has(value.level)) && errors.push(`${pathLabel}.level must be one of auto, none, attested, checked, verified, reviewed.`), value.level === "none" && (typeof value.reason != "string" || !value.reason.trim()) && errors.push(`${pathLabel}.reason is required when level is none.`), value.level === "reviewed" && errors.push(`${pathLabel}.level ${EXPLICIT_REVIEWED_UNAVAILABLE}`), value.reason !== void 0 && typeof value.reason != "string" && errors.push(`${pathLabel}.reason must be a string.`), value.criteria !== void 0 && !Array.isArray(value.criteria) && errors.push(`${pathLabel}.criteria must be an array.`), Array.isArray(value.criteria)) {
|
|
4082
|
+
allowedKeys.has(key) || errors.push(`${pathLabel}.${key} is not supported.`);
|
|
4083
|
+
if (mode === "persisted" ? (typeof value.level != "string" || !RESOLVED_LEVELS.has(value.level)) && errors.push(`${pathLabel}.level must be one of none, attested, checked, verified, reviewed.`) : value.level !== void 0 && (typeof value.level != "string" || !VALID_LEVELS.has(value.level)) && errors.push(`${pathLabel}.level must be one of auto, none, attested, checked, verified, reviewed.`), value.level === "none" && (typeof value.reason != "string" || !value.reason.trim()) && errors.push(`${pathLabel}.reason is required when level is none.`), mode === "launch" && value.level === "reviewed" && errors.push(`${pathLabel}.level ${EXPLICIT_REVIEWED_UNAVAILABLE}`), mode === "persisted" && (value.explicit !== void 0 && typeof value.explicit != "boolean" && errors.push(`${pathLabel}.explicit must be a boolean.`), value.inferredReason !== void 0 && (!Array.isArray(value.inferredReason) || value.inferredReason.some((item) => typeof item != "string")) && errors.push(`${pathLabel}.inferredReason must be an array of strings.`)), value.reason !== void 0 && typeof value.reason != "string" && errors.push(`${pathLabel}.reason must be a string.`), value.criteria !== void 0 && !Array.isArray(value.criteria) && errors.push(`${pathLabel}.criteria must be an array.`), Array.isArray(value.criteria)) {
|
|
3961
4084
|
let criterionIds = /* @__PURE__ */ new Set();
|
|
3962
4085
|
for (let [index, criterion] of value.criteria.entries()) {
|
|
3963
4086
|
if (typeof criterion == "string")
|
|
@@ -4017,6 +4140,29 @@ function validateAcceptanceInput(input, pathLabel = "acceptance") {
|
|
|
4017
4140
|
typeof item != "string" && errors.push(`${pathLabel}.stopRules[${index}] must be a string.`);
|
|
4018
4141
|
return errors;
|
|
4019
4142
|
}
|
|
4143
|
+
function validateAcceptanceInput(input, pathLabel = "acceptance") {
|
|
4144
|
+
return validateAcceptanceValue(input, pathLabel, "launch");
|
|
4145
|
+
}
|
|
4146
|
+
function validatePersistedAcceptance(input, pathLabel = "acceptance") {
|
|
4147
|
+
return validateAcceptanceValue(input, pathLabel, "persisted");
|
|
4148
|
+
}
|
|
4149
|
+
function restorePersistedAcceptance(input, pathLabel = "acceptance") {
|
|
4150
|
+
let errors = validatePersistedAcceptance(input, pathLabel);
|
|
4151
|
+
if (errors.length > 0)
|
|
4152
|
+
throw new Error(errors.join(" "));
|
|
4153
|
+
let value = input, evidence = Array.isArray(value.evidence) ? unique(value.evidence.filter((item) => VALID_EVIDENCE.has(item))) : [];
|
|
4154
|
+
return {
|
|
4155
|
+
level: value.level,
|
|
4156
|
+
explicit: value.explicit === !0,
|
|
4157
|
+
inferredReason: Array.isArray(value.inferredReason) ? value.inferredReason.filter((item) => typeof item == "string") : [],
|
|
4158
|
+
criteria: normalizeCriteria(value.criteria, evidence),
|
|
4159
|
+
evidence,
|
|
4160
|
+
verify: Array.isArray(value.verify) ? value.verify : [],
|
|
4161
|
+
review: value.review,
|
|
4162
|
+
stopRules: Array.isArray(value.stopRules) ? value.stopRules.filter((item) => typeof item == "string") : [],
|
|
4163
|
+
...typeof value.reason == "string" ? { reason: value.reason } : {}
|
|
4164
|
+
};
|
|
4165
|
+
}
|
|
4020
4166
|
function validateExecutionAcceptance(input) {
|
|
4021
4167
|
let errors = validateAcceptanceInput(input.acceptance, "acceptance");
|
|
4022
4168
|
for (let [index, task] of (input.tasks ?? []).entries())
|
|
@@ -4038,9 +4184,11 @@ function normalizeCriteria(criteria, evidence) {
|
|
|
4038
4184
|
}
|
|
4039
4185
|
function resolveEffectiveAcceptance(input) {
|
|
4040
4186
|
let explicit = normalizeAcceptanceInput(input.explicit), inferred = inferLevel(input), explicitLevel = normalizeLevel(explicit.level), level = explicitAcceptanceCanDisable(explicit) ? "none" : explicitLevel === "auto" ? inferred.level : LEVEL_RANK[explicitLevel] >= LEVEL_RANK[inferred.level] ? explicitLevel : inferred.level, evidence = unique([...level === inferred.level ? inferred.evidence : requiredEvidenceForLevel(level), ...explicit.evidence ?? []]), criteria = normalizeCriteria(explicit.criteria?.length ? explicit.criteria : inferred.criteria, evidence), review = explicit.review !== void 0 ? explicit.review : inferred.review;
|
|
4041
|
-
|
|
4187
|
+
level === "reviewed" && input.explicit !== void 0 && explicitLevel !== "reviewed" && explicit.review === void 0 && review && review !== !1 && (review = { ...review, required: !1 });
|
|
4188
|
+
let parentRequestedLevel = input.explicit === void 0 || explicitLevel === "auto" ? void 0 : explicitLevel;
|
|
4189
|
+
return {
|
|
4042
4190
|
level,
|
|
4043
|
-
explicit:
|
|
4191
|
+
explicit: parentRequestedLevel === level,
|
|
4044
4192
|
inferredReason: inferred.reasons,
|
|
4045
4193
|
criteria,
|
|
4046
4194
|
evidence,
|
|
@@ -4603,6 +4751,17 @@ function acceptanceFailureMessage(ledger) {
|
|
|
4603
4751
|
return failedVerify ? `Acceptance verification '${failedVerify.id}' ${failedVerify.status}.` : ledger.reviewResult?.status === "needs-parent-decision" ? "Acceptance review required but no automatic reviewer result is available." : ledger.reviewResult?.status === "blockers" ? "Acceptance review found blockers." : "Acceptance rejected.";
|
|
4604
4752
|
}
|
|
4605
4753
|
|
|
4754
|
+
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js
|
|
4755
|
+
function normalizeAsyncLaunchConfig(config) {
|
|
4756
|
+
return { ...config, asyncByDefault: !0, forceTopLevelAsync: !1 };
|
|
4757
|
+
}
|
|
4758
|
+
function subagentLaunchRunsAsync(params) {
|
|
4759
|
+
return !(params.foregroundOnly === !0 || params.clarify === !0 || params.async === !1);
|
|
4760
|
+
}
|
|
4761
|
+
function isAsyncSubagentExecution(params) {
|
|
4762
|
+
return params.action || !params.task && !params.tasks?.length && !params.chain?.length ? !1 : subagentLaunchRunsAsync(params);
|
|
4763
|
+
}
|
|
4764
|
+
|
|
4606
4765
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/turn-budget.js
|
|
4607
4766
|
function resolveTurnBudgetConfig(raw, label = "turnBudget") {
|
|
4608
4767
|
if (raw === void 0)
|
|
@@ -4663,132 +4822,36 @@ function shouldAbortForTurnBudget(budget, turnCount, terminalAssistantStop) {
|
|
|
4663
4822
|
return turnCount < hardLimit ? !1 : turnCount > hardLimit ? !0 : !terminalAssistantStop;
|
|
4664
4823
|
}
|
|
4665
4824
|
|
|
4666
|
-
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js
|
|
4667
|
-
import * as fs14 from "node:fs";
|
|
4668
|
-
import * as os7 from "node:os";
|
|
4669
|
-
import * as path15 from "node:path";
|
|
4670
|
-
var NATIVE_INTERCOM_EXTENSION_DIR = "native:pi-subagents-supervisor-channel";
|
|
4671
|
-
function defaultAgentDir() {
|
|
4672
|
-
return getAgentDir();
|
|
4673
|
-
}
|
|
4674
|
-
function defaultSubagentConfigDir(agentDir = defaultAgentDir()) {
|
|
4675
|
-
return path15.join(agentDir, "extensions", "subagent");
|
|
4676
|
-
}
|
|
4677
|
-
var DEFAULT_INTERCOM_TARGET_PREFIX = "subagent-chat", INTERCOM_BRIDGE_MARKER = "Intercom orchestration channel:", DEFAULT_INTERCOM_BRIDGE_TEMPLATE = `The inherited thread is reference-only. Do not continue that conversation or send questions, status updates, or completion handoffs to the supervisor in normal assistant text.
|
|
4678
|
-
|
|
4679
|
-
Use contact_supervisor first. It resolves the supervisor session "{orchestratorTarget}" and run metadata automatically.
|
|
4680
|
-
- Need a decision, blocked, approval, or product/API/scope ambiguity: contact_supervisor({ reason: "need_decision", message: "<question>" })
|
|
4681
|
-
- Need structured supervisor input rather than a freeform reply: contact_supervisor({ reason: "interview_request", message: "<what input is needed>", interview: { title: "...", questions: [] } })
|
|
4682
|
-
- After contact_supervisor with reason "need_decision" or "interview_request", stay alive and continue only after the reply arrives. Do not finish your final response with a choose-one question.
|
|
4683
|
-
- Do not ask for clarification when the only conflict is review-only/no-edit versus progress-writing or artifact-writing instructions. If an output path is configured but no write-capable tool is available, return the complete artifact in your final response; the runtime will persist it. Do not contact the supervisor merely because you cannot write that output path directly.
|
|
4684
|
-
- Meaningful progress or unexpected discoveries that change the plan: contact_supervisor({ reason: "progress_update", message: "UPDATE: <summary>" })
|
|
4685
|
-
- Generic intercom is lower-level plumbing/fallback only: intercom({ action: "ask", to: "{orchestratorTarget}", message: "<question>" })
|
|
4686
|
-
|
|
4687
|
-
Do not use contact_supervisor or intercom for routine completion handoffs. If no coordination is needed, return a focused task result.`;
|
|
4688
|
-
function resolveIntercomSessionTarget(sessionName, sessionId) {
|
|
4689
|
-
let trimmedName = sessionName?.trim();
|
|
4690
|
-
if (trimmedName)
|
|
4691
|
-
return trimmedName;
|
|
4692
|
-
let normalizedSessionId = sessionId.startsWith("session-") ? sessionId.slice(8) : sessionId;
|
|
4693
|
-
return `${DEFAULT_INTERCOM_TARGET_PREFIX}-${normalizedSessionId.slice(0, 8)}`;
|
|
4694
|
-
}
|
|
4695
|
-
function sanitizeIntercomTargetPart(value) {
|
|
4696
|
-
return value.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "agent";
|
|
4697
|
-
}
|
|
4698
|
-
function resolveSubagentIntercomTarget(runId, agent, index) {
|
|
4699
|
-
let stepSuffix = index !== void 0 ? `-${index + 1}` : "";
|
|
4700
|
-
return `subagent-${sanitizeIntercomTargetPart(agent)}-${sanitizeIntercomTargetPart(runId)}${stepSuffix}`;
|
|
4701
|
-
}
|
|
4702
|
-
function resolveIntercomBridgeMode(value) {
|
|
4703
|
-
return value === "off" || value === "always" || value === "fork-only" ? value : "always";
|
|
4704
|
-
}
|
|
4705
|
-
function resolveIntercomBridgeConfig(value) {
|
|
4706
|
-
return !value || typeof value != "object" || Array.isArray(value) ? { mode: "always", instructionFile: "" } : {
|
|
4707
|
-
mode: resolveIntercomBridgeMode(value.mode),
|
|
4708
|
-
instructionFile: typeof value.instructionFile == "string" ? value.instructionFile : ""
|
|
4709
|
-
};
|
|
4710
|
-
}
|
|
4711
|
-
function expandTilde(filePath) {
|
|
4712
|
-
return filePath.startsWith("~/") ? path15.join(os7.homedir(), filePath.slice(2)) : filePath;
|
|
4713
|
-
}
|
|
4714
|
-
function resolveInstructionTemplate(instructionFile, settingsDir) {
|
|
4715
|
-
if (!instructionFile)
|
|
4716
|
-
return DEFAULT_INTERCOM_BRIDGE_TEMPLATE;
|
|
4717
|
-
let expandedPath = expandTilde(instructionFile), resolvedPath = path15.isAbsolute(expandedPath) ? expandedPath : path15.resolve(settingsDir, expandedPath);
|
|
4718
|
-
try {
|
|
4719
|
-
return fs14.readFileSync(resolvedPath, "utf-8");
|
|
4720
|
-
} catch (error) {
|
|
4721
|
-
return console.warn(`Failed to read intercom bridge instructionFile at '${resolvedPath}'. Using default instructions.`, error), DEFAULT_INTERCOM_BRIDGE_TEMPLATE;
|
|
4722
|
-
}
|
|
4723
|
-
}
|
|
4724
|
-
function buildIntercomBridgeInstruction(orchestratorTarget, template) {
|
|
4725
|
-
let instruction = template.replaceAll("{orchestratorTarget}", orchestratorTarget).trim();
|
|
4726
|
-
return instruction.startsWith(INTERCOM_BRIDGE_MARKER) ? instruction : `${INTERCOM_BRIDGE_MARKER}
|
|
4727
|
-
${instruction}`;
|
|
4728
|
-
}
|
|
4729
|
-
function inactiveReason(mode, context, orchestratorTarget) {
|
|
4730
|
-
if (mode === "off")
|
|
4731
|
-
return "bridge mode is off";
|
|
4732
|
-
if (mode === "fork-only" && context !== "fork")
|
|
4733
|
-
return "bridge mode is fork-only and context is not fork";
|
|
4734
|
-
if (!orchestratorTarget)
|
|
4735
|
-
return "orchestrator target is not available";
|
|
4736
|
-
}
|
|
4737
|
-
function diagnoseIntercomBridge(input) {
|
|
4738
|
-
let mode = resolveIntercomBridgeConfig(input.config).mode, orchestratorTarget = input.orchestratorTarget?.trim(), wantsIntercom = mode !== "off" && !(mode === "fork-only" && input.context !== "fork"), reason = inactiveReason(mode, input.context, orchestratorTarget);
|
|
4739
|
-
return {
|
|
4740
|
-
active: reason === void 0,
|
|
4741
|
-
mode,
|
|
4742
|
-
wantsIntercom,
|
|
4743
|
-
supervisorChannelAvailable: !0,
|
|
4744
|
-
extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
|
|
4745
|
-
...orchestratorTarget ? { orchestratorTarget } : {},
|
|
4746
|
-
...reason ? { reason } : {}
|
|
4747
|
-
};
|
|
4748
|
-
}
|
|
4749
|
-
function resolveIntercomBridge(input) {
|
|
4750
|
-
let config = resolveIntercomBridgeConfig(input.config), mode = config.mode, orchestratorTarget = input.orchestratorTarget?.trim(), agentDir = path15.resolve(input.agentDir ?? defaultAgentDir()), settingsDir = path15.resolve(input.settingsDir ?? defaultSubagentConfigDir(agentDir)), defaultInstruction = buildIntercomBridgeInstruction(orchestratorTarget || "{orchestratorTarget}", DEFAULT_INTERCOM_BRIDGE_TEMPLATE);
|
|
4751
|
-
return inactiveReason(mode, input.context, orchestratorTarget) || !orchestratorTarget ? { active: !1, mode, extensionDir: NATIVE_INTERCOM_EXTENSION_DIR, instruction: defaultInstruction } : {
|
|
4752
|
-
active: !0,
|
|
4753
|
-
mode,
|
|
4754
|
-
orchestratorTarget,
|
|
4755
|
-
extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
|
|
4756
|
-
instruction: buildIntercomBridgeInstruction(orchestratorTarget, resolveInstructionTemplate(config.instructionFile, settingsDir))
|
|
4757
|
-
};
|
|
4758
|
-
}
|
|
4759
|
-
function applyIntercomBridgeToAgent(agent, bridge) {
|
|
4760
|
-
if (!bridge.active || !bridge.orchestratorTarget)
|
|
4761
|
-
return agent;
|
|
4762
|
-
let bridgeTools = ["intercom", "contact_supervisor"], tools = agent.tools ? [...agent.tools, ...bridgeTools.filter((tool) => !agent.tools?.includes(tool))] : agent.tools, instruction = bridge.instruction, trimmedPrompt = agent.systemPrompt?.trim() || "", systemPrompt = trimmedPrompt.includes(INTERCOM_BRIDGE_MARKER) ? trimmedPrompt : trimmedPrompt ? `${trimmedPrompt}
|
|
4763
|
-
|
|
4764
|
-
${instruction}` : instruction;
|
|
4765
|
-
return tools === agent.tools && systemPrompt === agent.systemPrompt ? agent : {
|
|
4766
|
-
...agent,
|
|
4767
|
-
tools,
|
|
4768
|
-
systemPrompt
|
|
4769
|
-
};
|
|
4770
|
-
}
|
|
4771
|
-
|
|
4772
4825
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/control-channel.js
|
|
4773
4826
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
4774
|
-
import * as
|
|
4775
|
-
import * as
|
|
4827
|
+
import * as fs14 from "node:fs";
|
|
4828
|
+
import * as path15 from "node:path";
|
|
4776
4829
|
var INTERRUPT_SIGNAL = process.platform === "win32" ? "SIGBREAK" : "SIGUSR2", STEER_REQUESTS_DIR = "steer-requests";
|
|
4777
|
-
var STEER_ACKS_DIR = "steer-acks", STEER_INBOX_CLOSED_FILE = "steer-inbox-closed.json", MAX_STEER_MESSAGE_BYTES = 128 * 1024, MAX_STEER_REQUEST_ID_LENGTH = 256;
|
|
4830
|
+
var STEER_CAPABILITIES_DIR = "steer-capabilities", STEER_ACKS_DIR = "steer-acks", STEER_INBOX_CLOSED_FILE = "steer-inbox-closed.json", MAX_STEER_MESSAGE_BYTES = 128 * 1024, MAX_STEER_REQUEST_ID_LENGTH = 256;
|
|
4778
4831
|
function controlInboxDir(asyncDir) {
|
|
4779
|
-
return
|
|
4832
|
+
return path15.join(asyncDir, "control");
|
|
4780
4833
|
}
|
|
4781
4834
|
function interruptRequestPath(asyncDir) {
|
|
4782
|
-
return
|
|
4835
|
+
return path15.join(controlInboxDir(asyncDir), "interrupt.json");
|
|
4783
4836
|
}
|
|
4784
4837
|
function stopRequestPath(asyncDir) {
|
|
4785
|
-
return
|
|
4838
|
+
return path15.join(controlInboxDir(asyncDir), "stop.json");
|
|
4786
4839
|
}
|
|
4787
4840
|
function steerRequestsDir(asyncDir) {
|
|
4788
|
-
return
|
|
4841
|
+
return path15.join(controlInboxDir(asyncDir), STEER_REQUESTS_DIR);
|
|
4789
4842
|
}
|
|
4790
4843
|
function steerInboxClosedPath(asyncDir) {
|
|
4791
|
-
return
|
|
4844
|
+
return path15.join(controlInboxDir(asyncDir), STEER_INBOX_CLOSED_FILE);
|
|
4845
|
+
}
|
|
4846
|
+
function steerCapabilitiesDir(asyncDir) {
|
|
4847
|
+
return path15.join(controlInboxDir(asyncDir), STEER_CAPABILITIES_DIR);
|
|
4848
|
+
}
|
|
4849
|
+
function steerCapabilityPath(asyncDir, index) {
|
|
4850
|
+
return assertChildIndex(index), path15.join(steerCapabilitiesDir(asyncDir), `${index}.json`);
|
|
4851
|
+
}
|
|
4852
|
+
function assertChildIndex(index) {
|
|
4853
|
+
if (!Number.isInteger(index) || index < 0 || index > 1e6)
|
|
4854
|
+
throw new Error("steer child index must be a non-negative integer.");
|
|
4792
4855
|
}
|
|
4793
4856
|
function steerRequestFileName(request) {
|
|
4794
4857
|
return `${String(request.ts).padStart(13, "0")}-${Buffer.from(request.id).toString("base64url")}.json`;
|
|
@@ -4799,7 +4862,7 @@ function validSteerRequest(request) {
|
|
|
4799
4862
|
function writeSteerRequestToDir(dir, request) {
|
|
4800
4863
|
if (!validSteerRequest(request))
|
|
4801
4864
|
throw new Error("steer request is malformed or exceeds transport limits.");
|
|
4802
|
-
let requestPath =
|
|
4865
|
+
let requestPath = path15.join(dir, steerRequestFileName(request));
|
|
4803
4866
|
return writeAtomicJson(requestPath, request), requestPath;
|
|
4804
4867
|
}
|
|
4805
4868
|
function requestAsyncInterrupt(asyncDir, payload = {}, deps = {}) {
|
|
@@ -4821,7 +4884,7 @@ function requestAsyncSteer(asyncDir, payload, deps = {}) {
|
|
|
4821
4884
|
if (payload.targetIndexes !== void 0 && (!Array.isArray(payload.targetIndexes) || payload.targetIndex !== void 0 || payload.targetIndexes.length === 0 || payload.targetIndexes.length > 1e3 || payload.targetIndexes.some((index) => !Number.isInteger(index) || index < 0 || index > 1e6) || new Set(payload.targetIndexes).size !== payload.targetIndexes.length))
|
|
4822
4885
|
throw new Error("steer targetIndexes must contain 1-1000 unique non-negative integers and cannot be combined with targetIndex.");
|
|
4823
4886
|
let closedPath = steerInboxClosedPath(asyncDir);
|
|
4824
|
-
if (
|
|
4887
|
+
if (fs14.existsSync(closedPath))
|
|
4825
4888
|
throw new Error("Async run no longer accepts steering requests.");
|
|
4826
4889
|
let request = {
|
|
4827
4890
|
type: "steer",
|
|
@@ -4832,10 +4895,17 @@ function requestAsyncSteer(asyncDir, payload, deps = {}) {
|
|
|
4832
4895
|
...payload.targetIndexes !== void 0 ? { targetIndexes: [...payload.targetIndexes] } : {},
|
|
4833
4896
|
...payload.source ? { source: payload.source } : {}
|
|
4834
4897
|
}, requestPath = writeSteerRequestToDir(steerRequestsDir(asyncDir), request);
|
|
4835
|
-
if (
|
|
4836
|
-
throw
|
|
4898
|
+
if (fs14.existsSync(closedPath))
|
|
4899
|
+
throw fs14.rmSync(requestPath, { force: !0 }), new Error("Async run stopped accepting steering before the request was committed.");
|
|
4837
4900
|
return requestPath;
|
|
4838
4901
|
}
|
|
4902
|
+
function parseSteerCapability(raw) {
|
|
4903
|
+
if (!raw || typeof raw != "object" || Array.isArray(raw))
|
|
4904
|
+
return;
|
|
4905
|
+
let input = raw;
|
|
4906
|
+
if (!(input.type !== "steer-capability" || input.protocolVersion !== 1) && !(!Number.isInteger(input.index) || input.index < 0 || input.index > 1e6) && !(!Number.isInteger(input.pid) || input.pid <= 0 || !Number.isFinite(input.readyAt) || input.readyAt <= 0 || typeof input.supported != "boolean"))
|
|
4907
|
+
return { type: "steer-capability", protocolVersion: 1, index: input.index, pid: input.pid, readyAt: input.readyAt, supported: input.supported };
|
|
4908
|
+
}
|
|
4839
4909
|
function parseSteerAck(raw) {
|
|
4840
4910
|
if (!raw || typeof raw != "object" || Array.isArray(raw))
|
|
4841
4911
|
return;
|
|
@@ -4843,8 +4913,15 @@ function parseSteerAck(raw) {
|
|
|
4843
4913
|
if (!(input.type !== "steer-ack" || input.protocolVersion !== 1 || typeof input.requestId != "string" || !/^[^\s]+$/.test(input.requestId) || input.requestId.length > 256) && !(!Number.isInteger(input.index) || input.index < 0 || input.index > 1e6 || !Number.isFinite(input.ts) || input.ts <= 0) && !(input.state !== "delivered" && input.state !== "failed") && !(typeof input.message != "string" || !input.message.trim() || input.message.length > 1e3))
|
|
4844
4914
|
return { type: "steer-ack", protocolVersion: 1, requestId: input.requestId, index: input.index, ts: input.ts, state: input.state, message: input.message.trim() };
|
|
4845
4915
|
}
|
|
4846
|
-
function
|
|
4847
|
-
|
|
4916
|
+
function readSteerCapability(asyncDir, index) {
|
|
4917
|
+
try {
|
|
4918
|
+
return parseSteerCapability(JSON.parse(fs14.readFileSync(steerCapabilityPath(asyncDir, index), "utf-8")));
|
|
4919
|
+
} catch {
|
|
4920
|
+
return;
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
function consumeSteerAcks(asyncDir, fsImpl = fs14) {
|
|
4924
|
+
let root = path15.join(controlInboxDir(asyncDir), STEER_ACKS_DIR);
|
|
4848
4925
|
if (!fsImpl.existsSync(root))
|
|
4849
4926
|
return [];
|
|
4850
4927
|
let acks = [], indexNames;
|
|
@@ -4854,14 +4931,14 @@ function consumeSteerAcks(asyncDir, fsImpl = fs15) {
|
|
|
4854
4931
|
return [];
|
|
4855
4932
|
}
|
|
4856
4933
|
for (let indexName of indexNames) {
|
|
4857
|
-
let dir =
|
|
4934
|
+
let dir = path15.join(root, indexName), entries;
|
|
4858
4935
|
try {
|
|
4859
4936
|
entries = fsImpl.readdirSync(dir).filter((name) => name.endsWith(".json")).sort();
|
|
4860
4937
|
} catch {
|
|
4861
4938
|
continue;
|
|
4862
4939
|
}
|
|
4863
4940
|
for (let entry of entries) {
|
|
4864
|
-
let target =
|
|
4941
|
+
let target = path15.join(dir, entry), ack;
|
|
4865
4942
|
try {
|
|
4866
4943
|
ack = parseSteerAck(JSON.parse(fsImpl.readFileSync(target, "utf-8")));
|
|
4867
4944
|
} catch {
|
|
@@ -4886,7 +4963,7 @@ function deliverInterruptRequest(input) {
|
|
|
4886
4963
|
if (error?.code === "ENOSYS")
|
|
4887
4964
|
return;
|
|
4888
4965
|
try {
|
|
4889
|
-
|
|
4966
|
+
fs14.rmSync(requestPath, { force: !0 });
|
|
4890
4967
|
} catch {
|
|
4891
4968
|
}
|
|
4892
4969
|
throw error;
|
|
@@ -4896,6 +4973,112 @@ function deliverStopRequest(input) {
|
|
|
4896
4973
|
requestAsyncStop(input.asyncDir, input.source ? { source: input.source } : {}, { now: input.now });
|
|
4897
4974
|
}
|
|
4898
4975
|
|
|
4976
|
+
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js
|
|
4977
|
+
import * as fs15 from "node:fs";
|
|
4978
|
+
import * as os7 from "node:os";
|
|
4979
|
+
import * as path16 from "node:path";
|
|
4980
|
+
var NATIVE_INTERCOM_EXTENSION_DIR = "native:pi-subagents-supervisor-channel";
|
|
4981
|
+
function defaultAgentDir() {
|
|
4982
|
+
return getAgentDir();
|
|
4983
|
+
}
|
|
4984
|
+
function defaultSubagentConfigDir(agentDir = defaultAgentDir()) {
|
|
4985
|
+
return path16.join(agentDir, "extensions", "subagent");
|
|
4986
|
+
}
|
|
4987
|
+
var DEFAULT_INTERCOM_TARGET_PREFIX = "subagent-chat", INTERCOM_BRIDGE_MARKER = "Intercom orchestration channel:", DEFAULT_INTERCOM_BRIDGE_TEMPLATE = `The inherited thread is reference-only. Do not continue that conversation or send questions, status updates, or completion handoffs to the supervisor in normal assistant text.
|
|
4988
|
+
|
|
4989
|
+
Use contact_supervisor first. It resolves the supervisor session "{orchestratorTarget}" and run metadata automatically.
|
|
4990
|
+
- Need a decision, blocked, approval, or product/API/scope ambiguity: contact_supervisor({ reason: "need_decision", message: "<question>" })
|
|
4991
|
+
- Need structured supervisor input rather than a freeform reply: contact_supervisor({ reason: "interview_request", message: "<what input is needed>", interview: { title: "...", questions: [] } })
|
|
4992
|
+
- After contact_supervisor with reason "need_decision" or "interview_request", stay alive and continue only after the reply arrives. Do not finish your final response with a choose-one question.
|
|
4993
|
+
- Do not ask for clarification when the only conflict is review-only/no-edit versus progress-writing or artifact-writing instructions. If an output path is configured but no write-capable tool is available, return the complete artifact in your final response; the runtime will persist it. Do not contact the supervisor merely because you cannot write that output path directly.
|
|
4994
|
+
- Meaningful progress or unexpected discoveries that change the plan: contact_supervisor({ reason: "progress_update", message: "UPDATE: <summary>" })
|
|
4995
|
+
- Generic intercom is lower-level plumbing/fallback only: intercom({ action: "ask", to: "{orchestratorTarget}", message: "<question>" })
|
|
4996
|
+
|
|
4997
|
+
Do not use contact_supervisor or intercom for routine completion handoffs. If no coordination is needed, return a focused task result.`;
|
|
4998
|
+
function resolveIntercomSessionTarget(sessionName, sessionId) {
|
|
4999
|
+
let trimmedName = sessionName?.trim();
|
|
5000
|
+
if (trimmedName)
|
|
5001
|
+
return trimmedName;
|
|
5002
|
+
let normalizedSessionId = sessionId.startsWith("session-") ? sessionId.slice(8) : sessionId;
|
|
5003
|
+
return `${DEFAULT_INTERCOM_TARGET_PREFIX}-${normalizedSessionId.slice(0, 8)}`;
|
|
5004
|
+
}
|
|
5005
|
+
function sanitizeIntercomTargetPart(value) {
|
|
5006
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "agent";
|
|
5007
|
+
}
|
|
5008
|
+
function resolveSubagentIntercomTarget(runId, agent, index) {
|
|
5009
|
+
let stepSuffix = index !== void 0 ? `-${index + 1}` : "";
|
|
5010
|
+
return `subagent-${sanitizeIntercomTargetPart(agent)}-${sanitizeIntercomTargetPart(runId)}${stepSuffix}`;
|
|
5011
|
+
}
|
|
5012
|
+
function resolveIntercomBridgeMode(value) {
|
|
5013
|
+
return value === "off" || value === "always" || value === "fork-only" ? value : "always";
|
|
5014
|
+
}
|
|
5015
|
+
function resolveIntercomBridgeConfig(value) {
|
|
5016
|
+
return !value || typeof value != "object" || Array.isArray(value) ? { mode: "always", instructionFile: "" } : {
|
|
5017
|
+
mode: resolveIntercomBridgeMode(value.mode),
|
|
5018
|
+
instructionFile: typeof value.instructionFile == "string" ? value.instructionFile : ""
|
|
5019
|
+
};
|
|
5020
|
+
}
|
|
5021
|
+
function expandTilde(filePath) {
|
|
5022
|
+
return filePath.startsWith("~/") ? path16.join(os7.homedir(), filePath.slice(2)) : filePath;
|
|
5023
|
+
}
|
|
5024
|
+
function resolveInstructionTemplate(instructionFile, settingsDir) {
|
|
5025
|
+
if (!instructionFile)
|
|
5026
|
+
return DEFAULT_INTERCOM_BRIDGE_TEMPLATE;
|
|
5027
|
+
let expandedPath = expandTilde(instructionFile), resolvedPath = path16.isAbsolute(expandedPath) ? expandedPath : path16.resolve(settingsDir, expandedPath);
|
|
5028
|
+
try {
|
|
5029
|
+
return fs15.readFileSync(resolvedPath, "utf-8");
|
|
5030
|
+
} catch (error) {
|
|
5031
|
+
return console.warn(`Failed to read intercom bridge instructionFile at '${resolvedPath}'. Using default instructions.`, error), DEFAULT_INTERCOM_BRIDGE_TEMPLATE;
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
function buildIntercomBridgeInstruction(orchestratorTarget, template) {
|
|
5035
|
+
let instruction = template.replaceAll("{orchestratorTarget}", orchestratorTarget).trim();
|
|
5036
|
+
return instruction.startsWith(INTERCOM_BRIDGE_MARKER) ? instruction : `${INTERCOM_BRIDGE_MARKER}
|
|
5037
|
+
${instruction}`;
|
|
5038
|
+
}
|
|
5039
|
+
function inactiveReason(mode, context, orchestratorTarget) {
|
|
5040
|
+
if (mode === "off")
|
|
5041
|
+
return "bridge mode is off";
|
|
5042
|
+
if (mode === "fork-only" && context !== "fork")
|
|
5043
|
+
return "bridge mode is fork-only and context is not fork";
|
|
5044
|
+
if (!orchestratorTarget)
|
|
5045
|
+
return "orchestrator target is not available";
|
|
5046
|
+
}
|
|
5047
|
+
function diagnoseIntercomBridge(input) {
|
|
5048
|
+
let mode = resolveIntercomBridgeConfig(input.config).mode, orchestratorTarget = input.orchestratorTarget?.trim(), wantsIntercom = mode !== "off" && !(mode === "fork-only" && input.context !== "fork"), reason = inactiveReason(mode, input.context, orchestratorTarget);
|
|
5049
|
+
return {
|
|
5050
|
+
active: reason === void 0,
|
|
5051
|
+
mode,
|
|
5052
|
+
wantsIntercom,
|
|
5053
|
+
supervisorChannelAvailable: !0,
|
|
5054
|
+
extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
|
|
5055
|
+
...orchestratorTarget ? { orchestratorTarget } : {},
|
|
5056
|
+
...reason ? { reason } : {}
|
|
5057
|
+
};
|
|
5058
|
+
}
|
|
5059
|
+
function resolveIntercomBridge(input) {
|
|
5060
|
+
let config = resolveIntercomBridgeConfig(input.config), mode = config.mode, orchestratorTarget = input.orchestratorTarget?.trim(), agentDir = path16.resolve(input.agentDir ?? defaultAgentDir()), settingsDir = path16.resolve(input.settingsDir ?? defaultSubagentConfigDir(agentDir)), defaultInstruction = buildIntercomBridgeInstruction(orchestratorTarget || "{orchestratorTarget}", DEFAULT_INTERCOM_BRIDGE_TEMPLATE);
|
|
5061
|
+
return inactiveReason(mode, input.context, orchestratorTarget) || !orchestratorTarget ? { active: !1, mode, extensionDir: NATIVE_INTERCOM_EXTENSION_DIR, instruction: defaultInstruction } : {
|
|
5062
|
+
active: !0,
|
|
5063
|
+
mode,
|
|
5064
|
+
orchestratorTarget,
|
|
5065
|
+
extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
|
|
5066
|
+
instruction: buildIntercomBridgeInstruction(orchestratorTarget, resolveInstructionTemplate(config.instructionFile, settingsDir))
|
|
5067
|
+
};
|
|
5068
|
+
}
|
|
5069
|
+
function applyIntercomBridgeToAgent(agent, bridge) {
|
|
5070
|
+
if (!bridge.active || !bridge.orchestratorTarget)
|
|
5071
|
+
return agent;
|
|
5072
|
+
let bridgeTools = ["intercom", "contact_supervisor"], tools = agent.tools ? [...agent.tools, ...bridgeTools.filter((tool) => !agent.tools?.includes(tool))] : agent.tools, instruction = bridge.instruction, trimmedPrompt = agent.systemPrompt?.trim() || "", systemPrompt = trimmedPrompt.includes(INTERCOM_BRIDGE_MARKER) ? trimmedPrompt : trimmedPrompt ? `${trimmedPrompt}
|
|
5073
|
+
|
|
5074
|
+
${instruction}` : instruction;
|
|
5075
|
+
return tools === agent.tools && systemPrompt === agent.systemPrompt ? agent : {
|
|
5076
|
+
...agent,
|
|
5077
|
+
tools,
|
|
5078
|
+
systemPrompt
|
|
5079
|
+
};
|
|
5080
|
+
}
|
|
5081
|
+
|
|
4899
5082
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js
|
|
4900
5083
|
import * as fs16 from "node:fs";
|
|
4901
5084
|
import * as path17 from "node:path";
|
|
@@ -4926,6 +5109,15 @@ function interruptLiveAsyncResumeTarget(input) {
|
|
|
4926
5109
|
function getErrorMessage3(error) {
|
|
4927
5110
|
return error instanceof Error ? error.message : String(error);
|
|
4928
5111
|
}
|
|
5112
|
+
var TURN_BUDGET_RUNTIME_KEYS = /* @__PURE__ */ new Set(["outcome", "turnCount", "wrapUpRequestedAtTurn", "exceededAtTurn"]);
|
|
5113
|
+
function persistedTurnBudgetConfig(raw) {
|
|
5114
|
+
if (!raw || typeof raw != "object" || Array.isArray(raw))
|
|
5115
|
+
return raw;
|
|
5116
|
+
let config = {};
|
|
5117
|
+
for (let [key, value] of Object.entries(raw))
|
|
5118
|
+
TURN_BUDGET_RUNTIME_KEYS.has(key) || (config[key] = value);
|
|
5119
|
+
return config;
|
|
5120
|
+
}
|
|
4929
5121
|
function ensureObject(value, source) {
|
|
4930
5122
|
if (!value || typeof value != "object" || Array.isArray(value))
|
|
4931
5123
|
throw new Error(`Async result file '${source}' must contain a JSON object.`);
|
|
@@ -5149,7 +5341,7 @@ function readAsyncRecoveryDescriptor(asyncDir) {
|
|
|
5149
5341
|
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': ${field} must be a non-empty string.`);
|
|
5150
5342
|
if (parsed.permissions !== "full" && parsed.permissions !== "read-only")
|
|
5151
5343
|
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': permissions must be full or read-only.`);
|
|
5152
|
-
if (parsed.tier !== "light" && parsed.tier !== "standard" && parsed.tier !== "heavy")
|
|
5344
|
+
if (parsed.tier !== void 0 && parsed.tier !== "light" && parsed.tier !== "standard" && parsed.tier !== "heavy")
|
|
5153
5345
|
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': tier must be light, standard, or heavy.`);
|
|
5154
5346
|
if (validateChildDescription(parsed.description, `Async recovery descriptor '${descriptorPath}' description`), parsed.outputMode !== "inline" && parsed.outputMode !== "file-only")
|
|
5155
5347
|
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': outputMode is invalid.`);
|
|
@@ -5170,17 +5362,23 @@ function readAsyncRecoveryDescriptor(asyncDir) {
|
|
|
5170
5362
|
let selection = parsed.modelSelection;
|
|
5171
5363
|
if (!selection || typeof selection != "object")
|
|
5172
5364
|
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection must be an object.`);
|
|
5173
|
-
if (selection.kind
|
|
5365
|
+
if (selection.kind === "tier") {
|
|
5366
|
+
if (selection.tier !== "light" && selection.tier !== "standard" && selection.tier !== "heavy")
|
|
5367
|
+
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection.tier is invalid.`);
|
|
5368
|
+
} else if (selection.kind === "model") {
|
|
5369
|
+
if (selection.model !== void 0 && (typeof selection.model != "string" || !selection.model.trim()))
|
|
5370
|
+
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection.model must be a non-empty string.`);
|
|
5371
|
+
} else
|
|
5174
5372
|
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection.kind is invalid.`);
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
}
|
|
5373
|
+
} else if (parsed.tier === void 0)
|
|
5374
|
+
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': tier or modelSelection is required.`);
|
|
5178
5375
|
if (parsed.absoluteDeadlineAt !== void 0 && (!Number.isFinite(parsed.absoluteDeadlineAt) || parsed.absoluteDeadlineAt <= 0))
|
|
5179
5376
|
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': absoluteDeadlineAt must be a positive timestamp.`);
|
|
5180
5377
|
if (parsed.initialTurnBudget !== void 0) {
|
|
5181
|
-
let result = resolveTurnBudgetConfig(parsed.initialTurnBudget, "recoveryDescriptor.initialTurnBudget");
|
|
5378
|
+
let result = resolveTurnBudgetConfig(persistedTurnBudgetConfig(parsed.initialTurnBudget), "recoveryDescriptor.initialTurnBudget");
|
|
5182
5379
|
if (result.error)
|
|
5183
5380
|
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': ${result.error}`);
|
|
5381
|
+
result.turnBudget && (parsed.initialTurnBudget = result.turnBudget);
|
|
5184
5382
|
}
|
|
5185
5383
|
if (parsed.initialToolBudget !== void 0) {
|
|
5186
5384
|
let result = validateToolBudgetConfig(parsed.initialToolBudget, "recoveryDescriptor.initialToolBudget");
|
|
@@ -5226,7 +5424,7 @@ function readAsyncRecoveryDescriptor(asyncDir) {
|
|
|
5226
5424
|
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': controlConfig.notifyChannels is invalid.`);
|
|
5227
5425
|
}
|
|
5228
5426
|
if (parsed.acceptance !== void 0) {
|
|
5229
|
-
let errors =
|
|
5427
|
+
let errors = validatePersistedAcceptance(parsed.acceptance, "recoveryDescriptor.acceptance");
|
|
5230
5428
|
if (errors.length)
|
|
5231
5429
|
throw new Error(`Invalid async recovery descriptor '${descriptorPath}': ${errors.join(" ")}`);
|
|
5232
5430
|
}
|
|
@@ -5279,6 +5477,7 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
|
|
|
5279
5477
|
sessionFile: selectedStep.sessionFile ?? status?.sessionFile ?? result?.sessionFile,
|
|
5280
5478
|
model: selectedStep.model,
|
|
5281
5479
|
thinking: selectedStep.thinking,
|
|
5480
|
+
modelSelection: selectedStep.modelSelection,
|
|
5282
5481
|
...recoveryDescriptor ? { recoveryDescriptor } : {}
|
|
5283
5482
|
};
|
|
5284
5483
|
if (selectedStep?.status === "pending")
|
|
@@ -5304,6 +5503,7 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
|
|
|
5304
5503
|
sessionFile: selected.step.sessionFile ?? status?.sessionFile ?? result?.sessionFile,
|
|
5305
5504
|
model: selected.step.model,
|
|
5306
5505
|
thinking: selected.step.thinking,
|
|
5506
|
+
modelSelection: selected.step.modelSelection,
|
|
5307
5507
|
...recoveryDescriptor ? { recoveryDescriptor } : {}
|
|
5308
5508
|
};
|
|
5309
5509
|
}
|
|
@@ -5336,6 +5536,7 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
|
|
|
5336
5536
|
intercomTarget: resolveSubagentIntercomTarget(runId, childId ?? agent, index),
|
|
5337
5537
|
cwd: status?.cwd ?? result?.cwd,
|
|
5338
5538
|
...resolvedSessionFile ? { sessionFile: resolvedSessionFile } : {},
|
|
5539
|
+
modelSelection: statusSteps[index]?.modelSelection,
|
|
5339
5540
|
...stepModel ? { model: stepModel } : {},
|
|
5340
5541
|
...stepThinking ? { thinking: stepThinking } : {},
|
|
5341
5542
|
...recoveryDescriptor ? { recoveryDescriptor } : {}
|
|
@@ -5357,6 +5558,76 @@ function buildRevivedAsyncTask(target, message) {
|
|
|
5357
5558
|
`);
|
|
5358
5559
|
}
|
|
5359
5560
|
|
|
5561
|
+
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/run-id-resolver.js
|
|
5562
|
+
import * as fs17 from "node:fs";
|
|
5563
|
+
import * as path18 from "node:path";
|
|
5564
|
+
function exactAsyncLocation(id, asyncDirRoot, resultsDir) {
|
|
5565
|
+
let asyncDir = path18.join(asyncDirRoot, id), resultPath = path18.join(resultsDir, `${id}.json`);
|
|
5566
|
+
if (!(!fs17.existsSync(asyncDir) && !fs17.existsSync(resultPath)))
|
|
5567
|
+
return {
|
|
5568
|
+
asyncDir: fs17.existsSync(asyncDir) ? asyncDir : null,
|
|
5569
|
+
resultPath: fs17.existsSync(resultPath) ? resultPath : null,
|
|
5570
|
+
resolvedId: id
|
|
5571
|
+
};
|
|
5572
|
+
}
|
|
5573
|
+
function foregroundIds(state) {
|
|
5574
|
+
if (!state)
|
|
5575
|
+
return [];
|
|
5576
|
+
let remembered = state.currentSessionId ? [...state.foregroundRuns?.values() ?? []].filter((run) => run.sessionId === state.currentSessionId).map((run) => run.runId) : [];
|
|
5577
|
+
return [.../* @__PURE__ */ new Set([...state.foregroundControls.keys(), ...remembered])];
|
|
5578
|
+
}
|
|
5579
|
+
function hasExactForegroundId(state, id) {
|
|
5580
|
+
if (!state)
|
|
5581
|
+
return !1;
|
|
5582
|
+
if (state.foregroundControls.has(id))
|
|
5583
|
+
return !0;
|
|
5584
|
+
let remembered = state.foregroundRuns?.get(id);
|
|
5585
|
+
return !!(remembered && state.currentSessionId && remembered.sessionId === state.currentSessionId);
|
|
5586
|
+
}
|
|
5587
|
+
function nestedScopeFromState(state) {
|
|
5588
|
+
if (!state)
|
|
5589
|
+
return;
|
|
5590
|
+
let routes = [], seen = /* @__PURE__ */ new Set(), add = (route) => {
|
|
5591
|
+
if (!route)
|
|
5592
|
+
return;
|
|
5593
|
+
let key = `${route.rootRunId}:${route.eventSink}:${route.controlInbox}`;
|
|
5594
|
+
seen.has(key) || (seen.add(key), routes.push(route));
|
|
5595
|
+
};
|
|
5596
|
+
for (let control of state.foregroundControls.values())
|
|
5597
|
+
add(control.nestedRoute);
|
|
5598
|
+
for (let job of state.asyncJobs.values())
|
|
5599
|
+
add(job.nestedRoute);
|
|
5600
|
+
return { routes };
|
|
5601
|
+
}
|
|
5602
|
+
function asyncPrefixMatches(prefix, asyncDirRoot, resultsDir) {
|
|
5603
|
+
return findAsyncRunPrefixMatches(prefix, asyncDirRoot, resultsDir);
|
|
5604
|
+
}
|
|
5605
|
+
function resolveSubagentRunId(id, deps = {}) {
|
|
5606
|
+
assertSafeNestedId("id", id);
|
|
5607
|
+
let asyncDirRoot = deps.asyncDirRoot ?? ASYNC_DIR, resultsDir = deps.resultsDir ?? RESULTS_DIR, nestedScope = deps.nested ?? nestedScopeFromState(deps.state);
|
|
5608
|
+
if (hasExactForegroundId(deps.state, id))
|
|
5609
|
+
return { kind: "foreground", id };
|
|
5610
|
+
let exactAsync = exactAsyncLocation(id, asyncDirRoot, resultsDir);
|
|
5611
|
+
if (exactAsync)
|
|
5612
|
+
return { kind: "async", id, location: exactAsync };
|
|
5613
|
+
let exactNested = findNestedRunMatchesById(id, nestedScope ? { scope: nestedScope } : {});
|
|
5614
|
+
if (exactNested.length > 1)
|
|
5615
|
+
throw new Error(`Nested run id '${id}' is ambiguous across authorized registries. Provide the full id after stale registries are cleaned up.`);
|
|
5616
|
+
if (exactNested[0])
|
|
5617
|
+
return { kind: "nested", id, match: exactNested[0] };
|
|
5618
|
+
let matches = [];
|
|
5619
|
+
for (let foregroundId of foregroundIds(deps.state).filter((candidate) => candidate.startsWith(id)))
|
|
5620
|
+
matches.push({ kind: "foreground", id: foregroundId });
|
|
5621
|
+
for (let match of asyncPrefixMatches(id, asyncDirRoot, resultsDir))
|
|
5622
|
+
matches.push({ kind: "async", id: match.id, location: match.location });
|
|
5623
|
+
for (let match of findNestedRunMatchesById(id, nestedScope ? { prefix: !0, scope: nestedScope } : { prefix: !0 }))
|
|
5624
|
+
matches.push({ kind: "nested", id: match.run.id, match });
|
|
5625
|
+
let values = [...new Map(matches.map((match) => [`${match.kind}:${match.id}`, match])).values()];
|
|
5626
|
+
if (values.length > 1)
|
|
5627
|
+
throw new Error(`Ambiguous subagent run id prefix '${id}' matched: ${values.map((match) => `${match.kind}:${match.id}`).join(", ")}. Provide a longer id.`);
|
|
5628
|
+
return values[0];
|
|
5629
|
+
}
|
|
5630
|
+
|
|
5360
5631
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js
|
|
5361
5632
|
var SUBAGENT_CONTROL_MESSAGE_TYPE = "subagent_control_notice";
|
|
5362
5633
|
function controlNoticeTarget(details) {
|
|
@@ -5407,8 +5678,8 @@ function handleSubagentControlNotice(input) {
|
|
|
5407
5678
|
}
|
|
5408
5679
|
|
|
5409
5680
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/async-status.js
|
|
5410
|
-
import * as
|
|
5411
|
-
import * as
|
|
5681
|
+
import * as fs18 from "node:fs";
|
|
5682
|
+
import * as path19 from "node:path";
|
|
5412
5683
|
function getErrorMessage4(error) {
|
|
5413
5684
|
return error instanceof Error ? error.message : String(error);
|
|
5414
5685
|
}
|
|
@@ -5416,9 +5687,9 @@ function isNotFoundError3(error) {
|
|
|
5416
5687
|
return typeof error == "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
5417
5688
|
}
|
|
5418
5689
|
function isAsyncRunDir(root, entry) {
|
|
5419
|
-
let entryPath =
|
|
5690
|
+
let entryPath = path19.join(root, entry);
|
|
5420
5691
|
try {
|
|
5421
|
-
return
|
|
5692
|
+
return fs18.statSync(entryPath).isDirectory();
|
|
5422
5693
|
} catch (error) {
|
|
5423
5694
|
if (isNotFoundError3(error))
|
|
5424
5695
|
return !1;
|
|
@@ -5430,7 +5701,7 @@ function isAsyncRunDir(root, entry) {
|
|
|
5430
5701
|
function outputFileMtime(outputFile) {
|
|
5431
5702
|
if (outputFile)
|
|
5432
5703
|
try {
|
|
5433
|
-
return
|
|
5704
|
+
return fs18.statSync(outputFile).mtimeMs;
|
|
5434
5705
|
} catch (error) {
|
|
5435
5706
|
if (isNotFoundError3(error))
|
|
5436
5707
|
return;
|
|
@@ -5442,7 +5713,7 @@ function outputFileMtime(outputFile) {
|
|
|
5442
5713
|
function deriveAsyncActivityState(asyncDir, status) {
|
|
5443
5714
|
if (status.state !== "running")
|
|
5444
5715
|
return { activityState: status.activityState, lastActivityAt: status.lastActivityAt };
|
|
5445
|
-
let outputPath = status.outputFile ?
|
|
5716
|
+
let outputPath = status.outputFile ? path19.isAbsolute(status.outputFile) ? status.outputFile : path19.join(asyncDir, status.outputFile) : void 0, currentStep = typeof status.currentStep == "number" ? status.steps?.[status.currentStep] : void 0;
|
|
5446
5717
|
return {
|
|
5447
5718
|
activityState: status.activityState,
|
|
5448
5719
|
lastActivityAt: status.lastActivityAt ?? outputFileMtime(outputPath) ?? currentStep?.lastActivityAt ?? currentStep?.startedAt ?? status.startedAt
|
|
@@ -5450,7 +5721,7 @@ function deriveAsyncActivityState(asyncDir, status) {
|
|
|
5450
5721
|
}
|
|
5451
5722
|
function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
|
|
5452
5723
|
if (status.sessionId !== void 0 && typeof status.sessionId != "string")
|
|
5453
|
-
throw new Error(`Invalid async status '${
|
|
5724
|
+
throw new Error(`Invalid async status '${path19.join(asyncDir, "status.json")}': sessionId must be a string.`);
|
|
5454
5725
|
let { activityState, lastActivityAt } = deriveAsyncActivityState(asyncDir, status), steps = status.steps ?? [], chainStepCount = status.chainStepCount ?? steps.length, parallelGroups = normalizeParallelGroups(status.parallelGroups, steps.length, chainStepCount), nestedChildren = [];
|
|
5455
5726
|
if (nestedWarnings.length === 0 && nestedRoute)
|
|
5456
5727
|
try {
|
|
@@ -5496,8 +5767,8 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
|
|
|
5496
5767
|
...step.children?.length ? { children: step.children } : {}
|
|
5497
5768
|
};
|
|
5498
5769
|
});
|
|
5499
|
-
return attachRootChildrenToSteps(status.runId ||
|
|
5500
|
-
id: status.runId ||
|
|
5770
|
+
return attachRootChildrenToSteps(status.runId || path19.basename(asyncDir), summarizedSteps, nestedChildren), {
|
|
5771
|
+
id: status.runId || path19.basename(asyncDir),
|
|
5501
5772
|
asyncDir,
|
|
5502
5773
|
...status.sessionId ? { sessionId: status.sessionId } : {},
|
|
5503
5774
|
state: status.state,
|
|
@@ -5567,7 +5838,7 @@ function sortRuns(runs) {
|
|
|
5567
5838
|
function listAsyncRuns(asyncDirRoot, options = {}) {
|
|
5568
5839
|
let entries;
|
|
5569
5840
|
try {
|
|
5570
|
-
entries =
|
|
5841
|
+
entries = fs18.readdirSync(asyncDirRoot).filter((entry) => isAsyncRunDir(asyncDirRoot, entry));
|
|
5571
5842
|
} catch (error) {
|
|
5572
5843
|
if (isNotFoundError3(error))
|
|
5573
5844
|
return [];
|
|
@@ -5577,13 +5848,13 @@ function listAsyncRuns(asyncDirRoot, options = {}) {
|
|
|
5577
5848
|
}
|
|
5578
5849
|
let allowedStates = options.states ? new Set(options.states) : void 0, runs = [], nestedRouteIndex, resolveNestedRoute = (rootRunId) => (nestedRouteIndex || (nestedRouteIndex = buildNestedRouteIndex()), nestedRouteIndex.get(rootRunId));
|
|
5579
5850
|
for (let entry of entries) {
|
|
5580
|
-
let asyncDir =
|
|
5851
|
+
let asyncDir = path19.join(asyncDirRoot, entry), status = (options.reconcile === !1 ? void 0 : reconcileAsyncRun(asyncDir, { resultsDir: options.resultsDir, kill: options.kill, now: options.now }))?.status ?? readStatus(asyncDir);
|
|
5581
5852
|
if (!status || allowedStates && !allowedStates.has(status.state) || options.sessionId && status.sessionId !== options.sessionId)
|
|
5582
5853
|
continue;
|
|
5583
5854
|
let nestedWarnings = [], nestedRoute;
|
|
5584
5855
|
if (options.reconcile !== !1)
|
|
5585
5856
|
try {
|
|
5586
|
-
nestedRoute = resolveNestedRoute(status.runId ||
|
|
5857
|
+
nestedRoute = resolveNestedRoute(status.runId || path19.basename(asyncDir)), nestedRoute && reconcileNestedAsyncDescendants(nestedRoute, { resultsDir: options.resultsDir, kill: options.kill, now: options.now });
|
|
5587
5858
|
} catch (error) {
|
|
5588
5859
|
nestedWarnings.push(`Nested status unavailable: ${getErrorMessage4(error)}`);
|
|
5589
5860
|
}
|
|
@@ -5611,7 +5882,7 @@ function formatStepLine(step) {
|
|
|
5611
5882
|
}
|
|
5612
5883
|
function formatAsyncRunOutputPath(run) {
|
|
5613
5884
|
if (run.outputFile)
|
|
5614
|
-
return
|
|
5885
|
+
return path19.isAbsolute(run.outputFile) ? run.outputFile : path19.join(run.asyncDir, run.outputFile);
|
|
5615
5886
|
}
|
|
5616
5887
|
function formatAsyncRunProgressLabel(run) {
|
|
5617
5888
|
let stepCount = run.steps.length || 1, chainStepCount = run.chainStepCount ?? stepCount, groups = normalizeParallelGroups(run.parallelGroups, run.steps.length, chainStepCount), activeGroup = run.currentStep !== void 0 ? groups.find((group) => run.currentStep >= group.start && run.currentStep < group.start + group.count) : void 0;
|
|
@@ -5645,8 +5916,8 @@ function formatAsyncRunList(runs, heading = "Active async runs") {
|
|
|
5645
5916
|
}
|
|
5646
5917
|
|
|
5647
5918
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/fleet-view.js
|
|
5648
|
-
import * as
|
|
5649
|
-
import * as
|
|
5919
|
+
import * as fs19 from "node:fs";
|
|
5920
|
+
import * as path20 from "node:path";
|
|
5650
5921
|
var DEFAULT_TRANSCRIPT_LINES = 80, MAX_TRANSCRIPT_LINES = 500, TRANSCRIPT_TAIL_BYTES = 256 * 1024;
|
|
5651
5922
|
function transcriptLineLimit(value) {
|
|
5652
5923
|
return value === void 0 || !Number.isFinite(value) ? DEFAULT_TRANSCRIPT_LINES : Math.max(1, Math.min(MAX_TRANSCRIPT_LINES, Math.trunc(value)));
|
|
@@ -5659,11 +5930,11 @@ function uniqueStrings2(values) {
|
|
|
5659
5930
|
}
|
|
5660
5931
|
function resolveMaybeRelative(asyncDir, filePath) {
|
|
5661
5932
|
if (filePath)
|
|
5662
|
-
return
|
|
5933
|
+
return path20.resolve(asyncDir, filePath);
|
|
5663
5934
|
}
|
|
5664
5935
|
function pathWithin(base, candidate) {
|
|
5665
|
-
let resolvedBase =
|
|
5666
|
-
return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${
|
|
5936
|
+
let resolvedBase = path20.resolve(base), resolvedCandidate = path20.resolve(candidate);
|
|
5937
|
+
return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${path20.sep}`);
|
|
5667
5938
|
}
|
|
5668
5939
|
function getErrorMessage5(error) {
|
|
5669
5940
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -5674,7 +5945,7 @@ function isNotFoundError4(error) {
|
|
|
5674
5945
|
function readTextTail(filePath, maxLines) {
|
|
5675
5946
|
let stat;
|
|
5676
5947
|
try {
|
|
5677
|
-
stat =
|
|
5948
|
+
stat = fs19.statSync(filePath);
|
|
5678
5949
|
} catch (error) {
|
|
5679
5950
|
return isNotFoundError4(error) ? { path: filePath, lines: [], truncated: !1 } : { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
|
|
5680
5951
|
}
|
|
@@ -5683,24 +5954,24 @@ function readTextTail(filePath, maxLines) {
|
|
|
5683
5954
|
let fd;
|
|
5684
5955
|
try {
|
|
5685
5956
|
let bytesToRead = Math.min(stat.size, TRANSCRIPT_TAIL_BYTES), start = stat.size - bytesToRead, buffer = Buffer.alloc(bytesToRead);
|
|
5686
|
-
fd =
|
|
5687
|
-
let bytesRead =
|
|
5957
|
+
fd = fs19.openSync(filePath, "r");
|
|
5958
|
+
let bytesRead = fs19.readSync(fd, buffer, 0, bytesToRead, start), lines = buffer.subarray(0, bytesRead).toString("utf-8").split(/\r?\n/);
|
|
5688
5959
|
return start > 0 && lines.length > 0 && (lines = lines.slice(1)), lines.at(-1) === "" && (lines = lines.slice(0, -1)), { path: filePath, lines: lines.slice(-maxLines), truncated: start > 0 || lines.length > maxLines };
|
|
5689
5960
|
} catch (error) {
|
|
5690
5961
|
return { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
|
|
5691
5962
|
} finally {
|
|
5692
|
-
fd !== void 0 &&
|
|
5963
|
+
fd !== void 0 && fs19.closeSync(fd);
|
|
5693
5964
|
}
|
|
5694
5965
|
}
|
|
5695
5966
|
function readContainedTextTail(filePath, maxLines, trustedRoots, label) {
|
|
5696
5967
|
if (trustedRoots.length === 0)
|
|
5697
5968
|
return { path: filePath, lines: [], truncated: !1, error: `Refusing to read ${label} transcript path without a trusted root: ${filePath}` };
|
|
5698
|
-
let resolvedPath =
|
|
5969
|
+
let resolvedPath = path20.resolve(filePath);
|
|
5699
5970
|
if (!trustedRoots.some((root) => pathWithin(root, resolvedPath)))
|
|
5700
5971
|
return { path: filePath, lines: [], truncated: !1, error: `Refusing to read ${label} transcript path outside trusted roots: ${filePath}` };
|
|
5701
5972
|
let lstat;
|
|
5702
5973
|
try {
|
|
5703
|
-
lstat =
|
|
5974
|
+
lstat = fs19.lstatSync(resolvedPath);
|
|
5704
5975
|
} catch (error) {
|
|
5705
5976
|
return isNotFoundError4(error) ? { path: filePath, lines: [], truncated: !1 } : { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
|
|
5706
5977
|
}
|
|
@@ -5710,7 +5981,7 @@ function readContainedTextTail(filePath, maxLines, trustedRoots, label) {
|
|
|
5710
5981
|
return { path: filePath, lines: [], truncated: !1, error: `Refusing to read non-file ${label} transcript path: ${filePath}` };
|
|
5711
5982
|
let realPath, realRoots;
|
|
5712
5983
|
try {
|
|
5713
|
-
realPath =
|
|
5984
|
+
realPath = fs19.realpathSync(resolvedPath), realRoots = trustedRoots.filter((root) => fs19.existsSync(root)).map((root) => fs19.realpathSync(root));
|
|
5714
5985
|
} catch (error) {
|
|
5715
5986
|
return { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
|
|
5716
5987
|
}
|
|
@@ -5801,8 +6072,8 @@ function formatAsyncFleetLines(runs) {
|
|
|
5801
6072
|
for (let step of run.steps) {
|
|
5802
6073
|
let display = step.label ? `${step.label} (${step.agent})` : step.agent, phase = step.phase ? `[${step.phase}] ` : "", stepActivity = formatActivityFacts2(step), modelThinking = formatModelSelection(step.modelSelection, step.model, step.thinking), parts = [`${step.index}. ${phase}${display}`, step.status, stepActivity, modelThinking].filter(Boolean);
|
|
5803
6074
|
lines.push(` ${parts.join(" | ")}`);
|
|
5804
|
-
let output =
|
|
5805
|
-
|
|
6075
|
+
let output = path20.join(run.asyncDir, `output-${step.index}.log`);
|
|
6076
|
+
fs19.existsSync(output) && lines.push(` output: ${shortenPath(output)}`), step.sessionFile && lines.push(` session: ${shortenPath(step.sessionFile)}`), (step.status === "running" || step.recentOutput?.length || fs19.existsSync(output)) && lines.push(` transcript: subagent({ action: "status", id: "${run.id}", index: ${step.index}, view: "transcript" })`), lines.push(...formatNestedRunStatusLines(step.children, { indent: " ", commandHints: !0, maxLines: 12 }));
|
|
5806
6077
|
}
|
|
5807
6078
|
let attached = new Set(run.steps.flatMap((step) => step.children?.map((child) => child.id) ?? [])), unattached = run.nestedChildren?.filter((child) => !attached.has(child.id)) ?? [];
|
|
5808
6079
|
lines.push(...formatNestedRunStatusLines(unattached, { indent: " ", commandHints: !0, maxLines: 12 })), run.error && lines.push(` error: ${run.error}`);
|
|
@@ -5892,14 +6163,14 @@ function appendTranscriptBody(lines, sourceLabel, sourceLines, truncated) {
|
|
|
5892
6163
|
lines.push(` ${line}`);
|
|
5893
6164
|
}
|
|
5894
6165
|
function formatAsyncRunTranscript(status, asyncDir, options = {}) {
|
|
5895
|
-
let lineLimit = transcriptLineLimit(options.lines), selected = selectTranscriptStep(status, options), stepOutputPath = selected.index !== void 0 ?
|
|
6166
|
+
let lineLimit = transcriptLineLimit(options.lines), selected = selectTranscriptStep(status, options), stepOutputPath = selected.index !== void 0 ? path20.join(asyncDir, `output-${selected.index}.log`) : void 0, runOutputPath = resolveMaybeRelative(asyncDir, status.outputFile), logPath = path20.join(asyncDir, `subagent-log-${status.runId}.md`), outputPaths = selected.index !== void 0 ? uniqueStrings2([stepOutputPath, runOutputPath && stepOutputPath && path20.resolve(runOutputPath) === path20.resolve(stepOutputPath) ? runOutputPath : void 0]) : uniqueStrings2([runOutputPath]), sessionFile = selected.index !== void 0 ? selected.step?.sessionFile : status.sessionFile, eventsPath = path20.join(asyncDir, "events.jsonl"), lines = [
|
|
5896
6167
|
`Run: ${status.runId}`,
|
|
5897
6168
|
`State: ${status.state}`,
|
|
5898
6169
|
`Mode: ${status.mode}`,
|
|
5899
6170
|
stepStateLine(status.mode, selected.index, selected.step),
|
|
5900
6171
|
selected.hint
|
|
5901
6172
|
].filter((line) => !!line);
|
|
5902
|
-
appendKnownArtifacts(lines, { outputPaths, sessionFile, eventsPath:
|
|
6173
|
+
appendKnownArtifacts(lines, { outputPaths, sessionFile, eventsPath: fs19.existsSync(eventsPath) ? eventsPath : void 0, logPath: fs19.existsSync(logPath) ? logPath : void 0 });
|
|
5903
6174
|
let warnings = [], transcriptLines = [], transcriptSource = "Transcript tail", truncated = !1;
|
|
5904
6175
|
for (let outputPath of outputPaths) {
|
|
5905
6176
|
let tail = readContainedTextTail(outputPath, lineLimit, [asyncDir], "output");
|
|
@@ -5945,7 +6216,7 @@ function formatNestedRunTranscript(run, options = {}) {
|
|
|
5945
6216
|
`);
|
|
5946
6217
|
}
|
|
5947
6218
|
function formatAsyncResultTranscript(data, resultPath, options = {}) {
|
|
5948
|
-
let lineLimit = transcriptLineLimit(options.lines), runId = data.runId ?? data.id ??
|
|
6219
|
+
let lineLimit = transcriptLineLimit(options.lines), runId = data.runId ?? data.id ?? path20.basename(resultPath, ".json"), children = Array.isArray(data.results) ? data.results : data.agent ? [{ agent: data.agent, output: data.output, summary: data.summary, sessionFile: data.sessionFile, state: data.state, success: data.success, exitCode: data.exitCode }] : [], index = options.index;
|
|
5949
6220
|
if (index !== void 0 && !Number.isInteger(index))
|
|
5950
6221
|
throw new Error("Transcript index must be an integer.");
|
|
5951
6222
|
if (index === void 0 && children.length === 1 && (index = 0), index !== void 0 && (index < 0 || index >= children.length))
|
|
@@ -6083,8 +6354,8 @@ function recommendStrongWatchdogModel(ctx) {
|
|
|
6083
6354
|
}
|
|
6084
6355
|
|
|
6085
6356
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/settings.js
|
|
6086
|
-
import * as
|
|
6087
|
-
import * as
|
|
6357
|
+
import * as fs20 from "node:fs";
|
|
6358
|
+
import * as path21 from "node:path";
|
|
6088
6359
|
|
|
6089
6360
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/types.js
|
|
6090
6361
|
var SUBAGENT_WATCHDOG_WARNING_TYPE = "subagent_watchdog_warning", WATCHDOG_WARNING_SEVERITIES = ["concern", "blocker"], WATCHDOG_WARNING_CATEGORIES = [
|
|
@@ -6210,7 +6481,7 @@ function parseNonEmptyString(value, field, meta) {
|
|
|
6210
6481
|
return value.trim();
|
|
6211
6482
|
throw invalid(meta, field, "a non-empty string");
|
|
6212
6483
|
}
|
|
6213
|
-
function
|
|
6484
|
+
function parseThinking2(value, field, meta) {
|
|
6214
6485
|
if (value === !1)
|
|
6215
6486
|
return !1;
|
|
6216
6487
|
if (typeof value == "string" && THINKING_LEVELS.includes(value))
|
|
@@ -6249,19 +6520,19 @@ function parseEndpointPatch(value, field, meta) {
|
|
|
6249
6520
|
let input = parseObject(value, field, meta);
|
|
6250
6521
|
assertKnownFields(input, ENDPOINT_FIELDS, field, meta);
|
|
6251
6522
|
let patch = {};
|
|
6252
|
-
return "enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking =
|
|
6523
|
+
return "enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking = parseThinking2(input.thinking, `${field}.thinking`, meta)), patch;
|
|
6253
6524
|
}
|
|
6254
6525
|
function parseChildOverridePatch(value, field, meta) {
|
|
6255
6526
|
let input = parseObject(value, field, meta);
|
|
6256
6527
|
assertKnownFields(input, CHILD_OVERRIDE_FIELDS, field, meta);
|
|
6257
6528
|
let patch = {};
|
|
6258
|
-
return "enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking =
|
|
6529
|
+
return "enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking = parseThinking2(input.thinking, `${field}.thinking`, meta)), patch;
|
|
6259
6530
|
}
|
|
6260
6531
|
function parseChildrenPatch(value, field, meta) {
|
|
6261
6532
|
let input = parseObject(value, field, meta);
|
|
6262
6533
|
assertKnownFields(input, CHILDREN_FIELDS, field, meta);
|
|
6263
6534
|
let patch = {};
|
|
6264
|
-
if ("enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking =
|
|
6535
|
+
if ("enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking = parseThinking2(input.thinking, `${field}.thinking`, meta)), "watchdogTailTimeoutMs" in input && (patch.watchdogTailTimeoutMs = parseInteger(input.watchdogTailTimeoutMs, `${field}.watchdogTailTimeoutMs`, meta, "a positive integer", (candidate) => candidate >= 1)), "autoFollow" in input && (patch.autoFollow = parseAutoFollowPatch(input.autoFollow, `${field}.autoFollow`, meta)), "overrides" in input) {
|
|
6265
6536
|
let overrides = parseObject(input.overrides, `${field}.overrides`, meta);
|
|
6266
6537
|
patch.overrides = {};
|
|
6267
6538
|
for (let [agent, override] of Object.entries(overrides)) {
|
|
@@ -6297,11 +6568,11 @@ function parseSettingsObject(settings, meta) {
|
|
|
6297
6568
|
return "watchdog" in subagents ? parseWatchdogPatch(subagents.watchdog, "subagents.watchdog", meta) : {};
|
|
6298
6569
|
}
|
|
6299
6570
|
function readSettingsFileStrict(filePath) {
|
|
6300
|
-
if (!
|
|
6571
|
+
if (!fs20.existsSync(filePath))
|
|
6301
6572
|
return {};
|
|
6302
6573
|
let raw;
|
|
6303
6574
|
try {
|
|
6304
|
-
raw =
|
|
6575
|
+
raw = fs20.readFileSync(filePath, "utf-8");
|
|
6305
6576
|
} catch (error) {
|
|
6306
6577
|
let message = error instanceof Error ? error.message : String(error);
|
|
6307
6578
|
throw new Error(`Failed to read settings file '${filePath}': ${message}`, { cause: error });
|
|
@@ -6319,13 +6590,13 @@ function readSettingsFileStrict(filePath) {
|
|
|
6319
6590
|
}
|
|
6320
6591
|
function isDirectory(dir) {
|
|
6321
6592
|
try {
|
|
6322
|
-
return
|
|
6593
|
+
return fs20.statSync(dir).isDirectory();
|
|
6323
6594
|
} catch {
|
|
6324
6595
|
return !1;
|
|
6325
6596
|
}
|
|
6326
6597
|
}
|
|
6327
6598
|
function getUserSettingsPath() {
|
|
6328
|
-
return
|
|
6599
|
+
return path21.join(getAgentDir(), "settings.json");
|
|
6329
6600
|
}
|
|
6330
6601
|
function getWatchdogUserSettingsPath() {
|
|
6331
6602
|
return getUserSettingsPath();
|
|
@@ -6333,16 +6604,16 @@ function getWatchdogUserSettingsPath() {
|
|
|
6333
6604
|
function getProjectSettingsPath(cwd) {
|
|
6334
6605
|
let currentDir = cwd;
|
|
6335
6606
|
for (; ; ) {
|
|
6336
|
-
if (isDirectory(getProjectConfigDir(currentDir)) || isDirectory(
|
|
6337
|
-
return
|
|
6338
|
-
let parentDir =
|
|
6607
|
+
if (isDirectory(getProjectConfigDir(currentDir)) || isDirectory(path21.join(currentDir, ".agents")))
|
|
6608
|
+
return path21.join(getProjectConfigDir(currentDir), "settings.json");
|
|
6609
|
+
let parentDir = path21.dirname(currentDir);
|
|
6339
6610
|
if (parentDir === currentDir)
|
|
6340
6611
|
return;
|
|
6341
6612
|
currentDir = parentDir;
|
|
6342
6613
|
}
|
|
6343
6614
|
}
|
|
6344
6615
|
function getWatchdogProjectSettingsPath(cwd) {
|
|
6345
|
-
return
|
|
6616
|
+
return path21.join(getProjectConfigDir(cwd), "settings.json");
|
|
6346
6617
|
}
|
|
6347
6618
|
function deepMerge(base, patch) {
|
|
6348
6619
|
let next = { ...base };
|
|
@@ -6386,7 +6657,7 @@ function targetSettingsObject(watchdog, target, meta) {
|
|
|
6386
6657
|
return ensureObjectField(overrides, target.agent.trim(), `subagents.watchdog.children.overrides.${target.agent.trim()}`, meta);
|
|
6387
6658
|
}
|
|
6388
6659
|
function writeSettingsFile(settingsPath, settings) {
|
|
6389
|
-
return
|
|
6660
|
+
return fs20.mkdirSync(path21.dirname(settingsPath), { recursive: !0 }), fs20.writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}
|
|
6390
6661
|
`, "utf-8"), settingsPath;
|
|
6391
6662
|
}
|
|
6392
6663
|
function writeUserWatchdogEnabled(enabled) {
|
|
@@ -6404,7 +6675,7 @@ function resolveWatchdogConfig(cwd, options = {}) {
|
|
|
6404
6675
|
];
|
|
6405
6676
|
for (let source of sourceSpecs)
|
|
6406
6677
|
if (source.path) {
|
|
6407
|
-
sources.push({ scope: source.scope, path: source.path, exists:
|
|
6678
|
+
sources.push({ scope: source.scope, path: source.path, exists: fs20.existsSync(source.path) });
|
|
6408
6679
|
try {
|
|
6409
6680
|
patch = deepMerge(patch, parseSourceFile(source.path, source.scope));
|
|
6410
6681
|
} catch (error) {
|
|
@@ -6678,8 +6949,8 @@ import { createHash as createHash4 } from "node:crypto";
|
|
|
6678
6949
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/change-signature.js
|
|
6679
6950
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
6680
6951
|
import { createHash as createHash2 } from "node:crypto";
|
|
6681
|
-
import * as
|
|
6682
|
-
import * as
|
|
6952
|
+
import * as fs21 from "node:fs";
|
|
6953
|
+
import * as path22 from "node:path";
|
|
6683
6954
|
var IGNORED_CHANGE_PREFIXES = [".pi-subagents/", "tmp/", "node_modules/"], IGNORED_CHANGE_PATHS = /* @__PURE__ */ new Set([".pi-subagents", "tmp", "node_modules"]);
|
|
6684
6955
|
function git(cwd, args) {
|
|
6685
6956
|
let result = spawnSync2("git", ["-C", cwd, ...args], { encoding: "utf-8", maxBuffer: 10485760 });
|
|
@@ -6687,28 +6958,28 @@ function git(cwd, args) {
|
|
|
6687
6958
|
return result.stdout;
|
|
6688
6959
|
}
|
|
6689
6960
|
function normalizeRelPath(value) {
|
|
6690
|
-
return value.replaceAll(
|
|
6961
|
+
return value.replaceAll(path22.sep, "/").replace(/^\.\//, "");
|
|
6691
6962
|
}
|
|
6692
6963
|
function ignoredRelPath(relPath) {
|
|
6693
6964
|
let normalized = normalizeRelPath(relPath);
|
|
6694
6965
|
return IGNORED_CHANGE_PATHS.has(normalized) || IGNORED_CHANGE_PREFIXES.some((prefix) => normalized.startsWith(prefix));
|
|
6695
6966
|
}
|
|
6696
6967
|
function hashFile(filePath) {
|
|
6697
|
-
return createHash2("sha256").update(
|
|
6968
|
+
return createHash2("sha256").update(fs21.readFileSync(filePath)).digest("hex");
|
|
6698
6969
|
}
|
|
6699
6970
|
function hashPath(root, relPath) {
|
|
6700
|
-
let normalized = normalizeRelPath(relPath), fullPath =
|
|
6971
|
+
let normalized = normalizeRelPath(relPath), fullPath = path22.join(root, normalized), stat;
|
|
6701
6972
|
try {
|
|
6702
|
-
stat =
|
|
6973
|
+
stat = fs21.lstatSync(fullPath);
|
|
6703
6974
|
} catch (error) {
|
|
6704
6975
|
if (error.code === "ENOENT")
|
|
6705
6976
|
return { path: normalized, state: "deleted" };
|
|
6706
6977
|
throw error;
|
|
6707
6978
|
}
|
|
6708
6979
|
if (stat.isSymbolicLink())
|
|
6709
|
-
return { path: normalized, state: "symlink", target:
|
|
6980
|
+
return { path: normalized, state: "symlink", target: fs21.readlinkSync(fullPath) };
|
|
6710
6981
|
if (stat.isDirectory()) {
|
|
6711
|
-
let entries =
|
|
6982
|
+
let entries = fs21.readdirSync(fullPath).map((entry) => normalizeRelPath(path22.posix.join(normalized, entry))).filter((entry) => !ignoredRelPath(entry)).sort();
|
|
6712
6983
|
return { path: normalized, state: "dir", entries: entries.map((entry) => hashPath(root, entry)) };
|
|
6713
6984
|
}
|
|
6714
6985
|
return stat.isFile() ? { path: normalized, state: "file", mode: stat.mode & 511, size: stat.size, hash: hashFile(fullPath) } : { path: normalized, state: "other", mode: stat.mode };
|
|
@@ -6841,8 +7112,8 @@ var WatchdogEmissionGuard = class {
|
|
|
6841
7112
|
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/lsp-diagnostics.js
|
|
6842
7113
|
import { spawn as spawn2 } from "node:child_process";
|
|
6843
7114
|
import { createHash as createHash3 } from "node:crypto";
|
|
6844
|
-
import * as
|
|
6845
|
-
import * as
|
|
7115
|
+
import * as fs22 from "node:fs";
|
|
7116
|
+
import * as path23 from "node:path";
|
|
6846
7117
|
import { pathToFileURL } from "node:url";
|
|
6847
7118
|
var TS_JS_EXTENSIONS = /* @__PURE__ */ new Map([
|
|
6848
7119
|
[".ts", "typescript"],
|
|
@@ -6855,14 +7126,14 @@ var TS_JS_EXTENSIONS = /* @__PURE__ */ new Map([
|
|
|
6855
7126
|
[".cjs", "javascript"]
|
|
6856
7127
|
]), PROVIDER_NAME = "typescript-language-server", MAX_MESSAGE_LENGTH = 500, MAX_STDERR_LENGTH = 2e3, SHUTDOWN_TIMEOUT_MS = 250;
|
|
6857
7128
|
function normalizeRelPath2(value) {
|
|
6858
|
-
return value.replaceAll(
|
|
7129
|
+
return value.replaceAll(path23.sep, "/").replace(/^\.\//, "");
|
|
6859
7130
|
}
|
|
6860
7131
|
function isPathInsideRoot(absPath, root) {
|
|
6861
|
-
let rel =
|
|
6862
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
7132
|
+
let rel = path23.relative(root, absPath);
|
|
7133
|
+
return rel === "" || !rel.startsWith("..") && !path23.isAbsolute(rel);
|
|
6863
7134
|
}
|
|
6864
7135
|
function languageIdForPath(filePath) {
|
|
6865
|
-
return TS_JS_EXTENSIONS.get(
|
|
7136
|
+
return TS_JS_EXTENSIONS.get(path23.extname(filePath).toLowerCase());
|
|
6866
7137
|
}
|
|
6867
7138
|
function trimDiagnosticMessage(message) {
|
|
6868
7139
|
let normalized = message.replace(/\s+/g, " ").trim();
|
|
@@ -6873,7 +7144,7 @@ function severityFromLsp(value) {
|
|
|
6873
7144
|
}
|
|
6874
7145
|
function pathExecutable(filePath) {
|
|
6875
7146
|
try {
|
|
6876
|
-
return
|
|
7147
|
+
return fs22.statSync(filePath).isFile() ? (process.platform === "win32" || fs22.accessSync(filePath, fs22.constants.X_OK), !0) : !1;
|
|
6877
7148
|
} catch {
|
|
6878
7149
|
return !1;
|
|
6879
7150
|
}
|
|
@@ -6886,13 +7157,13 @@ function pathExecutableNames(name) {
|
|
|
6886
7157
|
}
|
|
6887
7158
|
function resolveTypeScriptLanguageServer(root) {
|
|
6888
7159
|
for (let name of pathExecutableNames(PROVIDER_NAME)) {
|
|
6889
|
-
let local =
|
|
7160
|
+
let local = path23.join(root, "node_modules", ".bin", name);
|
|
6890
7161
|
if (pathExecutable(local))
|
|
6891
7162
|
return { command: local, args: ["--stdio"], label: `${PROVIDER_NAME} (project)` };
|
|
6892
7163
|
}
|
|
6893
|
-
for (let dir of (process.env.PATH ?? "").split(
|
|
7164
|
+
for (let dir of (process.env.PATH ?? "").split(path23.delimiter).filter(Boolean))
|
|
6894
7165
|
for (let name of pathExecutableNames(PROVIDER_NAME)) {
|
|
6895
|
-
let candidate =
|
|
7166
|
+
let candidate = path23.join(dir, name);
|
|
6896
7167
|
if (pathExecutable(candidate))
|
|
6897
7168
|
return { command: candidate, args: ["--stdio"], label: PROVIDER_NAME };
|
|
6898
7169
|
}
|
|
@@ -6900,14 +7171,14 @@ function resolveTypeScriptLanguageServer(root) {
|
|
|
6900
7171
|
function collectTargetFiles(root, changedPaths, maxFiles) {
|
|
6901
7172
|
let targets = [], skippedPaths = [];
|
|
6902
7173
|
for (let changedPath of changedPaths) {
|
|
6903
|
-
let relPath = normalizeRelPath2(changedPath), absPath =
|
|
7174
|
+
let relPath = normalizeRelPath2(changedPath), absPath = path23.resolve(root, relPath), languageId = languageIdForPath(absPath);
|
|
6904
7175
|
if (!languageId || !isPathInsideRoot(absPath, root)) {
|
|
6905
7176
|
skippedPaths.push(relPath);
|
|
6906
7177
|
continue;
|
|
6907
7178
|
}
|
|
6908
7179
|
let stat;
|
|
6909
7180
|
try {
|
|
6910
|
-
stat =
|
|
7181
|
+
stat = fs22.statSync(absPath);
|
|
6911
7182
|
} catch (error) {
|
|
6912
7183
|
if (error.code === "ENOENT") {
|
|
6913
7184
|
skippedPaths.push(relPath);
|
|
@@ -7134,7 +7405,7 @@ function initializeParams(root) {
|
|
|
7134
7405
|
},
|
|
7135
7406
|
workspace: { configuration: !1, workspaceFolders: !0 }
|
|
7136
7407
|
},
|
|
7137
|
-
workspaceFolders: [{ uri: rootUri, name:
|
|
7408
|
+
workspaceFolders: [{ uri: rootUri, name: path23.basename(root) || "workspace" }]
|
|
7138
7409
|
};
|
|
7139
7410
|
}
|
|
7140
7411
|
async function waitForDiagnostics(client, targets, timeoutMs, signal) {
|
|
@@ -7157,7 +7428,7 @@ async function collectWithTypeScriptLanguageServer(input) {
|
|
|
7157
7428
|
try {
|
|
7158
7429
|
await client.request("initialize", initializeParams(input.root), remaining(), input.signal), client.notify("initialized", {});
|
|
7159
7430
|
for (let target of input.targets) {
|
|
7160
|
-
let text =
|
|
7431
|
+
let text = fs22.readFileSync(target.absPath, "utf-8");
|
|
7161
7432
|
client.notify("textDocument/didOpen", {
|
|
7162
7433
|
textDocument: { uri: target.uri, languageId: target.languageId, version: 1, text }
|
|
7163
7434
|
}), client.notify("textDocument/didSave", {
|
|
@@ -7191,7 +7462,7 @@ async function collectWithTypeScriptLanguageServer(input) {
|
|
|
7191
7462
|
async function collectWatchdogLspDiagnostics(request) {
|
|
7192
7463
|
if (!request.config.enabled)
|
|
7193
7464
|
return { status: "disabled", checkedPaths: [], skippedPaths: [], diagnostics: [] };
|
|
7194
|
-
let root =
|
|
7465
|
+
let root = path23.resolve(request.root || request.cwd), { targets, skippedPaths } = collectTargetFiles(root, request.changedPaths, request.config.maxFiles);
|
|
7195
7466
|
if (!targets.length)
|
|
7196
7467
|
return {
|
|
7197
7468
|
status: "skipped",
|
|
@@ -7900,7 +8171,7 @@ function buildWatchdogStatus(snapshot, ctx) {
|
|
|
7900
8171
|
`Auto-follow: not implemented${snapshot.autoFollowQueued ? " (queued)" : ""}`,
|
|
7901
8172
|
`Review model call: ${snapshot.reviewDescription}`
|
|
7902
8173
|
];
|
|
7903
|
-
return snapshot.failedReviews > 0 && lines.push(`Failed reviews: ${snapshot.failedReviews}`), snapshot.staleReviews > 0 && lines.push(`Stale reviews: ${snapshot.staleReviews}`), snapshot.changedPaths?.length && lines.push(`Changed paths: ${snapshot.changedPaths.slice(0, 8).join(", ")}${snapshot.changedPaths.length > 8 ? `, +${snapshot.changedPaths.length - 8} more` : ""}`), snapshot.lastWarning && lines.push(`Last warning: ${snapshot.lastWarning.severity} \xB7 ${snapshot.lastWarning.state ?? "candidate"} \xB7 ${snapshot.lastWarning.summary}`), snapshot.lastError && lines.push(`Last error: ${snapshot.lastError}`), snapshot.configOk ? lines.push("", "Config: ok") : lines.push("", "Config errors:", ...snapshot.errors.map((error) => `- ${error.message}`), "Watchdog is disabled until the config is fixed."), lines.push("Sources:", ...snapshot.sources.map(sourceLine), "", "Model commands:", "- /subagents-watchdog recommend-model", "- /subagents-watchdog model recommended", "- /subagents-watchdog model <provider/model[:thinking]>", "- /subagents-watchdog model inherit", "- /subagents-watchdog session model recommended",
|
|
8174
|
+
return snapshot.failedReviews > 0 && lines.push(`Failed reviews: ${snapshot.failedReviews}`), snapshot.staleReviews > 0 && lines.push(`Stale reviews: ${snapshot.staleReviews}`), snapshot.changedPaths?.length && lines.push(`Changed paths: ${snapshot.changedPaths.slice(0, 8).join(", ")}${snapshot.changedPaths.length > 8 ? `, +${snapshot.changedPaths.length - 8} more` : ""}`), snapshot.lastWarning && lines.push(`Last warning: ${snapshot.lastWarning.severity} \xB7 ${snapshot.lastWarning.state ?? "candidate"} \xB7 ${snapshot.lastWarning.summary}`), snapshot.lastError && lines.push(`Last error: ${snapshot.lastError}`), snapshot.configOk ? lines.push("", "Config: ok") : lines.push("", "Config errors:", ...snapshot.errors.map((error) => `- ${error.message}`), "Watchdog is disabled until the config is fixed."), lines.push("Sources:", ...snapshot.sources.map(sourceLine), "", "Model commands:", "- /subagents-watchdog recommend-model", "- /subagents-watchdog model recommended", "- /subagents-watchdog model <provider/model[:thinking]>", "- /subagents-watchdog model inherit", "- /subagents-watchdog session model recommended", "Configure via /subagents-watchdog or /settings; agent watchdog.configure is not available."), lines.join(`
|
|
7904
8175
|
`);
|
|
7905
8176
|
}
|
|
7906
8177
|
function parseTestCommand(input) {
|
|
@@ -8153,6 +8424,9 @@ function registerMainWatchdog(pi, options = {}) {
|
|
|
8153
8424
|
}), runtime;
|
|
8154
8425
|
}
|
|
8155
8426
|
|
|
8427
|
+
// packages/coding-agent/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js
|
|
8428
|
+
var SUBAGENT_ASYNC_GUIDANCE = "Subagents run async by default. Set async:false when you need the result immediately and have no independent work to do, or need an interactive preview. Otherwise continue independent work or yield for normal interactive completion. Use subagent_wait for same-turn or skill completion. Headless sessions auto-drain current-session work. Use status for one-time inspection. Do not poll or sleep to wait.";
|
|
8429
|
+
|
|
8156
8430
|
export {
|
|
8157
8431
|
childRowLabel,
|
|
8158
8432
|
SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
|
|
@@ -8181,7 +8455,6 @@ export {
|
|
|
8181
8455
|
SLASH_SUBAGENT_UPDATE_EVENT,
|
|
8182
8456
|
SLASH_SUBAGENT_CANCEL_EVENT,
|
|
8183
8457
|
POLL_INTERVAL_MS,
|
|
8184
|
-
MAX_WIDGET_JOBS,
|
|
8185
8458
|
SUBAGENT_ACTIONS,
|
|
8186
8459
|
DEFAULT_FORK_PREAMBLE,
|
|
8187
8460
|
resolveTopLevelParallelMaxTasks,
|
|
@@ -8218,7 +8491,6 @@ export {
|
|
|
8218
8491
|
buildChainInstructions,
|
|
8219
8492
|
resolveParallelBehaviors,
|
|
8220
8493
|
createParallelDirs,
|
|
8221
|
-
THINKING_LEVELS,
|
|
8222
8494
|
toModelInfo,
|
|
8223
8495
|
resolveEffectiveThinking,
|
|
8224
8496
|
splitKnownThinkingSuffix,
|
|
@@ -8226,6 +8498,7 @@ export {
|
|
|
8226
8498
|
getSupportedThinkingLevels,
|
|
8227
8499
|
formatTokens,
|
|
8228
8500
|
formatModelSelection,
|
|
8501
|
+
formatCompactModelBadge,
|
|
8229
8502
|
formatUsage,
|
|
8230
8503
|
formatDuration,
|
|
8231
8504
|
buildChainSummary,
|
|
@@ -8280,8 +8553,8 @@ export {
|
|
|
8280
8553
|
splitThinkingSuffix,
|
|
8281
8554
|
resolveModelCandidate,
|
|
8282
8555
|
resolveEffectiveSubagentModel,
|
|
8283
|
-
resolveRequiredTierModel,
|
|
8284
8556
|
captureModelSelection,
|
|
8557
|
+
resolveExecutableChildModel,
|
|
8285
8558
|
buildModelCandidates,
|
|
8286
8559
|
isRetryableModelFailure,
|
|
8287
8560
|
formatModelAttemptNote,
|
|
@@ -8291,11 +8564,10 @@ export {
|
|
|
8291
8564
|
normalizeParallelGroups,
|
|
8292
8565
|
flatToLogicalStepIndex,
|
|
8293
8566
|
formatActivityLabel,
|
|
8294
|
-
aggregateStepStatus,
|
|
8295
8567
|
formatAgentRunningLabel,
|
|
8296
|
-
formatParallelOutcome,
|
|
8297
8568
|
formatNestedAggregate,
|
|
8298
8569
|
formatNestedRunStatusLines,
|
|
8570
|
+
resolveSubagentRequestParams,
|
|
8299
8571
|
DEFAULT_CONTROL_CONFIG,
|
|
8300
8572
|
resolveControlConfig,
|
|
8301
8573
|
deriveActivityState,
|
|
@@ -8306,7 +8578,6 @@ export {
|
|
|
8306
8578
|
formatControlIntercomMessage,
|
|
8307
8579
|
writeAtomicJson,
|
|
8308
8580
|
writePrivateAtomicJson,
|
|
8309
|
-
assertSafeNestedId,
|
|
8310
8581
|
createNestedRoute,
|
|
8311
8582
|
resolveInheritedNestedRouteFromEnv,
|
|
8312
8583
|
resolveNestedParentAddressFromEnv,
|
|
@@ -8314,7 +8585,6 @@ export {
|
|
|
8314
8585
|
sanitizeSummary,
|
|
8315
8586
|
findNestedRouteForRootId,
|
|
8316
8587
|
projectNestedRegistryForRoot,
|
|
8317
|
-
findNestedRunMatchesById,
|
|
8318
8588
|
writeNestedEvent,
|
|
8319
8589
|
writeNestedControlRequest,
|
|
8320
8590
|
readNestedControlResults,
|
|
@@ -8333,6 +8603,7 @@ export {
|
|
|
8333
8603
|
resolveSubagentResultStatus,
|
|
8334
8604
|
compactNestedResultChildren,
|
|
8335
8605
|
attachNestedChildrenToResultChildren,
|
|
8606
|
+
formatNestedResultLines,
|
|
8336
8607
|
buildSubagentResultIntercomPayload,
|
|
8337
8608
|
deliverSubagentResultIntercomEvent,
|
|
8338
8609
|
deliverSubagentIntercomMessageEvent,
|
|
@@ -8340,6 +8611,7 @@ export {
|
|
|
8340
8611
|
formatSubagentResultReceipt,
|
|
8341
8612
|
expectsImplementationMutation,
|
|
8342
8613
|
validateAcceptanceInput,
|
|
8614
|
+
restorePersistedAcceptance,
|
|
8343
8615
|
validateExecutionAcceptance,
|
|
8344
8616
|
resolveEffectiveAcceptance,
|
|
8345
8617
|
formatAcceptancePrompt,
|
|
@@ -8348,6 +8620,9 @@ export {
|
|
|
8348
8620
|
evaluateAcceptance,
|
|
8349
8621
|
buildSkippedAcceptanceLedger,
|
|
8350
8622
|
acceptanceFailureMessage,
|
|
8623
|
+
normalizeAsyncLaunchConfig,
|
|
8624
|
+
subagentLaunchRunsAsync,
|
|
8625
|
+
isAsyncSubagentExecution,
|
|
8351
8626
|
inspectSubagentFleet,
|
|
8352
8627
|
formatAsyncRunTranscript,
|
|
8353
8628
|
formatNestedRunTranscript,
|
|
@@ -8360,28 +8635,28 @@ export {
|
|
|
8360
8635
|
initialTurnBudgetState,
|
|
8361
8636
|
turnBudgetState,
|
|
8362
8637
|
shouldAbortForTurnBudget,
|
|
8363
|
-
parseWatchdogThinkingInput,
|
|
8364
8638
|
resolveWatchdogModelInput,
|
|
8365
8639
|
recommendStrongWatchdogModel,
|
|
8366
|
-
writeWatchdogModelSettings,
|
|
8367
8640
|
resolveWatchdogConfig,
|
|
8368
8641
|
buildWatchdogStatus,
|
|
8369
8642
|
registerMainWatchdog,
|
|
8643
|
+
requestAsyncSteer,
|
|
8644
|
+
readSteerCapability,
|
|
8645
|
+
consumeSteerAcks,
|
|
8646
|
+
deliverInterruptRequest,
|
|
8647
|
+
deliverStopRequest,
|
|
8370
8648
|
INTERCOM_BRIDGE_MARKER,
|
|
8371
8649
|
resolveIntercomSessionTarget,
|
|
8372
8650
|
resolveSubagentIntercomTarget,
|
|
8373
8651
|
diagnoseIntercomBridge,
|
|
8374
8652
|
resolveIntercomBridge,
|
|
8375
8653
|
applyIntercomBridgeToAgent,
|
|
8376
|
-
requestAsyncSteer,
|
|
8377
|
-
consumeSteerAcks,
|
|
8378
|
-
deliverInterruptRequest,
|
|
8379
|
-
deliverStopRequest,
|
|
8380
8654
|
interruptLiveAsyncResumeTarget,
|
|
8381
|
-
findAsyncRunPrefixMatches,
|
|
8382
8655
|
resolveAsyncRunLocation,
|
|
8383
8656
|
resolveAsyncResumeTarget,
|
|
8384
8657
|
buildRevivedAsyncTask,
|
|
8658
|
+
resolveSubagentRunId,
|
|
8659
|
+
SUBAGENT_ASYNC_GUIDANCE,
|
|
8385
8660
|
SUBAGENT_CONTROL_MESSAGE_TYPE,
|
|
8386
8661
|
clearPendingForegroundControlNotices,
|
|
8387
8662
|
handleSubagentControlNotice
|