@selesai/code 0.13.13 → 0.13.14
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/dist/bun/cli.d.ts +2 -0
- package/dist/bun/cli.js +10 -0
- package/dist/bun/register-bedrock.d.ts +1 -0
- package/dist/bun/register-bedrock.js +3 -0
- package/dist/bun/restore-sandbox-env.d.ts +16 -0
- package/dist/bun/restore-sandbox-env.js +35 -0
- package/dist/cli/args.d.ts +59 -0
- package/dist/cli/args.js +428 -0
- package/dist/cli/args.test.d.ts +1 -0
- package/dist/cli/args.test.js +32 -0
- package/dist/cli/config-selector.d.ts +15 -0
- package/dist/cli/config-selector.js +30 -0
- package/dist/cli/credential-print.d.ts +22 -0
- package/dist/cli/credential-print.js +116 -0
- package/dist/cli/file-processor.d.ts +14 -0
- package/dist/cli/file-processor.js +69 -0
- package/dist/cli/initial-message.d.ts +17 -0
- package/dist/cli/initial-message.js +21 -0
- package/dist/cli/list-models.d.ts +8 -0
- package/dist/cli/list-models.js +97 -0
- package/dist/cli/project-trust.d.ts +9 -0
- package/dist/cli/project-trust.js +47 -0
- package/dist/cli/session-picker.d.ts +9 -0
- package/dist/cli/session-picker.js +35 -0
- package/dist/cli/startup-ui.d.ts +22 -0
- package/dist/cli/startup-ui.js +172 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +17 -0
- package/dist/config.d.ts +181 -0
- package/dist/config.js +788 -0
- package/dist/core/agent-session-auto-handoff.test.d.ts +1 -0
- package/dist/core/agent-session-auto-handoff.test.js +183 -0
- package/dist/core/agent-session-length-continuation.test.d.ts +1 -0
- package/dist/core/agent-session-length-continuation.test.js +107 -0
- package/dist/core/agent-session-runtime.d.ts +118 -0
- package/dist/core/agent-session-runtime.js +305 -0
- package/dist/core/agent-session-services.d.ts +84 -0
- package/dist/core/agent-session-services.js +132 -0
- package/dist/core/agent-session-skill-block.test.d.ts +1 -0
- package/dist/core/agent-session-skill-block.test.js +19 -0
- package/dist/core/agent-session.d.ts +713 -0
- package/dist/core/agent-session.js +3054 -0
- package/dist/core/agents.d.ts +52 -0
- package/dist/core/agents.js +237 -0
- package/dist/core/auth-guidance.d.ts +4 -0
- package/dist/core/auth-guidance.js +20 -0
- package/dist/core/auth-storage.d.ts +61 -0
- package/dist/core/auth-storage.js +249 -0
- package/dist/core/bash-executor.d.ts +31 -0
- package/dist/core/bash-executor.js +110 -0
- package/dist/core/built-in-extensions.d.ts +2 -0
- package/dist/core/built-in-extensions.js +2 -0
- package/dist/core/cache-stats.d.ts +48 -0
- package/dist/core/cache-stats.js +100 -0
- package/dist/core/compaction/branch-summarization.d.ts +97 -0
- package/dist/core/compaction/branch-summarization.js +246 -0
- package/dist/core/compaction/compaction.d.ts +141 -0
- package/dist/core/compaction/compaction.js +659 -0
- package/dist/core/compaction/index.d.ts +6 -0
- package/dist/core/compaction/index.js +6 -0
- package/dist/core/compaction/utils.d.ts +37 -0
- package/dist/core/compaction/utils.js +141 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.js +10 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.js +1 -0
- package/dist/core/event-bus.d.ts +8 -0
- package/dist/core/event-bus.js +24 -0
- package/dist/core/exec.d.ts +28 -0
- package/dist/core/exec.js +74 -0
- package/dist/core/experimental.d.ts +5 -0
- package/dist/core/experimental.js +7 -0
- package/dist/core/export-html/ansi-to-html.d.ts +21 -0
- package/dist/core/export-html/ansi-to-html.js +248 -0
- package/dist/core/export-html/index.d.ts +36 -0
- package/dist/core/export-html/index.js +225 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/tool-renderer.d.ts +33 -0
- package/dist/core/export-html/tool-renderer.js +107 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +78 -0
- package/dist/core/extensions/index.d.ts +11 -0
- package/dist/core/extensions/index.js +8 -0
- package/dist/core/extensions/loader.d.ts +22 -0
- package/dist/core/extensions/loader.js +632 -0
- package/dist/core/extensions/loader.test.d.ts +1 -0
- package/dist/core/extensions/loader.test.js +21 -0
- package/dist/core/extensions/runner.d.ts +176 -0
- package/dist/core/extensions/runner.js +1016 -0
- package/dist/core/extensions/types.d.ts +1313 -0
- package/dist/core/extensions/types.js +44 -0
- package/dist/core/extensions/wrapper.d.ts +19 -0
- package/dist/core/extensions/wrapper.js +40 -0
- package/dist/core/footer-data-provider.d.ts +63 -0
- package/dist/core/footer-data-provider.js +337 -0
- package/dist/core/git-command.d.ts +8 -0
- package/dist/core/git-command.js +48 -0
- package/dist/core/handoff.d.ts +11 -0
- package/dist/core/handoff.js +49 -0
- package/dist/core/http-dispatcher.d.ts +21 -0
- package/dist/core/http-dispatcher.js +90 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +12 -0
- package/dist/core/keybindings.d.ts +421 -0
- package/dist/core/keybindings.js +295 -0
- package/dist/core/llama/client.d.ts +66 -0
- package/dist/core/llama/client.js +308 -0
- package/dist/core/llama/huggingface.d.ts +22 -0
- package/dist/core/llama/huggingface.js +140 -0
- package/dist/core/llama/index.d.ts +2 -0
- package/dist/core/llama/index.js +207 -0
- package/dist/core/llama/provider.d.ts +11 -0
- package/dist/core/llama/provider.js +143 -0
- package/dist/core/llama/ui.d.ts +41 -0
- package/dist/core/llama/ui.js +415 -0
- package/dist/core/messages.d.ts +76 -0
- package/dist/core/messages.js +122 -0
- package/dist/core/model-config.d.ts +547 -0
- package/dist/core/model-config.js +278 -0
- package/dist/core/model-registry.d.ts +45 -0
- package/dist/core/model-registry.js +107 -0
- package/dist/core/model-resolver.d.ts +122 -0
- package/dist/core/model-resolver.js +558 -0
- package/dist/core/model-runtime.d.ts +86 -0
- package/dist/core/model-runtime.js +472 -0
- package/dist/core/models-store.d.ts +16 -0
- package/dist/core/models-store.js +44 -0
- package/dist/core/output-guard.d.ts +6 -0
- package/dist/core/output-guard.js +88 -0
- package/dist/core/package-manager.d.ts +221 -0
- package/dist/core/package-manager.js +2232 -0
- package/dist/core/package-manager.test.d.ts +1 -0
- package/dist/core/package-manager.test.js +58 -0
- package/dist/core/project-trust.d.ts +14 -0
- package/dist/core/project-trust.js +58 -0
- package/dist/core/prompt-templates.d.ts +53 -0
- package/dist/core/prompt-templates.js +235 -0
- package/dist/core/provider-attribution.d.ts +3 -0
- package/dist/core/provider-attribution.js +71 -0
- package/dist/core/provider-composer.d.ts +54 -0
- package/dist/core/provider-composer.js +387 -0
- package/dist/core/radius.d.ts +1 -0
- package/dist/core/radius.js +1 -0
- package/dist/core/remote-catalog-provider.d.ts +4 -0
- package/dist/core/remote-catalog-provider.js +119 -0
- package/dist/core/resolve-config-value.d.ts +29 -0
- package/dist/core/resolve-config-value.js +246 -0
- package/dist/core/resource-loader.d.ts +256 -0
- package/dist/core/resource-loader.js +974 -0
- package/dist/core/runtime-credentials.d.ts +16 -0
- package/dist/core/runtime-credentials.js +41 -0
- package/dist/core/sdk.d.ts +107 -0
- package/dist/core/sdk.js +279 -0
- package/dist/core/session-cwd.d.ts +18 -0
- package/dist/core/session-cwd.js +37 -0
- package/dist/core/session-manager.d.ts +355 -0
- package/dist/core/session-manager.js +1339 -0
- package/dist/core/settings-manager-auto-handoff.test.d.ts +1 -0
- package/dist/core/settings-manager-auto-handoff.test.js +42 -0
- package/dist/core/settings-manager.d.ts +350 -0
- package/dist/core/settings-manager.js +1076 -0
- package/dist/core/skills.d.ts +70 -0
- package/dist/core/skills.js +401 -0
- package/dist/core/slash-commands.d.ts +14 -0
- package/dist/core/slash-commands.js +27 -0
- package/dist/core/source-info.d.ts +17 -0
- package/dist/core/source-info.js +18 -0
- package/dist/core/system-prompt.d.ts +30 -0
- package/dist/core/system-prompt.js +129 -0
- package/dist/core/system-prompt.test.d.ts +1 -0
- package/dist/core/system-prompt.test.js +94 -0
- package/dist/core/telemetry.d.ts +2 -0
- package/dist/core/telemetry.js +8 -0
- package/dist/core/timings.d.ts +9 -0
- package/dist/core/timings.js +40 -0
- package/dist/core/tools/bash.d.ts +86 -0
- package/dist/core/tools/bash.js +409 -0
- package/dist/core/tools/edit-diff.d.ts +105 -0
- package/dist/core/tools/edit-diff.js +423 -0
- package/dist/core/tools/edit.d.ts +50 -0
- package/dist/core/tools/edit.js +285 -0
- package/dist/core/tools/file-mutation-queue.d.ts +5 -0
- package/dist/core/tools/file-mutation-queue.js +51 -0
- package/dist/core/tools/find.d.ts +34 -0
- package/dist/core/tools/find.js +304 -0
- package/dist/core/tools/grep.d.ts +36 -0
- package/dist/core/tools/grep.js +303 -0
- package/dist/core/tools/index.d.ts +42 -0
- package/dist/core/tools/index.js +119 -0
- package/dist/core/tools/ls.d.ts +36 -0
- package/dist/core/tools/ls.js +166 -0
- package/dist/core/tools/output-accumulator.d.ts +51 -0
- package/dist/core/tools/output-accumulator.js +183 -0
- package/dist/core/tools/path-utils.d.ts +9 -0
- package/dist/core/tools/path-utils.js +98 -0
- package/dist/core/tools/powershell.d.ts +15 -0
- package/dist/core/tools/powershell.js +38 -0
- package/dist/core/tools/powershell.test.d.ts +1 -0
- package/dist/core/tools/powershell.test.js +20 -0
- package/dist/core/tools/read-vision.test.d.ts +1 -0
- package/dist/core/tools/read-vision.test.js +122 -0
- package/dist/core/tools/read.d.ts +46 -0
- package/dist/core/tools/read.js +327 -0
- package/dist/core/tools/render-utils.d.ts +23 -0
- package/dist/core/tools/render-utils.js +64 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +13 -0
- package/dist/core/tools/tool-definition-wrapper.js +35 -0
- package/dist/core/tools/truncate.d.ts +69 -0
- package/dist/core/tools/truncate.js +214 -0
- package/dist/core/tools/write.d.ts +25 -0
- package/dist/core/tools/write.js +198 -0
- package/dist/core/trust-manager.d.ts +35 -0
- package/dist/core/trust-manager.js +201 -0
- package/dist/core/usage-totals.d.ts +20 -0
- package/dist/core/usage-totals.js +61 -0
- package/dist/core/vision-caption.d.ts +30 -0
- package/dist/core/vision-caption.js +62 -0
- package/dist/defaults/models.json +335 -0
- package/dist/defaults/settings.json +61 -0
- package/dist/extensions/agent-browser.test.ts +371 -0
- package/dist/extensions/agent-browser.ts +160 -0
- package/dist/extensions/auto-session-name.test.ts +169 -0
- package/dist/extensions/auto-session-name.ts +100 -0
- package/dist/extensions/context-compaction-reminder.test.ts +82 -0
- package/dist/extensions/context-compaction-reminder.ts +28 -0
- package/dist/extensions/copy-turn.test.ts +383 -0
- package/dist/extensions/copy-turn.ts +146 -0
- package/dist/extensions/cost-reconcile.test.ts +272 -0
- package/dist/extensions/cost-reconcile.ts +264 -0
- package/dist/extensions/grep-app/index.test.ts +406 -0
- package/dist/extensions/grep-app/index.ts +216 -0
- package/dist/extensions/handoff-new.test.ts +434 -0
- package/dist/extensions/handoff-new.ts +129 -0
- package/dist/extensions/herdr-agent-state.ts +310 -0
- package/dist/extensions/inline-skills.test.ts +204 -0
- package/dist/extensions/inline-skills.ts +102 -0
- package/dist/extensions/package.json +32 -0
- package/dist/extensions/pi-hermes-memory/CHANGELOG.md +371 -0
- package/dist/extensions/pi-hermes-memory/LICENSE +21 -0
- package/dist/extensions/pi-hermes-memory/README.md +643 -0
- package/dist/extensions/pi-hermes-memory/docs/0.1/TASKS.md +197 -0
- package/dist/extensions/pi-hermes-memory/docs/0.2/PLAN.md +290 -0
- package/dist/extensions/pi-hermes-memory/docs/0.2/TASKS.md +134 -0
- package/dist/extensions/pi-hermes-memory/docs/0.2/TEST-PLAN.md +216 -0
- package/dist/extensions/pi-hermes-memory/docs/0.3/PLAN.md +330 -0
- package/dist/extensions/pi-hermes-memory/docs/0.3/TASKS.md +125 -0
- package/dist/extensions/pi-hermes-memory/docs/0.4/PLAN.md +160 -0
- package/dist/extensions/pi-hermes-memory/docs/0.4/TASKS.md +113 -0
- package/dist/extensions/pi-hermes-memory/docs/0.6/CHANGELOG.md +57 -0
- package/dist/extensions/pi-hermes-memory/docs/0.6/PLAN.md +202 -0
- package/dist/extensions/pi-hermes-memory/docs/0.6/TASKS.md +144 -0
- package/dist/extensions/pi-hermes-memory/docs/0.7/PLAN.md +349 -0
- package/dist/extensions/pi-hermes-memory/docs/0.7/TASKS.md +110 -0
- package/dist/extensions/pi-hermes-memory/docs/PUBLISHING.md +149 -0
- package/dist/extensions/pi-hermes-memory/docs/ROADMAP.md +468 -0
- package/dist/extensions/pi-hermes-memory/docs/images/memory-architecture.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/images/pi-logo.svg +22 -0
- package/dist/extensions/pi-hermes-memory/docs/images/pi_memory.png +0 -0
- package/dist/extensions/pi-hermes-memory/docs/images/pi_memory.svg +19 -0
- package/dist/extensions/pi-hermes-memory/docs/images/security-flow.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/images/session-lifecycle.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/images/source-architecture.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/memory-architecture.mmd +49 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/security-flow.mmd +40 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/session-lifecycle.mmd +56 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/source-architecture.mmd +54 -0
- package/dist/extensions/pi-hermes-memory/package-lock.json +3799 -0
- package/dist/extensions/pi-hermes-memory/package.json +66 -0
- package/dist/extensions/pi-hermes-memory/scripts/check-min-sdk.mjs +99 -0
- package/dist/extensions/pi-hermes-memory/scripts/ensure-dev.mjs +57 -0
- package/dist/extensions/pi-hermes-memory/src/auto-consolidation-warning.ts +6 -0
- package/dist/extensions/pi-hermes-memory/src/config.ts +178 -0
- package/dist/extensions/pi-hermes-memory/src/constants.ts +424 -0
- package/dist/extensions/pi-hermes-memory/src/extension-root-migration.ts +639 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/auto-consolidate.ts +401 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/background-review.ts +297 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/child-process-watchdog.mjs +90 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/correction-detector.ts +300 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/index-sessions.ts +86 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/insights.ts +78 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/interview.ts +37 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/learn-memory.ts +186 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/message-parts.ts +27 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/pi-child-process.ts +485 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/preview-context.ts +105 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/review-memory-ops.ts +506 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/session-backfill.ts +145 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/session-flush.ts +151 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/session-live-index.ts +94 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/skills-command.ts +1334 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/standing-pin.ts +111 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/switch-project.ts +75 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/sync-markdown-memories.ts +266 -0
- package/dist/extensions/pi-hermes-memory/src/index.ts +384 -0
- package/dist/extensions/pi-hermes-memory/src/lifecycle-timing.ts +54 -0
- package/dist/extensions/pi-hermes-memory/src/paths.ts +61 -0
- package/dist/extensions/pi-hermes-memory/src/project-context.ts +13 -0
- package/dist/extensions/pi-hermes-memory/src/project-memory-migration.ts +93 -0
- package/dist/extensions/pi-hermes-memory/src/project.ts +157 -0
- package/dist/extensions/pi-hermes-memory/src/prompt-context.ts +55 -0
- package/dist/extensions/pi-hermes-memory/src/store/atomic-lock-coordinator.ts +375 -0
- package/dist/extensions/pi-hermes-memory/src/store/canonical-storage-path.ts +54 -0
- package/dist/extensions/pi-hermes-memory/src/store/content-scanner.ts +101 -0
- package/dist/extensions/pi-hermes-memory/src/store/db.ts +1180 -0
- package/dist/extensions/pi-hermes-memory/src/store/fts-query.ts +101 -0
- package/dist/extensions/pi-hermes-memory/src/store/markdown-mutation-lock.ts +38 -0
- package/dist/extensions/pi-hermes-memory/src/store/memory-lookup.ts +24 -0
- package/dist/extensions/pi-hermes-memory/src/store/memory-store.ts +1191 -0
- package/dist/extensions/pi-hermes-memory/src/store/recovery-maintenance.ts +66 -0
- package/dist/extensions/pi-hermes-memory/src/store/schema.ts +118 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-anchor-search.ts +472 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-indexer.ts +511 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-parser.ts +213 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-search.ts +234 -0
- package/dist/extensions/pi-hermes-memory/src/store/skill-store.ts +950 -0
- package/dist/extensions/pi-hermes-memory/src/store/skill-utils.ts +133 -0
- package/dist/extensions/pi-hermes-memory/src/store/sqlite-memory-store.ts +1002 -0
- package/dist/extensions/pi-hermes-memory/src/store/sqlite-native.ts +241 -0
- package/dist/extensions/pi-hermes-memory/src/store/standing-instructions.ts +247 -0
- package/dist/extensions/pi-hermes-memory/src/tools/memory-search-tool.ts +95 -0
- package/dist/extensions/pi-hermes-memory/src/tools/memory-tool.ts +469 -0
- package/dist/extensions/pi-hermes-memory/src/tools/session-search-tool.ts +246 -0
- package/dist/extensions/pi-hermes-memory/src/tools/shared-output-view.ts +170 -0
- package/dist/extensions/pi-hermes-memory/src/tools/skill-tool.ts +333 -0
- package/dist/extensions/pi-hermes-memory/src/tools/tool-result-views.ts +105 -0
- package/dist/extensions/pi-hermes-memory/src/types.ts +214 -0
- package/dist/extensions/pi-hermes-memory/tests/config.test.ts +434 -0
- package/dist/extensions/pi-hermes-memory/tests/extension-root-migration.test.ts +368 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/auto-consolidate.test.ts +984 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/background-review.test.ts +950 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/correction-detector.test.ts +671 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/insights.test.ts +157 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/interview.test.ts +127 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/pi-child-process.test.ts +905 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/preview-context.test.ts +152 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/prompt-context.test.ts +166 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/resources-discover.test.ts +71 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/review-memory-ops.test.ts +614 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-backfill.test.ts +192 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-flush.test.ts +677 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-live-index.test.ts +225 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/skills-command.test.ts +827 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/standing-pin.test.ts +134 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/sync-markdown-memories.test.ts +491 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/system-prompt.test.ts +199 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/thinking-max.test.ts +64 -0
- package/dist/extensions/pi-hermes-memory/tests/index.test.ts +30 -0
- package/dist/extensions/pi-hermes-memory/tests/integration/flow.test.ts +126 -0
- package/dist/extensions/pi-hermes-memory/tests/lifecycle-timing.test.ts +76 -0
- package/dist/extensions/pi-hermes-memory/tests/paths.test.ts +23 -0
- package/dist/extensions/pi-hermes-memory/tests/project-memory-migration.test.ts +80 -0
- package/dist/extensions/pi-hermes-memory/tests/project-rebinding.test.ts +115 -0
- package/dist/extensions/pi-hermes-memory/tests/project.test.ts +120 -0
- package/dist/extensions/pi-hermes-memory/tests/run-all-timeout.test.ts +107 -0
- package/dist/extensions/pi-hermes-memory/tests/run-all.sh +45 -0
- package/dist/extensions/pi-hermes-memory/tests/store/atomic-lock-coordinator.test.ts +381 -0
- package/dist/extensions/pi-hermes-memory/tests/store/content-scanner.test.ts +388 -0
- package/dist/extensions/pi-hermes-memory/tests/store/db.test.ts +1046 -0
- package/dist/extensions/pi-hermes-memory/tests/store/markdown-mutation-lock.test.ts +34 -0
- package/dist/extensions/pi-hermes-memory/tests/store/memory-store.test.ts +2150 -0
- package/dist/extensions/pi-hermes-memory/tests/store/recovery-maintenance.test.ts +170 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-anchor-search.test.ts +210 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-indexer.test.ts +643 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-parser.test.ts +282 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-search.test.ts +287 -0
- package/dist/extensions/pi-hermes-memory/tests/store/skill-store.test.ts +678 -0
- package/dist/extensions/pi-hermes-memory/tests/store/skill-utils.test.ts +21 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-lazy-load.test.ts +78 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-memory-store.test.ts +543 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-native.test.ts +164 -0
- package/dist/extensions/pi-hermes-memory/tests/store/standing-instructions.test.ts +171 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/memory-search-tool.test.ts +84 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/memory-tool.test.ts +709 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/session-search-tool.test.ts +345 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/shared-output-view.test.ts +362 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/skill-tool.test.ts +478 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/tool-result-renderer-wiring.test.ts +40 -0
- package/dist/extensions/pi-hermes-memory/tsconfig.json +19 -0
- package/dist/extensions/pi-intercom/CHANGELOG.md +321 -0
- package/dist/extensions/pi-intercom/LICENSE +21 -0
- package/dist/extensions/pi-intercom/README.md +598 -0
- package/dist/extensions/pi-intercom/banner.png +0 -0
- package/dist/extensions/pi-intercom/broker/broker.ts +1721 -0
- package/dist/extensions/pi-intercom/broker/client-liveness.test.ts +173 -0
- package/dist/extensions/pi-intercom/broker/client.test.ts +83 -0
- package/dist/extensions/pi-intercom/broker/client.ts +793 -0
- package/dist/extensions/pi-intercom/broker/extension-state.ts +197 -0
- package/dist/extensions/pi-intercom/broker/extension.test.ts +486 -0
- package/dist/extensions/pi-intercom/broker/framing.test.ts +114 -0
- package/dist/extensions/pi-intercom/broker/framing.ts +115 -0
- package/dist/extensions/pi-intercom/broker/paths.test.ts +153 -0
- package/dist/extensions/pi-intercom/broker/paths.ts +134 -0
- package/dist/extensions/pi-intercom/broker/protocol.ts +208 -0
- package/dist/extensions/pi-intercom/broker/runtime-claim.test.ts +34 -0
- package/dist/extensions/pi-intercom/broker/runtime-claim.ts +21 -0
- package/dist/extensions/pi-intercom/broker/spawn.test.ts +252 -0
- package/dist/extensions/pi-intercom/broker/spawn.ts +420 -0
- package/dist/extensions/pi-intercom/config.test.ts +104 -0
- package/dist/extensions/pi-intercom/config.ts +163 -0
- package/dist/extensions/pi-intercom/cwd.test.ts +40 -0
- package/dist/extensions/pi-intercom/cwd.ts +31 -0
- package/dist/extensions/pi-intercom/extension-api.ts +84 -0
- package/dist/extensions/pi-intercom/format-context.test.ts +31 -0
- package/dist/extensions/pi-intercom/format-context.ts +32 -0
- package/dist/extensions/pi-intercom/index.ts +2821 -0
- package/dist/extensions/pi-intercom/intercom.integration.test.ts +4232 -0
- package/dist/extensions/pi-intercom/package.json +49 -0
- package/dist/extensions/pi-intercom/project-agent.test.ts +145 -0
- package/dist/extensions/pi-intercom/project-agent.ts +324 -0
- package/dist/extensions/pi-intercom/reply-tracker.test.ts +239 -0
- package/dist/extensions/pi-intercom/reply-tracker.ts +160 -0
- package/dist/extensions/pi-intercom/skills/pi-intercom/SKILL.md +452 -0
- package/dist/extensions/pi-intercom/test/inline-message.test.ts +184 -0
- package/dist/extensions/pi-intercom/test/overlay-width.test.ts +66 -0
- package/dist/extensions/pi-intercom/types.ts +165 -0
- package/dist/extensions/pi-intercom/ui/compose.ts +143 -0
- package/dist/extensions/pi-intercom/ui/inline-message.ts +118 -0
- package/dist/extensions/pi-intercom/ui/session-list.ts +166 -0
- package/dist/extensions/pi-rewind-hook/README.md +248 -0
- package/dist/extensions/pi-rewind-hook/index.ts +1575 -0
- package/dist/extensions/pi-rewind-hook/package.json +31 -0
- package/dist/extensions/pi-subagents/.github/assets/subagent-fleet-inspector.png +0 -0
- package/dist/extensions/pi-subagents/.github/workflows/release.yml +28 -0
- package/dist/extensions/pi-subagents/.github/workflows/test.yml +51 -0
- package/dist/extensions/pi-subagents/.greptile/config.json +33 -0
- package/dist/extensions/pi-subagents/.greptile/files.json +8 -0
- package/dist/extensions/pi-subagents/.greptile/rules.md +16 -0
- package/dist/extensions/pi-subagents/.oxlintrc.json +43 -0
- package/dist/extensions/pi-subagents/AGENTS.md +5 -0
- package/dist/extensions/pi-subagents/CHANGELOG.md +2325 -0
- package/dist/extensions/pi-subagents/LICENSE +21 -0
- package/dist/extensions/pi-subagents/README.md +126 -0
- package/dist/extensions/pi-subagents/VISION.md +92 -0
- package/dist/extensions/pi-subagents/agents/delegate.md +14 -0
- package/dist/extensions/pi-subagents/agents/oracle.md +78 -0
- package/dist/extensions/pi-subagents/agents/researcher.md +52 -0
- package/dist/extensions/pi-subagents/agents/reviewer.md +89 -0
- package/dist/extensions/pi-subagents/agents/scout.md +50 -0
- package/dist/extensions/pi-subagents/agents/worker.md +60 -0
- package/dist/extensions/pi-subagents/async-retention-discovery-worker.mjs +180 -0
- package/dist/extensions/pi-subagents/docs/agents.md +382 -0
- package/dist/extensions/pi-subagents/docs/configuration.md +534 -0
- package/dist/extensions/pi-subagents/docs/extension-api.md +443 -0
- package/dist/extensions/pi-subagents/docs/missions.md +121 -0
- package/dist/extensions/pi-subagents/docs/models.md +258 -0
- package/dist/extensions/pi-subagents/docs/observability.md +265 -0
- package/dist/extensions/pi-subagents/docs/tool-reference.md +482 -0
- package/dist/extensions/pi-subagents/docs/watchdog.md +154 -0
- package/dist/extensions/pi-subagents/docs/workflows.md +475 -0
- package/dist/extensions/pi-subagents/index.ts +10 -0
- package/dist/extensions/pi-subagents/inspector-runner.mjs +11 -0
- package/dist/extensions/pi-subagents/install.mjs +93 -0
- package/dist/extensions/pi-subagents/package-lock.json +1872 -0
- package/dist/extensions/pi-subagents/package.json +109 -0
- package/dist/extensions/pi-subagents/prompts/council.md +60 -0
- package/dist/extensions/pi-subagents/prompts/gather-context-and-clarify.md +13 -0
- package/dist/extensions/pi-subagents/prompts/parallel-cleanup.md +59 -0
- package/dist/extensions/pi-subagents/prompts/parallel-research.md +50 -0
- package/dist/extensions/pi-subagents/prompts/parallel-review.md +58 -0
- package/dist/extensions/pi-subagents/prompts/review-loop.md +47 -0
- package/dist/extensions/pi-subagents/skills/council-mode/SKILL.md +59 -0
- package/dist/extensions/pi-subagents/skills/council-mode/references/pass-contracts.md +150 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +103 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +70 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +539 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +161 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/multi-lane-orchestration.md +51 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +295 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/review-and-validation.md +73 -0
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +1373 -0
- package/dist/extensions/pi-subagents/src/agents/agent-memory.ts +254 -0
- package/dist/extensions/pi-subagents/src/agents/agent-refinements.ts +624 -0
- package/dist/extensions/pi-subagents/src/agents/agent-scope.ts +6 -0
- package/dist/extensions/pi-subagents/src/agents/agent-selection.ts +25 -0
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +179 -0
- package/dist/extensions/pi-subagents/src/agents/agents.ts +2790 -0
- package/dist/extensions/pi-subagents/src/agents/builtin-names.ts +9 -0
- package/dist/extensions/pi-subagents/src/agents/chain-serializer.ts +280 -0
- package/dist/extensions/pi-subagents/src/agents/frontmatter.ts +153 -0
- package/dist/extensions/pi-subagents/src/agents/identity.ts +30 -0
- package/dist/extensions/pi-subagents/src/agents/proactive-skills.ts +194 -0
- package/dist/extensions/pi-subagents/src/agents/runtime-agent-events.ts +70 -0
- package/dist/extensions/pi-subagents/src/agents/runtime-agent-registry.ts +429 -0
- package/dist/extensions/pi-subagents/src/agents/skills.ts +754 -0
- package/dist/extensions/pi-subagents/src/api/agents.ts +12 -0
- package/dist/extensions/pi-subagents/src/api/background-work.ts +206 -0
- package/dist/extensions/pi-subagents/src/api/capability-ceiling.ts +17 -0
- package/dist/extensions/pi-subagents/src/api/control-channel.ts +4 -0
- package/dist/extensions/pi-subagents/src/api/delegation.ts +112 -0
- package/dist/extensions/pi-subagents/src/api/external-job-provider.ts +195 -0
- package/dist/extensions/pi-subagents/src/api/external-runs.ts +282 -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 +501 -0
- package/dist/extensions/pi-subagents/src/api/project-panes.ts +32 -0
- package/dist/extensions/pi-subagents/src/api/shared-types.ts +27 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +255 -0
- package/dist/extensions/pi-subagents/src/extension/control-notices.ts +58 -0
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +278 -0
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +205 -0
- package/dist/extensions/pi-subagents/src/extension/index.ts +1093 -0
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +210 -0
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +860 -0
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +419 -0
- package/dist/extensions/pi-subagents/src/extension/steering-notices.ts +35 -0
- package/dist/extensions/pi-subagents/src/extension/subagent-guide.ts +39 -0
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +204 -0
- package/dist/extensions/pi-subagents/src/extension/tool-result.ts +19 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +235 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/client.ts +130 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/focus.ts +55 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +153 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +730 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/session-roots-codec.ts +42 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/shell-command.ts +16 -0
- package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +396 -0
- package/dist/extensions/pi-subagents/src/intercom/intercom-bridge.ts +191 -0
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +812 -0
- package/dist/extensions/pi-subagents/src/intercom/result-intercom.ts +423 -0
- package/dist/extensions/pi-subagents/src/missions/actions.ts +433 -0
- package/dist/extensions/pi-subagents/src/missions/goal-driver.ts +164 -0
- package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +367 -0
- package/dist/extensions/pi-subagents/src/missions/store.ts +584 -0
- package/dist/extensions/pi-subagents/src/missions/types.ts +190 -0
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +260 -0
- package/dist/extensions/pi-subagents/src/policy/authority.ts +46 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +662 -0
- package/dist/extensions/pi-subagents/src/runs/background/active-async-capacity.ts +516 -0
- package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +139 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +2080 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +781 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +631 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-retention.ts +903 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-status-snapshot.ts +48 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +761 -0
- package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +68 -0
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +321 -0
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +270 -0
- package/dist/extensions/pi-subagents/src/runs/background/completion-batcher.ts +168 -0
- package/dist/extensions/pi-subagents/src/runs/background/completion-dedupe.ts +58 -0
- package/dist/extensions/pi-subagents/src/runs/background/completion-replay.ts +287 -0
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +768 -0
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +620 -0
- package/dist/extensions/pi-subagents/src/runs/background/index-segment.ts +59 -0
- package/dist/extensions/pi-subagents/src/runs/background/inspect-rpc.ts +443 -0
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +645 -0
- package/dist/extensions/pi-subagents/src/runs/background/owned-process-tree.ts +104 -0
- package/dist/extensions/pi-subagents/src/runs/background/parallel-groups.ts +45 -0
- package/dist/extensions/pi-subagents/src/runs/background/process-terminal.ts +310 -0
- package/dist/extensions/pi-subagents/src/runs/background/result-delivery-ownership.ts +45 -0
- package/dist/extensions/pi-subagents/src/runs/background/result-files.ts +519 -0
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +792 -0
- package/dist/extensions/pi-subagents/src/runs/background/resume-guidance.ts +56 -0
- package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +135 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-id-query.ts +7 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +175 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +714 -0
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +965 -0
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +410 -0
- package/dist/extensions/pi-subagents/src/runs/background/steering.ts +242 -0
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +5683 -0
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +725 -0
- package/dist/extensions/pi-subagents/src/runs/background/terminal-run-index.ts +138 -0
- package/dist/extensions/pi-subagents/src/runs/background/top-level-async.ts +14 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +209 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-config.ts +50 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +348 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +51 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/async-dismiss-action.ts +86 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +262 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/async-stop-action.ts +86 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +2443 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-control.ts +153 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +160 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/prompt-audit.ts +172 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +6971 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-detach-reconcile.ts +299 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +188 -0
- package/dist/extensions/pi-subagents/src/runs/shared/abort-recovery.ts +119 -0
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +1525 -0
- package/dist/extensions/pi-subagents/src/runs/shared/agent-contract.ts +38 -0
- package/dist/extensions/pi-subagents/src/runs/shared/async-status-projection.ts +565 -0
- package/dist/extensions/pi-subagents/src/runs/shared/background-process-options.ts +9 -0
- package/dist/extensions/pi-subagents/src/runs/shared/capability-ceiling.ts +210 -0
- package/dist/extensions/pi-subagents/src/runs/shared/chain-outputs.ts +116 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-identity.ts +51 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-launch-plan.ts +151 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-protocol.ts +415 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-evidence.ts +89 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +252 -0
- package/dist/extensions/pi-subagents/src/runs/shared/context-mode.ts +44 -0
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +297 -0
- package/dist/extensions/pi-subagents/src/runs/shared/extension-bindings.ts +78 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-contract.ts +138 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-preflight.ts +122 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +429 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-job-bridge.ts +460 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-job-runner.ts +389 -0
- package/dist/extensions/pi-subagents/src/runs/shared/fast-mode-extension.ts +10 -0
- package/dist/extensions/pi-subagents/src/runs/shared/host-step-status.ts +231 -0
- package/dist/extensions/pi-subagents/src/runs/shared/lane-metadata.ts +126 -0
- package/dist/extensions/pi-subagents/src/runs/shared/launch-cwd.ts +16 -0
- package/dist/extensions/pi-subagents/src/runs/shared/llm-intent-arbiter.ts +302 -0
- package/dist/extensions/pi-subagents/src/runs/shared/long-running-guard.ts +221 -0
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-config-sources.ts +422 -0
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +483 -0
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-grant.ts +194 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-exclusions.ts +305 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +578 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-scope.ts +205 -0
- package/dist/extensions/pi-subagents/src/runs/shared/mutation-evidence.ts +199 -0
- package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +1086 -0
- package/dist/extensions/pi-subagents/src/runs/shared/nested-path.ts +52 -0
- package/dist/extensions/pi-subagents/src/runs/shared/nested-render.ts +127 -0
- package/dist/extensions/pi-subagents/src/runs/shared/orca-progress-tabs.ts +499 -0
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +696 -0
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +275 -0
- package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +100 -0
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +1059 -0
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +199 -0
- package/dist/extensions/pi-subagents/src/runs/shared/process-signal.ts +32 -0
- package/dist/extensions/pi-subagents/src/runs/shared/run-fanout-budget.ts +280 -0
- package/dist/extensions/pi-subagents/src/runs/shared/run-history.ts +201 -0
- package/dist/extensions/pi-subagents/src/runs/shared/runtime-acknowledged-extensions.ts +71 -0
- package/dist/extensions/pi-subagents/src/runs/shared/session-lease.ts +293 -0
- package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +304 -0
- package/dist/extensions/pi-subagents/src/runs/shared/spawn-budget.ts +128 -0
- package/dist/extensions/pi-subagents/src/runs/shared/structured-output.ts +223 -0
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-control.ts +292 -0
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +825 -0
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-startup-retry.ts +116 -0
- package/dist/extensions/pi-subagents/src/runs/shared/task-intent.ts +211 -0
- package/dist/extensions/pi-subagents/src/runs/shared/tool-availability.ts +81 -0
- package/dist/extensions/pi-subagents/src/runs/shared/tool-budget.ts +80 -0
- package/dist/extensions/pi-subagents/src/runs/shared/tool-timeout.ts +93 -0
- package/dist/extensions/pi-subagents/src/runs/shared/usage-budget.ts +65 -0
- package/dist/extensions/pi-subagents/src/runs/shared/workflow-graph.ts +225 -0
- package/dist/extensions/pi-subagents/src/runs/shared/worktree-cleanup-plan.ts +847 -0
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +1206 -0
- package/dist/extensions/pi-subagents/src/shared/accessible-dir.ts +47 -0
- package/dist/extensions/pi-subagents/src/shared/agent-stream-options.ts +5 -0
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +281 -0
- package/dist/extensions/pi-subagents/src/shared/atomic-json.ts +83 -0
- package/dist/extensions/pi-subagents/src/shared/capacity-resilient-json.ts +102 -0
- package/dist/extensions/pi-subagents/src/shared/child-session-name.ts +46 -0
- package/dist/extensions/pi-subagents/src/shared/child-transcript.ts +264 -0
- package/dist/extensions/pi-subagents/src/shared/completion-owner.ts +14 -0
- package/dist/extensions/pi-subagents/src/shared/display-text.ts +150 -0
- package/dist/extensions/pi-subagents/src/shared/extension-context.ts +24 -0
- package/dist/extensions/pi-subagents/src/shared/file-coalescer.ts +49 -0
- package/dist/extensions/pi-subagents/src/shared/file-system-retry.ts +95 -0
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +293 -0
- package/dist/extensions/pi-subagents/src/shared/fork-session-cwd.ts +27 -0
- package/dist/extensions/pi-subagents/src/shared/formatters.ts +146 -0
- package/dist/extensions/pi-subagents/src/shared/jsonl-writer.ts +81 -0
- package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +138 -0
- package/dist/extensions/pi-subagents/src/shared/model-info.ts +101 -0
- package/dist/extensions/pi-subagents/src/shared/node-executable.ts +21 -0
- package/dist/extensions/pi-subagents/src/shared/post-exit-stdio-guard.ts +85 -0
- package/dist/extensions/pi-subagents/src/shared/prompt-resources.ts +11 -0
- package/dist/extensions/pi-subagents/src/shared/pruned-fork.ts +450 -0
- package/dist/extensions/pi-subagents/src/shared/session-file-trust.ts +19 -0
- package/dist/extensions/pi-subagents/src/shared/session-identity.ts +10 -0
- package/dist/extensions/pi-subagents/src/shared/session-tokens.ts +55 -0
- package/dist/extensions/pi-subagents/src/shared/settings.ts +409 -0
- package/dist/extensions/pi-subagents/src/shared/shortcuts.ts +17 -0
- package/dist/extensions/pi-subagents/src/shared/status-format.ts +55 -0
- package/dist/extensions/pi-subagents/src/shared/thinking-ceiling.ts +52 -0
- package/dist/extensions/pi-subagents/src/shared/types.ts +2872 -0
- package/dist/extensions/pi-subagents/src/shared/utf8.ts +11 -0
- package/dist/extensions/pi-subagents/src/shared/utils.ts +601 -0
- package/dist/extensions/pi-subagents/src/shared/watch-strategy.ts +10 -0
- package/dist/extensions/pi-subagents/src/shared/workflow-child-permit.ts +207 -0
- package/dist/extensions/pi-subagents/src/slash/delegation-adapters.ts +426 -0
- package/dist/extensions/pi-subagents/src/slash/delegation-json.ts +108 -0
- package/dist/extensions/pi-subagents/src/slash/delegation-request.ts +162 -0
- package/dist/extensions/pi-subagents/src/slash/prompt-template-bridge.ts +419 -0
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +287 -0
- package/dist/extensions/pi-subagents/src/slash/selector.ts +147 -0
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +192 -0
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +1345 -0
- package/dist/extensions/pi-subagents/src/slash/slash-live-state.ts +310 -0
- package/dist/extensions/pi-subagents/src/slash/subagents-admin.ts +449 -0
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +964 -0
- package/dist/extensions/pi-subagents/src/tui/fleet-transcript.ts +536 -0
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +1441 -0
- package/dist/extensions/pi-subagents/src/tui/render-helpers.ts +111 -0
- package/dist/extensions/pi-subagents/src/tui/render.ts +3359 -0
- package/dist/extensions/pi-subagents/src/types/pi-runtime-compat.d.ts +8 -0
- package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +260 -0
- package/dist/extensions/pi-subagents/src/watchdog/child-status.ts +227 -0
- package/dist/extensions/pi-subagents/src/watchdog/diff-tool.ts +77 -0
- package/dist/extensions/pi-subagents/src/watchdog/emission-guard.ts +125 -0
- package/dist/extensions/pi-subagents/src/watchdog/guidance.ts +20 -0
- package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +538 -0
- package/dist/extensions/pi-subagents/src/watchdog/model-selection.ts +167 -0
- package/dist/extensions/pi-subagents/src/watchdog/permission-arbiter.ts +154 -0
- package/dist/extensions/pi-subagents/src/watchdog/register-child.ts +120 -0
- package/dist/extensions/pi-subagents/src/watchdog/register-main.ts +441 -0
- package/dist/extensions/pi-subagents/src/watchdog/render.ts +53 -0
- package/dist/extensions/pi-subagents/src/watchdog/review.ts +314 -0
- package/dist/extensions/pi-subagents/src/watchdog/rules.ts +70 -0
- package/dist/extensions/pi-subagents/src/watchdog/runtime.ts +851 -0
- package/dist/extensions/pi-subagents/src/watchdog/scope.ts +63 -0
- package/dist/extensions/pi-subagents/src/watchdog/settings.ts +512 -0
- package/dist/extensions/pi-subagents/src/watchdog/tool-actions.ts +155 -0
- package/dist/extensions/pi-subagents/src/watchdog/turn-delta.ts +161 -0
- package/dist/extensions/pi-subagents/src/watchdog/types.ts +184 -0
- package/dist/extensions/pi-subagents/src/watchdog/warning-format.ts +72 -0
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +152 -0
- package/dist/extensions/pi-subagents/src/workflows/host-command.ts +235 -0
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +2183 -0
- package/dist/extensions/pi-subagents/src/workflows/workflow-checklist.ts +439 -0
- package/dist/extensions/pi-subagents/src/workflows/workflow-child-summary.ts +121 -0
- package/dist/extensions/pi-subagents/src/workflows/workflow-preflight.ts +297 -0
- package/dist/extensions/pi-subagents/src/workflows/workflow-receipt.ts +330 -0
- package/dist/extensions/pi-subagents/src/workflows/workflow-resources.ts +150 -0
- package/dist/extensions/pi-subagents/src/workflows/workflow-settlement.ts +246 -0
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +224 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/cli.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/args.d.ts +57 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/config-selector.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/file-processor.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/initial-message.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/list-models.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/project-trust.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/session-picker.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/startup-ui.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/config.d.ts +96 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-runtime.d.ts +119 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-services.d.ts +85 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session.d.ts +620 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-guidance.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-storage.d.ts +56 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/bash-executor.d.ts +32 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/cache-stats.d.ts +49 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/branch-summarization.d.ts +93 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/compaction.d.ts +128 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/index.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/utils.d.ts +38 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/defaults.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/diagnostics.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/event-bus.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/exec.d.ts +29 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/experimental.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/index.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/index.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/loader.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/runner.d.ts +171 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/types.d.ts +1261 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/footer-data-provider.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/index.d.ts +13 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/keybindings.d.ts +358 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/messages.d.ts +77 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-config.d.ts +512 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-registry.d.ts +43 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-resolver.d.ts +121 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-runtime.d.ts +82 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/models-store.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/output-guard.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/package-manager.d.ts +210 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/project-trust.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/prompt-templates.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-attribution.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-composer.d.ts +55 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/radius.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resource-loader.d.ts +206 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/sdk.d.ts +106 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-cwd.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-manager.d.ts +356 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/settings-manager.d.ts +297 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/skills.d.ts +60 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/slash-commands.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/source-info.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/system-prompt.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/telemetry.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/timings.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/bash.d.ts +68 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit-diff.d.ts +106 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit.d.ts +51 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/find.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/grep.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/index.d.ts +40 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/ls.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/read.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/render-utils.d.ts +24 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/truncate.d.ts +70 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/write.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/trust-manager.d.ts +36 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/usage-totals.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/client.d.ts +61 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/provider.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/index.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/main.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/migrations.d.ts +33 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/index.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/assistant-message.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/config-selector.d.ts +102 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-entry.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-editor.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/footer.d.ts +32 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/index.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/login-dialog.d.ts +52 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/model-selector.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/settings-selector.d.ts +77 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/status-indicator.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tool-execution.d.ts +63 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tree-selector.d.ts +94 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/interactive-mode.d.ts +394 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme.d.ts +120 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/print-mode.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-client.d.ts +246 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-types.d.ts +457 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/package-manager-cli.d.ts +8 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/rpc-entry.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/ansi.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/changelog.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/child-process.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/deprecation.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/frontmatter.d.ts +8 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/fs-watch.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/git.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/html.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-convert.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-process.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/json.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/mime.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/open-browser.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/paths.d.ts +31 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/photon.d.ts +21 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/shell.d.ts +31 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/sleep.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/tools-manager.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/version-check.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/index.mjs +84 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/package.json +14 -0
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +472 -0
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +6986 -0
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +2000 -0
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +1300 -0
- package/dist/extensions/pi-subagents/test/integration/detect-error.test.ts +249 -0
- package/dist/extensions/pi-subagents/test/integration/doctor-executor.test.ts +128 -0
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +281 -0
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +167 -0
- package/dist/extensions/pi-subagents/test/integration/foreground-result-size.test.ts +188 -0
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +1356 -0
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +1946 -0
- package/dist/extensions/pi-subagents/test/integration/orca-progress-tabs.test.ts +214 -0
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +1408 -0
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +2094 -0
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +2442 -0
- package/dist/extensions/pi-subagents/test/integration/session-tokens.test.ts +62 -0
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +9292 -0
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +1517 -0
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +166 -0
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +344 -0
- package/dist/extensions/pi-subagents/test/integration/top-level-async.test.ts +43 -0
- package/dist/extensions/pi-subagents/test/support/cursor-smoke-inputs.ts +51 -0
- package/dist/extensions/pi-subagents/test/support/helpers.ts +250 -0
- package/dist/extensions/pi-subagents/test/support/isolated-temp-root.mjs +20 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +447 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +159 -0
- package/dist/extensions/pi-subagents/test/support/node-command.ts +15 -0
- package/dist/extensions/pi-subagents/test/support/real-session-child-cli.mjs +185 -0
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +311 -0
- package/dist/extensions/pi-subagents/test/support/register-loader.mjs +16 -0
- package/dist/extensions/pi-subagents/test/support/session-lease-child.mjs +42 -0
- package/dist/extensions/pi-subagents/test/support/ts-loader.mjs +100 -0
- package/dist/extensions/pi-subagents/test/unit/abort-recovery.test.ts +152 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +1556 -0
- package/dist/extensions/pi-subagents/test/unit/accessible-dir.test.ts +82 -0
- package/dist/extensions/pi-subagents/test/unit/active-async-capacity.test.ts +463 -0
- package/dist/extensions/pi-subagents/test/unit/agent-contract.test.ts +14 -0
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +213 -0
- package/dist/extensions/pi-subagents/test/unit/agent-discovery-cache.test.ts +232 -0
- package/dist/extensions/pi-subagents/test/unit/agent-eject-disable.test.ts +343 -0
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +2324 -0
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +1408 -0
- package/dist/extensions/pi-subagents/test/unit/agent-memory.test.ts +420 -0
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +1174 -0
- package/dist/extensions/pi-subagents/test/unit/agent-refinements.test.ts +178 -0
- package/dist/extensions/pi-subagents/test/unit/agent-scan-dirs.test.ts +133 -0
- package/dist/extensions/pi-subagents/test/unit/agent-scope.test.ts +20 -0
- package/dist/extensions/pi-subagents/test/unit/agent-selection.test.ts +88 -0
- package/dist/extensions/pi-subagents/test/unit/agent-stream-options.test.ts +14 -0
- package/dist/extensions/pi-subagents/test/unit/anti-slop-oxlint.test.ts +98 -0
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +78 -0
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +280 -0
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +1022 -0
- package/dist/extensions/pi-subagents/test/unit/async-permission-session.test.ts +100 -0
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +188 -0
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +978 -0
- package/dist/extensions/pi-subagents/test/unit/async-retention.test.ts +635 -0
- package/dist/extensions/pi-subagents/test/unit/async-status-projection.test.ts +260 -0
- package/dist/extensions/pi-subagents/test/unit/async-status-snapshot.test.ts +204 -0
- package/dist/extensions/pi-subagents/test/unit/atomic-json.test.ts +192 -0
- package/dist/extensions/pi-subagents/test/unit/authority-policy.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/auto-drain.test.ts +83 -0
- package/dist/extensions/pi-subagents/test/unit/background-process-options.test.ts +17 -0
- package/dist/extensions/pi-subagents/test/unit/background-work.test.ts +365 -0
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling-agent-allowlist.test.ts +102 -0
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling-pi-args.test.ts +84 -0
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling.test.ts +68 -0
- package/dist/extensions/pi-subagents/test/unit/capacity-resilient-json.test.ts +155 -0
- package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +283 -0
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +236 -0
- package/dist/extensions/pi-subagents/test/unit/chain-serializer.test.ts +229 -0
- package/dist/extensions/pi-subagents/test/unit/child-launch-plan.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/unit/child-protocol.test.ts +202 -0
- package/dist/extensions/pi-subagents/test/unit/child-session-name.test.ts +50 -0
- package/dist/extensions/pi-subagents/test/unit/child-transcript.test.ts +267 -0
- package/dist/extensions/pi-subagents/test/unit/close-grace-timer.test.ts +101 -0
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +98 -0
- package/dist/extensions/pi-subagents/test/unit/completion-batcher.test.ts +230 -0
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +35 -0
- package/dist/extensions/pi-subagents/test/unit/completion-evidence.test.ts +150 -0
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +753 -0
- package/dist/extensions/pi-subagents/test/unit/completion-replay.test.ts +305 -0
- package/dist/extensions/pi-subagents/test/unit/config-dir-runtime.test.ts +107 -0
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +630 -0
- package/dist/extensions/pi-subagents/test/unit/control-notices.test.ts +110 -0
- package/dist/extensions/pi-subagents/test/unit/cursor-smoke-inputs.test.ts +77 -0
- package/dist/extensions/pi-subagents/test/unit/default-extensions.test.ts +219 -0
- package/dist/extensions/pi-subagents/test/unit/delegation-api.test.ts +588 -0
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +201 -0
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +219 -0
- package/dist/extensions/pi-subagents/test/unit/ensure-accessible-dir.test.ts +125 -0
- package/dist/extensions/pi-subagents/test/unit/extension-bindings.test.ts +79 -0
- package/dist/extensions/pi-subagents/test/unit/extension-context.test.ts +27 -0
- package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +339 -0
- package/dist/extensions/pi-subagents/test/unit/external-job-runner.test.ts +961 -0
- package/dist/extensions/pi-subagents/test/unit/external-runs.test.ts +261 -0
- package/dist/extensions/pi-subagents/test/unit/extra-agent-dirs.test.ts +88 -0
- package/dist/extensions/pi-subagents/test/unit/fast-mode-extension.test.ts +27 -0
- package/dist/extensions/pi-subagents/test/unit/file-coalescer.test.ts +83 -0
- package/dist/extensions/pi-subagents/test/unit/file-system-retry.test.ts +64 -0
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +1377 -0
- package/dist/extensions/pi-subagents/test/unit/fleet-transcript.test.ts +435 -0
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +1786 -0
- package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +125 -0
- package/dist/extensions/pi-subagents/test/unit/foreground-tool-call-compaction.test.ts +115 -0
- package/dist/extensions/pi-subagents/test/unit/fork-cache-key.test.ts +91 -0
- package/dist/extensions/pi-subagents/test/unit/fork-context.test.ts +588 -0
- package/dist/extensions/pi-subagents/test/unit/formatters.test.ts +14 -0
- package/dist/extensions/pi-subagents/test/unit/get-final-output.test.ts +175 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector-bootstrap.test.ts +101 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +479 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-session-roots-codec.test.ts +63 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-shell-command.test.ts +59 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +716 -0
- package/dist/extensions/pi-subagents/test/unit/host-command.test.ts +157 -0
- package/dist/extensions/pi-subagents/test/unit/host-peer-runtime-imports.test.ts +157 -0
- package/dist/extensions/pi-subagents/test/unit/host-step-status.test.ts +98 -0
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +1307 -0
- package/dist/extensions/pi-subagents/test/unit/index-segment.test.ts +96 -0
- package/dist/extensions/pi-subagents/test/unit/inspect-rpc.test.ts +617 -0
- package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +220 -0
- package/dist/extensions/pi-subagents/test/unit/jsonl-writer.test.ts +119 -0
- package/dist/extensions/pi-subagents/test/unit/llm-intent-arbiter.test.ts +226 -0
- package/dist/extensions/pi-subagents/test/unit/mcp-direct-tool-grant.test.ts +155 -0
- package/dist/extensions/pi-subagents/test/unit/mission-goal-driver.test.ts +180 -0
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +300 -0
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +470 -0
- package/dist/extensions/pi-subagents/test/unit/mock-pi.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/model-exclusions.test.ts +258 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +903 -0
- package/dist/extensions/pi-subagents/test/unit/model-info.test.ts +162 -0
- package/dist/extensions/pi-subagents/test/unit/model-scope-settings.test.ts +101 -0
- package/dist/extensions/pi-subagents/test/unit/model-scope.test.ts +198 -0
- package/dist/extensions/pi-subagents/test/unit/mutation-evidence.test.ts +177 -0
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +796 -0
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +655 -0
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +492 -0
- package/dist/extensions/pi-subagents/test/unit/node-executable.test.ts +26 -0
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +816 -0
- package/dist/extensions/pi-subagents/test/unit/orca-progress-tabs.test.ts +545 -0
- package/dist/extensions/pi-subagents/test/unit/owned-process-tree.test.ts +69 -0
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +241 -0
- package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +563 -0
- package/dist/extensions/pi-subagents/test/unit/parallel-utils.test.ts +269 -0
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +108 -0
- package/dist/extensions/pi-subagents/test/unit/path-resolution.test.ts +103 -0
- package/dist/extensions/pi-subagents/test/unit/permissions.test.ts +46 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args-permission-system.test.ts +437 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +2347 -0
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +461 -0
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +493 -0
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +978 -0
- package/dist/extensions/pi-subagents/test/unit/proactive-skills.test.ts +118 -0
- package/dist/extensions/pi-subagents/test/unit/process-terminal.test.ts +279 -0
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +373 -0
- package/dist/extensions/pi-subagents/test/unit/project-panes-public-api.test.ts +293 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-template-bridge.test.ts +244 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +167 -0
- package/dist/extensions/pi-subagents/test/unit/pruned-fork.test.ts +214 -0
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +182 -0
- package/dist/extensions/pi-subagents/test/unit/reads-resolution.test.ts +66 -0
- package/dist/extensions/pi-subagents/test/unit/recursion-guard.test.ts +265 -0
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +639 -0
- package/dist/extensions/pi-subagents/test/unit/result-delivery-ownership.test.ts +34 -0
- package/dist/extensions/pi-subagents/test/unit/result-files.test.ts +501 -0
- package/dist/extensions/pi-subagents/test/unit/result-intercom.test.ts +258 -0
- package/dist/extensions/pi-subagents/test/unit/retained-children.test.ts +191 -0
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +1124 -0
- package/dist/extensions/pi-subagents/test/unit/run-fanout-budget.test.ts +191 -0
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +247 -0
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +1545 -0
- package/dist/extensions/pi-subagents/test/unit/runtime-acknowledged-extensions.test.ts +52 -0
- package/dist/extensions/pi-subagents/test/unit/runtime-agent-registration.test.ts +349 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +904 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-store-root.test.ts +67 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +657 -0
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +2501 -0
- package/dist/extensions/pi-subagents/test/unit/selector.test.ts +57 -0
- package/dist/extensions/pi-subagents/test/unit/session-lease.test.ts +339 -0
- package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +361 -0
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +709 -0
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +115 -0
- package/dist/extensions/pi-subagents/test/unit/spawn-budget.test.ts +124 -0
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +440 -0
- package/dist/extensions/pi-subagents/test/unit/status-format.test.ts +26 -0
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +435 -0
- package/dist/extensions/pi-subagents/test/unit/steering-notices.test.ts +58 -0
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +217 -0
- package/dist/extensions/pi-subagents/test/unit/streamed-progress-bounds.test.ts +78 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-action-recovery.test.ts +85 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +342 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-guide.test.ts +37 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +1593 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-startup-retry.test.ts +104 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +1367 -0
- package/dist/extensions/pi-subagents/test/unit/task-intent.test.ts +153 -0
- package/dist/extensions/pi-subagents/test/unit/temp-paths.test.ts +147 -0
- package/dist/extensions/pi-subagents/test/unit/thinking-ceiling.test.ts +73 -0
- package/dist/extensions/pi-subagents/test/unit/timeout-defaults.test.ts +138 -0
- package/dist/extensions/pi-subagents/test/unit/tool-budget.test.ts +67 -0
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +308 -0
- package/dist/extensions/pi-subagents/test/unit/tool-timeout.test.ts +108 -0
- package/dist/extensions/pi-subagents/test/unit/total-cost.test.ts +61 -0
- package/dist/extensions/pi-subagents/test/unit/ts-loader.test.ts +33 -0
- package/dist/extensions/pi-subagents/test/unit/types-fork-preamble.test.ts +23 -0
- package/dist/extensions/pi-subagents/test/unit/wait-completions.test.ts +110 -0
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +663 -0
- package/dist/extensions/pi-subagents/test/unit/watch-strategy.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-change-signature.test.ts +434 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-child-status.test.ts +170 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-diff-tool.test.ts +79 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-emission-guard.test.ts +62 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-lsp-diagnostics.test.ts +144 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-model-selection.test.ts +121 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-permission-arbiter.test.ts +113 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-render.test.ts +75 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-review.test.ts +372 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-rules.test.ts +37 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-runtime.test.ts +990 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-scope.test.ts +33 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-settings.test.ts +345 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-tool-actions.test.ts +91 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-turn-delta.test.ts +130 -0
- package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +171 -0
- package/dist/extensions/pi-subagents/test/unit/windows-hide-spawn.test.ts +49 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +570 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-checklist.test.ts +223 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-detach-reconcile.test.ts +777 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-graph.test.ts +134 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +407 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-preflight.test.ts +177 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-receipt.test.ts +461 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-resources.test.ts +98 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-resume-hint.test.ts +365 -0
- package/dist/extensions/pi-subagents/test/unit/worktree-cleanup-plan.test.ts +349 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +827 -0
- package/dist/extensions/pi-subagents/test/unit/writer-budget-guidance.test.ts +25 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/effect/index.ts +13 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/effect/rules/no-service-constructor-imports.ts +52 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/index.ts +41 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-chained-type-assertions.ts +77 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-conditional-empty-object-spread.ts +49 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-known-value-widening.ts +247 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-module-mocking.ts +91 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-object-parameters.ts +126 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-reflect-apply.ts +28 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-reflect-get.ts +28 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-runtime-typeof.ts +67 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-shape-in-symbol-names.ts +39 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unknown-parameters.ts +83 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unknown-returns.ts +115 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unknown-type-aliases.ts +72 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unsafe-dictionary-type.ts +134 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-widen-then-assert.ts +366 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/require-safety-comment-for-type-assertion.ts +62 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/shared/dictionary-types.ts +502 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/shared/lexical-type-parameters.ts +60 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/shared/reflect-method.ts +35 -0
- package/dist/extensions/pi-subagents/tsconfig.json +15 -0
- package/dist/extensions/pi-tool-display/CHANGELOG.md +329 -0
- package/dist/extensions/pi-tool-display/LICENSE +21 -0
- package/dist/extensions/pi-tool-display/README.md +417 -0
- package/dist/extensions/pi-tool-display/config/config.example.json +40 -0
- package/dist/extensions/pi-tool-display/index.ts +3 -0
- package/dist/extensions/pi-tool-display/package-lock.json +2555 -0
- package/dist/extensions/pi-tool-display/package.json +86 -0
- package/dist/extensions/pi-tool-display/src/agent-dir.ts +35 -0
- package/dist/extensions/pi-tool-display/src/ansi-utils.ts +116 -0
- package/dist/extensions/pi-tool-display/src/bash-display.ts +213 -0
- package/dist/extensions/pi-tool-display/src/capabilities.ts +88 -0
- package/dist/extensions/pi-tool-display/src/config-modal.ts +541 -0
- package/dist/extensions/pi-tool-display/src/config-store.ts +304 -0
- package/dist/extensions/pi-tool-display/src/debug-logger.ts +150 -0
- package/dist/extensions/pi-tool-display/src/diff-presentation.ts +72 -0
- package/dist/extensions/pi-tool-display/src/diff-renderer.ts +2517 -0
- package/dist/extensions/pi-tool-display/src/disposable.ts +34 -0
- package/dist/extensions/pi-tool-display/src/extension-lifecycle.ts +14 -0
- package/dist/extensions/pi-tool-display/src/index.ts +109 -0
- package/dist/extensions/pi-tool-display/src/line-width-safety.ts +93 -0
- package/dist/extensions/pi-tool-display/src/modal-icons.ts +57 -0
- package/dist/extensions/pi-tool-display/src/pending-diff-preview.ts +370 -0
- package/dist/extensions/pi-tool-display/src/presets.ts +117 -0
- package/dist/extensions/pi-tool-display/src/render-utils.ts +186 -0
- package/dist/extensions/pi-tool-display/src/settings-inspector-modal.ts +475 -0
- package/dist/extensions/pi-tool-display/src/thinking-label.ts +343 -0
- package/dist/extensions/pi-tool-display/src/tool-call-box.ts +181 -0
- package/dist/extensions/pi-tool-display/src/tool-metadata.ts +139 -0
- package/dist/extensions/pi-tool-display/src/tool-overrides.ts +2168 -0
- package/dist/extensions/pi-tool-display/src/types.ts +109 -0
- package/dist/extensions/pi-tool-display/src/user-message-box-markdown.ts +64 -0
- package/dist/extensions/pi-tool-display/src/user-message-box-native.ts +66 -0
- package/dist/extensions/pi-tool-display/src/user-message-box-patch.ts +72 -0
- package/dist/extensions/pi-tool-display/src/user-message-box-renderer.ts +419 -0
- package/dist/extensions/pi-tool-display/src/user-message-box-utils.ts +106 -0
- package/dist/extensions/pi-tool-display/src/write-display-utils.ts +31 -0
- package/dist/extensions/pi-tool-display/src/zellij-modal.ts +1027 -0
- package/dist/extensions/pi-tool-display/tests/active-backlog-red.test.ts +65 -0
- package/dist/extensions/pi-tool-display/tests/ansi-utils.test.ts +345 -0
- package/dist/extensions/pi-tool-display/tests/bash-display.test.ts +442 -0
- package/dist/extensions/pi-tool-display/tests/capabilities-edge.test.ts +360 -0
- package/dist/extensions/pi-tool-display/tests/capabilities.test.ts +54 -0
- package/dist/extensions/pi-tool-display/tests/config-modal.test.ts +360 -0
- package/dist/extensions/pi-tool-display/tests/config-store.test.ts +87 -0
- package/dist/extensions/pi-tool-display/tests/custom-tool-overrides.test.ts +415 -0
- package/dist/extensions/pi-tool-display/tests/debug-logger-edge.test.ts +630 -0
- package/dist/extensions/pi-tool-display/tests/debug-logger.test.ts +62 -0
- package/dist/extensions/pi-tool-display/tests/diff-renderer-ansi.test.ts +55 -0
- package/dist/extensions/pi-tool-display/tests/diff-renderer-edge.test.ts +886 -0
- package/dist/extensions/pi-tool-display/tests/diff-renderer-numbering.test.ts +135 -0
- package/dist/extensions/pi-tool-display/tests/diff-renderer-width.test.ts +454 -0
- package/dist/extensions/pi-tool-display/tests/diff-renderer-wrap.test.ts +169 -0
- package/dist/extensions/pi-tool-display/tests/index-integration.test.ts +354 -0
- package/dist/extensions/pi-tool-display/tests/pending-diff-preview.test.ts +79 -0
- package/dist/extensions/pi-tool-display/tests/presets-edge.test.ts +229 -0
- package/dist/extensions/pi-tool-display/tests/presets.test.ts +26 -0
- package/dist/extensions/pi-tool-display/tests/reload-behavior.test.ts +1241 -0
- package/dist/extensions/pi-tool-display/tests/render-utils.test.ts +710 -0
- package/dist/extensions/pi-tool-display/tests/settings-inspector.test.ts +450 -0
- package/dist/extensions/pi-tool-display/tests/thinking-label-edge.test.ts +904 -0
- package/dist/extensions/pi-tool-display/tests/thinking-label.test.ts +72 -0
- package/dist/extensions/pi-tool-display/tests/tool-call-box.test.ts +105 -0
- package/dist/extensions/pi-tool-display/tests/tool-overrides-config.test.ts +613 -0
- package/dist/extensions/pi-tool-display/tests/tool-overrides-mcp.test.ts +499 -0
- package/dist/extensions/pi-tool-display/tests/tool-overrides-registration.test.ts +315 -0
- package/dist/extensions/pi-tool-display/tests/tool-overrides-write-meta.test.ts +68 -0
- package/dist/extensions/pi-tool-display/tests/tool-ui-utils.test.ts +413 -0
- package/dist/extensions/pi-tool-display/tests/user-message-box-performance-red.test.ts +176 -0
- package/dist/extensions/pi-tool-display/tests/user-message-box.test.ts +908 -0
- package/dist/extensions/pi-tool-display/tests/zellij-modal.test.ts +848 -0
- package/dist/extensions/pi-tool-display/tool-display-api-consumer.d.ts +30 -0
- package/dist/extensions/pi-tool-display/tool-display-api-consumer.js +40 -0
- package/dist/extensions/pi-web-agent/CHANGELOG.md +410 -0
- package/dist/extensions/pi-web-agent/README.md +131 -0
- package/dist/extensions/pi-web-agent/package.json +33 -0
- package/dist/extensions/pi-web-agent/src/backends/config.ts +264 -0
- package/dist/extensions/pi-web-agent/src/backends/doctor.ts +272 -0
- package/dist/extensions/pi-web-agent/src/backends/factory.ts +253 -0
- package/dist/extensions/pi-web-agent/src/backends/settings-reader.ts +46 -0
- package/dist/extensions/pi-web-agent/src/cache/ttl-cache.ts +28 -0
- package/dist/extensions/pi-web-agent/src/changelog-notice.ts +136 -0
- package/dist/extensions/pi-web-agent/src/commands/web-agent-config.ts +1082 -0
- package/dist/extensions/pi-web-agent/src/extension.ts +163 -0
- package/dist/extensions/pi-web-agent/src/extract/readability.ts +126 -0
- package/dist/extensions/pi-web-agent/src/fetch/browser-resolution.ts +199 -0
- package/dist/extensions/pi-web-agent/src/fetch/firecrawl-fetch.ts +100 -0
- package/dist/extensions/pi-web-agent/src/fetch/headless-fetch.ts +117 -0
- package/dist/extensions/pi-web-agent/src/fetch/http-fetch.ts +67 -0
- package/dist/extensions/pi-web-agent/src/orchestration/answer-synthesizer.ts +60 -0
- package/dist/extensions/pi-web-agent/src/orchestration/candidate-selector.ts +51 -0
- package/dist/extensions/pi-web-agent/src/orchestration/direct-url.ts +29 -0
- package/dist/extensions/pi-web-agent/src/orchestration/evidence-quality.ts +108 -0
- package/dist/extensions/pi-web-agent/src/orchestration/evidence-ranker.ts +47 -0
- package/dist/extensions/pi-web-agent/src/orchestration/index.ts +28 -0
- package/dist/extensions/pi-web-agent/src/orchestration/query-planner.ts +47 -0
- package/dist/extensions/pi-web-agent/src/orchestration/research-orchestrator.ts +441 -0
- package/dist/extensions/pi-web-agent/src/orchestration/research-types.ts +71 -0
- package/dist/extensions/pi-web-agent/src/orchestration/research-worker.ts +206 -0
- package/dist/extensions/pi-web-agent/src/orchestration/source-profile.ts +105 -0
- package/dist/extensions/pi-web-agent/src/orchestration/stop-decider.ts +81 -0
- package/dist/extensions/pi-web-agent/src/orchestration/url.ts +35 -0
- package/dist/extensions/pi-web-agent/src/presentation/config-store.ts +210 -0
- package/dist/extensions/pi-web-agent/src/presentation/config.ts +75 -0
- package/dist/extensions/pi-web-agent/src/presentation/explore-presentation.ts +73 -0
- package/dist/extensions/pi-web-agent/src/presentation/fetch-presentation.ts +54 -0
- package/dist/extensions/pi-web-agent/src/presentation/search-presentation.ts +53 -0
- package/dist/extensions/pi-web-agent/src/presentation/select-view.ts +20 -0
- package/dist/extensions/pi-web-agent/src/presentation/types.ts +63 -0
- package/dist/extensions/pi-web-agent/src/readers/github-reader.ts +150 -0
- package/dist/extensions/pi-web-agent/src/readers/limits.ts +3 -0
- package/dist/extensions/pi-web-agent/src/readers/pdf-reader.ts +87 -0
- package/dist/extensions/pi-web-agent/src/readers/resolver.ts +25 -0
- package/dist/extensions/pi-web-agent/src/readers/types.ts +11 -0
- package/dist/extensions/pi-web-agent/src/readers/youtube-reader.ts +79 -0
- package/dist/extensions/pi-web-agent/src/search/brave.ts +114 -0
- package/dist/extensions/pi-web-agent/src/search/duckduckgo.ts +99 -0
- package/dist/extensions/pi-web-agent/src/search/exa.ts +109 -0
- package/dist/extensions/pi-web-agent/src/search/fanout.ts +154 -0
- package/dist/extensions/pi-web-agent/src/search/searxng.ts +96 -0
- package/dist/extensions/pi-web-agent/src/search/tavily.ts +113 -0
- package/dist/extensions/pi-web-agent/src/search/tokenin.ts +130 -0
- package/dist/extensions/pi-web-agent/src/search/youcom.ts +109 -0
- package/dist/extensions/pi-web-agent/src/tools/web-explore.ts +71 -0
- package/dist/extensions/pi-web-agent/src/tools/web-fetch-headless.ts +31 -0
- package/dist/extensions/pi-web-agent/src/tools/web-fetch.ts +31 -0
- package/dist/extensions/pi-web-agent/src/tools/web-search.ts +170 -0
- package/dist/extensions/pi-web-agent/src/types.ts +103 -0
- package/dist/extensions/pi-zentui/.editorconfig +12 -0
- package/dist/extensions/pi-zentui/.github/CODEOWNERS +1 -0
- package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/bug_report.yml +110 -0
- package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/config_question.yml +56 -0
- package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/feature_request.yml +63 -0
- package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/rendering_issue.yml +106 -0
- package/dist/extensions/pi-zentui/.github/ISSUE_TEMPLATE/runtime_detection.yml +103 -0
- package/dist/extensions/pi-zentui/.github/dependabot.yml +47 -0
- package/dist/extensions/pi-zentui/.github/pull_request_template.md +34 -0
- package/dist/extensions/pi-zentui/.github/release.yml +18 -0
- package/dist/extensions/pi-zentui/.github/workflows/ci.yml +79 -0
- package/dist/extensions/pi-zentui/.github/workflows/publish.yml +63 -0
- package/dist/extensions/pi-zentui/AGENTS.md +107 -0
- package/dist/extensions/pi-zentui/CONTRIBUTING.md +68 -0
- package/dist/extensions/pi-zentui/LICENSE +21 -0
- package/dist/extensions/pi-zentui/README.md +202 -0
- package/dist/extensions/pi-zentui/SECURITY.md +18 -0
- package/dist/extensions/pi-zentui/assets/main-cover.png +0 -0
- package/dist/extensions/pi-zentui/assets/screenshots/editor-accent-rail.png +0 -0
- package/dist/extensions/pi-zentui/assets/screenshots/editor-minimalist.png +0 -0
- package/dist/extensions/pi-zentui/assets/screenshots/editor-opencode-copy-friendly.png +0 -0
- package/dist/extensions/pi-zentui/assets/screenshots/editor-opencode.png +0 -0
- package/dist/extensions/pi-zentui/assets/screenshots/user-message-compact.png +0 -0
- package/dist/extensions/pi-zentui/assets/screenshots/user-message-framed-copy-friendly.png +0 -0
- package/dist/extensions/pi-zentui/assets/screenshots/user-message-framed.png +0 -0
- package/dist/extensions/pi-zentui/assets/screenshots/user-message-labeled.png +0 -0
- package/dist/extensions/pi-zentui/assets/zentui.png +0 -0
- package/dist/extensions/pi-zentui/biome.json +31 -0
- package/dist/extensions/pi-zentui/docs/configuration.md +537 -0
- package/dist/extensions/pi-zentui/docs/footer-format.md +162 -0
- package/dist/extensions/pi-zentui/extensions/zentui/accent-rail-editor.ts +99 -0
- package/dist/extensions/pi-zentui/extensions/zentui/accent-rail-layout-patch.ts +457 -0
- package/dist/extensions/pi-zentui/extensions/zentui/completion-menu.ts +157 -0
- package/dist/extensions/pi-zentui/extensions/zentui/config.ts +2129 -0
- package/dist/extensions/pi-zentui/extensions/zentui/editor-metadata-format.ts +321 -0
- package/dist/extensions/pi-zentui/extensions/zentui/editor-transfer.ts +73 -0
- package/dist/extensions/pi-zentui/extensions/zentui/extension-status.ts +89 -0
- package/dist/extensions/pi-zentui/extensions/zentui/footer-format.ts +364 -0
- package/dist/extensions/pi-zentui/extensions/zentui/footer-layout.ts +122 -0
- package/dist/extensions/pi-zentui/extensions/zentui/footer.ts +812 -0
- package/dist/extensions/pi-zentui/extensions/zentui/format.ts +620 -0
- package/dist/extensions/pi-zentui/extensions/zentui/git.ts +384 -0
- package/dist/extensions/pi-zentui/extensions/zentui/icons.ts +252 -0
- package/dist/extensions/pi-zentui/extensions/zentui/index.ts +1445 -0
- package/dist/extensions/pi-zentui/extensions/zentui/interaction-summary.ts +1049 -0
- package/dist/extensions/pi-zentui/extensions/zentui/live-context.ts +75 -0
- package/dist/extensions/pi-zentui/extensions/zentui/minimalist-editor.ts +463 -0
- package/dist/extensions/pi-zentui/extensions/zentui/package-version.ts +651 -0
- package/dist/extensions/pi-zentui/extensions/zentui/project-refresh.ts +120 -0
- package/dist/extensions/pi-zentui/extensions/zentui/project-state.ts +59 -0
- package/dist/extensions/pi-zentui/extensions/zentui/prototype-patch-registry.ts +210 -0
- package/dist/extensions/pi-zentui/extensions/zentui/repository-root.ts +98 -0
- package/dist/extensions/pi-zentui/extensions/zentui/runtime.ts +841 -0
- package/dist/extensions/pi-zentui/extensions/zentui/selector-border.ts +93 -0
- package/dist/extensions/pi-zentui/extensions/zentui/session-lifecycle.ts +60 -0
- package/dist/extensions/pi-zentui/extensions/zentui/settings-command.ts +1908 -0
- package/dist/extensions/pi-zentui/extensions/zentui/settings-previews.ts +245 -0
- package/dist/extensions/pi-zentui/extensions/zentui/state.ts +94 -0
- package/dist/extensions/pi-zentui/extensions/zentui/style.ts +424 -0
- package/dist/extensions/pi-zentui/extensions/zentui/telemetry.ts +82 -0
- package/dist/extensions/pi-zentui/extensions/zentui/thinking-experimental.ts +1768 -0
- package/dist/extensions/pi-zentui/extensions/zentui/thinking-status.ts +69 -0
- package/dist/extensions/pi-zentui/extensions/zentui/thinking-steps.ts +155 -0
- package/dist/extensions/pi-zentui/extensions/zentui/ui.ts +1291 -0
- package/dist/extensions/pi-zentui/extensions/zentui/user-message-osc.ts +262 -0
- package/dist/extensions/pi-zentui/extensions/zentui/user-message-styles.ts +215 -0
- package/dist/extensions/pi-zentui/extensions/zentui/user-message.ts +206 -0
- package/dist/extensions/pi-zentui/extensions/zentui/working-line-messages.ts +24 -0
- package/dist/extensions/pi-zentui/extensions/zentui/working-line-spinners.ts +54 -0
- package/dist/extensions/pi-zentui/extensions/zentui/working-line.ts +1433 -0
- package/dist/extensions/pi-zentui/package-lock.json +5311 -0
- package/dist/extensions/pi-zentui/package.json +60 -0
- package/dist/extensions/pi-zentui/test/accent-rail-editor.test.ts +232 -0
- package/dist/extensions/pi-zentui/test/accent-rail-layout-patch.test.ts +669 -0
- package/dist/extensions/pi-zentui/test/completion-menu.test.ts +265 -0
- package/dist/extensions/pi-zentui/test/config-load-lifecycle.test.ts +124 -0
- package/dist/extensions/pi-zentui/test/config.test.ts +3199 -0
- package/dist/extensions/pi-zentui/test/editor-metadata-format.test.ts +405 -0
- package/dist/extensions/pi-zentui/test/editor-transfer.test.ts +260 -0
- package/dist/extensions/pi-zentui/test/editor-viewport-indicators.test.ts +1301 -0
- package/dist/extensions/pi-zentui/test/extension-compliance.test.ts +7245 -0
- package/dist/extensions/pi-zentui/test/extension-status.test.ts +182 -0
- package/dist/extensions/pi-zentui/test/fixtures/starship-nerd-font-symbols.toml +172 -0
- package/dist/extensions/pi-zentui/test/footer-format.test.ts +431 -0
- package/dist/extensions/pi-zentui/test/footer-layout.test.ts +113 -0
- package/dist/extensions/pi-zentui/test/footer-repository-path.test.ts +123 -0
- package/dist/extensions/pi-zentui/test/format.test.ts +927 -0
- package/dist/extensions/pi-zentui/test/git.test.ts +212 -0
- package/dist/extensions/pi-zentui/test/icons.test.ts +69 -0
- package/dist/extensions/pi-zentui/test/interaction-summary.test.ts +1402 -0
- package/dist/extensions/pi-zentui/test/live-context-integration.test.ts +378 -0
- package/dist/extensions/pi-zentui/test/live-context.test.ts +139 -0
- package/dist/extensions/pi-zentui/test/minimalist-editor.test.ts +811 -0
- package/dist/extensions/pi-zentui/test/package-contents.mjs +33 -0
- package/dist/extensions/pi-zentui/test/package-version.test.ts +321 -0
- package/dist/extensions/pi-zentui/test/project-refresh.test.ts +250 -0
- package/dist/extensions/pi-zentui/test/project-state.test.ts +159 -0
- package/dist/extensions/pi-zentui/test/prototype-patch-registry.test.ts +131 -0
- package/dist/extensions/pi-zentui/test/repository-root.test.ts +108 -0
- package/dist/extensions/pi-zentui/test/responsive-dependencies.test.ts +825 -0
- package/dist/extensions/pi-zentui/test/runtime.test.ts +183 -0
- package/dist/extensions/pi-zentui/test/session-lifecycle.test.ts +40 -0
- package/dist/extensions/pi-zentui/test/settings-command.test.ts +1663 -0
- package/dist/extensions/pi-zentui/test/settings-previews.test.ts +453 -0
- package/dist/extensions/pi-zentui/test/state.test.ts +84 -0
- package/dist/extensions/pi-zentui/test/telemetry-lifecycle-integration.test.ts +276 -0
- package/dist/extensions/pi-zentui/test/telemetry.test.ts +105 -0
- package/dist/extensions/pi-zentui/test/thinking-experimental-docs.test.ts +51 -0
- package/dist/extensions/pi-zentui/test/thinking-experimental-loader-diagnostics.mjs +54 -0
- package/dist/extensions/pi-zentui/test/thinking-experimental-missing-export.test.ts +44 -0
- package/dist/extensions/pi-zentui/test/thinking-experimental-rows.test.ts +297 -0
- package/dist/extensions/pi-zentui/test/thinking-experimental-tui.mjs +2329 -0
- package/dist/extensions/pi-zentui/test/thinking-experimental.test.ts +1668 -0
- package/dist/extensions/pi-zentui/test/thinking-status.test.ts +85 -0
- package/dist/extensions/pi-zentui/test/thinking-steps.test.ts +122 -0
- package/dist/extensions/pi-zentui/test/turn-summary-lifecycle.integration.test.ts +327 -0
- package/dist/extensions/pi-zentui/test/user-message-osc.test.ts +222 -0
- package/dist/extensions/pi-zentui/test/user-message-styles.test.ts +292 -0
- package/dist/extensions/pi-zentui/test/working-line-lifecycle.integration.test.ts +730 -0
- package/dist/extensions/pi-zentui/test/working-line-messages.test.ts +34 -0
- package/dist/extensions/pi-zentui/test/working-line.test.ts +1990 -0
- package/dist/extensions/pi-zentui/tsconfig.json +16 -0
- package/dist/extensions/ponytail/index.js +176 -0
- package/dist/extensions/ponytail/package.json +8 -0
- package/dist/extensions/ponytail/ponytail-config.cjs +151 -0
- package/dist/extensions/ponytail/ponytail-instructions.cjs +112 -0
- package/dist/extensions/ponytail/test/extension.test.js +299 -0
- package/dist/extensions/ponytail/test/helpers.test.js +312 -0
- package/dist/extensions/question/batch.ts +103 -0
- package/dist/extensions/question/constants.ts +31 -0
- package/dist/extensions/question/helpers.ts +58 -0
- package/dist/extensions/question/index.ts +688 -0
- package/dist/extensions/question/navigation.ts +14 -0
- package/dist/extensions/question/package.json +19 -0
- package/dist/extensions/question/question-list.ts +533 -0
- package/dist/extensions/question/row-layout.ts +165 -0
- package/dist/extensions/question/schemas.ts +43 -0
- package/dist/extensions/question/selection-mode.ts +47 -0
- package/dist/extensions/question/shortcuts.ts +44 -0
- package/dist/extensions/question/tests/batch.test.ts +113 -0
- package/dist/extensions/question/tests/exp.test.ts +70 -0
- package/dist/extensions/question/tests/exp2.test.ts +59 -0
- package/dist/extensions/question/tests/exp3.test.ts +47 -0
- package/dist/extensions/question/tests/helpers.test.ts +93 -0
- package/dist/extensions/question/tests/question-list.test.ts +694 -0
- package/dist/extensions/question/tests/row-layout.test.ts +215 -0
- package/dist/extensions/question/tests/schemas.test.ts +53 -0
- package/dist/extensions/question/tests/selection-mode.test.ts +54 -0
- package/dist/extensions/question/tests/shortcuts.test.ts +107 -0
- package/dist/extensions/question/tests/wizard.test.ts +839 -0
- package/dist/extensions/question/tests/zz-ig3.test.ts +20 -0
- package/dist/extensions/question/tests/zz-probe.test.ts +29 -0
- package/dist/extensions/question/types.ts +132 -0
- package/dist/extensions/rtk.test.ts +320 -0
- package/dist/extensions/rtk.ts +123 -0
- package/dist/extensions/test-resolve-hook-impl.mjs +7 -0
- package/dist/extensions/test-resolve-hook.mjs +7 -0
- package/dist/extensions/tokenin-onboarding.ts +883 -0
- package/dist/extensions/tps.test.ts +38 -0
- package/dist/extensions/tps.ts +349 -0
- package/dist/extensions/undo.test.ts +720 -0
- package/dist/extensions/undo.ts +298 -0
- package/dist/extensions/web-agent-onboarding.test.ts +415 -0
- package/dist/extensions/web-agent-onboarding.ts +222 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +48 -0
- package/dist/main.d.ts +11 -0
- package/dist/main.js +768 -0
- package/dist/migrations.d.ts +32 -0
- package/dist/migrations.js +280 -0
- package/dist/modes/index.d.ts +8 -0
- package/dist/modes/index.js +7 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/components/armin.d.ts +33 -0
- package/dist/modes/interactive/components/armin.js +332 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +21 -0
- package/dist/modes/interactive/components/assistant-message.js +142 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +33 -0
- package/dist/modes/interactive/components/bash-execution.js +174 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +15 -0
- package/dist/modes/interactive/components/bordered-loader.js +53 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/branch-summary-message.js +43 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +44 -0
- package/dist/modes/interactive/components/config-selector.d.ts +101 -0
- package/dist/modes/interactive/components/config-selector.js +760 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +13 -0
- package/dist/modes/interactive/components/countdown-timer.js +32 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +20 -0
- package/dist/modes/interactive/components/custom-editor.js +69 -0
- package/dist/modes/interactive/components/custom-entry.d.ts +18 -0
- package/dist/modes/interactive/components/custom-entry.js +51 -0
- package/dist/modes/interactive/components/custom-message.d.ts +21 -0
- package/dist/modes/interactive/components/custom-message.js +86 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +22 -0
- package/dist/modes/interactive/components/daxnuts.js +139 -0
- package/dist/modes/interactive/components/diff.d.ts +11 -0
- package/dist/modes/interactive/components/diff.js +132 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +14 -0
- package/dist/modes/interactive/components/dynamic-border.js +20 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +4 -0
- package/dist/modes/interactive/components/earendil-announcement.js +39 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +20 -0
- package/dist/modes/interactive/components/extension-editor.js +97 -0
- package/dist/modes/interactive/components/extension-input.d.ts +22 -0
- package/dist/modes/interactive/components/extension-input.js +60 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +25 -0
- package/dist/modes/interactive/components/extension-selector.js +82 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +24 -0
- package/dist/modes/interactive/components/first-time-setup.js +116 -0
- package/dist/modes/interactive/components/footer.d.ts +31 -0
- package/dist/modes/interactive/components/footer.js +221 -0
- package/dist/modes/interactive/components/index.d.ts +33 -0
- package/dist/modes/interactive/components/index.js +34 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +12 -0
- package/dist/modes/interactive/components/keybinding-hints.js +35 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +51 -0
- package/dist/modes/interactive/components/login-dialog.js +187 -0
- package/dist/modes/interactive/components/model-selector.d.ts +63 -0
- package/dist/modes/interactive/components/model-selector.js +321 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +32 -0
- package/dist/modes/interactive/components/oauth-selector.js +162 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +41 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +301 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +22 -0
- package/dist/modes/interactive/components/session-selector-search.js +154 -0
- package/dist/modes/interactive/components/session-selector.d.ts +94 -0
- package/dist/modes/interactive/components/session-selector.js +866 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +103 -0
- package/dist/modes/interactive/components/settings-selector.js +726 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +9 -0
- package/dist/modes/interactive/components/show-images-selector.js +38 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +16 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +46 -0
- package/dist/modes/interactive/components/startup-box.d.ts +38 -0
- package/dist/modes/interactive/components/startup-box.js +90 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +30 -0
- package/dist/modes/interactive/components/status-indicator.js +64 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +10 -0
- package/dist/modes/interactive/components/theme-selector.js +49 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +10 -0
- package/dist/modes/interactive/components/thinking-selector.js +51 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +62 -0
- package/dist/modes/interactive/components/tool-execution.js +325 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +93 -0
- package/dist/modes/interactive/components/tree-selector.js +1244 -0
- package/dist/modes/interactive/components/trust-selector.d.ts +22 -0
- package/dist/modes/interactive/components/trust-selector.js +90 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +29 -0
- package/dist/modes/interactive/components/user-message-selector.js +113 -0
- package/dist/modes/interactive/components/user-message.d.ts +13 -0
- package/dist/modes/interactive/components/user-message.js +41 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +23 -0
- package/dist/modes/interactive/components/visual-truncate.js +32 -0
- package/dist/modes/interactive/external-editor.d.ts +11 -0
- package/dist/modes/interactive/external-editor.js +36 -0
- package/dist/modes/interactive/interactive-mode.d.ts +447 -0
- package/dist/modes/interactive/interactive-mode.js +5489 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts +6 -0
- package/dist/modes/interactive/model-catalog-refresh.js +33 -0
- package/dist/modes/interactive/model-search.d.ts +11 -0
- package/dist/modes/interactive/model-search.js +14 -0
- package/dist/modes/interactive/theme/dark.json +90 -0
- package/dist/modes/interactive/theme/light.json +89 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +39 -0
- package/dist/modes/interactive/theme/theme-controller.js +124 -0
- package/dist/modes/interactive/theme/theme-schema.json +348 -0
- package/dist/modes/interactive/theme/theme.d.ts +121 -0
- package/dist/modes/interactive/theme/theme.js +1090 -0
- package/dist/modes/print-mode.d.ts +27 -0
- package/dist/modes/print-mode.js +141 -0
- package/dist/modes/rpc/jsonl.d.ts +16 -0
- package/dist/modes/rpc/jsonl.js +48 -0
- package/dist/modes/rpc/rpc-client.d.ts +438 -0
- package/dist/modes/rpc/rpc-client.js +712 -0
- package/dist/modes/rpc/rpc-mode.d.ts +19 -0
- package/dist/modes/rpc/rpc-mode.js +1459 -0
- package/dist/modes/rpc/rpc-types.d.ts +902 -0
- package/dist/modes/rpc/rpc-types.js +7 -0
- package/dist/package-manager-cli.d.ts +7 -0
- package/dist/package-manager-cli.js +789 -0
- package/dist/rpc-entry.d.ts +2 -0
- package/dist/rpc-entry.js +9 -0
- package/dist/skills/agent-browser/SKILL.md +53 -0
- package/dist/skills/batch-grill-me/SKILL.md +20 -0
- package/dist/skills/brandkit/SKILL.md +798 -0
- package/dist/skills/brutalist/SKILL.md +92 -0
- package/dist/skills/design-references/SKILL.md +32 -0
- package/dist/skills/design-references/references/clickhouse/DESIGN.md +544 -0
- package/dist/skills/gpt-taste/SKILL.md +74 -0
- package/dist/skills/grill-me/SKILL.md +11 -0
- package/dist/skills/handoff/SKILL.md +17 -0
- package/dist/skills/handoff-text/SKILL.md +15 -0
- package/dist/skills/image-to-code/SKILL.md +1228 -0
- package/dist/skills/imagegen-frontend-mobile/SKILL.md +1465 -0
- package/dist/skills/imagegen-frontend-web/SKILL.md +987 -0
- package/dist/skills/implanger/SKILL.md +70 -0
- package/dist/skills/improve-codebase/REFERENCE.md +78 -0
- package/dist/skills/improve-codebase/SKILL.md +180 -0
- package/dist/skills/minimalist/SKILL.md +85 -0
- package/dist/skills/output/SKILL.md +49 -0
- package/dist/skills/pi-subagents/SKILL.md +50 -0
- package/dist/skills/pi-subagents/references/constraints-and-recipes.md +274 -0
- package/dist/skills/pi-subagents/references/execution-controls.md +463 -0
- package/dist/skills/pi-subagents/references/management-authoring-rpc.md +161 -0
- package/dist/skills/pi-subagents/references/multi-lane-orchestration.md +39 -0
- package/dist/skills/pi-subagents/references/prompting-and-roles.md +267 -0
- package/dist/skills/planger/SKILL.md +167 -0
- package/dist/skills/ponytail/SKILL.md +121 -0
- package/dist/skills/ponytail-audit/SKILL.md +42 -0
- package/dist/skills/ponytail-debt/SKILL.md +45 -0
- package/dist/skills/ponytail-gain/SKILL.md +51 -0
- package/dist/skills/ponytail-help/SKILL.md +72 -0
- package/dist/skills/ponytail-review/SKILL.md +58 -0
- package/dist/skills/redesign/SKILL.md +178 -0
- package/dist/skills/selesai-handoff/SKILL.md +21 -0
- package/dist/skills/soft/SKILL.md +98 -0
- package/dist/skills/stitch/DESIGN.md +121 -0
- package/dist/skills/stitch/SKILL.md +184 -0
- package/dist/skills/taste/SKILL.md +1206 -0
- package/dist/skills/taste-v1/SKILL.md +226 -0
- package/dist/skills/unlazy/CHANGELOG.md +109 -0
- package/dist/skills/unlazy/CONTRIBUTING.md +63 -0
- package/dist/skills/unlazy/LICENSE +21 -0
- package/dist/skills/unlazy/README.md +228 -0
- package/dist/skills/unlazy/SECURITY.md +60 -0
- package/dist/skills/unlazy/SKILL.md +93 -0
- package/dist/skills/unlazy/package.json +13 -0
- package/dist/skills/unlazy/references/dispatch.md +79 -0
- package/dist/skills/unlazy/references/gates.md +132 -0
- package/dist/skills/unlazy/references/method.md +49 -0
- package/dist/skills/unlazy/references/orchestration.md +98 -0
- package/dist/skills/unlazy/references/parallel.md +111 -0
- package/dist/skills/unlazy/references/token-economy.md +39 -0
- package/dist/skills/unlazy/research/validation-protocol.md +81 -0
- package/dist/skills/unlazy/scripts/dispatch-check.mjs +108 -0
- package/dist/skills/unlazy/scripts/gate-check.mjs +879 -0
- package/dist/skills/unlazy/scripts/gate-lint.mjs +178 -0
- package/dist/skills/unlazy/scripts/lib/check-supervisor.mjs +46 -0
- package/dist/skills/unlazy/scripts/lib/dispatch.mjs +283 -0
- package/dist/skills/unlazy/scripts/lib/gates.mjs +625 -0
- package/dist/skills/unlazy/scripts/lib/process-tree.mjs +161 -0
- package/dist/skills/unlazy/scripts/lib/regex-worker.mjs +9 -0
- package/dist/skills/unlazy/templates/PLAN.md +65 -0
- package/dist/skills/unlazy/templates/gates-leaf.md +51 -0
- package/dist/skills/unlazy/templates/gates-node.md +50 -0
- package/dist/skills/unlazy/tests/contract-tests.mjs +127 -0
- package/dist/skills/unlazy/tests/dispatch-tests.mjs +296 -0
- package/dist/skills/unlazy/tests/hardening-tests.mjs +900 -0
- package/dist/skills/unlazy/tests/lint-tests.mjs +242 -0
- package/dist/skills/unlazy/tests/run-tests.mjs +360 -0
- package/dist/skills/unlazy/tests/self-check.mjs +152 -0
- package/dist/skills/unlazy/tests/stress-tests.mjs +165 -0
- package/dist/skills/web-design-guidelines/SKILL.md +41 -0
- package/dist/skills/workflow/SKILL.md +95 -0
- package/dist/themes/adventure.json +84 -0
- package/dist/themes/adwaita-dark.json +84 -0
- package/dist/themes/arcoiris.json +84 -0
- package/dist/themes/arthur.json +84 -0
- package/dist/themes/atom.json +84 -0
- package/dist/themes/aura.json +84 -0
- package/dist/themes/black-metal-bathory.json +84 -0
- package/dist/themes/black-metal-burzum.json +84 -0
- package/dist/themes/black-metal-khold.json +84 -0
- package/dist/themes/box.json +84 -0
- package/dist/themes/brogrammer.json +84 -0
- package/dist/themes/carbonfox.json +84 -0
- package/dist/themes/catppuccin-mocha.json +84 -0
- package/dist/themes/citruszest.json +84 -0
- package/dist/themes/cursor-dark.json +84 -0
- package/dist/themes/cutie-pro.json +84 -0
- package/dist/themes/dark-modern.json +84 -0
- package/dist/themes/dark-pastel.json +84 -0
- package/dist/themes/dimmed-monokai.json +84 -0
- package/dist/themes/doom-peacock.json +84 -0
- package/dist/themes/dracula-plus.json +84 -0
- package/dist/themes/dracula.json +80 -0
- package/dist/themes/earthsong.json +84 -0
- package/dist/themes/everforest-dark-hard.json +84 -0
- package/dist/themes/everforest-dark.json +80 -0
- package/dist/themes/fahrenheit.json +84 -0
- package/dist/themes/flatland.json +84 -0
- package/dist/themes/flexoki-dark.json +84 -0
- package/dist/themes/front-end-delight.json +84 -0
- package/dist/themes/fun-forrest.json +84 -0
- package/dist/themes/galizur.json +84 -0
- package/dist/themes/github-dark-colorblind.json +84 -0
- package/dist/themes/github-dark-high-contrast.json +84 -0
- package/dist/themes/glacier.json +84 -0
- package/dist/themes/gruber-darker.json +84 -0
- package/dist/themes/gruvbox-dark-hard.json +84 -0
- package/dist/themes/gruvbox-dark.json +84 -0
- package/dist/themes/gruvbox-material.json +84 -0
- package/dist/themes/guezwhoz.json +84 -0
- package/dist/themes/hacktober.json +84 -0
- package/dist/themes/hardcore.json +84 -0
- package/dist/themes/havn-skumring.json +84 -0
- package/dist/themes/ic-orange-ppl.json +84 -0
- package/dist/themes/iterm2-smoooooth.json +84 -0
- package/dist/themes/iterm2-tango-dark.json +84 -0
- package/dist/themes/japanesque.json +84 -0
- package/dist/themes/jellybeans.json +84 -0
- package/dist/themes/kanagawa-wave.json +84 -0
- package/dist/themes/kurokula.json +84 -0
- package/dist/themes/later-this-evening.json +84 -0
- package/dist/themes/lovelace.json +84 -0
- package/dist/themes/material-darker.json +84 -0
- package/dist/themes/matte-black.json +84 -0
- package/dist/themes/mellow.json +84 -0
- package/dist/themes/miasma.json +84 -0
- package/dist/themes/nord.json +80 -0
- package/dist/themes/nvim-dark.json +84 -0
- package/dist/themes/one-dark.json +80 -0
- package/dist/themes/popping-and-locking.json +84 -0
- package/dist/themes/rose-pine.json +80 -0
- package/dist/themes/sea-shells.json +84 -0
- package/dist/themes/sleepy-hollow.json +84 -0
- package/dist/themes/smyck.json +84 -0
- package/dist/themes/solarized-dark.json +80 -0
- package/dist/themes/tokyo-night.json +80 -0
- package/dist/themes/tomorrow-night-bright.json +84 -0
- package/dist/themes/tomorrow-night-burns.json +84 -0
- package/dist/themes/tomorrow-night.json +84 -0
- package/dist/themes/twilight.json +84 -0
- package/dist/themes/vague.json +84 -0
- package/dist/themes/vesper.json +84 -0
- package/dist/themes/xcode-dark-hc.json +84 -0
- package/dist/utils/abort.d.ts +4 -0
- package/dist/utils/abort.js +47 -0
- package/dist/utils/ansi.d.ts +1 -0
- package/dist/utils/ansi.js +51 -0
- package/dist/utils/changelog.d.ts +21 -0
- package/dist/utils/changelog.js +164 -0
- package/dist/utils/child-process.d.ts +17 -0
- package/dist/utils/child-process.js +105 -0
- package/dist/utils/clipboard-image.d.ts +10 -0
- package/dist/utils/clipboard-image.js +250 -0
- package/dist/utils/clipboard-native.d.ts +10 -0
- package/dist/utils/clipboard-native.js +19 -0
- package/dist/utils/clipboard.d.ts +3 -0
- package/dist/utils/clipboard.js +140 -0
- package/dist/utils/deprecation.d.ts +3 -0
- package/dist/utils/deprecation.js +12 -0
- package/dist/utils/exif-orientation.d.ts +4 -0
- package/dist/utils/exif-orientation.js +157 -0
- package/dist/utils/frontmatter.d.ts +7 -0
- package/dist/utils/frontmatter.js +25 -0
- package/dist/utils/fs-watch.d.ts +4 -0
- package/dist/utils/fs-watch.js +24 -0
- package/dist/utils/git.d.ts +25 -0
- package/dist/utils/git.js +194 -0
- package/dist/utils/html.d.ts +6 -0
- package/dist/utils/html.js +39 -0
- package/dist/utils/image-convert.d.ts +9 -0
- package/dist/utils/image-convert.js +44 -0
- package/dist/utils/image-process.d.ts +17 -0
- package/dist/utils/image-process.js +82 -0
- package/dist/utils/image-resize-core.d.ts +29 -0
- package/dist/utils/image-resize-core.js +123 -0
- package/dist/utils/image-resize-worker.d.ts +1 -0
- package/dist/utils/image-resize-worker.js +30 -0
- package/dist/utils/image-resize.d.ts +15 -0
- package/dist/utils/image-resize.js +96 -0
- package/dist/utils/json.d.ts +2 -0
- package/dist/utils/json.js +6 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/mime.js +132 -0
- package/dist/utils/open-browser.d.ts +8 -0
- package/dist/utils/open-browser.js +21 -0
- package/dist/utils/paths.d.ts +30 -0
- package/dist/utils/paths.js +91 -0
- package/dist/utils/photon.d.ts +20 -0
- package/dist/utils/photon.js +120 -0
- package/dist/utils/pi-user-agent.d.ts +1 -0
- package/dist/utils/pi-user-agent.js +4 -0
- package/dist/utils/shell.d.ts +33 -0
- package/dist/utils/shell.js +215 -0
- package/dist/utils/sleep.d.ts +4 -0
- package/dist/utils/sleep.js +16 -0
- package/dist/utils/syntax-highlight.d.ts +11 -0
- package/dist/utils/syntax-highlight.js +117 -0
- package/dist/utils/thinking-tags.d.ts +6 -0
- package/dist/utils/thinking-tags.js +62 -0
- package/dist/utils/tools-manager.d.ts +7 -0
- package/dist/utils/tools-manager.js +402 -0
- package/dist/utils/version-check.d.ts +19 -0
- package/dist/utils/version-check.js +72 -0
- package/dist/utils/windows-self-update.d.ts +2 -0
- package/dist/utils/windows-self-update.js +76 -0
- package/package.json +1 -1
|
@@ -0,0 +1,2324 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
|
+
import * as os from "node:os";
|
|
5
|
+
import * as path from "node:path";
|
|
6
|
+
import { afterEach, describe, it } from "node:test";
|
|
7
|
+
import { handleManagementAction } from "../../src/agents/agent-management.ts";
|
|
8
|
+
import { serializeAgent } from "../../src/agents/agent-serializer.ts";
|
|
9
|
+
import { parseChain, serializeChain } from "../../src/agents/chain-serializer.ts";
|
|
10
|
+
import { discoverAgents, discoverAgentsAll, inspectAgentDefinitionDirectory, type AgentConfig } from "../../src/agents/agents.ts";
|
|
11
|
+
import { parseFrontmatter } from "../../src/agents/frontmatter.ts";
|
|
12
|
+
import { buildPiArgs } from "../../src/runs/shared/pi-args.ts";
|
|
13
|
+
import { THINKING_LEVELS } from "../../src/shared/model-info.ts";
|
|
14
|
+
|
|
15
|
+
const tempDirs: string[] = [];
|
|
16
|
+
|
|
17
|
+
function writeJson(filePath: string, value: unknown): void {
|
|
18
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
19
|
+
fs.writeFileSync(filePath, JSON.stringify(value, null, 2), "utf-8");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function writeAgent(filePath: string, body: string): void {
|
|
23
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
24
|
+
fs.writeFileSync(filePath, body, "utf-8");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function createNestedLinkedWorktree(): { repo: string; worktree: string } {
|
|
28
|
+
const repo = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-linked-worktree-"));
|
|
29
|
+
tempDirs.push(repo);
|
|
30
|
+
execFileSync("git", ["init"], { cwd: repo, stdio: "ignore" });
|
|
31
|
+
execFileSync("git", ["config", "user.email", "test@example.com"], { cwd: repo });
|
|
32
|
+
execFileSync("git", ["config", "user.name", "Test User"], { cwd: repo });
|
|
33
|
+
fs.writeFileSync(path.join(repo, "base.txt"), "base\n", "utf-8");
|
|
34
|
+
execFileSync("git", ["add", "base.txt"], { cwd: repo });
|
|
35
|
+
execFileSync("git", ["commit", "-m", "base"], { cwd: repo, stdio: "ignore" });
|
|
36
|
+
|
|
37
|
+
const worktree = path.join(repo, ".worktrees", "linked");
|
|
38
|
+
execFileSync("git", ["worktree", "add", "-b", "linked", worktree], { cwd: repo, stdio: "ignore" });
|
|
39
|
+
return { repo, worktree };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function writeLinkedWorktreePackage(repo: string): { packageAgentName: string; packageAgentPath: string; settingsPath: string } {
|
|
43
|
+
const packageAgentName = "issue950-workflow.reviewer";
|
|
44
|
+
const packageRoot = path.join(repo, ".selesai", "vendor", "workflow");
|
|
45
|
+
const packageAgentPath = path.join(packageRoot, "agents", "reviewer.md");
|
|
46
|
+
const settingsPath = path.join(repo, ".selesai", "settings.json");
|
|
47
|
+
writeJson(settingsPath, {
|
|
48
|
+
packages: [{ source: "file:./vendor/workflow" }],
|
|
49
|
+
subagents: {
|
|
50
|
+
projectRootResolution: "git-root",
|
|
51
|
+
agentOverrides: {
|
|
52
|
+
reviewer: { model: "issue950/outer-model" },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
writeJson(path.join(packageRoot, "package.json"), {
|
|
57
|
+
name: "issue950-workflow",
|
|
58
|
+
"pi-subagents": { agents: ["./agents"] },
|
|
59
|
+
});
|
|
60
|
+
writeAgent(packageAgentPath, `---
|
|
61
|
+
name: reviewer
|
|
62
|
+
package: issue950-workflow
|
|
63
|
+
description: Review from the primary checkout.
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
Review the linked worktree.
|
|
67
|
+
`);
|
|
68
|
+
return { packageAgentName, packageAgentPath, settingsPath };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function withTempHome<T>(fn: (home: string) => T): T {
|
|
72
|
+
const home = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-package-home-"));
|
|
73
|
+
tempDirs.push(home);
|
|
74
|
+
const oldHome = process.env.HOME;
|
|
75
|
+
const oldUserProfile = process.env.USERPROFILE;
|
|
76
|
+
const oldPiCodingAgentDir = process.env.SELESAI_CODING_AGENT_DIR;
|
|
77
|
+
const oldExtraAgentDirs = process.env.SELESAI_SUBAGENT_EXTRA_AGENT_DIRS;
|
|
78
|
+
process.env.HOME = home;
|
|
79
|
+
process.env.USERPROFILE = home;
|
|
80
|
+
delete process.env.SELESAI_CODING_AGENT_DIR;
|
|
81
|
+
delete process.env.SELESAI_SUBAGENT_EXTRA_AGENT_DIRS;
|
|
82
|
+
try {
|
|
83
|
+
return fn(home);
|
|
84
|
+
} finally {
|
|
85
|
+
if (oldHome === undefined) delete process.env.HOME;
|
|
86
|
+
else process.env.HOME = oldHome;
|
|
87
|
+
if (oldUserProfile === undefined) delete process.env.USERPROFILE;
|
|
88
|
+
else process.env.USERPROFILE = oldUserProfile;
|
|
89
|
+
if (oldPiCodingAgentDir === undefined) delete process.env.SELESAI_CODING_AGENT_DIR;
|
|
90
|
+
else process.env.SELESAI_CODING_AGENT_DIR = oldPiCodingAgentDir;
|
|
91
|
+
if (oldExtraAgentDirs === undefined) delete process.env.SELESAI_SUBAGENT_EXTRA_AGENT_DIRS;
|
|
92
|
+
else process.env.SELESAI_SUBAGENT_EXTRA_AGENT_DIRS = oldExtraAgentDirs;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
afterEach(() => {
|
|
97
|
+
while (tempDirs.length > 0) {
|
|
98
|
+
const dir = tempDirs.pop();
|
|
99
|
+
if (!dir) continue;
|
|
100
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
describe("agent definition directory inspection", () => {
|
|
105
|
+
it("distinguishes absent, empty, candidates, unreadable, and non-directory paths", () => {
|
|
106
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-inspection-"));
|
|
107
|
+
tempDirs.push(root);
|
|
108
|
+
const empty = path.join(root, "empty");
|
|
109
|
+
const candidates = path.join(root, "candidates");
|
|
110
|
+
const file = path.join(root, "not-directory");
|
|
111
|
+
fs.mkdirSync(empty);
|
|
112
|
+
fs.mkdirSync(candidates);
|
|
113
|
+
fs.writeFileSync(path.join(candidates, "worker.md"), "---\nname: worker\ndescription: Worker\n---\n", "utf-8");
|
|
114
|
+
fs.writeFileSync(file, "not a directory", "utf-8");
|
|
115
|
+
assert.equal(inspectAgentDefinitionDirectory(path.join(root, "absent")).state, "absent");
|
|
116
|
+
assert.equal(inspectAgentDefinitionDirectory(empty).state, "empty");
|
|
117
|
+
assert.deepEqual(inspectAgentDefinitionDirectory(candidates), { state: "candidates", files: [path.join(candidates, "worker.md")] });
|
|
118
|
+
assert.equal(inspectAgentDefinitionDirectory(file).state, "not-directory");
|
|
119
|
+
assert.equal(inspectAgentDefinitionDirectory(path.join(root, "blocked"), {
|
|
120
|
+
existsSync: () => true,
|
|
121
|
+
statSync: () => ({ isDirectory: () => true }),
|
|
122
|
+
readdirSync: () => { throw new Error("permission denied"); },
|
|
123
|
+
}).state, "unreadable");
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("reports cached builtin and configured project definition paths without synthesizing a root", () => withTempHome(() => {
|
|
127
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-report-"));
|
|
128
|
+
tempDirs.push(project);
|
|
129
|
+
writeJson(path.join(project, ".selesai", "settings.json"), { subagents: { projectRootResolution: "nearest" } });
|
|
130
|
+
const discovered = discoverAgents(project, "project");
|
|
131
|
+
assert.ok(discovered.directories.some((entry) => entry.source === "builtin"));
|
|
132
|
+
assert.deepEqual(discovered.directories.filter((entry) => entry.source === "project").map((entry) => entry.path), [path.join(project, ".agents"), path.join(project, ".selesai", "agents")]);
|
|
133
|
+
}));
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
describe("folded frontmatter blocks", () => {
|
|
137
|
+
it("folds ordinary lines and paragraph breaks for > and >-", () => {
|
|
138
|
+
const expected = "first line second line\nthird line";
|
|
139
|
+
const folded = parseFrontmatter(`---
|
|
140
|
+
name: worker
|
|
141
|
+
description: >
|
|
142
|
+
first line
|
|
143
|
+
second line
|
|
144
|
+
|
|
145
|
+
third line
|
|
146
|
+
---
|
|
147
|
+
body`);
|
|
148
|
+
const stripped = parseFrontmatter(`---
|
|
149
|
+
name: worker
|
|
150
|
+
description: >-
|
|
151
|
+
first line
|
|
152
|
+
second line
|
|
153
|
+
|
|
154
|
+
third line
|
|
155
|
+
---
|
|
156
|
+
body`);
|
|
157
|
+
|
|
158
|
+
assert.equal(folded.frontmatter.description, expected);
|
|
159
|
+
assert.equal(stripped.frontmatter.description, expected);
|
|
160
|
+
assert.equal(folded.frontmatter.name, "worker");
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("keeps quoted indicators as literal values", () => {
|
|
164
|
+
const parsed = parseFrontmatter(`---
|
|
165
|
+
description: ">"
|
|
166
|
+
other: '>-'
|
|
167
|
+
---
|
|
168
|
+
body`);
|
|
169
|
+
|
|
170
|
+
assert.equal(parsed.frontmatter.description, ">");
|
|
171
|
+
assert.equal(parsed.frontmatter.other, ">-");
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it("preserves lines for | and |-", () => {
|
|
175
|
+
for (const indicator of ["|", "|-"]) {
|
|
176
|
+
const parsed = parseFrontmatter(`---
|
|
177
|
+
description: ${indicator}
|
|
178
|
+
first line
|
|
179
|
+
second line
|
|
180
|
+
---
|
|
181
|
+
body`);
|
|
182
|
+
assert.equal(parsed.frontmatter.description, "first line\nsecond line");
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it("preserves more-indented lines and repeated whitespace-only separators", () => {
|
|
187
|
+
const parsed = parseFrontmatter(`---
|
|
188
|
+
description: >
|
|
189
|
+
normal
|
|
190
|
+
code
|
|
191
|
+
next
|
|
192
|
+
|
|
193
|
+
first
|
|
194
|
+
|
|
195
|
+
${" ".repeat(3)}
|
|
196
|
+
second
|
|
197
|
+
name: worker
|
|
198
|
+
---
|
|
199
|
+
body`);
|
|
200
|
+
|
|
201
|
+
assert.equal(parsed.frontmatter.description, "normal\n code\nnext\nfirst\n\nsecond");
|
|
202
|
+
assert.equal(parsed.frontmatter.name, "worker");
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it("keeps paragraph breaks adjacent to more-indented lines", () => {
|
|
206
|
+
const afterIndented = parseFrontmatter(`---
|
|
207
|
+
description: >
|
|
208
|
+
normal
|
|
209
|
+
code
|
|
210
|
+
|
|
211
|
+
next
|
|
212
|
+
---
|
|
213
|
+
body`);
|
|
214
|
+
const beforeIndented = parseFrontmatter(`---
|
|
215
|
+
description: >
|
|
216
|
+
normal
|
|
217
|
+
|
|
218
|
+
code
|
|
219
|
+
next
|
|
220
|
+
---
|
|
221
|
+
body`);
|
|
222
|
+
|
|
223
|
+
assert.equal(afterIndented.frontmatter.description, "normal\n code\n\nnext");
|
|
224
|
+
assert.equal(beforeIndented.frontmatter.description, "normal\n\n code\nnext");
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
describe("agent runner frontmatter", () => {
|
|
229
|
+
it("parses and serializes an external-cli runner", () => withTempHome(() => {
|
|
230
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-runner-agent-"));
|
|
231
|
+
tempDirs.push(project);
|
|
232
|
+
writeAgent(path.join(project, ".selesai", "agents", "external.md"), `---
|
|
233
|
+
name: external
|
|
234
|
+
description: External runner
|
|
235
|
+
runner:
|
|
236
|
+
type: external-cli
|
|
237
|
+
command: ${JSON.stringify(process.execPath)}
|
|
238
|
+
args: ["-e", "process.stdin.pipe(process.stdout)"]
|
|
239
|
+
promptDelivery: stdin
|
|
240
|
+
async: true
|
|
241
|
+
---
|
|
242
|
+
Review carefully.`.replace(" description:", "description:"));
|
|
243
|
+
|
|
244
|
+
const external = discoverAgents(project, "project").agents.find((agent) => agent.name === "external")!;
|
|
245
|
+
assert.deepEqual(external.runner, { type: "external-cli", command: process.execPath, args: ["-e", "process.stdin.pipe(process.stdout)"], promptDelivery: "stdin" });
|
|
246
|
+
assert.match(serializeAgent(external), /runner:\n type: external-cli\n command:/);
|
|
247
|
+
assert.deepEqual(discoverAgents(project, "project").agents.find((agent) => agent.name === "external")?.runner, external.runner);
|
|
248
|
+
}));
|
|
249
|
+
|
|
250
|
+
it("keeps external-cli stop code-owned while refusing capability widening", () => withTempHome(() => {
|
|
251
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-runner-capabilities-"));
|
|
252
|
+
tempDirs.push(project);
|
|
253
|
+
const agentPath = path.join(project, ".selesai", "agents", "external.md");
|
|
254
|
+
writeAgent(agentPath, `---\nname: external\ndescription: External runner\nrunner:\n type: external-cli\n command: node\n capabilities:\n steer: false\n---\nReview.`);
|
|
255
|
+
assert.deepEqual(discoverAgents(project, "project").agents.find((agent) => agent.name === "external")?.runner, {
|
|
256
|
+
type: "external-cli",
|
|
257
|
+
command: "node",
|
|
258
|
+
capabilities: { steer: false },
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
writeAgent(agentPath, `---\nname: external\ndescription: External runner\nrunner:\n type: external-cli\n command: node\n capabilities:\n stop: false\n---\nReview.`);
|
|
262
|
+
const narrowedStop = discoverAgents(project, "project");
|
|
263
|
+
assert.equal(narrowedStop.agents.some((agent) => agent.name === "external"), false);
|
|
264
|
+
assert.match(narrowedStop.agentDiagnostics?.[0]?.error ?? "", /capabilities has unsupported fields: stop/);
|
|
265
|
+
|
|
266
|
+
writeAgent(agentPath, `---\nname: external\ndescription: External runner\nrunner:\n type: external-cli\n command: node\n capabilities:\n steer: true\n---\nReview.`);
|
|
267
|
+
const widened = discoverAgents(project, "project");
|
|
268
|
+
assert.equal(widened.agents.some((agent) => agent.name === "external"), false);
|
|
269
|
+
assert.match(widened.agentDiagnostics?.[0]?.error ?? "", /steer may only be false; user config cannot widen code-owned external adapter capabilities/);
|
|
270
|
+
}));
|
|
271
|
+
|
|
272
|
+
it("parses and serializes an external-job runner", () => withTempHome(() => {
|
|
273
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-external-job-agent-"));
|
|
274
|
+
tempDirs.push(project);
|
|
275
|
+
writeAgent(path.join(project, ".selesai", "agents", "gpt-pro.md"), `---
|
|
276
|
+
name: gpt-pro
|
|
277
|
+
description: Surf GPT Pro advisor
|
|
278
|
+
runner:
|
|
279
|
+
type: external-job
|
|
280
|
+
provider: surf-oracle
|
|
281
|
+
options:
|
|
282
|
+
tier: pro
|
|
283
|
+
async: true
|
|
284
|
+
---
|
|
285
|
+
Review carefully.`);
|
|
286
|
+
|
|
287
|
+
const gptPro = discoverAgents(project, "project").agents.find((agent) => agent.name === "gpt-pro")!;
|
|
288
|
+
assert.deepEqual(gptPro.runner, { type: "external-job", provider: "surf-oracle", options: { tier: "pro" } });
|
|
289
|
+
assert.match(serializeAgent(gptPro), /runner:\n type: external-job\n provider: surf-oracle/);
|
|
290
|
+
}));
|
|
291
|
+
|
|
292
|
+
it("rejects invalid and Pi-only external runner fields", () => withTempHome(() => {
|
|
293
|
+
const invalidCases = [
|
|
294
|
+
"type: unknown\n command: node",
|
|
295
|
+
"type: external-cli\n command: ''",
|
|
296
|
+
"type: external-cli\n command: node\n args: nope",
|
|
297
|
+
"type: external-cli\n command: node\n args: [ok, 1]",
|
|
298
|
+
"type: external-cli\n command: node\n promptDelivery: argv",
|
|
299
|
+
"type: external-job\n provider: ''",
|
|
300
|
+
"type: external-job\n provider: surf-oracle\n options: []",
|
|
301
|
+
];
|
|
302
|
+
for (const [index, runner] of invalidCases.entries()) {
|
|
303
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), `pi-subagents-invalid-runner-${index}-`));
|
|
304
|
+
tempDirs.push(project);
|
|
305
|
+
writeAgent(path.join(project, ".selesai", "agents", "external.md"), `---\nname: external\ndescription: External\nrunner:\n ${runner}\n---\nBody`);
|
|
306
|
+
const discovered = discoverAgents(project, "project");
|
|
307
|
+
assert.equal(discovered.agents.some((agent) => agent.name === "external"), false);
|
|
308
|
+
assert.match(discovered.agentDiagnostics?.[0]?.error ?? "", /invalid runner\.type|non-empty command|args must be an array of strings|promptDelivery must be 'stdin'|provider string|options must be a JSON-serializable object/);
|
|
309
|
+
}
|
|
310
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-runner-pi-only-"));
|
|
311
|
+
tempDirs.push(project);
|
|
312
|
+
writeAgent(path.join(project, ".selesai", "agents", "external.md"), `---\nname: external\ndescription: External\nrunner:\n type: external-cli\n command: node\nmodel: provider/model\n---\nBody`);
|
|
313
|
+
assert.match(discoverAgents(project, "project").agentDiagnostics?.[0]?.error ?? "", /unsupported Pi-only fields: model/);
|
|
314
|
+
}));
|
|
315
|
+
|
|
316
|
+
it("keeps valid agents executable when another agent is malformed", () => withTempHome(() => {
|
|
317
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-invalid-agent-isolation-"));
|
|
318
|
+
tempDirs.push(project);
|
|
319
|
+
writeAgent(path.join(project, ".selesai", "agents", "broken.md"), "---\nname: broken\ndescription: Broken\nrunner:\n type: unknown\n---\nBody");
|
|
320
|
+
writeAgent(path.join(project, ".selesai", "agents", "working.md"), "---\nname: working\ndescription: Working\n---\nBody");
|
|
321
|
+
|
|
322
|
+
const discovered = discoverAgents(project, "project");
|
|
323
|
+
assert.ok(discovered.agents.some((agent) => agent.name === "working"));
|
|
324
|
+
assert.equal(discovered.agentDiagnostics?.[0]?.name, "broken");
|
|
325
|
+
}));
|
|
326
|
+
|
|
327
|
+
it("follows symlinked agent directories once without hiding diagnostics", () => withTempHome(() => {
|
|
328
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-symlinked-agent-dir-"));
|
|
329
|
+
tempDirs.push(project);
|
|
330
|
+
const legacyAgentsRoot = path.join(project, ".agents");
|
|
331
|
+
const sharedAgents = path.join(project, "shared-agents");
|
|
332
|
+
const linkedAgents = path.join(legacyAgentsRoot, "agents");
|
|
333
|
+
fs.mkdirSync(legacyAgentsRoot, { recursive: true });
|
|
334
|
+
fs.mkdirSync(sharedAgents, { recursive: true });
|
|
335
|
+
writeAgent(path.join(sharedAgents, "linked.md"), "---\nname: linked\ndescription: Linked agent\n---\nBody");
|
|
336
|
+
writeAgent(path.join(sharedAgents, "broken.md"), "---\nname: broken\ndescription: Broken\nrunner:\n type: unknown\n---\nBody");
|
|
337
|
+
fs.symlinkSync(sharedAgents, linkedAgents, process.platform === "win32" ? "junction" : "dir");
|
|
338
|
+
fs.symlinkSync(path.join(sharedAgents, "missing"), path.join(sharedAgents, "dangling"), process.platform === "win32" ? "junction" : "dir");
|
|
339
|
+
if (process.platform !== "win32") fs.symlinkSync(sharedAgents, path.join(sharedAgents, "loop"), "dir");
|
|
340
|
+
|
|
341
|
+
const discovered = discoverAgents(project, "project");
|
|
342
|
+
assert.equal(discovered.agents.find((agent) => agent.name === "linked")?.filePath, path.join(linkedAgents, "linked.md"));
|
|
343
|
+
assert.equal(discovered.agentDiagnostics?.find((diagnostic) => diagnostic.name === "broken")?.filePath, path.join(linkedAgents, "broken.md"));
|
|
344
|
+
}));
|
|
345
|
+
|
|
346
|
+
it("keeps a lower-priority agent available when a project override is malformed", () => withTempHome(() => {
|
|
347
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-invalid-agent-shadow-"));
|
|
348
|
+
tempDirs.push(project);
|
|
349
|
+
writeAgent(path.join(project, ".selesai", "agents", "reviewer.md"), "---\nname: reviewer\ndescription: Broken reviewer\nrunner:\n type: unknown\n---\nBody");
|
|
350
|
+
|
|
351
|
+
const discovered = discoverAgents(project, "both");
|
|
352
|
+
assert.equal(discovered.agents.find((agent) => agent.name === "reviewer")?.source, "builtin");
|
|
353
|
+
assert.equal(discovered.agentDiagnostics?.find((diagnostic) => diagnostic.name === "reviewer")?.source, "project");
|
|
354
|
+
}));
|
|
355
|
+
|
|
356
|
+
it("records the runtime name for malformed packaged agents", () => withTempHome(() => {
|
|
357
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-invalid-packaged-agent-"));
|
|
358
|
+
tempDirs.push(project);
|
|
359
|
+
writeAgent(path.join(project, ".selesai", "agents", "code-analysis.zeta-worker.md"), "---\nname: zeta-worker\npackage: code-analysis\ndescription: Broken packaged worker\nrunner:\n type: unknown\n---\nBody");
|
|
360
|
+
|
|
361
|
+
const discovered = discoverAgents(project, "project");
|
|
362
|
+
assert.equal(discovered.agents.some((agent) => agent.name === "code-analysis.zeta-worker"), false);
|
|
363
|
+
assert.deepEqual(discovered.agentDiagnostics?.[0] && { name: discovered.agentDiagnostics[0].name, runtimeName: discovered.agentDiagnostics[0].runtimeName }, {
|
|
364
|
+
name: "zeta-worker",
|
|
365
|
+
runtimeName: "code-analysis.zeta-worker",
|
|
366
|
+
});
|
|
367
|
+
}));
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
describe("agent skillPath frontmatter", () => {
|
|
371
|
+
it("parses and serializes comma-separated paths", () => withTempHome(() => {
|
|
372
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-skill-path-agent-"));
|
|
373
|
+
tempDirs.push(project);
|
|
374
|
+
writeAgent(path.join(project, ".selesai", "agents", "worker.md"), `---
|
|
375
|
+
name: worker
|
|
376
|
+
description: Worker
|
|
377
|
+
skillPath: ./skills, ../shared-skills
|
|
378
|
+
---
|
|
379
|
+
body`);
|
|
380
|
+
|
|
381
|
+
const worker = discoverAgents(project, "both").agents.find((agent) => agent.name === "worker")!;
|
|
382
|
+
assert.deepEqual(worker.skillPath, ["./skills", "../shared-skills"]);
|
|
383
|
+
assert.match(serializeAgent(worker), /^skillPath: \.\/skills, \.\.\/shared-skills$/m);
|
|
384
|
+
}));
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
describe("agent aliases", () => {
|
|
388
|
+
it("parses and serializes agent aliases", () => withTempHome(() => {
|
|
389
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-alias-agent-"));
|
|
390
|
+
tempDirs.push(project);
|
|
391
|
+
writeAgent(path.join(project, ".selesai", "agents", "worker.md"), `---
|
|
392
|
+
name: worker
|
|
393
|
+
description: Worker
|
|
394
|
+
aliases: developer, coder, worker
|
|
395
|
+
---
|
|
396
|
+
body`);
|
|
397
|
+
|
|
398
|
+
const worker = discoverAgents(project, "both").agents.find((agent) => agent.name === "worker")!;
|
|
399
|
+
assert.deepEqual(worker.aliases, ["developer", "coder"]);
|
|
400
|
+
assert.match(serializeAgent(worker), /^aliases: developer, coder$/m);
|
|
401
|
+
|
|
402
|
+
const ctx = { cwd: project, modelRegistry: { getAvailable: () => [] } };
|
|
403
|
+
assert.match(handleManagementAction("list", {}, ctx).content[0]?.text ?? "", /aliases: developer, coder/);
|
|
404
|
+
assert.match(handleManagementAction("get", { agent: "developer" }, ctx).content[0]?.text ?? "", /Agent: worker/);
|
|
405
|
+
}));
|
|
406
|
+
|
|
407
|
+
it("reports management alias collisions as ambiguous", () => withTempHome(() => {
|
|
408
|
+
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-alias-collision-"));
|
|
409
|
+
tempDirs.push(project);
|
|
410
|
+
writeAgent(path.join(project, ".selesai", "agents", "review-agent.md"), `---
|
|
411
|
+
name: review-agent
|
|
412
|
+
description: Custom reviewer
|
|
413
|
+
aliases: developer
|
|
414
|
+
---
|
|
415
|
+
body`);
|
|
416
|
+
|
|
417
|
+
const ctx = { cwd: project, modelRegistry: { getAvailable: () => [] } };
|
|
418
|
+
const getResult = handleManagementAction("get", { agent: "developer" }, ctx);
|
|
419
|
+
assert.equal(getResult.isError, true);
|
|
420
|
+
assert.match(getResult.content[0]?.text ?? "", /Ambiguous agent alias or name 'developer': review-agent, worker/);
|
|
421
|
+
|
|
422
|
+
const disableResult = handleManagementAction("disable", { agent: "developer" }, ctx);
|
|
423
|
+
assert.equal(disableResult.isError, true);
|
|
424
|
+
assert.match(disableResult.content[0]?.text ?? "", /Ambiguous agent alias 'developer': worker, review-agent|Ambiguous agent alias 'developer': review-agent, worker/);
|
|
425
|
+
}));
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
describe("agent simple-scalar list frontmatter", () => {
|
|
429
|
+
it("discovers newline block lists for all list fields and routes MCP tools", () => {
|
|
430
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-block-list-frontmatter-"));
|
|
431
|
+
tempDirs.push(dir);
|
|
432
|
+
writeAgent(path.join(dir, ".selesai", "agents", "worker.md"), `---
|
|
433
|
+
name: worker
|
|
434
|
+
description: Worker
|
|
435
|
+
tools:
|
|
436
|
+
- read-only
|
|
437
|
+
- mcp:github/search_repositories
|
|
438
|
+
defaultReads:
|
|
439
|
+
- input-one.md
|
|
440
|
+
- input-two.md
|
|
441
|
+
skill:
|
|
442
|
+
- review-checklist
|
|
443
|
+
- safe-bash
|
|
444
|
+
skillPath:
|
|
445
|
+
- ./private-skills
|
|
446
|
+
- ../shared-skills
|
|
447
|
+
fallbackModels:
|
|
448
|
+
- openai/gpt-5-mini
|
|
449
|
+
- anthropic/claude-sonnet-4
|
|
450
|
+
extensions:
|
|
451
|
+
- ./extension-one.ts
|
|
452
|
+
- ./extension-two.ts
|
|
453
|
+
subagentOnlyExtensions:
|
|
454
|
+
- ./child-only.ts
|
|
455
|
+
- ./child-helper.ts
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
Do work
|
|
459
|
+
`);
|
|
460
|
+
|
|
461
|
+
const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
|
|
462
|
+
assert.deepEqual(worker?.tools, ["read-only"]);
|
|
463
|
+
assert.deepEqual(worker?.mcpDirectTools, ["github/search_repositories"]);
|
|
464
|
+
assert.deepEqual(worker?.defaultReads, ["input-one.md", "input-two.md"]);
|
|
465
|
+
assert.deepEqual(worker?.skills, ["review-checklist", "safe-bash"]);
|
|
466
|
+
assert.deepEqual(worker?.skillPath, ["./private-skills", "../shared-skills"]);
|
|
467
|
+
assert.deepEqual(worker?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
|
|
468
|
+
assert.deepEqual(worker?.extensions, [path.join(dir, ".selesai", "agents", "extension-one.ts"), path.join(dir, ".selesai", "agents", "extension-two.ts")]);
|
|
469
|
+
assert.deepEqual(worker?.subagentOnlyExtensions, [path.join(dir, ".selesai", "agents", "child-only.ts"), path.join(dir, ".selesai", "agents", "child-helper.ts")]);
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
it("preserves MCP-only tools as an explicit empty builtin allowlist", () => {
|
|
473
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-mcp-only-frontmatter-"));
|
|
474
|
+
tempDirs.push(dir);
|
|
475
|
+
writeAgent(path.join(dir, ".selesai", "agents", "mcp-only.md"), `---
|
|
476
|
+
name: mcp-only
|
|
477
|
+
description: MCP only
|
|
478
|
+
tools: mcp:github/search_repositories
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
Do MCP work
|
|
482
|
+
`);
|
|
483
|
+
|
|
484
|
+
const agent = discoverAgents(dir, "project").agents.find((candidate) => candidate.name === "mcp-only");
|
|
485
|
+
assert.deepEqual(agent?.tools, []);
|
|
486
|
+
assert.deepEqual(agent?.mcpDirectTools, ["github/search_repositories"]);
|
|
487
|
+
assert.match(serializeAgent(agent!), /^tools: mcp:github\/search_repositories$/m);
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
it("preserves comma-separated syntax across all list fields", () => {
|
|
491
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-comma-list-frontmatter-"));
|
|
492
|
+
tempDirs.push(dir);
|
|
493
|
+
writeAgent(path.join(dir, ".selesai", "agents", "worker.md"), `---
|
|
494
|
+
name: worker
|
|
495
|
+
description: Worker
|
|
496
|
+
tools: read-only, mcp:github/search_repositories
|
|
497
|
+
defaultReads: input-one.md, input-two.md
|
|
498
|
+
skills: review-checklist, safe-bash
|
|
499
|
+
skillPath: ./private-skills, ../shared-skills
|
|
500
|
+
fallbackModels: openai/gpt-5-mini, anthropic/claude-sonnet-4
|
|
501
|
+
extensions: ./extension-one.ts, ./extension-two.ts
|
|
502
|
+
subagentOnlyExtensions: ./child-only.ts, ./child-helper.ts
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
Do work
|
|
506
|
+
`);
|
|
507
|
+
|
|
508
|
+
const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
|
|
509
|
+
assert.deepEqual(worker?.tools, ["read-only"]);
|
|
510
|
+
assert.deepEqual(worker?.mcpDirectTools, ["github/search_repositories"]);
|
|
511
|
+
assert.deepEqual(worker?.defaultReads, ["input-one.md", "input-two.md"]);
|
|
512
|
+
assert.deepEqual(worker?.skills, ["review-checklist", "safe-bash"]);
|
|
513
|
+
assert.deepEqual(worker?.skillPath, ["./private-skills", "../shared-skills"]);
|
|
514
|
+
assert.deepEqual(worker?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
|
|
515
|
+
assert.deepEqual(worker?.extensions, [path.join(dir, ".selesai", "agents", "extension-one.ts"), path.join(dir, ".selesai", "agents", "extension-two.ts")]);
|
|
516
|
+
assert.deepEqual(worker?.subagentOnlyExtensions, [path.join(dir, ".selesai", "agents", "child-only.ts"), path.join(dir, ".selesai", "agents", "child-helper.ts")]);
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
it("discovers and serializes excludeTools without validating names", () => {
|
|
520
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-exclude-tools-frontmatter-"));
|
|
521
|
+
tempDirs.push(dir);
|
|
522
|
+
const agentPath = path.join(dir, ".selesai", "agents", "worker.md");
|
|
523
|
+
writeAgent(agentPath, `---
|
|
524
|
+
name: worker
|
|
525
|
+
description: Worker
|
|
526
|
+
excludeTools:
|
|
527
|
+
- write
|
|
528
|
+
- made-up-tool
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
Do work
|
|
532
|
+
`);
|
|
533
|
+
|
|
534
|
+
const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
|
|
535
|
+
assert.deepEqual(worker?.excludeTools, ["write", "made-up-tool"]);
|
|
536
|
+
assert.match(serializeAgent(worker!), /^excludeTools: write, made-up-tool$/m);
|
|
537
|
+
});
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
describe("agent permission frontmatter", () => {
|
|
541
|
+
it("parses and preserves explicit non-bash permission rules", () => {
|
|
542
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-permission-frontmatter-"));
|
|
543
|
+
tempDirs.push(dir);
|
|
544
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
545
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
546
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
547
|
+
name: worker
|
|
548
|
+
description: Worker
|
|
549
|
+
tools: bash,read,write
|
|
550
|
+
permission:
|
|
551
|
+
read: allow
|
|
552
|
+
write: ask
|
|
553
|
+
edit: deny
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
Do work
|
|
557
|
+
`, "utf-8");
|
|
558
|
+
|
|
559
|
+
const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
|
|
560
|
+
assert.deepEqual(worker?.permissions, { read: "allow", write: "ask", edit: "deny" });
|
|
561
|
+
assert.equal(worker?.extraFields?.permission, undefined);
|
|
562
|
+
assert.match(serializeAgent(worker!), /^permissions:\n read: allow\n write: ask\n edit: deny$/m);
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
it("rejects bash permission rules and conflicting aliases", () => {
|
|
566
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-permission-invalid-"));
|
|
567
|
+
tempDirs.push(dir);
|
|
568
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
569
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
570
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---\nname: worker\ndescription: Worker\npermission:\n bash: deny\n---\n`, "utf-8");
|
|
571
|
+
assert.match(discoverAgents(dir, "project").agentDiagnostics?.[0]?.error ?? "", /pi-guard/);
|
|
572
|
+
|
|
573
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---\nname: worker\ndescription: Worker\npermission:\n write: ask\npermissions:\n edit: deny\n---\n`, "utf-8");
|
|
574
|
+
assert.match(discoverAgents(dir, "project").agentDiagnostics?.[0]?.error ?? "", /cannot declare both permission and permissions/);
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
describe("agent frontmatter defaultContext", () => {
|
|
579
|
+
it("serializes defaultContext into agent frontmatter", () => {
|
|
580
|
+
const agent: AgentConfig = {
|
|
581
|
+
name: "worker",
|
|
582
|
+
description: "Worker",
|
|
583
|
+
systemPrompt: "Do work",
|
|
584
|
+
systemPromptMode: "replace",
|
|
585
|
+
inheritProjectContext: true,
|
|
586
|
+
inheritSkills: false,
|
|
587
|
+
source: "project",
|
|
588
|
+
filePath: "/tmp/worker.md",
|
|
589
|
+
defaultContext: "fork",
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
const serialized = serializeAgent(agent);
|
|
593
|
+
assert.match(serialized, /defaultContext: fork/);
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
it("parses defaultContext from discovered agent frontmatter", () => {
|
|
597
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-default-context-"));
|
|
598
|
+
tempDirs.push(dir);
|
|
599
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
600
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
601
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
602
|
+
name: worker
|
|
603
|
+
description: Worker
|
|
604
|
+
defaultContext: fork
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
Do work
|
|
608
|
+
`, "utf-8");
|
|
609
|
+
|
|
610
|
+
const result = discoverAgents(dir, "project");
|
|
611
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
612
|
+
assert.equal(worker?.defaultContext, "fork");
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
it("loads packaged worker and oracle with fork defaultContext and advisor alias", () => {
|
|
616
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-default-context-"));
|
|
617
|
+
tempDirs.push(dir);
|
|
618
|
+
const agents = discoverAgentsAll(dir).builtin;
|
|
619
|
+
|
|
620
|
+
for (const name of ["worker", "oracle"]) {
|
|
621
|
+
const agent = agents.find((candidate) => candidate.name === name);
|
|
622
|
+
assert.equal(agent?.defaultContext, "fork", `${name} should default to fork context`);
|
|
623
|
+
}
|
|
624
|
+
const oracle = agents.find((candidate) => candidate.name === "oracle");
|
|
625
|
+
assert.deepEqual(oracle?.aliases, ["advisor"]);
|
|
626
|
+
assert.doesNotMatch(oracle?.tools?.join(",") ?? "", /contact_supervisor/);
|
|
627
|
+
for (const name of ["scout", "researcher", "oracle", "reviewer"]) {
|
|
628
|
+
assert.equal(agents.find((candidate) => candidate.name === name)?.tools?.includes("intercom"), false, `${name} should not require generic intercom`);
|
|
629
|
+
}
|
|
630
|
+
assert.match(oracle?.systemPrompt ?? "", /asking or consulting the oracle/);
|
|
631
|
+
assert.match(oracle?.systemPrompt ?? "", /When runtime bridge instructions provide `contact_supervisor`/);
|
|
632
|
+
assert.match(oracle?.systemPrompt ?? "", /If no supervisor channel is available/);
|
|
633
|
+
assert.equal(agents.some((candidate) => candidate.name === "planner"), false);
|
|
634
|
+
assert.equal(agents.some((candidate) => candidate.name === "context-builder"), false);
|
|
635
|
+
assert.equal(agents.some((candidate) => candidate.name === "gpt-pro"), false);
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
it("keeps bundled agent definitions from module load during package file updates", () => {
|
|
639
|
+
const fixture = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-hot-update-"));
|
|
640
|
+
tempDirs.push(fixture);
|
|
641
|
+
fs.cpSync(path.join(process.cwd(), "src"), path.join(fixture, "src"), { recursive: true });
|
|
642
|
+
fs.cpSync(path.join(process.cwd(), "agents"), path.join(fixture, "agents"), { recursive: true });
|
|
643
|
+
fs.symlinkSync(path.join(process.cwd(), "node_modules"), path.join(fixture, "node_modules"), process.platform === "win32" ? "junction" : "dir");
|
|
644
|
+
writeJson(path.join(fixture, "package.json"), { type: "module" });
|
|
645
|
+
writeAgent(path.join(fixture, "challenge.mjs"), `
|
|
646
|
+
import assert from "node:assert/strict";
|
|
647
|
+
import * as fs from "node:fs";
|
|
648
|
+
import * as path from "node:path";
|
|
649
|
+
import { discoverAgentsAll } from "./src/agents/agents.ts";
|
|
650
|
+
|
|
651
|
+
const scoutPath = path.join(process.cwd(), "agents", "scout.md");
|
|
652
|
+
fs.writeFileSync(scoutPath, \`---
|
|
653
|
+
name: scout
|
|
654
|
+
description: Future scout
|
|
655
|
+
runner:
|
|
656
|
+
type: future-runner
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
Review with the future runner.
|
|
660
|
+
\`, "utf-8");
|
|
661
|
+
|
|
662
|
+
const discovered = discoverAgentsAll(process.cwd());
|
|
663
|
+
const scout = discovered.builtin.find((candidate) => candidate.name === "scout");
|
|
664
|
+
|
|
665
|
+
assert.equal(scout?.runner, undefined);
|
|
666
|
+
assert.equal(discovered.agentDiagnostics?.some((diagnostic) => diagnostic.filePath === scoutPath), false);
|
|
667
|
+
`);
|
|
668
|
+
|
|
669
|
+
execFileSync(process.execPath, ["--experimental-strip-types", "challenge.mjs"], { cwd: fixture, stdio: "pipe" });
|
|
670
|
+
});
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
describe("agent frontmatter launch defaults", () => {
|
|
674
|
+
it("parses, serializes, and validates outputMode defaults", () => {
|
|
675
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-output-mode-"));
|
|
676
|
+
tempDirs.push(dir);
|
|
677
|
+
const filePath = path.join(dir, ".selesai", "agents", "worker.md");
|
|
678
|
+
writeAgent(filePath, `---
|
|
679
|
+
name: worker
|
|
680
|
+
description: Worker
|
|
681
|
+
outputMode: file-only
|
|
682
|
+
---
|
|
683
|
+
|
|
684
|
+
Do work
|
|
685
|
+
`);
|
|
686
|
+
|
|
687
|
+
const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
|
|
688
|
+
assert.equal(worker?.outputMode, "file-only");
|
|
689
|
+
assert.match(serializeAgent(worker!), /^outputMode: file-only$/m);
|
|
690
|
+
|
|
691
|
+
writeAgent(filePath, `---
|
|
692
|
+
name: worker
|
|
693
|
+
description: Worker
|
|
694
|
+
outputMode: artifact-only
|
|
695
|
+
---
|
|
696
|
+
|
|
697
|
+
Do work
|
|
698
|
+
`);
|
|
699
|
+
assert.match(discoverAgents(dir, "project").agentDiagnostics?.[0]?.error ?? "", /Agent 'worker' has invalid outputMode frontmatter; expected 'inline' or 'file-only'/);
|
|
700
|
+
});
|
|
701
|
+
|
|
702
|
+
it("serializes and discovers single-agent launch defaults", () => {
|
|
703
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-launch-defaults-"));
|
|
704
|
+
tempDirs.push(dir);
|
|
705
|
+
const filePath = path.join(dir, ".selesai", "agents", "worker.md");
|
|
706
|
+
const agent: AgentConfig = {
|
|
707
|
+
name: "worker",
|
|
708
|
+
description: "Worker",
|
|
709
|
+
systemPrompt: "Do work",
|
|
710
|
+
systemPromptMode: "replace",
|
|
711
|
+
inheritProjectContext: false,
|
|
712
|
+
inheritSkills: false,
|
|
713
|
+
source: "project",
|
|
714
|
+
filePath,
|
|
715
|
+
defaultAsync: false,
|
|
716
|
+
defaultTimeoutMs: 90_000,
|
|
717
|
+
defaultToolTimeoutMs: 600_000,
|
|
718
|
+
defaultAcceptance: { level: "none", reason: "lightweight lookup" },
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
const serialized = serializeAgent(agent);
|
|
722
|
+
assert.match(serialized, /^async: false$/m);
|
|
723
|
+
assert.match(serialized, /^timeoutMs: 90000$/m);
|
|
724
|
+
assert.match(serialized, /^toolTimeoutMs: 600000$/m);
|
|
725
|
+
assert.match(serialized, /^acceptance: \{"level":"none","reason":"lightweight lookup"\}$/m);
|
|
726
|
+
writeAgent(filePath, serialized);
|
|
727
|
+
|
|
728
|
+
const worker = discoverAgents(dir, "project").agents.find((candidate) => candidate.name === "worker");
|
|
729
|
+
assert.equal(worker?.defaultAsync, false);
|
|
730
|
+
assert.equal(worker?.defaultTimeoutMs, 90_000);
|
|
731
|
+
assert.equal(worker?.defaultToolTimeoutMs, 600_000);
|
|
732
|
+
assert.deepEqual(worker?.defaultAcceptance, { level: "none", reason: "lightweight lookup" });
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
it("parses scalar acceptance defaults and rejects invalid policies", () => {
|
|
736
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-acceptance-defaults-"));
|
|
737
|
+
tempDirs.push(dir);
|
|
738
|
+
const filePath = path.join(dir, ".selesai", "agents", "worker.md");
|
|
739
|
+
writeAgent(filePath, `---
|
|
740
|
+
name: worker
|
|
741
|
+
description: Worker
|
|
742
|
+
acceptance: checked
|
|
743
|
+
---
|
|
744
|
+
|
|
745
|
+
Do work
|
|
746
|
+
`);
|
|
747
|
+
assert.equal(discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker")?.defaultAcceptance, "checked");
|
|
748
|
+
|
|
749
|
+
writeAgent(filePath, `---
|
|
750
|
+
name: worker
|
|
751
|
+
description: Worker
|
|
752
|
+
acceptance: { level: "none", reason: "NA" }
|
|
753
|
+
---
|
|
754
|
+
|
|
755
|
+
Do work
|
|
756
|
+
`);
|
|
757
|
+
assert.deepEqual(
|
|
758
|
+
discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker")?.defaultAcceptance,
|
|
759
|
+
{ level: "none", reason: "NA" },
|
|
760
|
+
);
|
|
761
|
+
|
|
762
|
+
writeAgent(filePath, `---
|
|
763
|
+
name: worker
|
|
764
|
+
description: Worker
|
|
765
|
+
acceptance: none
|
|
766
|
+
---
|
|
767
|
+
|
|
768
|
+
Do work
|
|
769
|
+
`);
|
|
770
|
+
assert.match(discoverAgents(dir, "project").agentDiagnostics?.[0]?.error ?? "", /Agent 'worker' acceptance frontmatter level "none" requires a reason/);
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
it("parses, serializes, and validates acceptance roles", () => {
|
|
774
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-acceptance-role-"));
|
|
775
|
+
tempDirs.push(dir);
|
|
776
|
+
const filePath = path.join(dir, ".selesai", "agents", "explorer.md");
|
|
777
|
+
writeAgent(filePath, `---
|
|
778
|
+
name: explorer
|
|
779
|
+
description: Explorer
|
|
780
|
+
acceptanceRole: read-only
|
|
781
|
+
---
|
|
782
|
+
|
|
783
|
+
Explore the codebase
|
|
784
|
+
`);
|
|
785
|
+
|
|
786
|
+
const explorer = discoverAgents(dir, "project").agents.find((agent) => agent.name === "explorer");
|
|
787
|
+
assert.equal(explorer?.acceptanceRole, "read-only");
|
|
788
|
+
assert.match(serializeAgent(explorer!), /^acceptanceRole: read-only$/m);
|
|
789
|
+
assert.equal(explorer?.extraFields?.acceptanceRole, undefined);
|
|
790
|
+
|
|
791
|
+
writeAgent(filePath, `---
|
|
792
|
+
name: explorer
|
|
793
|
+
description: Explorer
|
|
794
|
+
acceptanceRole: observer
|
|
795
|
+
---
|
|
796
|
+
|
|
797
|
+
Explore the codebase
|
|
798
|
+
`);
|
|
799
|
+
assert.match(discoverAgents(dir, "project").agentDiagnostics?.[0]?.error ?? "", /Agent 'explorer' has invalid acceptanceRole frontmatter; expected 'read-only' or 'writer'/);
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
it("rejects invalid launch defaults instead of silently ignoring them", () => {
|
|
803
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-invalid-launch-defaults-"));
|
|
804
|
+
tempDirs.push(dir);
|
|
805
|
+
writeAgent(path.join(dir, ".selesai", "agents", "worker.md"), `---
|
|
806
|
+
name: worker
|
|
807
|
+
description: Worker
|
|
808
|
+
async: sometimes
|
|
809
|
+
---
|
|
810
|
+
|
|
811
|
+
Do work
|
|
812
|
+
`);
|
|
813
|
+
|
|
814
|
+
assert.match(discoverAgents(dir, "project").agentDiagnostics?.[0]?.error ?? "", /Agent 'worker' has invalid async frontmatter; expected true or false/);
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
it("rejects oversized toolTimeoutMs frontmatter at discovery", () => {
|
|
818
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-oversized-tool-timeout-"));
|
|
819
|
+
tempDirs.push(dir);
|
|
820
|
+
writeAgent(path.join(dir, ".selesai", "agents", "worker.md"), `---
|
|
821
|
+
name: worker
|
|
822
|
+
description: Worker
|
|
823
|
+
toolTimeoutMs: 2147483648
|
|
824
|
+
---
|
|
825
|
+
|
|
826
|
+
Do work
|
|
827
|
+
`);
|
|
828
|
+
|
|
829
|
+
assert.match(discoverAgents(dir, "project").agentDiagnostics?.[0]?.error ?? "", /Agent 'worker' has invalid toolTimeoutMs frontmatter; expected a positive integer no larger than 2147483647/);
|
|
830
|
+
});
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
describe("chain discovery", () => {
|
|
834
|
+
it("prefers same-scope .chain.json over .chain.md for the same runtime name", () => {
|
|
835
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-chain-format-precedence-"));
|
|
836
|
+
tempDirs.push(dir);
|
|
837
|
+
const chainsDir = path.join(dir, ".selesai", "chains");
|
|
838
|
+
fs.mkdirSync(chainsDir, { recursive: true });
|
|
839
|
+
fs.writeFileSync(path.join(chainsDir, "dynamic-review.chain.md"), `---
|
|
840
|
+
name: dynamic-review
|
|
841
|
+
description: Markdown fallback
|
|
842
|
+
---
|
|
843
|
+
|
|
844
|
+
## scout
|
|
845
|
+
|
|
846
|
+
Run the markdown chain
|
|
847
|
+
`, "utf-8");
|
|
848
|
+
fs.writeFileSync(path.join(chainsDir, "dynamic-review.chain.json"), JSON.stringify({
|
|
849
|
+
name: "dynamic-review",
|
|
850
|
+
description: "JSON dynamic chain",
|
|
851
|
+
chain: [
|
|
852
|
+
{
|
|
853
|
+
agent: "scout",
|
|
854
|
+
task: "Return targets",
|
|
855
|
+
as: "targets",
|
|
856
|
+
outputSchema: { type: "object" },
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
expand: { from: { output: "targets", path: "/items" }, maxItems: 4 },
|
|
860
|
+
parallel: { agent: "reviewer", task: "Review {item.path}" },
|
|
861
|
+
collect: { as: "reviews" },
|
|
862
|
+
},
|
|
863
|
+
],
|
|
864
|
+
}), "utf-8");
|
|
865
|
+
|
|
866
|
+
const result = discoverAgentsAll(dir);
|
|
867
|
+
const chain = result.chains.find((candidate) => candidate.name === "dynamic-review");
|
|
868
|
+
assert.equal(chain?.description, "JSON dynamic chain");
|
|
869
|
+
assert.equal(chain?.filePath.endsWith(".chain.json"), true);
|
|
870
|
+
assert.equal("expand" in (chain?.steps[1] ?? {}), true);
|
|
871
|
+
});
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
describe("package-provided agents and chains", () => {
|
|
875
|
+
it("discovers package agents and chains from installed package manifests", () => withTempHome(() => {
|
|
876
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-package-discovery-"));
|
|
877
|
+
tempDirs.push(dir);
|
|
878
|
+
const workflowRoot = path.join(dir, ".selesai", "npm", "node_modules", "my-pi-workflow");
|
|
879
|
+
const chainsRoot = path.join(dir, ".selesai", "npm", "node_modules", "@scope", "chain-workflow");
|
|
880
|
+
writeJson(path.join(workflowRoot, "package.json"), {
|
|
881
|
+
name: "my-pi-workflow",
|
|
882
|
+
version: "1.2.3",
|
|
883
|
+
"pi-subagents": {
|
|
884
|
+
agents: ["./agents"],
|
|
885
|
+
},
|
|
886
|
+
});
|
|
887
|
+
writeAgent(path.join(workflowRoot, "agents", "reviewer.md"), `---
|
|
888
|
+
name: reviewer
|
|
889
|
+
package: my-workflow
|
|
890
|
+
description: Review changes for this workflow.
|
|
891
|
+
---
|
|
892
|
+
|
|
893
|
+
Review the workflow.
|
|
894
|
+
`);
|
|
895
|
+
writeJson(path.join(chainsRoot, "package.json"), {
|
|
896
|
+
name: "@scope/chain-workflow",
|
|
897
|
+
pi: {
|
|
898
|
+
subagents: {
|
|
899
|
+
chains: ["./chains"],
|
|
900
|
+
},
|
|
901
|
+
},
|
|
902
|
+
});
|
|
903
|
+
writeAgent(path.join(chainsRoot, "chains", "review.chain.md"), `---
|
|
904
|
+
name: review
|
|
905
|
+
package: my-workflow
|
|
906
|
+
description: Run workflow review.
|
|
907
|
+
---
|
|
908
|
+
|
|
909
|
+
## my-workflow.reviewer
|
|
910
|
+
|
|
911
|
+
Review the task.
|
|
912
|
+
`);
|
|
913
|
+
|
|
914
|
+
const all = discoverAgentsAll(dir);
|
|
915
|
+
const packagedAgent = all.package.find((agent) => agent.name === "my-workflow.reviewer");
|
|
916
|
+
assert.ok(packagedAgent);
|
|
917
|
+
assert.equal(packagedAgent.source, "package");
|
|
918
|
+
assert.equal(packagedAgent.packageName, "my-workflow");
|
|
919
|
+
assert.equal(packagedAgent.packageSourceName, "my-pi-workflow");
|
|
920
|
+
assert.equal(packagedAgent.packageSourceVersion, "1.2.3");
|
|
921
|
+
assert.equal(packagedAgent.packageSourceRoot, workflowRoot);
|
|
922
|
+
assert.equal(packagedAgent.filePath, path.join(workflowRoot, "agents", "reviewer.md"));
|
|
923
|
+
assert.equal(discoverAgents(dir, "both").agents.find((agent) => agent.name === "my-workflow.reviewer")?.source, "package");
|
|
924
|
+
|
|
925
|
+
const packagedChain = all.chains.find((chain) => chain.name === "my-workflow.review");
|
|
926
|
+
assert.ok(packagedChain);
|
|
927
|
+
assert.equal(packagedChain.source, "package");
|
|
928
|
+
assert.equal(packagedChain.steps[0]?.agent, "my-workflow.reviewer");
|
|
929
|
+
}));
|
|
930
|
+
|
|
931
|
+
it("loads packages referenced from Pi settings", () => withTempHome(() => {
|
|
932
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-settings-package-"));
|
|
933
|
+
tempDirs.push(dir);
|
|
934
|
+
const packageRoot = path.join(dir, ".selesai", "vendor", "workflow");
|
|
935
|
+
writeJson(path.join(dir, ".selesai", "settings.json"), {
|
|
936
|
+
packages: [{ source: "file:./vendor/workflow" }],
|
|
937
|
+
});
|
|
938
|
+
writeJson(path.join(packageRoot, "package.json"), {
|
|
939
|
+
name: "settings-workflow",
|
|
940
|
+
pi: {
|
|
941
|
+
subagents: {
|
|
942
|
+
agents: ["./agents"],
|
|
943
|
+
},
|
|
944
|
+
},
|
|
945
|
+
});
|
|
946
|
+
writeAgent(path.join(packageRoot, "agents", "planner.md"), `---
|
|
947
|
+
name: planner
|
|
948
|
+
package: settings-workflow
|
|
949
|
+
description: Plan from a settings-installed package.
|
|
950
|
+
---
|
|
951
|
+
|
|
952
|
+
Plan the work.
|
|
953
|
+
`);
|
|
954
|
+
|
|
955
|
+
const agent = discoverAgents(dir, "both").agents.find((candidate) => candidate.name === "settings-workflow.planner");
|
|
956
|
+
assert.ok(agent);
|
|
957
|
+
assert.equal(agent.source, "package");
|
|
958
|
+
}));
|
|
959
|
+
|
|
960
|
+
it("loads bare HTTPS git packages from project Pi settings", () => withTempHome(() => {
|
|
961
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-settings-bare-git-package-"));
|
|
962
|
+
tempDirs.push(dir);
|
|
963
|
+
const packageRoot = path.join(dir, ".selesai", "git", "github.com", "user", "repo");
|
|
964
|
+
writeJson(path.join(dir, ".selesai", "settings.json"), {
|
|
965
|
+
packages: ["https://github.com/user/repo.git"],
|
|
966
|
+
});
|
|
967
|
+
writeJson(path.join(packageRoot, "package.json"), {
|
|
968
|
+
name: "bare-git-workflow",
|
|
969
|
+
"pi-subagents": { agents: ["./agents"] },
|
|
970
|
+
});
|
|
971
|
+
writeAgent(path.join(packageRoot, "agents", "planner.md"), `---
|
|
972
|
+
name: planner
|
|
973
|
+
package: bare-git-workflow
|
|
974
|
+
description: Plan from a bare HTTPS git package.
|
|
975
|
+
---
|
|
976
|
+
|
|
977
|
+
Plan the work.
|
|
978
|
+
`);
|
|
979
|
+
|
|
980
|
+
const agent = discoverAgents(dir, "both").agents.find((candidate) => candidate.name === "bare-git-workflow.planner");
|
|
981
|
+
assert.ok(agent);
|
|
982
|
+
assert.equal(agent.source, "package");
|
|
983
|
+
assert.equal(agent.packageSourceRoot, packageRoot);
|
|
984
|
+
}));
|
|
985
|
+
|
|
986
|
+
it("loads bare HTTP git packages from user Pi settings", () => withTempHome((home) => {
|
|
987
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-user-settings-bare-git-package-"));
|
|
988
|
+
tempDirs.push(dir);
|
|
989
|
+
const agentDir = path.join(home, ".selesai", "agent");
|
|
990
|
+
const packageRoot = path.join(agentDir, "git", "git.example.com", "team", "repo");
|
|
991
|
+
writeJson(path.join(agentDir, "settings.json"), {
|
|
992
|
+
packages: ["http://git.example.com/team/repo.git"],
|
|
993
|
+
});
|
|
994
|
+
writeJson(path.join(packageRoot, "package.json"), {
|
|
995
|
+
name: "user-bare-git-workflow",
|
|
996
|
+
"pi-subagents": { agents: ["./agents"] },
|
|
997
|
+
});
|
|
998
|
+
writeAgent(path.join(packageRoot, "agents", "reviewer.md"), `---
|
|
999
|
+
name: reviewer
|
|
1000
|
+
package: user-bare-git-workflow
|
|
1001
|
+
description: Review from a bare HTTP git package.
|
|
1002
|
+
---
|
|
1003
|
+
|
|
1004
|
+
Review the work.
|
|
1005
|
+
`);
|
|
1006
|
+
|
|
1007
|
+
const agent = discoverAgents(dir, "both").agents.find((candidate) => candidate.name === "user-bare-git-workflow.reviewer");
|
|
1008
|
+
assert.ok(agent);
|
|
1009
|
+
assert.equal(agent.source, "package");
|
|
1010
|
+
assert.equal(agent.packageSourceRoot, packageRoot);
|
|
1011
|
+
}));
|
|
1012
|
+
|
|
1013
|
+
it("discovers project package agents when cwd is nested below the project root", () => withTempHome(() => {
|
|
1014
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-nested-package-discovery-"));
|
|
1015
|
+
tempDirs.push(dir);
|
|
1016
|
+
const nested = path.join(dir, "packages", "app", "src");
|
|
1017
|
+
const packageRoot = path.join(dir, ".selesai", "npm", "node_modules", "nested-workflow");
|
|
1018
|
+
fs.mkdirSync(nested, { recursive: true });
|
|
1019
|
+
writeJson(path.join(packageRoot, "package.json"), {
|
|
1020
|
+
name: "nested-workflow",
|
|
1021
|
+
"pi-subagents": {
|
|
1022
|
+
agents: ["./agents"],
|
|
1023
|
+
},
|
|
1024
|
+
});
|
|
1025
|
+
writeAgent(path.join(packageRoot, "agents", "reviewer.md"), `---
|
|
1026
|
+
name: reviewer
|
|
1027
|
+
package: nested-workflow
|
|
1028
|
+
description: Review from a project package.
|
|
1029
|
+
---
|
|
1030
|
+
|
|
1031
|
+
Review nested project work.
|
|
1032
|
+
`);
|
|
1033
|
+
|
|
1034
|
+
const agent = discoverAgents(nested, "both").agents.find((candidate) => candidate.name === "nested-workflow.reviewer");
|
|
1035
|
+
assert.ok(agent);
|
|
1036
|
+
assert.equal(agent.source, "package");
|
|
1037
|
+
assert.equal(agent.filePath, path.join(packageRoot, "agents", "reviewer.md"));
|
|
1038
|
+
}));
|
|
1039
|
+
|
|
1040
|
+
it("keeps nearest project root discovery by default when a nested .selesai exists", () => withTempHome(() => {
|
|
1041
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-nearest-root-default-"));
|
|
1042
|
+
tempDirs.push(dir);
|
|
1043
|
+
const nested = path.join(dir, "packages", "app", "src");
|
|
1044
|
+
const nestedConfigDir = path.join(dir, "packages", "app", ".selesai");
|
|
1045
|
+
const packageRoot = path.join(dir, ".selesai", "npm", "node_modules", "outer-workflow");
|
|
1046
|
+
fs.mkdirSync(nested, { recursive: true });
|
|
1047
|
+
fs.mkdirSync(nestedConfigDir, { recursive: true });
|
|
1048
|
+
fs.mkdirSync(path.join(dir, ".git"), { recursive: true });
|
|
1049
|
+
writeJson(path.join(packageRoot, "package.json"), {
|
|
1050
|
+
name: "outer-workflow",
|
|
1051
|
+
"pi-subagents": { agents: ["./agents"] },
|
|
1052
|
+
});
|
|
1053
|
+
writeAgent(path.join(packageRoot, "agents", "planner.md"), `---
|
|
1054
|
+
name: planner
|
|
1055
|
+
package: outer-workflow
|
|
1056
|
+
description: Plan from the outer project package.
|
|
1057
|
+
---
|
|
1058
|
+
|
|
1059
|
+
Plan outer project work.
|
|
1060
|
+
`);
|
|
1061
|
+
|
|
1062
|
+
const agent = discoverAgents(nested, "both").agents.find((candidate) => candidate.name === "outer-workflow.planner");
|
|
1063
|
+
assert.equal(agent, undefined);
|
|
1064
|
+
}));
|
|
1065
|
+
|
|
1066
|
+
it("can resolve project packages and overrides from the git root", () => withTempHome(() => {
|
|
1067
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-git-root-resolution-"));
|
|
1068
|
+
tempDirs.push(dir);
|
|
1069
|
+
const nested = path.join(dir, "packages", "app", "src");
|
|
1070
|
+
const nestedConfigDir = path.join(dir, "packages", "app", ".selesai");
|
|
1071
|
+
const packageRoot = path.join(dir, ".selesai", "npm", "node_modules", "outer-workflow");
|
|
1072
|
+
fs.mkdirSync(nested, { recursive: true });
|
|
1073
|
+
fs.mkdirSync(nestedConfigDir, { recursive: true });
|
|
1074
|
+
fs.writeFileSync(path.join(dir, ".git"), "gitdir: ../.git/worktrees/app\n", "utf-8");
|
|
1075
|
+
writeJson(path.join(dir, ".selesai", "settings.json"), {
|
|
1076
|
+
subagents: {
|
|
1077
|
+
projectRootResolution: "git-root",
|
|
1078
|
+
agentOverrides: {
|
|
1079
|
+
reviewer: { model: "openai/gpt-5.4" },
|
|
1080
|
+
},
|
|
1081
|
+
},
|
|
1082
|
+
});
|
|
1083
|
+
writeJson(path.join(packageRoot, "package.json"), {
|
|
1084
|
+
name: "outer-workflow",
|
|
1085
|
+
"pi-subagents": { agents: ["./agents"] },
|
|
1086
|
+
});
|
|
1087
|
+
writeAgent(path.join(packageRoot, "agents", "planner.md"), `---
|
|
1088
|
+
name: planner
|
|
1089
|
+
package: outer-workflow
|
|
1090
|
+
description: Plan from the outer project package.
|
|
1091
|
+
---
|
|
1092
|
+
|
|
1093
|
+
Plan outer project work.
|
|
1094
|
+
`);
|
|
1095
|
+
|
|
1096
|
+
const agents = discoverAgents(nested, "both").agents;
|
|
1097
|
+
const packageAgent = agents.find((candidate) => candidate.name === "outer-workflow.planner");
|
|
1098
|
+
assert.ok(packageAgent);
|
|
1099
|
+
assert.equal(packageAgent.source, "package");
|
|
1100
|
+
assert.equal(packageAgent.filePath, path.join(packageRoot, "agents", "planner.md"));
|
|
1101
|
+
const reviewer = agents.find((candidate) => candidate.name === "reviewer");
|
|
1102
|
+
assert.equal(reviewer?.model, "openai/gpt-5.4");
|
|
1103
|
+
assert.equal(reviewer?.override?.path, path.join(dir, ".selesai", "settings.json"));
|
|
1104
|
+
}));
|
|
1105
|
+
|
|
1106
|
+
it("keeps git-root discovery stable when a nested linked worktree creates incidental .selesai state", () => withTempHome(() => {
|
|
1107
|
+
const { repo, worktree } = createNestedLinkedWorktree();
|
|
1108
|
+
const { packageAgentName, packageAgentPath, settingsPath } = writeLinkedWorktreePackage(repo);
|
|
1109
|
+
|
|
1110
|
+
const before = discoverAgents(worktree, "both").agents;
|
|
1111
|
+
const beforePackageAgent = before.find((candidate) => candidate.name === packageAgentName);
|
|
1112
|
+
assert.ok(beforePackageAgent);
|
|
1113
|
+
assert.equal(beforePackageAgent.source, "package");
|
|
1114
|
+
assert.equal(beforePackageAgent.filePath, packageAgentPath);
|
|
1115
|
+
assert.equal(before.find((candidate) => candidate.name === "reviewer")?.override?.path, settingsPath);
|
|
1116
|
+
|
|
1117
|
+
fs.mkdirSync(path.join(worktree, ".selesai", "todos"), { recursive: true });
|
|
1118
|
+
|
|
1119
|
+
const after = discoverAgents(worktree, "both").agents;
|
|
1120
|
+
const all = discoverAgentsAll(worktree);
|
|
1121
|
+
const afterPackageAgent = after.find((candidate) => candidate.name === packageAgentName);
|
|
1122
|
+
const allPackageAgent = all.package.find((candidate) => candidate.name === packageAgentName);
|
|
1123
|
+
assert.equal(afterPackageAgent?.source, beforePackageAgent.source);
|
|
1124
|
+
assert.equal(afterPackageAgent?.filePath, beforePackageAgent.filePath);
|
|
1125
|
+
assert.equal(allPackageAgent?.filePath, afterPackageAgent.filePath);
|
|
1126
|
+
assert.equal(all.projectSettingsPath, settingsPath);
|
|
1127
|
+
assert.equal(after.find((candidate) => candidate.name === "reviewer")?.override?.path, all.projectSettingsPath);
|
|
1128
|
+
}));
|
|
1129
|
+
|
|
1130
|
+
it("lets a linked worktree opt back into nearest-root discovery", () => withTempHome(() => {
|
|
1131
|
+
const { repo, worktree } = createNestedLinkedWorktree();
|
|
1132
|
+
const { packageAgentName } = writeLinkedWorktreePackage(repo);
|
|
1133
|
+
const worktreeSettingsPath = path.join(worktree, ".selesai", "settings.json");
|
|
1134
|
+
writeJson(worktreeSettingsPath, {
|
|
1135
|
+
subagents: {
|
|
1136
|
+
projectRootResolution: "nearest",
|
|
1137
|
+
agentOverrides: {
|
|
1138
|
+
reviewer: { model: "issue950/worktree-model" },
|
|
1139
|
+
},
|
|
1140
|
+
},
|
|
1141
|
+
});
|
|
1142
|
+
|
|
1143
|
+
const discovered = discoverAgents(worktree, "both").agents;
|
|
1144
|
+
const all = discoverAgentsAll(worktree);
|
|
1145
|
+
assert.equal(discovered.find((candidate) => candidate.name === packageAgentName), undefined);
|
|
1146
|
+
assert.equal(all.package.find((candidate) => candidate.name === packageAgentName), undefined);
|
|
1147
|
+
assert.equal(discovered.find((candidate) => candidate.name === "reviewer")?.model, "issue950/worktree-model");
|
|
1148
|
+
assert.equal(all.projectSettingsPath, worktreeSettingsPath);
|
|
1149
|
+
}));
|
|
1150
|
+
|
|
1151
|
+
it("does not register legacy skill files from broad package agent roots", () => withTempHome(() => {
|
|
1152
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-broad-package-skills-"));
|
|
1153
|
+
tempDirs.push(dir);
|
|
1154
|
+
const packageRoot = path.join(dir, ".selesai", "npm", "node_modules", "broad-workflow");
|
|
1155
|
+
writeJson(path.join(packageRoot, "package.json"), {
|
|
1156
|
+
name: "broad-workflow",
|
|
1157
|
+
"pi-subagents": {
|
|
1158
|
+
agents: ["."],
|
|
1159
|
+
},
|
|
1160
|
+
});
|
|
1161
|
+
writeAgent(path.join(packageRoot, "agent.md"), `---
|
|
1162
|
+
name: package-agent
|
|
1163
|
+
description: Package agent
|
|
1164
|
+
---
|
|
1165
|
+
|
|
1166
|
+
Package prompt
|
|
1167
|
+
`);
|
|
1168
|
+
writeAgent(path.join(packageRoot, ".agents", "skills", "package-skill", "SKILL.md"), `---
|
|
1169
|
+
name: package-skill
|
|
1170
|
+
description: Package skill
|
|
1171
|
+
---
|
|
1172
|
+
|
|
1173
|
+
Skill prompt
|
|
1174
|
+
`);
|
|
1175
|
+
writeAgent(path.join(packageRoot, "agents", "SKILL.md"), `---
|
|
1176
|
+
name: skill-named-package-agent
|
|
1177
|
+
description: Skill-named package agent
|
|
1178
|
+
---
|
|
1179
|
+
|
|
1180
|
+
Agent prompt
|
|
1181
|
+
`);
|
|
1182
|
+
|
|
1183
|
+
const packageAgents = discoverAgentsAll(dir).package;
|
|
1184
|
+
assert.ok(packageAgents.find((agent) => agent.name === "package-agent" && agent.filePath === path.join(packageRoot, "agent.md")));
|
|
1185
|
+
assert.ok(packageAgents.find((agent) => agent.name === "skill-named-package-agent" && agent.filePath === path.join(packageRoot, "agents", "SKILL.md")));
|
|
1186
|
+
assert.equal(packageAgents.some((agent) => agent.filePath.includes(`${path.sep}.agents${path.sep}skills${path.sep}`)), false);
|
|
1187
|
+
assert.equal(packageAgents.some((agent) => agent.name === "package-skill"), false);
|
|
1188
|
+
}));
|
|
1189
|
+
|
|
1190
|
+
it("prunes repo internals and nested project roots from broad package discovery", () => withTempHome(() => {
|
|
1191
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-broad-package-prune-"));
|
|
1192
|
+
tempDirs.push(dir);
|
|
1193
|
+
writeJson(path.join(dir, "package.json"), {
|
|
1194
|
+
name: "repo-root-workflow",
|
|
1195
|
+
pi: {
|
|
1196
|
+
subagents: {
|
|
1197
|
+
agents: ["."],
|
|
1198
|
+
chains: ["."],
|
|
1199
|
+
},
|
|
1200
|
+
},
|
|
1201
|
+
});
|
|
1202
|
+
writeAgent(path.join(dir, "root-agent.md"), `---
|
|
1203
|
+
name: root-agent
|
|
1204
|
+
description: Root package agent
|
|
1205
|
+
---
|
|
1206
|
+
|
|
1207
|
+
Root prompt
|
|
1208
|
+
`);
|
|
1209
|
+
writeAgent(path.join(dir, "root.chain.md"), `---
|
|
1210
|
+
name: root-chain
|
|
1211
|
+
description: Root package chain
|
|
1212
|
+
---
|
|
1213
|
+
|
|
1214
|
+
## root-agent
|
|
1215
|
+
|
|
1216
|
+
Run root agent
|
|
1217
|
+
`);
|
|
1218
|
+
writeAgent(path.join(dir, "node_modules", "bad-agent.md"), `---
|
|
1219
|
+
name: node-modules-agent
|
|
1220
|
+
description: Should not be discovered
|
|
1221
|
+
---
|
|
1222
|
+
|
|
1223
|
+
Ignored
|
|
1224
|
+
`);
|
|
1225
|
+
writeAgent(path.join(dir, ".git", "hooks", "bad-agent.md"), `---
|
|
1226
|
+
name: git-agent
|
|
1227
|
+
description: Should not be discovered
|
|
1228
|
+
---
|
|
1229
|
+
|
|
1230
|
+
Ignored
|
|
1231
|
+
`);
|
|
1232
|
+
writeAgent(path.join(dir, "vendor", "submodule", "submodule-agent.md"), `---
|
|
1233
|
+
name: submodule-agent
|
|
1234
|
+
description: Should not be discovered
|
|
1235
|
+
---
|
|
1236
|
+
|
|
1237
|
+
Ignored
|
|
1238
|
+
`);
|
|
1239
|
+
fs.writeFileSync(path.join(dir, "vendor", "submodule", ".git"), "gitdir: ../.git/modules/submodule\n", "utf-8");
|
|
1240
|
+
writeAgent(path.join(dir, "packages", "app", "local-agent.md"), `---
|
|
1241
|
+
name: nested-project-agent
|
|
1242
|
+
description: Should not be discovered
|
|
1243
|
+
---
|
|
1244
|
+
|
|
1245
|
+
Ignored
|
|
1246
|
+
`);
|
|
1247
|
+
fs.mkdirSync(path.join(dir, "packages", "app", ".selesai"), { recursive: true });
|
|
1248
|
+
writeAgent(path.join(dir, "node_modules", "bad.chain.md"), `---
|
|
1249
|
+
name: node-modules-chain
|
|
1250
|
+
description: Should not be discovered
|
|
1251
|
+
---
|
|
1252
|
+
|
|
1253
|
+
## root-agent
|
|
1254
|
+
|
|
1255
|
+
Ignored
|
|
1256
|
+
`);
|
|
1257
|
+
|
|
1258
|
+
const all = discoverAgentsAll(dir);
|
|
1259
|
+
assert.ok(all.package.find((agent) => agent.name === "root-agent" && agent.filePath === path.join(dir, "root-agent.md")));
|
|
1260
|
+
for (const name of ["node-modules-agent", "git-agent", "submodule-agent", "nested-project-agent"]) {
|
|
1261
|
+
assert.equal(all.package.some((agent) => agent.name === name), false, `${name} should be pruned`);
|
|
1262
|
+
}
|
|
1263
|
+
assert.ok(all.chains.find((chain) => chain.name === "root-chain" && chain.filePath === path.join(dir, "root.chain.md")));
|
|
1264
|
+
assert.equal(all.chains.some((chain) => chain.name === "node-modules-chain"), false);
|
|
1265
|
+
}));
|
|
1266
|
+
|
|
1267
|
+
it("keeps package definitions below user and project overrides", () => withTempHome((home) => {
|
|
1268
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-package-precedence-"));
|
|
1269
|
+
tempDirs.push(dir);
|
|
1270
|
+
const packageRoot = path.join(dir, ".selesai", "npm", "node_modules", "override-workflow");
|
|
1271
|
+
writeJson(path.join(packageRoot, "package.json"), {
|
|
1272
|
+
name: "override-workflow",
|
|
1273
|
+
"pi-subagents": {
|
|
1274
|
+
agents: ["./agents"],
|
|
1275
|
+
chains: ["./chains"],
|
|
1276
|
+
},
|
|
1277
|
+
});
|
|
1278
|
+
writeAgent(path.join(packageRoot, "agents", "scout.md"), `---
|
|
1279
|
+
name: scout
|
|
1280
|
+
description: Package scout
|
|
1281
|
+
---
|
|
1282
|
+
|
|
1283
|
+
Package scout.
|
|
1284
|
+
`);
|
|
1285
|
+
writeAgent(path.join(packageRoot, "chains", "shared.chain.md"), `---
|
|
1286
|
+
name: shared
|
|
1287
|
+
description: Package chain
|
|
1288
|
+
---
|
|
1289
|
+
|
|
1290
|
+
## scout
|
|
1291
|
+
|
|
1292
|
+
Package chain.
|
|
1293
|
+
`);
|
|
1294
|
+
writeAgent(path.join(home, ".selesai", "agent", "agents", "scout.md"), `---
|
|
1295
|
+
name: scout
|
|
1296
|
+
description: User scout
|
|
1297
|
+
---
|
|
1298
|
+
|
|
1299
|
+
User scout.
|
|
1300
|
+
`);
|
|
1301
|
+
writeAgent(path.join(dir, ".selesai", "agents", "scout.md"), `---
|
|
1302
|
+
name: scout
|
|
1303
|
+
description: Project scout
|
|
1304
|
+
---
|
|
1305
|
+
|
|
1306
|
+
Project scout.
|
|
1307
|
+
`);
|
|
1308
|
+
writeAgent(path.join(home, ".selesai", "agent", "chains", "shared.chain.md"), `---
|
|
1309
|
+
name: shared
|
|
1310
|
+
description: User chain
|
|
1311
|
+
---
|
|
1312
|
+
|
|
1313
|
+
## scout
|
|
1314
|
+
|
|
1315
|
+
User chain.
|
|
1316
|
+
`);
|
|
1317
|
+
writeAgent(path.join(dir, ".selesai", "chains", "shared.chain.md"), `---
|
|
1318
|
+
name: shared
|
|
1319
|
+
description: Project chain
|
|
1320
|
+
---
|
|
1321
|
+
|
|
1322
|
+
## scout
|
|
1323
|
+
|
|
1324
|
+
Project chain.
|
|
1325
|
+
`);
|
|
1326
|
+
|
|
1327
|
+
assert.equal(discoverAgents(dir, "user").agents.find((agent) => agent.name === "scout")?.source, "user");
|
|
1328
|
+
assert.equal(discoverAgents(dir, "project").agents.find((agent) => agent.name === "scout")?.source, "project");
|
|
1329
|
+
const chainByName = new Map(discoverAgentsAll(dir).chains.map((chain) => [chain.name, chain]));
|
|
1330
|
+
assert.equal(chainByName.get("shared")?.source, "project");
|
|
1331
|
+
}));
|
|
1332
|
+
|
|
1333
|
+
it("does not allow management updates to package agents", () => withTempHome(() => {
|
|
1334
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-package-readonly-"));
|
|
1335
|
+
tempDirs.push(dir);
|
|
1336
|
+
const packageRoot = path.join(dir, ".selesai", "npm", "node_modules", "readonly-workflow");
|
|
1337
|
+
writeJson(path.join(packageRoot, "package.json"), {
|
|
1338
|
+
name: "readonly-workflow",
|
|
1339
|
+
"pi-subagents": {
|
|
1340
|
+
agents: ["./agents"],
|
|
1341
|
+
},
|
|
1342
|
+
});
|
|
1343
|
+
writeAgent(path.join(packageRoot, "agents", "reviewer.md"), `---
|
|
1344
|
+
name: reviewer
|
|
1345
|
+
package: readonly-workflow
|
|
1346
|
+
description: Read-only package reviewer.
|
|
1347
|
+
---
|
|
1348
|
+
|
|
1349
|
+
Review only.
|
|
1350
|
+
`);
|
|
1351
|
+
|
|
1352
|
+
const result = handleManagementAction("update", {
|
|
1353
|
+
agent: "readonly-workflow.reviewer",
|
|
1354
|
+
config: { description: "Changed" },
|
|
1355
|
+
}, {
|
|
1356
|
+
cwd: dir,
|
|
1357
|
+
modelRegistry: { getAvailable: () => [] },
|
|
1358
|
+
});
|
|
1359
|
+
|
|
1360
|
+
assert.equal(result.isError, true);
|
|
1361
|
+
assert.match(result.content[0]?.text ?? "", /read-only/);
|
|
1362
|
+
}));
|
|
1363
|
+
});
|
|
1364
|
+
|
|
1365
|
+
describe("agent frontmatter completionGuard", () => {
|
|
1366
|
+
it("serializes disabled completion guard into agent frontmatter", () => {
|
|
1367
|
+
const agent: AgentConfig = {
|
|
1368
|
+
name: "test-runner",
|
|
1369
|
+
description: "Test runner",
|
|
1370
|
+
systemPrompt: "Validate changes",
|
|
1371
|
+
systemPromptMode: "replace",
|
|
1372
|
+
inheritProjectContext: false,
|
|
1373
|
+
inheritSkills: false,
|
|
1374
|
+
source: "project",
|
|
1375
|
+
filePath: "/tmp/test-runner.md",
|
|
1376
|
+
completionGuard: false,
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
const serialized = serializeAgent(agent);
|
|
1380
|
+
assert.match(serialized, /completionGuard: false/);
|
|
1381
|
+
});
|
|
1382
|
+
|
|
1383
|
+
it("omits enabled completion guard from serialized frontmatter", () => {
|
|
1384
|
+
const agent: AgentConfig = {
|
|
1385
|
+
name: "test-runner",
|
|
1386
|
+
description: "Test runner",
|
|
1387
|
+
systemPrompt: "Validate changes",
|
|
1388
|
+
systemPromptMode: "replace",
|
|
1389
|
+
inheritProjectContext: false,
|
|
1390
|
+
inheritSkills: false,
|
|
1391
|
+
source: "project",
|
|
1392
|
+
filePath: "/tmp/test-runner.md",
|
|
1393
|
+
completionGuard: true,
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1396
|
+
const serialized = serializeAgent(agent);
|
|
1397
|
+
assert.doesNotMatch(serialized, /completionGuard:/);
|
|
1398
|
+
});
|
|
1399
|
+
|
|
1400
|
+
it("parses completionGuard from discovered agent frontmatter", () => {
|
|
1401
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-completion-guard-"));
|
|
1402
|
+
tempDirs.push(dir);
|
|
1403
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1404
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1405
|
+
fs.writeFileSync(path.join(agentsDir, "test-runner.md"), `---
|
|
1406
|
+
name: test-runner
|
|
1407
|
+
description: Test runner
|
|
1408
|
+
completionGuard: false
|
|
1409
|
+
---
|
|
1410
|
+
|
|
1411
|
+
Validate changes
|
|
1412
|
+
`, "utf-8");
|
|
1413
|
+
|
|
1414
|
+
const result = discoverAgents(dir, "project");
|
|
1415
|
+
const runner = result.agents.find((agent) => agent.name === "test-runner");
|
|
1416
|
+
assert.equal(runner?.completionGuard, false);
|
|
1417
|
+
assert.equal(runner?.extraFields?.completionGuard, undefined);
|
|
1418
|
+
});
|
|
1419
|
+
});
|
|
1420
|
+
|
|
1421
|
+
describe("agent frontmatter maxSubagentDepth", () => {
|
|
1422
|
+
it("serializes maxSubagentDepth into agent frontmatter", () => {
|
|
1423
|
+
const agent: AgentConfig = {
|
|
1424
|
+
name: "scout",
|
|
1425
|
+
description: "Scout",
|
|
1426
|
+
systemPrompt: "Inspect code",
|
|
1427
|
+
systemPromptMode: "replace",
|
|
1428
|
+
inheritProjectContext: false,
|
|
1429
|
+
inheritSkills: false,
|
|
1430
|
+
source: "project",
|
|
1431
|
+
filePath: "/tmp/scout.md",
|
|
1432
|
+
maxSubagentDepth: 1,
|
|
1433
|
+
};
|
|
1434
|
+
|
|
1435
|
+
const serialized = serializeAgent(agent);
|
|
1436
|
+
assert.match(serialized, /maxSubagentDepth: 1/);
|
|
1437
|
+
});
|
|
1438
|
+
|
|
1439
|
+
it("parses maxSubagentDepth from discovered agent frontmatter", () => {
|
|
1440
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-frontmatter-"));
|
|
1441
|
+
tempDirs.push(dir);
|
|
1442
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1443
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1444
|
+
fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
|
|
1445
|
+
name: scout
|
|
1446
|
+
description: Scout
|
|
1447
|
+
maxSubagentDepth: 1
|
|
1448
|
+
---
|
|
1449
|
+
|
|
1450
|
+
Inspect code
|
|
1451
|
+
`, "utf-8");
|
|
1452
|
+
|
|
1453
|
+
const result = discoverAgents(dir, "project");
|
|
1454
|
+
const scout = result.agents.find((agent) => agent.name === "scout");
|
|
1455
|
+
assert.equal(scout?.maxSubagentDepth, 1);
|
|
1456
|
+
});
|
|
1457
|
+
});
|
|
1458
|
+
|
|
1459
|
+
describe("agent frontmatter allowNestedSubagents", () => {
|
|
1460
|
+
it("serializes and parses explicit nested fanout authorization", () => {
|
|
1461
|
+
const agent: AgentConfig = {
|
|
1462
|
+
name: "delegator",
|
|
1463
|
+
description: "Delegator",
|
|
1464
|
+
systemPrompt: "Delegate focused work",
|
|
1465
|
+
systemPromptMode: "replace",
|
|
1466
|
+
inheritProjectContext: false,
|
|
1467
|
+
inheritSkills: false,
|
|
1468
|
+
source: "project",
|
|
1469
|
+
filePath: "/tmp/delegator.md",
|
|
1470
|
+
allowNestedSubagents: true,
|
|
1471
|
+
};
|
|
1472
|
+
assert.match(serializeAgent(agent), /allowNestedSubagents: true/);
|
|
1473
|
+
|
|
1474
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-nested-fanout-"));
|
|
1475
|
+
tempDirs.push(dir);
|
|
1476
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1477
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1478
|
+
fs.writeFileSync(path.join(agentsDir, "delegator.md"), `---
|
|
1479
|
+
name: delegator
|
|
1480
|
+
description: Delegator
|
|
1481
|
+
allowNestedSubagents: true
|
|
1482
|
+
---
|
|
1483
|
+
|
|
1484
|
+
Delegate focused work
|
|
1485
|
+
`, "utf-8");
|
|
1486
|
+
const discovered = discoverAgents(dir, "project").agents.find((candidate) => candidate.name === "delegator");
|
|
1487
|
+
assert.equal(discovered?.allowNestedSubagents, true);
|
|
1488
|
+
assert.equal(discovered?.extraFields?.allowNestedSubagents, undefined);
|
|
1489
|
+
});
|
|
1490
|
+
});
|
|
1491
|
+
|
|
1492
|
+
describe("agent frontmatter thinking", () => {
|
|
1493
|
+
it("coerces frontmatter false strings to disabled thinking", () => {
|
|
1494
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-thinking-false-"));
|
|
1495
|
+
tempDirs.push(dir);
|
|
1496
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1497
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1498
|
+
|
|
1499
|
+
for (const [name, value] of [["unquoted", "false"], ["quoted", "\"false\""]] as const) {
|
|
1500
|
+
fs.writeFileSync(path.join(agentsDir, `${name}.md`), `---
|
|
1501
|
+
name: ${name}
|
|
1502
|
+
description: ${name}
|
|
1503
|
+
model: glm-5.2-short-fast
|
|
1504
|
+
thinking: ${value}
|
|
1505
|
+
---
|
|
1506
|
+
|
|
1507
|
+
Do work
|
|
1508
|
+
`, "utf-8");
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
const agents = discoverAgents(dir, "project").agents;
|
|
1512
|
+
for (const name of ["unquoted", "quoted"]) {
|
|
1513
|
+
const agent = agents.find((candidate) => candidate.name === name);
|
|
1514
|
+
assert.ok(agent);
|
|
1515
|
+
assert.equal(agent.thinking, false);
|
|
1516
|
+
|
|
1517
|
+
const { args } = buildPiArgs({
|
|
1518
|
+
baseArgs: ["-p"],
|
|
1519
|
+
task: "hello",
|
|
1520
|
+
sessionEnabled: false,
|
|
1521
|
+
model: agent.model,
|
|
1522
|
+
thinking: agent.thinking,
|
|
1523
|
+
inheritProjectContext: agent.inheritProjectContext,
|
|
1524
|
+
inheritSkills: agent.inheritSkills,
|
|
1525
|
+
});
|
|
1526
|
+
|
|
1527
|
+
assert.ok(args.includes("--model"));
|
|
1528
|
+
assert.ok(args.includes("glm-5.2-short-fast"));
|
|
1529
|
+
assert.ok(!args.some((arg) => arg.includes(":false")));
|
|
1530
|
+
}
|
|
1531
|
+
});
|
|
1532
|
+
|
|
1533
|
+
it("preserves supported frontmatter thinking strings", () => {
|
|
1534
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-thinking-levels-"));
|
|
1535
|
+
tempDirs.push(dir);
|
|
1536
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1537
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1538
|
+
|
|
1539
|
+
for (const level of THINKING_LEVELS) {
|
|
1540
|
+
fs.writeFileSync(path.join(agentsDir, `${level}.md`), `---
|
|
1541
|
+
name: thinker-${level}
|
|
1542
|
+
description: Thinking ${level}
|
|
1543
|
+
thinking: ${level}
|
|
1544
|
+
---
|
|
1545
|
+
|
|
1546
|
+
Do work
|
|
1547
|
+
`, "utf-8");
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
const agents = discoverAgents(dir, "project").agents;
|
|
1551
|
+
for (const level of THINKING_LEVELS) {
|
|
1552
|
+
const agent = agents.find((candidate) => candidate.name === `thinker-${level}`);
|
|
1553
|
+
assert.ok(agent);
|
|
1554
|
+
assert.equal(agent.thinking, level);
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1557
|
+
});
|
|
1558
|
+
|
|
1559
|
+
describe("agent frontmatter fallbackModels", () => {
|
|
1560
|
+
it("serializes fallbackModels into agent frontmatter", () => {
|
|
1561
|
+
const agent: AgentConfig = {
|
|
1562
|
+
name: "worker",
|
|
1563
|
+
description: "Worker",
|
|
1564
|
+
systemPrompt: "Do work",
|
|
1565
|
+
systemPromptMode: "replace",
|
|
1566
|
+
inheritProjectContext: false,
|
|
1567
|
+
inheritSkills: false,
|
|
1568
|
+
source: "project",
|
|
1569
|
+
filePath: "/tmp/worker.md",
|
|
1570
|
+
fallbackModels: ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"],
|
|
1571
|
+
};
|
|
1572
|
+
|
|
1573
|
+
const serialized = serializeAgent(agent);
|
|
1574
|
+
assert.match(serialized, /fallbackModels: openai\/gpt-5-mini, anthropic\/claude-sonnet-4/);
|
|
1575
|
+
});
|
|
1576
|
+
|
|
1577
|
+
it("parses fallbackModels from discovered agent frontmatter", () => {
|
|
1578
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-fallback-frontmatter-"));
|
|
1579
|
+
tempDirs.push(dir);
|
|
1580
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1581
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1582
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1583
|
+
name: worker
|
|
1584
|
+
description: Worker
|
|
1585
|
+
fallbackModels: openai/gpt-5-mini, anthropic/claude-sonnet-4
|
|
1586
|
+
---
|
|
1587
|
+
|
|
1588
|
+
Do work
|
|
1589
|
+
`, "utf-8");
|
|
1590
|
+
|
|
1591
|
+
const result = discoverAgents(dir, "project");
|
|
1592
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1593
|
+
assert.deepEqual(worker?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
|
|
1594
|
+
});
|
|
1595
|
+
});
|
|
1596
|
+
|
|
1597
|
+
describe("agent frontmatter systemPromptMode", () => {
|
|
1598
|
+
it("serializes systemPromptMode into agent frontmatter", () => {
|
|
1599
|
+
const agent: AgentConfig = {
|
|
1600
|
+
name: "worker",
|
|
1601
|
+
description: "Worker",
|
|
1602
|
+
systemPrompt: "Do work",
|
|
1603
|
+
systemPromptMode: "replace",
|
|
1604
|
+
inheritProjectContext: false,
|
|
1605
|
+
inheritSkills: false,
|
|
1606
|
+
source: "project",
|
|
1607
|
+
filePath: "/tmp/worker.md",
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
const serialized = serializeAgent(agent);
|
|
1611
|
+
assert.match(serialized, /systemPromptMode: replace/);
|
|
1612
|
+
});
|
|
1613
|
+
|
|
1614
|
+
it("parses systemPromptMode from discovered agent frontmatter", () => {
|
|
1615
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-prompt-mode-frontmatter-"));
|
|
1616
|
+
tempDirs.push(dir);
|
|
1617
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1618
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1619
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1620
|
+
name: worker
|
|
1621
|
+
description: Worker
|
|
1622
|
+
systemPromptMode: replace
|
|
1623
|
+
---
|
|
1624
|
+
|
|
1625
|
+
Do work
|
|
1626
|
+
`, "utf-8");
|
|
1627
|
+
|
|
1628
|
+
const result = discoverAgents(dir, "project");
|
|
1629
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1630
|
+
assert.equal(worker?.systemPromptMode, "replace");
|
|
1631
|
+
});
|
|
1632
|
+
});
|
|
1633
|
+
|
|
1634
|
+
describe("agent frontmatter prompt inheritance flags", () => {
|
|
1635
|
+
it("serializes inheritProjectContext and inheritSkills into agent frontmatter", () => {
|
|
1636
|
+
const agent: AgentConfig = {
|
|
1637
|
+
name: "worker",
|
|
1638
|
+
description: "Worker",
|
|
1639
|
+
systemPrompt: "Do work",
|
|
1640
|
+
systemPromptMode: "replace",
|
|
1641
|
+
inheritProjectContext: true,
|
|
1642
|
+
inheritGlobalContext: true,
|
|
1643
|
+
inheritSkills: true,
|
|
1644
|
+
source: "project",
|
|
1645
|
+
filePath: "/tmp/worker.md",
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
const serialized = serializeAgent(agent);
|
|
1649
|
+
assert.match(serialized, /inheritProjectContext: true/);
|
|
1650
|
+
assert.match(serialized, /inheritGlobalContext: true/);
|
|
1651
|
+
assert.match(serialized, /inheritSkills: true/);
|
|
1652
|
+
});
|
|
1653
|
+
|
|
1654
|
+
it("parses inheritProjectContext and inheritSkills from discovered agent frontmatter", () => {
|
|
1655
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-prompt-inheritance-frontmatter-"));
|
|
1656
|
+
tempDirs.push(dir);
|
|
1657
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1658
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1659
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1660
|
+
name: worker
|
|
1661
|
+
description: Worker
|
|
1662
|
+
inheritProjectContext: true
|
|
1663
|
+
inheritGlobalContext: true
|
|
1664
|
+
inheritSkills: true
|
|
1665
|
+
---
|
|
1666
|
+
|
|
1667
|
+
Do work
|
|
1668
|
+
`, "utf-8");
|
|
1669
|
+
|
|
1670
|
+
const result = discoverAgents(dir, "project");
|
|
1671
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1672
|
+
assert.equal(worker?.inheritProjectContext, true);
|
|
1673
|
+
assert.equal(worker?.inheritGlobalContext, true);
|
|
1674
|
+
assert.equal(worker?.inheritSkills, true);
|
|
1675
|
+
});
|
|
1676
|
+
|
|
1677
|
+
it("defaults inheritGlobalContext to false when frontmatter omits it", () => {
|
|
1678
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-prompt-inheritance-frontmatter-"));
|
|
1679
|
+
tempDirs.push(dir);
|
|
1680
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1681
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1682
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1683
|
+
name: worker
|
|
1684
|
+
description: Worker
|
|
1685
|
+
---
|
|
1686
|
+
|
|
1687
|
+
Do work
|
|
1688
|
+
`, "utf-8");
|
|
1689
|
+
|
|
1690
|
+
const result = discoverAgents(dir, "project");
|
|
1691
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1692
|
+
assert.equal(worker?.inheritGlobalContext, false);
|
|
1693
|
+
});
|
|
1694
|
+
});
|
|
1695
|
+
|
|
1696
|
+
describe("agent frontmatter subagentOnlyExtensions", () => {
|
|
1697
|
+
it("serializes subagentOnlyExtensions into agent frontmatter", () => {
|
|
1698
|
+
const agent: AgentConfig = {
|
|
1699
|
+
name: "worker",
|
|
1700
|
+
description: "Worker",
|
|
1701
|
+
systemPrompt: "Do work",
|
|
1702
|
+
systemPromptMode: "replace",
|
|
1703
|
+
inheritProjectContext: false,
|
|
1704
|
+
inheritSkills: false,
|
|
1705
|
+
source: "project",
|
|
1706
|
+
filePath: "/tmp/worker.md",
|
|
1707
|
+
subagentOnlyExtensions: ["./tools/child-search.ts", "/opt/pi/child-only.ts"],
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
const serialized = serializeAgent(agent);
|
|
1711
|
+
assert.match(serialized, /subagentOnlyExtensions: \.\/tools\/child-search\.ts, \/opt\/pi\/child-only\.ts/);
|
|
1712
|
+
});
|
|
1713
|
+
|
|
1714
|
+
it("parses subagentOnlyExtensions from discovered agent frontmatter", () => {
|
|
1715
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-child-ext-"));
|
|
1716
|
+
tempDirs.push(dir);
|
|
1717
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1718
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1719
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1720
|
+
name: worker
|
|
1721
|
+
description: Worker
|
|
1722
|
+
subagentOnlyExtensions: ./tools/child-search.ts, /opt/pi/child-only.ts
|
|
1723
|
+
---
|
|
1724
|
+
|
|
1725
|
+
Do work
|
|
1726
|
+
`, "utf-8");
|
|
1727
|
+
|
|
1728
|
+
const result = discoverAgents(dir, "project");
|
|
1729
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1730
|
+
assert.deepEqual(worker?.subagentOnlyExtensions, [path.join(agentsDir, "tools", "child-search.ts"), "/opt/pi/child-only.ts"]);
|
|
1731
|
+
});
|
|
1732
|
+
});
|
|
1733
|
+
|
|
1734
|
+
describe("agent frontmatter fast mode", () => {
|
|
1735
|
+
it("parses and serializes fast mode", () => {
|
|
1736
|
+
const agent: AgentConfig = {
|
|
1737
|
+
name: "worker",
|
|
1738
|
+
description: "Worker",
|
|
1739
|
+
systemPrompt: "Do work",
|
|
1740
|
+
systemPromptMode: "replace",
|
|
1741
|
+
inheritProjectContext: false,
|
|
1742
|
+
inheritSkills: false,
|
|
1743
|
+
source: "project",
|
|
1744
|
+
filePath: "/tmp/worker.md",
|
|
1745
|
+
fast: true,
|
|
1746
|
+
};
|
|
1747
|
+
|
|
1748
|
+
const serialized = serializeAgent(agent);
|
|
1749
|
+
assert.match(serialized, /fast: true/);
|
|
1750
|
+
|
|
1751
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-fast-mode-"));
|
|
1752
|
+
tempDirs.push(dir);
|
|
1753
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1754
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1755
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1756
|
+
name: worker
|
|
1757
|
+
description: Worker
|
|
1758
|
+
model: openai-codex/gpt-5.6-luna
|
|
1759
|
+
fast: true
|
|
1760
|
+
---
|
|
1761
|
+
|
|
1762
|
+
Do work
|
|
1763
|
+
`, "utf-8");
|
|
1764
|
+
|
|
1765
|
+
const result = discoverAgents(dir, "project");
|
|
1766
|
+
const worker = result.agents.find((candidate) => candidate.name === "worker");
|
|
1767
|
+
assert.equal(worker?.fast, true);
|
|
1768
|
+
assert.equal(worker?.extraFields?.fast, undefined);
|
|
1769
|
+
});
|
|
1770
|
+
|
|
1771
|
+
it("adds the fast extension only for allowlisted native models", () => {
|
|
1772
|
+
const allowed = buildPiArgs({
|
|
1773
|
+
baseArgs: ["-p"],
|
|
1774
|
+
task: "hello",
|
|
1775
|
+
sessionEnabled: false,
|
|
1776
|
+
model: "openai-codex/gpt-5.6-luna:low",
|
|
1777
|
+
fast: true,
|
|
1778
|
+
inheritProjectContext: false,
|
|
1779
|
+
inheritSkills: false,
|
|
1780
|
+
});
|
|
1781
|
+
|
|
1782
|
+
assert.ok(allowed.args.some((arg) => arg.endsWith("fast-mode-extension.ts")));
|
|
1783
|
+
assert.throws(() => buildPiArgs({
|
|
1784
|
+
baseArgs: ["-p"],
|
|
1785
|
+
task: "hello",
|
|
1786
|
+
sessionEnabled: false,
|
|
1787
|
+
model: "anthropic/claude-sonnet-4",
|
|
1788
|
+
fast: true,
|
|
1789
|
+
inheritProjectContext: false,
|
|
1790
|
+
inheritSkills: false,
|
|
1791
|
+
}), /fast mode supports only/);
|
|
1792
|
+
});
|
|
1793
|
+
});
|
|
1794
|
+
|
|
1795
|
+
describe("agent frontmatter prompt assembly defaults", () => {
|
|
1796
|
+
it("defaults ordinary agents to replace mode with no inherited context or skills", () => {
|
|
1797
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-default-prompt-settings-"));
|
|
1798
|
+
tempDirs.push(dir);
|
|
1799
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1800
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1801
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1802
|
+
name: worker
|
|
1803
|
+
description: Worker
|
|
1804
|
+
---
|
|
1805
|
+
|
|
1806
|
+
Do work
|
|
1807
|
+
`, "utf-8");
|
|
1808
|
+
|
|
1809
|
+
const result = discoverAgents(dir, "project");
|
|
1810
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1811
|
+
assert.equal(worker?.systemPromptMode, "replace");
|
|
1812
|
+
assert.equal(worker?.inheritProjectContext, false);
|
|
1813
|
+
assert.equal(worker?.inheritSkills, false);
|
|
1814
|
+
});
|
|
1815
|
+
|
|
1816
|
+
it("builtin agents inherit project context by default", () => {
|
|
1817
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-default-prompt-settings-"));
|
|
1818
|
+
const homeDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-default-home-"));
|
|
1819
|
+
tempDirs.push(dir);
|
|
1820
|
+
tempDirs.push(homeDir);
|
|
1821
|
+
const previousHome = process.env.HOME;
|
|
1822
|
+
const previousUserProfile = process.env.USERPROFILE;
|
|
1823
|
+
|
|
1824
|
+
try {
|
|
1825
|
+
process.env.HOME = homeDir;
|
|
1826
|
+
process.env.USERPROFILE = homeDir;
|
|
1827
|
+
|
|
1828
|
+
const result = discoverAgents(dir, "both");
|
|
1829
|
+
const scout = result.agents.find((agent) => agent.name === "scout");
|
|
1830
|
+
const reviewer = result.agents.find((agent) => agent.name === "reviewer");
|
|
1831
|
+
const delegate = result.agents.find((agent) => agent.name === "delegate");
|
|
1832
|
+
assert.equal(scout?.inheritProjectContext, true);
|
|
1833
|
+
assert.equal(reviewer?.inheritProjectContext, true);
|
|
1834
|
+
assert.equal(delegate?.inheritProjectContext, true);
|
|
1835
|
+
} finally {
|
|
1836
|
+
if (previousHome === undefined) delete process.env.HOME;
|
|
1837
|
+
else process.env.HOME = previousHome;
|
|
1838
|
+
if (previousUserProfile === undefined) delete process.env.USERPROFILE;
|
|
1839
|
+
else process.env.USERPROFILE = previousUserProfile;
|
|
1840
|
+
}
|
|
1841
|
+
});
|
|
1842
|
+
|
|
1843
|
+
it("bundled agents all have explicit tool allowlists", () => {
|
|
1844
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-tools-"));
|
|
1845
|
+
const homeDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-tools-home-"));
|
|
1846
|
+
tempDirs.push(dir);
|
|
1847
|
+
tempDirs.push(homeDir);
|
|
1848
|
+
const previousHome = process.env.HOME;
|
|
1849
|
+
const previousUserProfile = process.env.USERPROFILE;
|
|
1850
|
+
|
|
1851
|
+
try {
|
|
1852
|
+
process.env.HOME = homeDir;
|
|
1853
|
+
process.env.USERPROFILE = homeDir;
|
|
1854
|
+
const builtins = discoverAgentsAll(dir).builtin;
|
|
1855
|
+
assert.ok(builtins.length > 0);
|
|
1856
|
+
for (const agent of builtins) {
|
|
1857
|
+
if (agent.runner?.type === "external-cli" || agent.runner?.type === "external-job") continue;
|
|
1858
|
+
assert.ok(agent.tools && agent.tools.length > 0, `${agent.name} should have explicit tools frontmatter`);
|
|
1859
|
+
}
|
|
1860
|
+
} finally {
|
|
1861
|
+
if (previousHome === undefined) delete process.env.HOME;
|
|
1862
|
+
else process.env.HOME = previousHome;
|
|
1863
|
+
if (previousUserProfile === undefined) delete process.env.USERPROFILE;
|
|
1864
|
+
else process.env.USERPROFILE = previousUserProfile;
|
|
1865
|
+
}
|
|
1866
|
+
});
|
|
1867
|
+
|
|
1868
|
+
it("worker and delegate include the child-facing supervisor tool", () => {
|
|
1869
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-supervisor-tool-"));
|
|
1870
|
+
const homeDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-supervisor-tool-home-"));
|
|
1871
|
+
tempDirs.push(dir);
|
|
1872
|
+
tempDirs.push(homeDir);
|
|
1873
|
+
const previousHome = process.env.HOME;
|
|
1874
|
+
const previousUserProfile = process.env.USERPROFILE;
|
|
1875
|
+
|
|
1876
|
+
try {
|
|
1877
|
+
process.env.HOME = homeDir;
|
|
1878
|
+
process.env.USERPROFILE = homeDir;
|
|
1879
|
+
const agents = discoverAgentsAll(dir).builtin;
|
|
1880
|
+
for (const name of ["worker", "delegate"]) {
|
|
1881
|
+
const agent = agents.find((candidate) => candidate.name === name);
|
|
1882
|
+
assert.ok(agent, `${name} builtin should be discovered`);
|
|
1883
|
+
assert.deepEqual(agent?.tools, ["read", "grep", "find", "ls", "bash", "edit", "write", "contact_supervisor"]);
|
|
1884
|
+
}
|
|
1885
|
+
} finally {
|
|
1886
|
+
if (previousHome === undefined) delete process.env.HOME;
|
|
1887
|
+
else process.env.HOME = previousHome;
|
|
1888
|
+
if (previousUserProfile === undefined) delete process.env.USERPROFILE;
|
|
1889
|
+
else process.env.USERPROFILE = previousUserProfile;
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
|
|
1893
|
+
it("defaults delegate to append mode with inherited project context", () => {
|
|
1894
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-delegate-default-prompt-settings-"));
|
|
1895
|
+
tempDirs.push(dir);
|
|
1896
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1897
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1898
|
+
fs.writeFileSync(path.join(agentsDir, "delegate.md"), `---
|
|
1899
|
+
name: delegate
|
|
1900
|
+
description: Delegate
|
|
1901
|
+
---
|
|
1902
|
+
|
|
1903
|
+
Do work
|
|
1904
|
+
`, "utf-8");
|
|
1905
|
+
|
|
1906
|
+
const result = discoverAgents(dir, "project");
|
|
1907
|
+
const delegate = result.agents.find((agent) => agent.name === "delegate");
|
|
1908
|
+
assert.equal(delegate?.systemPromptMode, "append");
|
|
1909
|
+
assert.equal(delegate?.inheritProjectContext, true);
|
|
1910
|
+
assert.equal(delegate?.inheritSkills, false);
|
|
1911
|
+
});
|
|
1912
|
+
});
|
|
1913
|
+
|
|
1914
|
+
describe("packaged agent and chain discovery", () => {
|
|
1915
|
+
it("recursively discovers nested project agents while keeping chain files separate", () => {
|
|
1916
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-recursive-agent-discovery-"));
|
|
1917
|
+
tempDirs.push(dir);
|
|
1918
|
+
const nestedDir = path.join(dir, ".selesai", "agents", "code-analysis", "deep");
|
|
1919
|
+
const nestedChainDir = path.join(dir, ".selesai", "chains", "code-analysis", "deep");
|
|
1920
|
+
fs.mkdirSync(nestedDir, { recursive: true });
|
|
1921
|
+
fs.mkdirSync(nestedChainDir, { recursive: true });
|
|
1922
|
+
fs.writeFileSync(path.join(nestedDir, "scout.md"), `---
|
|
1923
|
+
name: scout
|
|
1924
|
+
description: Nested scout
|
|
1925
|
+
---
|
|
1926
|
+
|
|
1927
|
+
Inspect code
|
|
1928
|
+
`, "utf-8");
|
|
1929
|
+
fs.writeFileSync(path.join(nestedChainDir, "review.chain.md"), `---
|
|
1930
|
+
name: review-flow
|
|
1931
|
+
description: Review flow
|
|
1932
|
+
---
|
|
1933
|
+
|
|
1934
|
+
## scout
|
|
1935
|
+
|
|
1936
|
+
Review
|
|
1937
|
+
`, "utf-8");
|
|
1938
|
+
|
|
1939
|
+
const result = discoverAgentsAll(dir);
|
|
1940
|
+
assert.ok(result.project.find((agent) => agent.name === "scout" && agent.filePath === path.join(nestedDir, "scout.md")));
|
|
1941
|
+
assert.ok(result.chains.find((chain) => chain.name === "review-flow" && chain.filePath === path.join(nestedChainDir, "review.chain.md")));
|
|
1942
|
+
assert.equal(result.project.some((agent) => agent.filePath.endsWith("review.chain.md")), false);
|
|
1943
|
+
});
|
|
1944
|
+
|
|
1945
|
+
it("registers packaged agents by runtime name and serializes local name plus package", () => {
|
|
1946
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-packaged-agent-"));
|
|
1947
|
+
tempDirs.push(dir);
|
|
1948
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1949
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1950
|
+
fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
|
|
1951
|
+
name: scout
|
|
1952
|
+
package: code-analysis
|
|
1953
|
+
description: Fast recon
|
|
1954
|
+
---
|
|
1955
|
+
|
|
1956
|
+
Inspect code
|
|
1957
|
+
`, "utf-8");
|
|
1958
|
+
|
|
1959
|
+
const scout = discoverAgents(dir, "project").agents.find((agent) => agent.name === "code-analysis.scout");
|
|
1960
|
+
assert.ok(scout);
|
|
1961
|
+
assert.equal(scout.localName, "scout");
|
|
1962
|
+
assert.equal(scout.packageName, "code-analysis");
|
|
1963
|
+
const serialized = serializeAgent(scout);
|
|
1964
|
+
assert.match(serialized, /^name: scout$/m);
|
|
1965
|
+
assert.match(serialized, /^package: code-analysis$/m);
|
|
1966
|
+
assert.doesNotMatch(serialized, /^name: code-analysis\.scout$/m);
|
|
1967
|
+
});
|
|
1968
|
+
|
|
1969
|
+
it("recursively discovers packaged chains by runtime name and preserves package on serialize", () => {
|
|
1970
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-packaged-chain-"));
|
|
1971
|
+
tempDirs.push(dir);
|
|
1972
|
+
const nestedDir = path.join(dir, ".selesai", "chains", "flows");
|
|
1973
|
+
fs.mkdirSync(nestedDir, { recursive: true });
|
|
1974
|
+
const content = `---
|
|
1975
|
+
name: review-flow
|
|
1976
|
+
package: code-analysis
|
|
1977
|
+
description: Review flow
|
|
1978
|
+
---
|
|
1979
|
+
|
|
1980
|
+
## code-analysis.scout
|
|
1981
|
+
|
|
1982
|
+
Inspect {task}
|
|
1983
|
+
`;
|
|
1984
|
+
fs.writeFileSync(path.join(nestedDir, "review.chain.md"), content, "utf-8");
|
|
1985
|
+
|
|
1986
|
+
const chain = discoverAgentsAll(dir).chains.find((candidate) => candidate.name === "code-analysis.review-flow");
|
|
1987
|
+
assert.ok(chain);
|
|
1988
|
+
assert.equal(chain.localName, "review-flow");
|
|
1989
|
+
assert.equal(chain.packageName, "code-analysis");
|
|
1990
|
+
assert.equal(chain.steps[0]?.agent, "code-analysis.scout");
|
|
1991
|
+
const serialized = serializeChain(chain);
|
|
1992
|
+
assert.match(serialized, /^name: review-flow$/m);
|
|
1993
|
+
assert.match(serialized, /^package: code-analysis$/m);
|
|
1994
|
+
assert.match(serialized, /^## code-analysis\.scout$/m);
|
|
1995
|
+
assert.doesNotMatch(serialized, /^name: code-analysis\.review-flow$/m);
|
|
1996
|
+
});
|
|
1997
|
+
|
|
1998
|
+
it("keeps packaged and un-packaged runtime names distinct while preserving un-packaged precedence", () => {
|
|
1999
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-packaged-collisions-"));
|
|
2000
|
+
tempDirs.push(dir);
|
|
2001
|
+
fs.mkdirSync(path.join(dir, ".agents"), { recursive: true });
|
|
2002
|
+
fs.mkdirSync(path.join(dir, ".selesai", "agents"), { recursive: true });
|
|
2003
|
+
fs.writeFileSync(path.join(dir, ".agents", "scout.md"), `---
|
|
2004
|
+
name: scout
|
|
2005
|
+
description: Legacy scout
|
|
2006
|
+
---
|
|
2007
|
+
|
|
2008
|
+
Legacy
|
|
2009
|
+
`, "utf-8");
|
|
2010
|
+
fs.writeFileSync(path.join(dir, ".selesai", "agents", "scout.md"), `---
|
|
2011
|
+
name: scout
|
|
2012
|
+
description: Project scout
|
|
2013
|
+
---
|
|
2014
|
+
|
|
2015
|
+
Project
|
|
2016
|
+
`, "utf-8");
|
|
2017
|
+
fs.writeFileSync(path.join(dir, ".selesai", "agents", "packaged.md"), `---
|
|
2018
|
+
name: scout
|
|
2019
|
+
package: code-analysis
|
|
2020
|
+
description: Packaged scout
|
|
2021
|
+
---
|
|
2022
|
+
|
|
2023
|
+
Packaged
|
|
2024
|
+
`, "utf-8");
|
|
2025
|
+
|
|
2026
|
+
const agents = discoverAgents(dir, "project").agents;
|
|
2027
|
+
const unqualified = agents.find((agent) => agent.name === "scout");
|
|
2028
|
+
const packaged = agents.find((agent) => agent.name === "code-analysis.scout");
|
|
2029
|
+
assert.equal(unqualified?.description, "Project scout");
|
|
2030
|
+
assert.equal(unqualified?.filePath, path.join(dir, ".selesai", "agents", "scout.md"));
|
|
2031
|
+
assert.equal(packaged?.description, "Packaged scout");
|
|
2032
|
+
});
|
|
2033
|
+
|
|
2034
|
+
it("parses packaged chains directly from serializer helpers", () => {
|
|
2035
|
+
const parsed = parseChain(`---
|
|
2036
|
+
name: review-flow
|
|
2037
|
+
package: code-analysis
|
|
2038
|
+
description: Review flow
|
|
2039
|
+
---
|
|
2040
|
+
|
|
2041
|
+
## code-analysis.scout
|
|
2042
|
+
|
|
2043
|
+
Inspect
|
|
2044
|
+
`, "project", "/tmp/review.chain.md");
|
|
2045
|
+
|
|
2046
|
+
assert.equal(parsed.name, "code-analysis.review-flow");
|
|
2047
|
+
assert.equal(parsed.localName, "review-flow");
|
|
2048
|
+
assert.equal(parsed.packageName, "code-analysis");
|
|
2049
|
+
assert.match(serializeChain(parsed), /^name: review-flow$/m);
|
|
2050
|
+
});
|
|
2051
|
+
|
|
2052
|
+
it("normalizes package frontmatter consistently for agents and chains", () => {
|
|
2053
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-package-normalize-"));
|
|
2054
|
+
tempDirs.push(dir);
|
|
2055
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
2056
|
+
const chainsDir = path.join(dir, ".selesai", "chains");
|
|
2057
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
2058
|
+
fs.mkdirSync(chainsDir, { recursive: true });
|
|
2059
|
+
fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
|
|
2060
|
+
name: scout
|
|
2061
|
+
package: Code Analysis!
|
|
2062
|
+
description: Fast recon
|
|
2063
|
+
---
|
|
2064
|
+
|
|
2065
|
+
Inspect
|
|
2066
|
+
`, "utf-8");
|
|
2067
|
+
fs.writeFileSync(path.join(chainsDir, "review.chain.md"), `---
|
|
2068
|
+
name: review-flow
|
|
2069
|
+
package: Code Analysis!
|
|
2070
|
+
description: Review flow
|
|
2071
|
+
---
|
|
2072
|
+
|
|
2073
|
+
## code-analysis.scout
|
|
2074
|
+
|
|
2075
|
+
Review
|
|
2076
|
+
`, "utf-8");
|
|
2077
|
+
|
|
2078
|
+
const result = discoverAgentsAll(dir);
|
|
2079
|
+
assert.ok(result.project.find((agent) => agent.name === "code-analysis.scout"));
|
|
2080
|
+
assert.ok(result.chains.find((chain) => chain.name === "code-analysis.review-flow"));
|
|
2081
|
+
});
|
|
2082
|
+
|
|
2083
|
+
it("skips invalid package frontmatter that cannot be normalized", () => {
|
|
2084
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-invalid-package-"));
|
|
2085
|
+
tempDirs.push(dir);
|
|
2086
|
+
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
2087
|
+
const chainsDir = path.join(dir, ".selesai", "chains");
|
|
2088
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
2089
|
+
fs.mkdirSync(chainsDir, { recursive: true });
|
|
2090
|
+
fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
|
|
2091
|
+
name: scout
|
|
2092
|
+
package: !!!
|
|
2093
|
+
description: Fast recon
|
|
2094
|
+
---
|
|
2095
|
+
|
|
2096
|
+
Inspect
|
|
2097
|
+
`, "utf-8");
|
|
2098
|
+
fs.writeFileSync(path.join(chainsDir, "review.chain.md"), `---
|
|
2099
|
+
name: review-flow
|
|
2100
|
+
package: !!!
|
|
2101
|
+
description: Review flow
|
|
2102
|
+
---
|
|
2103
|
+
|
|
2104
|
+
## scout
|
|
2105
|
+
|
|
2106
|
+
Review
|
|
2107
|
+
`, "utf-8");
|
|
2108
|
+
|
|
2109
|
+
const result = discoverAgentsAll(dir);
|
|
2110
|
+
assert.equal(result.project.some((agent) => agent.filePath.endsWith("scout.md")), false);
|
|
2111
|
+
assert.match(result.agentDiagnostics?.find((diagnostic) => diagnostic.filePath.endsWith("scout.md"))?.error ?? "", /Agent 'scout' package is invalid after sanitization/);
|
|
2112
|
+
assert.equal(result.chains.some((chain) => chain.filePath.endsWith("review.chain.md")), false);
|
|
2113
|
+
});
|
|
2114
|
+
});
|
|
2115
|
+
|
|
2116
|
+
describe("project agent directory discovery", () => {
|
|
2117
|
+
it("discovers project agents from both .agents and .selesai/agents", () => {
|
|
2118
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-project-agent-dirs-"));
|
|
2119
|
+
tempDirs.push(dir);
|
|
2120
|
+
fs.mkdirSync(path.join(dir, ".agents", "skills"), { recursive: true });
|
|
2121
|
+
fs.mkdirSync(path.join(dir, ".selesai", "agents"), { recursive: true });
|
|
2122
|
+
fs.writeFileSync(path.join(dir, ".agents", "legacy.md"), `---
|
|
2123
|
+
name: legacy
|
|
2124
|
+
description: Legacy
|
|
2125
|
+
---
|
|
2126
|
+
|
|
2127
|
+
Legacy prompt
|
|
2128
|
+
`, "utf-8");
|
|
2129
|
+
fs.writeFileSync(path.join(dir, ".selesai", "agents", "canonical.md"), `---
|
|
2130
|
+
name: canonical
|
|
2131
|
+
description: Canonical
|
|
2132
|
+
---
|
|
2133
|
+
|
|
2134
|
+
Canonical prompt
|
|
2135
|
+
`, "utf-8");
|
|
2136
|
+
fs.writeFileSync(path.join(dir, ".selesai", "agents", "SKILL.md"), `---
|
|
2137
|
+
name: skill-named-agent
|
|
2138
|
+
description: Skill-named agent
|
|
2139
|
+
---
|
|
2140
|
+
|
|
2141
|
+
Skill-named agent prompt
|
|
2142
|
+
`, "utf-8");
|
|
2143
|
+
|
|
2144
|
+
const result = discoverAgents(dir, "project");
|
|
2145
|
+
assert.ok(result.agents.find((agent) => agent.name === "legacy" && agent.filePath === path.join(dir, ".agents", "legacy.md")));
|
|
2146
|
+
assert.ok(result.agents.find((agent) => agent.name === "canonical" && agent.filePath === path.join(dir, ".selesai", "agents", "canonical.md")));
|
|
2147
|
+
assert.ok(result.agents.find((agent) => agent.name === "skill-named-agent" && agent.filePath === path.join(dir, ".selesai", "agents", "SKILL.md")));
|
|
2148
|
+
assert.equal(result.projectAgentsDir, path.join(dir, ".selesai", "agents"));
|
|
2149
|
+
});
|
|
2150
|
+
|
|
2151
|
+
it("does not register legacy project skill files as agents", () => {
|
|
2152
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-project-skills-not-agents-"));
|
|
2153
|
+
tempDirs.push(dir);
|
|
2154
|
+
writeAgent(path.join(dir, ".agents", "legacy.md"), `---
|
|
2155
|
+
name: legacy
|
|
2156
|
+
description: Legacy
|
|
2157
|
+
---
|
|
2158
|
+
|
|
2159
|
+
Legacy prompt
|
|
2160
|
+
`);
|
|
2161
|
+
writeAgent(path.join(dir, ".agents", "skills", "directory-skill", "SKILL.md"), `---
|
|
2162
|
+
name: directory-skill
|
|
2163
|
+
description: Directory skill
|
|
2164
|
+
---
|
|
2165
|
+
|
|
2166
|
+
Skill prompt
|
|
2167
|
+
`);
|
|
2168
|
+
writeAgent(path.join(dir, ".agents", "skills", "file-skill.md"), `---
|
|
2169
|
+
name: file-skill
|
|
2170
|
+
description: File skill
|
|
2171
|
+
---
|
|
2172
|
+
|
|
2173
|
+
Skill prompt
|
|
2174
|
+
`);
|
|
2175
|
+
|
|
2176
|
+
const agents = discoverAgents(dir, "project").agents;
|
|
2177
|
+
assert.ok(agents.find((agent) => agent.name === "legacy"));
|
|
2178
|
+
assert.equal(agents.some((agent) => agent.filePath.includes(`${path.sep}.agents${path.sep}skills${path.sep}`)), false);
|
|
2179
|
+
assert.equal(agents.some((agent) => agent.name === "directory-skill"), false);
|
|
2180
|
+
assert.equal(agents.some((agent) => agent.name === "file-skill"), false);
|
|
2181
|
+
});
|
|
2182
|
+
|
|
2183
|
+
it("does not register user SKILL.md files as agents", () => withTempHome((home) => {
|
|
2184
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-user-skills-not-agents-"));
|
|
2185
|
+
tempDirs.push(dir);
|
|
2186
|
+
writeAgent(path.join(home, ".agents", "user-agent.md"), `---
|
|
2187
|
+
name: user-agent
|
|
2188
|
+
description: User agent
|
|
2189
|
+
---
|
|
2190
|
+
|
|
2191
|
+
User prompt
|
|
2192
|
+
`);
|
|
2193
|
+
writeAgent(path.join(home, ".agents", "skills", "user-skill", "SKILL.md"), `---
|
|
2194
|
+
name: user-skill
|
|
2195
|
+
description: User skill
|
|
2196
|
+
---
|
|
2197
|
+
|
|
2198
|
+
Skill prompt
|
|
2199
|
+
`);
|
|
2200
|
+
|
|
2201
|
+
const agents = discoverAgents(dir, "user").agents;
|
|
2202
|
+
assert.ok(agents.find((agent) => agent.name === "user-agent"));
|
|
2203
|
+
assert.equal(agents.some((agent) => agent.filePath.includes(`${path.sep}.agents${path.sep}skills${path.sep}`)), false);
|
|
2204
|
+
assert.equal(agents.some((agent) => agent.name === "user-skill"), false);
|
|
2205
|
+
}));
|
|
2206
|
+
|
|
2207
|
+
it("prefers .selesai/agents over .agents on project agent name collisions", () => {
|
|
2208
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-project-agent-collision-"));
|
|
2209
|
+
tempDirs.push(dir);
|
|
2210
|
+
fs.mkdirSync(path.join(dir, ".agents"), { recursive: true });
|
|
2211
|
+
fs.mkdirSync(path.join(dir, ".selesai", "agents"), { recursive: true });
|
|
2212
|
+
fs.writeFileSync(path.join(dir, ".agents", "shared.md"), `---
|
|
2213
|
+
name: shared
|
|
2214
|
+
description: Legacy shared
|
|
2215
|
+
---
|
|
2216
|
+
|
|
2217
|
+
Legacy prompt
|
|
2218
|
+
`, "utf-8");
|
|
2219
|
+
fs.writeFileSync(path.join(dir, ".selesai", "agents", "shared.md"), `---
|
|
2220
|
+
name: shared
|
|
2221
|
+
description: Canonical shared
|
|
2222
|
+
---
|
|
2223
|
+
|
|
2224
|
+
Canonical prompt
|
|
2225
|
+
`, "utf-8");
|
|
2226
|
+
|
|
2227
|
+
const shared = discoverAgents(dir, "project").agents.find((agent) => agent.name === "shared");
|
|
2228
|
+
assert.ok(shared);
|
|
2229
|
+
assert.equal(shared.filePath, path.join(dir, ".selesai", "agents", "shared.md"));
|
|
2230
|
+
assert.equal(shared.description, "Canonical shared");
|
|
2231
|
+
assert.equal(shared.systemPrompt.trim(), "Canonical prompt");
|
|
2232
|
+
});
|
|
2233
|
+
|
|
2234
|
+
it("uses the project root for the canonical project agent dir even when only .agents exists", () => {
|
|
2235
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-project-agent-root-"));
|
|
2236
|
+
tempDirs.push(dir);
|
|
2237
|
+
const nested = path.join(dir, "packages", "app");
|
|
2238
|
+
fs.mkdirSync(path.join(dir, ".agents", "skills"), { recursive: true });
|
|
2239
|
+
fs.mkdirSync(nested, { recursive: true });
|
|
2240
|
+
|
|
2241
|
+
const result = discoverAgentsAll(nested);
|
|
2242
|
+
assert.equal(result.projectDir, path.join(dir, ".selesai", "agents"));
|
|
2243
|
+
});
|
|
2244
|
+
|
|
2245
|
+
it("discovers project chains from .selesai/chains", () => {
|
|
2246
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-project-chain-dirs-"));
|
|
2247
|
+
tempDirs.push(dir);
|
|
2248
|
+
fs.mkdirSync(path.join(dir, ".selesai", "agents"), { recursive: true });
|
|
2249
|
+
fs.mkdirSync(path.join(dir, ".selesai", "chains", "flows"), { recursive: true });
|
|
2250
|
+
fs.writeFileSync(path.join(dir, ".selesai", "agents", "ignored.chain.md"), `---
|
|
2251
|
+
name: ignored-chain
|
|
2252
|
+
description: Ignored chain
|
|
2253
|
+
---
|
|
2254
|
+
|
|
2255
|
+
## scout
|
|
2256
|
+
|
|
2257
|
+
Ignore
|
|
2258
|
+
`, "utf-8");
|
|
2259
|
+
fs.writeFileSync(path.join(dir, ".selesai", "chains", "flows", "canonical.chain.md"), `---
|
|
2260
|
+
name: canonical-chain
|
|
2261
|
+
description: Canonical chain
|
|
2262
|
+
---
|
|
2263
|
+
|
|
2264
|
+
## worker
|
|
2265
|
+
|
|
2266
|
+
Inspect canonical
|
|
2267
|
+
`, "utf-8");
|
|
2268
|
+
|
|
2269
|
+
const result = discoverAgentsAll(dir);
|
|
2270
|
+
assert.equal(result.chains.some((chain) => chain.name === "ignored-chain"), false);
|
|
2271
|
+
assert.ok(result.chains.find((chain) => chain.name === "canonical-chain" && chain.filePath === path.join(dir, ".selesai", "chains", "flows", "canonical.chain.md")));
|
|
2272
|
+
assert.equal(result.projectDir, path.join(dir, ".selesai", "agents"));
|
|
2273
|
+
assert.equal(result.projectChainDir, path.join(dir, ".selesai", "chains"));
|
|
2274
|
+
});
|
|
2275
|
+
|
|
2276
|
+
it("prefers project .selesai/chains over user chains on name collisions", () => {
|
|
2277
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-project-chain-collision-"));
|
|
2278
|
+
const home = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-user-chain-home-"));
|
|
2279
|
+
tempDirs.push(dir, home);
|
|
2280
|
+
const oldHome = process.env.HOME;
|
|
2281
|
+
const oldUserProfile = process.env.USERPROFILE;
|
|
2282
|
+
process.env.HOME = home;
|
|
2283
|
+
process.env.USERPROFILE = home;
|
|
2284
|
+
try {
|
|
2285
|
+
const userChainsDir = path.join(home, ".selesai", "agent", "chains");
|
|
2286
|
+
fs.mkdirSync(userChainsDir, { recursive: true });
|
|
2287
|
+
fs.mkdirSync(path.join(dir, ".selesai", "chains"), { recursive: true });
|
|
2288
|
+
fs.writeFileSync(path.join(userChainsDir, "shared.chain.md"), `---
|
|
2289
|
+
name: shared-chain
|
|
2290
|
+
description: User chain
|
|
2291
|
+
---
|
|
2292
|
+
|
|
2293
|
+
## scout
|
|
2294
|
+
|
|
2295
|
+
Inspect user
|
|
2296
|
+
`, "utf-8");
|
|
2297
|
+
fs.writeFileSync(path.join(dir, ".selesai", "chains", "shared.chain.md"), `---
|
|
2298
|
+
name: shared-chain
|
|
2299
|
+
description: Project chain
|
|
2300
|
+
---
|
|
2301
|
+
|
|
2302
|
+
## worker
|
|
2303
|
+
|
|
2304
|
+
Inspect project
|
|
2305
|
+
`, "utf-8");
|
|
2306
|
+
|
|
2307
|
+
const sharedChains = discoverAgentsAll(dir).chains.filter((chain) => chain.name === "shared-chain");
|
|
2308
|
+
assert.equal(sharedChains.length, 2);
|
|
2309
|
+
assert.deepEqual(sharedChains.map((chain) => chain.source), ["user", "project"]);
|
|
2310
|
+
const savedChainLookup = new Map(sharedChains.map((chain) => [chain.name, chain]));
|
|
2311
|
+
const shared = savedChainLookup.get("shared-chain");
|
|
2312
|
+
assert.ok(shared);
|
|
2313
|
+
assert.equal(shared.filePath, path.join(dir, ".selesai", "chains", "shared.chain.md"));
|
|
2314
|
+
assert.equal(shared.description, "Project chain");
|
|
2315
|
+
assert.equal(shared.steps[0]?.agent, "worker");
|
|
2316
|
+
assert.equal(shared.steps[0]?.task, "Inspect project");
|
|
2317
|
+
} finally {
|
|
2318
|
+
if (oldHome === undefined) delete process.env.HOME;
|
|
2319
|
+
else process.env.HOME = oldHome;
|
|
2320
|
+
if (oldUserProfile === undefined) delete process.env.USERPROFILE;
|
|
2321
|
+
else process.env.USERPROFILE = oldUserProfile;
|
|
2322
|
+
}
|
|
2323
|
+
});
|
|
2324
|
+
});
|