@bastani/atomic 0.9.19-alpha.1 → 0.9.19-alpha.11
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 +206 -0
- package/README.md +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +51 -0
- package/dist/builtin/intercom/README.md +28 -18
- package/dist/builtin/intercom/broker/broker.ts +81 -9
- package/dist/builtin/intercom/broker/client.ts +45 -1
- package/dist/builtin/intercom/broker/framing.ts +5 -2
- package/dist/builtin/intercom/broker/group-membership.ts +4 -2
- package/dist/builtin/intercom/broker/presence-handler.ts +14 -0
- package/dist/builtin/intercom/broker/send-handler.ts +61 -6
- package/dist/builtin/intercom/broker/terminal-questions.ts +29 -0
- package/dist/builtin/intercom/index.bundle.mjs +1120 -783
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/intercom/recipient-purpose.ts +9 -0
- package/dist/builtin/intercom/recoverable-disconnect.ts +2 -3
- package/dist/builtin/intercom/retry-policy.ts +4 -2
- package/dist/builtin/intercom/skills/intercom/SKILL.md +8 -7
- package/dist/builtin/intercom/types.ts +18 -3
- package/dist/builtin/mcp/CHANGELOG.md +6 -0
- package/dist/builtin/mcp/README.md +2 -0
- package/dist/builtin/mcp/index.bundle.mjs +2201 -12000
- package/dist/builtin/mcp/package.json +2 -2
- package/dist/builtin/subagents/CHANGELOG.md +57 -0
- package/dist/builtin/subagents/README.md +46 -23
- package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
- package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-locator.md +2 -2
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +8 -8
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +2 -2
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-locator.md +2 -2
- package/dist/builtin/subagents/agents/debugger.md +2 -2
- package/dist/builtin/subagents/agents/worker.md +1 -1
- package/dist/builtin/subagents/package.json +2 -2
- package/dist/builtin/subagents/skills/herdr/LICENSE +201 -0
- package/dist/builtin/subagents/skills/herdr/SKILL.md +202 -0
- package/dist/builtin/subagents/skills/subagent/SKILL.md +41 -35
- package/dist/builtin/subagents/skills/tmux/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1414 -656
- package/dist/builtin/web-access/CHANGELOG.md +19 -0
- package/dist/builtin/web-access/README.md +31 -24
- package/dist/builtin/web-access/index.bundle.mjs +42723 -26674
- package/dist/builtin/web-access/package.json +3 -2
- package/dist/builtin/workflows/CHANGELOG.md +127 -0
- package/dist/builtin/workflows/README.md +15 -16
- package/dist/builtin/workflows/builtin/adversarial-verification.js +5 -7
- package/dist/builtin/workflows/builtin/{chunk-hqpe2cyx.js → chunk-1jth021m.js} +85 -85
- package/dist/builtin/workflows/builtin/{chunk-7430zyas.js → chunk-2377r57g.js} +5 -3
- package/dist/builtin/workflows/builtin/{chunk-79fjkcvh.js → chunk-31j2gs7h.js} +18 -18
- package/dist/builtin/workflows/builtin/{chunk-wgccch41.js → chunk-6w6cvk6b.js} +16 -16
- package/dist/builtin/workflows/builtin/{chunk-zbekjqew.js → chunk-a2kdsqn8.js} +4 -4
- package/dist/builtin/workflows/builtin/{chunk-ze5x3d1r.js → chunk-fg9esgkj.js} +7 -7
- package/dist/builtin/workflows/builtin/{chunk-n8h4yyew.js → chunk-g0csgs7w.js} +11 -11
- package/dist/builtin/workflows/builtin/{chunk-b0v2xab1.js → chunk-ngkqkzej.js} +221 -23
- package/dist/builtin/workflows/builtin/{chunk-ed4jfn5t.js → chunk-nkrafh9s.js} +61 -61
- package/dist/builtin/workflows/builtin/{chunk-reqr3sr3.js → chunk-wf741bv3.js} +22 -22
- package/dist/builtin/workflows/builtin/{chunk-42s7sw0b.js → chunk-yeee2jrc.js} +19 -19
- package/dist/builtin/workflows/builtin/{chunk-6fqs7c01.js → chunk-z0d03ktm.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-k3w87x8y.js → chunk-z29qbehr.js} +10 -10
- package/dist/builtin/workflows/builtin/classify-and-act.js +5 -6
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +3 -4
- package/dist/builtin/workflows/builtin/generate-and-filter.js +5 -6
- package/dist/builtin/workflows/builtin/goal.js +7 -8
- package/dist/builtin/workflows/builtin/index.js +20 -22
- package/dist/builtin/workflows/builtin/loop-until-done.js +5 -6
- package/dist/builtin/workflows/builtin/open-claude-design.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +7 -8
- package/dist/builtin/workflows/builtin/steering-context.js +3 -3
- package/dist/builtin/workflows/builtin/tournament.js +5 -7
- package/dist/builtin/workflows/package.json +6 -6
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +27782 -26348
- package/dist/builtin/workflows/src/index.js +1103 -515
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +4 -1
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/startup-ui.d.ts +1 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +6 -5
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +5 -1
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts +1 -1
- package/dist/core/agent-session-compaction.js +1 -1
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-custom-message-commit.d.ts +1 -1
- package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +33 -2
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-delivery-forwarding.d.ts +1 -1
- package/dist/core/agent-session-delivery-forwarding.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +5 -0
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-export.d.ts +1 -1
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts +8 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +45 -3
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +2 -2
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +22 -8
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +21 -8
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.d.ts +1 -1
- package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.js +13 -3
- package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.js +1 -1
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts +2 -2
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +105 -18
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-queue-pause.d.ts.map +1 -1
- package/dist/core/agent-session-queue-pause.js +11 -0
- package/dist/core/agent-session-queue-pause.js.map +1 -1
- package/dist/core/agent-session-runtime-auth.d.ts +1 -1
- package/dist/core/agent-session-runtime-auth.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +13 -4
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +27 -4
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +5 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +44 -34
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-state.d.ts +1 -1
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tasks.d.ts +14 -0
- package/dist/core/agent-session-tasks.d.ts.map +1 -0
- package/dist/core/agent-session-tasks.js +120 -0
- package/dist/core/agent-session-tasks.js.map +1 -0
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +2 -0
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts +1 -0
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +52 -5
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-transfer.d.ts.map +1 -1
- package/dist/core/agent-session-transfer.js +7 -0
- package/dist/core/agent-session-transfer.js.map +1 -1
- package/dist/core/agent-session-tree.d.ts.map +1 -1
- package/dist/core/agent-session-tree.js +3 -0
- package/dist/core/agent-session-tree.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +4 -2
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js +2 -0
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +8 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +29 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts +1 -1
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extension-session-state.js.map +1 -1
- package/dist/core/extensions/agent-events.d.ts +4 -4
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/extensions/api-types.d.ts +10 -2
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +15 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/event-results.d.ts +1 -1
- package/dist/core/extensions/event-results.js.map +1 -1
- package/dist/core/extensions/event-types.d.ts +2 -1
- package/dist/core/extensions/event-types.d.ts.map +1 -1
- package/dist/core/extensions/event-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +3 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader-api.d.ts +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +10 -0
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts +1 -1
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/loader-discovery.d.ts +1 -1
- package/dist/core/extensions/loader-discovery.js.map +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-host-modules.js +5 -2
- package/dist/core/extensions/loader-host-modules.js.map +1 -1
- package/dist/core/extensions/loader-runtime.d.ts.map +1 -1
- package/dist/core/extensions/loader-runtime.js +3 -0
- package/dist/core/extensions/loader-runtime.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +6 -1
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +1 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/message-types.d.ts +1 -1
- package/dist/core/extensions/message-types.js.map +1 -1
- package/dist/core/extensions/reactive-widget.d.ts +6 -0
- package/dist/core/extensions/reactive-widget.d.ts.map +1 -1
- package/dist/core/extensions/reactive-widget.js +7 -1
- package/dist/core/extensions/reactive-widget.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +12 -2
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +49 -4
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner-events.d.ts +1 -1
- package/dist/core/extensions/runner-events.d.ts.map +1 -1
- package/dist/core/extensions/runner-events.js +17 -2
- package/dist/core/extensions/runner-events.js.map +1 -1
- package/dist/core/extensions/runner-shortcuts.d.ts.map +1 -1
- package/dist/core/extensions/runner-shortcuts.js +32 -3
- package/dist/core/extensions/runner-shortcuts.js.map +1 -1
- package/dist/core/extensions/runner-ui.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +17 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +69 -19
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +8 -1
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/extensions/tool-types.d.ts +1 -1
- package/dist/core/extensions/tool-types.js.map +1 -1
- package/dist/core/extensions/types.d.ts +1 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +25 -1
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/extensions/workflow-activity-hub.d.ts +25 -0
- package/dist/core/extensions/workflow-activity-hub.d.ts.map +1 -0
- package/dist/core/extensions/workflow-activity-hub.js +183 -0
- package/dist/core/extensions/workflow-activity-hub.js.map +1 -0
- package/dist/core/extensions/workflow-events.d.ts +118 -0
- package/dist/core/extensions/workflow-events.d.ts.map +1 -0
- package/dist/core/extensions/workflow-events.js +2 -0
- package/dist/core/extensions/workflow-events.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +8 -4
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +97 -11
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybinding-identity.d.ts +4 -0
- package/dist/core/keybinding-identity.d.ts.map +1 -0
- package/dist/core/keybinding-identity.js +10 -0
- package/dist/core/keybinding-identity.js.map +1 -0
- package/dist/core/keybindings.d.ts +37 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +9 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mandatory-runtime-tools.d.ts +1 -1
- package/dist/core/mandatory-runtime-tools.js.map +1 -1
- package/dist/core/model-fallback-failures.js +2 -2
- package/dist/core/model-fallback-failures.js.map +1 -1
- package/dist/core/model-registry.d.ts +5 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +8 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver-defaults.js +1 -1
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/resource-loader-assets.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts +1 -1
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-internals.d.ts +2 -2
- package/dist/core/resource-loader-internals.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts +2 -0
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +231 -191
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +4 -2
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/retry-policy.d.ts +1 -0
- package/dist/core/retry-policy.d.ts.map +1 -1
- package/dist/core/retry-policy.js +2 -1
- package/dist/core/retry-policy.js.map +1 -1
- package/dist/core/sdk-exports.d.ts +3 -3
- package/dist/core/sdk-exports.d.ts.map +1 -1
- package/dist/core/sdk-exports.js +1 -1
- package/dist/core/sdk-exports.js.map +1 -1
- package/dist/core/sdk-types.d.ts +2 -2
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +6 -3
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +25 -8
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-manager-core.d.ts.map +1 -1
- package/dist/core/settings-manager-core.js +10 -4
- package/dist/core/settings-manager-core.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-storage.d.ts +1 -0
- package/dist/core/settings-storage.d.ts.map +1 -1
- package/dist/core/settings-storage.js +18 -0
- package/dist/core/settings-storage.js.map +1 -1
- package/dist/core/settings-types.d.ts +17 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +6 -5
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +5 -6
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts +44 -0
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -0
- package/dist/core/tasks/agent-adapter.js +112 -0
- package/dist/core/tasks/agent-adapter.js.map +1 -0
- package/dist/core/tasks/command-output.d.ts +15 -0
- package/dist/core/tasks/command-output.d.ts.map +1 -0
- package/dist/core/tasks/command-output.js +29 -0
- package/dist/core/tasks/command-output.js.map +1 -0
- package/dist/core/tasks/completion-ordering.d.ts +11 -0
- package/dist/core/tasks/completion-ordering.d.ts.map +1 -0
- package/dist/core/tasks/completion-ordering.js +19 -0
- package/dist/core/tasks/completion-ordering.js.map +1 -0
- package/dist/core/tasks/completion.d.ts +36 -0
- package/dist/core/tasks/completion.d.ts.map +1 -0
- package/dist/core/tasks/completion.js +119 -0
- package/dist/core/tasks/completion.js.map +1 -0
- package/dist/core/tasks/contracts.d.ts +404 -0
- package/dist/core/tasks/contracts.d.ts.map +1 -0
- package/dist/core/tasks/contracts.js +2 -0
- package/dist/core/tasks/contracts.js.map +1 -0
- package/dist/core/tasks/execution-scope.d.ts +10 -0
- package/dist/core/tasks/execution-scope.d.ts.map +1 -0
- package/dist/core/tasks/execution-scope.js +27 -0
- package/dist/core/tasks/execution-scope.js.map +1 -0
- package/dist/core/tasks/owner-store.d.ts +53 -0
- package/dist/core/tasks/owner-store.d.ts.map +1 -0
- package/dist/core/tasks/owner-store.js +155 -0
- package/dist/core/tasks/owner-store.js.map +1 -0
- package/dist/core/tasks/pause.d.ts +4 -0
- package/dist/core/tasks/pause.d.ts.map +1 -0
- package/dist/core/tasks/pause.js +49 -0
- package/dist/core/tasks/pause.js.map +1 -0
- package/dist/core/tasks/supervisor.d.ts +123 -0
- package/dist/core/tasks/supervisor.d.ts.map +1 -0
- package/dist/core/tasks/supervisor.js +942 -0
- package/dist/core/tasks/supervisor.js.map +1 -0
- package/dist/core/tasks/transcript.d.ts +23 -0
- package/dist/core/tasks/transcript.d.ts.map +1 -0
- package/dist/core/tasks/transcript.js +74 -0
- package/dist/core/tasks/transcript.js.map +1 -0
- package/dist/core/tools/ask-user-question/ask-user-question.d.ts +2 -2
- package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/ask-user-question.js +8 -4
- package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/build-questionnaire.d.ts +1 -1
- package/dist/core/tools/ask-user-question/state/build-questionnaire.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts +1 -1
- package/dist/core/tools/ask-user-question/state/questionnaire-session.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts +1 -1
- package/dist/core/tools/ask-user-question/view/components/multi-select-view.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.d.ts +1 -1
- package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts +1 -1
- package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/submit-picker.d.ts +1 -1
- package/dist/core/tools/ask-user-question/view/components/submit-picker.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/tab-bar.d.ts +1 -1
- package/dist/core/tools/ask-user-question/view/components/tab-bar.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts +1 -1
- package/dist/core/tools/ask-user-question/view/dialog-builder.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/tab-content-strategy.d.ts +1 -1
- package/dist/core/tools/ask-user-question/view/tab-content-strategy.js.map +1 -1
- package/dist/core/tools/bash-pty-native.d.ts +32 -3
- package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
- package/dist/core/tools/bash-pty-native.js +198 -1
- package/dist/core/tools/bash-pty-native.js.map +1 -1
- package/dist/core/tools/bash.d.ts +25 -5
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +100 -10
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +3 -0
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +92 -14
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-coordinator.d.ts +255 -0
- package/dist/core/tools/file-mutation-coordinator.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-coordinator.js +300 -0
- package/dist/core/tools/file-mutation-coordinator.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +14 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js +15 -3
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/hashline.d.ts +9 -0
- package/dist/core/tools/hashline.d.ts.map +1 -1
- package/dist/core/tools/hashline.js +12 -1
- package/dist/core/tools/hashline.js.map +1 -1
- package/dist/core/tools/index.d.ts +15 -4
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +79 -12
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/kill.d.ts +17 -0
- package/dist/core/tools/kill.d.ts.map +1 -0
- package/dist/core/tools/kill.js +49 -0
- package/dist/core/tools/kill.js.map +1 -0
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/non-minting-snapshot-store.d.ts +49 -0
- package/dist/core/tools/non-minting-snapshot-store.d.ts.map +1 -0
- package/dist/core/tools/non-minting-snapshot-store.js +64 -0
- package/dist/core/tools/non-minting-snapshot-store.js.map +1 -0
- package/dist/core/tools/powershell.d.ts +100 -34
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js +41 -11
- package/dist/core/tools/powershell.js.map +1 -1
- package/dist/core/tools/read-document-extract.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/resource-selectors.d.ts +1 -1
- package/dist/core/tools/resource-selectors.d.ts.map +1 -1
- package/dist/core/tools/resource-selectors.js +21 -10
- package/dist/core/tools/resource-selectors.js.map +1 -1
- package/dist/core/tools/search.js.map +1 -1
- package/dist/core/tools/todos-render.d.ts +1 -1
- package/dist/core/tools/todos-render.js.map +1 -1
- package/dist/core/tools/write.d.ts +30 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +98 -10
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +24 -0
- package/dist/core/workflow-stage-admission.d.ts.map +1 -1
- package/dist/core/workflow-stage-admission.js +87 -3
- package/dist/core/workflow-stage-admission.js.map +1 -1
- package/dist/extensions/herdr/activity.d.ts +15 -0
- package/dist/extensions/herdr/activity.d.ts.map +1 -0
- package/dist/extensions/herdr/activity.js +24 -0
- package/dist/extensions/herdr/activity.js.map +1 -0
- package/dist/extensions/herdr/environment.d.ts +7 -0
- package/dist/extensions/herdr/environment.d.ts.map +1 -0
- package/dist/extensions/herdr/environment.js +6 -0
- package/dist/extensions/herdr/environment.js.map +1 -0
- package/dist/extensions/herdr/index.d.ts +9 -0
- package/dist/extensions/herdr/index.d.ts.map +1 -0
- package/dist/extensions/herdr/index.js +225 -0
- package/dist/extensions/herdr/index.js.map +1 -0
- package/dist/extensions/herdr/pane-owner.d.ts +30 -0
- package/dist/extensions/herdr/pane-owner.d.ts.map +1 -0
- package/dist/extensions/herdr/pane-owner.js +111 -0
- package/dist/extensions/herdr/pane-owner.js.map +1 -0
- package/dist/extensions/herdr/transport.d.ts +8 -0
- package/dist/extensions/herdr/transport.d.ts.map +1 -0
- package/dist/extensions/herdr/transport.js +28 -0
- package/dist/extensions/herdr/transport.js.map +1 -0
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +2 -0
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/llama/huggingface-ui.d.ts +1 -1
- package/dist/extensions/llama/huggingface-ui.js.map +1 -1
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/index-extensions.d.ts +3 -2
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +14 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +149 -69
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/atomic-banner.d.ts +1 -1
- package/dist/modes/interactive/components/atomic-banner.js.map +1 -1
- package/dist/modes/interactive/components/atomic-working-status.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +12 -0
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +44 -0
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +43 -8
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-editor.d.ts +1 -1
- package/dist/modes/interactive/components/chat-session-host-editor.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts +2 -2
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts +2 -2
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +12 -3
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +4 -5
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.js +8 -6
- package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +7 -2
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +1 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-terminal-cleanup.d.ts +1 -1
- package/dist/modes/interactive/components/chat-session-host-terminal-cleanup.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.d.ts +8 -3
- package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts +1 -1
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-utils.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-utils.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +17 -2
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +100 -3
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts +1 -0
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +1 -1
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +12 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +7 -6
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +27 -9
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/host-input-form-mount.js.map +1 -1
- package/dist/modes/interactive/components/host-input-form.d.ts +1 -1
- package/dist/modes/interactive/components/host-input-form.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +2 -2
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts +1 -1
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/reserved-bottom-overlay.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/scroll-widget.d.ts +23 -0
- package/dist/modes/interactive/components/scroll-widget.d.ts.map +1 -0
- package/dist/modes/interactive/components/scroll-widget.js +61 -0
- package/dist/modes/interactive/components/scroll-widget.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-header.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/task-completion-message.d.ts +13 -0
- package/dist/modes/interactive/components/task-completion-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-completion-message.js +65 -0
- package/dist/modes/interactive/components/task-completion-message.js.map +1 -0
- package/dist/modes/interactive/components/task-detail.d.ts +27 -0
- package/dist/modes/interactive/components/task-detail.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-detail.js +107 -0
- package/dist/modes/interactive/components/task-detail.js.map +1 -0
- package/dist/modes/interactive/components/task-inspector.d.ts +50 -0
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-inspector.js +599 -0
- package/dist/modes/interactive/components/task-inspector.js.map +1 -0
- package/dist/modes/interactive/components/task-list.d.ts +18 -0
- package/dist/modes/interactive/components/task-list.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-list.js +59 -0
- package/dist/modes/interactive/components/task-list.js.map +1 -0
- package/dist/modes/interactive/components/task-live-transcript.d.ts +17 -0
- package/dist/modes/interactive/components/task-live-transcript.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-live-transcript.js +41 -0
- package/dist/modes/interactive/components/task-live-transcript.js.map +1 -0
- package/dist/modes/interactive/components/task-navigation.d.ts +38 -0
- package/dist/modes/interactive/components/task-navigation.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-navigation.js +93 -0
- package/dist/modes/interactive/components/task-navigation.js.map +1 -0
- package/dist/modes/interactive/components/task-row.d.ts +34 -0
- package/dist/modes/interactive/components/task-row.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-row.js +165 -0
- package/dist/modes/interactive/components/task-row.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/transcript-follow-indicator.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-component.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-help.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-label-input.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/working-status.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +8 -2
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.js +3 -1
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +9 -30
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +2 -1
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-context.js +14 -4
- package/dist/modes/interactive/interactive-extension-context.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +52 -4
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +11 -3
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-widgets.js +9 -1
- package/dist/modes/interactive/interactive-extension-widgets.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +19 -0
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +7 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +10 -4
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +6 -6
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +3 -2
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- 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 +3 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +4 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +30 -4
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +33 -23
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +1 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +3 -0
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-summarization-retry-events.js +2 -2
- package/dist/modes/interactive/interactive-summarization-retry-events.js.map +1 -1
- package/dist/modes/interactive/interactive-task-projection.d.ts +13 -0
- package/dist/modes/interactive/interactive-task-projection.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-task-projection.js +72 -0
- package/dist/modes/interactive/interactive-task-projection.js.map +1 -0
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/interactive/interactive-windows-subshell.d.ts +17 -0
- package/dist/modes/interactive/interactive-windows-subshell.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-windows-subshell.js +92 -0
- package/dist/modes/interactive/interactive-windows-subshell.js.map +1 -0
- package/dist/modes/interactive/skill-command-autocomplete.d.ts +12 -0
- package/dist/modes/interactive/skill-command-autocomplete.d.ts.map +1 -0
- package/dist/modes/interactive/skill-command-autocomplete.js +69 -0
- package/dist/modes/interactive/skill-command-autocomplete.js.map +1 -0
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +4 -1
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +1 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive-engine/activity-watchdog.d.ts +2 -2
- package/dist/modes/interactive-engine/activity-watchdog.d.ts.map +1 -1
- package/dist/modes/interactive-engine/activity-watchdog.js.map +1 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.d.ts +1 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts +9 -10
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +29 -12
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/engine-diagnostic-view.d.ts +3 -1
- package/dist/modes/interactive-engine/engine-diagnostic-view.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-diagnostic-view.js +11 -0
- package/dist/modes/interactive-engine/engine-diagnostic-view.js.map +1 -1
- package/dist/modes/interactive-engine/engine-dialog-host.d.ts +2 -2
- package/dist/modes/interactive-engine/engine-dialog-host.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-dialog-host.js +4 -1
- package/dist/modes/interactive-engine/engine-dialog-host.js.map +1 -1
- package/dist/modes/interactive-engine/engine-project-trust.d.ts +10 -0
- package/dist/modes/interactive-engine/engine-project-trust.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-project-trust.js +28 -0
- package/dist/modes/interactive-engine/engine-project-trust.js.map +1 -0
- package/dist/modes/interactive-engine/engine-render-service.d.ts +1 -1
- package/dist/modes/interactive-engine/engine-render-service.js.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +3 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js +7 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
- package/dist/modes/interactive-engine/input-form-host.d.ts +2 -2
- package/dist/modes/interactive-engine/input-form-host.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-auth.d.ts +1 -1
- package/dist/modes/interactive-engine/isolated-auth.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +5 -2
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +42 -4
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +21 -1
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +53 -2
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts +2 -2
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +19 -8
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.d.ts +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.js.map +1 -1
- package/dist/modes/interactive-engine/remote-renderer.d.ts +1 -1
- package/dist/modes/interactive-engine/remote-renderer.js.map +1 -1
- package/dist/modes/interactive-engine/session-picker-host.d.ts +2 -2
- package/dist/modes/interactive-engine/session-picker-host.js.map +1 -1
- package/dist/modes/json-event.d.ts +1 -1
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-bash-request-owners.d.ts +2 -2
- package/dist/modes/rpc/rpc-bash-request-owners.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +2 -2
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-api.js +2 -2
- package/dist/modes/rpc/rpc-client-api.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts +2 -0
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +23 -1
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-client-waits.d.ts +1 -1
- package/dist/modes/rpc/rpc-client-waits.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +3 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +40 -3
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts +4 -2
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +12 -4
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.d.ts +1 -1
- package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.js +2 -1
- package/dist/modes/rpc/rpc-extension-ui.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +12 -2
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.d.ts +1 -1
- package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts +4 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +35 -1
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +17 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/task-ui-bridge.d.ts +9 -0
- package/dist/modes/rpc/task-ui-bridge.d.ts.map +1 -0
- package/dist/modes/rpc/task-ui-bridge.js +146 -0
- package/dist/modes/rpc/task-ui-bridge.js.map +1 -0
- package/dist/self-update-plan.js.map +1 -1
- package/dist/utils/markit.d.ts +2 -0
- package/dist/utils/markit.d.ts.map +1 -1
- package/dist/utils/markit.js +65 -5
- package/dist/utils/markit.js.map +1 -1
- package/docs/background-tasks.md +232 -0
- package/docs/build.md +51 -0
- package/docs/changelog.mdx +8 -8
- package/docs/compaction/reference.md +267 -0
- package/docs/compaction.md +39 -200
- package/docs/computer-use.md +425 -0
- package/docs/containerization.md +9 -5
- package/docs/custom-provider/api-reference.md +145 -0
- package/docs/custom-provider/oauth.md +131 -0
- package/docs/custom-provider/override.md +34 -0
- package/docs/custom-provider/registration.md +163 -0
- package/docs/custom-provider/streaming.md +214 -0
- package/docs/custom-provider.md +43 -607
- package/docs/development.md +68 -30
- package/docs/docs.json +199 -73
- package/docs/environment-variables.md +2 -2
- package/docs/extensions/api-reference.md +1003 -0
- package/docs/extensions/authoring.md +676 -0
- package/docs/extensions/events.md +793 -0
- package/docs/extensions/examples.md +94 -0
- package/docs/extensions/ui.md +470 -0
- package/docs/extensions.md +241 -2623
- package/docs/getting-started/authentication.md +55 -0
- package/docs/getting-started/first-session.md +172 -0
- package/docs/getting-started/installation.md +154 -0
- package/docs/getting-started/project-instructions.md +43 -0
- package/docs/guides/configuration.md +65 -0
- package/docs/guides/intercom.md +24 -0
- package/docs/guides/non-interactive.md +33 -0
- package/docs/guides/subagents.md +24 -0
- package/docs/guides/workflows.md +27 -0
- package/docs/guides.md +41 -0
- package/docs/herdr.md +55 -0
- package/docs/index.md +13 -44
- package/docs/intercom/operations.md +178 -0
- package/docs/intercom/reference.md +150 -0
- package/docs/intercom.md +61 -251
- package/docs/json.md +17 -0
- package/docs/keybindings.md +36 -2
- package/docs/llama-cpp.md +5 -0
- package/docs/models/artificial-analysis-index.md +89 -0
- package/docs/models/evals.md +225 -148
- package/docs/models/model-selection.md +30 -21
- package/docs/models/pareto-efficiency.md +4 -4
- package/docs/models/reference.md +601 -0
- package/docs/models.md +45 -550
- package/docs/packages/authoring.md +88 -0
- package/docs/packages/reference.md +43 -0
- package/docs/packages.md +28 -107
- package/docs/programmatic.md +29 -0
- package/docs/prompt-templates.md +11 -0
- package/docs/providers/reference.md +23 -0
- package/docs/providers.md +59 -62
- package/docs/quickstart.md +45 -239
- package/docs/reference/cli.md +252 -0
- package/docs/reference.md +52 -0
- package/docs/rpc/examples.md +64 -0
- package/docs/rpc/extension-ui.md +198 -0
- package/docs/rpc/protocol.md +1341 -0
- package/docs/rpc.md +109 -1346
- package/docs/sdk/reference.md +1090 -0
- package/docs/sdk.md +64 -756
- package/docs/session-format.md +2 -0
- package/docs/sessions.md +6 -10
- package/docs/settings.md +45 -48
- package/docs/skills/authoring.md +95 -0
- package/docs/skills/reference.md +60 -0
- package/docs/skills.md +37 -117
- package/docs/subagents/authoring.md +37 -0
- package/docs/subagents/reference.md +60 -0
- package/docs/subagents.md +90 -78
- package/docs/terminal-setup.md +1 -1
- package/docs/themes/reference.md +176 -0
- package/docs/themes.md +25 -135
- package/docs/tmux.md +7 -0
- package/docs/tools/edit.md +5 -0
- package/docs/tools.md +67 -1
- package/docs/tui/reference.md +343 -0
- package/docs/tui.md +83 -285
- package/docs/usage.md +31 -210
- package/docs/web-access.md +50 -0
- package/docs/windows.md +6 -5
- package/docs/workflows/api-reference.md +31 -12
- package/docs/workflows/authoring.md +7 -5
- package/docs/workflows/builtins.md +11 -8
- package/docs/workflows/operations.md +103 -38
- package/docs/workflows/reliable-design.md +59 -10
- package/docs/workflows/verification.md +116 -32
- package/docs/workflows.md +7 -3
- package/examples/extensions/gondolin/index.ts +116 -148
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/ssh.ts +56 -34
- package/npm-shrinkwrap.json +798 -678
- package/package.json +11 -11
- /package/dist/builtin/workflows/builtin/{chunk-cg9tmks0.js → chunk-n1910xc4.js} +0 -0
- /package/dist/builtin/workflows/builtin/{chunk-wpckd35c.js → chunk-rc5ec5xx.js} +0 -0
- /package/dist/builtin/workflows/builtin/{chunk-7at6dnkr.js → chunk-tgt0s5e5.js} +0 -0
- /package/dist/builtin/workflows/builtin/{chunk-bfkmzv9h.js → chunk-xtxcq5tj.js} +0 -0
|
@@ -74,17 +74,17 @@ var require_visit = __commonJS(function(exports) {
|
|
|
74
74
|
visit.BREAK = BREAK;
|
|
75
75
|
visit.SKIP = SKIP;
|
|
76
76
|
visit.REMOVE = REMOVE;
|
|
77
|
-
function visit_(key, node, visitor,
|
|
78
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
77
|
+
function visit_(key, node, visitor, path) {
|
|
78
|
+
const ctrl = callVisitor(key, node, visitor, path);
|
|
79
79
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
80
|
-
replaceNode(key,
|
|
81
|
-
return visit_(key, ctrl, visitor,
|
|
80
|
+
replaceNode(key, path, ctrl);
|
|
81
|
+
return visit_(key, ctrl, visitor, path);
|
|
82
82
|
}
|
|
83
83
|
if (typeof ctrl !== "symbol") {
|
|
84
84
|
if (identity.isCollection(node)) {
|
|
85
|
-
|
|
85
|
+
path = Object.freeze(path.concat(node));
|
|
86
86
|
for (let i = 0;i < node.items.length; ++i) {
|
|
87
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
87
|
+
const ci = visit_(i, node.items[i], visitor, path);
|
|
88
88
|
if (typeof ci === "number")
|
|
89
89
|
i = ci - 1;
|
|
90
90
|
else if (ci === BREAK)
|
|
@@ -95,13 +95,13 @@ var require_visit = __commonJS(function(exports) {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
} else if (identity.isPair(node)) {
|
|
98
|
-
|
|
99
|
-
const ck = visit_("key", node.key, visitor,
|
|
98
|
+
path = Object.freeze(path.concat(node));
|
|
99
|
+
const ck = visit_("key", node.key, visitor, path);
|
|
100
100
|
if (ck === BREAK)
|
|
101
101
|
return BREAK;
|
|
102
102
|
else if (ck === REMOVE)
|
|
103
103
|
node.key = null;
|
|
104
|
-
const cv = visit_("value", node.value, visitor,
|
|
104
|
+
const cv = visit_("value", node.value, visitor, path);
|
|
105
105
|
if (cv === BREAK)
|
|
106
106
|
return BREAK;
|
|
107
107
|
else if (cv === REMOVE)
|
|
@@ -122,17 +122,17 @@ var require_visit = __commonJS(function(exports) {
|
|
|
122
122
|
visitAsync.BREAK = BREAK;
|
|
123
123
|
visitAsync.SKIP = SKIP;
|
|
124
124
|
visitAsync.REMOVE = REMOVE;
|
|
125
|
-
async function visitAsync_(key, node, visitor,
|
|
126
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
125
|
+
async function visitAsync_(key, node, visitor, path) {
|
|
126
|
+
const ctrl = await callVisitor(key, node, visitor, path);
|
|
127
127
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
128
|
-
replaceNode(key,
|
|
129
|
-
return visitAsync_(key, ctrl, visitor,
|
|
128
|
+
replaceNode(key, path, ctrl);
|
|
129
|
+
return visitAsync_(key, ctrl, visitor, path);
|
|
130
130
|
}
|
|
131
131
|
if (typeof ctrl !== "symbol") {
|
|
132
132
|
if (identity.isCollection(node)) {
|
|
133
|
-
|
|
133
|
+
path = Object.freeze(path.concat(node));
|
|
134
134
|
for (let i = 0;i < node.items.length; ++i) {
|
|
135
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
135
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path);
|
|
136
136
|
if (typeof ci === "number")
|
|
137
137
|
i = ci - 1;
|
|
138
138
|
else if (ci === BREAK)
|
|
@@ -143,13 +143,13 @@ var require_visit = __commonJS(function(exports) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
} else if (identity.isPair(node)) {
|
|
146
|
-
|
|
147
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
146
|
+
path = Object.freeze(path.concat(node));
|
|
147
|
+
const ck = await visitAsync_("key", node.key, visitor, path);
|
|
148
148
|
if (ck === BREAK)
|
|
149
149
|
return BREAK;
|
|
150
150
|
else if (ck === REMOVE)
|
|
151
151
|
node.key = null;
|
|
152
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
152
|
+
const cv = await visitAsync_("value", node.value, visitor, path);
|
|
153
153
|
if (cv === BREAK)
|
|
154
154
|
return BREAK;
|
|
155
155
|
else if (cv === REMOVE)
|
|
@@ -176,23 +176,23 @@ var require_visit = __commonJS(function(exports) {
|
|
|
176
176
|
}
|
|
177
177
|
return visitor;
|
|
178
178
|
}
|
|
179
|
-
function callVisitor(key, node, visitor,
|
|
179
|
+
function callVisitor(key, node, visitor, path) {
|
|
180
180
|
if (typeof visitor === "function")
|
|
181
|
-
return visitor(key, node,
|
|
181
|
+
return visitor(key, node, path);
|
|
182
182
|
if (identity.isMap(node))
|
|
183
|
-
return visitor.Map?.(key, node,
|
|
183
|
+
return visitor.Map?.(key, node, path);
|
|
184
184
|
if (identity.isSeq(node))
|
|
185
|
-
return visitor.Seq?.(key, node,
|
|
185
|
+
return visitor.Seq?.(key, node, path);
|
|
186
186
|
if (identity.isPair(node))
|
|
187
|
-
return visitor.Pair?.(key, node,
|
|
187
|
+
return visitor.Pair?.(key, node, path);
|
|
188
188
|
if (identity.isScalar(node))
|
|
189
|
-
return visitor.Scalar?.(key, node,
|
|
189
|
+
return visitor.Scalar?.(key, node, path);
|
|
190
190
|
if (identity.isAlias(node))
|
|
191
|
-
return visitor.Alias?.(key, node,
|
|
191
|
+
return visitor.Alias?.(key, node, path);
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
|
-
function replaceNode(key,
|
|
195
|
-
const parent =
|
|
194
|
+
function replaceNode(key, path, node) {
|
|
195
|
+
const parent = path[path.length - 1];
|
|
196
196
|
if (identity.isCollection(parent)) {
|
|
197
197
|
parent.items[key] = node;
|
|
198
198
|
} else if (identity.isPair(parent)) {
|
|
@@ -483,8 +483,8 @@ var require_toJS = __commonJS(function(exports) {
|
|
|
483
483
|
return value.toJSON(arg, ctx);
|
|
484
484
|
const data = { aliasCount: 0, count: 1, res: undefined };
|
|
485
485
|
ctx.anchors.set(value, data);
|
|
486
|
-
ctx.onCreate = (
|
|
487
|
-
data.res =
|
|
486
|
+
ctx.onCreate = (res) => {
|
|
487
|
+
data.res = res;
|
|
488
488
|
delete ctx.onCreate;
|
|
489
489
|
};
|
|
490
490
|
const res = value.toJSON(arg, ctx);
|
|
@@ -528,8 +528,8 @@ var require_Node = __commonJS(function(exports) {
|
|
|
528
528
|
};
|
|
529
529
|
const res = toJS.toJS(this, "", ctx);
|
|
530
530
|
if (typeof onAnchor === "function")
|
|
531
|
-
for (const { count, res
|
|
532
|
-
onAnchor(
|
|
531
|
+
for (const { count, res } of ctx.anchors.values())
|
|
532
|
+
onAnchor(res, count);
|
|
533
533
|
return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
|
|
534
534
|
}
|
|
535
535
|
}
|
|
@@ -583,16 +583,16 @@ var require_Alias = __commonJS(function(exports) {
|
|
|
583
583
|
toJSON(_arg, ctx) {
|
|
584
584
|
if (!ctx)
|
|
585
585
|
return { source: this.source };
|
|
586
|
-
const { anchors
|
|
586
|
+
const { anchors, doc, maxAliasCount } = ctx;
|
|
587
587
|
const source = this.resolve(doc, ctx);
|
|
588
588
|
if (!source) {
|
|
589
589
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
590
590
|
throw new ReferenceError(msg);
|
|
591
591
|
}
|
|
592
|
-
let data =
|
|
592
|
+
let data = anchors.get(source);
|
|
593
593
|
if (!data) {
|
|
594
594
|
toJS.toJS(source, null, ctx);
|
|
595
|
-
data =
|
|
595
|
+
data = anchors.get(source);
|
|
596
596
|
}
|
|
597
597
|
if (data?.res === undefined) {
|
|
598
598
|
const msg = "This should not happen: Alias anchor was not resolved?";
|
|
@@ -601,7 +601,7 @@ var require_Alias = __commonJS(function(exports) {
|
|
|
601
601
|
if (maxAliasCount >= 0) {
|
|
602
602
|
data.count += 1;
|
|
603
603
|
if (data.aliasCount === 0)
|
|
604
|
-
data.aliasCount = getAliasCount(doc, source,
|
|
604
|
+
data.aliasCount = getAliasCount(doc, source, anchors);
|
|
605
605
|
if (data.count * data.aliasCount > maxAliasCount) {
|
|
606
606
|
const msg = "Excessive alias count indicates a resource exhaustion attack";
|
|
607
607
|
throw new ReferenceError(msg);
|
|
@@ -623,22 +623,22 @@ var require_Alias = __commonJS(function(exports) {
|
|
|
623
623
|
return src;
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
function getAliasCount(doc, node,
|
|
626
|
+
function getAliasCount(doc, node, anchors) {
|
|
627
627
|
if (identity.isAlias(node)) {
|
|
628
628
|
const source = node.resolve(doc);
|
|
629
|
-
const anchor =
|
|
629
|
+
const anchor = anchors && source && anchors.get(source);
|
|
630
630
|
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
631
631
|
} else if (identity.isCollection(node)) {
|
|
632
632
|
let count = 0;
|
|
633
633
|
for (const item of node.items) {
|
|
634
|
-
const c = getAliasCount(doc, item,
|
|
634
|
+
const c = getAliasCount(doc, item, anchors);
|
|
635
635
|
if (c > count)
|
|
636
636
|
count = c;
|
|
637
637
|
}
|
|
638
638
|
return count;
|
|
639
639
|
} else if (identity.isPair(node)) {
|
|
640
|
-
const kc = getAliasCount(doc, node.key,
|
|
641
|
-
const vc = getAliasCount(doc, node.value,
|
|
640
|
+
const kc = getAliasCount(doc, node.key, anchors);
|
|
641
|
+
const vc = getAliasCount(doc, node.value, anchors);
|
|
642
642
|
return Math.max(kc, vc);
|
|
643
643
|
}
|
|
644
644
|
return 1;
|
|
@@ -723,10 +723,10 @@ var require_createNode = __commonJS(function(exports) {
|
|
|
723
723
|
value = value.toJSON();
|
|
724
724
|
}
|
|
725
725
|
if (!value || typeof value !== "object") {
|
|
726
|
-
const
|
|
726
|
+
const node = new Scalar.Scalar(value);
|
|
727
727
|
if (ref)
|
|
728
|
-
ref.node =
|
|
729
|
-
return
|
|
728
|
+
ref.node = node;
|
|
729
|
+
return node;
|
|
730
730
|
}
|
|
731
731
|
tagObj = value instanceof Map ? schema[identity.MAP] : (Symbol.iterator in Object(value)) ? schema[identity.SEQ] : schema[identity.MAP];
|
|
732
732
|
}
|
|
@@ -751,10 +751,10 @@ var require_Collection = __commonJS(function(exports) {
|
|
|
751
751
|
var createNode = require_createNode();
|
|
752
752
|
var identity = require_identity();
|
|
753
753
|
var Node = require_Node();
|
|
754
|
-
function collectionFromPath(schema,
|
|
754
|
+
function collectionFromPath(schema, path, value) {
|
|
755
755
|
let v = value;
|
|
756
|
-
for (let i =
|
|
757
|
-
const k =
|
|
756
|
+
for (let i = path.length - 1;i >= 0; --i) {
|
|
757
|
+
const k = path[i];
|
|
758
758
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
759
759
|
const a = [];
|
|
760
760
|
a[k] = v;
|
|
@@ -773,7 +773,7 @@ var require_Collection = __commonJS(function(exports) {
|
|
|
773
773
|
sourceObjects: new Map
|
|
774
774
|
});
|
|
775
775
|
}
|
|
776
|
-
var isEmptyPath = (
|
|
776
|
+
var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
|
|
777
777
|
|
|
778
778
|
class Collection extends Node.NodeBase {
|
|
779
779
|
constructor(type, schema) {
|
|
@@ -794,11 +794,11 @@ var require_Collection = __commonJS(function(exports) {
|
|
|
794
794
|
copy.range = this.range.slice();
|
|
795
795
|
return copy;
|
|
796
796
|
}
|
|
797
|
-
addIn(
|
|
798
|
-
if (isEmptyPath(
|
|
797
|
+
addIn(path, value) {
|
|
798
|
+
if (isEmptyPath(path))
|
|
799
799
|
this.add(value);
|
|
800
800
|
else {
|
|
801
|
-
const [key, ...rest] =
|
|
801
|
+
const [key, ...rest] = path;
|
|
802
802
|
const node = this.get(key, true);
|
|
803
803
|
if (identity.isCollection(node))
|
|
804
804
|
node.addIn(rest, value);
|
|
@@ -808,8 +808,8 @@ var require_Collection = __commonJS(function(exports) {
|
|
|
808
808
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
|
-
deleteIn(
|
|
812
|
-
const [key, ...rest] =
|
|
811
|
+
deleteIn(path) {
|
|
812
|
+
const [key, ...rest] = path;
|
|
813
813
|
if (rest.length === 0)
|
|
814
814
|
return this.delete(key);
|
|
815
815
|
const node = this.get(key, true);
|
|
@@ -818,8 +818,8 @@ var require_Collection = __commonJS(function(exports) {
|
|
|
818
818
|
else
|
|
819
819
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
820
820
|
}
|
|
821
|
-
getIn(
|
|
822
|
-
const [key, ...rest] =
|
|
821
|
+
getIn(path, keepScalar) {
|
|
822
|
+
const [key, ...rest] = path;
|
|
823
823
|
const node = this.get(key, true);
|
|
824
824
|
if (rest.length === 0)
|
|
825
825
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -834,15 +834,15 @@ var require_Collection = __commonJS(function(exports) {
|
|
|
834
834
|
return n == null || allowScalar && identity.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
835
835
|
});
|
|
836
836
|
}
|
|
837
|
-
hasIn(
|
|
838
|
-
const [key, ...rest] =
|
|
837
|
+
hasIn(path) {
|
|
838
|
+
const [key, ...rest] = path;
|
|
839
839
|
if (rest.length === 0)
|
|
840
840
|
return this.has(key);
|
|
841
841
|
const node = this.get(key, true);
|
|
842
842
|
return identity.isCollection(node) ? node.hasIn(rest) : false;
|
|
843
843
|
}
|
|
844
|
-
setIn(
|
|
845
|
-
const [key, ...rest] =
|
|
844
|
+
setIn(path, value) {
|
|
845
|
+
const [key, ...rest] = path;
|
|
846
846
|
if (rest.length === 0) {
|
|
847
847
|
this.set(key, value);
|
|
848
848
|
} else {
|
|
@@ -975,17 +975,17 @@ var require_foldFlowLines = __commonJS(function(exports) {
|
|
|
975
975
|
if (onFold)
|
|
976
976
|
onFold();
|
|
977
977
|
let res = text.slice(0, folds[0]);
|
|
978
|
-
for (let
|
|
979
|
-
const fold = folds[
|
|
980
|
-
const
|
|
978
|
+
for (let i = 0;i < folds.length; ++i) {
|
|
979
|
+
const fold = folds[i];
|
|
980
|
+
const end = folds[i + 1] || text.length;
|
|
981
981
|
if (fold === 0)
|
|
982
982
|
res = `
|
|
983
|
-
${indent}${text.slice(0,
|
|
983
|
+
${indent}${text.slice(0, end)}`;
|
|
984
984
|
else {
|
|
985
985
|
if (mode === FOLD_QUOTED && escapedFolds[fold])
|
|
986
986
|
res += `${text[fold]}\\`;
|
|
987
987
|
res += `
|
|
988
|
-
${indent}${text.slice(fold + 1,
|
|
988
|
+
${indent}${text.slice(fold + 1, end)}`;
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
991
|
return res;
|
|
@@ -1621,15 +1621,15 @@ var require_merge = __commonJS(function(exports) {
|
|
|
1621
1621
|
if (!identity.isMap(source))
|
|
1622
1622
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1623
1623
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
1624
|
-
for (const [key,
|
|
1624
|
+
for (const [key, value] of srcMap) {
|
|
1625
1625
|
if (map instanceof Map) {
|
|
1626
1626
|
if (!map.has(key))
|
|
1627
|
-
map.set(key,
|
|
1627
|
+
map.set(key, value);
|
|
1628
1628
|
} else if (map instanceof Set) {
|
|
1629
1629
|
map.add(key);
|
|
1630
1630
|
} else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
|
1631
1631
|
Object.defineProperty(map, key, {
|
|
1632
|
-
value
|
|
1632
|
+
value,
|
|
1633
1633
|
writable: true,
|
|
1634
1634
|
enumerable: true,
|
|
1635
1635
|
configurable: true
|
|
@@ -1752,8 +1752,8 @@ var require_stringifyCollection = __commonJS(function(exports) {
|
|
|
1752
1752
|
var stringifyComment = require_stringifyComment();
|
|
1753
1753
|
function stringifyCollection(collection, ctx, options) {
|
|
1754
1754
|
const flow = ctx.inFlow ?? collection.flow;
|
|
1755
|
-
const
|
|
1756
|
-
return
|
|
1755
|
+
const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;
|
|
1756
|
+
return stringify(collection, ctx, options);
|
|
1757
1757
|
}
|
|
1758
1758
|
function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
|
|
1759
1759
|
const { indent, options: { commentString } } = ctx;
|
|
@@ -1762,13 +1762,13 @@ var require_stringifyCollection = __commonJS(function(exports) {
|
|
|
1762
1762
|
const lines = [];
|
|
1763
1763
|
for (let i = 0;i < items.length; ++i) {
|
|
1764
1764
|
const item = items[i];
|
|
1765
|
-
let
|
|
1765
|
+
let comment = null;
|
|
1766
1766
|
if (identity.isNode(item)) {
|
|
1767
1767
|
if (!chompKeep && item.spaceBefore)
|
|
1768
1768
|
lines.push("");
|
|
1769
1769
|
addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
|
|
1770
1770
|
if (item.comment)
|
|
1771
|
-
|
|
1771
|
+
comment = item.comment;
|
|
1772
1772
|
} else if (identity.isPair(item)) {
|
|
1773
1773
|
const ik = identity.isNode(item.key) ? item.key : null;
|
|
1774
1774
|
if (ik) {
|
|
@@ -1778,12 +1778,12 @@ var require_stringifyCollection = __commonJS(function(exports) {
|
|
|
1778
1778
|
}
|
|
1779
1779
|
}
|
|
1780
1780
|
chompKeep = false;
|
|
1781
|
-
let
|
|
1782
|
-
if (
|
|
1783
|
-
|
|
1784
|
-
if (chompKeep &&
|
|
1781
|
+
let str = stringify.stringify(item, itemCtx, () => comment = null, () => chompKeep = true);
|
|
1782
|
+
if (comment)
|
|
1783
|
+
str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
|
|
1784
|
+
if (chompKeep && comment)
|
|
1785
1785
|
chompKeep = false;
|
|
1786
|
-
lines.push(blockItemPrefix +
|
|
1786
|
+
lines.push(blockItemPrefix + str);
|
|
1787
1787
|
}
|
|
1788
1788
|
let str;
|
|
1789
1789
|
if (lines.length === 0) {
|
|
@@ -2033,10 +2033,10 @@ var require_map = __commonJS(function(exports) {
|
|
|
2033
2033
|
default: true,
|
|
2034
2034
|
nodeClass: YAMLMap.YAMLMap,
|
|
2035
2035
|
tag: "tag:yaml.org,2002:map",
|
|
2036
|
-
resolve(
|
|
2037
|
-
if (!identity.isMap(
|
|
2036
|
+
resolve(map, onError) {
|
|
2037
|
+
if (!identity.isMap(map))
|
|
2038
2038
|
onError("Expected a mapping for this tag");
|
|
2039
|
-
return
|
|
2039
|
+
return map;
|
|
2040
2040
|
},
|
|
2041
2041
|
createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)
|
|
2042
2042
|
};
|
|
@@ -2145,10 +2145,10 @@ var require_seq = __commonJS(function(exports) {
|
|
|
2145
2145
|
default: true,
|
|
2146
2146
|
nodeClass: YAMLSeq.YAMLSeq,
|
|
2147
2147
|
tag: "tag:yaml.org,2002:seq",
|
|
2148
|
-
resolve(
|
|
2149
|
-
if (!identity.isSeq(
|
|
2148
|
+
resolve(seq, onError) {
|
|
2149
|
+
if (!identity.isSeq(seq))
|
|
2150
2150
|
onError("Expected a sequence for this tag");
|
|
2151
|
-
return
|
|
2151
|
+
return seq;
|
|
2152
2152
|
},
|
|
2153
2153
|
createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)
|
|
2154
2154
|
};
|
|
@@ -2494,8 +2494,8 @@ ${cn.comment}` : item.comment;
|
|
|
2494
2494
|
}
|
|
2495
2495
|
function createPairs(schema, iterable, ctx) {
|
|
2496
2496
|
const { replacer } = ctx;
|
|
2497
|
-
const
|
|
2498
|
-
|
|
2497
|
+
const pairs = new YAMLSeq.YAMLSeq(schema);
|
|
2498
|
+
pairs.tag = "tag:yaml.org,2002:pairs";
|
|
2499
2499
|
let i = 0;
|
|
2500
2500
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
2501
2501
|
for (let it of iterable) {
|
|
@@ -2519,9 +2519,9 @@ ${cn.comment}` : item.comment;
|
|
|
2519
2519
|
} else {
|
|
2520
2520
|
key = it;
|
|
2521
2521
|
}
|
|
2522
|
-
|
|
2522
|
+
pairs.items.push(Pair.createPair(key, value, ctx));
|
|
2523
2523
|
}
|
|
2524
|
-
return
|
|
2524
|
+
return pairs;
|
|
2525
2525
|
}
|
|
2526
2526
|
var pairs = {
|
|
2527
2527
|
collection: "seq",
|
|
@@ -2575,9 +2575,9 @@ var require_omap = __commonJS(function(exports) {
|
|
|
2575
2575
|
}
|
|
2576
2576
|
static from(schema, iterable, ctx) {
|
|
2577
2577
|
const pairs$1 = pairs.createPairs(schema, iterable, ctx);
|
|
2578
|
-
const
|
|
2579
|
-
|
|
2580
|
-
return
|
|
2578
|
+
const omap = new this;
|
|
2579
|
+
omap.items = pairs$1.items;
|
|
2580
|
+
return omap;
|
|
2581
2581
|
}
|
|
2582
2582
|
}
|
|
2583
2583
|
YAMLOMap.tag = "tag:yaml.org,2002:omap";
|
|
@@ -2703,8 +2703,8 @@ var require_int2 = __commonJS(function(exports) {
|
|
|
2703
2703
|
str = `0x${str}`;
|
|
2704
2704
|
break;
|
|
2705
2705
|
}
|
|
2706
|
-
const
|
|
2707
|
-
return sign === "-" ? BigInt(-1) *
|
|
2706
|
+
const n = BigInt(str);
|
|
2707
|
+
return sign === "-" ? BigInt(-1) * n : n;
|
|
2708
2708
|
}
|
|
2709
2709
|
const n = parseInt(str, radix);
|
|
2710
2710
|
return sign === "-" ? -1 * n : n;
|
|
@@ -2808,14 +2808,14 @@ var require_set = __commonJS(function(exports) {
|
|
|
2808
2808
|
}
|
|
2809
2809
|
static from(schema, iterable, ctx) {
|
|
2810
2810
|
const { replacer } = ctx;
|
|
2811
|
-
const
|
|
2811
|
+
const set = new this(schema);
|
|
2812
2812
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
2813
2813
|
for (let value of iterable) {
|
|
2814
2814
|
if (typeof replacer === "function")
|
|
2815
2815
|
value = replacer.call(iterable, value, value);
|
|
2816
|
-
|
|
2816
|
+
set.items.push(Pair.createPair(value, null, ctx));
|
|
2817
2817
|
}
|
|
2818
|
-
return
|
|
2818
|
+
return set;
|
|
2819
2819
|
}
|
|
2820
2820
|
}
|
|
2821
2821
|
YAMLSet.tag = "tag:yaml.org,2002:set";
|
|
@@ -2848,7 +2848,7 @@ var require_timestamp = __commonJS(function(exports) {
|
|
|
2848
2848
|
const sign = str[0];
|
|
2849
2849
|
const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
|
|
2850
2850
|
const num = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
2851
|
-
const res = parts.replace(/_/g, "").split(":").reduce((
|
|
2851
|
+
const res = parts.replace(/_/g, "").split(":").reduce((res, p) => res * num(60) + num(p), num(0));
|
|
2852
2852
|
return sign === "-" ? num(-1) * res : res;
|
|
2853
2853
|
}
|
|
2854
2854
|
function stringifySexagesimal(node) {
|
|
@@ -3039,16 +3039,16 @@ var require_tags = __commonJS(function(exports) {
|
|
|
3039
3039
|
}
|
|
3040
3040
|
if (addMergeTag)
|
|
3041
3041
|
tags = tags.concat(merge.merge);
|
|
3042
|
-
return tags.reduce((
|
|
3042
|
+
return tags.reduce((tags, tag) => {
|
|
3043
3043
|
const tagObj = typeof tag === "string" ? tagsByName[tag] : tag;
|
|
3044
3044
|
if (!tagObj) {
|
|
3045
3045
|
const tagName = JSON.stringify(tag);
|
|
3046
3046
|
const keys = Object.keys(tagsByName).map((key) => JSON.stringify(key)).join(", ");
|
|
3047
3047
|
throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
|
|
3048
3048
|
}
|
|
3049
|
-
if (!
|
|
3050
|
-
|
|
3051
|
-
return
|
|
3049
|
+
if (!tags.includes(tagObj))
|
|
3050
|
+
tags.push(tagObj);
|
|
3051
|
+
return tags;
|
|
3052
3052
|
}, []);
|
|
3053
3053
|
}
|
|
3054
3054
|
exports.coreKnownTags = coreKnownTags;
|
|
@@ -3235,9 +3235,9 @@ var require_Document = __commonJS(function(exports) {
|
|
|
3235
3235
|
if (assertCollection(this.contents))
|
|
3236
3236
|
this.contents.add(value);
|
|
3237
3237
|
}
|
|
3238
|
-
addIn(
|
|
3238
|
+
addIn(path, value) {
|
|
3239
3239
|
if (assertCollection(this.contents))
|
|
3240
|
-
this.contents.addIn(
|
|
3240
|
+
this.contents.addIn(path, value);
|
|
3241
3241
|
}
|
|
3242
3242
|
createAlias(node, name) {
|
|
3243
3243
|
if (!node.anchor) {
|
|
@@ -3286,30 +3286,30 @@ var require_Document = __commonJS(function(exports) {
|
|
|
3286
3286
|
delete(key) {
|
|
3287
3287
|
return assertCollection(this.contents) ? this.contents.delete(key) : false;
|
|
3288
3288
|
}
|
|
3289
|
-
deleteIn(
|
|
3290
|
-
if (Collection.isEmptyPath(
|
|
3289
|
+
deleteIn(path) {
|
|
3290
|
+
if (Collection.isEmptyPath(path)) {
|
|
3291
3291
|
if (this.contents == null)
|
|
3292
3292
|
return false;
|
|
3293
3293
|
this.contents = null;
|
|
3294
3294
|
return true;
|
|
3295
3295
|
}
|
|
3296
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3296
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
|
|
3297
3297
|
}
|
|
3298
3298
|
get(key, keepScalar) {
|
|
3299
3299
|
return identity.isCollection(this.contents) ? this.contents.get(key, keepScalar) : undefined;
|
|
3300
3300
|
}
|
|
3301
|
-
getIn(
|
|
3302
|
-
if (Collection.isEmptyPath(
|
|
3301
|
+
getIn(path, keepScalar) {
|
|
3302
|
+
if (Collection.isEmptyPath(path))
|
|
3303
3303
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3304
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3304
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : undefined;
|
|
3305
3305
|
}
|
|
3306
3306
|
has(key) {
|
|
3307
3307
|
return identity.isCollection(this.contents) ? this.contents.has(key) : false;
|
|
3308
3308
|
}
|
|
3309
|
-
hasIn(
|
|
3310
|
-
if (Collection.isEmptyPath(
|
|
3309
|
+
hasIn(path) {
|
|
3310
|
+
if (Collection.isEmptyPath(path))
|
|
3311
3311
|
return this.contents !== undefined;
|
|
3312
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3312
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;
|
|
3313
3313
|
}
|
|
3314
3314
|
set(key, value) {
|
|
3315
3315
|
if (this.contents == null) {
|
|
@@ -3318,13 +3318,13 @@ var require_Document = __commonJS(function(exports) {
|
|
|
3318
3318
|
this.contents.set(key, value);
|
|
3319
3319
|
}
|
|
3320
3320
|
}
|
|
3321
|
-
setIn(
|
|
3322
|
-
if (Collection.isEmptyPath(
|
|
3321
|
+
setIn(path, value) {
|
|
3322
|
+
if (Collection.isEmptyPath(path)) {
|
|
3323
3323
|
this.contents = value;
|
|
3324
3324
|
} else if (this.contents == null) {
|
|
3325
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3325
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);
|
|
3326
3326
|
} else if (assertCollection(this.contents)) {
|
|
3327
|
-
this.contents.setIn(
|
|
3327
|
+
this.contents.setIn(path, value);
|
|
3328
3328
|
}
|
|
3329
3329
|
}
|
|
3330
3330
|
setSchema(version, options = {}) {
|
|
@@ -3375,8 +3375,8 @@ var require_Document = __commonJS(function(exports) {
|
|
|
3375
3375
|
};
|
|
3376
3376
|
const res = toJS.toJS(this.contents, jsonArg ?? "", ctx);
|
|
3377
3377
|
if (typeof onAnchor === "function")
|
|
3378
|
-
for (const { count, res
|
|
3379
|
-
onAnchor(
|
|
3378
|
+
for (const { count, res } of ctx.anchors.values())
|
|
3379
|
+
onAnchor(res, count);
|
|
3380
3380
|
return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
|
|
3381
3381
|
}
|
|
3382
3382
|
toJSON(jsonArg, onAnchor) {
|
|
@@ -4130,12 +4130,12 @@ var require_resolve_block_scalar = __commonJS(function(exports) {
|
|
|
4130
4130
|
break;
|
|
4131
4131
|
}
|
|
4132
4132
|
if (chompStart === 0) {
|
|
4133
|
-
const
|
|
4133
|
+
const value = header.chomp === "+" && lines.length > 0 ? `
|
|
4134
4134
|
`.repeat(Math.max(1, lines.length - 1)) : "";
|
|
4135
|
-
let
|
|
4135
|
+
let end = start + header.length;
|
|
4136
4136
|
if (scalar.source)
|
|
4137
|
-
|
|
4138
|
-
return { value
|
|
4137
|
+
end += scalar.source.length;
|
|
4138
|
+
return { value, type, comment: header.comment, range: [start, end, end] };
|
|
4139
4139
|
}
|
|
4140
4140
|
let trimIndent = scalar.indent + header.indent;
|
|
4141
4141
|
let offset = scalar.offset + header.length;
|
|
@@ -4584,9 +4584,9 @@ var require_compose_scalar = __commonJS(function(exports) {
|
|
|
4584
4584
|
return schema[identity.SCALAR];
|
|
4585
4585
|
}
|
|
4586
4586
|
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
|
4587
|
-
const tag = schema.tags.find((
|
|
4587
|
+
const tag = schema.tags.find((tag) => (tag.default === true || atKey && tag.default === "key") && tag.test?.test(value)) || schema[identity.SCALAR];
|
|
4588
4588
|
if (schema.compat) {
|
|
4589
|
-
const compat = schema.compat.find((
|
|
4589
|
+
const compat = schema.compat.find((tag) => tag.default && tag.test?.test(value)) ?? schema[identity.SCALAR];
|
|
4590
4590
|
if (tag.tag !== compat.tag) {
|
|
4591
4591
|
const ts = directives.tagString(tag.tag);
|
|
4592
4592
|
const cs = directives.tagString(compat.tag);
|
|
@@ -5221,9 +5221,9 @@ var require_cst_visit = __commonJS(function(exports) {
|
|
|
5221
5221
|
visit.BREAK = BREAK;
|
|
5222
5222
|
visit.SKIP = SKIP;
|
|
5223
5223
|
visit.REMOVE = REMOVE;
|
|
5224
|
-
visit.itemAtPath = (cst,
|
|
5224
|
+
visit.itemAtPath = (cst, path) => {
|
|
5225
5225
|
let item = cst;
|
|
5226
|
-
for (const [field, index] of
|
|
5226
|
+
for (const [field, index] of path) {
|
|
5227
5227
|
const tok = item?.[field];
|
|
5228
5228
|
if (tok && "items" in tok) {
|
|
5229
5229
|
item = tok.items[index];
|
|
@@ -5232,23 +5232,23 @@ var require_cst_visit = __commonJS(function(exports) {
|
|
|
5232
5232
|
}
|
|
5233
5233
|
return item;
|
|
5234
5234
|
};
|
|
5235
|
-
visit.parentCollection = (cst,
|
|
5236
|
-
const parent = visit.itemAtPath(cst,
|
|
5237
|
-
const field =
|
|
5235
|
+
visit.parentCollection = (cst, path) => {
|
|
5236
|
+
const parent = visit.itemAtPath(cst, path.slice(0, -1));
|
|
5237
|
+
const field = path[path.length - 1][0];
|
|
5238
5238
|
const coll = parent?.[field];
|
|
5239
5239
|
if (coll && "items" in coll)
|
|
5240
5240
|
return coll;
|
|
5241
5241
|
throw new Error("Parent collection not found");
|
|
5242
5242
|
};
|
|
5243
|
-
function _visit(
|
|
5244
|
-
let ctrl = visitor(item,
|
|
5243
|
+
function _visit(path, item, visitor) {
|
|
5244
|
+
let ctrl = visitor(item, path);
|
|
5245
5245
|
if (typeof ctrl === "symbol")
|
|
5246
5246
|
return ctrl;
|
|
5247
5247
|
for (const field of ["key", "value"]) {
|
|
5248
5248
|
const token = item[field];
|
|
5249
5249
|
if (token && "items" in token) {
|
|
5250
5250
|
for (let i = 0;i < token.items.length; ++i) {
|
|
5251
|
-
const ci = _visit(Object.freeze(
|
|
5251
|
+
const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
|
|
5252
5252
|
if (typeof ci === "number")
|
|
5253
5253
|
i = ci - 1;
|
|
5254
5254
|
else if (ci === BREAK)
|
|
@@ -5259,10 +5259,10 @@ var require_cst_visit = __commonJS(function(exports) {
|
|
|
5259
5259
|
}
|
|
5260
5260
|
}
|
|
5261
5261
|
if (typeof ctrl === "function" && field === "key")
|
|
5262
|
-
ctrl = ctrl(item,
|
|
5262
|
+
ctrl = ctrl(item, path);
|
|
5263
5263
|
}
|
|
5264
5264
|
}
|
|
5265
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5265
|
+
return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
|
|
5266
5266
|
}
|
|
5267
5267
|
exports.visit = visit;
|
|
5268
5268
|
});
|
|
@@ -5742,18 +5742,18 @@ var require_lexer = __commonJS(function(exports) {
|
|
|
5742
5742
|
let indent = 0;
|
|
5743
5743
|
let ch;
|
|
5744
5744
|
loop:
|
|
5745
|
-
for (let
|
|
5745
|
+
for (let i = this.pos;ch = this.buffer[i]; ++i) {
|
|
5746
5746
|
switch (ch) {
|
|
5747
5747
|
case " ":
|
|
5748
5748
|
indent += 1;
|
|
5749
5749
|
break;
|
|
5750
5750
|
case `
|
|
5751
5751
|
`:
|
|
5752
|
-
nl =
|
|
5752
|
+
nl = i;
|
|
5753
5753
|
indent = 0;
|
|
5754
5754
|
break;
|
|
5755
5755
|
case "\r": {
|
|
5756
|
-
const next = this.buffer[
|
|
5756
|
+
const next = this.buffer[i + 1];
|
|
5757
5757
|
if (!next && !this.atEnd)
|
|
5758
5758
|
return this.setNext("block-scalar");
|
|
5759
5759
|
if (next === `
|
|
@@ -5796,16 +5796,16 @@ var require_lexer = __commonJS(function(exports) {
|
|
|
5796
5796
|
nl = i - 1;
|
|
5797
5797
|
} else if (!this.blockScalarKeep) {
|
|
5798
5798
|
do {
|
|
5799
|
-
let
|
|
5800
|
-
let
|
|
5801
|
-
if (
|
|
5802
|
-
|
|
5803
|
-
const lastChar =
|
|
5804
|
-
while (
|
|
5805
|
-
|
|
5806
|
-
if (
|
|
5807
|
-
` &&
|
|
5808
|
-
nl =
|
|
5799
|
+
let i = nl - 1;
|
|
5800
|
+
let ch = this.buffer[i];
|
|
5801
|
+
if (ch === "\r")
|
|
5802
|
+
ch = this.buffer[--i];
|
|
5803
|
+
const lastChar = i;
|
|
5804
|
+
while (ch === " ")
|
|
5805
|
+
ch = this.buffer[--i];
|
|
5806
|
+
if (ch === `
|
|
5807
|
+
` && i >= this.pos && i + 1 + indent > lastChar)
|
|
5808
|
+
nl = i;
|
|
5809
5809
|
else
|
|
5810
5810
|
break;
|
|
5811
5811
|
} while (true);
|
|
@@ -6492,12 +6492,12 @@ var require_parser = __commonJS(function(exports) {
|
|
|
6492
6492
|
if (includesToken(it.start, "newline")) {
|
|
6493
6493
|
Object.assign(it, { key: null, sep: [this.sourceToken] });
|
|
6494
6494
|
} else {
|
|
6495
|
-
const
|
|
6495
|
+
const start = getFirstKeyStartProps(it.start);
|
|
6496
6496
|
this.stack.push({
|
|
6497
6497
|
type: "block-map",
|
|
6498
6498
|
offset: this.offset,
|
|
6499
6499
|
indent: this.indent,
|
|
6500
|
-
items: [{ start
|
|
6500
|
+
items: [{ start, key: null, sep: [this.sourceToken] }]
|
|
6501
6501
|
});
|
|
6502
6502
|
}
|
|
6503
6503
|
} else if (it.value) {
|
|
@@ -6510,7 +6510,7 @@ var require_parser = __commonJS(function(exports) {
|
|
|
6510
6510
|
items: [{ start, key: null, sep: [this.sourceToken] }]
|
|
6511
6511
|
});
|
|
6512
6512
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
6513
|
-
const
|
|
6513
|
+
const start = getFirstKeyStartProps(it.start);
|
|
6514
6514
|
const key = it.key;
|
|
6515
6515
|
const sep = it.sep;
|
|
6516
6516
|
sep.push(this.sourceToken);
|
|
@@ -6520,7 +6520,7 @@ var require_parser = __commonJS(function(exports) {
|
|
|
6520
6520
|
type: "block-map",
|
|
6521
6521
|
offset: this.offset,
|
|
6522
6522
|
indent: this.indent,
|
|
6523
|
-
items: [{ start
|
|
6523
|
+
items: [{ start, key, sep }]
|
|
6524
6524
|
});
|
|
6525
6525
|
} else if (start.length > 0) {
|
|
6526
6526
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -6549,14 +6549,14 @@ var require_parser = __commonJS(function(exports) {
|
|
|
6549
6549
|
case "scalar":
|
|
6550
6550
|
case "single-quoted-scalar":
|
|
6551
6551
|
case "double-quoted-scalar": {
|
|
6552
|
-
const
|
|
6552
|
+
const fs = this.flowScalar(this.type);
|
|
6553
6553
|
if (atNextItem || it.value) {
|
|
6554
|
-
map.items.push({ start, key:
|
|
6554
|
+
map.items.push({ start, key: fs, sep: [] });
|
|
6555
6555
|
this.onKeyLine = true;
|
|
6556
6556
|
} else if (it.sep) {
|
|
6557
|
-
this.stack.push(
|
|
6557
|
+
this.stack.push(fs);
|
|
6558
6558
|
} else {
|
|
6559
|
-
Object.assign(it, { key:
|
|
6559
|
+
Object.assign(it, { key: fs, sep: [] });
|
|
6560
6560
|
this.onKeyLine = true;
|
|
6561
6561
|
}
|
|
6562
6562
|
return;
|
|
@@ -6684,13 +6684,13 @@ var require_parser = __commonJS(function(exports) {
|
|
|
6684
6684
|
case "scalar":
|
|
6685
6685
|
case "single-quoted-scalar":
|
|
6686
6686
|
case "double-quoted-scalar": {
|
|
6687
|
-
const
|
|
6687
|
+
const fs = this.flowScalar(this.type);
|
|
6688
6688
|
if (!it || it.value)
|
|
6689
|
-
fc.items.push({ start: [], key:
|
|
6689
|
+
fc.items.push({ start: [], key: fs, sep: [] });
|
|
6690
6690
|
else if (it.sep)
|
|
6691
|
-
this.stack.push(
|
|
6691
|
+
this.stack.push(fs);
|
|
6692
6692
|
else
|
|
6693
|
-
Object.assign(it, { key:
|
|
6693
|
+
Object.assign(it, { key: fs, sep: [] });
|
|
6694
6694
|
return;
|
|
6695
6695
|
}
|
|
6696
6696
|
case "flow-map-end":
|
|
@@ -6864,22 +6864,22 @@ var require_public_api = __commonJS(function(exports) {
|
|
|
6864
6864
|
return { lineCounter: lineCounter$1, prettyErrors };
|
|
6865
6865
|
}
|
|
6866
6866
|
function parseAllDocuments(source, options = {}) {
|
|
6867
|
-
const { lineCounter
|
|
6868
|
-
const parser$1 = new parser.Parser(
|
|
6867
|
+
const { lineCounter, prettyErrors } = parseOptions(options);
|
|
6868
|
+
const parser$1 = new parser.Parser(lineCounter?.addNewLine);
|
|
6869
6869
|
const composer$1 = new composer.Composer(options);
|
|
6870
6870
|
const docs = Array.from(composer$1.compose(parser$1.parse(source)));
|
|
6871
|
-
if (prettyErrors &&
|
|
6871
|
+
if (prettyErrors && lineCounter)
|
|
6872
6872
|
for (const doc of docs) {
|
|
6873
|
-
doc.errors.forEach(errors.prettifyError(source,
|
|
6874
|
-
doc.warnings.forEach(errors.prettifyError(source,
|
|
6873
|
+
doc.errors.forEach(errors.prettifyError(source, lineCounter));
|
|
6874
|
+
doc.warnings.forEach(errors.prettifyError(source, lineCounter));
|
|
6875
6875
|
}
|
|
6876
6876
|
if (docs.length > 0)
|
|
6877
6877
|
return docs;
|
|
6878
6878
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
6879
6879
|
}
|
|
6880
6880
|
function parseDocument(source, options = {}) {
|
|
6881
|
-
const { lineCounter
|
|
6882
|
-
const parser$1 = new parser.Parser(
|
|
6881
|
+
const { lineCounter, prettyErrors } = parseOptions(options);
|
|
6882
|
+
const parser$1 = new parser.Parser(lineCounter?.addNewLine);
|
|
6883
6883
|
const composer$1 = new composer.Composer(options);
|
|
6884
6884
|
let doc = null;
|
|
6885
6885
|
for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {
|
|
@@ -6890,9 +6890,9 @@ var require_public_api = __commonJS(function(exports) {
|
|
|
6890
6890
|
break;
|
|
6891
6891
|
}
|
|
6892
6892
|
}
|
|
6893
|
-
if (prettyErrors &&
|
|
6894
|
-
doc.errors.forEach(errors.prettifyError(source,
|
|
6895
|
-
doc.warnings.forEach(errors.prettifyError(source,
|
|
6893
|
+
if (prettyErrors && lineCounter) {
|
|
6894
|
+
doc.errors.forEach(errors.prettifyError(source, lineCounter));
|
|
6895
|
+
doc.warnings.forEach(errors.prettifyError(source, lineCounter));
|
|
6896
6896
|
}
|
|
6897
6897
|
return doc;
|
|
6898
6898
|
}
|
|
@@ -6949,16 +6949,16 @@ import * as os8 from "node:os";
|
|
|
6949
6949
|
import * as path23 from "node:path";
|
|
6950
6950
|
import {
|
|
6951
6951
|
APP_NAME as APP_NAME3,
|
|
6952
|
-
keyHintIfBound as
|
|
6952
|
+
keyHintIfBound as keyHintIfBound5
|
|
6953
6953
|
} from "@bastani/atomic";
|
|
6954
6954
|
import {
|
|
6955
6955
|
Box,
|
|
6956
6956
|
Container as Container4,
|
|
6957
6957
|
Spacer as Spacer2,
|
|
6958
|
-
Text as
|
|
6959
|
-
truncateToWidth,
|
|
6960
|
-
visibleWidth as
|
|
6961
|
-
wrapTextWithAnsi
|
|
6958
|
+
Text as Text5,
|
|
6959
|
+
truncateToWidth as truncateToWidth4,
|
|
6960
|
+
visibleWidth as visibleWidth4,
|
|
6961
|
+
wrapTextWithAnsi as wrapTextWithAnsi2
|
|
6962
6962
|
} from "@earendil-works/pi-tui";
|
|
6963
6963
|
|
|
6964
6964
|
// dist/builtin/subagents/src/agents/agent-discovery.ts
|
|
@@ -7234,7 +7234,7 @@ function readSubagentSettings(filePath) {
|
|
|
7234
7234
|
}
|
|
7235
7235
|
function readMergedSubagentSettings(filePaths) {
|
|
7236
7236
|
let settings = EMPTY_SUBAGENT_SETTINGS;
|
|
7237
|
-
let
|
|
7237
|
+
let path = null;
|
|
7238
7238
|
for (let i = filePaths.length - 1;i >= 0; i--) {
|
|
7239
7239
|
const filePath = filePaths[i];
|
|
7240
7240
|
if (!fs2.existsSync(filePath))
|
|
@@ -7244,9 +7244,9 @@ function readMergedSubagentSettings(filePaths) {
|
|
|
7244
7244
|
disableBuiltins: next.disableBuiltins ?? settings.disableBuiltins,
|
|
7245
7245
|
overrides: { ...settings.overrides, ...next.overrides }
|
|
7246
7246
|
};
|
|
7247
|
-
|
|
7247
|
+
path = filePath;
|
|
7248
7248
|
}
|
|
7249
|
-
return { settings, path
|
|
7249
|
+
return { settings, path };
|
|
7250
7250
|
}
|
|
7251
7251
|
function applyBuiltinOverride(agent, override, meta) {
|
|
7252
7252
|
const next = {
|
|
@@ -8169,7 +8169,7 @@ var DEFAULT_INTERCOM_BRIDGE_TEMPLATE = `The inherited thread is reference-only.
|
|
|
8169
8169
|
|
|
8170
8170
|
Use contact_supervisor first. It resolves the supervisor session "{orchestratorTarget}" and run metadata automatically.
|
|
8171
8171
|
- Need a decision, blocked, approval, or product/API/scope ambiguity: contact_supervisor({ reason: "need_decision", message: "<question>" })
|
|
8172
|
-
-
|
|
8172
|
+
- In parallel runs, blocking requests wait here and the supervisor's correlated reply lets this same child continue; siblings keep running. Do not request a replacement launch. A single-child claimed decision/interview instead ends with a dynamic [TASK_CONTEXT] fresh-child handoff; follow the actual tool result.
|
|
8173
8173
|
- Do not ask for clarification when the only conflict is review-only/no-edit versus progress-writing or artifact-writing instructions. Review-only/no-edit wins; leave files unchanged and mention the conflict in your final result only if it matters.
|
|
8174
8174
|
- Meaningful progress or unexpected discoveries that change the plan: contact_supervisor({ reason: "progress_update", message: "UPDATE: <summary>" })
|
|
8175
8175
|
- Generic intercom is lower-level plumbing/fallback only: intercom({ action: "ask", to: "{orchestratorTarget}", message: "<question>" })
|
|
@@ -8483,9 +8483,9 @@ function resolveTempScopeId(options) {
|
|
|
8483
8483
|
if (username)
|
|
8484
8484
|
return `user-${sanitizeTempScopeSegment(username)}`;
|
|
8485
8485
|
} catch {}
|
|
8486
|
-
const
|
|
8487
|
-
if (
|
|
8488
|
-
return `home-${sanitizeTempScopeSegment(
|
|
8486
|
+
const homedir = env.USERPROFILE ?? env.HOME;
|
|
8487
|
+
if (homedir)
|
|
8488
|
+
return `home-${sanitizeTempScopeSegment(homedir)}`;
|
|
8489
8489
|
const resolveHomedir = options && Object.hasOwn(options, "homedir") ? options.homedir : os4.homedir;
|
|
8490
8490
|
try {
|
|
8491
8491
|
const fallbackHomedir = resolveHomedir?.();
|
|
@@ -8495,7 +8495,7 @@ function resolveTempScopeId(options) {
|
|
|
8495
8495
|
return "shared";
|
|
8496
8496
|
}
|
|
8497
8497
|
var MAX_PARALLEL_TASKS = 50;
|
|
8498
|
-
var MAX_CONCURRENCY =
|
|
8498
|
+
var MAX_CONCURRENCY = 3;
|
|
8499
8499
|
var TEMP_ROOT_DIR = path6.join(os4.tmpdir(), `${APP_NAME2}-subagents-${resolveTempScopeId()}`);
|
|
8500
8500
|
var TEMP_ARTIFACTS_DIR = path6.join(TEMP_ROOT_DIR, "artifacts");
|
|
8501
8501
|
var SLASH_RESULT_TYPE = "subagent-slash-result";
|
|
@@ -8504,7 +8504,7 @@ var SLASH_SUBAGENT_STARTED_EVENT = "subagent:slash:started";
|
|
|
8504
8504
|
var SLASH_SUBAGENT_RESPONSE_EVENT = "subagent:slash:response";
|
|
8505
8505
|
var SLASH_SUBAGENT_UPDATE_EVENT = "subagent:slash:update";
|
|
8506
8506
|
var SLASH_SUBAGENT_CANCEL_EVENT = "subagent:slash:cancel";
|
|
8507
|
-
var SUBAGENT_ACTIONS = ["list", "get", "create", "update", "delete", "status", "
|
|
8507
|
+
var SUBAGENT_ACTIONS = ["list", "get", "create", "update", "delete", "status", "kill", "wait"];
|
|
8508
8508
|
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.";
|
|
8509
8509
|
function normalizeTopLevelParallelValue(value) {
|
|
8510
8510
|
const parsed = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
|
|
@@ -8657,7 +8657,7 @@ function registerSubagentNotify(pi) {
|
|
|
8657
8657
|
const agent = result.agent ?? "unknown";
|
|
8658
8658
|
const summary = typeof result.summary === "string" ? result.summary : "";
|
|
8659
8659
|
const interrupted = result.status === "interrupted" || result.state === "interrupted";
|
|
8660
|
-
const status = interrupted ? "interrupted" : result.status === "ok" ? "completed" : result.status === "continued" ? "interrupted" : "failed";
|
|
8660
|
+
const status = result.status === "killed" || result.state === "killed" ? "killed" : interrupted ? "interrupted" : result.status === "ok" ? "completed" : result.status === "continued" ? "interrupted" : "failed";
|
|
8661
8661
|
const taskInfo = result.taskIndex !== undefined && result.totalTasks !== undefined ? `(${result.taskIndex + 1}/${result.totalTasks})` : undefined;
|
|
8662
8662
|
const sessionLine = result.shareUrl ? `Session: ${result.shareUrl}` : result.shareError ? `Session share error: ${result.shareError}` : result.sessionFile ? `Session file: ${result.sessionFile}` : undefined;
|
|
8663
8663
|
const displaySummary = summary.trim() ? summary : "(no output)";
|
|
@@ -8892,8 +8892,8 @@ function collectInstalledPackageSkillPaths(cwd) {
|
|
|
8892
8892
|
continue;
|
|
8893
8893
|
if (!scopeEntry.isDirectory() && !scopeEntry.isSymbolicLink())
|
|
8894
8894
|
continue;
|
|
8895
|
-
const
|
|
8896
|
-
results.push(...extractSkillPathsFromPackageRoot(
|
|
8895
|
+
const pkgRoot = path7.join(scopeDir, scopeEntry.name);
|
|
8896
|
+
results.push(...extractSkillPathsFromPackageRoot(pkgRoot, dir.source, true));
|
|
8897
8897
|
}
|
|
8898
8898
|
continue;
|
|
8899
8899
|
}
|
|
@@ -9913,7 +9913,7 @@ function formatControlNoticeMessage(event, childIntercomTarget) {
|
|
|
9913
9913
|
"Hint: Inspect status, then nudge if the work seems stuck.",
|
|
9914
9914
|
childIntercomTarget ? `Nudge: ${nudgeCommand}` : "Nudge: no child message route registered",
|
|
9915
9915
|
`Status: subagent({ action: "status", id: "${runTarget}" })`,
|
|
9916
|
-
`
|
|
9916
|
+
`Kill: subagent({ action: "kill", id: "${runTarget}" })`
|
|
9917
9917
|
].filter((line) => Boolean(line)).join(`
|
|
9918
9918
|
`);
|
|
9919
9919
|
}
|
|
@@ -9925,7 +9925,7 @@ function formatControlNoticeMessage(event, childIntercomTarget) {
|
|
|
9925
9925
|
"Hint: Inspect status first unless the run is clearly blocked.",
|
|
9926
9926
|
childIntercomTarget ? `Nudge: ${nudgeCommand}` : "Nudge: no child message route registered",
|
|
9927
9927
|
`Status: subagent({ action: "status", id: "${runTarget}" })`,
|
|
9928
|
-
`
|
|
9928
|
+
`Kill: subagent({ action: "kill", id: "${runTarget}" })`
|
|
9929
9929
|
].filter((line) => Boolean(line)).join(`
|
|
9930
9930
|
`);
|
|
9931
9931
|
}
|
|
@@ -10012,9 +10012,12 @@ function handleSubagentControlNotice(input) {
|
|
|
10012
10012
|
}
|
|
10013
10013
|
|
|
10014
10014
|
// dist/builtin/subagents/src/runs/inprocess/runner.ts
|
|
10015
|
+
import { randomUUID } from "node:crypto";
|
|
10015
10016
|
import { appendFileSync as appendFileSync2, existsSync as existsSync10, mkdirSync as mkdirSync4, statSync as statSync4 } from "node:fs";
|
|
10016
10017
|
import { basename as basename2, dirname as dirname7, join as join10, relative as relative2, resolve as resolve6 } from "node:path";
|
|
10017
10018
|
import {
|
|
10019
|
+
applyAssistantMessageDelta,
|
|
10020
|
+
beginStreamingAssistantMessage,
|
|
10018
10021
|
createAgentSession,
|
|
10019
10022
|
DefaultResourceLoader,
|
|
10020
10023
|
getAgentDir as getAgentDir2,
|
|
@@ -10025,6 +10028,7 @@ import {
|
|
|
10025
10028
|
import {
|
|
10026
10029
|
SubagentControl
|
|
10027
10030
|
} from "@bastani/atomic-natives";
|
|
10031
|
+
import { clampThinkingLevel } from "@bastani/pi-ai/compat";
|
|
10028
10032
|
|
|
10029
10033
|
// dist/builtin/subagents/src/shared/artifacts.ts
|
|
10030
10034
|
import * as fs10 from "node:fs";
|
|
@@ -10276,7 +10280,7 @@ var CHILD_SUBAGENT_BOUNDARY_INSTRUCTIONS = [
|
|
|
10276
10280
|
var CHILD_FANOUT_BOUNDARY_INSTRUCTIONS = [
|
|
10277
10281
|
"You are a child subagent with explicit fanout responsibility for this assigned task.",
|
|
10278
10282
|
"The parent session owns final orchestration, completion decisions, and follow-up implementation launches.",
|
|
10279
|
-
"Delegation is one level deep: the `subagent` tool refuses every launch and
|
|
10283
|
+
"Delegation is one level deep: the `subagent` tool refuses every launch and kill from inside a subagent.",
|
|
10280
10284
|
"Do the assigned fanout work yourself and report what you found; do not plan around delegating it.",
|
|
10281
10285
|
"If you need to edit files, call the actual edit/write tools. Do not print tool-call syntax, patches, or pseudo-tool calls as text."
|
|
10282
10286
|
].join(`
|
|
@@ -10441,22 +10445,24 @@ var EMPTY_STATS = {
|
|
|
10441
10445
|
var CAPACITY_RETRY_INITIAL_DELAY_MS = 5;
|
|
10442
10446
|
var INTERRUPTED_ENVELOPE = "Interrupted";
|
|
10443
10447
|
var CAPACITY_RETRY_MAX_DELAY_MS = 100;
|
|
10444
|
-
function waitForExecutionCapacity(delayMs, signals) {
|
|
10445
|
-
if (signals.interrupt.aborted)
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
return Promise.resolve(
|
|
10448
|
+
function waitForExecutionCapacity(delayMs, signals, onSettled) {
|
|
10449
|
+
if (signals.interrupt.aborted || signals.abort.aborted) {
|
|
10450
|
+
const result = signals.interrupt.aborted ? "interrupt" : "abort";
|
|
10451
|
+
onSettled(result);
|
|
10452
|
+
return Promise.resolve(result);
|
|
10453
|
+
}
|
|
10449
10454
|
return new Promise((resolveWait) => {
|
|
10450
10455
|
let settled = false;
|
|
10451
10456
|
let timer;
|
|
10452
|
-
const settle = (
|
|
10457
|
+
const settle = (result) => {
|
|
10453
10458
|
if (settled)
|
|
10454
10459
|
return;
|
|
10455
10460
|
settled = true;
|
|
10456
10461
|
clearTimeout(timer);
|
|
10457
10462
|
signals.abort.removeEventListener("abort", onAbort);
|
|
10458
10463
|
signals.interrupt.removeEventListener("abort", onInterrupt);
|
|
10459
|
-
|
|
10464
|
+
onSettled(result);
|
|
10465
|
+
resolveWait(result);
|
|
10460
10466
|
};
|
|
10461
10467
|
const onAbort = () => settle("abort");
|
|
10462
10468
|
const onInterrupt = () => settle("interrupt");
|
|
@@ -10504,10 +10510,10 @@ function createTestSession(sessionManager, spec) {
|
|
|
10504
10510
|
let aborted = false;
|
|
10505
10511
|
let settlePromptAbort;
|
|
10506
10512
|
const messages = [];
|
|
10507
|
-
const promptAbort = new Promise((
|
|
10513
|
+
const promptAbort = new Promise((resolve, reject) => {
|
|
10508
10514
|
settlePromptAbort = () => {
|
|
10509
10515
|
if (testOptions.abortResolvesPrompt)
|
|
10510
|
-
|
|
10516
|
+
resolve("aborted");
|
|
10511
10517
|
else
|
|
10512
10518
|
reject(new Error("aborted"));
|
|
10513
10519
|
};
|
|
@@ -10592,6 +10598,9 @@ function createTestSession(sessionManager, spec) {
|
|
|
10592
10598
|
}
|
|
10593
10599
|
if (testOptions.fallbackBeforeGate)
|
|
10594
10600
|
emitFallback();
|
|
10601
|
+
for (const event of testOptions.beforeGateEvents ?? [])
|
|
10602
|
+
for (const listener of listeners)
|
|
10603
|
+
listener(event);
|
|
10595
10604
|
if (testOptions.promptGate) {
|
|
10596
10605
|
const gateResult = await Promise.race([
|
|
10597
10606
|
testOptions.promptGate.then(() => "released"),
|
|
@@ -10646,23 +10655,23 @@ function createTestSession(sessionManager, spec) {
|
|
|
10646
10655
|
tokens: zeroTokens,
|
|
10647
10656
|
cost: 0
|
|
10648
10657
|
}),
|
|
10649
|
-
dispose: () => {}
|
|
10658
|
+
dispose: testOptions.dispose ?? (() => {})
|
|
10650
10659
|
};
|
|
10651
10660
|
}
|
|
10652
10661
|
function nativeStatus(value) {
|
|
10653
|
-
return value;
|
|
10662
|
+
return value === "killed" ? "interrupted" : value;
|
|
10654
10663
|
}
|
|
10655
10664
|
function nativeCause(value) {
|
|
10656
10665
|
return value;
|
|
10657
10666
|
}
|
|
10658
|
-
function refusal(
|
|
10659
|
-
if (!
|
|
10667
|
+
function refusal(result) {
|
|
10668
|
+
if (!result.refusal)
|
|
10660
10669
|
return {};
|
|
10661
10670
|
return {
|
|
10662
10671
|
refusal: {
|
|
10663
|
-
kind:
|
|
10664
|
-
reason:
|
|
10665
|
-
...
|
|
10672
|
+
kind: result.refusal.kind,
|
|
10673
|
+
reason: result.refusal.reason,
|
|
10674
|
+
...result.refusal.maxDepth === undefined ? {} : { maxDepth: result.refusal.maxDepth }
|
|
10666
10675
|
}
|
|
10667
10676
|
};
|
|
10668
10677
|
}
|
|
@@ -10701,10 +10710,10 @@ function attemptStatus(termination) {
|
|
|
10701
10710
|
}
|
|
10702
10711
|
function boundedEnvelope(output, artifactPath, maxOutput) {
|
|
10703
10712
|
const config = { ...DEFAULT_MAX_OUTPUT, ...maxOutput };
|
|
10704
|
-
const
|
|
10705
|
-
return
|
|
10713
|
+
const result = truncateOutput(output, config, artifactPath);
|
|
10714
|
+
return result.truncated && artifactPath ? `${result.text}
|
|
10706
10715
|
|
|
10707
|
-
Full output: ${artifactPath}` :
|
|
10716
|
+
Full output: ${artifactPath}` : result.text;
|
|
10708
10717
|
}
|
|
10709
10718
|
function canonicalArtifactPaths(artifactsDir, childPath) {
|
|
10710
10719
|
const prefix = childPath.replaceAll("/", "_");
|
|
@@ -10807,6 +10816,7 @@ class SubagentControlRuntime {
|
|
|
10807
10816
|
attemptTerminators = new Map;
|
|
10808
10817
|
delivered = new Set;
|
|
10809
10818
|
deliveredEnvelopes = new Map;
|
|
10819
|
+
killedChildren = new Set;
|
|
10810
10820
|
nextAttemptId = 1;
|
|
10811
10821
|
constructor(parent, sessionRoot) {
|
|
10812
10822
|
this.parent = { ...parent };
|
|
@@ -10829,13 +10839,13 @@ class SubagentControlRuntime {
|
|
|
10829
10839
|
const native = this.native.admitChildSession({ taskName: spec.taskName, agentName: spec.agent.name, cwd: spec.cwd }, { path: parent.path, depth: parent.depth });
|
|
10830
10840
|
if (!native.child)
|
|
10831
10841
|
return refusal(native);
|
|
10832
|
-
const
|
|
10842
|
+
const identity = native.child;
|
|
10833
10843
|
const childModePolicy = resolveChildModePolicy(spec);
|
|
10834
|
-
const sessionDir = spec.sessionFile ? dirname7(spec.sessionFile) : sessionDirectory(this.sessionRoot,
|
|
10844
|
+
const sessionDir = spec.sessionFile ? dirname7(spec.sessionFile) : sessionDirectory(this.sessionRoot, identity.path);
|
|
10835
10845
|
mkdirSync4(sessionDir, { recursive: true });
|
|
10836
10846
|
return {
|
|
10837
10847
|
admitted: AdmittedChild.create({
|
|
10838
|
-
identity
|
|
10848
|
+
identity,
|
|
10839
10849
|
spec,
|
|
10840
10850
|
policy: {
|
|
10841
10851
|
...childModePolicy,
|
|
@@ -10849,7 +10859,7 @@ class SubagentControlRuntime {
|
|
|
10849
10859
|
thinkingLevel: spec.thinkingLevel ?? spec.agent.thinking,
|
|
10850
10860
|
intercomGroup: parent.intercomGroup,
|
|
10851
10861
|
intercom: spec.intercom,
|
|
10852
|
-
depth:
|
|
10862
|
+
depth: identity.depth
|
|
10853
10863
|
},
|
|
10854
10864
|
sessionDir,
|
|
10855
10865
|
sessionFile: spec.sessionFile,
|
|
@@ -10857,29 +10867,46 @@ class SubagentControlRuntime {
|
|
|
10857
10867
|
})
|
|
10858
10868
|
};
|
|
10859
10869
|
}
|
|
10860
|
-
async runChildAttempt(admitted, candidate, signals, onModelChange) {
|
|
10870
|
+
async runChildAttempt(admitted, candidate, signals, onModelChange, taskHooks, onCleanup) {
|
|
10861
10871
|
const candidateModelId = modelIdForCandidate(candidate, admitted.policy.model);
|
|
10862
10872
|
const configuredThinking = candidate.thinkingLevel ?? admitted.policy.thinkingLevel;
|
|
10863
10873
|
let effectiveModelId = candidateModelId;
|
|
10864
10874
|
let effectiveThinking = initialThinkingForAttempt(candidateModelId, configuredThinking);
|
|
10865
10875
|
let attemptedModels = candidateModelId ? [candidateModelId] : [];
|
|
10876
|
+
const selectedModel = candidate.model ?? admitted.policy.model;
|
|
10877
|
+
if (selectedModel)
|
|
10878
|
+
taskHooks?.reportActivity({
|
|
10879
|
+
reportId: `${randomUUID()}:admission-model`,
|
|
10880
|
+
change: {
|
|
10881
|
+
kind: "model",
|
|
10882
|
+
model: `${selectedModel.provider}/${selectedModel.id}`,
|
|
10883
|
+
thinking: configuredThinking === undefined ? undefined : clampThinkingLevel(selectedModel, configuredThinking)
|
|
10884
|
+
}
|
|
10885
|
+
});
|
|
10866
10886
|
let guard;
|
|
10867
10887
|
let retryDelayMs = CAPACITY_RETRY_INITIAL_DELAY_MS;
|
|
10868
10888
|
for (;; ) {
|
|
10869
10889
|
guard = this.native.beginChildAttempt(admitted.identity.path);
|
|
10870
10890
|
if (guard.token || guard.refusal?.kind !== "capacityExhausted")
|
|
10871
10891
|
break;
|
|
10872
|
-
|
|
10892
|
+
let killed = false;
|
|
10893
|
+
const waitResult = await waitForExecutionCapacity(retryDelayMs, signals, (result) => {
|
|
10894
|
+
killed = this.killedChildren.has(admitted.identity.path) || result === PARENT_CANCEL_CAUSE && !!taskHooks && signals.abort.reason === "user";
|
|
10895
|
+
});
|
|
10873
10896
|
if (waitResult !== "retry") {
|
|
10874
10897
|
const stats = { ...EMPTY_STATS, sessionId: admitted.identity.path };
|
|
10875
10898
|
if (waitResult === "interrupt" || waitResult === PARENT_CANCEL_CAUSE) {
|
|
10899
|
+
if (killed)
|
|
10900
|
+
this.killedChildren.add(admitted.identity.path);
|
|
10901
|
+
else
|
|
10902
|
+
this.killedChildren.delete(admitted.identity.path);
|
|
10876
10903
|
this.native.publishChildStatus(admitted.identity.path, nativeStatus("interrupted"));
|
|
10877
10904
|
return {
|
|
10878
|
-
status: "interrupted",
|
|
10879
|
-
...waitResult === PARENT_CANCEL_CAUSE ? { cause: PARENT_CANCEL_CAUSE } : {},
|
|
10905
|
+
status: killed ? "killed" : "interrupted",
|
|
10906
|
+
...waitResult === PARENT_CANCEL_CAUSE && !killed ? { cause: PARENT_CANCEL_CAUSE } : {},
|
|
10880
10907
|
stats,
|
|
10881
10908
|
path: admitted.identity.path,
|
|
10882
|
-
envelope: waitResult === PARENT_CANCEL_CAUSE ? cancelledEnvelope(undefined, admitted.spec, stats) : INTERRUPTED_ENVELOPE,
|
|
10909
|
+
envelope: killed ? "Killed. This child cannot be resumed." : waitResult === PARENT_CANCEL_CAUSE ? cancelledEnvelope(undefined, admitted.spec, stats) : INTERRUPTED_ENVELOPE,
|
|
10883
10910
|
...effectiveModelId === undefined ? {} : { model: effectiveModelId },
|
|
10884
10911
|
...effectiveThinking === undefined ? {} : { thinking: effectiveThinking }
|
|
10885
10912
|
};
|
|
@@ -10914,14 +10941,22 @@ class SubagentControlRuntime {
|
|
|
10914
10941
|
const token = guard.token;
|
|
10915
10942
|
this.attemptTokens.set(admitted.identity.path, token);
|
|
10916
10943
|
let session;
|
|
10944
|
+
const executionEnded = new AbortController;
|
|
10917
10945
|
let activeSessionManager;
|
|
10918
10946
|
let termination;
|
|
10919
10947
|
let terminating;
|
|
10948
|
+
let terminationWasKill = false;
|
|
10920
10949
|
let unsubscribe;
|
|
10921
10950
|
let skillReport = {};
|
|
10922
10951
|
const terminate = async (cause) => {
|
|
10923
|
-
if (terminating)
|
|
10952
|
+
if (terminating) {
|
|
10953
|
+
if (!terminationWasKill)
|
|
10954
|
+
this.killedChildren.delete(admitted.identity.path);
|
|
10924
10955
|
return terminating;
|
|
10956
|
+
}
|
|
10957
|
+
if (taskHooks && cause === "abort" && signals.abort.reason === "user")
|
|
10958
|
+
this.killedChildren.add(admitted.identity.path);
|
|
10959
|
+
terminationWasKill = this.killedChildren.has(admitted.identity.path);
|
|
10925
10960
|
termination = cause;
|
|
10926
10961
|
terminating = (async () => {
|
|
10927
10962
|
try {
|
|
@@ -10948,6 +10983,7 @@ class SubagentControlRuntime {
|
|
|
10948
10983
|
mkdirSync4(dirname7(admitted.sessionFile), { recursive: true });
|
|
10949
10984
|
const sessionManager = admitted.sessionFile ? SessionManager.open(admitted.sessionFile, admitted.sessionDir, admitted.policy.cwd) : SessionManager.create(admitted.policy.cwd, admitted.sessionDir, workflow ? { internal: true, workflow } : { internal: true });
|
|
10950
10985
|
activeSessionManager = sessionManager;
|
|
10986
|
+
taskHooks?.bindTranscript?.(sessionManager);
|
|
10951
10987
|
if (workflow)
|
|
10952
10988
|
sessionManager.markSessionInternal(workflow);
|
|
10953
10989
|
let created;
|
|
@@ -10987,7 +11023,7 @@ class SubagentControlRuntime {
|
|
|
10987
11023
|
sessionManager,
|
|
10988
11024
|
settingsManager,
|
|
10989
11025
|
orchestrationContext: admitted.spec.parent?.orchestrationContext,
|
|
10990
|
-
subagentPolicy: admitted.policy,
|
|
11026
|
+
subagentPolicy: { ...admitted.policy, executionEnded: executionEnded.signal },
|
|
10991
11027
|
systemPromptTransform,
|
|
10992
11028
|
initialContextTransform: promptBehavior.initialContextTransform
|
|
10993
11029
|
})).session
|
|
@@ -10995,6 +11031,14 @@ class SubagentControlRuntime {
|
|
|
10995
11031
|
await created.session.extensionRunner.emit({ type: "session_start", reason: "startup" });
|
|
10996
11032
|
}
|
|
10997
11033
|
session = created.session;
|
|
11034
|
+
const transcriptSession = session;
|
|
11035
|
+
let observedStreamingMessage;
|
|
11036
|
+
taskHooks?.bindTranscript?.({
|
|
11037
|
+
getSessionId: () => sessionManager.getSessionId(),
|
|
11038
|
+
getEntries: () => sessionManager.getEntries(),
|
|
11039
|
+
subscribe: (listener) => transcriptSession.subscribe(listener),
|
|
11040
|
+
getStreamingMessage: () => observedStreamingMessage
|
|
11041
|
+
});
|
|
10998
11042
|
const initialModelId = modelIdForSession(session) ?? candidateModelId;
|
|
10999
11043
|
effectiveModelId = initialModelId;
|
|
11000
11044
|
effectiveThinking = thinkingLevelForSession(session) ?? initialThinkingForAttempt(candidateModelId, configuredThinking);
|
|
@@ -11015,10 +11059,11 @@ class SubagentControlRuntime {
|
|
|
11015
11059
|
lastActivityAt: Date.now()
|
|
11016
11060
|
};
|
|
11017
11061
|
const attemptStartedAt = Date.now();
|
|
11062
|
+
const activityPrefix = randomUUID();
|
|
11018
11063
|
let lastProgressEmit = 0;
|
|
11019
11064
|
const emitProgress = (force) => {
|
|
11020
11065
|
const onProgress = admitted.spec.onProgress;
|
|
11021
|
-
if (!onProgress)
|
|
11066
|
+
if (!onProgress && !taskHooks)
|
|
11022
11067
|
return;
|
|
11023
11068
|
const now = Date.now();
|
|
11024
11069
|
if (!force && now - lastProgressEmit < 400)
|
|
@@ -11026,11 +11071,38 @@ class SubagentControlRuntime {
|
|
|
11026
11071
|
lastProgressEmit = now;
|
|
11027
11072
|
progressState.durationMs = now - attemptStartedAt;
|
|
11028
11073
|
progressState.lastActivityAt = now;
|
|
11029
|
-
|
|
11074
|
+
taskHooks?.reportActivity({
|
|
11075
|
+
reportId: `${activityPrefix}:metrics-${++activitySequence}`,
|
|
11076
|
+
change: {
|
|
11077
|
+
kind: "metrics",
|
|
11078
|
+
elapsedMs: progressState.durationMs,
|
|
11079
|
+
toolCount: progressState.toolCount,
|
|
11080
|
+
tokenCount: progressState.tokens
|
|
11081
|
+
}
|
|
11082
|
+
});
|
|
11083
|
+
onProgress?.({ ...progressState, recentTools: [...progressState.recentTools] });
|
|
11030
11084
|
};
|
|
11085
|
+
let activitySequence = 0;
|
|
11086
|
+
const reportModel = () => taskHooks?.reportActivity({
|
|
11087
|
+
reportId: `${activityPrefix}:model-${++activitySequence}`,
|
|
11088
|
+
change: { kind: "model", model: effectiveModelId, thinking: effectiveThinking }
|
|
11089
|
+
});
|
|
11090
|
+
reportModel();
|
|
11031
11091
|
unsubscribe = session.subscribe((event) => {
|
|
11032
11092
|
writeEvent(admitted.spec.artifactJsonlPath, event);
|
|
11093
|
+
if (event.type === "message_start" && event.message.role === "assistant")
|
|
11094
|
+
observedStreamingMessage = beginStreamingAssistantMessage(event.message);
|
|
11095
|
+
else if (event.type === "message_update" && observedStreamingMessage)
|
|
11096
|
+
applyAssistantMessageDelta(observedStreamingMessage, event.assistantMessageEvent);
|
|
11097
|
+
else if (event.type === "message_end" && event.message.role === "assistant")
|
|
11098
|
+
observedStreamingMessage = undefined;
|
|
11033
11099
|
const emission = progressEmissionFor(event.type);
|
|
11100
|
+
if (event.type === "tool_execution_start") {
|
|
11101
|
+
taskHooks?.reportActivity({
|
|
11102
|
+
reportId: `${activityPrefix}:tool-${++activitySequence}`,
|
|
11103
|
+
change: { kind: "action", tool: event.toolName, text: safeArgsPreview(event.args) }
|
|
11104
|
+
});
|
|
11105
|
+
}
|
|
11034
11106
|
if (event.type === "agent_start") {
|
|
11035
11107
|
this.native.publishChildStatus(admitted.identity.path, nativeStatus("running"));
|
|
11036
11108
|
} else if (event.type === "tool_execution_start") {
|
|
@@ -11068,10 +11140,13 @@ class SubagentControlRuntime {
|
|
|
11068
11140
|
effectiveModelId = event.to;
|
|
11069
11141
|
progressState.model = event.to;
|
|
11070
11142
|
onModelChange?.(effectiveModelId, effectiveThinking);
|
|
11143
|
+
reportModel();
|
|
11144
|
+
emitProgress(true);
|
|
11071
11145
|
} else if (event.type === "thinking_level_changed") {
|
|
11072
11146
|
effectiveThinking = event.level;
|
|
11073
11147
|
progressState.thinking = effectiveThinking;
|
|
11074
11148
|
onModelChange?.(effectiveModelId, effectiveThinking);
|
|
11149
|
+
reportModel();
|
|
11075
11150
|
emitProgress(true);
|
|
11076
11151
|
}
|
|
11077
11152
|
});
|
|
@@ -11103,11 +11178,11 @@ class SubagentControlRuntime {
|
|
|
11103
11178
|
};
|
|
11104
11179
|
if (status === "interrupted")
|
|
11105
11180
|
return {
|
|
11106
|
-
status,
|
|
11107
|
-
...termination === PARENT_CANCEL_CAUSE ? { cause: PARENT_CANCEL_CAUSE } : {},
|
|
11181
|
+
status: this.killedChildren.has(admitted.identity.path) ? "killed" : status,
|
|
11182
|
+
...termination === PARENT_CANCEL_CAUSE && !this.killedChildren.has(admitted.identity.path) ? { cause: PARENT_CANCEL_CAUSE } : {},
|
|
11108
11183
|
stats,
|
|
11109
11184
|
path: admitted.identity.path,
|
|
11110
|
-
envelope,
|
|
11185
|
+
envelope: this.killedChildren.has(admitted.identity.path) ? "Killed. This child cannot be resumed." : envelope,
|
|
11111
11186
|
sessionFile,
|
|
11112
11187
|
...effectiveModelId === undefined ? {} : { model: effectiveModelId },
|
|
11113
11188
|
...effectiveThinking === undefined ? {} : { thinking: effectiveThinking },
|
|
@@ -11136,11 +11211,11 @@ class SubagentControlRuntime {
|
|
|
11136
11211
|
} catch {}
|
|
11137
11212
|
if (status === "interrupted")
|
|
11138
11213
|
return {
|
|
11139
|
-
status,
|
|
11140
|
-
...termination === PARENT_CANCEL_CAUSE ? { cause: PARENT_CANCEL_CAUSE } : {},
|
|
11214
|
+
status: this.killedChildren.has(admitted.identity.path) ? "killed" : status,
|
|
11215
|
+
...termination === PARENT_CANCEL_CAUSE && !this.killedChildren.has(admitted.identity.path) ? { cause: PARENT_CANCEL_CAUSE } : {},
|
|
11141
11216
|
stats,
|
|
11142
11217
|
path: admitted.identity.path,
|
|
11143
|
-
envelope: termination === PARENT_CANCEL_CAUSE ? cancelledEnvelope(session, admitted.spec, stats) : INTERRUPTED_ENVELOPE,
|
|
11218
|
+
envelope: termination === PARENT_CANCEL_CAUSE && !this.killedChildren.has(admitted.identity.path) ? cancelledEnvelope(session, admitted.spec, stats) : this.killedChildren.has(admitted.identity.path) ? "Killed. This child cannot be resumed." : INTERRUPTED_ENVELOPE,
|
|
11144
11219
|
sessionFile: session?.sessionFile,
|
|
11145
11220
|
...effectiveModelId === undefined ? {} : { model: effectiveModelId },
|
|
11146
11221
|
...effectiveThinking === undefined ? {} : { thinking: effectiveThinking },
|
|
@@ -11160,6 +11235,7 @@ class SubagentControlRuntime {
|
|
|
11160
11235
|
...skillReport
|
|
11161
11236
|
};
|
|
11162
11237
|
} finally {
|
|
11238
|
+
executionEnded.abort();
|
|
11163
11239
|
signals.abort.removeEventListener("abort", abortListener);
|
|
11164
11240
|
signals.interrupt.removeEventListener("abort", interruptListener);
|
|
11165
11241
|
try {
|
|
@@ -11168,16 +11244,36 @@ class SubagentControlRuntime {
|
|
|
11168
11244
|
try {
|
|
11169
11245
|
activeSessionManager?.flush();
|
|
11170
11246
|
} catch {}
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11247
|
+
if (onCleanup) {
|
|
11248
|
+
onCleanup((async () => {
|
|
11249
|
+
try {
|
|
11250
|
+
await session?.dispose();
|
|
11251
|
+
return { kind: "reaped" };
|
|
11252
|
+
} catch (error) {
|
|
11253
|
+
return {
|
|
11254
|
+
kind: "failed",
|
|
11255
|
+
resources: [
|
|
11256
|
+
{
|
|
11257
|
+
resource: "agent-session",
|
|
11258
|
+
code: "CleanupFailed",
|
|
11259
|
+
message: error instanceof Error ? error.message : String(error)
|
|
11260
|
+
}
|
|
11261
|
+
]
|
|
11262
|
+
};
|
|
11263
|
+
}
|
|
11264
|
+
})());
|
|
11265
|
+
} else {
|
|
11266
|
+
try {
|
|
11267
|
+
session?.dispose();
|
|
11268
|
+
} catch {}
|
|
11269
|
+
}
|
|
11174
11270
|
if (this.attemptTokens.get(admitted.identity.path) === token)
|
|
11175
11271
|
this.attemptTokens.delete(admitted.identity.path);
|
|
11176
11272
|
if (this.attemptTerminators.get(admitted.identity.path) === terminate)
|
|
11177
11273
|
this.attemptTerminators.delete(admitted.identity.path);
|
|
11178
11274
|
}
|
|
11179
11275
|
}
|
|
11180
|
-
startAttempt(admitted, candidate, signals) {
|
|
11276
|
+
startAttempt(admitted, candidate, signals, taskHooks) {
|
|
11181
11277
|
const initialModel = modelIdForCandidate(candidate, admitted.policy.model);
|
|
11182
11278
|
const initialThinking = initialThinkingForAttempt(initialModel, candidate.thinkingLevel ?? admitted.policy.thinkingLevel);
|
|
11183
11279
|
const running = {
|
|
@@ -11196,19 +11292,26 @@ class SubagentControlRuntime {
|
|
|
11196
11292
|
envelope: "uninitialized"
|
|
11197
11293
|
})
|
|
11198
11294
|
};
|
|
11295
|
+
let cleanup = Promise.resolve({ kind: "reaped" });
|
|
11199
11296
|
running.promise = this.runChildAttempt(admitted, candidate, signals, (model, thinking) => {
|
|
11200
11297
|
running.currentModel = model;
|
|
11201
11298
|
running.currentThinking = thinking;
|
|
11202
|
-
}
|
|
11203
|
-
|
|
11299
|
+
}, taskHooks, taskHooks ? (result) => {
|
|
11300
|
+
cleanup = result;
|
|
11301
|
+
} : undefined).then((result) => {
|
|
11302
|
+
running.status = result.status;
|
|
11204
11303
|
this.runningAttempts.delete(running.id);
|
|
11205
|
-
return
|
|
11304
|
+
return result;
|
|
11206
11305
|
});
|
|
11207
11306
|
running.terminate = (cause) => this.terminateRunningAttempt(running, cause);
|
|
11208
11307
|
running.promise.catch(() => {
|
|
11209
11308
|
return;
|
|
11210
11309
|
});
|
|
11211
11310
|
this.runningAttempts.set(running.id, running);
|
|
11311
|
+
taskHooks?.onExecution({
|
|
11312
|
+
result: running.promise,
|
|
11313
|
+
cleanup: running.promise.then(() => cleanup, () => cleanup)
|
|
11314
|
+
});
|
|
11212
11315
|
return running;
|
|
11213
11316
|
}
|
|
11214
11317
|
continueDetached(running, _reason) {
|
|
@@ -11266,20 +11369,25 @@ class SubagentControlRuntime {
|
|
|
11266
11369
|
return this.deliveredEnvelopes.get(pathValue);
|
|
11267
11370
|
}
|
|
11268
11371
|
findChild(pathValue) {
|
|
11269
|
-
return this.
|
|
11372
|
+
return this.listChildren().find((child) => child.path === pathValue);
|
|
11270
11373
|
}
|
|
11271
11374
|
listChildren() {
|
|
11272
|
-
return this.native.listChildren()
|
|
11375
|
+
return this.native.listChildren().map((child) => ({
|
|
11376
|
+
...child,
|
|
11377
|
+
status: child.status === "interrupted" && this.killedChildren.has(child.path) ? "killed" : child.status
|
|
11378
|
+
}));
|
|
11273
11379
|
}
|
|
11274
|
-
async
|
|
11380
|
+
async killChild(pathValue) {
|
|
11275
11381
|
const running = [...this.runningAttempts.values()].find((attempt) => attempt.child.identity.path === pathValue && (attempt.status === "running" || attempt.status === "continued"));
|
|
11276
11382
|
if (!running)
|
|
11277
11383
|
return false;
|
|
11384
|
+
if (this.findChild(pathValue)?.status !== "interrupted")
|
|
11385
|
+
this.killedChildren.add(pathValue);
|
|
11278
11386
|
await this.terminateChildAttempt(running, "interrupt");
|
|
11279
11387
|
return true;
|
|
11280
11388
|
}
|
|
11281
11389
|
subscribe(pathValue, callback) {
|
|
11282
|
-
this.native.subscribeChildStatus(pathValue, callback);
|
|
11390
|
+
this.native.subscribeChildStatus(pathValue, (status) => callback(status === "interrupted" && this.killedChildren.has(pathValue) ? "killed" : status));
|
|
11283
11391
|
}
|
|
11284
11392
|
async terminateRunningAttempt(running, cause) {
|
|
11285
11393
|
const terminate = this.attemptTerminators.get(running.child.identity.path);
|
|
@@ -11349,6 +11457,21 @@ function childLines(control, id) {
|
|
|
11349
11457
|
}
|
|
11350
11458
|
return control.listChildren().map((child) => `${child.path} — ${child.status} (${child.loaded ? "loaded" : "cold"})`);
|
|
11351
11459
|
}
|
|
11460
|
+
function statusGroup(control, id) {
|
|
11461
|
+
return {
|
|
11462
|
+
parentPath: control.parent.path,
|
|
11463
|
+
children: canonicalChildren(control).filter((child) => !id || id === control.parent.path || child.path === id).map((child) => {
|
|
11464
|
+
const delivered = control.getDeliveredResult(child.path);
|
|
11465
|
+
const metadata = control.getChildMetadata(child.path) ?? delivered;
|
|
11466
|
+
return {
|
|
11467
|
+
...child,
|
|
11468
|
+
sessionFile: delivered?.sessionFile,
|
|
11469
|
+
...metadata?.model === undefined ? {} : { model: metadata.model },
|
|
11470
|
+
...metadata?.thinking === undefined ? {} : { thinking: metadata.thinking }
|
|
11471
|
+
};
|
|
11472
|
+
})
|
|
11473
|
+
};
|
|
11474
|
+
}
|
|
11352
11475
|
function inspectInProcessChildStatus(id) {
|
|
11353
11476
|
if (id) {
|
|
11354
11477
|
const control = findSubagentControl(id);
|
|
@@ -11361,31 +11484,34 @@ function inspectInProcessChildStatus(id) {
|
|
|
11361
11484
|
return;
|
|
11362
11485
|
return {
|
|
11363
11486
|
content: [{ type: "text", text }],
|
|
11364
|
-
details: { mode: "management", results: [] }
|
|
11487
|
+
details: { mode: "management", results: [], statusGroups: [statusGroup(control, id)] }
|
|
11365
11488
|
};
|
|
11366
11489
|
}
|
|
11367
|
-
const
|
|
11368
|
-
|
|
11369
|
-
...childLines(control)
|
|
11370
|
-
]);
|
|
11490
|
+
const controls = listSubagentControls();
|
|
11491
|
+
const lines = controls.flatMap((control) => [`Parent: ${control.parent.path}`, ...childLines(control)]);
|
|
11371
11492
|
if (lines.length === 0)
|
|
11372
11493
|
return;
|
|
11373
11494
|
return {
|
|
11374
11495
|
content: [{ type: "text", text: lines.join(`
|
|
11375
11496
|
`) }],
|
|
11376
|
-
details: { mode: "management", results: [] }
|
|
11497
|
+
details: { mode: "management", results: [], statusGroups: controls.map((control) => statusGroup(control)) }
|
|
11377
11498
|
};
|
|
11378
11499
|
}
|
|
11379
|
-
async function
|
|
11500
|
+
async function killInProcessChild(id) {
|
|
11380
11501
|
const control = findSubagentControl(id);
|
|
11381
11502
|
if (!control)
|
|
11382
11503
|
return;
|
|
11383
11504
|
const identities = canonicalChildren(control);
|
|
11384
11505
|
const candidates = id === control.parent.path ? identities : identities.filter((child) => child.path === id);
|
|
11385
11506
|
for (const child of candidates) {
|
|
11386
|
-
if (await control.
|
|
11507
|
+
if (await control.killChild(child.path)) {
|
|
11387
11508
|
return {
|
|
11388
|
-
content: [
|
|
11509
|
+
content: [
|
|
11510
|
+
{
|
|
11511
|
+
type: "text",
|
|
11512
|
+
text: `Kill requested for in-process child ${child.path}. This child cannot be resumed.`
|
|
11513
|
+
}
|
|
11514
|
+
],
|
|
11389
11515
|
details: { mode: "management", results: [] }
|
|
11390
11516
|
};
|
|
11391
11517
|
}
|
|
@@ -11481,8 +11607,8 @@ function registerBurstDisplay(callIds, taskCount) {
|
|
|
11481
11607
|
}
|
|
11482
11608
|
return display;
|
|
11483
11609
|
}
|
|
11484
|
-
function updateBurstDisplay(display,
|
|
11485
|
-
display.result =
|
|
11610
|
+
function updateBurstDisplay(display, result) {
|
|
11611
|
+
display.result = result;
|
|
11486
11612
|
}
|
|
11487
11613
|
function getBurstDisplay(callId) {
|
|
11488
11614
|
const display = displayByCallId.get(callId);
|
|
@@ -11503,20 +11629,17 @@ function resolveRequestedCwd(runtimeCwd, requestedCwd) {
|
|
|
11503
11629
|
|
|
11504
11630
|
// dist/builtin/subagents/src/runs/foreground/subagent-executor-live-update.ts
|
|
11505
11631
|
var liveResultIndices = new WeakMap;
|
|
11506
|
-
function markLiveResultIndices(
|
|
11507
|
-
liveResultIndices.set(
|
|
11632
|
+
function markLiveResultIndices(result, indices) {
|
|
11633
|
+
liveResultIndices.set(result, indices);
|
|
11508
11634
|
}
|
|
11509
|
-
function getLiveResultIndices(
|
|
11510
|
-
return liveResultIndices.get(
|
|
11635
|
+
function getLiveResultIndices(result) {
|
|
11636
|
+
return liveResultIndices.get(result);
|
|
11511
11637
|
}
|
|
11512
11638
|
|
|
11513
11639
|
// dist/builtin/subagents/src/runs/foreground/subagent-executor-parent-ask-projection.ts
|
|
11514
11640
|
var parentAskHandoffs = new WeakMap;
|
|
11515
|
-
function
|
|
11516
|
-
parentAskHandoffs.
|
|
11517
|
-
}
|
|
11518
|
-
function getParentAskHandoff(result2) {
|
|
11519
|
-
return parentAskHandoffs.get(result2);
|
|
11641
|
+
function getParentAskHandoff(result) {
|
|
11642
|
+
return parentAskHandoffs.get(result);
|
|
11520
11643
|
}
|
|
11521
11644
|
|
|
11522
11645
|
// dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts
|
|
@@ -11656,11 +11779,11 @@ function formatStandardParallelContent(results) {
|
|
|
11656
11779
|
error: child.error
|
|
11657
11780
|
})), (index, agent) => `=== Task ${index + 1}: ${agent} ===`);
|
|
11658
11781
|
}
|
|
11659
|
-
function projectParentAskContent(
|
|
11660
|
-
const handoff = getParentAskHandoff(
|
|
11782
|
+
function projectParentAskContent(result, route, projectedResults) {
|
|
11783
|
+
const handoff = getParentAskHandoff(result);
|
|
11661
11784
|
if (!handoff)
|
|
11662
11785
|
return;
|
|
11663
|
-
const originalItem =
|
|
11786
|
+
const originalItem = result.content.length === 1 && result.content[0]?.type === "text" ? result.content[0] : { type: "text", text: "" };
|
|
11664
11787
|
const routeEnd = route.start + route.length;
|
|
11665
11788
|
const inRoute = (index) => index >= route.start && index < routeEnd;
|
|
11666
11789
|
if (!inRoute(handoff.askingChildIndex)) {
|
|
@@ -11680,16 +11803,16 @@ function projectParentAskContent(result2, route, projectedResults) {
|
|
|
11680
11803
|
}
|
|
11681
11804
|
];
|
|
11682
11805
|
}
|
|
11683
|
-
function projectParallelContent(
|
|
11806
|
+
function projectParallelContent(result, sharedResults, projectedResults, route, live) {
|
|
11684
11807
|
const projectedText = formatStandardParallelContent(projectedResults);
|
|
11685
11808
|
if (live)
|
|
11686
11809
|
return [{ type: "text", text: projectedText }];
|
|
11687
|
-
const parentAskContent = projectParentAskContent(
|
|
11810
|
+
const parentAskContent = projectParentAskContent(result, route, projectedResults);
|
|
11688
11811
|
if (parentAskContent)
|
|
11689
11812
|
return parentAskContent;
|
|
11690
|
-
if (
|
|
11691
|
-
return
|
|
11692
|
-
const originalItem =
|
|
11813
|
+
if (result.content.length !== 1 || result.content[0]?.type !== "text")
|
|
11814
|
+
return result.content;
|
|
11815
|
+
const originalItem = result.content[0];
|
|
11693
11816
|
const originalText = originalItem.text;
|
|
11694
11817
|
const sharedText = formatStandardParallelContent(sharedResults);
|
|
11695
11818
|
if (originalText === sharedText)
|
|
@@ -11699,13 +11822,13 @@ function projectParallelContent(result2, sharedResults, projectedResults, route,
|
|
|
11699
11822
|
`)) {
|
|
11700
11823
|
return [{ ...originalItem, text: `${projectedText}${originalText.slice(sharedText.length)}` }];
|
|
11701
11824
|
}
|
|
11702
|
-
return
|
|
11825
|
+
return result.content;
|
|
11703
11826
|
}
|
|
11704
|
-
function projectResult(
|
|
11705
|
-
const sharedDetails =
|
|
11827
|
+
function projectResult(result, route, live = false) {
|
|
11828
|
+
const sharedDetails = result.details;
|
|
11706
11829
|
if (!sharedDetails || !live && sharedDetails.results.length === 0)
|
|
11707
|
-
return
|
|
11708
|
-
const liveIndices = live ? getLiveResultIndices(
|
|
11830
|
+
return result;
|
|
11831
|
+
const liveIndices = live ? getLiveResultIndices(result) : undefined;
|
|
11709
11832
|
const results = liveIndices ? sharedDetails.results.filter((_child, index) => {
|
|
11710
11833
|
const resultIndex = liveIndices[index];
|
|
11711
11834
|
return resultIndex !== undefined && resultIndex >= route.start && resultIndex < route.start + route.length;
|
|
@@ -11714,8 +11837,8 @@ function projectResult(result2, route, live = false) {
|
|
|
11714
11837
|
const controlEvents = sharedDetails.controlEvents?.filter((event) => event.index !== undefined && event.index >= route.start && event.index < route.start + route.length).map((event) => ({ ...event, index: event.index - route.start }));
|
|
11715
11838
|
const artifactFiles = results.flatMap((child) => child.artifactPaths ? [child.artifactPaths] : []);
|
|
11716
11839
|
return {
|
|
11717
|
-
content: projectParallelContent(
|
|
11718
|
-
...
|
|
11840
|
+
content: projectParallelContent(result, sharedDetails.results, results, route, live),
|
|
11841
|
+
...result.isError !== undefined ? { isError: result.isError } : {},
|
|
11719
11842
|
details: {
|
|
11720
11843
|
mode: "parallel",
|
|
11721
11844
|
...sharedDetails.runId !== undefined ? { runId: sharedDetails.runId } : {},
|
|
@@ -11729,11 +11852,11 @@ function projectResult(result2, route, live = false) {
|
|
|
11729
11852
|
}
|
|
11730
11853
|
};
|
|
11731
11854
|
}
|
|
11732
|
-
function resolveItem(item,
|
|
11855
|
+
function resolveItem(item, result) {
|
|
11733
11856
|
if (item.settled)
|
|
11734
11857
|
return;
|
|
11735
11858
|
item.settled = true;
|
|
11736
|
-
item.resolve(
|
|
11859
|
+
item.resolve(result);
|
|
11737
11860
|
}
|
|
11738
11861
|
function rejectItem(item, reason) {
|
|
11739
11862
|
if (item.settled)
|
|
@@ -11804,10 +11927,10 @@ function createExecutionBurstDispatcher(input) {
|
|
|
11804
11927
|
};
|
|
11805
11928
|
input.setActive(true);
|
|
11806
11929
|
try {
|
|
11807
|
-
const
|
|
11808
|
-
updateBurstDisplay(display,
|
|
11930
|
+
const result = await input.execute(first.id, merged.params, first.signal, onUpdate, first.ctx);
|
|
11931
|
+
updateBurstDisplay(display, result);
|
|
11809
11932
|
for (let index = 0;index < items.length; index++) {
|
|
11810
|
-
resolveItem(items[index], projectResult(
|
|
11933
|
+
resolveItem(items[index], projectResult(result, merged.routes[index]));
|
|
11811
11934
|
}
|
|
11812
11935
|
} catch (error) {
|
|
11813
11936
|
const rejection = error instanceof Error ? error : new Error(String(error));
|
|
@@ -11827,8 +11950,8 @@ function createExecutionBurstDispatcher(input) {
|
|
|
11827
11950
|
return (id, params, signal, onUpdate, ctx) => {
|
|
11828
11951
|
if (input.isActive())
|
|
11829
11952
|
return Promise.resolve(input.duplicateResult(params));
|
|
11830
|
-
return new Promise((
|
|
11831
|
-
queue.push({ id, params, signal, onUpdate, ctx, settled: false, resolve
|
|
11953
|
+
return new Promise((resolve, reject) => {
|
|
11954
|
+
queue.push({ id, params, signal, onUpdate, ctx, settled: false, resolve, reject });
|
|
11832
11955
|
if (!flushScheduled) {
|
|
11833
11956
|
flushScheduled = true;
|
|
11834
11957
|
setImmediate(flush);
|
|
@@ -11838,7 +11961,7 @@ function createExecutionBurstDispatcher(input) {
|
|
|
11838
11961
|
}
|
|
11839
11962
|
|
|
11840
11963
|
// dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts
|
|
11841
|
-
import { randomUUID } from "node:crypto";
|
|
11964
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
11842
11965
|
import * as fs13 from "node:fs";
|
|
11843
11966
|
import * as path13 from "node:path";
|
|
11844
11967
|
|
|
@@ -12081,13 +12204,13 @@ function normalizeRepeatedParallelCounts(params) {
|
|
|
12081
12204
|
return { error: buildRequestedModeError(params, expandedTasks.error) };
|
|
12082
12205
|
return { params: { ...params, tasks: expandedTasks.tasks } };
|
|
12083
12206
|
}
|
|
12084
|
-
function withForkContext(
|
|
12085
|
-
if (context !== "fork" || !
|
|
12086
|
-
return
|
|
12207
|
+
function withForkContext(result, context) {
|
|
12208
|
+
if (context !== "fork" || !result.details)
|
|
12209
|
+
return result;
|
|
12087
12210
|
return {
|
|
12088
|
-
...
|
|
12211
|
+
...result,
|
|
12089
12212
|
details: {
|
|
12090
|
-
...
|
|
12213
|
+
...result.details,
|
|
12091
12214
|
context: "fork"
|
|
12092
12215
|
}
|
|
12093
12216
|
};
|
|
@@ -12166,7 +12289,7 @@ function prepareExecutionContext(input) {
|
|
|
12166
12289
|
});
|
|
12167
12290
|
const agents = intercomBridge.active ? discoveredAgents.map((agent) => applyIntercomBridgeToAgent(agent, intercomBridge)) : discoveredAgents;
|
|
12168
12291
|
const parallelAgentConfigs = intercomBridge.active ? resolvedTaskAgents?.map((agent) => applyIntercomBridgeToAgent(agent, intercomBridge)) : resolvedTaskAgents;
|
|
12169
|
-
const runId =
|
|
12292
|
+
const runId = randomUUID2().slice(0, 8);
|
|
12170
12293
|
const shareEnabled = effectiveParams.share === true;
|
|
12171
12294
|
const hasTasks = (effectiveParams.tasks?.length ?? 0) > 0;
|
|
12172
12295
|
const hasSingle = !hasTasks && Boolean(effectiveParams.agent);
|
|
@@ -12272,10 +12395,10 @@ function resolveCandidateModel(candidateId, lookup, preferredProvider) {
|
|
|
12272
12395
|
const slash = baseModel.indexOf("/");
|
|
12273
12396
|
if (slash < 0) {
|
|
12274
12397
|
const available = lookup.getAvailable().filter((entry) => entry.id === baseModel);
|
|
12275
|
-
const
|
|
12276
|
-
if (!
|
|
12398
|
+
const model = available.find((entry) => entry.provider === preferredProvider) ?? (available.length === 1 ? available[0] : undefined);
|
|
12399
|
+
if (!model)
|
|
12277
12400
|
return;
|
|
12278
|
-
return thinkingLevel === undefined ? { model
|
|
12401
|
+
return thinkingLevel === undefined ? { model } : { model, thinkingLevel };
|
|
12279
12402
|
}
|
|
12280
12403
|
const provider = baseModel.slice(0, slash);
|
|
12281
12404
|
const modelId = baseModel.slice(slash + 1);
|
|
@@ -12289,7 +12412,7 @@ function createCandidateModelResolver(lookup, preferredProvider) {
|
|
|
12289
12412
|
}
|
|
12290
12413
|
|
|
12291
12414
|
// dist/builtin/subagents/src/runs/shared/intercom-group.ts
|
|
12292
|
-
import { randomUUID as
|
|
12415
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
12293
12416
|
import { readRuntimeIntercomGroup } from "@bastani/atomic";
|
|
12294
12417
|
function normalizeAutoGroupSentinel(group) {
|
|
12295
12418
|
if (group === undefined || group === true)
|
|
@@ -12313,14 +12436,14 @@ function inheritedIntercomGroup(ctx) {
|
|
|
12313
12436
|
function resolveChildIntercomGroup(explicit, inherited, sharedAutoGroup) {
|
|
12314
12437
|
const normalized = normalizeAutoGroupSentinel(explicit);
|
|
12315
12438
|
if (normalized === true)
|
|
12316
|
-
return sharedAutoGroup ??
|
|
12439
|
+
return sharedAutoGroup ?? randomUUID3();
|
|
12317
12440
|
if (typeof normalized === "string" && normalized.trim().length > 0)
|
|
12318
12441
|
return normalized.trim();
|
|
12319
12442
|
return inherited;
|
|
12320
12443
|
}
|
|
12321
12444
|
function sharedAutoGroupForSet(setGroup, items) {
|
|
12322
12445
|
const needsAuto = normalizeAutoGroupSentinel(setGroup) === true || items.some((item) => normalizeAutoGroupSentinel(item.group) === true);
|
|
12323
|
-
return needsAuto ?
|
|
12446
|
+
return needsAuto ? randomUUID3() : undefined;
|
|
12324
12447
|
}
|
|
12325
12448
|
|
|
12326
12449
|
// dist/builtin/subagents/src/runs/shared/model-fallback.ts
|
|
@@ -12499,8 +12622,8 @@ function hasTrackedPathComponent(runGit, repo, relativePath) {
|
|
|
12499
12622
|
let candidate = "";
|
|
12500
12623
|
for (const component of components) {
|
|
12501
12624
|
candidate = candidate ? `${candidate}/${component}` : component;
|
|
12502
|
-
const
|
|
12503
|
-
if (
|
|
12625
|
+
const result = runGit(repo, ["ls-files", "--stage", "--", candidate]);
|
|
12626
|
+
if (result.stdout.split(/\r?\n/).some((line) => line.slice(line.indexOf("\t") + 1) === candidate))
|
|
12504
12627
|
return true;
|
|
12505
12628
|
}
|
|
12506
12629
|
return false;
|
|
@@ -12533,9 +12656,9 @@ function configureHooks(runGit, mainRoot) {
|
|
|
12533
12656
|
const current = runGit(mainRoot, ["config", "--get", "core.hooksPath"]);
|
|
12534
12657
|
if (current.status === 0 && path16.resolve(mainRoot, current.stdout.trim()) === desired)
|
|
12535
12658
|
return;
|
|
12536
|
-
const
|
|
12537
|
-
if (
|
|
12538
|
-
throw new Error(
|
|
12659
|
+
const result = runGit(mainRoot, ["config", "core.hooksPath", desired]);
|
|
12660
|
+
if (result.status !== 0)
|
|
12661
|
+
throw new Error(result.stderr.trim() || "failed to configure shared core.hooksPath");
|
|
12539
12662
|
}
|
|
12540
12663
|
function copyIncludes(runGit, mainRoot, worktreeRoot) {
|
|
12541
12664
|
if (!fs15.existsSync(path16.join(mainRoot, ".worktreeinclude")))
|
|
@@ -12659,24 +12782,24 @@ function findCanonicalGitRoot(cwd) {
|
|
|
12659
12782
|
// dist/builtin/subagents/src/runs/shared/worktree.ts
|
|
12660
12783
|
var DEFAULT_WORKTREE_SETUP_HOOK_TIMEOUT_MS = 30000;
|
|
12661
12784
|
function runGit(cwd, args) {
|
|
12662
|
-
const
|
|
12785
|
+
const result = spawnSync("git", ["-C", cwd, ...args], {
|
|
12663
12786
|
encoding: "utf-8",
|
|
12664
12787
|
env: createGitEnvironment({}, createChildProcessEnvironment3())
|
|
12665
12788
|
});
|
|
12666
12789
|
return {
|
|
12667
|
-
stdout:
|
|
12668
|
-
stderr:
|
|
12669
|
-
status:
|
|
12790
|
+
stdout: result.stdout ?? "",
|
|
12791
|
+
stderr: result.stderr ?? "",
|
|
12792
|
+
status: result.status
|
|
12670
12793
|
};
|
|
12671
12794
|
}
|
|
12672
12795
|
function runGitChecked(cwd, args) {
|
|
12673
|
-
const
|
|
12674
|
-
if (
|
|
12796
|
+
const result = runGit(cwd, args);
|
|
12797
|
+
if (result.status !== 0) {
|
|
12675
12798
|
const command = `git -C ${cwd} ${args.join(" ")}`;
|
|
12676
|
-
const message =
|
|
12799
|
+
const message = result.stderr.trim() || result.stdout.trim() || `${command} failed`;
|
|
12677
12800
|
throw new Error(message);
|
|
12678
12801
|
}
|
|
12679
|
-
return
|
|
12802
|
+
return result.stdout;
|
|
12680
12803
|
}
|
|
12681
12804
|
function originDefaultBranch(mainRoot) {
|
|
12682
12805
|
const symbolic = runGit(mainRoot, ["symbolic-ref", "--short", "refs/remotes/origin/HEAD"]);
|
|
@@ -12798,18 +12921,18 @@ function normalizeSyntheticPath(worktreePath, rawPath) {
|
|
|
12798
12921
|
if (path18.isAbsolute(trimmed))
|
|
12799
12922
|
throw new Error(`synthetic path must be relative: ${rawPath}`);
|
|
12800
12923
|
const resolved = path18.resolve(worktreePath, trimmed);
|
|
12801
|
-
const
|
|
12802
|
-
if (!
|
|
12924
|
+
const relative = path18.relative(worktreePath, resolved);
|
|
12925
|
+
if (!relative || relative === ".") {
|
|
12803
12926
|
throw new Error(`synthetic path cannot target the worktree root: ${rawPath}`);
|
|
12804
12927
|
}
|
|
12805
|
-
if (
|
|
12928
|
+
if (relative === ".." || relative.startsWith(`..${path18.sep}`) || path18.isAbsolute(relative)) {
|
|
12806
12929
|
throw new Error(`synthetic path escapes the worktree root: ${rawPath}`);
|
|
12807
12930
|
}
|
|
12808
|
-
return path18.normalize(
|
|
12931
|
+
return path18.normalize(relative);
|
|
12809
12932
|
}
|
|
12810
12933
|
function hasTrackedEntries(worktreePath, relativePath) {
|
|
12811
|
-
const
|
|
12812
|
-
return
|
|
12934
|
+
const result = runGit(worktreePath, ["ls-files", "--", relativePath]);
|
|
12935
|
+
return result.status === 0 && result.stdout.trim().length > 0;
|
|
12813
12936
|
}
|
|
12814
12937
|
function parseWorktreeSetupHookOutput(rawStdout) {
|
|
12815
12938
|
const trimmed = rawStdout.trim();
|
|
@@ -12832,7 +12955,7 @@ function isSpuriousHookStdinWriteFailure(code, status) {
|
|
|
12832
12955
|
return code === "EPIPE" && status !== null;
|
|
12833
12956
|
}
|
|
12834
12957
|
function runWorktreeSetupHook(hook, input) {
|
|
12835
|
-
const
|
|
12958
|
+
const result = spawnSync(hook.hookPath, [], {
|
|
12836
12959
|
cwd: input.worktreePath,
|
|
12837
12960
|
encoding: "utf-8",
|
|
12838
12961
|
input: JSON.stringify(input),
|
|
@@ -12840,20 +12963,20 @@ function runWorktreeSetupHook(hook, input) {
|
|
|
12840
12963
|
timeout: hook.timeoutMs,
|
|
12841
12964
|
shell: false
|
|
12842
12965
|
});
|
|
12843
|
-
if (
|
|
12844
|
-
const code = "code" in
|
|
12966
|
+
if (result.error) {
|
|
12967
|
+
const code = "code" in result.error && typeof result.error.code === "string" ? result.error.code : undefined;
|
|
12845
12968
|
if (code === "ETIMEDOUT") {
|
|
12846
12969
|
throw new Error(`worktree setup hook timed out after ${hook.timeoutMs}ms`);
|
|
12847
12970
|
}
|
|
12848
|
-
if (!isSpuriousHookStdinWriteFailure(code,
|
|
12849
|
-
throw new Error(`worktree setup hook failed: ${
|
|
12971
|
+
if (!isSpuriousHookStdinWriteFailure(code, result.status)) {
|
|
12972
|
+
throw new Error(`worktree setup hook failed: ${result.error.message}`);
|
|
12850
12973
|
}
|
|
12851
12974
|
}
|
|
12852
|
-
if (
|
|
12853
|
-
const details =
|
|
12854
|
-
throw new Error(`worktree setup hook failed with exit code ${
|
|
12975
|
+
if (result.status !== 0) {
|
|
12976
|
+
const details = result.stderr.trim() || result.stdout.trim() || "no output";
|
|
12977
|
+
throw new Error(`worktree setup hook failed with exit code ${result.status}: ${details}`);
|
|
12855
12978
|
}
|
|
12856
|
-
const output = parseWorktreeSetupHookOutput(
|
|
12979
|
+
const output = parseWorktreeSetupHookOutput(result.stdout);
|
|
12857
12980
|
if (output.syntheticPaths === undefined)
|
|
12858
12981
|
return [];
|
|
12859
12982
|
if (!Array.isArray(output.syntheticPaths)) {
|
|
@@ -12924,8 +13047,8 @@ function createSingleWorktree(mainRoot, cwdRelative, runId, index, baseRef, base
|
|
|
12924
13047
|
}
|
|
12925
13048
|
function removeSyntheticPath(worktree, syntheticPath) {
|
|
12926
13049
|
const resolved = path18.resolve(worktree.path, syntheticPath);
|
|
12927
|
-
const
|
|
12928
|
-
if (!
|
|
13050
|
+
const relative = path18.relative(worktree.path, resolved);
|
|
13051
|
+
if (!relative || relative === "." || relative === ".." || relative.startsWith(`..${path18.sep}`) || path18.isAbsolute(relative)) {
|
|
12929
13052
|
return;
|
|
12930
13053
|
}
|
|
12931
13054
|
let stat;
|
|
@@ -13187,29 +13310,216 @@ function findDuplicateParallelOutputPath(input) {
|
|
|
13187
13310
|
return;
|
|
13188
13311
|
}
|
|
13189
13312
|
|
|
13190
|
-
// dist/builtin/subagents/src/runs/foreground/
|
|
13191
|
-
function
|
|
13313
|
+
// dist/builtin/subagents/src/runs/foreground/task-execution.ts
|
|
13314
|
+
function subagentTaskResultLabel(result) {
|
|
13315
|
+
return result.kind === "cancelled" && result.cause === "user" ? "killed (non-resumable)" : result.kind;
|
|
13316
|
+
}
|
|
13317
|
+
function subagentTaskResponseText(response) {
|
|
13318
|
+
const outcomes = response.kind === "parallel" ? response.slots.map((slot) => slot.outcome) : [response];
|
|
13319
|
+
const killed = outcomes.filter((outcome) => outcome.kind === "admitted" && outcome.observation.kind === "settled" && subagentTaskResultLabel(outcome.observation.result) === "killed (non-resumable)");
|
|
13320
|
+
return `${killed.length ? `${killed.length} killed. These children cannot be resumed. Underlying host response:
|
|
13321
|
+
` : ""}${JSON.stringify(response)}`;
|
|
13322
|
+
}
|
|
13323
|
+
function taskToolResult(response, host) {
|
|
13192
13324
|
return {
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13325
|
+
content: [{ type: "text", text: subagentTaskResponseText(response) }],
|
|
13326
|
+
details: {
|
|
13327
|
+
mode: "single",
|
|
13328
|
+
results: [],
|
|
13329
|
+
taskResponse: response,
|
|
13330
|
+
taskRecords: taskResponseRecords(response, host)
|
|
13331
|
+
},
|
|
13332
|
+
...response.kind === "unstarted" ? { isError: true } : {}
|
|
13333
|
+
};
|
|
13334
|
+
}
|
|
13335
|
+
function taskResponseRecords(response, host) {
|
|
13336
|
+
const outcomes = response.kind === "parallel" ? response.slots.map((slot) => slot.outcome) : [response];
|
|
13337
|
+
const ids = new Set(outcomes.flatMap((outcome) => outcome.kind === "admitted" ? [outcome.observation.taskId] : []));
|
|
13338
|
+
const watched = host?.watchOwnerTasks();
|
|
13339
|
+
if (!watched?.ok)
|
|
13340
|
+
return [];
|
|
13341
|
+
try {
|
|
13342
|
+
return watched.value.snapshot.tasks.filter((task) => ids.has(task.ref.taskId));
|
|
13343
|
+
} finally {
|
|
13344
|
+
watched.value.dispose();
|
|
13345
|
+
}
|
|
13346
|
+
}
|
|
13347
|
+
async function runAgentTask(input) {
|
|
13348
|
+
let yieldWait;
|
|
13349
|
+
let pendingYield = false;
|
|
13350
|
+
const registered = Promise.withResolvers();
|
|
13351
|
+
const started = await input.host.startAgentTask({ kind: "agent", agent: input.agent, task: input.intentTask ?? input.task, cwd: input.options.cwd ?? input.cwd }, `${input.options.runId}:${input.options.index ?? 0}`, (context) => {
|
|
13352
|
+
const cleaned = Promise.withResolvers();
|
|
13353
|
+
let executionBound = false;
|
|
13354
|
+
const result = registered.promise.then(async () => {
|
|
13355
|
+
try {
|
|
13356
|
+
const child = await input.runtime.runSync(input.cwd, input.agents, input.agent, input.task, {
|
|
13357
|
+
...input.options,
|
|
13358
|
+
signal: context.signal,
|
|
13359
|
+
taskExecution: {
|
|
13360
|
+
signal: context.signal,
|
|
13361
|
+
reportActivity: context.reportActivity,
|
|
13362
|
+
bindTranscript: (session) => context.bindTranscript({
|
|
13363
|
+
getSessionId: () => session.getSessionId(),
|
|
13364
|
+
getEntries: () => session.getEntries(),
|
|
13365
|
+
...session.subscribe ? { subscribe: session.subscribe.bind(session) } : {},
|
|
13366
|
+
...session.getStreamingMessage ? { getStreamingMessage: session.getStreamingMessage.bind(session) } : {},
|
|
13367
|
+
...input.options.intercomSessionName ? {
|
|
13368
|
+
completionSource: {
|
|
13369
|
+
runId: input.options.runId,
|
|
13370
|
+
intercomTarget: input.options.intercomSessionName
|
|
13371
|
+
}
|
|
13372
|
+
} : {}
|
|
13373
|
+
}),
|
|
13374
|
+
onExecution: (execution) => {
|
|
13375
|
+
executionBound = true;
|
|
13376
|
+
execution.cleanup.then(cleaned.resolve, (error) => cleaned.resolve({
|
|
13377
|
+
kind: "failed",
|
|
13378
|
+
resources: [{ resource: "agent-session", code: "CleanupFailed", message: String(error) }]
|
|
13379
|
+
}));
|
|
13380
|
+
},
|
|
13381
|
+
yieldTaskWait: () => {
|
|
13382
|
+
if (yieldWait)
|
|
13383
|
+
yieldWait("intercom-coordination");
|
|
13384
|
+
else
|
|
13385
|
+
pendingYield = true;
|
|
13386
|
+
}
|
|
13387
|
+
}
|
|
13388
|
+
});
|
|
13389
|
+
if (child.model !== undefined || child.thinking !== undefined)
|
|
13390
|
+
context.reportActivity({
|
|
13391
|
+
reportId: "terminal-model",
|
|
13392
|
+
change: { kind: "model", model: child.model, thinking: child.thinking }
|
|
13393
|
+
});
|
|
13394
|
+
input.onTerminal?.(child);
|
|
13395
|
+
const text = input.outputText?.(child) ?? getSingleResultOutput(child);
|
|
13396
|
+
const bytes = Buffer.from(text);
|
|
13397
|
+
context.reportActivity({
|
|
13398
|
+
reportId: "terminal-output",
|
|
13399
|
+
change: { kind: "output", offset: "0", bytesBase64: bytes.toString("base64") }
|
|
13400
|
+
});
|
|
13401
|
+
const output = {
|
|
13402
|
+
ownerId: context.ref.ownerId,
|
|
13403
|
+
taskId: context.ref.taskId,
|
|
13404
|
+
artifactId: `output:${context.ref.taskId}`,
|
|
13405
|
+
byteCount: String(bytes.length),
|
|
13406
|
+
omittedRanges: []
|
|
13407
|
+
};
|
|
13408
|
+
if (child.status === "killed")
|
|
13409
|
+
return { kind: "cancelled", cause: "user", output };
|
|
13410
|
+
if (child.interrupted)
|
|
13411
|
+
return {
|
|
13412
|
+
kind: "cancelled",
|
|
13413
|
+
cause: input.options.interruptSignal?.aborted ? "parent-handoff" : "owner-close",
|
|
13414
|
+
output
|
|
13415
|
+
};
|
|
13416
|
+
return child.status === "ok" ? { kind: "completed", output } : {
|
|
13417
|
+
kind: "failed",
|
|
13418
|
+
code: "AgentFailed",
|
|
13419
|
+
message: child.error ?? child.envelope ?? "Agent failed",
|
|
13420
|
+
output
|
|
13421
|
+
};
|
|
13422
|
+
} finally {
|
|
13423
|
+
if (!executionBound)
|
|
13424
|
+
cleaned.resolve({ kind: "reaped" });
|
|
13425
|
+
}
|
|
13426
|
+
});
|
|
13427
|
+
return { result, cleanup: cleaned.promise };
|
|
13428
|
+
}, input.schedule);
|
|
13429
|
+
if (!started.ok)
|
|
13430
|
+
return { kind: "unstarted", reason: { kind: "rejected", error: started.error } };
|
|
13431
|
+
const yieldForIntercom = () => {
|
|
13432
|
+
if (yieldWait)
|
|
13433
|
+
yieldWait("intercom-coordination");
|
|
13434
|
+
else
|
|
13435
|
+
pendingYield = true;
|
|
13436
|
+
};
|
|
13437
|
+
input.options.intercomDetachSignal?.addEventListener("abort", yieldForIntercom, { once: true });
|
|
13438
|
+
if (input.options.intercomDetachSignal?.aborted)
|
|
13439
|
+
yieldForIntercom();
|
|
13440
|
+
const observation = input.host.observeAgentLaunch(started.value.taskId, input.wait, (yieldRegistered) => {
|
|
13441
|
+
yieldWait = yieldRegistered;
|
|
13442
|
+
if (pendingYield)
|
|
13443
|
+
yieldRegistered("intercom-coordination");
|
|
13444
|
+
registered.resolve();
|
|
13445
|
+
});
|
|
13446
|
+
registered.resolve();
|
|
13447
|
+
const observed = await observation.finally(() => input.options.intercomDetachSignal?.removeEventListener("abort", yieldForIntercom));
|
|
13448
|
+
if (!observed.ok)
|
|
13449
|
+
throw new Error(`${observed.error.code}: ${observed.error.message}`);
|
|
13450
|
+
return { kind: "admitted", observation: observed.value };
|
|
13451
|
+
}
|
|
13452
|
+
|
|
13453
|
+
// dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts
|
|
13454
|
+
function runUnboundParallelTask(options, agent, task, schedule, run) {
|
|
13455
|
+
const observed = Promise.withResolvers();
|
|
13456
|
+
const finished = Promise.withResolvers();
|
|
13457
|
+
let started = false;
|
|
13458
|
+
let yielded = false;
|
|
13459
|
+
const yieldQueued = () => {
|
|
13460
|
+
if (started)
|
|
13461
|
+
return;
|
|
13462
|
+
yielded = true;
|
|
13463
|
+
observed.resolve({
|
|
13464
|
+
agent,
|
|
13465
|
+
task,
|
|
13466
|
+
status: "continued",
|
|
13467
|
+
detached: true,
|
|
13468
|
+
detachedReason: "intercom-coordination",
|
|
13469
|
+
messages: [],
|
|
13470
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 }
|
|
13471
|
+
});
|
|
13199
13472
|
};
|
|
13473
|
+
options.intercomDetachSignal?.addEventListener("abort", yieldQueued, { once: true });
|
|
13474
|
+
schedule(async () => {
|
|
13475
|
+
started = true;
|
|
13476
|
+
try {
|
|
13477
|
+
const result = await run({
|
|
13478
|
+
...options,
|
|
13479
|
+
onDetachedExit: (result) => {
|
|
13480
|
+
try {
|
|
13481
|
+
options.onDetachedExit?.(result);
|
|
13482
|
+
} finally {
|
|
13483
|
+
finished.resolve();
|
|
13484
|
+
}
|
|
13485
|
+
}
|
|
13486
|
+
});
|
|
13487
|
+
observed.resolve(result);
|
|
13488
|
+
if (!result.detached) {
|
|
13489
|
+
finished.resolve();
|
|
13490
|
+
if (yielded)
|
|
13491
|
+
options.onDetachedExit?.(result);
|
|
13492
|
+
}
|
|
13493
|
+
await finished.promise;
|
|
13494
|
+
} catch (error) {
|
|
13495
|
+
observed.reject(error);
|
|
13496
|
+
}
|
|
13497
|
+
});
|
|
13498
|
+
if (options.intercomDetachSignal?.aborted)
|
|
13499
|
+
yieldQueued();
|
|
13500
|
+
return observed.promise.finally(() => options.intercomDetachSignal?.removeEventListener("abort", yieldQueued));
|
|
13200
13501
|
}
|
|
13201
13502
|
async function runForegroundParallelTasks(input) {
|
|
13202
13503
|
const intercomDetachController = new AbortController;
|
|
13203
|
-
const
|
|
13204
|
-
|
|
13205
|
-
const
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13504
|
+
const host = input.ctx.getAgentTaskHost?.();
|
|
13505
|
+
let active = 0;
|
|
13506
|
+
const queued = [];
|
|
13507
|
+
const pump = () => {
|
|
13508
|
+
while (active < input.concurrencyLimit && queued.length > 0) {
|
|
13509
|
+
const dispatch = queued.shift();
|
|
13510
|
+
active++;
|
|
13511
|
+
const release = () => {
|
|
13512
|
+
active--;
|
|
13513
|
+
pump();
|
|
13514
|
+
};
|
|
13515
|
+
dispatch().then(release, release);
|
|
13212
13516
|
}
|
|
13517
|
+
};
|
|
13518
|
+
const schedule = (dispatch) => {
|
|
13519
|
+
queued.push(dispatch);
|
|
13520
|
+
pump();
|
|
13521
|
+
};
|
|
13522
|
+
return mapConcurrent(input.tasks, input.tasks.length, async (task, index) => {
|
|
13213
13523
|
const behavior = input.behaviors[index];
|
|
13214
13524
|
const effectiveSkills = behavior?.skills;
|
|
13215
13525
|
const taskCwd = resolveParallelTaskCwd(task, input.paramsCwd, input.worktreeSetup, index);
|
|
@@ -13219,19 +13529,7 @@ async function runForegroundParallelTasks(input) {
|
|
|
13219
13529
|
const taskText = injectSingleOutputInstruction(`${readInstructions.prefix}${input.taskTexts[index]}${progressInstructions.suffix}`, outputPath);
|
|
13220
13530
|
const childIntercomTarget = input.childIntercomTarget?.(task.agent, index);
|
|
13221
13531
|
const supervisorAuthorization = await requestSupervisorAuthorization(input.intercomEvents, childIntercomTarget);
|
|
13222
|
-
if (parentAskController.signal.aborted) {
|
|
13223
|
-
return skippedParallelResult(task, input.taskTexts[index] ?? task.task, "Skipped after parent ask handoff");
|
|
13224
|
-
}
|
|
13225
|
-
if (intercomDetachController.signal.aborted) {
|
|
13226
|
-
return skippedParallelResult(task, input.taskTexts[index] ?? task.task, "Skipped after foreground group detached for intercom coordination");
|
|
13227
|
-
}
|
|
13228
13532
|
const interruptController = new AbortController;
|
|
13229
|
-
const interruptForParentAsk = () => interruptController.abort();
|
|
13230
|
-
parentAskController.signal.addEventListener("abort", interruptForParentAsk, { once: true });
|
|
13231
|
-
if (parentAskController.signal.aborted)
|
|
13232
|
-
interruptController.abort();
|
|
13233
|
-
startedIndices.add(index);
|
|
13234
|
-
activeIndices.add(index);
|
|
13235
13533
|
if (input.foregroundControl) {
|
|
13236
13534
|
input.foregroundControl.currentAgent = task.agent;
|
|
13237
13535
|
input.foregroundControl.currentIndex = index;
|
|
@@ -13275,21 +13573,9 @@ async function runForegroundParallelTasks(input) {
|
|
|
13275
13573
|
supervisorAuthorization,
|
|
13276
13574
|
orchestratorIntercomTarget: input.orchestratorIntercomTarget,
|
|
13277
13575
|
intercomGroup: resolveChildIntercomGroup(task.group ?? input.setIntercomGroup, inheritedIntercomGroup(input.ctx), input.sharedAutoIntercomGroup),
|
|
13278
|
-
onDetachedExit: (
|
|
13576
|
+
onDetachedExit: (result) => input.onDetachedExit?.(index, result),
|
|
13279
13577
|
intercomDetachSignal: intercomDetachController.signal,
|
|
13280
13578
|
onIntercomDetachCommit: () => intercomDetachController.abort(),
|
|
13281
|
-
onParentAskHandoff: input.onParentAskHandoff ? (request) => {
|
|
13282
|
-
if (parentAskController.signal.aborted)
|
|
13283
|
-
return;
|
|
13284
|
-
request.taskContext = input.tasks[request.index]?.task ?? "";
|
|
13285
|
-
input.onParentAskHandoff?.({
|
|
13286
|
-
askingChildIndex: request.index,
|
|
13287
|
-
releasedChildIndices: [...activeIndices].sort((left, right) => left - right),
|
|
13288
|
-
unlaunchedChildIndices: input.tasks.map((_, taskIndex) => taskIndex).filter((taskIndex) => !startedIndices.has(taskIndex)),
|
|
13289
|
-
request
|
|
13290
|
-
});
|
|
13291
|
-
parentAskController.abort();
|
|
13292
|
-
} : undefined,
|
|
13293
13579
|
modelOverride: input.modelOverrides[index],
|
|
13294
13580
|
availableModels: input.availableModels,
|
|
13295
13581
|
knownModelProviders: input.knownModelProviders,
|
|
@@ -13319,12 +13605,12 @@ async function runForegroundParallelTasks(input) {
|
|
|
13319
13605
|
input.liveResults[index] = stepResults[0];
|
|
13320
13606
|
if (stepProgress.length > 0)
|
|
13321
13607
|
input.liveProgress[index] = stepProgress[0];
|
|
13322
|
-
const indexedResults = input.liveResults.flatMap((
|
|
13323
|
-
const mergedResults = indexedResults.map(({ result
|
|
13608
|
+
const indexedResults = input.liveResults.flatMap((result, resultIndex) => result === undefined ? [] : [{ result, index: resultIndex }]);
|
|
13609
|
+
const mergedResults = indexedResults.map(({ result }) => result);
|
|
13324
13610
|
const mergedProgress = input.liveProgress.filter((progress) => progress !== undefined);
|
|
13325
13611
|
const controlEvents = progressUpdate.details?.controlEvents?.map((event) => ({ ...event, index }));
|
|
13326
13612
|
const artifactDir = progressUpdate.details?.artifacts?.dir;
|
|
13327
|
-
const artifactFiles = mergedResults.flatMap((
|
|
13613
|
+
const artifactFiles = mergedResults.flatMap((result) => result.artifactPaths ? [result.artifactPaths] : []);
|
|
13328
13614
|
const aggregateUpdate = {
|
|
13329
13615
|
content: progressUpdate.content,
|
|
13330
13616
|
details: {
|
|
@@ -13341,9 +13627,39 @@ async function runForegroundParallelTasks(input) {
|
|
|
13341
13627
|
} : undefined
|
|
13342
13628
|
};
|
|
13343
13629
|
input.onExecution?.(index, input.ctx.cwd, runOptions);
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13630
|
+
if (host) {
|
|
13631
|
+
if (input.wait?.kind !== "foreground") {
|
|
13632
|
+
runOptions.intercomDetachSignal = undefined;
|
|
13633
|
+
runOptions.onIntercomDetachCommit = undefined;
|
|
13634
|
+
}
|
|
13635
|
+
let terminalChild;
|
|
13636
|
+
const response = await runAgentTask({
|
|
13637
|
+
host,
|
|
13638
|
+
cwd: input.ctx.cwd,
|
|
13639
|
+
agents: taskAgents,
|
|
13640
|
+
agent: task.agent,
|
|
13641
|
+
task: taskText,
|
|
13642
|
+
intentTask: task.task,
|
|
13643
|
+
options: runOptions,
|
|
13644
|
+
wait: input.wait,
|
|
13645
|
+
runtime: input.runtime,
|
|
13646
|
+
schedule: (dispatch) => schedule(() => dispatch().finally(() => input.onTaskTerminal?.(index))),
|
|
13647
|
+
onTerminal: (child) => {
|
|
13648
|
+
terminalChild = child;
|
|
13649
|
+
}
|
|
13650
|
+
});
|
|
13651
|
+
if (terminalChild)
|
|
13652
|
+
return { ...terminalChild, taskResponse: response };
|
|
13653
|
+
return {
|
|
13654
|
+
agent: task.agent,
|
|
13655
|
+
task: task.task,
|
|
13656
|
+
status: "continued",
|
|
13657
|
+
messages: [],
|
|
13658
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 },
|
|
13659
|
+
taskResponse: response
|
|
13660
|
+
};
|
|
13661
|
+
}
|
|
13662
|
+
return runUnboundParallelTask(runOptions, task.agent, taskText, schedule, (options) => input.runtime.runSync(input.ctx.cwd, taskAgents, task.agent, taskText, options)).finally(() => {
|
|
13347
13663
|
if (input.foregroundControl?.currentIndex === index) {
|
|
13348
13664
|
input.foregroundControl.interrupt = undefined;
|
|
13349
13665
|
input.foregroundControl.updatedAt = Date.now();
|
|
@@ -13356,9 +13672,11 @@ async function runForegroundParallelTasks(input) {
|
|
|
13356
13672
|
import { isStaleExtensionContextError as isStaleExtensionContextError4 } from "@bastani/atomic";
|
|
13357
13673
|
|
|
13358
13674
|
// dist/builtin/subagents/src/intercom/result-intercom.ts
|
|
13359
|
-
import { randomUUID as
|
|
13675
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
13360
13676
|
import { isStaleExtensionContextError as isStaleExtensionContextError3 } from "@bastani/atomic";
|
|
13361
13677
|
function resolveSubagentResultStatus(input) {
|
|
13678
|
+
if (input.status === "killed" || input.state === "killed")
|
|
13679
|
+
return "killed";
|
|
13362
13680
|
if (input.detached || input.status === "continued")
|
|
13363
13681
|
return "detached";
|
|
13364
13682
|
if (input.interrupted || input.status === "interrupted" || input.state === "interrupted")
|
|
@@ -13374,6 +13692,7 @@ function countStatuses(children) {
|
|
|
13374
13692
|
completed: 0,
|
|
13375
13693
|
failed: 0,
|
|
13376
13694
|
interrupted: 0,
|
|
13695
|
+
killed: 0,
|
|
13377
13696
|
detached: 0
|
|
13378
13697
|
};
|
|
13379
13698
|
for (const child of children) {
|
|
@@ -13385,6 +13704,7 @@ function formatStatusCounts(children) {
|
|
|
13385
13704
|
let completed = 0;
|
|
13386
13705
|
let failed = 0;
|
|
13387
13706
|
let interrupted = 0;
|
|
13707
|
+
let killed = 0;
|
|
13388
13708
|
let cancelled = 0;
|
|
13389
13709
|
let detached = 0;
|
|
13390
13710
|
for (const child of children) {
|
|
@@ -13397,6 +13717,8 @@ function formatStatusCounts(children) {
|
|
|
13397
13717
|
failed += 1;
|
|
13398
13718
|
else if (label === "interrupted")
|
|
13399
13719
|
interrupted += 1;
|
|
13720
|
+
else if (label === "killed")
|
|
13721
|
+
killed += 1;
|
|
13400
13722
|
else if (label === "detached")
|
|
13401
13723
|
detached += 1;
|
|
13402
13724
|
}
|
|
@@ -13405,6 +13727,7 @@ function formatStatusCounts(children) {
|
|
|
13405
13727
|
failed ? `${failed} failed` : undefined,
|
|
13406
13728
|
cancelled ? `${cancelled} cancelled` : undefined,
|
|
13407
13729
|
interrupted ? `${interrupted} interrupted` : undefined,
|
|
13730
|
+
killed ? `${killed} killed (non-resumable)` : undefined,
|
|
13408
13731
|
detached ? `${detached} detached` : undefined
|
|
13409
13732
|
].filter((part) => Boolean(part));
|
|
13410
13733
|
return parts.length ? parts.join(", ") : "0 results";
|
|
@@ -13413,6 +13736,10 @@ function resolveGroupedStatus(children) {
|
|
|
13413
13736
|
const counts = countStatuses(children);
|
|
13414
13737
|
if (counts.failed > 0)
|
|
13415
13738
|
return "failed";
|
|
13739
|
+
if (groupedParentCancelCause(children))
|
|
13740
|
+
return "interrupted";
|
|
13741
|
+
if (counts.killed > 0)
|
|
13742
|
+
return "killed";
|
|
13416
13743
|
if (counts.interrupted > 0)
|
|
13417
13744
|
return "interrupted";
|
|
13418
13745
|
if (counts.completed > 0)
|
|
@@ -13491,8 +13818,8 @@ async function deliverSubagentResultIntercomEvent(events, payload, timeoutMs = 5
|
|
|
13491
13818
|
async function deliverSubagentIntercomMessageEvent(events, to, message, timeoutMs = 500, extra = {}) {
|
|
13492
13819
|
if (typeof events.on !== "function" || typeof events.emit !== "function")
|
|
13493
13820
|
return false;
|
|
13494
|
-
const requestId = typeof extra.requestId === "string" ? extra.requestId :
|
|
13495
|
-
return new Promise((
|
|
13821
|
+
const requestId = typeof extra.requestId === "string" ? extra.requestId : randomUUID4();
|
|
13822
|
+
return new Promise((resolve) => {
|
|
13496
13823
|
let settled = false;
|
|
13497
13824
|
let unsubscribe;
|
|
13498
13825
|
let timer;
|
|
@@ -13508,7 +13835,7 @@ async function deliverSubagentIntercomMessageEvent(events, to, message, timeoutM
|
|
|
13508
13835
|
if (!isStaleExtensionContextError3(error))
|
|
13509
13836
|
throw error;
|
|
13510
13837
|
}
|
|
13511
|
-
|
|
13838
|
+
resolve(delivered);
|
|
13512
13839
|
};
|
|
13513
13840
|
try {
|
|
13514
13841
|
unsubscribe = events.on(SUBAGENT_RESULT_INTERCOM_DELIVERY_EVENT, (data) => {
|
|
@@ -13534,9 +13861,9 @@ async function deliverSubagentIntercomMessageEvent(events, to, message, timeoutM
|
|
|
13534
13861
|
}
|
|
13535
13862
|
});
|
|
13536
13863
|
}
|
|
13537
|
-
function stripSingleResultOutputs(
|
|
13864
|
+
function stripSingleResultOutputs(result) {
|
|
13538
13865
|
return {
|
|
13539
|
-
...
|
|
13866
|
+
...result,
|
|
13540
13867
|
messages: undefined,
|
|
13541
13868
|
finalOutput: undefined,
|
|
13542
13869
|
truncation: undefined
|
|
@@ -13583,14 +13910,14 @@ function formatSubagentResultReceipt(input) {
|
|
|
13583
13910
|
|
|
13584
13911
|
// dist/builtin/subagents/src/runs/foreground/completion-notification.ts
|
|
13585
13912
|
function deliverLocalCompletionNotification(events, payload, notificationId) {
|
|
13586
|
-
return new Promise((
|
|
13913
|
+
return new Promise((resolve, reject) => {
|
|
13587
13914
|
let settled = false;
|
|
13588
13915
|
let deferred = false;
|
|
13589
13916
|
const finish = (delivered) => {
|
|
13590
13917
|
if (settled)
|
|
13591
13918
|
return;
|
|
13592
13919
|
settled = true;
|
|
13593
|
-
|
|
13920
|
+
resolve(delivered);
|
|
13594
13921
|
};
|
|
13595
13922
|
const fail = (error) => {
|
|
13596
13923
|
if (settled)
|
|
@@ -13713,28 +14040,28 @@ function createForegroundControlNotifier(data, deps) {
|
|
|
13713
14040
|
function workflowStageAcceptsDetachedNotification(ctx) {
|
|
13714
14041
|
return ctx.orchestrationContext?.messageAdmission?.isOpen() !== false;
|
|
13715
14042
|
}
|
|
13716
|
-
function resultSummaryForIntercom(
|
|
13717
|
-
const output = getSingleResultOutput(
|
|
13718
|
-
if (
|
|
13719
|
-
return output ? `${
|
|
14043
|
+
function resultSummaryForIntercom(result) {
|
|
14044
|
+
const output = getSingleResultOutput(result);
|
|
14045
|
+
if (result.status === "error" && result.error) {
|
|
14046
|
+
return output ? `${result.error}
|
|
13720
14047
|
|
|
13721
14048
|
Output:
|
|
13722
|
-
${output}` :
|
|
14049
|
+
${output}` : result.error;
|
|
13723
14050
|
}
|
|
13724
|
-
return output ||
|
|
14051
|
+
return output || result.error || "(no output)";
|
|
13725
14052
|
}
|
|
13726
14053
|
function notifyDetachedForegroundChildExit(input) {
|
|
13727
|
-
const { pi, runId, index, result
|
|
14054
|
+
const { pi, runId, index, result } = input;
|
|
13728
14055
|
deliverLocalCompletionNotification(pi.events, {
|
|
13729
14056
|
id: runId,
|
|
13730
14057
|
runId,
|
|
13731
|
-
agent:
|
|
13732
|
-
status:
|
|
13733
|
-
summary: resultSummaryForIntercom(
|
|
13734
|
-
...
|
|
14058
|
+
agent: result.agent,
|
|
14059
|
+
status: result.status,
|
|
14060
|
+
summary: resultSummaryForIntercom(result),
|
|
14061
|
+
...result.interrupted ? { state: "interrupted" } : {},
|
|
13735
14062
|
timestamp: Date.now(),
|
|
13736
|
-
...
|
|
13737
|
-
...
|
|
14063
|
+
...result.progressSummary?.durationMs !== undefined ? { durationMs: result.progressSummary.durationMs } : {},
|
|
14064
|
+
...result.sessionFile ? { sessionFile: result.sessionFile } : {},
|
|
13738
14065
|
...input.totalTasks !== undefined && input.totalTasks > 1 ? { taskIndex: index, totalTasks: input.totalTasks } : {},
|
|
13739
14066
|
noticeLabel: "Detached subagent task"
|
|
13740
14067
|
}, `foreground-detach-${runId}-${index}`).catch((error) => {
|
|
@@ -13746,20 +14073,20 @@ function notifyDetachedForegroundChildExit(input) {
|
|
|
13746
14073
|
async function emitForegroundResultIntercom(input) {
|
|
13747
14074
|
if (!input.intercomBridge.active || !input.intercomBridge.orchestratorTarget)
|
|
13748
14075
|
return null;
|
|
13749
|
-
const children = input.results.flatMap((
|
|
14076
|
+
const children = input.results.flatMap((result, index) => result.detached ? [] : [
|
|
13750
14077
|
{
|
|
13751
|
-
agent:
|
|
14078
|
+
agent: result.agent,
|
|
13752
14079
|
status: resolveSubagentResultStatus({
|
|
13753
|
-
status:
|
|
13754
|
-
interrupted:
|
|
13755
|
-
detached:
|
|
14080
|
+
status: result.status,
|
|
14081
|
+
interrupted: result.interrupted,
|
|
14082
|
+
detached: result.detached
|
|
13756
14083
|
}),
|
|
13757
|
-
summary: resultSummaryForIntercom(
|
|
14084
|
+
summary: resultSummaryForIntercom(result),
|
|
13758
14085
|
index,
|
|
13759
|
-
...
|
|
13760
|
-
artifactPath:
|
|
13761
|
-
sessionPath:
|
|
13762
|
-
intercomTarget: resolveSubagentIntercomTarget(input.runId,
|
|
14086
|
+
...result.cause ? { cause: result.cause } : {},
|
|
14087
|
+
artifactPath: result.artifactPaths?.outputPath,
|
|
14088
|
+
sessionPath: result.sessionFile,
|
|
14089
|
+
intercomTarget: resolveSubagentIntercomTarget(input.runId, result.agent, index)
|
|
13763
14090
|
}
|
|
13764
14091
|
]);
|
|
13765
14092
|
if (children.length === 0)
|
|
@@ -13870,7 +14197,6 @@ async function runParallelPath(data, deps) {
|
|
|
13870
14197
|
});
|
|
13871
14198
|
if (errorResult)
|
|
13872
14199
|
return errorResult;
|
|
13873
|
-
let parentAsk;
|
|
13874
14200
|
try {
|
|
13875
14201
|
const duplicateOutputError = findDuplicateParallelOutputPath({
|
|
13876
14202
|
tasks,
|
|
@@ -13897,7 +14223,9 @@ async function runParallelPath(data, deps) {
|
|
|
13897
14223
|
}
|
|
13898
14224
|
}
|
|
13899
14225
|
const results = await runForegroundParallelTasks({
|
|
13900
|
-
|
|
14226
|
+
wait: params.wait,
|
|
14227
|
+
onTaskTerminal: (index) => detachedCleanup.recover(index),
|
|
14228
|
+
onDetachedExit: (index, result) => {
|
|
13901
14229
|
try {
|
|
13902
14230
|
if (workflowStageAcceptsDetachedNotification(ctx)) {
|
|
13903
14231
|
notifyDetachedForegroundChildExit({
|
|
@@ -13906,17 +14234,13 @@ async function runParallelPath(data, deps) {
|
|
|
13906
14234
|
mode: "parallel",
|
|
13907
14235
|
index,
|
|
13908
14236
|
totalTasks: tasks.length,
|
|
13909
|
-
result
|
|
14237
|
+
result
|
|
13910
14238
|
});
|
|
13911
14239
|
}
|
|
13912
14240
|
} finally {
|
|
13913
14241
|
detachedCleanup.recover(index);
|
|
13914
14242
|
}
|
|
13915
14243
|
},
|
|
13916
|
-
onParentAskHandoff: (handoff) => {
|
|
13917
|
-
if (!parentAsk)
|
|
13918
|
-
parentAsk = handoff;
|
|
13919
|
-
},
|
|
13920
14244
|
tasks,
|
|
13921
14245
|
taskTexts,
|
|
13922
14246
|
agents,
|
|
@@ -13954,57 +14278,67 @@ async function runParallelPath(data, deps) {
|
|
|
13954
14278
|
worktreeSetup,
|
|
13955
14279
|
runtime: deps.runtime
|
|
13956
14280
|
});
|
|
14281
|
+
if (ctx.getAgentTaskHost) {
|
|
14282
|
+
const response = {
|
|
14283
|
+
kind: "parallel",
|
|
14284
|
+
slots: results.map((result, ordinal) => ({
|
|
14285
|
+
ordinal,
|
|
14286
|
+
outcome: result.taskResponse ?? {
|
|
14287
|
+
kind: "unstarted",
|
|
14288
|
+
reason: { kind: "skipped", cause: "parallel-group-detach" }
|
|
14289
|
+
}
|
|
14290
|
+
}))
|
|
14291
|
+
};
|
|
14292
|
+
worktreeCleanupDeferred = detachedCleanup.defer(response.slots.flatMap(({ ordinal, outcome }) => outcome.kind === "admitted" && outcome.observation.kind === "yielded" ? [ordinal] : []));
|
|
14293
|
+
return {
|
|
14294
|
+
content: [{ type: "text", text: subagentTaskResponseText(response) }],
|
|
14295
|
+
details: {
|
|
14296
|
+
mode: "parallel",
|
|
14297
|
+
results: [],
|
|
14298
|
+
taskResponse: response,
|
|
14299
|
+
taskRecords: taskResponseRecords(response, ctx.getAgentTaskHost())
|
|
14300
|
+
}
|
|
14301
|
+
};
|
|
14302
|
+
}
|
|
13957
14303
|
for (let i = 0;i < results.length; i++) {
|
|
13958
14304
|
const run = results[i];
|
|
13959
14305
|
recordRun(run.agent, taskTexts[i], run.status, run.progressSummary?.durationMs ?? 0);
|
|
13960
14306
|
}
|
|
13961
|
-
for (const
|
|
13962
|
-
if (
|
|
13963
|
-
allProgress.push(
|
|
13964
|
-
if (
|
|
13965
|
-
allArtifactPaths.push(
|
|
14307
|
+
for (const result of results) {
|
|
14308
|
+
if (result.progress)
|
|
14309
|
+
allProgress.push(result.progress);
|
|
14310
|
+
if (result.artifactPaths)
|
|
14311
|
+
allArtifactPaths.push(result.artifactPaths);
|
|
13966
14312
|
}
|
|
13967
|
-
const interrupted = results.find((
|
|
14313
|
+
const interrupted = results.find((result) => result.status === "killed" || result.interrupted && !isParentCancellation(result.cause));
|
|
13968
14314
|
const details = compactForegroundDetails({
|
|
13969
14315
|
mode: "parallel",
|
|
13970
14316
|
runId,
|
|
13971
14317
|
results,
|
|
13972
|
-
parentAskYielded:
|
|
14318
|
+
parentAskYielded: false,
|
|
13973
14319
|
progress: params.includeProgress ? allProgress : undefined,
|
|
13974
14320
|
artifacts: allArtifactPaths.length ? { dir: artifactsDir, files: allArtifactPaths } : undefined
|
|
13975
14321
|
});
|
|
13976
|
-
if (
|
|
13977
|
-
const worktreeSuffix2 = buildParallelWorktreeSuffix(worktreeSetup, artifactsDir, tasks);
|
|
13978
|
-
const handoffText = formatParentAskHandoffOutput(parentAsk);
|
|
13979
|
-
const yieldedResult = {
|
|
13980
|
-
content: [{ type: "text", text: worktreeSuffix2 ? `${handoffText}
|
|
13981
|
-
|
|
13982
|
-
${worktreeSuffix2}` : handoffText }],
|
|
13983
|
-
details
|
|
13984
|
-
};
|
|
13985
|
-
markParentAskHandoff(yieldedResult, parentAsk);
|
|
13986
|
-
return yieldedResult;
|
|
13987
|
-
}
|
|
13988
|
-
if (interrupted && !results.some((result2) => isParentCancellation(result2.cause) && (result2.interrupted || result2.status === "interrupted"))) {
|
|
14322
|
+
if (interrupted && !results.some((result) => isParentCancellation(result.cause) && (result.interrupted || result.status === "interrupted"))) {
|
|
13989
14323
|
return {
|
|
13990
14324
|
content: [
|
|
13991
14325
|
{
|
|
13992
14326
|
type: "text",
|
|
13993
|
-
text: `Parallel run ended
|
|
14327
|
+
text: interrupted.status === "killed" ? `Parallel child killed (${interrupted.agent}). This child cannot be resumed. Launch fresh subagents for any follow-up.` : `Parallel run ended before completion (${interrupted.agent}). Launch fresh subagents for any follow-up.`
|
|
13994
14328
|
}
|
|
13995
14329
|
],
|
|
13996
14330
|
details
|
|
13997
14331
|
};
|
|
13998
14332
|
}
|
|
13999
|
-
const detachedIndex = results.findIndex((
|
|
14333
|
+
const detachedIndex = results.findIndex((result) => result.detached);
|
|
14000
14334
|
const detached = detachedIndex >= 0 ? results[detachedIndex] : undefined;
|
|
14001
|
-
worktreeCleanupDeferred = detachedCleanup.defer(results.flatMap((
|
|
14335
|
+
worktreeCleanupDeferred = detachedCleanup.defer(results.flatMap((result, index) => result.detached ? [index] : []));
|
|
14002
14336
|
if (detached) {
|
|
14003
14337
|
return {
|
|
14004
14338
|
content: [
|
|
14005
14339
|
{
|
|
14006
14340
|
type: "text",
|
|
14007
|
-
text: `Parallel
|
|
14341
|
+
text: `Parallel observation yielded for intercom coordination (${detached.agent}). The original children continue; reply to any pending ask without relaunching them.`
|
|
14008
14342
|
}
|
|
14009
14343
|
],
|
|
14010
14344
|
details
|
|
@@ -14024,12 +14358,12 @@ ${worktreeSuffix2}` : handoffText }],
|
|
|
14024
14358
|
};
|
|
14025
14359
|
}
|
|
14026
14360
|
const worktreeSuffix = buildParallelWorktreeSuffix(worktreeSetup, artifactsDir, tasks);
|
|
14027
|
-
const childContent = formatParallelResultContent(results.map((
|
|
14028
|
-
agent:
|
|
14029
|
-
output:
|
|
14030
|
-
status:
|
|
14031
|
-
error:
|
|
14032
|
-
...
|
|
14361
|
+
const childContent = formatParallelResultContent(results.map((result) => ({
|
|
14362
|
+
agent: result.agent,
|
|
14363
|
+
output: result.truncation?.text || getSingleResultOutput(result),
|
|
14364
|
+
status: result.status,
|
|
14365
|
+
error: result.error,
|
|
14366
|
+
...result.cause ? { cause: result.cause } : {}
|
|
14033
14367
|
})), (i, agent) => `=== Task ${i + 1}: ${agent} ===`);
|
|
14034
14368
|
const fullContent = worktreeSuffix ? `${childContent}
|
|
14035
14369
|
|
|
@@ -14132,8 +14466,9 @@ function matchesIntercomDetachRoute(event, expected) {
|
|
|
14132
14466
|
// dist/builtin/subagents/src/runs/foreground/execution-intercom-detach.ts
|
|
14133
14467
|
function registerExecutionIntercomDetach(options, state) {
|
|
14134
14468
|
const reservations = new IntercomDetachReservations;
|
|
14469
|
+
let taskWaitYielded = false;
|
|
14135
14470
|
const unsubscribe = options.intercomEvents?.on?.(INTERCOM_DETACH_REQUEST_EVENT, (payload) => {
|
|
14136
|
-
if (!options.allowIntercomDetach || state.isUnavailable())
|
|
14471
|
+
if (!options.allowIntercomDetach || state.isUnavailable() || taskWaitYielded)
|
|
14137
14472
|
return;
|
|
14138
14473
|
if (!payload || typeof payload !== "object")
|
|
14139
14474
|
return;
|
|
@@ -14150,11 +14485,26 @@ function registerExecutionIntercomDetach(options, state) {
|
|
|
14150
14485
|
}
|
|
14151
14486
|
if (event.phase !== "commit" || state.isDetached() || !reservations.commit(event))
|
|
14152
14487
|
return;
|
|
14153
|
-
options.
|
|
14154
|
-
|
|
14488
|
+
if (options.taskExecution) {
|
|
14489
|
+
taskWaitYielded = true;
|
|
14490
|
+
options.taskExecution.yieldTaskWait("intercom-coordination");
|
|
14491
|
+
options.onIntercomDetachCommit?.();
|
|
14492
|
+
} else {
|
|
14493
|
+
options.onIntercomDetachCommit?.();
|
|
14494
|
+
state.detach();
|
|
14495
|
+
}
|
|
14155
14496
|
options.intercomEvents?.emit?.(INTERCOM_DETACH_RESPONSE_EVENT, { ...event, accepted: true });
|
|
14156
14497
|
});
|
|
14157
|
-
const detachSibling = () =>
|
|
14498
|
+
const detachSibling = () => {
|
|
14499
|
+
if (options.taskExecution) {
|
|
14500
|
+
if (state.isUnavailable() || taskWaitYielded)
|
|
14501
|
+
return;
|
|
14502
|
+
taskWaitYielded = true;
|
|
14503
|
+
options.taskExecution.yieldTaskWait("intercom-coordination");
|
|
14504
|
+
} else {
|
|
14505
|
+
state.detach();
|
|
14506
|
+
}
|
|
14507
|
+
};
|
|
14158
14508
|
options.intercomDetachSignal?.addEventListener("abort", detachSibling, { once: true });
|
|
14159
14509
|
if (options.intercomDetachSignal?.aborted)
|
|
14160
14510
|
detachSibling();
|
|
@@ -14248,7 +14598,7 @@ function workflowOrchestrationContext(options) {
|
|
|
14248
14598
|
};
|
|
14249
14599
|
}
|
|
14250
14600
|
function progressFor(agent, task, outcome, startedAt) {
|
|
14251
|
-
const status = outcome.status === "ok" ? "completed" : outcome.status === "interrupted" && isParentCancellation(outcome.cause) ? "interrupted" : "failed";
|
|
14601
|
+
const status = outcome.status === "ok" ? "completed" : outcome.status === "killed" ? "killed" : outcome.status === "interrupted" && isParentCancellation(outcome.cause) ? "interrupted" : "failed";
|
|
14252
14602
|
return {
|
|
14253
14603
|
index: 0,
|
|
14254
14604
|
agent: agent.name,
|
|
@@ -14270,17 +14620,17 @@ function progressFor(agent, task, outcome, startedAt) {
|
|
|
14270
14620
|
}
|
|
14271
14621
|
function resultFromOutcome(agent, task, outcome, startedAt, artifactPaths) {
|
|
14272
14622
|
const status = outcome.status;
|
|
14273
|
-
const output = outcome.status === "ok" ? outcome.output : outcome.envelope;
|
|
14623
|
+
const output = outcome.status === "killed" ? "Killed. This child cannot be resumed." : outcome.status === "ok" ? outcome.output : outcome.envelope;
|
|
14274
14624
|
const model = outcome.model;
|
|
14275
14625
|
const thinking = outcome.thinking;
|
|
14276
|
-
const
|
|
14626
|
+
const result = {
|
|
14277
14627
|
agent: agent.name,
|
|
14278
14628
|
task,
|
|
14279
14629
|
status,
|
|
14280
14630
|
...outcome.status === "error" ? { cause: outcome.cause, error: outcome.cause } : outcome.status === "interrupted" && isParentCancellation(outcome.cause) ? { cause: outcome.cause } : {},
|
|
14281
14631
|
stats: outcome.stats,
|
|
14282
14632
|
path: outcome.path,
|
|
14283
|
-
envelope: outcome.envelope,
|
|
14633
|
+
envelope: outcome.status === "killed" ? output : outcome.envelope,
|
|
14284
14634
|
interrupted: status === "interrupted" ? true : undefined,
|
|
14285
14635
|
messages: [],
|
|
14286
14636
|
usage: usageFromStats(outcome.stats),
|
|
@@ -14299,7 +14649,7 @@ function resultFromOutcome(agent, task, outcome, startedAt, artifactPaths) {
|
|
|
14299
14649
|
},
|
|
14300
14650
|
...artifactPaths ? { artifactPaths } : {}
|
|
14301
14651
|
};
|
|
14302
|
-
return
|
|
14652
|
+
return result;
|
|
14303
14653
|
}
|
|
14304
14654
|
function refusedResult(agent, task, reason) {
|
|
14305
14655
|
return {
|
|
@@ -14431,9 +14781,9 @@ ${task}`);
|
|
|
14431
14781
|
const startedAt = Date.now();
|
|
14432
14782
|
const neverAbort = new AbortController().signal;
|
|
14433
14783
|
const running = control.startAttempt(admission.admitted, { model: resolvedCandidate?.model, modelId: candidate, thinkingLevel: spec.thinkingLevel }, {
|
|
14434
|
-
abort: options.signal ?? neverAbort,
|
|
14784
|
+
abort: options.taskExecution?.signal ?? options.signal ?? neverAbort,
|
|
14435
14785
|
interrupt: options.interruptSignal ?? neverAbort
|
|
14436
|
-
});
|
|
14786
|
+
}, options.taskExecution);
|
|
14437
14787
|
if (options.onUpdate) {
|
|
14438
14788
|
const launchModel = running.currentModel ?? candidate;
|
|
14439
14789
|
spec.onProgress?.({
|
|
@@ -14453,8 +14803,8 @@ ${task}`);
|
|
|
14453
14803
|
}
|
|
14454
14804
|
let detached = false;
|
|
14455
14805
|
let resolveContinuation;
|
|
14456
|
-
const continuation = new Promise((
|
|
14457
|
-
resolveContinuation =
|
|
14806
|
+
const continuation = new Promise((resolve) => {
|
|
14807
|
+
resolveContinuation = resolve;
|
|
14458
14808
|
});
|
|
14459
14809
|
const detachCleanup = registerExecutionIntercomDetach(options, {
|
|
14460
14810
|
isUnavailable: () => running.status !== "running",
|
|
@@ -14490,10 +14840,10 @@ ${task}`);
|
|
|
14490
14840
|
timestamp: Date.now(),
|
|
14491
14841
|
artifactsDir: options.artifactsDir
|
|
14492
14842
|
}, { artifactsDir: options.artifactsDir, artifactPaths, artifactsDisabled, maxOutput: options.maxOutput });
|
|
14493
|
-
const
|
|
14494
|
-
if (
|
|
14495
|
-
recovered.envelope =
|
|
14496
|
-
recovered.finalOutput =
|
|
14843
|
+
const delivered = control.getDeliveredResult(continuedOutcome.path);
|
|
14844
|
+
if (delivered) {
|
|
14845
|
+
recovered.envelope = delivered.envelope;
|
|
14846
|
+
recovered.finalOutput = delivered.envelope;
|
|
14497
14847
|
}
|
|
14498
14848
|
options.onDetachedExit?.(recovered);
|
|
14499
14849
|
});
|
|
@@ -14535,37 +14885,37 @@ ${task}`);
|
|
|
14535
14885
|
detachCleanup();
|
|
14536
14886
|
parentAskCleanup();
|
|
14537
14887
|
const outcome = winner.value;
|
|
14538
|
-
const
|
|
14888
|
+
const result = resultFromOutcome(agent, task, outcome, startedAt, artifactPaths);
|
|
14539
14889
|
if (filteredCandidates.skippedAttempts.length)
|
|
14540
|
-
|
|
14890
|
+
result.modelAttempts = [...filteredCandidates.skippedAttempts, ...result.modelAttempts ?? []];
|
|
14541
14891
|
await control.deliverChildResult({
|
|
14542
14892
|
path: outcome.path,
|
|
14543
14893
|
status: outcome.status,
|
|
14544
14894
|
...outcome.status === "error" || outcome.status === "interrupted" && outcome.cause ? { cause: outcome.cause } : {},
|
|
14545
14895
|
stats: outcome.stats,
|
|
14546
14896
|
envelope: outcome.envelope,
|
|
14547
|
-
...
|
|
14548
|
-
...
|
|
14897
|
+
...result.model === undefined ? {} : { model: result.model },
|
|
14898
|
+
...result.thinking === undefined ? {} : { thinking: result.thinking },
|
|
14549
14899
|
sessionFile: outcome.sessionFile,
|
|
14550
14900
|
timestamp: Date.now(),
|
|
14551
14901
|
artifactsDir: options.artifactsDir
|
|
14552
14902
|
}, { artifactsDir: options.artifactsDir, artifactPaths, artifactsDisabled, maxOutput: options.maxOutput });
|
|
14553
14903
|
const delivered = control.getDeliveredResult(outcome.path);
|
|
14554
14904
|
if (delivered) {
|
|
14555
|
-
|
|
14556
|
-
|
|
14905
|
+
result.envelope = delivered.envelope;
|
|
14906
|
+
result.finalOutput = delivered.envelope;
|
|
14557
14907
|
}
|
|
14558
14908
|
const update = {
|
|
14559
|
-
content: [{ type: "text", text:
|
|
14909
|
+
content: [{ type: "text", text: result.finalOutput ?? "(no output)" }],
|
|
14560
14910
|
details: {
|
|
14561
14911
|
mode: "single",
|
|
14562
14912
|
runId: options.runId,
|
|
14563
|
-
results: [
|
|
14564
|
-
progress:
|
|
14913
|
+
results: [result],
|
|
14914
|
+
progress: result.progress ? [result.progress] : undefined
|
|
14565
14915
|
}
|
|
14566
14916
|
};
|
|
14567
14917
|
options.onUpdate?.(update);
|
|
14568
|
-
return
|
|
14918
|
+
return result;
|
|
14569
14919
|
}
|
|
14570
14920
|
async function runSync(runtimeCwd, agents, agentName, task, options) {
|
|
14571
14921
|
const agent = agents.find((candidate) => candidate.name === agentName);
|
|
@@ -14593,15 +14943,15 @@ function resolveSubagentExecutorRuntimeDeps(overrides) {
|
|
|
14593
14943
|
// dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts
|
|
14594
14944
|
import * as fs18 from "node:fs";
|
|
14595
14945
|
import * as path20 from "node:path";
|
|
14596
|
-
function formatFailedSingleRunOutput(
|
|
14597
|
-
const error =
|
|
14946
|
+
function formatFailedSingleRunOutput(result, displayOutput) {
|
|
14947
|
+
const error = result.error || "Failed";
|
|
14598
14948
|
const output = displayOutput.trim();
|
|
14599
14949
|
const lines = [error];
|
|
14600
14950
|
if (output && output !== error.trim()) {
|
|
14601
14951
|
lines.push("", "Output:", output);
|
|
14602
14952
|
}
|
|
14603
|
-
if (
|
|
14604
|
-
lines.push("", `Output artifact: ${
|
|
14953
|
+
if (result.artifactPaths?.outputPath) {
|
|
14954
|
+
lines.push("", `Output artifact: ${result.artifactPaths.outputPath}`);
|
|
14605
14955
|
}
|
|
14606
14956
|
return lines.join(`
|
|
14607
14957
|
`);
|
|
@@ -14753,10 +15103,10 @@ async function runSinglePath(data, deps) {
|
|
|
14753
15103
|
parentAsk = request;
|
|
14754
15104
|
interruptController.abort();
|
|
14755
15105
|
},
|
|
14756
|
-
onDetachedExit: (
|
|
15106
|
+
onDetachedExit: (result) => {
|
|
14757
15107
|
cleanupTransientProgress(progressDir, artifactConfig.enabled);
|
|
14758
|
-
if (
|
|
14759
|
-
notifyDetachedForegroundChildExit({ pi: deps.pi, runId, mode: "single", index: 0, result
|
|
15108
|
+
if (result && workflowStageAcceptsDetachedNotification(ctx)) {
|
|
15109
|
+
notifyDetachedForegroundChildExit({ pi: deps.pi, runId, mode: "single", index: 0, result });
|
|
14760
15110
|
}
|
|
14761
15111
|
},
|
|
14762
15112
|
index: 0,
|
|
@@ -14769,7 +15119,34 @@ async function runSinglePath(data, deps) {
|
|
|
14769
15119
|
currentThinkingLevel: ctx.thinkingLevel,
|
|
14770
15120
|
skills: effectiveSkills
|
|
14771
15121
|
};
|
|
14772
|
-
|
|
15122
|
+
if (ctx.getAgentTaskHost) {
|
|
15123
|
+
let settledChild;
|
|
15124
|
+
const response = await runAgentTask({
|
|
15125
|
+
host: ctx.getAgentTaskHost(),
|
|
15126
|
+
cwd: ctx.cwd,
|
|
15127
|
+
agents,
|
|
15128
|
+
agent: params.agent,
|
|
15129
|
+
task,
|
|
15130
|
+
intentTask: handoffTaskContext,
|
|
15131
|
+
options: runOptions,
|
|
15132
|
+
wait: params.wait,
|
|
15133
|
+
runtime: deps.runtime,
|
|
15134
|
+
onTerminal: (child) => {
|
|
15135
|
+
settledChild = child;
|
|
15136
|
+
cleanupTransientProgress(progressDir, artifactConfig.enabled);
|
|
15137
|
+
},
|
|
15138
|
+
outputText: (child) => parentAsk && child.interrupted ? formatParentAskHandoffOutput({
|
|
15139
|
+
askingChildIndex: 0,
|
|
15140
|
+
releasedChildIndices: [0],
|
|
15141
|
+
unlaunchedChildIndices: [],
|
|
15142
|
+
request: parentAsk
|
|
15143
|
+
}) : getSingleResultOutput(child)
|
|
15144
|
+
});
|
|
15145
|
+
if (!parentAsk || !settledChild?.interrupted)
|
|
15146
|
+
return taskToolResult(response, ctx.getAgentTaskHost());
|
|
15147
|
+
r = settledChild;
|
|
15148
|
+
} else
|
|
15149
|
+
r = await deps.runtime.runSync(ctx.cwd, agents, params.agent, task, runOptions);
|
|
14773
15150
|
} catch (error) {
|
|
14774
15151
|
cleanupTransientProgress(progressDir, artifactConfig.enabled);
|
|
14775
15152
|
throw error;
|
|
@@ -14862,12 +15239,23 @@ async function runSinglePath(data, deps) {
|
|
|
14862
15239
|
details
|
|
14863
15240
|
};
|
|
14864
15241
|
}
|
|
15242
|
+
if (r.status === "killed") {
|
|
15243
|
+
return {
|
|
15244
|
+
content: [
|
|
15245
|
+
{
|
|
15246
|
+
type: "text",
|
|
15247
|
+
text: `Killed (${params.agent}). This child cannot be resumed. Launch a fresh subagent for any follow-up.`
|
|
15248
|
+
}
|
|
15249
|
+
],
|
|
15250
|
+
details
|
|
15251
|
+
};
|
|
15252
|
+
}
|
|
14865
15253
|
if (r.interrupted) {
|
|
14866
15254
|
return {
|
|
14867
15255
|
content: [
|
|
14868
15256
|
{
|
|
14869
15257
|
type: "text",
|
|
14870
|
-
text: `Run ended
|
|
15258
|
+
text: `Run ended before completion (${params.agent}). Launch a fresh subagent for any follow-up.`
|
|
14871
15259
|
}
|
|
14872
15260
|
],
|
|
14873
15261
|
details
|
|
@@ -14887,7 +15275,7 @@ async function runSinglePath(data, deps) {
|
|
|
14887
15275
|
|
|
14888
15276
|
// dist/builtin/subagents/src/runs/foreground/subagent-executor.ts
|
|
14889
15277
|
var MUTATING_MANAGEMENT_ACTIONS = new Set(["create", "update", "delete"]);
|
|
14890
|
-
var READ_ONLY_MANAGEMENT_ACTIONS = new Set(["list", "get", "status"]);
|
|
15278
|
+
var READ_ONLY_MANAGEMENT_ACTIONS = new Set(["list", "get", "status", "wait"]);
|
|
14891
15279
|
var FANOUT_REFUSAL_MESSAGE = "Subagent fanout is not authorized for this child.";
|
|
14892
15280
|
async function handleManagementRequest(input) {
|
|
14893
15281
|
const { params, paramsWithResolvedCwd, requestCwd, ctx, deps } = input;
|
|
@@ -14925,6 +15313,64 @@ async function handleManagementRequest(input) {
|
|
|
14925
15313
|
if (childRefusal)
|
|
14926
15314
|
return childRefusal;
|
|
14927
15315
|
}
|
|
15316
|
+
if (action === "wait") {
|
|
15317
|
+
const observed = ctx.getAgentTaskHost && params.id !== undefined ? await ctx.getAgentTaskHost().waitForTask(params.id, params.budgetMs) : { ok: false, error: { code: "UnknownTask", message: "Task not found in this owner" } };
|
|
15318
|
+
return {
|
|
15319
|
+
content: [
|
|
15320
|
+
{
|
|
15321
|
+
type: "text",
|
|
15322
|
+
text: `${observed.ok && observed.value.kind === "settled" && subagentTaskResultLabel(observed.value.result) === "killed (non-resumable)" ? `Killed. This child cannot be resumed. Underlying host observation:
|
|
15323
|
+
` : ""}${JSON.stringify(observed.ok ? observed.value : observed.error)}`
|
|
15324
|
+
}
|
|
15325
|
+
],
|
|
15326
|
+
details: {
|
|
15327
|
+
mode: "management",
|
|
15328
|
+
results: [],
|
|
15329
|
+
...observed.ok ? {
|
|
15330
|
+
taskResponse: { kind: "admitted", observation: observed.value },
|
|
15331
|
+
taskRecords: taskResponseRecords({ kind: "admitted", observation: observed.value }, ctx.getAgentTaskHost?.())
|
|
15332
|
+
} : { taskError: observed.error.message }
|
|
15333
|
+
},
|
|
15334
|
+
...!observed.ok ? { isError: true } : {}
|
|
15335
|
+
};
|
|
15336
|
+
}
|
|
15337
|
+
const targetTaskId = paramsWithResolvedCwd.id ?? paramsWithResolvedCwd.runId;
|
|
15338
|
+
if ((action === "status" || action === "kill") && ctx.getAgentTaskHost && targetTaskId) {
|
|
15339
|
+
const host = ctx.getAgentTaskHost();
|
|
15340
|
+
const taskId = targetTaskId;
|
|
15341
|
+
if (host.resolveTask(taskId).ok) {
|
|
15342
|
+
if (action === "kill") {
|
|
15343
|
+
const cancelled = await host.cancelTask(taskId, "user");
|
|
15344
|
+
if (!cancelled.ok)
|
|
15345
|
+
return {
|
|
15346
|
+
content: [{ type: "text", text: cancelled.error.message }],
|
|
15347
|
+
isError: true,
|
|
15348
|
+
details: { mode: "management", results: [], taskError: cancelled.error.message }
|
|
15349
|
+
};
|
|
15350
|
+
}
|
|
15351
|
+
const watched = host.watchOwnerTasks();
|
|
15352
|
+
if (watched.ok) {
|
|
15353
|
+
const records = watched.value.snapshot.tasks.filter((task) => task.ref.taskId === taskId);
|
|
15354
|
+
watched.value.dispose();
|
|
15355
|
+
return {
|
|
15356
|
+
content: [
|
|
15357
|
+
{
|
|
15358
|
+
type: "text",
|
|
15359
|
+
text: `${records.some((task) => task.execution.kind === "settled" && subagentTaskResultLabel(task.execution.result) === "killed (non-resumable)") ? `Killed. This child cannot be resumed. Underlying host records:
|
|
15360
|
+
` : action === "kill" ? `Kill requested. This child cannot be resumed. Underlying host records:
|
|
15361
|
+
` : ""}${JSON.stringify(records)}`
|
|
15362
|
+
}
|
|
15363
|
+
],
|
|
15364
|
+
details: { mode: "management", results: [], taskRecords: records }
|
|
15365
|
+
};
|
|
15366
|
+
}
|
|
15367
|
+
return {
|
|
15368
|
+
content: [{ type: "text", text: watched.error.message }],
|
|
15369
|
+
isError: true,
|
|
15370
|
+
details: { mode: "management", results: [], taskError: watched.error.message }
|
|
15371
|
+
};
|
|
15372
|
+
}
|
|
15373
|
+
}
|
|
14928
15374
|
if (action === "status") {
|
|
14929
15375
|
const targetRunId = paramsWithResolvedCwd.id ?? paramsWithResolvedCwd.runId;
|
|
14930
15376
|
const inProcess = inspectInProcessChildStatus(targetRunId);
|
|
@@ -14944,10 +15390,10 @@ async function handleManagementRequest(input) {
|
|
|
14944
15390
|
details: { mode: "management", results: [] }
|
|
14945
15391
|
};
|
|
14946
15392
|
}
|
|
14947
|
-
if (action === "
|
|
15393
|
+
if (action === "kill") {
|
|
14948
15394
|
const targetRunId = paramsWithResolvedCwd.runId ?? paramsWithResolvedCwd.id;
|
|
14949
15395
|
if (targetRunId) {
|
|
14950
|
-
const inProcess = await
|
|
15396
|
+
const inProcess = await killInProcessChild(targetRunId);
|
|
14951
15397
|
if (inProcess)
|
|
14952
15398
|
return inProcess;
|
|
14953
15399
|
}
|
|
@@ -14955,7 +15401,7 @@ async function handleManagementRequest(input) {
|
|
|
14955
15401
|
content: [
|
|
14956
15402
|
{
|
|
14957
15403
|
type: "text",
|
|
14958
|
-
text: targetRunId ? `No running in-process child found for '${targetRunId}'.` : "No
|
|
15404
|
+
text: targetRunId ? `No running in-process child found for '${targetRunId}'.` : "No kill-capable child found."
|
|
14959
15405
|
}
|
|
14960
15406
|
],
|
|
14961
15407
|
isError: true,
|
|
@@ -15008,12 +15454,12 @@ function createSubagentExecutor(rawDeps) {
|
|
|
15008
15454
|
const prepared = built.prepared;
|
|
15009
15455
|
try {
|
|
15010
15456
|
if (prepared.hasTasks && prepared.effectiveParams.tasks) {
|
|
15011
|
-
const
|
|
15012
|
-
return withForkContext(
|
|
15457
|
+
const result = await runParallelPath(prepared.execData, deps);
|
|
15458
|
+
return withForkContext(result, prepared.effectiveParams.context);
|
|
15013
15459
|
}
|
|
15014
15460
|
if (prepared.hasSingle) {
|
|
15015
|
-
const
|
|
15016
|
-
return withForkContext(
|
|
15461
|
+
const result = await runSinglePath(prepared.execData, deps);
|
|
15462
|
+
return withForkContext(result, prepared.effectiveParams.context);
|
|
15017
15463
|
}
|
|
15018
15464
|
} catch (error) {
|
|
15019
15465
|
return toExecutionErrorResult(prepared.effectiveParams, error);
|
|
@@ -15215,28 +15661,28 @@ function resolveProgressModel(update, entry) {
|
|
|
15215
15661
|
return byIndex.model;
|
|
15216
15662
|
}
|
|
15217
15663
|
if (entry.agent) {
|
|
15218
|
-
const byAgent = results.find((
|
|
15664
|
+
const byAgent = results.find((result) => result.agent === entry.agent && typeof result.model === "string");
|
|
15219
15665
|
if (byAgent?.model)
|
|
15220
15666
|
return byAgent.model;
|
|
15221
15667
|
}
|
|
15222
|
-
const firstWithModel = results.find((
|
|
15668
|
+
const firstWithModel = results.find((result) => typeof result.model === "string");
|
|
15223
15669
|
return firstWithModel?.model;
|
|
15224
15670
|
}
|
|
15225
15671
|
function toolCallSummaryText(summary) {
|
|
15226
15672
|
const text = typeof summary.expandedText === "string" && summary.expandedText.trim().length > 0 ? summary.expandedText.trim() : typeof summary.text === "string" ? summary.text.trim() : "";
|
|
15227
15673
|
return text || undefined;
|
|
15228
15674
|
}
|
|
15229
|
-
function buildDelegationMessages(
|
|
15230
|
-
if (Array.isArray(
|
|
15231
|
-
return
|
|
15232
|
-
const toolCallSummaries = (
|
|
15233
|
-
const
|
|
15234
|
-
return
|
|
15675
|
+
function buildDelegationMessages(result, fallbackText) {
|
|
15676
|
+
if (Array.isArray(result.messages) && result.messages.length > 0)
|
|
15677
|
+
return result.messages;
|
|
15678
|
+
const toolCallSummaries = (result.toolCalls ?? []).flatMap((summary) => {
|
|
15679
|
+
const text = toolCallSummaryText(summary);
|
|
15680
|
+
return text ? [`- ${text}`] : [];
|
|
15235
15681
|
});
|
|
15236
15682
|
const toolCallText = toolCallSummaries.length > 0 ? `Tool calls:
|
|
15237
15683
|
${toolCallSummaries.join(`
|
|
15238
15684
|
`)}` : undefined;
|
|
15239
|
-
const text = typeof
|
|
15685
|
+
const text = typeof result.finalOutput === "string" && result.finalOutput.trim().length > 0 ? result.finalOutput.trim() : fallbackText;
|
|
15240
15686
|
const contentText = [toolCallText, text].filter((part) => Boolean(part)).join(`
|
|
15241
15687
|
|
|
15242
15688
|
`);
|
|
@@ -15247,15 +15693,15 @@ ${toolCallSummaries.join(`
|
|
|
15247
15693
|
function toDelegationUpdate(requestId, update) {
|
|
15248
15694
|
const progress = update.details?.progress?.[0];
|
|
15249
15695
|
const taskProgress = update.details?.progress?.map((entry) => {
|
|
15250
|
-
const
|
|
15251
|
-
const
|
|
15696
|
+
const lastOutput = entry.recentOutput?.[entry.recentOutput.length - 1];
|
|
15697
|
+
const safeLastOutput = typeof lastOutput === "string" && lastOutput.trim() && lastOutput !== "(running...)" ? lastOutput : undefined;
|
|
15252
15698
|
return {
|
|
15253
15699
|
index: entry.index,
|
|
15254
15700
|
agent: entry.agent ?? "delegate",
|
|
15255
15701
|
status: entry.status,
|
|
15256
15702
|
currentTool: entry.currentTool,
|
|
15257
15703
|
currentToolArgs: entry.currentToolArgs,
|
|
15258
|
-
recentOutput:
|
|
15704
|
+
recentOutput: safeLastOutput,
|
|
15259
15705
|
recentOutputLines: filterRecentOutput(entry.recentOutput),
|
|
15260
15706
|
recentTools: sanitizeRecentTools(entry.recentTools),
|
|
15261
15707
|
model: resolveProgressModel(update, entry),
|
|
@@ -15345,7 +15791,7 @@ function registerPromptTemplateDelegationBridge(options) {
|
|
|
15345
15791
|
return;
|
|
15346
15792
|
}
|
|
15347
15793
|
try {
|
|
15348
|
-
const
|
|
15794
|
+
const result = await options.execute(request.requestId, request, controller.signal, ctx, (update) => {
|
|
15349
15795
|
const payload = toDelegationUpdate(request.requestId, update);
|
|
15350
15796
|
if (!payload)
|
|
15351
15797
|
return;
|
|
@@ -15353,10 +15799,10 @@ function registerPromptTemplateDelegationBridge(options) {
|
|
|
15353
15799
|
controller.abort();
|
|
15354
15800
|
}
|
|
15355
15801
|
});
|
|
15356
|
-
const contentText = firstTextContent(
|
|
15357
|
-
const messages = buildDelegationMessages(
|
|
15802
|
+
const contentText = firstTextContent(result.content);
|
|
15803
|
+
const messages = buildDelegationMessages(result.details?.results?.[0] ?? {}, contentText);
|
|
15358
15804
|
const parallelResults = request.tasks ? request.tasks.map((task, index) => {
|
|
15359
|
-
const step =
|
|
15805
|
+
const step = result.details?.results?.[index];
|
|
15360
15806
|
if (!step) {
|
|
15361
15807
|
return {
|
|
15362
15808
|
agent: task.agent,
|
|
@@ -15378,8 +15824,8 @@ function registerPromptTemplateDelegationBridge(options) {
|
|
|
15378
15824
|
messages,
|
|
15379
15825
|
...parallelResults ? { parallelResults } : {},
|
|
15380
15826
|
...contentText ? { contentText } : {},
|
|
15381
|
-
isError:
|
|
15382
|
-
errorText:
|
|
15827
|
+
isError: result.isError === true,
|
|
15828
|
+
errorText: result.isError ? contentText : undefined
|
|
15383
15829
|
};
|
|
15384
15830
|
emitBridgeEvent(options.events, PROMPT_TEMPLATE_SUBAGENT_RESPONSE_EVENT, response, settlement);
|
|
15385
15831
|
} catch (error) {
|
|
@@ -15487,7 +15933,7 @@ function registerSlashSubagentBridge(options) {
|
|
|
15487
15933
|
return;
|
|
15488
15934
|
}
|
|
15489
15935
|
try {
|
|
15490
|
-
const
|
|
15936
|
+
const result = await options.execute(requestId, params, controller.signal, (update) => {
|
|
15491
15937
|
const progress = update.details?.progress;
|
|
15492
15938
|
const first = progress?.[0];
|
|
15493
15939
|
const payload = {
|
|
@@ -15502,9 +15948,9 @@ function registerSlashSubagentBridge(options) {
|
|
|
15502
15948
|
}, ctx);
|
|
15503
15949
|
const response = {
|
|
15504
15950
|
requestId,
|
|
15505
|
-
result
|
|
15506
|
-
isError:
|
|
15507
|
-
errorText:
|
|
15951
|
+
result,
|
|
15952
|
+
isError: result.isError === true,
|
|
15953
|
+
errorText: result.isError ? result.content.find((c) => c.type === "text")?.text : undefined
|
|
15508
15954
|
};
|
|
15509
15955
|
emitBridgeEvent(options.events, SLASH_SUBAGENT_RESPONSE_EVENT, response, settlement);
|
|
15510
15956
|
} catch (error) {
|
|
@@ -15542,8 +15988,166 @@ function registerSlashSubagentBridge(options) {
|
|
|
15542
15988
|
};
|
|
15543
15989
|
}
|
|
15544
15990
|
|
|
15991
|
+
// dist/builtin/subagents/src/tui/agent-browser.ts
|
|
15992
|
+
import {
|
|
15993
|
+
Input,
|
|
15994
|
+
matchesKey,
|
|
15995
|
+
truncateToWidth,
|
|
15996
|
+
visibleWidth,
|
|
15997
|
+
wrapTextWithAnsi
|
|
15998
|
+
} from "@earendil-works/pi-tui";
|
|
15999
|
+
var sources = ["project", "user", "builtin"];
|
|
16000
|
+
var sourceLabels = { project: "Project agents", user: "User agents", builtin: "Built-in agents" };
|
|
16001
|
+
var clean = (text) => text.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").replace(/[\x00-\x1f\x7f-\x9f]/g, " ");
|
|
16002
|
+
|
|
16003
|
+
class AgentBrowser {
|
|
16004
|
+
theme;
|
|
16005
|
+
close;
|
|
16006
|
+
height;
|
|
16007
|
+
search = new Input({ prompt: "Search: ", placeholder: "name, role, or source" });
|
|
16008
|
+
index = 0;
|
|
16009
|
+
detail = false;
|
|
16010
|
+
scroll = 0;
|
|
16011
|
+
agents;
|
|
16012
|
+
get focused() {
|
|
16013
|
+
return this.search.focused;
|
|
16014
|
+
}
|
|
16015
|
+
set focused(value) {
|
|
16016
|
+
this.search.focused = value;
|
|
16017
|
+
}
|
|
16018
|
+
constructor(agents, theme, close, height, query = "") {
|
|
16019
|
+
this.theme = theme;
|
|
16020
|
+
this.close = close;
|
|
16021
|
+
this.height = height;
|
|
16022
|
+
this.agents = sources.flatMap((source) => agents.filter((agent) => agent.source === source).sort((a, b) => a.name.localeCompare(b.name)));
|
|
16023
|
+
this.search.setValue(query);
|
|
16024
|
+
this.search.handleInput("\x05");
|
|
16025
|
+
}
|
|
16026
|
+
invalidate() {}
|
|
16027
|
+
matches() {
|
|
16028
|
+
const query = this.search.getValue().toLowerCase().trim();
|
|
16029
|
+
return this.agents.filter((agent) => `${agent.name} ${agent.description} ${agent.source}`.toLowerCase().includes(query));
|
|
16030
|
+
}
|
|
16031
|
+
handleInput(data) {
|
|
16032
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
16033
|
+
if (this.detail) {
|
|
16034
|
+
this.detail = false;
|
|
16035
|
+
this.scroll = 0;
|
|
16036
|
+
} else
|
|
16037
|
+
this.close();
|
|
16038
|
+
return true;
|
|
16039
|
+
}
|
|
16040
|
+
if (this.detail) {
|
|
16041
|
+
if (matchesKey(data, "up"))
|
|
16042
|
+
this.scroll = Math.max(0, this.scroll - 1);
|
|
16043
|
+
else if (matchesKey(data, "down"))
|
|
16044
|
+
this.scroll++;
|
|
16045
|
+
else if (matchesKey(data, "pageDown"))
|
|
16046
|
+
this.scroll += 10;
|
|
16047
|
+
else if (matchesKey(data, "pageUp"))
|
|
16048
|
+
this.scroll = Math.max(0, this.scroll - 10);
|
|
16049
|
+
else if (matchesKey(data, "enter")) {
|
|
16050
|
+
this.detail = false;
|
|
16051
|
+
this.scroll = 0;
|
|
16052
|
+
}
|
|
16053
|
+
return true;
|
|
16054
|
+
}
|
|
16055
|
+
const agents = this.matches();
|
|
16056
|
+
if (matchesKey(data, "up"))
|
|
16057
|
+
this.index = Math.max(0, this.index - 1);
|
|
16058
|
+
else if (matchesKey(data, "down"))
|
|
16059
|
+
this.index = Math.min(Math.max(0, agents.length - 1), this.index + 1);
|
|
16060
|
+
else if (matchesKey(data, "enter"))
|
|
16061
|
+
this.detail = agents.length > 0;
|
|
16062
|
+
else {
|
|
16063
|
+
this.search.handleInput(data);
|
|
16064
|
+
this.index = 0;
|
|
16065
|
+
}
|
|
16066
|
+
return true;
|
|
16067
|
+
}
|
|
16068
|
+
render(width) {
|
|
16069
|
+
const theme = this.theme;
|
|
16070
|
+
const budget = Math.max(4, this.height() - 6);
|
|
16071
|
+
const framed = width >= 24 && budget >= 7;
|
|
16072
|
+
const inner = Math.max(1, width - (framed ? 4 : 0));
|
|
16073
|
+
const agents = this.matches();
|
|
16074
|
+
const agent = agents[this.index];
|
|
16075
|
+
const title = this.detail && agent ? agent.name : "Agents";
|
|
16076
|
+
const heading = theme.bold(truncateToWidth(clean(title), Math.max(1, width - 6)));
|
|
16077
|
+
const top = theme.fg("borderMuted", "╭─ ") + heading + theme.fg("borderMuted", ` ${"─".repeat(Math.max(0, width - visibleWidth(heading) - 5))}╮`);
|
|
16078
|
+
const body = [];
|
|
16079
|
+
let selectedRow = 0;
|
|
16080
|
+
if (this.detail && agent) {
|
|
16081
|
+
const section = (label, value) => {
|
|
16082
|
+
body.push("", theme.fg("muted", theme.bold(label)), ...wrapTextWithAnsi(clean(value), inner));
|
|
16083
|
+
};
|
|
16084
|
+
body.push(theme.fg("dim", `${sourceLabels[agent.source]} · ${agent.defaultContext ?? "fresh"} context`));
|
|
16085
|
+
section("Description", agent.description || "No description provided.");
|
|
16086
|
+
section("Model", agent.model ?? "Inherits the current model");
|
|
16087
|
+
if (agent.fallbackModels?.length)
|
|
16088
|
+
section("Fallbacks", agent.fallbackModels.join(" → "));
|
|
16089
|
+
section("Tools", agent.tools ? agent.tools.join(", ") || "None" : "Inherited tools");
|
|
16090
|
+
if (agent.skills?.length)
|
|
16091
|
+
section("Skills", agent.skills.join(", "));
|
|
16092
|
+
section("Definition", agent.filePath);
|
|
16093
|
+
section("System prompt", agent.systemPrompt || "No additional system prompt.");
|
|
16094
|
+
} else {
|
|
16095
|
+
if (!agents.length)
|
|
16096
|
+
body.push(theme.fg("muted", "No matching agents."), theme.fg("dim", "Try a name, role, or source."));
|
|
16097
|
+
for (const source of sources) {
|
|
16098
|
+
const group = agents.filter((agent) => agent.source === source);
|
|
16099
|
+
if (!group.length)
|
|
16100
|
+
continue;
|
|
16101
|
+
body.push(theme.fg("muted", theme.bold(`${sourceLabels[source]} (${group.length})`)));
|
|
16102
|
+
for (const item of group) {
|
|
16103
|
+
const selected = item === agent;
|
|
16104
|
+
if (selected)
|
|
16105
|
+
selectedRow = body.length;
|
|
16106
|
+
const name = `${selected ? "›" : " "} ${clean(item.name)}`;
|
|
16107
|
+
body.push(selected ? theme.fg("accent", theme.bold(name)) : name);
|
|
16108
|
+
if (selected)
|
|
16109
|
+
body.push(theme.fg("muted", ` ${clean(item.description)}`));
|
|
16110
|
+
}
|
|
16111
|
+
body.push("");
|
|
16112
|
+
}
|
|
16113
|
+
}
|
|
16114
|
+
const pinned = this.detail ? [] : this.search.render(inner);
|
|
16115
|
+
const room = Math.max(1, budget - (framed ? 3 : 2) - pinned.length);
|
|
16116
|
+
this.scroll = Math.min(this.scroll, Math.max(0, body.length - room));
|
|
16117
|
+
const offset = this.detail ? this.scroll : Math.max(0, selectedRow - room + Math.min(2, room));
|
|
16118
|
+
const rows = [...pinned, ...body.slice(offset, offset + room)].map((line) => {
|
|
16119
|
+
const text = truncateToWidth(line, inner);
|
|
16120
|
+
if (!framed)
|
|
16121
|
+
return text;
|
|
16122
|
+
return theme.fg("borderMuted", "│ ") + text + " ".repeat(Math.max(0, inner - visibleWidth(text))) + theme.fg("borderMuted", " │");
|
|
16123
|
+
});
|
|
16124
|
+
const hint = this.detail ? "↑↓ scroll · Enter / Esc back" : "Type to filter · ↑↓ select · Enter details · Esc close";
|
|
16125
|
+
return [
|
|
16126
|
+
framed ? top : heading,
|
|
16127
|
+
...rows,
|
|
16128
|
+
...framed ? [theme.fg("borderMuted", `╰${"─".repeat(Math.max(0, width - 2))}╯`)] : [],
|
|
16129
|
+
theme.fg("dim", hint)
|
|
16130
|
+
].map((line) => truncateToWidth(line, width));
|
|
16131
|
+
}
|
|
16132
|
+
}
|
|
16133
|
+
|
|
15545
16134
|
// dist/builtin/subagents/src/slash/slash-commands.ts
|
|
15546
|
-
function registerSlashCommands(
|
|
16135
|
+
function registerSlashCommands(pi, _state) {
|
|
16136
|
+
pi.registerCommand("agents", {
|
|
16137
|
+
description: "Browse available subagents and inspect their configuration",
|
|
16138
|
+
handler: async (args, ctx) => {
|
|
16139
|
+
if (!ctx.hasUI) {
|
|
16140
|
+
ctx.ui.notify("Use subagent action=list to list agents outside interactive mode.", "info");
|
|
16141
|
+
return;
|
|
16142
|
+
}
|
|
16143
|
+
const { agents } = discoverAgents(ctx.cwd, "both");
|
|
16144
|
+
await ctx.ui.custom((tui, theme, _keys, done) => {
|
|
16145
|
+
const browser = new AgentBrowser(agents, theme, () => done(), () => tui.terminal.rows, args.trim());
|
|
16146
|
+
return browser;
|
|
16147
|
+
}, { purpose: "navigation" });
|
|
16148
|
+
}
|
|
16149
|
+
});
|
|
16150
|
+
}
|
|
15547
16151
|
|
|
15548
16152
|
// dist/builtin/subagents/src/slash/slash-live-state.ts
|
|
15549
16153
|
var defaultStoreOwner = {};
|
|
@@ -15607,16 +16211,16 @@ function clearSlashSnapshots(owner) {
|
|
|
15607
16211
|
}
|
|
15608
16212
|
|
|
15609
16213
|
// dist/builtin/subagents/src/tui/render-layout.ts
|
|
15610
|
-
import { visibleWidth } from "@earendil-works/pi-tui";
|
|
16214
|
+
import { visibleWidth as visibleWidth2 } from "@earendil-works/pi-tui";
|
|
15611
16215
|
function getTermWidth() {
|
|
15612
16216
|
return process.stdout.columns || 120;
|
|
15613
16217
|
}
|
|
15614
16218
|
var segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
15615
16219
|
function truncLine(text, maxWidth) {
|
|
15616
|
-
if (
|
|
16220
|
+
if (visibleWidth2(text) <= maxWidth)
|
|
15617
16221
|
return text;
|
|
15618
16222
|
const targetWidth = maxWidth - 1;
|
|
15619
|
-
let
|
|
16223
|
+
let result = "";
|
|
15620
16224
|
let currentWidth = 0;
|
|
15621
16225
|
let activeStyles = [];
|
|
15622
16226
|
let i = 0;
|
|
@@ -15624,7 +16228,7 @@ function truncLine(text, maxWidth) {
|
|
|
15624
16228
|
const ansiMatch = text.slice(i).match(/^\x1b\[[0-9;]*m/);
|
|
15625
16229
|
if (ansiMatch) {
|
|
15626
16230
|
const code = ansiMatch[0];
|
|
15627
|
-
|
|
16231
|
+
result += code;
|
|
15628
16232
|
if (code === "\x1B[0m" || code === "\x1B[m") {
|
|
15629
16233
|
activeStyles = [];
|
|
15630
16234
|
} else {
|
|
@@ -15640,16 +16244,16 @@ function truncLine(text, maxWidth) {
|
|
|
15640
16244
|
const textPortion = text.slice(i, end);
|
|
15641
16245
|
for (const seg of segmenter.segment(textPortion)) {
|
|
15642
16246
|
const grapheme = seg.segment;
|
|
15643
|
-
const graphemeWidth =
|
|
16247
|
+
const graphemeWidth = visibleWidth2(grapheme);
|
|
15644
16248
|
if (currentWidth + graphemeWidth > targetWidth) {
|
|
15645
|
-
return `${
|
|
16249
|
+
return `${result + activeStyles.join("")}…`;
|
|
15646
16250
|
}
|
|
15647
|
-
|
|
16251
|
+
result += grapheme;
|
|
15648
16252
|
currentWidth += graphemeWidth;
|
|
15649
16253
|
}
|
|
15650
16254
|
i = end;
|
|
15651
16255
|
}
|
|
15652
|
-
return `${
|
|
16256
|
+
return `${result + activeStyles.join("")}…`;
|
|
15653
16257
|
}
|
|
15654
16258
|
var PULSE_FRAMES = ["·", "•", "●", "•"];
|
|
15655
16259
|
function pulseGlyph(frame) {
|
|
@@ -15657,8 +16261,8 @@ function pulseGlyph(frame) {
|
|
|
15657
16261
|
return PULSE_FRAMES[index % PULSE_FRAMES.length];
|
|
15658
16262
|
}
|
|
15659
16263
|
// dist/builtin/subagents/src/tui/render-result.ts
|
|
15660
|
-
import { getMarkdownTheme, keyHintIfBound as
|
|
15661
|
-
import { Container as Container2, Markdown, Spacer, Text as
|
|
16264
|
+
import { getMarkdownTheme, keyHintIfBound as keyHintIfBound3 } from "@bastani/atomic";
|
|
16265
|
+
import { Container as Container2, Markdown, Spacer, Text as Text3 } from "@earendil-works/pi-tui";
|
|
15662
16266
|
|
|
15663
16267
|
// dist/builtin/subagents/src/tui/render-event-formatting.ts
|
|
15664
16268
|
function modelThinkingBadge(theme, model, thinking) {
|
|
@@ -15694,13 +16298,13 @@ function formatAgentRunningLabel(count) {
|
|
|
15694
16298
|
}
|
|
15695
16299
|
|
|
15696
16300
|
// dist/builtin/subagents/src/tui/render-progress.ts
|
|
15697
|
-
function isDoneResult(
|
|
15698
|
-
const status =
|
|
16301
|
+
function isDoneResult(result) {
|
|
16302
|
+
const status = result.progress?.status;
|
|
15699
16303
|
if (status === "completed")
|
|
15700
16304
|
return true;
|
|
15701
16305
|
if (status === "running" || status === "pending")
|
|
15702
16306
|
return false;
|
|
15703
|
-
if (
|
|
16307
|
+
if (result.interrupted || result.detached || result.status !== "ok")
|
|
15704
16308
|
return false;
|
|
15705
16309
|
return true;
|
|
15706
16310
|
}
|
|
@@ -15714,20 +16318,20 @@ function buildMultiProgressLabel(details, hasRunning) {
|
|
|
15714
16318
|
statuses[progress.index] = progress.status;
|
|
15715
16319
|
}
|
|
15716
16320
|
for (let i = 0;i < details.results.length; i++) {
|
|
15717
|
-
const
|
|
15718
|
-
const progressFromArray = details.progress?.find((progress) => progress.index === i) || details.progress?.find((progress) => progress.agent ===
|
|
15719
|
-
const index =
|
|
16321
|
+
const result = details.results[i];
|
|
16322
|
+
const progressFromArray = details.progress?.find((progress) => progress.index === i) || details.progress?.find((progress) => progress.agent === result.agent && progress.status === "running");
|
|
16323
|
+
const index = result.progress?.index ?? progressFromArray?.index ?? i;
|
|
15720
16324
|
if (index < 0 || index >= totalCount)
|
|
15721
16325
|
continue;
|
|
15722
|
-
const status =
|
|
16326
|
+
const status = result.progress?.status ?? (result.status === "killed" ? "killed" : result.interrupted || result.status === "interrupted" ? "interrupted" : result.detached || result.status === "continued" ? "detached" : result.status === "ok" ? "completed" : "failed");
|
|
15723
16327
|
statuses[index] = status;
|
|
15724
16328
|
}
|
|
15725
16329
|
const running = statuses.filter((status) => status === "running").length;
|
|
15726
|
-
const
|
|
15727
|
-
const cancelled = details.results.filter((
|
|
15728
|
-
const
|
|
16330
|
+
const done = statuses.filter((status) => status === "completed").length;
|
|
16331
|
+
const cancelled = details.results.filter((result) => isParentCancellation(result.cause) && (result.interrupted || result.status === "interrupted")).length;
|
|
16332
|
+
const headerLabel = hasRunning ? `${formatAgentRunningLabel(running)} · ${done}/${totalCount} done` : cancelled > 0 ? `${done}/${totalCount} done · ${cancelled} cancelled` : `${done}/${totalCount} done`;
|
|
15729
16333
|
return {
|
|
15730
|
-
headerLabel
|
|
16334
|
+
headerLabel,
|
|
15731
16335
|
itemTitle,
|
|
15732
16336
|
totalCount,
|
|
15733
16337
|
groupStartIndex: 0,
|
|
@@ -15788,11 +16392,11 @@ function hasEmptyTextOutputWithoutOutputTarget(task, output) {
|
|
|
15788
16392
|
return false;
|
|
15789
16393
|
return !extractOutputTarget(task);
|
|
15790
16394
|
}
|
|
15791
|
-
function getToolCallLines(
|
|
15792
|
-
if (
|
|
15793
|
-
return getDisplayItems(
|
|
16395
|
+
function getToolCallLines(result, expanded) {
|
|
16396
|
+
if (result.messages) {
|
|
16397
|
+
return getDisplayItems(result.messages).filter((item) => item.type === "tool").map((item) => formatToolCall(item.name, item.args, expanded));
|
|
15794
16398
|
}
|
|
15795
|
-
return
|
|
16399
|
+
return result.toolCalls?.map((toolCall) => expanded ? toolCall.expandedText : toolCall.text) ?? [];
|
|
15796
16400
|
}
|
|
15797
16401
|
function snapshotNowForProgress(progress, now) {
|
|
15798
16402
|
if (now !== undefined)
|
|
@@ -15857,33 +16461,35 @@ function firstOutputLine(text) {
|
|
|
15857
16461
|
return text.split(`
|
|
15858
16462
|
`).find((line) => line.trim())?.trim() ?? "";
|
|
15859
16463
|
}
|
|
15860
|
-
function resultStatusLine(
|
|
15861
|
-
if (
|
|
15862
|
-
return
|
|
15863
|
-
if (
|
|
16464
|
+
function resultStatusLine(result, output) {
|
|
16465
|
+
if (result.detached)
|
|
16466
|
+
return result.detachedReason ? `Detached: ${result.detachedReason}` : "Detached";
|
|
16467
|
+
if (result.status === "continued")
|
|
15864
16468
|
return "Continued";
|
|
15865
|
-
if (
|
|
16469
|
+
if (result.status === "killed")
|
|
16470
|
+
return "Killed (non-resumable)";
|
|
16471
|
+
if (isParentCancellation(result.cause) && (result.interrupted || result.status === "interrupted"))
|
|
15866
16472
|
return "Cancelled";
|
|
15867
|
-
if (
|
|
16473
|
+
if (result.interrupted || result.status === "interrupted")
|
|
15868
16474
|
return "Interrupted";
|
|
15869
|
-
if (
|
|
15870
|
-
return
|
|
15871
|
-
if (
|
|
15872
|
-
return `Error: ${
|
|
15873
|
-
if (hasEmptyTextOutputWithoutOutputTarget(
|
|
16475
|
+
if (result.status === "skipped")
|
|
16476
|
+
return result.error ? `Skipped: ${result.error}` : "Skipped";
|
|
16477
|
+
if (result.status === "error")
|
|
16478
|
+
return `Error: ${result.error ?? (firstOutputLine(output) || "failed")}`;
|
|
16479
|
+
if (hasEmptyTextOutputWithoutOutputTarget(result.task, output))
|
|
15874
16480
|
return "Done (no text output)";
|
|
15875
16481
|
return "Done";
|
|
15876
16482
|
}
|
|
15877
|
-
function resultGlyph(
|
|
16483
|
+
function resultGlyph(result, output, theme, running = result.progress?.status === "running", pulseFrame) {
|
|
15878
16484
|
if (running)
|
|
15879
16485
|
return theme.fg("accent", pulseGlyph(pulseFrame));
|
|
15880
|
-
if (
|
|
16486
|
+
if (result.detached || result.status === "continued")
|
|
15881
16487
|
return theme.fg("warning", "■");
|
|
15882
|
-
if (
|
|
16488
|
+
if (result.status === "killed" || result.interrupted || result.status === "interrupted" || result.status === "skipped")
|
|
15883
16489
|
return theme.fg("warning", "■");
|
|
15884
|
-
if (
|
|
16490
|
+
if (result.status === "error")
|
|
15885
16491
|
return theme.fg("error", "✗");
|
|
15886
|
-
if (hasEmptyTextOutputWithoutOutputTarget(
|
|
16492
|
+
if (hasEmptyTextOutputWithoutOutputTarget(result.task, output))
|
|
15887
16493
|
return theme.fg("warning", "✓");
|
|
15888
16494
|
return theme.fg("success", "✓");
|
|
15889
16495
|
}
|
|
@@ -15936,6 +16542,7 @@ function renderSingleCompact(d, r, theme, now, pulseFrame) {
|
|
|
15936
16542
|
function renderMultiCompact(d, theme, now, pulseFrame) {
|
|
15937
16543
|
const hasRunning = d.progress?.some((p) => p.status === "running") || d.results.some((r) => r.progress?.status === "running");
|
|
15938
16544
|
const failed = d.results.some((r) => r.status === "error" && r.progress?.status !== "running");
|
|
16545
|
+
const hasKilled = d.results.some((r) => r.status === "killed" && r.progress?.status !== "running");
|
|
15939
16546
|
const interruptedOrDetached = d.results.some((r) => (r.interrupted || r.detached || r.status === "interrupted" || r.status === "continued" || r.status === "skipped") && r.progress?.status !== "running");
|
|
15940
16547
|
let totalSummary = d.progressSummary;
|
|
15941
16548
|
if (!totalSummary) {
|
|
@@ -15955,8 +16562,12 @@ function renderMultiCompact(d, theme, now, pulseFrame) {
|
|
|
15955
16562
|
}
|
|
15956
16563
|
const multiLabel = buildMultiProgressLabel(d, hasRunning);
|
|
15957
16564
|
const itemTitle = multiLabel.itemTitle;
|
|
15958
|
-
const stats = statJoin(theme, [
|
|
15959
|
-
|
|
16565
|
+
const stats = statJoin(theme, [
|
|
16566
|
+
multiLabel.headerLabel,
|
|
16567
|
+
!hasRunning && hasKilled ? theme.fg("warning", "killed (non-resumable)") : "",
|
|
16568
|
+
formatProgressStats(theme, totalSummary, true, now)
|
|
16569
|
+
]);
|
|
16570
|
+
const glyph = hasRunning ? theme.fg("accent", pulseGlyph(pulseFrame)) : failed ? theme.fg("error", "✗") : hasKilled || interruptedOrDetached ? theme.fg("warning", "■") : theme.fg("success", "✓");
|
|
15960
16571
|
const contextBadge = d.context === "fork" ? theme.fg("warning", " [fork]") : "";
|
|
15961
16572
|
const c = new Container;
|
|
15962
16573
|
const width = getTermWidth() - 4;
|
|
@@ -16011,10 +16622,10 @@ function renderMultiCompact(d, theme, now, pulseFrame) {
|
|
|
16011
16622
|
const stepNumber = r.progress?.index !== undefined ? r.progress.index + 1 : progressFromArray?.index !== undefined ? progressFromArray.index + 1 : i + 1;
|
|
16012
16623
|
const stepStats = formatProgressStats(theme, rProg, true, now);
|
|
16013
16624
|
const modelDisplay = modelThinkingBadge(theme, r.model ?? rProg?.model, r.thinking ?? rProg?.thinking);
|
|
16014
|
-
const
|
|
16625
|
+
const glyph = rPending ? theme.fg("dim", "◦") : resultGlyph(r, output, theme, rRunning, pulseFrame);
|
|
16015
16626
|
const pendingLabel = rPending ? ` ${theme.fg("dim", "· pending")}` : "";
|
|
16016
16627
|
const stepLabel = resultRowLabel(d, multiLabel, i, stepNumber);
|
|
16017
|
-
const line = `${
|
|
16628
|
+
const line = `${glyph} ${stepLabel}: ${themeBold(theme, agentName)}${modelDisplay}${stepStats ? ` ${theme.fg("dim", "·")} ${stepStats}` : ""}${pendingLabel}`;
|
|
16018
16629
|
c.addChild(new Text(truncLine(` ${line}`, width), 0, 0));
|
|
16019
16630
|
if (rRunning && rProg && "status" in rProg) {
|
|
16020
16631
|
const activity = compactCurrentActivity(rProg, now);
|
|
@@ -16061,10 +16672,10 @@ function progressRenderKey(progress) {
|
|
|
16061
16672
|
progress.currentPath ?? ""
|
|
16062
16673
|
].join(":");
|
|
16063
16674
|
}
|
|
16064
|
-
function subagentResultRenderKey(
|
|
16065
|
-
const details =
|
|
16675
|
+
function subagentResultRenderKey(result, options) {
|
|
16676
|
+
const details = result.details;
|
|
16066
16677
|
if (!details)
|
|
16067
|
-
return `${options.isPartial ? "partial" : "final"}:${
|
|
16678
|
+
return `${options.isPartial ? "partial" : "final"}:${result.content.length}`;
|
|
16068
16679
|
const progressKeys = [
|
|
16069
16680
|
...(details.progress ?? []).map(progressRenderKey),
|
|
16070
16681
|
...details.results.map((entry) => [
|
|
@@ -16088,22 +16699,90 @@ function subagentResultRenderKey(result2, options) {
|
|
|
16088
16699
|
].join("|");
|
|
16089
16700
|
}
|
|
16090
16701
|
|
|
16702
|
+
// dist/builtin/subagents/src/tui/render-status.ts
|
|
16703
|
+
import { keyHintIfBound as keyHintIfBound2 } from "@bastani/atomic";
|
|
16704
|
+
import { stripTerminalSequences, Text as Text2, truncateToWidth as truncateToWidth2, visibleWidth as visibleWidth3 } from "@earendil-works/pi-tui";
|
|
16705
|
+
var COMPACT_CHILD_LIMIT = 6;
|
|
16706
|
+
var statusStyles = {
|
|
16707
|
+
pending: { glyph: "○", label: "Pending", color: "dim" },
|
|
16708
|
+
running: { glyph: "∀", label: "Running", color: "accent" },
|
|
16709
|
+
ok: { glyph: "✓", label: "Completed", color: "success" },
|
|
16710
|
+
error: { glyph: "✗", label: "Failed", color: "error" },
|
|
16711
|
+
interrupted: { glyph: "■", label: "Interrupted", color: "warning" },
|
|
16712
|
+
killed: { glyph: "■", label: "Killed (non-resumable)", color: "warning" },
|
|
16713
|
+
continued: { glyph: "■", label: "Continued", color: "warning" }
|
|
16714
|
+
};
|
|
16715
|
+
var displayText = (value) => stripTerminalSequences(value).replace(/[\x00-\x1f\x7f-\x9f]/g, " ");
|
|
16716
|
+
function childStatusLines(child, expanded, theme, width) {
|
|
16717
|
+
const style = statusStyles[child.status];
|
|
16718
|
+
const name = displayText(child.path.split("/").at(-1) || child.taskName);
|
|
16719
|
+
const label = expanded ? name : displayText(truncateToWidth2(name, Math.max(1, width - visibleWidth3(style.label) - 5), "…"));
|
|
16720
|
+
const heading = `${theme.fg(style.color, style.glyph)} ${theme.fg("toolTitle", theme.bold(label))}${theme.fg("dim", " · ")}${theme.fg(style.color, style.label)}`;
|
|
16721
|
+
const model = formatModelThinking(child.model, child.thinking);
|
|
16722
|
+
const metadata = model ? [theme.fg("dim", ` ${displayText(model)}`)] : [];
|
|
16723
|
+
if (!expanded)
|
|
16724
|
+
return [heading, ...metadata];
|
|
16725
|
+
return [
|
|
16726
|
+
heading,
|
|
16727
|
+
...metadata,
|
|
16728
|
+
theme.fg("dim", ` Path: ${displayText(child.path)}`),
|
|
16729
|
+
theme.fg("dim", ` Parent: ${displayText(child.parentPath)} · Depth: ${child.depth}`),
|
|
16730
|
+
theme.fg("dim", ` Task: ${displayText(child.taskName)}`),
|
|
16731
|
+
theme.fg("dim", ` Residency: ${child.loaded ? "loaded" : "cold"}`),
|
|
16732
|
+
...child.cause ? [theme.fg("muted", ` Cause: ${displayText(child.cause)}`)] : [],
|
|
16733
|
+
...child.sessionFile ? [theme.fg("dim", ` Session: ${displayText(child.sessionFile)}`)] : []
|
|
16734
|
+
];
|
|
16735
|
+
}
|
|
16736
|
+
function statusLines(groups, expanded, theme, width) {
|
|
16737
|
+
const total = groups.reduce((sum, group) => sum + group.children.length, 0);
|
|
16738
|
+
const lines = total > 1 ? [theme.fg("muted", `${total} agents`)] : [];
|
|
16739
|
+
let shown = 0;
|
|
16740
|
+
for (const group of groups) {
|
|
16741
|
+
const children = expanded ? group.children : group.children.slice(0, COMPACT_CHILD_LIMIT - shown);
|
|
16742
|
+
if (!children.length && !expanded)
|
|
16743
|
+
continue;
|
|
16744
|
+
if (groups.length > 1 || !children.length)
|
|
16745
|
+
lines.push(theme.fg("dim", `Run ${displayText(group.parentPath)}`));
|
|
16746
|
+
lines.push(...children.length ? children.flatMap((child) => childStatusLines(child, expanded, theme, width)) : [theme.fg("muted", " No subagents")]);
|
|
16747
|
+
shown += children.length;
|
|
16748
|
+
}
|
|
16749
|
+
if (!lines.length)
|
|
16750
|
+
lines.push(theme.fg("muted", "No subagents"));
|
|
16751
|
+
if (shown < total)
|
|
16752
|
+
lines.push(theme.fg("muted", `… ${total - shown} more agents`));
|
|
16753
|
+
const hint = !expanded && keyHintIfBound2("app.tools.expand", "to expand");
|
|
16754
|
+
if (hint)
|
|
16755
|
+
lines.push(theme.fg("dim", hint));
|
|
16756
|
+
return lines;
|
|
16757
|
+
}
|
|
16758
|
+
function renderSubagentStatus(groups, expanded, theme) {
|
|
16759
|
+
return {
|
|
16760
|
+
invalidate() {},
|
|
16761
|
+
render(width) {
|
|
16762
|
+
if (width <= 0)
|
|
16763
|
+
return [];
|
|
16764
|
+
return new Text2(statusLines(groups, expanded, theme, width).join(`
|
|
16765
|
+
`), 0, 0).render(width);
|
|
16766
|
+
}
|
|
16767
|
+
};
|
|
16768
|
+
}
|
|
16769
|
+
|
|
16091
16770
|
// dist/builtin/subagents/src/tui/render-result.ts
|
|
16092
|
-
function parentAskOutput(
|
|
16093
|
-
if (!
|
|
16771
|
+
function parentAskOutput(result) {
|
|
16772
|
+
if (!result.details?.parentAskYielded)
|
|
16094
16773
|
return;
|
|
16095
|
-
return
|
|
16774
|
+
return result.content.find((part) => part.type === "text")?.text;
|
|
16096
16775
|
}
|
|
16097
16776
|
function appendParentAskOutput(component, output, theme) {
|
|
16098
16777
|
if (!output)
|
|
16099
16778
|
return component;
|
|
16100
16779
|
const container = new Container2;
|
|
16101
16780
|
container.addChild(component);
|
|
16102
|
-
container.addChild(new
|
|
16781
|
+
container.addChild(new Text3(theme.fg("accent", output), 0, 0));
|
|
16103
16782
|
return container;
|
|
16104
16783
|
}
|
|
16105
|
-
function renderLiveSubagentResult(
|
|
16106
|
-
const nextKey = subagentResultRenderKey(
|
|
16784
|
+
function renderLiveSubagentResult(result, options, theme, context) {
|
|
16785
|
+
const nextKey = subagentResultRenderKey(result, options);
|
|
16107
16786
|
if (context.state.subagentResultSnapshotKey !== nextKey) {
|
|
16108
16787
|
context.state.subagentResultSnapshotKey = nextKey;
|
|
16109
16788
|
context.state.subagentResultSnapshotNow = Date.now();
|
|
@@ -16112,110 +16791,113 @@ function renderLiveSubagentResult(result2, options, theme, context) {
|
|
|
16112
16791
|
context.state.subagentResultSnapshotNow ??= Date.now();
|
|
16113
16792
|
context.state.subagentResultPulseFrame ??= 0;
|
|
16114
16793
|
clearResultAnimationTimer(context);
|
|
16115
|
-
return renderSubagentResult(
|
|
16794
|
+
return renderSubagentResult(result, {
|
|
16116
16795
|
...options,
|
|
16117
16796
|
now: context.state.subagentResultSnapshotNow,
|
|
16118
16797
|
pulseFrame: context.state.subagentResultPulseFrame
|
|
16119
16798
|
}, theme);
|
|
16120
16799
|
}
|
|
16121
|
-
function renderSubagentResult(
|
|
16122
|
-
const d =
|
|
16800
|
+
function renderSubagentResult(result, options, theme) {
|
|
16801
|
+
const d = result.details;
|
|
16802
|
+
if (d?.statusGroups)
|
|
16803
|
+
return renderSubagentStatus(d.statusGroups, options.expanded, theme);
|
|
16123
16804
|
const liveMultiProgress = d?.mode === "parallel" && (d?.progress?.length ?? 0) > 0;
|
|
16124
16805
|
if (!d?.results.length && !liveMultiProgress) {
|
|
16125
|
-
const t =
|
|
16806
|
+
const t = result.content[0];
|
|
16126
16807
|
const text = t?.type === "text" ? t.text : "(no output)";
|
|
16127
16808
|
const contextPrefix = d?.context === "fork" ? `${theme.fg("warning", "[fork]")} ` : "";
|
|
16128
|
-
return new
|
|
16809
|
+
return new Text3(truncLine(`${contextPrefix}${text}`, getTermWidth() - 4), 0, 0);
|
|
16129
16810
|
}
|
|
16130
16811
|
const expanded = options.expanded;
|
|
16131
16812
|
const mdTheme = getMarkdownTheme();
|
|
16132
|
-
const handoffOutput = parentAskOutput(
|
|
16813
|
+
const handoffOutput = parentAskOutput(result);
|
|
16133
16814
|
if (d.mode === "single" && d.results.length === 1) {
|
|
16134
16815
|
const r = d.results[0];
|
|
16135
16816
|
if (!expanded)
|
|
16136
16817
|
return appendParentAskOutput(renderSingleCompact(d, r, theme, options.now, options.pulseFrame), handoffOutput, theme);
|
|
16137
16818
|
const isRunning = r.progress?.status === "running";
|
|
16138
|
-
const
|
|
16139
|
-
const
|
|
16819
|
+
const icon = isRunning ? theme.fg("warning", "running") : d.parentAskYielded ? theme.fg("warning", "yielded") : r.detached || r.status === "continued" ? theme.fg("warning", "detached") : r.status === "killed" ? theme.fg("warning", "killed (non-resumable)") : isParentCancellation(r.cause) && (r.interrupted || r.status === "interrupted") ? theme.fg("warning", "cancelled") : r.status === "ok" ? theme.fg("success", "ok") : theme.fg("error", "failed");
|
|
16820
|
+
const contextBadge = d.context === "fork" ? theme.fg("warning", " [fork]") : "";
|
|
16140
16821
|
const output = r.truncation?.text || getSingleResultOutput(r);
|
|
16141
16822
|
const progressInfo = isRunning && r.progress ? ` | ${r.progress.toolCount} tools, ${formatTokens(r.progress.tokens)} tok, ${formatDuration(displayProgressDurationMs(r.progress, options.now))}` : r.progressSummary ? ` | ${r.progressSummary.toolCount} tools, ${formatTokens(r.progressSummary.tokens)} tok, ${formatDuration(r.progressSummary.durationMs)}` : "";
|
|
16142
|
-
const
|
|
16143
|
-
const
|
|
16823
|
+
const w = getTermWidth() - 4;
|
|
16824
|
+
const fit = (text) => expanded ? text : truncLine(text, w);
|
|
16144
16825
|
const modelDisplay = modelThinkingBadge(theme, r.model, r.thinking);
|
|
16145
16826
|
const toolCallLines = getToolCallLines(r, expanded);
|
|
16146
|
-
const
|
|
16147
|
-
|
|
16148
|
-
|
|
16149
|
-
const taskMaxLen = Math.max(20,
|
|
16827
|
+
const c = new Container2;
|
|
16828
|
+
c.addChild(new Text3(fit(`${icon} ${theme.fg("toolTitle", theme.bold(r.agent))}${modelDisplay}${contextBadge}${progressInfo}`), 0, 0));
|
|
16829
|
+
c.addChild(new Spacer(1));
|
|
16830
|
+
const taskMaxLen = Math.max(20, w - 8);
|
|
16150
16831
|
const taskPreview = expanded || r.task.length <= taskMaxLen ? r.task : `${r.task.slice(0, taskMaxLen)}...`;
|
|
16151
|
-
|
|
16152
|
-
|
|
16832
|
+
c.addChild(new Text3(fit(theme.fg("dim", `Task: ${taskPreview}`)), 0, 0));
|
|
16833
|
+
c.addChild(new Spacer(1));
|
|
16153
16834
|
if (isRunning && r.progress) {
|
|
16154
16835
|
const progressSnapshotNow = snapshotNowForProgress(r.progress, options.now);
|
|
16155
|
-
const toolLine = formatCurrentToolLine(r.progress,
|
|
16836
|
+
const toolLine = formatCurrentToolLine(r.progress, w, expanded, progressSnapshotNow);
|
|
16156
16837
|
if (toolLine) {
|
|
16157
|
-
|
|
16838
|
+
c.addChild(new Text3(fit(theme.fg("warning", `> ${toolLine}`)), 0, 0));
|
|
16158
16839
|
}
|
|
16159
16840
|
const liveStatusLine = buildLiveStatusLine(r.progress, progressSnapshotNow);
|
|
16160
16841
|
if (liveStatusLine) {
|
|
16161
|
-
|
|
16842
|
+
c.addChild(new Text3(fit(theme.fg("accent", liveStatusLine)), 0, 0));
|
|
16162
16843
|
}
|
|
16163
|
-
const expandHint =
|
|
16844
|
+
const expandHint = keyHintIfBound3("app.tools.expand", "for live detail");
|
|
16164
16845
|
if (expandHint)
|
|
16165
|
-
|
|
16846
|
+
c.addChild(new Text3(fit(theme.fg("accent", `Press ${expandHint}`)), 0, 0));
|
|
16166
16847
|
if (r.artifactPaths) {
|
|
16167
|
-
|
|
16848
|
+
c.addChild(new Text3(fit(theme.fg("dim", `Artifacts: ${shortenPath(r.artifactPaths.outputPath)}`)), 0, 0));
|
|
16168
16849
|
}
|
|
16169
16850
|
if (r.progress.recentTools?.length) {
|
|
16170
16851
|
for (const t of r.progress.recentTools.slice(-3)) {
|
|
16171
|
-
const maxArgsLen = Math.max(40,
|
|
16852
|
+
const maxArgsLen = Math.max(40, w - 24);
|
|
16172
16853
|
const argsPreview = expanded || t.args.length <= maxArgsLen ? t.args : `${t.args.slice(0, maxArgsLen)}...`;
|
|
16173
|
-
|
|
16854
|
+
c.addChild(new Text3(fit(theme.fg("dim", `${t.tool}: ${argsPreview}`)), 0, 0));
|
|
16174
16855
|
}
|
|
16175
16856
|
}
|
|
16176
16857
|
for (const line of (r.progress.recentOutput ?? []).slice(-5)) {
|
|
16177
|
-
|
|
16858
|
+
c.addChild(new Text3(fit(theme.fg("dim", ` ${line}`)), 0, 0));
|
|
16178
16859
|
}
|
|
16179
16860
|
if (toolLine || liveStatusLine || r.progress.recentTools?.length || r.progress.recentOutput?.length || r.artifactPaths) {
|
|
16180
|
-
|
|
16861
|
+
c.addChild(new Spacer(1));
|
|
16181
16862
|
}
|
|
16182
16863
|
}
|
|
16183
16864
|
if (expanded) {
|
|
16184
16865
|
for (const line of toolCallLines) {
|
|
16185
|
-
|
|
16866
|
+
c.addChild(new Text3(fit(theme.fg("muted", line)), 0, 0));
|
|
16186
16867
|
}
|
|
16187
16868
|
if (toolCallLines.length)
|
|
16188
|
-
|
|
16869
|
+
c.addChild(new Spacer(1));
|
|
16189
16870
|
}
|
|
16190
16871
|
if (output)
|
|
16191
|
-
|
|
16192
|
-
|
|
16872
|
+
c.addChild(new Markdown(output, 0, 0, mdTheme));
|
|
16873
|
+
c.addChild(new Spacer(1));
|
|
16193
16874
|
if (r.skills?.length) {
|
|
16194
|
-
|
|
16875
|
+
c.addChild(new Text3(fit(theme.fg("dim", `Skills: ${r.skills.join(", ")}`)), 0, 0));
|
|
16195
16876
|
}
|
|
16196
16877
|
if (r.skillsWarning) {
|
|
16197
|
-
|
|
16878
|
+
c.addChild(new Text3(fit(theme.fg("warning", `Warning: ${r.skillsWarning}`)), 0, 0));
|
|
16198
16879
|
}
|
|
16199
16880
|
if (r.attemptedModels && r.attemptedModels.length > 1) {
|
|
16200
|
-
|
|
16881
|
+
c.addChild(new Text3(fit(theme.fg("dim", `Fallbacks: ${r.attemptedModels.join(" → ")}`)), 0, 0));
|
|
16201
16882
|
}
|
|
16202
|
-
|
|
16883
|
+
c.addChild(new Text3(fit(theme.fg("dim", formatUsage(r.usage))), 0, 0));
|
|
16203
16884
|
if (r.sessionFile) {
|
|
16204
|
-
|
|
16885
|
+
c.addChild(new Text3(fit(theme.fg("dim", `Session: ${shortenPath(r.sessionFile)}`)), 0, 0));
|
|
16205
16886
|
}
|
|
16206
16887
|
if (!isRunning && r.artifactPaths) {
|
|
16207
|
-
|
|
16208
|
-
|
|
16888
|
+
c.addChild(new Spacer(1));
|
|
16889
|
+
c.addChild(new Text3(fit(theme.fg("dim", `Artifacts: ${shortenPath(r.artifactPaths.outputPath)}`)), 0, 0));
|
|
16209
16890
|
}
|
|
16210
|
-
return appendParentAskOutput(
|
|
16891
|
+
return appendParentAskOutput(c, handoffOutput, theme);
|
|
16211
16892
|
}
|
|
16212
16893
|
if (!expanded)
|
|
16213
16894
|
return appendParentAskOutput(renderMultiCompact(d, theme, options.now, options.pulseFrame), handoffOutput, theme);
|
|
16214
16895
|
const hasRunning = d.progress?.some((p) => p.status === "running") || d.results.some((r) => r.progress?.status === "running");
|
|
16215
16896
|
const ok = d.results.filter((r) => r.progress?.status === "completed" || r.status === "ok" && r.progress?.status !== "running").length;
|
|
16216
16897
|
const hasEmptyWithoutTarget = d.results.some((r) => r.status === "ok" && r.progress?.status !== "running" && hasEmptyTextOutputWithoutOutputTarget(r.task, getSingleResultOutput(r)));
|
|
16217
|
-
const hasCancelled = d.results.some((
|
|
16218
|
-
const
|
|
16898
|
+
const hasCancelled = d.results.some((result) => isParentCancellation(result.cause) && (result.interrupted || result.status === "interrupted"));
|
|
16899
|
+
const hasKilled = d.results.some((result) => result.status === "killed");
|
|
16900
|
+
const icon = hasRunning ? theme.fg("warning", "running") : d.parentAskYielded ? theme.fg("warning", "yielded") : hasKilled && !hasCancelled && !d.results.some((result) => result.status === "error") ? theme.fg("warning", "killed (non-resumable)") : hasEmptyWithoutTarget ? theme.fg("warning", "warning") : ok === d.results.length ? theme.fg("success", "ok") : d.results.some((result) => result.status === "error") ? theme.fg("error", "failed") : hasCancelled ? theme.fg("warning", "cancelled") : theme.fg("error", "failed");
|
|
16219
16901
|
const totalSummary = d.progressSummary || d.results.reduce((acc, r) => {
|
|
16220
16902
|
const prog = r.progress || r.progressSummary;
|
|
16221
16903
|
if (prog) {
|
|
@@ -16232,7 +16914,7 @@ function renderSubagentResult(result2, options, theme) {
|
|
|
16232
16914
|
const w = getTermWidth() - 4;
|
|
16233
16915
|
const fit = (text) => expanded ? text : truncLine(text, w);
|
|
16234
16916
|
const c = new Container2;
|
|
16235
|
-
c.addChild(new
|
|
16917
|
+
c.addChild(new Text3(fit(`${icon} ${theme.fg("toolTitle", theme.bold(modeLabel))}${contextBadge} · ${multiLabel.headerLabel}${summaryStr}`), 0, 0));
|
|
16236
16918
|
const progressSpan = d.progress?.length ? Math.max(...d.progress.map((p) => p.index + 1)) : 0;
|
|
16237
16919
|
const resultsSpan = Math.max(d.results.length, progressSpan, d.mode === "parallel" ? d.totalSteps ?? 0 : 0);
|
|
16238
16920
|
const displayStart = multiLabel.showActiveGroupOnly ? multiLabel.groupStartIndex : 0;
|
|
@@ -16260,20 +16942,20 @@ function renderSubagentResult(result2, options, theme) {
|
|
|
16260
16942
|
if (runningProg) {
|
|
16261
16943
|
const runningStats = ` | ${runningProg.toolCount} tools, ${formatDuration(displayProgressDurationMs(runningProg, options.now))}`;
|
|
16262
16944
|
const runningBadge = modelThinkingBadge(theme, runningProg.model, runningProg.thinking);
|
|
16263
|
-
c.addChild(new
|
|
16945
|
+
c.addChild(new Text3(fit(`${theme.fg("warning", "running")} ${rowLabel}: ${theme.bold(theme.fg("warning", agentName))}${runningBadge}${runningStats}`), 0, 0));
|
|
16264
16946
|
const progressSnapshotNow = snapshotNowForProgress(runningProg, options.now);
|
|
16265
16947
|
const liveStatusLine = buildLiveStatusLine(runningProg, progressSnapshotNow);
|
|
16266
16948
|
if (liveStatusLine) {
|
|
16267
|
-
c.addChild(new
|
|
16949
|
+
c.addChild(new Text3(fit(theme.fg("accent", ` ${liveStatusLine}`)), 0, 0));
|
|
16268
16950
|
}
|
|
16269
|
-
const expandHint =
|
|
16951
|
+
const expandHint = keyHintIfBound3("app.tools.expand", "for live detail");
|
|
16270
16952
|
if (expandHint)
|
|
16271
|
-
c.addChild(new
|
|
16953
|
+
c.addChild(new Text3(fit(theme.fg("accent", ` Press ${expandHint}`)), 0, 0));
|
|
16272
16954
|
c.addChild(new Spacer(1));
|
|
16273
16955
|
continue;
|
|
16274
16956
|
}
|
|
16275
|
-
c.addChild(new
|
|
16276
|
-
c.addChild(new
|
|
16957
|
+
c.addChild(new Text3(fit(theme.fg("dim", ` ${rowLabel}: ${agentName}`)), 0, 0));
|
|
16958
|
+
c.addChild(new Text3(theme.fg("dim", ` status: pending`), 0, 0));
|
|
16277
16959
|
c.addChild(new Spacer(1));
|
|
16278
16960
|
continue;
|
|
16279
16961
|
}
|
|
@@ -16282,66 +16964,66 @@ function renderSubagentResult(result2, options, theme) {
|
|
|
16282
16964
|
const rRunning = rProg?.status === "running";
|
|
16283
16965
|
const stepNumber = typeof rProg?.index === "number" ? rProg.index + 1 : i + 1;
|
|
16284
16966
|
const resultOutput = getSingleResultOutput(r);
|
|
16285
|
-
const statusIcon = rRunning ? theme.fg("warning", "running") : r.status === "error" ? theme.fg("error", "failed") : isParentCancellation(r.cause) && (r.interrupted || r.status === "interrupted") ? theme.fg("warning", "cancelled") : r.status === "skipped" || r.status === "interrupted" || r.status === "continued" ? theme.fg("warning", r.status) : hasEmptyTextOutputWithoutOutputTarget(r.task, resultOutput) ? theme.fg("warning", "warning") : theme.fg("success", "done");
|
|
16967
|
+
const statusIcon = rRunning ? theme.fg("warning", "running") : r.status === "error" ? theme.fg("error", "failed") : isParentCancellation(r.cause) && (r.interrupted || r.status === "interrupted") ? theme.fg("warning", "cancelled") : r.status === "killed" || r.status === "skipped" || r.status === "interrupted" || r.status === "continued" ? theme.fg("warning", r.status) : hasEmptyTextOutputWithoutOutputTarget(r.task, resultOutput) ? theme.fg("warning", "warning") : theme.fg("success", "done");
|
|
16286
16968
|
const stats = rProg ? ` | ${rProg.toolCount} tools, ${formatDuration(displayProgressDurationMs(rProg, options.now))}` : "";
|
|
16287
16969
|
const modelDisplay = modelThinkingBadge(theme, r.model ?? rProg?.model, r.thinking ?? rProg?.thinking);
|
|
16288
16970
|
const stepLabel = resultRowLabel(d, multiLabel, i, stepNumber);
|
|
16289
16971
|
const stepHeader = rRunning ? `${statusIcon} ${stepLabel}: ${theme.bold(theme.fg("warning", r.agent))}${modelDisplay}${stats}` : `${statusIcon} ${stepLabel}: ${theme.bold(r.agent)}${modelDisplay}${stats}`;
|
|
16290
16972
|
const toolCallLines = getToolCallLines(r, expanded);
|
|
16291
|
-
c.addChild(new
|
|
16973
|
+
c.addChild(new Text3(fit(stepHeader), 0, 0));
|
|
16292
16974
|
const taskMaxLen = Math.max(20, w - 12);
|
|
16293
16975
|
const taskPreview = expanded || r.task.length <= taskMaxLen ? r.task : `${r.task.slice(0, taskMaxLen)}...`;
|
|
16294
|
-
c.addChild(new
|
|
16976
|
+
c.addChild(new Text3(fit(theme.fg("dim", ` task: ${taskPreview}`)), 0, 0));
|
|
16295
16977
|
const outputTarget = extractOutputTarget(r.task);
|
|
16296
16978
|
if (outputTarget) {
|
|
16297
|
-
c.addChild(new
|
|
16979
|
+
c.addChild(new Text3(fit(theme.fg("dim", ` output: ${outputTarget}`)), 0, 0));
|
|
16298
16980
|
}
|
|
16299
16981
|
if (r.skills?.length) {
|
|
16300
|
-
c.addChild(new
|
|
16982
|
+
c.addChild(new Text3(fit(theme.fg("dim", ` skills: ${r.skills.join(", ")}`)), 0, 0));
|
|
16301
16983
|
}
|
|
16302
16984
|
if (r.skillsWarning) {
|
|
16303
|
-
c.addChild(new
|
|
16985
|
+
c.addChild(new Text3(fit(theme.fg("warning", ` Warning: ${r.skillsWarning}`)), 0, 0));
|
|
16304
16986
|
}
|
|
16305
16987
|
if (r.attemptedModels && r.attemptedModels.length > 1) {
|
|
16306
|
-
c.addChild(new
|
|
16988
|
+
c.addChild(new Text3(fit(theme.fg("dim", ` fallbacks: ${r.attemptedModels.join(" → ")}`)), 0, 0));
|
|
16307
16989
|
}
|
|
16308
16990
|
if (rRunning && rProg) {
|
|
16309
16991
|
if (rProg.skills?.length) {
|
|
16310
|
-
c.addChild(new
|
|
16992
|
+
c.addChild(new Text3(fit(theme.fg("accent", ` skills: ${rProg.skills.join(", ")}`)), 0, 0));
|
|
16311
16993
|
}
|
|
16312
16994
|
const progressSnapshotNow = snapshotNowForProgress(rProg, options.now);
|
|
16313
16995
|
const toolLine = formatCurrentToolLine(rProg, w, expanded, progressSnapshotNow);
|
|
16314
16996
|
if (toolLine) {
|
|
16315
|
-
c.addChild(new
|
|
16997
|
+
c.addChild(new Text3(fit(theme.fg("warning", ` > ${toolLine}`)), 0, 0));
|
|
16316
16998
|
}
|
|
16317
16999
|
const liveStatusLine = buildLiveStatusLine(rProg, progressSnapshotNow);
|
|
16318
17000
|
if (liveStatusLine) {
|
|
16319
|
-
c.addChild(new
|
|
17001
|
+
c.addChild(new Text3(fit(theme.fg("accent", ` ${liveStatusLine}`)), 0, 0));
|
|
16320
17002
|
}
|
|
16321
|
-
const expandHint =
|
|
17003
|
+
const expandHint = keyHintIfBound3("app.tools.expand", "for live detail");
|
|
16322
17004
|
if (expandHint)
|
|
16323
|
-
c.addChild(new
|
|
17005
|
+
c.addChild(new Text3(fit(theme.fg("accent", ` Press ${expandHint}`)), 0, 0));
|
|
16324
17006
|
if (r.artifactPaths) {
|
|
16325
|
-
c.addChild(new
|
|
17007
|
+
c.addChild(new Text3(fit(theme.fg("dim", ` artifacts: ${shortenPath(r.artifactPaths.outputPath)}`)), 0, 0));
|
|
16326
17008
|
}
|
|
16327
17009
|
if (rProg.recentTools?.length) {
|
|
16328
17010
|
for (const t of rProg.recentTools.slice(-3)) {
|
|
16329
17011
|
const maxArgsLen = Math.max(40, w - 30);
|
|
16330
17012
|
const argsPreview = expanded || t.args.length <= maxArgsLen ? t.args : `${t.args.slice(0, maxArgsLen)}...`;
|
|
16331
|
-
c.addChild(new
|
|
17013
|
+
c.addChild(new Text3(fit(theme.fg("dim", ` ${t.tool}: ${argsPreview}`)), 0, 0));
|
|
16332
17014
|
}
|
|
16333
17015
|
}
|
|
16334
17016
|
const recentLines = (rProg.recentOutput ?? []).slice(-5);
|
|
16335
17017
|
for (const line of recentLines) {
|
|
16336
|
-
c.addChild(new
|
|
17018
|
+
c.addChild(new Text3(fit(theme.fg("dim", ` ${line}`)), 0, 0));
|
|
16337
17019
|
}
|
|
16338
17020
|
}
|
|
16339
17021
|
if (!rRunning && r.artifactPaths) {
|
|
16340
|
-
c.addChild(new
|
|
17022
|
+
c.addChild(new Text3(fit(theme.fg("dim", ` artifacts: ${shortenPath(r.artifactPaths.outputPath)}`)), 0, 0));
|
|
16341
17023
|
}
|
|
16342
17024
|
if (expanded && !rRunning) {
|
|
16343
17025
|
for (const line of toolCallLines) {
|
|
16344
|
-
c.addChild(new
|
|
17026
|
+
c.addChild(new Text3(fit(theme.fg("muted", ` ${line}`)), 0, 0));
|
|
16345
17027
|
}
|
|
16346
17028
|
if (toolCallLines.length)
|
|
16347
17029
|
c.addChild(new Spacer(1));
|
|
@@ -16350,7 +17032,7 @@ function renderSubagentResult(result2, options, theme) {
|
|
|
16350
17032
|
}
|
|
16351
17033
|
if (d.artifacts) {
|
|
16352
17034
|
c.addChild(new Spacer(1));
|
|
16353
|
-
c.addChild(new
|
|
17035
|
+
c.addChild(new Text3(fit(theme.fg("dim", `Artifacts dir: ${shortenPath(d.artifacts.dir)}`)), 0, 0));
|
|
16354
17036
|
}
|
|
16355
17037
|
return appendParentAskOutput(c, handoffOutput, theme);
|
|
16356
17038
|
}
|
|
@@ -16371,7 +17053,7 @@ function loadConfig() {
|
|
|
16371
17053
|
}
|
|
16372
17054
|
|
|
16373
17055
|
// dist/builtin/subagents/src/extension/notification-content.ts
|
|
16374
|
-
var HEADER_STATUSES = ["completed", "failed", "interrupted"];
|
|
17056
|
+
var HEADER_STATUSES = ["completed", "failed", "interrupted", "killed"];
|
|
16375
17057
|
function isHeaderLineTerminator(character) {
|
|
16376
17058
|
return character === "\r" || character === "\u2028" || character === "\u2029";
|
|
16377
17059
|
}
|
|
@@ -16463,11 +17145,13 @@ function parseSubagentNotifyContent(content) {
|
|
|
16463
17145
|
var DEFAULT_PROMPT_GUIDANCE = [
|
|
16464
17146
|
`**Subagent orchestration**: Use subagents for focused specialist work inside workflows or as bounded delegation when a workflow would be unnecessary overhead.
|
|
16465
17147
|
- Unless the user explicitly chooses inline execution for the specified task, workflows are the default for non-trivial structured work with verifiable objectives; use a workflow for implementation, review, or retry pipelines and let its stages delegate specialists.
|
|
16466
|
-
- Explicit requests such as "inline", "do this directly", or "don't use a workflow", and equivalent wording, override that default even for complex tasks. Do not create or launch a hidden/nested workflow or pressure the user to reapprove the choice. Preserve appropriate testing, review and evidence inline, and unrelated safety and authorization constraints. Apply the preference only to the specified task. Quoted examples and questions about inline code are not execution-mode instructions.
|
|
17148
|
+
- Explicit requests such as "quickly", "inline", "do this directly", or "don't use a workflow", and equivalent wording, override that default even for complex tasks. Treat "quickly" as an inline execution choice, not a request for a faster workflow. Do not create or launch a hidden/nested workflow or pressure the user to reapprove the choice. Preserve appropriate testing, review and evidence inline, and unrelated safety and authorization constraints. Apply the preference only to the specified task. Quoted examples and questions about inline code are not execution-mode instructions; neither are descriptions of software that should run quickly.
|
|
16467
17149
|
- On a switch from an active workflow to inline, notify the controlling session to safely hold/stop the affected run, reconcile completed work and in-flight side effects, then continue inline without duplicate execution. Do not claim completed work was undone.
|
|
16468
17150
|
- Use a single subagent for a focused specialty or parallel tasks for independent work. Keep substantial-overlap tasks together rather than duplicating investigation across agents.
|
|
16469
|
-
- Delegate noisy or context-heavy command investigation when isolation helps, but run concise commands inline when that is simpler.
|
|
16470
|
-
-
|
|
17151
|
+
- Keep immediately blocking work local unless specialist expertise, context isolation, or an explicit user request justifies delegation. Delegate independent work that can usefully overlap your own next steps; do not spawn a child merely to wait immediately. Delegate noisy or context-heavy command investigation when isolation helps, but run concise commands inline when that is simpler.
|
|
17152
|
+
- Background subagents are supported in owner-bound sessions: omitted wait or wait:{kind:"background"} yields after admission while the child continues. Use wait:{kind:"foreground",budgetMs:30000} for foreground-first observation. A yielded observation never means the task stopped. Do not duplicate delegated work; observe the existing task or await its completion notice. The UI shows compact status below the prompt, and /tasks opens inspection only when invoked.
|
|
17153
|
+
- Choose foreground-first or background observation for each authorized call based on whether the next action needs the result; do not ask the user merely to select a mode. Foreground observation automatically yields on budget expiry while the same task continues. Wait for terminal completion before starting dependent work. Execution mode does not bypass tool permissions, delegation boundaries, or owner lifetime.
|
|
17154
|
+
- Continue useful independent work after spawning without duplicating the child's task. Wait when its result becomes a dependency; otherwise rely on completion notices. Avoid repeated short waits or status polls. Omit the wait budget to use owner policy unless a concrete responsiveness need calls for an override.
|
|
16471
17155
|
- Use the debugger subagent for actual failures that need reproduction, root-cause diagnosis, and a validated fix; additional debugger or research delegates are optional when they add a distinct useful angle.
|
|
16472
17156
|
- Let each named agent use its declared model and fallback policy: omit the explicit model argument unless the user requests an exact model or a documented task requirement needs one, and record the reason for any override before launch. Do not choose an ad hoc model merely for diversity.
|
|
16473
17157
|
- If an agent has no declared model or fallback policy, consult packages/coding-agent/docs/models/model-selection.md for the role's Pareto-efficient recommendations and packages/coding-agent/docs/models/evals.md for the measured per-evaluation scores by task type, then use workflow({ action: "models" }) when available to inspect the configured catalog. Pin only a returned fullId and only append a thinking level listed for that entry. If the catalog tool is unavailable, the catalog is empty, or no recommended model is present, leave the child unpinned and state the limitation rather than inventing a model. Do not inspect credentials or infer why a model is absent.
|
|
@@ -16546,15 +17230,23 @@ var ControlOverrides = Type.Object({
|
|
|
16546
17230
|
}))
|
|
16547
17231
|
});
|
|
16548
17232
|
var SubagentParams = Type.Object({
|
|
17233
|
+
wait: Type.Optional(Type.Object({
|
|
17234
|
+
kind: Type.String({
|
|
17235
|
+
enum: ["background", "foreground"],
|
|
17236
|
+
description: "Wait policy kind. 'background' yields immediately; 'foreground' waits up to budgetMs."
|
|
17237
|
+
}),
|
|
17238
|
+
budgetMs: Type.Optional(Type.Number({ description: "Foreground wait budget in milliseconds (kind='foreground' only)." }))
|
|
17239
|
+
}, { additionalProperties: false })),
|
|
17240
|
+
budgetMs: Type.Optional(Type.Number({ description: "Foreground wait budget in milliseconds." })),
|
|
16549
17241
|
agent: Type.Optional(Type.String({ description: "Agent name (SINGLE mode) or target for management get/update/delete" })),
|
|
16550
17242
|
task: Type.Optional(Type.String({ description: "Task (SINGLE mode, optional for self-contained agents)" })),
|
|
16551
17243
|
action: Type.Optional(Type.String({
|
|
16552
17244
|
enum: [...SUBAGENT_ACTIONS],
|
|
16553
17245
|
description: "Management/control action. Omit for execution mode."
|
|
16554
17246
|
})),
|
|
16555
|
-
id: Type.Optional(Type.String({ description: "Run id or prefix for action='status' or action='
|
|
17247
|
+
id: Type.Optional(Type.String({ description: "Run id or prefix for action='status' or action='kill'." })),
|
|
16556
17248
|
runId: Type.Optional(Type.String({
|
|
16557
|
-
description: "Target run ID for action='
|
|
17249
|
+
description: "Target run ID for action='kill'. Prefer id for new calls."
|
|
16558
17250
|
})),
|
|
16559
17251
|
config: Type.Optional(Type.Unsafe({
|
|
16560
17252
|
anyOf: [{ type: "object", additionalProperties: true }, { type: "string" }],
|
|
@@ -16566,7 +17258,7 @@ var SubagentParams = Type.Object({
|
|
|
16566
17258
|
})),
|
|
16567
17259
|
concurrency: Type.Optional(Type.Integer({
|
|
16568
17260
|
minimum: 1,
|
|
16569
|
-
description: "Top-level PARALLEL mode only: max concurrent tasks. Defaults to config.parallel.concurrency or
|
|
17261
|
+
description: "Top-level PARALLEL mode only: max concurrent tasks. Defaults to config.parallel.concurrency or 3."
|
|
16570
17262
|
})),
|
|
16571
17263
|
group: Type.Optional(GroupSchema),
|
|
16572
17264
|
worktree: Type.Optional(Type.Boolean({
|
|
@@ -16618,10 +17310,13 @@ MANAGEMENT (use action field, omit agent/task/tasks):
|
|
|
16618
17310
|
• { action: "delete", agent: "code-analysis.custom-agent" }
|
|
16619
17311
|
CONTROL:
|
|
16620
17312
|
• { action: "status", id: "..." } - inspect an in-process run by id or prefix
|
|
16621
|
-
• { action: "
|
|
17313
|
+
• { action: "kill", id: "..." } - terminally stop the selected child; killed children cannot be resumed, so follow-up work starts a fresh launch`;
|
|
16622
17314
|
|
|
16623
17315
|
// dist/builtin/subagents/src/extension/tool-rendering.ts
|
|
16624
|
-
import {
|
|
17316
|
+
import { keyHintIfBound as keyHintIfBound4 } from "@bastani/atomic";
|
|
17317
|
+
import { Container as Container3, Text as Text4, truncateToWidth as truncateToWidth3 } from "@earendil-works/pi-tui";
|
|
17318
|
+
var renderRequests = new WeakMap;
|
|
17319
|
+
var displayText2 = (text) => text.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").replace(/[\x00-\x1f\x7f-\x9f]/g, " ");
|
|
16625
17320
|
function effectiveParallelTaskCount(tasks) {
|
|
16626
17321
|
if (!tasks || tasks.length === 0)
|
|
16627
17322
|
return 0;
|
|
@@ -16631,25 +17326,88 @@ function effectiveParallelTaskCount(tasks) {
|
|
|
16631
17326
|
}, 0);
|
|
16632
17327
|
}
|
|
16633
17328
|
function renderSubagentToolCall(args, theme, context) {
|
|
17329
|
+
renderRequests.set(context.state, args);
|
|
16634
17330
|
const burst = getBurstDisplay(context.toolCallId);
|
|
16635
17331
|
if (burst && !burst.owner)
|
|
16636
17332
|
return new Container3;
|
|
16637
17333
|
if (args.action) {
|
|
16638
|
-
const target = args.agent || "";
|
|
16639
|
-
return new
|
|
17334
|
+
const target = args.agent || args.id || args.runId || "";
|
|
17335
|
+
return new Text4(`${theme.fg("toolTitle", theme.bold("subagent "))}${args.action}${target ? ` ${theme.fg(args.action === "status" ? "dim" : "accent", displayText2(target))}` : ""}`, 0, 0);
|
|
16640
17336
|
}
|
|
16641
17337
|
if (burst) {
|
|
16642
|
-
return new
|
|
17338
|
+
return new Text4(`${theme.fg("toolTitle", theme.bold("subagent "))}parallel (${burst.taskCount})`, 0, 0);
|
|
16643
17339
|
}
|
|
16644
17340
|
const isParallel = (args.tasks?.length ?? 0) > 0;
|
|
16645
17341
|
const parallelCount = effectiveParallelTaskCount(args.tasks);
|
|
16646
|
-
return new
|
|
17342
|
+
return new Text4(isParallel ? `${theme.fg("toolTitle", theme.bold("subagent "))}parallel (${parallelCount})` : `${theme.fg("toolTitle", theme.bold("subagent "))}${theme.fg("accent", displayText2(args.agent || "?"))}${args.task ? `
|
|
17343
|
+
${theme.fg("muted", displayText2(truncateToWidth3(displayText2(args.task), 100)))}` : ""}`, 0, 0);
|
|
16647
17344
|
}
|
|
16648
|
-
function renderSubagentToolResult(
|
|
17345
|
+
function renderSubagentToolResult(result, options, theme, context) {
|
|
16649
17346
|
const burst = getBurstDisplay(context.toolCallId);
|
|
16650
17347
|
if (burst && !burst.owner)
|
|
16651
17348
|
return new Container3;
|
|
16652
|
-
|
|
17349
|
+
result = burst?.result ?? result;
|
|
17350
|
+
if (result.details?.taskError)
|
|
17351
|
+
return new Text4(theme.fg("error", `✗ ${displayText2(result.details.taskError)}`), 0, 0);
|
|
17352
|
+
if (result.details?.taskRecords && !result.details.taskResponse) {
|
|
17353
|
+
const lines = result.details.taskRecords.flatMap((task) => {
|
|
17354
|
+
const state = task.execution.kind === "settled" ? subagentTaskResultLabel(task.execution.result) : task.execution.kind;
|
|
17355
|
+
return [
|
|
17356
|
+
theme.bold(`${displayText2(task.agentName ?? "bash")} · ${state}`),
|
|
17357
|
+
...task.kind === "agent" ? [
|
|
17358
|
+
theme.fg("dim", displayText2(formatModelThinking(task.model, task.thinking) || "model / thinking unavailable"))
|
|
17359
|
+
] : [],
|
|
17360
|
+
theme.fg("muted", displayText2(task.title)),
|
|
17361
|
+
...options.expanded ? [theme.fg("dim", task.ref.taskId)] : [],
|
|
17362
|
+
...task.execution.kind === "settled" && task.execution.result.kind === "failed" ? [theme.fg("error", displayText2(task.execution.result.message))] : []
|
|
17363
|
+
];
|
|
17364
|
+
});
|
|
17365
|
+
return new Text4([...lines, theme.fg("dim", "/tasks to inspect output and manage tasks")].join(`
|
|
17366
|
+
`), 0, 0);
|
|
17367
|
+
}
|
|
17368
|
+
const response = result.details?.taskResponse;
|
|
17369
|
+
const request = renderRequests.get(context.state);
|
|
17370
|
+
if (response) {
|
|
17371
|
+
const outcomes = response.kind === "parallel" ? response.slots.map((slot) => slot.outcome) : [response];
|
|
17372
|
+
const labels = request && !burst ? [
|
|
17373
|
+
...request.agent ? [{ agent: request.agent, task: request.task ?? "" }] : [],
|
|
17374
|
+
...(request.tasks ?? []).flatMap((task) => Array.from({ length: Math.min(50, Math.max(1, task.count ?? 1)) }, () => task))
|
|
17375
|
+
] : [];
|
|
17376
|
+
const lines = outcomes.map((outcome, index) => {
|
|
17377
|
+
if (outcome.kind === "unstarted")
|
|
17378
|
+
return theme.fg("error", outcome.reason.kind === "rejected" ? `✗ ${index + 1}. Not started · ${displayText2(outcome.reason.error.message)}` : `○ ${index + 1}. Skipped`);
|
|
17379
|
+
const observation = outcome.observation;
|
|
17380
|
+
const state = observation.kind === "yielded" ? request?.action === "wait" ? "Still running in background" : "Launched in background" : observation.result.kind === "completed" ? "Completed" : observation.result.kind === "failed" ? "Failed" : subagentTaskResultLabel(observation.result) === "killed (non-resumable)" ? "Killed (non-resumable)" : "Stopped";
|
|
17381
|
+
const icon = observation.kind === "yielded" ? "∀" : observation.result.kind === "completed" ? "✓" : observation.result.kind === "failed" ? "✗" : "○";
|
|
17382
|
+
const color = observation.kind === "yielded" ? "accent" : observation.result.kind === "failed" ? "error" : observation.result.kind === "completed" ? "success" : "warning";
|
|
17383
|
+
const identity = labels[index];
|
|
17384
|
+
const name = outcomes.length > 1 ? `${index + 1}. ${identity ? displayText2(identity.agent) : "Agent"} · ` : "";
|
|
17385
|
+
const summary = theme.fg(color, `${icon} ${name}${state}`);
|
|
17386
|
+
const task = result.details?.taskRecords?.find((task) => task.ref.taskId === observation.taskId);
|
|
17387
|
+
const model = theme.fg("dim", `
|
|
17388
|
+
${displayText2(formatModelThinking(task?.model, task?.thinking) || "model / thinking unavailable")}`);
|
|
17389
|
+
const metadata = options.expanded ? theme.fg("dim", `
|
|
17390
|
+
${observation.taskId}${identity?.task ? ` · ${displayText2(identity.task)}` : ""}`) : "";
|
|
17391
|
+
const error = observation.kind === "settled" && observation.result.kind === "failed" ? `
|
|
17392
|
+
${theme.fg("error", displayText2(observation.result.message))}` : "";
|
|
17393
|
+
return summary + model + metadata + error;
|
|
17394
|
+
});
|
|
17395
|
+
const heading = outcomes.length > 1 ? [theme.bold(`${outcomes.length} agent tasks`)] : [];
|
|
17396
|
+
return new Text4([
|
|
17397
|
+
...heading,
|
|
17398
|
+
...lines.map((line, index) => outcomes.length > 1 ? `${index === lines.length - 1 ? "└─" : "├─"} ${line}` : line),
|
|
17399
|
+
theme.fg("dim", "/tasks to inspect output and manage tasks")
|
|
17400
|
+
].join(`
|
|
17401
|
+
`), 0, 0);
|
|
17402
|
+
}
|
|
17403
|
+
const text = result.content.find((part) => part.type === "text");
|
|
17404
|
+
if (text?.type === "text" && text.text.startsWith("Executable agents:")) {
|
|
17405
|
+
const count = text.text.split(`
|
|
17406
|
+
`).filter((line) => line.startsWith("- ") && line !== "- (none)").length;
|
|
17407
|
+
return new Text4(options.expanded ? text.text : `${theme.bold(`${count} available agents`)}
|
|
17408
|
+
${theme.fg("dim", ["/agents to browse", keyHintIfBound4("app.tools.expand", "Expand")].filter(Boolean).map((hint, index) => index ? `(${hint})` : hint).join(" · "))}`, 0, 0);
|
|
17409
|
+
}
|
|
17410
|
+
return renderLiveSubagentResult(burst?.result ?? result, options, theme, context);
|
|
16653
17411
|
}
|
|
16654
17412
|
// dist/builtin/subagents/src/extension/api-lifecycle.ts
|
|
16655
17413
|
function getWeakMap(key) {
|
|
@@ -16861,18 +17619,18 @@ function getSubagentSessionRoot(parentSessionFile) {
|
|
|
16861
17619
|
function expandTilde2(p) {
|
|
16862
17620
|
return p.startsWith("~/") ? path23.join(os8.homedir(), p.slice(2)) : p;
|
|
16863
17621
|
}
|
|
16864
|
-
function isSlashResultRunning(
|
|
16865
|
-
return
|
|
17622
|
+
function isSlashResultRunning(result) {
|
|
17623
|
+
return result.details?.progress?.some((entry) => entry.status === "running") || result.details?.results.some((entry) => entry.progress?.status === "running") || false;
|
|
16866
17624
|
}
|
|
16867
|
-
function isSlashResultError(
|
|
16868
|
-
return
|
|
17625
|
+
function isSlashResultError(result) {
|
|
17626
|
+
return result.details?.results.some((entry) => entry.status === "error" && entry.progress?.status !== "running") || false;
|
|
16869
17627
|
}
|
|
16870
|
-
function rebuildSlashResultContainer(container,
|
|
17628
|
+
function rebuildSlashResultContainer(container, result, options, theme) {
|
|
16871
17629
|
container.clear();
|
|
16872
17630
|
container.addChild(new Spacer2(1));
|
|
16873
|
-
const boxTheme = isSlashResultRunning(
|
|
17631
|
+
const boxTheme = isSlashResultRunning(result) ? "toolPendingBg" : isSlashResultError(result) ? "toolErrorBg" : "toolSuccessBg";
|
|
16874
17632
|
const box = new Box(1, 1, (text) => theme.bg(boxTheme, text));
|
|
16875
|
-
box.addChild(renderSubagentResult(
|
|
17633
|
+
box.addChild(renderSubagentResult(result, options, theme));
|
|
16876
17634
|
container.addChild(box);
|
|
16877
17635
|
}
|
|
16878
17636
|
function createSlashResultComponent(details, options, theme, owner) {
|
|
@@ -16896,8 +17654,8 @@ function renderSubagentNotification(message, options, theme) {
|
|
|
16896
17654
|
const content = typeof message.content === "string" ? message.content : "";
|
|
16897
17655
|
const details = message.details ?? parseSubagentNotifyContent(content);
|
|
16898
17656
|
if (!details)
|
|
16899
|
-
return new
|
|
16900
|
-
const icon = details.status === "completed" ? theme.fg("success", "✓") : details.status === "interrupted" ? theme.fg("warning", "■") : theme.fg("error", "✗");
|
|
17657
|
+
return new Text5(content, 0, 0);
|
|
17658
|
+
const icon = details.status === "completed" ? theme.fg("success", "✓") : details.status === "interrupted" || details.status === "killed" ? theme.fg("warning", "■") : theme.fg("error", "✗");
|
|
16901
17659
|
const parts = [];
|
|
16902
17660
|
if (details.taskInfo)
|
|
16903
17661
|
parts.push(details.taskInfo);
|
|
@@ -16916,7 +17674,7 @@ function renderSubagentNotification(message, options, theme) {
|
|
|
16916
17674
|
}
|
|
16917
17675
|
if (!options.expanded && trimmedPreview.includes(`
|
|
16918
17676
|
`)) {
|
|
16919
|
-
const expandHint =
|
|
17677
|
+
const expandHint = keyHintIfBound5("app.tools.expand", "full notification");
|
|
16920
17678
|
if (expandHint)
|
|
16921
17679
|
text += `
|
|
16922
17680
|
${expandHint}`;
|
|
@@ -16929,7 +17687,7 @@ function renderSubagentNotification(message, options, theme) {
|
|
|
16929
17687
|
container.addChild(new Spacer2(1));
|
|
16930
17688
|
const boxTheme = details.status === "completed" ? "toolSuccessBg" : details.status === "failed" ? "toolErrorBg" : "toolPendingBg";
|
|
16931
17689
|
const box = new Box(1, 1, (line) => theme.bg(boxTheme, line));
|
|
16932
|
-
box.addChild(new
|
|
17690
|
+
box.addChild(new Text5(text, 0, 0));
|
|
16933
17691
|
container.addChild(box);
|
|
16934
17692
|
return container;
|
|
16935
17693
|
}
|
|
@@ -16945,16 +17703,16 @@ class SubagentControlNoticeComponent {
|
|
|
16945
17703
|
render(width) {
|
|
16946
17704
|
const eventLabel = this.details.event.type.replaceAll("_", " ");
|
|
16947
17705
|
if (width < 3)
|
|
16948
|
-
return [
|
|
17706
|
+
return [truncateToWidth4(`Subagent ${eventLabel}`, width)];
|
|
16949
17707
|
const bodyWidth = Math.max(1, width - 2);
|
|
16950
17708
|
const borderChar = "─";
|
|
16951
17709
|
const header = ` ⚠ Subagent ${eventLabel}: ${this.details.event.agent} `;
|
|
16952
|
-
const headerText =
|
|
16953
|
-
const headerPadding = Math.max(0, bodyWidth -
|
|
17710
|
+
const headerText = truncateToWidth4(header, bodyWidth, "");
|
|
17711
|
+
const headerPadding = Math.max(0, bodyWidth - visibleWidth4(headerText));
|
|
16954
17712
|
const lines = [this.theme.fg("accent", `╭${headerText}${borderChar.repeat(headerPadding)}╮`)];
|
|
16955
|
-
for (const line of
|
|
16956
|
-
const text =
|
|
16957
|
-
const padding = Math.max(0, bodyWidth -
|
|
17713
|
+
for (const line of wrapTextWithAnsi2(formatSubagentControlNotice(this.details), bodyWidth)) {
|
|
17714
|
+
const text = truncateToWidth4(line, bodyWidth, "");
|
|
17715
|
+
const padding = Math.max(0, bodyWidth - visibleWidth4(text));
|
|
16958
17716
|
lines.push(this.theme.fg("accent", `│${text}${" ".repeat(padding)}│`));
|
|
16959
17717
|
}
|
|
16960
17718
|
lines.push(this.theme.fg("accent", `╰${borderChar.repeat(bodyWidth)}╯`));
|
|
@@ -17072,8 +17830,8 @@ function registerSubagentExtension(pi) {
|
|
|
17072
17830
|
renderCall(args, theme, context) {
|
|
17073
17831
|
return renderSubagentToolCall(args, theme, context);
|
|
17074
17832
|
},
|
|
17075
|
-
renderResult(
|
|
17076
|
-
return renderSubagentToolResult(
|
|
17833
|
+
renderResult(result, options, theme, context) {
|
|
17834
|
+
return renderSubagentToolResult(result, options, theme, context);
|
|
17077
17835
|
}
|
|
17078
17836
|
};
|
|
17079
17837
|
pi.registerTool(tool);
|