@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
|
@@ -8,7 +8,6 @@ import { parse as parseYaml } from "yaml";
|
|
|
8
8
|
import * as os from "node:os";
|
|
9
9
|
import * as path from "node:path";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
|
-
import "../shared/env.ts";
|
|
12
11
|
import type { AcceptanceInput, AcceptanceRole, AgentRunnerConfig, OutputMode, ToolBudgetConfig, TurnBudgetConfig } from "../shared/types.ts";
|
|
13
12
|
import { getAgentDir, getProjectConfigDir } from "../shared/utils.ts";
|
|
14
13
|
import { KNOWN_FIELDS } from "./agent-serializer.ts";
|
|
@@ -17,15 +16,17 @@ import { mergeAgentsForScope } from "./agent-selection.ts";
|
|
|
17
16
|
import { parseFrontmatter, parseFrontmatterList } from "./frontmatter.ts";
|
|
18
17
|
import { buildRuntimeName, parsePackageName } from "./identity.ts";
|
|
19
18
|
import { parseModelScopeConfig, type ModelScopeConfig } from "../runs/shared/model-scope.ts";
|
|
19
|
+
export { BUILTIN_AGENT_NAMES } from "./builtin-names.ts";
|
|
20
20
|
export { buildRuntimeName, frontmatterNameForConfig, parsePackageName } from "./identity.ts";
|
|
21
21
|
import { parseMemoryFrontmatter } from "./agent-memory.ts";
|
|
22
22
|
import { resolveTurnBudgetConfig } from "../runs/shared/turn-budget.ts";
|
|
23
23
|
import { validateAcceptanceInput } from "../runs/shared/acceptance.ts";
|
|
24
24
|
import { validatePermissionRules, type PermissionRules } from "../runs/shared/permissions.ts";
|
|
25
|
+
import { parseThinkingLevel, type ThinkingLevel } from "../shared/thinking-ceiling.ts";
|
|
25
26
|
|
|
26
27
|
export type AgentScope = "user" | "project" | "both";
|
|
27
28
|
|
|
28
|
-
export type AgentSource = "builtin" | "package" | "user" | "project";
|
|
29
|
+
export type AgentSource = "builtin" | "package" | "user" | "project" | "runtime";
|
|
29
30
|
type SystemPromptMode = "append" | "replace";
|
|
30
31
|
export type AgentDefaultContext = "fresh" | "fork";
|
|
31
32
|
|
|
@@ -36,21 +37,6 @@ export interface AgentMemoryConfig {
|
|
|
36
37
|
path: string;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
export const BUILTIN_AGENT_NAMES = [
|
|
40
|
-
"architect",
|
|
41
|
-
"advisor",
|
|
42
|
-
"builder",
|
|
43
|
-
"commentator",
|
|
44
|
-
"delegate",
|
|
45
|
-
"explorer",
|
|
46
|
-
"oracle",
|
|
47
|
-
"recapper",
|
|
48
|
-
"researcher",
|
|
49
|
-
"reviewer",
|
|
50
|
-
"scout",
|
|
51
|
-
"worker",
|
|
52
|
-
] as const;
|
|
53
|
-
|
|
54
40
|
export function defaultSystemPromptMode(name: string): SystemPromptMode {
|
|
55
41
|
return name === "delegate" ? "append" : "replace";
|
|
56
42
|
}
|
|
@@ -65,8 +51,13 @@ export function defaultInheritSkills(): boolean {
|
|
|
65
51
|
|
|
66
52
|
export interface BuiltinAgentOverrideBase {
|
|
67
53
|
description?: string;
|
|
54
|
+
output?: string;
|
|
55
|
+
outputMode?: OutputMode;
|
|
56
|
+
defaultReads?: string[];
|
|
68
57
|
model?: string;
|
|
58
|
+
modelProvider?: string;
|
|
69
59
|
fallbackModels?: string[];
|
|
60
|
+
fast?: boolean;
|
|
70
61
|
thinking?: string | false;
|
|
71
62
|
systemPromptMode: SystemPromptMode;
|
|
72
63
|
inheritProjectContext: boolean;
|
|
@@ -87,8 +78,13 @@ export interface BuiltinAgentOverrideBase {
|
|
|
87
78
|
|
|
88
79
|
interface BuiltinAgentOverrideConfig {
|
|
89
80
|
description?: string;
|
|
81
|
+
output?: string | false;
|
|
82
|
+
outputMode?: OutputMode;
|
|
83
|
+
defaultReads?: string[] | false;
|
|
90
84
|
model?: string | false;
|
|
85
|
+
defaultProvider?: string | false;
|
|
91
86
|
fallbackModels?: string[] | false;
|
|
87
|
+
fast?: boolean;
|
|
92
88
|
thinking?: string | false;
|
|
93
89
|
systemPromptMode?: SystemPromptMode;
|
|
94
90
|
inheritProjectContext?: boolean;
|
|
@@ -116,6 +112,7 @@ export interface AgentModelSourceInfo {
|
|
|
116
112
|
scope: "user" | "project";
|
|
117
113
|
path: string;
|
|
118
114
|
model: string;
|
|
115
|
+
defaultProvider?: string;
|
|
119
116
|
}
|
|
120
117
|
|
|
121
118
|
export interface AgentConfig {
|
|
@@ -123,12 +120,17 @@ export interface AgentConfig {
|
|
|
123
120
|
runner?: AgentRunnerConfig;
|
|
124
121
|
localName?: string;
|
|
125
122
|
packageName?: string;
|
|
123
|
+
packageSourceName?: string;
|
|
124
|
+
packageSourceVersion?: string;
|
|
125
|
+
packageSourceRoot?: string;
|
|
126
126
|
description: string;
|
|
127
127
|
aliases?: string[];
|
|
128
128
|
tools?: string[];
|
|
129
129
|
mcpDirectTools?: string[];
|
|
130
130
|
model?: string;
|
|
131
|
+
modelProvider?: string;
|
|
131
132
|
fallbackModels?: string[];
|
|
133
|
+
fast?: boolean;
|
|
132
134
|
thinking?: string | false;
|
|
133
135
|
systemPromptMode: SystemPromptMode;
|
|
134
136
|
inheritProjectContext: boolean;
|
|
@@ -143,12 +145,14 @@ export interface AgentConfig {
|
|
|
143
145
|
systemPrompt: string;
|
|
144
146
|
source: AgentSource;
|
|
145
147
|
filePath: string;
|
|
148
|
+
discoveryPriority?: number;
|
|
146
149
|
skills?: string[];
|
|
147
150
|
skillPath?: string[];
|
|
148
151
|
extensions?: string[];
|
|
149
152
|
extensionsFromDefault?: boolean;
|
|
150
153
|
subagentOnlyExtensions?: string[];
|
|
151
154
|
output?: string;
|
|
155
|
+
outputMode?: OutputMode;
|
|
152
156
|
defaultReads?: string[];
|
|
153
157
|
defaultProgress?: boolean;
|
|
154
158
|
interactive?: boolean;
|
|
@@ -161,6 +165,7 @@ export interface AgentConfig {
|
|
|
161
165
|
extraFields?: Record<string, string>;
|
|
162
166
|
override?: BuiltinAgentOverrideInfo;
|
|
163
167
|
modelSource?: AgentModelSourceInfo;
|
|
168
|
+
maxThinking?: ThinkingLevel;
|
|
164
169
|
}
|
|
165
170
|
|
|
166
171
|
type ProjectRootResolution = "nearest" | "git-root";
|
|
@@ -168,7 +173,9 @@ type ProjectRootResolution = "nearest" | "git-root";
|
|
|
168
173
|
interface SubagentSettings {
|
|
169
174
|
overrides: Record<string, BuiltinAgentOverrideConfig>;
|
|
170
175
|
defaultModel?: string;
|
|
176
|
+
defaultProvider?: string;
|
|
171
177
|
defaultThinking?: string;
|
|
178
|
+
maxThinking?: ThinkingLevel;
|
|
172
179
|
defaultExtensions?: string[];
|
|
173
180
|
disableBuiltins?: boolean;
|
|
174
181
|
disableThinking?: boolean;
|
|
@@ -218,18 +225,64 @@ export interface ChainDiscoveryDiagnostic {
|
|
|
218
225
|
error: string;
|
|
219
226
|
}
|
|
220
227
|
|
|
228
|
+
export interface AgentDiscoveryDiagnostic extends ChainDiscoveryDiagnostic {
|
|
229
|
+
name?: string;
|
|
230
|
+
runtimeName?: string;
|
|
231
|
+
packageSpecified?: boolean;
|
|
232
|
+
discoveryPriority?: number;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const AGENT_SOURCE_PRIORITY: Record<AgentSource, number> = {
|
|
236
|
+
builtin: 0,
|
|
237
|
+
package: 1,
|
|
238
|
+
user: 2,
|
|
239
|
+
project: 3,
|
|
240
|
+
runtime: 4,
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
function agentDefinitionPriority(definition: Pick<AgentConfig | AgentDiscoveryDiagnostic, "source" | "discoveryPriority">): number {
|
|
244
|
+
return AGENT_SOURCE_PRIORITY[definition.source] * 1_000_000
|
|
245
|
+
+ (definition.discoveryPriority ?? 0);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function findBlockingAgentDiagnostic(name: string, agent: AgentConfig | readonly AgentConfig[] | undefined, diagnostics: AgentDiscoveryDiagnostic[] | undefined): AgentDiscoveryDiagnostic | undefined {
|
|
249
|
+
const normalizedName = name.trim();
|
|
250
|
+
const agents = Array.isArray(agent) ? agent : agent ? [agent] : [];
|
|
251
|
+
let match: AgentDiscoveryDiagnostic | undefined;
|
|
252
|
+
for (const diagnostic of diagnostics ?? []) {
|
|
253
|
+
if ((diagnostic.runtimeName === normalizedName
|
|
254
|
+
|| (diagnostic.name === normalizedName && (!diagnostic.packageSpecified
|
|
255
|
+
|| diagnostic.runtimeName === undefined
|
|
256
|
+
|| agents.some((agent) => agent.name === diagnostic.runtimeName && agent.localName === diagnostic.name))))
|
|
257
|
+
&& (!match || agentDefinitionPriority(diagnostic) > agentDefinitionPriority(match))) {
|
|
258
|
+
match = diagnostic;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const highestPriority = Math.max(...agents.map(agentDefinitionPriority), -Infinity);
|
|
262
|
+
return !agents.length || (match && agentDefinitionPriority(match) > highestPriority) ? match : undefined;
|
|
263
|
+
}
|
|
264
|
+
|
|
221
265
|
interface AgentDiscoveryResult {
|
|
222
266
|
agents: AgentConfig[];
|
|
267
|
+
agentDiagnostics?: AgentDiscoveryDiagnostic[];
|
|
223
268
|
projectAgentsDir: string | null;
|
|
224
269
|
modelScope?: ModelScopeConfig;
|
|
270
|
+
maxThinking?: ThinkingLevel;
|
|
225
271
|
}
|
|
226
272
|
|
|
227
273
|
function getUserChainDir(): string {
|
|
228
274
|
return path.join(getAgentDir(), "chains");
|
|
229
275
|
}
|
|
230
276
|
|
|
277
|
+
interface PackageSubagentPath {
|
|
278
|
+
dir: string;
|
|
279
|
+
packageName?: string;
|
|
280
|
+
packageVersion?: string;
|
|
281
|
+
packageRoot: string;
|
|
282
|
+
}
|
|
283
|
+
|
|
231
284
|
interface PackageSubagentPaths {
|
|
232
|
-
agents:
|
|
285
|
+
agents: PackageSubagentPath[];
|
|
233
286
|
chains: string[];
|
|
234
287
|
}
|
|
235
288
|
|
|
@@ -351,7 +404,7 @@ function getGlobalNpmRoot(): string | null {
|
|
|
351
404
|
}
|
|
352
405
|
|
|
353
406
|
try {
|
|
354
|
-
cachedGlobalNpmRoot = fs.realpathSync(execSync("npm root -g", { encoding: "utf-8", timeout: 5000 }).trim());
|
|
407
|
+
cachedGlobalNpmRoot = fs.realpathSync(execSync("npm root -g", { encoding: "utf-8", timeout: 5000, windowsHide: true }).trim());
|
|
355
408
|
return cachedGlobalNpmRoot;
|
|
356
409
|
} catch {
|
|
357
410
|
cachedGlobalNpmRoot = "";
|
|
@@ -364,18 +417,30 @@ function stringArray(value: unknown): string[] {
|
|
|
364
417
|
return value.filter((entry): entry is string => typeof entry === "string" && entry.trim().length > 0);
|
|
365
418
|
}
|
|
366
419
|
|
|
420
|
+
function packageMetadata(pkg: Record<string, unknown>, packageRoot: string): Omit<PackageSubagentPath, "dir"> {
|
|
421
|
+
const name = typeof pkg.name === "string" && pkg.name.trim() ? pkg.name.trim() : undefined;
|
|
422
|
+
const version = typeof pkg.version === "string" && pkg.version.trim() ? pkg.version.trim() : undefined;
|
|
423
|
+
return {
|
|
424
|
+
packageRoot,
|
|
425
|
+
...(name ? { packageName: name } : {}),
|
|
426
|
+
...(version ? { packageVersion: version } : {}),
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
367
430
|
function extractSubagentPathsFromPackageRoot(packageRoot: string): PackageSubagentPaths {
|
|
368
431
|
const packageJsonPath = path.join(packageRoot, "package.json");
|
|
369
432
|
const pkg = readJsonFileBestEffort(packageJsonPath);
|
|
370
433
|
if (!pkg || typeof pkg !== "object" || Array.isArray(pkg)) return { agents: [], chains: [] };
|
|
434
|
+
const pkgRecord = pkg as Record<string, unknown>;
|
|
435
|
+
const metadata = packageMetadata(pkgRecord, packageRoot);
|
|
371
436
|
|
|
372
437
|
const roots: Record<string, unknown>[] = [];
|
|
373
|
-
const piSubagents =
|
|
438
|
+
const piSubagents = pkgRecord["pi-subagents"];
|
|
374
439
|
if (piSubagents && typeof piSubagents === "object" && !Array.isArray(piSubagents)) {
|
|
375
440
|
roots.push(piSubagents as Record<string, unknown>);
|
|
376
441
|
}
|
|
377
442
|
|
|
378
|
-
const pi =
|
|
443
|
+
const pi = pkgRecord.pi;
|
|
379
444
|
if (pi && typeof pi === "object" && !Array.isArray(pi)) {
|
|
380
445
|
const subagents = (pi as { subagents?: unknown }).subagents;
|
|
381
446
|
if (subagents && typeof subagents === "object" && !Array.isArray(subagents)) {
|
|
@@ -383,10 +448,10 @@ function extractSubagentPathsFromPackageRoot(packageRoot: string): PackageSubage
|
|
|
383
448
|
}
|
|
384
449
|
}
|
|
385
450
|
|
|
386
|
-
const agents:
|
|
451
|
+
const agents: PackageSubagentPath[] = [];
|
|
387
452
|
const chains: string[] = [];
|
|
388
453
|
for (const root of roots) {
|
|
389
|
-
for (const entry of stringArray(root.agents)) agents.push(path.resolve(packageRoot, entry));
|
|
454
|
+
for (const entry of stringArray(root.agents)) agents.push({ dir: path.resolve(packageRoot, entry), ...metadata });
|
|
390
455
|
for (const entry of stringArray(root.chains)) chains.push(path.resolve(packageRoot, entry));
|
|
391
456
|
}
|
|
392
457
|
return { agents, chains };
|
|
@@ -478,17 +543,17 @@ function collectPackageSubagentPaths(cwd: string, options: { includeUser: boolea
|
|
|
478
543
|
const seenRoots = new Set<string>();
|
|
479
544
|
const seenAgents = new Set<string>();
|
|
480
545
|
const seenChains = new Set<string>();
|
|
481
|
-
const agents:
|
|
546
|
+
const agents: PackageSubagentPath[] = [];
|
|
482
547
|
const chains: string[] = [];
|
|
483
548
|
for (const packageRoot of packageRoots) {
|
|
484
549
|
const resolvedRoot = path.resolve(packageRoot);
|
|
485
550
|
if (seenRoots.has(resolvedRoot)) continue;
|
|
486
551
|
seenRoots.add(resolvedRoot);
|
|
487
552
|
const paths = extractSubagentPathsFromPackageRoot(resolvedRoot);
|
|
488
|
-
for (const
|
|
489
|
-
if (seenAgents.has(
|
|
490
|
-
seenAgents.add(
|
|
491
|
-
agents.push(
|
|
553
|
+
for (const agentPath of paths.agents) {
|
|
554
|
+
if (seenAgents.has(agentPath.dir)) continue;
|
|
555
|
+
seenAgents.add(agentPath.dir);
|
|
556
|
+
agents.push(agentPath);
|
|
492
557
|
}
|
|
493
558
|
for (const chainDir of paths.chains) {
|
|
494
559
|
if (seenChains.has(chainDir)) continue;
|
|
@@ -508,7 +573,7 @@ function normalizeAgentAliases(rawAliases: string[] | undefined, agentName: stri
|
|
|
508
573
|
function effectiveAgentMatch(matches: AgentConfig[]): { agent?: AgentConfig; error?: string } {
|
|
509
574
|
const distinctNames = [...new Set(matches.map((agent) => agent.name))];
|
|
510
575
|
if (distinctNames.length === 1) {
|
|
511
|
-
const sourceRank = new Map<AgentConfig["source"], number>([["builtin", 0], ["package", 1], ["user", 2], ["project", 3]]);
|
|
576
|
+
const sourceRank = new Map<AgentConfig["source"], number>([["builtin", 0], ["package", 1], ["user", 2], ["project", 3], ["runtime", 4]]);
|
|
512
577
|
const agent = [...matches].sort((a, b) => (sourceRank.get(b.source) ?? 0) - (sourceRank.get(a.source) ?? 0))[0];
|
|
513
578
|
return agent ? { agent } : {};
|
|
514
579
|
}
|
|
@@ -572,8 +637,13 @@ function arraysEqual(a: string[] | undefined, b: string[] | undefined): boolean
|
|
|
572
637
|
function cloneOverrideBase(agent: AgentConfig): BuiltinAgentOverrideBase {
|
|
573
638
|
return {
|
|
574
639
|
description: agent.description,
|
|
640
|
+
...(agent.output !== undefined ? { output: agent.output } : {}),
|
|
641
|
+
...(agent.outputMode !== undefined ? { outputMode: agent.outputMode } : {}),
|
|
642
|
+
...(agent.defaultReads !== undefined ? { defaultReads: [...agent.defaultReads] } : {}),
|
|
575
643
|
...(agent.model !== undefined ? { model: agent.model } : {}),
|
|
644
|
+
...(agent.modelProvider !== undefined ? { modelProvider: agent.modelProvider } : {}),
|
|
576
645
|
...(agent.fallbackModels ? { fallbackModels: [...agent.fallbackModels] } : {}),
|
|
646
|
+
...(agent.fast !== undefined ? { fast: agent.fast } : {}),
|
|
577
647
|
...(agent.thinking !== undefined ? { thinking: agent.thinking } : {}),
|
|
578
648
|
systemPromptMode: agent.systemPromptMode,
|
|
579
649
|
inheritProjectContext: agent.inheritProjectContext,
|
|
@@ -596,10 +666,15 @@ function cloneOverrideBase(agent: AgentConfig): BuiltinAgentOverrideBase {
|
|
|
596
666
|
function cloneOverrideValue(override: BuiltinAgentOverrideConfig): BuiltinAgentOverrideConfig {
|
|
597
667
|
return {
|
|
598
668
|
...(override.description !== undefined ? { description: override.description } : {}),
|
|
669
|
+
...(override.output !== undefined ? { output: override.output } : {}),
|
|
670
|
+
...(override.outputMode !== undefined ? { outputMode: override.outputMode } : {}),
|
|
671
|
+
...(override.defaultReads !== undefined ? { defaultReads: override.defaultReads === false ? false : [...override.defaultReads] } : {}),
|
|
599
672
|
...(override.model !== undefined ? { model: override.model } : {}),
|
|
673
|
+
...(override.defaultProvider !== undefined ? { defaultProvider: override.defaultProvider } : {}),
|
|
600
674
|
...(override.fallbackModels !== undefined
|
|
601
675
|
? { fallbackModels: override.fallbackModels === false ? false : [...override.fallbackModels] }
|
|
602
676
|
: {}),
|
|
677
|
+
...(override.fast !== undefined ? { fast: override.fast } : {}),
|
|
603
678
|
...(override.thinking !== undefined ? { thinking: override.thinking } : {}),
|
|
604
679
|
...(override.systemPromptMode !== undefined ? { systemPromptMode: override.systemPromptMode } : {}),
|
|
605
680
|
...(override.inheritProjectContext !== undefined ? { inheritProjectContext: override.inheritProjectContext } : {}),
|
|
@@ -618,9 +693,6 @@ function cloneOverrideValue(override: BuiltinAgentOverrideConfig): BuiltinAgentO
|
|
|
618
693
|
}
|
|
619
694
|
|
|
620
695
|
function isProjectRootCandidate(dir: string): boolean {
|
|
621
|
-
// The host's user config lives at <home>/.selesai, which must not make the
|
|
622
|
-
// home directory look like every unrelated project's root.
|
|
623
|
-
if (path.resolve(dir) === path.resolve(os.homedir())) return false;
|
|
624
696
|
return isDirectory(getProjectConfigDir(dir)) || isDirectory(path.join(dir, ".agents"));
|
|
625
697
|
}
|
|
626
698
|
|
|
@@ -779,11 +851,29 @@ function parseBuiltinOverrideEntry(
|
|
|
779
851
|
}
|
|
780
852
|
}
|
|
781
853
|
|
|
854
|
+
if ("output" in input) {
|
|
855
|
+
if ((typeof input.output === "string" && input.output.trim()) || input.output === false) override.output = input.output;
|
|
856
|
+
else throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'output'; expected a non-empty string or false.`);
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
if ("outputMode" in input) {
|
|
860
|
+
if (input.outputMode === "inline" || input.outputMode === "file-only") {
|
|
861
|
+
override.outputMode = input.outputMode;
|
|
862
|
+
} else {
|
|
863
|
+
throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'outputMode'; expected 'inline' or 'file-only'.`);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
|
|
782
867
|
if ("model" in input) {
|
|
783
868
|
if (typeof input.model === "string" || input.model === false) override.model = input.model;
|
|
784
869
|
else throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'model'; expected a string or false.`);
|
|
785
870
|
}
|
|
786
871
|
|
|
872
|
+
if ("fast" in input) {
|
|
873
|
+
if (typeof input.fast === "boolean") override.fast = input.fast;
|
|
874
|
+
else throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'fast'; expected a boolean.`);
|
|
875
|
+
}
|
|
876
|
+
|
|
787
877
|
if ("thinking" in input) {
|
|
788
878
|
if (typeof input.thinking === "string" || input.thinking === false) override.thinking = input.thinking;
|
|
789
879
|
else throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'thinking'; expected a string or false.`);
|
|
@@ -860,9 +950,18 @@ function parseBuiltinOverrideEntry(
|
|
|
860
950
|
else throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'systemPrompt'; expected a string.`);
|
|
861
951
|
}
|
|
862
952
|
|
|
953
|
+
const defaultReads = parseOverrideStringArrayOrFalse(input.defaultReads, { filePath, name, field: "defaultReads" });
|
|
954
|
+
if (defaultReads !== undefined) override.defaultReads = defaultReads;
|
|
955
|
+
|
|
863
956
|
const fallbackModels = parseOverrideStringArrayOrFalse(input.fallbackModels, { filePath, name, field: "fallbackModels" });
|
|
864
957
|
if (fallbackModels !== undefined) override.fallbackModels = fallbackModels;
|
|
865
958
|
|
|
959
|
+
if ("defaultProvider" in input) {
|
|
960
|
+
if (input.defaultProvider === false) override.defaultProvider = false;
|
|
961
|
+
else if (typeof input.defaultProvider === "string" && input.defaultProvider.trim()) override.defaultProvider = input.defaultProvider.trim();
|
|
962
|
+
else throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'defaultProvider'; expected a non-empty string or false.`);
|
|
963
|
+
}
|
|
964
|
+
|
|
866
965
|
const skills = parseOverrideStringArrayOrFalse(input.skills, { filePath, name, field: "skills" });
|
|
867
966
|
if (skills !== undefined) override.skills = skills;
|
|
868
967
|
|
|
@@ -909,6 +1008,14 @@ function readSubagentSettings(filePath: string | null): SubagentSettings {
|
|
|
909
1008
|
throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultModel'; expected a non-empty string.`);
|
|
910
1009
|
}
|
|
911
1010
|
}
|
|
1011
|
+
let defaultProvider: string | undefined;
|
|
1012
|
+
if ("defaultProvider" in subagentsObject) {
|
|
1013
|
+
if (typeof subagentsObject.defaultProvider === "string" && subagentsObject.defaultProvider.trim()) {
|
|
1014
|
+
defaultProvider = subagentsObject.defaultProvider.trim();
|
|
1015
|
+
} else {
|
|
1016
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultProvider'; expected a non-empty string.`);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
912
1019
|
let defaultThinking: string | undefined;
|
|
913
1020
|
if ("defaultThinking" in subagentsObject) {
|
|
914
1021
|
if (typeof subagentsObject.defaultThinking === "string" && subagentsObject.defaultThinking.trim()) {
|
|
@@ -917,6 +1024,14 @@ function readSubagentSettings(filePath: string | null): SubagentSettings {
|
|
|
917
1024
|
throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultThinking'; expected a non-empty string.`);
|
|
918
1025
|
}
|
|
919
1026
|
}
|
|
1027
|
+
let maxThinking: ThinkingLevel | undefined;
|
|
1028
|
+
if ("maxThinking" in subagentsObject) {
|
|
1029
|
+
try {
|
|
1030
|
+
maxThinking = parseThinkingLevel(subagentsObject.maxThinking, `'${filePath}' subagents.maxThinking`);
|
|
1031
|
+
} catch (error) {
|
|
1032
|
+
throw new Error(`Subagent settings in '${filePath}' have invalid 'maxThinking'; expected one of off, minimal, low, medium, high, xhigh, or max.`, { cause: error instanceof Error ? error : undefined });
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
920
1035
|
let defaultExtensions: string[] | undefined;
|
|
921
1036
|
if ("defaultExtensions" in subagentsObject) {
|
|
922
1037
|
if (!Array.isArray(subagentsObject.defaultExtensions)
|
|
@@ -932,7 +1047,9 @@ function readSubagentSettings(filePath: string | null): SubagentSettings {
|
|
|
932
1047
|
const parsedSettings: SubagentSettings = {
|
|
933
1048
|
overrides: parsed,
|
|
934
1049
|
...(defaultModel !== undefined ? { defaultModel } : {}),
|
|
1050
|
+
...(defaultProvider !== undefined ? { defaultProvider } : {}),
|
|
935
1051
|
...(defaultThinking !== undefined ? { defaultThinking } : {}),
|
|
1052
|
+
...(maxThinking !== undefined ? { maxThinking } : {}),
|
|
936
1053
|
...(defaultExtensions !== undefined ? { defaultExtensions } : {}),
|
|
937
1054
|
...(disableBuiltins !== undefined ? { disableBuiltins } : {}),
|
|
938
1055
|
...(disableThinking !== undefined ? { disableThinking } : {}),
|
|
@@ -948,25 +1065,39 @@ function readSubagentSettings(filePath: string | null): SubagentSettings {
|
|
|
948
1065
|
return parsedSettings;
|
|
949
1066
|
}
|
|
950
1067
|
|
|
1068
|
+
function resolveSubagentDefaultProvider(
|
|
1069
|
+
userSettings: SubagentSettings,
|
|
1070
|
+
projectSettings: SubagentSettings,
|
|
1071
|
+
projectSettingsPath: string | null,
|
|
1072
|
+
): string | undefined {
|
|
1073
|
+
if (projectSettingsPath && projectSettings.defaultProvider !== undefined) return projectSettings.defaultProvider;
|
|
1074
|
+
return userSettings.defaultProvider;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
951
1077
|
function resolveSubagentDefaultModel(
|
|
952
1078
|
userSettings: SubagentSettings,
|
|
953
1079
|
projectSettings: SubagentSettings,
|
|
954
1080
|
userSettingsPath: string,
|
|
955
1081
|
projectSettingsPath: string | null,
|
|
1082
|
+
defaultProvider: string | undefined,
|
|
956
1083
|
): AgentModelSourceInfo | undefined {
|
|
957
1084
|
if (projectSettingsPath && projectSettings.defaultModel !== undefined) {
|
|
958
|
-
return { type: "subagents.defaultModel", scope: "project", path: projectSettingsPath, model: projectSettings.defaultModel };
|
|
1085
|
+
return { type: "subagents.defaultModel", scope: "project", path: projectSettingsPath, model: projectSettings.defaultModel, ...(defaultProvider ? { defaultProvider } : {}) };
|
|
959
1086
|
}
|
|
960
1087
|
return userSettings.defaultModel !== undefined
|
|
961
|
-
? { type: "subagents.defaultModel", scope: "user", path: userSettingsPath, model: userSettings.defaultModel }
|
|
1088
|
+
? { type: "subagents.defaultModel", scope: "user", path: userSettingsPath, model: userSettings.defaultModel, ...(defaultProvider ? { defaultProvider } : {}) }
|
|
962
1089
|
: undefined;
|
|
963
1090
|
}
|
|
964
1091
|
|
|
965
|
-
function applySubagentDefaultModel(agents: AgentConfig[], defaultModel: AgentModelSourceInfo | undefined): AgentConfig[] {
|
|
966
|
-
if (!defaultModel) return agents;
|
|
1092
|
+
function applySubagentDefaultModel(agents: AgentConfig[], defaultModel: AgentModelSourceInfo | undefined, defaultProvider: string | undefined): AgentConfig[] {
|
|
1093
|
+
if (!defaultModel && !defaultProvider) return agents;
|
|
967
1094
|
return agents.map((agent) => {
|
|
968
|
-
if (agent.model !== undefined) return agent;
|
|
969
|
-
const next = {
|
|
1095
|
+
if (agent.model !== undefined && (agent.modelProvider !== undefined || !defaultProvider)) return agent;
|
|
1096
|
+
const next = {
|
|
1097
|
+
...agent,
|
|
1098
|
+
...(agent.model === undefined && defaultModel ? { model: defaultModel.model, modelSource: defaultModel } : {}),
|
|
1099
|
+
...(defaultProvider ? { modelProvider: defaultProvider } : {}),
|
|
1100
|
+
};
|
|
970
1101
|
const frontmatterFields = agentFrontmatterFields.get(agent);
|
|
971
1102
|
if (frontmatterFields) agentFrontmatterFields.set(next, frontmatterFields);
|
|
972
1103
|
return next;
|
|
@@ -993,6 +1124,20 @@ function applySubagentDefaultThinking(agents: AgentConfig[], defaultThinking: st
|
|
|
993
1124
|
});
|
|
994
1125
|
}
|
|
995
1126
|
|
|
1127
|
+
function resolveSubagentMaxThinking(
|
|
1128
|
+
userSettings: SubagentSettings,
|
|
1129
|
+
projectSettings: SubagentSettings,
|
|
1130
|
+
projectSettingsPath: string | null,
|
|
1131
|
+
): ThinkingLevel | undefined {
|
|
1132
|
+
if (projectSettingsPath && projectSettings.maxThinking !== undefined) return projectSettings.maxThinking;
|
|
1133
|
+
return userSettings.maxThinking;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
function applySubagentMaxThinking(agents: AgentConfig[], maxThinking: ThinkingLevel | undefined): AgentConfig[] {
|
|
1137
|
+
if (maxThinking === undefined) return agents;
|
|
1138
|
+
return agents.map((agent) => agent.maxThinking === maxThinking ? agent : { ...agent, maxThinking });
|
|
1139
|
+
}
|
|
1140
|
+
|
|
996
1141
|
function resolveSubagentDefaultExtensions(
|
|
997
1142
|
userSettings: SubagentSettings,
|
|
998
1143
|
projectSettings: SubagentSettings,
|
|
@@ -1016,11 +1161,12 @@ function applySubagentDefaultExtensions(agents: AgentConfig[], defaultExtensions
|
|
|
1016
1161
|
function applySubagentDefaults(
|
|
1017
1162
|
agents: AgentConfig[],
|
|
1018
1163
|
defaultModel: AgentModelSourceInfo | undefined,
|
|
1164
|
+
defaultProvider: string | undefined,
|
|
1019
1165
|
defaultThinking: string | undefined,
|
|
1020
1166
|
defaultExtensions: string[] | undefined,
|
|
1021
1167
|
): AgentConfig[] {
|
|
1022
1168
|
return applySubagentDefaultExtensions(
|
|
1023
|
-
applySubagentDefaultThinking(applySubagentDefaultModel(agents, defaultModel), defaultThinking),
|
|
1169
|
+
applySubagentDefaultThinking(applySubagentDefaultModel(agents, defaultModel, defaultProvider), defaultThinking),
|
|
1024
1170
|
defaultExtensions,
|
|
1025
1171
|
);
|
|
1026
1172
|
}
|
|
@@ -1047,11 +1193,19 @@ function applyBuiltinOverride(
|
|
|
1047
1193
|
};
|
|
1048
1194
|
|
|
1049
1195
|
if (override.description !== undefined) next.description = override.description;
|
|
1196
|
+
if (override.output !== undefined) { if (override.output === false) delete next.output; else next.output = override.output; }
|
|
1197
|
+
if (override.outputMode !== undefined) next.outputMode = override.outputMode;
|
|
1198
|
+
if (override.defaultReads !== undefined) { if (override.defaultReads === false) delete next.defaultReads; else next.defaultReads = [...override.defaultReads]; }
|
|
1050
1199
|
if (override.model !== undefined) {
|
|
1051
1200
|
if (override.model === false) delete next.model; else next.model = override.model;
|
|
1052
1201
|
delete next.modelSource;
|
|
1053
1202
|
}
|
|
1203
|
+
if (override.defaultProvider !== undefined) {
|
|
1204
|
+
if (override.defaultProvider === false) delete next.modelProvider;
|
|
1205
|
+
else next.modelProvider = override.defaultProvider;
|
|
1206
|
+
}
|
|
1054
1207
|
if (override.fallbackModels !== undefined) { if (override.fallbackModels === false) delete next.fallbackModels; else next.fallbackModels = [...override.fallbackModels]; }
|
|
1208
|
+
if (override.fast !== undefined) next.fast = override.fast;
|
|
1055
1209
|
if (override.thinking !== undefined) { if (override.thinking === false) delete next.thinking; else next.thinking = override.thinking; }
|
|
1056
1210
|
if (override.systemPromptMode !== undefined) next.systemPromptMode = override.systemPromptMode;
|
|
1057
1211
|
if (override.inheritProjectContext !== undefined) next.inheritProjectContext = override.inheritProjectContext;
|
|
@@ -1164,12 +1318,24 @@ function applyCustomAgentOverride(
|
|
|
1164
1318
|
mutable().description = override.description;
|
|
1165
1319
|
anyFilled = true;
|
|
1166
1320
|
}
|
|
1321
|
+
if (override.output !== undefined) {
|
|
1322
|
+
fill("output", ["output"], override.output === false ? undefined : override.output);
|
|
1323
|
+
}
|
|
1324
|
+
if (override.outputMode !== undefined) {
|
|
1325
|
+
fill("outputMode", ["outputMode"], override.outputMode);
|
|
1326
|
+
}
|
|
1327
|
+
if (override.defaultReads !== undefined) {
|
|
1328
|
+
fill("defaultReads", ["defaultReads"], override.defaultReads === false ? undefined : [...override.defaultReads]);
|
|
1329
|
+
}
|
|
1167
1330
|
if (override.model !== undefined && !agentHasFrontmatterField(agent, "model")) {
|
|
1168
1331
|
const target = mutable();
|
|
1169
1332
|
if (override.model === false) delete target.model; else target.model = override.model;
|
|
1170
1333
|
delete target.modelSource;
|
|
1171
1334
|
anyFilled = true;
|
|
1172
1335
|
}
|
|
1336
|
+
if (override.defaultProvider !== undefined) {
|
|
1337
|
+
fill("modelProvider", ["modelProvider", "defaultProvider"], override.defaultProvider === false ? undefined : override.defaultProvider);
|
|
1338
|
+
}
|
|
1173
1339
|
if (override.fallbackModels !== undefined) {
|
|
1174
1340
|
fill(
|
|
1175
1341
|
"fallbackModels",
|
|
@@ -1177,6 +1343,9 @@ function applyCustomAgentOverride(
|
|
|
1177
1343
|
override.fallbackModels === false ? undefined : [...override.fallbackModels],
|
|
1178
1344
|
);
|
|
1179
1345
|
}
|
|
1346
|
+
if (override.fast !== undefined) {
|
|
1347
|
+
fill("fast", ["fast"], override.fast);
|
|
1348
|
+
}
|
|
1180
1349
|
if (override.thinking !== undefined) {
|
|
1181
1350
|
fill("thinking", ["thinking"], override.thinking === false ? undefined : override.thinking);
|
|
1182
1351
|
}
|
|
@@ -1195,7 +1364,8 @@ function applyCustomAgentOverride(
|
|
|
1195
1364
|
if (override.acceptanceRole !== undefined) {
|
|
1196
1365
|
fill("acceptanceRole", ["acceptanceRole"], override.acceptanceRole === false ? undefined : override.acceptanceRole);
|
|
1197
1366
|
}
|
|
1198
|
-
if (override.disabled !== undefined
|
|
1367
|
+
if (override.disabled !== undefined) {
|
|
1368
|
+
// Custom agent files cannot set `disabled`, so project overrides replace user overrides.
|
|
1199
1369
|
mutable().disabled = override.disabled;
|
|
1200
1370
|
anyFilled = true;
|
|
1201
1371
|
}
|
|
@@ -1224,7 +1394,7 @@ function applyCustomAgentOverride(
|
|
|
1224
1394
|
}
|
|
1225
1395
|
|
|
1226
1396
|
if (!anyFilled || !next) return agent;
|
|
1227
|
-
next.override = { ...meta, base: cloneOverrideBase(agent) };
|
|
1397
|
+
next.override = { ...meta, base: agent.override?.base ?? cloneOverrideBase(agent) };
|
|
1228
1398
|
const frontmatterFields = agentFrontmatterFields.get(agent);
|
|
1229
1399
|
if (frontmatterFields) agentFrontmatterFields.set(next, frontmatterFields);
|
|
1230
1400
|
return next;
|
|
@@ -1237,24 +1407,25 @@ function applyCustomAgentOverrides(
|
|
|
1237
1407
|
userSettingsPath: string,
|
|
1238
1408
|
projectSettingsPath: string | null,
|
|
1239
1409
|
): AgentConfig[] {
|
|
1410
|
+
// Apply user then project so project fields win without dropping user-only fields.
|
|
1240
1411
|
return agents.map((agent) => {
|
|
1412
|
+
const userOverride = userSettings.overrides[agent.name];
|
|
1413
|
+
const withUserOverride = userOverride
|
|
1414
|
+
? applyCustomAgentOverride(agent, userOverride, { scope: "user", path: userSettingsPath })
|
|
1415
|
+
: agent;
|
|
1416
|
+
|
|
1241
1417
|
const projectOverride = projectSettings.overrides[agent.name];
|
|
1242
1418
|
if (projectOverride && projectSettingsPath) {
|
|
1243
|
-
return applyCustomAgentOverride(
|
|
1419
|
+
return applyCustomAgentOverride(withUserOverride, projectOverride, { scope: "project", path: projectSettingsPath });
|
|
1244
1420
|
}
|
|
1245
1421
|
|
|
1246
|
-
|
|
1247
|
-
if (userOverride) {
|
|
1248
|
-
return applyCustomAgentOverride(agent, userOverride, { scope: "user", path: userSettingsPath });
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
return agent;
|
|
1422
|
+
return withUserOverride;
|
|
1252
1423
|
});
|
|
1253
1424
|
}
|
|
1254
1425
|
|
|
1255
1426
|
export function buildBuiltinOverrideConfig(
|
|
1256
1427
|
base: BuiltinAgentOverrideBase,
|
|
1257
|
-
draft: Pick<AgentConfig, "model" | "fallbackModels" | "thinking" | "systemPromptMode" | "inheritProjectContext" | "inheritSkills" | "defaultContext" | "acceptanceRole" | "disabled" | "systemPrompt" | "skills" | "tools" | "mcpDirectTools" | "extensions" | "subagentOnlyExtensions" | "completionGuard" | "toolBudget"> & Partial<Pick<AgentConfig, "description">>,
|
|
1428
|
+
draft: Pick<AgentConfig, "model" | "modelProvider" | "fallbackModels" | "fast" | "thinking" | "systemPromptMode" | "inheritProjectContext" | "inheritSkills" | "defaultContext" | "acceptanceRole" | "disabled" | "systemPrompt" | "skills" | "tools" | "mcpDirectTools" | "extensions" | "subagentOnlyExtensions" | "completionGuard" | "toolBudget"> & Partial<Pick<AgentConfig, "description" | "output" | "outputMode" | "defaultReads">>,
|
|
1258
1429
|
): BuiltinAgentOverrideConfig | undefined {
|
|
1259
1430
|
const override: BuiltinAgentOverrideConfig = {};
|
|
1260
1431
|
|
|
@@ -1262,8 +1433,13 @@ export function buildBuiltinOverrideConfig(
|
|
|
1262
1433
|
const description = draft.description.trim();
|
|
1263
1434
|
if (description && description !== base.description) override.description = description;
|
|
1264
1435
|
}
|
|
1436
|
+
if (draft.output !== base.output) override.output = draft.output ?? false;
|
|
1437
|
+
if (draft.outputMode !== undefined && draft.outputMode !== base.outputMode) override.outputMode = draft.outputMode;
|
|
1438
|
+
if (!arraysEqual(draft.defaultReads, base.defaultReads)) override.defaultReads = draft.defaultReads ? [...draft.defaultReads] : false;
|
|
1265
1439
|
if (draft.model !== base.model) override.model = draft.model ?? false;
|
|
1440
|
+
if (draft.modelProvider !== base.modelProvider) override.defaultProvider = draft.modelProvider ?? false;
|
|
1266
1441
|
if (!arraysEqual(draft.fallbackModels, base.fallbackModels)) override.fallbackModels = draft.fallbackModels ? [...draft.fallbackModels] : false;
|
|
1442
|
+
if (draft.fast !== base.fast) override.fast = draft.fast === true;
|
|
1267
1443
|
if (draft.thinking !== base.thinking) override.thinking = draft.thinking ?? false;
|
|
1268
1444
|
if (draft.systemPromptMode !== base.systemPromptMode) override.systemPromptMode = draft.systemPromptMode;
|
|
1269
1445
|
if (draft.inheritProjectContext !== base.inheritProjectContext) override.inheritProjectContext = draft.inheritProjectContext;
|
|
@@ -1457,6 +1633,14 @@ function isLegacyAgentSkillPath(rootDir: string, filePath: string): boolean {
|
|
|
1457
1633
|
return parts.some((part, index) => part === ".agents" && parts[index + 1] === "skills");
|
|
1458
1634
|
}
|
|
1459
1635
|
|
|
1636
|
+
function isJsonSerializable(value: unknown): boolean {
|
|
1637
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
1638
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
1639
|
+
if (Array.isArray(value)) return value.every(isJsonSerializable);
|
|
1640
|
+
if (value && typeof value === "object") return Object.values(value).every(isJsonSerializable);
|
|
1641
|
+
return false;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1460
1644
|
function parseAgentRunnerFrontmatter(raw: string | undefined, agentName: string): AgentRunnerConfig | undefined {
|
|
1461
1645
|
if (raw === undefined || !raw.trim()) return undefined;
|
|
1462
1646
|
let parsed: unknown;
|
|
@@ -1473,8 +1657,24 @@ function parseAgentRunnerFrontmatter(raw: string | undefined, agentName: string)
|
|
|
1473
1657
|
if (Object.keys(runner).some((key) => key !== "type")) throw new Error(`Agent '${agentName}' has invalid Pi runner frontmatter; only 'type' is supported.`);
|
|
1474
1658
|
return { type: "pi" };
|
|
1475
1659
|
}
|
|
1660
|
+
if (runner.type === "external-job") {
|
|
1661
|
+
if (typeof runner.provider !== "string" || !runner.provider.trim() || runner.provider.trim() !== runner.provider) {
|
|
1662
|
+
throw new Error(`Agent '${agentName}' external-job runner requires a non-empty trimmed provider string.`);
|
|
1663
|
+
}
|
|
1664
|
+
if (runner.options !== undefined && (!runner.options || typeof runner.options !== "object" || Array.isArray(runner.options) || !isJsonSerializable(runner.options))) {
|
|
1665
|
+
throw new Error(`Agent '${agentName}' external-job runner options must be a JSON-serializable object.`);
|
|
1666
|
+
}
|
|
1667
|
+
const supported = new Set(["type", "provider", "options"]);
|
|
1668
|
+
const unknown = Object.keys(runner).filter((key) => !supported.has(key));
|
|
1669
|
+
if (unknown.length > 0) throw new Error(`Agent '${agentName}' external-job runner has unsupported fields: ${unknown.join(", ")}.`);
|
|
1670
|
+
return {
|
|
1671
|
+
type: "external-job",
|
|
1672
|
+
provider: runner.provider,
|
|
1673
|
+
...(runner.options ? { options: runner.options as Record<string, unknown> } : {}),
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1476
1676
|
if (runner.type !== "external-cli") {
|
|
1477
|
-
throw new Error(`Agent '${agentName}' has invalid runner.type; expected 'pi' or 'external-
|
|
1677
|
+
throw new Error(`Agent '${agentName}' has invalid runner.type; expected 'pi', 'external-cli', or 'external-job'.`);
|
|
1478
1678
|
}
|
|
1479
1679
|
if (typeof runner.command !== "string" || !runner.command.trim()) {
|
|
1480
1680
|
throw new Error(`Agent '${agentName}' external-cli runner requires a non-empty command string.`);
|
|
@@ -1498,11 +1698,11 @@ function parseAgentRunnerFrontmatter(raw: string | undefined, agentName: string)
|
|
|
1498
1698
|
}
|
|
1499
1699
|
|
|
1500
1700
|
function validateExternalRunnerProfile(frontmatter: Record<string, string>, agentName: string, runner: AgentRunnerConfig | undefined): void {
|
|
1501
|
-
if (runner?.type !== "external-cli") return;
|
|
1701
|
+
if (runner?.type !== "external-cli" && runner?.type !== "external-job") return;
|
|
1502
1702
|
const unsupported = ["tools", "model", "fallbackModels", "thinking", "extensions", "subagentOnlyExtensions", "maxSubagentDepth", "completionGuard", "skills", "skill", "skillPath", "toolBudget", "permission", "permissions"]
|
|
1503
1703
|
.filter((field) => frontmatter[field] !== undefined);
|
|
1504
1704
|
if (unsupported.length > 0) {
|
|
1505
|
-
throw new Error(`Agent '${agentName}' uses runner.type='
|
|
1705
|
+
throw new Error(`Agent '${agentName}' uses runner.type='${runner.type}' and declares unsupported Pi-only fields: ${unsupported.join(", ")}.`);
|
|
1506
1706
|
}
|
|
1507
1707
|
}
|
|
1508
1708
|
|
|
@@ -1519,21 +1719,48 @@ function parseAgentAcceptanceFrontmatter(raw: string | undefined, agentName: str
|
|
|
1519
1719
|
return parsed as AcceptanceInput;
|
|
1520
1720
|
}
|
|
1521
1721
|
|
|
1522
|
-
|
|
1523
|
-
|
|
1722
|
+
interface AgentDefinitionFile {
|
|
1723
|
+
filePath: string;
|
|
1724
|
+
content: string;
|
|
1725
|
+
}
|
|
1524
1726
|
|
|
1727
|
+
function readAgentDefinitionFiles(dir: string): AgentDefinitionFile[] {
|
|
1728
|
+
const files: AgentDefinitionFile[] = [];
|
|
1525
1729
|
for (const filePath of listFilesRecursive(dir, (fileName) => fileName.endsWith(".md") && !fileName.endsWith(".chain.md"))) {
|
|
1526
1730
|
if (isLegacyAgentSkillPath(dir, filePath)) {
|
|
1527
1731
|
continue;
|
|
1528
1732
|
}
|
|
1529
1733
|
|
|
1530
|
-
let content: string;
|
|
1531
1734
|
try {
|
|
1532
|
-
content
|
|
1735
|
+
files.push({ filePath, content: fs.readFileSync(filePath, "utf-8") });
|
|
1533
1736
|
} catch {
|
|
1534
1737
|
continue;
|
|
1535
1738
|
}
|
|
1739
|
+
}
|
|
1740
|
+
return files;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
function resolveAgentRelativeExtensionPaths(paths: string[] | undefined, agentFilePath: string): string[] | undefined {
|
|
1744
|
+
if (paths === undefined) return undefined;
|
|
1745
|
+
const baseDir = path.dirname(agentFilePath);
|
|
1746
|
+
return paths.map((entry) => {
|
|
1747
|
+
const trimmed = entry.trim();
|
|
1748
|
+
if (trimmed === "." || trimmed === ".." || trimmed.startsWith("./") || trimmed.startsWith("../")) {
|
|
1749
|
+
return path.resolve(baseDir, trimmed);
|
|
1750
|
+
}
|
|
1751
|
+
return entry;
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
function loadAgentsFromDefinitionFiles(files: AgentDefinitionFile[], source: AgentSource, discoveryPriority?: number, packageSource?: Omit<PackageSubagentPath, "dir">): { agents: AgentConfig[]; diagnostics: AgentDiscoveryDiagnostic[] } {
|
|
1756
|
+
const agents: AgentConfig[] = [];
|
|
1757
|
+
const diagnostics: AgentDiscoveryDiagnostic[] = [];
|
|
1536
1758
|
|
|
1759
|
+
for (const { filePath, content } of files) {
|
|
1760
|
+
let name: string | undefined;
|
|
1761
|
+
let runtimeName: string | undefined;
|
|
1762
|
+
let packageSpecified = false;
|
|
1763
|
+
try {
|
|
1537
1764
|
const { frontmatter, body } = parseFrontmatter(content);
|
|
1538
1765
|
|
|
1539
1766
|
if (!frontmatter.name || !frontmatter.description) {
|
|
@@ -1541,10 +1768,12 @@ function loadAgentsFromDir(dir: string, source: AgentSource): AgentConfig[] {
|
|
|
1541
1768
|
}
|
|
1542
1769
|
|
|
1543
1770
|
const localName = frontmatter.name;
|
|
1771
|
+
name = localName;
|
|
1544
1772
|
const parsedPackage = parsePackageName(frontmatter.package, `Agent '${localName}' package`);
|
|
1545
|
-
|
|
1773
|
+
packageSpecified = parsedPackage.packageName !== undefined || parsedPackage.error !== undefined;
|
|
1774
|
+
if (parsedPackage.error) throw new Error(parsedPackage.error);
|
|
1546
1775
|
const packageName = parsedPackage.packageName;
|
|
1547
|
-
|
|
1776
|
+
runtimeName = buildRuntimeName(localName, packageName);
|
|
1548
1777
|
|
|
1549
1778
|
const runner = parseAgentRunnerFrontmatter(frontmatter.runner, localName);
|
|
1550
1779
|
validateExternalRunnerProfile(frontmatter, localName, runner);
|
|
@@ -1608,14 +1837,25 @@ function loadAgentsFromDir(dir: string, source: AgentSource): AgentConfig[] {
|
|
|
1608
1837
|
defaultTurnBudget = resolved.turnBudget;
|
|
1609
1838
|
}
|
|
1610
1839
|
const defaultAcceptance = parseAgentAcceptanceFrontmatter(frontmatter.acceptance, localName);
|
|
1840
|
+
let outputMode: OutputMode | undefined;
|
|
1841
|
+
if (frontmatter.outputMode !== undefined) {
|
|
1842
|
+
if (frontmatter.outputMode === "inline" || frontmatter.outputMode === "file-only") outputMode = frontmatter.outputMode;
|
|
1843
|
+
else throw new Error(`Agent '${localName}' has invalid outputMode frontmatter; expected 'inline' or 'file-only'.`);
|
|
1844
|
+
}
|
|
1611
1845
|
let acceptanceRole: AcceptanceRole | undefined;
|
|
1612
1846
|
if (frontmatter.acceptanceRole !== undefined && frontmatter.acceptanceRole.trim()) {
|
|
1613
1847
|
if (frontmatter.acceptanceRole === "read-only" || frontmatter.acceptanceRole === "writer") acceptanceRole = frontmatter.acceptanceRole;
|
|
1614
1848
|
else throw new Error(`Agent '${localName}' has invalid acceptanceRole frontmatter; expected 'read-only' or 'writer'.`);
|
|
1615
1849
|
}
|
|
1616
1850
|
|
|
1617
|
-
const extensions = parseFrontmatterList(frontmatter.extensions);
|
|
1618
|
-
const subagentOnlyExtensions = parseFrontmatterList(frontmatter.subagentOnlyExtensions);
|
|
1851
|
+
const extensions = resolveAgentRelativeExtensionPaths(parseFrontmatterList(frontmatter.extensions), filePath);
|
|
1852
|
+
const subagentOnlyExtensions = resolveAgentRelativeExtensionPaths(parseFrontmatterList(frontmatter.subagentOnlyExtensions), filePath);
|
|
1853
|
+
let fast: boolean | undefined;
|
|
1854
|
+
if (frontmatter.fast !== undefined) {
|
|
1855
|
+
if (frontmatter.fast === "true") fast = true;
|
|
1856
|
+
else if (frontmatter.fast === "false") fast = false;
|
|
1857
|
+
else throw new Error(`Agent '${localName}' has invalid fast frontmatter; expected true or false.`);
|
|
1858
|
+
}
|
|
1619
1859
|
|
|
1620
1860
|
const extraFields: Record<string, string> = {};
|
|
1621
1861
|
for (const [key, value] of Object.entries(frontmatter)) {
|
|
@@ -1653,12 +1893,16 @@ function loadAgentsFromDir(dir: string, source: AgentSource): AgentConfig[] {
|
|
|
1653
1893
|
...(runner !== undefined ? { runner } : {}),
|
|
1654
1894
|
localName,
|
|
1655
1895
|
...(packageName !== undefined ? { packageName } : {}),
|
|
1896
|
+
...(packageSource?.packageName ? { packageSourceName: packageSource.packageName } : {}),
|
|
1897
|
+
...(packageSource?.packageVersion ? { packageSourceVersion: packageSource.packageVersion } : {}),
|
|
1898
|
+
...(packageSource?.packageRoot ? { packageSourceRoot: packageSource.packageRoot } : {}),
|
|
1656
1899
|
description: frontmatter.description,
|
|
1657
1900
|
...(aliases !== undefined ? { aliases } : {}),
|
|
1658
1901
|
...(rawTools !== undefined ? { tools } : {}),
|
|
1659
1902
|
...(mcpDirectTools.length > 0 ? { mcpDirectTools } : {}),
|
|
1660
1903
|
...(frontmatter.model !== undefined ? { model: frontmatter.model } : {}),
|
|
1661
1904
|
...(fallbackModels?.length ? { fallbackModels } : {}),
|
|
1905
|
+
...(fast !== undefined ? { fast } : {}),
|
|
1662
1906
|
...(frontmatter.thinking !== undefined ? { thinking: frontmatter.thinking === "false" ? false : frontmatter.thinking } : {}),
|
|
1663
1907
|
systemPromptMode,
|
|
1664
1908
|
inheritProjectContext,
|
|
@@ -1673,11 +1917,13 @@ function loadAgentsFromDir(dir: string, source: AgentSource): AgentConfig[] {
|
|
|
1673
1917
|
systemPrompt: body,
|
|
1674
1918
|
source,
|
|
1675
1919
|
filePath,
|
|
1920
|
+
...(discoveryPriority !== undefined ? { discoveryPriority } : {}),
|
|
1676
1921
|
...(skills?.length ? { skills } : {}),
|
|
1677
1922
|
...(skillPath?.length ? { skillPath } : {}),
|
|
1678
1923
|
...(extensions !== undefined ? { extensions } : {}),
|
|
1679
1924
|
...(subagentOnlyExtensions !== undefined ? { subagentOnlyExtensions } : {}),
|
|
1680
1925
|
...(frontmatter.output !== undefined ? { output: frontmatter.output } : {}),
|
|
1926
|
+
...(outputMode !== undefined ? { outputMode } : {}),
|
|
1681
1927
|
...(defaultReads?.length ? { defaultReads } : {}),
|
|
1682
1928
|
defaultProgress: frontmatter.defaultProgress === "true",
|
|
1683
1929
|
interactive: frontmatter.interactive === "true",
|
|
@@ -1690,9 +1936,16 @@ function loadAgentsFromDir(dir: string, source: AgentSource): AgentConfig[] {
|
|
|
1690
1936
|
};
|
|
1691
1937
|
agentFrontmatterFields.set(agent, new Set(Object.keys(frontmatter)));
|
|
1692
1938
|
agents.push(agent);
|
|
1939
|
+
} catch (error) {
|
|
1940
|
+
diagnostics.push({ source, filePath, ...(name ? { name } : {}), ...(runtimeName && runtimeName !== name ? { runtimeName } : {}), ...(packageSpecified ? { packageSpecified: true } : {}), ...(discoveryPriority !== undefined ? { discoveryPriority } : {}), error: error instanceof Error ? error.message : String(error) });
|
|
1941
|
+
}
|
|
1693
1942
|
}
|
|
1694
1943
|
|
|
1695
|
-
return agents;
|
|
1944
|
+
return { agents, diagnostics };
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
function loadAgentsFromDir(dir: string, source: AgentSource, discoveryPriority?: number, packageSource?: Omit<PackageSubagentPath, "dir">): { agents: AgentConfig[]; diagnostics: AgentDiscoveryDiagnostic[] } {
|
|
1948
|
+
return loadAgentsFromDefinitionFiles(readAgentDefinitionFiles(dir), source, discoveryPriority, packageSource);
|
|
1696
1949
|
}
|
|
1697
1950
|
|
|
1698
1951
|
function loadChainsFromDir(dir: string, source: AgentSource): { chains: ChainConfig[]; diagnostics: ChainDiscoveryDiagnostic[] } {
|
|
@@ -1756,6 +2009,7 @@ function resolveNearestProjectChainDirs(cwd: string): { readDirs: string[]; pref
|
|
|
1756
2009
|
};
|
|
1757
2010
|
}
|
|
1758
2011
|
const BUILTIN_AGENTS_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "agents");
|
|
2012
|
+
const BUILTIN_AGENT_DEFINITION_FILES = readAgentDefinitionFiles(BUILTIN_AGENTS_DIR);
|
|
1759
2013
|
|
|
1760
2014
|
export const EXTRA_AGENT_DIRS_ENV = "SELESAI_SUBAGENT_EXTRA_AGENT_DIRS";
|
|
1761
2015
|
|
|
@@ -1781,8 +2035,10 @@ export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryRe
|
|
|
1781
2035
|
const projectSettingsPath = getProjectAgentSettingsPath(cwd);
|
|
1782
2036
|
const userSettings = scope === "project" ? EMPTY_SUBAGENT_SETTINGS : readSubagentSettings(userSettingsPath);
|
|
1783
2037
|
const projectSettings = scope === "user" ? EMPTY_SUBAGENT_SETTINGS : readSubagentSettings(projectSettingsPath);
|
|
1784
|
-
const
|
|
2038
|
+
const defaultProvider = resolveSubagentDefaultProvider(userSettings, projectSettings, projectSettingsPath);
|
|
2039
|
+
const defaultModel = resolveSubagentDefaultModel(userSettings, projectSettings, userSettingsPath, projectSettingsPath, defaultProvider);
|
|
1785
2040
|
const defaultThinking = resolveSubagentDefaultThinking(userSettings, projectSettings, projectSettingsPath);
|
|
2041
|
+
const maxThinking = resolveSubagentMaxThinking(userSettings, projectSettings, projectSettingsPath);
|
|
1786
2042
|
const defaultExtensions = resolveSubagentDefaultExtensions(userSettings, projectSettings, projectSettingsPath);
|
|
1787
2043
|
const modelScope = projectSettings.modelScope ?? userSettings.modelScope;
|
|
1788
2044
|
const packageSubagentPaths = collectPackageSubagentPaths(cwd, {
|
|
@@ -1790,43 +2046,60 @@ export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryRe
|
|
|
1790
2046
|
includeProject: scope !== "user",
|
|
1791
2047
|
});
|
|
1792
2048
|
|
|
2049
|
+
const builtinLoaded = loadAgentsFromDefinitionFiles(BUILTIN_AGENT_DEFINITION_FILES, "builtin");
|
|
1793
2050
|
const builtinAgents = applyBuiltinOverrides(
|
|
1794
|
-
applySubagentDefaults(
|
|
2051
|
+
applySubagentDefaults(builtinLoaded.agents, defaultModel, defaultProvider, defaultThinking, defaultExtensions),
|
|
1795
2052
|
userSettings,
|
|
1796
2053
|
projectSettings,
|
|
1797
2054
|
userSettingsPath,
|
|
1798
2055
|
projectSettingsPath,
|
|
1799
2056
|
);
|
|
1800
2057
|
|
|
1801
|
-
const
|
|
1802
|
-
|
|
1803
|
-
const userAgentsNew = scope === "project" ? [] : loadAgentsFromDir(userDirNew, "user");
|
|
2058
|
+
const userLoaded = scope === "project" ? [] : [...extraUserAgentDirs(), userDirOld, userDirNew]
|
|
2059
|
+
.map((dir, discoveryPriority) => loadAgentsFromDir(dir, "user", discoveryPriority));
|
|
1804
2060
|
const userAgents = applyCustomAgentOverrides(
|
|
1805
|
-
applySubagentDefaults(
|
|
2061
|
+
applySubagentDefaults(userLoaded.flatMap((loaded) => loaded.agents), defaultModel, defaultProvider, defaultThinking, defaultExtensions),
|
|
1806
2062
|
userSettings,
|
|
1807
2063
|
projectSettings,
|
|
1808
2064
|
userSettingsPath,
|
|
1809
2065
|
projectSettingsPath,
|
|
1810
2066
|
);
|
|
1811
2067
|
|
|
2068
|
+
const projectLoaded = scope === "user" ? [] : projectAgentDirs.map((dir) => loadAgentsFromDir(dir, "project", dir === projectAgentsDir ? 1 : 0));
|
|
1812
2069
|
const projectAgents = applyCustomAgentOverrides(
|
|
1813
|
-
applySubagentDefaults(
|
|
2070
|
+
applySubagentDefaults(projectLoaded.flatMap((loaded) => loaded.agents), defaultModel, defaultProvider, defaultThinking, defaultExtensions),
|
|
1814
2071
|
userSettings,
|
|
1815
2072
|
projectSettings,
|
|
1816
2073
|
userSettingsPath,
|
|
1817
2074
|
projectSettingsPath,
|
|
1818
2075
|
);
|
|
2076
|
+
const packageLoaded = packageSubagentPaths.agents.map((entry, index) => loadAgentsFromDir(entry.dir, "package", packageSubagentPaths.agents.length - index, entry));
|
|
2077
|
+
const packageMap = new Map<string, AgentConfig>();
|
|
2078
|
+
for (const loaded of packageLoaded) {
|
|
2079
|
+
for (const agent of loaded.agents) {
|
|
2080
|
+
if (!packageMap.has(agent.name)) packageMap.set(agent.name, agent);
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
1819
2083
|
const packageAgents = applyCustomAgentOverrides(
|
|
1820
|
-
applySubagentDefaults(
|
|
2084
|
+
applySubagentDefaults(Array.from(packageMap.values()), defaultModel, defaultProvider, defaultThinking, defaultExtensions),
|
|
1821
2085
|
userSettings,
|
|
1822
2086
|
projectSettings,
|
|
1823
2087
|
userSettingsPath,
|
|
1824
2088
|
projectSettingsPath,
|
|
1825
2089
|
);
|
|
1826
|
-
const agents =
|
|
1827
|
-
|
|
2090
|
+
const agents = applySubagentMaxThinking(
|
|
2091
|
+
mergeAgentsForScope(scope, userAgents, projectAgents, builtinAgents, packageAgents)
|
|
2092
|
+
.filter((agent) => agent.disabled !== true),
|
|
2093
|
+
maxThinking,
|
|
2094
|
+
);
|
|
1828
2095
|
|
|
1829
|
-
|
|
2096
|
+
const agentDiagnostics = [
|
|
2097
|
+
...builtinLoaded.diagnostics,
|
|
2098
|
+
...userLoaded.flatMap((loaded) => loaded.diagnostics),
|
|
2099
|
+
...projectLoaded.flatMap((loaded) => loaded.diagnostics),
|
|
2100
|
+
...packageLoaded.flatMap((loaded) => loaded.diagnostics),
|
|
2101
|
+
];
|
|
2102
|
+
return { agents, agentDiagnostics, projectAgentsDir, ...(modelScope !== undefined ? { modelScope } : {}), ...(maxThinking !== undefined ? { maxThinking } : {}) };
|
|
1830
2103
|
}
|
|
1831
2104
|
|
|
1832
2105
|
export function discoverAgentsAll(cwd: string): {
|
|
@@ -1834,6 +2107,7 @@ export function discoverAgentsAll(cwd: string): {
|
|
|
1834
2107
|
package: AgentConfig[];
|
|
1835
2108
|
user: AgentConfig[];
|
|
1836
2109
|
project: AgentConfig[];
|
|
2110
|
+
agentDiagnostics?: AgentDiscoveryDiagnostic[];
|
|
1837
2111
|
chains: ChainConfig[];
|
|
1838
2112
|
chainDiagnostics: ChainDiscoveryDiagnostic[];
|
|
1839
2113
|
userDir: string;
|
|
@@ -1842,6 +2116,7 @@ export function discoverAgentsAll(cwd: string): {
|
|
|
1842
2116
|
projectChainDir: string | null;
|
|
1843
2117
|
userSettingsPath: string;
|
|
1844
2118
|
projectSettingsPath: string | null;
|
|
2119
|
+
maxThinking?: ThinkingLevel;
|
|
1845
2120
|
} {
|
|
1846
2121
|
const userDirOld = path.join(getAgentDir(), "agents");
|
|
1847
2122
|
const userDirNew = path.join(os.homedir(), ".agents");
|
|
@@ -1852,50 +2127,57 @@ export function discoverAgentsAll(cwd: string): {
|
|
|
1852
2127
|
const projectSettingsPath = getProjectAgentSettingsPath(cwd);
|
|
1853
2128
|
const userSettings = readSubagentSettings(userSettingsPath);
|
|
1854
2129
|
const projectSettings = readSubagentSettings(projectSettingsPath);
|
|
1855
|
-
const
|
|
2130
|
+
const defaultProvider = resolveSubagentDefaultProvider(userSettings, projectSettings, projectSettingsPath);
|
|
2131
|
+
const defaultModel = resolveSubagentDefaultModel(userSettings, projectSettings, userSettingsPath, projectSettingsPath, defaultProvider);
|
|
1856
2132
|
const defaultThinking = resolveSubagentDefaultThinking(userSettings, projectSettings, projectSettingsPath);
|
|
2133
|
+
const maxThinking = resolveSubagentMaxThinking(userSettings, projectSettings, projectSettingsPath);
|
|
1857
2134
|
const defaultExtensions = resolveSubagentDefaultExtensions(userSettings, projectSettings, projectSettingsPath);
|
|
1858
2135
|
const packageSubagentPaths = collectPackageSubagentPaths(cwd);
|
|
1859
2136
|
|
|
2137
|
+
const builtinLoaded = loadAgentsFromDefinitionFiles(BUILTIN_AGENT_DEFINITION_FILES, "builtin");
|
|
1860
2138
|
const builtin = applyBuiltinOverrides(
|
|
1861
|
-
applySubagentDefaults(
|
|
2139
|
+
applySubagentDefaults(builtinLoaded.agents, defaultModel, defaultProvider, defaultThinking, defaultExtensions),
|
|
1862
2140
|
userSettings,
|
|
1863
2141
|
projectSettings,
|
|
1864
2142
|
userSettingsPath,
|
|
1865
2143
|
projectSettingsPath,
|
|
1866
2144
|
);
|
|
2145
|
+
const userLoaded = [...extraUserAgentDirs(), userDirOld, userDirNew]
|
|
2146
|
+
.map((dir, discoveryPriority) => loadAgentsFromDir(dir, "user", discoveryPriority));
|
|
1867
2147
|
const user = applyCustomAgentOverrides(
|
|
1868
|
-
applySubagentDefaults(
|
|
1869
|
-
...extraUserAgentDirs().flatMap((dir) => loadAgentsFromDir(dir, "user")),
|
|
1870
|
-
...loadAgentsFromDir(userDirOld, "user"),
|
|
1871
|
-
...loadAgentsFromDir(userDirNew, "user"),
|
|
1872
|
-
], defaultModel, defaultThinking, defaultExtensions),
|
|
2148
|
+
applySubagentDefaults(userLoaded.flatMap((loaded) => loaded.agents), defaultModel, defaultProvider, defaultThinking, defaultExtensions),
|
|
1873
2149
|
userSettings,
|
|
1874
2150
|
projectSettings,
|
|
1875
2151
|
userSettingsPath,
|
|
1876
2152
|
projectSettingsPath,
|
|
1877
2153
|
);
|
|
1878
2154
|
const packageMap = new Map<string, AgentConfig>();
|
|
1879
|
-
|
|
1880
|
-
|
|
2155
|
+
const packageAgentDiagnostics: AgentDiscoveryDiagnostic[] = [];
|
|
2156
|
+
for (const [index, entry] of packageSubagentPaths.agents.entries()) {
|
|
2157
|
+
const loaded = loadAgentsFromDir(entry.dir, "package", packageSubagentPaths.agents.length - index, entry);
|
|
2158
|
+
packageAgentDiagnostics.push(...loaded.diagnostics);
|
|
2159
|
+
for (const agent of loaded.agents) {
|
|
1881
2160
|
if (!packageMap.has(agent.name)) packageMap.set(agent.name, agent);
|
|
1882
2161
|
}
|
|
1883
2162
|
}
|
|
1884
2163
|
const packageAgents = applyCustomAgentOverrides(
|
|
1885
|
-
applySubagentDefaults(Array.from(packageMap.values()), defaultModel, defaultThinking, defaultExtensions),
|
|
2164
|
+
applySubagentDefaults(Array.from(packageMap.values()), defaultModel, defaultProvider, defaultThinking, defaultExtensions),
|
|
1886
2165
|
userSettings,
|
|
1887
2166
|
projectSettings,
|
|
1888
2167
|
userSettingsPath,
|
|
1889
2168
|
projectSettingsPath,
|
|
1890
2169
|
);
|
|
1891
2170
|
const projectMap = new Map<string, AgentConfig>();
|
|
2171
|
+
const projectAgentDiagnostics: AgentDiscoveryDiagnostic[] = [];
|
|
1892
2172
|
for (const dir of projectDirs) {
|
|
1893
|
-
|
|
2173
|
+
const loaded = loadAgentsFromDir(dir, "project", dir === projectDir ? 1 : 0);
|
|
2174
|
+
projectAgentDiagnostics.push(...loaded.diagnostics);
|
|
2175
|
+
for (const agent of loaded.agents) {
|
|
1894
2176
|
projectMap.set(agent.name, agent);
|
|
1895
2177
|
}
|
|
1896
2178
|
}
|
|
1897
2179
|
const project = applyCustomAgentOverrides(
|
|
1898
|
-
applySubagentDefaults(Array.from(projectMap.values()), defaultModel, defaultThinking, defaultExtensions),
|
|
2180
|
+
applySubagentDefaults(Array.from(projectMap.values()), defaultModel, defaultProvider, defaultThinking, defaultExtensions),
|
|
1899
2181
|
userSettings,
|
|
1900
2182
|
projectSettings,
|
|
1901
2183
|
userSettingsPath,
|
|
@@ -1931,8 +2213,29 @@ export function discoverAgentsAll(cwd: string): {
|
|
|
1931
2213
|
...userChains.diagnostics,
|
|
1932
2214
|
...projectChainDiagnostics,
|
|
1933
2215
|
];
|
|
2216
|
+
const agentDiagnostics = [
|
|
2217
|
+
...builtinLoaded.diagnostics,
|
|
2218
|
+
...userLoaded.flatMap((loaded) => loaded.diagnostics),
|
|
2219
|
+
...packageAgentDiagnostics,
|
|
2220
|
+
...projectAgentDiagnostics,
|
|
2221
|
+
];
|
|
1934
2222
|
|
|
1935
2223
|
const userDir = process.env.SELESAI_CODING_AGENT_DIR ? userDirOld : fs.existsSync(userDirNew) ? userDirNew : userDirOld;
|
|
1936
2224
|
|
|
1937
|
-
return {
|
|
2225
|
+
return {
|
|
2226
|
+
builtin: applySubagentMaxThinking(builtin, maxThinking),
|
|
2227
|
+
package: applySubagentMaxThinking(packageAgents, maxThinking),
|
|
2228
|
+
user: applySubagentMaxThinking(user, maxThinking),
|
|
2229
|
+
project: applySubagentMaxThinking(project, maxThinking),
|
|
2230
|
+
agentDiagnostics,
|
|
2231
|
+
chains,
|
|
2232
|
+
chainDiagnostics,
|
|
2233
|
+
userDir,
|
|
2234
|
+
projectDir,
|
|
2235
|
+
userChainDir,
|
|
2236
|
+
projectChainDir,
|
|
2237
|
+
userSettingsPath,
|
|
2238
|
+
projectSettingsPath,
|
|
2239
|
+
...(maxThinking !== undefined ? { maxThinking } : {}),
|
|
2240
|
+
};
|
|
1938
2241
|
}
|