@selesai/code 0.9.11 → 0.9.12
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 +11 -0
- package/dist/config.d.ts +4 -6
- package/dist/config.js +10 -14
- package/dist/core/agent-session.d.ts +0 -1
- package/dist/core/agent-session.js +3 -49
- package/dist/core/extensions/types.d.ts +0 -2
- package/dist/core/settings-manager.d.ts +0 -2
- package/dist/core/settings-manager.js +0 -3
- package/dist/core/tools/index.d.ts +0 -1
- package/dist/core/tools/index.js +0 -1
- package/dist/defaults/settings.json +0 -1
- package/dist/extensions/model-prompt-injector/index.test.ts +0 -10
- package/dist/extensions/model-prompt-injector/index.ts +0 -3
- package/dist/extensions/pi-intercom/CHANGELOG.md +53 -16
- package/dist/extensions/pi-intercom/README.md +41 -8
- package/dist/extensions/pi-intercom/banner.png +0 -0
- package/dist/extensions/pi-intercom/broker/broker.ts +498 -215
- package/dist/extensions/pi-intercom/broker/client.ts +39 -12
- package/dist/extensions/pi-intercom/broker/extension.test.ts +102 -3
- package/dist/extensions/pi-intercom/broker/paths.test.ts +2 -2
- package/dist/extensions/pi-intercom/broker/protocol.ts +26 -0
- package/dist/extensions/pi-intercom/broker/spawn.test.ts +5 -20
- package/dist/extensions/pi-intercom/config.test.ts +41 -0
- package/dist/extensions/pi-intercom/config.ts +21 -0
- package/dist/extensions/pi-intercom/extension-api.ts +40 -0
- package/dist/extensions/pi-intercom/index.ts +362 -26
- package/dist/extensions/pi-intercom/intercom.integration.test.ts +819 -13
- package/dist/extensions/pi-intercom/package.json +1 -1
- package/dist/extensions/pi-intercom/project-agent.ts +2 -2
- package/dist/extensions/pi-intercom/skills/pi-intercom/SKILL.md +8 -110
- package/dist/extensions/pi-intercom/types.ts +32 -5
- package/dist/extensions/pi-intercom/ui/inline-message.ts +6 -0
- package/dist/extensions/pi-subagents/.github/assets/subagent-fleet-inspector.png +0 -0
- package/dist/extensions/pi-subagents/.github/workflows/release.yml +28 -0
- package/dist/extensions/pi-subagents/.github/workflows/test.yml +51 -0
- package/dist/extensions/pi-subagents/.greptile/config.json +33 -0
- package/dist/extensions/pi-subagents/.greptile/files.json +8 -0
- package/dist/extensions/pi-subagents/.greptile/rules.md +16 -0
- package/dist/extensions/pi-subagents/CHANGELOG.md +309 -87
- package/dist/extensions/pi-subagents/README.md +15 -17
- package/dist/extensions/pi-subagents/agents/oracle.md +3 -1
- package/dist/extensions/pi-subagents/agents/researcher.md +32 -13
- package/dist/extensions/pi-subagents/agents/reviewer.md +13 -2
- package/dist/extensions/pi-subagents/agents/scout.md +2 -2
- package/dist/extensions/pi-subagents/agents/worker.md +2 -1
- package/dist/extensions/pi-subagents/async-retention-discovery-worker.mjs +180 -0
- package/dist/extensions/pi-subagents/docs/configuration.md +106 -27
- package/dist/extensions/pi-subagents/docs/extension-api.md +85 -21
- package/dist/extensions/pi-subagents/docs/missions.md +41 -4
- package/dist/extensions/pi-subagents/docs/models.md +52 -9
- package/dist/extensions/pi-subagents/docs/observability.md +103 -16
- package/dist/extensions/pi-subagents/docs/tool-reference.md +60 -45
- package/dist/extensions/pi-subagents/docs/watchdog.md +60 -3
- package/dist/extensions/pi-subagents/docs/workflows.md +181 -7
- package/dist/extensions/pi-subagents/index.ts +10 -1
- package/dist/extensions/pi-subagents/install.mjs +4 -4
- package/dist/extensions/pi-subagents/package-lock.json +1483 -1470
- package/dist/extensions/pi-subagents/package.json +6 -3
- package/dist/extensions/pi-subagents/prompts/council.md +60 -0
- package/dist/extensions/pi-subagents/prompts/parallel-review.md +5 -1
- package/dist/extensions/pi-subagents/prompts/review-loop.md +9 -5
- package/dist/extensions/pi-subagents/skills/council-mode/SKILL.md +254 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +18 -17
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +31 -9
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +107 -140
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +9 -12
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/multi-lane-orchestration.md +39 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +44 -92
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +261 -368
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +6 -2
- package/dist/extensions/pi-subagents/src/agents/agents.ts +388 -85
- package/dist/extensions/pi-subagents/src/agents/builtin-names.ts +14 -0
- package/dist/extensions/pi-subagents/src/agents/runtime-agent-registry.ts +418 -0
- package/dist/extensions/pi-subagents/src/agents/skills.ts +1 -1
- package/dist/extensions/pi-subagents/src/api/agents.ts +7 -0
- package/dist/extensions/pi-subagents/src/api/external-job-provider.ts +195 -0
- package/dist/extensions/pi-subagents/src/api/preflight.ts +88 -27
- package/dist/extensions/pi-subagents/src/api/project-panes.ts +2 -0
- package/dist/extensions/pi-subagents/src/api/shared-types.ts +2 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +20 -11
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +14 -6
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +5 -4
- package/dist/extensions/pi-subagents/src/extension/index.ts +270 -187
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +65 -28
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +120 -11
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +46 -64
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +51 -37
- package/dist/extensions/pi-subagents/src/extension/tool-result.ts +19 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +2 -2
- package/dist/extensions/pi-subagents/src/inspectors/herdr/client.ts +3 -3
- package/dist/extensions/pi-subagents/src/inspectors/herdr/focus.ts +55 -0
- package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +2 -1
- package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +230 -46
- package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +26 -4
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +32 -10
- package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +6 -1
- package/dist/extensions/pi-subagents/src/missions/store.ts +4 -9
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +2 -2
- package/dist/extensions/pi-subagents/src/policy/authority.ts +2 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +3 -1
- package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +31 -8
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +210 -52
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +63 -33
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +71 -17
- package/dist/extensions/pi-subagents/src/runs/background/async-retention.ts +886 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-status-snapshot.ts +14 -5
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +49 -56
- package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +1 -0
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +3 -33
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +5 -0
- package/dist/extensions/pi-subagents/src/runs/background/completion-dedupe.ts +5 -1
- package/dist/extensions/pi-subagents/src/runs/background/completion-replay.ts +22 -12
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +105 -71
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +68 -19
- package/dist/extensions/pi-subagents/src/runs/background/index-segment.ts +59 -0
- package/dist/extensions/pi-subagents/src/runs/background/inspect-rpc.ts +443 -0
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +94 -10
- package/dist/extensions/pi-subagents/src/runs/background/result-files.ts +158 -90
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +141 -53
- package/dist/extensions/pi-subagents/src/runs/background/resume-guidance.ts +8 -5
- package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +14 -4
- package/dist/extensions/pi-subagents/src/runs/background/run-id-query.ts +7 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +13 -14
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +46 -25
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +823 -0
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +9 -3
- package/dist/extensions/pi-subagents/src/runs/background/steering.ts +11 -1
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +594 -216
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +17 -13
- package/dist/extensions/pi-subagents/src/runs/background/terminal-run-index.ts +138 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +23 -4
- package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +82 -4
- package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +5 -3
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +21 -14
- package/dist/extensions/pi-subagents/src/runs/foreground/async-stop-action.ts +23 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +153 -58
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +7 -9
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +1283 -1657
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-detach-reconcile.ts +274 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +6 -5
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +59 -10
- package/dist/extensions/pi-subagents/src/runs/shared/agent-contract.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/chain-outputs.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/child-identity.ts +36 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +52 -2
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/extension-bindings.ts +78 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-job-bridge.ts +460 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-job-runner.ts +389 -0
- package/dist/extensions/pi-subagents/src/runs/shared/fast-mode-extension.ts +10 -0
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +14 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-exclusions.ts +243 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +201 -85
- package/dist/extensions/pi-subagents/src/runs/shared/model-scope.ts +106 -39
- package/dist/extensions/pi-subagents/src/runs/shared/mutation-evidence.ts +145 -0
- package/dist/extensions/pi-subagents/src/runs/shared/orca-progress-tabs.ts +150 -27
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +46 -4
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +19 -15
- package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +5 -1
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +86 -2
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +9 -9
- package/dist/extensions/pi-subagents/src/runs/shared/session-lease.ts +0 -6
- package/dist/extensions/pi-subagents/src/runs/shared/structured-output.ts +18 -4
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-control.ts +51 -7
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +62 -21
- package/dist/extensions/pi-subagents/src/runs/shared/tool-availability.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/tool-timeout.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/workflow-graph.ts +1 -23
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +14 -2
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +2 -2
- package/dist/extensions/pi-subagents/src/shared/atomic-json.ts +22 -2
- package/dist/extensions/pi-subagents/src/shared/capacity-resilient-json.ts +102 -0
- package/dist/extensions/pi-subagents/src/shared/completion-owner.ts +14 -0
- package/dist/extensions/pi-subagents/src/shared/file-system-retry.ts +49 -1
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +59 -1
- package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +12 -5
- package/dist/extensions/pi-subagents/src/shared/model-info.ts +20 -0
- package/dist/extensions/pi-subagents/src/shared/prompt-resources.ts +0 -40
- package/dist/extensions/pi-subagents/src/shared/settings.ts +11 -30
- package/dist/extensions/pi-subagents/src/shared/thinking-ceiling.ts +52 -0
- package/dist/extensions/pi-subagents/src/shared/types.ts +228 -49
- package/dist/extensions/pi-subagents/src/shared/utils.ts +11 -3
- package/dist/extensions/pi-subagents/src/shared/watch-strategy.ts +10 -0
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +0 -162
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +2 -5
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +105 -13
- package/dist/extensions/pi-subagents/src/slash/slash-live-state.ts +6 -36
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +829 -0
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +1415 -0
- package/dist/extensions/pi-subagents/src/tui/render.ts +78 -7
- package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +1 -1
- package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +1 -0
- package/dist/extensions/pi-subagents/src/watchdog/permission-arbiter.ts +59 -51
- package/dist/extensions/pi-subagents/src/watchdog/register-main.ts +8 -2
- package/dist/extensions/pi-subagents/src/watchdog/tool-actions.ts +2 -1
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +4 -4
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +471 -86
- package/dist/extensions/pi-subagents/src/workflows/workflow-receipt.ts +140 -0
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +2 -2
- 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 +1 -1
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +0 -54
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +1053 -414
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +194 -4
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +59 -4
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +0 -77
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +107 -6
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +211 -897
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +265 -375
- package/dist/extensions/pi-subagents/test/integration/orca-progress-tabs.test.ts +77 -7
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +10 -10
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +547 -30
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +2112 -310
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +274 -34
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +20 -3
- package/dist/extensions/pi-subagents/test/support/isolated-temp-root.mjs +9 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +30 -5
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +2 -0
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +4 -2
- package/dist/extensions/pi-subagents/test/support/register-loader.mjs +1 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +197 -0
- package/dist/extensions/pi-subagents/test/unit/agent-contract.test.ts +14 -0
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +204 -27
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +444 -145
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +256 -4
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +9 -7
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +152 -22
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +29 -0
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +205 -23
- package/dist/extensions/pi-subagents/test/unit/async-retention.test.ts +579 -0
- package/dist/extensions/pi-subagents/test/unit/atomic-json.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/authority-policy.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/unit/auto-drain.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/capacity-resilient-json.test.ts +155 -0
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +7 -0
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +123 -0
- package/dist/extensions/pi-subagents/test/unit/completion-replay.test.ts +81 -3
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +109 -7
- package/dist/extensions/pi-subagents/test/unit/default-extensions.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +5 -2
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +3 -2
- package/dist/extensions/pi-subagents/test/unit/extension-bindings.test.ts +79 -0
- package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/external-job-runner.test.ts +961 -0
- package/dist/extensions/pi-subagents/test/unit/file-system-retry.test.ts +64 -0
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +1110 -0
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +1664 -0
- package/dist/extensions/pi-subagents/test/unit/fork-context.test.ts +81 -1
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +138 -11
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +41 -2
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +210 -79
- package/dist/extensions/pi-subagents/test/unit/index-segment.test.ts +95 -0
- package/dist/extensions/pi-subagents/test/unit/inspect-rpc.test.ts +596 -0
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +10 -1
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +3 -5
- package/dist/extensions/pi-subagents/test/unit/model-exclusions.test.ts +167 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +319 -18
- package/dist/extensions/pi-subagents/test/unit/model-info.test.ts +78 -0
- package/dist/extensions/pi-subagents/test/unit/model-scope-settings.test.ts +19 -5
- package/dist/extensions/pi-subagents/test/unit/model-scope.test.ts +44 -0
- package/dist/extensions/pi-subagents/test/unit/mutation-evidence.test.ts +129 -0
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +231 -2
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +28 -1
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +106 -2
- package/dist/extensions/pi-subagents/test/unit/orca-progress-tabs.test.ts +204 -7
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +59 -4
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +2 -6
- package/dist/extensions/pi-subagents/test/unit/pi-args-permission-system.test.ts +34 -2
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +116 -6
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +12 -3
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +56 -61
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +416 -1
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +9 -2
- package/dist/extensions/pi-subagents/test/unit/project-panes-public-api.test.ts +42 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +21 -30
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +86 -11
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +49 -1
- package/dist/extensions/pi-subagents/test/unit/result-files.test.ts +233 -5
- package/dist/extensions/pi-subagents/test/unit/retained-children.test.ts +28 -5
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +323 -20
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +66 -10
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +68 -5
- package/dist/extensions/pi-subagents/test/unit/runtime-agent-registration.test.ts +174 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +679 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-store-root.test.ts +67 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +55 -44
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +399 -84
- package/dist/extensions/pi-subagents/test/unit/session-lease.test.ts +13 -0
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +15 -10
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +11 -7
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +2 -0
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +40 -1
- package/dist/extensions/pi-subagents/test/unit/subagent-action-recovery.test.ts +10 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +38 -3
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +110 -12
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +204 -19
- package/dist/extensions/pi-subagents/test/unit/temp-paths.test.ts +25 -0
- package/dist/extensions/pi-subagents/test/unit/thinking-ceiling.test.ts +73 -0
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +90 -50
- package/dist/extensions/pi-subagents/test/unit/tool-timeout.test.ts +1 -2
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +234 -7
- package/dist/extensions/pi-subagents/test/unit/watch-strategy.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/watchdog-permission-arbiter.test.ts +36 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +37 -9
- package/dist/extensions/pi-subagents/test/unit/workflow-detach-reconcile.test.ts +302 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +167 -7
- package/dist/extensions/pi-subagents/test/unit/workflow-receipt.test.ts +113 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +6 -6
- package/dist/extensions/ponytail/index.js +31 -25
- package/dist/extensions/ponytail/ponytail-config.cjs +34 -7
- package/dist/extensions/ponytail/ponytail-instructions.cjs +7 -9
- package/dist/extensions/ponytail/test/extension.test.js +7 -8
- package/dist/extensions/ponytail/test/helpers.test.js +1 -1
- package/dist/skills/brandkit/SKILL.md +799 -0
- package/dist/skills/design-taste-frontend/SKILL.md +1207 -0
- package/dist/skills/design-taste-frontend-v1/SKILL.md +227 -0
- package/dist/skills/full-output-enforcement/SKILL.md +50 -0
- package/dist/skills/gpt-taste/SKILL.md +75 -0
- package/dist/skills/high-end-visual-design/SKILL.md +99 -0
- package/dist/skills/image-to-code/SKILL.md +1229 -0
- package/dist/skills/imagegen-frontend-mobile/SKILL.md +1466 -0
- package/dist/skills/imagegen-frontend-web/SKILL.md +988 -0
- package/dist/skills/industrial-brutalist-ui/SKILL.md +93 -0
- package/dist/skills/minimalist-ui/SKILL.md +86 -0
- package/dist/skills/pi-subagents/SKILL.md +18 -17
- package/dist/skills/pi-subagents/references/constraints-and-recipes.md +31 -9
- package/dist/skills/pi-subagents/references/execution-controls.md +95 -143
- package/dist/skills/pi-subagents/references/management-authoring-rpc.md +9 -12
- package/dist/skills/pi-subagents/references/multi-lane-orchestration.md +39 -0
- package/dist/skills/pi-subagents/references/prompting-and-roles.md +45 -94
- package/dist/skills/ponytail/SKILL.md +12 -8
- package/dist/skills/ponytail-audit/SKILL.md +0 -1
- package/dist/skills/ponytail-debt/SKILL.md +0 -1
- package/dist/skills/ponytail-gain/SKILL.md +0 -1
- package/dist/skills/ponytail-help/SKILL.md +4 -3
- package/dist/skills/ponytail-review/SKILL.md +0 -1
- package/dist/skills/redesign-existing-projects/SKILL.md +179 -0
- package/dist/skills/stitch-design-taste/SKILL.md +185 -0
- package/dist/skills/unlazy/CHANGELOG.md +100 -0
- package/dist/skills/unlazy/CONTRIBUTING.md +66 -0
- package/dist/skills/unlazy/LICENSE +21 -0
- package/dist/skills/unlazy/README.md +242 -0
- package/dist/skills/unlazy/SECURITY.md +70 -0
- package/dist/skills/unlazy/SKILL.md +100 -0
- package/dist/skills/unlazy/package.json +13 -0
- package/dist/skills/unlazy/references/dispatch.md +82 -0
- package/dist/skills/unlazy/references/gates.md +132 -0
- package/dist/skills/unlazy/references/method.md +49 -0
- package/dist/skills/unlazy/references/orchestration.md +99 -0
- package/dist/skills/unlazy/references/parallel.md +123 -0
- package/dist/skills/unlazy/references/token-economy.md +39 -0
- package/dist/skills/unlazy/research/validation-protocol.md +81 -0
- package/dist/skills/unlazy/scripts/dispatch-check.mjs +108 -0
- package/dist/skills/unlazy/scripts/gate-check.mjs +894 -0
- package/dist/skills/unlazy/scripts/gate-lint.mjs +178 -0
- package/dist/skills/unlazy/scripts/install-hooks.mjs +206 -0
- package/dist/skills/unlazy/scripts/lib/check-supervisor.mjs +46 -0
- package/dist/skills/unlazy/scripts/lib/dispatch.mjs +283 -0
- package/dist/skills/unlazy/scripts/lib/gates.mjs +629 -0
- package/dist/skills/unlazy/scripts/lib/process-tree.mjs +161 -0
- package/dist/skills/unlazy/scripts/lib/regex-worker.mjs +9 -0
- package/dist/skills/unlazy/scripts/stop-hook.mjs +174 -0
- package/dist/skills/unlazy/templates/PLAN.md +65 -0
- package/dist/skills/unlazy/templates/gates-leaf.md +51 -0
- package/dist/skills/unlazy/templates/gates-node.md +50 -0
- package/dist/skills/unlazy/tests/contract-tests.mjs +127 -0
- package/dist/skills/unlazy/tests/dispatch-tests.mjs +481 -0
- package/dist/skills/unlazy/tests/hardening-tests.mjs +903 -0
- package/dist/skills/unlazy/tests/lint-tests.mjs +242 -0
- package/dist/skills/unlazy/tests/run-tests.mjs +554 -0
- package/dist/skills/unlazy/tests/self-check.mjs +165 -0
- package/dist/skills/unlazy/tests/stress-tests.mjs +356 -0
- package/dist/skills/web-design-guidelines/SKILL.md +40 -0
- package/docs/settings.md +0 -5
- package/package.json +1 -1
- package/dist/core/tools/schema-prune.d.ts +0 -16
- package/dist/core/tools/schema-prune.js +0 -39
- package/dist/core/tools/schema-prune.test.d.ts +0 -1
- package/dist/core/tools/schema-prune.test.js +0 -111
- package/dist/extensions/pi-subagents/UPSTREAM-V0.50-MAPPING.md +0 -172
- package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +0 -55
- package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +0 -61
- package/dist/extensions/pi-subagents/src/agents/task-aware-routing.ts +0 -132
- package/dist/extensions/pi-subagents/src/extension/chain-validation.ts +0 -181
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +0 -1354
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +0 -1581
- package/dist/extensions/pi-subagents/src/shared/env.ts +0 -16
- package/dist/extensions/pi-subagents/src/shared/session-lineage.ts +0 -71
- package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +0 -136
- package/dist/extensions/pi-subagents/src/workflows/workflow-auto-relaunch.ts +0 -41
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +0 -466
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +0 -1859
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +0 -733
- package/dist/extensions/pi-subagents/test/unit/builtin-agent-documentation.test.ts +0 -63
- package/dist/extensions/pi-subagents/test/unit/chain-validation.test.ts +0 -326
- package/dist/extensions/pi-subagents/test/unit/handoff-adoption.test.ts +0 -103
- package/dist/extensions/pi-subagents/test/unit/inline-subagents.test.ts +0 -127
- package/dist/extensions/pi-subagents/test/unit/session-lineage.test.ts +0 -73
- package/dist/extensions/pi-subagents/test/unit/task-aware-routing.test.ts +0 -213
- package/dist/extensions/pi-subagents/test/unit/workflow-auto-relaunch.test.ts +0 -65
|
@@ -6,6 +6,7 @@ import type { MockPi } from "../support/helpers.ts";
|
|
|
6
6
|
import { createEventBus, createMockPi, createTempDir, events, removeTempDir, tryImport } from "../support/helpers.ts";
|
|
7
7
|
import { discoverAgents } from "../../src/agents/agents.ts";
|
|
8
8
|
import { ACTIVE_ASYNC_CAPACITY_DIR, acquireActiveAsyncCapacity, activeAsyncCapacitySessionKey } from "../../src/runs/background/active-async-capacity.ts";
|
|
9
|
+
import { clearExclusions } from "../../src/runs/shared/model-exclusions.ts";
|
|
9
10
|
import { DEFAULT_FORK_PREAMBLE, INTERCOM_DETACH_REQUEST_EVENT, SUBAGENT_ASYNC_STARTED_EVENT } from "../../src/shared/types.ts";
|
|
10
11
|
|
|
11
12
|
interface ExecutorModule {
|
|
@@ -106,9 +107,11 @@ describe("fork context execution wiring", { skip: !available ? "subagent executo
|
|
|
106
107
|
tempDir = createTempDir("pi-subagent-fork-test-");
|
|
107
108
|
mockPi.reset();
|
|
108
109
|
mockPi.onCall({ output: "ok" });
|
|
110
|
+
clearExclusions();
|
|
109
111
|
});
|
|
110
112
|
|
|
111
113
|
afterEach(() => {
|
|
114
|
+
clearExclusions();
|
|
112
115
|
if (originalHome === undefined) delete process.env.HOME;
|
|
113
116
|
else process.env.HOME = originalHome;
|
|
114
117
|
if (originalUserProfile === undefined) delete process.env.USERPROFILE;
|
|
@@ -314,23 +317,35 @@ describe("fork context execution wiring", { skip: !available ? "subagent executo
|
|
|
314
317
|
assert.ok((args.at(-1) ?? "").startsWith("Task: \n\n## Acceptance Contract"));
|
|
315
318
|
});
|
|
316
319
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
it("falls back to fresh when an implicit default fork has no persisted parent session", async () => {
|
|
323
|
+
const { manager } = makeSessionManagerRecorder({ sessionFile: undefined, leafId: "leaf-current" });
|
|
324
|
+
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
325
|
+
agents: [
|
|
326
|
+
{ name: "worker", description: "Worker", defaultContext: "fork" },
|
|
327
|
+
],
|
|
328
|
+
projectAgentsDir: null,
|
|
329
|
+
}));
|
|
320
330
|
|
|
321
331
|
const result = await executor.execute(
|
|
322
332
|
"id",
|
|
323
|
-
{ agent: "
|
|
333
|
+
{ agent: "worker", task: "test" },
|
|
324
334
|
new AbortController().signal,
|
|
325
335
|
undefined,
|
|
326
336
|
makeCtx(manager),
|
|
327
337
|
);
|
|
328
338
|
|
|
329
339
|
assert.equal(result.isError, undefined);
|
|
330
|
-
|
|
331
|
-
assert.
|
|
340
|
+
assert.equal(result.details?.context, "fresh");
|
|
341
|
+
assert.equal(result.details?.results?.[0]?.context, "fresh");
|
|
342
|
+
assert.doesNotMatch(readCallArgs().at(-1) ?? "", /delegated subagent running from a fork/);
|
|
332
343
|
});
|
|
333
344
|
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
334
349
|
it("uses agent defaultContext fork when launch context is omitted", async () => {
|
|
335
350
|
const parentSessionFile = path.join(tempDir, "parent.jsonl");
|
|
336
351
|
const { manager, openedPaths, branchedLeafIds } = makeForkingSessionManagerRecorder({ sessionFile: parentSessionFile, leafId: "leaf-current" });
|
|
@@ -356,6 +371,99 @@ describe("fork context execution wiring", { skip: !available ? "subagent executo
|
|
|
356
371
|
assert.deepEqual(readSessionArgsFromCalls(), [path.join(tempDir, "fork-1.jsonl")]);
|
|
357
372
|
});
|
|
358
373
|
|
|
374
|
+
it("uses global defaultSubagentContext fork for a fresh-default agent", async () => {
|
|
375
|
+
const parentSessionFile = path.join(tempDir, "parent.jsonl");
|
|
376
|
+
const { manager, openedPaths, branchedLeafIds } = makeForkingSessionManagerRecorder({ sessionFile: parentSessionFile, leafId: "leaf-current" });
|
|
377
|
+
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
378
|
+
agents: [
|
|
379
|
+
{ name: "worker", description: "Worker", defaultContext: "fresh" },
|
|
380
|
+
],
|
|
381
|
+
projectAgentsDir: null,
|
|
382
|
+
}), { defaultSubagentContext: "fork" });
|
|
383
|
+
|
|
384
|
+
const result = await executor.execute(
|
|
385
|
+
"id",
|
|
386
|
+
{ agent: "worker", task: "test" },
|
|
387
|
+
new AbortController().signal,
|
|
388
|
+
undefined,
|
|
389
|
+
makeCtx(manager),
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
assert.equal(result.isError, undefined);
|
|
393
|
+
assert.equal(result.details?.context, "fork");
|
|
394
|
+
assert.equal(result.details?.results?.[0]?.context, "fork");
|
|
395
|
+
assert.deepEqual(openedPaths, [parentSessionFile]);
|
|
396
|
+
assert.deepEqual(branchedLeafIds, ["leaf-current"]);
|
|
397
|
+
assert.deepEqual(readSessionArgsFromCalls(), [path.join(tempDir, "fork-1.jsonl")]);
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
it("uses global defaultSubagentContext fresh for a fork-default agent", async () => {
|
|
401
|
+
const parentSessionFile = path.join(tempDir, "parent.jsonl");
|
|
402
|
+
const { manager, openedPaths } = makeForkingSessionManagerRecorder({ sessionFile: parentSessionFile, leafId: "leaf-current" });
|
|
403
|
+
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
404
|
+
agents: [
|
|
405
|
+
{ name: "worker", description: "Worker", defaultContext: "fork" },
|
|
406
|
+
],
|
|
407
|
+
projectAgentsDir: null,
|
|
408
|
+
}), { defaultSubagentContext: "fresh" });
|
|
409
|
+
|
|
410
|
+
const result = await executor.execute(
|
|
411
|
+
"id",
|
|
412
|
+
{ agent: "worker", task: "test" },
|
|
413
|
+
new AbortController().signal,
|
|
414
|
+
undefined,
|
|
415
|
+
makeCtx(manager),
|
|
416
|
+
);
|
|
417
|
+
|
|
418
|
+
assert.equal(result.isError, undefined);
|
|
419
|
+
assert.equal(result.details?.context, "fresh");
|
|
420
|
+
assert.equal(result.details?.results?.[0]?.context, "fresh");
|
|
421
|
+
assert.deepEqual(openedPaths, []);
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
it("uses profile context over global defaultSubagentContext", async () => {
|
|
425
|
+
const parentSessionFile = path.join(tempDir, "parent.jsonl");
|
|
426
|
+
const { manager, openedPaths, branchedLeafIds } = makeForkingSessionManagerRecorder({ sessionFile: parentSessionFile, leafId: "leaf-current" });
|
|
427
|
+
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
428
|
+
agents: [
|
|
429
|
+
{ name: "worker", description: "Worker", defaultContext: "fork" },
|
|
430
|
+
],
|
|
431
|
+
projectAgentsDir: null,
|
|
432
|
+
}), { defaultSubagentContext: "fresh" });
|
|
433
|
+
|
|
434
|
+
const result = await executor.execute(
|
|
435
|
+
"id",
|
|
436
|
+
{ agent: "worker", task: "test", context: "profile" },
|
|
437
|
+
new AbortController().signal,
|
|
438
|
+
undefined,
|
|
439
|
+
makeCtx(manager),
|
|
440
|
+
);
|
|
441
|
+
|
|
442
|
+
assert.equal(result.isError, undefined);
|
|
443
|
+
assert.equal(result.details?.context, "fork");
|
|
444
|
+
assert.equal(result.details?.results?.[0]?.context, "fork");
|
|
445
|
+
assert.deepEqual(openedPaths, [parentSessionFile]);
|
|
446
|
+
assert.deepEqual(branchedLeafIds, ["leaf-current"]);
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
it("fails profile context when the selected agent has no defaultContext", async () => {
|
|
450
|
+
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
451
|
+
agents: [{ name: "worker", description: "Worker" }],
|
|
452
|
+
projectAgentsDir: null,
|
|
453
|
+
}), { defaultSubagentContext: "fork" });
|
|
454
|
+
|
|
455
|
+
const result = await executor.execute(
|
|
456
|
+
"id",
|
|
457
|
+
{ agent: "worker", task: "test", context: "profile" },
|
|
458
|
+
new AbortController().signal,
|
|
459
|
+
undefined,
|
|
460
|
+
makeCtx(makeSessionManagerRecorder().manager),
|
|
461
|
+
);
|
|
462
|
+
|
|
463
|
+
assert.equal(result.isError, true);
|
|
464
|
+
assert.match(result.content[0]?.text ?? "", /context: "profile" requires agent 'worker' to declare defaultContext/);
|
|
465
|
+
});
|
|
466
|
+
|
|
359
467
|
it("sanitizes inherited signed thinking and forces child thinking off", async () => {
|
|
360
468
|
const parentSessionFile = path.join(tempDir, "parent.jsonl");
|
|
361
469
|
const childSessionFile = path.join(tempDir, "fork-with-thinking.jsonl");
|
|
@@ -667,115 +775,48 @@ describe("fork context execution wiring", { skip: !available ? "subagent executo
|
|
|
667
775
|
assert.equal(args[args.indexOf("--model") + 1], "anthropic/claude-sonnet-4-5:off");
|
|
668
776
|
});
|
|
669
777
|
|
|
670
|
-
it("
|
|
671
|
-
const
|
|
672
|
-
|
|
778
|
+
it("keeps inherited parent models outside the registry during foreground fork preparation", async () => {
|
|
779
|
+
const { manager } = makeForkingSessionManagerRecorder({
|
|
780
|
+
sessionFile: path.join(tempDir, "parent.jsonl"),
|
|
781
|
+
leafId: "leaf-123",
|
|
782
|
+
});
|
|
673
783
|
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
674
|
-
agents: [
|
|
675
|
-
{ name: "worker", description: "Worker", defaultContext: "fork", model: "anthropic/claude-sonnet-4-5", thinking: "high" },
|
|
676
|
-
],
|
|
784
|
+
agents: [{ name: "worker", description: "Worker", defaultContext: "fork" }],
|
|
677
785
|
projectAgentsDir: null,
|
|
678
786
|
}));
|
|
679
787
|
const ctx = {
|
|
680
788
|
...makeCtx(manager),
|
|
681
|
-
model: { provider: "
|
|
682
|
-
modelRegistry: {
|
|
683
|
-
getAvailable: () => [
|
|
684
|
-
{ provider: "anthropic", id: "claude-sonnet-4-5", api: "anthropic-messages", reasoning: true },
|
|
685
|
-
{ provider: "openai", id: "gpt-5-mini", api: "openai-responses", reasoning: true },
|
|
686
|
-
],
|
|
687
|
-
},
|
|
789
|
+
model: { provider: "gateway", id: "parent-model" },
|
|
790
|
+
modelRegistry: { getAvailable: () => [{ provider: "openai", id: "gpt-5-mini" }] },
|
|
688
791
|
};
|
|
689
792
|
|
|
690
|
-
const
|
|
691
|
-
"
|
|
692
|
-
{
|
|
793
|
+
const inherited = await executor.execute(
|
|
794
|
+
"inherited-parent-model",
|
|
795
|
+
{ agent: "worker", task: "test", context: "fork" },
|
|
693
796
|
new AbortController().signal,
|
|
694
797
|
undefined,
|
|
695
798
|
ctx,
|
|
696
799
|
);
|
|
697
|
-
|
|
698
|
-
assert.equal(result.isError, undefined);
|
|
800
|
+
assert.equal(inherited.isError, undefined);
|
|
699
801
|
const args = readCallArgs();
|
|
700
|
-
assert.equal(args[args.indexOf("--model") + 1], "
|
|
701
|
-
const text = result.content.filter((block) => block.text).map((block) => block.text).join("\n");
|
|
702
|
-
assert.equal(text.includes("fork context forced thinking off"), false);
|
|
703
|
-
});
|
|
704
|
-
|
|
705
|
-
it("classifies the agent model when empty inheritance has no parent model", async () => {
|
|
706
|
-
const childSessionFile = path.join(tempDir, "fork-empty-model-without-parent.jsonl");
|
|
707
|
-
const manager = makeSignedThinkingSessionManager(childSessionFile);
|
|
708
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
709
|
-
agents: [
|
|
710
|
-
{ name: "worker", description: "Worker", defaultContext: "fork", model: "openai/gpt-5-mini", thinking: "high" },
|
|
711
|
-
],
|
|
712
|
-
projectAgentsDir: null,
|
|
713
|
-
}));
|
|
714
|
-
const ctx = {
|
|
715
|
-
...makeCtx(manager),
|
|
716
|
-
modelRegistry: {
|
|
717
|
-
getAvailable: () => [{ provider: "openai", id: "gpt-5-mini", api: "openai-responses", reasoning: true }],
|
|
718
|
-
},
|
|
719
|
-
};
|
|
802
|
+
assert.equal(args[args.indexOf("--model") + 1], "gateway/parent-model");
|
|
720
803
|
|
|
721
|
-
const
|
|
722
|
-
"
|
|
723
|
-
{
|
|
804
|
+
const explicit = await executor.execute(
|
|
805
|
+
"explicit-unknown-model",
|
|
806
|
+
{ agent: "worker", task: "test", context: "fork", model: "gateway/unknown" },
|
|
724
807
|
new AbortController().signal,
|
|
725
808
|
undefined,
|
|
726
809
|
ctx,
|
|
727
810
|
);
|
|
728
|
-
|
|
729
|
-
assert.
|
|
730
|
-
const args = readCallArgs();
|
|
731
|
-
assert.equal(args[args.indexOf("--model") + 1], "openai/gpt-5-mini:high");
|
|
732
|
-
const text = result.content.filter((block) => block.text).map((block) => block.text).join("\n");
|
|
733
|
-
assert.equal(text.includes("fork context forced thinking off"), false);
|
|
811
|
+
assert.equal(explicit.isError, true);
|
|
812
|
+
assert.match(explicit.content[0]?.text ?? "", /Unknown subagent model 'gateway\/unknown'/);
|
|
734
813
|
});
|
|
735
814
|
|
|
736
|
-
it("classifies the effective model selected in Clarify", async () => {
|
|
737
|
-
const childSessionFile = path.join(tempDir, "fork-clarify-thinking.jsonl");
|
|
738
|
-
const manager = makeSignedThinkingSessionManager(childSessionFile);
|
|
739
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
740
|
-
agents: [
|
|
741
|
-
{ name: "worker", description: "Worker", defaultContext: "fork", model: "anthropic/claude-sonnet-4-5:high", thinking: "high" },
|
|
742
|
-
],
|
|
743
|
-
projectAgentsDir: null,
|
|
744
|
-
}));
|
|
745
|
-
const ctx = {
|
|
746
|
-
...makeCtx(manager),
|
|
747
|
-
hasUI: true,
|
|
748
|
-
ui: {
|
|
749
|
-
custom: async () => ({
|
|
750
|
-
confirmed: true,
|
|
751
|
-
runInBackground: false,
|
|
752
|
-
templates: ["test"],
|
|
753
|
-
behaviorOverrides: [{ model: "openai-codex/gpt-5.6-sol:high" }],
|
|
754
|
-
}),
|
|
755
|
-
},
|
|
756
|
-
model: { provider: "anthropic", id: "claude-sonnet-4-5" },
|
|
757
|
-
modelRegistry: {
|
|
758
|
-
getAvailable: () => [
|
|
759
|
-
{ provider: "anthropic", id: "claude-sonnet-4-5", api: "anthropic-messages", reasoning: true },
|
|
760
|
-
{ provider: "openai-codex", id: "gpt-5.6-sol", api: "openai-responses", reasoning: true },
|
|
761
|
-
],
|
|
762
|
-
},
|
|
763
|
-
};
|
|
764
815
|
|
|
765
|
-
const result = await executor.execute(
|
|
766
|
-
"id",
|
|
767
|
-
{ agent: "worker", task: "test", clarify: true },
|
|
768
|
-
new AbortController().signal,
|
|
769
|
-
undefined,
|
|
770
|
-
ctx,
|
|
771
|
-
);
|
|
772
816
|
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
const text = result.content.filter((block) => block.text).map((block) => block.text).join("\n");
|
|
777
|
-
assert.equal(text.includes("fork context forced thinking off"), false);
|
|
778
|
-
});
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
779
820
|
|
|
780
821
|
it("includes the fork-thinking downgrade note on failed results", async () => {
|
|
781
822
|
mockPi.reset();
|
|
@@ -862,94 +903,11 @@ describe("fork context execution wiring", { skip: !available ? "subagent executo
|
|
|
862
903
|
assert.notEqual(readSessionArgsFromCalls()[0], path.join(tempDir, "fork-1.jsonl"));
|
|
863
904
|
});
|
|
864
905
|
|
|
865
|
-
it("uses each agent defaultContext for top-level parallel when launch context is omitted", async () => {
|
|
866
|
-
const parentSessionFile = path.join(tempDir, "parent.jsonl");
|
|
867
|
-
const { manager, openedPaths, branchedLeafIds } = makeForkingSessionManagerRecorder({ sessionFile: parentSessionFile, leafId: "leaf-current" });
|
|
868
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
869
|
-
agents: [
|
|
870
|
-
{ name: "worker", description: "Worker", defaultContext: "fork" },
|
|
871
|
-
{ name: "second", description: "Second" },
|
|
872
|
-
],
|
|
873
|
-
projectAgentsDir: null,
|
|
874
|
-
}));
|
|
875
|
-
|
|
876
|
-
const result = await executor.execute(
|
|
877
|
-
"id",
|
|
878
|
-
{ tasks: [{ agent: "worker", task: "one" }, { agent: "second", task: "two" }] },
|
|
879
|
-
new AbortController().signal,
|
|
880
|
-
undefined,
|
|
881
|
-
makeCtx(manager),
|
|
882
|
-
);
|
|
883
|
-
|
|
884
|
-
assert.equal(result.isError, undefined);
|
|
885
|
-
assert.equal(result.details?.context, "mixed");
|
|
886
|
-
assert.deepEqual(result.details?.results?.map((entry) => entry.context), ["fork", "fresh"]);
|
|
887
|
-
assert.deepEqual(openedPaths, [parentSessionFile]);
|
|
888
|
-
assert.deepEqual(branchedLeafIds, ["leaf-current"]);
|
|
889
|
-
const workerArgs = readCallArgsForTask("one");
|
|
890
|
-
const freshArgs = readCallArgsForTask("two");
|
|
891
|
-
assert.match(workerArgs.at(-1) ?? "", /delegated subagent running from a fork/);
|
|
892
|
-
assert.doesNotMatch(freshArgs.at(-1) ?? "", /delegated subagent running from a fork/);
|
|
893
|
-
assert.equal(readSessionArg(workerArgs), path.join(tempDir, "fork-1.jsonl"));
|
|
894
|
-
assert.notEqual(readSessionArg(freshArgs), path.join(tempDir, "fork-1.jsonl"));
|
|
895
|
-
});
|
|
896
|
-
|
|
897
|
-
it("keeps explicit fresh context over top-level parallel agent defaultContext fork", async () => {
|
|
898
|
-
const parentSessionFile = path.join(tempDir, "parent.jsonl");
|
|
899
|
-
const { manager, openedPaths } = makeForkingSessionManagerRecorder({ sessionFile: parentSessionFile, leafId: "leaf-current" });
|
|
900
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
901
|
-
agents: [
|
|
902
|
-
{ name: "worker", description: "Worker", defaultContext: "fork" },
|
|
903
|
-
{ name: "second", description: "Second" },
|
|
904
|
-
],
|
|
905
|
-
projectAgentsDir: null,
|
|
906
|
-
}));
|
|
907
906
|
|
|
908
|
-
const result = await executor.execute(
|
|
909
|
-
"id",
|
|
910
|
-
{ tasks: [{ agent: "worker", task: "one" }, { agent: "second", task: "two" }], context: "fresh" },
|
|
911
|
-
new AbortController().signal,
|
|
912
|
-
undefined,
|
|
913
|
-
makeCtx(manager),
|
|
914
|
-
);
|
|
915
907
|
|
|
916
|
-
assert.equal(result.isError, undefined);
|
|
917
|
-
assert.equal(result.details?.context, "fresh");
|
|
918
|
-
assert.deepEqual(result.details?.results?.map((entry) => entry.context), ["fresh", "fresh"]);
|
|
919
|
-
assert.deepEqual(openedPaths, []);
|
|
920
|
-
});
|
|
921
908
|
|
|
922
|
-
it("uses each agent defaultContext for chain runs when launch context is omitted", async () => {
|
|
923
|
-
const parentSessionFile = path.join(tempDir, "parent.jsonl");
|
|
924
|
-
const { manager, openedPaths, branchedLeafIds } = makeForkingSessionManagerRecorder({ sessionFile: parentSessionFile, leafId: "leaf-current" });
|
|
925
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
926
|
-
agents: [
|
|
927
|
-
{ name: "echo", description: "Echo" },
|
|
928
|
-
{ name: "worker", description: "Worker", defaultContext: "fork" },
|
|
929
|
-
],
|
|
930
|
-
projectAgentsDir: null,
|
|
931
|
-
}));
|
|
932
909
|
|
|
933
|
-
const result = await executor.execute(
|
|
934
|
-
"id",
|
|
935
|
-
{ chain: [{ agent: "echo", task: "scan" }, { agent: "worker", task: "write" }], clarify: false },
|
|
936
|
-
new AbortController().signal,
|
|
937
|
-
undefined,
|
|
938
|
-
makeCtx(manager),
|
|
939
|
-
);
|
|
940
910
|
|
|
941
|
-
assert.equal(result.isError, undefined);
|
|
942
|
-
assert.equal(result.details?.context, "mixed");
|
|
943
|
-
assert.deepEqual(result.details?.results?.map((entry) => entry.context), ["fresh", "fork"]);
|
|
944
|
-
assert.deepEqual(openedPaths, [parentSessionFile]);
|
|
945
|
-
assert.deepEqual(branchedLeafIds, ["leaf-current"]);
|
|
946
|
-
const scanArgs = readCallArgsForTask("scan");
|
|
947
|
-
const writeArgs = readCallArgsForTask("write");
|
|
948
|
-
assert.doesNotMatch(scanArgs.at(-1) ?? "", /delegated subagent running from a fork/);
|
|
949
|
-
assert.match(writeArgs.at(-1) ?? "", /delegated subagent running from a fork/);
|
|
950
|
-
const forkSessionArgs = readSessionArgsFromCalls().filter((sessionFile) => path.basename(sessionFile).startsWith("fork-"));
|
|
951
|
-
assert.deepEqual(forkSessionArgs, [path.join(tempDir, "fork-1.jsonl")]);
|
|
952
|
-
});
|
|
953
911
|
|
|
954
912
|
it("fails before launching mixed parallel children when a default-fork session cannot branch", async () => {
|
|
955
913
|
const parentSessionFile = path.join(tempDir, "parent-mixed-fail.jsonl");
|
|
@@ -1032,45 +990,7 @@ describe("fork context execution wiring", { skip: !available ? "subagent executo
|
|
|
1032
990
|
assert.equal(mockPi.callCount(), 0);
|
|
1033
991
|
});
|
|
1034
992
|
|
|
1035
|
-
it("keeps later foreground forked chain steps aligned after short dynamic fanout", async () => {
|
|
1036
|
-
mockPi.reset();
|
|
1037
|
-
mockPi.onCall({ output: "targets", structuredOutput: { items: [{ id: "one" }] } });
|
|
1038
|
-
mockPi.onCall({ output: "inspected one" });
|
|
1039
|
-
mockPi.onCall({ output: "final done" });
|
|
1040
|
-
const parentSessionFile = path.join(tempDir, "parent-dynamic-chain.jsonl");
|
|
1041
|
-
const { manager } = makeForkingSessionManagerRecorder({ sessionFile: parentSessionFile, leafId: "leaf-current" });
|
|
1042
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
1043
|
-
agents: [
|
|
1044
|
-
{ name: "producer", description: "Producer", defaultContext: "fresh" },
|
|
1045
|
-
{ name: "worker", description: "Worker", defaultContext: "fork" },
|
|
1046
|
-
],
|
|
1047
|
-
projectAgentsDir: null,
|
|
1048
|
-
}));
|
|
1049
|
-
|
|
1050
|
-
const result = await executor.execute(
|
|
1051
|
-
"id",
|
|
1052
|
-
{
|
|
1053
|
-
chain: [
|
|
1054
|
-
{ agent: "producer", task: "produce", as: "items", outputSchema: { type: "object" } },
|
|
1055
|
-
{
|
|
1056
|
-
expand: { from: { output: "items", path: "/items" }, item: "item", key: "/id", maxItems: 3 },
|
|
1057
|
-
parallel: { agent: "worker", task: "inspect {item.id}" },
|
|
1058
|
-
collect: { as: "inspections" },
|
|
1059
|
-
},
|
|
1060
|
-
{ agent: "worker", task: "final" },
|
|
1061
|
-
],
|
|
1062
|
-
clarify: false,
|
|
1063
|
-
},
|
|
1064
|
-
new AbortController().signal,
|
|
1065
|
-
undefined,
|
|
1066
|
-
makeCtx(manager),
|
|
1067
|
-
);
|
|
1068
993
|
|
|
1069
|
-
assert.equal(result.isError, undefined);
|
|
1070
|
-
assert.equal(mockPi.callCount(), 3);
|
|
1071
|
-
assert.equal(readSessionArg(readCallArgsForTask("inspect one")), path.join(tempDir, "fork-1.jsonl"));
|
|
1072
|
-
assert.equal(readSessionArg(readCallArgsForTask("final")), path.join(tempDir, "fork-4.jsonl"));
|
|
1073
|
-
});
|
|
1074
994
|
|
|
1075
995
|
it("reports unknown top-level parallel agents before default-fork preconditions", async () => {
|
|
1076
996
|
const { manager } = makeSessionManagerRecorder({ sessionFile: undefined, leafId: "leaf-current" });
|
|
@@ -1108,11 +1028,82 @@ describe("fork context execution wiring", { skip: !available ? "subagent executo
|
|
|
1108
1028
|
assert.match(result.content[0]?.text ?? "", /persisted parent session/);
|
|
1109
1029
|
});
|
|
1110
1030
|
|
|
1111
|
-
it("
|
|
1112
|
-
const
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1115
|
-
|
|
1031
|
+
it("falls back to fresh when an implicit default fork has a session path that is not persisted yet", async () => {
|
|
1032
|
+
const parentSessionFile = path.join(tempDir, "unpersisted-parent.jsonl");
|
|
1033
|
+
const { manager } = makeSessionManagerRecorder({ sessionFile: parentSessionFile, leafId: "leaf-current" });
|
|
1034
|
+
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
1035
|
+
agents: [
|
|
1036
|
+
{ name: "worker", description: "Worker", defaultContext: "fork" },
|
|
1037
|
+
],
|
|
1038
|
+
projectAgentsDir: null,
|
|
1039
|
+
}));
|
|
1040
|
+
|
|
1041
|
+
const result = await executor.execute(
|
|
1042
|
+
"id",
|
|
1043
|
+
{ agent: "worker", task: "test" },
|
|
1044
|
+
new AbortController().signal,
|
|
1045
|
+
undefined,
|
|
1046
|
+
makeCtx(manager),
|
|
1047
|
+
);
|
|
1048
|
+
|
|
1049
|
+
assert.equal(result.isError, undefined);
|
|
1050
|
+
assert.equal(result.details?.context, "fresh");
|
|
1051
|
+
assert.equal(result.details?.results?.[0]?.context, "fresh");
|
|
1052
|
+
assert.doesNotMatch(readCallArgs().at(-1) ?? "", /delegated subagent running from a fork/);
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
it("falls back to fresh when an implicit default fork has no current leaf", async () => {
|
|
1056
|
+
const parentSessionFile = path.join(tempDir, "parent-no-leaf.jsonl");
|
|
1057
|
+
fs.writeFileSync(parentSessionFile, '{"type":"session","version":1,"id":"parent","timestamp":"2026-04-16T00:00:00.000Z","cwd":"/tmp"}\n', "utf-8");
|
|
1058
|
+
const { manager } = makeSessionManagerRecorder({ sessionFile: parentSessionFile, leafId: null });
|
|
1059
|
+
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
1060
|
+
agents: [
|
|
1061
|
+
{ name: "worker", description: "Worker", defaultContext: "fork" },
|
|
1062
|
+
],
|
|
1063
|
+
projectAgentsDir: null,
|
|
1064
|
+
}));
|
|
1065
|
+
|
|
1066
|
+
const result = await executor.execute(
|
|
1067
|
+
"id",
|
|
1068
|
+
{ agent: "worker", task: "test" },
|
|
1069
|
+
new AbortController().signal,
|
|
1070
|
+
undefined,
|
|
1071
|
+
makeCtx(manager),
|
|
1072
|
+
);
|
|
1073
|
+
|
|
1074
|
+
assert.equal(result.isError, undefined);
|
|
1075
|
+
assert.equal(result.details?.context, "fresh");
|
|
1076
|
+
assert.equal(result.details?.results?.[0]?.context, "fresh");
|
|
1077
|
+
assert.doesNotMatch(readCallArgs().at(-1) ?? "", /delegated subagent running from a fork/);
|
|
1078
|
+
});
|
|
1079
|
+
|
|
1080
|
+
it("keeps explicit fork fail-fast even when the agent defaults to fork", async () => {
|
|
1081
|
+
const { manager } = makeSessionManagerRecorder({ sessionFile: undefined, leafId: "leaf-current" });
|
|
1082
|
+
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
1083
|
+
agents: [
|
|
1084
|
+
{ name: "worker", description: "Worker", defaultContext: "fork" },
|
|
1085
|
+
],
|
|
1086
|
+
projectAgentsDir: null,
|
|
1087
|
+
}));
|
|
1088
|
+
|
|
1089
|
+
const result = await executor.execute(
|
|
1090
|
+
"id",
|
|
1091
|
+
{ agent: "worker", task: "test", context: "fork" },
|
|
1092
|
+
new AbortController().signal,
|
|
1093
|
+
undefined,
|
|
1094
|
+
makeCtx(manager),
|
|
1095
|
+
);
|
|
1096
|
+
|
|
1097
|
+
assert.equal(result.isError, true);
|
|
1098
|
+
assert.match(result.content[0]?.text ?? "", /persisted parent session/);
|
|
1099
|
+
assert.equal(mockPi.callCount(), 0);
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
it("fails fast when context=fork and leaf is missing", async () => {
|
|
1103
|
+
const { manager } = makeSessionManagerRecorder({ sessionFile: "/tmp/parent.jsonl", leafId: null });
|
|
1104
|
+
const executor = makeExecutor();
|
|
1105
|
+
|
|
1106
|
+
const result = await executor.execute(
|
|
1116
1107
|
"id",
|
|
1117
1108
|
{ agent: "echo", task: "test", context: "fork" },
|
|
1118
1109
|
new AbortController().signal,
|
|
@@ -1178,697 +1169,41 @@ describe("fork context execution wiring", { skip: !available ? "subagent executo
|
|
|
1178
1169
|
assert.equal(fs.existsSync(args[sessionIndex + 1]!), true);
|
|
1179
1170
|
});
|
|
1180
1171
|
|
|
1181
|
-
it("creates isolated forked sessions per parallel task", async () => {
|
|
1182
|
-
const { manager, openedPaths, branchedLeafIds } = makeForkingSessionManagerRecorder({
|
|
1183
|
-
sessionFile: path.join(tempDir, "parent-parallel.jsonl"),
|
|
1184
|
-
leafId: "leaf-777",
|
|
1185
|
-
});
|
|
1186
|
-
const executor = makeExecutor();
|
|
1187
1172
|
|
|
1188
|
-
const result = await executor.execute(
|
|
1189
|
-
"id",
|
|
1190
|
-
{
|
|
1191
|
-
tasks: [
|
|
1192
|
-
{ agent: "echo", task: "task one" },
|
|
1193
|
-
{ agent: "second", task: "task two" },
|
|
1194
|
-
],
|
|
1195
|
-
context: "fork",
|
|
1196
|
-
},
|
|
1197
|
-
new AbortController().signal,
|
|
1198
|
-
undefined,
|
|
1199
|
-
makeCtx(manager),
|
|
1200
|
-
);
|
|
1201
1173
|
|
|
1202
|
-
assert.equal(result.isError, undefined);
|
|
1203
|
-
assert.deepEqual(openedPaths, [path.join(tempDir, "parent-parallel.jsonl"), path.join(tempDir, "parent-parallel.jsonl")]);
|
|
1204
|
-
assert.deepEqual(branchedLeafIds, ["leaf-777", "leaf-777"]);
|
|
1205
|
-
const sessionArgs = readSessionArgsFromCalls();
|
|
1206
|
-
assert.equal(sessionArgs.length, 2);
|
|
1207
|
-
assert.equal(new Set(sessionArgs).size, 2);
|
|
1208
|
-
for (const childSessionFile of sessionArgs) {
|
|
1209
|
-
assert.notEqual(childSessionFile, path.join(tempDir, "parent-parallel.jsonl"));
|
|
1210
|
-
assert.equal(fs.existsSync(childSessionFile), true);
|
|
1211
|
-
}
|
|
1212
|
-
});
|
|
1213
1174
|
|
|
1214
|
-
it("expands top-level parallel task counts before fork session allocation", async () => {
|
|
1215
|
-
const { manager, openedPaths, branchedLeafIds } = makeForkingSessionManagerRecorder({
|
|
1216
|
-
sessionFile: path.join(tempDir, "parent-count.jsonl"),
|
|
1217
|
-
leafId: "leaf-count",
|
|
1218
|
-
});
|
|
1219
|
-
const executor = makeExecutor();
|
|
1220
1175
|
|
|
1221
|
-
const result = await executor.execute(
|
|
1222
|
-
"id",
|
|
1223
|
-
{
|
|
1224
|
-
tasks: [{ agent: "echo", task: "task one", count: 3 }],
|
|
1225
|
-
context: "fork",
|
|
1226
|
-
},
|
|
1227
|
-
new AbortController().signal,
|
|
1228
|
-
undefined,
|
|
1229
|
-
makeCtx(manager),
|
|
1230
|
-
);
|
|
1231
1176
|
|
|
1232
|
-
assert.equal(result.isError, undefined);
|
|
1233
|
-
assert.deepEqual(openedPaths, [
|
|
1234
|
-
path.join(tempDir, "parent-count.jsonl"),
|
|
1235
|
-
path.join(tempDir, "parent-count.jsonl"),
|
|
1236
|
-
path.join(tempDir, "parent-count.jsonl"),
|
|
1237
|
-
]);
|
|
1238
|
-
assert.deepEqual(branchedLeafIds, ["leaf-count", "leaf-count", "leaf-count"]);
|
|
1239
|
-
const sessionArgs = readSessionArgsFromCalls();
|
|
1240
|
-
assert.equal(sessionArgs.length, 3);
|
|
1241
|
-
assert.equal(new Set(sessionArgs).size, 3);
|
|
1242
|
-
});
|
|
1243
1177
|
|
|
1244
|
-
it("rejects top-level parallel worktree runs with a conflicting task cwd", async () => {
|
|
1245
|
-
const { manager } = makeSessionManagerRecorder({ sessionFile: "/tmp/parent.jsonl", leafId: "leaf-777" });
|
|
1246
|
-
const executor = makeExecutor();
|
|
1247
1178
|
|
|
1248
|
-
const result = await executor.execute(
|
|
1249
|
-
"id",
|
|
1250
|
-
{
|
|
1251
|
-
tasks: [
|
|
1252
|
-
{ agent: "echo", task: "task one" },
|
|
1253
|
-
{ agent: "second", task: "task two", cwd: `${tempDir}/other` },
|
|
1254
|
-
],
|
|
1255
|
-
worktree: true,
|
|
1256
|
-
},
|
|
1257
|
-
new AbortController().signal,
|
|
1258
|
-
undefined,
|
|
1259
|
-
makeCtx(manager),
|
|
1260
|
-
);
|
|
1261
|
-
|
|
1262
|
-
assert.equal(result.isError, true);
|
|
1263
|
-
assert.match(result.content[0]?.text ?? "", /worktree isolation uses the shared cwd/i);
|
|
1264
|
-
assert.match(result.content[0]?.text ?? "", /task 2 \(second\) sets cwd/i);
|
|
1265
|
-
});
|
|
1266
|
-
|
|
1267
|
-
it("rejects top-level parallel counts that expand past MAX_PARALLEL", async () => {
|
|
1268
|
-
const { manager } = makeSessionManagerRecorder({ sessionFile: "/tmp/parent.jsonl", leafId: "leaf-max" });
|
|
1269
|
-
const executor = makeExecutor();
|
|
1270
|
-
|
|
1271
|
-
const result = await executor.execute(
|
|
1272
|
-
"id",
|
|
1273
|
-
{
|
|
1274
|
-
tasks: [{ agent: "echo", task: "task one", count: 9 }],
|
|
1275
|
-
},
|
|
1276
|
-
new AbortController().signal,
|
|
1277
|
-
undefined,
|
|
1278
|
-
makeCtx(manager),
|
|
1279
|
-
);
|
|
1280
|
-
|
|
1281
|
-
assert.equal(result.isError, true);
|
|
1282
|
-
assert.match(result.content[0]?.text ?? "", /Max 8 tasks/);
|
|
1283
|
-
});
|
|
1284
|
-
|
|
1285
|
-
it("uses top-level parallel config overrides for maxTasks and concurrency", async () => {
|
|
1286
|
-
const { manager } = makeSessionManagerRecorder({ sessionFile: "/tmp/parent.jsonl", leafId: "leaf-max-config" });
|
|
1287
|
-
const maxTasksExecutor = makeExecutorWithConfig({ parallel: { maxTasks: 9 } });
|
|
1288
1179
|
|
|
1289
|
-
const maxTasksResult = await maxTasksExecutor.execute(
|
|
1290
|
-
"id",
|
|
1291
|
-
{
|
|
1292
|
-
tasks: [{ agent: "echo", task: "task one", count: 9 }],
|
|
1293
|
-
},
|
|
1294
|
-
new AbortController().signal,
|
|
1295
|
-
undefined,
|
|
1296
|
-
makeCtx(manager),
|
|
1297
|
-
);
|
|
1298
1180
|
|
|
1299
|
-
assert.equal(maxTasksResult.isError, undefined);
|
|
1300
|
-
assert.equal(mockPi.callCount(), 9);
|
|
1301
|
-
|
|
1302
|
-
for (const testCase of [
|
|
1303
|
-
{ name: "config", configConcurrency: 2, paramsConcurrency: undefined, expectedMaxRunning: 2 },
|
|
1304
|
-
{ name: "per-call", configConcurrency: 3, paramsConcurrency: 1, expectedMaxRunning: 1 },
|
|
1305
|
-
]) {
|
|
1306
|
-
mockPi.reset();
|
|
1307
|
-
for (let i = 0; i < 3; i++) {
|
|
1308
|
-
mockPi.onCall({
|
|
1309
|
-
steps: [
|
|
1310
|
-
{ jsonl: [events.toolStart("bash", { command: `${testCase.name}-${i}` })] },
|
|
1311
|
-
{ delay: 250 },
|
|
1312
|
-
{ jsonl: [events.toolEnd("bash"), events.assistantMessage(`done-${i}`)] },
|
|
1313
|
-
],
|
|
1314
|
-
});
|
|
1315
|
-
}
|
|
1316
1181
|
|
|
1317
|
-
const executor = makeExecutorWithConfig({ parallel: { concurrency: testCase.configConcurrency } });
|
|
1318
|
-
let maxRunning = 0;
|
|
1319
1182
|
|
|
1320
|
-
const result = await executor.execute(
|
|
1321
|
-
"id",
|
|
1322
|
-
{
|
|
1323
|
-
tasks: [
|
|
1324
|
-
{ agent: "echo", task: "task one" },
|
|
1325
|
-
{ agent: "second", task: "task two" },
|
|
1326
|
-
{ agent: "echo", task: "task three" },
|
|
1327
|
-
],
|
|
1328
|
-
...(testCase.paramsConcurrency ? { concurrency: testCase.paramsConcurrency } : {}),
|
|
1329
|
-
},
|
|
1330
|
-
new AbortController().signal,
|
|
1331
|
-
(update: ProgressUpdate) => {
|
|
1332
|
-
const progress = update.details?.progress ?? [];
|
|
1333
|
-
const running = progress.filter((entry) => entry.status === "running").length;
|
|
1334
|
-
maxRunning = Math.max(maxRunning, running);
|
|
1335
|
-
},
|
|
1336
|
-
makeCtx(makeSessionManagerRecorder().manager),
|
|
1337
|
-
);
|
|
1338
1183
|
|
|
1339
|
-
assert.equal(result.isError, undefined, testCase.name);
|
|
1340
|
-
assert.equal(maxRunning, testCase.expectedMaxRunning, testCase.name);
|
|
1341
|
-
}
|
|
1342
|
-
});
|
|
1343
1184
|
|
|
1344
|
-
it("caps top-level foreground parallel execution with globalConcurrencyLimit", async () => {
|
|
1345
|
-
mockPi.reset();
|
|
1346
|
-
for (let i = 0; i < 4; i++) {
|
|
1347
|
-
mockPi.onCall({
|
|
1348
|
-
steps: [
|
|
1349
|
-
{ jsonl: [events.toolStart("bash", { command: `global-${i}` })] },
|
|
1350
|
-
{ delay: 250 },
|
|
1351
|
-
{ jsonl: [events.toolEnd("bash"), events.assistantMessage(`done-${i}`)] },
|
|
1352
|
-
],
|
|
1353
|
-
});
|
|
1354
|
-
}
|
|
1355
1185
|
|
|
1356
|
-
const executor = makeExecutorWithConfig({ globalConcurrencyLimit: 2, parallel: { concurrency: 4 } });
|
|
1357
|
-
let maxRunning = 0;
|
|
1358
1186
|
|
|
1359
|
-
const result = await executor.execute(
|
|
1360
|
-
"id",
|
|
1361
|
-
{
|
|
1362
|
-
tasks: [
|
|
1363
|
-
{ agent: "echo", task: "task one" },
|
|
1364
|
-
{ agent: "second", task: "task two" },
|
|
1365
|
-
{ agent: "echo", task: "task three" },
|
|
1366
|
-
{ agent: "second", task: "task four" },
|
|
1367
|
-
],
|
|
1368
|
-
},
|
|
1369
|
-
new AbortController().signal,
|
|
1370
|
-
(update: ProgressUpdate) => {
|
|
1371
|
-
const progress = update.details?.progress ?? [];
|
|
1372
|
-
const running = progress.filter((entry) => entry.status === "running").length;
|
|
1373
|
-
maxRunning = Math.max(maxRunning, running);
|
|
1374
|
-
},
|
|
1375
|
-
makeCtx(makeSessionManagerRecorder().manager),
|
|
1376
|
-
);
|
|
1377
|
-
|
|
1378
|
-
assert.equal(result.isError, undefined);
|
|
1379
|
-
assert.equal(mockPi.callCount(), 4);
|
|
1380
|
-
assert.equal(maxRunning, 2);
|
|
1381
|
-
});
|
|
1382
|
-
|
|
1383
|
-
it("detaches parallel child runs cleanly on intercom handoff", async () => {
|
|
1384
|
-
mockPi.reset();
|
|
1385
|
-
mockPi.onCall({
|
|
1386
|
-
steps: [
|
|
1387
|
-
{ jsonl: [events.toolStart("intercom", { action: "send", to: "orchestrator" })] },
|
|
1388
|
-
{ delay: 1000, jsonl: [events.assistantMessage("after handoff")] },
|
|
1389
|
-
],
|
|
1390
|
-
});
|
|
1391
|
-
mockPi.onCall({ output: "other done" });
|
|
1392
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
1393
|
-
agents: [
|
|
1394
|
-
{ name: "echo", description: "Echo", systemPrompt: "Intercom orchestration channel:" },
|
|
1395
|
-
{ name: "second", description: "Second", systemPrompt: "Intercom orchestration channel:" },
|
|
1396
|
-
],
|
|
1397
|
-
projectAgentsDir: null,
|
|
1398
|
-
}));
|
|
1399
|
-
let detachEmitted = false;
|
|
1400
|
-
const result = await executor.execute(
|
|
1401
|
-
"intercom-parallel",
|
|
1402
|
-
{
|
|
1403
|
-
tasks: [
|
|
1404
|
-
{ agent: "echo", task: "send handoff" },
|
|
1405
|
-
{ agent: "second", task: "continue" },
|
|
1406
|
-
],
|
|
1407
|
-
},
|
|
1408
|
-
new AbortController().signal,
|
|
1409
|
-
(update: ProgressUpdate) => {
|
|
1410
|
-
if (detachEmitted) return;
|
|
1411
|
-
if (!update.details?.progress?.some((entry) => entry.currentTool === "intercom")) return;
|
|
1412
|
-
detachEmitted = true;
|
|
1413
|
-
executor.eventsApi.emit(INTERCOM_DETACH_REQUEST_EVENT, { requestId: "parallel-detach" });
|
|
1414
|
-
},
|
|
1415
|
-
makeCtx(makeSessionManagerRecorder().manager),
|
|
1416
|
-
);
|
|
1417
|
-
|
|
1418
|
-
assert.equal(result.isError, undefined);
|
|
1419
|
-
assert.match(result.content[0]?.text ?? "", /Parallel run detached for intercom coordination/);
|
|
1420
|
-
assert.equal(detachEmitted, true);
|
|
1421
|
-
assert.equal(result.details?.results?.some((entry) => entry.detached === true && entry.exitCode === -2), true);
|
|
1422
|
-
});
|
|
1423
|
-
|
|
1424
|
-
it("runs top-level parallel async requests in the background", { skip: !asyncAvailable ? "jiti not available" : undefined }, async () => {
|
|
1425
|
-
const executor = makeExecutor();
|
|
1426
|
-
|
|
1427
|
-
const result = await executor.execute(
|
|
1428
|
-
"id",
|
|
1429
|
-
{
|
|
1430
|
-
tasks: [
|
|
1431
|
-
{ agent: "echo", task: "task one" },
|
|
1432
|
-
{ agent: "second", task: "task two" },
|
|
1433
|
-
],
|
|
1434
|
-
async: true,
|
|
1435
|
-
clarify: false,
|
|
1436
|
-
},
|
|
1437
|
-
new AbortController().signal,
|
|
1438
|
-
undefined,
|
|
1439
|
-
makeCtx(makeSessionManagerRecorder().manager),
|
|
1440
|
-
);
|
|
1441
|
-
|
|
1442
|
-
assert.equal(result.isError, undefined);
|
|
1443
|
-
assert.equal(result.details?.mode, "parallel");
|
|
1444
|
-
assert.ok(result.details?.asyncId, "expected an asyncId for background top-level parallel runs");
|
|
1445
|
-
assert.match(result.content[0]?.text ?? "", /Async parallel:/);
|
|
1446
|
-
});
|
|
1447
1187
|
|
|
1448
|
-
it("keeps inherited model-scope warnings non-fatal in async parallel conversion", { skip: !asyncAvailable ? "jiti not available" : undefined }, async () => {
|
|
1449
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
1450
|
-
agents: [{ name: "worker", description: "Worker", model: "openai/gpt-5-mini" }],
|
|
1451
|
-
projectAgentsDir: null,
|
|
1452
|
-
modelScope: { enforce: true, allow: ["anthropic/*"] },
|
|
1453
|
-
}));
|
|
1454
|
-
const ctx = {
|
|
1455
|
-
...makeCtx(makeSessionManagerRecorder().manager),
|
|
1456
|
-
modelRegistry: {
|
|
1457
|
-
getAvailable: () => [{ provider: "openai", id: "gpt-5-mini", api: "openai-responses", reasoning: true }],
|
|
1458
|
-
},
|
|
1459
|
-
};
|
|
1460
|
-
const warnings: string[] = [];
|
|
1461
|
-
const originalWarn = console.warn;
|
|
1462
|
-
console.warn = (message?: unknown) => warnings.push(String(message));
|
|
1463
|
-
try {
|
|
1464
|
-
const result = await executor.execute(
|
|
1465
|
-
"id",
|
|
1466
|
-
{ tasks: [{ agent: "worker", task: "test" }], async: true },
|
|
1467
|
-
new AbortController().signal,
|
|
1468
|
-
undefined,
|
|
1469
|
-
ctx,
|
|
1470
|
-
);
|
|
1471
|
-
assert.equal(result.isError, undefined);
|
|
1472
|
-
assert.ok(result.details?.asyncId);
|
|
1473
|
-
assert.equal(warnings.length, 1);
|
|
1474
|
-
assert.match(warnings[0]!, /outside the configured subagent model scope/);
|
|
1475
|
-
} finally {
|
|
1476
|
-
console.warn = originalWarn;
|
|
1477
|
-
}
|
|
1478
|
-
});
|
|
1479
1188
|
|
|
1480
|
-
it("keeps inherited model-scope warnings non-fatal after Clarify switches parallel work to background", { skip: !asyncAvailable ? "jiti not available" : undefined }, async () => {
|
|
1481
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
1482
|
-
agents: [{ name: "worker", description: "Worker", model: "openai/gpt-5-mini" }],
|
|
1483
|
-
projectAgentsDir: null,
|
|
1484
|
-
modelScope: { enforce: true, allow: ["anthropic/*"] },
|
|
1485
|
-
}));
|
|
1486
|
-
const ctx = {
|
|
1487
|
-
...makeCtx(makeSessionManagerRecorder().manager),
|
|
1488
|
-
hasUI: true,
|
|
1489
|
-
ui: {
|
|
1490
|
-
custom: async () => ({
|
|
1491
|
-
confirmed: true,
|
|
1492
|
-
runInBackground: true,
|
|
1493
|
-
templates: ["test"],
|
|
1494
|
-
behaviorOverrides: [{}],
|
|
1495
|
-
}),
|
|
1496
|
-
},
|
|
1497
|
-
modelRegistry: {
|
|
1498
|
-
getAvailable: () => [{ provider: "openai", id: "gpt-5-mini", api: "openai-responses", reasoning: true }],
|
|
1499
|
-
},
|
|
1500
|
-
};
|
|
1501
|
-
const warnings: string[] = [];
|
|
1502
|
-
const originalWarn = console.warn;
|
|
1503
|
-
console.warn = (message?: unknown) => warnings.push(String(message));
|
|
1504
|
-
try {
|
|
1505
|
-
const result = await executor.execute(
|
|
1506
|
-
"id",
|
|
1507
|
-
{ tasks: [{ agent: "worker", task: "test" }], clarify: true },
|
|
1508
|
-
new AbortController().signal,
|
|
1509
|
-
undefined,
|
|
1510
|
-
ctx,
|
|
1511
|
-
);
|
|
1512
|
-
assert.equal(result.isError, undefined);
|
|
1513
|
-
assert.ok(result.details?.asyncId);
|
|
1514
|
-
assert.equal(warnings.length, 2);
|
|
1515
|
-
assert.equal(warnings.every((warning) => warning.includes("outside the configured subagent model scope")), true);
|
|
1516
|
-
} finally {
|
|
1517
|
-
console.warn = originalWarn;
|
|
1518
|
-
}
|
|
1519
|
-
});
|
|
1520
1189
|
|
|
1521
|
-
it("keeps raw goals at fork-wrapped async executor boundaries", { skip: !asyncAvailable ? "jiti not available" : undefined }, async () => {
|
|
1522
|
-
const rawSingleGoal = "Direct forked single raw goal";
|
|
1523
|
-
const rawParallelGoal = "Top-level forked first child raw goal";
|
|
1524
|
-
const rawParallelChainGoal = "Parallel chain first child raw goal";
|
|
1525
|
-
const paddedWorkflowGoal = " preserve this workflow padding ";
|
|
1526
|
-
const literalPreambleGoal = `${DEFAULT_FORK_PREAMBLE}\n\nTask:\nliteral fresh-context text`;
|
|
1527
|
-
const redactedGoal = "[prompt redacted]";
|
|
1528
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
1529
|
-
agents: [
|
|
1530
|
-
{ name: "echo", description: "Echo", defaultContext: "fork" },
|
|
1531
|
-
{ name: "second", description: "Second" },
|
|
1532
|
-
],
|
|
1533
|
-
projectAgentsDir: null,
|
|
1534
|
-
}));
|
|
1535
|
-
const started: Array<{ id?: string; goal?: string }> = [];
|
|
1536
|
-
executor.eventsApi.on(SUBAGENT_ASYNC_STARTED_EVENT, (event: unknown) => started.push(event as { id?: string; goal?: string }));
|
|
1537
|
-
const forkManager = () => makeForkingSessionManagerRecorder({
|
|
1538
|
-
sessionFile: path.join(tempDir, "parent-fork-goal.jsonl"),
|
|
1539
|
-
leafId: "fork-goal-leaf",
|
|
1540
|
-
}).manager;
|
|
1541
|
-
|
|
1542
|
-
for (const testCase of [
|
|
1543
|
-
{
|
|
1544
|
-
name: "direct single",
|
|
1545
|
-
goal: rawSingleGoal,
|
|
1546
|
-
params: { agent: "echo", task: rawSingleGoal, async: true, clarify: false },
|
|
1547
|
-
},
|
|
1548
|
-
{
|
|
1549
|
-
name: "top-level parallel",
|
|
1550
|
-
goal: rawParallelGoal,
|
|
1551
|
-
params: { tasks: [{ agent: "echo", task: rawParallelGoal }, { agent: "second", task: "Second child" }], async: true, clarify: false },
|
|
1552
|
-
},
|
|
1553
|
-
{
|
|
1554
|
-
name: "parallel chain whitespace workflow fallback",
|
|
1555
|
-
goal: rawParallelChainGoal,
|
|
1556
|
-
params: { task: " ", chain: [{ parallel: [{ agent: "echo", task: rawParallelChainGoal }, { agent: "second", task: "Second chain child" }] }], async: true, clarify: false },
|
|
1557
|
-
},
|
|
1558
|
-
{
|
|
1559
|
-
name: "padded workflow goal",
|
|
1560
|
-
goal: paddedWorkflowGoal,
|
|
1561
|
-
params: { task: paddedWorkflowGoal, chain: [{ agent: "echo", task: "Forked child" }], async: true, clarify: false },
|
|
1562
|
-
},
|
|
1563
|
-
{
|
|
1564
|
-
name: "literal preamble in fresh child",
|
|
1565
|
-
goal: literalPreambleGoal.slice(0, 120),
|
|
1566
|
-
allowsLiteralPreamble: true,
|
|
1567
|
-
params: { chain: [{ agent: "second", task: literalPreambleGoal }], async: true, clarify: false },
|
|
1568
|
-
},
|
|
1569
|
-
]) {
|
|
1570
|
-
const result = await executor.execute(
|
|
1571
|
-
`fork-goal-${testCase.name}`,
|
|
1572
|
-
testCase.params,
|
|
1573
|
-
new AbortController().signal,
|
|
1574
|
-
undefined,
|
|
1575
|
-
makeCtx(forkManager()),
|
|
1576
|
-
);
|
|
1577
|
-
assert.equal(result.isError, undefined, testCase.name);
|
|
1578
|
-
assert.ok(result.details?.asyncId, `${testCase.name}: expected an async id`);
|
|
1579
|
-
const event = started.find((entry) => entry.id === result.details?.asyncId);
|
|
1580
|
-
assert.ok(event, `${testCase.name}: missing async-started event for ${result.details?.asyncId}`);
|
|
1581
|
-
assert.equal(event.goal, redactedGoal, testCase.name);
|
|
1582
|
-
if (!("allowsLiteralPreamble" in testCase)) {
|
|
1583
|
-
assert.doesNotMatch(event.goal ?? "", /delegated subagent running from a fork/, testCase.name);
|
|
1584
|
-
assert.notEqual(event.goal, testCase.goal, testCase.name);
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
});
|
|
1588
1190
|
|
|
1589
|
-
it("rejects Clarify background switches over the active async capacity cap", { skip: !asyncAvailable ? "jiti not available" : undefined }, async () => {
|
|
1590
|
-
const previousDepth = process.env.SELESAI_SUBAGENT_DEPTH;
|
|
1591
|
-
process.env.SELESAI_SUBAGENT_DEPTH = "0";
|
|
1592
|
-
try {
|
|
1593
|
-
for (const testCase of [
|
|
1594
|
-
{
|
|
1595
|
-
name: "single",
|
|
1596
|
-
mode: "single",
|
|
1597
|
-
params: { agent: "echo", task: "Original single", async: true, clarify: true },
|
|
1598
|
-
templates: ["Edited single"],
|
|
1599
|
-
},
|
|
1600
|
-
{
|
|
1601
|
-
name: "parallel",
|
|
1602
|
-
mode: "parallel",
|
|
1603
|
-
params: { tasks: [{ agent: "echo", task: "Original parallel" }, { agent: "second", task: "Second child" }], async: true, clarify: true },
|
|
1604
|
-
templates: ["Edited parallel", "Second child"],
|
|
1605
|
-
},
|
|
1606
|
-
{
|
|
1607
|
-
name: "chain",
|
|
1608
|
-
mode: "chain",
|
|
1609
|
-
params: { chain: [{ agent: "echo", task: "Original chain" }], async: true, clarify: true },
|
|
1610
|
-
templates: ["Edited chain"],
|
|
1611
|
-
},
|
|
1612
|
-
] as const) {
|
|
1613
|
-
const sessionId = `session-clarify-cap-${testCase.name}-${Date.now()}`;
|
|
1614
|
-
const sessionCapacityDir = path.join(ACTIVE_ASYNC_CAPACITY_DIR, activeAsyncCapacitySessionKey(sessionId));
|
|
1615
|
-
fs.rmSync(sessionCapacityDir, { recursive: true, force: true });
|
|
1616
|
-
const held = acquireActiveAsyncCapacity({
|
|
1617
|
-
sessionId,
|
|
1618
|
-
limit: 1,
|
|
1619
|
-
runId: `held-${testCase.name}`,
|
|
1620
|
-
kind: "runner",
|
|
1621
|
-
asyncDir: path.join(tempDir, `held-${testCase.name}`),
|
|
1622
|
-
});
|
|
1623
|
-
held?.markStarted(`held-runner-${testCase.name}`);
|
|
1624
|
-
try {
|
|
1625
|
-
const executor = makeExecutorWithConfig({ maxActiveAsyncRunsPerSession: 1 });
|
|
1626
|
-
const manager = {
|
|
1627
|
-
...makeSessionManagerRecorder().manager,
|
|
1628
|
-
getSessionId: () => sessionId,
|
|
1629
|
-
};
|
|
1630
|
-
const ctx = {
|
|
1631
|
-
...makeCtx(manager),
|
|
1632
|
-
hasUI: true,
|
|
1633
|
-
ui: {
|
|
1634
|
-
custom: async () => ({
|
|
1635
|
-
confirmed: true,
|
|
1636
|
-
templates: testCase.templates,
|
|
1637
|
-
behaviorOverrides: testCase.templates.map(() => undefined),
|
|
1638
|
-
runInBackground: true,
|
|
1639
|
-
}),
|
|
1640
|
-
},
|
|
1641
|
-
};
|
|
1642
|
-
|
|
1643
|
-
const result = await executor.execute(
|
|
1644
|
-
`clarify-cap-${testCase.name}`,
|
|
1645
|
-
testCase.params,
|
|
1646
|
-
new AbortController().signal,
|
|
1647
|
-
undefined,
|
|
1648
|
-
ctx,
|
|
1649
|
-
);
|
|
1650
|
-
|
|
1651
|
-
assert.equal(result.isError, true, testCase.name);
|
|
1652
|
-
assert.equal(result.details?.mode, testCase.mode, testCase.name);
|
|
1653
|
-
assert.equal(result.details?.asyncId, undefined, testCase.name);
|
|
1654
|
-
assert.match(result.content[0]?.text ?? "", /Active async run capacity exhausted: 1\/1 used/, testCase.name);
|
|
1655
|
-
assert.equal(mockPi.callCount(), 0, testCase.name);
|
|
1656
|
-
} finally {
|
|
1657
|
-
fs.rmSync(sessionCapacityDir, { recursive: true, force: true });
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
} finally {
|
|
1661
|
-
if (previousDepth === undefined) delete process.env.SELESAI_SUBAGENT_DEPTH;
|
|
1662
|
-
else process.env.SELESAI_SUBAGENT_DEPTH = previousDepth;
|
|
1663
|
-
}
|
|
1664
|
-
});
|
|
1665
1191
|
|
|
1666
|
-
it("uses edited raw goals when clarification switches each mode to background", { skip: !asyncAvailable ? "jiti not available" : undefined }, async () => {
|
|
1667
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
1668
|
-
agents: [
|
|
1669
|
-
{ name: "echo", description: "Echo", defaultContext: "fork" },
|
|
1670
|
-
{ name: "second", description: "Second" },
|
|
1671
|
-
],
|
|
1672
|
-
projectAgentsDir: null,
|
|
1673
|
-
}));
|
|
1674
|
-
const started: Array<{ id?: string; goal?: string }> = [];
|
|
1675
|
-
executor.eventsApi.on(SUBAGENT_ASYNC_STARTED_EVENT, (event: unknown) => started.push(event as { id?: string; goal?: string }));
|
|
1676
1192
|
|
|
1677
|
-
for (const testCase of [
|
|
1678
|
-
{
|
|
1679
|
-
name: "single",
|
|
1680
|
-
goal: "Edited single goal",
|
|
1681
|
-
params: { agent: "echo", task: "Original single", async: true, clarify: true },
|
|
1682
|
-
templates: ["Edited single goal"],
|
|
1683
|
-
},
|
|
1684
|
-
{
|
|
1685
|
-
name: "parallel",
|
|
1686
|
-
goal: "Edited parallel goal",
|
|
1687
|
-
params: { tasks: [{ agent: "echo", task: "Original parallel" }, { agent: "second", task: "Second child" }], async: true, clarify: true },
|
|
1688
|
-
templates: ["Edited parallel goal", "Second child"],
|
|
1689
|
-
},
|
|
1690
|
-
{
|
|
1691
|
-
name: "chain",
|
|
1692
|
-
goal: "Edited chain goal",
|
|
1693
|
-
params: { chain: [{ agent: "echo", task: "Original chain" }], async: true, clarify: true },
|
|
1694
|
-
templates: ["Edited chain goal"],
|
|
1695
|
-
},
|
|
1696
|
-
]) {
|
|
1697
|
-
const forkManager = makeForkingSessionManagerRecorder({
|
|
1698
|
-
sessionFile: path.join(tempDir, `parent-clarify-${testCase.name}.jsonl`),
|
|
1699
|
-
leafId: `clarify-${testCase.name}-leaf`,
|
|
1700
|
-
}).manager;
|
|
1701
|
-
const ctx = {
|
|
1702
|
-
...makeCtx(forkManager),
|
|
1703
|
-
hasUI: true,
|
|
1704
|
-
ui: {
|
|
1705
|
-
custom: async () => ({
|
|
1706
|
-
confirmed: true,
|
|
1707
|
-
templates: testCase.templates,
|
|
1708
|
-
behaviorOverrides: testCase.templates.map(() => undefined),
|
|
1709
|
-
runInBackground: true,
|
|
1710
|
-
}),
|
|
1711
|
-
},
|
|
1712
|
-
};
|
|
1713
|
-
const result = await executor.execute(
|
|
1714
|
-
`clarify-goal-${testCase.name}`,
|
|
1715
|
-
testCase.params,
|
|
1716
|
-
new AbortController().signal,
|
|
1717
|
-
undefined,
|
|
1718
|
-
ctx,
|
|
1719
|
-
);
|
|
1720
|
-
assert.equal(result.isError, undefined, testCase.name);
|
|
1721
|
-
assert.ok(result.details?.asyncId, `${testCase.name}: expected an async id`);
|
|
1722
|
-
const event = started.find((entry) => entry.id === result.details?.asyncId);
|
|
1723
|
-
assert.equal(event?.goal, "[prompt redacted]", testCase.name);
|
|
1724
|
-
assert.notEqual(event?.goal, testCase.goal, testCase.name);
|
|
1725
|
-
assert.doesNotMatch(event?.goal ?? "", /delegated subagent running from a fork/, testCase.name);
|
|
1726
|
-
}
|
|
1727
|
-
});
|
|
1728
1193
|
|
|
1729
|
-
it("runs async chain requests in the background when clarify is omitted", { skip: !asyncAvailable ? "jiti not available" : undefined }, async () => {
|
|
1730
|
-
const executor = makeExecutor();
|
|
1731
1194
|
|
|
1732
|
-
const result = await executor.execute(
|
|
1733
|
-
"id",
|
|
1734
|
-
{
|
|
1735
|
-
chain: [
|
|
1736
|
-
{ agent: "echo", task: "task one" },
|
|
1737
|
-
{ agent: "second", task: "task two" },
|
|
1738
|
-
],
|
|
1739
|
-
async: true,
|
|
1740
|
-
},
|
|
1741
|
-
new AbortController().signal,
|
|
1742
|
-
undefined,
|
|
1743
|
-
makeCtx(makeSessionManagerRecorder().manager),
|
|
1744
|
-
);
|
|
1745
1195
|
|
|
1746
|
-
assert.equal(result.isError, undefined);
|
|
1747
|
-
assert.equal(result.details?.mode, "chain");
|
|
1748
|
-
assert.ok(result.details?.asyncId, "expected an asyncId for background chain runs");
|
|
1749
|
-
assert.match(result.content[0]?.text ?? "", /Async chain:/);
|
|
1750
|
-
});
|
|
1751
1196
|
|
|
1752
|
-
it("keeps explicit clarify async chain requests in the foreground", async () => {
|
|
1753
|
-
const executor = makeExecutor();
|
|
1754
1197
|
|
|
1755
|
-
const result = await executor.execute(
|
|
1756
|
-
"id",
|
|
1757
|
-
{
|
|
1758
|
-
chain: [
|
|
1759
|
-
{ agent: "echo", task: "task one" },
|
|
1760
|
-
{ agent: "second", task: "task two" },
|
|
1761
|
-
],
|
|
1762
|
-
async: true,
|
|
1763
|
-
clarify: true,
|
|
1764
|
-
},
|
|
1765
|
-
new AbortController().signal,
|
|
1766
|
-
undefined,
|
|
1767
|
-
makeCtx(makeSessionManagerRecorder().manager),
|
|
1768
|
-
);
|
|
1769
1198
|
|
|
1770
|
-
assert.equal(result.isError, undefined);
|
|
1771
|
-
assert.equal(result.details?.mode, "chain");
|
|
1772
|
-
assert.equal(result.details?.asyncId, undefined);
|
|
1773
|
-
assert.doesNotMatch(result.content[0]?.text ?? "", /Async chain:/);
|
|
1774
|
-
});
|
|
1775
1199
|
|
|
1776
|
-
it("rejects invalid background top-level parallel requests during executor preflight", async () => {
|
|
1777
|
-
const executor = makeExecutor();
|
|
1778
|
-
for (const testCase of [
|
|
1779
|
-
{
|
|
1780
|
-
name: "max tasks",
|
|
1781
|
-
params: { tasks: [{ agent: "echo", task: "task one", count: 9 }], async: true, clarify: false },
|
|
1782
|
-
patterns: [/Max 8 tasks/],
|
|
1783
|
-
},
|
|
1784
|
-
{
|
|
1785
|
-
name: "worktree cwd conflict",
|
|
1786
|
-
params: {
|
|
1787
|
-
tasks: [
|
|
1788
|
-
{ agent: "echo", task: "task one" },
|
|
1789
|
-
{ agent: "second", task: "task two", cwd: `${tempDir}/other` },
|
|
1790
|
-
],
|
|
1791
|
-
worktree: true,
|
|
1792
|
-
async: true,
|
|
1793
|
-
clarify: false,
|
|
1794
|
-
},
|
|
1795
|
-
patterns: [/worktree isolation uses the shared cwd/i, /task 2 \(second\) sets cwd/i],
|
|
1796
|
-
},
|
|
1797
|
-
]) {
|
|
1798
|
-
const result = await executor.execute(
|
|
1799
|
-
"id",
|
|
1800
|
-
testCase.params,
|
|
1801
|
-
new AbortController().signal,
|
|
1802
|
-
undefined,
|
|
1803
|
-
makeCtx(makeSessionManagerRecorder().manager),
|
|
1804
|
-
);
|
|
1805
1200
|
|
|
1806
|
-
assert.equal(result.isError, true, testCase.name);
|
|
1807
|
-
for (const pattern of testCase.patterns) {
|
|
1808
|
-
assert.match(result.content[0]?.text ?? "", pattern, testCase.name);
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
});
|
|
1812
1201
|
|
|
1813
|
-
it("rejects async chain worktree runs with a conflicting task cwd", async () => {
|
|
1814
|
-
const { manager } = makeSessionManagerRecorder({ sessionFile: "/tmp/parent.jsonl", leafId: "leaf-chain" });
|
|
1815
|
-
const executor = makeExecutor();
|
|
1816
1202
|
|
|
1817
|
-
const result = await executor.execute(
|
|
1818
|
-
"id",
|
|
1819
|
-
{
|
|
1820
|
-
chain: [
|
|
1821
|
-
{
|
|
1822
|
-
parallel: [
|
|
1823
|
-
{ agent: "echo", task: "p1" },
|
|
1824
|
-
{ agent: "second", task: "p2", cwd: `${tempDir}/other` },
|
|
1825
|
-
],
|
|
1826
|
-
worktree: true,
|
|
1827
|
-
},
|
|
1828
|
-
],
|
|
1829
|
-
async: true,
|
|
1830
|
-
clarify: false,
|
|
1831
|
-
},
|
|
1832
|
-
new AbortController().signal,
|
|
1833
|
-
undefined,
|
|
1834
|
-
makeCtx(manager),
|
|
1835
|
-
);
|
|
1836
1203
|
|
|
1837
|
-
assert.equal(result.isError, true);
|
|
1838
|
-
assert.match(result.content[0]?.text ?? "", /parallel chain step 1/i);
|
|
1839
|
-
assert.match(result.content[0]?.text ?? "", /task 2 \(second\) sets cwd/i);
|
|
1840
|
-
});
|
|
1841
1204
|
|
|
1842
|
-
it("creates isolated forked sessions per chain step (including counted parallel steps)", async () => {
|
|
1843
|
-
const { manager, openedPaths, branchedLeafIds } = makeForkingSessionManagerRecorder({
|
|
1844
|
-
sessionFile: path.join(tempDir, "parent-chain.jsonl"),
|
|
1845
|
-
leafId: "leaf-chain",
|
|
1846
|
-
});
|
|
1847
|
-
const executor = makeExecutor();
|
|
1848
1205
|
|
|
1849
|
-
const result = await executor.execute(
|
|
1850
|
-
"id",
|
|
1851
|
-
{
|
|
1852
|
-
chain: [
|
|
1853
|
-
{ agent: "echo", task: "step 1" },
|
|
1854
|
-
{ parallel: [{ agent: "echo", task: "p1", count: 2 }, { agent: "second", task: "p2", count: 2 }] },
|
|
1855
|
-
{ agent: "second", task: "step 3" },
|
|
1856
|
-
],
|
|
1857
|
-
context: "fork",
|
|
1858
|
-
clarify: false,
|
|
1859
|
-
},
|
|
1860
|
-
new AbortController().signal,
|
|
1861
|
-
undefined,
|
|
1862
|
-
makeCtx(manager),
|
|
1863
|
-
);
|
|
1864
1206
|
|
|
1865
|
-
assert.equal(result.isError, undefined);
|
|
1866
|
-
assert.deepEqual(openedPaths, Array(6).fill(path.join(tempDir, "parent-chain.jsonl")));
|
|
1867
|
-
assert.deepEqual(branchedLeafIds, Array(6).fill("leaf-chain"));
|
|
1868
|
-
const sessionArgs = readSessionArgsFromCalls().filter((sessionFile) => path.dirname(sessionFile) === tempDir && path.basename(sessionFile).startsWith("fork-"));
|
|
1869
|
-
assert.equal(sessionArgs.length, 6, "1 sequential + 4 parallel + 1 sequential");
|
|
1870
|
-
assert.equal(new Set(sessionArgs).size, 6);
|
|
1871
|
-
});
|
|
1872
1207
|
|
|
1873
1208
|
it("uses request cwd for management actions", async () => {
|
|
1874
1209
|
const executor = makeExecutor();
|
|
@@ -1915,28 +1250,7 @@ describe("fork context execution wiring", { skip: !available ? "subagent executo
|
|
|
1915
1250
|
assert.equal(args[modelIndex + 1], "anthropic/claude-haiku-4-5");
|
|
1916
1251
|
});
|
|
1917
1252
|
|
|
1918
|
-
it("resolves parallel task cwd values relative to the request cwd", async () => {
|
|
1919
|
-
const worktreeDir = path.join(tempDir, "worktree");
|
|
1920
|
-
writePackageSkill(path.join(worktreeDir, "packages", "app"), "parallel-step-skill");
|
|
1921
|
-
const executor = makeExecutorWithDiscoverAgents(() => ({
|
|
1922
|
-
agents: [{ name: "echo", description: "Echo test agent", skills: ["parallel-step-skill"] }],
|
|
1923
|
-
projectAgentsDir: null,
|
|
1924
|
-
}));
|
|
1925
1253
|
|
|
1926
|
-
const result = await executor.execute(
|
|
1927
|
-
"id",
|
|
1928
|
-
{
|
|
1929
|
-
tasks: [{ agent: "echo", task: "test", cwd: "packages/app" }],
|
|
1930
|
-
cwd: worktreeDir,
|
|
1931
|
-
},
|
|
1932
|
-
new AbortController().signal,
|
|
1933
|
-
undefined,
|
|
1934
|
-
makeCtx(makeSessionManagerRecorder().manager),
|
|
1935
|
-
);
|
|
1936
|
-
|
|
1937
|
-
assert.equal(result.isError, undefined);
|
|
1938
|
-
assert.deepEqual(result.details?.results?.[0]?.skills, ["parallel-step-skill"]);
|
|
1939
|
-
});
|
|
1940
1254
|
|
|
1941
1255
|
it("uses request cwd for project builtin overrides during management", async () => {
|
|
1942
1256
|
const tempHome = createTempDir("pi-subagent-home-");
|