@selesai/code 0.8.2 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +4 -2
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.js +18 -0
- package/dist/cli/config-selector.js +2 -2
- package/dist/cli/startup-ui.d.ts +1 -1
- package/dist/cli/startup-ui.js +2 -2
- package/dist/core/keybindings.d.ts +44 -4
- package/dist/core/llama/provider.js +22 -7
- package/dist/core/model-resolver.js +2 -0
- package/dist/core/model-runtime.d.ts +4 -2
- package/dist/core/model-runtime.js +23 -2
- package/dist/core/remote-catalog-provider.js +72 -67
- package/dist/core/settings-manager.d.ts +8 -0
- package/dist/core/settings-manager.js +18 -0
- package/dist/extensions/handoff-new.ts +1 -1
- package/dist/extensions/inline-skills.test.ts +1 -0
- package/dist/extensions/inline-skills.ts +1 -1
- package/dist/extensions/pi-intercom/CHANGELOG.md +25 -3
- package/dist/extensions/pi-intercom/README.md +34 -15
- package/dist/extensions/pi-intercom/broker/broker.ts +38 -141
- package/dist/extensions/pi-intercom/broker/client-liveness.test.ts +173 -0
- package/dist/extensions/pi-intercom/broker/client.ts +78 -150
- package/dist/extensions/pi-intercom/broker/extension-state.ts +18 -7
- package/dist/extensions/pi-intercom/broker/framing.ts +1 -1
- package/dist/extensions/pi-intercom/broker/protocol.ts +182 -0
- package/dist/extensions/pi-intercom/broker/spawn.test.ts +106 -7
- package/dist/extensions/pi-intercom/broker/spawn.ts +37 -11
- package/dist/extensions/pi-intercom/config.test.ts +8 -10
- package/dist/extensions/pi-intercom/config.ts +3 -3
- package/dist/extensions/pi-intercom/index.ts +218 -147
- package/dist/extensions/pi-intercom/intercom.integration.test.ts +891 -103
- package/dist/extensions/pi-intercom/package.json +3 -2
- 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 +86 -1
- package/dist/extensions/pi-intercom/reply-tracker.ts +41 -9
- package/dist/extensions/pi-intercom/skills/pi-intercom/SKILL.md +49 -9
- package/dist/extensions/pi-intercom/test/inline-message.test.ts +9 -9
- package/dist/extensions/pi-intercom/types.ts +3 -1
- package/dist/extensions/pi-intercom/ui/inline-message.ts +7 -7
- package/dist/extensions/pi-powerline-footer/.github/workflows/test.yml +2 -2
- package/dist/extensions/pi-powerline-footer/CHANGELOG.md +15 -1
- package/dist/extensions/pi-powerline-footer/README.md +20 -37
- package/dist/extensions/pi-powerline-footer/bash-mode/completion.ts +40 -25
- package/dist/extensions/pi-powerline-footer/bash-mode/editor.ts +149 -18
- package/dist/extensions/pi-powerline-footer/bash-mode/types.ts +1 -0
- package/dist/extensions/pi-powerline-footer/editor-performance.ts +99 -0
- package/dist/extensions/pi-powerline-footer/git-status.ts +15 -0
- package/dist/extensions/pi-powerline-footer/index.ts +394 -586
- package/dist/extensions/pi-powerline-footer/package.json +5 -6
- package/dist/extensions/pi-powerline-footer/powerline-config.ts +0 -18
- package/dist/extensions/pi-powerline-footer/queue/store.ts +8 -56
- package/dist/extensions/pi-powerline-footer/queue/types.ts +1 -2
- package/dist/extensions/pi-powerline-footer/segments.ts +0 -3
- package/dist/extensions/pi-powerline-footer/tests/bash-mode.test.ts +231 -1
- package/dist/extensions/pi-powerline-footer/tests/custom-items.test.ts +5 -19
- package/dist/extensions/pi-powerline-footer/tests/editor-performance.test.ts +43 -0
- package/dist/extensions/pi-powerline-footer/tests/fixed-editor-border.test.ts +2 -2
- package/dist/extensions/pi-powerline-footer/tests/git-optional-locks.test.ts +64 -0
- package/dist/extensions/pi-powerline-footer/tests/guide.test.ts +1 -1
- package/dist/extensions/pi-powerline-footer/tests/jump-shortcuts.test.ts +86 -19
- package/dist/extensions/pi-powerline-footer/tests/queue-store.test.ts +19 -149
- package/dist/extensions/pi-powerline-footer/tests/remaining-regressions.test.ts +6 -0
- package/dist/extensions/pi-powerline-footer/tests/usage-display.test.ts +5 -5
- package/dist/extensions/pi-powerline-footer/tsconfig.json +1 -1
- package/dist/extensions/pi-powerline-footer/types.ts +1 -2
- package/dist/extensions/pi-subagents/CHANGELOG.md +202 -14
- package/dist/extensions/pi-subagents/README.md +65 -1614
- package/dist/extensions/pi-subagents/agents/builder.md +0 -1
- package/dist/extensions/pi-subagents/agents/delegate.md +14 -0
- package/dist/extensions/pi-subagents/agents/oracle.md +74 -0
- package/dist/extensions/pi-subagents/agents/reviewer.md +78 -0
- package/dist/extensions/pi-subagents/agents/scout.md +50 -0
- package/dist/extensions/pi-subagents/agents/worker.md +58 -0
- package/dist/extensions/pi-subagents/docs/configuration.md +328 -0
- package/dist/extensions/pi-subagents/docs/extension-api.md +308 -0
- package/dist/extensions/pi-subagents/docs/missions.md +119 -0
- package/dist/extensions/pi-subagents/docs/models.md +192 -0
- package/dist/extensions/pi-subagents/docs/observability.md +174 -0
- package/dist/extensions/pi-subagents/docs/tool-reference.md +343 -0
- package/dist/extensions/pi-subagents/docs/watchdog.md +176 -0
- package/dist/extensions/pi-subagents/docs/workflows.md +163 -0
- package/dist/extensions/pi-subagents/inspector-runner.mjs +11 -0
- package/dist/extensions/pi-subagents/package-lock.json +152 -194
- package/dist/extensions/pi-subagents/package.json +9 -10
- package/dist/extensions/pi-subagents/prompts/gather-context-and-clarify.md +1 -1
- package/dist/extensions/pi-subagents/prompts/parallel-cleanup.md +9 -9
- package/dist/extensions/pi-subagents/prompts/parallel-research.md +6 -6
- package/dist/extensions/pi-subagents/prompts/parallel-review.md +8 -8
- package/dist/extensions/pi-subagents/prompts/review-loop.md +12 -12
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +22 -17
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +77 -72
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +177 -69
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +28 -8
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +88 -66
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +3 -3
- package/dist/extensions/pi-subagents/src/agents/agent-refinements.ts +624 -0
- package/dist/extensions/pi-subagents/src/agents/agents.ts +29 -16
- package/dist/extensions/pi-subagents/src/agents/frontmatter.ts +7 -3
- package/dist/extensions/pi-subagents/src/agents/proactive-skills.ts +2 -2
- package/dist/extensions/pi-subagents/src/agents/skills.ts +2 -9
- package/dist/extensions/pi-subagents/src/api/delegation.ts +1 -2
- package/dist/extensions/pi-subagents/src/api/project-panes.ts +30 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +56 -8
- package/dist/extensions/pi-subagents/src/extension/control-notices.ts +2 -2
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +51 -26
- package/dist/extensions/pi-subagents/src/extension/index.ts +119 -50
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +72 -0
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +15 -15
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +58 -21
- package/dist/extensions/pi-subagents/src/extension/subagent-guide.ts +39 -0
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +47 -25
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +3 -3
- package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +460 -64
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +102 -4
- package/dist/extensions/pi-subagents/src/missions/actions.ts +77 -16
- package/dist/extensions/pi-subagents/src/missions/goal-driver.ts +162 -0
- package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +65 -14
- package/dist/extensions/pi-subagents/src/missions/store.ts +147 -5
- package/dist/extensions/pi-subagents/src/missions/types.ts +58 -3
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +256 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +8 -8
- package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +42 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +41 -7
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +294 -134
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +19 -3
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +39 -6
- package/dist/extensions/pi-subagents/src/runs/background/completion-replay.ts +267 -0
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +145 -60
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +114 -6
- package/dist/extensions/pi-subagents/src/runs/background/resume-guidance.ts +33 -0
- package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +68 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +71 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +21 -2
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +42 -14
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +12 -24
- package/dist/extensions/pi-subagents/src/runs/background/steering.ts +7 -5
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +152 -68
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +17 -4
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +146 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +21 -5
- package/dist/extensions/pi-subagents/src/runs/foreground/async-dismiss-action.ts +85 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +43 -18
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +20 -19
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +3 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +55 -26
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +137 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +798 -112
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +187 -0
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +165 -22
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +9 -5
- package/dist/extensions/pi-subagents/src/runs/shared/model-scope.ts +12 -2
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +1 -0
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +465 -116
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +10 -10
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +189 -32
- package/dist/extensions/pi-subagents/src/runs/shared/task-intent.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +3 -3
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +128 -3
- package/dist/extensions/pi-subagents/src/shared/display-text.ts +100 -0
- package/dist/extensions/pi-subagents/src/shared/file-coalescer.ts +9 -0
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +13 -0
- package/dist/extensions/pi-subagents/src/shared/formatters.ts +4 -6
- package/dist/extensions/pi-subagents/src/shared/prompt-resources.ts +51 -0
- package/dist/extensions/pi-subagents/src/shared/settings.ts +41 -11
- package/dist/extensions/pi-subagents/src/shared/types.ts +100 -3
- package/dist/extensions/pi-subagents/src/shared/utf8.ts +11 -0
- package/dist/extensions/pi-subagents/src/shared/utils.ts +43 -33
- package/dist/extensions/pi-subagents/src/slash/delegation-adapters.ts +1 -14
- package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +1 -1
- package/dist/extensions/pi-subagents/src/slash/prompt-template-bridge.ts +14 -12
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +176 -21
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +12 -6
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +52 -18
- package/dist/extensions/pi-subagents/src/slash/slash-live-state.ts +36 -5
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +30 -16
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +151 -31
- package/dist/extensions/pi-subagents/src/tui/render.ts +201 -68
- package/dist/extensions/pi-subagents/src/types/pi-runtime-compat.d.ts +0 -6
- package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +5 -4
- package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +0 -1
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +313 -25
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +15 -15
- 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 +15 -15
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +411 -300
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +309 -123
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +99 -56
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +62 -16
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +159 -108
- package/dist/extensions/pi-subagents/test/integration/detect-error.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +4 -2
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +56 -56
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +114 -45
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +57 -19
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +106 -106
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +416 -106
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +287 -17
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +809 -87
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +107 -20
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +26 -6
- package/dist/extensions/pi-subagents/test/integration/top-level-async.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/support/helpers.ts +2 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +1 -1
- package/dist/extensions/pi-subagents/test/support/ts-loader.mjs +0 -8
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +163 -58
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +15 -15
- package/dist/extensions/pi-subagents/test/unit/agent-eject-disable.test.ts +66 -66
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +334 -248
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +52 -52
- package/dist/extensions/pi-subagents/test/unit/agent-memory.test.ts +26 -26
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +99 -99
- package/dist/extensions/pi-subagents/test/unit/agent-refinements.test.ts +160 -0
- package/dist/extensions/pi-subagents/test/unit/agent-selection.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +43 -1
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +36 -10
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +387 -30
- package/dist/extensions/pi-subagents/test/unit/async-permission-session.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +94 -40
- package/dist/extensions/pi-subagents/test/unit/background-work.test.ts +5 -3
- package/dist/extensions/pi-subagents/test/unit/builtin-agent-documentation.test.ts +7 -7
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling-agent-allowlist.test.ts +19 -19
- package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +19 -19
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/chain-serializer.test.ts +20 -20
- package/dist/extensions/pi-subagents/test/unit/child-transcript.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +35 -5
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +52 -52
- package/dist/extensions/pi-subagents/test/unit/completion-replay.test.ts +187 -0
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +125 -71
- package/dist/extensions/pi-subagents/test/unit/control-notices.test.ts +18 -3
- package/dist/extensions/pi-subagents/test/unit/default-extensions.test.ts +12 -12
- package/dist/extensions/pi-subagents/test/unit/delegation-api.test.ts +17 -23
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +25 -25
- package/dist/extensions/pi-subagents/test/unit/extra-agent-dirs.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/file-coalescer.test.ts +15 -0
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +62 -44
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +329 -37
- package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/foreground-tool-call-compaction.test.ts +37 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector-bootstrap.test.ts +69 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +79 -2
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +102 -49
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +98 -32
- package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +5 -5
- package/dist/extensions/pi-subagents/test/unit/mission-goal-driver.test.ts +116 -0
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +55 -7
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +289 -13
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +28 -1
- package/dist/extensions/pi-subagents/test/unit/model-scope-settings.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/model-scope.test.ts +11 -2
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +84 -10
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +122 -8
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +8 -8
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +24 -24
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +16 -2
- package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +7 -7
- package/dist/extensions/pi-subagents/test/unit/parallel-utils.test.ts +10 -10
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/path-resolution.test.ts +26 -17
- package/dist/extensions/pi-subagents/test/unit/pi-args-permission-system.test.ts +405 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +357 -92
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +22 -6
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +6 -6
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +43 -43
- package/dist/extensions/pi-subagents/test/unit/proactive-skills.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/process-terminal.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +19 -19
- package/dist/extensions/pi-subagents/test/unit/project-panes-public-api.test.ts +243 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-template-bridge.test.ts +68 -168
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +58 -15
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +40 -0
- package/dist/extensions/pi-subagents/test/unit/reads-resolution.test.ts +66 -0
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +47 -28
- package/dist/extensions/pi-subagents/test/unit/result-intercom.test.ts +12 -12
- package/dist/extensions/pi-subagents/test/unit/retained-children.test.ts +57 -0
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +107 -27
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +56 -50
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +69 -28
- package/dist/extensions/pi-subagents/test/unit/scheduled-store-root.test.ts +67 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +59 -44
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +424 -49
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +23 -1
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +32 -5
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +120 -91
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +2 -2
- 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 +35 -35
- package/dist/extensions/pi-subagents/test/unit/subagent-guide.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +312 -22
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +150 -15
- package/dist/extensions/pi-subagents/test/unit/task-intent.test.ts +26 -26
- package/dist/extensions/pi-subagents/test/unit/timeout-defaults.test.ts +73 -0
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +76 -25
- package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +5 -5
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +55 -6
- package/dist/extensions/pi-subagents/test/unit/watchdog-child-status.test.ts +13 -13
- package/dist/extensions/pi-subagents/test/unit/watchdog-lsp-diagnostics.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/watchdog-runtime.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/watchdog-settings.test.ts +8 -8
- package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +6 -6
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +138 -11
- package/dist/extensions/pi-subagents/test/unit/workflow-graph.test.ts +8 -8
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +113 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +7 -7
- package/dist/extensions/pi-subagents/test/unit/writer-budget-guidance.test.ts +6 -6
- package/dist/extensions/workflow/extension.ts +21 -19
- package/dist/extensions/workflow/modes.ts +65 -0
- package/dist/index.d.ts +1 -1
- package/dist/main.js +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +6 -2
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/interactive-mode.d.ts +28 -0
- package/dist/modes/interactive/interactive-mode.js +214 -28
- package/dist/modes/interactive/theme/dark.json +1 -0
- package/dist/modes/interactive/theme/light.json +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +3 -0
- package/dist/modes/interactive/theme/theme-controller.js +10 -1
- package/dist/modes/interactive/theme/theme.d.ts +2 -2
- package/dist/modes/interactive/theme/theme.js +24 -6
- package/dist/skills/pi-subagents/SKILL.md +20 -15
- package/dist/skills/pi-subagents/references/constraints-and-recipes.md +77 -83
- package/dist/skills/pi-subagents/references/execution-controls.md +215 -106
- package/dist/skills/pi-subagents/references/management-authoring-rpc.md +29 -9
- package/dist/skills/pi-subagents/references/prompting-and-roles.md +58 -43
- package/docs/keybindings.md +35 -7
- package/docs/plans/workflow-autoloop-reference.md +192 -0
- package/docs/plans/workflow-subagent-consolidation-planb.md +374 -0
- package/docs/plans/workflow-subagent-scripted-merge.md +406 -0
- package/docs/settings.md +16 -14
- package/docs/usage.md +5 -0
- package/package.json +5 -5
- package/dist/extensions/pi-powerline-footer/fixed-editor/cluster.ts +0 -113
- package/dist/extensions/pi-powerline-footer/fixed-editor/terminal-split.ts +0 -1080
- package/dist/extensions/pi-powerline-footer/tests/fixed-editor.test.ts +0 -1452
- package/dist/extensions/workflow/adapter.ts +0 -949
- package/dist/extensions/workflow/modes/loop.ts +0 -74
- package/dist/extensions/workflow/modes/prototype.ts +0 -170
- package/dist/extensions/workflow/modes/quicktype.ts +0 -150
- package/dist/extensions/workflow/modes/task.ts +0 -105
- package/dist/extensions/workflow/run-state.ts +0 -124
- package/dist/extensions/workflow/state-machine.ts +0 -484
- package/dist/extensions/workflow/validators.ts +0 -42
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
2
3
|
import * as fs from "node:fs";
|
|
3
4
|
import * as os from "node:os";
|
|
4
5
|
import * as path from "node:path";
|
|
@@ -23,6 +24,50 @@ function writeAgent(filePath: string, body: string): void {
|
|
|
23
24
|
fs.writeFileSync(filePath, body, "utf-8");
|
|
24
25
|
}
|
|
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
|
+
|
|
26
71
|
function withTempHome<T>(fn: (home: string) => T): T {
|
|
27
72
|
const home = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-package-home-"));
|
|
28
73
|
tempDirs.push(home);
|
|
@@ -60,7 +105,7 @@ describe("folded frontmatter blocks", () => {
|
|
|
60
105
|
it("folds ordinary lines and paragraph breaks for > and >-", () => {
|
|
61
106
|
const expected = "first line second line\nthird line";
|
|
62
107
|
const folded = parseFrontmatter(`---
|
|
63
|
-
name:
|
|
108
|
+
name: worker
|
|
64
109
|
description: >
|
|
65
110
|
first line
|
|
66
111
|
second line
|
|
@@ -69,7 +114,7 @@ description: >
|
|
|
69
114
|
---
|
|
70
115
|
body`);
|
|
71
116
|
const stripped = parseFrontmatter(`---
|
|
72
|
-
name:
|
|
117
|
+
name: worker
|
|
73
118
|
description: >-
|
|
74
119
|
first line
|
|
75
120
|
second line
|
|
@@ -80,7 +125,7 @@ body`);
|
|
|
80
125
|
|
|
81
126
|
assert.equal(folded.frontmatter.description, expected);
|
|
82
127
|
assert.equal(stripped.frontmatter.description, expected);
|
|
83
|
-
assert.equal(folded.frontmatter.name, "
|
|
128
|
+
assert.equal(folded.frontmatter.name, "worker");
|
|
84
129
|
});
|
|
85
130
|
|
|
86
131
|
it("keeps quoted indicators as literal values", () => {
|
|
@@ -94,6 +139,18 @@ body`);
|
|
|
94
139
|
assert.equal(parsed.frontmatter.other, ">-");
|
|
95
140
|
});
|
|
96
141
|
|
|
142
|
+
it("preserves lines for | and |-", () => {
|
|
143
|
+
for (const indicator of ["|", "|-"]) {
|
|
144
|
+
const parsed = parseFrontmatter(`---
|
|
145
|
+
description: ${indicator}
|
|
146
|
+
first line
|
|
147
|
+
second line
|
|
148
|
+
---
|
|
149
|
+
body`);
|
|
150
|
+
assert.equal(parsed.frontmatter.description, "first line\nsecond line");
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
97
154
|
it("preserves more-indented lines and repeated whitespace-only separators", () => {
|
|
98
155
|
const parsed = parseFrontmatter(`---
|
|
99
156
|
description: >
|
|
@@ -105,12 +162,12 @@ description: >
|
|
|
105
162
|
|
|
106
163
|
${" ".repeat(3)}
|
|
107
164
|
second
|
|
108
|
-
name:
|
|
165
|
+
name: worker
|
|
109
166
|
---
|
|
110
167
|
body`);
|
|
111
168
|
|
|
112
169
|
assert.equal(parsed.frontmatter.description, "normal\n code\nnext\nfirst\n\nsecond");
|
|
113
|
-
assert.equal(parsed.frontmatter.name, "
|
|
170
|
+
assert.equal(parsed.frontmatter.name, "worker");
|
|
114
171
|
});
|
|
115
172
|
|
|
116
173
|
it("keeps paragraph breaks adjacent to more-indented lines", () => {
|
|
@@ -183,16 +240,16 @@ describe("agent skillPath frontmatter", () => {
|
|
|
183
240
|
it("parses and serializes comma-separated paths", () => withTempHome(() => {
|
|
184
241
|
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-skill-path-agent-"));
|
|
185
242
|
tempDirs.push(project);
|
|
186
|
-
writeAgent(path.join(project, ".selesai", "agents", "
|
|
187
|
-
name:
|
|
243
|
+
writeAgent(path.join(project, ".selesai", "agents", "worker.md"), `---
|
|
244
|
+
name: worker
|
|
188
245
|
description: Worker
|
|
189
246
|
skillPath: ./skills, ../shared-skills
|
|
190
247
|
---
|
|
191
248
|
body`);
|
|
192
249
|
|
|
193
|
-
const
|
|
194
|
-
assert.deepEqual(
|
|
195
|
-
assert.match(serializeAgent(
|
|
250
|
+
const worker = discoverAgents(project, "both").agents.find((agent) => agent.name === "worker")!;
|
|
251
|
+
assert.deepEqual(worker.skillPath, ["./skills", "../shared-skills"]);
|
|
252
|
+
assert.match(serializeAgent(worker), /^skillPath: \.\/skills, \.\.\/shared-skills$/m);
|
|
196
253
|
}));
|
|
197
254
|
});
|
|
198
255
|
|
|
@@ -200,20 +257,20 @@ describe("agent aliases", () => {
|
|
|
200
257
|
it("parses and serializes agent aliases", () => withTempHome(() => {
|
|
201
258
|
const project = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-alias-agent-"));
|
|
202
259
|
tempDirs.push(project);
|
|
203
|
-
writeAgent(path.join(project, ".selesai", "agents", "
|
|
204
|
-
name:
|
|
260
|
+
writeAgent(path.join(project, ".selesai", "agents", "worker.md"), `---
|
|
261
|
+
name: worker
|
|
205
262
|
description: Worker
|
|
206
|
-
aliases: developer, coder,
|
|
263
|
+
aliases: developer, coder, worker
|
|
207
264
|
---
|
|
208
265
|
body`);
|
|
209
266
|
|
|
210
|
-
const
|
|
211
|
-
assert.deepEqual(
|
|
212
|
-
assert.match(serializeAgent(
|
|
267
|
+
const worker = discoverAgents(project, "both").agents.find((agent) => agent.name === "worker")!;
|
|
268
|
+
assert.deepEqual(worker.aliases, ["developer", "coder"]);
|
|
269
|
+
assert.match(serializeAgent(worker), /^aliases: developer, coder$/m);
|
|
213
270
|
|
|
214
271
|
const ctx = { cwd: project, modelRegistry: { getAvailable: () => [] } };
|
|
215
272
|
assert.match(handleManagementAction("list", {}, ctx).content[0]?.text ?? "", /aliases: developer, coder/);
|
|
216
|
-
assert.match(handleManagementAction("get", { agent: "developer" }, ctx).content[0]?.text ?? "", /Agent:
|
|
273
|
+
assert.match(handleManagementAction("get", { agent: "developer" }, ctx).content[0]?.text ?? "", /Agent: worker/);
|
|
217
274
|
}));
|
|
218
275
|
|
|
219
276
|
it("reports management alias collisions as ambiguous", () => withTempHome(() => {
|
|
@@ -221,7 +278,7 @@ body`);
|
|
|
221
278
|
tempDirs.push(project);
|
|
222
279
|
writeAgent(path.join(project, ".selesai", "agents", "review-agent.md"), `---
|
|
223
280
|
name: review-agent
|
|
224
|
-
description: Custom
|
|
281
|
+
description: Custom reviewer
|
|
225
282
|
aliases: developer
|
|
226
283
|
---
|
|
227
284
|
body`);
|
|
@@ -229,11 +286,11 @@ body`);
|
|
|
229
286
|
const ctx = { cwd: project, modelRegistry: { getAvailable: () => [] } };
|
|
230
287
|
const getResult = handleManagementAction("get", { agent: "developer" }, ctx);
|
|
231
288
|
assert.equal(getResult.isError, true);
|
|
232
|
-
assert.match(getResult.content[0]?.text ?? "", /Ambiguous agent alias or name 'developer':
|
|
289
|
+
assert.match(getResult.content[0]?.text ?? "", /Ambiguous agent alias or name 'developer': review-agent, worker/);
|
|
233
290
|
|
|
234
291
|
const disableResult = handleManagementAction("disable", { agent: "developer" }, ctx);
|
|
235
292
|
assert.equal(disableResult.isError, true);
|
|
236
|
-
assert.match(disableResult.content[0]?.text ?? "", /Ambiguous agent alias 'developer':
|
|
293
|
+
assert.match(disableResult.content[0]?.text ?? "", /Ambiguous agent alias 'developer': worker, review-agent|Ambiguous agent alias 'developer': review-agent, worker/);
|
|
237
294
|
}));
|
|
238
295
|
});
|
|
239
296
|
|
|
@@ -241,8 +298,8 @@ describe("agent simple-scalar list frontmatter", () => {
|
|
|
241
298
|
it("discovers newline block lists for all list fields and routes MCP tools", () => {
|
|
242
299
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-block-list-frontmatter-"));
|
|
243
300
|
tempDirs.push(dir);
|
|
244
|
-
writeAgent(path.join(dir, ".selesai", "agents", "
|
|
245
|
-
name:
|
|
301
|
+
writeAgent(path.join(dir, ".selesai", "agents", "worker.md"), `---
|
|
302
|
+
name: worker
|
|
246
303
|
description: Worker
|
|
247
304
|
tools:
|
|
248
305
|
- read-only
|
|
@@ -270,15 +327,15 @@ subagentOnlyExtensions:
|
|
|
270
327
|
Do work
|
|
271
328
|
`);
|
|
272
329
|
|
|
273
|
-
const
|
|
274
|
-
assert.deepEqual(
|
|
275
|
-
assert.deepEqual(
|
|
276
|
-
assert.deepEqual(
|
|
277
|
-
assert.deepEqual(
|
|
278
|
-
assert.deepEqual(
|
|
279
|
-
assert.deepEqual(
|
|
280
|
-
assert.deepEqual(
|
|
281
|
-
assert.deepEqual(
|
|
330
|
+
const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
|
|
331
|
+
assert.deepEqual(worker?.tools, ["read-only"]);
|
|
332
|
+
assert.deepEqual(worker?.mcpDirectTools, ["github/search_repositories"]);
|
|
333
|
+
assert.deepEqual(worker?.defaultReads, ["input-one.md", "input-two.md"]);
|
|
334
|
+
assert.deepEqual(worker?.skills, ["review-checklist", "safe-bash"]);
|
|
335
|
+
assert.deepEqual(worker?.skillPath, ["./private-skills", "../shared-skills"]);
|
|
336
|
+
assert.deepEqual(worker?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
|
|
337
|
+
assert.deepEqual(worker?.extensions, ["./extension-one.ts", "./extension-two.ts"]);
|
|
338
|
+
assert.deepEqual(worker?.subagentOnlyExtensions, ["./child-only.ts", "./child-helper.ts"]);
|
|
282
339
|
});
|
|
283
340
|
|
|
284
341
|
it("preserves MCP-only tools as an explicit empty builtin allowlist", () => {
|
|
@@ -302,8 +359,8 @@ Do MCP work
|
|
|
302
359
|
it("preserves comma-separated syntax across all list fields", () => {
|
|
303
360
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-comma-list-frontmatter-"));
|
|
304
361
|
tempDirs.push(dir);
|
|
305
|
-
writeAgent(path.join(dir, ".selesai", "agents", "
|
|
306
|
-
name:
|
|
362
|
+
writeAgent(path.join(dir, ".selesai", "agents", "worker.md"), `---
|
|
363
|
+
name: worker
|
|
307
364
|
description: Worker
|
|
308
365
|
tools: read-only, mcp:github/search_repositories
|
|
309
366
|
defaultReads: input-one.md, input-two.md
|
|
@@ -317,15 +374,15 @@ subagentOnlyExtensions: ./child-only.ts, ./child-helper.ts
|
|
|
317
374
|
Do work
|
|
318
375
|
`);
|
|
319
376
|
|
|
320
|
-
const
|
|
321
|
-
assert.deepEqual(
|
|
322
|
-
assert.deepEqual(
|
|
323
|
-
assert.deepEqual(
|
|
324
|
-
assert.deepEqual(
|
|
325
|
-
assert.deepEqual(
|
|
326
|
-
assert.deepEqual(
|
|
327
|
-
assert.deepEqual(
|
|
328
|
-
assert.deepEqual(
|
|
377
|
+
const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
|
|
378
|
+
assert.deepEqual(worker?.tools, ["read-only"]);
|
|
379
|
+
assert.deepEqual(worker?.mcpDirectTools, ["github/search_repositories"]);
|
|
380
|
+
assert.deepEqual(worker?.defaultReads, ["input-one.md", "input-two.md"]);
|
|
381
|
+
assert.deepEqual(worker?.skills, ["review-checklist", "safe-bash"]);
|
|
382
|
+
assert.deepEqual(worker?.skillPath, ["./private-skills", "../shared-skills"]);
|
|
383
|
+
assert.deepEqual(worker?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
|
|
384
|
+
assert.deepEqual(worker?.extensions, ["./extension-one.ts", "./extension-two.ts"]);
|
|
385
|
+
assert.deepEqual(worker?.subagentOnlyExtensions, ["./child-only.ts", "./child-helper.ts"]);
|
|
329
386
|
});
|
|
330
387
|
});
|
|
331
388
|
|
|
@@ -335,8 +392,8 @@ describe("agent permission frontmatter", () => {
|
|
|
335
392
|
tempDirs.push(dir);
|
|
336
393
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
337
394
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
338
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
339
|
-
name:
|
|
395
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
396
|
+
name: worker
|
|
340
397
|
description: Worker
|
|
341
398
|
tools: bash,read,write
|
|
342
399
|
permission:
|
|
@@ -348,10 +405,10 @@ permission:
|
|
|
348
405
|
Do work
|
|
349
406
|
`, "utf-8");
|
|
350
407
|
|
|
351
|
-
const
|
|
352
|
-
assert.deepEqual(
|
|
353
|
-
assert.equal(
|
|
354
|
-
assert.match(serializeAgent(
|
|
408
|
+
const worker = discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker");
|
|
409
|
+
assert.deepEqual(worker?.permissions, { read: "allow", write: "ask", edit: "deny" });
|
|
410
|
+
assert.equal(worker?.extraFields?.permission, undefined);
|
|
411
|
+
assert.match(serializeAgent(worker!), /^permissions:\n read: allow\n write: ask\n edit: deny$/m);
|
|
355
412
|
});
|
|
356
413
|
|
|
357
414
|
it("rejects bash permission rules and conflicting aliases", () => {
|
|
@@ -359,10 +416,10 @@ Do work
|
|
|
359
416
|
tempDirs.push(dir);
|
|
360
417
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
361
418
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
362
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
419
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---\nname: worker\ndescription: Worker\npermission:\n bash: deny\n---\n`, "utf-8");
|
|
363
420
|
assert.throws(() => discoverAgents(dir, "project"), /pi-guard/);
|
|
364
421
|
|
|
365
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
422
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---\nname: worker\ndescription: Worker\npermission:\n write: ask\npermissions:\n edit: deny\n---\n`, "utf-8");
|
|
366
423
|
assert.throws(() => discoverAgents(dir, "project"), /cannot declare both permission and permissions/);
|
|
367
424
|
});
|
|
368
425
|
});
|
|
@@ -370,14 +427,14 @@ Do work
|
|
|
370
427
|
describe("agent frontmatter defaultContext", () => {
|
|
371
428
|
it("serializes defaultContext into agent frontmatter", () => {
|
|
372
429
|
const agent: AgentConfig = {
|
|
373
|
-
name: "
|
|
430
|
+
name: "worker",
|
|
374
431
|
description: "Worker",
|
|
375
432
|
systemPrompt: "Do work",
|
|
376
433
|
systemPromptMode: "replace",
|
|
377
434
|
inheritProjectContext: true,
|
|
378
435
|
inheritSkills: false,
|
|
379
436
|
source: "project",
|
|
380
|
-
filePath: "/tmp/
|
|
437
|
+
filePath: "/tmp/worker.md",
|
|
381
438
|
defaultContext: "fork",
|
|
382
439
|
};
|
|
383
440
|
|
|
@@ -390,8 +447,8 @@ describe("agent frontmatter defaultContext", () => {
|
|
|
390
447
|
tempDirs.push(dir);
|
|
391
448
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
392
449
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
393
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
394
|
-
name:
|
|
450
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
451
|
+
name: worker
|
|
395
452
|
description: Worker
|
|
396
453
|
defaultContext: fork
|
|
397
454
|
---
|
|
@@ -400,18 +457,23 @@ Do work
|
|
|
400
457
|
`, "utf-8");
|
|
401
458
|
|
|
402
459
|
const result = discoverAgents(dir, "project");
|
|
403
|
-
const
|
|
404
|
-
assert.equal(
|
|
460
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
461
|
+
assert.equal(worker?.defaultContext, "fork");
|
|
405
462
|
});
|
|
406
463
|
|
|
407
|
-
it("loads
|
|
464
|
+
it("loads packaged worker and oracle with fork defaultContext and advisor alias", () => {
|
|
408
465
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-default-context-"));
|
|
409
466
|
tempDirs.push(dir);
|
|
410
467
|
const agents = discoverAgentsAll(dir).builtin;
|
|
411
468
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
469
|
+
for (const name of ["worker", "oracle"]) {
|
|
470
|
+
const agent = agents.find((candidate) => candidate.name === name);
|
|
471
|
+
assert.equal(agent?.defaultContext, "fork", `${name} should default to fork context`);
|
|
472
|
+
}
|
|
473
|
+
const oracle = agents.find((candidate) => candidate.name === "oracle");
|
|
474
|
+
assert.deepEqual(oracle?.aliases, ["advisor"]);
|
|
475
|
+
assert.equal(agents.some((candidate) => candidate.name === "planner"), false);
|
|
476
|
+
assert.equal(agents.some((candidate) => candidate.name === "context-builder"), false);
|
|
415
477
|
});
|
|
416
478
|
});
|
|
417
479
|
|
|
@@ -419,9 +481,9 @@ describe("agent frontmatter launch defaults", () => {
|
|
|
419
481
|
it("serializes and discovers single-agent launch defaults", () => {
|
|
420
482
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-launch-defaults-"));
|
|
421
483
|
tempDirs.push(dir);
|
|
422
|
-
const filePath = path.join(dir, ".selesai", "agents", "
|
|
484
|
+
const filePath = path.join(dir, ".selesai", "agents", "worker.md");
|
|
423
485
|
const agent: AgentConfig = {
|
|
424
|
-
name: "
|
|
486
|
+
name: "worker",
|
|
425
487
|
description: "Worker",
|
|
426
488
|
systemPrompt: "Do work",
|
|
427
489
|
systemPromptMode: "replace",
|
|
@@ -442,29 +504,29 @@ describe("agent frontmatter launch defaults", () => {
|
|
|
442
504
|
assert.match(serialized, /^acceptance: \{"level":"none","reason":"lightweight lookup"\}$/m);
|
|
443
505
|
writeAgent(filePath, serialized);
|
|
444
506
|
|
|
445
|
-
const
|
|
446
|
-
assert.equal(
|
|
447
|
-
assert.equal(
|
|
448
|
-
assert.deepEqual(
|
|
449
|
-
assert.deepEqual(
|
|
507
|
+
const worker = discoverAgents(dir, "project").agents.find((candidate) => candidate.name === "worker");
|
|
508
|
+
assert.equal(worker?.defaultAsync, false);
|
|
509
|
+
assert.equal(worker?.defaultTimeoutMs, 90_000);
|
|
510
|
+
assert.deepEqual(worker?.defaultTurnBudget, { maxTurns: 12, graceTurns: 2 });
|
|
511
|
+
assert.deepEqual(worker?.defaultAcceptance, { level: "none", reason: "lightweight lookup" });
|
|
450
512
|
});
|
|
451
513
|
|
|
452
514
|
it("parses scalar acceptance defaults and rejects invalid policies", () => {
|
|
453
515
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-acceptance-defaults-"));
|
|
454
516
|
tempDirs.push(dir);
|
|
455
|
-
const filePath = path.join(dir, ".selesai", "agents", "
|
|
517
|
+
const filePath = path.join(dir, ".selesai", "agents", "worker.md");
|
|
456
518
|
writeAgent(filePath, `---
|
|
457
|
-
name:
|
|
519
|
+
name: worker
|
|
458
520
|
description: Worker
|
|
459
521
|
acceptance: checked
|
|
460
522
|
---
|
|
461
523
|
|
|
462
524
|
Do work
|
|
463
525
|
`);
|
|
464
|
-
assert.equal(discoverAgents(dir, "project").agents.find((agent) => agent.name === "
|
|
526
|
+
assert.equal(discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker")?.defaultAcceptance, "checked");
|
|
465
527
|
|
|
466
528
|
writeAgent(filePath, `---
|
|
467
|
-
name:
|
|
529
|
+
name: worker
|
|
468
530
|
description: Worker
|
|
469
531
|
acceptance: { level: "none", reason: "NA" }
|
|
470
532
|
---
|
|
@@ -472,12 +534,12 @@ acceptance: { level: "none", reason: "NA" }
|
|
|
472
534
|
Do work
|
|
473
535
|
`);
|
|
474
536
|
assert.deepEqual(
|
|
475
|
-
discoverAgents(dir, "project").agents.find((agent) => agent.name === "
|
|
537
|
+
discoverAgents(dir, "project").agents.find((agent) => agent.name === "worker")?.defaultAcceptance,
|
|
476
538
|
{ level: "none", reason: "NA" },
|
|
477
539
|
);
|
|
478
540
|
|
|
479
541
|
writeAgent(filePath, `---
|
|
480
|
-
name:
|
|
542
|
+
name: worker
|
|
481
543
|
description: Worker
|
|
482
544
|
acceptance: none
|
|
483
545
|
---
|
|
@@ -486,7 +548,7 @@ Do work
|
|
|
486
548
|
`);
|
|
487
549
|
assert.throws(
|
|
488
550
|
() => discoverAgents(dir, "project"),
|
|
489
|
-
/Agent '
|
|
551
|
+
/Agent 'worker' acceptance frontmatter level "none" requires a reason/,
|
|
490
552
|
);
|
|
491
553
|
});
|
|
492
554
|
|
|
@@ -525,8 +587,8 @@ Explore the codebase
|
|
|
525
587
|
it("rejects invalid launch defaults instead of silently ignoring them", () => {
|
|
526
588
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-invalid-launch-defaults-"));
|
|
527
589
|
tempDirs.push(dir);
|
|
528
|
-
writeAgent(path.join(dir, ".selesai", "agents", "
|
|
529
|
-
name:
|
|
590
|
+
writeAgent(path.join(dir, ".selesai", "agents", "worker.md"), `---
|
|
591
|
+
name: worker
|
|
530
592
|
description: Worker
|
|
531
593
|
async: sometimes
|
|
532
594
|
---
|
|
@@ -536,7 +598,7 @@ Do work
|
|
|
536
598
|
|
|
537
599
|
assert.throws(
|
|
538
600
|
() => discoverAgents(dir, "project"),
|
|
539
|
-
/Agent '
|
|
601
|
+
/Agent 'worker' has invalid async frontmatter; expected true or false/,
|
|
540
602
|
);
|
|
541
603
|
});
|
|
542
604
|
});
|
|
@@ -552,7 +614,7 @@ name: dynamic-review
|
|
|
552
614
|
description: Markdown fallback
|
|
553
615
|
---
|
|
554
616
|
|
|
555
|
-
##
|
|
617
|
+
## scout
|
|
556
618
|
|
|
557
619
|
Run the markdown chain
|
|
558
620
|
`, "utf-8");
|
|
@@ -561,14 +623,14 @@ Run the markdown chain
|
|
|
561
623
|
description: "JSON dynamic chain",
|
|
562
624
|
chain: [
|
|
563
625
|
{
|
|
564
|
-
agent: "
|
|
626
|
+
agent: "scout",
|
|
565
627
|
task: "Return targets",
|
|
566
628
|
as: "targets",
|
|
567
629
|
outputSchema: { type: "object" },
|
|
568
630
|
},
|
|
569
631
|
{
|
|
570
632
|
expand: { from: { output: "targets", path: "/items" }, maxItems: 4 },
|
|
571
|
-
parallel: { agent: "
|
|
633
|
+
parallel: { agent: "reviewer", task: "Review {item.path}" },
|
|
572
634
|
collect: { as: "reviews" },
|
|
573
635
|
},
|
|
574
636
|
],
|
|
@@ -594,8 +656,8 @@ describe("package-provided agents and chains", () => {
|
|
|
594
656
|
agents: ["./agents"],
|
|
595
657
|
},
|
|
596
658
|
});
|
|
597
|
-
writeAgent(path.join(workflowRoot, "agents", "
|
|
598
|
-
name:
|
|
659
|
+
writeAgent(path.join(workflowRoot, "agents", "reviewer.md"), `---
|
|
660
|
+
name: reviewer
|
|
599
661
|
package: my-workflow
|
|
600
662
|
description: Review changes for this workflow.
|
|
601
663
|
---
|
|
@@ -616,22 +678,22 @@ package: my-workflow
|
|
|
616
678
|
description: Run workflow review.
|
|
617
679
|
---
|
|
618
680
|
|
|
619
|
-
## my-workflow.
|
|
681
|
+
## my-workflow.reviewer
|
|
620
682
|
|
|
621
683
|
Review the task.
|
|
622
684
|
`);
|
|
623
685
|
|
|
624
686
|
const all = discoverAgentsAll(dir);
|
|
625
|
-
const packagedAgent = all.package.find((agent) => agent.name === "my-workflow.
|
|
687
|
+
const packagedAgent = all.package.find((agent) => agent.name === "my-workflow.reviewer");
|
|
626
688
|
assert.ok(packagedAgent);
|
|
627
689
|
assert.equal(packagedAgent.source, "package");
|
|
628
|
-
assert.equal(packagedAgent.filePath, path.join(workflowRoot, "agents", "
|
|
629
|
-
assert.equal(discoverAgents(dir, "both").agents.find((agent) => agent.name === "my-workflow.
|
|
690
|
+
assert.equal(packagedAgent.filePath, path.join(workflowRoot, "agents", "reviewer.md"));
|
|
691
|
+
assert.equal(discoverAgents(dir, "both").agents.find((agent) => agent.name === "my-workflow.reviewer")?.source, "package");
|
|
630
692
|
|
|
631
693
|
const packagedChain = all.chains.find((chain) => chain.name === "my-workflow.review");
|
|
632
694
|
assert.ok(packagedChain);
|
|
633
695
|
assert.equal(packagedChain.source, "package");
|
|
634
|
-
assert.equal(packagedChain.steps[0]?.agent, "my-workflow.
|
|
696
|
+
assert.equal(packagedChain.steps[0]?.agent, "my-workflow.reviewer");
|
|
635
697
|
}));
|
|
636
698
|
|
|
637
699
|
it("loads packages referenced from Pi settings", () => withTempHome(() => {
|
|
@@ -649,8 +711,8 @@ Review the task.
|
|
|
649
711
|
},
|
|
650
712
|
},
|
|
651
713
|
});
|
|
652
|
-
writeAgent(path.join(packageRoot, "agents", "
|
|
653
|
-
name:
|
|
714
|
+
writeAgent(path.join(packageRoot, "agents", "planner.md"), `---
|
|
715
|
+
name: planner
|
|
654
716
|
package: settings-workflow
|
|
655
717
|
description: Plan from a settings-installed package.
|
|
656
718
|
---
|
|
@@ -658,7 +720,7 @@ description: Plan from a settings-installed package.
|
|
|
658
720
|
Plan the work.
|
|
659
721
|
`);
|
|
660
722
|
|
|
661
|
-
const agent = discoverAgents(dir, "both").agents.find((candidate) => candidate.name === "settings-workflow.
|
|
723
|
+
const agent = discoverAgents(dir, "both").agents.find((candidate) => candidate.name === "settings-workflow.planner");
|
|
662
724
|
assert.ok(agent);
|
|
663
725
|
assert.equal(agent.source, "package");
|
|
664
726
|
}));
|
|
@@ -675,8 +737,8 @@ Plan the work.
|
|
|
675
737
|
agents: ["./agents"],
|
|
676
738
|
},
|
|
677
739
|
});
|
|
678
|
-
writeAgent(path.join(packageRoot, "agents", "
|
|
679
|
-
name:
|
|
740
|
+
writeAgent(path.join(packageRoot, "agents", "reviewer.md"), `---
|
|
741
|
+
name: reviewer
|
|
680
742
|
package: nested-workflow
|
|
681
743
|
description: Review from a project package.
|
|
682
744
|
---
|
|
@@ -684,10 +746,10 @@ description: Review from a project package.
|
|
|
684
746
|
Review nested project work.
|
|
685
747
|
`);
|
|
686
748
|
|
|
687
|
-
const agent = discoverAgents(nested, "both").agents.find((candidate) => candidate.name === "nested-workflow.
|
|
749
|
+
const agent = discoverAgents(nested, "both").agents.find((candidate) => candidate.name === "nested-workflow.reviewer");
|
|
688
750
|
assert.ok(agent);
|
|
689
751
|
assert.equal(agent.source, "package");
|
|
690
|
-
assert.equal(agent.filePath, path.join(packageRoot, "agents", "
|
|
752
|
+
assert.equal(agent.filePath, path.join(packageRoot, "agents", "reviewer.md"));
|
|
691
753
|
}));
|
|
692
754
|
|
|
693
755
|
it("keeps nearest project root discovery by default when a nested .pi exists", () => withTempHome(() => {
|
|
@@ -703,8 +765,8 @@ Review nested project work.
|
|
|
703
765
|
name: "outer-workflow",
|
|
704
766
|
"pi-subagents": { agents: ["./agents"] },
|
|
705
767
|
});
|
|
706
|
-
writeAgent(path.join(packageRoot, "agents", "
|
|
707
|
-
name:
|
|
768
|
+
writeAgent(path.join(packageRoot, "agents", "planner.md"), `---
|
|
769
|
+
name: planner
|
|
708
770
|
package: outer-workflow
|
|
709
771
|
description: Plan from the outer project package.
|
|
710
772
|
---
|
|
@@ -712,7 +774,7 @@ description: Plan from the outer project package.
|
|
|
712
774
|
Plan outer project work.
|
|
713
775
|
`);
|
|
714
776
|
|
|
715
|
-
const agent = discoverAgents(nested, "both").agents.find((candidate) => candidate.name === "outer-workflow.
|
|
777
|
+
const agent = discoverAgents(nested, "both").agents.find((candidate) => candidate.name === "outer-workflow.planner");
|
|
716
778
|
assert.equal(agent, undefined);
|
|
717
779
|
}));
|
|
718
780
|
|
|
@@ -729,7 +791,7 @@ Plan outer project work.
|
|
|
729
791
|
subagents: {
|
|
730
792
|
projectRootResolution: "git-root",
|
|
731
793
|
agentOverrides: {
|
|
732
|
-
|
|
794
|
+
reviewer: { model: "openai/gpt-5.4" },
|
|
733
795
|
},
|
|
734
796
|
},
|
|
735
797
|
});
|
|
@@ -737,8 +799,8 @@ Plan outer project work.
|
|
|
737
799
|
name: "outer-workflow",
|
|
738
800
|
"pi-subagents": { agents: ["./agents"] },
|
|
739
801
|
});
|
|
740
|
-
writeAgent(path.join(packageRoot, "agents", "
|
|
741
|
-
name:
|
|
802
|
+
writeAgent(path.join(packageRoot, "agents", "planner.md"), `---
|
|
803
|
+
name: planner
|
|
742
804
|
package: outer-workflow
|
|
743
805
|
description: Plan from the outer project package.
|
|
744
806
|
---
|
|
@@ -747,13 +809,58 @@ Plan outer project work.
|
|
|
747
809
|
`);
|
|
748
810
|
|
|
749
811
|
const agents = discoverAgents(nested, "both").agents;
|
|
750
|
-
const packageAgent = agents.find((candidate) => candidate.name === "outer-workflow.
|
|
812
|
+
const packageAgent = agents.find((candidate) => candidate.name === "outer-workflow.planner");
|
|
751
813
|
assert.ok(packageAgent);
|
|
752
814
|
assert.equal(packageAgent.source, "package");
|
|
753
|
-
assert.equal(packageAgent.filePath, path.join(packageRoot, "agents", "
|
|
754
|
-
const
|
|
755
|
-
assert.equal(
|
|
756
|
-
assert.equal(
|
|
815
|
+
assert.equal(packageAgent.filePath, path.join(packageRoot, "agents", "planner.md"));
|
|
816
|
+
const reviewer = agents.find((candidate) => candidate.name === "reviewer");
|
|
817
|
+
assert.equal(reviewer?.model, "openai/gpt-5.4");
|
|
818
|
+
assert.equal(reviewer?.override?.path, path.join(dir, ".selesai", "settings.json"));
|
|
819
|
+
}));
|
|
820
|
+
|
|
821
|
+
it("keeps git-root discovery stable when a nested linked worktree creates incidental .pi state", () => withTempHome(() => {
|
|
822
|
+
const { repo, worktree } = createNestedLinkedWorktree();
|
|
823
|
+
const { packageAgentName, packageAgentPath, settingsPath } = writeLinkedWorktreePackage(repo);
|
|
824
|
+
|
|
825
|
+
const before = discoverAgents(worktree, "both").agents;
|
|
826
|
+
const beforePackageAgent = before.find((candidate) => candidate.name === packageAgentName);
|
|
827
|
+
assert.ok(beforePackageAgent);
|
|
828
|
+
assert.equal(beforePackageAgent.source, "package");
|
|
829
|
+
assert.equal(beforePackageAgent.filePath, packageAgentPath);
|
|
830
|
+
assert.equal(before.find((candidate) => candidate.name === "reviewer")?.override?.path, settingsPath);
|
|
831
|
+
|
|
832
|
+
fs.mkdirSync(path.join(worktree, ".selesai", "todos"), { recursive: true });
|
|
833
|
+
|
|
834
|
+
const after = discoverAgents(worktree, "both").agents;
|
|
835
|
+
const all = discoverAgentsAll(worktree);
|
|
836
|
+
const afterPackageAgent = after.find((candidate) => candidate.name === packageAgentName);
|
|
837
|
+
const allPackageAgent = all.package.find((candidate) => candidate.name === packageAgentName);
|
|
838
|
+
assert.equal(afterPackageAgent?.source, beforePackageAgent.source);
|
|
839
|
+
assert.equal(afterPackageAgent?.filePath, beforePackageAgent.filePath);
|
|
840
|
+
assert.equal(allPackageAgent?.filePath, afterPackageAgent.filePath);
|
|
841
|
+
assert.equal(all.projectSettingsPath, settingsPath);
|
|
842
|
+
assert.equal(after.find((candidate) => candidate.name === "reviewer")?.override?.path, all.projectSettingsPath);
|
|
843
|
+
}));
|
|
844
|
+
|
|
845
|
+
it("lets a linked worktree opt back into nearest-root discovery", () => withTempHome(() => {
|
|
846
|
+
const { repo, worktree } = createNestedLinkedWorktree();
|
|
847
|
+
const { packageAgentName } = writeLinkedWorktreePackage(repo);
|
|
848
|
+
const worktreeSettingsPath = path.join(worktree, ".selesai", "settings.json");
|
|
849
|
+
writeJson(worktreeSettingsPath, {
|
|
850
|
+
subagents: {
|
|
851
|
+
projectRootResolution: "nearest",
|
|
852
|
+
agentOverrides: {
|
|
853
|
+
reviewer: { model: "issue950/worktree-model" },
|
|
854
|
+
},
|
|
855
|
+
},
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
const discovered = discoverAgents(worktree, "both").agents;
|
|
859
|
+
const all = discoverAgentsAll(worktree);
|
|
860
|
+
assert.equal(discovered.find((candidate) => candidate.name === packageAgentName), undefined);
|
|
861
|
+
assert.equal(all.package.find((candidate) => candidate.name === packageAgentName), undefined);
|
|
862
|
+
assert.equal(discovered.find((candidate) => candidate.name === "reviewer")?.model, "issue950/worktree-model");
|
|
863
|
+
assert.equal(all.projectSettingsPath, worktreeSettingsPath);
|
|
757
864
|
}));
|
|
758
865
|
|
|
759
866
|
it("does not register legacy skill files from broad package agent roots", () => withTempHome(() => {
|
|
@@ -883,42 +990,42 @@ Ignored
|
|
|
883
990
|
chains: ["./chains"],
|
|
884
991
|
},
|
|
885
992
|
});
|
|
886
|
-
writeAgent(path.join(packageRoot, "agents", "
|
|
887
|
-
name:
|
|
888
|
-
description: Package
|
|
993
|
+
writeAgent(path.join(packageRoot, "agents", "scout.md"), `---
|
|
994
|
+
name: scout
|
|
995
|
+
description: Package scout
|
|
889
996
|
---
|
|
890
997
|
|
|
891
|
-
Package
|
|
998
|
+
Package scout.
|
|
892
999
|
`);
|
|
893
1000
|
writeAgent(path.join(packageRoot, "chains", "shared.chain.md"), `---
|
|
894
1001
|
name: shared
|
|
895
1002
|
description: Package chain
|
|
896
1003
|
---
|
|
897
1004
|
|
|
898
|
-
##
|
|
1005
|
+
## scout
|
|
899
1006
|
|
|
900
1007
|
Package chain.
|
|
901
1008
|
`);
|
|
902
|
-
writeAgent(path.join(home, ".selesai", "agent", "agents", "
|
|
903
|
-
name:
|
|
904
|
-
description: User
|
|
1009
|
+
writeAgent(path.join(home, ".selesai", "agent", "agents", "scout.md"), `---
|
|
1010
|
+
name: scout
|
|
1011
|
+
description: User scout
|
|
905
1012
|
---
|
|
906
1013
|
|
|
907
|
-
User
|
|
1014
|
+
User scout.
|
|
908
1015
|
`);
|
|
909
|
-
writeAgent(path.join(dir, ".selesai", "agents", "
|
|
910
|
-
name:
|
|
911
|
-
description: Project
|
|
1016
|
+
writeAgent(path.join(dir, ".selesai", "agents", "scout.md"), `---
|
|
1017
|
+
name: scout
|
|
1018
|
+
description: Project scout
|
|
912
1019
|
---
|
|
913
1020
|
|
|
914
|
-
Project
|
|
1021
|
+
Project scout.
|
|
915
1022
|
`);
|
|
916
1023
|
writeAgent(path.join(home, ".selesai", "agent", "chains", "shared.chain.md"), `---
|
|
917
1024
|
name: shared
|
|
918
1025
|
description: User chain
|
|
919
1026
|
---
|
|
920
1027
|
|
|
921
|
-
##
|
|
1028
|
+
## scout
|
|
922
1029
|
|
|
923
1030
|
User chain.
|
|
924
1031
|
`);
|
|
@@ -927,13 +1034,13 @@ name: shared
|
|
|
927
1034
|
description: Project chain
|
|
928
1035
|
---
|
|
929
1036
|
|
|
930
|
-
##
|
|
1037
|
+
## scout
|
|
931
1038
|
|
|
932
1039
|
Project chain.
|
|
933
1040
|
`);
|
|
934
1041
|
|
|
935
|
-
assert.equal(discoverAgents(dir, "user").agents.find((agent) => agent.name === "
|
|
936
|
-
assert.equal(discoverAgents(dir, "project").agents.find((agent) => agent.name === "
|
|
1042
|
+
assert.equal(discoverAgents(dir, "user").agents.find((agent) => agent.name === "scout")?.source, "user");
|
|
1043
|
+
assert.equal(discoverAgents(dir, "project").agents.find((agent) => agent.name === "scout")?.source, "project");
|
|
937
1044
|
const chainByName = new Map(discoverAgentsAll(dir).chains.map((chain) => [chain.name, chain]));
|
|
938
1045
|
assert.equal(chainByName.get("shared")?.source, "project");
|
|
939
1046
|
}));
|
|
@@ -948,17 +1055,17 @@ Project chain.
|
|
|
948
1055
|
agents: ["./agents"],
|
|
949
1056
|
},
|
|
950
1057
|
});
|
|
951
|
-
writeAgent(path.join(packageRoot, "agents", "
|
|
952
|
-
name:
|
|
1058
|
+
writeAgent(path.join(packageRoot, "agents", "reviewer.md"), `---
|
|
1059
|
+
name: reviewer
|
|
953
1060
|
package: readonly-workflow
|
|
954
|
-
description: Read-only package
|
|
1061
|
+
description: Read-only package reviewer.
|
|
955
1062
|
---
|
|
956
1063
|
|
|
957
1064
|
Review only.
|
|
958
1065
|
`);
|
|
959
1066
|
|
|
960
1067
|
const result = handleManagementAction("update", {
|
|
961
|
-
agent: "readonly-workflow.
|
|
1068
|
+
agent: "readonly-workflow.reviewer",
|
|
962
1069
|
config: { description: "Changed" },
|
|
963
1070
|
}, {
|
|
964
1071
|
cwd: dir,
|
|
@@ -1029,14 +1136,14 @@ Validate changes
|
|
|
1029
1136
|
describe("agent frontmatter maxSubagentDepth", () => {
|
|
1030
1137
|
it("serializes maxSubagentDepth into agent frontmatter", () => {
|
|
1031
1138
|
const agent: AgentConfig = {
|
|
1032
|
-
name: "
|
|
1139
|
+
name: "scout",
|
|
1033
1140
|
description: "Scout",
|
|
1034
1141
|
systemPrompt: "Inspect code",
|
|
1035
1142
|
systemPromptMode: "replace",
|
|
1036
1143
|
inheritProjectContext: false,
|
|
1037
1144
|
inheritSkills: false,
|
|
1038
1145
|
source: "project",
|
|
1039
|
-
filePath: "/tmp/
|
|
1146
|
+
filePath: "/tmp/scout.md",
|
|
1040
1147
|
maxSubagentDepth: 1,
|
|
1041
1148
|
};
|
|
1042
1149
|
|
|
@@ -1049,8 +1156,8 @@ describe("agent frontmatter maxSubagentDepth", () => {
|
|
|
1049
1156
|
tempDirs.push(dir);
|
|
1050
1157
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1051
1158
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1052
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
1053
|
-
name:
|
|
1159
|
+
fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
|
|
1160
|
+
name: scout
|
|
1054
1161
|
description: Scout
|
|
1055
1162
|
maxSubagentDepth: 1
|
|
1056
1163
|
---
|
|
@@ -1059,8 +1166,8 @@ Inspect code
|
|
|
1059
1166
|
`, "utf-8");
|
|
1060
1167
|
|
|
1061
1168
|
const result = discoverAgents(dir, "project");
|
|
1062
|
-
const
|
|
1063
|
-
assert.equal(
|
|
1169
|
+
const scout = result.agents.find((agent) => agent.name === "scout");
|
|
1170
|
+
assert.equal(scout?.maxSubagentDepth, 1);
|
|
1064
1171
|
});
|
|
1065
1172
|
});
|
|
1066
1173
|
|
|
@@ -1134,14 +1241,14 @@ Do work
|
|
|
1134
1241
|
describe("agent frontmatter fallbackModels", () => {
|
|
1135
1242
|
it("serializes fallbackModels into agent frontmatter", () => {
|
|
1136
1243
|
const agent: AgentConfig = {
|
|
1137
|
-
name: "
|
|
1244
|
+
name: "worker",
|
|
1138
1245
|
description: "Worker",
|
|
1139
1246
|
systemPrompt: "Do work",
|
|
1140
1247
|
systemPromptMode: "replace",
|
|
1141
1248
|
inheritProjectContext: false,
|
|
1142
1249
|
inheritSkills: false,
|
|
1143
1250
|
source: "project",
|
|
1144
|
-
filePath: "/tmp/
|
|
1251
|
+
filePath: "/tmp/worker.md",
|
|
1145
1252
|
fallbackModels: ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"],
|
|
1146
1253
|
};
|
|
1147
1254
|
|
|
@@ -1154,8 +1261,8 @@ describe("agent frontmatter fallbackModels", () => {
|
|
|
1154
1261
|
tempDirs.push(dir);
|
|
1155
1262
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1156
1263
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1157
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
1158
|
-
name:
|
|
1264
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1265
|
+
name: worker
|
|
1159
1266
|
description: Worker
|
|
1160
1267
|
fallbackModels: openai/gpt-5-mini, anthropic/claude-sonnet-4
|
|
1161
1268
|
---
|
|
@@ -1164,22 +1271,22 @@ Do work
|
|
|
1164
1271
|
`, "utf-8");
|
|
1165
1272
|
|
|
1166
1273
|
const result = discoverAgents(dir, "project");
|
|
1167
|
-
const
|
|
1168
|
-
assert.deepEqual(
|
|
1274
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1275
|
+
assert.deepEqual(worker?.fallbackModels, ["openai/gpt-5-mini", "anthropic/claude-sonnet-4"]);
|
|
1169
1276
|
});
|
|
1170
1277
|
});
|
|
1171
1278
|
|
|
1172
1279
|
describe("agent frontmatter systemPromptMode", () => {
|
|
1173
1280
|
it("serializes systemPromptMode into agent frontmatter", () => {
|
|
1174
1281
|
const agent: AgentConfig = {
|
|
1175
|
-
name: "
|
|
1282
|
+
name: "worker",
|
|
1176
1283
|
description: "Worker",
|
|
1177
1284
|
systemPrompt: "Do work",
|
|
1178
1285
|
systemPromptMode: "replace",
|
|
1179
1286
|
inheritProjectContext: false,
|
|
1180
1287
|
inheritSkills: false,
|
|
1181
1288
|
source: "project",
|
|
1182
|
-
filePath: "/tmp/
|
|
1289
|
+
filePath: "/tmp/worker.md",
|
|
1183
1290
|
};
|
|
1184
1291
|
|
|
1185
1292
|
const serialized = serializeAgent(agent);
|
|
@@ -1191,8 +1298,8 @@ describe("agent frontmatter systemPromptMode", () => {
|
|
|
1191
1298
|
tempDirs.push(dir);
|
|
1192
1299
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1193
1300
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1194
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
1195
|
-
name:
|
|
1301
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1302
|
+
name: worker
|
|
1196
1303
|
description: Worker
|
|
1197
1304
|
systemPromptMode: replace
|
|
1198
1305
|
---
|
|
@@ -1201,22 +1308,22 @@ Do work
|
|
|
1201
1308
|
`, "utf-8");
|
|
1202
1309
|
|
|
1203
1310
|
const result = discoverAgents(dir, "project");
|
|
1204
|
-
const
|
|
1205
|
-
assert.equal(
|
|
1311
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1312
|
+
assert.equal(worker?.systemPromptMode, "replace");
|
|
1206
1313
|
});
|
|
1207
1314
|
});
|
|
1208
1315
|
|
|
1209
1316
|
describe("agent frontmatter prompt inheritance flags", () => {
|
|
1210
1317
|
it("serializes inheritProjectContext and inheritSkills into agent frontmatter", () => {
|
|
1211
1318
|
const agent: AgentConfig = {
|
|
1212
|
-
name: "
|
|
1319
|
+
name: "worker",
|
|
1213
1320
|
description: "Worker",
|
|
1214
1321
|
systemPrompt: "Do work",
|
|
1215
1322
|
systemPromptMode: "replace",
|
|
1216
1323
|
inheritProjectContext: true,
|
|
1217
1324
|
inheritSkills: true,
|
|
1218
1325
|
source: "project",
|
|
1219
|
-
filePath: "/tmp/
|
|
1326
|
+
filePath: "/tmp/worker.md",
|
|
1220
1327
|
};
|
|
1221
1328
|
|
|
1222
1329
|
const serialized = serializeAgent(agent);
|
|
@@ -1229,8 +1336,8 @@ describe("agent frontmatter prompt inheritance flags", () => {
|
|
|
1229
1336
|
tempDirs.push(dir);
|
|
1230
1337
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1231
1338
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1232
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
1233
|
-
name:
|
|
1339
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1340
|
+
name: worker
|
|
1234
1341
|
description: Worker
|
|
1235
1342
|
inheritProjectContext: true
|
|
1236
1343
|
inheritSkills: true
|
|
@@ -1240,23 +1347,23 @@ Do work
|
|
|
1240
1347
|
`, "utf-8");
|
|
1241
1348
|
|
|
1242
1349
|
const result = discoverAgents(dir, "project");
|
|
1243
|
-
const
|
|
1244
|
-
assert.equal(
|
|
1245
|
-
assert.equal(
|
|
1350
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1351
|
+
assert.equal(worker?.inheritProjectContext, true);
|
|
1352
|
+
assert.equal(worker?.inheritSkills, true);
|
|
1246
1353
|
});
|
|
1247
1354
|
});
|
|
1248
1355
|
|
|
1249
1356
|
describe("agent frontmatter subagentOnlyExtensions", () => {
|
|
1250
1357
|
it("serializes subagentOnlyExtensions into agent frontmatter", () => {
|
|
1251
1358
|
const agent: AgentConfig = {
|
|
1252
|
-
name: "
|
|
1359
|
+
name: "worker",
|
|
1253
1360
|
description: "Worker",
|
|
1254
1361
|
systemPrompt: "Do work",
|
|
1255
1362
|
systemPromptMode: "replace",
|
|
1256
1363
|
inheritProjectContext: false,
|
|
1257
1364
|
inheritSkills: false,
|
|
1258
1365
|
source: "project",
|
|
1259
|
-
filePath: "/tmp/
|
|
1366
|
+
filePath: "/tmp/worker.md",
|
|
1260
1367
|
subagentOnlyExtensions: ["./tools/child-search.ts", "/opt/pi/child-only.ts"],
|
|
1261
1368
|
};
|
|
1262
1369
|
|
|
@@ -1269,8 +1376,8 @@ describe("agent frontmatter subagentOnlyExtensions", () => {
|
|
|
1269
1376
|
tempDirs.push(dir);
|
|
1270
1377
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1271
1378
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1272
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
1273
|
-
name:
|
|
1379
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1380
|
+
name: worker
|
|
1274
1381
|
description: Worker
|
|
1275
1382
|
subagentOnlyExtensions: ./tools/child-search.ts, /opt/pi/child-only.ts
|
|
1276
1383
|
---
|
|
@@ -1279,8 +1386,8 @@ Do work
|
|
|
1279
1386
|
`, "utf-8");
|
|
1280
1387
|
|
|
1281
1388
|
const result = discoverAgents(dir, "project");
|
|
1282
|
-
const
|
|
1283
|
-
assert.deepEqual(
|
|
1389
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1390
|
+
assert.deepEqual(worker?.subagentOnlyExtensions, ["./tools/child-search.ts", "/opt/pi/child-only.ts"]);
|
|
1284
1391
|
});
|
|
1285
1392
|
});
|
|
1286
1393
|
|
|
@@ -1290,8 +1397,8 @@ describe("agent frontmatter prompt assembly defaults", () => {
|
|
|
1290
1397
|
tempDirs.push(dir);
|
|
1291
1398
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1292
1399
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1293
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
1294
|
-
name:
|
|
1400
|
+
fs.writeFileSync(path.join(agentsDir, "worker.md"), `---
|
|
1401
|
+
name: worker
|
|
1295
1402
|
description: Worker
|
|
1296
1403
|
---
|
|
1297
1404
|
|
|
@@ -1299,10 +1406,10 @@ Do work
|
|
|
1299
1406
|
`, "utf-8");
|
|
1300
1407
|
|
|
1301
1408
|
const result = discoverAgents(dir, "project");
|
|
1302
|
-
const
|
|
1303
|
-
assert.equal(
|
|
1304
|
-
assert.equal(
|
|
1305
|
-
assert.equal(
|
|
1409
|
+
const worker = result.agents.find((agent) => agent.name === "worker");
|
|
1410
|
+
assert.equal(worker?.systemPromptMode, "replace");
|
|
1411
|
+
assert.equal(worker?.inheritProjectContext, false);
|
|
1412
|
+
assert.equal(worker?.inheritSkills, false);
|
|
1306
1413
|
});
|
|
1307
1414
|
|
|
1308
1415
|
it("builtin agents inherit project context by default", () => {
|
|
@@ -1318,12 +1425,12 @@ Do work
|
|
|
1318
1425
|
process.env.USERPROFILE = homeDir;
|
|
1319
1426
|
|
|
1320
1427
|
const result = discoverAgents(dir, "both");
|
|
1321
|
-
const
|
|
1322
|
-
const
|
|
1323
|
-
const
|
|
1324
|
-
assert.equal(
|
|
1325
|
-
assert.equal(
|
|
1326
|
-
assert.equal(
|
|
1428
|
+
const scout = result.agents.find((agent) => agent.name === "scout");
|
|
1429
|
+
const reviewer = result.agents.find((agent) => agent.name === "reviewer");
|
|
1430
|
+
const delegate = result.agents.find((agent) => agent.name === "delegate");
|
|
1431
|
+
assert.equal(scout?.inheritProjectContext, true);
|
|
1432
|
+
assert.equal(reviewer?.inheritProjectContext, true);
|
|
1433
|
+
assert.equal(delegate?.inheritProjectContext, true);
|
|
1327
1434
|
} finally {
|
|
1328
1435
|
if (previousHome === undefined) delete process.env.HOME;
|
|
1329
1436
|
else process.env.HOME = previousHome;
|
|
@@ -1356,30 +1463,7 @@ Do work
|
|
|
1356
1463
|
}
|
|
1357
1464
|
});
|
|
1358
1465
|
|
|
1359
|
-
it("
|
|
1360
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-architect-tools-"));
|
|
1361
|
-
const homeDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-architect-home-"));
|
|
1362
|
-
tempDirs.push(dir);
|
|
1363
|
-
tempDirs.push(homeDir);
|
|
1364
|
-
const previousHome = process.env.HOME;
|
|
1365
|
-
const previousUserProfile = process.env.USERPROFILE;
|
|
1366
|
-
|
|
1367
|
-
try {
|
|
1368
|
-
process.env.HOME = homeDir;
|
|
1369
|
-
process.env.USERPROFILE = homeDir;
|
|
1370
|
-
const architect = discoverAgentsAll(dir).builtin.find((agent) => agent.name === "architect");
|
|
1371
|
-
assert.ok(architect, "architect builtin should be discovered");
|
|
1372
|
-
assert.deepEqual(architect.tools, ["read", "grep", "find", "ls"]);
|
|
1373
|
-
assert.equal(architect.acceptanceRole, "read-only");
|
|
1374
|
-
} finally {
|
|
1375
|
-
if (previousHome === undefined) delete process.env.HOME;
|
|
1376
|
-
else process.env.HOME = previousHome;
|
|
1377
|
-
if (previousUserProfile === undefined) delete process.env.USERPROFILE;
|
|
1378
|
-
else process.env.USERPROFILE = previousUserProfile;
|
|
1379
|
-
}
|
|
1380
|
-
});
|
|
1381
|
-
|
|
1382
|
-
it("builder includes the child-facing supervisor tool", () => {
|
|
1466
|
+
it("worker and delegate include the child-facing supervisor tool", () => {
|
|
1383
1467
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-supervisor-tool-"));
|
|
1384
1468
|
const homeDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-builtin-supervisor-tool-home-"));
|
|
1385
1469
|
tempDirs.push(dir);
|
|
@@ -1391,9 +1475,11 @@ Do work
|
|
|
1391
1475
|
process.env.HOME = homeDir;
|
|
1392
1476
|
process.env.USERPROFILE = homeDir;
|
|
1393
1477
|
const agents = discoverAgentsAll(dir).builtin;
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1478
|
+
for (const name of ["worker", "delegate"]) {
|
|
1479
|
+
const agent = agents.find((candidate) => candidate.name === name);
|
|
1480
|
+
assert.ok(agent, `${name} builtin should be discovered`);
|
|
1481
|
+
assert.deepEqual(agent?.tools, ["read", "grep", "find", "ls", "bash", "edit", "write", "contact_supervisor"]);
|
|
1482
|
+
}
|
|
1397
1483
|
} finally {
|
|
1398
1484
|
if (previousHome === undefined) delete process.env.HOME;
|
|
1399
1485
|
else process.env.HOME = previousHome;
|
|
@@ -1402,13 +1488,13 @@ Do work
|
|
|
1402
1488
|
}
|
|
1403
1489
|
});
|
|
1404
1490
|
|
|
1405
|
-
it("defaults
|
|
1406
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-
|
|
1491
|
+
it("defaults delegate to append mode with inherited project context", () => {
|
|
1492
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-agent-delegate-default-prompt-settings-"));
|
|
1407
1493
|
tempDirs.push(dir);
|
|
1408
1494
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1409
1495
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1410
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
1411
|
-
name:
|
|
1496
|
+
fs.writeFileSync(path.join(agentsDir, "delegate.md"), `---
|
|
1497
|
+
name: delegate
|
|
1412
1498
|
description: Delegate
|
|
1413
1499
|
---
|
|
1414
1500
|
|
|
@@ -1416,10 +1502,10 @@ Do work
|
|
|
1416
1502
|
`, "utf-8");
|
|
1417
1503
|
|
|
1418
1504
|
const result = discoverAgents(dir, "project");
|
|
1419
|
-
const
|
|
1420
|
-
assert.equal(
|
|
1421
|
-
assert.equal(
|
|
1422
|
-
assert.equal(
|
|
1505
|
+
const delegate = result.agents.find((agent) => agent.name === "delegate");
|
|
1506
|
+
assert.equal(delegate?.systemPromptMode, "append");
|
|
1507
|
+
assert.equal(delegate?.inheritProjectContext, true);
|
|
1508
|
+
assert.equal(delegate?.inheritSkills, false);
|
|
1423
1509
|
});
|
|
1424
1510
|
});
|
|
1425
1511
|
|
|
@@ -1431,9 +1517,9 @@ describe("packaged agent and chain discovery", () => {
|
|
|
1431
1517
|
const nestedChainDir = path.join(dir, ".selesai", "chains", "code-analysis", "deep");
|
|
1432
1518
|
fs.mkdirSync(nestedDir, { recursive: true });
|
|
1433
1519
|
fs.mkdirSync(nestedChainDir, { recursive: true });
|
|
1434
|
-
fs.writeFileSync(path.join(nestedDir, "
|
|
1435
|
-
name:
|
|
1436
|
-
description: Nested
|
|
1520
|
+
fs.writeFileSync(path.join(nestedDir, "scout.md"), `---
|
|
1521
|
+
name: scout
|
|
1522
|
+
description: Nested scout
|
|
1437
1523
|
---
|
|
1438
1524
|
|
|
1439
1525
|
Inspect code
|
|
@@ -1443,13 +1529,13 @@ name: review-flow
|
|
|
1443
1529
|
description: Review flow
|
|
1444
1530
|
---
|
|
1445
1531
|
|
|
1446
|
-
##
|
|
1532
|
+
## scout
|
|
1447
1533
|
|
|
1448
1534
|
Review
|
|
1449
1535
|
`, "utf-8");
|
|
1450
1536
|
|
|
1451
1537
|
const result = discoverAgentsAll(dir);
|
|
1452
|
-
assert.ok(result.project.find((agent) => agent.name === "
|
|
1538
|
+
assert.ok(result.project.find((agent) => agent.name === "scout" && agent.filePath === path.join(nestedDir, "scout.md")));
|
|
1453
1539
|
assert.ok(result.chains.find((chain) => chain.name === "review-flow" && chain.filePath === path.join(nestedChainDir, "review.chain.md")));
|
|
1454
1540
|
assert.equal(result.project.some((agent) => agent.filePath.endsWith("review.chain.md")), false);
|
|
1455
1541
|
});
|
|
@@ -1459,8 +1545,8 @@ Review
|
|
|
1459
1545
|
tempDirs.push(dir);
|
|
1460
1546
|
const agentsDir = path.join(dir, ".selesai", "agents");
|
|
1461
1547
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1462
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
1463
|
-
name:
|
|
1548
|
+
fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
|
|
1549
|
+
name: scout
|
|
1464
1550
|
package: code-analysis
|
|
1465
1551
|
description: Fast recon
|
|
1466
1552
|
---
|
|
@@ -1468,14 +1554,14 @@ description: Fast recon
|
|
|
1468
1554
|
Inspect code
|
|
1469
1555
|
`, "utf-8");
|
|
1470
1556
|
|
|
1471
|
-
const
|
|
1472
|
-
assert.ok(
|
|
1473
|
-
assert.equal(
|
|
1474
|
-
assert.equal(
|
|
1475
|
-
const serialized = serializeAgent(
|
|
1476
|
-
assert.match(serialized, /^name:
|
|
1557
|
+
const scout = discoverAgents(dir, "project").agents.find((agent) => agent.name === "code-analysis.scout");
|
|
1558
|
+
assert.ok(scout);
|
|
1559
|
+
assert.equal(scout.localName, "scout");
|
|
1560
|
+
assert.equal(scout.packageName, "code-analysis");
|
|
1561
|
+
const serialized = serializeAgent(scout);
|
|
1562
|
+
assert.match(serialized, /^name: scout$/m);
|
|
1477
1563
|
assert.match(serialized, /^package: code-analysis$/m);
|
|
1478
|
-
assert.doesNotMatch(serialized, /^name: code-analysis\.
|
|
1564
|
+
assert.doesNotMatch(serialized, /^name: code-analysis\.scout$/m);
|
|
1479
1565
|
});
|
|
1480
1566
|
|
|
1481
1567
|
it("recursively discovers packaged chains by runtime name and preserves package on serialize", () => {
|
|
@@ -1489,7 +1575,7 @@ package: code-analysis
|
|
|
1489
1575
|
description: Review flow
|
|
1490
1576
|
---
|
|
1491
1577
|
|
|
1492
|
-
## code-analysis.
|
|
1578
|
+
## code-analysis.scout
|
|
1493
1579
|
|
|
1494
1580
|
Inspect {task}
|
|
1495
1581
|
`;
|
|
@@ -1499,11 +1585,11 @@ Inspect {task}
|
|
|
1499
1585
|
assert.ok(chain);
|
|
1500
1586
|
assert.equal(chain.localName, "review-flow");
|
|
1501
1587
|
assert.equal(chain.packageName, "code-analysis");
|
|
1502
|
-
assert.equal(chain.steps[0]?.agent, "code-analysis.
|
|
1588
|
+
assert.equal(chain.steps[0]?.agent, "code-analysis.scout");
|
|
1503
1589
|
const serialized = serializeChain(chain);
|
|
1504
1590
|
assert.match(serialized, /^name: review-flow$/m);
|
|
1505
1591
|
assert.match(serialized, /^package: code-analysis$/m);
|
|
1506
|
-
assert.match(serialized, /^## code-analysis\.
|
|
1592
|
+
assert.match(serialized, /^## code-analysis\.scout$/m);
|
|
1507
1593
|
assert.doesNotMatch(serialized, /^name: code-analysis\.review-flow$/m);
|
|
1508
1594
|
});
|
|
1509
1595
|
|
|
@@ -1512,35 +1598,35 @@ Inspect {task}
|
|
|
1512
1598
|
tempDirs.push(dir);
|
|
1513
1599
|
fs.mkdirSync(path.join(dir, ".agents"), { recursive: true });
|
|
1514
1600
|
fs.mkdirSync(path.join(dir, ".selesai", "agents"), { recursive: true });
|
|
1515
|
-
fs.writeFileSync(path.join(dir, ".agents", "
|
|
1516
|
-
name:
|
|
1517
|
-
description: Legacy
|
|
1601
|
+
fs.writeFileSync(path.join(dir, ".agents", "scout.md"), `---
|
|
1602
|
+
name: scout
|
|
1603
|
+
description: Legacy scout
|
|
1518
1604
|
---
|
|
1519
1605
|
|
|
1520
1606
|
Legacy
|
|
1521
1607
|
`, "utf-8");
|
|
1522
|
-
fs.writeFileSync(path.join(dir, ".selesai", "agents", "
|
|
1523
|
-
name:
|
|
1524
|
-
description: Project
|
|
1608
|
+
fs.writeFileSync(path.join(dir, ".selesai", "agents", "scout.md"), `---
|
|
1609
|
+
name: scout
|
|
1610
|
+
description: Project scout
|
|
1525
1611
|
---
|
|
1526
1612
|
|
|
1527
1613
|
Project
|
|
1528
1614
|
`, "utf-8");
|
|
1529
1615
|
fs.writeFileSync(path.join(dir, ".selesai", "agents", "packaged.md"), `---
|
|
1530
|
-
name:
|
|
1616
|
+
name: scout
|
|
1531
1617
|
package: code-analysis
|
|
1532
|
-
description: Packaged
|
|
1618
|
+
description: Packaged scout
|
|
1533
1619
|
---
|
|
1534
1620
|
|
|
1535
1621
|
Packaged
|
|
1536
1622
|
`, "utf-8");
|
|
1537
1623
|
|
|
1538
1624
|
const agents = discoverAgents(dir, "project").agents;
|
|
1539
|
-
const unqualified = agents.find((agent) => agent.name === "
|
|
1540
|
-
const packaged = agents.find((agent) => agent.name === "code-analysis.
|
|
1541
|
-
assert.equal(unqualified?.description, "Project
|
|
1542
|
-
assert.equal(unqualified?.filePath, path.join(dir, ".selesai", "agents", "
|
|
1543
|
-
assert.equal(packaged?.description, "Packaged
|
|
1625
|
+
const unqualified = agents.find((agent) => agent.name === "scout");
|
|
1626
|
+
const packaged = agents.find((agent) => agent.name === "code-analysis.scout");
|
|
1627
|
+
assert.equal(unqualified?.description, "Project scout");
|
|
1628
|
+
assert.equal(unqualified?.filePath, path.join(dir, ".selesai", "agents", "scout.md"));
|
|
1629
|
+
assert.equal(packaged?.description, "Packaged scout");
|
|
1544
1630
|
});
|
|
1545
1631
|
|
|
1546
1632
|
it("parses packaged chains directly from serializer helpers", () => {
|
|
@@ -1550,7 +1636,7 @@ package: code-analysis
|
|
|
1550
1636
|
description: Review flow
|
|
1551
1637
|
---
|
|
1552
1638
|
|
|
1553
|
-
## code-analysis.
|
|
1639
|
+
## code-analysis.scout
|
|
1554
1640
|
|
|
1555
1641
|
Inspect
|
|
1556
1642
|
`, "project", "/tmp/review.chain.md");
|
|
@@ -1568,8 +1654,8 @@ Inspect
|
|
|
1568
1654
|
const chainsDir = path.join(dir, ".selesai", "chains");
|
|
1569
1655
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1570
1656
|
fs.mkdirSync(chainsDir, { recursive: true });
|
|
1571
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
1572
|
-
name:
|
|
1657
|
+
fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
|
|
1658
|
+
name: scout
|
|
1573
1659
|
package: Code Analysis!
|
|
1574
1660
|
description: Fast recon
|
|
1575
1661
|
---
|
|
@@ -1582,13 +1668,13 @@ package: Code Analysis!
|
|
|
1582
1668
|
description: Review flow
|
|
1583
1669
|
---
|
|
1584
1670
|
|
|
1585
|
-
## code-analysis.
|
|
1671
|
+
## code-analysis.scout
|
|
1586
1672
|
|
|
1587
1673
|
Review
|
|
1588
1674
|
`, "utf-8");
|
|
1589
1675
|
|
|
1590
1676
|
const result = discoverAgentsAll(dir);
|
|
1591
|
-
assert.ok(result.project.find((agent) => agent.name === "code-analysis.
|
|
1677
|
+
assert.ok(result.project.find((agent) => agent.name === "code-analysis.scout"));
|
|
1592
1678
|
assert.ok(result.chains.find((chain) => chain.name === "code-analysis.review-flow"));
|
|
1593
1679
|
});
|
|
1594
1680
|
|
|
@@ -1599,8 +1685,8 @@ Review
|
|
|
1599
1685
|
const chainsDir = path.join(dir, ".selesai", "chains");
|
|
1600
1686
|
fs.mkdirSync(agentsDir, { recursive: true });
|
|
1601
1687
|
fs.mkdirSync(chainsDir, { recursive: true });
|
|
1602
|
-
fs.writeFileSync(path.join(agentsDir, "
|
|
1603
|
-
name:
|
|
1688
|
+
fs.writeFileSync(path.join(agentsDir, "scout.md"), `---
|
|
1689
|
+
name: scout
|
|
1604
1690
|
package: !!!
|
|
1605
1691
|
description: Fast recon
|
|
1606
1692
|
---
|
|
@@ -1613,13 +1699,13 @@ package: !!!
|
|
|
1613
1699
|
description: Review flow
|
|
1614
1700
|
---
|
|
1615
1701
|
|
|
1616
|
-
##
|
|
1702
|
+
## scout
|
|
1617
1703
|
|
|
1618
1704
|
Review
|
|
1619
1705
|
`, "utf-8");
|
|
1620
1706
|
|
|
1621
1707
|
const result = discoverAgentsAll(dir);
|
|
1622
|
-
assert.equal(result.project.some((agent) => agent.filePath.endsWith("
|
|
1708
|
+
assert.equal(result.project.some((agent) => agent.filePath.endsWith("scout.md")), false);
|
|
1623
1709
|
assert.equal(result.chains.some((chain) => chain.filePath.endsWith("review.chain.md")), false);
|
|
1624
1710
|
});
|
|
1625
1711
|
});
|
|
@@ -1763,7 +1849,7 @@ name: ignored-chain
|
|
|
1763
1849
|
description: Ignored chain
|
|
1764
1850
|
---
|
|
1765
1851
|
|
|
1766
|
-
##
|
|
1852
|
+
## scout
|
|
1767
1853
|
|
|
1768
1854
|
Ignore
|
|
1769
1855
|
`, "utf-8");
|
|
@@ -1772,7 +1858,7 @@ name: canonical-chain
|
|
|
1772
1858
|
description: Canonical chain
|
|
1773
1859
|
---
|
|
1774
1860
|
|
|
1775
|
-
##
|
|
1861
|
+
## worker
|
|
1776
1862
|
|
|
1777
1863
|
Inspect canonical
|
|
1778
1864
|
`, "utf-8");
|
|
@@ -1801,7 +1887,7 @@ name: shared-chain
|
|
|
1801
1887
|
description: User chain
|
|
1802
1888
|
---
|
|
1803
1889
|
|
|
1804
|
-
##
|
|
1890
|
+
## scout
|
|
1805
1891
|
|
|
1806
1892
|
Inspect user
|
|
1807
1893
|
`, "utf-8");
|
|
@@ -1810,7 +1896,7 @@ name: shared-chain
|
|
|
1810
1896
|
description: Project chain
|
|
1811
1897
|
---
|
|
1812
1898
|
|
|
1813
|
-
##
|
|
1899
|
+
## worker
|
|
1814
1900
|
|
|
1815
1901
|
Inspect project
|
|
1816
1902
|
`, "utf-8");
|
|
@@ -1823,7 +1909,7 @@ Inspect project
|
|
|
1823
1909
|
assert.ok(shared);
|
|
1824
1910
|
assert.equal(shared.filePath, path.join(dir, ".selesai", "chains", "shared.chain.md"));
|
|
1825
1911
|
assert.equal(shared.description, "Project chain");
|
|
1826
|
-
assert.equal(shared.steps[0]?.agent, "
|
|
1912
|
+
assert.equal(shared.steps[0]?.agent, "worker");
|
|
1827
1913
|
assert.equal(shared.steps[0]?.task, "Inspect project");
|
|
1828
1914
|
} finally {
|
|
1829
1915
|
if (oldHome === undefined) delete process.env.HOME;
|