@selesai/code 0.8.3 → 0.8.5
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 +7 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/defaults/models.json +41 -55
- package/dist/defaults/settings.json +7 -8
- 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 +225 -14
- package/dist/extensions/pi-subagents/README.md +66 -1613
- 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 +372 -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 +38 -19
- 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 +62 -8
- package/dist/extensions/pi-subagents/src/extension/control-notices.ts +2 -2
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +40 -0
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +51 -26
- package/dist/extensions/pi-subagents/src/extension/index.ts +140 -50
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +77 -0
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +18 -24
- 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/intercom-bridge.ts +4 -1
- 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 -17
- package/dist/extensions/pi-subagents/src/missions/store.ts +151 -9
- package/dist/extensions/pi-subagents/src/missions/types.ts +58 -3
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +260 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +8 -8
- package/dist/extensions/pi-subagents/src/runs/background/active-async-capacity.ts +374 -0
- package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +46 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +158 -36
- 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 +26 -4
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +45 -6
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +33 -15
- 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/owned-process-tree.ts +104 -0
- package/dist/extensions/pi-subagents/src/runs/background/process-terminal.ts +17 -3
- 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 +26 -3
- 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 +233 -101
- 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 +40 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +188 -46
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-control.ts +12 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +137 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/prompt-audit.ts +171 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +1365 -252
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +187 -0
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +178 -26
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/llm-intent-arbiter.ts +286 -0
- 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 +32 -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 +3 -0
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +509 -117
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +10 -10
- package/dist/extensions/pi-subagents/src/runs/shared/run-fanout-budget.ts +280 -0
- package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +4 -2
- 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 +21 -5
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +20 -8
- 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 +192 -3
- package/dist/extensions/pi-subagents/src/shared/utf8.ts +11 -0
- package/dist/extensions/pi-subagents/src/shared/utils.ts +46 -34
- 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 +37 -21
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +375 -42
- 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 +332 -27
- 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 +102 -15
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +507 -306
- 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 +124 -58
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +62 -16
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +167 -113
- 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 +139 -58
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +324 -59
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +98 -22
- 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 +1122 -96
- 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 +194 -59
- package/dist/extensions/pi-subagents/test/unit/active-async-capacity.test.ts +317 -0
- 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 +118 -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 +18 -3
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +99 -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 +94 -23
- 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 +70 -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 +30 -2
- 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 +91 -47
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +468 -38
- package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +14 -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 +7 -6
- package/dist/extensions/pi-subagents/test/unit/llm-intent-arbiter.test.ts +171 -0
- 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 +81 -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 +42 -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/owned-process-tree.test.ts +69 -0
- 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 +440 -92
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +24 -8
- 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 +59 -6
- 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 +51 -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 +111 -31
- package/dist/extensions/pi-subagents/test/unit/run-fanout-budget.test.ts +121 -0
- 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 +65 -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 +60 -44
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +424 -49
- package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +28 -0
- 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 +130 -92
- 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 +65 -26
- package/dist/extensions/pi-subagents/test/unit/timeout-defaults.test.ts +138 -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 +68 -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/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.js +48 -1
- 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/docs/quickstart.md +27 -43
- package/docs/settings.md +4 -0
- package/docs/usage.md +1 -0
- package/package.json +2 -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
|
@@ -1,8 +1,102 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { describe, it } from "node:test";
|
|
3
|
-
import {
|
|
3
|
+
import { Worker } from "node:worker_threads";
|
|
4
|
+
import { formatWorkflowJsonPreview, previewSimpleWorkflowRun, runWorkflowScript, WorkflowScriptError } from "../../src/workflows/scripted-workflow.ts";
|
|
4
5
|
|
|
5
6
|
describe("scripted workflow runtime", () => {
|
|
7
|
+
it("uses ordinary statement-body return semantics", async () => {
|
|
8
|
+
const implicit = await runWorkflowScript({
|
|
9
|
+
script: `({ answer: 42 });`,
|
|
10
|
+
async launch(key) { return { key, ok: true, output: "done", artifactPaths: [] }; },
|
|
11
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
12
|
+
});
|
|
13
|
+
const explicit = await runWorkflowScript({
|
|
14
|
+
script: `return ({ answer: 42 });`,
|
|
15
|
+
async launch(key) { return { key, ok: true, output: "done", artifactPaths: [] }; },
|
|
16
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
assert.equal(implicit.value, null);
|
|
20
|
+
assert.deepEqual(explicit.value, { answer: 42 });
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("guides invalid JavaScript caused by Markdown fence backticks", async () => {
|
|
24
|
+
const script = [
|
|
25
|
+
"const task = `Run:",
|
|
26
|
+
"```bash",
|
|
27
|
+
"npm test",
|
|
28
|
+
"```;",
|
|
29
|
+
"return task;",
|
|
30
|
+
].join("\n");
|
|
31
|
+
|
|
32
|
+
await assert.rejects(
|
|
33
|
+
runWorkflowScript({
|
|
34
|
+
script,
|
|
35
|
+
async launch(key) { return { key, ok: true, output: "unexpected", artifactPaths: [] }; },
|
|
36
|
+
async status(key) { return { key, ok: true, output: "unexpected", artifactPaths: [] }; },
|
|
37
|
+
}),
|
|
38
|
+
(error: unknown) => error instanceof WorkflowScriptError
|
|
39
|
+
&& error.message.includes("workflowScript must be valid JavaScript")
|
|
40
|
+
&& error.message.includes('array joined with "\\n"')
|
|
41
|
+
&& /workflow-script\.js:\d+/.test(error.message)
|
|
42
|
+
&& error.message.includes("SyntaxError"),
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("previews only simple explicit-return child scripts", () => {
|
|
47
|
+
assert.deepEqual(previewSimpleWorkflowRun(`return runs.run('main', { agent: 'worker', task: 'Review' });`), { agent: "worker", task: "Review" });
|
|
48
|
+
assert.deepEqual(previewSimpleWorkflowRun(`return runs.run("main", {"agent":"scout","task":"Scan"})`), { agent: "scout", task: "Scan" });
|
|
49
|
+
assert.equal(previewSimpleWorkflowRun(`const agent = "worker"; return runs.run("main", { agent });`), undefined);
|
|
50
|
+
assert.deepEqual(previewSimpleWorkflowRun(`return runs.run("main", { agent: selected });`), {});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("allows scripts to run without a timeout", async () => {
|
|
54
|
+
const result = await runWorkflowScript({
|
|
55
|
+
script: `return "done";`,
|
|
56
|
+
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
57
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
assert.equal(result.value, "done");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("exposes validated state only when a mission state adapter is present", async () => {
|
|
64
|
+
const values = new Map<string, unknown>();
|
|
65
|
+
const withState = await runWorkflowScript({
|
|
66
|
+
script: `
|
|
67
|
+
if (typeof state !== "object") throw new Error("state missing");
|
|
68
|
+
await state.set("review.stage", { count: 2 });
|
|
69
|
+
return await state.get("review.stage");
|
|
70
|
+
`,
|
|
71
|
+
state: {
|
|
72
|
+
get: (key) => values.get(key),
|
|
73
|
+
set: (key, value) => { values.set(key, value); },
|
|
74
|
+
},
|
|
75
|
+
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
76
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
77
|
+
});
|
|
78
|
+
assert.deepEqual(withState.value, { count: 2 });
|
|
79
|
+
|
|
80
|
+
const withoutState = await runWorkflowScript({
|
|
81
|
+
script: `return typeof state;`,
|
|
82
|
+
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
83
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
84
|
+
});
|
|
85
|
+
assert.equal(withoutState.value, "undefined");
|
|
86
|
+
|
|
87
|
+
for (const script of [`return state.get("bad key");`, `return state.set("valid", undefined);`]) {
|
|
88
|
+
await assert.rejects(
|
|
89
|
+
runWorkflowScript({
|
|
90
|
+
script,
|
|
91
|
+
state: { get: () => undefined, set: () => undefined },
|
|
92
|
+
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
93
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
94
|
+
}),
|
|
95
|
+
(error: unknown) => error instanceof WorkflowScriptError && /state/.test(error.message),
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
6
100
|
it("runs keyed children, streams progress, and exposes no host capabilities", async () => {
|
|
7
101
|
const launches: Array<{ key: string; params: Record<string, unknown> }> = [];
|
|
8
102
|
const traceSnapshots: number[] = [];
|
|
@@ -12,8 +106,8 @@ describe("scripted workflow runtime", () => {
|
|
|
12
106
|
onEmit: (emits) => emitSnapshots.push(emits.length),
|
|
13
107
|
script: `
|
|
14
108
|
if (typeof process !== "undefined" || typeof require !== "undefined") throw new Error("host globals leaked");
|
|
15
|
-
const scan = await runs.run("scan", { agent: "
|
|
16
|
-
const reviews = await runs.all(scan.structuredOutput.items.map((item) => ({ key: "review-" + item, agent: "
|
|
109
|
+
const scan = await runs.run("scan", { agent: "scout", task: "find targets" });
|
|
110
|
+
const reviews = await runs.all(scan.structuredOutput.items.map((item) => ({ key: "review-" + item, agent: "reviewer", task: item })));
|
|
17
111
|
emit({ count: reviews.length });
|
|
18
112
|
console.log("reviewed", reviews.length);
|
|
19
113
|
return { refs: runs.refs(reviews) };
|
|
@@ -41,14 +135,39 @@ describe("scripted workflow runtime", () => {
|
|
|
41
135
|
assert.deepEqual(emitSnapshots, [1]);
|
|
42
136
|
});
|
|
43
137
|
|
|
138
|
+
it("renders prompt text before passing it explicitly to a child", async () => {
|
|
139
|
+
let launchTask: unknown;
|
|
140
|
+
const result = await runWorkflowScript({
|
|
141
|
+
script: `
|
|
142
|
+
const task = await prompts.render("project:writer-followup", { pass: 2, previous: "draft" });
|
|
143
|
+
return runs.run("followup", { resume: "retained-run", task });
|
|
144
|
+
`,
|
|
145
|
+
prompts: {
|
|
146
|
+
render(ref, vars) {
|
|
147
|
+
assert.equal(ref, "project:writer-followup");
|
|
148
|
+
assert.deepEqual(vars, { pass: 2, previous: "draft" });
|
|
149
|
+
return "Pass 2: revise draft";
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
async launch(key, params) {
|
|
153
|
+
launchTask = params.task;
|
|
154
|
+
return { key, ok: true, runId: "latest-run", output: "revised", artifactPaths: [] };
|
|
155
|
+
},
|
|
156
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
assert.equal(launchTask, "Pass 2: revise draft");
|
|
160
|
+
assert.equal((result.value as { runId: string }).runId, "latest-run");
|
|
161
|
+
});
|
|
162
|
+
|
|
44
163
|
it("waits for every runs.all child and returns ordinary failures in input order", async () => {
|
|
45
164
|
let delayedFinished = false;
|
|
46
165
|
let delayedAborted = false;
|
|
47
166
|
const result = await runWorkflowScript({
|
|
48
167
|
script: `
|
|
49
168
|
const children = await runs.all([
|
|
50
|
-
{ key: "fails-first", agent: "
|
|
51
|
-
{ key: "finishes-later", agent: "
|
|
169
|
+
{ key: "fails-first", agent: "worker", task: "fail" },
|
|
170
|
+
{ key: "finishes-later", agent: "worker", task: "finish" }
|
|
52
171
|
]);
|
|
53
172
|
return children.map(({ key, ok, error, results }) => error === undefined ? { key, ok, results } : { key, ok, error, results });
|
|
54
173
|
`,
|
|
@@ -95,7 +214,7 @@ describe("scripted workflow runtime", () => {
|
|
|
95
214
|
script: `
|
|
96
215
|
const children = await runs.all([
|
|
97
216
|
{ key: "cannot-launch", agent: "missing", task: "fail" },
|
|
98
|
-
{ key: "still-runs", agent: "
|
|
217
|
+
{ key: "still-runs", agent: "worker", task: "finish" }
|
|
99
218
|
]);
|
|
100
219
|
return children.map(({ key, ok, error }) => error === undefined ? { key, ok } : { key, ok, error });
|
|
101
220
|
`,
|
|
@@ -117,10 +236,39 @@ describe("scripted workflow runtime", () => {
|
|
|
117
236
|
]);
|
|
118
237
|
});
|
|
119
238
|
|
|
239
|
+
it("accepts one gate command and rejects gate with acceptance", async () => {
|
|
240
|
+
const launches: Record<string, unknown>[] = [];
|
|
241
|
+
await runWorkflowScript({
|
|
242
|
+
script: `return runs.run("gated", { agent: "worker", gate: "npm test" });`,
|
|
243
|
+
async launch(key, params) { launches.push(params); return { key, ok: true, output: "done", artifactPaths: [] }; },
|
|
244
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
245
|
+
});
|
|
246
|
+
assert.equal(launches[0]?.gate, "npm test");
|
|
247
|
+
await assert.rejects(
|
|
248
|
+
runWorkflowScript({
|
|
249
|
+
script: `return runs.run("invalid", { agent: "worker", gate: "npm test", acceptance: "checked" });`,
|
|
250
|
+
async launch(key) { return { key, ok: true, output: "done", artifactPaths: [] }; },
|
|
251
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
252
|
+
}),
|
|
253
|
+
(error: unknown) => error instanceof WorkflowScriptError && /gate cannot be combined with acceptance/.test(error.message),
|
|
254
|
+
);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it("rejects retained resume with gate", async () => {
|
|
258
|
+
await assert.rejects(
|
|
259
|
+
runWorkflowScript({
|
|
260
|
+
script: `return runs.run("resume", { resume: "retained-run", task: "Continue", gate: "npm test" });`,
|
|
261
|
+
async launch(key) { return { key, ok: true, output: "done", artifactPaths: [] }; },
|
|
262
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
263
|
+
}),
|
|
264
|
+
(error: unknown) => error instanceof WorkflowScriptError && /gate is not supported with retained resume/.test(error.message),
|
|
265
|
+
);
|
|
266
|
+
});
|
|
267
|
+
|
|
120
268
|
it("keeps runs.run fail-fast for ordinary child failures", async () => {
|
|
121
269
|
await assert.rejects(
|
|
122
270
|
runWorkflowScript({
|
|
123
|
-
script: `return await runs.run("fails", { agent: "
|
|
271
|
+
script: `return await runs.run("fails", { agent: "worker", task: "fail" });`,
|
|
124
272
|
timeoutMs: 2_000,
|
|
125
273
|
async launch(key) { return { key, ok: false, output: "failed", artifactPaths: [], results: [] }; },
|
|
126
274
|
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
@@ -131,13 +279,14 @@ describe("scripted workflow runtime", () => {
|
|
|
131
279
|
|
|
132
280
|
it("validates every runs.all item before launching children", async () => {
|
|
133
281
|
const malformedScripts = [
|
|
134
|
-
`return await runs.all([{ key: "valid", agent: "
|
|
135
|
-
`return await runs.all([{ key: "valid", agent: "
|
|
136
|
-
`return await runs.all([{ key: "same", agent: "
|
|
137
|
-
`return await runs.all([{ key: "valid", agent: "
|
|
138
|
-
`return await runs.all([{ key: "valid", agent: "
|
|
139
|
-
`return await runs.all([{ key: "valid", agent: "
|
|
140
|
-
`
|
|
282
|
+
`return await runs.all([{ key: "valid", agent: "worker", task: "run" }, null]);`,
|
|
283
|
+
`return await runs.all([{ key: "valid", agent: "worker", task: "run" }, { key: "bad key", agent: "worker", task: "run" }]);`,
|
|
284
|
+
`return await runs.all([{ key: "same", agent: "worker", task: "one" }, { key: "same", agent: "worker", task: "two" }]);`,
|
|
285
|
+
`return await runs.all([{ key: "valid", agent: "worker", task: "run" }, { key: "nested", workflowScript: "return null" }]);`,
|
|
286
|
+
`return await runs.all([{ key: "valid", agent: "worker", task: "run" }, { key: "legacy", agent: "worker", task: "run", parallel: [{ task: "nested" }] }]);`,
|
|
287
|
+
`return await runs.all([{ key: "valid", agent: "worker", task: "run" }, { key: "undefined-action", agent: "worker", task: "run", action: undefined }]);`,
|
|
288
|
+
`return await runs.all([{ key: "valid", agent: "worker", task: "run" }, { key: "uncloneable", agent: "worker", task: () => "run" }]);`,
|
|
289
|
+
`const items = []; items[1] = { key: "valid", agent: "worker", task: "run" }; return await runs.all(items);`,
|
|
141
290
|
];
|
|
142
291
|
for (const script of malformedScripts) {
|
|
143
292
|
let launches = 0;
|
|
@@ -159,10 +308,10 @@ describe("scripted workflow runtime", () => {
|
|
|
159
308
|
await assert.rejects(
|
|
160
309
|
runWorkflowScript({
|
|
161
310
|
script: `
|
|
162
|
-
await runs.run("same", { agent: "
|
|
311
|
+
await runs.run("same", { agent: "worker", task: "one" });
|
|
163
312
|
return await runs.all([
|
|
164
|
-
{ key: "valid", agent: "
|
|
165
|
-
{ key: "same", agent: "
|
|
313
|
+
{ key: "valid", agent: "worker", task: "run" },
|
|
314
|
+
{ key: "same", agent: "worker", task: "two" }
|
|
166
315
|
]);
|
|
167
316
|
`,
|
|
168
317
|
timeoutMs: 2_000,
|
|
@@ -177,8 +326,8 @@ describe("scripted workflow runtime", () => {
|
|
|
177
326
|
it("reports host-side children in launch order", async () => {
|
|
178
327
|
const result = await runWorkflowScript({
|
|
179
328
|
script: `return await runs.all([
|
|
180
|
-
{ key: "slow", agent: "
|
|
181
|
-
{ key: "fast", agent: "
|
|
329
|
+
{ key: "slow", agent: "worker", task: "slow" },
|
|
330
|
+
{ key: "fast", agent: "worker", task: "fast" }
|
|
182
331
|
]);`,
|
|
183
332
|
timeoutMs: 2_000,
|
|
184
333
|
launch(key) {
|
|
@@ -193,7 +342,7 @@ describe("scripted workflow runtime", () => {
|
|
|
193
342
|
|
|
194
343
|
it("omits undefined child result fields before a script returns them", async () => {
|
|
195
344
|
const result = await runWorkflowScript({
|
|
196
|
-
script: `return await runs.run("artifact-only", { agent: "
|
|
345
|
+
script: `return await runs.run("artifact-only", { agent: "worker", task: "write output" });`,
|
|
197
346
|
timeoutMs: 2_000,
|
|
198
347
|
async launch(key) {
|
|
199
348
|
return {
|
|
@@ -216,13 +365,32 @@ describe("scripted workflow runtime", () => {
|
|
|
216
365
|
});
|
|
217
366
|
});
|
|
218
367
|
|
|
368
|
+
it("omits undefined fields in workflow return objects", async () => {
|
|
369
|
+
const result = await runWorkflowScript({
|
|
370
|
+
script: `
|
|
371
|
+
const children = await runs.all([{ key: "review", agent: "worker", task: "review" }]);
|
|
372
|
+
return children.map((child) => ({
|
|
373
|
+
key: child.key,
|
|
374
|
+
status: child.status,
|
|
375
|
+
output: child.output,
|
|
376
|
+
values: [child.status],
|
|
377
|
+
}));
|
|
378
|
+
`,
|
|
379
|
+
timeoutMs: 2_000,
|
|
380
|
+
async launch(key) { return { key, ok: true, output: "completed", artifactPaths: [], results: [] }; },
|
|
381
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
assert.deepEqual(result.value, [{ key: "review", output: "completed", values: [null] }]);
|
|
385
|
+
});
|
|
386
|
+
|
|
219
387
|
it("rejects non-plain child result values", async () => {
|
|
220
388
|
await assert.rejects(
|
|
221
389
|
runWorkflowScript({
|
|
222
|
-
script: `return await runs.run("non-plain", { agent: "
|
|
390
|
+
script: `return await runs.run("non-plain", { agent: "worker", task: "write output" });`,
|
|
223
391
|
timeoutMs: 2_000,
|
|
224
392
|
async launch(key) {
|
|
225
|
-
return { key, ok: true, output: "Saved output.", artifactPaths: [], results: [{ metadata: new Map([["source", "
|
|
393
|
+
return { key, ok: true, output: "Saved output.", artifactPaths: [], results: [{ metadata: new Map([["source", "worker"]]) }] };
|
|
226
394
|
},
|
|
227
395
|
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
228
396
|
}),
|
|
@@ -230,14 +398,39 @@ describe("scripted workflow runtime", () => {
|
|
|
230
398
|
);
|
|
231
399
|
});
|
|
232
400
|
|
|
401
|
+
it("passes retained resume items and rejects agent overrides", async () => {
|
|
402
|
+
let launchParams: Record<string, unknown> | undefined;
|
|
403
|
+
const resumed = await runWorkflowScript({
|
|
404
|
+
script: `return runs.run("continue", { resume: "retained-run", task: "Apply the follow-up" });`,
|
|
405
|
+
timeoutMs: 2_000,
|
|
406
|
+
async launch(key, params) {
|
|
407
|
+
launchParams = params;
|
|
408
|
+
return { key, ok: true, runId: "revived-run", output: "continued", artifactPaths: [] };
|
|
409
|
+
},
|
|
410
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
411
|
+
});
|
|
412
|
+
assert.deepEqual(launchParams, { resume: "retained-run", task: "Apply the follow-up", async: false });
|
|
413
|
+
assert.equal((resumed.value as { runId?: string }).runId, "revived-run");
|
|
414
|
+
|
|
415
|
+
await assert.rejects(
|
|
416
|
+
runWorkflowScript({
|
|
417
|
+
script: `return runs.run("invalid", { resume: "retained-run", agent: "worker", task: "Override" });`,
|
|
418
|
+
timeoutMs: 2_000,
|
|
419
|
+
async launch(key) { return { key, ok: true, output: "unexpected", artifactPaths: [] }; },
|
|
420
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
421
|
+
}),
|
|
422
|
+
(error: unknown) => error instanceof WorkflowScriptError && /resume and agent are mutually exclusive/.test(error.message),
|
|
423
|
+
);
|
|
424
|
+
});
|
|
425
|
+
|
|
233
426
|
it("passes per-child worktree controls through runs.run and runs.all", async () => {
|
|
234
427
|
const launches: Array<{ key: string; worktree: unknown }> = [];
|
|
235
428
|
await runWorkflowScript({
|
|
236
429
|
script: `
|
|
237
|
-
const one = await runs.run("one", { agent: "
|
|
430
|
+
const one = await runs.run("one", { agent: "worker", task: "one", worktree: true });
|
|
238
431
|
const rest = await runs.all([
|
|
239
|
-
{ key: "two", agent: "
|
|
240
|
-
{ key: "three", agent: "
|
|
432
|
+
{ key: "two", agent: "worker", task: "two", worktree: true },
|
|
433
|
+
{ key: "three", agent: "reviewer", task: "three", worktree: false }
|
|
241
434
|
]);
|
|
242
435
|
return [one.key, ...rest.map((entry) => entry.key)];
|
|
243
436
|
`,
|
|
@@ -255,26 +448,64 @@ describe("scripted workflow runtime", () => {
|
|
|
255
448
|
]);
|
|
256
449
|
});
|
|
257
450
|
|
|
451
|
+
it("composes dynamic sequential and parallel phases with per-child controls", async () => {
|
|
452
|
+
const launches: Array<{ key: string; agent: unknown; task: unknown; worktree: unknown }> = [];
|
|
453
|
+
const result = await runWorkflowScript({
|
|
454
|
+
script: `
|
|
455
|
+
const plan = await runs.run("plan", { agent: "planner", task: "plan", worktree: true });
|
|
456
|
+
const targets = ["api", "ui"];
|
|
457
|
+
const built = await runs.all(targets.map((target) => ({
|
|
458
|
+
key: "build-" + target,
|
|
459
|
+
agent: "worker",
|
|
460
|
+
task: plan.output + ":" + target,
|
|
461
|
+
worktree: true
|
|
462
|
+
})));
|
|
463
|
+
const review = await runs.run("review", {
|
|
464
|
+
agent: "reviewer",
|
|
465
|
+
task: built.map((child) => child.key).join(","),
|
|
466
|
+
worktree: false
|
|
467
|
+
});
|
|
468
|
+
return { plan: plan.key, built: built.map((child) => child.key), review: review.key };
|
|
469
|
+
`,
|
|
470
|
+
timeoutMs: 2_000,
|
|
471
|
+
async launch(key, params) {
|
|
472
|
+
launches.push({ key, agent: params.agent, task: params.task, worktree: params.worktree });
|
|
473
|
+
return { key, ok: true, output: key, artifactPaths: [], results: [] };
|
|
474
|
+
},
|
|
475
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
assert.deepEqual(result.value, { plan: "plan", built: ["build-api", "build-ui"], review: "review" });
|
|
479
|
+
assert.deepEqual(launches, [
|
|
480
|
+
{ key: "plan", agent: "planner", task: "plan", worktree: true },
|
|
481
|
+
{ key: "build-api", agent: "worker", task: "plan:api", worktree: true },
|
|
482
|
+
{ key: "build-ui", agent: "worker", task: "plan:ui", worktree: true },
|
|
483
|
+
{ key: "review", agent: "reviewer", task: "build-api,build-ui", worktree: false },
|
|
484
|
+
]);
|
|
485
|
+
});
|
|
486
|
+
|
|
258
487
|
it("rejects legacy orchestration params in runs.run", async () => {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
488
|
+
for (const params of [`tasks: [{ agent: "scout", task: "scan" }]`, `parallel: [{ agent: "scout", task: "scan" }]`]) {
|
|
489
|
+
let launches = 0;
|
|
490
|
+
await assert.rejects(
|
|
491
|
+
runWorkflowScript({
|
|
492
|
+
script: `return await runs.run("legacy", { ${params} });`,
|
|
493
|
+
timeoutMs: 2_000,
|
|
494
|
+
launch: async () => { launches++; return { ok: true, output: "unexpected" }; },
|
|
495
|
+
status: async () => ({ ok: true, output: "unused" }),
|
|
496
|
+
}),
|
|
497
|
+
(error: unknown) => error instanceof WorkflowScriptError && /accepts one child.*runs\.all/i.test(error.message),
|
|
498
|
+
);
|
|
499
|
+
assert.equal(launches, 0);
|
|
500
|
+
}
|
|
270
501
|
});
|
|
271
502
|
|
|
272
503
|
it("rejects a duplicate key with incompatible params", async () => {
|
|
273
504
|
await assert.rejects(
|
|
274
505
|
runWorkflowScript({
|
|
275
506
|
script: `
|
|
276
|
-
await runs.run("same", { agent: "
|
|
277
|
-
await runs.run("same", { agent: "
|
|
507
|
+
await runs.run("same", { agent: "scout", task: "one" });
|
|
508
|
+
await runs.run("same", { agent: "scout", task: "two" });
|
|
278
509
|
`,
|
|
279
510
|
timeoutMs: 2_000,
|
|
280
511
|
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [], results: [] }; },
|
|
@@ -284,21 +515,128 @@ describe("scripted workflow runtime", () => {
|
|
|
284
515
|
);
|
|
285
516
|
});
|
|
286
517
|
|
|
287
|
-
it("aborts an unawaited child launch when the script completes", async () => {
|
|
518
|
+
it("rejects and aborts an unawaited child launch when the script completes", async () => {
|
|
288
519
|
let childAborted = false;
|
|
520
|
+
await assert.rejects(
|
|
521
|
+
runWorkflowScript({
|
|
522
|
+
script: `runs.run("bg", { agent: "worker", task: "fire and forget" }); return "done";`,
|
|
523
|
+
timeoutMs: 2_000,
|
|
524
|
+
launch(_key, _params, signal) {
|
|
525
|
+
return new Promise((_resolve, reject) => signal.addEventListener("abort", () => {
|
|
526
|
+
childAborted = true;
|
|
527
|
+
reject(signal.reason);
|
|
528
|
+
}, { once: true }));
|
|
529
|
+
},
|
|
530
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
531
|
+
}),
|
|
532
|
+
(error: unknown) => error instanceof WorkflowScriptError
|
|
533
|
+
&& error.message.includes("unawaited runs.run launch(es): 'bg'")
|
|
534
|
+
&& error.message.includes("Await or return each launch"),
|
|
535
|
+
);
|
|
536
|
+
assert.equal(childAborted, true);
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
it("rejects an unawaited child launch that settles before the script completes", async () => {
|
|
540
|
+
await assert.rejects(
|
|
541
|
+
runWorkflowScript({
|
|
542
|
+
script: `runs.run("fast", { agent: "worker", task: "quick" }); await runs.status("probe"); return "done";`,
|
|
543
|
+
timeoutMs: 2_000,
|
|
544
|
+
async launch(key) { return { key, ok: true, output: "fast output", artifactPaths: [] }; },
|
|
545
|
+
async status(key) {
|
|
546
|
+
await Promise.resolve();
|
|
547
|
+
return { key, ok: true, output: "ok", artifactPaths: [] };
|
|
548
|
+
},
|
|
549
|
+
}),
|
|
550
|
+
(error: unknown) => error instanceof WorkflowScriptError
|
|
551
|
+
&& error.message.includes("unawaited runs.run launch(es): 'fast'")
|
|
552
|
+
&& error.partial.children.some((child) => child.key === "fast"),
|
|
553
|
+
);
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
it("rejects an unawaited runs.all launch group", async () => {
|
|
557
|
+
await assert.rejects(
|
|
558
|
+
runWorkflowScript({
|
|
559
|
+
script: `runs.all([{ key: "a", agent: "worker", task: "one" }]); return "done";`,
|
|
560
|
+
timeoutMs: 2_000,
|
|
561
|
+
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
562
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
563
|
+
}),
|
|
564
|
+
(error: unknown) => error instanceof WorkflowScriptError && error.message.includes("unawaited runs.run launch(es): 'a'"),
|
|
565
|
+
);
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
it("rejects an unawaited native Promise.all over runs.run", async () => {
|
|
569
|
+
await assert.rejects(
|
|
570
|
+
runWorkflowScript({
|
|
571
|
+
script: `Promise.all([runs.run("native", { agent: "worker", task: "one" })]); return "done";`,
|
|
572
|
+
timeoutMs: 2_000,
|
|
573
|
+
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
574
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
575
|
+
}),
|
|
576
|
+
(error: unknown) => error instanceof WorkflowScriptError && error.message.includes("unawaited runs.run launch(es): 'native'"),
|
|
577
|
+
);
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
it("rejects fire-and-forget callbacks on a runs.run promise", async () => {
|
|
581
|
+
await assert.rejects(
|
|
582
|
+
runWorkflowScript({
|
|
583
|
+
script: `runs.run("bg", { agent: "worker", task: "fire" }).then(() => {}); return "done";`,
|
|
584
|
+
timeoutMs: 2_000,
|
|
585
|
+
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
586
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
587
|
+
}),
|
|
588
|
+
(error: unknown) => error instanceof WorkflowScriptError && error.message.includes("unawaited runs.run launch(es): 'bg'"),
|
|
589
|
+
);
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
it("rejects reading output from an unawaited runs.run promise", async () => {
|
|
593
|
+
await assert.rejects(
|
|
594
|
+
runWorkflowScript({
|
|
595
|
+
script: `return runs.run("x", { agent: "worker", task: "run" }).output;`,
|
|
596
|
+
timeoutMs: 2_000,
|
|
597
|
+
launch(_key, _params, signal) {
|
|
598
|
+
return new Promise((_resolve, reject) => signal.addEventListener("abort", () => reject(signal.reason), { once: true }));
|
|
599
|
+
},
|
|
600
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
601
|
+
}),
|
|
602
|
+
(error: unknown) => error instanceof WorkflowScriptError && error.message.includes("unawaited runs.run launch(es): 'x'"),
|
|
603
|
+
);
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
it("names every outstanding workflow launch", async () => {
|
|
607
|
+
await assert.rejects(
|
|
608
|
+
runWorkflowScript({
|
|
609
|
+
script: `runs.run("first", { agent: "worker", task: "one" }); runs.run("second", { agent: "worker", task: "two" }); return null;`,
|
|
610
|
+
timeoutMs: 2_000,
|
|
611
|
+
launch(_key, _params, signal) {
|
|
612
|
+
return new Promise((_resolve, reject) => signal.addEventListener("abort", () => reject(signal.reason), { once: true }));
|
|
613
|
+
},
|
|
614
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
615
|
+
}),
|
|
616
|
+
(error: unknown) => error instanceof WorkflowScriptError
|
|
617
|
+
&& error.message.includes("'first', 'second'")
|
|
618
|
+
&& error.partial.children.length === 0,
|
|
619
|
+
);
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
it("accepts a directly returned runs.run promise", async () => {
|
|
289
623
|
const result = await runWorkflowScript({
|
|
290
|
-
script: `runs.run("
|
|
624
|
+
script: `return runs.run("direct", { agent: "worker", task: "run" });`,
|
|
291
625
|
timeoutMs: 2_000,
|
|
292
|
-
launch(
|
|
293
|
-
return new Promise((_resolve, reject) => signal.addEventListener("abort", () => {
|
|
294
|
-
childAborted = true;
|
|
295
|
-
reject(signal.reason);
|
|
296
|
-
}, { once: true }));
|
|
297
|
-
},
|
|
626
|
+
async launch(key) { return { key, ok: true, output: "direct output", artifactPaths: [] }; },
|
|
298
627
|
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
299
628
|
});
|
|
300
|
-
assert.equal(result.value, "
|
|
301
|
-
|
|
629
|
+
assert.equal((result.value as { output?: string }).output, "direct output");
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
it("accepts output from an explicitly awaited runs.run promise", async () => {
|
|
633
|
+
const result = await runWorkflowScript({
|
|
634
|
+
script: `return (await runs.run("awaited", { agent: "worker", task: "run" })).output;`,
|
|
635
|
+
timeoutMs: 2_000,
|
|
636
|
+
async launch(key) { return { key, ok: true, output: "awaited output", artifactPaths: [] }; },
|
|
637
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
638
|
+
});
|
|
639
|
+
assert.equal(result.value, "awaited output");
|
|
302
640
|
});
|
|
303
641
|
|
|
304
642
|
it("rejects non-JSON-safe emitted values without persisting them", async () => {
|
|
@@ -335,6 +673,7 @@ describe("scripted workflow runtime", () => {
|
|
|
335
673
|
`return 1n;`,
|
|
336
674
|
`return new (class Object { constructor() { this.ok = true; } })();`,
|
|
337
675
|
`const value = {}; value.self = value; return value;`,
|
|
676
|
+
`const value = {}; value[Symbol("hidden")] = true; return value;`,
|
|
338
677
|
`return () => true;`,
|
|
339
678
|
`return Symbol("value");`,
|
|
340
679
|
];
|
|
@@ -394,7 +733,7 @@ describe("scripted workflow runtime", () => {
|
|
|
394
733
|
let childAborted = false;
|
|
395
734
|
await assert.rejects(
|
|
396
735
|
runWorkflowScript({
|
|
397
|
-
script: `await runs.run("slow", { agent: "
|
|
736
|
+
script: `await runs.run("slow", { agent: "worker", task: "wait" });`,
|
|
398
737
|
timeoutMs: 500,
|
|
399
738
|
launch(_key, _params, signal) {
|
|
400
739
|
return new Promise((_resolve, reject) => signal.addEventListener("abort", () => {
|
|
@@ -408,4 +747,40 @@ describe("scripted workflow runtime", () => {
|
|
|
408
747
|
);
|
|
409
748
|
assert.equal(childAborted, true);
|
|
410
749
|
});
|
|
750
|
+
|
|
751
|
+
it("drops a child response that settles after the workflow aborts", async () => {
|
|
752
|
+
const workerPrototype = Worker.prototype as unknown as { postMessage(value: unknown, ...args: unknown[]): void };
|
|
753
|
+
const originalPostMessage = workerPrototype.postMessage;
|
|
754
|
+
const controller = new AbortController();
|
|
755
|
+
let workflowSettled = false;
|
|
756
|
+
let postSettlementResponses = 0;
|
|
757
|
+
let resolveLaunch!: (result: { key: string; ok: true; output: string; artifactPaths: string[]; results: never[] }) => void;
|
|
758
|
+
let markLaunchStarted!: () => void;
|
|
759
|
+
const launchStarted = new Promise<void>((resolve) => { markLaunchStarted = resolve; });
|
|
760
|
+
workerPrototype.postMessage = function (value, ...args) {
|
|
761
|
+
if (workflowSettled && typeof value === "object" && value !== null && "type" in value && value.type === "response") postSettlementResponses++;
|
|
762
|
+
originalPostMessage.call(this, value, ...args);
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
try {
|
|
766
|
+
const workflow = runWorkflowScript({
|
|
767
|
+
script: `await runs.run("slow", { agent: "worker", task: "wait" });`,
|
|
768
|
+
signal: controller.signal,
|
|
769
|
+
launch() {
|
|
770
|
+
markLaunchStarted();
|
|
771
|
+
return new Promise((resolve) => { resolveLaunch = resolve; });
|
|
772
|
+
},
|
|
773
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
774
|
+
});
|
|
775
|
+
await launchStarted;
|
|
776
|
+
controller.abort();
|
|
777
|
+
await assert.rejects(workflow, (error: unknown) => error instanceof WorkflowScriptError && /aborted/.test(error.message));
|
|
778
|
+
workflowSettled = true;
|
|
779
|
+
resolveLaunch({ key: "slow", ok: true, output: "done", artifactPaths: [], results: [] });
|
|
780
|
+
await new Promise((resolve) => queueMicrotask(resolve));
|
|
781
|
+
assert.equal(postSettlementResponses, 0);
|
|
782
|
+
} finally {
|
|
783
|
+
workerPrototype.postMessage = originalPostMessage;
|
|
784
|
+
}
|
|
785
|
+
});
|
|
411
786
|
});
|
|
@@ -309,4 +309,32 @@ describe("finalizeSingleOutput", () => {
|
|
|
309
309
|
|
|
310
310
|
assert.equal(result.displayOutput, "truncated output");
|
|
311
311
|
});
|
|
312
|
+
|
|
313
|
+
it("preserves the saved-output reference for acceptance-only failures", () => {
|
|
314
|
+
const result = finalizeSingleOutput({
|
|
315
|
+
fullOutput: "useful output",
|
|
316
|
+
outputPath: "/tmp/review.md",
|
|
317
|
+
outputMode: "file-only",
|
|
318
|
+
exitCode: 1,
|
|
319
|
+
preserveSavedOutput: true,
|
|
320
|
+
savedPath: "/tmp/review.md",
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
assert.match(result.displayOutput, /^Output saved to:/);
|
|
324
|
+
assert.doesNotMatch(result.displayOutput, /useful output/);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it("does not duplicate an existing saved-output reference", () => {
|
|
328
|
+
const outputReference = formatSavedOutputReference("/tmp/review.md", "useful output");
|
|
329
|
+
const result = finalizeSingleOutput({
|
|
330
|
+
fullOutput: `useful output\n\n${outputReference.message}`,
|
|
331
|
+
outputPath: "/tmp/review.md",
|
|
332
|
+
exitCode: 1,
|
|
333
|
+
preserveSavedOutput: true,
|
|
334
|
+
savedPath: "/tmp/review.md",
|
|
335
|
+
outputReference,
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
assert.equal(result.displayOutput.match(/Output saved to:/g)?.length, 1);
|
|
339
|
+
});
|
|
312
340
|
});
|