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
|
@@ -0,0 +1,1528 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { defaultInheritProjectContext, defaultInheritSkills, defaultSystemPromptMode, discoverAgentsAll, buildRuntimeName, findBlockingAgentDiagnostic, frontmatterNameForConfig, parsePackageName, mergeBuiltinAgentOverride, removeBuiltinAgentOverride, removeBuiltinAgentOverrideFields, resolveAgentName, } from "./agents.js";
|
|
4
|
+
import { serializeAgent } from "./agent-serializer.js";
|
|
5
|
+
import { mergeAgentsForScope } from "./agent-selection.js";
|
|
6
|
+
import { discoverAvailableSkills, resolveSkills } from "./skills.js";
|
|
7
|
+
import { buildProactiveSkillSubagentRecommendationLines, } from "./proactive-skills.js";
|
|
8
|
+
import { parseFrontmatter, parseFrontmatterList } from "./frontmatter.js";
|
|
9
|
+
import { resolveEffectiveThinking, toModelInfo } from "../shared/model-info.js";
|
|
10
|
+
import { resolveSubagentModelOverride } from "../runs/shared/model-resolution.js";
|
|
11
|
+
import { validateToolBudgetConfig } from "../runs/shared/tool-budget.js";
|
|
12
|
+
import { formatReviewGateLabel, validateAcceptanceInput } from "../runs/shared/acceptance.js";
|
|
13
|
+
import { CODE_OWNED_EXTERNAL_CLI_ADAPTER_LABEL, isCodeOwnedExternalCliAdapterId, resolveExternalCliRunnerStatus, validateCodeOwnedProfileRunner } from "../runs/shared/external-cli-contract.js";
|
|
14
|
+
import { resolveExternalCliBinaryAvailability } from "../runs/shared/external-cli-preflight.js";
|
|
15
|
+
import { getProjectConfigDir } from "../shared/utils.js";
|
|
16
|
+
import { previewDisplayText } from "../shared/display-text.js";
|
|
17
|
+
import { capabilityCeilingAgentRestrictionSources, isAgentAllowedByCapabilityCeiling, resolveCurrentSubagentCapabilityCeiling } from "../runs/shared/capability-ceiling.js";
|
|
18
|
+
import { mergeRuntimeAgents } from "./runtime-agent-registry.js";
|
|
19
|
+
import { listExternalJobProviders } from "../api/external-job-provider.js";
|
|
20
|
+
function result(text, isError = false, details) {
|
|
21
|
+
return { content: [{ type: "text", text }], isError, details: { mode: "management", results: [], ...details } };
|
|
22
|
+
}
|
|
23
|
+
function jsonDetails(value) {
|
|
24
|
+
return JSON.parse(JSON.stringify(value));
|
|
25
|
+
}
|
|
26
|
+
function presentDetails(value) {
|
|
27
|
+
const cleaned = jsonDetails(value);
|
|
28
|
+
return Object.keys(cleaned).length > 0 ? cleaned : undefined;
|
|
29
|
+
}
|
|
30
|
+
function parseCsv(value) {
|
|
31
|
+
return [...new Set(value.split(",").map((v) => v.trim()).filter(Boolean))];
|
|
32
|
+
}
|
|
33
|
+
function configObject(config) {
|
|
34
|
+
let val = config;
|
|
35
|
+
if (typeof val === "string") {
|
|
36
|
+
try {
|
|
37
|
+
val = JSON.parse(val);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
41
|
+
return { status: "error", message: `config must be valid JSON: ${message}` };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (!val || typeof val !== "object" || Array.isArray(val))
|
|
45
|
+
return { status: "missing" };
|
|
46
|
+
return { status: "ok", value: val };
|
|
47
|
+
}
|
|
48
|
+
function hasKey(obj, key) {
|
|
49
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
50
|
+
}
|
|
51
|
+
function isJsonSerializable(value) {
|
|
52
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
53
|
+
return true;
|
|
54
|
+
if (typeof value === "number")
|
|
55
|
+
return Number.isFinite(value);
|
|
56
|
+
if (Array.isArray(value))
|
|
57
|
+
return value.every(isJsonSerializable);
|
|
58
|
+
if (value && typeof value === "object")
|
|
59
|
+
return Object.values(value).every(isJsonSerializable);
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
function asDisambiguationScope(scope) {
|
|
63
|
+
if (scope === "user" || scope === "project")
|
|
64
|
+
return scope;
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
function actionScope(scope, action) {
|
|
68
|
+
if (scope === undefined)
|
|
69
|
+
return { scope: "user" };
|
|
70
|
+
const parsed = asDisambiguationScope(scope);
|
|
71
|
+
return parsed ? { scope: parsed } : { error: result(`agentScope must be 'user' or 'project' for ${action}.`, true) };
|
|
72
|
+
}
|
|
73
|
+
function normalizeListScope(scope) {
|
|
74
|
+
if (scope === undefined)
|
|
75
|
+
return "both";
|
|
76
|
+
if (scope === "user" || scope === "project" || scope === "both")
|
|
77
|
+
return scope;
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
function sanitizeName(name) {
|
|
81
|
+
return name.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
|
|
82
|
+
}
|
|
83
|
+
function parsePackageConfig(value) {
|
|
84
|
+
return parsePackageName(value, "config.package");
|
|
85
|
+
}
|
|
86
|
+
function allAgents(d) {
|
|
87
|
+
return [...d.builtin, ...d.package, ...d.user, ...d.project];
|
|
88
|
+
}
|
|
89
|
+
function effectiveAgentsForScope(scope, d, runtimeAgentOwner) {
|
|
90
|
+
let agents = mergeAgentsForScope(scope, d.user, d.project, d.builtin, d.package);
|
|
91
|
+
if (runtimeAgentOwner) {
|
|
92
|
+
agents = mergeRuntimeAgents(runtimeAgentOwner, { agents }, allAgents(d)).agents;
|
|
93
|
+
}
|
|
94
|
+
return agents;
|
|
95
|
+
}
|
|
96
|
+
function availableAgentNamesFromDiscovery(d, runtimeAgentOwner) {
|
|
97
|
+
const agents = runtimeAgentOwner ? effectiveAgentsForScope("both", d, runtimeAgentOwner) : allAgents(d);
|
|
98
|
+
return [...new Set(agents.map((agent) => agent.name))].sort((a, b) => a.localeCompare(b));
|
|
99
|
+
}
|
|
100
|
+
function availableAgentNames(cwd) {
|
|
101
|
+
return availableAgentNamesFromDiscovery(discoverAgentsAll(cwd));
|
|
102
|
+
}
|
|
103
|
+
function findAgentsInDiscovery(name, d, scope = "both", runtimeAgentOwner) {
|
|
104
|
+
const raw = name.trim();
|
|
105
|
+
const sanitized = sanitizeName(raw);
|
|
106
|
+
const scoped = effectiveAgentsForScope(scope, d, runtimeAgentOwner);
|
|
107
|
+
let resolved = resolveAgentName(raw, scoped);
|
|
108
|
+
if (!resolved.agent && !resolved.error && sanitized !== raw)
|
|
109
|
+
resolved = resolveAgentName(sanitized, scoped);
|
|
110
|
+
if (resolved.agent)
|
|
111
|
+
return scoped.filter((agent) => agent.name === resolved.agent.name).sort((a, b) => a.source.localeCompare(b.source));
|
|
112
|
+
return scoped
|
|
113
|
+
.filter((agent) => Boolean(resolveAgentName(raw, [agent]).agent)
|
|
114
|
+
|| (sanitized !== raw && Boolean(resolveAgentName(sanitized, [agent]).agent)))
|
|
115
|
+
.sort((a, b) => a.source.localeCompare(b.source));
|
|
116
|
+
}
|
|
117
|
+
function findAgents(name, cwd, scope = "both") {
|
|
118
|
+
return findAgentsInDiscovery(name, discoverAgentsAll(cwd), scope);
|
|
119
|
+
}
|
|
120
|
+
function diagnosticsForScope(diagnostics, scope) {
|
|
121
|
+
if (scope === "both")
|
|
122
|
+
return diagnostics;
|
|
123
|
+
const excludedSource = scope === "user" ? "project" : "user";
|
|
124
|
+
return diagnostics?.filter((diagnostic) => diagnostic.source !== excludedSource);
|
|
125
|
+
}
|
|
126
|
+
const AGENT_SOURCE_PRECEDENCE = { builtin: 0, package: 1, user: 2, project: 3, runtime: 4 };
|
|
127
|
+
// Returns the highest-precedence definition for a resolved canonical name (project > user > package > builtin),
|
|
128
|
+
// matching mergeAgentsForScope for "both", including disabled agents so disable/enable can locate hidden targets.
|
|
129
|
+
function resolveEffectiveAgent(d, name) {
|
|
130
|
+
const raw = name.trim();
|
|
131
|
+
const candidates = allAgents(d);
|
|
132
|
+
let resolved = resolveAgentName(raw, candidates);
|
|
133
|
+
if (!resolved.agent && !resolved.error) {
|
|
134
|
+
const sanitized = sanitizeName(raw);
|
|
135
|
+
if (sanitized !== raw)
|
|
136
|
+
resolved = resolveAgentName(sanitized, candidates);
|
|
137
|
+
}
|
|
138
|
+
if (resolved.error)
|
|
139
|
+
return { error: resolved.error };
|
|
140
|
+
if (!resolved.agent)
|
|
141
|
+
return {};
|
|
142
|
+
const matches = candidates.filter((agent) => agent.name === resolved.agent.name);
|
|
143
|
+
return { agent: matches.reduce((best, agent) => (AGENT_SOURCE_PRECEDENCE[agent.source] > AGENT_SOURCE_PRECEDENCE[best.source] ? agent : best)) };
|
|
144
|
+
}
|
|
145
|
+
function nameExistsInScope(cwd, scope, name, excludePath) {
|
|
146
|
+
const d = discoverAgentsAll(cwd);
|
|
147
|
+
for (const a of scope === "user" ? d.user : d.project) {
|
|
148
|
+
if (a.name === name && a.filePath !== excludePath)
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
function isMutableSource(source) {
|
|
154
|
+
return source === "user" || source === "project";
|
|
155
|
+
}
|
|
156
|
+
function modelWarning(ctx, model) {
|
|
157
|
+
if (!model)
|
|
158
|
+
return undefined;
|
|
159
|
+
const found = ctx.modelRegistry.getAvailable().some((m) => `${m.provider}/${m.id}` === model || m.id === model);
|
|
160
|
+
if (found)
|
|
161
|
+
return undefined;
|
|
162
|
+
return `Warning: model '${model}' is not in the current model registry. Run subagent({ action: "models" }) to list valid provider/id selectors, then use the exact provider/id form (bare ids resolve only when unique).`;
|
|
163
|
+
}
|
|
164
|
+
function skillsWarning(cwd, agent) {
|
|
165
|
+
if (!agent.skills?.length)
|
|
166
|
+
return undefined;
|
|
167
|
+
const { missing } = resolveSkills(agent.skills, cwd, agent.skillPath, agent.filePath ? path.dirname(agent.filePath) : cwd);
|
|
168
|
+
return missing.length ? `Warning: skills not found: ${missing.join(", ")}.` : undefined;
|
|
169
|
+
}
|
|
170
|
+
function withDeclaredExtensionPaths(config, filePath) {
|
|
171
|
+
const { frontmatter } = parseFrontmatter(fs.readFileSync(filePath, "utf-8"));
|
|
172
|
+
const { extensions: _extensions, subagentOnlyExtensions: _subagentOnlyExtensions, ...withoutResolvedExtensions } = config;
|
|
173
|
+
return {
|
|
174
|
+
...withoutResolvedExtensions,
|
|
175
|
+
...(frontmatter.extensions !== undefined ? { extensions: parseFrontmatterList(frontmatter.extensions) } : {}),
|
|
176
|
+
...(frontmatter.subagentOnlyExtensions !== undefined
|
|
177
|
+
? { subagentOnlyExtensions: parseFrontmatterList(frontmatter.subagentOnlyExtensions) }
|
|
178
|
+
: {}),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
export function editableAgentConfig(agent) {
|
|
182
|
+
const { extensions: _extensions, ...withoutExtensions } = agent;
|
|
183
|
+
const base = agent.override?.base;
|
|
184
|
+
const description = base?.description ?? agent.description;
|
|
185
|
+
const frontmatterFields = agent.source === "builtin" || agent.source === "runtime" ? undefined : readAgentFrontmatterFields(agent.filePath);
|
|
186
|
+
const hasDeclaredField = (...fields) => frontmatterFields === undefined || fields.some((field) => frontmatterFields.has(field));
|
|
187
|
+
const withoutSettingsDefaults = (config) => {
|
|
188
|
+
if (!frontmatterFields)
|
|
189
|
+
return config;
|
|
190
|
+
const next = { ...config };
|
|
191
|
+
if (!hasDeclaredField("model"))
|
|
192
|
+
delete next.model;
|
|
193
|
+
if (!hasDeclaredField("thinking"))
|
|
194
|
+
delete next.thinking;
|
|
195
|
+
return next;
|
|
196
|
+
};
|
|
197
|
+
const { override: _override, description: _description, output: _output, outputMode: _outputMode, defaultReads: _defaultReads, model: _model, fast: _fast, thinking: _thinking, systemPromptMode: _systemPromptMode, inheritProjectContext: _inheritProjectContext, inheritGlobalContext: _inheritGlobalContext, inheritSkills: _inheritSkills, defaultContext: _defaultContext, acceptanceRole: _acceptanceRole, disabled: _disabled, systemPrompt: _systemPrompt, skills: _skills, skillPath: _skillPath, tools: _tools, excludeTools: _excludeTools, mcpDirectTools: _mcpDirectTools, allowNestedSubagents: _allowNestedSubagents, allowedAgents: _allowedAgents, subagentOnlyExtensions: _subagentOnlyExtensions, mutationTools: _mutationTools, completionGuard: _completionGuard, toolBudget: _toolBudget, ...editable } = withoutExtensions;
|
|
198
|
+
if (!base) {
|
|
199
|
+
return withDeclaredExtensionPaths(withoutSettingsDefaults({
|
|
200
|
+
...withoutExtensions,
|
|
201
|
+
...(agent.extensionsFromDefault ? {} : agent.extensions !== undefined ? { extensions: [...agent.extensions] } : {}),
|
|
202
|
+
}), agent.filePath);
|
|
203
|
+
}
|
|
204
|
+
return withDeclaredExtensionPaths({
|
|
205
|
+
...editable,
|
|
206
|
+
description,
|
|
207
|
+
...(base.output !== undefined ? { output: base.output } : {}),
|
|
208
|
+
...(base.outputMode !== undefined ? { outputMode: base.outputMode } : {}),
|
|
209
|
+
...(base.defaultReads !== undefined ? { defaultReads: [...base.defaultReads] } : {}),
|
|
210
|
+
...(base.model !== undefined && hasDeclaredField("model") ? { model: base.model } : {}),
|
|
211
|
+
...(base.fast !== undefined ? { fast: base.fast } : {}),
|
|
212
|
+
...(base.thinking !== undefined && hasDeclaredField("thinking") ? { thinking: base.thinking } : {}),
|
|
213
|
+
systemPromptMode: base.systemPromptMode,
|
|
214
|
+
inheritProjectContext: base.inheritProjectContext,
|
|
215
|
+
inheritGlobalContext: base.inheritGlobalContext,
|
|
216
|
+
inheritSkills: base.inheritSkills,
|
|
217
|
+
...(base.defaultContext !== undefined ? { defaultContext: base.defaultContext } : {}),
|
|
218
|
+
...(base.acceptanceRole !== undefined ? { acceptanceRole: base.acceptanceRole } : {}),
|
|
219
|
+
...(base.disabled !== undefined ? { disabled: base.disabled } : {}),
|
|
220
|
+
systemPrompt: base.systemPrompt,
|
|
221
|
+
...(base.skills !== undefined ? { skills: [...base.skills] } : {}),
|
|
222
|
+
...(base.skillPath !== undefined ? { skillPath: [...base.skillPath] } : {}),
|
|
223
|
+
...(base.tools !== undefined ? { tools: [...base.tools] } : {}),
|
|
224
|
+
...(base.excludeTools !== undefined ? { excludeTools: [...base.excludeTools] } : {}),
|
|
225
|
+
...(base.mcpDirectTools !== undefined ? { mcpDirectTools: [...base.mcpDirectTools] } : {}),
|
|
226
|
+
...(base.allowNestedSubagents !== undefined ? { allowNestedSubagents: base.allowNestedSubagents } : {}),
|
|
227
|
+
...(base.allowedAgents !== undefined ? { allowedAgents: [...base.allowedAgents] } : {}),
|
|
228
|
+
...(base.extensions !== undefined ? { extensions: [...base.extensions] } : {}),
|
|
229
|
+
...(base.subagentOnlyExtensions !== undefined ? { subagentOnlyExtensions: [...base.subagentOnlyExtensions] } : {}),
|
|
230
|
+
...(base.mutationTools !== undefined ? { mutationTools: [...base.mutationTools] } : {}),
|
|
231
|
+
...(base.completionGuard !== undefined ? { completionGuard: base.completionGuard } : {}),
|
|
232
|
+
...(base.toolBudget !== undefined ? { toolBudget: base.toolBudget } : {}),
|
|
233
|
+
}, agent.filePath);
|
|
234
|
+
}
|
|
235
|
+
function readAgentFrontmatterFields(filePath) {
|
|
236
|
+
try {
|
|
237
|
+
const { frontmatter } = parseFrontmatter(fs.readFileSync(filePath, "utf-8"));
|
|
238
|
+
return new Set(Object.keys(frontmatter));
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
return new Set();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
export function preservedAgentFrontmatterFields(agent, cfg) {
|
|
245
|
+
const fields = readAgentFrontmatterFields(agent.filePath);
|
|
246
|
+
const changed = (...names) => {
|
|
247
|
+
for (const name of names)
|
|
248
|
+
fields.delete(name);
|
|
249
|
+
};
|
|
250
|
+
if (hasKey(cfg, "name"))
|
|
251
|
+
changed("name");
|
|
252
|
+
if (hasKey(cfg, "package"))
|
|
253
|
+
changed("package");
|
|
254
|
+
if (hasKey(cfg, "description"))
|
|
255
|
+
changed("description");
|
|
256
|
+
if (hasKey(cfg, "advertise"))
|
|
257
|
+
changed("advertise");
|
|
258
|
+
if (hasKey(cfg, "aliases"))
|
|
259
|
+
changed("alias", "aliases");
|
|
260
|
+
if (hasKey(cfg, "systemPrompt"))
|
|
261
|
+
changed("systemPrompt");
|
|
262
|
+
if (hasKey(cfg, "runner"))
|
|
263
|
+
changed("runner");
|
|
264
|
+
if (hasKey(cfg, "model"))
|
|
265
|
+
changed("model");
|
|
266
|
+
if (hasKey(cfg, "tools"))
|
|
267
|
+
changed("tools");
|
|
268
|
+
if (hasKey(cfg, "excludeTools"))
|
|
269
|
+
changed("excludeTools");
|
|
270
|
+
if (hasKey(cfg, "skills"))
|
|
271
|
+
changed("skill", "skills");
|
|
272
|
+
if (hasKey(cfg, "skillPath"))
|
|
273
|
+
changed("skillPath");
|
|
274
|
+
if (hasKey(cfg, "extensions"))
|
|
275
|
+
changed("extensions");
|
|
276
|
+
if (hasKey(cfg, "subagentOnlyExtensions"))
|
|
277
|
+
changed("subagentOnlyExtensions");
|
|
278
|
+
if (hasKey(cfg, "mutationTools"))
|
|
279
|
+
changed("mutationTools");
|
|
280
|
+
if (hasKey(cfg, "thinking")) {
|
|
281
|
+
changed("thinking");
|
|
282
|
+
if (cfg.thinking === "off")
|
|
283
|
+
fields.add("thinking");
|
|
284
|
+
}
|
|
285
|
+
if (hasKey(cfg, "systemPromptMode")) {
|
|
286
|
+
changed("systemPromptMode");
|
|
287
|
+
fields.add("systemPromptMode");
|
|
288
|
+
}
|
|
289
|
+
if (hasKey(cfg, "inheritProjectContext")) {
|
|
290
|
+
changed("inheritProjectContext");
|
|
291
|
+
fields.add("inheritProjectContext");
|
|
292
|
+
}
|
|
293
|
+
if (hasKey(cfg, "inheritGlobalContext")) {
|
|
294
|
+
changed("inheritGlobalContext");
|
|
295
|
+
fields.add("inheritGlobalContext");
|
|
296
|
+
}
|
|
297
|
+
if (hasKey(cfg, "inheritSkills")) {
|
|
298
|
+
changed("inheritSkills");
|
|
299
|
+
fields.add("inheritSkills");
|
|
300
|
+
}
|
|
301
|
+
if (hasKey(cfg, "defaultContext"))
|
|
302
|
+
changed("defaultContext");
|
|
303
|
+
if (hasKey(cfg, "async"))
|
|
304
|
+
changed("async");
|
|
305
|
+
if (hasKey(cfg, "timeoutMs"))
|
|
306
|
+
changed("timeoutMs");
|
|
307
|
+
if (hasKey(cfg, "acceptance"))
|
|
308
|
+
changed("acceptance");
|
|
309
|
+
if (hasKey(cfg, "acceptanceRole"))
|
|
310
|
+
changed("acceptanceRole");
|
|
311
|
+
if (hasKey(cfg, "output"))
|
|
312
|
+
changed("output");
|
|
313
|
+
if (hasKey(cfg, "outputMode"))
|
|
314
|
+
changed("outputMode");
|
|
315
|
+
if (hasKey(cfg, "reads"))
|
|
316
|
+
changed("defaultReads");
|
|
317
|
+
if (hasKey(cfg, "progress"))
|
|
318
|
+
changed("defaultProgress");
|
|
319
|
+
if (hasKey(cfg, "maxSubagentDepth"))
|
|
320
|
+
changed("maxSubagentDepth");
|
|
321
|
+
if (hasKey(cfg, "completionGuard")) {
|
|
322
|
+
changed("completionGuard");
|
|
323
|
+
if (cfg.completionGuard === true)
|
|
324
|
+
fields.add("completionGuard");
|
|
325
|
+
}
|
|
326
|
+
if (hasKey(cfg, "toolBudget"))
|
|
327
|
+
changed("toolBudget");
|
|
328
|
+
return fields;
|
|
329
|
+
}
|
|
330
|
+
function parseTools(raw) {
|
|
331
|
+
const tools = [];
|
|
332
|
+
const mcpDirectTools = [];
|
|
333
|
+
for (const item of parseCsv(raw)) {
|
|
334
|
+
if (item.startsWith("mcp:")) {
|
|
335
|
+
const direct = item.slice(4).trim();
|
|
336
|
+
if (direct)
|
|
337
|
+
mcpDirectTools.push(direct);
|
|
338
|
+
}
|
|
339
|
+
else
|
|
340
|
+
tools.push(item);
|
|
341
|
+
}
|
|
342
|
+
return {
|
|
343
|
+
...(tools.length ? { tools } : {}),
|
|
344
|
+
...(mcpDirectTools.length ? { mcpDirectTools } : {}),
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function applyAgentConfig(target, cfg) {
|
|
348
|
+
if (hasKey(cfg, "advertise")) {
|
|
349
|
+
if (cfg.advertise === "")
|
|
350
|
+
delete target.advertise;
|
|
351
|
+
else if (typeof cfg.advertise === "boolean")
|
|
352
|
+
target.advertise = cfg.advertise;
|
|
353
|
+
else
|
|
354
|
+
return "config.advertise must be a boolean or empty string when provided.";
|
|
355
|
+
}
|
|
356
|
+
if (hasKey(cfg, "aliases")) {
|
|
357
|
+
if (cfg.aliases === false || cfg.aliases === "")
|
|
358
|
+
delete target.aliases;
|
|
359
|
+
else if (typeof cfg.aliases === "string") {
|
|
360
|
+
const aliases = parseCsv(cfg.aliases).filter((alias) => alias !== target.name);
|
|
361
|
+
if (aliases.length)
|
|
362
|
+
target.aliases = aliases;
|
|
363
|
+
else
|
|
364
|
+
delete target.aliases;
|
|
365
|
+
}
|
|
366
|
+
else if (Array.isArray(cfg.aliases) && cfg.aliases.every((entry) => typeof entry === "string")) {
|
|
367
|
+
const aliases = [...new Set(cfg.aliases.map((entry) => entry.trim()).filter(Boolean).filter((alias) => alias !== target.name))];
|
|
368
|
+
if (aliases.length)
|
|
369
|
+
target.aliases = aliases;
|
|
370
|
+
else
|
|
371
|
+
delete target.aliases;
|
|
372
|
+
}
|
|
373
|
+
else
|
|
374
|
+
return "config.aliases must be a comma-separated string, string array, or false when provided.";
|
|
375
|
+
}
|
|
376
|
+
if (hasKey(cfg, "systemPrompt")) {
|
|
377
|
+
if (cfg.systemPrompt === false || cfg.systemPrompt === "")
|
|
378
|
+
target.systemPrompt = "";
|
|
379
|
+
else if (typeof cfg.systemPrompt === "string")
|
|
380
|
+
target.systemPrompt = cfg.systemPrompt;
|
|
381
|
+
else
|
|
382
|
+
return "config.systemPrompt must be a string or false when provided.";
|
|
383
|
+
}
|
|
384
|
+
if (hasKey(cfg, "runner")) {
|
|
385
|
+
if (cfg.runner === false || cfg.runner === "")
|
|
386
|
+
delete target.runner;
|
|
387
|
+
else if (cfg.runner && typeof cfg.runner === "object" && !Array.isArray(cfg.runner)) {
|
|
388
|
+
const runner = cfg.runner;
|
|
389
|
+
if (runner.type === "pi" && Object.keys(runner).every((key) => key === "type"))
|
|
390
|
+
target.runner = { type: "pi" };
|
|
391
|
+
else if (runner.type === "external-cli" && typeof runner.command === "string" && runner.command.trim()
|
|
392
|
+
&& (runner.args === undefined || (Array.isArray(runner.args) && runner.args.every((arg) => typeof arg === "string")))
|
|
393
|
+
&& (runner.adapter === undefined || isCodeOwnedExternalCliAdapterId(runner.adapter))
|
|
394
|
+
&& (runner.adapter === undefined || runner.args === undefined || runner.args.length === 0)
|
|
395
|
+
&& (runner.promptDelivery === undefined || runner.promptDelivery === "stdin")
|
|
396
|
+
&& Object.keys(runner).every((key) => ["type", "adapter", "command", "args", "promptDelivery"].includes(key))) {
|
|
397
|
+
const runnerArgs = Array.isArray(runner.args) ? runner.args.filter((arg) => typeof arg === "string") : undefined;
|
|
398
|
+
target.runner = { type: "external-cli", ...(isCodeOwnedExternalCliAdapterId(runner.adapter) ? { adapter: runner.adapter } : {}), command: runner.command.trim(), ...(runnerArgs?.length ? { args: runnerArgs } : {}), ...(runner.promptDelivery ? { promptDelivery: "stdin" } : {}) };
|
|
399
|
+
}
|
|
400
|
+
else if (runner.type === "external-job" && typeof runner.provider === "string" && runner.provider.trim() === runner.provider && runner.provider
|
|
401
|
+
&& (runner.options === undefined || (runner.options && typeof runner.options === "object" && !Array.isArray(runner.options) && isJsonSerializable(runner.options)))
|
|
402
|
+
&& Object.keys(runner).every((key) => ["type", "provider", "options"].includes(key))) {
|
|
403
|
+
target.runner = { type: "external-job", provider: runner.provider, ...(runner.options ? { options: runner.options } : {}) };
|
|
404
|
+
}
|
|
405
|
+
else
|
|
406
|
+
return `config.runner must be { type: 'pi' }, { type: 'external-cli', adapter?: ${CODE_OWNED_EXTERNAL_CLI_ADAPTER_LABEL}, command: string, args?: string[], promptDelivery?: 'stdin' }, or { type: 'external-job', provider: string, options?: object }.`;
|
|
407
|
+
}
|
|
408
|
+
else
|
|
409
|
+
return "config.runner must be an object, false, or empty string when provided.";
|
|
410
|
+
}
|
|
411
|
+
if (hasKey(cfg, "model")) {
|
|
412
|
+
if (cfg.model === false || cfg.model === "")
|
|
413
|
+
delete target.model;
|
|
414
|
+
else if (typeof cfg.model === "string") {
|
|
415
|
+
const model = cfg.model.trim();
|
|
416
|
+
if (model)
|
|
417
|
+
target.model = model;
|
|
418
|
+
else
|
|
419
|
+
delete target.model;
|
|
420
|
+
}
|
|
421
|
+
else
|
|
422
|
+
return "config.model must be a string or false when provided.";
|
|
423
|
+
}
|
|
424
|
+
if (hasKey(cfg, "fallbackModels"))
|
|
425
|
+
return "config.fallbackModels was removed; configure one model instead.";
|
|
426
|
+
if (hasKey(cfg, "tools")) {
|
|
427
|
+
if (cfg.tools === false || cfg.tools === "") {
|
|
428
|
+
delete target.tools;
|
|
429
|
+
delete target.mcpDirectTools;
|
|
430
|
+
}
|
|
431
|
+
else if (typeof cfg.tools === "string") {
|
|
432
|
+
const parsed = parseTools(cfg.tools);
|
|
433
|
+
if (parsed.tools)
|
|
434
|
+
target.tools = parsed.tools;
|
|
435
|
+
else
|
|
436
|
+
delete target.tools;
|
|
437
|
+
if (parsed.mcpDirectTools)
|
|
438
|
+
target.mcpDirectTools = parsed.mcpDirectTools;
|
|
439
|
+
else
|
|
440
|
+
delete target.mcpDirectTools;
|
|
441
|
+
}
|
|
442
|
+
else
|
|
443
|
+
return "config.tools must be a comma-separated string or false when provided.";
|
|
444
|
+
}
|
|
445
|
+
if (hasKey(cfg, "excludeTools")) {
|
|
446
|
+
if (cfg.excludeTools === false || cfg.excludeTools === "")
|
|
447
|
+
delete target.excludeTools;
|
|
448
|
+
else if (typeof cfg.excludeTools === "string") {
|
|
449
|
+
const excludeTools = parseCsv(cfg.excludeTools);
|
|
450
|
+
if (excludeTools.length)
|
|
451
|
+
target.excludeTools = [...new Set(excludeTools)];
|
|
452
|
+
else
|
|
453
|
+
delete target.excludeTools;
|
|
454
|
+
}
|
|
455
|
+
else if (Array.isArray(cfg.excludeTools) && cfg.excludeTools.every((entry) => typeof entry === "string")) {
|
|
456
|
+
const excludeTools = [...new Set(cfg.excludeTools.map((entry) => entry.trim()).filter(Boolean))];
|
|
457
|
+
if (excludeTools.length)
|
|
458
|
+
target.excludeTools = excludeTools;
|
|
459
|
+
else
|
|
460
|
+
delete target.excludeTools;
|
|
461
|
+
}
|
|
462
|
+
else
|
|
463
|
+
return "config.excludeTools must be a comma-separated string, string array, or false when provided.";
|
|
464
|
+
}
|
|
465
|
+
if (hasKey(cfg, "skills")) {
|
|
466
|
+
if (cfg.skills === false || cfg.skills === "")
|
|
467
|
+
delete target.skills;
|
|
468
|
+
else if (typeof cfg.skills === "string") {
|
|
469
|
+
const skills = parseCsv(cfg.skills);
|
|
470
|
+
if (skills.length)
|
|
471
|
+
target.skills = skills;
|
|
472
|
+
else
|
|
473
|
+
delete target.skills;
|
|
474
|
+
}
|
|
475
|
+
else
|
|
476
|
+
return "config.skills must be a comma-separated string or false when provided.";
|
|
477
|
+
}
|
|
478
|
+
if (hasKey(cfg, "skillPath")) {
|
|
479
|
+
if (cfg.skillPath === false || cfg.skillPath === "")
|
|
480
|
+
delete target.skillPath;
|
|
481
|
+
else if (typeof cfg.skillPath === "string") {
|
|
482
|
+
const skillPath = parseCsv(cfg.skillPath);
|
|
483
|
+
if (skillPath.length)
|
|
484
|
+
target.skillPath = skillPath;
|
|
485
|
+
else
|
|
486
|
+
delete target.skillPath;
|
|
487
|
+
}
|
|
488
|
+
else if (Array.isArray(cfg.skillPath) && cfg.skillPath.every((entry) => typeof entry === "string")) {
|
|
489
|
+
const skillPath = [...new Set(cfg.skillPath.map((entry) => entry.trim()).filter(Boolean))];
|
|
490
|
+
if (skillPath.length)
|
|
491
|
+
target.skillPath = skillPath;
|
|
492
|
+
else
|
|
493
|
+
delete target.skillPath;
|
|
494
|
+
}
|
|
495
|
+
else
|
|
496
|
+
return "config.skillPath must be a comma-separated string, string array, or false when provided.";
|
|
497
|
+
}
|
|
498
|
+
if (hasKey(cfg, "extensions")) {
|
|
499
|
+
if (cfg.extensions === false)
|
|
500
|
+
delete target.extensions;
|
|
501
|
+
else if (cfg.extensions === "")
|
|
502
|
+
target.extensions = [];
|
|
503
|
+
else if (typeof cfg.extensions === "string")
|
|
504
|
+
target.extensions = parseCsv(cfg.extensions);
|
|
505
|
+
else
|
|
506
|
+
return "config.extensions must be a comma-separated string, empty string, or false when provided.";
|
|
507
|
+
}
|
|
508
|
+
if (hasKey(cfg, "subagentOnlyExtensions")) {
|
|
509
|
+
if (cfg.subagentOnlyExtensions === false)
|
|
510
|
+
delete target.subagentOnlyExtensions;
|
|
511
|
+
else if (cfg.subagentOnlyExtensions === "")
|
|
512
|
+
target.subagentOnlyExtensions = [];
|
|
513
|
+
else if (typeof cfg.subagentOnlyExtensions === "string")
|
|
514
|
+
target.subagentOnlyExtensions = parseCsv(cfg.subagentOnlyExtensions);
|
|
515
|
+
else
|
|
516
|
+
return "config.subagentOnlyExtensions must be a comma-separated string, empty string, or false when provided.";
|
|
517
|
+
}
|
|
518
|
+
if (hasKey(cfg, "mutationTools")) {
|
|
519
|
+
if (cfg.mutationTools === false)
|
|
520
|
+
delete target.mutationTools;
|
|
521
|
+
else if (cfg.mutationTools === "")
|
|
522
|
+
target.mutationTools = [];
|
|
523
|
+
else if (typeof cfg.mutationTools === "string")
|
|
524
|
+
target.mutationTools = parseCsv(cfg.mutationTools);
|
|
525
|
+
else
|
|
526
|
+
return "config.mutationTools must be a comma-separated string, empty string, or false when provided.";
|
|
527
|
+
}
|
|
528
|
+
if (hasKey(cfg, "thinking")) {
|
|
529
|
+
if (cfg.thinking === false || cfg.thinking === "")
|
|
530
|
+
delete target.thinking;
|
|
531
|
+
else if (typeof cfg.thinking === "string") {
|
|
532
|
+
const thinking = cfg.thinking.trim();
|
|
533
|
+
if (thinking)
|
|
534
|
+
target.thinking = thinking;
|
|
535
|
+
else
|
|
536
|
+
delete target.thinking;
|
|
537
|
+
}
|
|
538
|
+
else
|
|
539
|
+
return "config.thinking must be a string or false when provided.";
|
|
540
|
+
}
|
|
541
|
+
if (hasKey(cfg, "systemPromptMode")) {
|
|
542
|
+
if (cfg.systemPromptMode === "append" || cfg.systemPromptMode === "replace")
|
|
543
|
+
target.systemPromptMode = cfg.systemPromptMode;
|
|
544
|
+
else
|
|
545
|
+
return "config.systemPromptMode must be 'append' or 'replace' when provided.";
|
|
546
|
+
}
|
|
547
|
+
if (hasKey(cfg, "inheritProjectContext")) {
|
|
548
|
+
if (typeof cfg.inheritProjectContext !== "boolean")
|
|
549
|
+
return "config.inheritProjectContext must be a boolean when provided.";
|
|
550
|
+
target.inheritProjectContext = cfg.inheritProjectContext;
|
|
551
|
+
}
|
|
552
|
+
if (hasKey(cfg, "inheritGlobalContext")) {
|
|
553
|
+
if (typeof cfg.inheritGlobalContext !== "boolean")
|
|
554
|
+
return "config.inheritGlobalContext must be a boolean when provided.";
|
|
555
|
+
target.inheritGlobalContext = cfg.inheritGlobalContext;
|
|
556
|
+
}
|
|
557
|
+
if (hasKey(cfg, "inheritSkills")) {
|
|
558
|
+
if (typeof cfg.inheritSkills !== "boolean")
|
|
559
|
+
return "config.inheritSkills must be a boolean when provided.";
|
|
560
|
+
target.inheritSkills = cfg.inheritSkills;
|
|
561
|
+
}
|
|
562
|
+
if (hasKey(cfg, "defaultContext")) {
|
|
563
|
+
if (cfg.defaultContext === false || cfg.defaultContext === "")
|
|
564
|
+
delete target.defaultContext;
|
|
565
|
+
else if (cfg.defaultContext === "fresh" || cfg.defaultContext === "fork")
|
|
566
|
+
target.defaultContext = cfg.defaultContext;
|
|
567
|
+
else
|
|
568
|
+
return "config.defaultContext must be 'fresh', 'fork', or false when provided.";
|
|
569
|
+
}
|
|
570
|
+
if (hasKey(cfg, "async")) {
|
|
571
|
+
if (cfg.async === "")
|
|
572
|
+
delete target.defaultAsync;
|
|
573
|
+
else if (typeof cfg.async === "boolean")
|
|
574
|
+
target.defaultAsync = cfg.async;
|
|
575
|
+
else
|
|
576
|
+
return "config.async must be a boolean or empty string when provided.";
|
|
577
|
+
}
|
|
578
|
+
if (hasKey(cfg, "timeoutMs")) {
|
|
579
|
+
if (cfg.timeoutMs === false || cfg.timeoutMs === "")
|
|
580
|
+
delete target.defaultTimeoutMs;
|
|
581
|
+
else if (typeof cfg.timeoutMs === "number" && Number.isInteger(cfg.timeoutMs) && cfg.timeoutMs > 0)
|
|
582
|
+
target.defaultTimeoutMs = cfg.timeoutMs;
|
|
583
|
+
else
|
|
584
|
+
return "config.timeoutMs must be a positive integer or false when provided.";
|
|
585
|
+
}
|
|
586
|
+
if (hasKey(cfg, "acceptance")) {
|
|
587
|
+
if (cfg.acceptance === "")
|
|
588
|
+
delete target.defaultAcceptance;
|
|
589
|
+
else {
|
|
590
|
+
const errors = validateAcceptanceInput(cfg.acceptance, "config.acceptance");
|
|
591
|
+
if (errors.length > 0)
|
|
592
|
+
return errors.join(" ");
|
|
593
|
+
target.defaultAcceptance = cfg.acceptance;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if (hasKey(cfg, "acceptanceRole")) {
|
|
597
|
+
if (cfg.acceptanceRole === false || cfg.acceptanceRole === "")
|
|
598
|
+
delete target.acceptanceRole;
|
|
599
|
+
else if (cfg.acceptanceRole === "read-only" || cfg.acceptanceRole === "writer")
|
|
600
|
+
target.acceptanceRole = cfg.acceptanceRole;
|
|
601
|
+
else
|
|
602
|
+
return "config.acceptanceRole must be 'read-only', 'writer', or false when provided.";
|
|
603
|
+
}
|
|
604
|
+
if (hasKey(cfg, "output")) {
|
|
605
|
+
if (cfg.output === false || cfg.output === "")
|
|
606
|
+
delete target.output;
|
|
607
|
+
else if (typeof cfg.output === "string")
|
|
608
|
+
target.output = cfg.output;
|
|
609
|
+
else
|
|
610
|
+
return "config.output must be a string or false when provided.";
|
|
611
|
+
}
|
|
612
|
+
if (hasKey(cfg, "outputMode")) {
|
|
613
|
+
if (cfg.outputMode === "inline" || cfg.outputMode === "file-only")
|
|
614
|
+
target.outputMode = cfg.outputMode;
|
|
615
|
+
else
|
|
616
|
+
return "config.outputMode must be 'inline' or 'file-only' when provided.";
|
|
617
|
+
}
|
|
618
|
+
if (hasKey(cfg, "reads")) {
|
|
619
|
+
if (cfg.reads === false || cfg.reads === "")
|
|
620
|
+
delete target.defaultReads;
|
|
621
|
+
else if (typeof cfg.reads === "string") {
|
|
622
|
+
const reads = parseCsv(cfg.reads);
|
|
623
|
+
if (reads.length)
|
|
624
|
+
target.defaultReads = reads;
|
|
625
|
+
else
|
|
626
|
+
delete target.defaultReads;
|
|
627
|
+
}
|
|
628
|
+
else
|
|
629
|
+
return "config.reads must be a comma-separated string or false when provided.";
|
|
630
|
+
}
|
|
631
|
+
if (hasKey(cfg, "progress")) {
|
|
632
|
+
if (typeof cfg.progress !== "boolean")
|
|
633
|
+
return "config.progress must be a boolean when provided.";
|
|
634
|
+
target.defaultProgress = cfg.progress;
|
|
635
|
+
}
|
|
636
|
+
if (hasKey(cfg, "maxSubagentDepth")) {
|
|
637
|
+
if (cfg.maxSubagentDepth === false || cfg.maxSubagentDepth === "")
|
|
638
|
+
delete target.maxSubagentDepth;
|
|
639
|
+
else if (typeof cfg.maxSubagentDepth === "number" && Number.isInteger(cfg.maxSubagentDepth) && cfg.maxSubagentDepth >= 0) {
|
|
640
|
+
target.maxSubagentDepth = cfg.maxSubagentDepth;
|
|
641
|
+
}
|
|
642
|
+
else
|
|
643
|
+
return "config.maxSubagentDepth must be an integer >= 0 or false when provided.";
|
|
644
|
+
}
|
|
645
|
+
if (hasKey(cfg, "completionGuard")) {
|
|
646
|
+
if (typeof cfg.completionGuard !== "boolean")
|
|
647
|
+
return "config.completionGuard must be a boolean when provided.";
|
|
648
|
+
target.completionGuard = cfg.completionGuard;
|
|
649
|
+
}
|
|
650
|
+
if (hasKey(cfg, "toolBudget")) {
|
|
651
|
+
if (cfg.toolBudget === false || cfg.toolBudget === "")
|
|
652
|
+
delete target.toolBudget;
|
|
653
|
+
else {
|
|
654
|
+
const validation = validateToolBudgetConfig(cfg.toolBudget, "config.toolBudget");
|
|
655
|
+
if (validation.error)
|
|
656
|
+
return validation.error;
|
|
657
|
+
target.toolBudget = cfg.toolBudget;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (target.runner?.type === "external-cli" || target.runner?.type === "external-job") {
|
|
661
|
+
const unsupported = [
|
|
662
|
+
target.tools?.length || target.mcpDirectTools?.length ? "tools" : undefined,
|
|
663
|
+
target.excludeTools?.length ? "excludeTools" : undefined,
|
|
664
|
+
target.model ? "model" : undefined,
|
|
665
|
+
target.thinking ? "thinking" : undefined,
|
|
666
|
+
target.extensions?.length ? "extensions" : undefined,
|
|
667
|
+
target.subagentOnlyExtensions?.length ? "subagentOnlyExtensions" : undefined,
|
|
668
|
+
target.mutationTools?.length ? "mutationTools" : undefined,
|
|
669
|
+
target.skills?.length || target.skillPath?.length ? "skills" : undefined,
|
|
670
|
+
target.maxSubagentDepth !== undefined ? "maxSubagentDepth" : undefined,
|
|
671
|
+
target.completionGuard !== undefined ? "completionGuard" : undefined,
|
|
672
|
+
target.toolBudget ? "toolBudget" : undefined,
|
|
673
|
+
].filter((field) => Boolean(field));
|
|
674
|
+
if (unsupported.length > 0)
|
|
675
|
+
return `config.runner type '${target.runner.type}' does not support Pi-only fields: ${unsupported.join(", ")}.`;
|
|
676
|
+
}
|
|
677
|
+
return undefined;
|
|
678
|
+
}
|
|
679
|
+
function resolveTarget(name, matches, cwd, scopeHint) {
|
|
680
|
+
const distinctNames = [...new Set(matches.map((match) => match.name))];
|
|
681
|
+
if (distinctNames.length > 1)
|
|
682
|
+
return result(`Ambiguous agent alias or name '${name}': ${distinctNames.sort((a, b) => a.localeCompare(b)).join(", ")}`, true);
|
|
683
|
+
const mutable = matches.filter((match) => isMutableSource(match.source));
|
|
684
|
+
if (mutable.length === 0) {
|
|
685
|
+
if (matches.length > 0)
|
|
686
|
+
return result(`Agent '${name}' is read-only and cannot be modified. Create a same-named agent in user or project scope to override it.`, true);
|
|
687
|
+
return result(`Agent '${name}' not found. Available: ${availableAgentNames(cwd).join(", ") || "none"}.`, true);
|
|
688
|
+
}
|
|
689
|
+
if (mutable.length === 1)
|
|
690
|
+
return mutable[0];
|
|
691
|
+
const scope = asDisambiguationScope(scopeHint);
|
|
692
|
+
if (!scope) {
|
|
693
|
+
const paths = mutable.map((match) => `${match.source}: ${match.filePath}`).join("\n");
|
|
694
|
+
return result(`Agent '${name}' exists in both scopes. Specify agentScope: 'user' or 'project'.\n${paths}`, true);
|
|
695
|
+
}
|
|
696
|
+
const scoped = mutable.filter((match) => match.source === scope);
|
|
697
|
+
if (scoped.length === 0)
|
|
698
|
+
return result(`Agent '${name}' not found in scope '${scope}'.`, true);
|
|
699
|
+
if (scoped.length > 1)
|
|
700
|
+
return result(`Multiple agents named '${name}' found in scope '${scope}': ${scoped.map((match) => match.filePath).join(", ")}`, true);
|
|
701
|
+
return scoped[0];
|
|
702
|
+
}
|
|
703
|
+
function renamePath(currentPath, newName, scope, cwd) {
|
|
704
|
+
if (nameExistsInScope(cwd, scope, newName, currentPath))
|
|
705
|
+
return { error: `Name '${newName}' already exists in ${scope} scope.` };
|
|
706
|
+
const filePath = path.join(path.dirname(currentPath), `${newName}.md`);
|
|
707
|
+
if (fs.existsSync(filePath) && filePath !== currentPath)
|
|
708
|
+
return { error: `File already exists at ${filePath} but is not a valid agent definition. Remove or rename it first.` };
|
|
709
|
+
fs.renameSync(currentPath, filePath);
|
|
710
|
+
return { filePath };
|
|
711
|
+
}
|
|
712
|
+
function packageSourceLabel(agent) {
|
|
713
|
+
if (!agent.packageSourceName)
|
|
714
|
+
return agent.source;
|
|
715
|
+
return agent.packageSourceVersion ? `${agent.packageSourceName}@${agent.packageSourceVersion}` : agent.packageSourceName;
|
|
716
|
+
}
|
|
717
|
+
function errorMessage(error) {
|
|
718
|
+
return error instanceof Error ? error.message : String(error);
|
|
719
|
+
}
|
|
720
|
+
function registeredExternalJobProviderStatus() {
|
|
721
|
+
try {
|
|
722
|
+
return { ok: true, names: new Set(listExternalJobProviders().map((provider) => provider.name)) };
|
|
723
|
+
}
|
|
724
|
+
catch (error) {
|
|
725
|
+
return { ok: false, error: errorMessage(error) };
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
function externalJobProviderSuffix(provider, names) {
|
|
729
|
+
if (!names)
|
|
730
|
+
return "?";
|
|
731
|
+
return names.has(provider) ? "✓" : "missing";
|
|
732
|
+
}
|
|
733
|
+
/** A placed agent checks only local ssh; machine catalog and remote CLI validation happen at launch. */
|
|
734
|
+
function externalCliAvailabilityKey(command, machine) {
|
|
735
|
+
return machine ? `ssh@${machine}` : command;
|
|
736
|
+
}
|
|
737
|
+
function externalCliAvailabilityForAgents(agents) {
|
|
738
|
+
const availability = new Map();
|
|
739
|
+
for (const agent of agents) {
|
|
740
|
+
const runner = agent.runner;
|
|
741
|
+
if (runner?.type !== "external-cli")
|
|
742
|
+
continue;
|
|
743
|
+
const key = externalCliAvailabilityKey(runner.command, agent.machine);
|
|
744
|
+
if (availability.has(key))
|
|
745
|
+
continue;
|
|
746
|
+
availability.set(key, resolveExternalCliBinaryAvailability(agent.machine ? "ssh" : runner.command, process.env));
|
|
747
|
+
}
|
|
748
|
+
return availability;
|
|
749
|
+
}
|
|
750
|
+
function runnerListBadge(agent, providerNames, externalCliAvailability) {
|
|
751
|
+
if (agent.runner?.type === "external-job")
|
|
752
|
+
return `external-job:${agent.runner.provider} ${externalJobProviderSuffix(agent.runner.provider, providerNames)}`;
|
|
753
|
+
if (agent.runner?.type === "external-cli") {
|
|
754
|
+
const placed = agent.machine ? `${agent.runner.command} @ ${agent.machine}` : agent.runner.command;
|
|
755
|
+
const availability = externalCliAvailability?.get(externalCliAvailabilityKey(agent.runner.command, agent.machine));
|
|
756
|
+
if (!availability)
|
|
757
|
+
return `external-cli:${placed}`;
|
|
758
|
+
if (agent.machine)
|
|
759
|
+
return `external-cli:${placed} saved Herdr placement; transport ${availability.available ? "✓" : "missing"}; machine not preflighted`;
|
|
760
|
+
return `external-cli:${placed} ${availability.available ? "✓" : "missing"}`;
|
|
761
|
+
}
|
|
762
|
+
if (agent.machine)
|
|
763
|
+
return `machine: ${agent.machine} (saved Herdr placement)`;
|
|
764
|
+
return undefined;
|
|
765
|
+
}
|
|
766
|
+
function agentListMetadata(agent, providerNames, externalCliAvailability) {
|
|
767
|
+
const source = agent.source === "package" ? packageSourceLabel(agent) : agent.source;
|
|
768
|
+
return [
|
|
769
|
+
source,
|
|
770
|
+
runnerListBadge(agent, providerNames, externalCliAvailability),
|
|
771
|
+
agent.defaultContext ? `context: ${agent.defaultContext}` : undefined,
|
|
772
|
+
agent.aliases?.length ? `aliases: ${agent.aliases.join(", ")}` : undefined,
|
|
773
|
+
].filter((part) => Boolean(part)).join(", ");
|
|
774
|
+
}
|
|
775
|
+
function formatAgentListLine(agent, providerNames) {
|
|
776
|
+
return `- ${agent.name} (${agentListMetadata(agent, providerNames)}): ${agent.description}`;
|
|
777
|
+
}
|
|
778
|
+
function formatAgentCapabilitiesLine(agent, providerNames, externalCliAvailability) {
|
|
779
|
+
const declaredTools = [
|
|
780
|
+
...(agent.tools ?? []),
|
|
781
|
+
...(agent.mcpDirectTools ?? []).map((tool) => `mcp:${tool}`),
|
|
782
|
+
];
|
|
783
|
+
let tools = "none";
|
|
784
|
+
if (agent.tools === undefined && agent.mcpDirectTools === undefined) {
|
|
785
|
+
tools = "default/ambient";
|
|
786
|
+
}
|
|
787
|
+
else if (declaredTools.length > 0) {
|
|
788
|
+
tools = declaredTools.join(", ");
|
|
789
|
+
}
|
|
790
|
+
if (agent.excludeTools?.length)
|
|
791
|
+
tools = `${tools}; excludes: ${agent.excludeTools.join(", ")}`;
|
|
792
|
+
let model = "inherits current session";
|
|
793
|
+
if (agent.model !== undefined) {
|
|
794
|
+
model = agent.model;
|
|
795
|
+
if (agent.modelProvider && !agent.model.includes("/"))
|
|
796
|
+
model = `${agent.modelProvider}/${agent.model}`;
|
|
797
|
+
}
|
|
798
|
+
const thinking = agent.thinking === false ? "off" : agent.thinking ?? "default";
|
|
799
|
+
const machine = agent.machine ? `; Machine: ${agent.machine} (saved Herdr placement)` : "";
|
|
800
|
+
const acceptance = formatAcceptanceSummary(agent);
|
|
801
|
+
return `- ${agent.name} (${agentListMetadata(agent, providerNames, externalCliAvailability)}): Description: ${previewDisplayText(agent.description, 240)}; Tools: ${tools}; Model: ${model}; Thinking: ${thinking}${machine}${acceptance ? `; ${acceptance}` : ""}`;
|
|
802
|
+
}
|
|
803
|
+
function formatAcceptanceSummary(agent) {
|
|
804
|
+
const policy = agent.defaultAcceptance;
|
|
805
|
+
const summary = [];
|
|
806
|
+
if (policy === false)
|
|
807
|
+
summary.push("Acceptance: disabled");
|
|
808
|
+
else if (typeof policy === "string")
|
|
809
|
+
summary.push(`Acceptance: ${policy}`);
|
|
810
|
+
else if (policy) {
|
|
811
|
+
const modifiers = [
|
|
812
|
+
...(policy.evidence ?? []),
|
|
813
|
+
...(policy.verify ?? []).map((command) => `verify: ${formatAcceptanceDisplayLabel(command.id)}`),
|
|
814
|
+
...(policy.criteria?.length ? [`criteria: ${policy.criteria.length}`] : []),
|
|
815
|
+
...(policy.stopRules?.length ? [`stopRules: ${policy.stopRules.length}`] : []),
|
|
816
|
+
];
|
|
817
|
+
if (policy.review === false)
|
|
818
|
+
modifiers.push("review: off");
|
|
819
|
+
else if (policy.review) {
|
|
820
|
+
const displayReview = policy.review.agent
|
|
821
|
+
? { ...policy.review, agent: formatAcceptanceDisplayLabel(policy.review.agent) }
|
|
822
|
+
: policy.review;
|
|
823
|
+
modifiers.push(`review: ${formatReviewGateLabel(displayReview)}`);
|
|
824
|
+
}
|
|
825
|
+
if (policy.report)
|
|
826
|
+
modifiers.push(`report: ${policy.report}`);
|
|
827
|
+
summary.push(`Acceptance: ${policy.level ?? "auto"}${modifiers.length > 0 ? ` (${modifiers.join(", ")})` : ""}`);
|
|
828
|
+
}
|
|
829
|
+
if (agent.acceptanceRole)
|
|
830
|
+
summary.push(`Acceptance role: ${agent.acceptanceRole}`);
|
|
831
|
+
return summary.length > 0 ? summary.join("; ") : undefined;
|
|
832
|
+
}
|
|
833
|
+
function formatAcceptanceDisplayLabel(value) {
|
|
834
|
+
return JSON.stringify(previewDisplayText(value, 80));
|
|
835
|
+
}
|
|
836
|
+
const EXTERNAL_JOB_CAPABILITIES = { stop: false, steer: false, resume: false, structuredOutput: false, toolEvents: false };
|
|
837
|
+
const PI_AGENT_RUNNER = { type: "pi" };
|
|
838
|
+
function listOrEmpty(values) {
|
|
839
|
+
return values ?? [];
|
|
840
|
+
}
|
|
841
|
+
function agentCapabilityRunner(agent, providerNames, externalCliAvailability) {
|
|
842
|
+
const runner = agent.runner;
|
|
843
|
+
if (!runner || runner.type === "pi")
|
|
844
|
+
return PI_AGENT_RUNNER;
|
|
845
|
+
if (runner.type === "external-cli") {
|
|
846
|
+
const availability = externalCliAvailability.get(externalCliAvailabilityKey(runner.command, agent.machine));
|
|
847
|
+
return {
|
|
848
|
+
type: "external-cli",
|
|
849
|
+
adapter: runner.adapter,
|
|
850
|
+
command: runner.command,
|
|
851
|
+
...(agent.machine ? { machine: agent.machine } : {}),
|
|
852
|
+
...availability,
|
|
853
|
+
capabilities: resolveExternalCliRunnerStatus(runner).capabilities,
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
return { type: "external-job", provider: runner.provider, available: providerNames?.has(runner.provider), capabilities: EXTERNAL_JOB_CAPABILITIES };
|
|
857
|
+
}
|
|
858
|
+
function agentCapabilityTools(agent) {
|
|
859
|
+
return {
|
|
860
|
+
ambient: agent.tools === undefined && agent.mcpDirectTools === undefined,
|
|
861
|
+
names: listOrEmpty(agent.tools),
|
|
862
|
+
...(agent.excludeTools !== undefined ? { excludeTools: [...agent.excludeTools] } : {}),
|
|
863
|
+
mcpDirectTools: listOrEmpty(agent.mcpDirectTools),
|
|
864
|
+
mutationTools: agent.mutationTools,
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
function agentCapabilityRow(agent, options) {
|
|
868
|
+
return {
|
|
869
|
+
name: agent.name,
|
|
870
|
+
description: previewDisplayText(agent.description, 1000),
|
|
871
|
+
source: agent.source,
|
|
872
|
+
executable: options.executable,
|
|
873
|
+
restrictionSources: options.executable ? undefined : options.restrictionSources ?? [],
|
|
874
|
+
aliases: agent.aliases ? [...agent.aliases] : undefined,
|
|
875
|
+
runner: agentCapabilityRunner(agent, options.providerNames, options.externalCliAvailability),
|
|
876
|
+
tools: agentCapabilityTools(agent),
|
|
877
|
+
model: presentDetails({ value: agent.model, thinking: agent.thinking }),
|
|
878
|
+
execution: presentDetails({ defaultAsync: agent.defaultAsync, timeoutMs: agent.defaultTimeoutMs }),
|
|
879
|
+
acceptance: presentDetails({ policy: agent.defaultAcceptance, role: agent.acceptanceRole }),
|
|
880
|
+
output: presentDetails({ path: agent.output, mode: agent.outputMode }),
|
|
881
|
+
extensions: presentDetails({ names: agent.extensions, subagentOnly: agent.subagentOnlyExtensions, skills: agent.skills }),
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
function agentCapabilitiesSnapshot(input) {
|
|
885
|
+
return {
|
|
886
|
+
agents: [
|
|
887
|
+
...input.agents.map((agent) => agentCapabilityRow(agent, { executable: true, providerNames: input.providerNames, externalCliAvailability: input.externalCliAvailability })),
|
|
888
|
+
...input.restrictedAgents.map((agent) => agentCapabilityRow(agent, { executable: false, providerNames: input.providerNames, externalCliAvailability: input.externalCliAvailability, restrictionSources: input.restrictedSources })),
|
|
889
|
+
],
|
|
890
|
+
restrictedCount: input.restrictedAgents.length,
|
|
891
|
+
...(input.restrictedSources?.length ? { capabilityCeilingSources: [...input.restrictedSources] } : {}),
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
function providerNames(status) {
|
|
895
|
+
return status.ok ? status.names : undefined;
|
|
896
|
+
}
|
|
897
|
+
function appendRestrictedAgentLines(input) {
|
|
898
|
+
if (input.agents.length === 0)
|
|
899
|
+
return;
|
|
900
|
+
input.lines.push("", `Restricted agents (not executable in this session${input.sources?.length ? `; capability ceiling: ${input.sources.join(", ")}` : ""}):`, ...input.agents.map((agent) => input.formatLine(agent, input.providerNames)));
|
|
901
|
+
}
|
|
902
|
+
function appendExternalJobRegistryLine(lines, agents, status) {
|
|
903
|
+
if (status.ok || !agents.some((agent) => agent.runner?.type === "external-job"))
|
|
904
|
+
return;
|
|
905
|
+
lines.push("", `External-job provider registry unavailable: ${status.error}`);
|
|
906
|
+
}
|
|
907
|
+
function appendAgentDiagnosticLines(lines, diagnostics) {
|
|
908
|
+
if (!diagnostics?.length)
|
|
909
|
+
return;
|
|
910
|
+
lines.push("", "Invalid agent definitions:", ...diagnostics.map((diagnostic) => `- ${diagnostic.name ?? diagnostic.filePath} (${diagnostic.source}): ${diagnostic.error}`));
|
|
911
|
+
}
|
|
912
|
+
function agentCapabilityDetails(input) {
|
|
913
|
+
if (!input.capabilityMode)
|
|
914
|
+
return undefined;
|
|
915
|
+
return {
|
|
916
|
+
agentCapabilities: jsonDetails(agentCapabilitiesSnapshot({
|
|
917
|
+
agents: input.agents,
|
|
918
|
+
restrictedAgents: input.restrictedAgents,
|
|
919
|
+
providerNames: input.providerNames,
|
|
920
|
+
externalCliAvailability: input.externalCliAvailability,
|
|
921
|
+
restrictedSources: input.restrictedSources,
|
|
922
|
+
})),
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
function formatAgentListSections(agents, providerNames, formatLine = formatAgentListLine) {
|
|
926
|
+
if (agents.length === 0)
|
|
927
|
+
return ["- (none)"];
|
|
928
|
+
const sections = [
|
|
929
|
+
["package", "Package agents"],
|
|
930
|
+
["user", "User agents"],
|
|
931
|
+
["project", "Project agents"],
|
|
932
|
+
["runtime", "Runtime agents"],
|
|
933
|
+
["builtin", "Builtin agents"],
|
|
934
|
+
];
|
|
935
|
+
const lines = [];
|
|
936
|
+
for (const [source, label] of sections) {
|
|
937
|
+
const matches = agents.filter((agent) => agent.source === source);
|
|
938
|
+
if (matches.length === 0)
|
|
939
|
+
continue;
|
|
940
|
+
if (lines.length > 0)
|
|
941
|
+
lines.push("");
|
|
942
|
+
lines.push(label, ...matches.map((agent) => formatLine(agent, providerNames)));
|
|
943
|
+
}
|
|
944
|
+
return lines;
|
|
945
|
+
}
|
|
946
|
+
function formatRunnerDetail(agent, providerNames) {
|
|
947
|
+
if (!agent.runner)
|
|
948
|
+
return undefined;
|
|
949
|
+
if (agent.runner.type === "external-job")
|
|
950
|
+
return `Runner: external-job via ${agent.runner.provider} ${externalJobProviderSuffix(agent.runner.provider, providerNames)}`;
|
|
951
|
+
if (agent.runner.type === "external-cli")
|
|
952
|
+
return `Runner: external-cli ${agent.runner.command}`;
|
|
953
|
+
return `Runner: ${JSON.stringify(agent.runner)}`;
|
|
954
|
+
}
|
|
955
|
+
function formatAgentDetail(agent) {
|
|
956
|
+
const tools = [...(agent.tools ?? []), ...(agent.mcpDirectTools ?? []).map((t) => `mcp:${t}`)];
|
|
957
|
+
const providerStatus = registeredExternalJobProviderStatus();
|
|
958
|
+
const lines = [`Agent: ${agent.name} (${agent.source})`, `Path: ${agent.filePath}`, `Description: ${agent.description}`];
|
|
959
|
+
if (agent.source === "package" && agent.packageSourceName) {
|
|
960
|
+
lines.push(`Source package: ${packageSourceLabel(agent)}`);
|
|
961
|
+
if (agent.packageSourceRoot)
|
|
962
|
+
lines.push(`Package root: ${agent.packageSourceRoot}`);
|
|
963
|
+
}
|
|
964
|
+
if (agent.packageName) {
|
|
965
|
+
lines.push(`Local name: ${frontmatterNameForConfig(agent)}`);
|
|
966
|
+
lines.push(`Package: ${agent.packageName}`);
|
|
967
|
+
}
|
|
968
|
+
if (agent.aliases?.length)
|
|
969
|
+
lines.push(`Aliases: ${agent.aliases.join(", ")}`);
|
|
970
|
+
if (agent.model)
|
|
971
|
+
lines.push(`Model: ${agent.model}`);
|
|
972
|
+
if (tools.length)
|
|
973
|
+
lines.push(`Tools: ${tools.join(", ")}`);
|
|
974
|
+
if (agent.excludeTools?.length)
|
|
975
|
+
lines.push(`Excluded tools: ${agent.excludeTools.join(", ")}`);
|
|
976
|
+
if (agent.skills?.length)
|
|
977
|
+
lines.push(`Skills: ${agent.skills.join(", ")}`);
|
|
978
|
+
if (agent.skillPath?.length)
|
|
979
|
+
lines.push(`Skill paths: ${agent.skillPath.join(", ")}`);
|
|
980
|
+
lines.push(`System prompt mode: ${agent.systemPromptMode}`);
|
|
981
|
+
const runnerDetail = formatRunnerDetail(agent, providerStatus.ok ? providerStatus.names : undefined);
|
|
982
|
+
if (runnerDetail) {
|
|
983
|
+
lines.push(runnerDetail);
|
|
984
|
+
if (agent.runner?.type === "external-job" && !providerStatus.ok)
|
|
985
|
+
lines.push(`External-job provider registry unavailable: ${providerStatus.error}`);
|
|
986
|
+
if (agent.runner?.type === "external-job" && agent.runner.options)
|
|
987
|
+
lines.push(`Runner options: ${JSON.stringify(agent.runner.options)}`);
|
|
988
|
+
}
|
|
989
|
+
lines.push(`Inherit project context: ${agent.inheritProjectContext ? "true" : "false"}`);
|
|
990
|
+
lines.push(`Inherit global context: ${agent.inheritGlobalContext ? "true" : "false"}`);
|
|
991
|
+
lines.push(`Inherit skills: ${agent.inheritSkills ? "true" : "false"}`);
|
|
992
|
+
if (agent.defaultContext)
|
|
993
|
+
lines.push(`Default context: ${agent.defaultContext}`);
|
|
994
|
+
if (agent.defaultAsync !== undefined)
|
|
995
|
+
lines.push(`Async: ${agent.defaultAsync ? "true" : "false"}`);
|
|
996
|
+
if (agent.defaultTimeoutMs !== undefined)
|
|
997
|
+
lines.push(`Timeout: ${agent.defaultTimeoutMs}ms`);
|
|
998
|
+
if (agent.defaultAcceptance !== undefined)
|
|
999
|
+
lines.push(`Acceptance: ${typeof agent.defaultAcceptance === "object" ? JSON.stringify(agent.defaultAcceptance) : String(agent.defaultAcceptance)}`);
|
|
1000
|
+
if (agent.acceptanceRole)
|
|
1001
|
+
lines.push(`Acceptance role: ${agent.acceptanceRole}`);
|
|
1002
|
+
if (agent.source === "builtin")
|
|
1003
|
+
lines.push(`Disabled: ${agent.disabled ? "true" : "false"}`);
|
|
1004
|
+
if (agent.extensions !== undefined)
|
|
1005
|
+
lines.push(`Extensions: ${agent.extensions.length ? agent.extensions.join(", ") : "(none)"}`);
|
|
1006
|
+
if (agent.subagentOnlyExtensions !== undefined)
|
|
1007
|
+
lines.push(`Subagent-only extensions: ${agent.subagentOnlyExtensions.length ? agent.subagentOnlyExtensions.join(", ") : "(none)"}`);
|
|
1008
|
+
if (agent.mutationTools !== undefined)
|
|
1009
|
+
lines.push(`Mutation tools: ${agent.mutationTools.length ? agent.mutationTools.join(", ") : "(none)"}`);
|
|
1010
|
+
if (agent.thinking)
|
|
1011
|
+
lines.push(`Thinking: ${agent.thinking}`);
|
|
1012
|
+
if (agent.output)
|
|
1013
|
+
lines.push(`Output: ${agent.output}`);
|
|
1014
|
+
if (agent.outputMode)
|
|
1015
|
+
lines.push(`Output mode: ${agent.outputMode}`);
|
|
1016
|
+
if (agent.defaultReads?.length)
|
|
1017
|
+
lines.push(`Reads: ${agent.defaultReads.join(", ")}`);
|
|
1018
|
+
if (agent.defaultProgress)
|
|
1019
|
+
lines.push("Progress: true");
|
|
1020
|
+
if (agent.maxSubagentDepth !== undefined)
|
|
1021
|
+
lines.push(`Max subagent depth: ${agent.maxSubagentDepth}`);
|
|
1022
|
+
if (agent.completionGuard === false)
|
|
1023
|
+
lines.push("Completion guard: false");
|
|
1024
|
+
if (agent.toolBudget)
|
|
1025
|
+
lines.push(`Tool budget: ${JSON.stringify(agent.toolBudget)}`);
|
|
1026
|
+
if (agent.memory)
|
|
1027
|
+
lines.push(`Memory: ${agent.memory.scope} scope, path: ${agent.memory.path}`);
|
|
1028
|
+
if (agent.systemPrompt.trim())
|
|
1029
|
+
lines.push("", "System Prompt:", agent.systemPrompt);
|
|
1030
|
+
return lines.join("\n");
|
|
1031
|
+
}
|
|
1032
|
+
export function handleList(params, ctx) {
|
|
1033
|
+
const scope = normalizeListScope(params.agentScope) ?? "both";
|
|
1034
|
+
const d = discoverAgentsAll(ctx.cwd, ctx.model?.provider);
|
|
1035
|
+
let scopedAgents = effectiveAgentsForScope(scope, d, ctx.runtimeAgentOwner);
|
|
1036
|
+
scopedAgents = scopedAgents
|
|
1037
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
1038
|
+
const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.currentSessionId);
|
|
1039
|
+
const visibleAgents = scopedAgents.filter((a) => !a.disabled);
|
|
1040
|
+
const agents = visibleAgents.filter((a) => isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
|
|
1041
|
+
const restrictedAgents = visibleAgents.filter((a) => !isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
|
|
1042
|
+
const restrictedSources = capabilityCeilingAgentRestrictionSources(capabilityCeiling);
|
|
1043
|
+
const proactiveSuggestions = buildProactiveSkillSubagentRecommendationLines({
|
|
1044
|
+
agents,
|
|
1045
|
+
...(ctx.config?.proactiveSkillSubagents !== undefined ? { config: ctx.config.proactiveSkillSubagents } : {}),
|
|
1046
|
+
discoverAvailableSkills: () => discoverAvailableSkills(ctx.cwd),
|
|
1047
|
+
});
|
|
1048
|
+
const providerStatus = registeredExternalJobProviderStatus();
|
|
1049
|
+
const providerNameSet = providerNames(providerStatus);
|
|
1050
|
+
const capabilityMode = params.capabilities === true;
|
|
1051
|
+
const externalCliAvailability = capabilityMode ? externalCliAvailabilityForAgents([...agents, ...restrictedAgents]) : undefined;
|
|
1052
|
+
const formatLine = capabilityMode
|
|
1053
|
+
? (agent, names) => formatAgentCapabilitiesLine(agent, names, externalCliAvailability)
|
|
1054
|
+
: formatAgentListLine;
|
|
1055
|
+
const lines = [
|
|
1056
|
+
capabilityMode ? "Executable agents (capabilities):" : "Executable agents:",
|
|
1057
|
+
...formatAgentListSections(agents, providerNameSet, formatLine),
|
|
1058
|
+
];
|
|
1059
|
+
appendRestrictedAgentLines({ lines, agents: restrictedAgents, sources: restrictedSources, providerNames: providerNameSet, formatLine });
|
|
1060
|
+
appendExternalJobRegistryLine(lines, [...agents, ...restrictedAgents], providerStatus);
|
|
1061
|
+
appendAgentDiagnosticLines(lines, d.agentDiagnostics);
|
|
1062
|
+
if (proactiveSuggestions.length)
|
|
1063
|
+
lines.push("", ...proactiveSuggestions);
|
|
1064
|
+
return result(lines.join("\n"), false, agentCapabilityDetails({
|
|
1065
|
+
capabilityMode,
|
|
1066
|
+
agents,
|
|
1067
|
+
restrictedAgents,
|
|
1068
|
+
providerNames: providerNameSet,
|
|
1069
|
+
externalCliAvailability: externalCliAvailability ?? new Map(),
|
|
1070
|
+
restrictedSources,
|
|
1071
|
+
}));
|
|
1072
|
+
}
|
|
1073
|
+
function formatModelSource(agent, currentModel) {
|
|
1074
|
+
if (agent.override && agent.model !== agent.override.base.model) {
|
|
1075
|
+
return `${agent.override.scope} override`;
|
|
1076
|
+
}
|
|
1077
|
+
if (agent.modelSource?.type === "subagents.defaultModel" && agent.model === agent.modelSource.model) {
|
|
1078
|
+
return `${agent.modelSource.scope} defaultModel`;
|
|
1079
|
+
}
|
|
1080
|
+
if (agent.model)
|
|
1081
|
+
return `${agent.source} agent config`;
|
|
1082
|
+
if (currentModel)
|
|
1083
|
+
return "inherits current session model";
|
|
1084
|
+
return "inherit requested, but no current session model is available";
|
|
1085
|
+
}
|
|
1086
|
+
function handleModels(params, ctx) {
|
|
1087
|
+
const requestedAgent = params.agent?.trim();
|
|
1088
|
+
const scope = normalizeListScope(params.agentScope);
|
|
1089
|
+
if (!scope)
|
|
1090
|
+
return result("agentScope must be 'user', 'project', or 'both' for models.", true);
|
|
1091
|
+
const discovered = discoverAgentsAll(ctx.cwd, ctx.model?.provider);
|
|
1092
|
+
const effectiveAgents = effectiveAgentsForScope(scope, discovered, ctx.runtimeAgentOwner)
|
|
1093
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
1094
|
+
const availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
1095
|
+
const currentModel = ctx.model ? { provider: ctx.model.provider, id: ctx.model.id } : undefined;
|
|
1096
|
+
const preferredProvider = ctx.model?.provider;
|
|
1097
|
+
const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.currentSessionId);
|
|
1098
|
+
let selectedAgents = effectiveAgents;
|
|
1099
|
+
if (requestedAgent) {
|
|
1100
|
+
const matches = findAgentsInDiscovery(requestedAgent, discovered, scope, ctx.runtimeAgentOwner);
|
|
1101
|
+
const diagnostics = diagnosticsForScope(discovered.agentDiagnostics, scope);
|
|
1102
|
+
const normalizedName = sanitizeName(requestedAgent);
|
|
1103
|
+
const diagnostic = findBlockingAgentDiagnostic(requestedAgent, matches, diagnostics)
|
|
1104
|
+
?? (normalizedName !== requestedAgent ? findBlockingAgentDiagnostic(normalizedName, matches, diagnostics) : undefined);
|
|
1105
|
+
if (diagnostic)
|
|
1106
|
+
return result(`Agent '${params.agent}' has invalid configuration: ${diagnostic.error}`, true);
|
|
1107
|
+
const distinctNames = [...new Set(matches.map((agent) => agent.name))];
|
|
1108
|
+
if (distinctNames.length > 1)
|
|
1109
|
+
return result(`Ambiguous agent alias or name '${params.agent}': ${distinctNames.sort((a, b) => a.localeCompare(b)).join(", ")}`, true);
|
|
1110
|
+
if (!matches.length) {
|
|
1111
|
+
return result(`Agent '${params.agent}' not found. Available: ${availableAgentNamesFromDiscovery(discovered, ctx.runtimeAgentOwner).join(", ") || "none"}.`, true);
|
|
1112
|
+
}
|
|
1113
|
+
selectedAgents = [matches[0]];
|
|
1114
|
+
}
|
|
1115
|
+
const lines = [
|
|
1116
|
+
requestedAgent ? "Subagent model" : "Subagent models",
|
|
1117
|
+
"",
|
|
1118
|
+
...(requestedAgent ? [] : [
|
|
1119
|
+
"Current session model:",
|
|
1120
|
+
` ${currentModel ? `${currentModel.provider}/${currentModel.id}` : "(unavailable)"}`,
|
|
1121
|
+
"",
|
|
1122
|
+
]),
|
|
1123
|
+
];
|
|
1124
|
+
const modelEntries = selectedAgents.flatMap((agent) => requestedAgent
|
|
1125
|
+
? [{ agent, name: requestedAgent }]
|
|
1126
|
+
: [{ agent, name: agent.name }, ...(agent.aliases ?? []).map((name) => ({ agent, name }))]);
|
|
1127
|
+
for (const { agent, name } of modelEntries) {
|
|
1128
|
+
const resolvedModel = resolveSubagentModelOverride(agent.model, currentModel, availableModels, agent.modelProvider ?? preferredProvider);
|
|
1129
|
+
const effectiveThinking = resolveEffectiveThinking(resolvedModel, agent.thinking)
|
|
1130
|
+
?? (agent.thinking === false ? "off" : undefined);
|
|
1131
|
+
const source = `${formatModelSource(agent, currentModel)}${agent.disabled ? "; disabled" : ""}${isAgentAllowedByCapabilityCeiling(agent.name, capabilityCeiling) ? "" : "; restricted"}`;
|
|
1132
|
+
if (requestedAgent) {
|
|
1133
|
+
lines.push(`Agent: ${requestedAgent}`);
|
|
1134
|
+
lines.push("Effective model:");
|
|
1135
|
+
lines.push(` ${resolvedModel ?? "(unresolved)"}`);
|
|
1136
|
+
lines.push(`Source: ${source}`);
|
|
1137
|
+
lines.push(`Thinking: ${effectiveThinking ?? "default"}`);
|
|
1138
|
+
if (agent.override) {
|
|
1139
|
+
lines.push("Override file:");
|
|
1140
|
+
lines.push(` ${agent.override.path}`);
|
|
1141
|
+
}
|
|
1142
|
+
if (agent.model && resolvedModel && agent.model !== resolvedModel) {
|
|
1143
|
+
lines.push("Requested model setting:");
|
|
1144
|
+
lines.push(` ${agent.model}`);
|
|
1145
|
+
}
|
|
1146
|
+
if (agent.disabled)
|
|
1147
|
+
lines.push("Disabled: true");
|
|
1148
|
+
if (!isAgentAllowedByCapabilityCeiling(agent.name, capabilityCeiling))
|
|
1149
|
+
lines.push("Restricted: true");
|
|
1150
|
+
lines.push("Current session model:");
|
|
1151
|
+
lines.push(` ${currentModel ? `${currentModel.provider}/${currentModel.id}` : "(unavailable)"}`);
|
|
1152
|
+
break;
|
|
1153
|
+
}
|
|
1154
|
+
lines.push(name);
|
|
1155
|
+
lines.push(" model:");
|
|
1156
|
+
lines.push(` ${resolvedModel ?? "(unresolved)"}`);
|
|
1157
|
+
lines.push(` source: ${source}`);
|
|
1158
|
+
lines.push(` thinking: ${effectiveThinking ?? "default"}`);
|
|
1159
|
+
if (agent.override) {
|
|
1160
|
+
lines.push(" override file:");
|
|
1161
|
+
lines.push(` ${agent.override.path}`);
|
|
1162
|
+
}
|
|
1163
|
+
if (agent.model && resolvedModel && agent.model !== resolvedModel) {
|
|
1164
|
+
lines.push(" requested model setting:");
|
|
1165
|
+
lines.push(` ${agent.model}`);
|
|
1166
|
+
}
|
|
1167
|
+
lines.push("");
|
|
1168
|
+
}
|
|
1169
|
+
const availableFullIds = availableModels.map((m) => m.fullId).sort();
|
|
1170
|
+
if (!requestedAgent && availableFullIds.length > 0) {
|
|
1171
|
+
lines.push("Available models in this session's registry (copy an exact provider/id when passing model):");
|
|
1172
|
+
lines.push("");
|
|
1173
|
+
const shown = availableFullIds.slice(0, 80);
|
|
1174
|
+
for (const fullId of shown)
|
|
1175
|
+
lines.push(` ${fullId}`);
|
|
1176
|
+
if (availableFullIds.length > shown.length)
|
|
1177
|
+
lines.push(` ... and ${availableFullIds.length - shown.length} more`);
|
|
1178
|
+
lines.push("");
|
|
1179
|
+
lines.push("Use an exact provider/id from this list when you pass model; bare ids resolve only when unique in the registry.");
|
|
1180
|
+
}
|
|
1181
|
+
if (!requestedAgent)
|
|
1182
|
+
appendAgentDiagnosticLines(lines, diagnosticsForScope(discovered.agentDiagnostics, scope));
|
|
1183
|
+
return result(lines.join("\n"));
|
|
1184
|
+
}
|
|
1185
|
+
function handleGet(params, ctx) {
|
|
1186
|
+
if (!params.agent)
|
|
1187
|
+
return result("Specify 'agent' for get.", true);
|
|
1188
|
+
const scope = normalizeListScope(params.agentScope);
|
|
1189
|
+
if (!scope)
|
|
1190
|
+
return result("agentScope must be 'user', 'project', or 'both' for get.", true);
|
|
1191
|
+
const discovered = discoverAgentsAll(ctx.cwd, ctx.model?.provider);
|
|
1192
|
+
const matches = findAgentsInDiscovery(params.agent, discovered, scope);
|
|
1193
|
+
const diagnostics = diagnosticsForScope(discovered.agentDiagnostics, scope);
|
|
1194
|
+
const rawName = params.agent.trim();
|
|
1195
|
+
const normalizedName = sanitizeName(rawName);
|
|
1196
|
+
const diagnostic = findBlockingAgentDiagnostic(rawName, matches, diagnostics)
|
|
1197
|
+
?? (normalizedName !== rawName ? findBlockingAgentDiagnostic(normalizedName, matches, diagnostics) : undefined);
|
|
1198
|
+
if (diagnostic)
|
|
1199
|
+
return result(`Agent '${params.agent}' has invalid configuration: ${diagnostic.error}`, true);
|
|
1200
|
+
const distinctNames = [...new Set(matches.map((agent) => agent.name))];
|
|
1201
|
+
if (distinctNames.length > 1)
|
|
1202
|
+
return result(`Ambiguous agent alias or name '${params.agent}': ${distinctNames.sort((a, b) => a.localeCompare(b)).join(", ")}`, true);
|
|
1203
|
+
if (!matches.length) {
|
|
1204
|
+
return result(`Agent '${params.agent}' not found. Available: ${availableAgentNamesFromDiscovery(discovered).join(", ") || "none"}.`, true);
|
|
1205
|
+
}
|
|
1206
|
+
return result(matches.map(formatAgentDetail).join("\n\n"));
|
|
1207
|
+
}
|
|
1208
|
+
export function handleCreate(params, ctx) {
|
|
1209
|
+
const parsedConfig = configObject(params.config);
|
|
1210
|
+
if (parsedConfig.status === "error")
|
|
1211
|
+
return result(parsedConfig.message, true);
|
|
1212
|
+
if (parsedConfig.status === "missing")
|
|
1213
|
+
return result("config required for create.", true);
|
|
1214
|
+
const cfg = parsedConfig.value;
|
|
1215
|
+
if (typeof cfg.name !== "string" || !cfg.name.trim())
|
|
1216
|
+
return result("config.name is required and must be a non-empty string.", true);
|
|
1217
|
+
if (typeof cfg.description !== "string" || !cfg.description.trim())
|
|
1218
|
+
return result("config.description is required and must be a non-empty string.", true);
|
|
1219
|
+
const name = sanitizeName(cfg.name);
|
|
1220
|
+
if (!name)
|
|
1221
|
+
return result("config.name is invalid after sanitization. Use letters, numbers, spaces, or hyphens.", true);
|
|
1222
|
+
const parsedPackage = parsePackageConfig(cfg.package);
|
|
1223
|
+
if (parsedPackage.error)
|
|
1224
|
+
return result(parsedPackage.error, true);
|
|
1225
|
+
const runtimeName = buildRuntimeName(name, parsedPackage.packageName);
|
|
1226
|
+
const scopeRaw = cfg.scope ?? "user";
|
|
1227
|
+
if (scopeRaw !== "user" && scopeRaw !== "project")
|
|
1228
|
+
return result("config.scope must be 'user' or 'project'.", true);
|
|
1229
|
+
const scope = scopeRaw;
|
|
1230
|
+
if (hasKey(cfg, "steps"))
|
|
1231
|
+
return result("Durable chain definitions were removed; use workflowScript or /prompt-workflow for repeatable workflows.", true);
|
|
1232
|
+
const d = discoverAgentsAll(ctx.cwd);
|
|
1233
|
+
const projectConfigDir = getProjectConfigDir(ctx.cwd);
|
|
1234
|
+
const targetDir = scope === "user" ? d.userDir : d.projectDir ?? path.join(projectConfigDir, "agents");
|
|
1235
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
1236
|
+
if (nameExistsInScope(ctx.cwd, scope, runtimeName))
|
|
1237
|
+
return result(`Name '${runtimeName}' already exists in ${scope} scope. Use update instead.`, true);
|
|
1238
|
+
const targetPath = path.join(targetDir, `${runtimeName}.md`);
|
|
1239
|
+
if (fs.existsSync(targetPath))
|
|
1240
|
+
return result(`File already exists at ${targetPath} but is not a valid agent definition. Remove or rename it first.`, true);
|
|
1241
|
+
const warnings = [];
|
|
1242
|
+
if (d.builtin.some((a) => a.name === runtimeName))
|
|
1243
|
+
warnings.push(`Note: this shadows the builtin agent '${runtimeName}'.`);
|
|
1244
|
+
const agent = {
|
|
1245
|
+
name: runtimeName,
|
|
1246
|
+
localName: name,
|
|
1247
|
+
...(parsedPackage.packageName !== undefined ? { packageName: parsedPackage.packageName } : {}),
|
|
1248
|
+
description: cfg.description.trim(),
|
|
1249
|
+
source: scope,
|
|
1250
|
+
filePath: targetPath,
|
|
1251
|
+
systemPrompt: "",
|
|
1252
|
+
systemPromptMode: defaultSystemPromptMode(name),
|
|
1253
|
+
inheritProjectContext: defaultInheritProjectContext(name),
|
|
1254
|
+
inheritGlobalContext: false,
|
|
1255
|
+
inheritSkills: defaultInheritSkills(),
|
|
1256
|
+
};
|
|
1257
|
+
const applyError = applyAgentConfig(agent, cfg);
|
|
1258
|
+
if (applyError)
|
|
1259
|
+
return result(applyError, true);
|
|
1260
|
+
const profileError = validateCodeOwnedProfileRunner(agent);
|
|
1261
|
+
if (profileError)
|
|
1262
|
+
return result(profileError, true);
|
|
1263
|
+
const mw = modelWarning(ctx, agent.model);
|
|
1264
|
+
if (mw)
|
|
1265
|
+
warnings.push(mw);
|
|
1266
|
+
const sw = skillsWarning(ctx.cwd, agent);
|
|
1267
|
+
if (sw)
|
|
1268
|
+
warnings.push(sw);
|
|
1269
|
+
fs.writeFileSync(targetPath, serializeAgent(agent), "utf-8");
|
|
1270
|
+
ctx.onAgentsChanged?.();
|
|
1271
|
+
return result([`Created agent '${runtimeName}' at ${targetPath}.`, ...warnings].join("\n"));
|
|
1272
|
+
}
|
|
1273
|
+
export function handleUpdate(params, ctx) {
|
|
1274
|
+
if (!params.agent)
|
|
1275
|
+
return result("Specify 'agent' for update.", true);
|
|
1276
|
+
const parsedConfig = configObject(params.config);
|
|
1277
|
+
if (parsedConfig.status === "error")
|
|
1278
|
+
return result(parsedConfig.message, true);
|
|
1279
|
+
if (parsedConfig.status === "missing")
|
|
1280
|
+
return result("config required for update.", true);
|
|
1281
|
+
const cfg = parsedConfig.value;
|
|
1282
|
+
if (hasKey(cfg, "steps"))
|
|
1283
|
+
return result("Durable chain definitions were removed; use workflowScript or /prompt-workflow for repeatable workflows.", true);
|
|
1284
|
+
const warnings = [];
|
|
1285
|
+
const scopeHint = asDisambiguationScope(params.agentScope);
|
|
1286
|
+
const targetOrError = resolveTarget(params.agent, findAgents(params.agent, ctx.cwd, scopeHint ?? "both"), ctx.cwd, scopeHint);
|
|
1287
|
+
if ("content" in targetOrError)
|
|
1288
|
+
return targetOrError;
|
|
1289
|
+
const target = targetOrError;
|
|
1290
|
+
if (target.source !== "user" && target.source !== "project")
|
|
1291
|
+
return result(`Cannot update ${target.source} agent '${target.name}'. Eject it to user or project scope first.`, true);
|
|
1292
|
+
let updated;
|
|
1293
|
+
try {
|
|
1294
|
+
updated = editableAgentConfig(target);
|
|
1295
|
+
}
|
|
1296
|
+
catch (error) {
|
|
1297
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1298
|
+
return result(`Could not reread agent definition ${target.filePath} before updating '${target.name}': ${message}`, true);
|
|
1299
|
+
}
|
|
1300
|
+
const oldName = target.name;
|
|
1301
|
+
if (hasKey(cfg, "name") && (typeof cfg.name !== "string" || !cfg.name.trim()))
|
|
1302
|
+
return result("config.name must be a non-empty string when provided.", true);
|
|
1303
|
+
if (hasKey(cfg, "description") && (typeof cfg.description !== "string" || !cfg.description.trim()))
|
|
1304
|
+
return result("config.description must be a non-empty string when provided.", true);
|
|
1305
|
+
let newLocalName = target.localName ?? frontmatterNameForConfig(target);
|
|
1306
|
+
if (hasKey(cfg, "name")) {
|
|
1307
|
+
newLocalName = sanitizeName(cfg.name);
|
|
1308
|
+
if (!newLocalName)
|
|
1309
|
+
return result("config.name is invalid after sanitization.", true);
|
|
1310
|
+
}
|
|
1311
|
+
let newPackageName = target.packageName;
|
|
1312
|
+
if (hasKey(cfg, "package")) {
|
|
1313
|
+
const parsedPackage = parsePackageConfig(cfg.package);
|
|
1314
|
+
if (parsedPackage.error)
|
|
1315
|
+
return result(parsedPackage.error, true);
|
|
1316
|
+
newPackageName = parsedPackage.packageName;
|
|
1317
|
+
}
|
|
1318
|
+
const applyError = applyAgentConfig(updated, cfg);
|
|
1319
|
+
if (applyError)
|
|
1320
|
+
return result(applyError, true);
|
|
1321
|
+
const preserveFrontmatterFields = preservedAgentFrontmatterFields(target, cfg);
|
|
1322
|
+
updated.localName = newLocalName;
|
|
1323
|
+
if (newPackageName !== undefined)
|
|
1324
|
+
updated.packageName = newPackageName;
|
|
1325
|
+
else
|
|
1326
|
+
delete updated.packageName;
|
|
1327
|
+
updated.name = buildRuntimeName(newLocalName, newPackageName);
|
|
1328
|
+
const profileError = validateCodeOwnedProfileRunner(updated);
|
|
1329
|
+
if (profileError)
|
|
1330
|
+
return result(profileError, true);
|
|
1331
|
+
if (hasKey(cfg, "description"))
|
|
1332
|
+
updated.description = cfg.description.trim();
|
|
1333
|
+
if (hasKey(cfg, "model")) {
|
|
1334
|
+
const mw = modelWarning(ctx, updated.model);
|
|
1335
|
+
if (mw)
|
|
1336
|
+
warnings.push(mw);
|
|
1337
|
+
}
|
|
1338
|
+
if (hasKey(cfg, "skills") || hasKey(cfg, "skillPath")) {
|
|
1339
|
+
const sw = skillsWarning(ctx.cwd, updated);
|
|
1340
|
+
if (sw)
|
|
1341
|
+
warnings.push(sw);
|
|
1342
|
+
}
|
|
1343
|
+
if (updated.name !== oldName) {
|
|
1344
|
+
const renamed = renamePath(target.filePath, updated.name, target.source, ctx.cwd);
|
|
1345
|
+
if (renamed.error)
|
|
1346
|
+
return result(renamed.error, true);
|
|
1347
|
+
updated.filePath = renamed.filePath;
|
|
1348
|
+
}
|
|
1349
|
+
fs.writeFileSync(updated.filePath, serializeAgent(updated, { preserveFrontmatterFields }), "utf-8");
|
|
1350
|
+
ctx.onAgentsChanged?.();
|
|
1351
|
+
const headline = updated.name === oldName
|
|
1352
|
+
? `Updated agent '${updated.name}' at ${updated.filePath}.`
|
|
1353
|
+
: `Updated agent '${oldName}' to '${updated.name}' at ${updated.filePath}.`;
|
|
1354
|
+
return result([headline, ...warnings].join("\n"));
|
|
1355
|
+
}
|
|
1356
|
+
function handleDelete(params, ctx) {
|
|
1357
|
+
if (!params.agent)
|
|
1358
|
+
return result("Specify 'agent' for delete.", true);
|
|
1359
|
+
const scopeHint = asDisambiguationScope(params.agentScope);
|
|
1360
|
+
const targetOrError = resolveTarget(params.agent, findAgents(params.agent, ctx.cwd, scopeHint ?? "both"), ctx.cwd, scopeHint);
|
|
1361
|
+
if ("content" in targetOrError)
|
|
1362
|
+
return targetOrError;
|
|
1363
|
+
const target = targetOrError;
|
|
1364
|
+
fs.unlinkSync(target.filePath);
|
|
1365
|
+
ctx.onAgentsChanged?.();
|
|
1366
|
+
return result(`Deleted agent '${target.name}' at ${target.filePath}.`);
|
|
1367
|
+
}
|
|
1368
|
+
function handleEject(params, ctx) {
|
|
1369
|
+
if (!params.agent)
|
|
1370
|
+
return result("Specify 'agent' for eject.", true);
|
|
1371
|
+
const raw = params.agent.trim();
|
|
1372
|
+
const sanitized = sanitizeName(raw);
|
|
1373
|
+
const parsedScope = actionScope(params.agentScope, "eject");
|
|
1374
|
+
if (parsedScope.error)
|
|
1375
|
+
return parsedScope.error;
|
|
1376
|
+
const scope = parsedScope.scope;
|
|
1377
|
+
const d = discoverAgentsAll(ctx.cwd);
|
|
1378
|
+
const source = [...d.package, ...d.builtin].find((a) => a.name === raw || a.name === sanitized);
|
|
1379
|
+
if (!source) {
|
|
1380
|
+
return result(`Agent '${raw}' not found or is not a bundled/package agent. eject copies a builtin or package agent to ${scope} scope so it can be customized. Available: ${availableAgentNames(ctx.cwd).join(", ") || "none"}.`, true);
|
|
1381
|
+
}
|
|
1382
|
+
const runtimeName = source.name;
|
|
1383
|
+
const existingCustom = (scope === "user" ? d.user : d.project).find((a) => a.name === runtimeName);
|
|
1384
|
+
if (existingCustom) {
|
|
1385
|
+
return result(`Agent '${runtimeName}' is already a custom ${scope} agent at ${existingCustom.filePath}. Edit it with { action: "update", agent: "${runtimeName}" } or delete it first.`, true);
|
|
1386
|
+
}
|
|
1387
|
+
if (nameExistsInScope(ctx.cwd, scope, runtimeName)) {
|
|
1388
|
+
return result(`An agent named '${runtimeName}' already exists in ${scope} scope. Remove or rename it first.`, true);
|
|
1389
|
+
}
|
|
1390
|
+
const projectConfigDir = getProjectConfigDir(ctx.cwd);
|
|
1391
|
+
const targetDir = scope === "user" ? d.userDir : d.projectDir ?? path.join(projectConfigDir, "agents");
|
|
1392
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
1393
|
+
const targetPath = path.join(targetDir, `${runtimeName}.md`);
|
|
1394
|
+
if (fs.existsSync(targetPath)) {
|
|
1395
|
+
return result(`File already exists at ${targetPath} but is not a valid agent definition. Remove or rename it first.`, true);
|
|
1396
|
+
}
|
|
1397
|
+
let content;
|
|
1398
|
+
try {
|
|
1399
|
+
content = fs.readFileSync(source.filePath, "utf-8");
|
|
1400
|
+
}
|
|
1401
|
+
catch (error) {
|
|
1402
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1403
|
+
return result(`Failed to read source agent at ${source.filePath}: ${message}`, true);
|
|
1404
|
+
}
|
|
1405
|
+
fs.writeFileSync(targetPath, content, "utf-8");
|
|
1406
|
+
ctx.onAgentsChanged?.();
|
|
1407
|
+
return result(`Ejected agent '${runtimeName}' from ${source.source} to ${scope} scope at ${targetPath}. Edit it there to customize; it shadows the bundled ${source.source} agent of the same name.`);
|
|
1408
|
+
}
|
|
1409
|
+
function handleDisable(params, ctx) {
|
|
1410
|
+
if (!params.agent)
|
|
1411
|
+
return result("Specify 'agent' for disable.", true);
|
|
1412
|
+
const raw = params.agent.trim();
|
|
1413
|
+
const parsedScope = actionScope(params.agentScope, "disable");
|
|
1414
|
+
if (parsedScope.error)
|
|
1415
|
+
return parsedScope.error;
|
|
1416
|
+
const scope = parsedScope.scope;
|
|
1417
|
+
const d = discoverAgentsAll(ctx.cwd);
|
|
1418
|
+
if (scope === "project" && d.projectSettingsPath === null) {
|
|
1419
|
+
return result("Project override is not available here: no project config root (.pi or .agents) was found above the cwd. Use agentScope: 'user' or run from inside a project.", true);
|
|
1420
|
+
}
|
|
1421
|
+
const effective = resolveEffectiveAgent(d, raw);
|
|
1422
|
+
if (effective.error)
|
|
1423
|
+
return result(effective.error, true);
|
|
1424
|
+
if (!effective.agent) {
|
|
1425
|
+
return result(`Agent '${raw}' not found. Available: ${availableAgentNames(ctx.cwd).join(", ") || "none"}.`, true);
|
|
1426
|
+
}
|
|
1427
|
+
const runtimeName = effective.agent.name;
|
|
1428
|
+
const settingsPath = mergeBuiltinAgentOverride(ctx.cwd, runtimeName, scope, { disabled: true });
|
|
1429
|
+
const after = resolveEffectiveAgent(discoverAgentsAll(ctx.cwd), raw).agent;
|
|
1430
|
+
if (after?.disabled === true) {
|
|
1431
|
+
ctx.onAgentsChanged?.();
|
|
1432
|
+
return result(`Disabled agent '${runtimeName}' via ${scope} settings override at ${settingsPath}. It is now hidden from runtime discovery and { action: "list" }.`);
|
|
1433
|
+
}
|
|
1434
|
+
return result(`Wrote a disabled override for '${runtimeName}' at ${settingsPath}, but the agent is still enabled. A higher-precedence ${after?.override?.scope ?? "project"} override is likely winning. Try agentScope: '${after?.override?.scope ?? "project"}'.`, true);
|
|
1435
|
+
}
|
|
1436
|
+
function handleEnable(params, ctx) {
|
|
1437
|
+
if (!params.agent)
|
|
1438
|
+
return result("Specify 'agent' for enable.", true);
|
|
1439
|
+
const raw = params.agent.trim();
|
|
1440
|
+
const parsedScope = actionScope(params.agentScope, "enable");
|
|
1441
|
+
if (parsedScope.error)
|
|
1442
|
+
return parsedScope.error;
|
|
1443
|
+
const scope = parsedScope.scope;
|
|
1444
|
+
const d = discoverAgentsAll(ctx.cwd);
|
|
1445
|
+
if (scope === "project" && d.projectSettingsPath === null) {
|
|
1446
|
+
return result("Project override is not available here: no project config root (.pi or .agents) was found above the cwd. Use agentScope: 'user' or run from inside a project.", true);
|
|
1447
|
+
}
|
|
1448
|
+
const effective = resolveEffectiveAgent(d, raw);
|
|
1449
|
+
if (effective.error)
|
|
1450
|
+
return result(effective.error, true);
|
|
1451
|
+
if (!effective.agent) {
|
|
1452
|
+
return result(`Agent '${raw}' not found. Available: ${availableAgentNames(ctx.cwd).join(", ") || "none"}.`, true);
|
|
1453
|
+
}
|
|
1454
|
+
const runtimeName = effective.agent.name;
|
|
1455
|
+
const { path: settingsPath, removed } = removeBuiltinAgentOverrideFields(ctx.cwd, runtimeName, scope, ["disabled"]);
|
|
1456
|
+
const after = resolveEffectiveAgent(discoverAgentsAll(ctx.cwd), raw).agent;
|
|
1457
|
+
if (after && after.disabled !== true) {
|
|
1458
|
+
if (removed)
|
|
1459
|
+
ctx.onAgentsChanged?.();
|
|
1460
|
+
if (removed)
|
|
1461
|
+
return result(`Enabled agent '${runtimeName}' (removed disabled override at ${settingsPath}).`);
|
|
1462
|
+
return result(`Agent '${runtimeName}' is already enabled.`);
|
|
1463
|
+
}
|
|
1464
|
+
if (after?.override?.scope && after.override.scope !== scope) {
|
|
1465
|
+
return result(`Agent '${runtimeName}' is still disabled via a ${after.override.scope} scope override at ${after.override.path}. Specify agentScope: '${after.override.scope}' to enable it.`, true);
|
|
1466
|
+
}
|
|
1467
|
+
return result(`Agent '${runtimeName}' is still disabled after removing the ${scope} disabled override. It may be hidden via subagents.disableBuiltins in ${after?.override?.scope ?? scope} settings at ${after?.override?.path ?? settingsPath}.`, true);
|
|
1468
|
+
}
|
|
1469
|
+
function handleReset(params, ctx) {
|
|
1470
|
+
if (!params.agent)
|
|
1471
|
+
return result("Specify 'agent' for reset.", true);
|
|
1472
|
+
const raw = params.agent.trim();
|
|
1473
|
+
const sanitized = sanitizeName(raw);
|
|
1474
|
+
const parsedScope = actionScope(params.agentScope, "reset");
|
|
1475
|
+
if (parsedScope.error)
|
|
1476
|
+
return parsedScope.error;
|
|
1477
|
+
const scope = parsedScope.scope;
|
|
1478
|
+
const d = discoverAgentsAll(ctx.cwd);
|
|
1479
|
+
if (scope === "project" && d.projectSettingsPath === null) {
|
|
1480
|
+
return result("Project override is not available here: no project config root (.pi or .agents) was found above the cwd. Use agentScope: 'user' or run from inside a project.", true);
|
|
1481
|
+
}
|
|
1482
|
+
const bundled = [...d.package, ...d.builtin].find((a) => a.name === raw || a.name === sanitized);
|
|
1483
|
+
if (!bundled) {
|
|
1484
|
+
const custom = [...d.user, ...d.project].find((a) => a.name === raw || a.name === sanitized);
|
|
1485
|
+
if (custom) {
|
|
1486
|
+
return result(`Agent '${raw}' has no bundled default to reset to. Use { action: "delete", agent: "${custom.name}" } to remove the custom ${custom.source} agent.`, true);
|
|
1487
|
+
}
|
|
1488
|
+
return result(`Agent '${raw}' not found. Available: ${availableAgentNames(ctx.cwd).join(", ") || "none"}.`, true);
|
|
1489
|
+
}
|
|
1490
|
+
const runtimeName = bundled.name;
|
|
1491
|
+
const custom = (scope === "user" ? d.user : d.project).find((a) => a.name === raw || a.name === sanitized);
|
|
1492
|
+
const lines = [];
|
|
1493
|
+
if (custom) {
|
|
1494
|
+
fs.unlinkSync(custom.filePath);
|
|
1495
|
+
lines.push(`Deleted custom ${scope} agent file at ${custom.filePath}.`);
|
|
1496
|
+
}
|
|
1497
|
+
const overrideRemoval = removeBuiltinAgentOverride(ctx.cwd, runtimeName, scope, { preserveMachine: true });
|
|
1498
|
+
if (overrideRemoval.removed)
|
|
1499
|
+
lines.push(`${overrideRemoval.machinePreserved ? "Cleared customization in" : "Removed"} ${scope} settings override at ${overrideRemoval.path}.${overrideRemoval.machinePreserved ? " Retained machine placement." : ""}`);
|
|
1500
|
+
if (lines.length === 0) {
|
|
1501
|
+
const otherScope = scope === "user" ? "project" : "user";
|
|
1502
|
+
const otherCustom = (otherScope === "user" ? d.user : d.project).find((a) => a.name === raw || a.name === sanitized);
|
|
1503
|
+
const hasOtherOverride = bundled.override?.scope === otherScope;
|
|
1504
|
+
const note = (otherCustom || hasOtherOverride)
|
|
1505
|
+
? ` Customization exists in ${otherScope} scope; specify agentScope: '${otherScope}' to reset it.`
|
|
1506
|
+
: "";
|
|
1507
|
+
return result(`Agent '${runtimeName}' has no ${scope} customization to reset.${note} It is at its bundled ${bundled.source} default.`);
|
|
1508
|
+
}
|
|
1509
|
+
lines.push(`Reset agent '${runtimeName}' to its bundled ${bundled.source} default.`);
|
|
1510
|
+
ctx.onAgentsChanged?.();
|
|
1511
|
+
return result(lines.join("\n"));
|
|
1512
|
+
}
|
|
1513
|
+
export function handleManagementAction(action, params, ctx) {
|
|
1514
|
+
switch (action) {
|
|
1515
|
+
case "list": return handleList(params, ctx);
|
|
1516
|
+
case "get": return handleGet(params, ctx);
|
|
1517
|
+
case "models": return handleModels(params, ctx);
|
|
1518
|
+
case "create": return handleCreate(params, ctx);
|
|
1519
|
+
case "update": return handleUpdate(params, ctx);
|
|
1520
|
+
case "delete": return handleDelete(params, ctx);
|
|
1521
|
+
case "eject": return handleEject(params, ctx);
|
|
1522
|
+
case "disable": return handleDisable(params, ctx);
|
|
1523
|
+
case "enable": return handleEnable(params, ctx);
|
|
1524
|
+
case "reset": return handleReset(params, ctx);
|
|
1525
|
+
default: return result(`Unknown action: ${action}`, true);
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
//# sourceMappingURL=agent-management.js.map
|