@selesai/code 0.9.10 → 0.9.12
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 +271 -255
- package/dist/cli/args.js +13 -2
- package/dist/cli/args.test.js +8 -0
- package/dist/cli/credential-print.js +4 -4
- package/dist/cli.js +0 -0
- package/dist/config.d.ts +4 -6
- package/dist/config.js +10 -14
- package/dist/core/agent-session-auto-handoff.test.js +24 -1
- package/dist/core/agent-session.d.ts +10 -4
- package/dist/core/agent-session.js +61 -46
- package/dist/core/compaction/branch-summarization.js +30 -30
- package/dist/core/compaction/compaction.js +81 -81
- package/dist/core/compaction/utils.js +2 -2
- package/dist/core/defaults.d.ts +1 -0
- package/dist/core/defaults.js +9 -0
- package/dist/core/export-html/template.css +1066 -1066
- package/dist/core/export-html/template.html +55 -55
- package/dist/core/export-html/template.js +1864 -1864
- package/dist/core/export-html/vendor/highlight.min.js +1212 -1212
- package/dist/core/export-html/vendor/marked.min.js +78 -78
- package/dist/core/extensions/loader.js +108 -35
- package/dist/core/extensions/loader.test.js +21 -0
- package/dist/core/extensions/types.d.ts +12 -4
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/messages.js +7 -7
- package/dist/core/model-resolver.d.ts +1 -0
- package/dist/core/model-resolver.js +10 -4
- package/dist/core/package-manager.js +4 -4
- package/dist/core/sdk.d.ts +5 -5
- package/dist/core/sdk.js +16 -4
- package/dist/core/settings-manager.d.ts +6 -2
- package/dist/core/settings-manager.js +22 -3
- package/dist/core/tools/bash.d.ts +18 -1
- package/dist/core/tools/bash.js +41 -23
- package/dist/core/tools/index.d.ts +4 -2
- package/dist/core/tools/index.js +9 -2
- package/dist/core/tools/powershell.d.ts +15 -0
- package/dist/core/tools/powershell.js +38 -0
- package/dist/core/tools/powershell.test.d.ts +1 -0
- package/dist/core/tools/powershell.test.js +20 -0
- package/dist/defaults/settings.json +0 -1
- package/dist/extensions/context-compaction-reminder.test.ts +82 -82
- package/dist/extensions/context-compaction-reminder.ts +28 -28
- package/dist/extensions/model-prompt-injector/index.test.ts +0 -10
- package/dist/extensions/model-prompt-injector/index.ts +0 -3
- package/dist/extensions/pi-intercom/CHANGELOG.md +53 -16
- package/dist/extensions/pi-intercom/LICENSE +21 -21
- package/dist/extensions/pi-intercom/README.md +41 -8
- package/dist/extensions/pi-intercom/banner.png +0 -0
- package/dist/extensions/pi-intercom/broker/broker.ts +498 -215
- package/dist/extensions/pi-intercom/broker/client.test.ts +83 -83
- package/dist/extensions/pi-intercom/broker/client.ts +39 -12
- package/dist/extensions/pi-intercom/broker/extension.test.ts +486 -387
- package/dist/extensions/pi-intercom/broker/framing.test.ts +114 -114
- package/dist/extensions/pi-intercom/broker/paths.test.ts +153 -153
- package/dist/extensions/pi-intercom/broker/paths.ts +134 -134
- package/dist/extensions/pi-intercom/broker/protocol.ts +26 -0
- package/dist/extensions/pi-intercom/broker/runtime-claim.test.ts +34 -34
- package/dist/extensions/pi-intercom/broker/runtime-claim.ts +21 -21
- package/dist/extensions/pi-intercom/broker/spawn.test.ts +5 -20
- package/dist/extensions/pi-intercom/config.test.ts +41 -0
- package/dist/extensions/pi-intercom/config.ts +21 -0
- package/dist/extensions/pi-intercom/cwd.test.ts +40 -40
- package/dist/extensions/pi-intercom/cwd.ts +31 -31
- package/dist/extensions/pi-intercom/extension-api.ts +84 -44
- package/dist/extensions/pi-intercom/format-context.test.ts +31 -31
- package/dist/extensions/pi-intercom/format-context.ts +32 -32
- package/dist/extensions/pi-intercom/index.ts +362 -26
- package/dist/extensions/pi-intercom/intercom.integration.test.ts +819 -13
- package/dist/extensions/pi-intercom/package.json +1 -1
- package/dist/extensions/pi-intercom/project-agent.ts +2 -2
- package/dist/extensions/pi-intercom/skills/pi-intercom/SKILL.md +8 -110
- package/dist/extensions/pi-intercom/test/overlay-width.test.ts +66 -66
- package/dist/extensions/pi-intercom/types.ts +32 -5
- package/dist/extensions/pi-intercom/ui/compose.ts +143 -143
- package/dist/extensions/pi-intercom/ui/inline-message.ts +6 -0
- package/dist/extensions/pi-intercom/ui/session-list.ts +166 -166
- package/dist/extensions/pi-powerline-footer/bash-mode/shell-session.ts +286 -286
- package/dist/extensions/pi-powerline-footer/bash-mode/transcript.ts +108 -108
- package/dist/extensions/pi-powerline-footer/separators.ts +57 -57
- package/dist/extensions/pi-powerline-footer/tests/session-usage.test.ts +47 -47
- package/dist/extensions/pi-powerline-footer/tests/tps.test.ts +39 -39
- package/dist/extensions/pi-powerline-footer/theme.example.json +24 -24
- package/dist/extensions/pi-powerline-footer/theme.json +12 -12
- package/dist/extensions/pi-powerline-footer/tps.ts +345 -345
- package/dist/extensions/pi-rewind-hook/README.md +245 -245
- package/dist/extensions/pi-rewind-hook/index.ts +1445 -1445
- package/dist/extensions/pi-rewind-hook/package.json +29 -29
- package/dist/extensions/pi-subagents/.github/assets/subagent-fleet-inspector.png +0 -0
- package/dist/extensions/pi-subagents/.github/workflows/release.yml +28 -0
- package/dist/extensions/pi-subagents/.github/workflows/test.yml +51 -0
- package/dist/extensions/pi-subagents/.greptile/config.json +33 -0
- package/dist/extensions/pi-subagents/.greptile/files.json +8 -0
- package/dist/extensions/pi-subagents/.greptile/rules.md +16 -0
- package/dist/extensions/pi-subagents/CHANGELOG.md +309 -87
- package/dist/extensions/pi-subagents/README.md +15 -17
- package/dist/extensions/pi-subagents/agents/oracle.md +3 -1
- package/dist/extensions/pi-subagents/agents/researcher.md +32 -13
- package/dist/extensions/pi-subagents/agents/reviewer.md +13 -2
- package/dist/extensions/pi-subagents/agents/scout.md +2 -2
- package/dist/extensions/pi-subagents/agents/worker.md +2 -1
- package/dist/extensions/pi-subagents/async-retention-discovery-worker.mjs +180 -0
- package/dist/extensions/pi-subagents/docs/configuration.md +106 -27
- package/dist/extensions/pi-subagents/docs/extension-api.md +85 -21
- package/dist/extensions/pi-subagents/docs/missions.md +41 -4
- package/dist/extensions/pi-subagents/docs/models.md +52 -9
- package/dist/extensions/pi-subagents/docs/observability.md +103 -16
- package/dist/extensions/pi-subagents/docs/tool-reference.md +60 -45
- package/dist/extensions/pi-subagents/docs/watchdog.md +60 -3
- package/dist/extensions/pi-subagents/docs/workflows.md +181 -7
- package/dist/extensions/pi-subagents/index.ts +10 -1
- package/dist/extensions/pi-subagents/install.mjs +4 -4
- package/dist/extensions/pi-subagents/package-lock.json +1483 -1470
- package/dist/extensions/pi-subagents/package.json +6 -3
- package/dist/extensions/pi-subagents/prompts/council.md +60 -0
- package/dist/extensions/pi-subagents/prompts/parallel-review.md +5 -1
- package/dist/extensions/pi-subagents/prompts/review-loop.md +9 -5
- package/dist/extensions/pi-subagents/skills/council-mode/SKILL.md +254 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +18 -17
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +31 -9
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +107 -140
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +9 -12
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/multi-lane-orchestration.md +39 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +44 -92
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +261 -368
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +6 -2
- package/dist/extensions/pi-subagents/src/agents/agents.ts +388 -85
- package/dist/extensions/pi-subagents/src/agents/builtin-names.ts +14 -0
- package/dist/extensions/pi-subagents/src/agents/runtime-agent-registry.ts +418 -0
- package/dist/extensions/pi-subagents/src/agents/skills.ts +1 -1
- package/dist/extensions/pi-subagents/src/api/agents.ts +7 -0
- package/dist/extensions/pi-subagents/src/api/external-job-provider.ts +195 -0
- package/dist/extensions/pi-subagents/src/api/preflight.ts +88 -27
- package/dist/extensions/pi-subagents/src/api/project-panes.ts +2 -0
- package/dist/extensions/pi-subagents/src/api/shared-types.ts +2 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +20 -11
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +14 -6
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +5 -4
- package/dist/extensions/pi-subagents/src/extension/index.ts +270 -187
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +65 -28
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +120 -11
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +46 -64
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +51 -37
- package/dist/extensions/pi-subagents/src/extension/tool-result.ts +19 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +2 -2
- package/dist/extensions/pi-subagents/src/inspectors/herdr/client.ts +3 -3
- package/dist/extensions/pi-subagents/src/inspectors/herdr/focus.ts +55 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +2 -1
- package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +230 -46
- package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +26 -4
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +32 -10
- package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +6 -1
- package/dist/extensions/pi-subagents/src/missions/store.ts +4 -9
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +2 -2
- package/dist/extensions/pi-subagents/src/policy/authority.ts +2 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +3 -1
- package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +31 -8
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +210 -52
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +63 -33
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +71 -17
- package/dist/extensions/pi-subagents/src/runs/background/async-retention.ts +886 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-status-snapshot.ts +14 -5
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +49 -56
- package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +1 -0
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +3 -33
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +5 -0
- package/dist/extensions/pi-subagents/src/runs/background/completion-dedupe.ts +5 -1
- package/dist/extensions/pi-subagents/src/runs/background/completion-replay.ts +22 -12
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +105 -71
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +68 -19
- package/dist/extensions/pi-subagents/src/runs/background/index-segment.ts +59 -0
- package/dist/extensions/pi-subagents/src/runs/background/inspect-rpc.ts +443 -0
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +94 -10
- package/dist/extensions/pi-subagents/src/runs/background/result-files.ts +158 -90
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +141 -53
- package/dist/extensions/pi-subagents/src/runs/background/resume-guidance.ts +8 -5
- package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +14 -4
- package/dist/extensions/pi-subagents/src/runs/background/run-id-query.ts +7 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +13 -14
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +46 -25
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +823 -0
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +9 -3
- package/dist/extensions/pi-subagents/src/runs/background/steering.ts +11 -1
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +594 -216
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +17 -13
- package/dist/extensions/pi-subagents/src/runs/background/terminal-run-index.ts +138 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +23 -4
- package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +82 -4
- package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +5 -3
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +21 -14
- package/dist/extensions/pi-subagents/src/runs/foreground/async-stop-action.ts +23 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +153 -58
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +7 -9
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +1283 -1657
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-detach-reconcile.ts +274 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +6 -5
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +59 -10
- package/dist/extensions/pi-subagents/src/runs/shared/agent-contract.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/chain-outputs.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/child-identity.ts +36 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +52 -2
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/extension-bindings.ts +78 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-job-bridge.ts +460 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-job-runner.ts +389 -0
- package/dist/extensions/pi-subagents/src/runs/shared/fast-mode-extension.ts +10 -0
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +14 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-exclusions.ts +243 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +201 -85
- package/dist/extensions/pi-subagents/src/runs/shared/model-scope.ts +106 -39
- package/dist/extensions/pi-subagents/src/runs/shared/mutation-evidence.ts +145 -0
- package/dist/extensions/pi-subagents/src/runs/shared/orca-progress-tabs.ts +150 -27
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +46 -4
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +19 -15
- package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +5 -1
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +86 -2
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +9 -9
- package/dist/extensions/pi-subagents/src/runs/shared/session-lease.ts +0 -6
- package/dist/extensions/pi-subagents/src/runs/shared/structured-output.ts +18 -4
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-control.ts +51 -7
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +62 -21
- package/dist/extensions/pi-subagents/src/runs/shared/tool-availability.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/tool-timeout.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/workflow-graph.ts +1 -23
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +14 -2
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +2 -2
- package/dist/extensions/pi-subagents/src/shared/atomic-json.ts +22 -2
- package/dist/extensions/pi-subagents/src/shared/capacity-resilient-json.ts +102 -0
- package/dist/extensions/pi-subagents/src/shared/completion-owner.ts +14 -0
- package/dist/extensions/pi-subagents/src/shared/file-system-retry.ts +49 -1
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +59 -1
- package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +12 -5
- package/dist/extensions/pi-subagents/src/shared/model-info.ts +20 -0
- package/dist/extensions/pi-subagents/src/shared/prompt-resources.ts +0 -40
- package/dist/extensions/pi-subagents/src/shared/settings.ts +11 -30
- package/dist/extensions/pi-subagents/src/shared/thinking-ceiling.ts +52 -0
- package/dist/extensions/pi-subagents/src/shared/types.ts +228 -49
- package/dist/extensions/pi-subagents/src/shared/utils.ts +11 -3
- package/dist/extensions/pi-subagents/src/shared/watch-strategy.ts +10 -0
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +0 -162
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +2 -5
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +105 -13
- package/dist/extensions/pi-subagents/src/slash/slash-live-state.ts +6 -36
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +829 -0
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +1415 -0
- package/dist/extensions/pi-subagents/src/tui/render.ts +78 -7
- package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +1 -1
- package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +1 -0
- package/dist/extensions/pi-subagents/src/watchdog/permission-arbiter.ts +59 -51
- package/dist/extensions/pi-subagents/src/watchdog/register-main.ts +8 -2
- package/dist/extensions/pi-subagents/src/watchdog/tool-actions.ts +2 -1
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +4 -4
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +471 -86
- package/dist/extensions/pi-subagents/src/workflows/workflow-receipt.ts +140 -0
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/cli.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/args.d.ts +57 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/config-selector.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/file-processor.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/initial-message.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/list-models.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/project-trust.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/session-picker.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/startup-ui.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/config.d.ts +96 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-runtime.d.ts +119 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-services.d.ts +85 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session.d.ts +620 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-guidance.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-storage.d.ts +56 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/bash-executor.d.ts +32 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/cache-stats.d.ts +49 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/branch-summarization.d.ts +93 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/compaction.d.ts +128 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/index.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/utils.d.ts +38 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/defaults.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/diagnostics.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/event-bus.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/exec.d.ts +29 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/experimental.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/index.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/index.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/loader.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/runner.d.ts +171 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/types.d.ts +1261 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/footer-data-provider.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/index.d.ts +13 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/keybindings.d.ts +358 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/messages.d.ts +77 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-config.d.ts +512 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-registry.d.ts +43 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-resolver.d.ts +121 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-runtime.d.ts +82 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/models-store.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/output-guard.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/package-manager.d.ts +210 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/project-trust.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/prompt-templates.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-attribution.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-composer.d.ts +55 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/radius.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resource-loader.d.ts +206 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/sdk.d.ts +106 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-cwd.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-manager.d.ts +356 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/settings-manager.d.ts +297 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/skills.d.ts +60 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/slash-commands.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/source-info.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/system-prompt.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/telemetry.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/timings.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/bash.d.ts +68 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit-diff.d.ts +106 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit.d.ts +51 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/find.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/grep.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/index.d.ts +40 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/ls.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/read.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/render-utils.d.ts +24 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/truncate.d.ts +70 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/write.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/trust-manager.d.ts +36 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/usage-totals.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/client.d.ts +61 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/provider.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/index.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/main.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/migrations.d.ts +33 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/index.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/assistant-message.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/config-selector.d.ts +102 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-entry.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-editor.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/footer.d.ts +32 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/index.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/login-dialog.d.ts +52 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/model-selector.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/settings-selector.d.ts +77 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/status-indicator.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tool-execution.d.ts +63 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tree-selector.d.ts +94 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/interactive-mode.d.ts +394 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme.d.ts +120 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/print-mode.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-client.d.ts +246 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-types.d.ts +457 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/package-manager-cli.d.ts +8 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/rpc-entry.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/ansi.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/changelog.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/child-process.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/deprecation.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/frontmatter.d.ts +8 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/fs-watch.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/git.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/html.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-convert.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-process.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/json.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/mime.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/open-browser.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/paths.d.ts +31 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/photon.d.ts +21 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/shell.d.ts +31 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/sleep.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/tools-manager.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/version-check.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/index.mjs +1 -1
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +0 -54
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +1053 -414
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +194 -4
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +59 -4
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +0 -77
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +107 -6
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +211 -897
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +265 -375
- package/dist/extensions/pi-subagents/test/integration/orca-progress-tabs.test.ts +77 -7
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +10 -10
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +547 -30
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +2112 -310
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +274 -34
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +20 -3
- package/dist/extensions/pi-subagents/test/support/isolated-temp-root.mjs +9 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +30 -5
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +2 -0
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +4 -2
- package/dist/extensions/pi-subagents/test/support/register-loader.mjs +1 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +197 -0
- package/dist/extensions/pi-subagents/test/unit/agent-contract.test.ts +14 -0
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +204 -27
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +444 -145
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +256 -4
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +9 -7
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +152 -22
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +29 -0
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +205 -23
- package/dist/extensions/pi-subagents/test/unit/async-retention.test.ts +579 -0
- package/dist/extensions/pi-subagents/test/unit/atomic-json.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/authority-policy.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/unit/auto-drain.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/capacity-resilient-json.test.ts +155 -0
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +7 -0
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +123 -0
- package/dist/extensions/pi-subagents/test/unit/completion-replay.test.ts +81 -3
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +109 -7
- package/dist/extensions/pi-subagents/test/unit/default-extensions.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +5 -2
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +3 -2
- package/dist/extensions/pi-subagents/test/unit/extension-bindings.test.ts +79 -0
- package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/external-job-runner.test.ts +961 -0
- package/dist/extensions/pi-subagents/test/unit/file-system-retry.test.ts +64 -0
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +1110 -0
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +1664 -0
- package/dist/extensions/pi-subagents/test/unit/fork-context.test.ts +81 -1
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +138 -11
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +41 -2
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +210 -79
- package/dist/extensions/pi-subagents/test/unit/index-segment.test.ts +95 -0
- package/dist/extensions/pi-subagents/test/unit/inspect-rpc.test.ts +596 -0
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +10 -1
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +3 -5
- package/dist/extensions/pi-subagents/test/unit/model-exclusions.test.ts +167 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +319 -18
- package/dist/extensions/pi-subagents/test/unit/model-info.test.ts +78 -0
- package/dist/extensions/pi-subagents/test/unit/model-scope-settings.test.ts +19 -5
- package/dist/extensions/pi-subagents/test/unit/model-scope.test.ts +44 -0
- package/dist/extensions/pi-subagents/test/unit/mutation-evidence.test.ts +129 -0
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +231 -2
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +28 -1
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +106 -2
- package/dist/extensions/pi-subagents/test/unit/orca-progress-tabs.test.ts +204 -7
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +59 -4
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +2 -6
- package/dist/extensions/pi-subagents/test/unit/pi-args-permission-system.test.ts +34 -2
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +116 -6
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +12 -3
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +56 -61
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +416 -1
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +9 -2
- package/dist/extensions/pi-subagents/test/unit/project-panes-public-api.test.ts +42 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +21 -30
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +86 -11
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +49 -1
- package/dist/extensions/pi-subagents/test/unit/result-files.test.ts +233 -5
- package/dist/extensions/pi-subagents/test/unit/retained-children.test.ts +28 -5
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +323 -20
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +66 -10
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +68 -5
- package/dist/extensions/pi-subagents/test/unit/runtime-agent-registration.test.ts +174 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +679 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-store-root.test.ts +67 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +55 -44
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +399 -84
- package/dist/extensions/pi-subagents/test/unit/session-lease.test.ts +13 -0
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +15 -10
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +11 -7
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +2 -0
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +40 -1
- package/dist/extensions/pi-subagents/test/unit/subagent-action-recovery.test.ts +10 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +38 -3
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +110 -12
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +204 -19
- package/dist/extensions/pi-subagents/test/unit/temp-paths.test.ts +25 -0
- package/dist/extensions/pi-subagents/test/unit/thinking-ceiling.test.ts +73 -0
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +90 -50
- package/dist/extensions/pi-subagents/test/unit/tool-timeout.test.ts +1 -2
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +234 -7
- package/dist/extensions/pi-subagents/test/unit/watch-strategy.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-permission-arbiter.test.ts +36 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +37 -9
- package/dist/extensions/pi-subagents/test/unit/workflow-detach-reconcile.test.ts +302 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +167 -7
- package/dist/extensions/pi-subagents/test/unit/workflow-receipt.test.ts +113 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +6 -6
- package/dist/extensions/pi-web-agent/package.json +31 -31
- package/dist/extensions/pi-web-agent/src/backends/config.ts +205 -205
- package/dist/extensions/pi-web-agent/src/backends/doctor.ts +136 -136
- package/dist/extensions/pi-web-agent/src/backends/factory.ts +152 -152
- package/dist/extensions/pi-web-agent/src/backends/settings-reader.ts +25 -25
- package/dist/extensions/pi-web-agent/src/cache/ttl-cache.ts +28 -28
- package/dist/extensions/pi-web-agent/src/changelog-notice.ts +136 -136
- package/dist/extensions/pi-web-agent/src/commands/web-agent-config.ts +946 -946
- package/dist/extensions/pi-web-agent/src/extension.ts +126 -126
- package/dist/extensions/pi-web-agent/src/extract/readability.ts +118 -118
- package/dist/extensions/pi-web-agent/src/fetch/browser-resolution.ts +199 -199
- package/dist/extensions/pi-web-agent/src/fetch/firecrawl-fetch.ts +100 -100
- package/dist/extensions/pi-web-agent/src/fetch/headless-fetch.ts +117 -117
- package/dist/extensions/pi-web-agent/src/fetch/http-fetch.ts +67 -67
- package/dist/extensions/pi-web-agent/src/orchestration/answer-synthesizer.ts +60 -60
- package/dist/extensions/pi-web-agent/src/orchestration/candidate-selector.ts +50 -50
- package/dist/extensions/pi-web-agent/src/orchestration/direct-url.ts +52 -52
- package/dist/extensions/pi-web-agent/src/orchestration/evidence-quality.ts +105 -105
- package/dist/extensions/pi-web-agent/src/orchestration/evidence-ranker.ts +45 -45
- package/dist/extensions/pi-web-agent/src/orchestration/index.ts +28 -28
- package/dist/extensions/pi-web-agent/src/orchestration/query-planner.ts +47 -47
- package/dist/extensions/pi-web-agent/src/orchestration/research-orchestrator.ts +376 -376
- package/dist/extensions/pi-web-agent/src/orchestration/research-types.ts +64 -64
- package/dist/extensions/pi-web-agent/src/orchestration/research-worker.ts +181 -181
- package/dist/extensions/pi-web-agent/src/orchestration/source-profile.ts +101 -101
- package/dist/extensions/pi-web-agent/src/orchestration/stop-decider.ts +81 -81
- package/dist/extensions/pi-web-agent/src/presentation/config-store.ts +210 -210
- package/dist/extensions/pi-web-agent/src/presentation/config.ts +75 -75
- package/dist/extensions/pi-web-agent/src/presentation/explore-presentation.ts +61 -61
- package/dist/extensions/pi-web-agent/src/presentation/fetch-presentation.ts +54 -54
- package/dist/extensions/pi-web-agent/src/presentation/search-presentation.ts +41 -41
- package/dist/extensions/pi-web-agent/src/presentation/select-view.ts +20 -20
- package/dist/extensions/pi-web-agent/src/presentation/types.ts +63 -63
- package/dist/extensions/pi-web-agent/src/search/brave.ts +114 -114
- package/dist/extensions/pi-web-agent/src/search/duckduckgo.ts +72 -72
- package/dist/extensions/pi-web-agent/src/search/searxng.ts +96 -96
- package/dist/extensions/pi-web-agent/src/tools/web-explore.ts +71 -71
- package/dist/extensions/pi-web-agent/src/tools/web-fetch-headless.ts +31 -31
- package/dist/extensions/pi-web-agent/src/tools/web-fetch.ts +31 -31
- package/dist/extensions/pi-web-agent/src/tools/web-search.ts +157 -157
- package/dist/extensions/pi-web-agent/src/types.ts +88 -88
- package/dist/extensions/ponytail/index.js +31 -25
- package/dist/extensions/ponytail/package.json +8 -8
- package/dist/extensions/ponytail/ponytail-config.cjs +34 -7
- package/dist/extensions/ponytail/ponytail-instructions.cjs +7 -9
- package/dist/extensions/ponytail/test/extension.test.js +7 -8
- package/dist/extensions/ponytail/test/helpers.test.js +1 -1
- package/dist/extensions/question/batch.ts +103 -103
- package/dist/extensions/question/constants.ts +30 -30
- package/dist/extensions/question/helpers.ts +58 -58
- package/dist/extensions/question/navigation.ts +14 -14
- package/dist/extensions/question/package.json +19 -19
- package/dist/extensions/question/schemas.ts +43 -43
- package/dist/extensions/question/selection-mode.ts +46 -46
- package/dist/extensions/question/shortcuts.ts +44 -44
- package/dist/extensions/question/types.ts +132 -132
- package/dist/extensions/test-resolve-hook-impl.mjs +6 -6
- package/dist/extensions/test-resolve-hook.mjs +6 -6
- package/dist/extensions/web-agent-onboarding.ts +222 -222
- package/dist/extensions/workflow/package.json +17 -17
- package/dist/package-manager-cli.js +71 -71
- package/dist/rpc-entry.js +0 -0
- package/dist/skills/agent-browser/SKILL.md +52 -52
- package/dist/skills/batch-grill-me/SKILL.md +19 -19
- package/dist/skills/brandkit/SKILL.md +799 -0
- package/dist/skills/design-taste-frontend/SKILL.md +1207 -0
- package/dist/skills/design-taste-frontend-v1/SKILL.md +227 -0
- package/dist/skills/full-output-enforcement/SKILL.md +50 -0
- package/dist/skills/gpt-taste/SKILL.md +75 -0
- package/dist/skills/grill-me/SKILL.md +10 -10
- package/dist/skills/handoff/SKILL.md +16 -16
- package/dist/skills/handoff-text/SKILL.md +14 -14
- package/dist/skills/high-end-visual-design/SKILL.md +99 -0
- package/dist/skills/image-to-code/SKILL.md +1229 -0
- package/dist/skills/imagegen-frontend-mobile/SKILL.md +1466 -0
- package/dist/skills/imagegen-frontend-web/SKILL.md +988 -0
- package/dist/skills/implanger/SKILL.md +69 -69
- package/dist/skills/improve-codebase/REFERENCE.md +78 -78
- package/dist/skills/improve-codebase/SKILL.md +178 -178
- package/dist/skills/industrial-brutalist-ui/SKILL.md +93 -0
- package/dist/skills/minimalist-ui/SKILL.md +86 -0
- package/dist/skills/pi-subagents/SKILL.md +18 -17
- package/dist/skills/pi-subagents/references/constraints-and-recipes.md +31 -9
- package/dist/skills/pi-subagents/references/execution-controls.md +95 -143
- package/dist/skills/pi-subagents/references/management-authoring-rpc.md +9 -12
- package/dist/skills/pi-subagents/references/multi-lane-orchestration.md +39 -0
- package/dist/skills/pi-subagents/references/prompting-and-roles.md +45 -94
- package/dist/skills/planger/SKILL.md +166 -166
- package/dist/skills/ponytail/SKILL.md +120 -116
- package/dist/skills/ponytail-audit/SKILL.md +41 -42
- package/dist/skills/ponytail-debt/SKILL.md +44 -45
- package/dist/skills/ponytail-gain/SKILL.md +50 -51
- package/dist/skills/ponytail-help/SKILL.md +71 -70
- package/dist/skills/ponytail-review/SKILL.md +57 -58
- package/dist/skills/redesign-existing-projects/SKILL.md +179 -0
- package/dist/skills/selesai-handoff/SKILL.md +20 -20
- package/dist/skills/stitch-design-taste/SKILL.md +185 -0
- package/dist/skills/unlazy/CHANGELOG.md +100 -0
- package/dist/skills/unlazy/CONTRIBUTING.md +66 -0
- package/dist/skills/unlazy/LICENSE +21 -0
- package/dist/skills/unlazy/README.md +242 -0
- package/dist/skills/unlazy/SECURITY.md +70 -0
- package/dist/skills/unlazy/SKILL.md +100 -0
- package/dist/skills/unlazy/package.json +13 -0
- package/dist/skills/unlazy/references/dispatch.md +82 -0
- package/dist/skills/unlazy/references/gates.md +132 -0
- package/dist/skills/unlazy/references/method.md +49 -0
- package/dist/skills/unlazy/references/orchestration.md +99 -0
- package/dist/skills/unlazy/references/parallel.md +123 -0
- package/dist/skills/unlazy/references/token-economy.md +39 -0
- package/dist/skills/unlazy/research/validation-protocol.md +81 -0
- package/dist/skills/unlazy/scripts/dispatch-check.mjs +108 -0
- package/dist/skills/unlazy/scripts/gate-check.mjs +894 -0
- package/dist/skills/unlazy/scripts/gate-lint.mjs +178 -0
- package/dist/skills/unlazy/scripts/install-hooks.mjs +206 -0
- package/dist/skills/unlazy/scripts/lib/check-supervisor.mjs +46 -0
- package/dist/skills/unlazy/scripts/lib/dispatch.mjs +283 -0
- package/dist/skills/unlazy/scripts/lib/gates.mjs +629 -0
- package/dist/skills/unlazy/scripts/lib/process-tree.mjs +161 -0
- package/dist/skills/unlazy/scripts/lib/regex-worker.mjs +9 -0
- package/dist/skills/unlazy/scripts/stop-hook.mjs +174 -0
- package/dist/skills/unlazy/templates/PLAN.md +65 -0
- package/dist/skills/unlazy/templates/gates-leaf.md +51 -0
- package/dist/skills/unlazy/templates/gates-node.md +50 -0
- package/dist/skills/unlazy/tests/contract-tests.mjs +127 -0
- package/dist/skills/unlazy/tests/dispatch-tests.mjs +481 -0
- package/dist/skills/unlazy/tests/hardening-tests.mjs +903 -0
- package/dist/skills/unlazy/tests/lint-tests.mjs +242 -0
- package/dist/skills/unlazy/tests/run-tests.mjs +554 -0
- package/dist/skills/unlazy/tests/self-check.mjs +165 -0
- package/dist/skills/unlazy/tests/stress-tests.mjs +356 -0
- package/dist/skills/web-design-guidelines/SKILL.md +40 -0
- package/dist/skills/workflow-creation/SKILL.md +73 -73
- package/dist/themes/powerline-footer/theme.json +33 -33
- package/dist/utils/shell.d.ts +3 -0
- package/dist/utils/shell.js +17 -5
- package/docs/compaction.md +396 -396
- package/docs/containerization.md +111 -111
- package/docs/development.md +71 -71
- package/docs/docs.json +164 -164
- package/docs/environment-variables.md +86 -86
- package/docs/index.md +83 -83
- package/docs/json.md +82 -82
- package/docs/models.md +502 -502
- package/docs/packages.md +227 -227
- package/docs/plans/subagent-delegation/phase-0-correctness.md +264 -264
- package/docs/plans/subagent-delegation/phase-1-behavioral-contract.md +485 -485
- package/docs/plans/subagent-delegation/phase-2-context-controls.md +281 -281
- package/docs/plans/subagent-delegation/phase-3-advisory-routing.md +361 -361
- package/docs/plans/subagent-delegation/phase-4-optional-enforcement.md +380 -380
- package/docs/prompt-templates.md +95 -95
- package/docs/providers.md +293 -293
- package/docs/sdk.md +1144 -1143
- package/docs/security.md +59 -59
- package/docs/session-format.md +414 -414
- package/docs/sessions.md +145 -145
- package/docs/settings.md +0 -5
- package/docs/shared-host-extensions.md +109 -109
- package/docs/shell-aliases.md +13 -13
- package/docs/skills.md +231 -231
- package/docs/terminal-setup.md +142 -142
- package/docs/termux.md +127 -127
- package/docs/themes.md +295 -295
- package/docs/tmux.md +63 -63
- package/docs/tui.md +927 -927
- package/docs/windows.md +17 -17
- package/examples/README.md +25 -25
- package/examples/extensions/README.md +211 -211
- package/examples/extensions/auto-commit-on-exit.ts +49 -49
- package/examples/extensions/bash-spawn-hook.ts +30 -30
- package/examples/extensions/bookmark.ts +50 -50
- package/examples/extensions/border-status-editor.ts +150 -150
- package/examples/extensions/built-in-tool-renderer.ts +249 -249
- package/examples/extensions/claude-rules.ts +86 -86
- package/examples/extensions/commands.ts +72 -72
- package/examples/extensions/confirm-destructive.ts +59 -59
- package/examples/extensions/custom-compaction.ts +130 -130
- package/examples/extensions/custom-footer.ts +64 -64
- package/examples/extensions/custom-header.ts +73 -73
- package/examples/extensions/custom-provider-anthropic/index.ts +610 -610
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -24
- package/examples/extensions/custom-provider-anthropic/package.json +19 -19
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +404 -404
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -16
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -82
- package/examples/extensions/dirty-repo-guard.ts +56 -56
- package/examples/extensions/doom-overlay/README.md +46 -46
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -21
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -152
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -72
- package/examples/extensions/doom-overlay/doom-component.ts +132 -132
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -173
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -104
- package/examples/extensions/doom-overlay/index.ts +74 -74
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -51
- package/examples/extensions/dynamic-resources/SKILL.md +8 -8
- package/examples/extensions/dynamic-resources/dynamic.json +79 -79
- package/examples/extensions/dynamic-resources/dynamic.md +5 -5
- package/examples/extensions/dynamic-resources/index.ts +15 -15
- package/examples/extensions/dynamic-tools.ts +74 -74
- package/examples/extensions/event-bus.ts +43 -43
- package/examples/extensions/file-trigger.ts +41 -41
- package/examples/extensions/git-checkpoint.ts +53 -53
- package/examples/extensions/git-merge-and-resolve.ts +115 -115
- package/examples/extensions/github-issue-autocomplete.ts +185 -185
- package/examples/extensions/gondolin/index.ts +531 -531
- package/examples/extensions/gondolin/package-lock.json +185 -185
- package/examples/extensions/gondolin/package.json +19 -19
- package/examples/extensions/handoff.ts +199 -199
- package/examples/extensions/hello.ts +26 -26
- package/examples/extensions/hidden-thinking-label.ts +53 -53
- package/examples/extensions/inline-bash.ts +94 -94
- package/examples/extensions/input-transform-streaming.ts +39 -39
- package/examples/extensions/input-transform.ts +43 -43
- package/examples/extensions/interactive-shell.ts +196 -196
- package/examples/extensions/mac-system-theme.ts +47 -47
- package/examples/extensions/message-renderer.ts +59 -59
- package/examples/extensions/minimal-mode.ts +426 -426
- package/examples/extensions/modal-editor.ts +85 -85
- package/examples/extensions/model-status.ts +31 -31
- package/examples/extensions/notify.ts +55 -55
- package/examples/extensions/overlay-qa-tests.ts +1450 -1450
- package/examples/extensions/overlay-test.ts +153 -153
- package/examples/extensions/permission-gate.ts +34 -34
- package/examples/extensions/pirate.ts +47 -47
- package/examples/extensions/plan-mode/README.md +66 -66
- package/examples/extensions/plan-mode/index.ts +390 -390
- package/examples/extensions/plan-mode/utils.ts +168 -168
- package/examples/extensions/preset.ts +436 -436
- package/examples/extensions/project-trust.ts +64 -64
- package/examples/extensions/prompt-customizer.ts +97 -97
- package/examples/extensions/protected-paths.ts +30 -30
- package/examples/extensions/provider-payload.ts +18 -18
- package/examples/extensions/qna.ts +122 -122
- package/examples/extensions/question.ts +285 -285
- package/examples/extensions/questionnaire.ts +448 -448
- package/examples/extensions/rainbow-editor.ts +88 -88
- package/examples/extensions/reload-runtime.ts +37 -37
- package/examples/extensions/rpc-demo.ts +118 -118
- package/examples/extensions/sandbox/index.ts +321 -321
- package/examples/extensions/sandbox/package-lock.json +92 -92
- package/examples/extensions/sandbox/package.json +19 -19
- package/examples/extensions/send-user-message.ts +97 -97
- package/examples/extensions/session-name.ts +27 -27
- package/examples/extensions/shutdown-command.ts +63 -63
- package/examples/extensions/snake.ts +343 -343
- package/examples/extensions/space-invaders.ts +560 -560
- package/examples/extensions/ssh.ts +220 -220
- package/examples/extensions/status-line.ts +32 -32
- package/examples/extensions/structured-output.ts +65 -65
- package/examples/extensions/subagent/README.md +175 -175
- package/examples/extensions/subagent/agents/planner.md +37 -37
- package/examples/extensions/subagent/agents/reviewer.md +35 -35
- package/examples/extensions/subagent/agents/scout.md +50 -50
- package/examples/extensions/subagent/agents/worker.md +24 -24
- package/examples/extensions/subagent/agents.ts +126 -126
- package/examples/extensions/subagent/index.ts +1015 -1015
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -10
- package/examples/extensions/subagent/prompts/implement.md +10 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -9
- package/examples/extensions/summarize.ts +209 -209
- package/examples/extensions/system-prompt-header.ts +17 -17
- package/examples/extensions/tic-tac-toe.ts +1008 -1008
- package/examples/extensions/timed-confirm.ts +70 -70
- package/examples/extensions/titlebar-spinner.ts +58 -58
- package/examples/extensions/todo.ts +297 -297
- package/examples/extensions/tool-override.ts +144 -144
- package/examples/extensions/tools.ts +146 -146
- package/examples/extensions/trigger-compact.ts +50 -50
- package/examples/extensions/truncated-tool.ts +195 -195
- package/examples/extensions/widget-placement.ts +9 -9
- package/examples/extensions/with-deps/index.ts +32 -32
- package/examples/extensions/with-deps/package-lock.json +31 -31
- package/examples/extensions/with-deps/package.json +22 -22
- package/examples/extensions/working-indicator.ts +123 -123
- package/examples/extensions/working-message-test.ts +25 -25
- package/examples/rpc-extension-ui.ts +632 -632
- package/examples/sdk/01-minimal.ts +26 -26
- package/examples/sdk/02-custom-model.ts +53 -53
- package/examples/sdk/03-custom-prompt.ts +75 -75
- package/examples/sdk/04-skills.ts +55 -55
- package/examples/sdk/05-tools.ts +48 -48
- package/examples/sdk/06-extensions.ts +99 -99
- package/examples/sdk/07-context-files.ts +47 -47
- package/examples/sdk/08-prompt-templates.ts +51 -51
- package/examples/sdk/09-api-keys-and-oauth.ts +52 -52
- package/examples/sdk/10-settings.ts +53 -53
- package/examples/sdk/11-sessions.ts +52 -52
- package/examples/sdk/12-full-control.ts +79 -79
- package/examples/sdk/13-session-runtime.ts +67 -67
- package/examples/sdk/README.md +144 -144
- package/package.json +4 -4
- package/dist/core/tools/schema-prune.d.ts +0 -16
- package/dist/core/tools/schema-prune.js +0 -39
- package/dist/core/tools/schema-prune.test.js +0 -111
- package/dist/extensions/pi-subagents/UPSTREAM-V0.50-MAPPING.md +0 -172
- package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +0 -55
- package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +0 -61
- package/dist/extensions/pi-subagents/src/agents/task-aware-routing.ts +0 -132
- package/dist/extensions/pi-subagents/src/extension/chain-validation.ts +0 -181
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +0 -1354
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +0 -1581
- package/dist/extensions/pi-subagents/src/shared/env.ts +0 -16
- package/dist/extensions/pi-subagents/src/shared/session-lineage.ts +0 -71
- package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +0 -136
- package/dist/extensions/pi-subagents/src/workflows/workflow-auto-relaunch.ts +0 -41
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +0 -466
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +0 -1859
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +0 -733
- package/dist/extensions/pi-subagents/test/unit/builtin-agent-documentation.test.ts +0 -63
- package/dist/extensions/pi-subagents/test/unit/chain-validation.test.ts +0 -326
- package/dist/extensions/pi-subagents/test/unit/handoff-adoption.test.ts +0 -103
- package/dist/extensions/pi-subagents/test/unit/inline-subagents.test.ts +0 -127
- package/dist/extensions/pi-subagents/test/unit/session-lineage.test.ts +0 -73
- package/dist/extensions/pi-subagents/test/unit/task-aware-routing.test.ts +0 -213
- package/dist/extensions/pi-subagents/test/unit/workflow-auto-relaunch.test.ts +0 -65
- /package/dist/core/{tools/schema-prune.test.d.ts → extensions/loader.test.d.ts} +0 -0
|
@@ -4,16 +4,16 @@ import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
|
4
4
|
import type { ExtensionContext } from "@selesai/code";
|
|
5
5
|
import {
|
|
6
6
|
type AgentConfig,
|
|
7
|
+
type AgentDiscoveryDiagnostic,
|
|
7
8
|
type AgentScope,
|
|
8
9
|
type AgentSource,
|
|
9
|
-
type ChainConfig,
|
|
10
|
-
type ChainStepConfig,
|
|
11
10
|
BUILTIN_AGENT_NAMES,
|
|
12
11
|
defaultInheritProjectContext,
|
|
13
12
|
defaultInheritSkills,
|
|
14
13
|
defaultSystemPromptMode,
|
|
15
14
|
discoverAgentsAll,
|
|
16
15
|
buildRuntimeName,
|
|
16
|
+
findBlockingAgentDiagnostic,
|
|
17
17
|
frontmatterNameForConfig,
|
|
18
18
|
parsePackageName,
|
|
19
19
|
mergeBuiltinAgentOverride,
|
|
@@ -23,12 +23,11 @@ import {
|
|
|
23
23
|
} from "./agents.ts";
|
|
24
24
|
import { serializeAgent } from "./agent-serializer.ts";
|
|
25
25
|
import { mergeAgentsForScope } from "./agent-selection.ts";
|
|
26
|
-
import { serializeChain, serializeJsonChain } from "./chain-serializer.ts";
|
|
27
26
|
import { discoverAvailableSkills, resolveSkills } from "./skills.ts";
|
|
28
27
|
import {
|
|
29
28
|
buildProactiveSkillSubagentRecommendationLines,
|
|
30
29
|
} from "./proactive-skills.ts";
|
|
31
|
-
import { parseFrontmatter } from "./frontmatter.ts";
|
|
30
|
+
import { parseFrontmatter, parseFrontmatterList } from "./frontmatter.ts";
|
|
32
31
|
import { toModelInfo } from "../shared/model-info.ts";
|
|
33
32
|
import { resolveSubagentModelOverride, type ParentModel } from "../runs/shared/model-fallback.ts";
|
|
34
33
|
import { validateToolBudgetConfig } from "../runs/shared/tool-budget.ts";
|
|
@@ -37,15 +36,16 @@ import { validateAcceptanceInput } from "../runs/shared/acceptance.ts";
|
|
|
37
36
|
import type { AcceptanceInput, Details, ExtensionConfig, ToolBudgetConfig } from "../shared/types.ts";
|
|
38
37
|
import { getProjectConfigDir } from "../shared/utils.ts";
|
|
39
38
|
import { capabilityCeilingAgentRestrictionSources, isAgentAllowedByCapabilityCeiling, resolveCurrentSubagentCapabilityCeiling } from "../runs/shared/capability-ceiling.ts";
|
|
39
|
+
import { listRuntimeAgentConfigs, mergeRuntimeAgents, type RuntimeAgentOwner } from "./runtime-agent-registry.ts";
|
|
40
|
+
import { listExternalJobProviders } from "../api/external-job-provider.ts";
|
|
40
41
|
|
|
41
42
|
type ManagementAction = "list" | "get" | "models" | "create" | "update" | "delete" | "eject" | "disable" | "enable" | "reset";
|
|
42
43
|
type ManagementScope = "user" | "project";
|
|
43
|
-
type ManagementContext = Pick<ExtensionContext, "cwd" | "modelRegistry"> & { model?: ExtensionContext["model"]; config?: ExtensionConfig; currentSessionId?: string };
|
|
44
|
+
type ManagementContext = Pick<ExtensionContext, "cwd" | "modelRegistry"> & { model?: ExtensionContext["model"]; config?: ExtensionConfig; currentSessionId?: string; runtimeAgentOwner?: RuntimeAgentOwner };
|
|
44
45
|
|
|
45
46
|
interface ManagementParams {
|
|
46
47
|
action?: string;
|
|
47
48
|
agent?: string;
|
|
48
|
-
chainName?: string;
|
|
49
49
|
agentScope?: unknown;
|
|
50
50
|
config?: unknown;
|
|
51
51
|
}
|
|
@@ -58,24 +58,37 @@ function parseCsv(value: string): string[] {
|
|
|
58
58
|
return [...new Set(value.split(",").map((v) => v.trim()).filter(Boolean))];
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
type ConfigObjectResult =
|
|
62
|
+
| { status: "ok"; value: Record<string, unknown> }
|
|
63
|
+
| { status: "missing" }
|
|
64
|
+
| { status: "error"; message: string };
|
|
65
|
+
|
|
66
|
+
function configObject(config: unknown): ConfigObjectResult {
|
|
62
67
|
let val = config;
|
|
63
68
|
if (typeof val === "string") {
|
|
64
69
|
try {
|
|
65
70
|
val = JSON.parse(val);
|
|
66
71
|
} catch (error) {
|
|
67
72
|
const message = error instanceof Error ? error.message : String(error);
|
|
68
|
-
return { error: `config must be valid JSON: ${message}` };
|
|
73
|
+
return { status: "error", message: `config must be valid JSON: ${message}` };
|
|
69
74
|
}
|
|
70
75
|
}
|
|
71
|
-
if (!val || typeof val !== "object" || Array.isArray(val)) return {};
|
|
72
|
-
return { value: val as Record<string, unknown> };
|
|
76
|
+
if (!val || typeof val !== "object" || Array.isArray(val)) return { status: "missing" };
|
|
77
|
+
return { status: "ok", value: val as Record<string, unknown> };
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
function hasKey(obj: Record<string, unknown>, key: string): boolean {
|
|
76
81
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
77
82
|
}
|
|
78
83
|
|
|
84
|
+
function isJsonSerializable(value: unknown): boolean {
|
|
85
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
86
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
87
|
+
if (Array.isArray(value)) return value.every(isJsonSerializable);
|
|
88
|
+
if (value && typeof value === "object") return Object.values(value).every(isJsonSerializable);
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
|
|
79
92
|
function asDisambiguationScope(scope: unknown): ManagementScope | undefined {
|
|
80
93
|
if (scope === "user" || scope === "project") return scope;
|
|
81
94
|
return undefined;
|
|
@@ -105,14 +118,15 @@ function allAgents(d: { builtin: AgentConfig[]; package: AgentConfig[]; user: Ag
|
|
|
105
118
|
return [...d.builtin, ...d.package, ...d.user, ...d.project];
|
|
106
119
|
}
|
|
107
120
|
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
const items = kind === "agent" ? allAgents(d) : d.chains;
|
|
111
|
-
return [...new Set(items.map((x) => x.name))].sort((a, b) => a.localeCompare(b));
|
|
121
|
+
function availableAgentNamesFromDiscovery(d: { builtin: AgentConfig[]; package: AgentConfig[]; user: AgentConfig[]; project: AgentConfig[] }): string[] {
|
|
122
|
+
return [...new Set(allAgents(d).map((agent) => agent.name))].sort((a, b) => a.localeCompare(b));
|
|
112
123
|
}
|
|
113
124
|
|
|
114
|
-
function
|
|
115
|
-
|
|
125
|
+
function availableAgentNames(cwd: string): string[] {
|
|
126
|
+
return availableAgentNamesFromDiscovery(discoverAgentsAll(cwd));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function findAgentsInDiscovery(name: string, d: { builtin: AgentConfig[]; package: AgentConfig[]; user: AgentConfig[]; project: AgentConfig[] }, scope: AgentScope = "both"): AgentConfig[] {
|
|
116
130
|
const raw = name.trim();
|
|
117
131
|
const sanitized = sanitizeName(raw);
|
|
118
132
|
const scoped = mergeAgentsForScope(scope, d.user, d.project, d.builtin, d.package);
|
|
@@ -125,15 +139,17 @@ function findAgents(name: string, cwd: string, scope: AgentScope = "both"): Agen
|
|
|
125
139
|
.sort((a, b) => a.source.localeCompare(b.source));
|
|
126
140
|
}
|
|
127
141
|
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
142
|
+
function findAgents(name: string, cwd: string, scope: AgentScope = "both"): AgentConfig[] {
|
|
143
|
+
return findAgentsInDiscovery(name, discoverAgentsAll(cwd), scope);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function diagnosticsForScope(diagnostics: AgentDiscoveryDiagnostic[] | undefined, scope: AgentScope): AgentDiscoveryDiagnostic[] | undefined {
|
|
147
|
+
if (scope === "both") return diagnostics;
|
|
148
|
+
const excludedSource = scope === "user" ? "project" : "user";
|
|
149
|
+
return diagnostics?.filter((diagnostic) => diagnostic.source !== excludedSource);
|
|
134
150
|
}
|
|
135
151
|
|
|
136
|
-
const AGENT_SOURCE_PRECEDENCE: Record<AgentSource, number> = { builtin: 0, package: 1, user: 2, project: 3 };
|
|
152
|
+
const AGENT_SOURCE_PRECEDENCE: Record<AgentSource, number> = { builtin: 0, package: 1, user: 2, project: 3, runtime: 4 };
|
|
137
153
|
|
|
138
154
|
// Returns the highest-precedence definition for a resolved canonical name (project > user > package > builtin),
|
|
139
155
|
// matching mergeAgentsForScope for "both", including disabled agents so disable/enable can locate hidden targets.
|
|
@@ -156,9 +172,6 @@ function nameExistsInScope(cwd: string, scope: ManagementScope, name: string, ex
|
|
|
156
172
|
for (const a of scope === "user" ? d.user : d.project) {
|
|
157
173
|
if (a.name === name && a.filePath !== excludePath) return true;
|
|
158
174
|
}
|
|
159
|
-
for (const c of d.chains) {
|
|
160
|
-
if (c.source === scope && c.name === name && c.filePath !== excludePath) return true;
|
|
161
|
-
}
|
|
162
175
|
return false;
|
|
163
176
|
}
|
|
164
177
|
|
|
@@ -166,34 +179,11 @@ function isMutableSource(source: AgentSource): source is ManagementScope {
|
|
|
166
179
|
return source === "user" || source === "project";
|
|
167
180
|
}
|
|
168
181
|
|
|
169
|
-
function unknownChainAgents(cwd: string, steps: ChainStepConfig[]): string[] {
|
|
170
|
-
const d = discoverAgentsAll(cwd);
|
|
171
|
-
const agents = allAgents(d);
|
|
172
|
-
return [...new Set(steps.map((s) => s.agent).filter((agentName): agentName is string => typeof agentName === "string" && !resolveAgentName(agentName, agents).agent))]
|
|
173
|
-
.sort((a, b) => a.localeCompare(b));
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function chainStepWarnings(ctx: ManagementContext, steps: ChainStepConfig[]): string[] {
|
|
177
|
-
const warnings: string[] = [];
|
|
178
|
-
const available = new Set(discoverAvailableSkills(ctx.cwd).map((s) => s.name));
|
|
179
|
-
for (let i = 0; i < steps.length; i++) {
|
|
180
|
-
const s = steps[i]!;
|
|
181
|
-
if (s.model) {
|
|
182
|
-
const found = ctx.modelRegistry.getAvailable().some((m) => `${m.provider}/${m.id}` === s.model || m.id === s.model);
|
|
183
|
-
if (!found) warnings.push(`Warning: step ${i + 1} (${s.agent}): model '${s.model}' is not in the current model registry.`);
|
|
184
|
-
}
|
|
185
|
-
if (Array.isArray(s.skills) && s.skills.length > 0) {
|
|
186
|
-
const missing = s.skills.filter((sk) => !available.has(sk));
|
|
187
|
-
if (missing.length) warnings.push(`Warning: step ${i + 1} (${s.agent}): skills not found: ${missing.join(", ")}.`);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return warnings;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
182
|
function modelWarning(ctx: ManagementContext, model: string | undefined): string | undefined {
|
|
194
183
|
if (!model) return undefined;
|
|
195
184
|
const found = ctx.modelRegistry.getAvailable().some((m) => `${m.provider}/${m.id}` === model || m.id === model);
|
|
196
|
-
|
|
185
|
+
if (found) return undefined;
|
|
186
|
+
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).`;
|
|
197
187
|
}
|
|
198
188
|
|
|
199
189
|
function fallbackModelsWarning(ctx: ManagementContext, fallbackModels: string[] | undefined): string | undefined {
|
|
@@ -214,11 +204,26 @@ function skillsWarning(cwd: string, agent: Pick<AgentConfig, "skills" | "skillPa
|
|
|
214
204
|
return missing.length ? `Warning: skills not found: ${missing.join(", ")}.` : undefined;
|
|
215
205
|
}
|
|
216
206
|
|
|
207
|
+
function withDeclaredExtensionPaths(config: AgentConfig, filePath: string): AgentConfig {
|
|
208
|
+
const { frontmatter } = parseFrontmatter(fs.readFileSync(filePath, "utf-8"));
|
|
209
|
+
const { extensions: _extensions, subagentOnlyExtensions: _subagentOnlyExtensions, ...withoutResolvedExtensions } = config;
|
|
210
|
+
return {
|
|
211
|
+
...withoutResolvedExtensions,
|
|
212
|
+
...(frontmatter.extensions !== undefined ? { extensions: parseFrontmatterList(frontmatter.extensions) } : {}),
|
|
213
|
+
...(frontmatter.subagentOnlyExtensions !== undefined
|
|
214
|
+
? { subagentOnlyExtensions: parseFrontmatterList(frontmatter.subagentOnlyExtensions) }
|
|
215
|
+
: {}),
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
217
219
|
export function editableAgentConfig(agent: AgentConfig): AgentConfig {
|
|
218
220
|
const { extensions: _extensions, ...withoutExtensions } = agent;
|
|
219
221
|
const base = agent.override?.base;
|
|
220
222
|
const {
|
|
221
223
|
override: _override,
|
|
224
|
+
output: _output,
|
|
225
|
+
outputMode: _outputMode,
|
|
226
|
+
defaultReads: _defaultReads,
|
|
222
227
|
model: _model,
|
|
223
228
|
fallbackModels: _fallbackModels,
|
|
224
229
|
thinking: _thinking,
|
|
@@ -238,14 +243,17 @@ export function editableAgentConfig(agent: AgentConfig): AgentConfig {
|
|
|
238
243
|
...editable
|
|
239
244
|
} = withoutExtensions;
|
|
240
245
|
if (!base) {
|
|
241
|
-
return {
|
|
246
|
+
return withDeclaredExtensionPaths({
|
|
242
247
|
...withoutExtensions,
|
|
243
248
|
...(agent.extensionsFromDefault ? {} : agent.extensions !== undefined ? { extensions: [...agent.extensions] } : {}),
|
|
244
|
-
};
|
|
249
|
+
}, agent.filePath);
|
|
245
250
|
}
|
|
246
251
|
|
|
247
|
-
return {
|
|
252
|
+
return withDeclaredExtensionPaths({
|
|
248
253
|
...editable,
|
|
254
|
+
...(base.output !== undefined ? { output: base.output } : {}),
|
|
255
|
+
...(base.outputMode !== undefined ? { outputMode: base.outputMode } : {}),
|
|
256
|
+
...(base.defaultReads !== undefined ? { defaultReads: [...base.defaultReads] } : {}),
|
|
249
257
|
...(base.model !== undefined ? { model: base.model } : {}),
|
|
250
258
|
...(base.fallbackModels !== undefined ? { fallbackModels: [...base.fallbackModels] } : {}),
|
|
251
259
|
...(base.thinking !== undefined ? { thinking: base.thinking } : {}),
|
|
@@ -263,7 +271,7 @@ export function editableAgentConfig(agent: AgentConfig): AgentConfig {
|
|
|
263
271
|
...(base.extensions !== undefined ? { extensions: [...base.extensions] } : {}),
|
|
264
272
|
...(base.subagentOnlyExtensions !== undefined ? { subagentOnlyExtensions: [...base.subagentOnlyExtensions] } : {}),
|
|
265
273
|
...(base.completionGuard !== undefined ? { completionGuard: base.completionGuard } : {}),
|
|
266
|
-
};
|
|
274
|
+
}, agent.filePath);
|
|
267
275
|
}
|
|
268
276
|
|
|
269
277
|
function readAgentFrontmatterFields(filePath: string): Set<string> {
|
|
@@ -317,6 +325,7 @@ export function preservedAgentFrontmatterFields(agent: AgentConfig, cfg: Record<
|
|
|
317
325
|
if (hasKey(cfg, "acceptance")) changed("acceptance");
|
|
318
326
|
if (hasKey(cfg, "acceptanceRole")) changed("acceptanceRole");
|
|
319
327
|
if (hasKey(cfg, "output")) changed("output");
|
|
328
|
+
if (hasKey(cfg, "outputMode")) changed("outputMode");
|
|
320
329
|
if (hasKey(cfg, "reads")) changed("defaultReads");
|
|
321
330
|
if (hasKey(cfg, "progress")) changed("defaultProgress");
|
|
322
331
|
if (hasKey(cfg, "maxSubagentDepth")) changed("maxSubagentDepth");
|
|
@@ -329,69 +338,6 @@ export function preservedAgentFrontmatterFields(agent: AgentConfig, cfg: Record<
|
|
|
329
338
|
return fields;
|
|
330
339
|
}
|
|
331
340
|
|
|
332
|
-
function parseStepList(raw: unknown): { steps?: ChainStepConfig[]; error?: string } {
|
|
333
|
-
if (!Array.isArray(raw)) return { error: "config.steps must be an array." };
|
|
334
|
-
if (raw.length === 0) return { error: "config.steps must include at least one step." };
|
|
335
|
-
const steps: ChainStepConfig[] = [];
|
|
336
|
-
for (let i = 0; i < raw.length; i++) {
|
|
337
|
-
const item = raw[i];
|
|
338
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) return { error: `config.steps[${i}] must be an object.` };
|
|
339
|
-
const s = item as Record<string, unknown>;
|
|
340
|
-
if (typeof s.agent !== "string" || !s.agent.trim()) return { error: `config.steps[${i}].agent must be a non-empty string.` };
|
|
341
|
-
const step: ChainStepConfig = { agent: s.agent.trim(), task: typeof s.task === "string" ? s.task : "" };
|
|
342
|
-
if (hasKey(s, "phase")) {
|
|
343
|
-
if (typeof s.phase === "string") step.phase = s.phase;
|
|
344
|
-
else return { error: `config.steps[${i}].phase must be a string.` };
|
|
345
|
-
}
|
|
346
|
-
if (hasKey(s, "label")) {
|
|
347
|
-
if (typeof s.label === "string") step.label = s.label;
|
|
348
|
-
else return { error: `config.steps[${i}].label must be a string.` };
|
|
349
|
-
}
|
|
350
|
-
if (hasKey(s, "as")) {
|
|
351
|
-
if (typeof s.as === "string") step.as = s.as;
|
|
352
|
-
else return { error: `config.steps[${i}].as must be a string.` };
|
|
353
|
-
}
|
|
354
|
-
if (hasKey(s, "outputSchema")) {
|
|
355
|
-
if (typeof s.outputSchema === "string") step.outputSchema = s.outputSchema;
|
|
356
|
-
else return { error: `config.steps[${i}].outputSchema must be a schema file path string for saved chains.` };
|
|
357
|
-
}
|
|
358
|
-
if (hasKey(s, "output")) {
|
|
359
|
-
if (s.output === false) step.output = false;
|
|
360
|
-
else if (typeof s.output === "string") step.output = s.output;
|
|
361
|
-
else return { error: `config.steps[${i}].output must be a string or false.` };
|
|
362
|
-
}
|
|
363
|
-
if (hasKey(s, "outputMode")) {
|
|
364
|
-
if (s.outputMode === "inline" || s.outputMode === "file-only") step.outputMode = s.outputMode;
|
|
365
|
-
else return { error: `config.steps[${i}].outputMode must be 'inline' or 'file-only'.` };
|
|
366
|
-
}
|
|
367
|
-
if (hasKey(s, "reads")) {
|
|
368
|
-
if (s.reads === false) step.reads = false;
|
|
369
|
-
else if (Array.isArray(s.reads)) step.reads = s.reads.filter((v): v is string => typeof v === "string").map((v) => v.trim()).filter(Boolean);
|
|
370
|
-
else return { error: `config.steps[${i}].reads must be an array or false.` };
|
|
371
|
-
}
|
|
372
|
-
if (hasKey(s, "model")) {
|
|
373
|
-
if (typeof s.model === "string") step.model = s.model;
|
|
374
|
-
else return { error: `config.steps[${i}].model must be a string.` };
|
|
375
|
-
}
|
|
376
|
-
if (hasKey(s, "skills")) {
|
|
377
|
-
if (s.skills === false) step.skills = false;
|
|
378
|
-
else if (Array.isArray(s.skills)) step.skills = s.skills.filter((v): v is string => typeof v === "string").map((v) => v.trim()).filter(Boolean);
|
|
379
|
-
else return { error: `config.steps[${i}].skills must be an array or false.` };
|
|
380
|
-
}
|
|
381
|
-
if (hasKey(s, "progress")) {
|
|
382
|
-
if (typeof s.progress === "boolean") step.progress = s.progress;
|
|
383
|
-
else return { error: `config.steps[${i}].progress must be a boolean.` };
|
|
384
|
-
}
|
|
385
|
-
if (hasKey(s, "toolBudget")) {
|
|
386
|
-
const validation = validateToolBudgetConfig(s.toolBudget, `config.steps[${i}].toolBudget`);
|
|
387
|
-
if (validation.error) return { error: validation.error };
|
|
388
|
-
if (s.toolBudget !== undefined) step.toolBudget = s.toolBudget as ToolBudgetConfig;
|
|
389
|
-
}
|
|
390
|
-
steps.push(step);
|
|
391
|
-
}
|
|
392
|
-
return { steps };
|
|
393
|
-
}
|
|
394
|
-
|
|
395
341
|
function parseTools(raw: string): { tools?: string[]; mcpDirectTools?: string[] } {
|
|
396
342
|
const tools: string[] = [];
|
|
397
343
|
const mcpDirectTools: string[] = [];
|
|
@@ -436,7 +382,11 @@ function applyAgentConfig(target: AgentConfig, cfg: Record<string, unknown>): st
|
|
|
436
382
|
&& Object.keys(runner).every((key) => ["type", "command", "args", "promptDelivery"].includes(key))) {
|
|
437
383
|
const runnerArgs = Array.isArray(runner.args) ? runner.args.filter((arg): arg is string => typeof arg === "string") : undefined;
|
|
438
384
|
target.runner = { type: "external-cli", command: runner.command.trim(), ...(runnerArgs?.length ? { args: runnerArgs } : {}), ...(runner.promptDelivery ? { promptDelivery: "stdin" } : {}) };
|
|
439
|
-
} else
|
|
385
|
+
} else if (runner.type === "external-job" && typeof runner.provider === "string" && runner.provider.trim() === runner.provider && runner.provider
|
|
386
|
+
&& (runner.options === undefined || (runner.options && typeof runner.options === "object" && !Array.isArray(runner.options) && isJsonSerializable(runner.options)))
|
|
387
|
+
&& Object.keys(runner).every((key) => ["type", "provider", "options"].includes(key))) {
|
|
388
|
+
target.runner = { type: "external-job", provider: runner.provider, ...(runner.options ? { options: runner.options as Record<string, unknown> } : {}) };
|
|
389
|
+
} else return "config.runner must be { type: 'pi' }, { type: 'external-cli', command: string, args?: string[], promptDelivery?: 'stdin' }, or { type: 'external-job', provider: string, options?: object }.";
|
|
440
390
|
} else return "config.runner must be an object, false, or empty string when provided.";
|
|
441
391
|
}
|
|
442
392
|
if (hasKey(cfg, "model")) {
|
|
@@ -566,6 +516,10 @@ function applyAgentConfig(target: AgentConfig, cfg: Record<string, unknown>): st
|
|
|
566
516
|
else if (typeof cfg.output === "string") target.output = cfg.output;
|
|
567
517
|
else return "config.output must be a string or false when provided.";
|
|
568
518
|
}
|
|
519
|
+
if (hasKey(cfg, "outputMode")) {
|
|
520
|
+
if (cfg.outputMode === "inline" || cfg.outputMode === "file-only") target.outputMode = cfg.outputMode;
|
|
521
|
+
else return "config.outputMode must be 'inline' or 'file-only' when provided.";
|
|
522
|
+
}
|
|
569
523
|
if (hasKey(cfg, "reads")) {
|
|
570
524
|
if (cfg.reads === false || cfg.reads === "") delete target.defaultReads;
|
|
571
525
|
else if (typeof cfg.reads === "string") {
|
|
@@ -596,7 +550,7 @@ function applyAgentConfig(target: AgentConfig, cfg: Record<string, unknown>): st
|
|
|
596
550
|
target.toolBudget = cfg.toolBudget as ToolBudgetConfig;
|
|
597
551
|
}
|
|
598
552
|
}
|
|
599
|
-
if (target.runner?.type === "external-cli") {
|
|
553
|
+
if (target.runner?.type === "external-cli" || target.runner?.type === "external-job") {
|
|
600
554
|
const unsupported = [
|
|
601
555
|
target.tools?.length || target.mcpDirectTools?.length ? "tools" : undefined,
|
|
602
556
|
target.model ? "model" : undefined,
|
|
@@ -609,62 +563,121 @@ function applyAgentConfig(target: AgentConfig, cfg: Record<string, unknown>): st
|
|
|
609
563
|
target.completionGuard !== undefined ? "completionGuard" : undefined,
|
|
610
564
|
target.toolBudget ? "toolBudget" : undefined,
|
|
611
565
|
].filter((field): field is string => Boolean(field));
|
|
612
|
-
if (unsupported.length > 0) return `config.runner type '
|
|
566
|
+
if (unsupported.length > 0) return `config.runner type '${target.runner.type}' does not support Pi-only fields: ${unsupported.join(", ")}.`;
|
|
613
567
|
}
|
|
614
568
|
return undefined;
|
|
615
569
|
}
|
|
616
570
|
|
|
617
571
|
function resolveTarget<T extends { name: string; source: AgentSource; filePath: string }>(
|
|
618
|
-
kind: "agent" | "chain",
|
|
619
572
|
name: string,
|
|
620
573
|
matches: T[],
|
|
621
574
|
cwd: string,
|
|
622
575
|
scopeHint?: string,
|
|
623
576
|
): T | AgentToolResult<Details> {
|
|
624
|
-
const distinctNames = [...new Set(matches.map((
|
|
625
|
-
if (distinctNames.length > 1) {
|
|
626
|
-
|
|
627
|
-
}
|
|
628
|
-
const mutable = matches.filter((m): m is T & { source: ManagementScope } => isMutableSource(m.source));
|
|
577
|
+
const distinctNames = [...new Set(matches.map((match) => match.name))];
|
|
578
|
+
if (distinctNames.length > 1) return result(`Ambiguous agent alias or name '${name}': ${distinctNames.sort((a, b) => a.localeCompare(b)).join(", ")}`, true);
|
|
579
|
+
const mutable = matches.filter((match): match is T & { source: ManagementScope } => isMutableSource(match.source));
|
|
629
580
|
if (mutable.length === 0) {
|
|
630
|
-
if (matches.length > 0) {
|
|
631
|
-
|
|
632
|
-
}
|
|
633
|
-
const available = availableNames(cwd, kind);
|
|
634
|
-
return result(`${kind === "agent" ? "Agent" : "Chain"} '${name}' not found. Available: ${available.join(", ") || "none"}.`, true);
|
|
581
|
+
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);
|
|
582
|
+
return result(`Agent '${name}' not found. Available: ${availableAgentNames(cwd).join(", ") || "none"}.`, true);
|
|
635
583
|
}
|
|
636
584
|
if (mutable.length === 1) return mutable[0]!;
|
|
637
585
|
const scope = asDisambiguationScope(scopeHint);
|
|
638
586
|
if (!scope) {
|
|
639
|
-
const paths = mutable.map((
|
|
640
|
-
return result(
|
|
587
|
+
const paths = mutable.map((match) => `${match.source}: ${match.filePath}`).join("\n");
|
|
588
|
+
return result(`Agent '${name}' exists in both scopes. Specify agentScope: 'user' or 'project'.\n${paths}`, true);
|
|
641
589
|
}
|
|
642
|
-
const scoped = mutable.filter((
|
|
643
|
-
if (scoped.length === 0) return result(
|
|
644
|
-
if (scoped.length > 1) return result(`Multiple
|
|
590
|
+
const scoped = mutable.filter((match) => match.source === scope);
|
|
591
|
+
if (scoped.length === 0) return result(`Agent '${name}' not found in scope '${scope}'.`, true);
|
|
592
|
+
if (scoped.length > 1) return result(`Multiple agents named '${name}' found in scope '${scope}': ${scoped.map((match) => match.filePath).join(", ")}`, true);
|
|
645
593
|
return scoped[0]!;
|
|
646
594
|
}
|
|
647
595
|
|
|
648
|
-
function renamePath(
|
|
649
|
-
kind: "agent" | "chain",
|
|
650
|
-
currentPath: string,
|
|
651
|
-
newName: string,
|
|
652
|
-
scope: ManagementScope,
|
|
653
|
-
cwd: string,
|
|
654
|
-
): { filePath?: string; error?: string } {
|
|
596
|
+
function renamePath(currentPath: string, newName: string, scope: ManagementScope, cwd: string): { filePath?: string; error?: string } {
|
|
655
597
|
if (nameExistsInScope(cwd, scope, newName, currentPath)) return { error: `Name '${newName}' already exists in ${scope} scope.` };
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
if (fs.existsSync(filePath) && filePath !== currentPath) {
|
|
659
|
-
return { error: `File already exists at ${filePath} but is not a valid ${kind} definition. Remove or rename it first.` };
|
|
660
|
-
}
|
|
598
|
+
const filePath = path.join(path.dirname(currentPath), `${newName}.md`);
|
|
599
|
+
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.` };
|
|
661
600
|
fs.renameSync(currentPath, filePath);
|
|
662
601
|
return { filePath };
|
|
663
602
|
}
|
|
664
603
|
|
|
604
|
+
function packageSourceLabel(agent: AgentConfig): string {
|
|
605
|
+
if (!agent.packageSourceName) return agent.source;
|
|
606
|
+
return agent.packageSourceVersion ? `${agent.packageSourceName}@${agent.packageSourceVersion}` : agent.packageSourceName;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
type ExternalJobProviderStatus =
|
|
610
|
+
| { ok: true; names: Set<string> }
|
|
611
|
+
| { ok: false; error: string };
|
|
612
|
+
|
|
613
|
+
function errorMessage(error: unknown): string {
|
|
614
|
+
return error instanceof Error ? error.message : String(error);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
function registeredExternalJobProviderStatus(): ExternalJobProviderStatus {
|
|
618
|
+
try {
|
|
619
|
+
return { ok: true, names: new Set(listExternalJobProviders().map((provider) => provider.name)) };
|
|
620
|
+
} catch (error) {
|
|
621
|
+
return { ok: false, error: errorMessage(error) };
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
function externalJobProviderSuffix(provider: string, names: Set<string> | undefined): string {
|
|
626
|
+
if (!names) return "?";
|
|
627
|
+
return names.has(provider) ? "✓" : "missing";
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function runnerListBadge(agent: AgentConfig, providerNames: Set<string> | undefined): string | undefined {
|
|
631
|
+
if (agent.runner?.type === "external-job") return `external-job:${agent.runner.provider} ${externalJobProviderSuffix(agent.runner.provider, providerNames)}`;
|
|
632
|
+
if (agent.runner?.type === "external-cli") return "external-cli";
|
|
633
|
+
return undefined;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
function formatAgentListLine(agent: AgentConfig, providerNames: Set<string> | undefined): string {
|
|
637
|
+
const source = agent.source === "package" ? packageSourceLabel(agent) : agent.source;
|
|
638
|
+
const parts = [
|
|
639
|
+
source,
|
|
640
|
+
runnerListBadge(agent, providerNames),
|
|
641
|
+
agent.defaultContext ? `context: ${agent.defaultContext}` : undefined,
|
|
642
|
+
agent.aliases?.length ? `aliases: ${agent.aliases.join(", ")}` : undefined,
|
|
643
|
+
].filter((part): part is string => Boolean(part));
|
|
644
|
+
return `- ${agent.name} (${parts.join(", ")}): ${agent.description}`;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
function formatAgentListSections(agents: AgentConfig[], providerNames: Set<string> | undefined): string[] {
|
|
648
|
+
if (agents.length === 0) return ["- (none)"];
|
|
649
|
+
const sections: Array<[AgentSource, string]> = [
|
|
650
|
+
["package", "Package agents"],
|
|
651
|
+
["user", "User agents"],
|
|
652
|
+
["project", "Project agents"],
|
|
653
|
+
["runtime", "Runtime agents"],
|
|
654
|
+
["builtin", "Builtin agents"],
|
|
655
|
+
];
|
|
656
|
+
const lines: string[] = [];
|
|
657
|
+
for (const [source, label] of sections) {
|
|
658
|
+
const matches = agents.filter((agent) => agent.source === source);
|
|
659
|
+
if (matches.length === 0) continue;
|
|
660
|
+
if (lines.length > 0) lines.push("");
|
|
661
|
+
lines.push(label, ...matches.map((agent) => formatAgentListLine(agent, providerNames)));
|
|
662
|
+
}
|
|
663
|
+
return lines;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function formatRunnerDetail(agent: AgentConfig, providerNames: Set<string> | undefined): string | undefined {
|
|
667
|
+
if (!agent.runner) return undefined;
|
|
668
|
+
if (agent.runner.type === "external-job") return `Runner: external-job via ${agent.runner.provider} ${externalJobProviderSuffix(agent.runner.provider, providerNames)}`;
|
|
669
|
+
if (agent.runner.type === "external-cli") return `Runner: external-cli ${agent.runner.command}`;
|
|
670
|
+
return `Runner: ${JSON.stringify(agent.runner)}`;
|
|
671
|
+
}
|
|
672
|
+
|
|
665
673
|
function formatAgentDetail(agent: AgentConfig): string {
|
|
666
674
|
const tools = [...(agent.tools ?? []), ...(agent.mcpDirectTools ?? []).map((t) => `mcp:${t}`)];
|
|
675
|
+
const providerStatus = registeredExternalJobProviderStatus();
|
|
667
676
|
const lines: string[] = [`Agent: ${agent.name} (${agent.source})`, `Path: ${agent.filePath}`, `Description: ${agent.description}`];
|
|
677
|
+
if (agent.source === "package" && agent.packageSourceName) {
|
|
678
|
+
lines.push(`Source package: ${packageSourceLabel(agent)}`);
|
|
679
|
+
if (agent.packageSourceRoot) lines.push(`Package root: ${agent.packageSourceRoot}`);
|
|
680
|
+
}
|
|
668
681
|
if (agent.packageName) {
|
|
669
682
|
lines.push(`Local name: ${frontmatterNameForConfig(agent)}`);
|
|
670
683
|
lines.push(`Package: ${agent.packageName}`);
|
|
@@ -676,7 +689,12 @@ function formatAgentDetail(agent: AgentConfig): string {
|
|
|
676
689
|
if (agent.skills?.length) lines.push(`Skills: ${agent.skills.join(", ")}`);
|
|
677
690
|
if (agent.skillPath?.length) lines.push(`Skill paths: ${agent.skillPath.join(", ")}`);
|
|
678
691
|
lines.push(`System prompt mode: ${agent.systemPromptMode}`);
|
|
679
|
-
|
|
692
|
+
const runnerDetail = formatRunnerDetail(agent, providerStatus.ok ? providerStatus.names : undefined);
|
|
693
|
+
if (runnerDetail) {
|
|
694
|
+
lines.push(runnerDetail);
|
|
695
|
+
if (agent.runner?.type === "external-job" && !providerStatus.ok) lines.push(`External-job provider registry unavailable: ${providerStatus.error}`);
|
|
696
|
+
if (agent.runner?.type === "external-job" && agent.runner.options) lines.push(`Runner options: ${JSON.stringify(agent.runner.options)}`);
|
|
697
|
+
}
|
|
680
698
|
lines.push(`Inherit project context: ${agent.inheritProjectContext ? "true" : "false"}`);
|
|
681
699
|
lines.push(`Inherit skills: ${agent.inheritSkills ? "true" : "false"}`);
|
|
682
700
|
if (agent.defaultContext) lines.push(`Default context: ${agent.defaultContext}`);
|
|
@@ -690,6 +708,7 @@ function formatAgentDetail(agent: AgentConfig): string {
|
|
|
690
708
|
if (agent.subagentOnlyExtensions !== undefined) lines.push(`Subagent-only extensions: ${agent.subagentOnlyExtensions.length ? agent.subagentOnlyExtensions.join(", ") : "(none)"}`);
|
|
691
709
|
if (agent.thinking) lines.push(`Thinking: ${agent.thinking}`);
|
|
692
710
|
if (agent.output) lines.push(`Output: ${agent.output}`);
|
|
711
|
+
if (agent.outputMode) lines.push(`Output mode: ${agent.outputMode}`);
|
|
693
712
|
if (agent.defaultReads?.length) lines.push(`Reads: ${agent.defaultReads.join(", ")}`);
|
|
694
713
|
if (agent.defaultProgress) lines.push("Progress: true");
|
|
695
714
|
if (agent.maxSubagentDepth !== undefined) lines.push(`Max subagent depth: ${agent.maxSubagentDepth}`);
|
|
@@ -700,89 +719,47 @@ function formatAgentDetail(agent: AgentConfig): string {
|
|
|
700
719
|
return lines.join("\n");
|
|
701
720
|
}
|
|
702
721
|
|
|
703
|
-
function formatChainStepDetail(step: ChainStepConfig, index: number): string[] {
|
|
704
|
-
const lines: string[] = [];
|
|
705
|
-
if (step.expand || step.collect) {
|
|
706
|
-
const parallel = step.parallel && !Array.isArray(step.parallel) && typeof step.parallel === "object" ? step.parallel as { agent?: unknown; task?: unknown; label?: unknown; outputSchema?: unknown } : undefined;
|
|
707
|
-
const expand = step.expand && typeof step.expand === "object" ? step.expand as { from?: { output?: unknown; path?: unknown }; item?: unknown; key?: unknown; maxItems?: unknown; onEmpty?: unknown } : undefined;
|
|
708
|
-
const collect = step.collect && typeof step.collect === "object" ? step.collect as { as?: unknown; outputSchema?: unknown } : undefined;
|
|
709
|
-
lines.push(`${index + 1}. Dynamic fanout${typeof collect?.as === "string" ? ` -> ${collect.as}` : ""}`);
|
|
710
|
-
if (expand?.from) lines.push(` Expand: ${String(expand.from.output ?? "?")}${String(expand.from.path ?? "")}`);
|
|
711
|
-
if (typeof expand?.item === "string") lines.push(` Item variable: ${expand.item}`);
|
|
712
|
-
if (typeof expand?.key === "string") lines.push(` Key: ${expand.key}`);
|
|
713
|
-
if (typeof expand?.maxItems === "number") lines.push(` Max items: ${expand.maxItems}`);
|
|
714
|
-
if (typeof expand?.onEmpty === "string") lines.push(` On empty: ${expand.onEmpty}`);
|
|
715
|
-
if (parallel?.agent) lines.push(` Agent: ${String(parallel.agent)}`);
|
|
716
|
-
if (typeof parallel?.label === "string") lines.push(` Label: ${parallel.label}`);
|
|
717
|
-
if (typeof parallel?.task === "string" && parallel.task.trim()) lines.push(` Task: ${parallel.task}`);
|
|
718
|
-
if (parallel?.outputSchema) lines.push(" Structured output: true");
|
|
719
|
-
if (parallel && "toolBudget" in parallel) lines.push(` Tool budget: ${JSON.stringify((parallel as { toolBudget?: unknown }).toolBudget)}`);
|
|
720
|
-
if (collect?.outputSchema) lines.push(" Collect schema: true");
|
|
721
|
-
if (step.concurrency !== undefined) lines.push(` Concurrency: ${step.concurrency}`);
|
|
722
|
-
if (step.failFast !== undefined) lines.push(` Fail fast: ${step.failFast ? "true" : "false"}`);
|
|
723
|
-
return lines;
|
|
724
|
-
}
|
|
725
|
-
lines.push(`${index + 1}. ${step.agent}`);
|
|
726
|
-
if (step.task?.trim()) lines.push(` Task: ${step.task}`);
|
|
727
|
-
if (step.output === false) lines.push(" Output: false");
|
|
728
|
-
else if (step.output) lines.push(` Output: ${step.output}`);
|
|
729
|
-
if (step.outputMode) lines.push(` Output mode: ${step.outputMode}`);
|
|
730
|
-
if (step.toolBudget) lines.push(` Tool budget: ${JSON.stringify(step.toolBudget)}`);
|
|
731
|
-
if (step.reads === false) lines.push(" Reads: false");
|
|
732
|
-
else if (Array.isArray(step.reads) && step.reads.length > 0) lines.push(` Reads: ${step.reads.join(", ")}`);
|
|
733
|
-
if (step.model) lines.push(` Model: ${step.model}`);
|
|
734
|
-
if (step.skills === false) lines.push(" Skills: false");
|
|
735
|
-
else if (Array.isArray(step.skills) && step.skills.length > 0) lines.push(` Skills: ${step.skills.join(", ")}`);
|
|
736
|
-
if (step.progress !== undefined) lines.push(` Progress: ${step.progress ? "true" : "false"}`);
|
|
737
|
-
return lines;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
function formatChainDetail(chain: ChainConfig): string {
|
|
741
|
-
const lines: string[] = [`Chain: ${chain.name} (${chain.source})`, `Path: ${chain.filePath}`, `Description: ${chain.description}`];
|
|
742
|
-
if (chain.packageName) {
|
|
743
|
-
lines.push(`Local name: ${frontmatterNameForConfig(chain)}`);
|
|
744
|
-
lines.push(`Package: ${chain.packageName}`);
|
|
745
|
-
}
|
|
746
|
-
lines.push("", "Steps:");
|
|
747
|
-
for (let i = 0; i < chain.steps.length; i++) {
|
|
748
|
-
lines.push(...formatChainStepDetail(chain.steps[i]!, i));
|
|
749
|
-
}
|
|
750
|
-
return lines.join("\n");
|
|
751
|
-
}
|
|
752
|
-
|
|
753
722
|
export function handleList(params: ManagementParams, ctx: ManagementContext): AgentToolResult<Details> {
|
|
754
723
|
const scope = normalizeListScope(params.agentScope) ?? "both";
|
|
755
724
|
const d = discoverAgentsAll(ctx.cwd);
|
|
756
|
-
|
|
725
|
+
let scopedAgents = mergeAgentsForScope(scope, d.user, d.project, d.builtin, d.package);
|
|
726
|
+
if (ctx.runtimeAgentOwner && listRuntimeAgentConfigs(ctx.runtimeAgentOwner).length > 0) {
|
|
727
|
+
const configuredAgents: AgentConfig[] = [
|
|
728
|
+
...d.builtin,
|
|
729
|
+
...d.package,
|
|
730
|
+
...d.user,
|
|
731
|
+
...d.project,
|
|
732
|
+
];
|
|
733
|
+
scopedAgents = mergeRuntimeAgents(ctx.runtimeAgentOwner, { agents: scopedAgents }, configuredAgents).agents;
|
|
734
|
+
}
|
|
735
|
+
scopedAgents = scopedAgents
|
|
757
736
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
758
737
|
const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.currentSessionId);
|
|
759
738
|
const visibleAgents = scopedAgents.filter((a) => !a.disabled);
|
|
760
739
|
const agents = visibleAgents.filter((a) => isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
|
|
761
740
|
const restrictedAgents = visibleAgents.filter((a) => !isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
|
|
762
741
|
const restrictedSources = capabilityCeilingAgentRestrictionSources(capabilityCeiling);
|
|
763
|
-
const chains = d.chains.filter((c) => scope === "both" || c.source === "package" || c.source === scope).sort((a, b) => a.name.localeCompare(b.name));
|
|
764
|
-
const diagnostics = d.chainDiagnostics.filter((entry) => scope === "both" || entry.source === scope);
|
|
765
742
|
const proactiveSuggestions = buildProactiveSkillSubagentRecommendationLines({
|
|
766
743
|
agents,
|
|
767
|
-
chains,
|
|
768
744
|
...(ctx.config?.proactiveSkillSubagents !== undefined ? { config: ctx.config.proactiveSkillSubagents } : {}),
|
|
769
745
|
discoverAvailableSkills: () => discoverAvailableSkills(ctx.cwd),
|
|
770
746
|
});
|
|
747
|
+
const providerStatus = registeredExternalJobProviderStatus();
|
|
771
748
|
const lines = [
|
|
772
749
|
"Executable agents:",
|
|
773
|
-
...(agents.
|
|
774
|
-
? agents.map((a) => `- ${a.name} (${a.source}${a.defaultContext ? `, context: ${a.defaultContext}` : ""}${a.aliases?.length ? `, aliases: ${a.aliases.join(", ")}` : ""}): ${a.description}`)
|
|
775
|
-
: ["- (none)"]),
|
|
750
|
+
...formatAgentListSections(agents, providerStatus.ok ? providerStatus.names : undefined),
|
|
776
751
|
...(restrictedAgents.length ? [
|
|
777
752
|
"",
|
|
778
753
|
`Restricted agents (not executable in this session${restrictedSources?.length ? `; capability ceiling: ${restrictedSources.join(", ")}` : ""}):`,
|
|
779
|
-
...restrictedAgents.map((a) =>
|
|
754
|
+
...restrictedAgents.map((a) => formatAgentListLine(a, providerStatus.ok ? providerStatus.names : undefined)),
|
|
755
|
+
] : []),
|
|
756
|
+
...(!providerStatus.ok && [...agents, ...restrictedAgents].some((agent) => agent.runner?.type === "external-job") ? ["", `External-job provider registry unavailable: ${providerStatus.error}`] : []),
|
|
757
|
+
...(d.agentDiagnostics?.length ? [
|
|
758
|
+
"",
|
|
759
|
+
"Invalid agent definitions:",
|
|
760
|
+
...d.agentDiagnostics.map((diagnostic) => `- ${diagnostic.name ?? diagnostic.filePath} (${diagnostic.source}): ${diagnostic.error}`),
|
|
780
761
|
] : []),
|
|
781
|
-
"",
|
|
782
|
-
"Chains:",
|
|
783
|
-
...(chains.length ? chains.map((c) => `- ${c.name} (${c.source}): ${c.description}`) : ["- (none)"]),
|
|
784
762
|
...(proactiveSuggestions.length ? ["", ...proactiveSuggestions] : []),
|
|
785
|
-
...(diagnostics.length ? ["", "Chain diagnostics:", ...diagnostics.map((entry) => `- ${entry.filePath}: ${entry.error}`)] : []),
|
|
786
763
|
];
|
|
787
764
|
return result(lines.join("\n"));
|
|
788
765
|
}
|
|
@@ -865,51 +842,45 @@ function handleModels(params: ManagementParams, ctx: ManagementContext): AgentTo
|
|
|
865
842
|
lines.push("");
|
|
866
843
|
}
|
|
867
844
|
|
|
845
|
+
const availableFullIds = availableModels.map((m) => m.fullId).sort();
|
|
846
|
+
if (availableFullIds.length > 0) {
|
|
847
|
+
lines.push("Available models in this session's registry (copy an exact provider/id when passing model):");
|
|
848
|
+
lines.push("");
|
|
849
|
+
const shown = availableFullIds.slice(0, 80);
|
|
850
|
+
for (const fullId of shown) lines.push(` ${fullId}`);
|
|
851
|
+
if (availableFullIds.length > shown.length) lines.push(` ... and ${availableFullIds.length - shown.length} more`);
|
|
852
|
+
lines.push("");
|
|
853
|
+
lines.push("Use an exact provider/id from this list when you pass model; bare ids resolve only when unique in the registry.");
|
|
854
|
+
}
|
|
855
|
+
|
|
868
856
|
return result(lines.join("\n"));
|
|
869
857
|
}
|
|
870
858
|
|
|
871
859
|
function handleGet(params: ManagementParams, ctx: ManagementContext): AgentToolResult<Details> {
|
|
872
|
-
if (!params.agent
|
|
860
|
+
if (!params.agent) return result("Specify 'agent' for get.", true);
|
|
873
861
|
const scope = normalizeListScope(params.agentScope);
|
|
874
862
|
if (!scope) return result("agentScope must be 'user', 'project', or 'both' for get.", true);
|
|
875
|
-
const
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
} else {
|
|
890
|
-
anyFound = true;
|
|
891
|
-
blocks.push(...matches.map(formatAgentDetail));
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
if (params.chainName) {
|
|
895
|
-
const matches = findChains(params.chainName, ctx.cwd, scope);
|
|
896
|
-
if (!matches.length) {
|
|
897
|
-
const msg = `Chain '${params.chainName}' not found. Available: ${availableNames(ctx.cwd, "chain").join(", ") || "none"}.`;
|
|
898
|
-
if (!hasBoth) return result(msg, true);
|
|
899
|
-
blocks.push(msg);
|
|
900
|
-
} else {
|
|
901
|
-
anyFound = true;
|
|
902
|
-
blocks.push(...matches.map(formatChainDetail));
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
return result(blocks.join("\n\n"), !anyFound);
|
|
863
|
+
const discovered = discoverAgentsAll(ctx.cwd);
|
|
864
|
+
const matches = findAgentsInDiscovery(params.agent, discovered, scope);
|
|
865
|
+
const diagnostics = diagnosticsForScope(discovered.agentDiagnostics, scope);
|
|
866
|
+
const rawName = params.agent.trim();
|
|
867
|
+
const normalizedName = sanitizeName(rawName);
|
|
868
|
+
const diagnostic = findBlockingAgentDiagnostic(rawName, matches, diagnostics)
|
|
869
|
+
?? (normalizedName !== rawName ? findBlockingAgentDiagnostic(normalizedName, matches, diagnostics) : undefined);
|
|
870
|
+
if (diagnostic) return result(`Agent '${params.agent}' has invalid configuration: ${diagnostic.error}`, true);
|
|
871
|
+
const distinctNames = [...new Set(matches.map((agent) => agent.name))];
|
|
872
|
+
if (distinctNames.length > 1) return result(`Ambiguous agent alias or name '${params.agent}': ${distinctNames.sort((a, b) => a.localeCompare(b)).join(", ")}`, true);
|
|
873
|
+
if (!matches.length) {
|
|
874
|
+
return result(`Agent '${params.agent}' not found. Available: ${availableAgentNamesFromDiscovery(discovered).join(", ") || "none"}.`, true);
|
|
875
|
+
}
|
|
876
|
+
return result(matches.map(formatAgentDetail).join("\n\n"));
|
|
906
877
|
}
|
|
907
878
|
|
|
908
879
|
export function handleCreate(params: ManagementParams, ctx: ManagementContext): AgentToolResult<Details> {
|
|
909
880
|
const parsedConfig = configObject(params.config);
|
|
910
|
-
if (parsedConfig.error) return result(parsedConfig.
|
|
881
|
+
if (parsedConfig.status === "error") return result(parsedConfig.message, true);
|
|
882
|
+
if (parsedConfig.status === "missing") return result("config required for create.", true);
|
|
911
883
|
const cfg = parsedConfig.value;
|
|
912
|
-
if (!cfg) return result("config required for create.", true);
|
|
913
884
|
if (typeof cfg.name !== "string" || !cfg.name.trim()) return result("config.name is required and must be a non-empty string.", true);
|
|
914
885
|
if (typeof cfg.description !== "string" || !cfg.description.trim()) return result("config.description is required and must be a non-empty string.", true);
|
|
915
886
|
const name = sanitizeName(cfg.name);
|
|
@@ -920,36 +891,16 @@ export function handleCreate(params: ManagementParams, ctx: ManagementContext):
|
|
|
920
891
|
const scopeRaw = cfg.scope ?? "user";
|
|
921
892
|
if (scopeRaw !== "user" && scopeRaw !== "project") return result("config.scope must be 'user' or 'project'.", true);
|
|
922
893
|
const scope = scopeRaw as ManagementScope;
|
|
923
|
-
|
|
894
|
+
if (hasKey(cfg, "steps")) return result("Durable chain definitions were removed; use workflowScript or /prompt-workflow for repeatable workflows.", true);
|
|
924
895
|
const d = discoverAgentsAll(ctx.cwd);
|
|
925
896
|
const projectConfigDir = getProjectConfigDir(ctx.cwd);
|
|
926
|
-
const targetDir =
|
|
927
|
-
? scope === "user" ? d.userChainDir : d.projectChainDir ?? path.join(projectConfigDir, "chains")
|
|
928
|
-
: scope === "user" ? d.userDir : d.projectDir ?? path.join(projectConfigDir, "agents");
|
|
897
|
+
const targetDir = scope === "user" ? d.userDir : d.projectDir ?? path.join(projectConfigDir, "agents");
|
|
929
898
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
930
899
|
if (nameExistsInScope(ctx.cwd, scope, runtimeName)) return result(`Name '${runtimeName}' already exists in ${scope} scope. Use update instead.`, true);
|
|
931
|
-
const targetPath = path.join(targetDir,
|
|
932
|
-
if (fs.existsSync(targetPath)) return result(`File already exists at ${targetPath} but is not a valid
|
|
900
|
+
const targetPath = path.join(targetDir, `${runtimeName}.md`);
|
|
901
|
+
if (fs.existsSync(targetPath)) return result(`File already exists at ${targetPath} but is not a valid agent definition. Remove or rename it first.`, true);
|
|
933
902
|
const warnings: string[] = [];
|
|
934
|
-
if (
|
|
935
|
-
if (isChain) {
|
|
936
|
-
const parsed = parseStepList(cfg.steps);
|
|
937
|
-
if (parsed.error) return result(parsed.error, true);
|
|
938
|
-
const chain: ChainConfig = {
|
|
939
|
-
name: runtimeName,
|
|
940
|
-
localName: name,
|
|
941
|
-
...(parsedPackage.packageName !== undefined ? { packageName: parsedPackage.packageName } : {}),
|
|
942
|
-
description: cfg.description.trim(),
|
|
943
|
-
source: scope,
|
|
944
|
-
filePath: targetPath,
|
|
945
|
-
steps: parsed.steps!,
|
|
946
|
-
};
|
|
947
|
-
fs.writeFileSync(targetPath, serializeChain(chain), "utf-8");
|
|
948
|
-
const missing = unknownChainAgents(ctx.cwd, chain.steps);
|
|
949
|
-
if (missing.length) warnings.push(`Warning: chain steps reference unknown agents: ${missing.join(", ")}.`);
|
|
950
|
-
warnings.push(...chainStepWarnings(ctx, chain.steps));
|
|
951
|
-
return result([`Created chain '${runtimeName}' at ${targetPath}.`, ...warnings].join("\n"));
|
|
952
|
-
}
|
|
903
|
+
if (d.builtin.some((a) => a.name === runtimeName)) warnings.push(`Note: this shadows the builtin agent '${runtimeName}'.`);
|
|
953
904
|
const agent: AgentConfig = {
|
|
954
905
|
name: runtimeName,
|
|
955
906
|
localName: name,
|
|
@@ -975,75 +926,25 @@ export function handleCreate(params: ManagementParams, ctx: ManagementContext):
|
|
|
975
926
|
}
|
|
976
927
|
|
|
977
928
|
export function handleUpdate(params: ManagementParams, ctx: ManagementContext): AgentToolResult<Details> {
|
|
978
|
-
if (!params.agent
|
|
979
|
-
if (params.agent && params.chainName) return result("Specify either 'agent' or 'chainName', not both.", true);
|
|
929
|
+
if (!params.agent) return result("Specify 'agent' for update.", true);
|
|
980
930
|
const parsedConfig = configObject(params.config);
|
|
981
|
-
if (parsedConfig.error) return result(parsedConfig.
|
|
931
|
+
if (parsedConfig.status === "error") return result(parsedConfig.message, true);
|
|
932
|
+
if (parsedConfig.status === "missing") return result("config required for update.", true);
|
|
982
933
|
const cfg = parsedConfig.value;
|
|
983
|
-
if (
|
|
934
|
+
if (hasKey(cfg, "steps")) return result("Durable chain definitions were removed; use workflowScript or /prompt-workflow for repeatable workflows.", true);
|
|
984
935
|
const warnings: string[] = [];
|
|
985
|
-
if (params.agent) {
|
|
986
|
-
const scopeHint = asDisambiguationScope(params.agentScope);
|
|
987
|
-
const targetOrError = resolveTarget("agent", params.agent, findAgents(params.agent, ctx.cwd, scopeHint ?? "both"), ctx.cwd, scopeHint);
|
|
988
|
-
if ("content" in targetOrError) return targetOrError;
|
|
989
|
-
const target = targetOrError;
|
|
990
|
-
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);
|
|
991
|
-
const updated = editableAgentConfig(target);
|
|
992
|
-
const oldName = target.name;
|
|
993
|
-
if (hasKey(cfg, "name") && (typeof cfg.name !== "string" || !cfg.name.trim())) return result("config.name must be a non-empty string when provided.", true);
|
|
994
|
-
if (hasKey(cfg, "description") && (typeof cfg.description !== "string" || !cfg.description.trim())) return result("config.description must be a non-empty string when provided.", true);
|
|
995
|
-
let newLocalName = target.localName ?? frontmatterNameForConfig(target);
|
|
996
|
-
if (hasKey(cfg, "name")) {
|
|
997
|
-
newLocalName = sanitizeName(cfg.name as string);
|
|
998
|
-
if (!newLocalName) return result("config.name is invalid after sanitization.", true);
|
|
999
|
-
}
|
|
1000
|
-
let newPackageName = target.packageName;
|
|
1001
|
-
if (hasKey(cfg, "package")) {
|
|
1002
|
-
const parsedPackage = parsePackageConfig(cfg.package);
|
|
1003
|
-
if (parsedPackage.error) return result(parsedPackage.error, true);
|
|
1004
|
-
newPackageName = parsedPackage.packageName;
|
|
1005
|
-
}
|
|
1006
|
-
const applyError = applyAgentConfig(updated, cfg);
|
|
1007
|
-
if (applyError) return result(applyError, true);
|
|
1008
|
-
const preserveFrontmatterFields = preservedAgentFrontmatterFields(target, cfg);
|
|
1009
|
-
updated.localName = newLocalName;
|
|
1010
|
-
if (newPackageName !== undefined) updated.packageName = newPackageName;
|
|
1011
|
-
else delete updated.packageName;
|
|
1012
|
-
updated.name = buildRuntimeName(newLocalName, newPackageName);
|
|
1013
|
-
if (hasKey(cfg, "description")) updated.description = (cfg.description as string).trim();
|
|
1014
|
-
if (hasKey(cfg, "model")) {
|
|
1015
|
-
const mw = modelWarning(ctx, updated.model);
|
|
1016
|
-
if (mw) warnings.push(mw);
|
|
1017
|
-
}
|
|
1018
|
-
if (hasKey(cfg, "fallbackModels")) {
|
|
1019
|
-
const fmw = fallbackModelsWarning(ctx, updated.fallbackModels);
|
|
1020
|
-
if (fmw) warnings.push(fmw);
|
|
1021
|
-
}
|
|
1022
|
-
if (hasKey(cfg, "skills") || hasKey(cfg, "skillPath")) {
|
|
1023
|
-
const sw = skillsWarning(ctx.cwd, updated);
|
|
1024
|
-
if (sw) warnings.push(sw);
|
|
1025
|
-
}
|
|
1026
|
-
if (updated.name !== oldName) {
|
|
1027
|
-
const renamed = renamePath("agent", target.filePath, updated.name, target.source, ctx.cwd);
|
|
1028
|
-
if (renamed.error) return result(renamed.error, true);
|
|
1029
|
-
updated.filePath = renamed.filePath!;
|
|
1030
|
-
}
|
|
1031
|
-
fs.writeFileSync(updated.filePath, serializeAgent(updated, { preserveFrontmatterFields }), "utf-8");
|
|
1032
|
-
if (updated.name !== oldName) {
|
|
1033
|
-
const refs = discoverAgentsAll(ctx.cwd).chains.filter((c) => c.steps.some((s) => s.agent === oldName)).map((c) => `${c.name} (${c.source})`);
|
|
1034
|
-
if (refs.length) warnings.push(`Warning: chains still reference '${oldName}': ${refs.join(", ")}.`);
|
|
1035
|
-
}
|
|
1036
|
-
const headline = updated.name === oldName
|
|
1037
|
-
? `Updated agent '${updated.name}' at ${updated.filePath}.`
|
|
1038
|
-
: `Updated agent '${oldName}' to '${updated.name}' at ${updated.filePath}.`;
|
|
1039
|
-
return result([headline, ...warnings].join("\n"));
|
|
1040
|
-
}
|
|
1041
936
|
const scopeHint = asDisambiguationScope(params.agentScope);
|
|
1042
|
-
const targetOrError = resolveTarget(
|
|
937
|
+
const targetOrError = resolveTarget(params.agent, findAgents(params.agent, ctx.cwd, scopeHint ?? "both"), ctx.cwd, scopeHint);
|
|
1043
938
|
if ("content" in targetOrError) return targetOrError;
|
|
1044
939
|
const target = targetOrError;
|
|
1045
|
-
if (target.source !== "user" && target.source !== "project") return result(`Cannot update ${target.source}
|
|
1046
|
-
|
|
940
|
+
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);
|
|
941
|
+
let updated: AgentConfig;
|
|
942
|
+
try {
|
|
943
|
+
updated = editableAgentConfig(target);
|
|
944
|
+
} catch (error) {
|
|
945
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
946
|
+
return result(`Could not reread agent definition ${target.filePath} before updating '${target.name}': ${message}`, true);
|
|
947
|
+
}
|
|
1047
948
|
const oldName = target.name;
|
|
1048
949
|
if (hasKey(cfg, "name") && (typeof cfg.name !== "string" || !cfg.name.trim())) return result("config.name must be a non-empty string when provided.", true);
|
|
1049
950
|
if (hasKey(cfg, "description") && (typeof cfg.description !== "string" || !cfg.description.trim())) return result("config.description must be a non-empty string when provided.", true);
|
|
@@ -1058,54 +959,46 @@ export function handleUpdate(params: ManagementParams, ctx: ManagementContext):
|
|
|
1058
959
|
if (parsedPackage.error) return result(parsedPackage.error, true);
|
|
1059
960
|
newPackageName = parsedPackage.packageName;
|
|
1060
961
|
}
|
|
1061
|
-
|
|
1062
|
-
if (
|
|
1063
|
-
|
|
1064
|
-
if (parsed.error) return result(parsed.error, true);
|
|
1065
|
-
parsedSteps = parsed.steps!;
|
|
1066
|
-
}
|
|
962
|
+
const applyError = applyAgentConfig(updated, cfg);
|
|
963
|
+
if (applyError) return result(applyError, true);
|
|
964
|
+
const preserveFrontmatterFields = preservedAgentFrontmatterFields(target, cfg);
|
|
1067
965
|
updated.localName = newLocalName;
|
|
1068
966
|
if (newPackageName !== undefined) updated.packageName = newPackageName;
|
|
1069
967
|
else delete updated.packageName;
|
|
1070
968
|
updated.name = buildRuntimeName(newLocalName, newPackageName);
|
|
1071
969
|
if (hasKey(cfg, "description")) updated.description = (cfg.description as string).trim();
|
|
1072
|
-
if (
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
970
|
+
if (hasKey(cfg, "model")) {
|
|
971
|
+
const mw = modelWarning(ctx, updated.model);
|
|
972
|
+
if (mw) warnings.push(mw);
|
|
973
|
+
}
|
|
974
|
+
if (hasKey(cfg, "fallbackModels")) {
|
|
975
|
+
const fmw = fallbackModelsWarning(ctx, updated.fallbackModels);
|
|
976
|
+
if (fmw) warnings.push(fmw);
|
|
977
|
+
}
|
|
978
|
+
if (hasKey(cfg, "skills") || hasKey(cfg, "skillPath")) {
|
|
979
|
+
const sw = skillsWarning(ctx.cwd, updated);
|
|
980
|
+
if (sw) warnings.push(sw);
|
|
1077
981
|
}
|
|
1078
982
|
if (updated.name !== oldName) {
|
|
1079
|
-
const renamed = renamePath(
|
|
983
|
+
const renamed = renamePath(target.filePath, updated.name, target.source, ctx.cwd);
|
|
1080
984
|
if (renamed.error) return result(renamed.error, true);
|
|
1081
985
|
updated.filePath = renamed.filePath!;
|
|
1082
986
|
}
|
|
1083
|
-
fs.writeFileSync(updated.filePath, updated
|
|
987
|
+
fs.writeFileSync(updated.filePath, serializeAgent(updated, { preserveFrontmatterFields }), "utf-8");
|
|
1084
988
|
const headline = updated.name === oldName
|
|
1085
|
-
? `Updated
|
|
1086
|
-
: `Updated
|
|
989
|
+
? `Updated agent '${updated.name}' at ${updated.filePath}.`
|
|
990
|
+
: `Updated agent '${oldName}' to '${updated.name}' at ${updated.filePath}.`;
|
|
1087
991
|
return result([headline, ...warnings].join("\n"));
|
|
1088
992
|
}
|
|
1089
993
|
|
|
1090
994
|
function handleDelete(params: ManagementParams, ctx: ManagementContext): AgentToolResult<Details> {
|
|
1091
|
-
if (!params.agent
|
|
1092
|
-
if (params.agent && params.chainName) return result("Specify either 'agent' or 'chainName', not both.", true);
|
|
995
|
+
if (!params.agent) return result("Specify 'agent' for delete.", true);
|
|
1093
996
|
const scopeHint = asDisambiguationScope(params.agentScope);
|
|
1094
|
-
|
|
1095
|
-
const targetOrError = resolveTarget("agent", params.agent, findAgents(params.agent, ctx.cwd, scopeHint ?? "both"), ctx.cwd, scopeHint);
|
|
1096
|
-
if ("content" in targetOrError) return targetOrError;
|
|
1097
|
-
const target = targetOrError;
|
|
1098
|
-
fs.unlinkSync(target.filePath);
|
|
1099
|
-
const refs = discoverAgentsAll(ctx.cwd).chains.filter((c) => c.steps.some((s) => s.agent === target.name)).map((c) => `${c.name} (${c.source})`);
|
|
1100
|
-
const lines = [`Deleted agent '${target.name}' at ${target.filePath}.`];
|
|
1101
|
-
if (refs.length) lines.push(`Warning: chains reference deleted agent '${target.name}': ${refs.join(", ")}.`);
|
|
1102
|
-
return result(lines.join("\n"));
|
|
1103
|
-
}
|
|
1104
|
-
const targetOrError = resolveTarget("chain", params.chainName!, findChains(params.chainName!, ctx.cwd, scopeHint ?? "both"), ctx.cwd, scopeHint);
|
|
997
|
+
const targetOrError = resolveTarget(params.agent, findAgents(params.agent, ctx.cwd, scopeHint ?? "both"), ctx.cwd, scopeHint);
|
|
1105
998
|
if ("content" in targetOrError) return targetOrError;
|
|
1106
999
|
const target = targetOrError;
|
|
1107
1000
|
fs.unlinkSync(target.filePath);
|
|
1108
|
-
return result(`Deleted
|
|
1001
|
+
return result(`Deleted agent '${target.name}' at ${target.filePath}.`);
|
|
1109
1002
|
}
|
|
1110
1003
|
|
|
1111
1004
|
function handleEject(params: ManagementParams, ctx: ManagementContext): AgentToolResult<Details> {
|
|
@@ -1118,7 +1011,7 @@ function handleEject(params: ManagementParams, ctx: ManagementContext): AgentToo
|
|
|
1118
1011
|
const d = discoverAgentsAll(ctx.cwd);
|
|
1119
1012
|
const source = [...d.package, ...d.builtin].find((a) => a.name === raw || a.name === sanitized);
|
|
1120
1013
|
if (!source) {
|
|
1121
|
-
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: ${
|
|
1014
|
+
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);
|
|
1122
1015
|
}
|
|
1123
1016
|
const runtimeName = source.name;
|
|
1124
1017
|
const existingCustom = (scope === "user" ? d.user : d.project).find((a) => a.name === runtimeName);
|
|
@@ -1126,7 +1019,7 @@ function handleEject(params: ManagementParams, ctx: ManagementContext): AgentToo
|
|
|
1126
1019
|
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);
|
|
1127
1020
|
}
|
|
1128
1021
|
if (nameExistsInScope(ctx.cwd, scope, runtimeName)) {
|
|
1129
|
-
return result(`An agent
|
|
1022
|
+
return result(`An agent named '${runtimeName}' already exists in ${scope} scope. Remove or rename it first.`, true);
|
|
1130
1023
|
}
|
|
1131
1024
|
const projectConfigDir = getProjectConfigDir(ctx.cwd);
|
|
1132
1025
|
const targetDir = scope === "user" ? d.userDir : d.projectDir ?? path.join(projectConfigDir, "agents");
|
|
@@ -1159,7 +1052,7 @@ function handleDisable(params: ManagementParams, ctx: ManagementContext): AgentT
|
|
|
1159
1052
|
const effective = resolveEffectiveAgent(d, raw);
|
|
1160
1053
|
if (effective.error) return result(effective.error, true);
|
|
1161
1054
|
if (!effective.agent) {
|
|
1162
|
-
return result(`Agent '${raw}' not found. Available: ${
|
|
1055
|
+
return result(`Agent '${raw}' not found. Available: ${availableAgentNames(ctx.cwd).join(", ") || "none"}.`, true);
|
|
1163
1056
|
}
|
|
1164
1057
|
const runtimeName = effective.agent.name;
|
|
1165
1058
|
const settingsPath = mergeBuiltinAgentOverride(ctx.cwd, runtimeName, scope, { disabled: true });
|
|
@@ -1183,7 +1076,7 @@ function handleEnable(params: ManagementParams, ctx: ManagementContext): AgentTo
|
|
|
1183
1076
|
const effective = resolveEffectiveAgent(d, raw);
|
|
1184
1077
|
if (effective.error) return result(effective.error, true);
|
|
1185
1078
|
if (!effective.agent) {
|
|
1186
|
-
return result(`Agent '${raw}' not found. Available: ${
|
|
1079
|
+
return result(`Agent '${raw}' not found. Available: ${availableAgentNames(ctx.cwd).join(", ") || "none"}.`, true);
|
|
1187
1080
|
}
|
|
1188
1081
|
const runtimeName = effective.agent.name;
|
|
1189
1082
|
const { path: settingsPath, removed } = removeBuiltinAgentOverrideFields(ctx.cwd, runtimeName, scope, ["disabled"]);
|
|
@@ -1215,7 +1108,7 @@ function handleReset(params: ManagementParams, ctx: ManagementContext): AgentToo
|
|
|
1215
1108
|
if (custom) {
|
|
1216
1109
|
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);
|
|
1217
1110
|
}
|
|
1218
|
-
return result(`Agent '${raw}' not found. Available: ${
|
|
1111
|
+
return result(`Agent '${raw}' not found. Available: ${availableAgentNames(ctx.cwd).join(", ") || "none"}.`, true);
|
|
1219
1112
|
}
|
|
1220
1113
|
const runtimeName = bundled.name;
|
|
1221
1114
|
const custom = (scope === "user" ? d.user : d.project).find((a) => a.name === raw || a.name === sanitized);
|