pi-subagents 0.69.0 → 0.70.0
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 +41 -0
- package/agents/reviewer.md +3 -2
- package/docs/agents.md +6 -2
- package/docs/configuration.md +1 -1
- package/docs/extension-api.md +1 -1
- package/docs/models.md +3 -1
- package/docs/observability.md +6 -0
- package/docs/watchdog.md +2 -0
- package/docs/workflows.md +6 -2
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +10 -0
- package/index.js.map +1 -0
- package/package.json +89 -73
- package/runner-peer-loader.mjs +4 -7
- package/runner-peer-preload.mjs +5 -7
- package/skills/pi-subagents/references/prompting-and-roles.md +2 -2
- package/src/agents/advertised-agent-prompt.d.ts +8 -0
- package/src/agents/advertised-agent-prompt.d.ts.map +1 -0
- package/src/agents/advertised-agent-prompt.js +77 -0
- package/src/agents/advertised-agent-prompt.js.map +1 -0
- package/src/agents/agent-management.d.ts +27 -0
- package/src/agents/agent-management.d.ts.map +1 -0
- package/src/agents/agent-management.js +1528 -0
- package/src/agents/agent-management.js.map +1 -0
- package/src/agents/agent-memory.d.ts +49 -0
- package/src/agents/agent-memory.d.ts.map +1 -0
- package/src/agents/agent-memory.js +349 -0
- package/src/agents/agent-memory.js.map +1 -0
- package/src/agents/agent-refinements.d.ts +100 -0
- package/src/agents/agent-refinements.d.ts.map +1 -0
- package/src/agents/agent-refinements.js +569 -0
- package/src/agents/agent-refinements.js.map +1 -0
- package/src/agents/agent-scope.d.ts +3 -0
- package/src/agents/agent-scope.d.ts.map +1 -0
- package/src/agents/agent-scope.js +6 -0
- package/src/agents/agent-scope.js.map +1 -0
- package/src/agents/agent-selection.d.ts +3 -0
- package/src/agents/agent-selection.d.ts.map +1 -0
- package/src/agents/agent-selection.js +23 -0
- package/src/agents/agent-selection.js.map +1 -0
- package/src/agents/agent-serializer.d.ts +8 -0
- package/src/agents/agent-serializer.d.ts.map +1 -0
- package/src/agents/agent-serializer.js +200 -0
- package/src/agents/agent-serializer.js.map +1 -0
- package/src/agents/agents.d.ts +313 -0
- package/src/agents/agents.d.ts.map +1 -0
- package/src/agents/agents.js +2622 -0
- package/src/agents/agents.js.map +1 -0
- package/src/agents/builtin-names.d.ts +2 -0
- package/src/agents/builtin-names.d.ts.map +1 -0
- package/src/agents/builtin-names.js +17 -0
- package/src/agents/builtin-names.js.map +1 -0
- package/src/agents/chain-serializer.d.ts +7 -0
- package/src/agents/chain-serializer.d.ts.map +1 -0
- package/src/agents/chain-serializer.js +319 -0
- package/src/agents/chain-serializer.js.map +1 -0
- package/src/agents/frontmatter.d.ts +16 -0
- package/src/agents/frontmatter.d.ts.map +1 -0
- package/src/agents/frontmatter.js +142 -0
- package/src/agents/frontmatter.js.map +1 -0
- package/src/agents/identity.d.ts +8 -0
- package/src/agents/identity.d.ts.map +1 -0
- package/src/agents/identity.js +30 -0
- package/src/agents/identity.js.map +1 -0
- package/src/agents/proactive-skills.d.ts +35 -0
- package/src/agents/proactive-skills.d.ts.map +1 -0
- package/src/agents/proactive-skills.js +154 -0
- package/src/agents/proactive-skills.js.map +1 -0
- package/src/agents/runtime-agent-events.d.ts +27 -0
- package/src/agents/runtime-agent-events.d.ts.map +1 -0
- package/src/agents/runtime-agent-events.js +53 -0
- package/src/agents/runtime-agent-events.js.map +1 -0
- package/src/agents/runtime-agent-registry.d.ts +59 -0
- package/src/agents/runtime-agent-registry.d.ts.map +1 -0
- package/src/agents/runtime-agent-registry.js +390 -0
- package/src/agents/runtime-agent-registry.js.map +1 -0
- package/src/agents/skills.d.ts +33 -0
- package/src/agents/skills.d.ts.map +1 -0
- package/src/agents/skills.js +685 -0
- package/src/agents/skills.js.map +1 -0
- package/src/api/agents.d.ts +5 -0
- package/src/api/agents.d.ts.map +1 -0
- package/src/api/agents.js +3 -0
- package/src/api/agents.js.map +1 -0
- package/src/api/background-work.d.ts +39 -0
- package/src/api/background-work.d.ts.map +1 -0
- package/src/api/background-work.js +165 -0
- package/src/api/background-work.js.map +1 -0
- package/src/api/capability-ceiling.d.ts +2 -0
- package/src/api/capability-ceiling.d.ts.map +1 -0
- package/src/api/capability-ceiling.js +2 -0
- package/src/api/capability-ceiling.js.map +1 -0
- package/src/api/child-tool-plan.d.ts +2 -0
- package/src/api/child-tool-plan.d.ts.map +1 -0
- package/src/api/child-tool-plan.js +2 -0
- package/src/api/child-tool-plan.js.map +1 -0
- package/src/api/control-channel.d.ts +2 -0
- package/src/api/control-channel.d.ts.map +1 -0
- package/src/api/control-channel.js +2 -0
- package/src/api/control-channel.js.map +1 -0
- package/src/api/delegation.d.ts +99 -0
- package/src/api/delegation.d.ts.map +1 -0
- package/src/api/delegation.js +9 -0
- package/src/api/delegation.js.map +1 -0
- package/src/api/external-job-provider.d.ts +58 -0
- package/src/api/external-job-provider.d.ts.map +1 -0
- package/src/api/external-job-provider.js +140 -0
- package/src/api/external-job-provider.js.map +1 -0
- package/src/api/external-runs.d.ts +48 -0
- package/src/api/external-runs.d.ts.map +1 -0
- package/src/api/external-runs.js +245 -0
- package/src/api/external-runs.js.map +1 -0
- package/src/api/intercom-bridge.d.ts +2 -0
- package/src/api/intercom-bridge.d.ts.map +1 -0
- package/src/api/intercom-bridge.js +2 -0
- package/src/api/intercom-bridge.js.map +1 -0
- package/src/api/preflight.d.ts +173 -0
- package/src/api/preflight.d.ts.map +1 -0
- package/src/api/preflight.js +362 -0
- package/src/api/preflight.js.map +1 -0
- package/src/api/project-panes.d.ts +8 -0
- package/src/api/project-panes.d.ts.map +1 -0
- package/src/api/project-panes.js +8 -0
- package/src/api/project-panes.js.map +1 -0
- package/src/api/required-child-extensions.d.ts +2 -0
- package/src/api/required-child-extensions.d.ts.map +1 -0
- package/src/api/required-child-extensions.js +2 -0
- package/src/api/required-child-extensions.js.map +1 -0
- package/src/api/shared-types.d.ts +2 -0
- package/src/api/shared-types.d.ts.map +1 -0
- package/src/api/shared-types.js +2 -0
- package/src/api/shared-types.js.map +1 -0
- package/src/api/workflow-resources.d.ts +3 -0
- package/src/api/workflow-resources.d.ts.map +1 -0
- package/src/api/workflow-resources.js +2 -0
- package/src/api/workflow-resources.js.map +1 -0
- package/src/extension/config.d.ts +8 -0
- package/src/extension/config.d.ts.map +1 -0
- package/src/extension/config.js +245 -0
- package/src/extension/config.js.map +1 -0
- package/src/extension/control-notices.d.ts +19 -0
- package/src/extension/control-notices.d.ts.map +1 -0
- package/src/extension/control-notices.js +34 -0
- package/src/extension/control-notices.js.map +1 -0
- package/src/extension/doctor.d.ts +33 -0
- package/src/extension/doctor.d.ts.map +1 -0
- package/src/extension/doctor.js +231 -0
- package/src/extension/doctor.js.map +1 -0
- package/src/extension/fanout-child.d.ts +7 -0
- package/src/extension/fanout-child.d.ts.map +1 -0
- package/src/extension/fanout-child.js +261 -0
- package/src/extension/fanout-child.js.map +1 -0
- package/src/extension/herdr-pi-bridge.d.ts +17 -0
- package/src/extension/herdr-pi-bridge.d.ts.map +1 -0
- package/src/extension/herdr-pi-bridge.js +243 -0
- package/src/extension/herdr-pi-bridge.js.map +1 -0
- package/src/extension/index.d.ts +20 -0
- package/src/extension/index.d.ts.map +1 -0
- package/src/extension/index.js +1108 -0
- package/src/extension/index.js.map +1 -0
- package/src/extension/public-execution.d.ts +62 -0
- package/src/extension/public-execution.d.ts.map +1 -0
- package/src/extension/public-execution.js +174 -0
- package/src/extension/public-execution.js.map +1 -0
- package/src/extension/rpc.d.ts +83 -0
- package/src/extension/rpc.d.ts.map +1 -0
- package/src/extension/rpc.js +687 -0
- package/src/extension/rpc.js.map +1 -0
- package/src/extension/schemas.d.ts +252 -0
- package/src/extension/schemas.d.ts.map +1 -0
- package/src/extension/schemas.js +396 -0
- package/src/extension/schemas.js.map +1 -0
- package/src/extension/steering-notices.d.ts +15 -0
- package/src/extension/steering-notices.d.ts.map +1 -0
- package/src/extension/steering-notices.js +23 -0
- package/src/extension/steering-notices.js.map +1 -0
- package/src/extension/subagent-guide.d.ts +4 -0
- package/src/extension/subagent-guide.d.ts.map +1 -0
- package/src/extension/subagent-guide.js +35 -0
- package/src/extension/subagent-guide.js.map +1 -0
- package/src/extension/tool-description.d.ts +20 -0
- package/src/extension/tool-description.d.ts.map +1 -0
- package/src/extension/tool-description.js +160 -0
- package/src/extension/tool-description.js.map +1 -0
- package/src/extension/tool-result.d.ts +10 -0
- package/src/extension/tool-result.d.ts.map +1 -0
- package/src/extension/tool-result.js +17 -0
- package/src/extension/tool-result.js.map +1 -0
- package/src/inspectors/actions.d.ts +23 -0
- package/src/inspectors/actions.d.ts.map +1 -0
- package/src/inspectors/actions.js +155 -0
- package/src/inspectors/actions.js.map +1 -0
- package/src/inspectors/ghostty/actions.d.ts +12 -0
- package/src/inspectors/ghostty/actions.d.ts.map +1 -0
- package/src/inspectors/ghostty/actions.js +63 -0
- package/src/inspectors/ghostty/actions.js.map +1 -0
- package/src/inspectors/ghostty/plugin.d.ts +8 -0
- package/src/inspectors/ghostty/plugin.d.ts.map +1 -0
- package/src/inspectors/ghostty/plugin.js +24 -0
- package/src/inspectors/ghostty/plugin.js.map +1 -0
- package/src/inspectors/herdr/actions.d.ts +26 -0
- package/src/inspectors/herdr/actions.d.ts.map +1 -0
- package/src/inspectors/herdr/actions.js +134 -0
- package/src/inspectors/herdr/actions.js.map +1 -0
- package/src/inspectors/herdr/client.d.ts +42 -0
- package/src/inspectors/herdr/client.d.ts.map +1 -0
- package/src/inspectors/herdr/client.js +130 -0
- package/src/inspectors/herdr/client.js.map +1 -0
- package/src/inspectors/herdr/focus.d.ts +25 -0
- package/src/inspectors/herdr/focus.d.ts.map +1 -0
- package/src/inspectors/herdr/focus.js +50 -0
- package/src/inspectors/herdr/focus.js.map +1 -0
- package/src/inspectors/herdr/plugin.d.ts +7 -0
- package/src/inspectors/herdr/plugin.d.ts.map +1 -0
- package/src/inspectors/herdr/plugin.js +15 -0
- package/src/inspectors/herdr/plugin.js.map +1 -0
- package/src/inspectors/herdr/project-panes.d.ts +137 -0
- package/src/inspectors/herdr/project-panes.d.ts.map +1 -0
- package/src/inspectors/herdr/project-panes.js +608 -0
- package/src/inspectors/herdr/project-panes.js.map +1 -0
- package/src/inspectors/inspector-runner.d.ts +24 -0
- package/src/inspectors/inspector-runner.d.ts.map +1 -0
- package/src/inspectors/inspector-runner.js +162 -0
- package/src/inspectors/inspector-runner.js.map +1 -0
- package/src/inspectors/plugins.d.ts +4 -0
- package/src/inspectors/plugins.d.ts.map +1 -0
- package/src/inspectors/plugins.js +7 -0
- package/src/inspectors/plugins.js.map +1 -0
- package/src/inspectors/session-roots-codec.d.ts +16 -0
- package/src/inspectors/session-roots-codec.d.ts.map +1 -0
- package/src/inspectors/session-roots-codec.js +33 -0
- package/src/inspectors/session-roots-codec.js.map +1 -0
- package/src/inspectors/shell-command.d.ts +2 -0
- package/src/inspectors/shell-command.d.ts.map +1 -0
- package/src/inspectors/shell-command.js +17 -0
- package/src/inspectors/shell-command.js.map +1 -0
- package/src/inspectors/types.d.ts +49 -0
- package/src/inspectors/types.d.ts.map +1 -0
- package/src/inspectors/types.js +2 -0
- package/src/inspectors/types.js.map +1 -0
- package/src/integrations/herdr-status.d.ts +46 -0
- package/src/integrations/herdr-status.d.ts.map +1 -0
- package/src/integrations/herdr-status.js +371 -0
- package/src/integrations/herdr-status.js.map +1 -0
- package/src/integrations/pi-web-session-liveness.d.ts +20 -0
- package/src/integrations/pi-web-session-liveness.d.ts.map +1 -0
- package/src/integrations/pi-web-session-liveness.js +54 -0
- package/src/integrations/pi-web-session-liveness.js.map +1 -0
- package/src/intercom/intercom-bridge.d.ts +59 -0
- package/src/intercom/intercom-bridge.d.ts.map +1 -0
- package/src/intercom/intercom-bridge.js +192 -0
- package/src/intercom/intercom-bridge.js.map +1 -0
- package/src/intercom/native-supervisor-channel.d.ts +64 -0
- package/src/intercom/native-supervisor-channel.d.ts.map +1 -0
- package/src/intercom/native-supervisor-channel.js +894 -0
- package/src/intercom/native-supervisor-channel.js.map +1 -0
- package/src/intercom/result-intercom.d.ts +36 -0
- package/src/intercom/result-intercom.d.ts.map +1 -0
- package/src/intercom/result-intercom.js +372 -0
- package/src/intercom/result-intercom.js.map +1 -0
- package/src/intercom/supervisor-ui.d.ts +40 -0
- package/src/intercom/supervisor-ui.d.ts.map +1 -0
- package/src/intercom/supervisor-ui.js +202 -0
- package/src/intercom/supervisor-ui.js.map +1 -0
- package/src/missions/actions.d.ts +55 -0
- package/src/missions/actions.d.ts.map +1 -0
- package/src/missions/actions.js +396 -0
- package/src/missions/actions.js.map +1 -0
- package/src/missions/goal-driver.d.ts +16 -0
- package/src/missions/goal-driver.d.ts.map +1 -0
- package/src/missions/goal-driver.js +157 -0
- package/src/missions/goal-driver.js.map +1 -0
- package/src/missions/lifecycle.d.ts +40 -0
- package/src/missions/lifecycle.d.ts.map +1 -0
- package/src/missions/lifecycle.js +352 -0
- package/src/missions/lifecycle.js.map +1 -0
- package/src/missions/store.d.ts +22 -0
- package/src/missions/store.d.ts.map +1 -0
- package/src/missions/store.js +573 -0
- package/src/missions/store.js.map +1 -0
- package/src/missions/types.d.ts +168 -0
- package/src/missions/types.d.ts.map +1 -0
- package/src/missions/types.js +10 -0
- package/src/missions/types.js.map +1 -0
- package/src/missions/workflow-state.d.ts +15 -0
- package/src/missions/workflow-state.d.ts.map +1 -0
- package/src/missions/workflow-state.js +274 -0
- package/src/missions/workflow-state.js.map +1 -0
- package/src/policy/authority.d.ts +10 -0
- package/src/policy/authority.d.ts.map +1 -0
- package/src/policy/authority.js +42 -0
- package/src/policy/authority.js.map +1 -0
- package/src/profiles/profiles.d.ts +135 -0
- package/src/profiles/profiles.d.ts.map +1 -0
- package/src/profiles/profiles.js +520 -0
- package/src/profiles/profiles.js.map +1 -0
- package/src/runs/background/active-async-capacity.d.ts +100 -0
- package/src/runs/background/active-async-capacity.d.ts.map +1 -0
- package/src/runs/background/active-async-capacity.js +492 -0
- package/src/runs/background/active-async-capacity.js.map +1 -0
- package/src/runs/background/active-run-index.d.ts +13 -0
- package/src/runs/background/active-run-index.d.ts.map +1 -0
- package/src/runs/background/active-run-index.js +158 -0
- package/src/runs/background/active-run-index.js.map +1 -0
- package/src/runs/background/async-execution.d.ts +274 -0
- package/src/runs/background/async-execution.d.ts.map +1 -0
- package/src/runs/background/async-execution.js +1989 -0
- package/src/runs/background/async-execution.js.map +1 -0
- package/src/runs/background/async-job-tracker.d.ts +28 -0
- package/src/runs/background/async-job-tracker.d.ts.map +1 -0
- package/src/runs/background/async-job-tracker.js +876 -0
- package/src/runs/background/async-job-tracker.js.map +1 -0
- package/src/runs/background/async-resume.d.ts +59 -0
- package/src/runs/background/async-resume.d.ts.map +1 -0
- package/src/runs/background/async-resume.js +670 -0
- package/src/runs/background/async-resume.js.map +1 -0
- package/src/runs/background/async-retention.d.ts +45 -0
- package/src/runs/background/async-retention.d.ts.map +1 -0
- package/src/runs/background/async-retention.js +884 -0
- package/src/runs/background/async-retention.js.map +1 -0
- package/src/runs/background/async-status-snapshot.d.ts +10 -0
- package/src/runs/background/async-status-snapshot.d.ts.map +1 -0
- package/src/runs/background/async-status-snapshot.js +25 -0
- package/src/runs/background/async-status-snapshot.js.map +1 -0
- package/src/runs/background/async-status.d.ts +169 -0
- package/src/runs/background/async-status.d.ts.map +1 -0
- package/src/runs/background/async-status.js +673 -0
- package/src/runs/background/async-status.js.map +1 -0
- package/src/runs/background/auto-drain.d.ts +17 -0
- package/src/runs/background/auto-drain.d.ts.map +1 -0
- package/src/runs/background/auto-drain.js +73 -0
- package/src/runs/background/auto-drain.js.map +1 -0
- package/src/runs/background/binary-bootstrap.d.ts +9 -0
- package/src/runs/background/binary-bootstrap.d.ts.map +1 -0
- package/src/runs/background/binary-bootstrap.js +41 -0
- package/src/runs/background/binary-bootstrap.js.map +1 -0
- package/src/runs/background/chain-append.d.ts +35 -0
- package/src/runs/background/chain-append.d.ts.map +1 -0
- package/src/runs/background/chain-append.js +300 -0
- package/src/runs/background/chain-append.js.map +1 -0
- package/src/runs/background/chain-root-attachment.d.ts +49 -0
- package/src/runs/background/chain-root-attachment.d.ts.map +1 -0
- package/src/runs/background/chain-root-attachment.js +184 -0
- package/src/runs/background/chain-root-attachment.js.map +1 -0
- package/src/runs/background/completion-batcher.d.ts +52 -0
- package/src/runs/background/completion-batcher.d.ts.map +1 -0
- package/src/runs/background/completion-batcher.js +120 -0
- package/src/runs/background/completion-batcher.js.map +1 -0
- package/src/runs/background/completion-dedupe.d.ts +14 -0
- package/src/runs/background/completion-dedupe.d.ts.map +1 -0
- package/src/runs/background/completion-dedupe.js +49 -0
- package/src/runs/background/completion-dedupe.js.map +1 -0
- package/src/runs/background/completion-replay.d.ts +48 -0
- package/src/runs/background/completion-replay.d.ts.map +1 -0
- package/src/runs/background/completion-replay.js +267 -0
- package/src/runs/background/completion-replay.js.map +1 -0
- package/src/runs/background/control-channel.d.ts +156 -0
- package/src/runs/background/control-channel.d.ts.map +1 -0
- package/src/runs/background/control-channel.js +521 -0
- package/src/runs/background/control-channel.js.map +1 -0
- package/src/runs/background/fleet-view.d.ts +64 -0
- package/src/runs/background/fleet-view.d.ts.map +1 -0
- package/src/runs/background/fleet-view.js +648 -0
- package/src/runs/background/fleet-view.js.map +1 -0
- package/src/runs/background/index-segment.d.ts +16 -0
- package/src/runs/background/index-segment.d.ts.map +1 -0
- package/src/runs/background/index-segment.js +59 -0
- package/src/runs/background/index-segment.js.map +1 -0
- package/src/runs/background/inspect-rpc.d.ts +60 -0
- package/src/runs/background/inspect-rpc.d.ts.map +1 -0
- package/src/runs/background/inspect-rpc.js +406 -0
- package/src/runs/background/inspect-rpc.js.map +1 -0
- package/src/runs/background/notify.d.ts +162 -0
- package/src/runs/background/notify.d.ts.map +1 -0
- package/src/runs/background/notify.js +665 -0
- package/src/runs/background/notify.js.map +1 -0
- package/src/runs/background/owned-process-tree.d.ts +11 -0
- package/src/runs/background/owned-process-tree.d.ts.map +1 -0
- package/src/runs/background/owned-process-tree.js +117 -0
- package/src/runs/background/owned-process-tree.js.map +1 -0
- package/src/runs/background/parallel-groups.d.ts +4 -0
- package/src/runs/background/parallel-groups.d.ts.map +1 -0
- package/src/runs/background/parallel-groups.js +47 -0
- package/src/runs/background/parallel-groups.js.map +1 -0
- package/src/runs/background/process-terminal.d.ts +34 -0
- package/src/runs/background/process-terminal.d.ts.map +1 -0
- package/src/runs/background/process-terminal.js +305 -0
- package/src/runs/background/process-terminal.js.map +1 -0
- package/src/runs/background/result-delivery-ownership.d.ts +11 -0
- package/src/runs/background/result-delivery-ownership.d.ts.map +1 -0
- package/src/runs/background/result-delivery-ownership.js +37 -0
- package/src/runs/background/result-delivery-ownership.js.map +1 -0
- package/src/runs/background/result-files.d.ts +33 -0
- package/src/runs/background/result-files.d.ts.map +1 -0
- package/src/runs/background/result-files.js +528 -0
- package/src/runs/background/result-files.js.map +1 -0
- package/src/runs/background/result-watcher.d.ts +87 -0
- package/src/runs/background/result-watcher.d.ts.map +1 -0
- package/src/runs/background/result-watcher.js +764 -0
- package/src/runs/background/result-watcher.js.map +1 -0
- package/src/runs/background/resume-guidance.d.ts +5 -0
- package/src/runs/background/resume-guidance.d.ts.map +1 -0
- package/src/runs/background/resume-guidance.js +57 -0
- package/src/runs/background/resume-guidance.js.map +1 -0
- package/src/runs/background/retained-children.d.ts +25 -0
- package/src/runs/background/retained-children.d.ts.map +1 -0
- package/src/runs/background/retained-children.js +128 -0
- package/src/runs/background/retained-children.js.map +1 -0
- package/src/runs/background/retained-nested-route-tracker.d.ts +13 -0
- package/src/runs/background/retained-nested-route-tracker.d.ts.map +1 -0
- package/src/runs/background/retained-nested-route-tracker.js +91 -0
- package/src/runs/background/retained-nested-route-tracker.js.map +1 -0
- package/src/runs/background/run-child-session.d.ts +123 -0
- package/src/runs/background/run-child-session.d.ts.map +1 -0
- package/src/runs/background/run-child-session.js +602 -0
- package/src/runs/background/run-child-session.js.map +1 -0
- package/src/runs/background/run-id-query.d.ts +4 -0
- package/src/runs/background/run-id-query.d.ts.map +1 -0
- package/src/runs/background/run-id-query.js +7 -0
- package/src/runs/background/run-id-query.js.map +1 -0
- package/src/runs/background/run-id-resolver.d.ts +23 -0
- package/src/runs/background/run-id-resolver.d.ts.map +1 -0
- package/src/runs/background/run-id-resolver.js +170 -0
- package/src/runs/background/run-id-resolver.js.map +1 -0
- package/src/runs/background/run-status.d.ts +26 -0
- package/src/runs/background/run-status.d.ts.map +1 -0
- package/src/runs/background/run-status.js +826 -0
- package/src/runs/background/run-status.js.map +1 -0
- package/src/runs/background/runner-aliases.d.ts +17 -0
- package/src/runs/background/runner-aliases.d.ts.map +1 -0
- package/src/runs/background/runner-aliases.js +141 -0
- package/src/runs/background/runner-aliases.js.map +1 -0
- package/src/runs/background/runner-child-launch.d.ts +24 -0
- package/src/runs/background/runner-child-launch.d.ts.map +1 -0
- package/src/runs/background/runner-child-launch.js +68 -0
- package/src/runs/background/runner-child-launch.js.map +1 -0
- package/src/runs/background/runner-child-sessions.d.ts +7 -0
- package/src/runs/background/runner-child-sessions.d.ts.map +1 -0
- package/src/runs/background/runner-child-sessions.js +35 -0
- package/src/runs/background/runner-child-sessions.js.map +1 -0
- package/src/runs/background/runner-http-dispatcher.d.ts +43 -0
- package/src/runs/background/runner-http-dispatcher.d.ts.map +1 -0
- package/src/runs/background/runner-http-dispatcher.js +114 -0
- package/src/runs/background/runner-http-dispatcher.js.map +1 -0
- package/src/runs/background/scheduled-runs.d.ts +116 -0
- package/src/runs/background/scheduled-runs.d.ts.map +1 -0
- package/src/runs/background/scheduled-runs.js +1024 -0
- package/src/runs/background/scheduled-runs.js.map +1 -0
- package/src/runs/background/stale-run-reconciler.d.ts +37 -0
- package/src/runs/background/stale-run-reconciler.d.ts.map +1 -0
- package/src/runs/background/stale-run-reconciler.js +393 -0
- package/src/runs/background/stale-run-reconciler.js.map +1 -0
- package/src/runs/background/steering.d.ts +52 -0
- package/src/runs/background/steering.d.ts.map +1 -0
- package/src/runs/background/steering.js +247 -0
- package/src/runs/background/steering.js.map +1 -0
- package/src/runs/background/subagent-runner.d.ts +201 -0
- package/src/runs/background/subagent-runner.d.ts.map +1 -0
- package/src/runs/background/subagent-runner.js +5134 -0
- package/src/runs/background/subagent-runner.js.map +1 -0
- package/src/runs/background/subagent-wait.d.ts +122 -0
- package/src/runs/background/subagent-wait.d.ts.map +1 -0
- package/src/runs/background/subagent-wait.js +735 -0
- package/src/runs/background/subagent-wait.js.map +1 -0
- package/src/runs/background/terminal-run-index.d.ts +8 -0
- package/src/runs/background/terminal-run-index.d.ts.map +1 -0
- package/src/runs/background/terminal-run-index.js +123 -0
- package/src/runs/background/terminal-run-index.js.map +1 -0
- package/src/runs/background/top-level-async.d.ts +8 -0
- package/src/runs/background/top-level-async.d.ts.map +1 -0
- package/src/runs/background/top-level-async.js +6 -0
- package/src/runs/background/top-level-async.js.map +1 -0
- package/src/runs/background/wait-completions.d.ts +29 -0
- package/src/runs/background/wait-completions.d.ts.map +1 -0
- package/src/runs/background/wait-completions.js +264 -0
- package/src/runs/background/wait-completions.js.map +1 -0
- package/src/runs/background/wait-config.d.ts +9 -0
- package/src/runs/background/wait-config.d.ts.map +1 -0
- package/src/runs/background/wait-config.js +47 -0
- package/src/runs/background/wait-config.js.map +1 -0
- package/src/runs/background/wait-subscriptions.d.ts +27 -0
- package/src/runs/background/wait-subscriptions.d.ts.map +1 -0
- package/src/runs/background/wait-subscriptions.js +337 -0
- package/src/runs/background/wait-subscriptions.js.map +1 -0
- package/src/runs/background/wait-tool.d.ts +7 -0
- package/src/runs/background/wait-tool.d.ts.map +1 -0
- package/src/runs/background/wait-tool.js +36 -0
- package/src/runs/background/wait-tool.js.map +1 -0
- package/src/runs/foreground/async-dismiss-action.d.ts +7 -0
- package/src/runs/foreground/async-dismiss-action.d.ts.map +1 -0
- package/src/runs/foreground/async-dismiss-action.js +82 -0
- package/src/runs/foreground/async-dismiss-action.js.map +1 -0
- package/src/runs/foreground/async-steering-action.d.ts +32 -0
- package/src/runs/foreground/async-steering-action.d.ts.map +1 -0
- package/src/runs/foreground/async-steering-action.js +270 -0
- package/src/runs/foreground/async-steering-action.js.map +1 -0
- package/src/runs/foreground/async-stop-action.d.ts +7 -0
- package/src/runs/foreground/async-stop-action.d.ts.map +1 -0
- package/src/runs/foreground/async-stop-action.js +171 -0
- package/src/runs/foreground/async-stop-action.js.map +1 -0
- package/src/runs/foreground/execution.d.ts +11 -0
- package/src/runs/foreground/execution.d.ts.map +1 -0
- package/src/runs/foreground/execution.js +2186 -0
- package/src/runs/foreground/execution.js.map +1 -0
- package/src/runs/foreground/foreground-control.d.ts +25 -0
- package/src/runs/foreground/foreground-control.d.ts.map +1 -0
- package/src/runs/foreground/foreground-control.js +139 -0
- package/src/runs/foreground/foreground-control.js.map +1 -0
- package/src/runs/foreground/foreground-history.d.ts +12 -0
- package/src/runs/foreground/foreground-history.d.ts.map +1 -0
- package/src/runs/foreground/foreground-history.js +165 -0
- package/src/runs/foreground/foreground-history.js.map +1 -0
- package/src/runs/foreground/prompt-audit.d.ts +33 -0
- package/src/runs/foreground/prompt-audit.d.ts.map +1 -0
- package/src/runs/foreground/prompt-audit.js +143 -0
- package/src/runs/foreground/prompt-audit.js.map +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +296 -0
- package/src/runs/foreground/subagent-executor.d.ts.map +1 -0
- package/src/runs/foreground/subagent-executor.js +7047 -0
- package/src/runs/foreground/subagent-executor.js.map +1 -0
- package/src/runs/foreground/workflow-detach-reconcile.d.ts +16 -0
- package/src/runs/foreground/workflow-detach-reconcile.d.ts.map +1 -0
- package/src/runs/foreground/workflow-detach-reconcile.js +284 -0
- package/src/runs/foreground/workflow-detach-reconcile.js.map +1 -0
- package/src/runs/foreground/workflow-foreground-steering.d.ts +44 -0
- package/src/runs/foreground/workflow-foreground-steering.d.ts.map +1 -0
- package/src/runs/foreground/workflow-foreground-steering.js +149 -0
- package/src/runs/foreground/workflow-foreground-steering.js.map +1 -0
- package/src/runs/shared/abort-recovery.d.ts +27 -0
- package/src/runs/shared/abort-recovery.d.ts.map +1 -0
- package/src/runs/shared/abort-recovery.js +109 -0
- package/src/runs/shared/abort-recovery.js.map +1 -0
- package/src/runs/shared/acceptance.d.ts +145 -0
- package/src/runs/shared/acceptance.d.ts.map +1 -0
- package/src/runs/shared/acceptance.js +1650 -0
- package/src/runs/shared/acceptance.js.map +1 -0
- package/src/runs/shared/agent-contract.d.ts +6 -0
- package/src/runs/shared/agent-contract.d.ts.map +1 -0
- package/src/runs/shared/agent-contract.js +36 -0
- package/src/runs/shared/agent-contract.js.map +1 -0
- package/src/runs/shared/async-status-projection.d.ts +94 -0
- package/src/runs/shared/async-status-projection.d.ts.map +1 -0
- package/src/runs/shared/async-status-projection.js +542 -0
- package/src/runs/shared/async-status-projection.js.map +1 -0
- package/src/runs/shared/background-process-options.d.ts +5 -0
- package/src/runs/shared/background-process-options.d.ts.map +1 -0
- package/src/runs/shared/background-process-options.js +7 -0
- package/src/runs/shared/background-process-options.js.map +1 -0
- package/src/runs/shared/capability-ceiling.d.ts +58 -0
- package/src/runs/shared/capability-ceiling.d.ts.map +1 -0
- package/src/runs/shared/capability-ceiling.js +179 -0
- package/src/runs/shared/capability-ceiling.js.map +1 -0
- package/src/runs/shared/chain-outputs.d.ts +19 -0
- package/src/runs/shared/chain-outputs.d.ts.map +1 -0
- package/src/runs/shared/chain-outputs.js +105 -0
- package/src/runs/shared/chain-outputs.js.map +1 -0
- package/src/runs/shared/child-hooks.d.ts +34 -0
- package/src/runs/shared/child-hooks.d.ts.map +1 -0
- package/src/runs/shared/child-hooks.js +188 -0
- package/src/runs/shared/child-hooks.js.map +1 -0
- package/src/runs/shared/child-identity.d.ts +24 -0
- package/src/runs/shared/child-identity.d.ts.map +1 -0
- package/src/runs/shared/child-identity.js +41 -0
- package/src/runs/shared/child-identity.js.map +1 -0
- package/src/runs/shared/child-launch-plan.d.ts +71 -0
- package/src/runs/shared/child-launch-plan.d.ts.map +1 -0
- package/src/runs/shared/child-launch-plan.js +89 -0
- package/src/runs/shared/child-launch-plan.js.map +1 -0
- package/src/runs/shared/child-launch.d.ts +114 -0
- package/src/runs/shared/child-launch.d.ts.map +1 -0
- package/src/runs/shared/child-launch.js +231 -0
- package/src/runs/shared/child-launch.js.map +1 -0
- package/src/runs/shared/child-lifecycle.d.ts +14 -0
- package/src/runs/shared/child-lifecycle.d.ts.map +1 -0
- package/src/runs/shared/child-lifecycle.js +23 -0
- package/src/runs/shared/child-lifecycle.js.map +1 -0
- package/src/runs/shared/child-runtime-config.d.ts +102 -0
- package/src/runs/shared/child-runtime-config.d.ts.map +1 -0
- package/src/runs/shared/child-runtime-config.js +39 -0
- package/src/runs/shared/child-runtime-config.js.map +1 -0
- package/src/runs/shared/child-session.d.ts +155 -0
- package/src/runs/shared/child-session.d.ts.map +1 -0
- package/src/runs/shared/child-session.js +347 -0
- package/src/runs/shared/child-session.js.map +1 -0
- package/src/runs/shared/child-tool-plan.d.ts +73 -0
- package/src/runs/shared/child-tool-plan.d.ts.map +1 -0
- package/src/runs/shared/child-tool-plan.js +380 -0
- package/src/runs/shared/child-tool-plan.js.map +1 -0
- package/src/runs/shared/claude-code-adapter.d.ts +25 -0
- package/src/runs/shared/claude-code-adapter.d.ts.map +1 -0
- package/src/runs/shared/claude-code-adapter.js +120 -0
- package/src/runs/shared/claude-code-adapter.js.map +1 -0
- package/src/runs/shared/codex-exec-adapter.d.ts +26 -0
- package/src/runs/shared/codex-exec-adapter.d.ts.map +1 -0
- package/src/runs/shared/codex-exec-adapter.js +128 -0
- package/src/runs/shared/codex-exec-adapter.js.map +1 -0
- package/src/runs/shared/completion-evidence.d.ts +31 -0
- package/src/runs/shared/completion-evidence.d.ts.map +1 -0
- package/src/runs/shared/completion-evidence.js +54 -0
- package/src/runs/shared/completion-evidence.js.map +1 -0
- package/src/runs/shared/completion-guard.d.ts +35 -0
- package/src/runs/shared/completion-guard.d.ts.map +1 -0
- package/src/runs/shared/completion-guard.js +214 -0
- package/src/runs/shared/completion-guard.js.map +1 -0
- package/src/runs/shared/context-mode.d.ts +13 -0
- package/src/runs/shared/context-mode.d.ts.map +1 -0
- package/src/runs/shared/context-mode.js +39 -0
- package/src/runs/shared/context-mode.js.map +1 -0
- package/src/runs/shared/cursor-agent-adapter.d.ts +27 -0
- package/src/runs/shared/cursor-agent-adapter.d.ts.map +1 -0
- package/src/runs/shared/cursor-agent-adapter.js +100 -0
- package/src/runs/shared/cursor-agent-adapter.js.map +1 -0
- package/src/runs/shared/dynamic-fanout.d.ts +50 -0
- package/src/runs/shared/dynamic-fanout.d.ts.map +1 -0
- package/src/runs/shared/dynamic-fanout.js +274 -0
- package/src/runs/shared/dynamic-fanout.js.map +1 -0
- package/src/runs/shared/effective-system-prompt.d.ts +18 -0
- package/src/runs/shared/effective-system-prompt.d.ts.map +1 -0
- package/src/runs/shared/effective-system-prompt.js +23 -0
- package/src/runs/shared/effective-system-prompt.js.map +1 -0
- package/src/runs/shared/extension-bindings.d.ts +17 -0
- package/src/runs/shared/extension-bindings.d.ts.map +1 -0
- package/src/runs/shared/extension-bindings.js +83 -0
- package/src/runs/shared/extension-bindings.js.map +1 -0
- package/src/runs/shared/external-cli-contract.d.ts +30 -0
- package/src/runs/shared/external-cli-contract.d.ts.map +1 -0
- package/src/runs/shared/external-cli-contract.js +146 -0
- package/src/runs/shared/external-cli-contract.js.map +1 -0
- package/src/runs/shared/external-cli-preflight.d.ts +32 -0
- package/src/runs/shared/external-cli-preflight.d.ts.map +1 -0
- package/src/runs/shared/external-cli-preflight.js +116 -0
- package/src/runs/shared/external-cli-preflight.js.map +1 -0
- package/src/runs/shared/external-cli-runner.d.ts +66 -0
- package/src/runs/shared/external-cli-runner.d.ts.map +1 -0
- package/src/runs/shared/external-cli-runner.js +421 -0
- package/src/runs/shared/external-cli-runner.js.map +1 -0
- package/src/runs/shared/external-job-bridge.d.ts +18 -0
- package/src/runs/shared/external-job-bridge.d.ts.map +1 -0
- package/src/runs/shared/external-job-bridge.js +424 -0
- package/src/runs/shared/external-job-bridge.js.map +1 -0
- package/src/runs/shared/external-job-runner.d.ts +45 -0
- package/src/runs/shared/external-job-runner.d.ts.map +1 -0
- package/src/runs/shared/external-job-runner.js +353 -0
- package/src/runs/shared/external-job-runner.js.map +1 -0
- package/src/runs/shared/fast-mode-extension.d.ts +4 -0
- package/src/runs/shared/fast-mode-extension.d.ts.map +1 -0
- package/src/runs/shared/fast-mode-extension.js +9 -0
- package/src/runs/shared/fast-mode-extension.js.map +1 -0
- package/src/runs/shared/herdr-connection.d.ts +71 -0
- package/src/runs/shared/herdr-connection.d.ts.map +1 -0
- package/src/runs/shared/herdr-connection.js +258 -0
- package/src/runs/shared/herdr-connection.js.map +1 -0
- package/src/runs/shared/herdr-external-adapters.d.ts +148 -0
- package/src/runs/shared/herdr-external-adapters.d.ts.map +1 -0
- package/src/runs/shared/herdr-external-adapters.js +405 -0
- package/src/runs/shared/herdr-external-adapters.js.map +1 -0
- package/src/runs/shared/herdr-machine.d.ts +48 -0
- package/src/runs/shared/herdr-machine.d.ts.map +1 -0
- package/src/runs/shared/herdr-machine.js +247 -0
- package/src/runs/shared/herdr-machine.js.map +1 -0
- package/src/runs/shared/herdr-pi-protocol.d.ts +22 -0
- package/src/runs/shared/herdr-pi-protocol.d.ts.map +1 -0
- package/src/runs/shared/herdr-pi-protocol.js +58 -0
- package/src/runs/shared/herdr-pi-protocol.js.map +1 -0
- package/src/runs/shared/herdr-placed-run.d.ts +267 -0
- package/src/runs/shared/herdr-placed-run.d.ts.map +1 -0
- package/src/runs/shared/herdr-placed-run.js +716 -0
- package/src/runs/shared/herdr-placed-run.js.map +1 -0
- package/src/runs/shared/host-step-status.d.ts +34 -0
- package/src/runs/shared/host-step-status.d.ts.map +1 -0
- package/src/runs/shared/host-step-status.js +245 -0
- package/src/runs/shared/host-step-status.js.map +1 -0
- package/src/runs/shared/lane-metadata.d.ts +24 -0
- package/src/runs/shared/lane-metadata.d.ts.map +1 -0
- package/src/runs/shared/lane-metadata.js +127 -0
- package/src/runs/shared/lane-metadata.js.map +1 -0
- package/src/runs/shared/launch-cwd.d.ts +2 -0
- package/src/runs/shared/launch-cwd.d.ts.map +1 -0
- package/src/runs/shared/launch-cwd.js +17 -0
- package/src/runs/shared/launch-cwd.js.map +1 -0
- package/src/runs/shared/llm-intent-arbiter.d.ts +48 -0
- package/src/runs/shared/llm-intent-arbiter.d.ts.map +1 -0
- package/src/runs/shared/llm-intent-arbiter.js +235 -0
- package/src/runs/shared/llm-intent-arbiter.js.map +1 -0
- package/src/runs/shared/long-running-guard.d.ts +33 -0
- package/src/runs/shared/long-running-guard.d.ts.map +1 -0
- package/src/runs/shared/long-running-guard.js +199 -0
- package/src/runs/shared/long-running-guard.js.map +1 -0
- package/src/runs/shared/mcp-config-sources.d.ts +30 -0
- package/src/runs/shared/mcp-config-sources.d.ts.map +1 -0
- package/src/runs/shared/mcp-config-sources.js +419 -0
- package/src/runs/shared/mcp-config-sources.js.map +1 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +59 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts.map +1 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.js +400 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.js.map +1 -0
- package/src/runs/shared/mcp-direct-tool-grant.d.ts +41 -0
- package/src/runs/shared/mcp-direct-tool-grant.d.ts.map +1 -0
- package/src/runs/shared/mcp-direct-tool-grant.js +146 -0
- package/src/runs/shared/mcp-direct-tool-grant.js.map +1 -0
- package/src/runs/shared/model-resolution-diagnostic.d.ts +22 -0
- package/src/runs/shared/model-resolution-diagnostic.d.ts.map +1 -0
- package/src/runs/shared/model-resolution-diagnostic.js +65 -0
- package/src/runs/shared/model-resolution-diagnostic.js.map +1 -0
- package/src/runs/shared/model-resolution.d.ts +92 -0
- package/src/runs/shared/model-resolution.d.ts.map +1 -0
- package/src/runs/shared/model-resolution.js +343 -0
- package/src/runs/shared/model-resolution.js.map +1 -0
- package/src/runs/shared/model-scope.d.ts +68 -0
- package/src/runs/shared/model-scope.d.ts.map +1 -0
- package/src/runs/shared/model-scope.js +156 -0
- package/src/runs/shared/model-scope.js.map +1 -0
- package/src/runs/shared/mutation-evidence.d.ts +19 -0
- package/src/runs/shared/mutation-evidence.d.ts.map +1 -0
- package/src/runs/shared/mutation-evidence.js +199 -0
- package/src/runs/shared/mutation-evidence.js.map +1 -0
- package/src/runs/shared/nested-events.d.ts +134 -0
- package/src/runs/shared/nested-events.d.ts.map +1 -0
- package/src/runs/shared/nested-events.js +1056 -0
- package/src/runs/shared/nested-events.js.map +1 -0
- package/src/runs/shared/nested-path.d.ts +9 -0
- package/src/runs/shared/nested-path.d.ts.map +1 -0
- package/src/runs/shared/nested-path.js +35 -0
- package/src/runs/shared/nested-path.js.map +1 -0
- package/src/runs/shared/nested-render.d.ts +21 -0
- package/src/runs/shared/nested-render.d.ts.map +1 -0
- package/src/runs/shared/nested-render.js +116 -0
- package/src/runs/shared/nested-render.js.map +1 -0
- package/src/runs/shared/orca-progress-tabs.d.ts +33 -0
- package/src/runs/shared/orca-progress-tabs.d.ts.map +1 -0
- package/src/runs/shared/orca-progress-tabs.js +527 -0
- package/src/runs/shared/orca-progress-tabs.js.map +1 -0
- package/src/runs/shared/parallel-handoff.d.ts +73 -0
- package/src/runs/shared/parallel-handoff.d.ts.map +1 -0
- package/src/runs/shared/parallel-handoff.js +733 -0
- package/src/runs/shared/parallel-handoff.js.map +1 -0
- package/src/runs/shared/parallel-utils.d.ts +165 -0
- package/src/runs/shared/parallel-utils.d.ts.map +1 -0
- package/src/runs/shared/parallel-utils.js +126 -0
- package/src/runs/shared/parallel-utils.js.map +1 -0
- package/src/runs/shared/permissions.d.ts +13 -0
- package/src/runs/shared/permissions.d.ts.map +1 -0
- package/src/runs/shared/permissions.js +93 -0
- package/src/runs/shared/permissions.js.map +1 -0
- package/src/runs/shared/pi-spawn.d.ts +28 -0
- package/src/runs/shared/pi-spawn.d.ts.map +1 -0
- package/src/runs/shared/pi-spawn.js +156 -0
- package/src/runs/shared/pi-spawn.js.map +1 -0
- package/src/runs/shared/process-signal.d.ts +16 -0
- package/src/runs/shared/process-signal.d.ts.map +1 -0
- package/src/runs/shared/process-signal.js +22 -0
- package/src/runs/shared/process-signal.js.map +1 -0
- package/src/runs/shared/readonly-drain-observation.d.ts +26 -0
- package/src/runs/shared/readonly-drain-observation.d.ts.map +1 -0
- package/src/runs/shared/readonly-drain-observation.js +51 -0
- package/src/runs/shared/readonly-drain-observation.js.map +1 -0
- package/src/runs/shared/run-fanout-budget.d.ts +15 -0
- package/src/runs/shared/run-fanout-budget.d.ts.map +1 -0
- package/src/runs/shared/run-fanout-budget.js +259 -0
- package/src/runs/shared/run-fanout-budget.js.map +1 -0
- package/src/runs/shared/run-history.d.ts +20 -0
- package/src/runs/shared/run-history.d.ts.map +1 -0
- package/src/runs/shared/run-history.js +200 -0
- package/src/runs/shared/run-history.js.map +1 -0
- package/src/runs/shared/runtime-acknowledged-extensions.d.ts +8 -0
- package/src/runs/shared/runtime-acknowledged-extensions.d.ts.map +1 -0
- package/src/runs/shared/runtime-acknowledged-extensions.js +45 -0
- package/src/runs/shared/runtime-acknowledged-extensions.js.map +1 -0
- package/src/runs/shared/session-lease.d.ts +70 -0
- package/src/runs/shared/session-lease.d.ts.map +1 -0
- package/src/runs/shared/session-lease.js +251 -0
- package/src/runs/shared/session-lease.js.map +1 -0
- package/src/runs/shared/single-output.d.ts +61 -0
- package/src/runs/shared/single-output.d.ts.map +1 -0
- package/src/runs/shared/single-output.js +263 -0
- package/src/runs/shared/single-output.js.map +1 -0
- package/src/runs/shared/spawn-budget.d.ts +21 -0
- package/src/runs/shared/spawn-budget.d.ts.map +1 -0
- package/src/runs/shared/spawn-budget.js +94 -0
- package/src/runs/shared/spawn-budget.js.map +1 -0
- package/src/runs/shared/structured-output.d.ts +57 -0
- package/src/runs/shared/structured-output.d.ts.map +1 -0
- package/src/runs/shared/structured-output.js +391 -0
- package/src/runs/shared/structured-output.js.map +1 -0
- package/src/runs/shared/subagent-control.d.ts +50 -0
- package/src/runs/shared/subagent-control.d.ts.map +1 -0
- package/src/runs/shared/subagent-control.js +247 -0
- package/src/runs/shared/subagent-control.js.map +1 -0
- package/src/runs/shared/subagent-prompt-runtime.d.ts +28 -0
- package/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -0
- package/src/runs/shared/subagent-prompt-runtime.js +548 -0
- package/src/runs/shared/subagent-prompt-runtime.js.map +1 -0
- package/src/runs/shared/task-intent.d.ts +38 -0
- package/src/runs/shared/task-intent.d.ts.map +1 -0
- package/src/runs/shared/task-intent.js +213 -0
- package/src/runs/shared/task-intent.js.map +1 -0
- package/src/runs/shared/tool-availability.d.ts +17 -0
- package/src/runs/shared/tool-availability.d.ts.map +1 -0
- package/src/runs/shared/tool-availability.js +30 -0
- package/src/runs/shared/tool-availability.js.map +1 -0
- package/src/runs/shared/tool-budget.d.ts +22 -0
- package/src/runs/shared/tool-budget.d.ts.map +1 -0
- package/src/runs/shared/tool-budget.js +79 -0
- package/src/runs/shared/tool-budget.js.map +1 -0
- package/src/runs/shared/tool-timeout.d.ts +32 -0
- package/src/runs/shared/tool-timeout.d.ts.map +1 -0
- package/src/runs/shared/tool-timeout.js +74 -0
- package/src/runs/shared/tool-timeout.js.map +1 -0
- package/src/runs/shared/usage-budget.d.ts +8 -0
- package/src/runs/shared/usage-budget.d.ts.map +1 -0
- package/src/runs/shared/usage-budget.js +75 -0
- package/src/runs/shared/usage-budget.js.map +1 -0
- package/src/runs/shared/usage-reconciliation.d.ts +9 -0
- package/src/runs/shared/usage-reconciliation.d.ts.map +1 -0
- package/src/runs/shared/usage-reconciliation.js +72 -0
- package/src/runs/shared/usage-reconciliation.js.map +1 -0
- package/src/runs/shared/workflow-async-child-guidance.d.ts +4 -0
- package/src/runs/shared/workflow-async-child-guidance.d.ts.map +1 -0
- package/src/runs/shared/workflow-async-child-guidance.js +18 -0
- package/src/runs/shared/workflow-async-child-guidance.js.map +1 -0
- package/src/runs/shared/workflow-graph.d.ts +32 -0
- package/src/runs/shared/workflow-graph.d.ts.map +1 -0
- package/src/runs/shared/workflow-graph.js +222 -0
- package/src/runs/shared/workflow-graph.js.map +1 -0
- package/src/runs/shared/worktree-cleanup-plan.d.ts +78 -0
- package/src/runs/shared/worktree-cleanup-plan.d.ts.map +1 -0
- package/src/runs/shared/worktree-cleanup-plan.js +782 -0
- package/src/runs/shared/worktree-cleanup-plan.js.map +1 -0
- package/src/runs/shared/worktree-setup-command.d.ts +39 -0
- package/src/runs/shared/worktree-setup-command.d.ts.map +1 -0
- package/src/runs/shared/worktree-setup-command.js +201 -0
- package/src/runs/shared/worktree-setup-command.js.map +1 -0
- package/src/runs/shared/worktree.d.ts +179 -0
- package/src/runs/shared/worktree.d.ts.map +1 -0
- package/src/runs/shared/worktree.js +1333 -0
- package/src/runs/shared/worktree.js.map +1 -0
- package/src/shared/accessible-dir.d.ts +12 -0
- package/src/shared/accessible-dir.d.ts.map +1 -0
- package/src/shared/accessible-dir.js +37 -0
- package/src/shared/accessible-dir.js.map +1 -0
- package/src/shared/agent-stream-options.d.ts +6 -0
- package/src/shared/agent-stream-options.d.ts.map +1 -0
- package/src/shared/agent-stream-options.js +4 -0
- package/src/shared/agent-stream-options.js.map +1 -0
- package/src/shared/artifacts.d.ts +23 -0
- package/src/shared/artifacts.d.ts.map +1 -0
- package/src/shared/artifacts.js +273 -0
- package/src/shared/artifacts.js.map +1 -0
- package/src/shared/atomic-json.d.ts +19 -0
- package/src/shared/atomic-json.d.ts.map +1 -0
- package/src/shared/atomic-json.js +60 -0
- package/src/shared/atomic-json.js.map +1 -0
- package/src/shared/capacity-resilient-json.d.ts +27 -0
- package/src/shared/capacity-resilient-json.d.ts.map +1 -0
- package/src/shared/capacity-resilient-json.js +87 -0
- package/src/shared/capacity-resilient-json.js.map +1 -0
- package/src/shared/child-cache-retention.d.ts +30 -0
- package/src/shared/child-cache-retention.d.ts.map +1 -0
- package/src/shared/child-cache-retention.js +41 -0
- package/src/shared/child-cache-retention.js.map +1 -0
- package/src/shared/child-session-name.d.ts +9 -0
- package/src/shared/child-session-name.d.ts.map +1 -0
- package/src/shared/child-session-name.js +39 -0
- package/src/shared/child-session-name.js.map +1 -0
- package/src/shared/child-transcript.d.ts +38 -0
- package/src/shared/child-transcript.d.ts.map +1 -0
- package/src/shared/child-transcript.js +226 -0
- package/src/shared/child-transcript.js.map +1 -0
- package/src/shared/completion-owner.d.ts +3 -0
- package/src/shared/completion-owner.d.ts.map +1 -0
- package/src/shared/completion-owner.js +9 -0
- package/src/shared/completion-owner.js.map +1 -0
- package/src/shared/display-text.d.ts +6 -0
- package/src/shared/display-text.d.ts.map +1 -0
- package/src/shared/display-text.js +155 -0
- package/src/shared/display-text.js.map +1 -0
- package/src/shared/extension-context.d.ts +6 -0
- package/src/shared/extension-context.d.ts.map +1 -0
- package/src/shared/extension-context.js +22 -0
- package/src/shared/extension-context.js.map +1 -0
- package/src/shared/file-coalescer.d.ts +12 -0
- package/src/shared/file-coalescer.d.ts.map +1 -0
- package/src/shared/file-coalescer.js +35 -0
- package/src/shared/file-coalescer.js.map +1 -0
- package/src/shared/file-system-retry.d.ts +32 -0
- package/src/shared/file-system-retry.d.ts.map +1 -0
- package/src/shared/file-system-retry.js +85 -0
- package/src/shared/file-system-retry.js.map +1 -0
- package/src/shared/fork-context.d.ts +59 -0
- package/src/shared/fork-context.d.ts.map +1 -0
- package/src/shared/fork-context.js +171 -0
- package/src/shared/fork-context.js.map +1 -0
- package/src/shared/fork-session-cwd.d.ts +3 -0
- package/src/shared/fork-session-cwd.d.ts.map +1 -0
- package/src/shared/fork-session-cwd.js +24 -0
- package/src/shared/fork-session-cwd.js.map +1 -0
- package/src/shared/formatters.d.ts +36 -0
- package/src/shared/formatters.d.ts.map +1 -0
- package/src/shared/formatters.js +143 -0
- package/src/shared/formatters.js.map +1 -0
- package/src/shared/jsonl-writer.d.ts +21 -0
- package/src/shared/jsonl-writer.d.ts.map +1 -0
- package/src/shared/jsonl-writer.js +68 -0
- package/src/shared/jsonl-writer.js.map +1 -0
- package/src/shared/launch-contract.d.ts +64 -0
- package/src/shared/launch-contract.d.ts.map +1 -0
- package/src/shared/launch-contract.js +141 -0
- package/src/shared/launch-contract.js.map +1 -0
- package/src/shared/model-info.d.ts +44 -0
- package/src/shared/model-info.d.ts.map +1 -0
- package/src/shared/model-info.js +73 -0
- package/src/shared/model-info.js.map +1 -0
- package/src/shared/model-response-aliases.d.ts +2 -0
- package/src/shared/model-response-aliases.d.ts.map +1 -0
- package/src/shared/model-response-aliases.js +16 -0
- package/src/shared/model-response-aliases.js.map +1 -0
- package/src/shared/node-executable.d.ts +2 -0
- package/src/shared/node-executable.d.ts.map +1 -0
- package/src/shared/node-executable.js +21 -0
- package/src/shared/node-executable.js.map +1 -0
- package/src/shared/opencode-session-headers.d.ts +13 -0
- package/src/shared/opencode-session-headers.d.ts.map +1 -0
- package/src/shared/opencode-session-headers.js +27 -0
- package/src/shared/opencode-session-headers.js.map +1 -0
- package/src/shared/prompt-resources.d.ts +6 -0
- package/src/shared/prompt-resources.d.ts.map +1 -0
- package/src/shared/prompt-resources.js +11 -0
- package/src/shared/prompt-resources.js.map +1 -0
- package/src/shared/pruned-fork.d.ts +35 -0
- package/src/shared/pruned-fork.d.ts.map +1 -0
- package/src/shared/pruned-fork.js +424 -0
- package/src/shared/pruned-fork.js.map +1 -0
- package/src/shared/required-child-extensions.d.ts +20 -0
- package/src/shared/required-child-extensions.d.ts.map +1 -0
- package/src/shared/required-child-extensions.js +74 -0
- package/src/shared/required-child-extensions.js.map +1 -0
- package/src/shared/session-file-trust.d.ts +2 -0
- package/src/shared/session-file-trust.d.ts.map +1 -0
- package/src/shared/session-file-trust.js +21 -0
- package/src/shared/session-file-trust.js.map +1 -0
- package/src/shared/session-identity.d.ts +7 -0
- package/src/shared/session-identity.d.ts.map +1 -0
- package/src/shared/session-identity.js +7 -0
- package/src/shared/session-identity.js.map +1 -0
- package/src/shared/session-tokens.d.ts +3 -0
- package/src/shared/session-tokens.d.ts.map +1 -0
- package/src/shared/session-tokens.js +59 -0
- package/src/shared/session-tokens.js.map +1 -0
- package/src/shared/settings.d.ts +147 -0
- package/src/shared/settings.d.ts.map +1 -0
- package/src/shared/settings.js +248 -0
- package/src/shared/settings.js.map +1 -0
- package/src/shared/shortcuts.d.ts +2 -0
- package/src/shared/shortcuts.d.ts.map +1 -0
- package/src/shared/shortcuts.js +18 -0
- package/src/shared/shortcuts.js.map +1 -0
- package/src/shared/status-format.d.ts +10 -0
- package/src/shared/status-format.d.ts.map +1 -0
- package/src/shared/status-format.js +61 -0
- package/src/shared/status-format.js.map +1 -0
- package/src/shared/thinking-ceiling.d.ts +14 -0
- package/src/shared/thinking-ceiling.d.ts.map +1 -0
- package/src/shared/thinking-ceiling.js +38 -0
- package/src/shared/thinking-ceiling.js.map +1 -0
- package/src/shared/types.d.ts +2667 -0
- package/src/shared/types.d.ts.map +1 -0
- package/src/shared/types.js +265 -0
- package/src/shared/types.js.map +1 -0
- package/src/shared/utf8.d.ts +6 -0
- package/src/shared/utf8.d.ts.map +1 -0
- package/src/shared/utf8.js +13 -0
- package/src/shared/utf8.js.map +1 -0
- package/src/shared/utils.d.ts +71 -0
- package/src/shared/utils.d.ts.map +1 -0
- package/src/shared/utils.js +593 -0
- package/src/shared/utils.js.map +1 -0
- package/src/shared/watch-strategy.d.ts +3 -0
- package/src/shared/watch-strategy.d.ts.map +1 -0
- package/src/shared/watch-strategy.js +6 -0
- package/src/shared/watch-strategy.js.map +1 -0
- package/src/shared/workflow-child-permit.d.ts +59 -0
- package/src/shared/workflow-child-permit.d.ts.map +1 -0
- package/src/shared/workflow-child-permit.js +160 -0
- package/src/shared/workflow-child-permit.js.map +1 -0
- package/src/slash/delegation-adapters.d.ts +147 -0
- package/src/slash/delegation-adapters.d.ts.map +1 -0
- package/src/slash/delegation-adapters.js +293 -0
- package/src/slash/delegation-adapters.js.map +1 -0
- package/src/slash/delegation-json.d.ts +11 -0
- package/src/slash/delegation-json.d.ts.map +1 -0
- package/src/slash/delegation-json.js +118 -0
- package/src/slash/delegation-json.js.map +1 -0
- package/src/slash/delegation-request.d.ts +13 -0
- package/src/slash/delegation-request.d.ts.map +1 -0
- package/src/slash/delegation-request.js +175 -0
- package/src/slash/delegation-request.js.map +1 -0
- package/src/slash/prompt-template-bridge.d.ts +27 -0
- package/src/slash/prompt-template-bridge.d.ts.map +1 -0
- package/src/slash/prompt-template-bridge.js +380 -0
- package/src/slash/prompt-template-bridge.js.map +1 -0
- package/src/slash/prompt-workflows.d.ts +22 -0
- package/src/slash/prompt-workflows.d.ts.map +1 -0
- package/src/slash/prompt-workflows.js +261 -0
- package/src/slash/prompt-workflows.js.map +1 -0
- package/src/slash/selector.d.ts +48 -0
- package/src/slash/selector.d.ts.map +1 -0
- package/src/slash/selector.js +118 -0
- package/src/slash/selector.js.map +1 -0
- package/src/slash/slash-bridge.d.ts +31 -0
- package/src/slash/slash-bridge.d.ts.map +1 -0
- package/src/slash/slash-bridge.js +133 -0
- package/src/slash/slash-bridge.js.map +1 -0
- package/src/slash/slash-commands.d.ts +9 -0
- package/src/slash/slash-commands.d.ts.map +1 -0
- package/src/slash/slash-commands.js +1295 -0
- package/src/slash/slash-commands.js.map +1 -0
- package/src/slash/slash-live-state.d.ts +22 -0
- package/src/slash/slash-live-state.d.ts.map +1 -0
- package/src/slash/slash-live-state.js +264 -0
- package/src/slash/slash-live-state.js.map +1 -0
- package/src/slash/subagents-admin.d.ts +3 -0
- package/src/slash/subagents-admin.d.ts.map +1 -0
- package/src/slash/subagents-admin.js +454 -0
- package/src/slash/subagents-admin.js.map +1 -0
- package/src/tui/fleet-status.d.ts +86 -0
- package/src/tui/fleet-status.d.ts.map +1 -0
- package/src/tui/fleet-status.js +1083 -0
- package/src/tui/fleet-status.js.map +1 -0
- package/src/tui/fleet-transcript.d.ts +50 -0
- package/src/tui/fleet-transcript.d.ts.map +1 -0
- package/src/tui/fleet-transcript.js +497 -0
- package/src/tui/fleet-transcript.js.map +1 -0
- package/src/tui/fleet.d.ts +169 -0
- package/src/tui/fleet.d.ts.map +1 -0
- package/src/tui/fleet.js +1412 -0
- package/src/tui/fleet.js.map +1 -0
- package/src/tui/render-helpers.d.ts +24 -0
- package/src/tui/render-helpers.d.ts.map +1 -0
- package/src/tui/render-helpers.js +101 -0
- package/src/tui/render-helpers.js.map +1 -0
- package/src/tui/render.d.ts +61 -0
- package/src/tui/render.d.ts.map +1 -0
- package/src/tui/render.js +3607 -0
- package/src/tui/render.js.map +1 -0
- package/src/watchdog/change-signature.d.ts +8 -0
- package/src/watchdog/change-signature.d.ts.map +1 -0
- package/src/watchdog/change-signature.js +246 -0
- package/src/watchdog/change-signature.js.map +1 -0
- package/src/watchdog/child-status.d.ts +54 -0
- package/src/watchdog/child-status.d.ts.map +1 -0
- package/src/watchdog/child-status.js +188 -0
- package/src/watchdog/child-status.js.map +1 -0
- package/src/watchdog/diff-tool.d.ts +23 -0
- package/src/watchdog/diff-tool.d.ts.map +1 -0
- package/src/watchdog/diff-tool.js +84 -0
- package/src/watchdog/diff-tool.js.map +1 -0
- package/src/watchdog/emission-guard.d.ts +37 -0
- package/src/watchdog/emission-guard.d.ts.map +1 -0
- package/src/watchdog/emission-guard.js +98 -0
- package/src/watchdog/emission-guard.js.map +1 -0
- package/src/watchdog/guidance.d.ts +4 -0
- package/src/watchdog/guidance.d.ts.map +1 -0
- package/src/watchdog/guidance.js +20 -0
- package/src/watchdog/guidance.js.map +1 -0
- package/src/watchdog/lsp-diagnostics.d.ts +18 -0
- package/src/watchdog/lsp-diagnostics.d.ts.map +1 -0
- package/src/watchdog/lsp-diagnostics.js +490 -0
- package/src/watchdog/lsp-diagnostics.js.map +1 -0
- package/src/watchdog/model-selection.d.ts +25 -0
- package/src/watchdog/model-selection.d.ts.map +1 -0
- package/src/watchdog/model-selection.js +168 -0
- package/src/watchdog/model-selection.js.map +1 -0
- package/src/watchdog/permission-arbiter.d.ts +21 -0
- package/src/watchdog/permission-arbiter.d.ts.map +1 -0
- package/src/watchdog/permission-arbiter.js +136 -0
- package/src/watchdog/permission-arbiter.js.map +1 -0
- package/src/watchdog/register-child.d.ts +12 -0
- package/src/watchdog/register-child.d.ts.map +1 -0
- package/src/watchdog/register-child.js +120 -0
- package/src/watchdog/register-child.js.map +1 -0
- package/src/watchdog/register-main.d.ts +10 -0
- package/src/watchdog/register-main.d.ts.map +1 -0
- package/src/watchdog/register-main.js +419 -0
- package/src/watchdog/register-main.js.map +1 -0
- package/src/watchdog/render.d.ts +12 -0
- package/src/watchdog/render.d.ts.map +1 -0
- package/src/watchdog/render.js +52 -0
- package/src/watchdog/render.js.map +1 -0
- package/src/watchdog/review.d.ts +36 -0
- package/src/watchdog/review.d.ts.map +1 -0
- package/src/watchdog/review.js +318 -0
- package/src/watchdog/review.js.map +1 -0
- package/src/watchdog/rules.d.ts +22 -0
- package/src/watchdog/rules.d.ts.map +1 -0
- package/src/watchdog/rules.js +59 -0
- package/src/watchdog/rules.js.map +1 -0
- package/src/watchdog/runtime.d.ts +196 -0
- package/src/watchdog/runtime.d.ts.map +1 -0
- package/src/watchdog/runtime.js +862 -0
- package/src/watchdog/runtime.js.map +1 -0
- package/src/watchdog/scope.d.ts +15 -0
- package/src/watchdog/scope.d.ts.map +1 -0
- package/src/watchdog/scope.js +45 -0
- package/src/watchdog/scope.js.map +1 -0
- package/src/watchdog/settings.d.ts +30 -0
- package/src/watchdog/settings.d.ts.map +1 -0
- package/src/watchdog/settings.js +476 -0
- package/src/watchdog/settings.js.map +1 -0
- package/src/watchdog/tool-actions.d.ts +18 -0
- package/src/watchdog/tool-actions.d.ts.map +1 -0
- package/src/watchdog/tool-actions.js +151 -0
- package/src/watchdog/tool-actions.js.map +1 -0
- package/src/watchdog/turn-delta.d.ts +12 -0
- package/src/watchdog/turn-delta.d.ts.map +1 -0
- package/src/watchdog/turn-delta.js +185 -0
- package/src/watchdog/turn-delta.js.map +1 -0
- package/src/watchdog/types.d.ts +142 -0
- package/src/watchdog/types.d.ts.map +1 -0
- package/src/watchdog/types.js +28 -0
- package/src/watchdog/types.js.map +1 -0
- package/src/watchdog/warning-format.d.ts +8 -0
- package/src/watchdog/warning-format.d.ts.map +1 -0
- package/src/watchdog/warning-format.js +60 -0
- package/src/watchdog/warning-format.js.map +1 -0
- package/src/workflows/chat-progress.d.ts +38 -0
- package/src/workflows/chat-progress.d.ts.map +1 -0
- package/src/workflows/chat-progress.js +130 -0
- package/src/workflows/chat-progress.js.map +1 -0
- package/src/workflows/host-command.d.ts +31 -0
- package/src/workflows/host-command.d.ts.map +1 -0
- package/src/workflows/host-command.js +228 -0
- package/src/workflows/host-command.js.map +1 -0
- package/src/workflows/scripted-workflow.d.ts +195 -0
- package/src/workflows/scripted-workflow.d.ts.map +1 -0
- package/src/workflows/scripted-workflow.js +2636 -0
- package/src/workflows/scripted-workflow.js.map +1 -0
- package/src/workflows/workflow-checklist.d.ts +124 -0
- package/src/workflows/workflow-checklist.d.ts.map +1 -0
- package/src/workflows/workflow-checklist.js +312 -0
- package/src/workflows/workflow-checklist.js.map +1 -0
- package/src/workflows/workflow-child-summary.d.ts +20 -0
- package/src/workflows/workflow-child-summary.d.ts.map +1 -0
- package/src/workflows/workflow-child-summary.js +179 -0
- package/src/workflows/workflow-child-summary.js.map +1 -0
- package/src/workflows/workflow-preflight.d.ts +59 -0
- package/src/workflows/workflow-preflight.d.ts.map +1 -0
- package/src/workflows/workflow-preflight.js +289 -0
- package/src/workflows/workflow-preflight.js.map +1 -0
- package/src/workflows/workflow-receipt.d.ts +35 -0
- package/src/workflows/workflow-receipt.d.ts.map +1 -0
- package/src/workflows/workflow-receipt.js +449 -0
- package/src/workflows/workflow-receipt.js.map +1 -0
- package/src/workflows/workflow-resources.d.ts +43 -0
- package/src/workflows/workflow-resources.d.ts.map +1 -0
- package/src/workflows/workflow-resources.js +230 -0
- package/src/workflows/workflow-resources.js.map +1 -0
- package/src/workflows/workflow-settlement.d.ts +85 -0
- package/src/workflows/workflow-settlement.d.ts.map +1 -0
- package/src/workflows/workflow-settlement.js +204 -0
- package/src/workflows/workflow-settlement.js.map +1 -0
- package/index.ts +0 -13
- package/src/agents/advertised-agent-prompt.ts +0 -94
- package/src/agents/agent-management.ts +0 -1417
- package/src/agents/agent-memory.ts +0 -254
- package/src/agents/agent-refinements.ts +0 -624
- package/src/agents/agent-scope.ts +0 -6
- package/src/agents/agent-selection.ts +0 -25
- package/src/agents/agent-serializer.ts +0 -182
- package/src/agents/agents.ts +0 -2917
- package/src/agents/builtin-names.ts +0 -16
- package/src/agents/chain-serializer.ts +0 -285
- package/src/agents/frontmatter.ts +0 -153
- package/src/agents/identity.ts +0 -30
- package/src/agents/proactive-skills.ts +0 -194
- package/src/agents/runtime-agent-events.ts +0 -70
- package/src/agents/runtime-agent-registry.ts +0 -430
- package/src/agents/skills.ts +0 -754
- package/src/api/agents.ts +0 -12
- package/src/api/background-work.ts +0 -206
- package/src/api/capability-ceiling.ts +0 -16
- package/src/api/child-tool-plan.ts +0 -5
- package/src/api/control-channel.ts +0 -4
- package/src/api/delegation.ts +0 -116
- package/src/api/external-job-provider.ts +0 -195
- package/src/api/external-runs.ts +0 -282
- package/src/api/intercom-bridge.ts +0 -3
- package/src/api/preflight.ts +0 -539
- package/src/api/project-panes.ts +0 -32
- package/src/api/required-child-extensions.ts +0 -6
- package/src/api/shared-types.ts +0 -29
- package/src/api/workflow-resources.ts +0 -6
- package/src/extension/config.ts +0 -230
- package/src/extension/control-notices.ts +0 -58
- package/src/extension/doctor.ts +0 -270
- package/src/extension/fanout-child.ts +0 -265
- package/src/extension/herdr-pi-bridge.ts +0 -160
- package/src/extension/index.ts +0 -1205
- package/src/extension/public-execution.ts +0 -225
- package/src/extension/rpc.ts +0 -848
- package/src/extension/schemas.ts +0 -428
- package/src/extension/steering-notices.ts +0 -35
- package/src/extension/subagent-guide.ts +0 -39
- package/src/extension/tool-description.ts +0 -175
- package/src/extension/tool-result.ts +0 -19
- package/src/inspectors/actions.ts +0 -148
- package/src/inspectors/ghostty/actions.ts +0 -74
- package/src/inspectors/ghostty/plugin.ts +0 -29
- package/src/inspectors/herdr/actions.ts +0 -155
- package/src/inspectors/herdr/client.ts +0 -130
- package/src/inspectors/herdr/focus.ts +0 -55
- package/src/inspectors/herdr/plugin.ts +0 -20
- package/src/inspectors/herdr/project-panes.ts +0 -730
- package/src/inspectors/inspector-runner.ts +0 -153
- package/src/inspectors/plugins.ts +0 -8
- package/src/inspectors/session-roots-codec.ts +0 -31
- package/src/inspectors/shell-command.ts +0 -16
- package/src/inspectors/types.ts +0 -51
- package/src/integrations/herdr-status.ts +0 -400
- package/src/integrations/pi-web-session-liveness.ts +0 -73
- package/src/intercom/intercom-bridge.ts +0 -233
- package/src/intercom/native-supervisor-channel.ts +0 -917
- package/src/intercom/result-intercom.ts +0 -423
- package/src/intercom/supervisor-ui.ts +0 -244
- package/src/missions/actions.ts +0 -433
- package/src/missions/goal-driver.ts +0 -164
- package/src/missions/lifecycle.ts +0 -367
- package/src/missions/store.ts +0 -584
- package/src/missions/types.ts +0 -190
- package/src/missions/workflow-state.ts +0 -281
- package/src/policy/authority.ts +0 -50
- package/src/profiles/profiles.ts +0 -668
- package/src/runs/background/active-async-capacity.ts +0 -520
- package/src/runs/background/active-run-index.ts +0 -155
- package/src/runs/background/async-execution.ts +0 -2278
- package/src/runs/background/async-job-tracker.ts +0 -826
- package/src/runs/background/async-resume.ts +0 -647
- package/src/runs/background/async-retention.ts +0 -912
- package/src/runs/background/async-status-snapshot.ts +0 -46
- package/src/runs/background/async-status.ts +0 -771
- package/src/runs/background/auto-drain.ts +0 -92
- package/src/runs/background/binary-bootstrap.ts +0 -38
- package/src/runs/background/chain-append.ts +0 -321
- package/src/runs/background/chain-root-attachment.ts +0 -259
- package/src/runs/background/completion-batcher.ts +0 -168
- package/src/runs/background/completion-dedupe.ts +0 -58
- package/src/runs/background/completion-replay.ts +0 -287
- package/src/runs/background/control-channel.ts +0 -600
- package/src/runs/background/fleet-view.ts +0 -648
- package/src/runs/background/index-segment.ts +0 -59
- package/src/runs/background/inspect-rpc.ts +0 -443
- package/src/runs/background/notify.ts +0 -819
- package/src/runs/background/owned-process-tree.ts +0 -131
- package/src/runs/background/parallel-groups.ts +0 -45
- package/src/runs/background/process-terminal.ts +0 -310
- package/src/runs/background/result-delivery-ownership.ts +0 -45
- package/src/runs/background/result-files.ts +0 -523
- package/src/runs/background/result-watcher.ts +0 -809
- package/src/runs/background/resume-guidance.ts +0 -56
- package/src/runs/background/retained-children.ts +0 -135
- package/src/runs/background/retained-nested-route-tracker.ts +0 -96
- package/src/runs/background/run-child-session.ts +0 -690
- package/src/runs/background/run-id-query.ts +0 -7
- package/src/runs/background/run-id-resolver.ts +0 -175
- package/src/runs/background/run-status.ts +0 -786
- package/src/runs/background/runner-aliases.ts +0 -142
- package/src/runs/background/runner-child-launch.ts +0 -91
- package/src/runs/background/runner-child-sessions.ts +0 -32
- package/src/runs/background/runner-http-dispatcher.ts +0 -119
- package/src/runs/background/scheduled-runs.ts +0 -1012
- package/src/runs/background/stale-run-reconciler.ts +0 -436
- package/src/runs/background/steering.ts +0 -260
- package/src/runs/background/subagent-runner.ts +0 -5357
- package/src/runs/background/subagent-wait.ts +0 -876
- package/src/runs/background/terminal-run-index.ts +0 -138
- package/src/runs/background/top-level-async.ts +0 -14
- package/src/runs/background/wait-completions.ts +0 -261
- package/src/runs/background/wait-config.ts +0 -50
- package/src/runs/background/wait-subscriptions.ts +0 -354
- package/src/runs/background/wait-tool.ts +0 -45
- package/src/runs/foreground/async-dismiss-action.ts +0 -86
- package/src/runs/foreground/async-steering-action.ts +0 -276
- package/src/runs/foreground/async-stop-action.ts +0 -176
- package/src/runs/foreground/execution.ts +0 -2254
- package/src/runs/foreground/foreground-control.ts +0 -157
- package/src/runs/foreground/foreground-history.ts +0 -163
- package/src/runs/foreground/prompt-audit.ts +0 -178
- package/src/runs/foreground/subagent-executor.ts +0 -7526
- package/src/runs/foreground/workflow-detach-reconcile.ts +0 -304
- package/src/runs/foreground/workflow-foreground-steering.ts +0 -169
- package/src/runs/shared/abort-recovery.ts +0 -119
- package/src/runs/shared/acceptance.ts +0 -1698
- package/src/runs/shared/agent-contract.ts +0 -38
- package/src/runs/shared/async-status-projection.ts +0 -659
- package/src/runs/shared/background-process-options.ts +0 -9
- package/src/runs/shared/capability-ceiling.ts +0 -211
- package/src/runs/shared/chain-outputs.ts +0 -116
- package/src/runs/shared/child-hooks.ts +0 -189
- package/src/runs/shared/child-identity.ts +0 -62
- package/src/runs/shared/child-launch-plan.ts +0 -163
- package/src/runs/shared/child-launch.ts +0 -342
- package/src/runs/shared/child-lifecycle.ts +0 -28
- package/src/runs/shared/child-runtime-config.ts +0 -133
- package/src/runs/shared/child-session.ts +0 -448
- package/src/runs/shared/child-tool-plan.ts +0 -661
- package/src/runs/shared/claude-code-adapter.ts +0 -133
- package/src/runs/shared/codex-exec-adapter.ts +0 -129
- package/src/runs/shared/completion-evidence.ts +0 -89
- package/src/runs/shared/completion-guard.ts +0 -255
- package/src/runs/shared/context-mode.ts +0 -44
- package/src/runs/shared/cursor-agent-adapter.ts +0 -114
- package/src/runs/shared/dynamic-fanout.ts +0 -297
- package/src/runs/shared/effective-system-prompt.ts +0 -33
- package/src/runs/shared/extension-bindings.ts +0 -78
- package/src/runs/shared/external-cli-contract.ts +0 -177
- package/src/runs/shared/external-cli-preflight.ts +0 -142
- package/src/runs/shared/external-cli-runner.ts +0 -431
- package/src/runs/shared/external-job-bridge.ts +0 -460
- package/src/runs/shared/external-job-runner.ts +0 -389
- package/src/runs/shared/fast-mode-extension.ts +0 -10
- package/src/runs/shared/herdr-connection.ts +0 -134
- package/src/runs/shared/herdr-external-adapters.ts +0 -169
- package/src/runs/shared/herdr-machine.ts +0 -279
- package/src/runs/shared/herdr-pi-protocol.ts +0 -59
- package/src/runs/shared/herdr-placed-run.ts +0 -263
- package/src/runs/shared/host-step-status.ts +0 -231
- package/src/runs/shared/lane-metadata.ts +0 -126
- package/src/runs/shared/launch-cwd.ts +0 -16
- package/src/runs/shared/llm-intent-arbiter.ts +0 -321
- package/src/runs/shared/long-running-guard.ts +0 -221
- package/src/runs/shared/mcp-config-sources.ts +0 -422
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +0 -484
- package/src/runs/shared/mcp-direct-tool-grant.ts +0 -194
- package/src/runs/shared/model-resolution-diagnostic.ts +0 -76
- package/src/runs/shared/model-resolution.ts +0 -441
- package/src/runs/shared/model-scope.ts +0 -205
- package/src/runs/shared/mutation-evidence.ts +0 -199
- package/src/runs/shared/nested-events.ts +0 -1079
- package/src/runs/shared/nested-path.ts +0 -38
- package/src/runs/shared/nested-render.ts +0 -127
- package/src/runs/shared/orca-progress-tabs.ts +0 -510
- package/src/runs/shared/parallel-handoff.ts +0 -741
- package/src/runs/shared/parallel-utils.ts +0 -279
- package/src/runs/shared/permissions.ts +0 -86
- package/src/runs/shared/pi-spawn.ts +0 -207
- package/src/runs/shared/process-signal.ts +0 -35
- package/src/runs/shared/readonly-drain-observation.ts +0 -42
- package/src/runs/shared/run-fanout-budget.ts +0 -267
- package/src/runs/shared/run-history.ts +0 -201
- package/src/runs/shared/runtime-acknowledged-extensions.ts +0 -44
- package/src/runs/shared/session-lease.ts +0 -293
- package/src/runs/shared/single-output.ts +0 -304
- package/src/runs/shared/spawn-budget.ts +0 -128
- package/src/runs/shared/structured-output.ts +0 -236
- package/src/runs/shared/subagent-control.ts +0 -294
- package/src/runs/shared/subagent-prompt-runtime.ts +0 -545
- package/src/runs/shared/task-intent.ts +0 -244
- package/src/runs/shared/tool-availability.ts +0 -37
- package/src/runs/shared/tool-budget.ts +0 -66
- package/src/runs/shared/tool-timeout.ts +0 -93
- package/src/runs/shared/usage-budget.ts +0 -65
- package/src/runs/shared/workflow-async-child-guidance.ts +0 -18
- package/src/runs/shared/workflow-graph.ts +0 -225
- package/src/runs/shared/worktree-cleanup-plan.ts +0 -869
- package/src/runs/shared/worktree-setup-command.ts +0 -213
- package/src/runs/shared/worktree.ts +0 -1538
- package/src/shared/accessible-dir.ts +0 -47
- package/src/shared/agent-stream-options.ts +0 -5
- package/src/shared/artifacts.ts +0 -281
- package/src/shared/atomic-json.ts +0 -83
- package/src/shared/capacity-resilient-json.ts +0 -102
- package/src/shared/child-cache-retention.ts +0 -43
- package/src/shared/child-session-name.ts +0 -46
- package/src/shared/child-transcript.ts +0 -264
- package/src/shared/completion-owner.ts +0 -14
- package/src/shared/display-text.ts +0 -150
- package/src/shared/extension-context.ts +0 -24
- package/src/shared/file-coalescer.ts +0 -49
- package/src/shared/file-system-retry.ts +0 -95
- package/src/shared/fork-context.ts +0 -236
- package/src/shared/fork-session-cwd.ts +0 -27
- package/src/shared/formatters.ts +0 -146
- package/src/shared/jsonl-writer.ts +0 -92
- package/src/shared/launch-contract.ts +0 -198
- package/src/shared/model-info.ts +0 -101
- package/src/shared/model-response-aliases.ts +0 -13
- package/src/shared/node-executable.ts +0 -21
- package/src/shared/opencode-session-headers.ts +0 -30
- package/src/shared/prompt-resources.ts +0 -11
- package/src/shared/pruned-fork.ts +0 -450
- package/src/shared/required-child-extensions.ts +0 -81
- package/src/shared/session-file-trust.ts +0 -19
- package/src/shared/session-identity.ts +0 -10
- package/src/shared/session-tokens.ts +0 -55
- package/src/shared/settings.ts +0 -412
- package/src/shared/shortcuts.ts +0 -13
- package/src/shared/status-format.ts +0 -55
- package/src/shared/thinking-ceiling.ts +0 -46
- package/src/shared/types.ts +0 -2983
- package/src/shared/utf8.ts +0 -11
- package/src/shared/utils.ts +0 -608
- package/src/shared/watch-strategy.ts +0 -12
- package/src/shared/workflow-child-permit.ts +0 -212
- package/src/slash/delegation-adapters.ts +0 -428
- package/src/slash/delegation-json.ts +0 -108
- package/src/slash/delegation-request.ts +0 -176
- package/src/slash/prompt-template-bridge.ts +0 -419
- package/src/slash/prompt-workflows.ts +0 -287
- package/src/slash/selector.ts +0 -147
- package/src/slash/slash-bridge.ts +0 -192
- package/src/slash/slash-commands.ts +0 -1325
- package/src/slash/slash-live-state.ts +0 -310
- package/src/slash/subagents-admin.ts +0 -460
- package/src/tui/fleet-status.ts +0 -1109
- package/src/tui/fleet-transcript.ts +0 -536
- package/src/tui/fleet.ts +0 -1448
- package/src/tui/render-helpers.ts +0 -111
- package/src/tui/render.ts +0 -3721
- package/src/types/pi-runtime-compat.d.ts +0 -8
- package/src/watchdog/change-signature.ts +0 -260
- package/src/watchdog/child-status.ts +0 -225
- package/src/watchdog/diff-tool.ts +0 -77
- package/src/watchdog/emission-guard.ts +0 -125
- package/src/watchdog/guidance.ts +0 -20
- package/src/watchdog/lsp-diagnostics.ts +0 -538
- package/src/watchdog/model-selection.ts +0 -187
- package/src/watchdog/permission-arbiter.ts +0 -156
- package/src/watchdog/register-child.ts +0 -128
- package/src/watchdog/register-main.ts +0 -445
- package/src/watchdog/render.ts +0 -53
- package/src/watchdog/review.ts +0 -363
- package/src/watchdog/rules.ts +0 -70
- package/src/watchdog/runtime.ts +0 -924
- package/src/watchdog/scope.ts +0 -51
- package/src/watchdog/settings.ts +0 -515
- package/src/watchdog/tool-actions.ts +0 -156
- package/src/watchdog/turn-delta.ts +0 -184
- package/src/watchdog/types.ts +0 -186
- package/src/watchdog/warning-format.ts +0 -72
- package/src/workflows/chat-progress.ts +0 -152
- package/src/workflows/host-command.ts +0 -235
- package/src/workflows/scripted-workflow.ts +0 -2575
- package/src/workflows/workflow-checklist.ts +0 -436
- package/src/workflows/workflow-child-summary.ts +0 -170
- package/src/workflows/workflow-preflight.ts +0 -297
- package/src/workflows/workflow-receipt.ts +0 -384
- package/src/workflows/workflow-resources.ts +0 -236
- package/src/workflows/workflow-settlement.ts +0 -249
package/src/extension/index.ts
DELETED
|
@@ -1,1205 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Subagent Tool
|
|
3
|
-
*
|
|
4
|
-
* Full-featured subagent with sync and async modes.
|
|
5
|
-
* - Sync (default): Streams output, renders markdown, tracks usage
|
|
6
|
-
* - Async: Background execution, emits events when done
|
|
7
|
-
*
|
|
8
|
-
* Public execution mode: workflow (workflowScript)
|
|
9
|
-
* Toggle: async parameter (default: true; set asyncByDefault:false in config.json to opt out)
|
|
10
|
-
*
|
|
11
|
-
* Config file: ~/.pi/agent/extensions/subagent/config.json
|
|
12
|
-
* { "asyncByDefault": true, "defaultSubagentContext": "fork", "forkContext": { "mode": "pruned", "model": "provider/model" }, "forceTopLevelAsync": true, "maxSubagentDepth": 1, "intercomBridge": { "mode": "always", "instructionFile": "./intercom-bridge.md" }, "worktreeSetupHook": "./scripts/setup-worktree.mjs" }
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { randomUUID } from "node:crypto";
|
|
16
|
-
import * as fs from "node:fs";
|
|
17
|
-
import * as os from "node:os";
|
|
18
|
-
import * as path from "node:path";
|
|
19
|
-
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
20
|
-
import { keyText, type ExtensionAPI, type ExtensionContext, type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
21
|
-
import { Box, Container, Spacer, Text, truncateToWidth, visibleWidth, wrapTextWithAnsi, type Component } from "@earendil-works/pi-tui";
|
|
22
|
-
import { clearAgentDiscoveryCache, discoverAgentSnapshot, discoverAgents, type AgentConfig, type AgentScope } from "../agents/agents.ts";
|
|
23
|
-
import { appendAdvertisedAgentPrompt, buildAdvertisedAgentPrompt } from "../agents/advertised-agent-prompt.ts";
|
|
24
|
-
import { clearRuntimeAgentsForPi, listRuntimeAgentConfigs, mergeRuntimeAgents } from "../agents/runtime-agent-registry.ts";
|
|
25
|
-
import { registerRuntimeAgentEventListener } from "../agents/runtime-agent-events.ts";
|
|
26
|
-
import { ensureAccessibleDir } from "../shared/accessible-dir.ts";
|
|
27
|
-
import { cleanupAllArtifactDirs, cleanupOldArtifacts, getArtifactsDir } from "../shared/artifacts.ts";
|
|
28
|
-
import { resolveCurrentSessionId } from "../shared/session-identity.ts";
|
|
29
|
-
import { getAgentDir } from "../shared/utils.ts";
|
|
30
|
-
import { isStaleExtensionContextError, withCachedUiContext } from "../shared/extension-context.ts";
|
|
31
|
-
import { currentCompletionOwnerId } from "../shared/completion-owner.ts";
|
|
32
|
-
import { cleanupOldChainDirs } from "../shared/settings.ts";
|
|
33
|
-
import { clearLegacyResultAnimationTimer, renderSubagentResult, renderSubagentSummary, setInlineWorkflowCoverage } from "../tui/render.ts";
|
|
34
|
-
import { openSubagentFleet } from "../tui/fleet.ts";
|
|
35
|
-
import { createBuiltinInspectorPlugins } from "../inspectors/plugins.ts";
|
|
36
|
-
import { SubagentFleetStatus, resolveFleetViewPlacement } from "../tui/fleet-status.ts";
|
|
37
|
-
import { createSubagentParamsSchema } from "./schemas.ts";
|
|
38
|
-
import { createSubagentExecutor, type SubagentParamsLike } from "../runs/foreground/subagent-executor.ts";
|
|
39
|
-
import { createAsyncJobTracker } from "../runs/background/async-job-tracker.ts";
|
|
40
|
-
import { getActiveAsyncCapacitySnapshot, resolveAbandonedSlotReleaseAfterMs, resolveMaxActiveAsyncRunsPerSession } from "../runs/background/active-async-capacity.ts";
|
|
41
|
-
import { cleanupResultIndexes, missionObserverResultCandidateFiles } from "../runs/background/result-files.ts";
|
|
42
|
-
import { ASYNC_RETENTION_DELAY_MS, cleanupAsyncRetention } from "../runs/background/async-retention.ts";
|
|
43
|
-
import { createResultWatcher } from "../runs/background/result-watcher.ts";
|
|
44
|
-
import { createResultDeliveryOwnership } from "../runs/background/result-delivery-ownership.ts";
|
|
45
|
-
import { createScheduledRunManager } from "../runs/background/scheduled-runs.ts";
|
|
46
|
-
import { registerSlashCommands } from "../slash/slash-commands.ts";
|
|
47
|
-
import { registerPromptTemplateDelegationBridge } from "../slash/prompt-template-bridge.ts";
|
|
48
|
-
import { registerMainWatchdog } from "../watchdog/register-main.ts";
|
|
49
|
-
import { registerSlashSubagentBridge } from "../slash/slash-bridge.ts";
|
|
50
|
-
import { createNativeSupervisorChannel } from "../intercom/native-supervisor-channel.ts";
|
|
51
|
-
import {
|
|
52
|
-
renderSupervisorReply,
|
|
53
|
-
renderSupervisorRequest,
|
|
54
|
-
SUPERVISOR_REPLY_ENTRY_TYPE,
|
|
55
|
-
SUPERVISOR_REQUEST_MESSAGE_TYPE,
|
|
56
|
-
type SupervisorRequestMessageDetails,
|
|
57
|
-
} from "../intercom/supervisor-ui.ts";
|
|
58
|
-
import { registerHerdrStatusBridge, type HerdrStatusRun } from "../integrations/herdr-status.ts";
|
|
59
|
-
import { hasLiveSubagentWork, registerPiWebSessionLiveness } from "../integrations/pi-web-session-liveness.ts";
|
|
60
|
-
import { createRetainedNestedRouteTracker } from "../runs/background/retained-nested-route-tracker.ts";
|
|
61
|
-
import { listHerdrProjectPaneRoots, restoreHerdrProjectPaneSnapshots } from "../inspectors/herdr/project-panes.ts";
|
|
62
|
-
import { registerSubagentRpcBridge } from "./rpc.ts";
|
|
63
|
-
import { clearSlashSnapshots, getSlashRenderableSnapshot, resolveSlashMessageDetails, restoreSlashFinalSnapshots, type SlashMessageDetails } from "../slash/slash-live-state.ts";
|
|
64
|
-
import { resolveWaitToolConfig } from "../runs/background/subagent-wait.ts";
|
|
65
|
-
import { registerWaitTool } from "../runs/background/wait-tool.ts";
|
|
66
|
-
import { createWaitSubscriptionManager } from "../runs/background/wait-subscriptions.ts";
|
|
67
|
-
import { drainOutstandingWork } from "../runs/background/auto-drain.ts";
|
|
68
|
-
import registerSubagentNotify, { parseSubagentNotifyContent, type SubagentNotifyDetails } from "../runs/background/notify.ts";
|
|
69
|
-
import { formatSteeringNotice, handleSubagentSteeringNotice, SUBAGENT_STEERING_MESSAGE_TYPE, type SubagentSteeringMessageDetails } from "./steering-notices.ts";
|
|
70
|
-
import { SUBAGENT_CHILD_ENV, SUBAGENT_PARENT_SESSION_ENV } from "../runs/shared/child-runtime-config.ts";
|
|
71
|
-
import { disposeChildSessions } from "../runs/shared/child-session.ts";
|
|
72
|
-
import { resolveCurrentSubagentCapabilityCeiling } from "../runs/shared/capability-ceiling.ts";
|
|
73
|
-
import { formatDuration, shortenPath } from "../shared/formatters.ts";
|
|
74
|
-
import { loadConfig, resolveAsyncByDefault, resolveScheduledStoreRoot } from "./config.ts";
|
|
75
|
-
import { buildSubagentToolDescription, buildSubagentToolPromptMetadata } from "./tool-description.ts";
|
|
76
|
-
import { formatWorkflowPreflightSummary, normalizeWorkflowPreflight } from "../workflows/workflow-preflight.ts";
|
|
77
|
-
import { finalizeToolResult } from "./tool-result.ts";
|
|
78
|
-
import { collectGoalContinuationNotices } from "../missions/goal-driver.ts";
|
|
79
|
-
import { restoreForegroundRunHistory } from "../runs/foreground/foreground-history.ts";
|
|
80
|
-
import { resolveMissionStoreLocation } from "../missions/store.ts";
|
|
81
|
-
import { listRetainedChildren } from "../runs/background/retained-children.ts";
|
|
82
|
-
import {
|
|
83
|
-
type Details,
|
|
84
|
-
type MainWindowRendererConfig,
|
|
85
|
-
type SubagentState,
|
|
86
|
-
DIRS,
|
|
87
|
-
DEFAULT_ARTIFACT_CONFIG,
|
|
88
|
-
SLASH_RESULT_TYPE,
|
|
89
|
-
SLASH_TEXT_RESULT_TYPE,
|
|
90
|
-
SUBAGENT_ASYNC_COMPLETE_EVENT,
|
|
91
|
-
SUBAGENT_ASYNC_STARTED_EVENT,
|
|
92
|
-
SUBAGENT_PROCESS_TERMINAL_EVENT,
|
|
93
|
-
SUBAGENT_CONTROL_EVENT,
|
|
94
|
-
SUBAGENT_STEERING_NOTICE_EVENT,
|
|
95
|
-
WIDGET_KEY,
|
|
96
|
-
resolveMaxSubagentSpawnsPerSession,
|
|
97
|
-
} from "../shared/types.ts";
|
|
98
|
-
import {
|
|
99
|
-
formatSubagentControlNotice,
|
|
100
|
-
handleSubagentControlNotice,
|
|
101
|
-
SUBAGENT_CONTROL_MESSAGE_TYPE,
|
|
102
|
-
type SubagentControlMessageDetails,
|
|
103
|
-
} from "./control-notices.ts";
|
|
104
|
-
|
|
105
|
-
export { loadConfig, resolveAsyncByDefault } from "./config.ts";
|
|
106
|
-
|
|
107
|
-
const SLOW_RELOAD_PHASE_MS = 250;
|
|
108
|
-
const RUNTIME_REGISTRY_STORE_KEY = "__piSubagentRuntimeRegistry";
|
|
109
|
-
|
|
110
|
-
interface SubagentRuntimeEntry {
|
|
111
|
-
cleanup(): void;
|
|
112
|
-
sessionManager: object | null;
|
|
113
|
-
visibleControlNotices: Set<string>;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
interface SubagentRuntimeRegistry {
|
|
117
|
-
bySessionManager: WeakMap<object, SubagentRuntimeEntry>;
|
|
118
|
-
visibleControlNoticesBySessionManager: WeakMap<object, Set<string>>;
|
|
119
|
-
activeEntries: Set<SubagentRuntimeEntry>;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function getRuntimeRegistry(): SubagentRuntimeRegistry {
|
|
123
|
-
const globalStore = globalThis as Record<string, unknown>;
|
|
124
|
-
const existing = globalStore[RUNTIME_REGISTRY_STORE_KEY] as Partial<SubagentRuntimeRegistry> | undefined;
|
|
125
|
-
if (existing?.bySessionManager instanceof WeakMap && existing.activeEntries instanceof Set) {
|
|
126
|
-
if (!(existing.visibleControlNoticesBySessionManager instanceof WeakMap)) {
|
|
127
|
-
existing.visibleControlNoticesBySessionManager = new WeakMap();
|
|
128
|
-
}
|
|
129
|
-
return existing as SubagentRuntimeRegistry;
|
|
130
|
-
}
|
|
131
|
-
const registry: SubagentRuntimeRegistry = {
|
|
132
|
-
bySessionManager: new WeakMap(),
|
|
133
|
-
visibleControlNoticesBySessionManager: new WeakMap(),
|
|
134
|
-
activeEntries: new Set(),
|
|
135
|
-
};
|
|
136
|
-
globalStore[RUNTIME_REGISTRY_STORE_KEY] = registry;
|
|
137
|
-
return registry;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function logSlowPhase(label: string, startedAt: number): void {
|
|
141
|
-
const elapsed = Date.now() - startedAt;
|
|
142
|
-
if (elapsed >= SLOW_RELOAD_PHASE_MS) console.error(`Subagent reload phase '${label}' took ${elapsed}ms.`);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function workflowLaneKeys(script: string): string[] {
|
|
146
|
-
const keys: string[] = [];
|
|
147
|
-
const seen = new Set<string>();
|
|
148
|
-
const add = (key: string): void => {
|
|
149
|
-
if (!seen.has(key)) {
|
|
150
|
-
seen.add(key);
|
|
151
|
-
keys.push(key);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
const isIdentifier = (char: string | undefined): boolean => char !== undefined && /[\w$]/.test(char);
|
|
155
|
-
const skipTrivia = (start: number): number => {
|
|
156
|
-
let index = start;
|
|
157
|
-
while (index < script.length) {
|
|
158
|
-
if (/\s/.test(script[index]!)) index += 1;
|
|
159
|
-
else if (script.startsWith("//", index)) {
|
|
160
|
-
const end = script.indexOf("\n", index + 2);
|
|
161
|
-
index = end === -1 ? script.length : end + 1;
|
|
162
|
-
} else if (script.startsWith("/*", index)) {
|
|
163
|
-
const end = script.indexOf("*/", index + 2);
|
|
164
|
-
index = end === -1 ? script.length : end + 2;
|
|
165
|
-
} else break;
|
|
166
|
-
}
|
|
167
|
-
return index;
|
|
168
|
-
};
|
|
169
|
-
const readLiteral = (start: number): { key?: string; end: number } | undefined => {
|
|
170
|
-
const quote = script[start];
|
|
171
|
-
if (quote !== "'" && quote !== '"' && quote !== "`") return undefined;
|
|
172
|
-
let index = start + 1;
|
|
173
|
-
let dynamicTemplate = false;
|
|
174
|
-
while (index < script.length) {
|
|
175
|
-
if (script[index] === "\\") {
|
|
176
|
-
index += 2;
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
if (quote === "`" && script.startsWith("${", index)) dynamicTemplate = true;
|
|
180
|
-
if (script[index] === quote) return { key: dynamicTemplate ? undefined : script.slice(start + 1, index), end: index + 1 };
|
|
181
|
-
if (quote !== "`" && /[\r\n]/.test(script[index]!)) return { end: index + 1 };
|
|
182
|
-
index += 1;
|
|
183
|
-
}
|
|
184
|
-
return { end: script.length };
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
const collectRunsAllKeys = (start: number): number => {
|
|
188
|
-
let index = skipTrivia(start);
|
|
189
|
-
if (script[index] !== "(") return start;
|
|
190
|
-
index = skipTrivia(index + 1);
|
|
191
|
-
if (script[index] !== "[") return start;
|
|
192
|
-
let arrayDepth = 1;
|
|
193
|
-
let objectDepth = 0;
|
|
194
|
-
let directChildObject = false;
|
|
195
|
-
let expectingElement = true;
|
|
196
|
-
for (index += 1; index < script.length; index += 1) {
|
|
197
|
-
index = skipTrivia(index);
|
|
198
|
-
const literal = readLiteral(index);
|
|
199
|
-
if (literal) {
|
|
200
|
-
index = literal.end - 1;
|
|
201
|
-
continue;
|
|
202
|
-
}
|
|
203
|
-
if (script[index] === "[") {
|
|
204
|
-
arrayDepth += 1;
|
|
205
|
-
expectingElement = false;
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
if (script[index] === "]") {
|
|
209
|
-
arrayDepth -= 1;
|
|
210
|
-
if (arrayDepth === 0) return index + 1;
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
if (script[index] === "{") {
|
|
214
|
-
objectDepth += 1;
|
|
215
|
-
if (objectDepth === 1) directChildObject = arrayDepth === 1 && expectingElement;
|
|
216
|
-
expectingElement = false;
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
if (script[index] === "}") {
|
|
220
|
-
objectDepth -= 1;
|
|
221
|
-
if (objectDepth === 0) directChildObject = false;
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
if (script[index] === "," && arrayDepth === 1 && objectDepth === 0) {
|
|
225
|
-
expectingElement = true;
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
if (directChildObject && objectDepth === 1 && !isIdentifier(script[index - 1]) && script.startsWith("key", index) && !isIdentifier(script[index + 3])) {
|
|
229
|
-
const colon = skipTrivia(index + 3);
|
|
230
|
-
const key = script[colon] === ":" ? readLiteral(skipTrivia(colon + 1)) : undefined;
|
|
231
|
-
if (key) {
|
|
232
|
-
const next = skipTrivia(key.end);
|
|
233
|
-
if (key.key !== undefined && (script[next] === "," || script[next] === "}")) add(key.key);
|
|
234
|
-
index = key.end - 1;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return index;
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
for (let index = 0; index < script.length;) {
|
|
242
|
-
index = skipTrivia(index);
|
|
243
|
-
const literal = readLiteral(index);
|
|
244
|
-
if (literal) {
|
|
245
|
-
index = literal.end;
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
if (!isIdentifier(script[index - 1]) && script.startsWith("runs.run", index) && !isIdentifier(script[index + 8])) {
|
|
249
|
-
const open = skipTrivia(index + 8);
|
|
250
|
-
const key = script[open] === "(" ? readLiteral(skipTrivia(open + 1)) : undefined;
|
|
251
|
-
if (key) {
|
|
252
|
-
const next = skipTrivia(key.end);
|
|
253
|
-
if (key.key !== undefined && (script[next] === "," || script[next] === ")")) add(key.key);
|
|
254
|
-
index = key.end;
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
if (!isIdentifier(script[index - 1]) && script.startsWith("runs.all", index) && !isIdentifier(script[index + 8])) {
|
|
259
|
-
index = collectRunsAllKeys(index + 8);
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
index += 1;
|
|
263
|
-
}
|
|
264
|
-
return keys;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function formatWorkflowPreflightCall(input: unknown): string {
|
|
268
|
-
if (input === undefined) return "";
|
|
269
|
-
try {
|
|
270
|
-
return formatWorkflowPreflightSummary(normalizeWorkflowPreflight(input));
|
|
271
|
-
} catch (error) {
|
|
272
|
-
return `preflight · rejected: ${error instanceof Error ? error.message : String(error)}`;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function formatWorkflowManifest(script: string, async: unknown, clarify: unknown, preflightInput?: unknown): string {
|
|
277
|
-
if (clarify === true) return "workflow script · rejected: clarify UI unsupported";
|
|
278
|
-
const keys = workflowLaneKeys(script);
|
|
279
|
-
// The workflow executor starts background work unless callers pass async:false.
|
|
280
|
-
const mode = async === false ? "foreground" : "background";
|
|
281
|
-
const preflight = formatWorkflowPreflightCall(preflightInput);
|
|
282
|
-
if (keys.length === 0) return `workflow script · ${mode}${preflight ? ` · ${preflight}` : ""}`;
|
|
283
|
-
const visibleKeys = keys.slice(0, 4).join(", ");
|
|
284
|
-
const remainder = keys.length > 4 ? `, +${keys.length - 4}` : "";
|
|
285
|
-
return `workflow · ${mode} · ${keys.length} lane${keys.length === 1 ? "" : "s"}: ${visibleKeys}${remainder}${preflight ? ` · ${preflight}` : ""}`;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Derive subagent session base directory from parent session file.
|
|
290
|
-
* If parent session is ~/.pi/agent/sessions/abc123.jsonl,
|
|
291
|
-
* returns ~/.pi/agent/sessions/abc123/ as the base.
|
|
292
|
-
* Callers add runId to create the actual session root: abc123/{runId}/
|
|
293
|
-
* Falls back to a unique temp directory if no parent session.
|
|
294
|
-
*/
|
|
295
|
-
function getSubagentSessionRoot(parentSessionFile: string | null): string {
|
|
296
|
-
if (parentSessionFile) {
|
|
297
|
-
const baseName = path.basename(parentSessionFile, ".jsonl");
|
|
298
|
-
const sessionsDir = path.dirname(parentSessionFile);
|
|
299
|
-
return path.join(sessionsDir, baseName);
|
|
300
|
-
}
|
|
301
|
-
return fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagent-session-"));
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function expandTilde(p: string): string {
|
|
305
|
-
return p.startsWith("~/") ? path.join(os.homedir(), p.slice(2)) : p;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
function isSlashResultRunning(result: { details?: Details }): boolean {
|
|
309
|
-
return result.details?.progress?.some((entry) => entry.status === "running")
|
|
310
|
-
|| result.details?.results.some((entry) => entry.progress?.status === "running")
|
|
311
|
-
|| false;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function isSlashResultError(result: { details?: Details }): boolean {
|
|
315
|
-
return result.details?.results.some((entry) => entry.exitCode !== 0 && entry.progress?.status !== "running") || false;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function rebuildSlashResultContainer(
|
|
319
|
-
container: Container,
|
|
320
|
-
result: AgentToolResult<Details>,
|
|
321
|
-
options: { expanded: boolean },
|
|
322
|
-
theme: ExtensionContext["ui"]["theme"],
|
|
323
|
-
rendererConfig?: MainWindowRendererConfig,
|
|
324
|
-
foregroundDetachShortcut?: string,
|
|
325
|
-
): void {
|
|
326
|
-
container.clear();
|
|
327
|
-
container.addChild(new Spacer(1));
|
|
328
|
-
const boxTheme = isSlashResultRunning(result) ? "toolPendingBg" : isSlashResultError(result) ? "toolErrorBg" : "toolSuccessBg";
|
|
329
|
-
const box = new Box(1, 1, (text: string) => theme.bg(boxTheme, text));
|
|
330
|
-
box.addChild(renderSubagentResult(result, options, theme, undefined, rendererConfig, foregroundDetachShortcut));
|
|
331
|
-
container.addChild(box);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function createSlashResultComponent(
|
|
335
|
-
details: SlashMessageDetails,
|
|
336
|
-
options: { expanded: boolean },
|
|
337
|
-
theme: ExtensionContext["ui"]["theme"],
|
|
338
|
-
rendererConfig?: MainWindowRendererConfig,
|
|
339
|
-
foregroundDetachShortcut?: string,
|
|
340
|
-
getCurrentTheme: () => ExtensionContext["ui"]["theme"] = () => theme,
|
|
341
|
-
): Container {
|
|
342
|
-
const container = new Container();
|
|
343
|
-
let lastVersion = -1;
|
|
344
|
-
let lastTheme: ExtensionContext["ui"]["theme"] | undefined;
|
|
345
|
-
container.render = (width: number): string[] => {
|
|
346
|
-
const snapshot = getSlashRenderableSnapshot(details);
|
|
347
|
-
const currentTheme = getCurrentTheme();
|
|
348
|
-
if (snapshot.version !== lastVersion || currentTheme !== lastTheme || isSlashResultRunning(snapshot.result)) {
|
|
349
|
-
lastVersion = snapshot.version;
|
|
350
|
-
lastTheme = currentTheme;
|
|
351
|
-
rebuildSlashResultContainer(container, snapshot.result, options, currentTheme, rendererConfig, foregroundDetachShortcut);
|
|
352
|
-
}
|
|
353
|
-
return Container.prototype.render.call(container, width);
|
|
354
|
-
};
|
|
355
|
-
return container;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
class SubagentControlNoticeComponent implements Component {
|
|
359
|
-
private readonly details: SubagentControlMessageDetails;
|
|
360
|
-
private readonly theme: ExtensionContext["ui"]["theme"];
|
|
361
|
-
|
|
362
|
-
constructor(details: SubagentControlMessageDetails, theme: ExtensionContext["ui"]["theme"]) {
|
|
363
|
-
this.details = details;
|
|
364
|
-
this.theme = theme;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
invalidate(): void {}
|
|
368
|
-
|
|
369
|
-
render(width: number): string[] {
|
|
370
|
-
const eventLabel = this.details.event.type.replaceAll("_", " ");
|
|
371
|
-
if (width < 3) return [truncateToWidth(`Subagent ${eventLabel}`, width)];
|
|
372
|
-
const bodyWidth = Math.max(1, width - 2);
|
|
373
|
-
const borderChar = "─";
|
|
374
|
-
const header = ` ⚠ Subagent ${eventLabel}: ${this.details.event.agent} `;
|
|
375
|
-
const headerText = truncateToWidth(header, bodyWidth, "");
|
|
376
|
-
const headerPadding = Math.max(0, bodyWidth - visibleWidth(headerText));
|
|
377
|
-
const lines = [this.theme.fg("accent", `╭${headerText}${borderChar.repeat(headerPadding)}╮`)];
|
|
378
|
-
|
|
379
|
-
for (const line of wrapTextWithAnsi(formatSubagentControlNotice(this.details), bodyWidth)) {
|
|
380
|
-
const text = truncateToWidth(line, bodyWidth, "");
|
|
381
|
-
const padding = Math.max(0, bodyWidth - visibleWidth(text));
|
|
382
|
-
lines.push(this.theme.fg("accent", `│${text}${" ".repeat(padding)}│`));
|
|
383
|
-
}
|
|
384
|
-
lines.push(this.theme.fg("accent", `╰${borderChar.repeat(bodyWidth)}╯`));
|
|
385
|
-
return lines;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
export function projectActiveHerdrRuns(state: SubagentState): HerdrStatusRun[] {
|
|
390
|
-
const active = (status: string) => status === "queued" || status === "running";
|
|
391
|
-
const foregroundChildrenByWorkflow = new Map<string, Array<{ agent: string; needsAttention: boolean }>>();
|
|
392
|
-
for (const control of state.foregroundControls.values()) {
|
|
393
|
-
if (!control.parentWorkflowRunId) continue;
|
|
394
|
-
const children = control.activeChildren?.size
|
|
395
|
-
? [...control.activeChildren.values()].map((child) => ({
|
|
396
|
-
agent: child.agent,
|
|
397
|
-
needsAttention: child.currentActivityState === "needs_attention",
|
|
398
|
-
}))
|
|
399
|
-
: control.currentAgent
|
|
400
|
-
? [{ agent: control.currentAgent, needsAttention: control.currentActivityState === "needs_attention" }]
|
|
401
|
-
: [];
|
|
402
|
-
if (children.length === 0) continue;
|
|
403
|
-
const existing = foregroundChildrenByWorkflow.get(control.parentWorkflowRunId) ?? [];
|
|
404
|
-
existing.push(...children);
|
|
405
|
-
foregroundChildrenByWorkflow.set(control.parentWorkflowRunId, existing);
|
|
406
|
-
}
|
|
407
|
-
return [...state.asyncJobs.values()]
|
|
408
|
-
.filter((job) => active(job.status))
|
|
409
|
-
.map((job) => {
|
|
410
|
-
const children = job.mode === "workflow" ? foregroundChildrenByWorkflow.get(job.asyncId) : undefined;
|
|
411
|
-
const currentStep = job.steps?.find((step) => step.status === "running")
|
|
412
|
-
?? (job.currentStep !== undefined ? job.steps?.[job.currentStep] : undefined)
|
|
413
|
-
?? job.steps?.find((step) => step.status === "pending");
|
|
414
|
-
return {
|
|
415
|
-
id: job.asyncId,
|
|
416
|
-
agents: children?.length ? children.map((child) => child.agent) : job.agents,
|
|
417
|
-
...(currentStep?.label ? { taskLabel: currentStep.label } : {}),
|
|
418
|
-
needsAttention: job.activityState === "needs_attention" || children?.some((child) => child.needsAttention),
|
|
419
|
-
};
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
424
|
-
if (process.env[SUBAGENT_CHILD_ENV] === "1") {
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
const runtimeRegistry = getRuntimeRegistry();
|
|
428
|
-
|
|
429
|
-
DIRS.results = ensureAccessibleDir(DIRS.results);
|
|
430
|
-
DIRS.async = ensureAccessibleDir(DIRS.async);
|
|
431
|
-
cleanupOldChainDirs();
|
|
432
|
-
|
|
433
|
-
const config = loadConfig();
|
|
434
|
-
const waitToolConfig = resolveWaitToolConfig(config.waitTool);
|
|
435
|
-
const asyncByDefault = resolveAsyncByDefault(config);
|
|
436
|
-
const fleetViewEnabled = config.fleetView !== false;
|
|
437
|
-
const fleetViewPlacement = resolveFleetViewPlacement(config.fleetViewPlacement);
|
|
438
|
-
const asyncWidgetEnabled = config.asyncWidget !== false;
|
|
439
|
-
const summaryInlineToolDisplay = config.inlineToolDisplay === "summary";
|
|
440
|
-
const tempArtifactsDir = getArtifactsDir(null);
|
|
441
|
-
const artifactCleanupDays = config.artifactConfig?.cleanupDays ?? DEFAULT_ARTIFACT_CONFIG.cleanupDays;
|
|
442
|
-
cleanupAllArtifactDirs(artifactCleanupDays);
|
|
443
|
-
let resultIndexCleanupTimer: ReturnType<typeof setTimeout> | undefined;
|
|
444
|
-
|
|
445
|
-
const state: SubagentState = {
|
|
446
|
-
baseCwd: "",
|
|
447
|
-
currentSessionId: null,
|
|
448
|
-
statusProjectionSessionId: null,
|
|
449
|
-
completionOwnerId: currentCompletionOwnerId(),
|
|
450
|
-
artifactDirPreference: config.artifactDir ?? DEFAULT_ARTIFACT_CONFIG.dir,
|
|
451
|
-
...(config.authorityPolicy ? { authorityPolicy: config.authorityPolicy } : {}),
|
|
452
|
-
...(config.missions ? { missionStoreConfig: config.missions } : {}),
|
|
453
|
-
parentSessionFile: null,
|
|
454
|
-
trustedSessionRoots: [],
|
|
455
|
-
subagentInProgress: false,
|
|
456
|
-
subagentSpawns: {
|
|
457
|
-
sessionId: null,
|
|
458
|
-
count: 0,
|
|
459
|
-
configuredLimit: resolveMaxSubagentSpawnsPerSession(config.maxSubagentSpawnsPerSession) ?? null,
|
|
460
|
-
granted: 0,
|
|
461
|
-
grantHistory: [],
|
|
462
|
-
},
|
|
463
|
-
activeAsyncCapacity: { used: 0, limit: resolveMaxActiveAsyncRunsPerSession(config.maxActiveAsyncRunsPerSession) ?? 0 },
|
|
464
|
-
herdrProjectPanes: new Map(),
|
|
465
|
-
asyncJobs: new Map(),
|
|
466
|
-
fleetJobs: new Map(),
|
|
467
|
-
foregroundRuns: new Map(),
|
|
468
|
-
foregroundControls: new Map(),
|
|
469
|
-
lastForegroundControlId: null,
|
|
470
|
-
cleanupTimers: new Map(),
|
|
471
|
-
lastUiContext: null,
|
|
472
|
-
poller: null,
|
|
473
|
-
completionSeen: new Map(),
|
|
474
|
-
widgetsSuspended: false,
|
|
475
|
-
watcher: null,
|
|
476
|
-
watcherRestartTimer: null,
|
|
477
|
-
resultFileCoalescer: {
|
|
478
|
-
schedule: () => false,
|
|
479
|
-
clear: () => {},
|
|
480
|
-
},
|
|
481
|
-
};
|
|
482
|
-
const withLastUiContext = <T>(run: (ctx: ExtensionContext) => T): T | undefined => {
|
|
483
|
-
const cached = state.lastUiContext;
|
|
484
|
-
return withCachedUiContext(cached, () => {
|
|
485
|
-
if (state.lastUiContext === cached) state.lastUiContext = null;
|
|
486
|
-
}, run);
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
const supervisorChannel = createNativeSupervisorChannel(pi, state, {
|
|
490
|
-
getCurrentOwnerStates: () => executor.getCurrentSupervisorOwnerStates(),
|
|
491
|
-
});
|
|
492
|
-
const waitSubscriptionManager = createWaitSubscriptionManager(pi, state);
|
|
493
|
-
const mainWatchdog = registerMainWatchdog(pi);
|
|
494
|
-
const resultDeliveryOwnership = createResultDeliveryOwnership(state);
|
|
495
|
-
const completionNotifier = registerSubagentNotify(pi, state, { batchConfig: config.completionBatch, ownership: resultDeliveryOwnership });
|
|
496
|
-
let retainedNestedRouteTracker: ReturnType<typeof createRetainedNestedRouteTracker> | undefined;
|
|
497
|
-
const fleetStatus = fleetViewEnabled
|
|
498
|
-
? new SubagentFleetStatus(state, async (itemKey) => {
|
|
499
|
-
const ctx = withLastUiContext((current) => current);
|
|
500
|
-
if (!ctx) return;
|
|
501
|
-
try {
|
|
502
|
-
await openSubagentFleet(ctx, state, { initialKey: itemKey, asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: config.fleetKeybindings, inspectorPlugins: createBuiltinInspectorPlugins() });
|
|
503
|
-
} catch (error) {
|
|
504
|
-
if (isStaleExtensionContextError(error)) {
|
|
505
|
-
if (state.lastUiContext === ctx) state.lastUiContext = null;
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
throw error;
|
|
509
|
-
}
|
|
510
|
-
}, { placement: fleetViewPlacement, onWorkflowCoverageChange: setInlineWorkflowCoverage })
|
|
511
|
-
: undefined;
|
|
512
|
-
let executorScheduled: ((id: string, params: SubagentParamsLike, signal: AbortSignal, ctx: ExtensionContext) => Promise<AgentToolResult<Details>>) | undefined;
|
|
513
|
-
let goalTurnId = 0;
|
|
514
|
-
let parentSessionEnvValue: string | null = null;
|
|
515
|
-
let releaseHostSessionLiveness = () => {};
|
|
516
|
-
const scheduledStoreRoot = config.scheduledRuns?.storeRoot === undefined ? undefined : resolveScheduledStoreRoot(config.scheduledRuns.storeRoot);
|
|
517
|
-
const scheduledRunManager = createScheduledRunManager({
|
|
518
|
-
config,
|
|
519
|
-
storeRoot: scheduledStoreRoot,
|
|
520
|
-
launch: (params, ctx, signal) => {
|
|
521
|
-
if (!executorScheduled) {
|
|
522
|
-
return Promise.resolve({
|
|
523
|
-
content: [{ type: "text", text: "Scheduled subagent launch is unavailable (executor not ready)." }],
|
|
524
|
-
isError: true,
|
|
525
|
-
details: { mode: "management" as const, results: [] },
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
return executorScheduled(randomUUID(), params, signal, ctx);
|
|
529
|
-
},
|
|
530
|
-
resolveCapabilityCeiling: (sessionId) => resolveCurrentSubagentCapabilityCeiling(sessionId),
|
|
531
|
-
});
|
|
532
|
-
let refreshResultDelivery = () => {};
|
|
533
|
-
let advertisedAgents: AgentConfig[] = [];
|
|
534
|
-
let advertisedContext: Pick<ExtensionContext, "cwd" | "model"> | undefined;
|
|
535
|
-
const refreshAdvertisedAgents = () => {
|
|
536
|
-
advertisedAgents = [];
|
|
537
|
-
if (!advertisedContext) return;
|
|
538
|
-
clearAgentDiscoveryCache();
|
|
539
|
-
advertisedAgents = discoverAgents(advertisedContext.cwd, "both", advertisedContext.model?.provider).agents
|
|
540
|
-
.filter((agent) => agent.advertise === true);
|
|
541
|
-
};
|
|
542
|
-
const hasResultDeliveryDemand = () => {
|
|
543
|
-
if ([...state.asyncJobs.values()].some((job) => job.status === "queued" || job.status === "running")) return true;
|
|
544
|
-
if (state.foregroundControls.size > 0) return true;
|
|
545
|
-
if (scheduledRunManager.observedCompletionRunIds().size > 0) return true;
|
|
546
|
-
return missionObserverResultCandidateFiles(DIRS.results).length > 0;
|
|
547
|
-
};
|
|
548
|
-
const discoverAgentsForRuntime = (cwd: string, scope: AgentScope, preferredModelProvider?: string) => {
|
|
549
|
-
if (listRuntimeAgentConfigs(pi).length === 0) return discoverAgents(cwd, scope, preferredModelProvider);
|
|
550
|
-
const snapshot = discoverAgentSnapshot(cwd, scope, preferredModelProvider, { includeChains: false });
|
|
551
|
-
const discovered = snapshot.effective;
|
|
552
|
-
const all = snapshot.all;
|
|
553
|
-
const configuredAgents: AgentConfig[] = [
|
|
554
|
-
...all.builtin,
|
|
555
|
-
...all.package,
|
|
556
|
-
...all.user,
|
|
557
|
-
...all.project,
|
|
558
|
-
];
|
|
559
|
-
const merged = mergeRuntimeAgents(pi, discovered, configuredAgents);
|
|
560
|
-
if (discovered.maxThinking === undefined) return merged;
|
|
561
|
-
return {
|
|
562
|
-
...merged,
|
|
563
|
-
agents: merged.agents.map((agent) => agent.maxThinking === discovered.maxThinking ? agent : { ...agent, maxThinking: discovered.maxThinking }),
|
|
564
|
-
};
|
|
565
|
-
};
|
|
566
|
-
const { ensurePoller, refreshWidget, handleStarted, handleComplete, resetJobs, restoreActiveJobs, dispose: disposeAsyncJobTracker } = createAsyncJobTracker(pi, state, DIRS.async, {
|
|
567
|
-
widgetEnabled: asyncWidgetEnabled,
|
|
568
|
-
onJobTerminal: () => refreshResultDelivery(),
|
|
569
|
-
supervisorRequestState: supervisorChannel.getSupervisorRequestState,
|
|
570
|
-
});
|
|
571
|
-
const resultWatcher = createResultWatcher(
|
|
572
|
-
pi,
|
|
573
|
-
state,
|
|
574
|
-
DIRS.results,
|
|
575
|
-
10 * 60 * 1000,
|
|
576
|
-
{
|
|
577
|
-
notifier: completionNotifier,
|
|
578
|
-
ownership: resultDeliveryOwnership,
|
|
579
|
-
observeCompletion: (result) => scheduledRunManager.handleAsyncCompletion(result),
|
|
580
|
-
observedCompletionRunIds: () => scheduledRunManager.observedCompletionRunIds(),
|
|
581
|
-
hasDeliveryDemand: hasResultDeliveryDemand,
|
|
582
|
-
deliverIntercomResults: config.intercomBridge?.resultDelivery === true,
|
|
583
|
-
resultScanLogging: config.resultScanLogging,
|
|
584
|
-
},
|
|
585
|
-
);
|
|
586
|
-
const { startResultWatcher, transitionResultDelivery, primeExistingResults, stopResultWatcher } = resultWatcher;
|
|
587
|
-
refreshResultDelivery = resultWatcher.refreshResultDelivery;
|
|
588
|
-
const asyncRetentionAbort = new AbortController();
|
|
589
|
-
let asyncRetentionTimer: ReturnType<typeof setTimeout> | undefined;
|
|
590
|
-
const startSessionMaintenance = () => {
|
|
591
|
-
if (!resultIndexCleanupTimer) {
|
|
592
|
-
resultIndexCleanupTimer = setTimeout(() => {
|
|
593
|
-
try {
|
|
594
|
-
cleanupResultIndexes(DIRS.results);
|
|
595
|
-
} catch (error) {
|
|
596
|
-
console.error("Failed to clean stale subagent result indexes:", error);
|
|
597
|
-
}
|
|
598
|
-
}, 30_000);
|
|
599
|
-
resultIndexCleanupTimer.unref?.();
|
|
600
|
-
}
|
|
601
|
-
waitSubscriptionManager.start();
|
|
602
|
-
if (!asyncRetentionTimer) {
|
|
603
|
-
asyncRetentionTimer = setTimeout(async () => {
|
|
604
|
-
try {
|
|
605
|
-
await cleanupAsyncRetention({
|
|
606
|
-
asyncDirRoot: DIRS.async,
|
|
607
|
-
resultsDir: DIRS.results,
|
|
608
|
-
signal: asyncRetentionAbort.signal,
|
|
609
|
-
protectedRunIds: new Set([
|
|
610
|
-
...state.asyncJobs.keys(),
|
|
611
|
-
...(state.workflowControllers?.keys() ?? []),
|
|
612
|
-
...scheduledRunManager.referencedAsyncRunIds(),
|
|
613
|
-
]),
|
|
614
|
-
});
|
|
615
|
-
} catch (error) {
|
|
616
|
-
console.error("Failed to clean retained async subagent state:", error);
|
|
617
|
-
}
|
|
618
|
-
}, ASYNC_RETENTION_DELAY_MS);
|
|
619
|
-
asyncRetentionTimer.unref?.();
|
|
620
|
-
}
|
|
621
|
-
};
|
|
622
|
-
|
|
623
|
-
const executorDeps: Parameters<typeof createSubagentExecutor>[0] = {
|
|
624
|
-
pi,
|
|
625
|
-
state,
|
|
626
|
-
config,
|
|
627
|
-
asyncByDefault,
|
|
628
|
-
waitToolEnabled: waitToolConfig.enabled,
|
|
629
|
-
waitToolDefaultTimeoutMs: waitToolConfig.defaultTimeoutMs,
|
|
630
|
-
handleScheduledRunAction: (params, ctx) => scheduledRunManager.handleToolCall(params, ctx),
|
|
631
|
-
watchdog: mainWatchdog,
|
|
632
|
-
tempArtifactsDir,
|
|
633
|
-
getSubagentSessionRoot,
|
|
634
|
-
expandTilde,
|
|
635
|
-
discoverAgents: discoverAgentsForRuntime,
|
|
636
|
-
onAgentsChanged: () => {
|
|
637
|
-
try {
|
|
638
|
-
refreshAdvertisedAgents();
|
|
639
|
-
} catch (error) {
|
|
640
|
-
// The mutation already persisted. Withdraw stale guidance, not its result.
|
|
641
|
-
console.error("Failed to refresh advertised agents; catalog withdrawn until refresh:", error);
|
|
642
|
-
}
|
|
643
|
-
},
|
|
644
|
-
activateSupervisorTransport: () => supervisorChannel.activateTransport(),
|
|
645
|
-
findPendingAsks: (target) => supervisorChannel.findPendingAsks(target),
|
|
646
|
-
refreshResultDelivery: () => refreshResultDelivery(),
|
|
647
|
-
trackRetainedNestedRoute: undefined,
|
|
648
|
-
};
|
|
649
|
-
const executor = createSubagentExecutor(executorDeps);
|
|
650
|
-
executorScheduled = executor.executeScheduled;
|
|
651
|
-
|
|
652
|
-
pi.registerMessageRenderer<SupervisorRequestMessageDetails>(SUPERVISOR_REQUEST_MESSAGE_TYPE, renderSupervisorRequest);
|
|
653
|
-
const registerEntryRenderer = (pi as unknown as {
|
|
654
|
-
registerEntryRenderer?: (customType: string, renderer: (entry: { data?: unknown }, options: { expanded: boolean }, theme: ExtensionContext["ui"]["theme"]) => Component | undefined) => void;
|
|
655
|
-
}).registerEntryRenderer;
|
|
656
|
-
if (typeof registerEntryRenderer === "function") {
|
|
657
|
-
registerEntryRenderer.call(pi, SUPERVISOR_REPLY_ENTRY_TYPE, renderSupervisorReply);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
pi.registerMessageRenderer<SlashMessageDetails>(SLASH_RESULT_TYPE, (message, options, theme) => {
|
|
661
|
-
const details = resolveSlashMessageDetails(message.details);
|
|
662
|
-
if (!details) return undefined;
|
|
663
|
-
return createSlashResultComponent(
|
|
664
|
-
details,
|
|
665
|
-
options,
|
|
666
|
-
theme,
|
|
667
|
-
config.mainWindowRenderer,
|
|
668
|
-
config.foregroundDetachShortcut,
|
|
669
|
-
() => state.lastUiContext?.ui.theme ?? theme,
|
|
670
|
-
);
|
|
671
|
-
});
|
|
672
|
-
|
|
673
|
-
pi.registerMessageRenderer<undefined>(SLASH_TEXT_RESULT_TYPE, (message, _options, _theme) => {
|
|
674
|
-
const content = typeof message.content === "string"
|
|
675
|
-
? message.content
|
|
676
|
-
: message.content
|
|
677
|
-
.filter((entry) => entry.type === "text")
|
|
678
|
-
.map((entry) => entry.text)
|
|
679
|
-
.join("\n");
|
|
680
|
-
return new Text(content, 0, 0);
|
|
681
|
-
});
|
|
682
|
-
|
|
683
|
-
pi.registerMessageRenderer<SubagentNotifyDetails>("subagent-notify", (message, options, theme) => {
|
|
684
|
-
const content = typeof message.content === "string" ? message.content : "";
|
|
685
|
-
const details = (message.details as SubagentNotifyDetails | undefined) ?? parseSubagentNotifyContent(content);
|
|
686
|
-
if (!details) return new Text(content, 0, 0);
|
|
687
|
-
const icon = details.status === "completed"
|
|
688
|
-
? theme.fg("success", "✓")
|
|
689
|
-
: details.status === "paused"
|
|
690
|
-
? theme.fg("warning", "■")
|
|
691
|
-
: theme.fg("error", "✗");
|
|
692
|
-
const parts: string[] = [];
|
|
693
|
-
if (details.taskInfo) parts.push(details.taskInfo);
|
|
694
|
-
if (details.durationMs !== undefined) parts.push(formatDuration(details.durationMs));
|
|
695
|
-
let text = `${icon} ${theme.bold(details.agent)} ${theme.fg("dim", details.status)}`;
|
|
696
|
-
if (parts.length > 0) text += ` ${theme.fg("dim", "·")} ${parts.map((part) => theme.fg("dim", part)).join(` ${theme.fg("dim", "·")} `)}`;
|
|
697
|
-
const trimmedPreview = details.resultPreview.trim();
|
|
698
|
-
const previewLines = options.expanded
|
|
699
|
-
? trimmedPreview.split("\n").filter((line) => line.trim())
|
|
700
|
-
: [trimmedPreview.split("\n", 1)[0] ?? ""].filter((line) => line.trim());
|
|
701
|
-
for (const line of previewLines.length > 0 ? previewLines : ["(no output)"]) {
|
|
702
|
-
text += `\n ${theme.fg("dim", `⎿ ${line}`)}`;
|
|
703
|
-
}
|
|
704
|
-
if (!options.expanded && trimmedPreview.includes("\n")) {
|
|
705
|
-
const expandKey = keyText("app.tools.expand");
|
|
706
|
-
text += `\n ${theme.fg("dim", `${expandKey} full notification`)}`;
|
|
707
|
-
}
|
|
708
|
-
if (details.workflowRunId) {
|
|
709
|
-
text += `\n ${theme.fg("muted", `workflow: ${details.workflowRunId}`)}`;
|
|
710
|
-
}
|
|
711
|
-
if (details.childRuns?.length) {
|
|
712
|
-
text += `\n ${theme.fg("muted", `children: ${details.childRuns.map((child) => `${child.workflowKey ?? child.agent ?? "child"}=${child.runId}`).join(", ")}`)}`;
|
|
713
|
-
}
|
|
714
|
-
if (details.reconciledFromDetachedChild) {
|
|
715
|
-
text += `\n ${theme.fg("muted", `reconciled child: ${details.reconciledFromDetachedChild}`)}`;
|
|
716
|
-
}
|
|
717
|
-
if (details.sessionLabel && details.sessionValue) {
|
|
718
|
-
text += `\n ${theme.fg("muted", `${details.sessionLabel}: ${shortenPath(details.sessionValue)}`)}`;
|
|
719
|
-
}
|
|
720
|
-
return new Text(text, 0, 0);
|
|
721
|
-
});
|
|
722
|
-
|
|
723
|
-
pi.registerMessageRenderer<SubagentSteeringMessageDetails>(SUBAGENT_STEERING_MESSAGE_TYPE, (message, _options, theme) => {
|
|
724
|
-
const details = message.details as SubagentSteeringMessageDetails | undefined;
|
|
725
|
-
if (!details) return undefined;
|
|
726
|
-
return new Text(theme.fg(details.state === "recovered" ? "warning" : "error", formatSteeringNotice(details)), 0, 0);
|
|
727
|
-
});
|
|
728
|
-
|
|
729
|
-
pi.registerMessageRenderer<SubagentControlMessageDetails>(SUBAGENT_CONTROL_MESSAGE_TYPE, (message, _options, theme) => {
|
|
730
|
-
const details = message.details as SubagentControlMessageDetails | undefined;
|
|
731
|
-
if (!details?.event) return undefined;
|
|
732
|
-
const content = typeof message.content === "string" ? message.content : undefined;
|
|
733
|
-
return new SubagentControlNoticeComponent({ ...details, noticeText: formatSubagentControlNotice(details, content) }, theme);
|
|
734
|
-
});
|
|
735
|
-
|
|
736
|
-
const executeSubagentCollapsed = (id: string, params: SubagentParamsLike, signal: AbortSignal, onUpdate: ((result: AgentToolResult<Details>) => void) | undefined, ctx: ExtensionContext) => {
|
|
737
|
-
if (ctx.hasUI) ctx.ui.setToolsExpanded(false);
|
|
738
|
-
return executor.executePublic(id, params, signal, onUpdate, ctx);
|
|
739
|
-
};
|
|
740
|
-
|
|
741
|
-
const slashBridge = registerSlashSubagentBridge({
|
|
742
|
-
events: pi.events,
|
|
743
|
-
getContext: () => state.lastUiContext,
|
|
744
|
-
execute: (id, params, signal, onUpdate, ctx) =>
|
|
745
|
-
executeSubagentCollapsed(id, params, signal, onUpdate, ctx),
|
|
746
|
-
});
|
|
747
|
-
|
|
748
|
-
const promptTemplateBridge = registerPromptTemplateDelegationBridge({
|
|
749
|
-
events: pi.events,
|
|
750
|
-
getContext: () => state.lastUiContext,
|
|
751
|
-
execute: (requestId, params, signal, ctx, onUpdate) =>
|
|
752
|
-
executeSubagentCollapsed(requestId, params, signal, onUpdate, ctx),
|
|
753
|
-
executeStructured: (requestId, params, signal, ctx, onUpdate) => {
|
|
754
|
-
if (ctx.hasUI) ctx.ui.setToolsExpanded(false);
|
|
755
|
-
return executor.executeDelegated(requestId, params, signal, onUpdate, ctx);
|
|
756
|
-
},
|
|
757
|
-
});
|
|
758
|
-
|
|
759
|
-
const rpcBridge = registerSubagentRpcBridge({
|
|
760
|
-
events: pi.events,
|
|
761
|
-
getContext: () => state.lastUiContext,
|
|
762
|
-
execute: (id, params, signal, onUpdate, ctx) => executor.executePublic(id, params, signal, onUpdate, ctx),
|
|
763
|
-
state,
|
|
764
|
-
});
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
const parameters = createSubagentParamsSchema();
|
|
768
|
-
const tool: ToolDefinition<typeof parameters, Details> = {
|
|
769
|
-
name: "subagent",
|
|
770
|
-
label: "Subagent",
|
|
771
|
-
description: buildSubagentToolDescription(config),
|
|
772
|
-
...buildSubagentToolPromptMetadata(config),
|
|
773
|
-
parameters,
|
|
774
|
-
|
|
775
|
-
async execute(id, params, signal, onUpdate, ctx) {
|
|
776
|
-
return finalizeToolResult(await executeSubagentCollapsed(id, params as SubagentParamsLike, signal ?? new AbortController().signal, onUpdate, ctx));
|
|
777
|
-
},
|
|
778
|
-
|
|
779
|
-
renderCall(args, theme) {
|
|
780
|
-
const gap = " ".repeat(config.mainWindowRenderer?.horizontalSpacing ?? 1);
|
|
781
|
-
const title = theme.fg("toolTitle", theme.bold("subagent"));
|
|
782
|
-
if (args.action) {
|
|
783
|
-
const target = args.agent || "";
|
|
784
|
-
return new Text(
|
|
785
|
-
`${title}${gap}${args.action}${target ? `${gap}${theme.fg("accent", target)}` : ""}`,
|
|
786
|
-
0, 0,
|
|
787
|
-
);
|
|
788
|
-
}
|
|
789
|
-
if (args.workflowScript)
|
|
790
|
-
return new Text(
|
|
791
|
-
`${title}${gap}${formatWorkflowManifest(args.workflowScript, args.async, false, args.preflight)}`,
|
|
792
|
-
0,
|
|
793
|
-
0,
|
|
794
|
-
);
|
|
795
|
-
if (args.workflowScriptPath)
|
|
796
|
-
return new Text(
|
|
797
|
-
`${title}${gap}${theme.fg("accent", args.workflowScriptPath)}${args.async === true ? `${gap}${theme.fg("warning", "[async]")}` : ""}${args.preflight !== undefined ? `${gap}${theme.fg("dim", formatWorkflowPreflightCall(args.preflight))}` : ""}`,
|
|
798
|
-
0,
|
|
799
|
-
0,
|
|
800
|
-
);
|
|
801
|
-
const asyncLabel = args.async === true ? `${gap}${theme.fg("warning", "[async]")}` : "";
|
|
802
|
-
return new Text(
|
|
803
|
-
`${title}${gap}${theme.fg("accent", args.agent || "?")}${asyncLabel}`,
|
|
804
|
-
0,
|
|
805
|
-
0,
|
|
806
|
-
);
|
|
807
|
-
},
|
|
808
|
-
|
|
809
|
-
renderResult(result, options, theme, context) {
|
|
810
|
-
clearLegacyResultAnimationTimer(context);
|
|
811
|
-
const renderedResult = { ...result, isError: context.isError };
|
|
812
|
-
return summaryInlineToolDisplay
|
|
813
|
-
? renderSubagentSummary(renderedResult, options, theme)
|
|
814
|
-
: renderSubagentResult(renderedResult, options, theme, undefined, config.mainWindowRenderer, config.foregroundDetachShortcut);
|
|
815
|
-
},
|
|
816
|
-
|
|
817
|
-
};
|
|
818
|
-
|
|
819
|
-
pi.registerTool(tool);
|
|
820
|
-
|
|
821
|
-
pi.on("before_agent_start", (event, ctx) => {
|
|
822
|
-
const selectedTools = event.systemPromptOptions?.selectedTools ?? (typeof pi.getActiveTools === "function" ? pi.getActiveTools() : []);
|
|
823
|
-
const sessionId = state.currentSessionId ?? resolveCurrentSessionId(ctx.sessionManager);
|
|
824
|
-
const advertisedPrompt = Array.isArray(selectedTools) && selectedTools.includes("subagent")
|
|
825
|
-
? buildAdvertisedAgentPrompt(advertisedAgents, resolveCurrentSubagentCapabilityCeiling(sessionId))
|
|
826
|
-
: undefined;
|
|
827
|
-
const systemPrompt = appendAdvertisedAgentPrompt(event.systemPrompt, advertisedPrompt);
|
|
828
|
-
if (systemPrompt !== event.systemPrompt) return { systemPrompt };
|
|
829
|
-
});
|
|
830
|
-
|
|
831
|
-
registerWaitTool(pi, state, waitToolConfig.enabled, waitSubscriptionManager, waitToolConfig.defaultTimeoutMs);
|
|
832
|
-
|
|
833
|
-
pi.on("agent_end", async (_event, ctx) => {
|
|
834
|
-
if (!ctx.hasUI) await drainOutstandingWork({ state, events: pi.events, hasPendingSupervisorRequest: supervisorChannel.hasPendingRequests });
|
|
835
|
-
const ownerSessionId = state.currentSessionId;
|
|
836
|
-
if (!ownerSessionId) return;
|
|
837
|
-
goalTurnId += 1;
|
|
838
|
-
try {
|
|
839
|
-
const location = resolveMissionStoreLocation({ projectRoot: state.baseCwd, ...(config.missions ? { config: config.missions } : {}) });
|
|
840
|
-
const retainedChildren = listRetainedChildren(DIRS.async, ownerSessionId);
|
|
841
|
-
for (const notice of collectGoalContinuationNotices({ location, ownerSessionId, retainedChildren, turnId: goalTurnId })) {
|
|
842
|
-
handleSubagentControlNotice({
|
|
843
|
-
pi,
|
|
844
|
-
state,
|
|
845
|
-
visibleControlNotices: new Set(),
|
|
846
|
-
details: { source: "goal", event: notice.event, noticeText: notice.message },
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
} catch (error) {
|
|
850
|
-
console.error("Failed to evaluate goal missions:", error);
|
|
851
|
-
}
|
|
852
|
-
});
|
|
853
|
-
|
|
854
|
-
const disposeSlashCommands = registerSlashCommands(pi, state, {
|
|
855
|
-
fleetKeybindings: config.fleetKeybindings,
|
|
856
|
-
foregroundDetachShortcut: config.foregroundDetachShortcut,
|
|
857
|
-
});
|
|
858
|
-
|
|
859
|
-
let visibleControlNotices = new Set<string>();
|
|
860
|
-
const activeHerdrRuns = () => projectActiveHerdrRuns(state);
|
|
861
|
-
const herdrStatusBridge = registerHerdrStatusBridge({
|
|
862
|
-
events: pi.events,
|
|
863
|
-
getRuns: activeHerdrRuns,
|
|
864
|
-
getProjectPaneCount: () => [...(state.herdrProjectPanes?.values() ?? [])].filter((pane) => pane.state === "open").length,
|
|
865
|
-
async runHerdr(args) {
|
|
866
|
-
await pi.exec(process.env.HERDR_BIN || "herdr", [...args], { timeout: 5_000 });
|
|
867
|
-
},
|
|
868
|
-
});
|
|
869
|
-
const controlEventHandler = (payload: unknown) => {
|
|
870
|
-
handleSubagentControlNotice({
|
|
871
|
-
pi,
|
|
872
|
-
state,
|
|
873
|
-
visibleControlNotices,
|
|
874
|
-
details: payload as SubagentControlMessageDetails,
|
|
875
|
-
});
|
|
876
|
-
};
|
|
877
|
-
const steeringNoticeHandler = (payload: unknown) => {
|
|
878
|
-
handleSubagentSteeringNotice({ pi, state, details: payload as SubagentSteeringMessageDetails });
|
|
879
|
-
};
|
|
880
|
-
const asyncStartedHandler = (payload: unknown) => {
|
|
881
|
-
handleStarted(payload);
|
|
882
|
-
supervisorChannel.activateTransport();
|
|
883
|
-
refreshResultDelivery();
|
|
884
|
-
fleetStatus?.refresh();
|
|
885
|
-
};
|
|
886
|
-
const asyncCompleteHandler = (payload: unknown) => {
|
|
887
|
-
handleComplete(payload);
|
|
888
|
-
refreshResultDelivery();
|
|
889
|
-
refreshActiveAsyncCapacity();
|
|
890
|
-
scheduledRunManager.handleAsyncCompletion(payload);
|
|
891
|
-
fleetStatus?.refresh();
|
|
892
|
-
};
|
|
893
|
-
const eventUnsubscribes = [
|
|
894
|
-
registerRuntimeAgentEventListener(pi),
|
|
895
|
-
pi.events.on(SUBAGENT_ASYNC_STARTED_EVENT, asyncStartedHandler),
|
|
896
|
-
pi.events.on(SUBAGENT_ASYNC_COMPLETE_EVENT, asyncCompleteHandler),
|
|
897
|
-
pi.events.on(SUBAGENT_PROCESS_TERMINAL_EVENT, () => {
|
|
898
|
-
refreshActiveAsyncCapacity();
|
|
899
|
-
fleetStatus?.refresh();
|
|
900
|
-
}),
|
|
901
|
-
pi.events.on(SUBAGENT_CONTROL_EVENT, controlEventHandler),
|
|
902
|
-
pi.events.on(SUBAGENT_STEERING_NOTICE_EVENT, steeringNoticeHandler),
|
|
903
|
-
herdrStatusBridge.dispose,
|
|
904
|
-
rpcBridge.dispose,
|
|
905
|
-
];
|
|
906
|
-
|
|
907
|
-
pi.on("tool_result", (event, ctx) => {
|
|
908
|
-
if (event.toolName !== "subagent") return;
|
|
909
|
-
if (!ctx.hasUI) return;
|
|
910
|
-
state.lastUiContext = ctx;
|
|
911
|
-
const activeJobCount = state.asyncJobs.size;
|
|
912
|
-
restoreActiveJobs(ctx);
|
|
913
|
-
if (state.asyncJobs.size > activeJobCount) herdrStatusBridge.syncRuns();
|
|
914
|
-
fleetStatus?.setContext(ctx);
|
|
915
|
-
fleetStatus?.refresh();
|
|
916
|
-
if (state.asyncJobs.size > 0) {
|
|
917
|
-
refreshWidget(ctx);
|
|
918
|
-
ensurePoller();
|
|
919
|
-
}
|
|
920
|
-
});
|
|
921
|
-
|
|
922
|
-
const cleanupSessionArtifacts = (ctx: ExtensionContext) => {
|
|
923
|
-
try {
|
|
924
|
-
const sessionFile = ctx.sessionManager.getSessionFile();
|
|
925
|
-
if (sessionFile) {
|
|
926
|
-
cleanupOldArtifacts(getArtifactsDir(sessionFile), artifactCleanupDays);
|
|
927
|
-
}
|
|
928
|
-
} catch {
|
|
929
|
-
// Cleanup failures should not block session lifecycle events.
|
|
930
|
-
}
|
|
931
|
-
};
|
|
932
|
-
|
|
933
|
-
const suspendWidgetsForCompaction = () => {
|
|
934
|
-
if (state.widgetsSuspended) return;
|
|
935
|
-
state.widgetsSuspended = true;
|
|
936
|
-
withLastUiContext((ctx) => ctx.ui.setWidget(WIDGET_KEY, undefined));
|
|
937
|
-
fleetStatus?.refresh();
|
|
938
|
-
};
|
|
939
|
-
const resumeWidgetsAfterCompaction = () => {
|
|
940
|
-
if (!state.widgetsSuspended) return;
|
|
941
|
-
state.widgetsSuspended = false;
|
|
942
|
-
withLastUiContext((ctx) => refreshWidget(ctx));
|
|
943
|
-
fleetStatus?.refresh();
|
|
944
|
-
};
|
|
945
|
-
|
|
946
|
-
const refreshActiveAsyncCapacity = () => {
|
|
947
|
-
if (!state.currentSessionId) {
|
|
948
|
-
state.activeAsyncCapacity = { used: 0, limit: resolveMaxActiveAsyncRunsPerSession(config.maxActiveAsyncRunsPerSession) ?? 0 };
|
|
949
|
-
return;
|
|
950
|
-
}
|
|
951
|
-
state.activeAsyncCapacity = getActiveAsyncCapacitySnapshot(
|
|
952
|
-
state.currentSessionId,
|
|
953
|
-
resolveMaxActiveAsyncRunsPerSession(config.maxActiveAsyncRunsPerSession),
|
|
954
|
-
{ liveWorkflowRunIds: new Set(state.workflowControllers?.keys() ?? []), abandonedSlotReleaseAfterMs: resolveAbandonedSlotReleaseAfterMs(config.capacity?.abandonedSlotReleaseAfterMs) },
|
|
955
|
-
);
|
|
956
|
-
};
|
|
957
|
-
|
|
958
|
-
const resetSessionState = (ctx: ExtensionContext, recovering: boolean, previousSessionFile?: string) => {
|
|
959
|
-
state.widgetsSuspended = false;
|
|
960
|
-
state.baseCwd = ctx.cwd;
|
|
961
|
-
goalTurnId = 0;
|
|
962
|
-
const previousRuntimeSessionId = state.currentSessionId;
|
|
963
|
-
resultDeliveryOwnership.claimPredecessor(previousSessionFile, previousRuntimeSessionId);
|
|
964
|
-
state.currentSessionId = resolveCurrentSessionId(ctx.sessionManager);
|
|
965
|
-
state.supervisorOwnerSessionId = ctx.sessionManager.getSessionId() || null;
|
|
966
|
-
transitionResultDelivery();
|
|
967
|
-
state.parentSessionFile = ctx.sessionManager.getSessionFile();
|
|
968
|
-
state.trustedSessionFileRoot = state.parentSessionFile ? path.join(getAgentDir(), "sessions") : undefined;
|
|
969
|
-
state.trustedSessionRoots = [...new Set([
|
|
970
|
-
...(config.defaultSessionDir ? [path.resolve(expandTilde(config.defaultSessionDir))] : []),
|
|
971
|
-
...(state.parentSessionFile ? [getSubagentSessionRoot(state.parentSessionFile)] : []),
|
|
972
|
-
])];
|
|
973
|
-
state.subagentSpawns = {
|
|
974
|
-
sessionId: state.currentSessionId,
|
|
975
|
-
count: 0,
|
|
976
|
-
configuredLimit: resolveMaxSubagentSpawnsPerSession(config.maxSubagentSpawnsPerSession) ?? null,
|
|
977
|
-
granted: 0,
|
|
978
|
-
grantHistory: [],
|
|
979
|
-
};
|
|
980
|
-
const projectPaneOwnerRoot = path.resolve(ctx.cwd);
|
|
981
|
-
restoreHerdrProjectPaneSnapshots(state, [...new Set([...(state.herdrProjectPanes?.keys() ?? []), ...listHerdrProjectPaneRoots(projectPaneOwnerRoot), projectPaneOwnerRoot])]);
|
|
982
|
-
// Set PI_SUBAGENT_PARENT_SESSION for permission-system forwarding.
|
|
983
|
-
// Only set in the root session (the interactive UI session), not in a
|
|
984
|
-
// child host: the runner process inherits the parent's value through
|
|
985
|
-
// its environment at spawn time and must not overwrite it with a child
|
|
986
|
-
// session's identity.
|
|
987
|
-
if (!process.env[SUBAGENT_CHILD_ENV]) {
|
|
988
|
-
const sessionId = ctx.sessionManager.getSessionId();
|
|
989
|
-
if (sessionId) {
|
|
990
|
-
process.env[SUBAGENT_PARENT_SESSION_ENV] = sessionId;
|
|
991
|
-
parentSessionEnvValue = sessionId;
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
state.lastUiContext = ctx;
|
|
995
|
-
let phaseStartedAt = Date.now();
|
|
996
|
-
refreshActiveAsyncCapacity();
|
|
997
|
-
logSlowPhase("active-capacity", phaseStartedAt);
|
|
998
|
-
phaseStartedAt = Date.now();
|
|
999
|
-
cleanupSessionArtifacts(ctx);
|
|
1000
|
-
logSlowPhase("session-artifact-cleanup", phaseStartedAt);
|
|
1001
|
-
state.foregroundControls.clear();
|
|
1002
|
-
retainedNestedRouteTracker?.clear();
|
|
1003
|
-
retainedNestedRouteTracker = undefined;
|
|
1004
|
-
executorDeps.trackRetainedNestedRoute = undefined;
|
|
1005
|
-
state.lastForegroundControlId = null;
|
|
1006
|
-
phaseStartedAt = Date.now();
|
|
1007
|
-
resetJobs(ctx);
|
|
1008
|
-
logSlowPhase("reset-jobs", phaseStartedAt);
|
|
1009
|
-
phaseStartedAt = Date.now();
|
|
1010
|
-
restoreForegroundRunHistory(state, { resultsDir: DIRS.results });
|
|
1011
|
-
logSlowPhase("foreground-history", phaseStartedAt);
|
|
1012
|
-
phaseStartedAt = Date.now();
|
|
1013
|
-
restoreActiveJobs(ctx);
|
|
1014
|
-
logSlowPhase("active-job-restore", phaseStartedAt);
|
|
1015
|
-
phaseStartedAt = Date.now();
|
|
1016
|
-
scheduledRunManager.bindSession(ctx);
|
|
1017
|
-
logSlowPhase("scheduled-runs", phaseStartedAt);
|
|
1018
|
-
phaseStartedAt = Date.now();
|
|
1019
|
-
restoreSlashFinalSnapshots(ctx.sessionManager.getEntries());
|
|
1020
|
-
logSlowPhase("slash-snapshots", phaseStartedAt);
|
|
1021
|
-
phaseStartedAt = Date.now();
|
|
1022
|
-
waitSubscriptionManager.restore();
|
|
1023
|
-
logSlowPhase("wait-subscriptions", phaseStartedAt);
|
|
1024
|
-
phaseStartedAt = Date.now();
|
|
1025
|
-
startResultWatcher();
|
|
1026
|
-
logSlowPhase("result-watcher-start", phaseStartedAt);
|
|
1027
|
-
phaseStartedAt = Date.now();
|
|
1028
|
-
primeExistingResults({ triggerTurn: !recovering });
|
|
1029
|
-
logSlowPhase("result-prime", phaseStartedAt);
|
|
1030
|
-
fleetStatus?.setContext(ctx);
|
|
1031
|
-
};
|
|
1032
|
-
|
|
1033
|
-
let runtimeCleaned = false;
|
|
1034
|
-
const runtimeEntry: SubagentRuntimeEntry = {
|
|
1035
|
-
sessionManager: null,
|
|
1036
|
-
visibleControlNotices,
|
|
1037
|
-
cleanup() {
|
|
1038
|
-
if (runtimeCleaned) return;
|
|
1039
|
-
runtimeCleaned = true;
|
|
1040
|
-
const shuttingDownParentSession = parentSessionEnvValue;
|
|
1041
|
-
releaseHostSessionLiveness();
|
|
1042
|
-
releaseHostSessionLiveness = () => {};
|
|
1043
|
-
// Workflow continuations retain their launch context; abort them before
|
|
1044
|
-
// teardown so a reload cannot launch through a stale context.
|
|
1045
|
-
for (const controller of state.workflowControllers?.values() ?? []) {
|
|
1046
|
-
if (!controller.signal.aborted) controller.abort(new Error("Workflow stopped because the extension session was replaced or reloaded."));
|
|
1047
|
-
}
|
|
1048
|
-
state.workflowControllers?.clear();
|
|
1049
|
-
state.workflowChildStops?.clear();
|
|
1050
|
-
clearRuntimeAgentsForPi(pi);
|
|
1051
|
-
if (resultIndexCleanupTimer) clearTimeout(resultIndexCleanupTimer);
|
|
1052
|
-
resultIndexCleanupTimer = undefined;
|
|
1053
|
-
if (asyncRetentionTimer) clearTimeout(asyncRetentionTimer);
|
|
1054
|
-
asyncRetentionTimer = undefined;
|
|
1055
|
-
asyncRetentionAbort.abort();
|
|
1056
|
-
stopResultWatcher();
|
|
1057
|
-
resultDeliveryOwnership.clear();
|
|
1058
|
-
completionNotifier.dispose();
|
|
1059
|
-
mainWatchdog.dispose();
|
|
1060
|
-
scheduledRunManager.stop();
|
|
1061
|
-
supervisorChannel.dispose();
|
|
1062
|
-
waitSubscriptionManager.dispose();
|
|
1063
|
-
fleetStatus?.dispose();
|
|
1064
|
-
disposeAsyncJobTracker();
|
|
1065
|
-
for (const timer of state.cleanupTimers.values()) clearTimeout(timer);
|
|
1066
|
-
state.cleanupTimers.clear();
|
|
1067
|
-
state.asyncJobs.clear();
|
|
1068
|
-
retainedNestedRouteTracker?.clear();
|
|
1069
|
-
retainedNestedRouteTracker = undefined;
|
|
1070
|
-
executorDeps.trackRetainedNestedRoute = undefined;
|
|
1071
|
-
for (const unsubscribe of eventUnsubscribes) {
|
|
1072
|
-
try {
|
|
1073
|
-
unsubscribe();
|
|
1074
|
-
} catch {
|
|
1075
|
-
// Best effort cleanup during shutdown or reload.
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
disposeSlashCommands.dispose();
|
|
1079
|
-
slashBridge.cancelAll();
|
|
1080
|
-
slashBridge.dispose();
|
|
1081
|
-
promptTemplateBridge.cancelAll();
|
|
1082
|
-
promptTemplateBridge.dispose();
|
|
1083
|
-
state.widgetsSuspended = false;
|
|
1084
|
-
state.currentSessionId = null;
|
|
1085
|
-
state.supervisorOwnerSessionId = null;
|
|
1086
|
-
state.statusProjectionSessionId = null;
|
|
1087
|
-
state.parentSessionFile = null;
|
|
1088
|
-
parentSessionEnvValue = null;
|
|
1089
|
-
if (shuttingDownParentSession && process.env[SUBAGENT_PARENT_SESSION_ENV] === shuttingDownParentSession) {
|
|
1090
|
-
delete process.env[SUBAGENT_PARENT_SESSION_ENV];
|
|
1091
|
-
}
|
|
1092
|
-
if (runtimeEntry.sessionManager && runtimeRegistry.bySessionManager.get(runtimeEntry.sessionManager) === runtimeEntry) {
|
|
1093
|
-
runtimeRegistry.bySessionManager.delete(runtimeEntry.sessionManager);
|
|
1094
|
-
}
|
|
1095
|
-
runtimeRegistry.activeEntries.delete(runtimeEntry);
|
|
1096
|
-
if (runtimeRegistry.activeEntries.size === 0) clearSlashSnapshots();
|
|
1097
|
-
try {
|
|
1098
|
-
if (state.lastUiContext?.hasUI) state.lastUiContext.ui.setWidget(WIDGET_KEY, undefined);
|
|
1099
|
-
} catch (error) {
|
|
1100
|
-
if (!isStaleExtensionContextError(error)) throw error;
|
|
1101
|
-
}
|
|
1102
|
-
state.lastUiContext = null;
|
|
1103
|
-
},
|
|
1104
|
-
};
|
|
1105
|
-
|
|
1106
|
-
const installRuntime = (ctx: ExtensionContext) => {
|
|
1107
|
-
if (runtimeCleaned) {
|
|
1108
|
-
throw new Error("Cannot restart a cleaned pi-subagents extension runtime; register a new extension instance.");
|
|
1109
|
-
}
|
|
1110
|
-
const sessionManager = ctx.sessionManager as object;
|
|
1111
|
-
const previousRuntime = runtimeRegistry.bySessionManager.get(sessionManager);
|
|
1112
|
-
const existingVisibleControlNotices = runtimeRegistry.visibleControlNoticesBySessionManager.get(sessionManager);
|
|
1113
|
-
if (existingVisibleControlNotices) {
|
|
1114
|
-
visibleControlNotices = existingVisibleControlNotices;
|
|
1115
|
-
} else {
|
|
1116
|
-
runtimeRegistry.visibleControlNoticesBySessionManager.set(sessionManager, visibleControlNotices);
|
|
1117
|
-
}
|
|
1118
|
-
runtimeEntry.visibleControlNotices = visibleControlNotices;
|
|
1119
|
-
if (runtimeEntry.sessionManager && runtimeEntry.sessionManager !== sessionManager
|
|
1120
|
-
&& runtimeRegistry.bySessionManager.get(runtimeEntry.sessionManager) === runtimeEntry) {
|
|
1121
|
-
runtimeRegistry.bySessionManager.delete(runtimeEntry.sessionManager);
|
|
1122
|
-
}
|
|
1123
|
-
runtimeEntry.sessionManager = sessionManager;
|
|
1124
|
-
runtimeRegistry.bySessionManager.set(sessionManager, runtimeEntry);
|
|
1125
|
-
runtimeRegistry.activeEntries.add(runtimeEntry);
|
|
1126
|
-
if (previousRuntime && previousRuntime !== runtimeEntry) {
|
|
1127
|
-
try {
|
|
1128
|
-
previousRuntime.cleanup();
|
|
1129
|
-
} catch {
|
|
1130
|
-
// Best effort cleanup for stale resources from the replaced runtime.
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
};
|
|
1134
|
-
|
|
1135
|
-
pi.on("agent_start", () => {
|
|
1136
|
-
resumeWidgetsAfterCompaction();
|
|
1137
|
-
herdrStatusBridge.agentStarted();
|
|
1138
|
-
});
|
|
1139
|
-
|
|
1140
|
-
pi.on("agent_settled", () => {
|
|
1141
|
-
resumeWidgetsAfterCompaction();
|
|
1142
|
-
});
|
|
1143
|
-
|
|
1144
|
-
pi.on("session_before_compact", (event) => {
|
|
1145
|
-
if (event.reason !== "manual") suspendWidgetsForCompaction();
|
|
1146
|
-
});
|
|
1147
|
-
|
|
1148
|
-
pi.on("session_compact", (event) => {
|
|
1149
|
-
if (event.reason !== "manual") return;
|
|
1150
|
-
const hasActiveAsyncWork = [...state.asyncJobs.values()].some((job) => job.status === "queued" || job.status === "running");
|
|
1151
|
-
if (!hasActiveAsyncWork || !withLastUiContext(() => true)) return;
|
|
1152
|
-
pi.sendMessage(
|
|
1153
|
-
{
|
|
1154
|
-
customType: "subagent-compaction-resume",
|
|
1155
|
-
content: "Compaction is complete. Resume the parent task now; background subagent results will arrive separately when ready.",
|
|
1156
|
-
display: false,
|
|
1157
|
-
},
|
|
1158
|
-
{ triggerTurn: true },
|
|
1159
|
-
);
|
|
1160
|
-
});
|
|
1161
|
-
|
|
1162
|
-
pi.on("session_start", (event, ctx) => {
|
|
1163
|
-
installRuntime(ctx);
|
|
1164
|
-
startSessionMaintenance();
|
|
1165
|
-
const recovering = event.reason === "startup" || event.reason === "reload" || event.reason === "resume";
|
|
1166
|
-
resetSessionState(ctx, recovering, event.previousSessionFile);
|
|
1167
|
-
releaseHostSessionLiveness();
|
|
1168
|
-
const sessionId = ctx.sessionManager.getSessionId();
|
|
1169
|
-
const sessionFile = ctx.sessionManager.getSessionFile();
|
|
1170
|
-
const liveness = sessionId
|
|
1171
|
-
? registerPiWebSessionLiveness({
|
|
1172
|
-
sessionId,
|
|
1173
|
-
...(sessionFile ? { sessionFile } : {}),
|
|
1174
|
-
isActive: () => hasLiveSubagentWork(state) || completionNotifier.hasPendingDelivery(),
|
|
1175
|
-
})
|
|
1176
|
-
: { registered: false, release: () => {} };
|
|
1177
|
-
releaseHostSessionLiveness = liveness.release;
|
|
1178
|
-
if (liveness.registered) {
|
|
1179
|
-
retainedNestedRouteTracker = createRetainedNestedRouteTracker(state);
|
|
1180
|
-
executorDeps.trackRetainedNestedRoute = retainedNestedRouteTracker.track;
|
|
1181
|
-
}
|
|
1182
|
-
herdrStatusBridge.sessionStarted({
|
|
1183
|
-
hasUI: ctx.hasUI === true,
|
|
1184
|
-
runs: activeHerdrRuns(),
|
|
1185
|
-
});
|
|
1186
|
-
rpcBridge.emitReady(ctx);
|
|
1187
|
-
supervisorChannel.start();
|
|
1188
|
-
supervisorChannel.activateTransport();
|
|
1189
|
-
});
|
|
1190
|
-
|
|
1191
|
-
pi.on("session_shutdown", async () => {
|
|
1192
|
-
runtimeEntry.cleanup();
|
|
1193
|
-
try {
|
|
1194
|
-
await disposeChildSessions();
|
|
1195
|
-
} catch (error) {
|
|
1196
|
-
console.error("Failed to dispose in-process child sessions:", error);
|
|
1197
|
-
}
|
|
1198
|
-
await herdrStatusBridge.flush();
|
|
1199
|
-
});
|
|
1200
|
-
|
|
1201
|
-
pi.on("session_start", (_event, ctx) => {
|
|
1202
|
-
advertisedContext = { cwd: ctx.cwd, model: ctx.model };
|
|
1203
|
-
refreshAdvertisedAgents();
|
|
1204
|
-
});
|
|
1205
|
-
}
|