@selesai/code 0.8.3 → 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 +5 -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 +14 -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 -317
- package/dist/extensions/pi-powerline-footer/package.json +1 -1
- package/dist/extensions/pi-powerline-footer/powerline-config.ts +0 -12
- 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/git-optional-locks.test.ts +64 -0
- package/dist/extensions/pi-powerline-footer/tests/jump-shortcuts.test.ts +116 -0
- 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/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/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/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/package.json +1 -1
- 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
|
@@ -3,10 +3,12 @@ import * as fs from "node:fs";
|
|
|
3
3
|
import * as os from "node:os";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { describe, it } from "node:test";
|
|
6
|
+
import { updateActiveRunIndex } from "../../src/runs/background/active-run-index.ts";
|
|
6
7
|
import { WAIT_TOOL_ENABLED_ENV, resolveWaitToolConfig, waitForSubagents, type SubagentWaitDeps } from "../../src/runs/background/subagent-wait.ts";
|
|
7
|
-
import
|
|
8
|
+
import { recordWaitCompletion } from "../../src/runs/background/wait-completions.ts";
|
|
9
|
+
import type { AsyncStatus, SubagentState } from "../../src/shared/types.ts";
|
|
8
10
|
|
|
9
|
-
function writeStatus(asyncRoot: string, runId: string, state:
|
|
11
|
+
function writeStatus(asyncRoot: string, runId: string, state: AsyncStatus["state"], extra: object = {}): void {
|
|
10
12
|
const dir = path.join(asyncRoot, runId);
|
|
11
13
|
fs.mkdirSync(dir, { recursive: true });
|
|
12
14
|
// Use a recent timestamp so the stale-run reconciler doesn't mark a live
|
|
@@ -20,11 +22,12 @@ function writeStatus(asyncRoot: string, runId: string, state: string, extra: obj
|
|
|
20
22
|
state,
|
|
21
23
|
startedAt: nowMs,
|
|
22
24
|
lastUpdate: nowMs,
|
|
23
|
-
steps: [{ agent: "
|
|
25
|
+
steps: [{ agent: "worker", status: state }],
|
|
24
26
|
...extra,
|
|
25
27
|
}),
|
|
26
28
|
"utf-8",
|
|
27
29
|
);
|
|
30
|
+
updateActiveRunIndex(dir, state);
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
function makeState(sessionId: string | null): SubagentState {
|
|
@@ -147,7 +150,7 @@ describe("subagent_wait tool", () => {
|
|
|
147
150
|
sessionId: "sess-1",
|
|
148
151
|
pid: 999999,
|
|
149
152
|
steps: [{
|
|
150
|
-
agent: "
|
|
153
|
+
agent: "worker",
|
|
151
154
|
status: "running",
|
|
152
155
|
currentTool: "edit",
|
|
153
156
|
currentPath: "src/render.ts",
|
|
@@ -164,7 +167,7 @@ describe("subagent_wait tool", () => {
|
|
|
164
167
|
assert.equal(result.isError, undefined);
|
|
165
168
|
assert.equal(updates.length, 1);
|
|
166
169
|
assert.match(updates[0]!, /Waiting .* for 1 async run/);
|
|
167
|
-
assert.match(updates[0]!.split("\n")[0]!, /
|
|
170
|
+
assert.match(updates[0]!.split("\n")[0]!, /worker: edit .*src\/render\.ts/);
|
|
168
171
|
assert.match(updates[0]!, /run-live/);
|
|
169
172
|
} finally {
|
|
170
173
|
fs.rmSync(root, { recursive: true, force: true });
|
|
@@ -188,6 +191,138 @@ describe("subagent_wait tool", () => {
|
|
|
188
191
|
}
|
|
189
192
|
});
|
|
190
193
|
|
|
194
|
+
it("tells blocking callers to revive resumable failed runs before replacing them", async () => {
|
|
195
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-revive-first-"));
|
|
196
|
+
try {
|
|
197
|
+
const asyncRoot = path.join(root, "runs");
|
|
198
|
+
const sessionFile = path.join(root, "worker-session.jsonl");
|
|
199
|
+
fs.writeFileSync(sessionFile, "{}\n", "utf-8");
|
|
200
|
+
const state = makeState("sess-1");
|
|
201
|
+
writeStatus(asyncRoot, "run-revive", "running", { sessionId: "sess-1", pid: 999999 });
|
|
202
|
+
const result = await waitForSubagents({ all: true }, undefined, baseDeps(root, state, {
|
|
203
|
+
sleep: async () => writeStatus(asyncRoot, "run-revive", "failed", {
|
|
204
|
+
sessionId: "sess-1",
|
|
205
|
+
steps: [{ agent: "worker", status: "failed", sessionFile }],
|
|
206
|
+
}),
|
|
207
|
+
}));
|
|
208
|
+
|
|
209
|
+
assert.equal(result.isError, undefined);
|
|
210
|
+
const text = textOf(result);
|
|
211
|
+
assert.match(text, /1 failed/);
|
|
212
|
+
assert.match(text, /Resume-first/);
|
|
213
|
+
assert.match(text, /subagent\(\{ action: "resume", id: "run-revive", message:/);
|
|
214
|
+
assert.match(text, /before reporting failure or launching a replacement/);
|
|
215
|
+
assert.match(text, /only if revive fails or the user explicitly asks/);
|
|
216
|
+
} finally {
|
|
217
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it("surfaces terminal completion payloads from the result file in details.completions", async () => {
|
|
222
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-completions-file-"));
|
|
223
|
+
try {
|
|
224
|
+
const asyncRoot = path.join(root, "runs");
|
|
225
|
+
const resultsDir = path.join(root, "results");
|
|
226
|
+
fs.mkdirSync(resultsDir, { recursive: true });
|
|
227
|
+
const state = makeState("sess-1");
|
|
228
|
+
writeStatus(asyncRoot, "run-a", "running", { sessionId: "sess-1", pid: 999999 });
|
|
229
|
+
const result = await waitForSubagents({ all: true }, undefined, baseDeps(root, state, {
|
|
230
|
+
sleep: async () => {
|
|
231
|
+
writeStatus(asyncRoot, "run-a", "complete", { sessionId: "sess-1" });
|
|
232
|
+
fs.writeFileSync(path.join(resultsDir, "run-a.json"), JSON.stringify({
|
|
233
|
+
id: "run-a",
|
|
234
|
+
runId: "run-a",
|
|
235
|
+
sessionId: "sess-1",
|
|
236
|
+
agent: "workflow",
|
|
237
|
+
mode: "workflow",
|
|
238
|
+
state: "complete",
|
|
239
|
+
success: true,
|
|
240
|
+
results: [{
|
|
241
|
+
agent: "reviewer",
|
|
242
|
+
runId: "a1b2c3d4",
|
|
243
|
+
success: true,
|
|
244
|
+
outputState: "present",
|
|
245
|
+
output: "full output text stays out of details",
|
|
246
|
+
artifactPaths: {
|
|
247
|
+
outputPath: "/tmp/a1b2c3d4_reviewer_0_output.md",
|
|
248
|
+
metadataPath: "/tmp/a1b2c3d4_reviewer_0_meta.json",
|
|
249
|
+
},
|
|
250
|
+
}],
|
|
251
|
+
}), "utf-8");
|
|
252
|
+
},
|
|
253
|
+
}));
|
|
254
|
+
|
|
255
|
+
assert.equal(result.isError, undefined);
|
|
256
|
+
const completions = result.details.completions;
|
|
257
|
+
assert.equal(completions?.length, 1);
|
|
258
|
+
assert.equal(completions![0]!.runId, "run-a");
|
|
259
|
+
assert.equal(completions![0]!.mode, "workflow");
|
|
260
|
+
assert.equal(completions![0]!.success, true);
|
|
261
|
+
const child = completions![0]!.results?.[0];
|
|
262
|
+
assert.equal(child?.agent, "reviewer");
|
|
263
|
+
assert.equal(child?.runId, "a1b2c3d4");
|
|
264
|
+
assert.equal(child?.artifactPaths?.metadataPath, "/tmp/a1b2c3d4_reviewer_0_meta.json");
|
|
265
|
+
assert.equal("output" in (child ?? {}), false);
|
|
266
|
+
// The result file is the watcher's to consume; the wait must not delete it.
|
|
267
|
+
assert.equal(fs.existsSync(path.join(resultsDir, "run-a.json")), true);
|
|
268
|
+
} finally {
|
|
269
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it("reports malformed terminal result files as actionable errors", async () => {
|
|
274
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-completions-malformed-"));
|
|
275
|
+
try {
|
|
276
|
+
const asyncRoot = path.join(root, "runs");
|
|
277
|
+
const resultsDir = path.join(root, "results");
|
|
278
|
+
fs.mkdirSync(resultsDir, { recursive: true });
|
|
279
|
+
const state = makeState("sess-1");
|
|
280
|
+
writeStatus(asyncRoot, "run-bad", "running", { sessionId: "sess-1", pid: 999999 });
|
|
281
|
+
const result = await waitForSubagents({ all: true }, undefined, baseDeps(root, state, {
|
|
282
|
+
sleep: async () => {
|
|
283
|
+
writeStatus(asyncRoot, "run-bad", "complete", { sessionId: "sess-1" });
|
|
284
|
+
fs.writeFileSync(path.join(resultsDir, "run-bad.json"), "{not json", "utf-8");
|
|
285
|
+
},
|
|
286
|
+
}));
|
|
287
|
+
|
|
288
|
+
assert.equal(result.isError, true);
|
|
289
|
+
assert.match(textOf(result), /Failed to read subagent result/);
|
|
290
|
+
assert.match(textOf(result), /run-bad\.json/);
|
|
291
|
+
} finally {
|
|
292
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
it("surfaces completions from the watcher record when the result file is already consumed", async () => {
|
|
297
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-completions-record-"));
|
|
298
|
+
try {
|
|
299
|
+
const asyncRoot = path.join(root, "runs");
|
|
300
|
+
const state = makeState("sess-1");
|
|
301
|
+
writeStatus(asyncRoot, "run-b", "running", { sessionId: "sess-1", pid: 999999 });
|
|
302
|
+
const result = await waitForSubagents({ all: true }, undefined, baseDeps(root, state, {
|
|
303
|
+
sleep: async () => {
|
|
304
|
+
writeStatus(asyncRoot, "run-b", "complete", { sessionId: "sess-1" });
|
|
305
|
+
// Simulates the watcher: payload recorded, file consumed and deleted.
|
|
306
|
+
recordWaitCompletion(state, "run-b", {
|
|
307
|
+
agent: "worker",
|
|
308
|
+
mode: "single",
|
|
309
|
+
state: "complete",
|
|
310
|
+
success: true,
|
|
311
|
+
results: [{ agent: "worker", success: true, outputState: "present" }],
|
|
312
|
+
}, Date.now(), 60_000);
|
|
313
|
+
},
|
|
314
|
+
}));
|
|
315
|
+
|
|
316
|
+
assert.equal(result.isError, undefined);
|
|
317
|
+
const completions = result.details.completions;
|
|
318
|
+
assert.equal(completions?.length, 1);
|
|
319
|
+
assert.equal(completions![0]!.runId, "run-b");
|
|
320
|
+
assert.equal(completions![0]!.results?.[0]?.agent, "worker");
|
|
321
|
+
} finally {
|
|
322
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
191
326
|
it("wakes when a run needs attention, not only on completion", async () => {
|
|
192
327
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-attn-"));
|
|
193
328
|
try {
|
|
@@ -249,7 +384,7 @@ describe("subagent_wait tool", () => {
|
|
|
249
384
|
writeStatus(asyncRoot, "run-step-blocked", "running", {
|
|
250
385
|
sessionId: "sess-1",
|
|
251
386
|
pid: 999999,
|
|
252
|
-
steps: [{ agent: "
|
|
387
|
+
steps: [{ agent: "worker", status: "running", activityState: "needs_attention" }],
|
|
253
388
|
});
|
|
254
389
|
|
|
255
390
|
let polls = 0;
|
|
@@ -343,7 +478,7 @@ describe("subagent_wait tool", () => {
|
|
|
343
478
|
cwd: root,
|
|
344
479
|
sessionId: "sess-1",
|
|
345
480
|
updatedAt: 1,
|
|
346
|
-
children: [{ agent: "
|
|
481
|
+
children: [{ agent: "reviewer", index: 0, status: "detached", updatedAt: 1 }],
|
|
347
482
|
}],
|
|
348
483
|
["foreground-other", {
|
|
349
484
|
runId: "foreground-other",
|
|
@@ -351,7 +486,7 @@ describe("subagent_wait tool", () => {
|
|
|
351
486
|
cwd: root,
|
|
352
487
|
sessionId: "sess-2",
|
|
353
488
|
updatedAt: 1,
|
|
354
|
-
children: [{ agent: "
|
|
489
|
+
children: [{ agent: "worker", index: 0, status: "detached", updatedAt: 1 }],
|
|
355
490
|
}],
|
|
356
491
|
]);
|
|
357
492
|
let polls = 0;
|
|
@@ -359,7 +494,7 @@ describe("subagent_wait tool", () => {
|
|
|
359
494
|
sleep: async () => {
|
|
360
495
|
polls += 1;
|
|
361
496
|
state.foregroundRuns!.get("foreground-alpha")!.children[0] = {
|
|
362
|
-
agent: "
|
|
497
|
+
agent: "reviewer",
|
|
363
498
|
index: 0,
|
|
364
499
|
status: "completed",
|
|
365
500
|
finalOutput: "Recovered review",
|
|
@@ -427,7 +562,7 @@ describe("subagent_wait tool", () => {
|
|
|
427
562
|
cwd: root,
|
|
428
563
|
sessionId: "sess-1",
|
|
429
564
|
updatedAt: 1,
|
|
430
|
-
children: [{ agent: "
|
|
565
|
+
children: [{ agent: "worker", index: 0, status: "detached", updatedAt: 1 }],
|
|
431
566
|
}]]);
|
|
432
567
|
const handlers = new Map<string, Array<(data: unknown) => void>>();
|
|
433
568
|
const events = {
|
|
@@ -480,14 +615,14 @@ describe("subagent_wait tool", () => {
|
|
|
480
615
|
cwd: root,
|
|
481
616
|
sessionId: "sess-1",
|
|
482
617
|
updatedAt: ts,
|
|
483
|
-
children: [{ agent: "
|
|
618
|
+
children: [{ agent: "worker", index: 0, status: "detached", transcriptPath, updatedAt: ts }],
|
|
484
619
|
}]]);
|
|
485
620
|
const updates: string[] = [];
|
|
486
621
|
const result = await waitForSubagents({ id: "foreground-live" }, undefined, baseDeps(root, state, {
|
|
487
622
|
onUpdate: (update) => updates.push(textOf(update)),
|
|
488
623
|
sleep: async () => {
|
|
489
624
|
state.foregroundRuns!.get("foreground-live")!.children[0] = {
|
|
490
|
-
agent: "
|
|
625
|
+
agent: "worker",
|
|
491
626
|
index: 0,
|
|
492
627
|
status: "completed",
|
|
493
628
|
finalOutput: "Implemented the renderer fix.",
|
|
@@ -500,7 +635,7 @@ describe("subagent_wait tool", () => {
|
|
|
500
635
|
assert.equal(result.isError, undefined);
|
|
501
636
|
assert.equal(updates.length, 1);
|
|
502
637
|
assert.match(updates[0]!, /Waiting for detached foreground run "foreground-live"/);
|
|
503
|
-
assert.match(updates[0]!, /
|
|
638
|
+
assert.match(updates[0]!, /worker · working after supervisor handoff/);
|
|
504
639
|
assert.match(updates[0]!, /current: edit: \{ path: src\/render\.ts \}/);
|
|
505
640
|
assert.match(updates[0]!, /assistant: I found the relevant renderer path\./);
|
|
506
641
|
assert.doesNotMatch(updates[0]!, /large delegated task/);
|
|
@@ -520,7 +655,7 @@ describe("subagent_wait tool", () => {
|
|
|
520
655
|
cwd: root,
|
|
521
656
|
sessionId: "sess-1",
|
|
522
657
|
updatedAt: 1,
|
|
523
|
-
children: [{ agent: "
|
|
658
|
+
children: [{ agent: "reviewer", index: 0, status: "detached", updatedAt: 1 }],
|
|
524
659
|
}]]);
|
|
525
660
|
const result = await waitForSubagents({ id: "foreground-still", timeoutMs: 5000 }, undefined, baseDeps(root, state, {
|
|
526
661
|
sleep: async () => {
|
|
@@ -549,7 +684,7 @@ describe("subagent_wait tool", () => {
|
|
|
549
684
|
cwd: root,
|
|
550
685
|
sessionId: "sess-1",
|
|
551
686
|
updatedAt: 1,
|
|
552
|
-
children: [{ agent: "
|
|
687
|
+
children: [{ agent: "reviewer", index: 0, status: "detached", updatedAt: 1 }],
|
|
553
688
|
}]]);
|
|
554
689
|
|
|
555
690
|
const result = await waitForSubagents({ id: "shared" }, undefined, baseDeps(root, state));
|
|
@@ -4,18 +4,18 @@ import { classifyTaskMutationIntent, expectsImplementationMutation, taskMayMutat
|
|
|
4
4
|
|
|
5
5
|
describe("classifyTaskMutationIntent", () => {
|
|
6
6
|
it("keeps write imperatives despite investigative wording", () => {
|
|
7
|
-
assert.equal(classifyTaskMutationIntent("
|
|
8
|
-
assert.equal(classifyTaskMutationIntent("
|
|
7
|
+
assert.equal(classifyTaskMutationIntent("worker", "Inspect the failure and implement the fix").kind, "implementation");
|
|
8
|
+
assert.equal(classifyTaskMutationIntent("worker", "Research the current code path and patch the bug").kind, "implementation");
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
it("does not broaden the shared completion-guard classifier for role-only path patches", () => {
|
|
12
|
-
assert.equal(classifyTaskMutationIntent("
|
|
12
|
+
assert.equal(classifyTaskMutationIntent("worker", "Patch src/auth.ts").kind, "unknown");
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
it("treats scoped no-edit constraints as constraints, not task intent", () => {
|
|
16
|
-
assert.equal(classifyTaskMutationIntent("
|
|
17
|
-
assert.equal(classifyTaskMutationIntent("
|
|
18
|
-
assert.equal(classifyTaskMutationIntent("
|
|
16
|
+
assert.equal(classifyTaskMutationIntent("worker", "Do not modify tests; implement the fix").kind, "implementation");
|
|
17
|
+
assert.equal(classifyTaskMutationIntent("worker", "Fix the bug. Do not edit files outside src/.").kind, "implementation");
|
|
18
|
+
assert.equal(classifyTaskMutationIntent("worker", "Must not touch the production database; implement the fix locally").kind, "implementation");
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it("stops the prohibition object before a following implementation clause", () => {
|
|
@@ -28,42 +28,42 @@ describe("classifyTaskMutationIntent", () => {
|
|
|
28
28
|
"Do not modify tests – implement the fix",
|
|
29
29
|
"Do not modify tests — implement the fix",
|
|
30
30
|
]) {
|
|
31
|
-
assert.equal(classifyTaskMutationIntent("
|
|
31
|
+
assert.equal(classifyTaskMutationIntent("worker", task).kind, "implementation", task);
|
|
32
32
|
}
|
|
33
|
-
assert.equal(classifyTaskMutationIntent("
|
|
33
|
+
assert.equal(classifyTaskMutationIntent("worker", "Do not modify tests and fixtures").kind, "read-only");
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
it("lets blanket no-edit prohibitions win over write verbs", () => {
|
|
37
|
-
assert.equal(classifyTaskMutationIntent("
|
|
38
|
-
assert.equal(classifyTaskMutationIntent("
|
|
39
|
-
assert.equal(classifyTaskMutationIntent("
|
|
40
|
-
assert.equal(classifyTaskMutationIntent("
|
|
41
|
-
assert.equal(classifyTaskMutationIntent("
|
|
37
|
+
assert.equal(classifyTaskMutationIntent("worker", "Implement this. Do not edit files.").kind, "read-only");
|
|
38
|
+
assert.equal(classifyTaskMutationIntent("worker", "Do not edit files. Tell me how to fix the bug.").kind, "read-only");
|
|
39
|
+
assert.equal(classifyTaskMutationIntent("worker", "Report on the extraction pipeline. Do not modify project/source files.").kind, "read-only");
|
|
40
|
+
assert.equal(classifyTaskMutationIntent("reviewer", "Final correctness review after prior fixes. Inspect all changed files and tests. Do not modify project/source files. Report findings.").kind, "read-only");
|
|
41
|
+
assert.equal(classifyTaskMutationIntent("worker", "Verification-only task. Do not edit product/source/config files.\n Run a disposable check, delete its temporary harness, and retain only\n a sanitized report at an explicitly named artifact path.").kind, "read-only");
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
it("strips repeated prohibition phrases before testing write intent", () => {
|
|
45
|
-
assert.equal(classifyTaskMutationIntent("
|
|
46
|
-
assert.equal(classifyTaskMutationIntent("
|
|
45
|
+
assert.equal(classifyTaskMutationIntent("worker", "Do not modify vendor/. Do not modify generated/. Summarize the build.").kind, "read-only");
|
|
46
|
+
assert.equal(classifyTaskMutationIntent("worker", "Do not modify vendor/. Do not modify generated/. Implement the fix in src/.").kind, "implementation");
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
it("classifies research agents and
|
|
49
|
+
it("classifies research agents and reviewer-style tasks as read-only", () => {
|
|
50
50
|
assert.equal(classifyTaskMutationIntent("researcher", "Research this and patch the bug").kind, "read-only");
|
|
51
|
-
assert.equal(classifyTaskMutationIntent("
|
|
52
|
-
assert.equal(classifyTaskMutationIntent("
|
|
53
|
-
assert.equal(classifyTaskMutationIntent("
|
|
54
|
-
assert.equal(classifyTaskMutationIntent("
|
|
55
|
-
assert.equal(classifyTaskMutationIntent("
|
|
56
|
-
assert.equal(classifyTaskMutationIntent("
|
|
51
|
+
assert.equal(classifyTaskMutationIntent("reviewer", "Review this and fix any real issues").kind, "read-only");
|
|
52
|
+
assert.equal(classifyTaskMutationIntent("oracle", "Review findings and determine what to implement with playbooks instead of before").kind, "read-only");
|
|
53
|
+
assert.equal(classifyTaskMutationIntent("advisor", "Review findings and determine what to implement with playbooks instead of before").kind, "read-only");
|
|
54
|
+
assert.equal(classifyTaskMutationIntent("reviewer", "Review this; regardless of findings, apply changes directly").kind, "implementation");
|
|
55
|
+
assert.equal(classifyTaskMutationIntent("oracle", "Implement the approved file changes").kind, "implementation");
|
|
56
|
+
assert.equal(classifyTaskMutationIntent("advisor", "Implement the approved file changes").kind, "implementation");
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
it("keeps report-writing deliverables read-only", () => {
|
|
60
|
-
assert.equal(classifyTaskMutationIntent("
|
|
61
|
-
assert.equal(classifyTaskMutationIntent("
|
|
60
|
+
assert.equal(classifyTaskMutationIntent("worker", "Write a report on the API").kind, "read-only");
|
|
61
|
+
assert.equal(classifyTaskMutationIntent("worker", "Create a summary").kind, "unknown");
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
it("expectsImplementationMutation mirrors the classifier", () => {
|
|
65
|
-
assert.equal(expectsImplementationMutation("
|
|
66
|
-
assert.equal(expectsImplementationMutation("
|
|
65
|
+
assert.equal(expectsImplementationMutation("worker", "Do not modify tests; implement the fix"), true);
|
|
66
|
+
assert.equal(expectsImplementationMutation("worker", "Review the diff and suggest fixes only. Do not edit files."), false);
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { describe, it } from "node:test";
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_ASYNC_TIMEOUT_MS,
|
|
5
|
+
DEFAULT_FOREGROUND_TIMEOUT_MS,
|
|
6
|
+
resolveSingleAgentLaunchTimeout,
|
|
7
|
+
} from "../../src/runs/foreground/subagent-executor.ts";
|
|
8
|
+
|
|
9
|
+
describe("single-agent launch timeout wiring", () => {
|
|
10
|
+
it("async runs default to DEFAULT_ASYNC_TIMEOUT_MS when no explicit/agent timeout", () => {
|
|
11
|
+
assert.deepEqual(resolveSingleAgentLaunchTimeout({}, true), {
|
|
12
|
+
timeoutMs: DEFAULT_ASYNC_TIMEOUT_MS,
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("foreground runs default to DEFAULT_FOREGROUND_TIMEOUT_MS when no explicit/agent timeout", () => {
|
|
17
|
+
assert.deepEqual(resolveSingleAgentLaunchTimeout({}, false), {
|
|
18
|
+
timeoutMs: DEFAULT_FOREGROUND_TIMEOUT_MS,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("explicit timeoutMs wins over the async default", () => {
|
|
23
|
+
assert.deepEqual(resolveSingleAgentLaunchTimeout({ timeoutMs: 5_000 }, true), {
|
|
24
|
+
timeoutMs: 5_000,
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("maxRuntimeMs alias wins over the async default", () => {
|
|
29
|
+
assert.deepEqual(resolveSingleAgentLaunchTimeout({ maxRuntimeMs: 7_000 }, true), {
|
|
30
|
+
timeoutMs: 7_000,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("rejects non-positive timeouts", () => {
|
|
35
|
+
const result = resolveSingleAgentLaunchTimeout({ timeoutMs: 0 }, true);
|
|
36
|
+
assert.ok(result.error);
|
|
37
|
+
assert.match(result.error!, /positive integer/);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("rejects mismatched alias values", () => {
|
|
41
|
+
const result = resolveSingleAgentLaunchTimeout({ timeoutMs: 1_000, maxRuntimeMs: 2_000 }, true);
|
|
42
|
+
assert.ok(result.error);
|
|
43
|
+
assert.match(result.error!, /aliases/);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("does not apply the async default to async chains (children are bounded individually)", () => {
|
|
47
|
+
assert.deepEqual(
|
|
48
|
+
resolveSingleAgentLaunchTimeout({ agent: "worker", task: "x", chain: [{ agent: "worker", task: "y" }] }, true),
|
|
49
|
+
{},
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("does not apply the async default to async parallel tasks", () => {
|
|
54
|
+
assert.deepEqual(
|
|
55
|
+
resolveSingleAgentLaunchTimeout({ agent: "worker", task: "x", tasks: [{ agent: "worker", task: "y" }] }, true),
|
|
56
|
+
{},
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("does not apply the async default to async workflowScript", () => {
|
|
61
|
+
assert.deepEqual(
|
|
62
|
+
resolveSingleAgentLaunchTimeout({ workflowScript: "return runs.run('a', { agent: 'worker', task: 'x' })" }, true),
|
|
63
|
+
{},
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("explicit top-level timeout still applies to async chains", () => {
|
|
68
|
+
assert.deepEqual(
|
|
69
|
+
resolveSingleAgentLaunchTimeout({ agent: "worker", task: "x", chain: [{ agent: "worker", task: "y" }], timeoutMs: 5_000 }, true),
|
|
70
|
+
{ timeoutMs: 5_000 },
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -28,29 +28,42 @@ function parentToolEnv(agentDir?: string): NodeJS.ProcessEnv {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
describe("registered subagent tool description", () => {
|
|
31
|
-
it("describes
|
|
31
|
+
it("describes the four first-class execution modes", () => {
|
|
32
32
|
const description = buildSubagentToolDescription();
|
|
33
|
-
assert.match(description, /^Delegate one child with \{ agent, task \}
|
|
34
|
-
assert.match(description, /
|
|
33
|
+
assert.match(description, /^Delegate one child with \{ agent, task \}/i);
|
|
34
|
+
assert.match(description, /SINGLE: \{ agent, task\? \}/i);
|
|
35
|
+
assert.match(description, /CHAIN: \{ chain: \[\{ agent: "explorer"/i);
|
|
36
|
+
assert.match(description, /PARALLEL: \{ tasks:/i);
|
|
35
37
|
assert.match(description, /runs\.run for one child and runs\.all for parallel children/i);
|
|
36
|
-
assert.match(description, /repository mutation lanes.*worktree:true.*
|
|
37
|
-
assert.match(description, /
|
|
38
|
-
assert.match(description, /
|
|
39
|
-
assert.
|
|
40
|
-
assert.match(description, /append-step
|
|
38
|
+
assert.match(description, /repository mutation lanes.*worktree:true.*runs\.run\/runs\.all.*managed isolation/i);
|
|
39
|
+
assert.match(description, /ordinary JavaScript statement body.*explicit return/i);
|
|
40
|
+
assert.match(description, /Sequential example/i);
|
|
41
|
+
assert.match(description, /Parallel example/i);
|
|
42
|
+
assert.match(description, /append-step/i);
|
|
43
|
+
assert.match(description, /approve-checkpoint and reject-checkpoint/i);
|
|
41
44
|
assert.match(description, /cannot access filesystem, shell, arbitrary Pi tools, or host globals/i);
|
|
45
|
+
assert.match(description, /exactly one non-empty title or summary/i);
|
|
46
|
+
assert.match(description, /goal may only be true and requires budget:\{tokens\}/i);
|
|
42
47
|
assert.match(description, /SAFETY-CRITICAL SUBAGENT GUIDANCE/);
|
|
43
48
|
assert.match(description, /status\.json/);
|
|
44
49
|
});
|
|
45
50
|
|
|
51
|
+
it("includes legacy chain-control guidance when enabled", () => {
|
|
52
|
+
const description = buildSubagentToolDescription({ legacyChainControls: true });
|
|
53
|
+
assert.match(description, /append-step.*step:/i);
|
|
54
|
+
assert.match(description, /approve-checkpoint|reject-checkpoint/);
|
|
55
|
+
});
|
|
56
|
+
|
|
46
57
|
it("offers a compact mode that keeps the cutover and safety guidance", () => {
|
|
47
|
-
const description = buildSubagentToolDescription({ toolDescriptionMode: "compact" });
|
|
58
|
+
const description = buildSubagentToolDescription({ toolDescriptionMode: "compact", legacyChainControls: true });
|
|
48
59
|
assert.equal(description, COMPACT_SUBAGENT_TOOL_DESCRIPTION);
|
|
49
|
-
assert.match(description,
|
|
60
|
+
assert.match(description, /^Delegate one child with \{ agent, task \}/i);
|
|
50
61
|
assert.match(description, /runs\.run for one child and runs\.all for parallel work/i);
|
|
51
|
-
assert.match(description, /repository mutation lanes.*worktree:true.*
|
|
52
|
-
assert.
|
|
62
|
+
assert.match(description, /repository mutation lanes.*worktree:true.*runs\.run\/runs\.all.*managed isolation/i);
|
|
63
|
+
assert.match(description, /SINGLE \{agent, task\?\}|CHAIN \{chain:/i);
|
|
53
64
|
assert.match(description, /subagent_wait/i);
|
|
65
|
+
assert.match(description, /exactly one non-empty title or summary/i);
|
|
66
|
+
assert.match(description, /goal may only be true and requires budget:\{tokens\}/i);
|
|
54
67
|
assert.ok(description.length < FULL_SUBAGENT_TOOL_DESCRIPTION.length);
|
|
55
68
|
});
|
|
56
69
|
|
|
@@ -114,13 +127,33 @@ describe("registered subagent tool description", () => {
|
|
|
114
127
|
assert.match(description, /ordinary child subagents are not orchestrators/i);
|
|
115
128
|
});
|
|
116
129
|
|
|
130
|
+
it("preserves custom guidance while trimming built-in legacy chain guidance", () => {
|
|
131
|
+
const cwd = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-legacy-note-"));
|
|
132
|
+
const agentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-agent-"));
|
|
133
|
+
fs.mkdirSync(path.join(cwd, ".selesai"), { recursive: true });
|
|
134
|
+
fs.writeFileSync(
|
|
135
|
+
path.join(cwd, ".selesai", "subagent-tool-description.md"),
|
|
136
|
+
[
|
|
137
|
+
"Custom migration note: append-step, approve-checkpoint, and reject-checkpoint appear here as audit context.",
|
|
138
|
+
"{{fullDescription}}",
|
|
139
|
+
].join("\n\n"),
|
|
140
|
+
"utf-8",
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
const description = buildSubagentToolDescription({ toolDescriptionMode: "custom" }, { cwd, agentDir });
|
|
144
|
+
|
|
145
|
+
assert.match(description, /Custom migration note: append-step, approve-checkpoint, and reject-checkpoint/);
|
|
146
|
+
assert.doesNotMatch(description, /appends one step to an already-running durable legacy chain/);
|
|
147
|
+
assert.doesNotMatch(description, /decide a paused durable legacy chain checkpoint/);
|
|
148
|
+
});
|
|
149
|
+
|
|
117
150
|
it("falls back to full mode when custom mode has no valid file", () => {
|
|
118
151
|
const cwd = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-missing-"));
|
|
119
152
|
const agentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-agent-"));
|
|
120
153
|
const warnings: string[] = [];
|
|
121
154
|
|
|
122
155
|
const description = buildSubagentToolDescription(
|
|
123
|
-
{ toolDescriptionMode: "custom" },
|
|
156
|
+
{ toolDescriptionMode: "custom", legacyChainControls: true },
|
|
124
157
|
{ cwd, agentDir, warn: (message) => warnings.push(message) },
|
|
125
158
|
);
|
|
126
159
|
|
|
@@ -132,7 +165,7 @@ describe("registered subagent tool description", () => {
|
|
|
132
165
|
const warnings: string[] = [];
|
|
133
166
|
|
|
134
167
|
const description = buildSubagentToolDescription(
|
|
135
|
-
{ toolDescriptionMode: "tiny" } as never,
|
|
168
|
+
{ toolDescriptionMode: "tiny", legacyChainControls: true } as never,
|
|
136
169
|
{ warn: (message) => warnings.push(message) },
|
|
137
170
|
);
|
|
138
171
|
|
|
@@ -140,7 +173,7 @@ describe("registered subagent tool description", () => {
|
|
|
140
173
|
assert.ok(warnings.some((message) => message.includes("Ignoring invalid toolDescriptionMode")));
|
|
141
174
|
});
|
|
142
175
|
|
|
143
|
-
function
|
|
176
|
+
function readRegisteredTool(agentDir: string): { description: string; properties: string[] } {
|
|
144
177
|
const script = String.raw`
|
|
145
178
|
import registerSubagentExtension from "./src/extension/index.ts";
|
|
146
179
|
const events = { on() { return () => {}; }, emit() {} };
|
|
@@ -161,7 +194,7 @@ describe("registered subagent tool description", () => {
|
|
|
161
194
|
});
|
|
162
195
|
registerSubagentExtension(fakePi);
|
|
163
196
|
if (!registeredTool) throw new Error("tool not registered");
|
|
164
|
-
process.stdout.write(JSON.stringify(registeredTool.description));
|
|
197
|
+
process.stdout.write(JSON.stringify({ description: registeredTool.description, properties: Object.keys(registeredTool.parameters.properties) }));
|
|
165
198
|
`;
|
|
166
199
|
const output = execFileSync(
|
|
167
200
|
process.execPath,
|
|
@@ -175,7 +208,7 @@ describe("registered subagent tool description", () => {
|
|
|
175
208
|
],
|
|
176
209
|
{ cwd: projectRoot, env: parentToolEnv(agentDir), encoding: "utf-8" },
|
|
177
210
|
);
|
|
178
|
-
return JSON.parse(output) as string;
|
|
211
|
+
return JSON.parse(output) as { description: string; properties: string[] };
|
|
179
212
|
}
|
|
180
213
|
|
|
181
214
|
function writeExtensionConfig(agentDir: string, config: Record<string, unknown>): void {
|
|
@@ -186,25 +219,43 @@ describe("registered subagent tool description", () => {
|
|
|
186
219
|
|
|
187
220
|
it("registers full, compact, custom, and fallback descriptions from extension config", () => {
|
|
188
221
|
const defaultAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-default-"));
|
|
189
|
-
|
|
222
|
+
writeExtensionConfig(defaultAgentDir, { legacyChainControls: true });
|
|
223
|
+
assert.equal(readRegisteredTool(defaultAgentDir).description, FULL_SUBAGENT_TOOL_DESCRIPTION);
|
|
190
224
|
|
|
191
225
|
const compactAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-compact-"));
|
|
192
|
-
writeExtensionConfig(compactAgentDir, { toolDescriptionMode: "compact" });
|
|
193
|
-
assert.equal(
|
|
226
|
+
writeExtensionConfig(compactAgentDir, { toolDescriptionMode: "compact", legacyChainControls: true });
|
|
227
|
+
assert.equal(readRegisteredTool(compactAgentDir).description, COMPACT_SUBAGENT_TOOL_DESCRIPTION);
|
|
194
228
|
|
|
195
229
|
const customAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-custom-"));
|
|
196
230
|
writeExtensionConfig(customAgentDir, { toolDescriptionMode: "custom" });
|
|
197
231
|
fs.writeFileSync(path.join(customAgentDir, "subagent-tool-description.md"), "Registered custom description.", "utf-8");
|
|
198
|
-
const customDescription =
|
|
232
|
+
const customDescription = readRegisteredTool(customAgentDir).description;
|
|
199
233
|
assert.match(customDescription, /Registered custom description/);
|
|
200
234
|
assert.match(customDescription, /SAFETY-CRITICAL SUBAGENT GUIDANCE/);
|
|
201
235
|
|
|
202
236
|
const missingCustomAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-missing-"));
|
|
203
|
-
writeExtensionConfig(missingCustomAgentDir, { toolDescriptionMode: "custom" });
|
|
204
|
-
assert.equal(
|
|
237
|
+
writeExtensionConfig(missingCustomAgentDir, { toolDescriptionMode: "custom", legacyChainControls: true });
|
|
238
|
+
assert.equal(readRegisteredTool(missingCustomAgentDir).description, FULL_SUBAGENT_TOOL_DESCRIPTION);
|
|
205
239
|
|
|
206
240
|
const invalidAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-invalid-"));
|
|
207
|
-
writeExtensionConfig(invalidAgentDir, { toolDescriptionMode: "tiny" });
|
|
208
|
-
assert.equal(
|
|
241
|
+
writeExtensionConfig(invalidAgentDir, { toolDescriptionMode: "tiny", legacyChainControls: true });
|
|
242
|
+
assert.equal(readRegisteredTool(invalidAgentDir).description, FULL_SUBAGENT_TOOL_DESCRIPTION);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it("registers the full schema and first-class chain description by default", () => {
|
|
246
|
+
const agentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-trimmed-"));
|
|
247
|
+
const tool = readRegisteredTool(agentDir);
|
|
248
|
+
assert.equal(tool.properties.includes("step"), true);
|
|
249
|
+
assert.equal(tool.properties.includes("chain"), true);
|
|
250
|
+
assert.equal(tool.properties.includes("tasks"), true);
|
|
251
|
+
assert.match(tool.description, /CHAIN: \{ chain:/i);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it("registers the trimmed schema and description when legacyChainControls is false", () => {
|
|
255
|
+
const agentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-legacy-"));
|
|
256
|
+
writeExtensionConfig(agentDir, { legacyChainControls: false });
|
|
257
|
+
const tool = readRegisteredTool(agentDir);
|
|
258
|
+
assert.equal(tool.properties.includes("step"), false);
|
|
259
|
+
assert.doesNotMatch(tool.description, /append-step/i);
|
|
209
260
|
});
|
|
210
261
|
});
|
|
@@ -50,13 +50,13 @@ describe("turn-budget module", () => {
|
|
|
50
50
|
|
|
51
51
|
describe("appendTurnBudgetSystemPrompt", () => {
|
|
52
52
|
it("returns the system prompt unchanged when no budget is configured", () => {
|
|
53
|
-
assert.equal(appendTurnBudgetSystemPrompt("You are a
|
|
53
|
+
assert.equal(appendTurnBudgetSystemPrompt("You are a reviewer.", undefined), "You are a reviewer.");
|
|
54
54
|
assert.equal(appendTurnBudgetSystemPrompt("", undefined), "");
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
it("appends a turn-budget block after an existing system prompt", () => {
|
|
58
|
-
const result = appendTurnBudgetSystemPrompt("You are a
|
|
59
|
-
assert.ok(result.startsWith("You are a
|
|
58
|
+
const result = appendTurnBudgetSystemPrompt("You are a reviewer.", budget({ maxTurns: 5, graceTurns: 2 }));
|
|
59
|
+
assert.ok(result.startsWith("You are a reviewer.\n\n## Turn budget\n"), result);
|
|
60
60
|
assert.match(result, /soft budget of 5 assistant turns/);
|
|
61
61
|
assert.match(result, /2 additional assistant turns/);
|
|
62
62
|
});
|
|
@@ -68,8 +68,8 @@ describe("turn-budget module", () => {
|
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
it("trims surrounding whitespace from the existing system prompt before joining", () => {
|
|
71
|
-
const result = appendTurnBudgetSystemPrompt("\nYou are a
|
|
72
|
-
assert.ok(result.startsWith("You are a
|
|
71
|
+
const result = appendTurnBudgetSystemPrompt("\nYou are a reviewer.\n\n", budget());
|
|
72
|
+
assert.ok(result.startsWith("You are a reviewer.\n\n## Turn budget\n"), result);
|
|
73
73
|
assert.equal(result.startsWith("\n"), false);
|
|
74
74
|
});
|
|
75
75
|
|