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