@emiliosp/pi-maestro 0.7.4 → 0.9.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/ADR.md +89 -0
- package/CHANGELOG.md +6 -0
- package/README.md +3 -2
- package/ROADMAP.md +115 -21
- package/agents/builder.md +2 -4
- package/docs/glossary.md +2 -1
- package/docs/workflow.md +25 -9
- package/node_modules/pi-subagents/CHANGELOG.md +140 -0
- package/node_modules/pi-subagents/README.md +1 -1
- package/node_modules/pi-subagents/agents/evidence-auditor.md +1 -0
- package/node_modules/pi-subagents/agents/oracle.md +9 -19
- package/node_modules/pi-subagents/agents/researcher.md +0 -3
- package/node_modules/pi-subagents/agents/reviewer.md +18 -61
- package/node_modules/pi-subagents/agents/scout.md +1 -4
- package/node_modules/pi-subagents/agents/worker.md +8 -25
- package/node_modules/pi-subagents/docs/agents.md +71 -4
- package/node_modules/pi-subagents/docs/configuration.md +75 -10
- package/node_modules/pi-subagents/docs/extension-api.md +40 -11
- package/node_modules/pi-subagents/docs/missions.md +24 -17
- package/node_modules/pi-subagents/docs/models.md +1 -1
- package/node_modules/pi-subagents/docs/observability.md +12 -5
- package/node_modules/pi-subagents/docs/tool-reference.md +103 -85
- package/node_modules/pi-subagents/docs/watchdog.md +8 -6
- package/node_modules/pi-subagents/docs/workflows.md +17 -8
- package/node_modules/pi-subagents/index.d.ts.map +1 -1
- package/node_modules/pi-subagents/index.js +5 -0
- package/node_modules/pi-subagents/index.js.map +1 -1
- package/node_modules/pi-subagents/package.json +2 -1
- package/node_modules/pi-subagents/prompts/council.md +1 -1
- package/node_modules/pi-subagents/skills/pi-subagents/SKILL.md +2 -2
- package/node_modules/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +1 -1
- package/node_modules/pi-subagents/skills/pi-subagents/references/execution-controls.md +16 -16
- package/node_modules/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +16 -12
- package/node_modules/pi-subagents/skills/pi-subagents/references/multi-lane-orchestration.md +1 -1
- package/node_modules/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +3 -3
- package/node_modules/pi-subagents/src/agents/advertised-agent-prompt.d.ts +5 -1
- package/node_modules/pi-subagents/src/agents/advertised-agent-prompt.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/agents/advertised-agent-prompt.js +8 -2
- package/node_modules/pi-subagents/src/agents/advertised-agent-prompt.js.map +1 -1
- package/node_modules/pi-subagents/src/agents/agent-management.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/agents/agent-management.js +5 -0
- package/node_modules/pi-subagents/src/agents/agent-management.js.map +1 -1
- package/node_modules/pi-subagents/src/agents/agent-scope.d.ts +1 -0
- package/node_modules/pi-subagents/src/agents/agent-scope.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/agents/agent-scope.js +3 -0
- package/node_modules/pi-subagents/src/agents/agent-scope.js.map +1 -1
- package/node_modules/pi-subagents/src/agents/agent-serializer.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/agents/agent-serializer.js +3 -0
- package/node_modules/pi-subagents/src/agents/agent-serializer.js.map +1 -1
- package/node_modules/pi-subagents/src/agents/agents.d.ts +14 -2
- package/node_modules/pi-subagents/src/agents/agents.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/agents/agents.js +94 -36
- package/node_modules/pi-subagents/src/agents/agents.js.map +1 -1
- package/node_modules/pi-subagents/src/api/external-runs.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/api/external-runs.js +5 -4
- package/node_modules/pi-subagents/src/api/external-runs.js.map +1 -1
- package/node_modules/pi-subagents/src/api/preflight.d.ts +2 -0
- package/node_modules/pi-subagents/src/api/preflight.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/api/preflight.js +7 -3
- package/node_modules/pi-subagents/src/api/preflight.js.map +1 -1
- package/node_modules/pi-subagents/src/extension/active-runs-prompt.d.ts +8 -0
- package/node_modules/pi-subagents/src/extension/active-runs-prompt.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/active-runs-prompt.js +30 -0
- package/node_modules/pi-subagents/src/extension/active-runs-prompt.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/config.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/extension/config.js +29 -2
- package/node_modules/pi-subagents/src/extension/config.js.map +1 -1
- package/node_modules/pi-subagents/src/extension/control-notices.d.ts +0 -2
- package/node_modules/pi-subagents/src/extension/control-notices.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/extension/control-notices.js +1 -7
- package/node_modules/pi-subagents/src/extension/control-notices.js.map +1 -1
- package/node_modules/pi-subagents/src/extension/declaration-pinning.d.ts +19 -0
- package/node_modules/pi-subagents/src/extension/declaration-pinning.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/declaration-pinning.js +154 -0
- package/node_modules/pi-subagents/src/extension/declaration-pinning.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/doctor.d.ts +3 -1
- package/node_modules/pi-subagents/src/extension/doctor.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/extension/doctor.js +3 -9
- package/node_modules/pi-subagents/src/extension/doctor.js.map +1 -1
- package/node_modules/pi-subagents/src/extension/fanout-child.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/extension/fanout-child.js +6 -8
- package/node_modules/pi-subagents/src/extension/fanout-child.js.map +1 -1
- package/node_modules/pi-subagents/src/extension/index.d.ts +1 -2
- package/node_modules/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/extension/index.js +121 -127
- package/node_modules/pi-subagents/src/extension/index.js.map +1 -1
- package/node_modules/pi-subagents/src/extension/rpc.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/extension/rpc.js +12 -6
- package/node_modules/pi-subagents/src/extension/rpc.js.map +1 -1
- package/node_modules/pi-subagents/src/extension/schemas.d.ts +137 -1
- package/node_modules/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/extension/schemas.js +22 -22
- package/node_modules/pi-subagents/src/extension/schemas.js.map +1 -1
- package/node_modules/pi-subagents/src/extension/subagent-guide.d.ts +1 -0
- package/node_modules/pi-subagents/src/extension/subagent-guide.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/extension/subagent-guide.js +80 -6
- package/node_modules/pi-subagents/src/extension/subagent-guide.js.map +1 -1
- package/node_modules/pi-subagents/src/extension/subagent-options.d.ts +8 -0
- package/node_modules/pi-subagents/src/extension/subagent-options.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/extension/subagent-options.js +52 -0
- package/node_modules/pi-subagents/src/extension/subagent-options.js.map +1 -0
- package/node_modules/pi-subagents/src/extension/tool-activation.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/extension/tool-activation.js +7 -4
- package/node_modules/pi-subagents/src/extension/tool-activation.js.map +1 -1
- package/node_modules/pi-subagents/src/extension/tool-description.d.ts +4 -7
- package/node_modules/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/extension/tool-description.js +45 -59
- package/node_modules/pi-subagents/src/extension/tool-description.js.map +1 -1
- package/node_modules/pi-subagents/src/inspectors/actions.d.ts +2 -0
- package/node_modules/pi-subagents/src/inspectors/actions.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/inspectors/actions.js +41 -13
- package/node_modules/pi-subagents/src/inspectors/actions.js.map +1 -1
- package/node_modules/pi-subagents/src/inspectors/plugins.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/inspectors/plugins.js +3 -2
- package/node_modules/pi-subagents/src/inspectors/plugins.js.map +1 -1
- package/node_modules/pi-subagents/src/inspectors/tmux/actions.d.ts +26 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/actions.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/actions.js +182 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/actions.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/client.d.ts +28 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/client.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/client.js +65 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/client.js.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/plugin.d.ts +8 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/plugin.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/plugin.js +15 -0
- package/node_modules/pi-subagents/src/inspectors/tmux/plugin.js.map +1 -0
- package/node_modules/pi-subagents/src/integrations/herdr-status.d.ts +0 -1
- package/node_modules/pi-subagents/src/integrations/herdr-status.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/integrations/herdr-status.js +18 -52
- package/node_modules/pi-subagents/src/integrations/herdr-status.js.map +1 -1
- package/node_modules/pi-subagents/src/integrations/program-status.d.ts +31 -0
- package/node_modules/pi-subagents/src/integrations/program-status.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/integrations/program-status.js +189 -0
- package/node_modules/pi-subagents/src/integrations/program-status.js.map +1 -0
- package/node_modules/pi-subagents/src/intercom/native-supervisor-channel.d.ts +17 -1
- package/node_modules/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/intercom/native-supervisor-channel.js +102 -9
- package/node_modules/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
- package/node_modules/pi-subagents/src/intercom/result-intercom.js +1 -1
- package/node_modules/pi-subagents/src/intercom/result-intercom.js.map +1 -1
- package/node_modules/pi-subagents/src/intercom/supervisor-ui.d.ts +2 -12
- package/node_modules/pi-subagents/src/intercom/supervisor-ui.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/intercom/supervisor-ui.js +2 -154
- package/node_modules/pi-subagents/src/intercom/supervisor-ui.js.map +1 -1
- package/node_modules/pi-subagents/src/missions/store.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/missions/store.js +27 -5
- package/node_modules/pi-subagents/src/missions/store.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/active-async-capacity.d.ts +2 -1
- package/node_modules/pi-subagents/src/runs/background/active-async-capacity.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/active-async-capacity.js +10 -6
- package/node_modules/pi-subagents/src/runs/background/active-async-capacity.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/async-execution.d.ts +9 -1
- package/node_modules/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/async-execution.js +253 -144
- package/node_modules/pi-subagents/src/runs/background/async-execution.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/async-job-tracker.d.ts +4 -1
- package/node_modules/pi-subagents/src/runs/background/async-job-tracker.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/async-job-tracker.js +3 -2
- package/node_modules/pi-subagents/src/runs/background/async-job-tracker.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/async-resume.js +9 -3
- package/node_modules/pi-subagents/src/runs/background/async-resume.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/await-async-run.d.ts +8 -4
- package/node_modules/pi-subagents/src/runs/background/await-async-run.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/await-async-run.js +14 -8
- package/node_modules/pi-subagents/src/runs/background/await-async-run.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/binary-bootstrap.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/binary-bootstrap.js +2 -1
- package/node_modules/pi-subagents/src/runs/background/binary-bootstrap.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/chain-root-attachment.d.ts +2 -0
- package/node_modules/pi-subagents/src/runs/background/chain-root-attachment.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/chain-root-attachment.js +9 -6
- package/node_modules/pi-subagents/src/runs/background/chain-root-attachment.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/control-channel.d.ts +1 -0
- package/node_modules/pi-subagents/src/runs/background/control-channel.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/control-channel.js +27 -3
- package/node_modules/pi-subagents/src/runs/background/control-channel.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/fleet-view.js +5 -5
- package/node_modules/pi-subagents/src/runs/background/fleet-view.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/notify.d.ts +12 -2
- package/node_modules/pi-subagents/src/runs/background/notify.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/notify.js +152 -13
- package/node_modules/pi-subagents/src/runs/background/notify.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/result-files.d.ts +29 -0
- package/node_modules/pi-subagents/src/runs/background/result-files.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/result-files.js +104 -6
- package/node_modules/pi-subagents/src/runs/background/result-files.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/result-watcher.js +60 -64
- package/node_modules/pi-subagents/src/runs/background/result-watcher.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/resume-guidance.js +2 -2
- package/node_modules/pi-subagents/src/runs/background/resume-guidance.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/run-child-session.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/run-child-session.js +9 -15
- package/node_modules/pi-subagents/src/runs/background/run-child-session.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/run-id-resolver.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/run-id-resolver.js +9 -6
- package/node_modules/pi-subagents/src/runs/background/run-id-resolver.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/run-status.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/run-status.js +19 -15
- package/node_modules/pi-subagents/src/runs/background/run-status.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/runner-aliases.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/runner-aliases.js +11 -8
- package/node_modules/pi-subagents/src/runs/background/runner-aliases.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/runner-child-launch.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/runner-child-launch.js +1 -0
- package/node_modules/pi-subagents/src/runs/background/runner-child-launch.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/runner-http-dispatcher.d.ts +3 -0
- package/node_modules/pi-subagents/src/runs/background/runner-http-dispatcher.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/runner-http-dispatcher.js +2 -0
- package/node_modules/pi-subagents/src/runs/background/runner-http-dispatcher.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/scheduled-runs.d.ts +9 -0
- package/node_modules/pi-subagents/src/runs/background/scheduled-runs.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/scheduled-runs.js +124 -36
- package/node_modules/pi-subagents/src/runs/background/scheduled-runs.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/subagent-runner-bootstrap.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/subagent-runner-bootstrap.js +5 -1
- package/node_modules/pi-subagents/src/runs/background/subagent-runner-bootstrap.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/subagent-runner.d.ts +3 -1
- package/node_modules/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/subagent-runner.js +211 -283
- package/node_modules/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/subagent-wait.d.ts +2 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/subagent-wait.js +34 -20
- package/node_modules/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/terminal-run-index.d.ts +1 -0
- package/node_modules/pi-subagents/src/runs/background/terminal-run-index.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/terminal-run-index.js +47 -1
- package/node_modules/pi-subagents/src/runs/background/terminal-run-index.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/wait-tool.js +36 -23
- package/node_modules/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/workflow-terminal-proof.d.ts +1 -1
- package/node_modules/pi-subagents/src/runs/background/workflow-terminal-proof.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/background/workflow-terminal-proof.js +12 -3
- package/node_modules/pi-subagents/src/runs/background/workflow-terminal-proof.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/foreground/async-stop-action.d.ts +7 -1
- package/node_modules/pi-subagents/src/runs/foreground/async-stop-action.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/foreground/async-stop-action.js +55 -32
- package/node_modules/pi-subagents/src/runs/foreground/async-stop-action.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/foreground/execution.js +101 -79
- package/node_modules/pi-subagents/src/runs/foreground/execution.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/foreground/subagent-executor.d.ts +5 -1
- package/node_modules/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/foreground/subagent-executor.js +184 -84
- package/node_modules/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/child-hooks.js +6 -5
- package/node_modules/pi-subagents/src/runs/shared/child-hooks.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/child-launch.d.ts +2 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/child-launch.js +1 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/child-session.d.ts +4 -0
- package/node_modules/pi-subagents/src/runs/shared/child-session.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/child-session.js +28 -23
- package/node_modules/pi-subagents/src/runs/shared/child-session.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/child-tool-plan.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/child-tool-plan.js +11 -10
- package/node_modules/pi-subagents/src/runs/shared/child-tool-plan.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/dynamic-fanout.js +1 -1
- package/node_modules/pi-subagents/src/runs/shared/dynamic-fanout.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/effective-system-prompt.d.ts +4 -4
- package/node_modules/pi-subagents/src/runs/shared/effective-system-prompt.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/effective-system-prompt.js +5 -4
- package/node_modules/pi-subagents/src/runs/shared/effective-system-prompt.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/external-cli-runner.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/external-cli-runner.js +3 -2
- package/node_modules/pi-subagents/src/runs/shared/external-cli-runner.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/herdr-placed-run.d.ts +1 -0
- package/node_modules/pi-subagents/src/runs/shared/herdr-placed-run.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/herdr-placed-run.js +10 -6
- package/node_modules/pi-subagents/src/runs/shared/herdr-placed-run.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/model-resolution-diagnostic.d.ts +17 -5
- package/node_modules/pi-subagents/src/runs/shared/model-resolution-diagnostic.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/model-resolution-diagnostic.js +37 -10
- package/node_modules/pi-subagents/src/runs/shared/model-resolution-diagnostic.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/model-resolution.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/model-resolution.js +29 -1
- package/node_modules/pi-subagents/src/runs/shared/model-resolution.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/nested-events.d.ts +2 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-events.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/nested-events.js +4 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-events.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/orca-progress-tabs.js +1 -1
- package/node_modules/pi-subagents/src/runs/shared/orca-progress-tabs.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/parallel-handoff.js +2 -2
- package/node_modules/pi-subagents/src/runs/shared/parallel-handoff.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/parallel-utils.d.ts +2 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/partial-output.d.ts +7 -0
- package/node_modules/pi-subagents/src/runs/shared/partial-output.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/partial-output.js +7 -0
- package/node_modules/pi-subagents/src/runs/shared/partial-output.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/runner-launcher.d.ts +12 -0
- package/node_modules/pi-subagents/src/runs/shared/runner-launcher.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/runner-launcher.js +25 -0
- package/node_modules/pi-subagents/src/runs/shared/runner-launcher.js.map +1 -0
- package/node_modules/pi-subagents/src/runs/shared/single-output.d.ts +31 -1
- package/node_modules/pi-subagents/src/runs/shared/single-output.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/single-output.js +100 -21
- package/node_modules/pi-subagents/src/runs/shared/single-output.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/structured-output.d.ts +2 -0
- package/node_modules/pi-subagents/src/runs/shared/structured-output.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/structured-output.js +26 -8
- package/node_modules/pi-subagents/src/runs/shared/structured-output.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/subagent-control.js +3 -3
- package/node_modules/pi-subagents/src/runs/shared/subagent-control.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts +37 -2
- package/node_modules/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +130 -22
- package/node_modules/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/tool-budget.js +1 -1
- package/node_modules/pi-subagents/src/runs/shared/tool-budget.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/workflow-async-child-guidance.js +1 -1
- package/node_modules/pi-subagents/src/runs/shared/workflow-async-child-guidance.js.map +1 -1
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-plan.js +1 -1
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-plan.js.map +1 -1
- package/node_modules/pi-subagents/src/shared/atomic-json.d.ts +4 -3
- package/node_modules/pi-subagents/src/shared/atomic-json.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/shared/atomic-json.js +3 -1
- package/node_modules/pi-subagents/src/shared/atomic-json.js.map +1 -1
- package/node_modules/pi-subagents/src/shared/child-transcript.js +1 -1
- package/node_modules/pi-subagents/src/shared/child-transcript.js.map +1 -1
- package/node_modules/pi-subagents/src/shared/edit-distance.d.ts +5 -0
- package/node_modules/pi-subagents/src/shared/edit-distance.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/edit-distance.js +33 -0
- package/node_modules/pi-subagents/src/shared/edit-distance.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/extension-context.d.ts +5 -0
- package/node_modules/pi-subagents/src/shared/extension-context.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/shared/extension-context.js +7 -0
- package/node_modules/pi-subagents/src/shared/extension-context.js.map +1 -1
- package/node_modules/pi-subagents/src/shared/formatters.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/shared/formatters.js +1 -6
- package/node_modules/pi-subagents/src/shared/formatters.js.map +1 -1
- package/node_modules/pi-subagents/src/shared/model-info.d.ts +8 -0
- package/node_modules/pi-subagents/src/shared/model-info.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/shared/model-info.js +22 -0
- package/node_modules/pi-subagents/src/shared/model-info.js.map +1 -1
- package/node_modules/pi-subagents/src/shared/package-version.d.ts +3 -0
- package/node_modules/pi-subagents/src/shared/package-version.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/package-version.js +15 -0
- package/node_modules/pi-subagents/src/shared/package-version.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/parent-wake.d.ts +24 -0
- package/node_modules/pi-subagents/src/shared/parent-wake.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/parent-wake.js +71 -0
- package/node_modules/pi-subagents/src/shared/parent-wake.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/pruned-fork.d.ts +1 -1
- package/node_modules/pi-subagents/src/shared/pruned-fork.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/shared/pruned-fork.js +6 -0
- package/node_modules/pi-subagents/src/shared/pruned-fork.js.map +1 -1
- package/node_modules/pi-subagents/src/shared/runtime-module-path.d.ts +11 -0
- package/node_modules/pi-subagents/src/shared/runtime-module-path.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/shared/runtime-module-path.js +17 -0
- package/node_modules/pi-subagents/src/shared/runtime-module-path.js.map +1 -0
- package/node_modules/pi-subagents/src/shared/types.d.ts +33 -10
- package/node_modules/pi-subagents/src/shared/types.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/shared/types.js +7 -4
- package/node_modules/pi-subagents/src/shared/types.js.map +1 -1
- package/node_modules/pi-subagents/src/shared/utils.d.ts +2 -0
- package/node_modules/pi-subagents/src/shared/utils.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/shared/utils.js +10 -7
- package/node_modules/pi-subagents/src/shared/utils.js.map +1 -1
- package/node_modules/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/slash/slash-commands.js +21 -10
- package/node_modules/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/node_modules/pi-subagents/src/slash/subagents-admin.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/slash/subagents-admin.js +3 -1
- package/node_modules/pi-subagents/src/slash/subagents-admin.js.map +1 -1
- package/node_modules/pi-subagents/src/tui/fleet-status.d.ts +5 -0
- package/node_modules/pi-subagents/src/tui/fleet-status.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/tui/fleet-status.js +24 -3
- package/node_modules/pi-subagents/src/tui/fleet-status.js.map +1 -1
- package/node_modules/pi-subagents/src/tui/fleet-transcript.d.ts +2 -0
- package/node_modules/pi-subagents/src/tui/fleet-transcript.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/tui/fleet-transcript.js +7 -2
- package/node_modules/pi-subagents/src/tui/fleet-transcript.js.map +1 -1
- package/node_modules/pi-subagents/src/tui/fleet.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/tui/fleet.js +11 -6
- package/node_modules/pi-subagents/src/tui/fleet.js.map +1 -1
- package/node_modules/pi-subagents/src/tui/render.d.ts +2 -2
- package/node_modules/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/tui/render.js +19 -17
- package/node_modules/pi-subagents/src/tui/render.js.map +1 -1
- package/node_modules/pi-subagents/src/tui/subagent-messages.d.ts +23 -0
- package/node_modules/pi-subagents/src/tui/subagent-messages.d.ts.map +1 -0
- package/node_modules/pi-subagents/src/tui/subagent-messages.js +270 -0
- package/node_modules/pi-subagents/src/tui/subagent-messages.js.map +1 -0
- package/node_modules/pi-subagents/src/watchdog/change-signature.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/watchdog/change-signature.js +1 -3
- package/node_modules/pi-subagents/src/watchdog/change-signature.js.map +1 -1
- package/node_modules/pi-subagents/src/watchdog/register-main.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/watchdog/register-main.js +1 -19
- package/node_modules/pi-subagents/src/watchdog/register-main.js.map +1 -1
- package/node_modules/pi-subagents/src/watchdog/render.d.ts +2 -10
- package/node_modules/pi-subagents/src/watchdog/render.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/watchdog/render.js +1 -19
- package/node_modules/pi-subagents/src/watchdog/render.js.map +1 -1
- package/node_modules/pi-subagents/src/watchdog/tool-actions.js +2 -2
- package/node_modules/pi-subagents/src/watchdog/tool-actions.js.map +1 -1
- package/node_modules/pi-subagents/src/workflows/scripted-workflow.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/workflows/scripted-workflow.js +33 -10
- package/node_modules/pi-subagents/src/workflows/scripted-workflow.js.map +1 -1
- package/node_modules/pi-subagents/src/workflows/workflow-resources.d.ts.map +1 -1
- package/node_modules/pi-subagents/src/workflows/workflow-resources.js +12 -0
- package/node_modules/pi-subagents/src/workflows/workflow-resources.js.map +1 -1
- package/package.json +3 -3
- package/src/artifacts/builder-handoff/assertBuilderHandoff.ts +0 -14
- package/src/artifacts/builder-handoff/schema.ts +0 -26
- package/src/maestro/instructions/getMaestroInstructions.ts +4 -2
- package/src/maestro/status/formatMaestroStatus.ts +0 -3
- package/src/tools/child/record-builder-handoff.ts +2 -10
- package/src/tools/main/resolve-escalations.ts +1 -1
- package/src/tools/main/resolve-findings.ts +1 -1
- package/src/tools/main/run-builder.ts +9 -49
- package/src/workflow/builder/completeBuilderPass.ts +4 -13
- package/src/workflow/builder/utils/getWorkflowEventByBuilderHandoff.ts +24 -0
- package/src/workflow/state/schema.ts +0 -3
- package/src/workflow/transitions.ts +0 -4
- package/src/workflow/verifier/completeVerifierPass.ts +3 -9
- package/src/workflow/{findings → verifier}/resolveFindings.ts +4 -12
- package/src/workflow/verifier/utils/getWorkflowEventByVerifierHandoff.ts +40 -0
- package/DESIGN_DECISIONS.md +0 -21
- package/node_modules/pi-subagents/src/runs/shared/run-history.d.ts +0 -67
- package/node_modules/pi-subagents/src/runs/shared/run-history.d.ts.map +0 -1
- package/node_modules/pi-subagents/src/runs/shared/run-history.js +0 -270
- package/node_modules/pi-subagents/src/runs/shared/run-history.js.map +0 -1
- /package/src/workflow/{escalation → builder}/resolveEscalations.ts +0 -0
|
@@ -15,8 +15,7 @@ import { randomUUID } from "node:crypto";
|
|
|
15
15
|
import * as fs from "node:fs";
|
|
16
16
|
import * as os from "node:os";
|
|
17
17
|
import * as path from "node:path";
|
|
18
|
-
import {
|
|
19
|
-
import { Box, Container, Spacer, Text, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
18
|
+
import { Box, Container, Spacer, Text } from "@earendil-works/pi-tui";
|
|
20
19
|
import { clearAgentDiscoveryCache, discoverAgentSnapshot, discoverAgents, discoverAgentsAll } from "../agents/agents.js";
|
|
21
20
|
import { resolveGlobalNpmRoot } from "../agents/global-npm-root.js";
|
|
22
21
|
import { buildAdvertisedAgentCatalog, buildAdvertisedAgentPrompt } from "../agents/advertised-agent-prompt.js";
|
|
@@ -46,9 +45,10 @@ import { registerSlashCommands } from "../slash/slash-commands.js";
|
|
|
46
45
|
import { registerPromptTemplateDelegationBridge } from "../slash/prompt-template-bridge.js";
|
|
47
46
|
import { registerMainWatchdog } from "../watchdog/register-main.js";
|
|
48
47
|
import { registerSlashSubagentBridge } from "../slash/slash-bridge.js";
|
|
49
|
-
import { createNativeSupervisorChannel } from "../intercom/native-supervisor-channel.js";
|
|
50
|
-
import {
|
|
48
|
+
import { createNativeSupervisorChannel, topLevelSupervisorTool } from "../intercom/native-supervisor-channel.js";
|
|
49
|
+
import { renderSubagentEntry, renderSubagentMessage, SUBAGENT_ENTRY_TYPES, SUBAGENT_MESSAGE_TYPES } from "../tui/subagent-messages.js";
|
|
51
50
|
import { registerHerdrStatusBridge } from "../integrations/herdr-status.js";
|
|
51
|
+
import { registerProgramStatusReporter } from "../integrations/program-status.js";
|
|
52
52
|
import { hasLiveSubagentWork, registerPiWebSessionLiveness } from "../integrations/pi-web-session-liveness.js";
|
|
53
53
|
import { createRetainedNestedRouteTracker } from "../runs/background/retained-nested-route-tracker.js";
|
|
54
54
|
import { listHerdrProjectPaneRoots, restoreHerdrProjectPaneSnapshots } from "../inspectors/herdr/project-panes.js";
|
|
@@ -57,31 +57,34 @@ import { clearSlashSnapshots, getSlashRenderableSnapshot, resolveSlashMessageDet
|
|
|
57
57
|
import { resolveWaitToolConfig } from "../runs/background/subagent-wait.js";
|
|
58
58
|
import { registerWaitTool } from "../runs/background/wait-tool.js";
|
|
59
59
|
import { registerSubagentToolActivation } from "./tool-activation.js";
|
|
60
|
+
import { recordedPromptSection, registerPinnedTool, setDeclarationPinning } from "./declaration-pinning.js";
|
|
61
|
+
import { buildActiveRunsSection } from "./active-runs-prompt.js";
|
|
60
62
|
import { createWaitSubscriptionManager } from "../runs/background/wait-subscriptions.js";
|
|
61
63
|
import { drainOutstandingWork } from "../runs/background/auto-drain.js";
|
|
62
|
-
import registerSubagentNotify
|
|
63
|
-
import {
|
|
64
|
+
import registerSubagentNotify from "../runs/background/notify.js";
|
|
65
|
+
import { createParentWake } from "../shared/parent-wake.js";
|
|
66
|
+
import { handleSubagentSteeringNotice } from "./steering-notices.js";
|
|
64
67
|
import { SUBAGENT_CHILD_ENV, SUBAGENT_PARENT_SESSION_ENV } from "../runs/shared/child-runtime-config.js";
|
|
65
68
|
import { disposeChildSessions } from "../runs/shared/child-session.js";
|
|
66
69
|
import { resolveCurrentSubagentCapabilityCeiling } from "../runs/shared/capability-ceiling.js";
|
|
67
|
-
import { formatDuration, shortenPath } from "../shared/formatters.js";
|
|
68
70
|
import { loadConfig, resolveAsyncByDefault, resolveScheduledStoreRoot } from "./config.js";
|
|
69
71
|
import { buildSubagentToolDescription, buildSubagentToolPromptMetadata } from "./tool-description.js";
|
|
70
72
|
import { formatWorkflowPreflightSummary, normalizeWorkflowPreflight } from "../workflows/workflow-preflight.js";
|
|
71
73
|
import { runtimeReplacedAbortReason } from "../workflows/workflow-reuse.js";
|
|
72
74
|
import { finalizeToolResult } from "./tool-result.js";
|
|
73
|
-
import {
|
|
75
|
+
import { flattenSubagentToolOptions } from "./subagent-options.js";
|
|
74
76
|
import { collectGoalContinuationNotices } from "../missions/goal-driver.js";
|
|
75
77
|
import { restoreForegroundRunHistory } from "../runs/foreground/foreground-history.js";
|
|
76
78
|
import { resolveMissionStoreLocation } from "../missions/store.js";
|
|
77
79
|
import { listRetainedChildren } from "../runs/background/retained-children.js";
|
|
78
80
|
import { DIRS, DEFAULT_ARTIFACT_CONFIG, SLASH_RESULT_TYPE, SLASH_TEXT_RESULT_TYPE, SUBAGENT_ASYNC_COMPLETE_EVENT, SUBAGENT_ASYNC_STARTED_EVENT, SUBAGENT_PROCESS_TERMINAL_EVENT, SUBAGENT_CONTROL_EVENT, SUBAGENT_STEERING_NOTICE_EVENT, WIDGET_KEY, resolveMaxSubagentSpawnsPerSession, } from "../shared/types.js";
|
|
79
|
-
import {
|
|
81
|
+
import { handleSubagentControlNotice, } from "./control-notices.js";
|
|
80
82
|
import { showUpgradeNotice } from "./upgrade-notice.js";
|
|
81
|
-
export { loadConfig, resolveAsyncByDefault } from "./config.js";
|
|
82
83
|
const SLOW_RELOAD_PHASE_MS = 250;
|
|
83
84
|
// Long enough for Pi to finish starting; loading the executor blocks the event loop for tens of ms.
|
|
84
85
|
const MODULE_PRELOAD_DELAY_MS = 1_000;
|
|
86
|
+
const COMPACTION_RESUME_POLL_MS = 50;
|
|
87
|
+
const COMPACTION_RESUME_DEADLINE_MS = 10_000;
|
|
85
88
|
const RUNTIME_REGISTRY_STORE_KEY = "__piSubagentRuntimeRegistry";
|
|
86
89
|
function getRuntimeRegistry() {
|
|
87
90
|
const globalStore = globalThis;
|
|
@@ -165,33 +168,6 @@ function createSlashResultComponent(details, options, theme, rendererConfig, for
|
|
|
165
168
|
};
|
|
166
169
|
return container;
|
|
167
170
|
}
|
|
168
|
-
class SubagentControlNoticeComponent {
|
|
169
|
-
details;
|
|
170
|
-
theme;
|
|
171
|
-
constructor(details, theme) {
|
|
172
|
-
this.details = details;
|
|
173
|
-
this.theme = theme;
|
|
174
|
-
}
|
|
175
|
-
invalidate() { }
|
|
176
|
-
render(width) {
|
|
177
|
-
const eventLabel = this.details.event.type.replaceAll("_", " ");
|
|
178
|
-
if (width < 3)
|
|
179
|
-
return [truncateToWidth(`Subagent ${eventLabel}`, width)];
|
|
180
|
-
const bodyWidth = Math.max(1, width - 2);
|
|
181
|
-
const borderChar = "─";
|
|
182
|
-
const header = ` ⚠ Subagent ${eventLabel}: ${this.details.event.agent} `;
|
|
183
|
-
const headerText = truncateToWidth(header, bodyWidth, "");
|
|
184
|
-
const headerPadding = Math.max(0, bodyWidth - visibleWidth(headerText));
|
|
185
|
-
const lines = [this.theme.fg("accent", `╭${headerText}${borderChar.repeat(headerPadding)}╮`)];
|
|
186
|
-
for (const line of wrapTextWithAnsi(formatSubagentControlNotice(this.details), bodyWidth)) {
|
|
187
|
-
const text = truncateToWidth(line, bodyWidth, "");
|
|
188
|
-
const padding = Math.max(0, bodyWidth - visibleWidth(text));
|
|
189
|
-
lines.push(this.theme.fg("accent", `│${text}${" ".repeat(padding)}│`));
|
|
190
|
-
}
|
|
191
|
-
lines.push(this.theme.fg("accent", `╰${borderChar.repeat(bodyWidth)}╯`));
|
|
192
|
-
return lines;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
171
|
export function projectActiveHerdrRuns(state) {
|
|
196
172
|
const active = (status) => status === "queued" || status === "running";
|
|
197
173
|
const foregroundChildrenByWorkflow = new Map();
|
|
@@ -249,12 +225,14 @@ export default function registerSubagentExtension(pi) {
|
|
|
249
225
|
DIRS.async = ensureAccessibleDir(DIRS.async);
|
|
250
226
|
cleanupOldChainDirs();
|
|
251
227
|
const config = loadConfig();
|
|
228
|
+
setDeclarationPinning(pi, config.pinToolDeclarations !== false);
|
|
252
229
|
const waitToolConfig = resolveWaitToolConfig(config.waitTool);
|
|
253
230
|
const asyncByDefault = resolveAsyncByDefault(config);
|
|
254
231
|
const fleetViewEnabled = config.fleetView !== false;
|
|
255
232
|
const fleetViewPlacement = resolveFleetViewPlacement(config.fleetViewPlacement);
|
|
256
233
|
const asyncWidgetEnabled = config.asyncWidget !== false;
|
|
257
234
|
const asyncWidgetCollapsed = config.asyncWidgetCollapsed === true;
|
|
235
|
+
const asyncWidgetLayout = config.asyncWidgetLayout ?? "adaptive";
|
|
258
236
|
const summaryInlineToolDisplay = config.inlineToolDisplay === "summary";
|
|
259
237
|
const tempArtifactsDir = getArtifactsDir(null);
|
|
260
238
|
const artifactCleanupDays = config.artifactConfig?.cleanupDays ?? DEFAULT_ARTIFACT_CONFIG.cleanupDays;
|
|
@@ -304,14 +282,18 @@ export default function registerSubagentExtension(pi) {
|
|
|
304
282
|
state.lastUiContext = null;
|
|
305
283
|
}, run);
|
|
306
284
|
};
|
|
285
|
+
// Every notice that wakes the parent goes through parentWake; the watchdog wakes only inside a run.
|
|
286
|
+
const parentWake = createParentWake(pi);
|
|
287
|
+
const wakingPi = { events: pi.events, sendMessage: parentWake.sendMessage, isHeld: parentWake.isHeld, on: pi.on };
|
|
307
288
|
const supervisorChannel = createNativeSupervisorChannel(pi, state, {
|
|
308
289
|
// Owner states are created only by scheduled execution, which loads the executor first.
|
|
309
290
|
getCurrentOwnerStates: () => executor?.getCurrentSupervisorOwnerStates() ?? [],
|
|
291
|
+
parentWake,
|
|
310
292
|
});
|
|
311
|
-
const waitSubscriptionManager = createWaitSubscriptionManager(
|
|
293
|
+
const waitSubscriptionManager = createWaitSubscriptionManager(wakingPi, state);
|
|
312
294
|
const mainWatchdog = registerMainWatchdog(pi);
|
|
313
295
|
const resultDeliveryOwnership = createResultDeliveryOwnership(state);
|
|
314
|
-
const completionNotifier = registerSubagentNotify(
|
|
296
|
+
const completionNotifier = registerSubagentNotify(wakingPi, state, { batchConfig: config.completionBatch, ownership: resultDeliveryOwnership });
|
|
315
297
|
// Ended async runs whose result has not reached the notifier yet.
|
|
316
298
|
const owedResultRunIds = new Set();
|
|
317
299
|
// Tracked runs whose result was already delivered, so a later terminal
|
|
@@ -376,7 +358,7 @@ export default function registerSubagentExtension(pi) {
|
|
|
376
358
|
if (!advertisedContext)
|
|
377
359
|
return;
|
|
378
360
|
clearAgentDiscoveryCache();
|
|
379
|
-
advertisedAgents = discoverAgents(advertisedContext.cwd, "both", advertisedContext.model?.provider, { globalNpmRoot: globalRoot }).agents
|
|
361
|
+
advertisedAgents = discoverAgents(advertisedContext.cwd, "both", advertisedContext.model?.provider, { globalNpmRoot: globalRoot, projectTrusted: advertisedContext.projectTrusted }).agents
|
|
380
362
|
.filter((agent) => agent.advertise === true);
|
|
381
363
|
};
|
|
382
364
|
const beginAdvertisement = (ctx) => {
|
|
@@ -384,7 +366,7 @@ export default function registerSubagentExtension(pi) {
|
|
|
384
366
|
notifySessionChange();
|
|
385
367
|
sessionChanged = new Promise((resolve) => { notifySessionChange = resolve; });
|
|
386
368
|
advertisedAgents = [];
|
|
387
|
-
advertisedContext = { cwd: ctx.cwd, model: ctx.model };
|
|
369
|
+
advertisedContext = { cwd: ctx.cwd, model: ctx.model, projectTrusted: typeof ctx.isProjectTrusted === "function" ? ctx.isProjectTrusted() : undefined };
|
|
388
370
|
globalRoot = null;
|
|
389
371
|
advertisementReady = resolveGlobalNpmRoot().then((root) => {
|
|
390
372
|
if (generation !== advertisementGeneration)
|
|
@@ -399,10 +381,11 @@ export default function registerSubagentExtension(pi) {
|
|
|
399
381
|
return { error };
|
|
400
382
|
});
|
|
401
383
|
};
|
|
384
|
+
const activeAsyncJobCount = () => [...state.asyncJobs.values()].filter((job) => job.status === "queued" || job.status === "running").length;
|
|
402
385
|
const hasResultDeliveryDemand = () => {
|
|
403
386
|
if (owedResultRunIds.size > 0)
|
|
404
387
|
return true;
|
|
405
|
-
if (
|
|
388
|
+
if (activeAsyncJobCount() > 0)
|
|
406
389
|
return true;
|
|
407
390
|
if (state.foregroundControls.size > 0)
|
|
408
391
|
return true;
|
|
@@ -410,10 +393,10 @@ export default function registerSubagentExtension(pi) {
|
|
|
410
393
|
return true;
|
|
411
394
|
return missionObserverResultCandidateFiles(DIRS.results).length > 0;
|
|
412
395
|
};
|
|
413
|
-
const discoverAgentsForRuntime = (cwd, scope, preferredModelProvider) => {
|
|
396
|
+
const discoverAgentsForRuntime = (cwd, scope, preferredModelProvider, options = {}) => {
|
|
414
397
|
if (listRuntimeAgentConfigs(pi).length === 0)
|
|
415
|
-
return discoverAgents(cwd, scope, preferredModelProvider, { globalNpmRoot: globalRoot });
|
|
416
|
-
const snapshot = discoverAgentSnapshot(cwd, scope, preferredModelProvider, { includeChains: false, globalNpmRoot: globalRoot });
|
|
398
|
+
return discoverAgents(cwd, scope, preferredModelProvider, { globalNpmRoot: globalRoot, projectTrusted: options.projectTrusted });
|
|
399
|
+
const snapshot = discoverAgentSnapshot(cwd, scope, preferredModelProvider, { includeChains: false, globalNpmRoot: globalRoot, projectTrusted: options.projectTrusted });
|
|
417
400
|
const discovered = snapshot.effective;
|
|
418
401
|
const all = snapshot.all;
|
|
419
402
|
const configuredAgents = [
|
|
@@ -422,7 +405,8 @@ export default function registerSubagentExtension(pi) {
|
|
|
422
405
|
...all.user,
|
|
423
406
|
...all.project,
|
|
424
407
|
];
|
|
425
|
-
|
|
408
|
+
// Runtime agents take model settings from the scope discovery actually used.
|
|
409
|
+
const merged = mergeRuntimeAgents(pi, discovered, configuredAgents, { cwd, scope: discovered.scope, preferredModelProvider, projectTrusted: options.projectTrusted });
|
|
426
410
|
if (discovered.maxThinking === undefined)
|
|
427
411
|
return merged;
|
|
428
412
|
return {
|
|
@@ -430,15 +414,23 @@ export default function registerSubagentExtension(pi) {
|
|
|
430
414
|
agents: merged.agents.map((agent) => agent.maxThinking === discovered.maxThinking ? agent : { ...agent, maxThinking: discovered.maxThinking }),
|
|
431
415
|
};
|
|
432
416
|
};
|
|
417
|
+
const programStatus = registerProgramStatusReporter({
|
|
418
|
+
enabled: config.programStatus !== false,
|
|
419
|
+
// Fleet history keeps recent finished runs after the widget drops them.
|
|
420
|
+
getJobs: () => new Map([...(state.fleetJobs ?? []), ...state.asyncJobs]).values(),
|
|
421
|
+
getPendingRequests: () => supervisorChannel.pending.values(),
|
|
422
|
+
});
|
|
433
423
|
const { ensurePoller, refreshWidget, handleStarted, handleComplete, resetJobs, restoreActiveJobs, dispose: disposeAsyncJobTracker } = createAsyncJobTracker(pi, state, DIRS.async, {
|
|
434
424
|
widgetEnabled: asyncWidgetEnabled,
|
|
435
425
|
widgetCollapsed: asyncWidgetCollapsed,
|
|
426
|
+
widgetLayout: asyncWidgetLayout,
|
|
436
427
|
onJobTerminal: (job) => {
|
|
437
428
|
holdOwedResult(job);
|
|
438
429
|
refreshResultDelivery();
|
|
439
430
|
},
|
|
440
431
|
onJobCleanup: (asyncId) => deliveredRunIds.delete(asyncId),
|
|
441
432
|
supervisorRequestState: supervisorChannel.getSupervisorRequestState,
|
|
433
|
+
onJobsChanged: programStatus.sync,
|
|
442
434
|
});
|
|
443
435
|
const resultWatcher = createResultWatcher(pi, state, DIRS.results, 10 * 60 * 1000, {
|
|
444
436
|
notifier: completionNotifier,
|
|
@@ -494,6 +486,7 @@ export default function registerSubagentExtension(pi) {
|
|
|
494
486
|
};
|
|
495
487
|
const executorDeps = {
|
|
496
488
|
pi,
|
|
489
|
+
parentWake,
|
|
497
490
|
state,
|
|
498
491
|
config,
|
|
499
492
|
asyncByDefault,
|
|
@@ -547,10 +540,12 @@ export default function registerSubagentExtension(pi) {
|
|
|
547
540
|
}, MODULE_PRELOAD_DELAY_MS);
|
|
548
541
|
modulePreloadTimer.unref?.();
|
|
549
542
|
};
|
|
550
|
-
|
|
543
|
+
for (const customType of SUBAGENT_MESSAGE_TYPES)
|
|
544
|
+
pi.registerMessageRenderer(customType, renderSubagentMessage);
|
|
551
545
|
const registerEntryRenderer = pi.registerEntryRenderer;
|
|
552
546
|
if (typeof registerEntryRenderer === "function") {
|
|
553
|
-
|
|
547
|
+
for (const customType of SUBAGENT_ENTRY_TYPES)
|
|
548
|
+
registerEntryRenderer.call(pi, customType, renderSubagentEntry);
|
|
554
549
|
}
|
|
555
550
|
pi.registerMessageRenderer(SLASH_RESULT_TYPE, (message, options, theme) => {
|
|
556
551
|
const details = resolveSlashMessageDetails(message.details);
|
|
@@ -567,62 +562,6 @@ export default function registerSubagentExtension(pi) {
|
|
|
567
562
|
.join("\n");
|
|
568
563
|
return new Text(content, 0, 0);
|
|
569
564
|
});
|
|
570
|
-
pi.registerMessageRenderer("subagent-notify", (message, options, theme) => {
|
|
571
|
-
const content = typeof message.content === "string" ? message.content : "";
|
|
572
|
-
const details = message.details ?? parseSubagentNotifyContent(content);
|
|
573
|
-
if (!details)
|
|
574
|
-
return new Text(content, 0, 0);
|
|
575
|
-
const icon = details.status === "completed"
|
|
576
|
-
? theme.fg("success", "✓")
|
|
577
|
-
: details.status === "paused"
|
|
578
|
-
? theme.fg("warning", "■")
|
|
579
|
-
: theme.fg("error", "✗");
|
|
580
|
-
const parts = [];
|
|
581
|
-
if (details.taskInfo)
|
|
582
|
-
parts.push(details.taskInfo);
|
|
583
|
-
if (details.durationMs !== undefined)
|
|
584
|
-
parts.push(formatDuration(details.durationMs));
|
|
585
|
-
let text = `${icon} ${theme.bold(details.agent)} ${theme.fg("dim", details.status)}`;
|
|
586
|
-
if (parts.length > 0)
|
|
587
|
-
text += ` ${theme.fg("dim", "·")} ${parts.map((part) => theme.fg("dim", part)).join(` ${theme.fg("dim", "·")} `)}`;
|
|
588
|
-
const trimmedPreview = details.resultPreview.trim();
|
|
589
|
-
const previewLines = options.expanded
|
|
590
|
-
? trimmedPreview.split("\n").filter((line) => line.trim())
|
|
591
|
-
: [trimmedPreview.split("\n", 1)[0] ?? ""].filter((line) => line.trim());
|
|
592
|
-
for (const line of previewLines.length > 0 ? previewLines : ["(no output)"]) {
|
|
593
|
-
text += `\n ${theme.fg("dim", `⎿ ${line}`)}`;
|
|
594
|
-
}
|
|
595
|
-
if (!options.expanded && trimmedPreview.includes("\n")) {
|
|
596
|
-
const expandKey = keyText("app.tools.expand");
|
|
597
|
-
text += `\n ${theme.fg("dim", `${expandKey} full notification`)}`;
|
|
598
|
-
}
|
|
599
|
-
if (details.workflowRunId) {
|
|
600
|
-
text += `\n ${theme.fg("muted", `workflow: ${details.workflowRunId}`)}`;
|
|
601
|
-
}
|
|
602
|
-
if (details.childRuns?.length) {
|
|
603
|
-
text += `\n ${theme.fg("muted", `children: ${details.childRuns.map((child) => `${child.workflowKey ?? child.agent ?? "child"}=${child.runId}`).join(", ")}`)}`;
|
|
604
|
-
}
|
|
605
|
-
if (details.reconciledFromDetachedChild) {
|
|
606
|
-
text += `\n ${theme.fg("muted", `reconciled child: ${details.reconciledFromDetachedChild}`)}`;
|
|
607
|
-
}
|
|
608
|
-
if (details.sessionLabel && details.sessionValue) {
|
|
609
|
-
text += `\n ${theme.fg("muted", `${details.sessionLabel}: ${shortenPath(details.sessionValue)}`)}`;
|
|
610
|
-
}
|
|
611
|
-
return new Text(text, 0, 0);
|
|
612
|
-
});
|
|
613
|
-
pi.registerMessageRenderer(SUBAGENT_STEERING_MESSAGE_TYPE, (message, _options, theme) => {
|
|
614
|
-
const details = message.details;
|
|
615
|
-
if (!details)
|
|
616
|
-
return undefined;
|
|
617
|
-
return new Text(theme.fg(details.state === "recovered" ? "warning" : "error", formatSteeringNotice(details)), 0, 0);
|
|
618
|
-
});
|
|
619
|
-
pi.registerMessageRenderer(SUBAGENT_CONTROL_MESSAGE_TYPE, (message, _options, theme) => {
|
|
620
|
-
const details = message.details;
|
|
621
|
-
if (!details?.event)
|
|
622
|
-
return undefined;
|
|
623
|
-
const content = typeof message.content === "string" ? message.content : undefined;
|
|
624
|
-
return new SubagentControlNoticeComponent({ ...details, noticeText: formatSubagentControlNotice(details, content) }, theme);
|
|
625
|
-
});
|
|
626
565
|
const executeSubagentReady = async (id, params, signal, onUpdate, ctx) => {
|
|
627
566
|
await waitForAdvertisement();
|
|
628
567
|
return (await getExecutor()).executePublic(id, params, signal, onUpdate, ctx);
|
|
@@ -665,10 +604,7 @@ export default function registerSubagentExtension(pi) {
|
|
|
665
604
|
...buildSubagentToolPromptMetadata(config, disabledFeatures),
|
|
666
605
|
parameters,
|
|
667
606
|
async execute(id, params, signal, onUpdate, ctx) {
|
|
668
|
-
|
|
669
|
-
if (removedField)
|
|
670
|
-
throw new Error(removedField);
|
|
671
|
-
return finalizeToolResult(await executeSubagentCollapsed(id, params, signal ?? new AbortController().signal, onUpdate, ctx));
|
|
607
|
+
return finalizeToolResult(await executeSubagentCollapsed(id, flattenSubagentToolOptions(params, disabledFeatures), signal ?? new AbortController().signal, onUpdate, ctx));
|
|
672
608
|
},
|
|
673
609
|
renderCall(args, theme) {
|
|
674
610
|
const gap = " ".repeat(config.mainWindowRenderer?.horizontalSpacing ?? 1);
|
|
@@ -677,8 +613,9 @@ export default function registerSubagentExtension(pi) {
|
|
|
677
613
|
const target = args.agent || "";
|
|
678
614
|
return new Text(`${title}${gap}${args.action}${target ? `${gap}${theme.fg("accent", target)}` : ""}`, 0, 0);
|
|
679
615
|
}
|
|
616
|
+
const preflight = args.options?.preflight ?? args.preflight;
|
|
680
617
|
if (args.workflow !== undefined)
|
|
681
|
-
return new Text(`${title}${gap}${theme.fg("accent", args.workflow === true || args.workflow === "true" ? "workflow (reply block)" : `workflow ${String(args.workflow)}`)}${args.async === true ? `${gap}${theme.fg("warning", "[async]")}` : ""}${
|
|
618
|
+
return new Text(`${title}${gap}${theme.fg("accent", args.workflow === true || args.workflow === "true" ? "workflow (reply block)" : `workflow ${String(args.workflow)}`)}${args.async === true ? `${gap}${theme.fg("warning", "[async]")}` : ""}${preflight !== undefined ? `${gap}${theme.fg("dim", formatWorkflowPreflightCall(preflight))}` : ""}`, 0, 0);
|
|
682
619
|
const asyncLabel = args.async === true ? `${gap}${theme.fg("warning", "[async]")}` : "";
|
|
683
620
|
return new Text(`${title}${gap}${theme.fg("accent", args.agent || "?")}${asyncLabel}`, 0, 0);
|
|
684
621
|
},
|
|
@@ -690,22 +627,36 @@ export default function registerSubagentExtension(pi) {
|
|
|
690
627
|
: renderSubagentResult(renderedResult, options, theme, undefined, config.mainWindowRenderer, config.foregroundDetachShortcut);
|
|
691
628
|
},
|
|
692
629
|
};
|
|
693
|
-
pi
|
|
630
|
+
registerPinnedTool(pi, tool);
|
|
631
|
+
// Declared with the same definition children use, so a fork's tool list equals this session's.
|
|
632
|
+
registerPinnedTool(pi, topLevelSupervisorTool());
|
|
694
633
|
pi.on("before_agent_start", async (event, ctx) => {
|
|
695
634
|
await waitForAdvertisement();
|
|
696
|
-
if (!event.systemPromptOptions.selectedTools.includes("subagent"))
|
|
697
|
-
return;
|
|
698
635
|
const sessionId = state.currentSessionId ?? resolveCurrentSessionId(ctx.sessionManager);
|
|
699
636
|
// Structured sections let Pi append a transcript delta instead of replacing the
|
|
700
637
|
// cached system prompt. Set the section on every turn it applies: Pi rebuilds the
|
|
701
638
|
// options each turn, and an unset turn records a removal.
|
|
702
|
-
|
|
639
|
+
// Active runs are listed even when only subagents_enable is selected, e.g. runs re-adopted after a resume.
|
|
640
|
+
const activeRuns = config.activeRunsPrompt === true ? buildActiveRunsSection(state.asyncJobs.values(), sessionId) : undefined;
|
|
641
|
+
if (activeRuns)
|
|
642
|
+
event.systemPromptOptions.sections.active_subagents = activeRuns;
|
|
643
|
+
if (!event.systemPromptOptions.selectedTools.includes("subagent"))
|
|
644
|
+
return;
|
|
645
|
+
const catalog = buildAdvertisedAgentCatalog(advertisedAgents, resolveCurrentSubagentCapabilityCeiling(sessionId), recordedPromptSection(pi, "advertised_subagents"));
|
|
703
646
|
if (catalog)
|
|
704
647
|
event.systemPromptOptions.sections.advertised_subagents = catalog;
|
|
705
648
|
});
|
|
706
649
|
registerWaitTool(pi, state, waitToolConfig.enabled, waitSubscriptionManager, waitToolConfig.defaultTimeoutMs, undefined, supervisorChannel.hasPendingRequests);
|
|
707
650
|
pi.on("agent_end", async (_event, ctx) => {
|
|
708
651
|
try {
|
|
652
|
+
// The run is still active here, so its signal tells a user stop (Esc) apart from a finished or failed run.
|
|
653
|
+
// Pi skips agent_before_settle after an abort. Background runs keep going, but they must not restart the parent.
|
|
654
|
+
if (ctx.hasUI && ctx.signal?.aborted) {
|
|
655
|
+
parentWake.userAborted();
|
|
656
|
+
const active = activeAsyncJobCount();
|
|
657
|
+
if (active > 0)
|
|
658
|
+
ctx.ui.notify(`${active} background subagent run${active === 1 ? " is" : "s are"} still active · /subagents-stop`, "info");
|
|
659
|
+
}
|
|
709
660
|
// A headless host may dispose the session as soon as this turn settles, so hand
|
|
710
661
|
// finished results to Pi now; Pi runs the queued completion turn after agent_end.
|
|
711
662
|
// A failed drain rejects without this step so its deadline stays exact.
|
|
@@ -722,7 +673,7 @@ export default function registerSubagentExtension(pi) {
|
|
|
722
673
|
const retainedChildren = listRetainedChildren(DIRS.async, ownerSessionId);
|
|
723
674
|
for (const notice of collectGoalContinuationNotices({ location, ownerSessionId, retainedChildren, turnId: goalTurnId })) {
|
|
724
675
|
handleSubagentControlNotice({
|
|
725
|
-
pi,
|
|
676
|
+
pi: parentWake,
|
|
726
677
|
state,
|
|
727
678
|
visibleControlNotices: new Set(),
|
|
728
679
|
details: { source: "goal", event: notice.event, noticeText: notice.message },
|
|
@@ -752,14 +703,14 @@ export default function registerSubagentExtension(pi) {
|
|
|
752
703
|
});
|
|
753
704
|
const controlEventHandler = (payload) => {
|
|
754
705
|
handleSubagentControlNotice({
|
|
755
|
-
pi,
|
|
706
|
+
pi: parentWake,
|
|
756
707
|
state,
|
|
757
708
|
visibleControlNotices,
|
|
758
709
|
details: payload,
|
|
759
710
|
});
|
|
760
711
|
};
|
|
761
712
|
const steeringNoticeHandler = (payload) => {
|
|
762
|
-
handleSubagentSteeringNotice({ pi, state, details: payload });
|
|
713
|
+
handleSubagentSteeringNotice({ pi: parentWake, state, details: payload });
|
|
763
714
|
};
|
|
764
715
|
const asyncStartedHandler = (payload) => {
|
|
765
716
|
handleStarted(payload);
|
|
@@ -916,12 +867,23 @@ export default function registerSubagentExtension(pi) {
|
|
|
916
867
|
const runtimeEntry = {
|
|
917
868
|
sessionManager: null,
|
|
918
869
|
visibleControlNotices,
|
|
919
|
-
cleanup() {
|
|
870
|
+
cleanup(shutdownReason) {
|
|
920
871
|
if (runtimeCleaned)
|
|
921
872
|
return;
|
|
922
873
|
runtimeCleaned = true;
|
|
874
|
+
programStatus.dispose(shutdownReason);
|
|
923
875
|
releaseHostSessionLiveness();
|
|
924
876
|
releaseHostSessionLiveness = () => { };
|
|
877
|
+
// Detached foreground children run in this runtime's memory, and the next runtime
|
|
878
|
+
// cannot see or control them, so stop each one and record it as stopped.
|
|
879
|
+
for (const control of state.foregroundControls.values()) {
|
|
880
|
+
try {
|
|
881
|
+
control.stopForRuntimeReplacement?.();
|
|
882
|
+
}
|
|
883
|
+
catch (error) {
|
|
884
|
+
console.error(`Failed to stop detached foreground run ${control.runId}:`, error);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
925
887
|
// Workflow continuations retain their launch context; abort them before
|
|
926
888
|
// teardown so a reload cannot launch through a stale context.
|
|
927
889
|
for (const controller of state.workflowControllers?.values() ?? []) {
|
|
@@ -1022,31 +984,59 @@ export default function registerSubagentExtension(pi) {
|
|
|
1022
984
|
}
|
|
1023
985
|
}
|
|
1024
986
|
};
|
|
987
|
+
let compactionResumeTimer;
|
|
988
|
+
const cancelCompactionResume = () => { clearTimeout(compactionResumeTimer); compactionResumeTimer = undefined; };
|
|
1025
989
|
pi.on("agent_start", () => {
|
|
990
|
+
cancelCompactionResume();
|
|
991
|
+
parentWake.agentStarted();
|
|
1026
992
|
resumeWidgetsAfterCompaction();
|
|
1027
993
|
herdrStatusBridge.agentStarted();
|
|
994
|
+
programStatus.agentStarted();
|
|
1028
995
|
});
|
|
1029
996
|
pi.on("message_start", (event) => completionNotifier.messageStarted(event.message));
|
|
1030
997
|
pi.on("agent_settled", () => {
|
|
1031
998
|
resumeWidgetsAfterCompaction();
|
|
999
|
+
programStatus.agentSettled();
|
|
1032
1000
|
});
|
|
1033
1001
|
pi.on("session_before_compact", (event) => {
|
|
1034
1002
|
if (event.reason !== "manual")
|
|
1035
1003
|
suspendWidgetsForCompaction();
|
|
1036
1004
|
});
|
|
1005
|
+
// Pi emits session_compact before it clears its compaction state, and a parent that is still
|
|
1006
|
+
// compacting can only be woken without before_agent_start (earendil-works/pi#5581). Wait for the
|
|
1007
|
+
// parent to go idle so the resume takes parentWake's prompt() path. A run that starts first cancels the pending resume.
|
|
1037
1008
|
pi.on("session_compact", (event) => {
|
|
1038
1009
|
if (event.reason !== "manual")
|
|
1039
1010
|
return;
|
|
1040
|
-
|
|
1041
|
-
if (!hasActiveAsyncWork || !withLastUiContext(() => true))
|
|
1011
|
+
if (activeAsyncJobCount() === 0 || !withLastUiContext(() => true))
|
|
1042
1012
|
return;
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1013
|
+
cancelCompactionResume();
|
|
1014
|
+
const sessionId = state.currentSessionId;
|
|
1015
|
+
const deadline = Date.now() + COMPACTION_RESUME_DEADLINE_MS;
|
|
1016
|
+
const resumeWhenIdle = () => {
|
|
1017
|
+
if (state.currentSessionId !== sessionId || activeAsyncJobCount() === 0)
|
|
1018
|
+
return;
|
|
1019
|
+
const idle = withLastUiContext((ctx) => ctx.isIdle());
|
|
1020
|
+
if (idle === undefined)
|
|
1021
|
+
return;
|
|
1022
|
+
if (!idle) {
|
|
1023
|
+
if (Date.now() < deadline)
|
|
1024
|
+
compactionResumeTimer = setTimeout(resumeWhenIdle, COMPACTION_RESUME_POLL_MS);
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
// Pi's compact() aborts a live run first, which set the user-abort hold; this resume is deliberate.
|
|
1028
|
+
parentWake.releaseHold();
|
|
1029
|
+
parentWake.sendMessage({
|
|
1030
|
+
customType: "subagent-compaction-resume",
|
|
1031
|
+
content: "Compaction is complete. Resume the parent task now; background subagent results will arrive separately when ready.",
|
|
1032
|
+
display: false,
|
|
1033
|
+
}, { triggerTurn: true });
|
|
1034
|
+
};
|
|
1035
|
+
compactionResumeTimer = setTimeout(resumeWhenIdle, COMPACTION_RESUME_POLL_MS);
|
|
1048
1036
|
});
|
|
1049
1037
|
pi.on("session_start", (event, ctx) => {
|
|
1038
|
+
parentWake.bindSession(ctx);
|
|
1039
|
+
completionNotifier.bindSession(ctx.sessionManager);
|
|
1050
1040
|
installRuntime(ctx);
|
|
1051
1041
|
startSessionMaintenance();
|
|
1052
1042
|
scheduleModulePreload();
|
|
@@ -1059,7 +1049,7 @@ export default function registerSubagentExtension(pi) {
|
|
|
1059
1049
|
? registerPiWebSessionLiveness({
|
|
1060
1050
|
sessionId,
|
|
1061
1051
|
...(sessionFile ? { sessionFile } : {}),
|
|
1062
|
-
isActive: () => owedResultRunIds.size > 0 || hasLiveSubagentWork(state) || completionNotifier.hasPendingDelivery(),
|
|
1052
|
+
isActive: () => owedResultRunIds.size > 0 || hasLiveSubagentWork(state) || completionNotifier.hasPendingDelivery() || parentWake.isPending(),
|
|
1063
1053
|
})
|
|
1064
1054
|
: { registered: false, release: () => { } };
|
|
1065
1055
|
releaseHostSessionLiveness = liveness.release;
|
|
@@ -1071,12 +1061,16 @@ export default function registerSubagentExtension(pi) {
|
|
|
1071
1061
|
hasUI: ctx.hasUI === true,
|
|
1072
1062
|
runs: activeHerdrRuns(),
|
|
1073
1063
|
});
|
|
1064
|
+
programStatus.sessionStarted({ hasUI: ctx.hasUI === true, mode: ctx.mode });
|
|
1074
1065
|
rpcBridge.emitReady(ctx);
|
|
1075
1066
|
supervisorChannel.start();
|
|
1076
1067
|
supervisorChannel.activateTransport();
|
|
1077
1068
|
});
|
|
1078
|
-
pi.on("session_shutdown", async () => {
|
|
1079
|
-
|
|
1069
|
+
pi.on("session_shutdown", async (event) => {
|
|
1070
|
+
cancelCompactionResume();
|
|
1071
|
+
completionNotifier.sessionShutdown(event?.reason);
|
|
1072
|
+
parentWake.sessionShutdown(event?.reason);
|
|
1073
|
+
runtimeEntry.cleanup(event?.reason);
|
|
1080
1074
|
try {
|
|
1081
1075
|
await disposeChildSessions();
|
|
1082
1076
|
}
|