@selesai/code 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/README.md +1 -1
- package/dist/bun/cli.d.ts +0 -1
- package/dist/bun/cli.js +0 -1
- package/dist/bun/register-bedrock.d.ts +0 -1
- package/dist/bun/register-bedrock.js +0 -1
- package/dist/bun/restore-sandbox-env.d.ts +0 -1
- package/dist/bun/restore-sandbox-env.js +0 -1
- package/dist/cli/args.d.ts +0 -1
- package/dist/cli/args.js +0 -1
- package/dist/cli/config-selector.d.ts +0 -1
- package/dist/cli/config-selector.js +0 -1
- package/dist/cli/credential-print.d.ts +0 -1
- package/dist/cli/credential-print.js +0 -1
- package/dist/cli/file-processor.d.ts +0 -1
- package/dist/cli/file-processor.js +0 -1
- package/dist/cli/initial-message.d.ts +0 -1
- package/dist/cli/initial-message.js +0 -1
- package/dist/cli/list-models.d.ts +0 -1
- package/dist/cli/list-models.js +0 -1
- package/dist/cli/project-trust.d.ts +0 -1
- package/dist/cli/project-trust.js +0 -1
- package/dist/cli/session-picker.d.ts +0 -1
- package/dist/cli/session-picker.js +0 -1
- package/dist/cli/startup-ui.d.ts +0 -1
- package/dist/cli/startup-ui.js +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/config.js +0 -1
- package/dist/core/agent-session-auto-handoff.test.d.ts +0 -1
- package/dist/core/agent-session-auto-handoff.test.js +0 -1
- package/dist/core/agent-session-runtime.d.ts +0 -1
- package/dist/core/agent-session-runtime.js +0 -1
- package/dist/core/agent-session-services.d.ts +0 -1
- package/dist/core/agent-session-services.js +0 -1
- package/dist/core/agent-session-skill-block.test.d.ts +0 -1
- package/dist/core/agent-session-skill-block.test.js +0 -1
- package/dist/core/agent-session.d.ts +0 -1
- package/dist/core/agent-session.js +0 -1
- package/dist/core/agents.d.ts +0 -1
- package/dist/core/agents.js +0 -1
- package/dist/core/auth-guidance.d.ts +0 -1
- package/dist/core/auth-guidance.js +0 -1
- package/dist/core/auth-storage.d.ts +0 -1
- package/dist/core/auth-storage.js +0 -1
- package/dist/core/bash-executor.d.ts +0 -1
- package/dist/core/bash-executor.js +0 -1
- package/dist/core/built-in-extensions.d.ts +0 -1
- package/dist/core/built-in-extensions.js +0 -1
- package/dist/core/cache-stats.d.ts +0 -1
- package/dist/core/cache-stats.js +0 -1
- package/dist/core/compaction/branch-summarization.d.ts +0 -1
- package/dist/core/compaction/branch-summarization.js +0 -1
- package/dist/core/compaction/compaction.d.ts +0 -1
- package/dist/core/compaction/compaction.js +0 -1
- package/dist/core/compaction/index.d.ts +0 -1
- package/dist/core/compaction/index.js +0 -1
- package/dist/core/compaction/utils.d.ts +0 -1
- package/dist/core/compaction/utils.js +0 -1
- package/dist/core/defaults.d.ts +0 -1
- package/dist/core/defaults.js +0 -1
- package/dist/core/diagnostics.d.ts +0 -1
- package/dist/core/diagnostics.js +0 -1
- package/dist/core/event-bus.d.ts +0 -1
- package/dist/core/event-bus.js +0 -1
- package/dist/core/exec.d.ts +0 -1
- package/dist/core/exec.js +0 -1
- package/dist/core/experimental.d.ts +0 -1
- package/dist/core/experimental.js +0 -1
- package/dist/core/export-html/ansi-to-html.d.ts +0 -1
- package/dist/core/export-html/ansi-to-html.js +0 -1
- package/dist/core/export-html/index.d.ts +0 -1
- package/dist/core/export-html/index.js +0 -1
- package/dist/core/export-html/tool-renderer.d.ts +0 -1
- package/dist/core/export-html/tool-renderer.js +0 -1
- package/dist/core/extensions/index.d.ts +0 -1
- package/dist/core/extensions/index.js +0 -1
- package/dist/core/extensions/loader.d.ts +0 -1
- package/dist/core/extensions/loader.js +0 -1
- package/dist/core/extensions/runner.d.ts +0 -1
- package/dist/core/extensions/runner.js +0 -1
- package/dist/core/extensions/types.d.ts +0 -1
- package/dist/core/extensions/types.js +0 -1
- package/dist/core/extensions/wrapper.d.ts +0 -1
- package/dist/core/extensions/wrapper.js +0 -1
- package/dist/core/footer-data-provider.d.ts +0 -1
- package/dist/core/footer-data-provider.js +0 -1
- package/dist/core/git-command.d.ts +0 -1
- package/dist/core/git-command.js +0 -1
- package/dist/core/http-dispatcher.d.ts +0 -1
- package/dist/core/http-dispatcher.js +0 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -1
- package/dist/core/keybindings.d.ts +0 -1
- package/dist/core/keybindings.js +0 -1
- package/dist/core/llama/client.d.ts +0 -1
- package/dist/core/llama/client.js +0 -1
- package/dist/core/llama/huggingface.d.ts +0 -1
- package/dist/core/llama/huggingface.js +0 -1
- package/dist/core/llama/index.d.ts +0 -1
- package/dist/core/llama/index.js +0 -1
- package/dist/core/llama/provider.d.ts +0 -1
- package/dist/core/llama/provider.js +0 -1
- package/dist/core/llama/ui.d.ts +0 -1
- package/dist/core/llama/ui.js +0 -1
- package/dist/core/messages.d.ts +0 -1
- package/dist/core/messages.js +0 -1
- package/dist/core/model-config.d.ts +0 -1
- package/dist/core/model-config.js +0 -1
- package/dist/core/model-registry.d.ts +0 -1
- package/dist/core/model-registry.js +0 -1
- package/dist/core/model-resolver.d.ts +0 -1
- package/dist/core/model-resolver.js +0 -1
- package/dist/core/model-runtime.d.ts +0 -1
- package/dist/core/model-runtime.js +0 -1
- package/dist/core/models-store.d.ts +0 -1
- package/dist/core/models-store.js +0 -1
- package/dist/core/output-guard.d.ts +0 -1
- package/dist/core/output-guard.js +0 -1
- package/dist/core/package-manager.d.ts +0 -1
- package/dist/core/package-manager.js +0 -1
- package/dist/core/package-manager.test.d.ts +0 -1
- package/dist/core/package-manager.test.js +0 -1
- package/dist/core/project-trust.d.ts +0 -1
- package/dist/core/project-trust.js +0 -1
- package/dist/core/prompt-templates.d.ts +0 -1
- package/dist/core/prompt-templates.js +0 -1
- package/dist/core/provider-attribution.d.ts +0 -1
- package/dist/core/provider-attribution.js +0 -1
- package/dist/core/provider-composer.d.ts +0 -1
- package/dist/core/provider-composer.js +0 -1
- package/dist/core/radius.d.ts +0 -1
- package/dist/core/radius.js +0 -1
- package/dist/core/remote-catalog-provider.d.ts +0 -1
- package/dist/core/remote-catalog-provider.js +0 -1
- package/dist/core/resolve-config-value.d.ts +0 -1
- package/dist/core/resolve-config-value.js +0 -1
- package/dist/core/resource-loader.d.ts +0 -1
- package/dist/core/resource-loader.js +0 -1
- package/dist/core/runtime-credentials.d.ts +0 -1
- package/dist/core/runtime-credentials.js +0 -1
- package/dist/core/sdk.d.ts +0 -1
- package/dist/core/sdk.js +0 -1
- package/dist/core/session-cwd.d.ts +0 -1
- package/dist/core/session-cwd.js +0 -1
- package/dist/core/session-manager.d.ts +0 -1
- package/dist/core/session-manager.js +0 -1
- package/dist/core/settings-manager-auto-handoff.test.d.ts +0 -1
- package/dist/core/settings-manager-auto-handoff.test.js +0 -1
- package/dist/core/settings-manager.d.ts +0 -4
- package/dist/core/settings-manager.js +0 -12
- package/dist/core/skills.d.ts +0 -1
- package/dist/core/skills.js +0 -1
- package/dist/core/slash-commands.d.ts +0 -1
- package/dist/core/slash-commands.js +0 -1
- package/dist/core/source-info.d.ts +0 -1
- package/dist/core/source-info.js +0 -1
- package/dist/core/system-prompt.d.ts +0 -1
- package/dist/core/system-prompt.js +0 -1
- package/dist/core/system-prompt.test.d.ts +0 -1
- package/dist/core/system-prompt.test.js +0 -1
- package/dist/core/telemetry.d.ts +0 -1
- package/dist/core/telemetry.js +0 -1
- package/dist/core/timings.d.ts +0 -1
- package/dist/core/timings.js +0 -1
- package/dist/core/tools/bash.d.ts +0 -1
- package/dist/core/tools/bash.js +0 -1
- package/dist/core/tools/edit-diff.d.ts +0 -1
- package/dist/core/tools/edit-diff.js +0 -1
- package/dist/core/tools/edit.d.ts +0 -1
- package/dist/core/tools/edit.js +0 -1
- package/dist/core/tools/file-mutation-queue.d.ts +0 -1
- package/dist/core/tools/file-mutation-queue.js +0 -1
- package/dist/core/tools/find.d.ts +0 -1
- package/dist/core/tools/find.js +0 -1
- package/dist/core/tools/grep.d.ts +0 -1
- package/dist/core/tools/grep.js +0 -1
- package/dist/core/tools/index.d.ts +0 -1
- package/dist/core/tools/index.js +0 -1
- package/dist/core/tools/ls.d.ts +0 -1
- package/dist/core/tools/ls.js +0 -1
- package/dist/core/tools/output-accumulator.d.ts +0 -1
- package/dist/core/tools/output-accumulator.js +0 -1
- package/dist/core/tools/path-utils.d.ts +0 -1
- package/dist/core/tools/path-utils.js +0 -1
- package/dist/core/tools/read.d.ts +0 -1
- package/dist/core/tools/read.js +0 -1
- package/dist/core/tools/render-utils.d.ts +0 -1
- package/dist/core/tools/render-utils.js +0 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts +0 -1
- package/dist/core/tools/tool-definition-wrapper.js +0 -1
- package/dist/core/tools/truncate.d.ts +0 -1
- package/dist/core/tools/truncate.js +0 -1
- package/dist/core/tools/write.d.ts +0 -1
- package/dist/core/tools/write.js +0 -1
- package/dist/core/trust-manager.d.ts +0 -1
- package/dist/core/trust-manager.js +0 -1
- package/dist/core/usage-totals.d.ts +0 -1
- package/dist/core/usage-totals.js +0 -1
- package/dist/defaults/models.json +8 -0
- package/dist/defaults/settings.json +6 -7
- package/dist/extensions/inline-skills.test.ts +13 -13
- package/dist/extensions/inline-skills.ts +6 -6
- package/dist/extensions/pi-subagents/CHANGELOG.md +89 -12
- package/dist/extensions/pi-subagents/README.md +339 -604
- package/dist/extensions/pi-subagents/package-lock.json +190 -2079
- package/dist/extensions/pi-subagents/package.json +13 -5
- package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +1 -1
- package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +1 -1
- package/dist/extensions/pi-subagents/prompts/review-loop.md +1 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +10 -10
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +32 -43
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +106 -105
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +3 -3
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +28 -35
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +167 -124
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +19 -0
- package/dist/extensions/pi-subagents/src/agents/agents.ts +163 -75
- package/dist/extensions/pi-subagents/src/agents/chain-serializer.ts +10 -7
- package/dist/extensions/pi-subagents/src/agents/frontmatter.ts +5 -3
- package/dist/extensions/pi-subagents/src/agents/identity.ts +1 -1
- package/dist/extensions/pi-subagents/src/agents/proactive-skills.ts +14 -11
- package/dist/extensions/pi-subagents/src/agents/skills.ts +23 -6
- package/dist/extensions/pi-subagents/src/agents/task-aware-routing.ts +8 -1
- package/dist/extensions/pi-subagents/src/api/control-channel.ts +4 -0
- package/dist/extensions/pi-subagents/src/api/delegation.ts +26 -194
- package/dist/extensions/pi-subagents/src/api/external-runs.ts +129 -0
- package/dist/extensions/pi-subagents/src/api/intercom-bridge.ts +3 -0
- package/dist/extensions/pi-subagents/src/api/pi-args.ts +5 -0
- package/dist/extensions/pi-subagents/src/api/preflight.ts +4 -4
- package/dist/extensions/pi-subagents/src/api/shared-types.ts +19 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +10 -0
- package/dist/extensions/pi-subagents/src/extension/control-notices.ts +5 -39
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +10 -9
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +7 -4
- package/dist/extensions/pi-subagents/src/extension/index.ts +243 -77
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +18 -6
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +50 -39
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +36 -103
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +229 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/client.ts +130 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +141 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +154 -0
- package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +330 -0
- package/dist/extensions/pi-subagents/src/intercom/intercom-bridge.ts +3 -2
- package/dist/extensions/pi-subagents/src/intercom/result-intercom.ts +5 -1
- package/dist/extensions/pi-subagents/src/missions/actions.ts +372 -0
- package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +314 -0
- package/dist/extensions/pi-subagents/src/missions/store.ts +442 -0
- package/dist/extensions/pi-subagents/src/missions/types.ts +135 -0
- package/dist/extensions/pi-subagents/src/policy/authority.ts +46 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +32 -6
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +103 -72
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +10 -2
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +6 -6
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +29 -1
- package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +3 -2
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +9 -7
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +3 -4
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +3 -28
- package/dist/extensions/pi-subagents/src/runs/background/process-terminal.ts +5 -5
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +18 -68
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +35 -8
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +602 -375
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +612 -464
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +50 -9
- package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +253 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +12 -4
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +8 -4
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +74 -102
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +21 -22
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +1050 -396
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +44 -18
- package/dist/extensions/pi-subagents/src/runs/shared/capability-ceiling.ts +0 -1
- package/dist/extensions/pi-subagents/src/runs/shared/child-protocol.ts +302 -22
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +130 -0
- package/dist/extensions/pi-subagents/src/runs/shared/long-running-guard.ts +42 -1
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +59 -5
- package/dist/extensions/pi-subagents/src/runs/shared/nested-render.ts +9 -4
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +86 -2
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +11 -2
- package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +95 -0
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +11 -1
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +15 -6
- package/dist/extensions/pi-subagents/src/runs/shared/run-history.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +9 -63
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +37 -6
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-startup-retry.ts +5 -2
- package/dist/extensions/pi-subagents/src/runs/shared/task-intent.ts +2 -23
- package/dist/extensions/pi-subagents/src/runs/shared/turn-budget.ts +6 -6
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +124 -13
- package/dist/extensions/pi-subagents/src/shared/accessible-dir.ts +29 -7
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +18 -1
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +3 -2
- package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +1 -0
- package/dist/extensions/pi-subagents/src/shared/settings.ts +10 -0
- package/dist/extensions/pi-subagents/src/shared/types.ts +158 -55
- package/dist/extensions/pi-subagents/src/shared/utils.ts +16 -66
- package/dist/extensions/pi-subagents/src/slash/delegation-adapters.ts +33 -199
- package/dist/extensions/pi-subagents/src/slash/delegation-request.ts +43 -126
- package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +103 -0
- package/dist/extensions/pi-subagents/src/slash/prompt-template-bridge.ts +158 -205
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +22 -58
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +14 -0
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +44 -642
- package/dist/extensions/pi-subagents/src/slash/subagents-admin.ts +18 -14
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +156 -21
- package/dist/extensions/pi-subagents/src/tui/fleet-transcript.ts +110 -5
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +60 -24
- package/dist/extensions/pi-subagents/src/tui/render.ts +296 -140
- package/dist/extensions/pi-subagents/src/types/pi-runtime-compat.d.ts +14 -0
- package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +1 -1
- package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +13 -7
- package/dist/extensions/pi-subagents/src/watchdog/model-selection.ts +2 -2
- package/dist/extensions/pi-subagents/src/watchdog/permission-arbiter.ts +145 -0
- package/dist/extensions/pi-subagents/src/watchdog/register-child.ts +1 -1
- package/dist/extensions/pi-subagents/src/watchdog/register-main.ts +1 -1
- package/dist/extensions/pi-subagents/src/watchdog/review.ts +4 -1
- package/dist/extensions/pi-subagents/src/watchdog/runtime.ts +3 -2
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +140 -0
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +415 -0
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +41 -144
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +16 -16
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +415 -298
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +149 -82
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +40 -40
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +15 -15
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +193 -133
- package/dist/extensions/pi-subagents/test/integration/detect-error.test.ts +1 -49
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +62 -0
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +56 -58
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +81 -68
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +20 -25
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +425 -317
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +73 -73
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +123 -98
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +653 -240
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +20 -1661
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/integration/top-level-async.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +8 -5
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +6 -6
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +4 -20
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +25 -4
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +280 -295
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +47 -207
- package/dist/extensions/pi-subagents/test/unit/agent-memory.test.ts +26 -26
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +89 -89
- package/dist/extensions/pi-subagents/test/unit/agent-selection.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +10 -0
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +33 -9
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +24 -2
- package/dist/extensions/pi-subagents/test/unit/async-permission-session.test.ts +11 -9
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +40 -40
- package/dist/extensions/pi-subagents/test/unit/authority-policy.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/background-work.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling-agent-allowlist.test.ts +5 -39
- package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +19 -19
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/chain-serializer.test.ts +20 -20
- package/dist/extensions/pi-subagents/test/unit/child-protocol.test.ts +99 -0
- package/dist/extensions/pi-subagents/test/unit/child-transcript.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +41 -0
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +35 -5
- package/dist/extensions/pi-subagents/test/unit/config-dir-runtime.test.ts +7 -0
- package/dist/extensions/pi-subagents/test/unit/control-notices.test.ts +16 -82
- package/dist/extensions/pi-subagents/test/unit/delegation-api.test.ts +162 -620
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +25 -25
- package/dist/extensions/pi-subagents/test/unit/ensure-accessible-dir.test.ts +125 -0
- package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/unit/external-runs.test.ts +66 -0
- package/dist/extensions/pi-subagents/test/unit/extra-agent-dirs.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +242 -52
- package/dist/extensions/pi-subagents/test/unit/fleet-transcript.test.ts +127 -0
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +197 -36
- package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +245 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +494 -0
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +261 -31
- package/dist/extensions/pi-subagents/test/unit/inline-subagents.test.ts +52 -0
- package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +6 -6
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +217 -0
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +182 -0
- package/dist/extensions/pi-subagents/test/unit/mock-pi.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +10 -10
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +20 -12
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +47 -5
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +49 -55
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +20 -3
- package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +37 -7
- package/dist/extensions/pi-subagents/test/unit/parallel-utils.test.ts +10 -10
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/permissions.test.ts +46 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +31 -10
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +40 -16
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +42 -44
- package/dist/extensions/pi-subagents/test/unit/proactive-skills.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/process-terminal.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +75 -9
- package/dist/extensions/pi-subagents/test/unit/prompt-template-bridge.test.ts +20 -84
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +15 -16
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +28 -28
- package/dist/extensions/pi-subagents/test/unit/result-intercom.test.ts +19 -12
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +37 -21
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +50 -50
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +396 -433
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +76 -153
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +411 -0
- package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +1 -91
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +139 -0
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +29 -0
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +35 -35
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +53 -18
- package/dist/extensions/pi-subagents/test/unit/subagent-startup-retry.test.ts +13 -1
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +44 -11
- package/dist/extensions/pi-subagents/test/unit/task-intent.test.ts +2 -26
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +24 -148
- package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +11 -9
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +351 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-child-status.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/watchdog-lsp-diagnostics.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/watchdog-permission-arbiter.test.ts +79 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-runtime.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/watchdog-settings.test.ts +8 -8
- package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +45 -9
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +197 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-graph.test.ts +8 -8
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +142 -12
- package/dist/extensions/pi-subagents/tsconfig.json +15 -0
- package/dist/extensions/pi-web-agent/package.json +1 -1
- package/dist/extensions/rtk.test.ts +126 -0
- package/dist/extensions/rtk.ts +56 -20
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -1
- package/dist/migrations.d.ts +0 -1
- package/dist/migrations.js +0 -1
- package/dist/modes/index.d.ts +0 -1
- package/dist/modes/index.js +0 -1
- package/dist/modes/interactive/components/armin.d.ts +0 -1
- package/dist/modes/interactive/components/armin.js +0 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +0 -1
- package/dist/modes/interactive/components/assistant-message.js +0 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +0 -1
- package/dist/modes/interactive/components/bash-execution.js +0 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +0 -1
- package/dist/modes/interactive/components/bordered-loader.js +0 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -1
- package/dist/modes/interactive/components/branch-summary-message.js +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +0 -1
- package/dist/modes/interactive/components/config-selector.d.ts +0 -1
- package/dist/modes/interactive/components/config-selector.js +0 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +0 -1
- package/dist/modes/interactive/components/countdown-timer.js +0 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +0 -1
- package/dist/modes/interactive/components/custom-editor.js +0 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +0 -1
- package/dist/modes/interactive/components/custom-entry.js +0 -1
- package/dist/modes/interactive/components/custom-message.d.ts +0 -1
- package/dist/modes/interactive/components/custom-message.js +0 -1
- package/dist/modes/interactive/components/daxnuts.d.ts +0 -1
- package/dist/modes/interactive/components/daxnuts.js +0 -1
- package/dist/modes/interactive/components/diff.d.ts +0 -1
- package/dist/modes/interactive/components/diff.js +0 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts +0 -1
- package/dist/modes/interactive/components/dynamic-border.js +0 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -1
- package/dist/modes/interactive/components/earendil-announcement.js +0 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +0 -1
- package/dist/modes/interactive/components/extension-editor.js +0 -1
- package/dist/modes/interactive/components/extension-input.d.ts +0 -1
- package/dist/modes/interactive/components/extension-input.js +0 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +0 -1
- package/dist/modes/interactive/components/extension-selector.js +0 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +0 -1
- package/dist/modes/interactive/components/first-time-setup.js +0 -1
- package/dist/modes/interactive/components/footer.d.ts +0 -1
- package/dist/modes/interactive/components/footer.js +0 -1
- package/dist/modes/interactive/components/index.d.ts +0 -1
- package/dist/modes/interactive/components/index.js +0 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -1
- package/dist/modes/interactive/components/keybinding-hints.js +0 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +0 -1
- package/dist/modes/interactive/components/login-dialog.js +0 -1
- package/dist/modes/interactive/components/model-selector.d.ts +0 -1
- package/dist/modes/interactive/components/model-selector.js +0 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +0 -1
- package/dist/modes/interactive/components/oauth-selector.js +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +0 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts +0 -1
- package/dist/modes/interactive/components/session-selector-search.js +0 -1
- package/dist/modes/interactive/components/session-selector.d.ts +0 -1
- package/dist/modes/interactive/components/session-selector.js +0 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +0 -3
- package/dist/modes/interactive/components/settings-selector.js +1 -14
- package/dist/modes/interactive/components/show-images-selector.d.ts +0 -1
- package/dist/modes/interactive/components/show-images-selector.js +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +0 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +0 -1
- package/dist/modes/interactive/components/status-indicator.js +0 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +0 -1
- package/dist/modes/interactive/components/theme-selector.js +0 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +0 -1
- package/dist/modes/interactive/components/thinking-selector.js +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
- package/dist/modes/interactive/components/tool-execution.js +0 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +0 -1
- package/dist/modes/interactive/components/tree-selector.js +0 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +0 -1
- package/dist/modes/interactive/components/trust-selector.js +0 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +0 -1
- package/dist/modes/interactive/components/user-message-selector.js +0 -1
- package/dist/modes/interactive/components/user-message.d.ts +0 -1
- package/dist/modes/interactive/components/user-message.js +0 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +0 -1
- package/dist/modes/interactive/components/visual-truncate.js +0 -1
- package/dist/modes/interactive/external-editor.d.ts +0 -1
- package/dist/modes/interactive/external-editor.js +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts +0 -2
- package/dist/modes/interactive/interactive-mode.js +1 -22
- package/dist/modes/interactive/model-search.d.ts +0 -1
- package/dist/modes/interactive/model-search.js +0 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +0 -1
- package/dist/modes/interactive/theme/theme-controller.js +0 -1
- package/dist/modes/interactive/theme/theme.d.ts +0 -1
- package/dist/modes/interactive/theme/theme.js +0 -1
- package/dist/modes/print-mode.d.ts +0 -1
- package/dist/modes/print-mode.js +0 -1
- package/dist/modes/rpc/jsonl.d.ts +0 -1
- package/dist/modes/rpc/jsonl.js +0 -1
- package/dist/modes/rpc/rpc-client.d.ts +1 -2
- package/dist/modes/rpc/rpc-client.js +1 -2
- package/dist/modes/rpc/rpc-mode.d.ts +0 -1
- package/dist/modes/rpc/rpc-mode.js +0 -9
- package/dist/modes/rpc/rpc-types.d.ts +0 -1
- package/dist/modes/rpc/rpc-types.js +0 -1
- package/dist/package-manager-cli.d.ts +0 -1
- package/dist/package-manager-cli.js +0 -1
- package/dist/rpc-entry.d.ts +0 -1
- package/dist/rpc-entry.js +0 -1
- package/dist/utils/ansi.d.ts +0 -1
- package/dist/utils/ansi.js +0 -1
- package/dist/utils/changelog.d.ts +0 -1
- package/dist/utils/changelog.js +0 -1
- package/dist/utils/child-process.d.ts +0 -1
- package/dist/utils/child-process.js +0 -1
- package/dist/utils/clipboard-image.d.ts +0 -1
- package/dist/utils/clipboard-image.js +0 -1
- package/dist/utils/clipboard-native.d.ts +0 -1
- package/dist/utils/clipboard-native.js +0 -1
- package/dist/utils/clipboard.d.ts +0 -1
- package/dist/utils/clipboard.js +0 -1
- package/dist/utils/deprecation.d.ts +0 -1
- package/dist/utils/deprecation.js +0 -1
- package/dist/utils/exif-orientation.d.ts +0 -1
- package/dist/utils/exif-orientation.js +0 -1
- package/dist/utils/frontmatter.d.ts +0 -1
- package/dist/utils/frontmatter.js +0 -1
- package/dist/utils/fs-watch.d.ts +0 -1
- package/dist/utils/fs-watch.js +0 -1
- package/dist/utils/git.d.ts +0 -1
- package/dist/utils/git.js +0 -1
- package/dist/utils/html.d.ts +0 -1
- package/dist/utils/html.js +0 -1
- package/dist/utils/image-convert.d.ts +0 -1
- package/dist/utils/image-convert.js +0 -1
- package/dist/utils/image-process.d.ts +0 -1
- package/dist/utils/image-process.js +0 -1
- package/dist/utils/image-resize-core.d.ts +0 -1
- package/dist/utils/image-resize-core.js +0 -1
- package/dist/utils/image-resize-worker.d.ts +0 -1
- package/dist/utils/image-resize-worker.js +0 -1
- package/dist/utils/image-resize.d.ts +0 -1
- package/dist/utils/image-resize.js +0 -1
- package/dist/utils/json.d.ts +0 -1
- package/dist/utils/json.js +0 -1
- package/dist/utils/mime.d.ts +0 -1
- package/dist/utils/mime.js +0 -1
- package/dist/utils/open-browser.d.ts +0 -1
- package/dist/utils/open-browser.js +0 -1
- package/dist/utils/paths.d.ts +0 -1
- package/dist/utils/paths.js +0 -1
- package/dist/utils/photon.d.ts +0 -1
- package/dist/utils/photon.js +0 -1
- package/dist/utils/pi-user-agent.d.ts +0 -1
- package/dist/utils/pi-user-agent.js +0 -1
- package/dist/utils/shell.d.ts +0 -1
- package/dist/utils/shell.js +0 -1
- package/dist/utils/sleep.d.ts +0 -1
- package/dist/utils/sleep.js +0 -1
- package/dist/utils/syntax-highlight.d.ts +0 -1
- package/dist/utils/syntax-highlight.js +0 -1
- package/dist/utils/thinking-tags.d.ts +0 -1
- package/dist/utils/thinking-tags.js +0 -1
- package/dist/utils/tools-manager.d.ts +3 -3
- package/dist/utils/tools-manager.js +125 -42
- package/dist/utils/version-check.d.ts +0 -1
- package/dist/utils/version-check.js +0 -1
- package/dist/utils/windows-self-update.d.ts +0 -1
- package/dist/utils/windows-self-update.js +0 -1
- package/docs/rpc.md +1 -2
- package/docs/settings.md +0 -1
- package/docs/skills.md +10 -18
- package/package.json +4 -3
- package/dist/bun/cli.d.ts.map +0 -1
- package/dist/bun/cli.js.map +0 -1
- package/dist/bun/register-bedrock.d.ts.map +0 -1
- package/dist/bun/register-bedrock.js.map +0 -1
- package/dist/bun/restore-sandbox-env.d.ts.map +0 -1
- package/dist/bun/restore-sandbox-env.js.map +0 -1
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/config-selector.d.ts.map +0 -1
- package/dist/cli/config-selector.js.map +0 -1
- package/dist/cli/credential-print.d.ts.map +0 -1
- package/dist/cli/credential-print.js.map +0 -1
- package/dist/cli/file-processor.d.ts.map +0 -1
- package/dist/cli/file-processor.js.map +0 -1
- package/dist/cli/initial-message.d.ts.map +0 -1
- package/dist/cli/initial-message.js.map +0 -1
- package/dist/cli/list-models.d.ts.map +0 -1
- package/dist/cli/list-models.js.map +0 -1
- package/dist/cli/project-trust.d.ts.map +0 -1
- package/dist/cli/project-trust.js.map +0 -1
- package/dist/cli/session-picker.d.ts.map +0 -1
- package/dist/cli/session-picker.js.map +0 -1
- package/dist/cli/startup-ui.d.ts.map +0 -1
- package/dist/cli/startup-ui.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/core/agent-session-auto-handoff.test.d.ts.map +0 -1
- package/dist/core/agent-session-auto-handoff.test.js.map +0 -1
- package/dist/core/agent-session-runtime.d.ts.map +0 -1
- package/dist/core/agent-session-runtime.js.map +0 -1
- package/dist/core/agent-session-services.d.ts.map +0 -1
- package/dist/core/agent-session-services.js.map +0 -1
- package/dist/core/agent-session-skill-block.test.d.ts.map +0 -1
- package/dist/core/agent-session-skill-block.test.js.map +0 -1
- package/dist/core/agent-session.d.ts.map +0 -1
- package/dist/core/agent-session.js.map +0 -1
- package/dist/core/agents.d.ts.map +0 -1
- package/dist/core/agents.js.map +0 -1
- package/dist/core/auth-guidance.d.ts.map +0 -1
- package/dist/core/auth-guidance.js.map +0 -1
- package/dist/core/auth-storage.d.ts.map +0 -1
- package/dist/core/auth-storage.js.map +0 -1
- package/dist/core/bash-executor.d.ts.map +0 -1
- package/dist/core/bash-executor.js.map +0 -1
- package/dist/core/built-in-extensions.d.ts.map +0 -1
- package/dist/core/built-in-extensions.js.map +0 -1
- package/dist/core/cache-stats.d.ts.map +0 -1
- package/dist/core/cache-stats.js.map +0 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
- package/dist/core/compaction/branch-summarization.js.map +0 -1
- package/dist/core/compaction/compaction.d.ts.map +0 -1
- package/dist/core/compaction/compaction.js.map +0 -1
- package/dist/core/compaction/index.d.ts.map +0 -1
- package/dist/core/compaction/index.js.map +0 -1
- package/dist/core/compaction/utils.d.ts.map +0 -1
- package/dist/core/compaction/utils.js.map +0 -1
- package/dist/core/defaults.d.ts.map +0 -1
- package/dist/core/defaults.js.map +0 -1
- package/dist/core/diagnostics.d.ts.map +0 -1
- package/dist/core/diagnostics.js.map +0 -1
- package/dist/core/event-bus.d.ts.map +0 -1
- package/dist/core/event-bus.js.map +0 -1
- package/dist/core/exec.d.ts.map +0 -1
- package/dist/core/exec.js.map +0 -1
- package/dist/core/experimental.d.ts.map +0 -1
- package/dist/core/experimental.js.map +0 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
- package/dist/core/export-html/ansi-to-html.js.map +0 -1
- package/dist/core/export-html/index.d.ts.map +0 -1
- package/dist/core/export-html/index.js.map +0 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
- package/dist/core/export-html/tool-renderer.js.map +0 -1
- package/dist/core/extensions/index.d.ts.map +0 -1
- package/dist/core/extensions/index.js.map +0 -1
- package/dist/core/extensions/loader.d.ts.map +0 -1
- package/dist/core/extensions/loader.js.map +0 -1
- package/dist/core/extensions/runner.d.ts.map +0 -1
- package/dist/core/extensions/runner.js.map +0 -1
- package/dist/core/extensions/types.d.ts.map +0 -1
- package/dist/core/extensions/types.js.map +0 -1
- package/dist/core/extensions/wrapper.d.ts.map +0 -1
- package/dist/core/extensions/wrapper.js.map +0 -1
- package/dist/core/footer-data-provider.d.ts.map +0 -1
- package/dist/core/footer-data-provider.js.map +0 -1
- package/dist/core/git-command.d.ts.map +0 -1
- package/dist/core/git-command.js.map +0 -1
- package/dist/core/http-dispatcher.d.ts.map +0 -1
- package/dist/core/http-dispatcher.js.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/keybindings.d.ts.map +0 -1
- package/dist/core/keybindings.js.map +0 -1
- package/dist/core/llama/client.d.ts.map +0 -1
- package/dist/core/llama/client.js.map +0 -1
- package/dist/core/llama/huggingface.d.ts.map +0 -1
- package/dist/core/llama/huggingface.js.map +0 -1
- package/dist/core/llama/index.d.ts.map +0 -1
- package/dist/core/llama/index.js.map +0 -1
- package/dist/core/llama/provider.d.ts.map +0 -1
- package/dist/core/llama/provider.js.map +0 -1
- package/dist/core/llama/ui.d.ts.map +0 -1
- package/dist/core/llama/ui.js.map +0 -1
- package/dist/core/messages.d.ts.map +0 -1
- package/dist/core/messages.js.map +0 -1
- package/dist/core/model-config.d.ts.map +0 -1
- package/dist/core/model-config.js.map +0 -1
- package/dist/core/model-registry.d.ts.map +0 -1
- package/dist/core/model-registry.js.map +0 -1
- package/dist/core/model-resolver.d.ts.map +0 -1
- package/dist/core/model-resolver.js.map +0 -1
- package/dist/core/model-runtime.d.ts.map +0 -1
- package/dist/core/model-runtime.js.map +0 -1
- package/dist/core/models-store.d.ts.map +0 -1
- package/dist/core/models-store.js.map +0 -1
- package/dist/core/output-guard.d.ts.map +0 -1
- package/dist/core/output-guard.js.map +0 -1
- package/dist/core/package-manager.d.ts.map +0 -1
- package/dist/core/package-manager.js.map +0 -1
- package/dist/core/package-manager.test.d.ts.map +0 -1
- package/dist/core/package-manager.test.js.map +0 -1
- package/dist/core/project-trust.d.ts.map +0 -1
- package/dist/core/project-trust.js.map +0 -1
- package/dist/core/prompt-templates.d.ts.map +0 -1
- package/dist/core/prompt-templates.js.map +0 -1
- package/dist/core/provider-attribution.d.ts.map +0 -1
- package/dist/core/provider-attribution.js.map +0 -1
- package/dist/core/provider-composer.d.ts.map +0 -1
- package/dist/core/provider-composer.js.map +0 -1
- package/dist/core/radius.d.ts.map +0 -1
- package/dist/core/radius.js.map +0 -1
- package/dist/core/remote-catalog-provider.d.ts.map +0 -1
- package/dist/core/remote-catalog-provider.js.map +0 -1
- package/dist/core/resolve-config-value.d.ts.map +0 -1
- package/dist/core/resolve-config-value.js.map +0 -1
- package/dist/core/resource-loader.d.ts.map +0 -1
- package/dist/core/resource-loader.js.map +0 -1
- package/dist/core/runtime-credentials.d.ts.map +0 -1
- package/dist/core/runtime-credentials.js.map +0 -1
- package/dist/core/sdk.d.ts.map +0 -1
- package/dist/core/sdk.js.map +0 -1
- package/dist/core/session-cwd.d.ts.map +0 -1
- package/dist/core/session-cwd.js.map +0 -1
- package/dist/core/session-manager.d.ts.map +0 -1
- package/dist/core/session-manager.js.map +0 -1
- package/dist/core/settings-manager-auto-handoff.test.d.ts.map +0 -1
- package/dist/core/settings-manager-auto-handoff.test.js.map +0 -1
- package/dist/core/settings-manager.d.ts.map +0 -1
- package/dist/core/settings-manager.js.map +0 -1
- package/dist/core/skills.d.ts.map +0 -1
- package/dist/core/skills.js.map +0 -1
- package/dist/core/slash-commands.d.ts.map +0 -1
- package/dist/core/slash-commands.js.map +0 -1
- package/dist/core/source-info.d.ts.map +0 -1
- package/dist/core/source-info.js.map +0 -1
- package/dist/core/system-prompt.d.ts.map +0 -1
- package/dist/core/system-prompt.js.map +0 -1
- package/dist/core/system-prompt.test.d.ts.map +0 -1
- package/dist/core/system-prompt.test.js.map +0 -1
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js.map +0 -1
- package/dist/core/timings.d.ts.map +0 -1
- package/dist/core/timings.js.map +0 -1
- package/dist/core/tools/bash.d.ts.map +0 -1
- package/dist/core/tools/bash.js.map +0 -1
- package/dist/core/tools/edit-diff.d.ts.map +0 -1
- package/dist/core/tools/edit-diff.js.map +0 -1
- package/dist/core/tools/edit.d.ts.map +0 -1
- package/dist/core/tools/edit.js.map +0 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
- package/dist/core/tools/file-mutation-queue.js.map +0 -1
- package/dist/core/tools/find.d.ts.map +0 -1
- package/dist/core/tools/find.js.map +0 -1
- package/dist/core/tools/grep.d.ts.map +0 -1
- package/dist/core/tools/grep.js.map +0 -1
- package/dist/core/tools/index.d.ts.map +0 -1
- package/dist/core/tools/index.js.map +0 -1
- package/dist/core/tools/ls.d.ts.map +0 -1
- package/dist/core/tools/ls.js.map +0 -1
- package/dist/core/tools/output-accumulator.d.ts.map +0 -1
- package/dist/core/tools/output-accumulator.js.map +0 -1
- package/dist/core/tools/path-utils.d.ts.map +0 -1
- package/dist/core/tools/path-utils.js.map +0 -1
- package/dist/core/tools/read.d.ts.map +0 -1
- package/dist/core/tools/read.js.map +0 -1
- package/dist/core/tools/render-utils.d.ts.map +0 -1
- package/dist/core/tools/render-utils.js.map +0 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
- package/dist/core/tools/truncate.d.ts.map +0 -1
- package/dist/core/tools/truncate.js.map +0 -1
- package/dist/core/tools/write.d.ts.map +0 -1
- package/dist/core/tools/write.js.map +0 -1
- package/dist/core/trust-manager.d.ts.map +0 -1
- package/dist/core/trust-manager.js.map +0 -1
- package/dist/core/usage-totals.d.ts.map +0 -1
- package/dist/core/usage-totals.js.map +0 -1
- package/dist/extensions/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/dist/extensions/pi-subagents/test/unit/slash-chain-groups.test.ts +0 -464
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js.map +0 -1
- package/dist/migrations.d.ts.map +0 -1
- package/dist/migrations.js.map +0 -1
- package/dist/modes/index.d.ts.map +0 -1
- package/dist/modes/index.js.map +0 -1
- package/dist/modes/interactive/components/armin.d.ts.map +0 -1
- package/dist/modes/interactive/components/armin.js.map +0 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/assistant-message.js.map +0 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
- package/dist/modes/interactive/components/bash-execution.js.map +0 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
- package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/config-selector.js.map +0 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
- package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-editor.js.map +0 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-entry.js.map +0 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-message.js.map +0 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
- package/dist/modes/interactive/components/daxnuts.js.map +0 -1
- package/dist/modes/interactive/components/diff.d.ts.map +0 -1
- package/dist/modes/interactive/components/diff.js.map +0 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
- package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-editor.js.map +0 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-input.js.map +0 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-selector.js.map +0 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
- package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
- package/dist/modes/interactive/components/footer.d.ts.map +0 -1
- package/dist/modes/interactive/components/footer.js.map +0 -1
- package/dist/modes/interactive/components/index.d.ts.map +0 -1
- package/dist/modes/interactive/components/index.js.map +0 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
- package/dist/modes/interactive/components/login-dialog.js.map +0 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/model-selector.js.map +0 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/session-selector.js.map +0 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/settings-selector.js.map +0 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
- package/dist/modes/interactive/components/status-indicator.js.map +0 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/theme-selector.js.map +0 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
- package/dist/modes/interactive/components/tool-execution.js.map +0 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/tree-selector.js.map +0 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/trust-selector.js.map +0 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/user-message.js.map +0 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
- package/dist/modes/interactive/external-editor.d.ts.map +0 -1
- package/dist/modes/interactive/external-editor.js.map +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
- package/dist/modes/interactive/interactive-mode.js.map +0 -1
- package/dist/modes/interactive/model-search.d.ts.map +0 -1
- package/dist/modes/interactive/model-search.js.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme.js.map +0 -1
- package/dist/modes/print-mode.d.ts.map +0 -1
- package/dist/modes/print-mode.js.map +0 -1
- package/dist/modes/rpc/jsonl.d.ts.map +0 -1
- package/dist/modes/rpc/jsonl.js.map +0 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-client.js.map +0 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-mode.js.map +0 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
- package/dist/modes/rpc/rpc-types.js.map +0 -1
- package/dist/package-manager-cli.d.ts.map +0 -1
- package/dist/package-manager-cli.js.map +0 -1
- package/dist/rpc-entry.d.ts.map +0 -1
- package/dist/rpc-entry.js.map +0 -1
- package/dist/utils/ansi.d.ts.map +0 -1
- package/dist/utils/ansi.js.map +0 -1
- package/dist/utils/changelog.d.ts.map +0 -1
- package/dist/utils/changelog.js.map +0 -1
- package/dist/utils/child-process.d.ts.map +0 -1
- package/dist/utils/child-process.js.map +0 -1
- package/dist/utils/clipboard-image.d.ts.map +0 -1
- package/dist/utils/clipboard-image.js.map +0 -1
- package/dist/utils/clipboard-native.d.ts.map +0 -1
- package/dist/utils/clipboard-native.js.map +0 -1
- package/dist/utils/clipboard.d.ts.map +0 -1
- package/dist/utils/clipboard.js.map +0 -1
- package/dist/utils/deprecation.d.ts.map +0 -1
- package/dist/utils/deprecation.js.map +0 -1
- package/dist/utils/exif-orientation.d.ts.map +0 -1
- package/dist/utils/exif-orientation.js.map +0 -1
- package/dist/utils/frontmatter.d.ts.map +0 -1
- package/dist/utils/frontmatter.js.map +0 -1
- package/dist/utils/fs-watch.d.ts.map +0 -1
- package/dist/utils/fs-watch.js.map +0 -1
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/html.d.ts.map +0 -1
- package/dist/utils/html.js.map +0 -1
- package/dist/utils/image-convert.d.ts.map +0 -1
- package/dist/utils/image-convert.js.map +0 -1
- package/dist/utils/image-process.d.ts.map +0 -1
- package/dist/utils/image-process.js.map +0 -1
- package/dist/utils/image-resize-core.d.ts.map +0 -1
- package/dist/utils/image-resize-core.js.map +0 -1
- package/dist/utils/image-resize-worker.d.ts.map +0 -1
- package/dist/utils/image-resize-worker.js.map +0 -1
- package/dist/utils/image-resize.d.ts.map +0 -1
- package/dist/utils/image-resize.js.map +0 -1
- package/dist/utils/json.d.ts.map +0 -1
- package/dist/utils/json.js.map +0 -1
- package/dist/utils/mime.d.ts.map +0 -1
- package/dist/utils/mime.js.map +0 -1
- package/dist/utils/open-browser.d.ts.map +0 -1
- package/dist/utils/open-browser.js.map +0 -1
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/photon.d.ts.map +0 -1
- package/dist/utils/photon.js.map +0 -1
- package/dist/utils/pi-user-agent.d.ts.map +0 -1
- package/dist/utils/pi-user-agent.js.map +0 -1
- package/dist/utils/shell.d.ts.map +0 -1
- package/dist/utils/shell.js.map +0 -1
- package/dist/utils/sleep.d.ts.map +0 -1
- package/dist/utils/sleep.js.map +0 -1
- package/dist/utils/syntax-highlight.d.ts.map +0 -1
- package/dist/utils/syntax-highlight.js.map +0 -1
- package/dist/utils/thinking-tags.d.ts.map +0 -1
- package/dist/utils/thinking-tags.js.map +0 -1
- package/dist/utils/tools-manager.d.ts.map +0 -1
- package/dist/utils/tools-manager.js.map +0 -1
- package/dist/utils/version-check.d.ts.map +0 -1
- package/dist/utils/version-check.js.map +0 -1
- package/dist/utils/windows-self-update.d.ts.map +0 -1
- package/dist/utils/windows-self-update.js.map +0 -1
|
@@ -9,7 +9,7 @@ import * as os from "node:os";
|
|
|
9
9
|
import "../shared/env.ts";
|
|
10
10
|
import * as path from "node:path";
|
|
11
11
|
import { fileURLToPath } from "node:url";
|
|
12
|
-
import type { AcceptanceInput, AcceptanceRole, OutputMode, ToolBudgetConfig, TurnBudgetConfig } from "../shared/types.ts";
|
|
12
|
+
import type { AcceptanceInput, AcceptanceRole, AgentRunnerConfig, OutputMode, ToolBudgetConfig, TurnBudgetConfig } from "../shared/types.ts";
|
|
13
13
|
import { getAgentDir, getProjectConfigDir } from "../shared/utils.ts";
|
|
14
14
|
import { KNOWN_FIELDS } from "./agent-serializer.ts";
|
|
15
15
|
import { parseChain, parseJsonChain } from "./chain-serializer.ts";
|
|
@@ -21,6 +21,9 @@ export { buildRuntimeName, frontmatterNameForConfig, parsePackageName } from "./
|
|
|
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
|
+
import { validatePermissionRules, type PermissionRules } from "../runs/shared/permissions.ts";
|
|
25
|
+
|
|
26
|
+
const PROCESS_HOME = os.homedir();
|
|
24
27
|
|
|
25
28
|
export type AgentScope = "user" | "project" | "both";
|
|
26
29
|
|
|
@@ -44,12 +47,12 @@ export const BUILTIN_AGENT_NAMES = [
|
|
|
44
47
|
"researcher",
|
|
45
48
|
] as const;
|
|
46
49
|
|
|
47
|
-
export function defaultSystemPromptMode(
|
|
48
|
-
return
|
|
50
|
+
export function defaultSystemPromptMode(_name: string): SystemPromptMode {
|
|
51
|
+
return "replace";
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
export function defaultInheritProjectContext(
|
|
52
|
-
return
|
|
54
|
+
export function defaultInheritProjectContext(_name: string): boolean {
|
|
55
|
+
return false;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
export function defaultInheritSkills(): boolean {
|
|
@@ -113,6 +116,7 @@ export interface AgentModelSourceInfo {
|
|
|
113
116
|
|
|
114
117
|
export interface AgentConfig {
|
|
115
118
|
name: string;
|
|
119
|
+
runner?: AgentRunnerConfig;
|
|
116
120
|
localName?: string;
|
|
117
121
|
packageName?: string;
|
|
118
122
|
description: string;
|
|
@@ -146,6 +150,7 @@ export interface AgentConfig {
|
|
|
146
150
|
maxSubagentDepth?: number;
|
|
147
151
|
completionGuard?: boolean;
|
|
148
152
|
toolBudget?: ToolBudgetConfig;
|
|
153
|
+
permissions?: PermissionRules;
|
|
149
154
|
memory?: AgentMemoryConfig;
|
|
150
155
|
disabled?: boolean;
|
|
151
156
|
extraFields?: Record<string, string>;
|
|
@@ -325,6 +330,21 @@ function getGlobalNpmRoot(): string | null {
|
|
|
325
330
|
const offline = process.env.PI_OFFLINE?.toLowerCase();
|
|
326
331
|
if (offline === "1" || offline === "true" || offline === "yes") return null;
|
|
327
332
|
if (cachedGlobalNpmRoot !== null) return cachedGlobalNpmRoot;
|
|
333
|
+
|
|
334
|
+
const windowsGlobalRoot = process.platform === "win32" && process.env.APPDATA
|
|
335
|
+
? path.join(process.env.APPDATA, "npm", "node_modules")
|
|
336
|
+
: undefined;
|
|
337
|
+
if (windowsGlobalRoot) {
|
|
338
|
+
try {
|
|
339
|
+
if (fs.statSync(windowsGlobalRoot).isDirectory()) {
|
|
340
|
+
cachedGlobalNpmRoot = fs.realpathSync(windowsGlobalRoot);
|
|
341
|
+
return cachedGlobalNpmRoot;
|
|
342
|
+
}
|
|
343
|
+
} catch {
|
|
344
|
+
// Fall through if the directory disappears while resolving it.
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
328
348
|
try {
|
|
329
349
|
cachedGlobalNpmRoot = fs.realpathSync(execSync("npm root -g", { encoding: "utf-8", timeout: 5000 }).trim());
|
|
330
350
|
return cachedGlobalNpmRoot;
|
|
@@ -484,7 +504,8 @@ function effectiveAgentMatch(matches: AgentConfig[]): { agent?: AgentConfig; err
|
|
|
484
504
|
const distinctNames = [...new Set(matches.map((agent) => agent.name))];
|
|
485
505
|
if (distinctNames.length === 1) {
|
|
486
506
|
const sourceRank = new Map<AgentConfig["source"], number>([["builtin", 0], ["package", 1], ["user", 2], ["project", 3]]);
|
|
487
|
-
|
|
507
|
+
const agent = [...matches].sort((a, b) => (sourceRank.get(b.source) ?? 0) - (sourceRank.get(a.source) ?? 0))[0];
|
|
508
|
+
return agent ? { agent } : {};
|
|
488
509
|
}
|
|
489
510
|
return {};
|
|
490
511
|
}
|
|
@@ -492,7 +513,7 @@ function effectiveAgentMatch(matches: AgentConfig[]): { agent?: AgentConfig; err
|
|
|
492
513
|
export function resolveAgentName(name: string, agents: AgentConfig[]): { agent?: AgentConfig; error?: string } {
|
|
493
514
|
const raw = name.trim();
|
|
494
515
|
const exact = agents.filter((agent) => agent.name === raw || agent.localName === raw);
|
|
495
|
-
if (exact.length === 1) return { agent: exact[0] };
|
|
516
|
+
if (exact.length === 1) return exact[0] ? { agent: exact[0] } : {};
|
|
496
517
|
if (exact.length > 1) {
|
|
497
518
|
const effective = effectiveAgentMatch(exact);
|
|
498
519
|
if (effective.agent) return effective;
|
|
@@ -500,7 +521,7 @@ export function resolveAgentName(name: string, agents: AgentConfig[]): { agent?:
|
|
|
500
521
|
}
|
|
501
522
|
|
|
502
523
|
const aliases = agents.filter((agent) => agent.aliases?.includes(raw));
|
|
503
|
-
if (aliases.length === 1) return { agent: aliases[0] };
|
|
524
|
+
if (aliases.length === 1) return aliases[0] ? { agent: aliases[0] } : {};
|
|
504
525
|
if (aliases.length > 1) {
|
|
505
526
|
const effective = effectiveAgentMatch(aliases);
|
|
506
527
|
if (effective.agent) return effective;
|
|
@@ -546,24 +567,24 @@ function arraysEqual(a: string[] | undefined, b: string[] | undefined): boolean
|
|
|
546
567
|
function cloneOverrideBase(agent: AgentConfig): BuiltinAgentOverrideBase {
|
|
547
568
|
return {
|
|
548
569
|
description: agent.description,
|
|
549
|
-
model: agent.model,
|
|
550
|
-
|
|
551
|
-
thinking: agent.thinking,
|
|
570
|
+
...(agent.model !== undefined ? { model: agent.model } : {}),
|
|
571
|
+
...(agent.fallbackModels ? { fallbackModels: [...agent.fallbackModels] } : {}),
|
|
572
|
+
...(agent.thinking !== undefined ? { thinking: agent.thinking } : {}),
|
|
552
573
|
systemPromptMode: agent.systemPromptMode,
|
|
553
574
|
inheritProjectContext: agent.inheritProjectContext,
|
|
554
575
|
inheritSkills: agent.inheritSkills,
|
|
555
|
-
defaultContext: agent.defaultContext,
|
|
556
|
-
acceptanceRole: agent.acceptanceRole,
|
|
557
|
-
disabled: agent.disabled,
|
|
576
|
+
...(agent.defaultContext !== undefined ? { defaultContext: agent.defaultContext } : {}),
|
|
577
|
+
...(agent.acceptanceRole !== undefined ? { acceptanceRole: agent.acceptanceRole } : {}),
|
|
578
|
+
...(agent.disabled !== undefined ? { disabled: agent.disabled } : {}),
|
|
558
579
|
systemPrompt: agent.systemPrompt,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
completionGuard: agent.completionGuard,
|
|
566
|
-
toolBudget: agent.toolBudget,
|
|
580
|
+
...(agent.skills ? { skills: [...agent.skills] } : {}),
|
|
581
|
+
...(agent.skillPath ? { skillPath: [...agent.skillPath] } : {}),
|
|
582
|
+
...(agent.tools ? { tools: [...agent.tools] } : {}),
|
|
583
|
+
...(agent.mcpDirectTools ? { mcpDirectTools: [...agent.mcpDirectTools] } : {}),
|
|
584
|
+
...(!agent.extensionsFromDefault && agent.extensions ? { extensions: [...agent.extensions] } : {}),
|
|
585
|
+
...(agent.subagentOnlyExtensions ? { subagentOnlyExtensions: [...agent.subagentOnlyExtensions] } : {}),
|
|
586
|
+
...(agent.completionGuard !== undefined ? { completionGuard: agent.completionGuard } : {}),
|
|
587
|
+
...(agent.toolBudget !== undefined ? { toolBudget: agent.toolBudget } : {}),
|
|
567
588
|
};
|
|
568
589
|
}
|
|
569
590
|
|
|
@@ -592,6 +613,9 @@ function cloneOverrideValue(override: BuiltinAgentOverrideConfig): BuiltinAgentO
|
|
|
592
613
|
}
|
|
593
614
|
|
|
594
615
|
function isProjectRootCandidate(dir: string): boolean {
|
|
616
|
+
// The host's user config lives at <home>/.selesai, which must not make the
|
|
617
|
+
// home directory look like every unrelated project's root.
|
|
618
|
+
if (path.resolve(dir) === path.resolve(PROCESS_HOME)) return false;
|
|
595
619
|
return isDirectory(getProjectConfigDir(dir)) || isDirectory(path.join(dir, ".agents"));
|
|
596
620
|
}
|
|
597
621
|
|
|
@@ -880,14 +904,23 @@ function readSubagentSettings(filePath: string | null): SubagentSettings {
|
|
|
880
904
|
|
|
881
905
|
const parsed: Record<string, BuiltinAgentOverrideConfig> = {};
|
|
882
906
|
const agentOverrides = subagentsObject.agentOverrides;
|
|
907
|
+
const parsedSettings: SubagentSettings = {
|
|
908
|
+
overrides: parsed,
|
|
909
|
+
...(defaultModel !== undefined ? { defaultModel } : {}),
|
|
910
|
+
...(defaultThinking !== undefined ? { defaultThinking } : {}),
|
|
911
|
+
...(defaultExtensions !== undefined ? { defaultExtensions } : {}),
|
|
912
|
+
...(disableBuiltins !== undefined ? { disableBuiltins } : {}),
|
|
913
|
+
...(disableThinking !== undefined ? { disableThinking } : {}),
|
|
914
|
+
...(modelScope !== undefined ? { modelScope } : {}),
|
|
915
|
+
};
|
|
883
916
|
if (!agentOverrides || typeof agentOverrides !== "object" || Array.isArray(agentOverrides)) {
|
|
884
|
-
return
|
|
917
|
+
return parsedSettings;
|
|
885
918
|
}
|
|
886
919
|
for (const [name, value] of Object.entries(agentOverrides)) {
|
|
887
920
|
const override = parseBuiltinOverrideEntry(name, value, filePath);
|
|
888
921
|
if (override) parsed[name] = override;
|
|
889
922
|
}
|
|
890
|
-
return
|
|
923
|
+
return parsedSettings;
|
|
891
924
|
}
|
|
892
925
|
|
|
893
926
|
function resolveSubagentDefaultModel(
|
|
@@ -978,41 +1011,34 @@ function applyBuiltinOverride(
|
|
|
978
1011
|
};
|
|
979
1012
|
|
|
980
1013
|
if (override.description !== undefined) next.description = override.description;
|
|
981
|
-
if (override.model !== undefined)
|
|
982
|
-
if (override.fallbackModels !== undefined) {
|
|
983
|
-
|
|
984
|
-
}
|
|
985
|
-
if (override.thinking !== undefined) next.thinking = override.thinking === false ? undefined : override.thinking;
|
|
1014
|
+
if (override.model !== undefined) { if (override.model === false) delete next.model; else next.model = override.model; }
|
|
1015
|
+
if (override.fallbackModels !== undefined) { if (override.fallbackModels === false) delete next.fallbackModels; else next.fallbackModels = [...override.fallbackModels]; }
|
|
1016
|
+
if (override.thinking !== undefined) { if (override.thinking === false) delete next.thinking; else next.thinking = override.thinking; }
|
|
986
1017
|
if (override.systemPromptMode !== undefined) next.systemPromptMode = override.systemPromptMode;
|
|
987
1018
|
if (override.inheritProjectContext !== undefined) next.inheritProjectContext = override.inheritProjectContext;
|
|
988
1019
|
if (override.inheritSkills !== undefined) next.inheritSkills = override.inheritSkills;
|
|
989
|
-
if (override.defaultContext !== undefined)
|
|
990
|
-
if (override.acceptanceRole !== undefined)
|
|
1020
|
+
if (override.defaultContext !== undefined) { if (override.defaultContext === false) delete next.defaultContext; else next.defaultContext = override.defaultContext; }
|
|
1021
|
+
if (override.acceptanceRole !== undefined) { if (override.acceptanceRole === false) delete next.acceptanceRole; else next.acceptanceRole = override.acceptanceRole; }
|
|
991
1022
|
if (override.disabled !== undefined) next.disabled = override.disabled;
|
|
992
1023
|
if (override.systemPrompt !== undefined) next.systemPrompt = override.systemPrompt;
|
|
993
|
-
if (override.skills !== undefined)
|
|
1024
|
+
if (override.skills !== undefined) { if (override.skills === false) delete next.skills; else next.skills = [...override.skills]; }
|
|
994
1025
|
if (override.tools !== undefined) {
|
|
995
1026
|
const { tools, mcpDirectTools } = splitToolList(override.tools === false ? [] : override.tools);
|
|
996
|
-
next.tools = tools;
|
|
997
|
-
next.mcpDirectTools = mcpDirectTools;
|
|
998
|
-
}
|
|
999
|
-
if (override.extensions !== undefined) next.extensions = override.extensions === false ? undefined : [...override.extensions];
|
|
1000
|
-
if (override.subagentOnlyExtensions !== undefined) {
|
|
1001
|
-
next.subagentOnlyExtensions = override.subagentOnlyExtensions === false ? undefined : [...override.subagentOnlyExtensions];
|
|
1027
|
+
if (tools === undefined) delete next.tools; else next.tools = tools;
|
|
1028
|
+
if (mcpDirectTools === undefined) delete next.mcpDirectTools; else next.mcpDirectTools = mcpDirectTools;
|
|
1002
1029
|
}
|
|
1030
|
+
if (override.extensions !== undefined) { if (override.extensions === false) delete next.extensions; else next.extensions = [...override.extensions]; }
|
|
1031
|
+
if (override.subagentOnlyExtensions !== undefined) { if (override.subagentOnlyExtensions === false) delete next.subagentOnlyExtensions; else next.subagentOnlyExtensions = [...override.subagentOnlyExtensions]; }
|
|
1003
1032
|
if (override.completionGuard !== undefined) next.completionGuard = override.completionGuard;
|
|
1004
|
-
if (override.toolBudget !== undefined)
|
|
1033
|
+
if (override.toolBudget !== undefined) { if (override.toolBudget === false) delete next.toolBudget; else next.toolBudget = override.toolBudget; }
|
|
1005
1034
|
|
|
1006
1035
|
return next;
|
|
1007
1036
|
}
|
|
1008
1037
|
|
|
1009
1038
|
function clearBuiltinThinking(agent: AgentConfig, meta: { scope: "user" | "project"; path: string }): AgentConfig {
|
|
1010
1039
|
if (agent.thinking === undefined) return agent;
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
thinking: undefined,
|
|
1014
|
-
override: agent.override ?? { ...meta, base: cloneOverrideBase(agent) },
|
|
1015
|
-
};
|
|
1040
|
+
const { thinking: _thinking, ...next } = agent;
|
|
1041
|
+
return { ...next, override: agent.override ?? { ...meta, base: cloneOverrideBase(agent) } };
|
|
1016
1042
|
}
|
|
1017
1043
|
|
|
1018
1044
|
function applyBuiltinOverrides(
|
|
@@ -1094,7 +1120,8 @@ function applyCustomAgentOverride(
|
|
|
1094
1120
|
value: AgentConfig[K],
|
|
1095
1121
|
): void => {
|
|
1096
1122
|
if (agentHasFrontmatterField(agent, ...frontmatterFields)) return;
|
|
1097
|
-
mutable()
|
|
1123
|
+
const target = mutable();
|
|
1124
|
+
if (value === undefined) delete target[field]; else target[field] = value;
|
|
1098
1125
|
anyFilled = true;
|
|
1099
1126
|
};
|
|
1100
1127
|
|
|
@@ -1140,8 +1167,8 @@ function applyCustomAgentOverride(
|
|
|
1140
1167
|
if (override.tools !== undefined && !agentHasFrontmatterField(agent, "tools")) {
|
|
1141
1168
|
const { tools, mcpDirectTools } = splitToolList(override.tools === false ? [] : override.tools);
|
|
1142
1169
|
const target = mutable();
|
|
1143
|
-
target.tools = tools;
|
|
1144
|
-
target.mcpDirectTools = mcpDirectTools;
|
|
1170
|
+
if (tools === undefined) delete target.tools; else target.tools = tools;
|
|
1171
|
+
if (mcpDirectTools === undefined) delete target.mcpDirectTools; else target.mcpDirectTools = mcpDirectTools;
|
|
1145
1172
|
anyFilled = true;
|
|
1146
1173
|
}
|
|
1147
1174
|
if (override.extensions !== undefined) {
|
|
@@ -1395,6 +1422,55 @@ function isLegacyAgentSkillPath(rootDir: string, filePath: string): boolean {
|
|
|
1395
1422
|
return parts.some((part, index) => part === ".agents" && parts[index + 1] === "skills");
|
|
1396
1423
|
}
|
|
1397
1424
|
|
|
1425
|
+
function parseAgentRunnerFrontmatter(raw: string | undefined, agentName: string): AgentRunnerConfig | undefined {
|
|
1426
|
+
if (raw === undefined || !raw.trim()) return undefined;
|
|
1427
|
+
let parsed: unknown;
|
|
1428
|
+
try {
|
|
1429
|
+
parsed = parseYaml(raw);
|
|
1430
|
+
} catch (error) {
|
|
1431
|
+
throw new Error(`Agent '${agentName}' has invalid runner frontmatter: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
1432
|
+
}
|
|
1433
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
1434
|
+
throw new Error(`Agent '${agentName}' has invalid runner frontmatter; expected an object.`);
|
|
1435
|
+
}
|
|
1436
|
+
const runner = parsed as Record<string, unknown>;
|
|
1437
|
+
if (runner.type === "pi") {
|
|
1438
|
+
if (Object.keys(runner).some((key) => key !== "type")) throw new Error(`Agent '${agentName}' has invalid Pi runner frontmatter; only 'type' is supported.`);
|
|
1439
|
+
return { type: "pi" };
|
|
1440
|
+
}
|
|
1441
|
+
if (runner.type !== "external-cli") {
|
|
1442
|
+
throw new Error(`Agent '${agentName}' has invalid runner.type; expected 'pi' or 'external-cli'.`);
|
|
1443
|
+
}
|
|
1444
|
+
if (typeof runner.command !== "string" || !runner.command.trim()) {
|
|
1445
|
+
throw new Error(`Agent '${agentName}' external-cli runner requires a non-empty command string.`);
|
|
1446
|
+
}
|
|
1447
|
+
if (runner.args !== undefined && (!Array.isArray(runner.args) || runner.args.some((arg) => typeof arg !== "string"))) {
|
|
1448
|
+
throw new Error(`Agent '${agentName}' external-cli runner args must be an array of strings.`);
|
|
1449
|
+
}
|
|
1450
|
+
if (runner.promptDelivery !== undefined && runner.promptDelivery !== "stdin") {
|
|
1451
|
+
throw new Error(`Agent '${agentName}' external-cli runner promptDelivery must be 'stdin'.`);
|
|
1452
|
+
}
|
|
1453
|
+
const supported = new Set(["type", "command", "args", "promptDelivery"]);
|
|
1454
|
+
const unknown = Object.keys(runner).filter((key) => !supported.has(key));
|
|
1455
|
+
if (unknown.length > 0) throw new Error(`Agent '${agentName}' external-cli runner has unsupported fields: ${unknown.join(", ")}.`);
|
|
1456
|
+
const runnerArgs = Array.isArray(runner.args) ? runner.args.filter((arg): arg is string => typeof arg === "string") : undefined;
|
|
1457
|
+
return {
|
|
1458
|
+
type: "external-cli",
|
|
1459
|
+
command: runner.command.trim(),
|
|
1460
|
+
...(runnerArgs?.length ? { args: runnerArgs } : {}),
|
|
1461
|
+
...(runner.promptDelivery ? { promptDelivery: "stdin" as const } : {}),
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
function validateExternalRunnerProfile(frontmatter: Record<string, string>, agentName: string, runner: AgentRunnerConfig | undefined): void {
|
|
1466
|
+
if (runner?.type !== "external-cli") return;
|
|
1467
|
+
const unsupported = ["tools", "model", "fallbackModels", "thinking", "extensions", "subagentOnlyExtensions", "maxSubagentDepth", "completionGuard", "skills", "skill", "skillPath", "toolBudget", "permission", "permissions"]
|
|
1468
|
+
.filter((field) => frontmatter[field] !== undefined);
|
|
1469
|
+
if (unsupported.length > 0) {
|
|
1470
|
+
throw new Error(`Agent '${agentName}' uses runner.type='external-cli' and declares unsupported Pi-only fields: ${unsupported.join(", ")}.`);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1398
1474
|
function parseAgentAcceptanceFrontmatter(raw: string | undefined, agentName: string): AcceptanceInput | undefined {
|
|
1399
1475
|
if (raw === undefined || !raw.trim()) return undefined;
|
|
1400
1476
|
let parsed: unknown;
|
|
@@ -1435,6 +1511,8 @@ function loadAgentsFromDir(dir: string, source: AgentSource): AgentConfig[] {
|
|
|
1435
1511
|
const packageName = parsedPackage.packageName;
|
|
1436
1512
|
const runtimeName = buildRuntimeName(localName, packageName);
|
|
1437
1513
|
|
|
1514
|
+
const runner = parseAgentRunnerFrontmatter(frontmatter.runner, localName);
|
|
1515
|
+
validateExternalRunnerProfile(frontmatter, localName, runner);
|
|
1438
1516
|
const rawTools = parseFrontmatterList(frontmatter.tools);
|
|
1439
1517
|
const parsedTools = splitToolList(rawTools);
|
|
1440
1518
|
const tools = parsedTools.tools ?? [];
|
|
@@ -1502,6 +1580,13 @@ function loadAgentsFromDir(dir: string, source: AgentSource): AgentConfig[] {
|
|
|
1502
1580
|
}
|
|
1503
1581
|
|
|
1504
1582
|
const parsedMaxSubagentDepth = Number(frontmatter.maxSubagentDepth);
|
|
1583
|
+
if (frontmatter.permission !== undefined && frontmatter.permissions !== undefined) {
|
|
1584
|
+
throw new Error(`Agent '${localName}' cannot declare both permission and permissions frontmatter.`);
|
|
1585
|
+
}
|
|
1586
|
+
const permissionSource = frontmatter.permissions ?? frontmatter.permission;
|
|
1587
|
+
const permissions = permissionSource?.trim()
|
|
1588
|
+
? validatePermissionRules(parseYaml(permissionSource), `Agent '${localName}' permissions`)
|
|
1589
|
+
: undefined;
|
|
1505
1590
|
let toolBudget: ToolBudgetConfig | undefined;
|
|
1506
1591
|
if (frontmatter.toolBudget !== undefined && frontmatter.toolBudget.trim()) {
|
|
1507
1592
|
const parsed = JSON.parse(frontmatter.toolBudget) as unknown;
|
|
@@ -1516,45 +1601,48 @@ function loadAgentsFromDir(dir: string, source: AgentSource): AgentConfig[] {
|
|
|
1516
1601
|
? true
|
|
1517
1602
|
: undefined;
|
|
1518
1603
|
|
|
1604
|
+
const maxSubagentDepth = Number.isInteger(parsedMaxSubagentDepth) && parsedMaxSubagentDepth >= 0
|
|
1605
|
+
? parsedMaxSubagentDepth
|
|
1606
|
+
: undefined;
|
|
1607
|
+
const memory = parseMemoryFrontmatter(frontmatter.memory);
|
|
1519
1608
|
const agent: AgentConfig = {
|
|
1520
1609
|
name: runtimeName,
|
|
1610
|
+
...(runner !== undefined ? { runner } : {}),
|
|
1521
1611
|
localName,
|
|
1522
|
-
packageName,
|
|
1612
|
+
...(packageName !== undefined ? { packageName } : {}),
|
|
1523
1613
|
description: frontmatter.description,
|
|
1524
|
-
aliases,
|
|
1525
|
-
|
|
1526
|
-
mcpDirectTools
|
|
1527
|
-
model: frontmatter.model,
|
|
1528
|
-
fallbackModels
|
|
1529
|
-
thinking: frontmatter.thinking === "false" ? false : frontmatter.thinking,
|
|
1614
|
+
...(aliases !== undefined ? { aliases } : {}),
|
|
1615
|
+
...(rawTools !== undefined ? { tools } : {}),
|
|
1616
|
+
...(mcpDirectTools.length > 0 ? { mcpDirectTools } : {}),
|
|
1617
|
+
...(frontmatter.model !== undefined ? { model: frontmatter.model } : {}),
|
|
1618
|
+
...(fallbackModels?.length ? { fallbackModels } : {}),
|
|
1619
|
+
...(frontmatter.thinking !== undefined ? { thinking: frontmatter.thinking === "false" ? false : frontmatter.thinking } : {}),
|
|
1530
1620
|
systemPromptMode,
|
|
1531
1621
|
inheritProjectContext,
|
|
1532
1622
|
inheritSkills,
|
|
1533
|
-
defaultContext,
|
|
1534
|
-
defaultAsync,
|
|
1535
|
-
defaultTimeoutMs,
|
|
1536
|
-
defaultTurnBudget,
|
|
1537
|
-
defaultAcceptance,
|
|
1538
|
-
acceptanceRole,
|
|
1623
|
+
...(defaultContext !== undefined ? { defaultContext } : {}),
|
|
1624
|
+
...(defaultAsync !== undefined ? { defaultAsync } : {}),
|
|
1625
|
+
...(defaultTimeoutMs !== undefined ? { defaultTimeoutMs } : {}),
|
|
1626
|
+
...(defaultTurnBudget !== undefined ? { defaultTurnBudget } : {}),
|
|
1627
|
+
...(defaultAcceptance !== undefined ? { defaultAcceptance } : {}),
|
|
1628
|
+
...(acceptanceRole !== undefined ? { acceptanceRole } : {}),
|
|
1539
1629
|
systemPrompt: body,
|
|
1540
1630
|
source,
|
|
1541
1631
|
filePath,
|
|
1542
|
-
skills
|
|
1543
|
-
skillPath
|
|
1544
|
-
extensions,
|
|
1545
|
-
subagentOnlyExtensions,
|
|
1546
|
-
output: frontmatter.output,
|
|
1547
|
-
defaultReads
|
|
1632
|
+
...(skills?.length ? { skills } : {}),
|
|
1633
|
+
...(skillPath?.length ? { skillPath } : {}),
|
|
1634
|
+
...(extensions !== undefined ? { extensions } : {}),
|
|
1635
|
+
...(subagentOnlyExtensions !== undefined ? { subagentOnlyExtensions } : {}),
|
|
1636
|
+
...(frontmatter.output !== undefined ? { output: frontmatter.output } : {}),
|
|
1637
|
+
...(defaultReads?.length ? { defaultReads } : {}),
|
|
1548
1638
|
defaultProgress: frontmatter.defaultProgress === "true",
|
|
1549
1639
|
interactive: frontmatter.interactive === "true",
|
|
1550
|
-
maxSubagentDepth:
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
memory: parseMemoryFrontmatter(frontmatter.memory),
|
|
1557
|
-
extraFields: Object.keys(extraFields).length > 0 ? extraFields : undefined,
|
|
1640
|
+
...(maxSubagentDepth !== undefined ? { maxSubagentDepth } : {}),
|
|
1641
|
+
...(completionGuard !== undefined ? { completionGuard } : {}),
|
|
1642
|
+
...(toolBudget !== undefined ? { toolBudget } : {}),
|
|
1643
|
+
...(permissions !== undefined ? { permissions } : {}),
|
|
1644
|
+
...(memory !== undefined ? { memory } : {}),
|
|
1645
|
+
...(Object.keys(extraFields).length > 0 ? { extraFields } : {}),
|
|
1558
1646
|
};
|
|
1559
1647
|
agentFrontmatterFields.set(agent, new Set(Object.keys(frontmatter)));
|
|
1560
1648
|
agents.push(agent);
|
|
@@ -1694,7 +1782,7 @@ export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryRe
|
|
|
1694
1782
|
const agents = mergeAgentsForScope(scope, userAgents, projectAgents, builtinAgents, packageAgents)
|
|
1695
1783
|
.filter((agent) => agent.disabled !== true);
|
|
1696
1784
|
|
|
1697
|
-
return { agents, projectAgentsDir, modelScope };
|
|
1785
|
+
return { agents, projectAgentsDir, ...(modelScope !== undefined ? { modelScope } : {}) };
|
|
1698
1786
|
}
|
|
1699
1787
|
|
|
1700
1788
|
export function discoverAgentsAll(cwd: string): {
|
|
@@ -17,8 +17,10 @@ function parseStepBody(agent: string, sectionBody: string): ChainStepConfig {
|
|
|
17
17
|
for (const line of configLines) {
|
|
18
18
|
const match = line.match(/^([\w-]+):\s*(.*)$/);
|
|
19
19
|
if (!match) continue;
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const [keyValue, rawValueValue] = match.slice(1);
|
|
21
|
+
if (keyValue === undefined || rawValueValue === undefined) continue;
|
|
22
|
+
const key = keyValue.trim().toLowerCase();
|
|
23
|
+
const rawValue = rawValueValue.trim();
|
|
22
24
|
|
|
23
25
|
if (key === "output") {
|
|
24
26
|
if (rawValue === "false") step.output = false;
|
|
@@ -91,7 +93,8 @@ function parseStepBody(agent: string, sectionBody: string): ChainStepConfig {
|
|
|
91
93
|
}
|
|
92
94
|
const validation = validateToolBudgetConfig(parsed, `toolBudget for step '${agent}'`);
|
|
93
95
|
if (validation.error) throw new Error(validation.error);
|
|
94
|
-
|
|
96
|
+
const toolBudget = parsed as ChainStepConfig["toolBudget"];
|
|
97
|
+
if (toolBudget !== undefined) step.toolBudget = toolBudget;
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
|
|
@@ -130,12 +133,12 @@ export function parseChain(content: string, source: AgentSource, filePath: strin
|
|
|
130
133
|
return {
|
|
131
134
|
name: buildRuntimeName(localName, packageName),
|
|
132
135
|
localName,
|
|
133
|
-
packageName,
|
|
136
|
+
...(packageName !== undefined ? { packageName } : {}),
|
|
134
137
|
description: frontmatter.description,
|
|
135
138
|
source,
|
|
136
139
|
filePath,
|
|
137
140
|
steps,
|
|
138
|
-
|
|
141
|
+
...(Object.keys(extraFields).length > 0 ? { extraFields } : {}),
|
|
139
142
|
};
|
|
140
143
|
}
|
|
141
144
|
|
|
@@ -213,12 +216,12 @@ export function parseJsonChain(content: string, source: AgentSource, filePath: s
|
|
|
213
216
|
return {
|
|
214
217
|
name: buildRuntimeName(input.name.trim(), parsedPackage.packageName),
|
|
215
218
|
localName: input.name.trim(),
|
|
216
|
-
packageName: parsedPackage.packageName,
|
|
219
|
+
...(parsedPackage.packageName !== undefined ? { packageName: parsedPackage.packageName } : {}),
|
|
217
220
|
description: input.description.trim(),
|
|
218
221
|
source,
|
|
219
222
|
filePath,
|
|
220
223
|
steps: input.chain as ChainStepConfig[],
|
|
221
|
-
|
|
224
|
+
...(Object.keys(extraFields).length > 0 ? { extraFields } : {}),
|
|
222
225
|
};
|
|
223
226
|
}
|
|
224
227
|
|
|
@@ -113,20 +113,22 @@ export function parseFrontmatter(content: string): { frontmatter: Record<string,
|
|
|
113
113
|
|
|
114
114
|
const match = line.match(/^([\w-]+):\s*(.*)$/);
|
|
115
115
|
if (match) {
|
|
116
|
-
const
|
|
116
|
+
const [key, rawValueValue] = match.slice(1);
|
|
117
|
+
if (key === undefined || rawValueValue === undefined) continue;
|
|
118
|
+
const rawValue = rawValueValue.trim();
|
|
117
119
|
const isQuoted = (rawValue.startsWith('"') && rawValue.endsWith('"')) || (rawValue.startsWith("'") && rawValue.endsWith("'"));
|
|
118
120
|
const value = isQuoted ? rawValue.slice(1, -1) : rawValue;
|
|
119
121
|
const isFolded = !isQuoted && (rawValue === ">" || rawValue === ">-");
|
|
120
122
|
|
|
121
123
|
if (value === "" || isFolded) {
|
|
122
124
|
// Key with empty value or folded block indicator — defer storing until we see indent
|
|
123
|
-
currentKey =
|
|
125
|
+
currentKey = key;
|
|
124
126
|
currentBlockLines = [];
|
|
125
127
|
currentIndent = indent;
|
|
126
128
|
currentFolded = isFolded;
|
|
127
129
|
} else {
|
|
128
130
|
// Simple key: value
|
|
129
|
-
frontmatter[
|
|
131
|
+
frontmatter[key] = value;
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
134
|
// Lines that don't match a key pattern (e.g., comments, empty lines) are ignored
|
|
@@ -9,7 +9,7 @@ function normalizePackageName(value: string | undefined): string | undefined {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function parsePackageName(value: unknown, label = "package"): { packageName?: string; error?: string } {
|
|
12
|
-
if (value === undefined || value === false || value === "") return {
|
|
12
|
+
if (value === undefined || value === false || value === "") return {};
|
|
13
13
|
if (typeof value !== "string") return { error: `${label} must be a string or false when provided.` };
|
|
14
14
|
const packageName = normalizePackageName(value);
|
|
15
15
|
if (!packageName || !IDENTIFIER_PATTERN.test(packageName)) return { error: `${label} is invalid after sanitization.` };
|
|
@@ -5,7 +5,7 @@ const SUBAGENT_ORCHESTRATION_SKILL = "pi-subagents";
|
|
|
5
5
|
const DEFAULT_MIN_REFERENCES = 2;
|
|
6
6
|
const DEFAULT_MAX_RECOMMENDATIONS = 3;
|
|
7
7
|
const DEFAULT_PREFERRED_AGENT = "commentator";
|
|
8
|
-
const FALLBACK_AGENT_ORDER = ["commentator", "architect", "
|
|
8
|
+
const FALLBACK_AGENT_ORDER = ["commentator", "architect", "explorer"];
|
|
9
9
|
const MAX_RECOMMENDATION_CAP = 5;
|
|
10
10
|
|
|
11
11
|
export interface ResolvedProactiveSkillSubagentsConfig {
|
|
@@ -141,14 +141,17 @@ export function recommendProactiveSkillSubagents(input: {
|
|
|
141
141
|
|
|
142
142
|
return [...counts.entries()]
|
|
143
143
|
.filter(([skill, sources]) => sources.size >= config.minReferences && (!availableByName || availableByName.has(skill)))
|
|
144
|
-
.map(([skill, sources]) =>
|
|
145
|
-
skill
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
.map(([skill, sources]) => {
|
|
145
|
+
const description = availableByName?.get(skill)?.description;
|
|
146
|
+
return {
|
|
147
|
+
skill,
|
|
148
|
+
agent,
|
|
149
|
+
references: sources.size,
|
|
150
|
+
sources: [...sources].sort((a, b) => a.localeCompare(b)),
|
|
151
|
+
...(description !== undefined ? { description } : {}),
|
|
152
|
+
reason: `referenced by ${sources.size} configured agents/chains`,
|
|
153
|
+
};
|
|
154
|
+
})
|
|
152
155
|
.sort((a, b) => b.references - a.references || a.skill.localeCompare(b.skill))
|
|
153
156
|
.slice(0, config.maxRecommendations);
|
|
154
157
|
}
|
|
@@ -184,8 +187,8 @@ export function buildProactiveSkillSubagentRecommendationLines(input: {
|
|
|
184
187
|
}
|
|
185
188
|
return formatProactiveSkillSubagentRecommendations(recommendProactiveSkillSubagents({
|
|
186
189
|
agents: input.agents,
|
|
187
|
-
chains: input.chains,
|
|
190
|
+
...(input.chains !== undefined ? { chains: input.chains } : {}),
|
|
188
191
|
availableSkills,
|
|
189
|
-
config: input.config,
|
|
192
|
+
...(input.config !== undefined ? { config: input.config } : {}),
|
|
190
193
|
}));
|
|
191
194
|
}
|
|
@@ -125,8 +125,23 @@ function getGlobalNpmRoot(): string | null {
|
|
|
125
125
|
const offline = process.env.PI_OFFLINE?.toLowerCase();
|
|
126
126
|
if (offline === "1" || offline === "true" || offline === "yes") return null;
|
|
127
127
|
if (cachedGlobalNpmRoot !== null) return cachedGlobalNpmRoot;
|
|
128
|
+
|
|
129
|
+
const windowsGlobalRoot = process.platform === "win32" && process.env.APPDATA
|
|
130
|
+
? path.join(process.env.APPDATA, "npm", "node_modules")
|
|
131
|
+
: undefined;
|
|
132
|
+
if (windowsGlobalRoot) {
|
|
133
|
+
try {
|
|
134
|
+
if (fs.statSync(windowsGlobalRoot).isDirectory()) {
|
|
135
|
+
cachedGlobalNpmRoot = fs.realpathSync(windowsGlobalRoot);
|
|
136
|
+
return cachedGlobalNpmRoot;
|
|
137
|
+
}
|
|
138
|
+
} catch {
|
|
139
|
+
// Fall through if the directory disappears while resolving it.
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
128
143
|
try {
|
|
129
|
-
cachedGlobalNpmRoot = execSync("npm root -g", { encoding: "utf-8", timeout: 5000 }).trim();
|
|
144
|
+
cachedGlobalNpmRoot = fs.realpathSync(execSync("npm root -g", { encoding: "utf-8", timeout: 5000 }).trim());
|
|
130
145
|
return cachedGlobalNpmRoot;
|
|
131
146
|
} catch {
|
|
132
147
|
// Global npm root is optional in constrained environments.
|
|
@@ -410,15 +425,17 @@ function collectFilesystemSkills(cwd: string, agentDir: string, skillPaths: Skil
|
|
|
410
425
|
const resolvedFile = path.resolve(filePath);
|
|
411
426
|
if (!fs.existsSync(resolvedFile)) return;
|
|
412
427
|
const source = inferSkillSource(resolvedFile, cwd, agentDir, sourceHint);
|
|
428
|
+
const description = maybeReadSkillDescription(resolvedFile);
|
|
413
429
|
const existingIndex = seen.get(resolvedFile);
|
|
414
430
|
if (existingIndex !== undefined) {
|
|
415
431
|
const existing = entries[existingIndex];
|
|
416
432
|
if (existing && (SOURCE_PRIORITY[source] ?? 0) > (SOURCE_PRIORITY[existing.source] ?? 0)) {
|
|
433
|
+
const { description: _description, ...existingWithoutDescription } = existing;
|
|
417
434
|
entries[existingIndex] = {
|
|
418
|
-
...
|
|
435
|
+
...existingWithoutDescription,
|
|
419
436
|
name,
|
|
420
437
|
source,
|
|
421
|
-
description:
|
|
438
|
+
...(description !== undefined ? { description } : {}),
|
|
422
439
|
};
|
|
423
440
|
}
|
|
424
441
|
return;
|
|
@@ -428,7 +445,7 @@ function collectFilesystemSkills(cwd: string, agentDir: string, skillPaths: Skil
|
|
|
428
445
|
name,
|
|
429
446
|
filePath: resolvedFile,
|
|
430
447
|
source,
|
|
431
|
-
description:
|
|
448
|
+
...(description !== undefined ? { description } : {}),
|
|
432
449
|
order: order++,
|
|
433
450
|
});
|
|
434
451
|
};
|
|
@@ -592,7 +609,7 @@ function readSkill(
|
|
|
592
609
|
name: skillName,
|
|
593
610
|
path: skillPath,
|
|
594
611
|
content,
|
|
595
|
-
description,
|
|
612
|
+
...(description !== undefined ? { description } : {}),
|
|
596
613
|
source,
|
|
597
614
|
};
|
|
598
615
|
|
|
@@ -733,7 +750,7 @@ export function discoverAvailableSkills(cwd: string): Array<{
|
|
|
733
750
|
.map((s) => ({
|
|
734
751
|
name: s.name,
|
|
735
752
|
source: s.source,
|
|
736
|
-
description: s.description,
|
|
753
|
+
...(s.description !== undefined ? { description: s.description } : {}),
|
|
737
754
|
}))
|
|
738
755
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
739
756
|
}
|
|
@@ -13,9 +13,16 @@
|
|
|
13
13
|
|
|
14
14
|
import type { AgentConfig, AgentSource } from "./agents.ts";
|
|
15
15
|
import { agentHasWriteTools } from "./agent-memory.ts";
|
|
16
|
-
import { classifyTaskMutationIntent
|
|
16
|
+
import { classifyTaskMutationIntent } from "../runs/shared/task-intent.ts";
|
|
17
17
|
import { isAgentAllowedByCapabilityCeiling, type ResolvedSubagentCapabilityCeiling } from "../runs/shared/capability-ceiling.ts";
|
|
18
18
|
|
|
19
|
+
function resolveAgentRoutingRole(name: string, acceptanceRole: AgentConfig["acceptanceRole"]): "writer" | "read-only" | undefined {
|
|
20
|
+
if (acceptanceRole === "writer" || acceptanceRole === "read-only") return acceptanceRole;
|
|
21
|
+
if (/^(?:builder|developer|coder|implementer|develop)$/i.test(name)) return "writer";
|
|
22
|
+
if (/^(?:architect|commentator|explorer|researcher|recapper)$/i.test(name)) return "read-only";
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
/** Core tools that make an implementation agent able to write (matches agent-memory). */
|
|
20
27
|
const WRITER_TOOLS = new Set(["edit", "write", "bash"]);
|
|
21
28
|
|