@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
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
2
5
|
import { describe, it } from "node:test";
|
|
3
6
|
import { Worker } from "node:worker_threads";
|
|
4
7
|
import { formatWorkflowJsonPreview, previewSimpleWorkflowRun, runWorkflowScript, WorkflowScriptError } from "../../src/workflows/scripted-workflow.ts";
|
|
@@ -20,6 +23,23 @@ describe("scripted workflow runtime", () => {
|
|
|
20
23
|
assert.deepEqual(explicit.value, { answer: 42 });
|
|
21
24
|
});
|
|
22
25
|
|
|
26
|
+
it("resolves the workflow parser from pi-subagents outside the project cwd", async () => {
|
|
27
|
+
const originalCwd = process.cwd();
|
|
28
|
+
const emptyCwd = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-no-acorn-"));
|
|
29
|
+
try {
|
|
30
|
+
process.chdir(emptyCwd);
|
|
31
|
+
const result = await runWorkflowScript({
|
|
32
|
+
script: `return "done";`,
|
|
33
|
+
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
34
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
35
|
+
});
|
|
36
|
+
assert.equal(result.value, "done");
|
|
37
|
+
} finally {
|
|
38
|
+
process.chdir(originalCwd);
|
|
39
|
+
fs.rmSync(emptyCwd, { recursive: true, force: true });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
23
43
|
it("guides invalid JavaScript caused by Markdown fence backticks", async () => {
|
|
24
44
|
const script = [
|
|
25
45
|
"const task = `Run:",
|
|
@@ -38,7 +58,7 @@ describe("scripted workflow runtime", () => {
|
|
|
38
58
|
(error: unknown) => error instanceof WorkflowScriptError
|
|
39
59
|
&& error.message.includes("workflowScript must be valid JavaScript")
|
|
40
60
|
&& error.message.includes('array joined with "\\n"')
|
|
41
|
-
&&
|
|
61
|
+
&& error.message.includes("Unexpected token")
|
|
42
62
|
&& error.message.includes("SyntaxError"),
|
|
43
63
|
);
|
|
44
64
|
});
|
|
@@ -125,7 +145,7 @@ describe("scripted workflow runtime", () => {
|
|
|
125
145
|
});
|
|
126
146
|
|
|
127
147
|
assert.deepEqual(launches.map(({ key }) => key), ["scan", "review-a", "review-b"]);
|
|
128
|
-
assert.equal(launches.every(({ params }) => params
|
|
148
|
+
assert.equal(launches.every(({ params }) => !Object.prototype.hasOwnProperty.call(params, "async")), true);
|
|
129
149
|
assert.deepEqual(result.emits, [{ count: 2 }]);
|
|
130
150
|
assert.deepEqual(result.console, [{ level: "log", text: "reviewed 2" }]);
|
|
131
151
|
assert.match(JSON.stringify(result.value), /\[run review-a; id=run-revi\]/);
|
|
@@ -149,29 +169,51 @@ describe("scripted workflow runtime", () => {
|
|
|
149
169
|
assert.deepEqual(launchParams?.intercomBridge, { mode: "off" });
|
|
150
170
|
});
|
|
151
171
|
|
|
152
|
-
it("
|
|
153
|
-
let
|
|
172
|
+
it("resolves a keyed workflow receipt before launching a retained child", async () => {
|
|
173
|
+
let launchParams: Record<string, unknown> | undefined;
|
|
174
|
+
let resolvedReference: unknown;
|
|
154
175
|
const result = await runWorkflowScript({
|
|
155
|
-
script: `
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
prompts: {
|
|
160
|
-
render(ref, vars) {
|
|
161
|
-
assert.equal(ref, "project:writer-followup");
|
|
162
|
-
assert.deepEqual(vars, { pass: 2, previous: "draft" });
|
|
163
|
-
return "Pass 2: revise draft";
|
|
164
|
-
},
|
|
176
|
+
script: `return runs.run("cross-review", { resume: { workflowRunId: "workflow-1", key: "advisor", latest: true }, task: "Continue" });`,
|
|
177
|
+
resolveResume(reference) {
|
|
178
|
+
resolvedReference = reference;
|
|
179
|
+
return { runId: "retained-run", runIds: ["ancestor-run", "retained-run"] };
|
|
165
180
|
},
|
|
166
181
|
async launch(key, params) {
|
|
167
|
-
|
|
168
|
-
return { key, ok: true, runId: "
|
|
182
|
+
launchParams = params;
|
|
183
|
+
return { key, ok: true, runId: "continued-run", output: "done", artifactPaths: [] };
|
|
169
184
|
},
|
|
170
185
|
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
171
186
|
});
|
|
172
187
|
|
|
173
|
-
assert.
|
|
174
|
-
assert.
|
|
188
|
+
assert.deepEqual(resolvedReference, { workflowRunId: "workflow-1", key: "advisor", latest: true });
|
|
189
|
+
assert.deepEqual(launchParams, { resume: "retained-run", task: "Continue" });
|
|
190
|
+
assert.equal((result.value as { runId?: string }).runId, "continued-run");
|
|
191
|
+
assert.deepEqual((result.value as { continuation?: { runIds?: string[] } }).continuation?.runIds, ["ancestor-run", "retained-run", "continued-run"]);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it("fails closed for invalid or unavailable keyed workflow receipt resume", async () => {
|
|
195
|
+
for (const resume of [
|
|
196
|
+
`{ workflowRunId: "workflow-1", key: "advisor", latest: false }`,
|
|
197
|
+
`{ workflowRunId: "workflow-1", key: "bad key", latest: true }`,
|
|
198
|
+
`{ workflowRunId: "workflow-1", key: "advisor", latest: true, extra: true }`,
|
|
199
|
+
]) {
|
|
200
|
+
await assert.rejects(
|
|
201
|
+
runWorkflowScript({
|
|
202
|
+
script: `return runs.run("cross-review", { resume: ${resume}, task: "Continue" });`,
|
|
203
|
+
async launch(key) { return { key, ok: true, output: "unexpected", artifactPaths: [] }; },
|
|
204
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
205
|
+
}),
|
|
206
|
+
(error: unknown) => error instanceof WorkflowScriptError && /keyed resume/.test(error.message),
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
await assert.rejects(
|
|
210
|
+
runWorkflowScript({
|
|
211
|
+
script: `return runs.run("cross-review", { resume: { workflowRunId: "workflow-1", key: "advisor", latest: true }, task: "Continue" });`,
|
|
212
|
+
async launch(key) { return { key, ok: true, output: "unexpected", artifactPaths: [] }; },
|
|
213
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
214
|
+
}),
|
|
215
|
+
(error: unknown) => error instanceof WorkflowScriptError && /unavailable in this host/.test(error.message),
|
|
216
|
+
);
|
|
175
217
|
});
|
|
176
218
|
|
|
177
219
|
it("waits for every runs.all child and returns ordinary failures in input order", async () => {
|
|
@@ -328,6 +370,7 @@ describe("scripted workflow runtime", () => {
|
|
|
328
370
|
`return await runs.all([{ key: "valid", agent: "worker", task: "run" }, { key: "legacy", agent: "worker", task: "run", parallel: [{ task: "nested" }] }]);`,
|
|
329
371
|
`return await runs.all([{ key: "valid", agent: "worker", task: "run" }, { key: "undefined-action", agent: "worker", task: "run", action: undefined }]);`,
|
|
330
372
|
`return await runs.all([{ key: "valid", agent: "worker", task: "run" }, { key: "uncloneable", agent: "worker", task: () => "run" }]);`,
|
|
373
|
+
`return await runs.all([{ key: "valid", agent: "worker", task: "run" }, { key: "bad-binding", agent: "worker", task: "run", extensionBindings: { invalid: true } }]);`,
|
|
331
374
|
`const items = []; items[1] = { key: "valid", agent: "worker", task: "run" }; return await runs.all(items);`,
|
|
332
375
|
];
|
|
333
376
|
for (const script of malformedScripts) {
|
|
@@ -426,18 +469,30 @@ describe("scripted workflow runtime", () => {
|
|
|
426
469
|
assert.deepEqual(result.value, [{ key: "review", output: "completed", values: [null] }]);
|
|
427
470
|
});
|
|
428
471
|
|
|
429
|
-
it("
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
472
|
+
it("omits non-JSON child result metadata before returning reused runs.run results", async () => {
|
|
473
|
+
let launches = 0;
|
|
474
|
+
const result = await runWorkflowScript({
|
|
475
|
+
script: `
|
|
476
|
+
const first = await runs.run("non-plain", { agent: "worker", task: "write output" });
|
|
477
|
+
const reused = await runs.run("non-plain", { agent: "worker", task: "write output" });
|
|
478
|
+
return [first, reused];
|
|
479
|
+
`,
|
|
480
|
+
timeoutMs: 2_000,
|
|
481
|
+
async launch(key) {
|
|
482
|
+
launches++;
|
|
483
|
+
return { key, ok: true, output: "Saved output.", artifactPaths: [], results: [{ metadata: new Map([["source", "worker"]]) }] };
|
|
484
|
+
},
|
|
485
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
assert.equal(launches, 1);
|
|
489
|
+
assert.deepEqual(result.value, [
|
|
490
|
+
{ key: "non-plain", ok: true, output: "Saved output.", artifactPaths: [] },
|
|
491
|
+
{ key: "non-plain", ok: true, output: "Saved output.", artifactPaths: [] },
|
|
492
|
+
]);
|
|
493
|
+
assert.equal((result.value as Array<{ results?: unknown }>)[0]?.results, undefined);
|
|
494
|
+
assert.equal((result.value as Array<{ results?: unknown }>)[1]?.results, undefined);
|
|
495
|
+
assert.ok(result.children[0]?.results?.[0] && (result.children[0].results[0] as { metadata?: unknown }).metadata instanceof Map);
|
|
441
496
|
});
|
|
442
497
|
|
|
443
498
|
it("passes retained resume items and rejects agent overrides", async () => {
|
|
@@ -451,7 +506,7 @@ describe("scripted workflow runtime", () => {
|
|
|
451
506
|
},
|
|
452
507
|
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
453
508
|
});
|
|
454
|
-
assert.deepEqual(launchParams, { resume: "retained-run", task: "Apply the follow-up"
|
|
509
|
+
assert.deepEqual(launchParams, { resume: "retained-run", task: "Apply the follow-up" });
|
|
455
510
|
assert.equal((resumed.value as { runId?: string }).runId, "revived-run");
|
|
456
511
|
|
|
457
512
|
await assert.rejects(
|
|
@@ -490,6 +545,26 @@ describe("scripted workflow runtime", () => {
|
|
|
490
545
|
]);
|
|
491
546
|
});
|
|
492
547
|
|
|
548
|
+
it("passes distinct namespaced bindings to parallel children", async () => {
|
|
549
|
+
const launches: Array<{ key: string; bindings: unknown }> = [];
|
|
550
|
+
await runWorkflowScript({
|
|
551
|
+
script: `return runs.all([
|
|
552
|
+
{ key: "coder", agent: "worker", task: "code", extensionBindings: { "shepherd.dispatch/1": { role: "coder" } } },
|
|
553
|
+
{ key: "reviewer", agent: "reviewer", task: "review", extensionBindings: { "shepherd.dispatch/1": { role: "reviewer" } } }
|
|
554
|
+
]);`,
|
|
555
|
+
timeoutMs: 2_000,
|
|
556
|
+
async launch(key, params) {
|
|
557
|
+
launches.push({ key, bindings: params.extensionBindings });
|
|
558
|
+
return { key, ok: true, output: key, artifactPaths: [], results: [] };
|
|
559
|
+
},
|
|
560
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
561
|
+
});
|
|
562
|
+
assert.deepEqual(launches, [
|
|
563
|
+
{ key: "coder", bindings: { "shepherd.dispatch/1": { role: "coder" } } },
|
|
564
|
+
{ key: "reviewer", bindings: { "shepherd.dispatch/1": { role: "reviewer" } } },
|
|
565
|
+
]);
|
|
566
|
+
});
|
|
567
|
+
|
|
493
568
|
it("composes dynamic sequential and parallel phases with per-child controls", async () => {
|
|
494
569
|
const launches: Array<{ key: string; agent: unknown; task: unknown; worktree: unknown }> = [];
|
|
495
570
|
const result = await runWorkflowScript({
|
|
@@ -542,6 +617,20 @@ describe("scripted workflow runtime", () => {
|
|
|
542
617
|
}
|
|
543
618
|
});
|
|
544
619
|
|
|
620
|
+
it("rejects clarify UI on workflow children", async () => {
|
|
621
|
+
let launches = 0;
|
|
622
|
+
await assert.rejects(
|
|
623
|
+
runWorkflowScript({
|
|
624
|
+
script: `return runs.run("clarify", { agent: "worker", task: "Review", clarify: true });`,
|
|
625
|
+
timeoutMs: 2_000,
|
|
626
|
+
launch: async () => { launches++; return { ok: true, output: "unexpected" }; },
|
|
627
|
+
status: async () => ({ ok: true, output: "unused" }),
|
|
628
|
+
}),
|
|
629
|
+
(error: unknown) => error instanceof WorkflowScriptError && /does not support clarify UI/.test(error.message),
|
|
630
|
+
);
|
|
631
|
+
assert.equal(launches, 0);
|
|
632
|
+
});
|
|
633
|
+
|
|
545
634
|
it("rejects a duplicate key with incompatible params", async () => {
|
|
546
635
|
await assert.rejects(
|
|
547
636
|
runWorkflowScript({
|
|
@@ -557,6 +646,142 @@ describe("scripted workflow runtime", () => {
|
|
|
557
646
|
);
|
|
558
647
|
});
|
|
559
648
|
|
|
649
|
+
it("validates runs.steer input before calling the host", async () => {
|
|
650
|
+
for (const script of [
|
|
651
|
+
`return runs.steer("bad key", "guide");`,
|
|
652
|
+
`return runs.steer("writer", " ");`,
|
|
653
|
+
`return runs.steer("writer", "guide", { mode: "later" });`,
|
|
654
|
+
`return runs.steer("writer", "guide", { index: -1 });`,
|
|
655
|
+
`return runs.steer("writer", "guide", { ackTimeoutMs: 0 });`,
|
|
656
|
+
`return runs.steer("writer", "guide", { runId: "raw-id" });`,
|
|
657
|
+
]) {
|
|
658
|
+
let steerCalls = 0;
|
|
659
|
+
await assert.rejects(
|
|
660
|
+
runWorkflowScript({
|
|
661
|
+
script,
|
|
662
|
+
async launch(key) { return { key, ok: true, output: "done", artifactPaths: [] }; },
|
|
663
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
664
|
+
async steer(key) { steerCalls++; return { key, state: "delivered" }; },
|
|
665
|
+
}),
|
|
666
|
+
(error: unknown) => error instanceof WorkflowScriptError && /runs\.steer/.test(error.message),
|
|
667
|
+
);
|
|
668
|
+
assert.equal(steerCalls, 0);
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
it("steers a still-running sibling after Promise.race and awaits both children", async () => {
|
|
673
|
+
let resolveSlow!: (result: { key: string; ok: true; output: string; artifactPaths: never[] }) => void;
|
|
674
|
+
const result = await runWorkflowScript({
|
|
675
|
+
script: `
|
|
676
|
+
const fast = runs.run("fast", { agent: "worker", task: "fast" });
|
|
677
|
+
const slow = runs.run("slow", { agent: "worker", task: "slow" });
|
|
678
|
+
const first = await Promise.race([fast, slow]);
|
|
679
|
+
const receipt = await runs.steer("slow", "Focus on tests.", { mode: "auto", index: 0, ackTimeoutMs: 100 });
|
|
680
|
+
const children = await Promise.all([fast, slow]);
|
|
681
|
+
return { first: first.key, receipt, children: children.map((child) => child.key) };
|
|
682
|
+
`,
|
|
683
|
+
launch(key) {
|
|
684
|
+
if (key === "fast") return Promise.resolve({ key, ok: true, output: "fast", artifactPaths: [] });
|
|
685
|
+
return new Promise((resolve) => { resolveSlow = resolve; });
|
|
686
|
+
},
|
|
687
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
688
|
+
async steer(key, message, options) {
|
|
689
|
+
assert.equal(key, "slow");
|
|
690
|
+
assert.equal(message, "Focus on tests.");
|
|
691
|
+
assert.deepEqual(options, { mode: "auto", index: 0, ackTimeoutMs: 100 });
|
|
692
|
+
resolveSlow({ key, ok: true, output: "slow", artifactPaths: [] });
|
|
693
|
+
return { key, state: "delivered", requestId: "request-1", deliveryStatus: "delivered", targets: [{ index: 0, state: "delivered" }] };
|
|
694
|
+
},
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
assert.deepEqual(result.value, {
|
|
698
|
+
first: "fast",
|
|
699
|
+
receipt: { key: "slow", state: "delivered", requestId: "request-1", deliveryStatus: "delivered", targets: [{ index: 0, state: "delivered" }] },
|
|
700
|
+
children: ["fast", "slow"],
|
|
701
|
+
});
|
|
702
|
+
assert.deepEqual(result.trace.filter((entry) => entry.operation === "steer").map(({ state }) => state), ["started", "delivered"]);
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
it("uses Promise.race to roll through child completions and steer the remaining work", async () => {
|
|
706
|
+
let resolveBeta!: (result: { key: string; ok: true; output: string; artifactPaths: never[] }) => void;
|
|
707
|
+
let resolveGamma!: (result: { key: string; ok: true; output: string; artifactPaths: never[] }) => void;
|
|
708
|
+
const result = await runWorkflowScript({
|
|
709
|
+
script: `
|
|
710
|
+
let pending = [
|
|
711
|
+
{ key: "alpha", promise: runs.run("alpha", { agent: "worker", task: "alpha" }).then((result) => ({ key: "alpha", result })) },
|
|
712
|
+
{ key: "beta", promise: runs.run("beta", { agent: "worker", task: "beta" }).then((result) => ({ key: "beta", result })) },
|
|
713
|
+
{ key: "gamma", promise: runs.run("gamma", { agent: "worker", task: "gamma" }).then((result) => ({ key: "gamma", result })) },
|
|
714
|
+
];
|
|
715
|
+
const first = await Promise.race(pending.map((child) => child.promise));
|
|
716
|
+
pending = pending.filter((child) => child.key !== first.key);
|
|
717
|
+
const target = pending.find((child) => child.key === "gamma") ?? pending[0];
|
|
718
|
+
const receipt = await runs.steer(target.key, "Challenge the first result: " + first.result.output, { mode: "auto", ackTimeoutMs: 100 });
|
|
719
|
+
const second = await Promise.race(pending.map((child) => child.promise));
|
|
720
|
+
pending = pending.filter((child) => child.key !== second.key);
|
|
721
|
+
const rest = await Promise.all(pending.map((child) => child.promise));
|
|
722
|
+
return { first: first.key, second: second.key, rest: rest.map((child) => child.key), receipt };
|
|
723
|
+
`,
|
|
724
|
+
launch(key) {
|
|
725
|
+
if (key === "alpha") return Promise.resolve({ key, ok: true, output: "alpha done", artifactPaths: [] });
|
|
726
|
+
if (key === "beta") return new Promise((resolve) => { resolveBeta = resolve; });
|
|
727
|
+
return new Promise((resolve) => { resolveGamma = resolve; });
|
|
728
|
+
},
|
|
729
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
730
|
+
async steer(key, message, options) {
|
|
731
|
+
assert.equal(key, "gamma");
|
|
732
|
+
assert.equal(message, "Challenge the first result: alpha done");
|
|
733
|
+
assert.deepEqual(options, { mode: "auto", ackTimeoutMs: 100 });
|
|
734
|
+
resolveGamma({ key, ok: true, output: "gamma done", artifactPaths: [] });
|
|
735
|
+
setTimeout(() => resolveBeta({ key: "beta", ok: true, output: "beta done", artifactPaths: [] }), 5);
|
|
736
|
+
return { key, state: "delivered", requestId: "request-rolling", deliveryStatus: "delivered", targets: [{ index: 0, state: "delivered" }] };
|
|
737
|
+
},
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
assert.deepEqual(result.value, {
|
|
741
|
+
first: "alpha",
|
|
742
|
+
second: "gamma",
|
|
743
|
+
rest: ["beta"],
|
|
744
|
+
receipt: { key: "gamma", state: "delivered", requestId: "request-rolling", deliveryStatus: "delivered", targets: [{ index: 0, state: "delivered" }] },
|
|
745
|
+
});
|
|
746
|
+
assert.deepEqual(result.children.map((child) => child.key), ["alpha", "beta", "gamma"]);
|
|
747
|
+
assert.deepEqual(result.trace.filter((entry) => entry.operation === "run" && entry.state === "completed").map((entry) => entry.key), ["alpha", "gamma", "beta"]);
|
|
748
|
+
assert.deepEqual(result.trace.filter((entry) => entry.operation === "steer").map(({ key, state }) => ({ key, state })), [{ key: "gamma", state: "started" }, { key: "gamma", state: "delivered" }]);
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
it("waits for and rejects an unawaited runs.steer side effect", async () => {
|
|
752
|
+
let steerSettled = false;
|
|
753
|
+
await assert.rejects(
|
|
754
|
+
runWorkflowScript({
|
|
755
|
+
script: `await runs.run("writer", { agent: "worker", task: "work" }); runs.steer("writer", "Checkpoint."); return "done";`,
|
|
756
|
+
async launch(key) { return { key, ok: true, output: "done", artifactPaths: [] }; },
|
|
757
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
758
|
+
async steer(key) {
|
|
759
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
760
|
+
steerSettled = true;
|
|
761
|
+
return { key, state: "queued" };
|
|
762
|
+
},
|
|
763
|
+
}),
|
|
764
|
+
(error: unknown) => error instanceof WorkflowScriptError
|
|
765
|
+
&& error.message.includes("unawaited runs.steer call(s): 'writer'")
|
|
766
|
+
&& error.partial.trace.some((entry) => entry.operation === "steer" && entry.state === "queued"),
|
|
767
|
+
);
|
|
768
|
+
assert.equal(steerSettled, true);
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
it("rejects an unawaited runs.steer host-invariant failure", async () => {
|
|
772
|
+
await assert.rejects(
|
|
773
|
+
runWorkflowScript({
|
|
774
|
+
script: `runs.steer("missing", "Checkpoint."); return "done";`,
|
|
775
|
+
async launch(key) { return { key, ok: true, output: "done", artifactPaths: [] }; },
|
|
776
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
777
|
+
async steer(key) { return { key, state: "delivered" }; },
|
|
778
|
+
}),
|
|
779
|
+
(error: unknown) => error instanceof WorkflowScriptError
|
|
780
|
+
&& (error.message.includes("unawaited runs.steer call(s): 'missing'") || error.message.includes("runs.steer('missing') requires a prior runs.run/runs.all launch with that key"))
|
|
781
|
+
&& error.partial.trace.some((entry) => entry.operation === "steer" && entry.state === "failed"),
|
|
782
|
+
);
|
|
783
|
+
});
|
|
784
|
+
|
|
560
785
|
it("rejects and aborts an unawaited child launch when the script completes", async () => {
|
|
561
786
|
let childAborted = false;
|
|
562
787
|
await assert.rejects(
|
|
@@ -573,7 +798,7 @@ describe("scripted workflow runtime", () => {
|
|
|
573
798
|
}),
|
|
574
799
|
(error: unknown) => error instanceof WorkflowScriptError
|
|
575
800
|
&& error.message.includes("unawaited runs.run launch(es): 'bg'")
|
|
576
|
-
&& error.message.includes("
|
|
801
|
+
&& error.message.includes("await runs.all([{key, agent, task}, ...])"),
|
|
577
802
|
);
|
|
578
803
|
assert.equal(childAborted, true);
|
|
579
804
|
});
|
|
@@ -631,21 +856,87 @@ describe("scripted workflow runtime", () => {
|
|
|
631
856
|
);
|
|
632
857
|
});
|
|
633
858
|
|
|
634
|
-
it("rejects
|
|
859
|
+
it("rejects nested async helper syntax for portable workflow parity", async () => {
|
|
860
|
+
const scripts = [
|
|
861
|
+
`async function helper() { return runs.run("async-function", { agent: "worker", task: "run" }); } const child = await helper(); return child.output;`,
|
|
862
|
+
`const helper = async () => runs.run("async-arrow", { agent: "worker", task: "run" }); const child = await helper(); return child.output;`,
|
|
863
|
+
`const helpers = { async scan() { return runs.run("async-method", { agent: "worker", task: "run" }); } }; return helpers.scan();`,
|
|
864
|
+
`const helpers = { async ["scan"]() { return runs.run("async-computed-method", { agent: "worker", task: "run" }); } }; helpers.scan(); return "done";`,
|
|
865
|
+
];
|
|
866
|
+
for (const script of scripts) {
|
|
867
|
+
await assert.rejects(
|
|
868
|
+
runWorkflowScript({
|
|
869
|
+
script,
|
|
870
|
+
timeoutMs: 2_000,
|
|
871
|
+
async launch(key) { return { key, ok: true, output: "unexpected", artifactPaths: [] }; },
|
|
872
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
873
|
+
}),
|
|
874
|
+
(error: unknown) => error instanceof WorkflowScriptError
|
|
875
|
+
&& error.message.includes("does not support nested async functions")
|
|
876
|
+
&& error.partial.children.length === 0,
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
it("rejects nested async helpers before launching children", async () => {
|
|
882
|
+
let launches = 0;
|
|
635
883
|
await assert.rejects(
|
|
636
884
|
runWorkflowScript({
|
|
637
|
-
script: `async function
|
|
885
|
+
script: `async function patchLane(key) { const writer = await runs.run(key, { agent: "worker", task: "write" }); return runs.run(key + "-review", { agent: "reviewer", task: writer.output }); } await Promise.all([patchLane("lane")]);`,
|
|
638
886
|
timeoutMs: 2_000,
|
|
639
|
-
async launch(key) {
|
|
887
|
+
async launch(key) {
|
|
888
|
+
launches++;
|
|
889
|
+
return { key, ok: true, output: "unexpected", artifactPaths: [] };
|
|
890
|
+
},
|
|
891
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
892
|
+
}),
|
|
893
|
+
(error: unknown) => error instanceof WorkflowScriptError
|
|
894
|
+
&& error.message.includes("does not support nested async functions")
|
|
895
|
+
&& error.partial.children.length === 0,
|
|
896
|
+
);
|
|
897
|
+
assert.equal(launches, 0);
|
|
898
|
+
});
|
|
899
|
+
|
|
900
|
+
it("ignores async-looking text in regex literals", async () => {
|
|
901
|
+
const result = await runWorkflowScript({
|
|
902
|
+
script: [
|
|
903
|
+
`const pattern = /async function helper/;`,
|
|
904
|
+
`if (true) /async function helper/.test("async function helper");`,
|
|
905
|
+
`if (true) /* comment */ /async function helper/.test("async function helper");`,
|
|
906
|
+
`const inResult = "async function helper" in /async function helper/;`,
|
|
907
|
+
`const inBlockComment = "async function helper" in /* comment */ /async function helper/;`,
|
|
908
|
+
`const inLineComment = "async function helper" in // comment`,
|
|
909
|
+
`/async function helper/;`,
|
|
910
|
+
`let instanceResult = false;`,
|
|
911
|
+
`try { instanceResult = {} instanceof /* comment */ /async function helper/; } catch {}`,
|
|
912
|
+
`function helper() { return runs.run("regex-text", { agent: "worker", task: "run" }); }`,
|
|
913
|
+
`const child = await helper();`,
|
|
914
|
+
`return pattern.test("async function helper") && !inResult && !inBlockComment && !inLineComment && !instanceResult ? child.output : "missing";`,
|
|
915
|
+
].join("\n"),
|
|
916
|
+
timeoutMs: 2_000,
|
|
917
|
+
async launch(key) { return { key, ok: true, output: "regex output", artifactPaths: [] }; },
|
|
918
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
919
|
+
});
|
|
920
|
+
assert.equal(result.value, "regex output");
|
|
921
|
+
});
|
|
922
|
+
|
|
923
|
+
it("rejects nested async helper syntax inside template expressions", async () => {
|
|
924
|
+
await assert.rejects(
|
|
925
|
+
runWorkflowScript({
|
|
926
|
+
script: "const value = `${(async () => runs.run(\"template-async\", { agent: \"worker\", task: \"run\" }))()}`; return value;",
|
|
927
|
+
timeoutMs: 2_000,
|
|
928
|
+
async launch(key) { return { key, ok: true, output: "unexpected", artifactPaths: [] }; },
|
|
640
929
|
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
641
930
|
}),
|
|
642
|
-
(error: unknown) => error instanceof WorkflowScriptError
|
|
931
|
+
(error: unknown) => error instanceof WorkflowScriptError
|
|
932
|
+
&& error.message.includes("does not support nested async functions")
|
|
933
|
+
&& error.partial.children.length === 0,
|
|
643
934
|
);
|
|
644
935
|
});
|
|
645
936
|
|
|
646
|
-
it("accepts
|
|
937
|
+
it("accepts portable plain helper wrappers over runs.run", async () => {
|
|
647
938
|
const result = await runWorkflowScript({
|
|
648
|
-
script: `
|
|
939
|
+
script: `function helper() { return runs.run("plain-helper", { agent: "worker", task: "run" }); } const child = await helper(); return child.output;`,
|
|
649
940
|
timeoutMs: 2_000,
|
|
650
941
|
async launch(key) { return { key, ok: true, output: "helper output", artifactPaths: [] }; },
|
|
651
942
|
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
@@ -653,7 +944,38 @@ describe("scripted workflow runtime", () => {
|
|
|
653
944
|
assert.equal(result.value, "helper output");
|
|
654
945
|
});
|
|
655
946
|
|
|
656
|
-
it("accepts
|
|
947
|
+
it("accepts Promise.all over a portable plain helper wrapper", async () => {
|
|
948
|
+
const result = await runWorkflowScript({
|
|
949
|
+
script: `function helper() { return runs.run("plain-helper-all", { agent: "worker", task: "run" }); } const children = await Promise.all([helper()]); return children[0].output;`,
|
|
950
|
+
timeoutMs: 2_000,
|
|
951
|
+
async launch(key) { return { key, ok: true, output: "helper all output", artifactPaths: [] }; },
|
|
952
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
953
|
+
});
|
|
954
|
+
assert.equal(result.value, "helper all output");
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
it("accepts awaited Promise.all over then chains that return child launches", async () => {
|
|
958
|
+
const result = await runWorkflowScript({
|
|
959
|
+
script: `
|
|
960
|
+
function patchLane(key) {
|
|
961
|
+
return runs.run(key + "-writer", { agent: "worker", task: "write " + key })
|
|
962
|
+
.then((writer) => runs.run(key + "-review", { agent: "reviewer", task: "review " + writer.output }));
|
|
963
|
+
}
|
|
964
|
+
const reviews = await Promise.all([patchLane("alpha"), patchLane("beta")]);
|
|
965
|
+
return reviews.map((review) => review.key);
|
|
966
|
+
`,
|
|
967
|
+
timeoutMs: 2_000,
|
|
968
|
+
async launch(key, params) {
|
|
969
|
+
if (key.endsWith("-review")) assert.match(String(params.task), /review .* writer output/);
|
|
970
|
+
return { key, ok: true, output: key + " writer output", artifactPaths: [] };
|
|
971
|
+
},
|
|
972
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
973
|
+
});
|
|
974
|
+
assert.deepEqual(result.value, ["alpha-review", "beta-review"]);
|
|
975
|
+
assert.deepEqual(result.children.map((child) => child.key), ["alpha-writer", "beta-writer", "alpha-review", "beta-review"]);
|
|
976
|
+
});
|
|
977
|
+
|
|
978
|
+
it("accepts awaited and returned handlers on portable plain helper wrappers", async () => {
|
|
657
979
|
const handlers = [
|
|
658
980
|
{ name: "then", chain: "then((value) => value)" },
|
|
659
981
|
{ name: "catch", chain: "catch(() => ({ output: 'fallback' }))" },
|
|
@@ -664,7 +986,7 @@ describe("scripted workflow runtime", () => {
|
|
|
664
986
|
const key = `${mode}-${name}`;
|
|
665
987
|
const expression = `helper().${chain}`;
|
|
666
988
|
const result = await runWorkflowScript({
|
|
667
|
-
script: `
|
|
989
|
+
script: `function helper() { return runs.run("${key}", { agent: "worker", task: "run" }); } ${mode === "await" ? `const child = await ${expression}; return child.output;` : `return ${expression};`}`,
|
|
668
990
|
timeoutMs: 2_000,
|
|
669
991
|
async launch(key) { return { key, ok: true, output: "helper chain output", artifactPaths: [] }; },
|
|
670
992
|
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
@@ -674,23 +996,11 @@ describe("scripted workflow runtime", () => {
|
|
|
674
996
|
}
|
|
675
997
|
});
|
|
676
998
|
|
|
677
|
-
it("
|
|
678
|
-
await assert.rejects(
|
|
679
|
-
runWorkflowScript({
|
|
680
|
-
script: `async function inner() { return runs.run("nested-bare", { agent: "worker", task: "run" }); } async function outer() { return inner(); } outer(); return "done";`,
|
|
681
|
-
timeoutMs: 2_000,
|
|
682
|
-
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
683
|
-
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
684
|
-
}),
|
|
685
|
-
(error: unknown) => error instanceof WorkflowScriptError && error.message.includes("unawaited runs.run launch(es): 'nested-bare'"),
|
|
686
|
-
);
|
|
687
|
-
});
|
|
688
|
-
|
|
689
|
-
it("accepts awaited and returned nested async helper wrappers", async () => {
|
|
999
|
+
it("accepts awaited and returned nested plain helper wrappers", async () => {
|
|
690
1000
|
for (const mode of ["await", "return"] as const) {
|
|
691
1001
|
const key = `nested-${mode}`;
|
|
692
1002
|
const result = await runWorkflowScript({
|
|
693
|
-
script: `
|
|
1003
|
+
script: `function inner() { return runs.run("${key}", { agent: "worker", task: "run" }); } function outer() { return inner(); } ${mode === "await" ? "const child = await outer(); return child.output;" : "return outer();"}`,
|
|
694
1004
|
timeoutMs: 2_000,
|
|
695
1005
|
async launch(key) { return { key, ok: true, output: "nested output", artifactPaths: [] }; },
|
|
696
1006
|
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
@@ -699,35 +1009,6 @@ describe("scripted workflow runtime", () => {
|
|
|
699
1009
|
}
|
|
700
1010
|
});
|
|
701
1011
|
|
|
702
|
-
it("counts an explicit internal helper await as observed", async () => {
|
|
703
|
-
const result = await runWorkflowScript({
|
|
704
|
-
script: `async function helper() { return await runs.run("internal-await", { agent: "worker", task: "run" }); } helper(); return "done";`,
|
|
705
|
-
timeoutMs: 2_000,
|
|
706
|
-
async launch(key) { return { key, ok: true, output: "helper output", artifactPaths: [] }; },
|
|
707
|
-
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
708
|
-
});
|
|
709
|
-
assert.equal(result.value, "done");
|
|
710
|
-
});
|
|
711
|
-
|
|
712
|
-
it("rejects detached handlers on async helper wrappers", async () => {
|
|
713
|
-
const handlers = [
|
|
714
|
-
{ key: "async-then", chain: "then(() => {})" },
|
|
715
|
-
{ key: "async-catch", chain: "catch(() => {})" },
|
|
716
|
-
{ key: "async-finally", chain: "finally(() => {})" },
|
|
717
|
-
];
|
|
718
|
-
for (const { key, chain } of handlers) {
|
|
719
|
-
await assert.rejects(
|
|
720
|
-
runWorkflowScript({
|
|
721
|
-
script: `async function helper() { return runs.run("${key}", { agent: "worker", task: "run" }); } helper().${chain}; return "done";`,
|
|
722
|
-
timeoutMs: 2_000,
|
|
723
|
-
async launch(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
724
|
-
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
725
|
-
}),
|
|
726
|
-
(error: unknown) => error instanceof WorkflowScriptError && error.message.includes(`unawaited runs.run launch(es): '${key}'`),
|
|
727
|
-
);
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
|
|
731
1012
|
it("rejects a launch passed to an ignored repeated Promise resolution", async () => {
|
|
732
1013
|
await assert.rejects(
|
|
733
1014
|
runWorkflowScript({
|
|
@@ -787,7 +1068,9 @@ describe("scripted workflow runtime", () => {
|
|
|
787
1068
|
},
|
|
788
1069
|
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
789
1070
|
}),
|
|
790
|
-
(error: unknown) => error instanceof WorkflowScriptError
|
|
1071
|
+
(error: unknown) => error instanceof WorkflowScriptError
|
|
1072
|
+
&& error.message.includes("unawaited runs.run launch(es): 'x'")
|
|
1073
|
+
&& error.message.includes("do not read .output from unawaited launches"),
|
|
791
1074
|
);
|
|
792
1075
|
});
|
|
793
1076
|
|
|
@@ -1235,4 +1518,36 @@ describe("scripted workflow runtime", () => {
|
|
|
1235
1518
|
await new Promise((resolve) => queueMicrotask(resolve));
|
|
1236
1519
|
assert.equal(traceLengths.at(-1), finalTraceLength);
|
|
1237
1520
|
});
|
|
1521
|
+
|
|
1522
|
+
it("keeps every child alive when a host trace callback throws", async () => {
|
|
1523
|
+
// Regression: hosts persist a status journal from onTrace, and onTrace is called
|
|
1524
|
+
// from inside the run-promise handlers. A failed status write used to reject the
|
|
1525
|
+
// child promise, so one locked status.json marked a finished child failed and
|
|
1526
|
+
// aborted its still-running siblings through Promise.all inside runs.all.
|
|
1527
|
+
let thrown = 0;
|
|
1528
|
+
const abortedWhileRunning: string[] = [];
|
|
1529
|
+
const result = await runWorkflowScript({
|
|
1530
|
+
script: `return await runs.all([{ key: "a", agent: "worker", task: "one" }, { key: "b", agent: "worker", task: "two" }, { key: "c", agent: "worker", task: "three" }]);`,
|
|
1531
|
+
timeoutMs: 5_000,
|
|
1532
|
+
onTrace(trace) {
|
|
1533
|
+
if (thrown === 0 && trace.some((entry) => entry.operation === "run" && entry.state === "completed")) {
|
|
1534
|
+
thrown += 1;
|
|
1535
|
+
throw Object.assign(new Error("EPERM: operation not permitted, rename"), { code: "EPERM" });
|
|
1536
|
+
}
|
|
1537
|
+
},
|
|
1538
|
+
async launch(key, _params, signal) {
|
|
1539
|
+
if (key !== "a") await new Promise((resolve) => setTimeout(resolve, 10));
|
|
1540
|
+
if (signal?.aborted) abortedWhileRunning.push(key);
|
|
1541
|
+
return { key, ok: true, output: `${key} done`, artifactPaths: [] };
|
|
1542
|
+
},
|
|
1543
|
+
async status(key) { return { key, ok: true, output: "ok", artifactPaths: [] }; },
|
|
1544
|
+
});
|
|
1545
|
+
|
|
1546
|
+
assert.equal(thrown, 1, "the trace callback should have thrown once");
|
|
1547
|
+
assert.deepEqual(abortedWhileRunning, [], "no sibling should be aborted by a journal failure");
|
|
1548
|
+
const children = result.value as Array<{ key: string; ok: boolean }>;
|
|
1549
|
+
assert.deepEqual(children.map((child) => child.key), ["a", "b", "c"]);
|
|
1550
|
+
assert.ok(children.every((child) => child.ok), "every child should still report success");
|
|
1551
|
+
assert.equal(result.children.filter((child) => !child.ok).length, 0);
|
|
1552
|
+
});
|
|
1238
1553
|
});
|
|
@@ -113,6 +113,19 @@ describe("session revival leases", () => {
|
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
+
it("acquires a lease without a ps start probe when the platform has none", {
|
|
117
|
+
skip: process.platform === "linux" || process.platform === "win32" ? "platform has a native start probe" : undefined,
|
|
118
|
+
}, () => {
|
|
119
|
+
const { root, leases, sessionFile } = fixture("pi-session-lease-no-ps-");
|
|
120
|
+
try {
|
|
121
|
+
const lease = acquireSessionLease(request(sessionFile, "no-ps"), { rootDir: leases });
|
|
122
|
+
assert.match(lease.owner.processStartIdentity ?? "", /^runtime:/);
|
|
123
|
+
lease.release();
|
|
124
|
+
} finally {
|
|
125
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
116
129
|
it("keys aliases by the canonical session path", { skip: process.platform === "win32" ? "symlink creation is not portable on Windows CI" : undefined }, () => {
|
|
117
130
|
const { root, leases, sessionFile } = fixture("pi-session-lease-canonical-");
|
|
118
131
|
try {
|
|
@@ -686,7 +686,7 @@ Fallback global agent.
|
|
|
686
686
|
|
|
687
687
|
assert.throws(
|
|
688
688
|
() => resolveSkills(["missing-skill"], tempDir),
|
|
689
|
-
/Failed to read skills settings file .+\.
|
|
689
|
+
/Failed to read skills settings file .+\.pi[\\/]settings\.json/,
|
|
690
690
|
);
|
|
691
691
|
});
|
|
692
692
|
|