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/tui/fleet.ts
DELETED
|
@@ -1,1448 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
4
|
-
import { getMarkdownTheme, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
5
|
-
import { matchesKey, truncateToWidth, visibleWidth, wrapTextWithAnsi, type Component, type MarkdownTheme } from "@earendil-works/pi-tui";
|
|
6
|
-
import { snapshotExternalRuns, type ExternalRun } from "../api/external-runs.ts";
|
|
7
|
-
import { getArtifactPaths, getArtifactsDir } from "../shared/artifacts.ts";
|
|
8
|
-
import { formatDuration, formatModelThinking, formatTokens, formatTokenUsage, shortenPath } from "../shared/formatters.ts";
|
|
9
|
-
import { DIRS, type AsyncJobState, type AsyncJobStep, type Details, type FleetKeybindingAction, type FleetKeybindingsConfig, type ForegroundChildControl, type ForegroundResumeChild, type ForegroundResumeRun, type ForegroundRunControl, type SubagentState } from "../shared/types.ts";
|
|
10
|
-
import { decodeUtf8Tail } from "../shared/utf8.ts";
|
|
11
|
-
import { readStatus } from "../shared/utils.ts";
|
|
12
|
-
import { formatAsyncRunTranscript } from "../runs/background/fleet-view.ts";
|
|
13
|
-
import { listAsyncRuns, type AsyncRunSummary } from "../runs/background/async-status.ts";
|
|
14
|
-
import { steerAsyncRun } from "../runs/foreground/async-steering-action.ts";
|
|
15
|
-
import type { SteerDeliveryMode } from "../runs/background/control-channel.ts";
|
|
16
|
-
import { stopAsyncRun } from "../runs/foreground/async-stop-action.ts";
|
|
17
|
-
import { resolveWorkflowForegroundSteeringTarget, steerWorkflowForegroundTarget } from "../runs/foreground/workflow-foreground-steering.ts";
|
|
18
|
-
import { contextModeBadge, contextModeLabel } from "../runs/shared/context-mode.ts";
|
|
19
|
-
import { FLEET_STATUS_WIDGET_KEY } from "./fleet-status.ts";
|
|
20
|
-
import { readFleetTranscript, renderFleetTranscript, type FleetTranscript } from "./fleet-transcript.ts";
|
|
21
|
-
import { handleInspectorAction } from "../inspectors/actions.ts";
|
|
22
|
-
import type { InspectorPlugin } from "../inspectors/types.ts";
|
|
23
|
-
import { getLivePromptAudit, type LivePromptAudit, type PromptAuditView } from "../runs/foreground/prompt-audit.ts";
|
|
24
|
-
|
|
25
|
-
const REFRESH_MS = 750;
|
|
26
|
-
const MIN_REFRESH_MS = 250;
|
|
27
|
-
const MAX_RECENT_ASYNC_RUNS = 20;
|
|
28
|
-
const MAX_FLEET_HISTORY_CANDIDATES = 100;
|
|
29
|
-
const TRANSCRIPT_LINES = 200;
|
|
30
|
-
const OUTPUT_TAIL_BYTES = 64 * 1024;
|
|
31
|
-
const PROMPT_AUDIT_SUMMARY_WIDTH = 160;
|
|
32
|
-
|
|
33
|
-
export const DEFAULT_FLEET_KEYBINDINGS: Record<FleetKeybindingAction, string[]> = {
|
|
34
|
-
close: ["escape", "ctrl+c", "q"],
|
|
35
|
-
scrollUp: ["K"],
|
|
36
|
-
scrollDown: ["J"],
|
|
37
|
-
selectUp: ["up", "k"],
|
|
38
|
-
selectDown: ["down", "j"],
|
|
39
|
-
selectFirst: ["home"],
|
|
40
|
-
selectLast: ["end"],
|
|
41
|
-
pageUp: ["pageUp"],
|
|
42
|
-
pageDown: ["pageDown"],
|
|
43
|
-
refresh: ["r", "R"],
|
|
44
|
-
steer: ["s"],
|
|
45
|
-
inspect: ["return", "H"],
|
|
46
|
-
stop: ["D"],
|
|
47
|
-
toggleTools: ["x", "X", "ctrl+o"],
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
type ResolvedFleetKeybindings = Record<FleetKeybindingAction, string[]>;
|
|
51
|
-
|
|
52
|
-
export function resolveFleetKeybindings(config: FleetKeybindingsConfig | undefined): ResolvedFleetKeybindings {
|
|
53
|
-
return Object.fromEntries(
|
|
54
|
-
Object.entries(DEFAULT_FLEET_KEYBINDINGS).map(([action, defaults]) => [action, config?.[action as FleetKeybindingAction] ?? defaults]),
|
|
55
|
-
) as ResolvedFleetKeybindings;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function matchesFleetBinding(data: string, binding: string): boolean {
|
|
59
|
-
const key = /^[A-Z]$/.test(binding) ? `shift+${binding.toLowerCase()}` : binding;
|
|
60
|
-
return matchesKey(data, key as Parameters<typeof matchesKey>[1]);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function matchesFleetAction(data: string, bindings: ResolvedFleetKeybindings, action: FleetKeybindingAction): boolean {
|
|
64
|
-
return bindings[action].some((binding) => matchesFleetBinding(data, binding));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function bindingLabel(bindings: ResolvedFleetKeybindings, action: FleetKeybindingAction): string {
|
|
68
|
-
return bindings[action]
|
|
69
|
-
.map((binding) => binding === "up" ? "↑" : binding === "down" ? "↓" : binding === "escape" ? "Esc" : binding === "return" ? "Enter" : binding)
|
|
70
|
-
.join("/");
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
type Theme = ExtensionContext["ui"]["theme"];
|
|
74
|
-
type FleetTui = {
|
|
75
|
-
terminal?: { rows: number };
|
|
76
|
-
requestRender(): void;
|
|
77
|
-
};
|
|
78
|
-
type AsyncStep = AsyncRunSummary["steps"][number];
|
|
79
|
-
|
|
80
|
-
export type FleetItem = (
|
|
81
|
-
| { key: string; kind: "foreground-active"; runId: string; index?: number; agent: string; state: "running"; updatedAt: number; control: ForegroundRunControl; activeChild?: ForegroundChildControl }
|
|
82
|
-
| { key: string; kind: "foreground-recent"; runId: string; index: number; agent: string; state: ForegroundResumeChild["status"]; updatedAt: number; run: ForegroundResumeRun; child: ForegroundResumeChild }
|
|
83
|
-
| { key: string; kind: "async"; runId: string; index?: number; agent: string; state: string; updatedAt: number; run: AsyncRunSummary; step?: AsyncStep }
|
|
84
|
-
| { key: string; kind: "external"; runId: string; agent: string; state: ExternalRun["state"]; updatedAt: number; run: ExternalRun }
|
|
85
|
-
) & { description?: string };
|
|
86
|
-
|
|
87
|
-
export interface FleetSnapshot {
|
|
88
|
-
items: FleetItem[];
|
|
89
|
-
error?: string;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface FleetActionResult {
|
|
93
|
-
text: string;
|
|
94
|
-
isError?: boolean;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface FleetActionHandlers {
|
|
98
|
-
steer(input: { runId: string; asyncDir: string; index?: number; message: string; mode: SteerDeliveryMode }): Promise<FleetActionResult>;
|
|
99
|
-
stop(input: { runId: string; asyncDir: string; index?: number }): Promise<FleetActionResult> | FleetActionResult;
|
|
100
|
-
inspect?(input: { runId: string; asyncDir: string; index?: number }): Promise<FleetActionResult>;
|
|
101
|
-
redoPrompt?(input: { runId: string; index: number; guidance: string; control?: ForegroundRunControl }): Promise<FleetActionResult>;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface FleetViewOptions {
|
|
105
|
-
asyncDirRoot?: string;
|
|
106
|
-
resultsDir?: string;
|
|
107
|
-
refreshMs?: number;
|
|
108
|
-
initialKey?: string;
|
|
109
|
-
markdownTheme?: MarkdownTheme;
|
|
110
|
-
fleetKeybindings?: FleetKeybindingsConfig;
|
|
111
|
-
actions?: FleetActionHandlers;
|
|
112
|
-
copyText?: (text: string) => Promise<void> | void;
|
|
113
|
-
inspectorPlugins?: readonly InspectorPlugin[];
|
|
114
|
-
inspectorEnv?: NodeJS.ProcessEnv;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function belongsToCurrentSession(sessionId: string | undefined, currentSessionId: string | null): boolean {
|
|
118
|
-
return !currentSessionId || sessionId === currentSessionId;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function trackedJobSummary(job: AsyncJobState): AsyncRunSummary {
|
|
122
|
-
const startedAt = job.startedAt ?? job.updatedAt ?? Date.now();
|
|
123
|
-
return {
|
|
124
|
-
id: job.asyncId,
|
|
125
|
-
asyncDir: job.asyncDir,
|
|
126
|
-
...(job.sessionId ? { sessionId: job.sessionId } : {}),
|
|
127
|
-
state: job.status,
|
|
128
|
-
activityState: job.activityState,
|
|
129
|
-
lastActivityAt: job.lastActivityAt,
|
|
130
|
-
currentTool: job.currentTool,
|
|
131
|
-
currentToolStartedAt: job.currentToolStartedAt,
|
|
132
|
-
currentPath: job.currentPath,
|
|
133
|
-
turnCount: job.turnCount,
|
|
134
|
-
toolCount: job.toolCount,
|
|
135
|
-
steering: job.steering,
|
|
136
|
-
mode: job.mode ?? "single",
|
|
137
|
-
...(job.context ? { context: job.context } : {}),
|
|
138
|
-
...(job.cwd ? { cwd: job.cwd } : {}),
|
|
139
|
-
startedAt,
|
|
140
|
-
...(job.updatedAt !== undefined ? { lastUpdate: job.updatedAt } : {}),
|
|
141
|
-
...(job.timeoutMs !== undefined ? { timeoutMs: job.timeoutMs } : {}),
|
|
142
|
-
...(job.deadlineAt !== undefined ? { deadlineAt: job.deadlineAt } : {}),
|
|
143
|
-
...(job.timedOut !== undefined ? { timedOut: job.timedOut } : {}),
|
|
144
|
-
...(job.stopped !== undefined ? { stopped: job.stopped } : {}),
|
|
145
|
-
...(job.turnBudget ? { turnBudget: job.turnBudget } : {}),
|
|
146
|
-
...(job.turnBudgetExceeded !== undefined ? { turnBudgetExceeded: job.turnBudgetExceeded } : {}),
|
|
147
|
-
...(job.wrapUpRequested !== undefined ? { wrapUpRequested: job.wrapUpRequested } : {}),
|
|
148
|
-
...(job.currentStep !== undefined ? { currentStep: job.currentStep } : {}),
|
|
149
|
-
...(job.chainStepCount !== undefined ? { chainStepCount: job.chainStepCount } : {}),
|
|
150
|
-
...(job.parallelGroups?.length ? { parallelGroups: job.parallelGroups } : {}),
|
|
151
|
-
...(job.preflight ? { preflight: job.preflight } : {}),
|
|
152
|
-
steps: (job.steps ?? job.agents?.map((agent, index) => ({ agent, index, status: job.status === "queued" ? "pending" as const : job.status })) ?? []).map((step, index) => ({
|
|
153
|
-
...step,
|
|
154
|
-
index: step.index ?? index,
|
|
155
|
-
})),
|
|
156
|
-
...(job.sessionDir ? { sessionDir: job.sessionDir } : {}),
|
|
157
|
-
...(job.outputFile ? { outputFile: job.outputFile } : {}),
|
|
158
|
-
...(job.totalTokens ? { totalTokens: job.totalTokens } : {}),
|
|
159
|
-
...(job.sessionFile ? { sessionFile: job.sessionFile } : {}),
|
|
160
|
-
...(job.nestedChildren?.length ? { nestedChildren: job.nestedChildren } : {}),
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function asyncItems(run: AsyncRunSummary, description?: string): FleetItem[] {
|
|
165
|
-
const updatedAt = run.lastUpdate ?? run.endedAt ?? run.startedAt;
|
|
166
|
-
if (run.steps.length === 0 || run.mode === "workflow") {
|
|
167
|
-
return [{ key: `async:${run.id}`, kind: "async", runId: run.id, agent: run.mode, state: run.state, updatedAt, run, ...(description ? { description } : {}) }];
|
|
168
|
-
}
|
|
169
|
-
return run.steps.map((step) => ({
|
|
170
|
-
key: `async:${run.id}:${step.index}`,
|
|
171
|
-
kind: "async" as const,
|
|
172
|
-
runId: run.id,
|
|
173
|
-
index: step.index,
|
|
174
|
-
agent: step.label ? `${step.label} (${step.agent})` : step.agent,
|
|
175
|
-
state: step.status,
|
|
176
|
-
updatedAt: step.lastActivityAt ?? updatedAt,
|
|
177
|
-
run,
|
|
178
|
-
step,
|
|
179
|
-
...(description ? { description } : {}),
|
|
180
|
-
}));
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function orderFleetAsyncRuns(runs: AsyncRunSummary[], terminalLimit: number, trackedJobs: Map<string, AsyncJobState>): AsyncRunSummary[] {
|
|
184
|
-
const updatedAt = (run: AsyncRunSummary) => run.lastUpdate ?? run.endedAt ?? run.startedAt;
|
|
185
|
-
const byNewest = (left: AsyncRunSummary, right: AsyncRunSummary) => updatedAt(right) - updatedAt(left);
|
|
186
|
-
// Missing tracked starts must not inherit the summary's heartbeat-based display fallback.
|
|
187
|
-
const startedAt = (run: AsyncRunSummary) => {
|
|
188
|
-
const job = trackedJobs.get(run.id);
|
|
189
|
-
return job ? job.startedAt ?? 0 : run.startedAt;
|
|
190
|
-
};
|
|
191
|
-
const byStartedAt = (left: AsyncRunSummary, right: AsyncRunSummary) => startedAt(left) - startedAt(right) || left.id.localeCompare(right.id);
|
|
192
|
-
const active = runs.filter((run) => run.state === "queued" || run.state === "running").sort(byStartedAt);
|
|
193
|
-
const terminal = runs.filter((run) => run.state !== "queued" && run.state !== "running").sort(byNewest);
|
|
194
|
-
return [...active, ...terminal.slice(0, terminalLimit)];
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export function collectFleetSnapshot(
|
|
198
|
-
state: SubagentState,
|
|
199
|
-
options: { asyncDirRoot?: string; resultsDir?: string; limit?: number } = {},
|
|
200
|
-
): FleetSnapshot {
|
|
201
|
-
const items: FleetItem[] = [];
|
|
202
|
-
const activeForegroundIds = new Set<string>();
|
|
203
|
-
const trackedJobs = state.fleetJobs ?? state.asyncJobs;
|
|
204
|
-
const workflowParentIds = new Set([...trackedJobs.values()]
|
|
205
|
-
.filter((job) => job.mode === "workflow" && belongsToCurrentSession(job.sessionId, state.currentSessionId))
|
|
206
|
-
.map((job) => job.asyncId));
|
|
207
|
-
const workflowForegroundChildCounts = new Map<string, number>();
|
|
208
|
-
const liveWorkflowForegroundControls = new Set<ForegroundRunControl>();
|
|
209
|
-
for (const control of state.foregroundControls.values()) {
|
|
210
|
-
const activeChildCount = control.activeChildren?.size ?? 0;
|
|
211
|
-
if (!control.parentWorkflowRunId
|
|
212
|
-
|| !workflowParentIds.has(control.parentWorkflowRunId)
|
|
213
|
-
|| !belongsToCurrentSession(control.sessionId, state.currentSessionId)
|
|
214
|
-
|| activeChildCount === 0) continue;
|
|
215
|
-
liveWorkflowForegroundControls.add(control);
|
|
216
|
-
workflowForegroundChildCounts.set(control.parentWorkflowRunId, (workflowForegroundChildCounts.get(control.parentWorkflowRunId) ?? 0) + activeChildCount);
|
|
217
|
-
}
|
|
218
|
-
for (const control of [...state.foregroundControls.values()].sort((left, right) => left.startedAt - right.startedAt || left.runId.localeCompare(right.runId))) {
|
|
219
|
-
activeForegroundIds.add(control.runId);
|
|
220
|
-
if (control.parentWorkflowRunId && workflowParentIds.has(control.parentWorkflowRunId)
|
|
221
|
-
&& ((workflowForegroundChildCounts.get(control.parentWorkflowRunId) ?? 0) <= 1 || !liveWorkflowForegroundControls.has(control))) continue;
|
|
222
|
-
if (control.activeChildren) {
|
|
223
|
-
for (const child of [...control.activeChildren.values()].sort((left, right) => left.index - right.index)) {
|
|
224
|
-
items.push({
|
|
225
|
-
key: `foreground-active:${control.runId}:${child.index}`,
|
|
226
|
-
kind: "foreground-active",
|
|
227
|
-
runId: control.runId,
|
|
228
|
-
index: child.index,
|
|
229
|
-
agent: child.agent,
|
|
230
|
-
state: "running",
|
|
231
|
-
updatedAt: child.updatedAt,
|
|
232
|
-
control,
|
|
233
|
-
activeChild: child,
|
|
234
|
-
...(child.description ? { description: child.description } : {}),
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
items.push({
|
|
240
|
-
key: `foreground-active:${control.runId}:${control.currentIndex ?? 0}`,
|
|
241
|
-
kind: "foreground-active",
|
|
242
|
-
runId: control.runId,
|
|
243
|
-
...(control.currentIndex !== undefined ? { index: control.currentIndex } : {}),
|
|
244
|
-
agent: control.currentAgent ?? control.mode,
|
|
245
|
-
state: "running",
|
|
246
|
-
updatedAt: control.updatedAt,
|
|
247
|
-
control,
|
|
248
|
-
...(control.description ? { description: control.description } : {}),
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
let error: string | undefined;
|
|
253
|
-
try {
|
|
254
|
-
let runs: AsyncRunSummary[];
|
|
255
|
-
const descriptions = new Map<string, string>();
|
|
256
|
-
const tracked = [...trackedJobs.values()]
|
|
257
|
-
.filter((job) => belongsToCurrentSession(job.sessionId, state.currentSessionId));
|
|
258
|
-
const byUpdate = (left: AsyncJobState, right: AsyncJobState) => (right.updatedAt ?? right.startedAt ?? 0) - (left.updatedAt ?? left.startedAt ?? 0);
|
|
259
|
-
const active = tracked.filter((job) => job.status === "queued" || job.status === "running");
|
|
260
|
-
const recent = tracked.filter((job) => job.status !== "queued" && job.status !== "running").sort(byUpdate).slice(0, options.limit ?? MAX_RECENT_ASYNC_RUNS);
|
|
261
|
-
const trackedRuns: AsyncRunSummary[] = [];
|
|
262
|
-
for (const job of [...active, ...recent]) {
|
|
263
|
-
try {
|
|
264
|
-
trackedRuns.push(trackedJobSummary(job));
|
|
265
|
-
if (job.description) descriptions.set(job.asyncId, job.description);
|
|
266
|
-
} catch (cause) {
|
|
267
|
-
error = `Failed to inspect async run '${job.asyncId}': ${cause instanceof Error ? cause.message : String(cause)}`;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
if (options.asyncDirRoot !== undefined) {
|
|
271
|
-
const trackedIds = new Set(trackedRuns.map((run) => run.id));
|
|
272
|
-
const history = listAsyncRuns(options.asyncDirRoot, {
|
|
273
|
-
...(state.currentSessionId ? { sessionId: state.currentSessionId } : {}),
|
|
274
|
-
entryLimit: MAX_FLEET_HISTORY_CANDIDATES,
|
|
275
|
-
resultsDir: options.resultsDir ?? DIRS.results,
|
|
276
|
-
reconcile: false,
|
|
277
|
-
}).filter((run) => !trackedIds.has(run.id));
|
|
278
|
-
runs = [...trackedRuns, ...history];
|
|
279
|
-
} else {
|
|
280
|
-
runs = trackedRuns;
|
|
281
|
-
}
|
|
282
|
-
for (const run of orderFleetAsyncRuns(runs, options.limit ?? MAX_RECENT_ASYNC_RUNS, trackedJobs)) {
|
|
283
|
-
items.push(...asyncItems(run, descriptions.get(run.id)));
|
|
284
|
-
}
|
|
285
|
-
} catch (cause) {
|
|
286
|
-
error = cause instanceof Error ? cause.message : String(cause);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (state.currentSessionId) {
|
|
290
|
-
try {
|
|
291
|
-
for (const run of snapshotExternalRuns(state.currentSessionId, { ignoreMalformed: true, onMalformedRecord: (message) => console.warn(`[pi-subagents] Removed ${message}`) })) {
|
|
292
|
-
items.push({
|
|
293
|
-
key: `external:${run.id}`,
|
|
294
|
-
kind: "external",
|
|
295
|
-
runId: run.id,
|
|
296
|
-
agent: run.label,
|
|
297
|
-
state: run.state,
|
|
298
|
-
updatedAt: run.updatedAt ?? run.endedAt ?? run.startedAt,
|
|
299
|
-
run,
|
|
300
|
-
...(run.currentAction ? { description: run.currentAction } : {}),
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
} catch (cause) {
|
|
304
|
-
const message = `Failed to inspect external jobs: ${cause instanceof Error ? cause.message : String(cause)}`;
|
|
305
|
-
error = error ? `${error}; ${message}` : message;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
const recentForeground = [...(state.foregroundRuns?.values() ?? [])]
|
|
310
|
-
.filter((run) => belongsToCurrentSession(run.sessionId, state.currentSessionId) && !activeForegroundIds.has(run.runId))
|
|
311
|
-
.sort((left, right) => right.updatedAt - left.updatedAt);
|
|
312
|
-
for (const run of recentForeground) {
|
|
313
|
-
for (const child of run.children) {
|
|
314
|
-
items.push({
|
|
315
|
-
key: `foreground-recent:${run.runId}:${child.index}`,
|
|
316
|
-
kind: "foreground-recent",
|
|
317
|
-
runId: run.runId,
|
|
318
|
-
index: child.index,
|
|
319
|
-
agent: child.agent,
|
|
320
|
-
state: child.status,
|
|
321
|
-
updatedAt: child.updatedAt ?? run.updatedAt,
|
|
322
|
-
run,
|
|
323
|
-
child,
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return { items, ...(error ? { error } : {}) };
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function visibleWorkflowParentKeyForForegroundKey(state: SubagentState, key: string, items: FleetItem[]): string | undefined {
|
|
331
|
-
for (const control of state.foregroundControls.values()) {
|
|
332
|
-
if (!control.parentWorkflowRunId) continue;
|
|
333
|
-
let matches = false;
|
|
334
|
-
if (control.activeChildren) {
|
|
335
|
-
for (const child of control.activeChildren.values()) {
|
|
336
|
-
if (`foreground-active:${control.runId}:${child.index}` === key) {
|
|
337
|
-
matches = true;
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
} else {
|
|
342
|
-
matches = `foreground-active:${control.runId}:${control.currentIndex ?? 0}` === key;
|
|
343
|
-
}
|
|
344
|
-
if (!matches) continue;
|
|
345
|
-
const parentKey = `async:${control.parentWorkflowRunId}`;
|
|
346
|
-
return items.some((item) => item.key === parentKey) ? parentKey : undefined;
|
|
347
|
-
}
|
|
348
|
-
return undefined;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
function statusGlyph(item: FleetItem, theme: Theme): string {
|
|
352
|
-
if (item.state === "running") return theme.fg("accent", "●");
|
|
353
|
-
if (item.state === "queued" || item.state === "pending") return theme.fg("muted", "◦");
|
|
354
|
-
if (item.state === "complete" || item.state === "completed") return theme.fg("success", "✓");
|
|
355
|
-
if (item.state === "paused" || item.state === "stopped" || item.state === "detached") return theme.fg("warning", "■");
|
|
356
|
-
return theme.fg("error", "✗");
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function foregroundPromptAuditCount(item: Extract<FleetItem, { kind: "foreground-active" }>, state: SubagentState): number {
|
|
360
|
-
if (!state.currentSessionId || item.control.sessionId !== state.currentSessionId) return 0;
|
|
361
|
-
if (!item.control.activeChildren) return getLivePromptAudit(item.control, item.index ?? 0) ? 1 : 0;
|
|
362
|
-
return [...item.control.activeChildren.keys()].filter((index) => getLivePromptAudit(item.control, index)).length;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function promptAuditString(value: unknown): string | undefined {
|
|
366
|
-
return typeof value === "string" ? value : undefined;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
function authoredPromptSummary(text: unknown): string | undefined {
|
|
370
|
-
if (typeof text !== "string") return undefined;
|
|
371
|
-
const summary = text.replace(/\s+/g, " ").trim();
|
|
372
|
-
return summary ? truncateToWidth(summary, PROMPT_AUDIT_SUMMARY_WIDTH, "…") : undefined;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
function foregroundAuthoredPromptSummary(item: Extract<FleetItem, { kind: "foreground-active" }>, state: SubagentState): string | undefined {
|
|
376
|
-
if (!state.currentSessionId || item.control.sessionId !== state.currentSessionId) return undefined;
|
|
377
|
-
const prompt = getLivePromptAudit(item.control, item.index ?? 0);
|
|
378
|
-
return prompt ? authoredPromptSummary(prompt.authoredTask) : undefined;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function promptAuditText(prompt: LivePromptAudit, view: PromptAuditView): string | undefined {
|
|
382
|
-
switch (view) {
|
|
383
|
-
case "authored": return promptAuditString(prompt.authoredTask);
|
|
384
|
-
case "runtime": return promptAuditString(prompt.runtimeAdditions);
|
|
385
|
-
case "effective": return promptAuditString(prompt.finalEffectivePrompt);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
function promptAuditViewLabel(view: PromptAuditView): string {
|
|
390
|
-
switch (view) {
|
|
391
|
-
case "authored": return "[1] Authored task";
|
|
392
|
-
case "runtime": return "[2] Runtime additions";
|
|
393
|
-
case "effective": return "[3] Final effective prompt";
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
function foregroundActiveDetail(item: Extract<FleetItem, { kind: "foreground-active" }>, state: SubagentState): string[] {
|
|
398
|
-
const { control } = item;
|
|
399
|
-
const live = item.activeChild ?? control;
|
|
400
|
-
const modelThinking = formatModelThinking(live.model, live.thinking);
|
|
401
|
-
const promptAuditCount = foregroundPromptAuditCount(item, state);
|
|
402
|
-
const promptSummary = foregroundAuthoredPromptSummary(item, state);
|
|
403
|
-
const lines = [
|
|
404
|
-
`Run: ${item.runId}`,
|
|
405
|
-
"Source: foreground",
|
|
406
|
-
`State: running`,
|
|
407
|
-
`Mode: ${control.mode}`,
|
|
408
|
-
control.parentWorkflowRunId ? `Workflow child of: ${control.parentWorkflowRunId}${control.workflowKey ? ` (${control.workflowKey})` : ""}` : undefined,
|
|
409
|
-
control.sourceRunId ? `Redo source: ${control.sourceRunId}` : undefined,
|
|
410
|
-
control.supersededByRunId ? `Superseded by: ${control.supersededByRunId}` : undefined,
|
|
411
|
-
item.index !== undefined ? `Child: ${item.index} (${item.agent})` : `Agent: ${item.agent}`,
|
|
412
|
-
modelThinking ? `Model: ${modelThinking}` : undefined,
|
|
413
|
-
promptSummary ? `Task: ${promptSummary}` : undefined,
|
|
414
|
-
`Started: ${new Date(live.startedAt).toISOString()}`,
|
|
415
|
-
live.currentTool ? `Current tool: ${live.currentTool}${live.currentPath ? ` · ${shortenPath(live.currentPath)}` : ""}` : undefined,
|
|
416
|
-
live.turnCount !== undefined ? `Turns: ${live.turnCount}` : undefined,
|
|
417
|
-
live.toolCount !== undefined ? `Tools: ${live.toolCount}` : undefined,
|
|
418
|
-
live.tokens !== undefined
|
|
419
|
-
? `Tokens: ${formatTokenUsage({ input: live.inputTokens ?? 0, output: live.outputTokens ?? 0, total: live.tokens, ...(live.window !== undefined ? { window: live.window } : {}), ...(live.windowPeak !== undefined ? { windowPeak: live.windowPeak } : {}) }, "tokens")}`
|
|
420
|
-
: undefined,
|
|
421
|
-
promptAuditCount > 0 ? `Prompt audit: ${promptAuditCount} live · 3 views · p opens` : undefined,
|
|
422
|
-
"",
|
|
423
|
-
"Transcript",
|
|
424
|
-
"Live foreground output remains in the expanded subagent tool result. Persisted output and session paths appear here after the child settles.",
|
|
425
|
-
];
|
|
426
|
-
return lines.filter((line): line is string => line !== undefined);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
function pathWithin(base: string, candidate: string): boolean {
|
|
430
|
-
const resolvedBase = path.resolve(base);
|
|
431
|
-
const resolvedCandidate = path.resolve(candidate);
|
|
432
|
-
return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${path.sep}`);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
function trustedFileTail(filePath: string, trustedRoots: string[]): { text?: string; warning?: string; unavailable?: string } {
|
|
436
|
-
const resolvedPath = path.resolve(filePath);
|
|
437
|
-
if (trustedRoots.length === 0 || !trustedRoots.some((root) => pathWithin(root, resolvedPath))) return { warning: `output artifact is outside trusted roots: ${filePath}` };
|
|
438
|
-
let stat: fs.Stats;
|
|
439
|
-
try {
|
|
440
|
-
stat = fs.lstatSync(resolvedPath);
|
|
441
|
-
} catch (error) {
|
|
442
|
-
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") return { unavailable: `output artifact unavailable: ${filePath}` };
|
|
443
|
-
return { warning: `output artifact could not be inspected: ${error instanceof Error ? error.message : String(error)}` };
|
|
444
|
-
}
|
|
445
|
-
if (stat.isSymbolicLink()) return { warning: `output artifact refused a symlink: ${filePath}` };
|
|
446
|
-
if (!stat.isFile()) return { warning: `output artifact is not a file: ${filePath}` };
|
|
447
|
-
try {
|
|
448
|
-
const realPath = fs.realpathSync(resolvedPath);
|
|
449
|
-
const realRoots = trustedRoots.filter((root) => fs.existsSync(root)).map((root) => fs.realpathSync(root));
|
|
450
|
-
if (!realRoots.some((root) => pathWithin(root, realPath))) return { warning: `output artifact resolves outside trusted roots: ${filePath}` };
|
|
451
|
-
const fd = fs.openSync(realPath, "r");
|
|
452
|
-
try {
|
|
453
|
-
const bytes = Math.min(stat.size, OUTPUT_TAIL_BYTES);
|
|
454
|
-
const buffer = Buffer.alloc(bytes);
|
|
455
|
-
fs.readSync(fd, buffer, 0, bytes, stat.size - bytes);
|
|
456
|
-
return { text: decodeUtf8Tail(buffer) };
|
|
457
|
-
} finally {
|
|
458
|
-
fs.closeSync(fd);
|
|
459
|
-
}
|
|
460
|
-
} catch (error) {
|
|
461
|
-
return { warning: `output artifact could not be read: ${error instanceof Error ? error.message : String(error)}` };
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
function foregroundRecentOutputLines(item: Extract<FleetItem, { kind: "foreground-recent" }>, state: SubagentState): string[] {
|
|
466
|
-
const outputPath = item.child.artifactPaths?.outputPath ?? item.child.savedOutputPath;
|
|
467
|
-
const output = item.child.finalOutput
|
|
468
|
-
? { text: item.child.finalOutput }
|
|
469
|
-
: outputPath
|
|
470
|
-
? trustedFileTail(path.isAbsolute(outputPath) ? outputPath : path.resolve(item.run.cwd, outputPath), uniquePaths([
|
|
471
|
-
fleetArtifactsRoot(state, item.run.cwd),
|
|
472
|
-
fleetArtifactsRoot(state, state.baseCwd),
|
|
473
|
-
]))
|
|
474
|
-
: undefined;
|
|
475
|
-
if (output?.warning) return [`(${output.warning})`];
|
|
476
|
-
if (output?.unavailable) return [`(${output.unavailable})`];
|
|
477
|
-
const outputLines = (output?.text ?? "").split(/\r?\n/).filter((line) => line.trim()).slice(-TRANSCRIPT_LINES);
|
|
478
|
-
return outputLines.length ? outputLines : ["(no recovered output available)"];
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
function foregroundRecentDetail(item: Extract<FleetItem, { kind: "foreground-recent" }>, state: SubagentState): string[] {
|
|
482
|
-
const { child, run } = item;
|
|
483
|
-
const outputPath = child.artifactPaths?.outputPath ?? child.savedOutputPath;
|
|
484
|
-
const modelThinking = formatModelThinking(child.model, child.thinking);
|
|
485
|
-
const lines = [
|
|
486
|
-
`Run: ${item.runId}`,
|
|
487
|
-
"Source: foreground",
|
|
488
|
-
`State: ${child.status}`,
|
|
489
|
-
`Mode: ${run.mode}`,
|
|
490
|
-
`Child: ${child.index} (${child.agent})${contextModeLabel(child.context) ? ` ${contextModeLabel(child.context)}` : ""}`,
|
|
491
|
-
modelThinking ? `Model: ${modelThinking}` : undefined,
|
|
492
|
-
`Updated: ${new Date(child.updatedAt ?? run.updatedAt).toISOString()}`,
|
|
493
|
-
outputPath ? `Output: ${outputPath}` : undefined,
|
|
494
|
-
child.sessionFile ? `Session: ${child.sessionFile}` : undefined,
|
|
495
|
-
child.transcriptPath ? `Transcript file: ${child.transcriptPath}` : undefined,
|
|
496
|
-
child.error ? `Error: ${child.error}` : undefined,
|
|
497
|
-
child.outputSaveError ? `Output warning: ${child.outputSaveError}` : undefined,
|
|
498
|
-
child.transcriptError ? `Transcript warning: ${child.transcriptError}` : undefined,
|
|
499
|
-
"",
|
|
500
|
-
"Result transcript tail",
|
|
501
|
-
];
|
|
502
|
-
lines.push(...foregroundRecentOutputLines(item, state));
|
|
503
|
-
return lines.filter((line): line is string => line !== undefined);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
function externalElapsedEnd(run: ExternalRun): number {
|
|
507
|
-
const terminal = run.state !== "queued" && run.state !== "running";
|
|
508
|
-
return terminal ? (run.endedAt ?? run.updatedAt ?? Date.now()) : Date.now();
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
function workflowStepLabel(step: AsyncJobStep, index: number): string {
|
|
512
|
-
const key = step.workflowKey ?? `step ${index + 1}`;
|
|
513
|
-
const label = step.label && step.label !== key ? ` · ${step.label}` : "";
|
|
514
|
-
const phase = step.phase ? `${step.phase}: ` : "";
|
|
515
|
-
return `${phase}${key}${label} (${step.agent})`;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
function workflowStepActivity(step: AsyncJobStep): string | undefined {
|
|
519
|
-
if (step.currentTool) return `tool ${step.currentTool}`;
|
|
520
|
-
if (step.currentPath) return shortenPath(step.currentPath);
|
|
521
|
-
if (step.activityState === "needs_attention") return "needs attention";
|
|
522
|
-
if (step.activityState === "active_long_running") return "long-running";
|
|
523
|
-
if (step.turnCount !== undefined) return `${step.turnCount} turns`;
|
|
524
|
-
if (step.toolCount !== undefined) return `${step.toolCount} tools`;
|
|
525
|
-
return undefined;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
function visibleWorkflowProgressSteps(steps: AsyncJobStep[], visibleLimit: number): Array<{ step: AsyncJobStep; index: number } | { hidden: number }> {
|
|
529
|
-
if (steps.length <= visibleLimit) return steps.map((step, index) => ({ step, index }));
|
|
530
|
-
const selected = new Set<number>();
|
|
531
|
-
for (const [index, step] of steps.entries()) {
|
|
532
|
-
if (step.status !== "complete" && step.status !== "completed") selected.add(index);
|
|
533
|
-
if (selected.size >= visibleLimit) break;
|
|
534
|
-
}
|
|
535
|
-
for (let index = steps.length - 1; index >= 0 && selected.size < visibleLimit; index--) selected.add(index);
|
|
536
|
-
const visible = [...selected].sort((left, right) => left - right).map((index) => ({ step: steps[index]!, index }));
|
|
537
|
-
return [{ hidden: steps.length - visible.length }, ...visible];
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
function workflowProgressLines(steps: AsyncJobStep[] | undefined): string[] {
|
|
541
|
-
if (!steps?.length) return [];
|
|
542
|
-
const lines = ["Workflow progress:"];
|
|
543
|
-
for (const row of visibleWorkflowProgressSteps(steps, 8)) {
|
|
544
|
-
if ("hidden" in row) {
|
|
545
|
-
lines.push(` +${row.hidden} hidden workflow steps`);
|
|
546
|
-
continue;
|
|
547
|
-
}
|
|
548
|
-
const activity = workflowStepActivity(row.step);
|
|
549
|
-
const context = contextModeLabel(row.step.context);
|
|
550
|
-
const details = [row.step.status, activity, context, row.step.tokens ? formatTokenUsage(row.step.tokens) : undefined].filter(Boolean).join(" · ");
|
|
551
|
-
lines.push(` ${row.index + 1}. ${workflowStepLabel(row.step, row.index)}${details ? ` — ${details}` : ""}`);
|
|
552
|
-
}
|
|
553
|
-
return lines;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
function asyncDetail(item: Extract<FleetItem, { kind: "async" }>, state: SubagentState): string[] {
|
|
557
|
-
const status = readStatus(item.run.asyncDir);
|
|
558
|
-
if (status) {
|
|
559
|
-
const trackedJob = state.fleetJobs?.get(item.runId) ?? state.asyncJobs.get(item.runId);
|
|
560
|
-
const lines = formatAsyncRunTranscript(status, item.run.asyncDir, {
|
|
561
|
-
index: item.index,
|
|
562
|
-
lines: TRANSCRIPT_LINES,
|
|
563
|
-
sessionRoots: uniquePaths([...(state.trustedSessionRoots ?? []), trackedJob?.sessionRoot]),
|
|
564
|
-
trustedSessionFiles: [item.step?.sessionFile ?? item.run.sessionFile].filter((value): value is string => Boolean(value)),
|
|
565
|
-
trustedSessionFileRoot: state.trustedSessionFileRoot,
|
|
566
|
-
}).split("\n");
|
|
567
|
-
if (status.mode === "workflow" && item.index === undefined) {
|
|
568
|
-
const progress = workflowProgressLines((status.steps ?? item.run.steps) as AsyncJobStep[]);
|
|
569
|
-
if (progress.length) {
|
|
570
|
-
const modeIndex = lines.findIndex((line) => line.startsWith("Mode:"));
|
|
571
|
-
lines.splice(modeIndex >= 0 ? modeIndex + 1 : 0, 0, "", ...progress);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
return lines;
|
|
575
|
-
}
|
|
576
|
-
const outputPath = item.index !== undefined ? path.join(item.run.asyncDir, `output-${item.index}.log`) : undefined;
|
|
577
|
-
return [
|
|
578
|
-
`Run: ${item.runId}`,
|
|
579
|
-
"Source: async",
|
|
580
|
-
`State: ${item.state}`,
|
|
581
|
-
`Mode: ${item.run.mode}${contextModeLabel(item.run.context) ? ` ${contextModeLabel(item.run.context)}` : ""}`,
|
|
582
|
-
item.index !== undefined ? `Child: ${item.index} (${item.agent})${contextModeLabel(item.step?.context) ? ` ${contextModeLabel(item.step?.context)}` : ""}` : `Agent: ${item.agent}${contextModeLabel(item.run.context) ? ` ${contextModeLabel(item.run.context)}` : ""}`,
|
|
583
|
-
outputPath ? `Output: ${outputPath}` : undefined,
|
|
584
|
-
item.step?.sessionFile ? `Session: ${item.step.sessionFile}` : item.run.sessionFile ? `Session: ${item.run.sessionFile}` : undefined,
|
|
585
|
-
"",
|
|
586
|
-
"Transcript",
|
|
587
|
-
"(status is no longer available)",
|
|
588
|
-
].filter((line): line is string => line !== undefined);
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
function externalDetail(item: Extract<FleetItem, { kind: "external" }>): string[] {
|
|
592
|
-
return [
|
|
593
|
-
`Run: ${item.runId}`,
|
|
594
|
-
"Source: external · display-only",
|
|
595
|
-
`Owner: ${item.run.source}`,
|
|
596
|
-
`State: ${item.state}`,
|
|
597
|
-
`Started: ${new Date(item.run.startedAt).toISOString()}`,
|
|
598
|
-
item.run.updatedAt !== undefined ? `Updated: ${new Date(item.run.updatedAt).toISOString()}` : undefined,
|
|
599
|
-
item.run.endedAt !== undefined ? `Ended: ${new Date(item.run.endedAt).toISOString()}` : undefined,
|
|
600
|
-
`Elapsed: ${formatDuration(Math.max(0, externalElapsedEnd(item.run) - item.run.startedAt))}`,
|
|
601
|
-
item.run.currentAction ? `Current action: ${item.run.currentAction}` : undefined,
|
|
602
|
-
item.run.reportPath ? `Report path: ${item.run.reportPath}` : undefined,
|
|
603
|
-
item.run.transcriptPath ? `Transcript path: ${item.run.transcriptPath}` : undefined,
|
|
604
|
-
"",
|
|
605
|
-
"Preview",
|
|
606
|
-
item.run.preview ?? "(no preview supplied)",
|
|
607
|
-
"",
|
|
608
|
-
"The owning extension controls execution, persistence, cancellation, and results.",
|
|
609
|
-
].filter((line): line is string => line !== undefined);
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
function detailLines(item: FleetItem | undefined, error: string | undefined, state: SubagentState): string[] {
|
|
613
|
-
if (!item) return [error ? `Fleet scan failed: ${error}` : "No current-session Fleet jobs.", "", "New jobs appear here automatically while this inspector remains open."];
|
|
614
|
-
const lines = item.kind === "foreground-active"
|
|
615
|
-
? foregroundActiveDetail(item, state)
|
|
616
|
-
: item.kind === "foreground-recent"
|
|
617
|
-
? foregroundRecentDetail(item, state)
|
|
618
|
-
: item.kind === "external"
|
|
619
|
-
? externalDetail(item)
|
|
620
|
-
: asyncDetail(item, state);
|
|
621
|
-
if (error) lines.unshift(`Fleet scan warning: ${error}`, "");
|
|
622
|
-
return lines;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
function isActionableAsyncState(state: string): boolean {
|
|
626
|
-
return state === "running" || state === "queued" || state === "pending";
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
function firstToolResultText(result: AgentToolResult<Details> | null, fallback: string): FleetActionResult {
|
|
630
|
-
if (!result) return { text: fallback, isError: true };
|
|
631
|
-
const text = result.content.find((item) => item.type === "text")?.text ?? fallback;
|
|
632
|
-
return { text, ...(result.isError ? { isError: true } : {}) };
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
function uniquePaths(values: Array<string | undefined>): string[] {
|
|
636
|
-
return [...new Set(values.filter((value): value is string => Boolean(value)).map((value) => path.resolve(value)))];
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
function fleetArtifactsRoot(state: SubagentState, cwd: string): string {
|
|
640
|
-
return getArtifactsDir(
|
|
641
|
-
state.parentSessionFile ?? null,
|
|
642
|
-
cwd,
|
|
643
|
-
state.artifactDirPreference,
|
|
644
|
-
);
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
function transcriptTarget(item: FleetItem, state: SubagentState): { path: string; trustedRoots: string[]; trustedFiles?: string[]; trustedFileRoot?: string } | undefined {
|
|
648
|
-
if (item.kind === "external") return undefined;
|
|
649
|
-
if (item.kind === "foreground-active") {
|
|
650
|
-
const artifactsRoot = fleetArtifactsRoot(state, item.control.cwd ?? state.baseCwd);
|
|
651
|
-
return {
|
|
652
|
-
path: getArtifactPaths(artifactsRoot, item.runId, item.agent, item.index ?? 0).transcriptPath,
|
|
653
|
-
trustedRoots: [artifactsRoot],
|
|
654
|
-
};
|
|
655
|
-
}
|
|
656
|
-
if (item.kind === "foreground-recent") {
|
|
657
|
-
if (!item.child.transcriptPath) return undefined;
|
|
658
|
-
const transcriptPath = path.isAbsolute(item.child.transcriptPath)
|
|
659
|
-
? item.child.transcriptPath
|
|
660
|
-
: path.resolve(item.run.cwd, item.child.transcriptPath);
|
|
661
|
-
return {
|
|
662
|
-
path: transcriptPath,
|
|
663
|
-
trustedRoots: uniquePaths([
|
|
664
|
-
fleetArtifactsRoot(state, item.run.cwd),
|
|
665
|
-
fleetArtifactsRoot(state, state.baseCwd),
|
|
666
|
-
]),
|
|
667
|
-
};
|
|
668
|
-
}
|
|
669
|
-
const step = item.step ?? (item.run.steps.length === 1 ? item.run.steps[0] : undefined);
|
|
670
|
-
const recordedSessionFile = step?.sessionFile ?? item.run.sessionFile;
|
|
671
|
-
const recordedPath = step?.transcriptPath ?? recordedSessionFile;
|
|
672
|
-
if (!recordedPath) return undefined;
|
|
673
|
-
const transcriptPath = path.isAbsolute(recordedPath)
|
|
674
|
-
? recordedPath
|
|
675
|
-
: path.resolve(item.run.asyncDir, recordedPath);
|
|
676
|
-
const trackedJob = state.fleetJobs?.get(item.runId) ?? state.asyncJobs.get(item.runId);
|
|
677
|
-
return {
|
|
678
|
-
path: transcriptPath,
|
|
679
|
-
trustedRoots: uniquePaths([
|
|
680
|
-
item.run.asyncDir,
|
|
681
|
-
fleetArtifactsRoot(state, state.baseCwd),
|
|
682
|
-
trackedJob?.cwd ? fleetArtifactsRoot(state, trackedJob.cwd) : undefined,
|
|
683
|
-
item.run.sessionFile ? getArtifactsDir(item.run.sessionFile, item.run.cwd ?? state.baseCwd, state.artifactDirPreference) : undefined,
|
|
684
|
-
]),
|
|
685
|
-
...(!step?.transcriptPath && recordedSessionFile ? { trustedFiles: [recordedSessionFile], trustedFileRoot: state.trustedSessionFileRoot } : {}),
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
function itemContext(item: FleetItem): string | undefined {
|
|
690
|
-
if (item.kind === "async") return contextModeLabel(item.step?.context ?? item.run.context);
|
|
691
|
-
if (item.kind === "foreground-recent") return contextModeLabel(item.child.context);
|
|
692
|
-
return undefined;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
function itemMode(item: FleetItem): string {
|
|
696
|
-
if (item.kind === "external") return "display-only";
|
|
697
|
-
return item.kind === "foreground-active" ? item.control.mode : item.run.mode;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
function itemSource(item: FleetItem): string {
|
|
701
|
-
if (item.kind === "external") return `external · ${item.run.source}`;
|
|
702
|
-
if (item.kind === "async") return "background";
|
|
703
|
-
return item.kind === "foreground-active" ? "foreground · live" : "foreground · recent";
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
function itemStats(item: FleetItem): string[] {
|
|
707
|
-
let model: string | undefined;
|
|
708
|
-
let tokens: number | undefined;
|
|
709
|
-
let tokenUsage: AsyncJobStep["tokens"];
|
|
710
|
-
let tools: number | undefined;
|
|
711
|
-
let durationMs: number | undefined;
|
|
712
|
-
if (item.kind === "foreground-active") {
|
|
713
|
-
const live = item.activeChild ?? item.control;
|
|
714
|
-
model = formatModelThinking(live.model, live.thinking) || undefined;
|
|
715
|
-
tokens = live.tokens;
|
|
716
|
-
if (tokens !== undefined) tokenUsage = { input: live.inputTokens ?? 0, output: live.outputTokens ?? 0, total: tokens, ...(live.window !== undefined ? { window: live.window } : {}), ...(live.windowPeak !== undefined ? { windowPeak: live.windowPeak } : {}) };
|
|
717
|
-
tools = live.toolCount;
|
|
718
|
-
durationMs = Math.max(0, Date.now() - live.startedAt);
|
|
719
|
-
} else if (item.kind === "foreground-recent") {
|
|
720
|
-
model = formatModelThinking(item.child.model, item.child.thinking) || undefined;
|
|
721
|
-
tokens = item.child.tokens;
|
|
722
|
-
if (tokens !== undefined) tokenUsage = { input: 0, output: 0, total: tokens, ...(item.child.window !== undefined ? { window: item.child.window } : {}), ...(item.child.windowPeak !== undefined ? { windowPeak: item.child.windowPeak } : {}) };
|
|
723
|
-
tools = item.child.toolCount;
|
|
724
|
-
} else if (item.kind === "external") {
|
|
725
|
-
durationMs = Math.max(0, externalElapsedEnd(item.run) - item.run.startedAt);
|
|
726
|
-
} else {
|
|
727
|
-
model = formatModelThinking(item.step?.model, item.step?.thinking) || undefined;
|
|
728
|
-
tokenUsage = item.step?.tokens ?? (item.index === undefined ? item.run.totalTokens : undefined);
|
|
729
|
-
tokens = tokenUsage?.total;
|
|
730
|
-
tools = item.step?.toolCount ?? (item.index === undefined ? item.run.toolCount : undefined);
|
|
731
|
-
const terminalRun = item.state !== "queued" && item.state !== "running" && item.state !== "pending";
|
|
732
|
-
const endTime = item.run.endedAt ?? (terminalRun ? item.run.lastUpdate : undefined) ?? Date.now();
|
|
733
|
-
durationMs = item.step?.durationMs ?? Math.max(0, endTime - item.run.startedAt);
|
|
734
|
-
}
|
|
735
|
-
return [
|
|
736
|
-
model,
|
|
737
|
-
tokenUsage ? formatTokenUsage(tokenUsage) : tokens !== undefined ? `${formatTokens(tokens)} tok` : undefined,
|
|
738
|
-
tools !== undefined ? `${tools} tool${tools === 1 ? "" : "s"}` : undefined,
|
|
739
|
-
durationMs !== undefined ? formatDuration(durationMs) : undefined,
|
|
740
|
-
].filter((value): value is string => Boolean(value));
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
function structuredHeader(item: FleetItem, width: number, theme: Theme, conversationState: string, promptSummary?: string): string[] {
|
|
744
|
-
const lines: string[] = [];
|
|
745
|
-
lines.push(rightAligned(` ${statusGlyph(item, theme)} ${theme.bold(item.agent)}`, theme.fg("dim", item.state), width));
|
|
746
|
-
const child = "index" in item && item.index !== undefined ? ` · child ${item.index + 1}` : "";
|
|
747
|
-
const context = itemContext(item);
|
|
748
|
-
const identity = `${itemSource(item)} · ${item.runId.slice(0, 8)}${child} · ${itemMode(item)}${context ? ` ${context}` : ""}`;
|
|
749
|
-
lines.push(` ${theme.fg("dim", identity)}`);
|
|
750
|
-
const stats = itemStats(item);
|
|
751
|
-
if (stats.length) lines.push(` ${theme.fg("muted", stats.join(" · "))}`);
|
|
752
|
-
if (promptSummary) lines.push(` ${theme.fg("muted", `Task: ${promptSummary}`)}`);
|
|
753
|
-
lines.push(`${theme.fg("accent", "Conversation")} ${theme.fg("dim", `· ${conversationState}`)}`);
|
|
754
|
-
return lines.map((line) => truncateToWidth(line, width));
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
function fit(text: string, width: number): string {
|
|
758
|
-
const clipped = truncateToWidth(text, Math.max(0, width));
|
|
759
|
-
return clipped + " ".repeat(Math.max(0, width - visibleWidth(clipped)));
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
function rightAligned(left: string, right: string, width: number): string {
|
|
763
|
-
const rightWidth = visibleWidth(right);
|
|
764
|
-
const leftWidth = Math.max(0, width - rightWidth - 1);
|
|
765
|
-
return fit(left, leftWidth) + " ".repeat(Math.max(1, width - leftWidth - rightWidth)) + fit(right, rightWidth);
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
interface FleetDetailSections {
|
|
769
|
-
header: string[];
|
|
770
|
-
body: string[];
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
interface FleetTranscriptCache {
|
|
774
|
-
path: string;
|
|
775
|
-
fingerprint: string;
|
|
776
|
-
width: number;
|
|
777
|
-
expandedTools: boolean;
|
|
778
|
-
transcript: FleetTranscript;
|
|
779
|
-
body: string[];
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
function transcriptFingerprint(filePath: string): string {
|
|
783
|
-
try {
|
|
784
|
-
const stat = fs.statSync(filePath);
|
|
785
|
-
return `${stat.size}:${stat.mtimeMs}`;
|
|
786
|
-
} catch {
|
|
787
|
-
return "missing";
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
export class SubagentFleetComponent implements Component {
|
|
792
|
-
private snapshot: FleetSnapshot = { items: [] };
|
|
793
|
-
private selected = 0;
|
|
794
|
-
private selectedKey: string | undefined;
|
|
795
|
-
private detailScroll = 0;
|
|
796
|
-
private detailAutoFollow = true;
|
|
797
|
-
private detailLineCount = 0;
|
|
798
|
-
private detailViewportHeight = 8;
|
|
799
|
-
private bodyHeight = 8;
|
|
800
|
-
private expandedTools = false;
|
|
801
|
-
private promptAuditOpen = false;
|
|
802
|
-
private promptAuditView: PromptAuditView = "authored";
|
|
803
|
-
private actionNotice: FleetActionResult | undefined;
|
|
804
|
-
private steerDraft: string | undefined;
|
|
805
|
-
private redoGuidanceDraft: string | undefined;
|
|
806
|
-
private steerMode: SteerDeliveryMode = "steer";
|
|
807
|
-
private stopConfirming = false;
|
|
808
|
-
private actionBusy = false;
|
|
809
|
-
private transcriptCache: FleetTranscriptCache | undefined;
|
|
810
|
-
private disposed = false;
|
|
811
|
-
private refreshTimer: ReturnType<typeof setTimeout> | undefined;
|
|
812
|
-
private readonly refreshMs: number;
|
|
813
|
-
private readonly tui: FleetTui;
|
|
814
|
-
private readonly theme: Theme;
|
|
815
|
-
private readonly markdownTheme: MarkdownTheme;
|
|
816
|
-
private readonly state: SubagentState;
|
|
817
|
-
private readonly done: (result: undefined) => void;
|
|
818
|
-
private readonly options: FleetViewOptions;
|
|
819
|
-
private readonly keybindings: ResolvedFleetKeybindings;
|
|
820
|
-
|
|
821
|
-
constructor(
|
|
822
|
-
tui: FleetTui,
|
|
823
|
-
theme: Theme,
|
|
824
|
-
state: SubagentState,
|
|
825
|
-
done: (result: undefined) => void,
|
|
826
|
-
options: FleetViewOptions = {},
|
|
827
|
-
) {
|
|
828
|
-
this.tui = tui;
|
|
829
|
-
this.theme = theme;
|
|
830
|
-
this.markdownTheme = options.markdownTheme ?? getMarkdownTheme();
|
|
831
|
-
this.state = state;
|
|
832
|
-
this.done = done;
|
|
833
|
-
this.options = options;
|
|
834
|
-
this.keybindings = resolveFleetKeybindings(options.fleetKeybindings);
|
|
835
|
-
this.refreshMs = Math.max(MIN_REFRESH_MS, options.refreshMs ?? REFRESH_MS);
|
|
836
|
-
this.selectedKey = options.initialKey;
|
|
837
|
-
this.refresh();
|
|
838
|
-
this.scheduleRefresh();
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
private scheduleRefresh(): void {
|
|
842
|
-
if (this.disposed || this.refreshTimer) return;
|
|
843
|
-
this.refreshTimer = setTimeout(() => {
|
|
844
|
-
this.refreshTimer = undefined;
|
|
845
|
-
if (this.disposed) return;
|
|
846
|
-
try {
|
|
847
|
-
this.invalidate();
|
|
848
|
-
this.tui.requestRender();
|
|
849
|
-
} finally {
|
|
850
|
-
this.scheduleRefresh();
|
|
851
|
-
}
|
|
852
|
-
}, this.refreshMs);
|
|
853
|
-
this.refreshTimer.unref?.();
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
private stopRefresh(): void {
|
|
857
|
-
this.disposed = true;
|
|
858
|
-
if (this.refreshTimer) clearTimeout(this.refreshTimer);
|
|
859
|
-
this.refreshTimer = undefined;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
private refresh(): void {
|
|
863
|
-
const previousKey = this.snapshot.items[this.selected]?.key ?? this.selectedKey;
|
|
864
|
-
this.snapshot = collectFleetSnapshot(this.state, this.options);
|
|
865
|
-
let preserved = previousKey ? this.snapshot.items.findIndex((item) => item.key === previousKey) : -1;
|
|
866
|
-
if (preserved < 0 && previousKey) {
|
|
867
|
-
const parentKey = visibleWorkflowParentKeyForForegroundKey(this.state, previousKey, this.snapshot.items);
|
|
868
|
-
if (parentKey) preserved = this.snapshot.items.findIndex((item) => item.key === parentKey);
|
|
869
|
-
}
|
|
870
|
-
this.selected = preserved >= 0 ? preserved : Math.min(this.selected, Math.max(0, this.snapshot.items.length - 1));
|
|
871
|
-
this.selectedKey = this.snapshot.items[this.selected]?.key;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
private moveSelection(delta: number): void {
|
|
875
|
-
if (this.snapshot.items.length === 0) return;
|
|
876
|
-
this.selected = Math.max(0, Math.min(this.snapshot.items.length - 1, this.selected + delta));
|
|
877
|
-
this.selectedKey = this.snapshot.items[this.selected]?.key;
|
|
878
|
-
this.detailAutoFollow = true;
|
|
879
|
-
this.resetActionInput();
|
|
880
|
-
this.tui.requestRender();
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
private selectedPromptAudit(): LivePromptAudit | undefined {
|
|
884
|
-
const item = this.snapshot.items[this.selected];
|
|
885
|
-
if (item?.kind !== "foreground-active") return undefined;
|
|
886
|
-
if (!this.state.currentSessionId || item.control.sessionId !== this.state.currentSessionId) return undefined;
|
|
887
|
-
return getLivePromptAudit(item.control, item.index ?? 0);
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
private promptAuditItems(): Array<{ item: Extract<FleetItem, { kind: "foreground-active" }>; prompt: LivePromptAudit }> {
|
|
891
|
-
const selected = this.snapshot.items[this.selected];
|
|
892
|
-
if (selected?.kind !== "foreground-active" || !this.state.currentSessionId || selected.control.sessionId !== this.state.currentSessionId) return [];
|
|
893
|
-
return this.snapshot.items.flatMap((item) => {
|
|
894
|
-
if (item.kind !== "foreground-active" || item.control !== selected.control) return [];
|
|
895
|
-
const prompt = getLivePromptAudit(item.control, item.index ?? 0);
|
|
896
|
-
return prompt ? [{ item, prompt }] : [];
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
private selectedPromptText(): string | undefined {
|
|
901
|
-
const prompt = this.selectedPromptAudit();
|
|
902
|
-
return prompt ? promptAuditText(prompt, this.promptAuditView) : undefined;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
private movePromptSelection(delta: number): void {
|
|
906
|
-
const items = this.promptAuditItems();
|
|
907
|
-
if (items.length === 0) return;
|
|
908
|
-
const currentKey = this.snapshot.items[this.selected]?.key;
|
|
909
|
-
const current = Math.max(0, items.findIndex(({ item }) => item.key === currentKey));
|
|
910
|
-
const target = items[Math.max(0, Math.min(items.length - 1, current + delta))]?.item;
|
|
911
|
-
if (!target) return;
|
|
912
|
-
this.selected = this.snapshot.items.findIndex((item) => item.key === target.key);
|
|
913
|
-
this.selectedKey = target.key;
|
|
914
|
-
this.detailScroll = 0;
|
|
915
|
-
this.detailAutoFollow = false;
|
|
916
|
-
this.tui.requestRender();
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
private resetActionInput(): void {
|
|
920
|
-
this.steerDraft = undefined;
|
|
921
|
-
this.redoGuidanceDraft = undefined;
|
|
922
|
-
this.steerMode = "steer";
|
|
923
|
-
this.stopConfirming = false;
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
private selectedAsyncAction(): { item: Extract<FleetItem, { kind: "async" }> } | { reason: string } {
|
|
927
|
-
const item = this.snapshot.items[this.selected];
|
|
928
|
-
if (!item) return { reason: "No child is selected." };
|
|
929
|
-
if (item.kind === "external") return { reason: "External jobs are display-only and remain controlled by their owning extension." };
|
|
930
|
-
if (item.kind !== "async") return { reason: "Fleet controls are available for current-session top-level async runs only." };
|
|
931
|
-
if (!isActionableAsyncState(item.run.state) || !isActionableAsyncState(item.state)) return { reason: `Selected child is ${item.state}; controls require a running or queued async child.` };
|
|
932
|
-
return { item };
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
private selectedSteerAction(): { runId: string; asyncDir: string; index?: number } | { reason: string } {
|
|
936
|
-
const item = this.snapshot.items[this.selected];
|
|
937
|
-
if (item?.kind === "foreground-active" && item.control.parentWorkflowRunId) {
|
|
938
|
-
const parent = this.state.asyncJobs.get(item.control.parentWorkflowRunId) ?? this.state.fleetJobs?.get(item.control.parentWorkflowRunId);
|
|
939
|
-
if (!parent || !isActionableAsyncState(parent.status)) return { reason: "The parent workflow is no longer available for steering." };
|
|
940
|
-
return { runId: item.runId, asyncDir: parent.asyncDir, ...(item.index !== undefined ? { index: item.index } : {}) };
|
|
941
|
-
}
|
|
942
|
-
const target = this.selectedAsyncAction();
|
|
943
|
-
if ("reason" in target) return target;
|
|
944
|
-
return { runId: target.item.runId, asyncDir: target.item.run.asyncDir, ...(target.item.index !== undefined ? { index: target.item.index } : {}) };
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
private selectedInspectAction(): { runId: string; asyncDir: string; index?: number } | { reason: string } {
|
|
948
|
-
const item = this.snapshot.items[this.selected];
|
|
949
|
-
if (!item) return { reason: "No child is selected." };
|
|
950
|
-
if (item.kind === "external") return { reason: "External jobs are display-only and have no inspector controls." };
|
|
951
|
-
if (item.kind === "async") {
|
|
952
|
-
if (!isActionableAsyncState(item.run.state) || !isActionableAsyncState(item.state)) return { reason: `Selected child is ${item.state}; controls require a running or queued async child.` };
|
|
953
|
-
return { runId: item.runId, asyncDir: item.run.asyncDir, ...(item.index !== undefined ? { index: item.index } : {}) };
|
|
954
|
-
}
|
|
955
|
-
if (item.kind !== "foreground-active" || !item.control.parentWorkflowRunId) return { reason: "Fleet controls are available for current-session top-level async runs only." };
|
|
956
|
-
const parent = this.state.asyncJobs.get(item.control.parentWorkflowRunId) ?? this.state.fleetJobs?.get(item.control.parentWorkflowRunId);
|
|
957
|
-
if (!parent || !isActionableAsyncState(parent.status)) return { reason: "The parent workflow is no longer available for inspection." };
|
|
958
|
-
return { runId: parent.asyncId, asyncDir: parent.asyncDir };
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
private inspectSelected(): void {
|
|
962
|
-
const target = this.selectedInspectAction();
|
|
963
|
-
if ("reason" in target || !this.options.actions?.inspect) this.setActionNotice({ text: "reason" in target ? target.reason : "Inspector controls are unavailable in this context.", isError: true });
|
|
964
|
-
else this.runAction(() => this.options.actions!.inspect!(target));
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
private actionLines(): string[] {
|
|
968
|
-
const lines: string[] = [];
|
|
969
|
-
if (this.actionBusy) lines.push(this.theme.fg("accent", "Action pending..."));
|
|
970
|
-
if (this.steerDraft !== undefined) {
|
|
971
|
-
lines.push(this.theme.fg("accent", `Steer message (${this.steerMode}): ${this.steerDraft}${this.theme.fg("dim", "▌")}`));
|
|
972
|
-
lines.push(this.theme.fg("dim", "Enter sends · Tab changes mode · Esc cancels · Backspace edits"));
|
|
973
|
-
} else if (this.redoGuidanceDraft !== undefined) {
|
|
974
|
-
lines.push(this.theme.fg("accent", `Redo guidance: ${this.redoGuidanceDraft}${this.theme.fg("dim", "▌")}`));
|
|
975
|
-
lines.push(this.theme.fg("dim", "Enter rewrites and reruns · Esc cancels · Backspace edits"));
|
|
976
|
-
} else if (this.stopConfirming) {
|
|
977
|
-
const selected = this.snapshot.items[this.selected];
|
|
978
|
-
lines.push(this.theme.fg("warning", `Confirm stop for async run ${selected?.runId ?? "selected run"}?`));
|
|
979
|
-
lines.push(this.theme.fg("dim", "Stop ends the run; use interrupt for a resumable pause. Enter/Y confirms · N returns · Esc cancels"));
|
|
980
|
-
} else if (this.actionNotice) {
|
|
981
|
-
lines.push(this.theme.fg(this.actionNotice.isError ? "error" : "success", this.actionNotice.text));
|
|
982
|
-
}
|
|
983
|
-
return lines;
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
private withActionLines(body: string[]): string[] {
|
|
987
|
-
const actionLines = this.actionLines();
|
|
988
|
-
return actionLines.length ? [...actionLines, "", ...body] : body;
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
private setActionNotice(result: FleetActionResult): void {
|
|
992
|
-
this.actionNotice = result;
|
|
993
|
-
this.resetActionInput();
|
|
994
|
-
this.detailAutoFollow = false;
|
|
995
|
-
this.detailScroll = 0;
|
|
996
|
-
this.refresh();
|
|
997
|
-
this.tui.requestRender();
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
private runAction(action: () => Promise<FleetActionResult>): void {
|
|
1001
|
-
if (this.actionBusy) return;
|
|
1002
|
-
this.actionBusy = true;
|
|
1003
|
-
this.actionNotice = undefined;
|
|
1004
|
-
this.tui.requestRender();
|
|
1005
|
-
void action()
|
|
1006
|
-
.then((result) => this.setActionNotice(result))
|
|
1007
|
-
.catch((error) => this.setActionNotice({ text: error instanceof Error ? error.message : String(error), isError: true }))
|
|
1008
|
-
.finally(() => {
|
|
1009
|
-
this.actionBusy = false;
|
|
1010
|
-
if (!this.disposed) this.tui.requestRender();
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
private scrollDetail(delta: number): void {
|
|
1015
|
-
const maxScroll = Math.max(0, this.detailLineCount - this.detailViewportHeight);
|
|
1016
|
-
this.detailScroll = Math.max(0, Math.min(maxScroll, this.detailScroll + delta));
|
|
1017
|
-
this.detailAutoFollow = this.detailScroll >= maxScroll;
|
|
1018
|
-
this.tui.requestRender();
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
handleInput(data: string): void {
|
|
1022
|
-
if (this.promptAuditOpen && this.redoGuidanceDraft !== undefined) {
|
|
1023
|
-
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
1024
|
-
this.resetActionInput();
|
|
1025
|
-
this.tui.requestRender();
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1028
|
-
if (matchesKey(data, "return") || data === "\r" || data === "\n") {
|
|
1029
|
-
const guidance = this.redoGuidanceDraft.trim();
|
|
1030
|
-
if (!guidance) {
|
|
1031
|
-
this.setActionNotice({ text: "Redo guidance cannot be empty.", isError: true });
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
const selected = this.snapshot.items[this.selected];
|
|
1035
|
-
if (selected?.kind !== "foreground-active" || !this.options.actions?.redoPrompt) {
|
|
1036
|
-
this.setActionNotice({ text: "Redo is unavailable for this prompt.", isError: true });
|
|
1037
|
-
return;
|
|
1038
|
-
}
|
|
1039
|
-
this.runAction(() => this.options.actions!.redoPrompt!({ runId: selected.runId, index: selected.index ?? 0, guidance, control: selected.control }));
|
|
1040
|
-
return;
|
|
1041
|
-
}
|
|
1042
|
-
if (matchesKey(data, "backspace") || data === "\x7f") {
|
|
1043
|
-
this.redoGuidanceDraft = this.redoGuidanceDraft.slice(0, -1);
|
|
1044
|
-
this.tui.requestRender();
|
|
1045
|
-
return;
|
|
1046
|
-
}
|
|
1047
|
-
if (data.length === 1 && data >= " " && data !== "\x7f") {
|
|
1048
|
-
this.redoGuidanceDraft += data;
|
|
1049
|
-
this.tui.requestRender();
|
|
1050
|
-
}
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
if (this.promptAuditOpen) {
|
|
1054
|
-
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
1055
|
-
this.promptAuditOpen = false;
|
|
1056
|
-
this.detailAutoFollow = true;
|
|
1057
|
-
this.tui.requestRender();
|
|
1058
|
-
return;
|
|
1059
|
-
}
|
|
1060
|
-
if (data === "j") return this.movePromptSelection(1);
|
|
1061
|
-
if (data === "k") return this.movePromptSelection(-1);
|
|
1062
|
-
if (data === "1" || data === "2" || data === "3") {
|
|
1063
|
-
this.promptAuditView = data === "1" ? "authored" : data === "2" ? "runtime" : "effective";
|
|
1064
|
-
this.detailScroll = 0;
|
|
1065
|
-
this.tui.requestRender();
|
|
1066
|
-
return;
|
|
1067
|
-
}
|
|
1068
|
-
if (data === "g") {
|
|
1069
|
-
const prompt = this.selectedPromptAudit();
|
|
1070
|
-
if (!prompt) this.setActionNotice({ text: "Prompt Audit is available only for a live child owned by this session.", isError: true });
|
|
1071
|
-
else if (!prompt.rerun) this.setActionNotice({ text: "Redo is not safe for this prompt in this slice.", isError: true });
|
|
1072
|
-
else if (!this.options.actions?.redoPrompt) this.setActionNotice({ text: "Redo controls are unavailable in this context.", isError: true });
|
|
1073
|
-
else {
|
|
1074
|
-
this.actionNotice = undefined;
|
|
1075
|
-
this.redoGuidanceDraft = "";
|
|
1076
|
-
this.detailAutoFollow = false;
|
|
1077
|
-
this.detailScroll = 0;
|
|
1078
|
-
this.tui.requestRender();
|
|
1079
|
-
}
|
|
1080
|
-
return;
|
|
1081
|
-
}
|
|
1082
|
-
if (data === "c") {
|
|
1083
|
-
const text = this.selectedPromptText();
|
|
1084
|
-
if (!text) this.setActionNotice({ text: "No prompt view is available to copy.", isError: true });
|
|
1085
|
-
else if (!this.options.copyText) this.setActionNotice({ text: "Clipboard is unavailable in this context.", isError: true });
|
|
1086
|
-
else this.runAction(async () => {
|
|
1087
|
-
await this.options.copyText!(text);
|
|
1088
|
-
return { text: "Copied visible prompt view." };
|
|
1089
|
-
});
|
|
1090
|
-
return;
|
|
1091
|
-
}
|
|
1092
|
-
if (matchesFleetAction(data, this.keybindings, "scrollUp")) return this.scrollDetail(-1);
|
|
1093
|
-
if (matchesFleetAction(data, this.keybindings, "scrollDown")) return this.scrollDetail(1);
|
|
1094
|
-
if (matchesFleetAction(data, this.keybindings, "pageUp")) return this.scrollDetail(-this.detailViewportHeight);
|
|
1095
|
-
if (matchesFleetAction(data, this.keybindings, "pageDown")) return this.scrollDetail(this.detailViewportHeight);
|
|
1096
|
-
return;
|
|
1097
|
-
}
|
|
1098
|
-
if (this.steerDraft !== undefined) {
|
|
1099
|
-
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
1100
|
-
this.resetActionInput();
|
|
1101
|
-
this.tui.requestRender();
|
|
1102
|
-
return;
|
|
1103
|
-
}
|
|
1104
|
-
if (matchesKey(data, "return") || data === "\r" || data === "\n") {
|
|
1105
|
-
const message = this.steerDraft.trim();
|
|
1106
|
-
if (!message) {
|
|
1107
|
-
this.setActionNotice({ text: "Steer message cannot be empty.", isError: true });
|
|
1108
|
-
return;
|
|
1109
|
-
}
|
|
1110
|
-
const target = this.selectedSteerAction();
|
|
1111
|
-
if ("reason" in target || !this.options.actions) {
|
|
1112
|
-
this.setActionNotice({ text: "reason" in target ? target.reason : "Fleet controls are unavailable in this context.", isError: true });
|
|
1113
|
-
return;
|
|
1114
|
-
}
|
|
1115
|
-
this.runAction(() => this.options.actions!.steer({ ...target, message, mode: this.steerMode }));
|
|
1116
|
-
return;
|
|
1117
|
-
}
|
|
1118
|
-
if (matchesKey(data, "tab") || data === "\t") {
|
|
1119
|
-
const modes: SteerDeliveryMode[] = ["steer", "follow_up", "auto"];
|
|
1120
|
-
this.steerMode = modes[(modes.indexOf(this.steerMode) + 1) % modes.length]!;
|
|
1121
|
-
this.tui.requestRender();
|
|
1122
|
-
return;
|
|
1123
|
-
}
|
|
1124
|
-
if (matchesKey(data, "backspace") || data === "\x7f") {
|
|
1125
|
-
this.steerDraft = this.steerDraft.slice(0, -1);
|
|
1126
|
-
this.tui.requestRender();
|
|
1127
|
-
return;
|
|
1128
|
-
}
|
|
1129
|
-
if (data.length === 1 && data >= " " && data !== "\x7f") {
|
|
1130
|
-
this.steerDraft += data;
|
|
1131
|
-
this.tui.requestRender();
|
|
1132
|
-
}
|
|
1133
|
-
return;
|
|
1134
|
-
}
|
|
1135
|
-
if (this.stopConfirming) {
|
|
1136
|
-
if (matchesKey(data, "return") || data.toLowerCase() === "y") {
|
|
1137
|
-
const target = this.selectedAsyncAction();
|
|
1138
|
-
if ("reason" in target || !this.options.actions) {
|
|
1139
|
-
this.setActionNotice({ text: "reason" in target ? target.reason : "Fleet controls are unavailable in this context.", isError: true });
|
|
1140
|
-
return;
|
|
1141
|
-
}
|
|
1142
|
-
this.runAction(() => Promise.resolve(this.options.actions!.stop({ runId: target.item.runId, asyncDir: target.item.run.asyncDir, ...(target.item.index !== undefined ? { index: target.item.index } : {}) })));
|
|
1143
|
-
return;
|
|
1144
|
-
}
|
|
1145
|
-
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c") || data.toLowerCase() === "n" || matchesKey(data, "backspace")) {
|
|
1146
|
-
this.resetActionInput();
|
|
1147
|
-
this.tui.requestRender();
|
|
1148
|
-
}
|
|
1149
|
-
return;
|
|
1150
|
-
}
|
|
1151
|
-
if (matchesFleetAction(data, this.keybindings, "close")) {
|
|
1152
|
-
this.stopRefresh();
|
|
1153
|
-
this.done(undefined);
|
|
1154
|
-
return;
|
|
1155
|
-
}
|
|
1156
|
-
if (matchesFleetAction(data, this.keybindings, "scrollUp")) return this.scrollDetail(-1);
|
|
1157
|
-
if (matchesFleetAction(data, this.keybindings, "scrollDown")) return this.scrollDetail(1);
|
|
1158
|
-
if (matchesFleetAction(data, this.keybindings, "selectUp")) return this.moveSelection(-1);
|
|
1159
|
-
if (matchesFleetAction(data, this.keybindings, "selectDown")) return this.moveSelection(1);
|
|
1160
|
-
if (matchesFleetAction(data, this.keybindings, "selectFirst")) return this.moveSelection(-this.snapshot.items.length);
|
|
1161
|
-
if (matchesFleetAction(data, this.keybindings, "selectLast")) return this.moveSelection(this.snapshot.items.length);
|
|
1162
|
-
if (matchesFleetAction(data, this.keybindings, "pageUp")) return this.scrollDetail(-this.detailViewportHeight);
|
|
1163
|
-
if (matchesFleetAction(data, this.keybindings, "pageDown")) return this.scrollDetail(this.detailViewportHeight);
|
|
1164
|
-
if (matchesFleetAction(data, this.keybindings, "refresh")) {
|
|
1165
|
-
this.transcriptCache = undefined;
|
|
1166
|
-
this.refresh();
|
|
1167
|
-
this.tui.requestRender();
|
|
1168
|
-
return;
|
|
1169
|
-
}
|
|
1170
|
-
if (data === "p") {
|
|
1171
|
-
if (!this.selectedPromptAudit()) this.setActionNotice({ text: "Prompt Audit is available only for a live child owned by this session.", isError: true });
|
|
1172
|
-
else {
|
|
1173
|
-
this.promptAuditOpen = true;
|
|
1174
|
-
this.promptAuditView = "authored";
|
|
1175
|
-
this.detailScroll = 0;
|
|
1176
|
-
this.detailAutoFollow = false;
|
|
1177
|
-
this.actionNotice = undefined;
|
|
1178
|
-
this.tui.requestRender();
|
|
1179
|
-
}
|
|
1180
|
-
return;
|
|
1181
|
-
}
|
|
1182
|
-
if (matchesFleetAction(data, this.keybindings, "steer")) {
|
|
1183
|
-
const target = this.selectedSteerAction();
|
|
1184
|
-
if ("reason" in target || !this.options.actions) this.setActionNotice({ text: "reason" in target ? target.reason : "Fleet controls are unavailable in this context.", isError: true });
|
|
1185
|
-
else {
|
|
1186
|
-
this.actionNotice = undefined;
|
|
1187
|
-
this.steerDraft = "";
|
|
1188
|
-
this.detailAutoFollow = false;
|
|
1189
|
-
this.detailScroll = 0;
|
|
1190
|
-
this.tui.requestRender();
|
|
1191
|
-
}
|
|
1192
|
-
return;
|
|
1193
|
-
}
|
|
1194
|
-
if (matchesFleetAction(data, this.keybindings, "stop")) {
|
|
1195
|
-
const target = this.selectedAsyncAction();
|
|
1196
|
-
if ("reason" in target || !this.options.actions) this.setActionNotice({ text: "reason" in target ? target.reason : "Fleet controls are unavailable in this context.", isError: true });
|
|
1197
|
-
else {
|
|
1198
|
-
this.actionNotice = undefined;
|
|
1199
|
-
this.stopConfirming = true;
|
|
1200
|
-
this.detailAutoFollow = false;
|
|
1201
|
-
this.detailScroll = 0;
|
|
1202
|
-
this.tui.requestRender();
|
|
1203
|
-
}
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
if (matchesFleetAction(data, this.keybindings, "toggleTools")) {
|
|
1207
|
-
this.expandedTools = !this.expandedTools;
|
|
1208
|
-
this.transcriptCache = undefined;
|
|
1209
|
-
this.tui.requestRender();
|
|
1210
|
-
return;
|
|
1211
|
-
}
|
|
1212
|
-
if (matchesFleetAction(data, this.keybindings, "inspect")) {
|
|
1213
|
-
this.inspectSelected();
|
|
1214
|
-
return;
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
private rosterLines(width: number): string[] {
|
|
1219
|
-
if (this.snapshot.items.length === 0) return [this.theme.fg("dim", "No tracked children")];
|
|
1220
|
-
const start = Math.max(0, Math.min(this.selected - this.bodyHeight + 1, Math.max(0, this.snapshot.items.length - this.bodyHeight)));
|
|
1221
|
-
return this.snapshot.items.slice(start, start + this.bodyHeight).map((item, offset) => {
|
|
1222
|
-
const index = start + offset;
|
|
1223
|
-
const marker = index === this.selected ? this.theme.fg("accent", "›") : " ";
|
|
1224
|
-
const context = item.kind === "async" ? contextModeBadge(this.theme, item.step?.context ?? item.run.context) : item.kind === "foreground-recent" ? contextModeBadge(this.theme, item.child.context) : "";
|
|
1225
|
-
const agent = index === this.selected ? this.theme.bold(item.agent) : item.agent;
|
|
1226
|
-
const identity = item.runId.slice(0, 8);
|
|
1227
|
-
const left = `${marker} ${statusGlyph(item, this.theme)} ${agent}${context} ${this.theme.fg("dim", `· ${identity}`)}`;
|
|
1228
|
-
return rightAligned(left, this.theme.fg("dim", item.state), width);
|
|
1229
|
-
});
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
private renderedTranscript(target: { path: string; trustedRoots: string[]; trustedFiles?: string[]; trustedFileRoot?: string }, width: number): { transcript: FleetTranscript; body: string[] } {
|
|
1233
|
-
const fingerprint = `${target.trustedRoots.join("\0")}|${target.trustedFiles?.join("\0") ?? ""}|${target.trustedFileRoot ?? ""}|${transcriptFingerprint(target.path)}`;
|
|
1234
|
-
if (this.transcriptCache
|
|
1235
|
-
&& this.transcriptCache.path === target.path
|
|
1236
|
-
&& this.transcriptCache.fingerprint === fingerprint
|
|
1237
|
-
&& this.transcriptCache.width === width
|
|
1238
|
-
&& this.transcriptCache.expandedTools === this.expandedTools) {
|
|
1239
|
-
return { transcript: this.transcriptCache.transcript, body: [...this.transcriptCache.body] };
|
|
1240
|
-
}
|
|
1241
|
-
const transcript = readFleetTranscript(target.path, {
|
|
1242
|
-
trustedRoots: target.trustedRoots,
|
|
1243
|
-
...(target.trustedFiles ? { trustedFiles: target.trustedFiles } : {}),
|
|
1244
|
-
...(target.trustedFileRoot ? { trustedFileRoot: target.trustedFileRoot } : {}),
|
|
1245
|
-
});
|
|
1246
|
-
const body = transcript.events.length > 0
|
|
1247
|
-
? renderFleetTranscript(transcript, width, this.theme, this.markdownTheme, { expandedTools: this.expandedTools })
|
|
1248
|
-
: [];
|
|
1249
|
-
this.transcriptCache = { path: target.path, fingerprint, width, expandedTools: this.expandedTools, transcript, body };
|
|
1250
|
-
return { transcript, body: [...body] };
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
private promptAuditDetail(width: number): FleetDetailSections {
|
|
1254
|
-
const selected = this.snapshot.items[this.selected];
|
|
1255
|
-
const prompt = this.selectedPromptAudit();
|
|
1256
|
-
const items = this.promptAuditItems();
|
|
1257
|
-
const selectedPosition = selected ? items.findIndex(({ item }) => item.key === selected.key) : -1;
|
|
1258
|
-
const live = selected?.kind === "foreground-active" ? selected.activeChild ?? selected.control : undefined;
|
|
1259
|
-
const viewLabel = promptAuditViewLabel(this.promptAuditView);
|
|
1260
|
-
const promptText = this.selectedPromptText()
|
|
1261
|
-
?? this.theme.fg("muted", "Selected prompt unavailable.");
|
|
1262
|
-
const raw = [
|
|
1263
|
-
this.theme.bold("Prompt Audit"),
|
|
1264
|
-
this.theme.fg("dim", "Retention: live memory only · no storage"),
|
|
1265
|
-
selected?.kind === "foreground-active" ? `Run: ${selected.runId}${selected.index !== undefined ? ` · Child: ${selected.index}` : ""} · Agent: ${selected.agent}` : "Selected prompt unavailable",
|
|
1266
|
-
live ? `Started: ${new Date(live.startedAt).toISOString()}` : undefined,
|
|
1267
|
-
live ? `Model: ${formatModelThinking(live.model, live.thinking) || "default"}` : undefined,
|
|
1268
|
-
prompt?.cwd ? `Cwd: ${prompt.cwd}` : undefined,
|
|
1269
|
-
prompt?.outputPath ? `Output: ${prompt.outputPath}` : undefined,
|
|
1270
|
-
this.theme.fg("dim", `Live children: ${items.map(({ item }) => item.agent).join(", ") || "none"}`),
|
|
1271
|
-
this.theme.fg("dim", selectedPosition >= 0 ? `Selected: ${selectedPosition + 1}/${items.length}` : "Selected prompt unavailable"),
|
|
1272
|
-
"",
|
|
1273
|
-
this.theme.fg("accent", viewLabel),
|
|
1274
|
-
promptText,
|
|
1275
|
-
];
|
|
1276
|
-
const body = raw.filter((line): line is string => line !== undefined).flatMap((line) => wrapTextWithAnsi(line, Math.max(1, width)));
|
|
1277
|
-
return { header: [], body: this.withActionLines(body) };
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
private wrappedDetail(width: number): FleetDetailSections {
|
|
1281
|
-
if (this.promptAuditOpen) return this.promptAuditDetail(width);
|
|
1282
|
-
const selected = this.snapshot.items[this.selected];
|
|
1283
|
-
let transcriptWarning: string | undefined;
|
|
1284
|
-
if (selected) {
|
|
1285
|
-
const target = transcriptTarget(selected, this.state);
|
|
1286
|
-
if (target) {
|
|
1287
|
-
const { transcript, body } = this.renderedTranscript(target, width);
|
|
1288
|
-
transcriptWarning = transcript.warning;
|
|
1289
|
-
if (transcript.events.length > 0) {
|
|
1290
|
-
if (this.snapshot.error) body.unshift(this.theme.fg("warning", `Fleet scan warning: ${this.snapshot.error}`), "");
|
|
1291
|
-
const latest = transcript.events.at(-1);
|
|
1292
|
-
const conversationState = latest?.kind === "assistant"
|
|
1293
|
-
? "assistant response"
|
|
1294
|
-
: latest?.kind === "user"
|
|
1295
|
-
? "supervisor message"
|
|
1296
|
-
: latest?.kind === "tool"
|
|
1297
|
-
? `${latest.name} · ${latest.status}`
|
|
1298
|
-
: "activity";
|
|
1299
|
-
const promptSummary = selected.kind === "foreground-active" ? foregroundAuthoredPromptSummary(selected, this.state) : undefined;
|
|
1300
|
-
return { header: structuredHeader(selected, width, this.theme, conversationState, promptSummary), body: this.withActionLines(body) };
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
const raw = detailLines(selected, this.snapshot.error, this.state);
|
|
1306
|
-
if (transcriptWarning) raw.unshift(`Transcript preview warning: ${transcriptWarning}`, "");
|
|
1307
|
-
const lines: string[] = [];
|
|
1308
|
-
for (const line of raw) {
|
|
1309
|
-
const styled = /^(Run|State|Mode|Source|Child|Agent|Model|Task):/.test(line)
|
|
1310
|
-
? this.theme.bold(line)
|
|
1311
|
-
: /^(Transcript|Result transcript tail)/.test(line)
|
|
1312
|
-
? this.theme.fg("accent", line)
|
|
1313
|
-
: /^(Output|Session|Transcript file|Artifacts):/.test(line)
|
|
1314
|
-
? this.theme.fg("muted", line)
|
|
1315
|
-
: /^Transcript preview warning:/.test(line)
|
|
1316
|
-
? this.theme.fg("warning", line)
|
|
1317
|
-
: line;
|
|
1318
|
-
const wrapped = wrapTextWithAnsi(styled, Math.max(1, width));
|
|
1319
|
-
lines.push(...(wrapped.length ? wrapped : [""]));
|
|
1320
|
-
}
|
|
1321
|
-
return { header: [], body: this.withActionLines(lines) };
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
render(width: number): string[] {
|
|
1325
|
-
if (width < 36) return [truncateToWidth("Subagent fleet needs at least 36 columns. Esc closes.", width)];
|
|
1326
|
-
const innerWidth = width - 2;
|
|
1327
|
-
const rows = this.tui.terminal?.rows ?? 32;
|
|
1328
|
-
this.bodyHeight = Math.max(2, Math.floor(rows * 0.85) - 6);
|
|
1329
|
-
const rosterWidth = Math.max(22, Math.min(46, Math.floor((innerWidth - 1) * 0.38)));
|
|
1330
|
-
const detailWidth = Math.max(1, innerWidth - rosterWidth - 1);
|
|
1331
|
-
const roster = this.rosterLines(rosterWidth);
|
|
1332
|
-
const detail = this.wrappedDetail(detailWidth);
|
|
1333
|
-
const detailHeader = detail.header.slice(0, Math.max(0, this.bodyHeight - 1));
|
|
1334
|
-
this.detailViewportHeight = Math.max(1, this.bodyHeight - detailHeader.length);
|
|
1335
|
-
this.detailLineCount = detail.body.length;
|
|
1336
|
-
const maxDetailScroll = Math.max(0, detail.body.length - this.detailViewportHeight);
|
|
1337
|
-
if (this.detailAutoFollow) this.detailScroll = maxDetailScroll;
|
|
1338
|
-
else if (this.detailScroll > maxDetailScroll) this.detailScroll = maxDetailScroll;
|
|
1339
|
-
const visibleDetails = [
|
|
1340
|
-
...detailHeader,
|
|
1341
|
-
...detail.body.slice(this.detailScroll, this.detailScroll + this.detailViewportHeight),
|
|
1342
|
-
];
|
|
1343
|
-
const lines = [this.theme.fg("border", `╭${"─".repeat(innerWidth)}╮`)];
|
|
1344
|
-
const selected = this.snapshot.items[this.selected];
|
|
1345
|
-
const title = selected?.kind === "external"
|
|
1346
|
-
? ` ${this.theme.bold("Fleet inspector")} ${this.theme.fg("dim", "· external display-only")}`
|
|
1347
|
-
: ` ${this.theme.bold("Subagent fleet inspector")} ${this.theme.fg("dim", "· live controls")}`;
|
|
1348
|
-
const selectedStatus = selected
|
|
1349
|
-
? `${statusGlyph(selected, this.theme)} ${selected.agent} · ${selected.state} `
|
|
1350
|
-
: this.theme.fg("dim", "no children ");
|
|
1351
|
-
lines.push(this.theme.fg("border", "│") + rightAligned(title, selectedStatus, innerWidth) + this.theme.fg("border", "│"));
|
|
1352
|
-
lines.push(this.theme.fg("border", `├${"─".repeat(rosterWidth)}┬${"─".repeat(detailWidth)}┤`));
|
|
1353
|
-
for (let index = 0; index < this.bodyHeight; index++) {
|
|
1354
|
-
lines.push(
|
|
1355
|
-
this.theme.fg("border", "│")
|
|
1356
|
-
+ fit(roster[index] ?? "", rosterWidth)
|
|
1357
|
-
+ this.theme.fg("border", "│")
|
|
1358
|
-
+ fit(visibleDetails[index] ?? "", detailWidth)
|
|
1359
|
-
+ this.theme.fg("border", "│"),
|
|
1360
|
-
);
|
|
1361
|
-
}
|
|
1362
|
-
lines.push(this.theme.fg("border", `├${"─".repeat(rosterWidth)}┴${"─".repeat(detailWidth)}┤`));
|
|
1363
|
-
const position = this.snapshot.items.length ? `${this.selected + 1}/${this.snapshot.items.length}` : "0/0";
|
|
1364
|
-
const footer = this.promptAuditOpen
|
|
1365
|
-
? ` j/k child · 1/2/3 view · g redo with guidance · c copy · Esc close Prompt Audit · ${position}`
|
|
1366
|
-
: selected?.kind === "external"
|
|
1367
|
-
? ` ${bindingLabel(this.keybindings, "selectUp")}/${bindingLabel(this.keybindings, "selectDown")} job · display-only · ${bindingLabel(this.keybindings, "refresh")} refresh · ${bindingLabel(this.keybindings, "close")} close · ${position}`
|
|
1368
|
-
: ` ${bindingLabel(this.keybindings, "selectUp")}/${bindingLabel(this.keybindings, "selectDown")} agent · p Prompt Audit · ${bindingLabel(this.keybindings, "inspect")} Inspect · ${bindingLabel(this.keybindings, "steer")} steer · ${bindingLabel(this.keybindings, "stop")} stop · ${bindingLabel(this.keybindings, "toggleTools")} tools · ${bindingLabel(this.keybindings, "refresh")} refresh · ${bindingLabel(this.keybindings, "close")} close · ${position}`;
|
|
1369
|
-
lines.push(this.theme.fg("border", "│") + fit(this.theme.fg("dim", footer), innerWidth) + this.theme.fg("border", "│"));
|
|
1370
|
-
lines.push(this.theme.fg("border", `╰${"─".repeat(innerWidth)}╯`));
|
|
1371
|
-
return lines.map((line) => truncateToWidth(line, width));
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
invalidate(): void {
|
|
1375
|
-
this.transcriptCache = undefined;
|
|
1376
|
-
this.refresh();
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
dispose(): void {
|
|
1380
|
-
this.stopRefresh();
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
export async function openSubagentFleet(ctx: ExtensionContext, state: SubagentState, options: FleetViewOptions = {}): Promise<void> {
|
|
1385
|
-
const wasOpen = state.fleetInspectorOpen === true;
|
|
1386
|
-
state.fleetInspectorOpen = true;
|
|
1387
|
-
if (typeof ctx.ui.setWidget === "function") ctx.ui.setWidget(FLEET_STATUS_WIDGET_KEY, undefined);
|
|
1388
|
-
const copyText = options.copyText ?? (async (text: string) => {
|
|
1389
|
-
const module = await import("@earendil-works/pi-coding-agent");
|
|
1390
|
-
const copyToClipboard = (module as { copyToClipboard?: (value: string) => Promise<void> | void }).copyToClipboard;
|
|
1391
|
-
if (!copyToClipboard) throw new Error("Clipboard is unavailable in this Pi version.");
|
|
1392
|
-
await copyToClipboard(text);
|
|
1393
|
-
});
|
|
1394
|
-
const actions = options.actions ?? {
|
|
1395
|
-
steer: async (input: { runId: string; asyncDir: string; index?: number; message: string; mode: SteerDeliveryMode }) => {
|
|
1396
|
-
const status = readStatus(input.asyncDir);
|
|
1397
|
-
const liveWorkflowRunId = status?.mode === "workflow" && state.workflowControllers?.has(status.runId || input.runId)
|
|
1398
|
-
? status.runId || input.runId
|
|
1399
|
-
: undefined;
|
|
1400
|
-
if (liveWorkflowRunId) {
|
|
1401
|
-
const route = state.foregroundControls.get(input.runId)?.parentWorkflowRunId === liveWorkflowRunId
|
|
1402
|
-
? resolveWorkflowForegroundSteeringTarget({ state, childRunId: input.runId, asyncDirRoot: options.asyncDirRoot ?? DIRS.async })
|
|
1403
|
-
: resolveWorkflowForegroundSteeringTarget({ state, workflowRunId: liveWorkflowRunId, asyncDirRoot: options.asyncDirRoot ?? DIRS.async });
|
|
1404
|
-
if (!route.ok) return { text: route.message, isError: true };
|
|
1405
|
-
return firstToolResultText(await steerWorkflowForegroundTarget({ target: route.target, message: input.message, mode: input.mode, ...(input.index !== undefined ? { index: input.index } : {}) }), `Failed to steer foreground run ${input.runId}.`);
|
|
1406
|
-
}
|
|
1407
|
-
return firstToolResultText(await steerAsyncRun({
|
|
1408
|
-
state,
|
|
1409
|
-
runId: input.runId,
|
|
1410
|
-
...(input.index !== undefined ? { index: input.index } : {}),
|
|
1411
|
-
message: input.message,
|
|
1412
|
-
mode: input.mode,
|
|
1413
|
-
location: { asyncDir: input.asyncDir, resolvedId: input.runId } as Parameters<typeof steerAsyncRun>[0]["location"],
|
|
1414
|
-
}), `Failed to steer async run ${input.runId}.`);
|
|
1415
|
-
},
|
|
1416
|
-
stop: (input: { runId: string; asyncDir: string; index?: number }) => firstToolResultText(stopAsyncRun(state, input.runId, undefined, { asyncDir: input.asyncDir, resolvedId: input.runId }), `Failed to stop async run ${input.runId}.`),
|
|
1417
|
-
inspect: async (input: { runId: string; asyncDir: string; index?: number }) => firstToolResultText(await handleInspectorAction("inspector.open", {
|
|
1418
|
-
id: input.runId,
|
|
1419
|
-
dir: input.asyncDir,
|
|
1420
|
-
focus: true,
|
|
1421
|
-
...(input.index !== undefined ? { index: input.index } : {}),
|
|
1422
|
-
}, {
|
|
1423
|
-
state,
|
|
1424
|
-
sessionRoots: state.trustedSessionRoots,
|
|
1425
|
-
cwd: state.baseCwd,
|
|
1426
|
-
...(state.authorityPolicy ? { authorityPolicy: state.authorityPolicy } : {}),
|
|
1427
|
-
...(state.missionStoreConfig ? { missions: state.missionStoreConfig } : {}),
|
|
1428
|
-
...(options.inspectorPlugins ? { plugins: options.inspectorPlugins } : {}),
|
|
1429
|
-
...(options.inspectorEnv ? { env: options.inspectorEnv } : {}),
|
|
1430
|
-
}), `Failed to open inspector for async run ${input.runId}.`),
|
|
1431
|
-
redoPrompt: async (input: { runId: string; index: number; guidance: string; control?: ForegroundRunControl }) => {
|
|
1432
|
-
const control = input.control ?? state.foregroundControls.get(input.runId);
|
|
1433
|
-
if (!control?.promptAuditRedo) return { text: "Redo is not available for this live child.", isError: true };
|
|
1434
|
-
return control.promptAuditRedo(input.index, input.guidance);
|
|
1435
|
-
},
|
|
1436
|
-
} satisfies FleetActionHandlers;
|
|
1437
|
-
try {
|
|
1438
|
-
await ctx.ui.custom<undefined>(
|
|
1439
|
-
(tui, theme, _keybindings, done) => new SubagentFleetComponent(tui, theme, state, done, { ...options, actions, copyText }),
|
|
1440
|
-
{
|
|
1441
|
-
overlay: true,
|
|
1442
|
-
overlayOptions: { anchor: "center", width: "95%", minWidth: 60, maxHeight: "85%", margin: 1 },
|
|
1443
|
-
},
|
|
1444
|
-
);
|
|
1445
|
-
} finally {
|
|
1446
|
-
state.fleetInspectorOpen = wasOpen;
|
|
1447
|
-
}
|
|
1448
|
-
}
|