@selesai/code 0.13.0 → 0.13.2
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 +22 -0
- package/dist/core/agent-session.d.ts +1 -1
- package/dist/core/agent-session.js +1 -1
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.js +1 -1
- package/dist/core/system-prompt.d.ts +1 -1
- package/dist/core/system-prompt.js +1 -1
- package/dist/extensions/package.json +1 -2
- package/dist/extensions/pi-hermes-memory/CHANGELOG.md +371 -0
- package/dist/extensions/pi-hermes-memory/LICENSE +21 -0
- package/dist/extensions/pi-hermes-memory/README.md +643 -0
- package/dist/extensions/pi-hermes-memory/docs/0.1/TASKS.md +197 -0
- package/dist/extensions/pi-hermes-memory/docs/0.2/PLAN.md +290 -0
- package/dist/extensions/pi-hermes-memory/docs/0.2/TASKS.md +134 -0
- package/dist/extensions/pi-hermes-memory/docs/0.2/TEST-PLAN.md +216 -0
- package/dist/extensions/pi-hermes-memory/docs/0.3/PLAN.md +330 -0
- package/dist/extensions/pi-hermes-memory/docs/0.3/TASKS.md +125 -0
- package/dist/extensions/pi-hermes-memory/docs/0.4/PLAN.md +160 -0
- package/dist/extensions/pi-hermes-memory/docs/0.4/TASKS.md +113 -0
- package/dist/extensions/pi-hermes-memory/docs/0.6/CHANGELOG.md +57 -0
- package/dist/extensions/pi-hermes-memory/docs/0.6/PLAN.md +202 -0
- package/dist/extensions/pi-hermes-memory/docs/0.6/TASKS.md +144 -0
- package/dist/extensions/pi-hermes-memory/docs/0.7/PLAN.md +349 -0
- package/dist/extensions/pi-hermes-memory/docs/0.7/TASKS.md +110 -0
- package/dist/extensions/pi-hermes-memory/docs/PUBLISHING.md +149 -0
- package/dist/extensions/pi-hermes-memory/docs/ROADMAP.md +468 -0
- package/dist/extensions/pi-hermes-memory/docs/images/memory-architecture.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/images/pi-logo.svg +22 -0
- package/dist/extensions/pi-hermes-memory/docs/images/pi_memory.png +0 -0
- package/dist/extensions/pi-hermes-memory/docs/images/pi_memory.svg +19 -0
- package/dist/extensions/pi-hermes-memory/docs/images/security-flow.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/images/session-lifecycle.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/images/source-architecture.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/memory-architecture.mmd +49 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/security-flow.mmd +40 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/session-lifecycle.mmd +56 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/source-architecture.mmd +54 -0
- package/dist/extensions/pi-hermes-memory/package-lock.json +3799 -0
- package/dist/extensions/pi-hermes-memory/package.json +66 -0
- package/dist/extensions/pi-hermes-memory/scripts/check-min-sdk.mjs +99 -0
- package/dist/extensions/pi-hermes-memory/scripts/ensure-dev.mjs +57 -0
- package/dist/extensions/pi-hermes-memory/src/auto-consolidation-warning.ts +6 -0
- package/dist/extensions/pi-hermes-memory/src/config.ts +178 -0
- package/dist/extensions/pi-hermes-memory/src/constants.ts +424 -0
- package/dist/extensions/pi-hermes-memory/src/extension-root-migration.ts +639 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/auto-consolidate.ts +401 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/background-review.ts +297 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/child-process-watchdog.mjs +90 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/correction-detector.ts +300 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/index-sessions.ts +86 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/insights.ts +78 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/interview.ts +37 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/learn-memory.ts +186 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/message-parts.ts +27 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/pi-child-process.ts +485 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/preview-context.ts +105 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/review-memory-ops.ts +506 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/session-backfill.ts +145 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/session-flush.ts +151 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/session-live-index.ts +94 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/skills-command.ts +1334 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/standing-pin.ts +111 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/switch-project.ts +75 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/sync-markdown-memories.ts +266 -0
- package/dist/extensions/pi-hermes-memory/src/index.ts +378 -0
- package/dist/extensions/pi-hermes-memory/src/lifecycle-timing.ts +54 -0
- package/dist/extensions/pi-hermes-memory/src/paths.ts +61 -0
- package/dist/extensions/pi-hermes-memory/src/project-context.ts +13 -0
- package/dist/extensions/pi-hermes-memory/src/project-memory-migration.ts +93 -0
- package/dist/extensions/pi-hermes-memory/src/project.ts +157 -0
- package/dist/extensions/pi-hermes-memory/src/prompt-context.ts +55 -0
- package/dist/extensions/pi-hermes-memory/src/store/atomic-lock-coordinator.ts +375 -0
- package/dist/extensions/pi-hermes-memory/src/store/canonical-storage-path.ts +54 -0
- package/dist/extensions/pi-hermes-memory/src/store/content-scanner.ts +101 -0
- package/dist/extensions/pi-hermes-memory/src/store/db.ts +1180 -0
- package/dist/extensions/pi-hermes-memory/src/store/fts-query.ts +101 -0
- package/dist/extensions/pi-hermes-memory/src/store/markdown-mutation-lock.ts +38 -0
- package/dist/extensions/pi-hermes-memory/src/store/memory-lookup.ts +24 -0
- package/dist/extensions/pi-hermes-memory/src/store/memory-store.ts +1191 -0
- package/dist/extensions/pi-hermes-memory/src/store/recovery-maintenance.ts +66 -0
- package/dist/extensions/pi-hermes-memory/src/store/schema.ts +118 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-anchor-search.ts +472 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-indexer.ts +511 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-parser.ts +213 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-search.ts +234 -0
- package/dist/extensions/pi-hermes-memory/src/store/skill-store.ts +950 -0
- package/dist/extensions/pi-hermes-memory/src/store/skill-utils.ts +133 -0
- package/dist/extensions/pi-hermes-memory/src/store/sqlite-memory-store.ts +1002 -0
- package/dist/extensions/pi-hermes-memory/src/store/sqlite-native.ts +241 -0
- package/dist/extensions/pi-hermes-memory/src/store/standing-instructions.ts +247 -0
- package/dist/extensions/pi-hermes-memory/src/tools/memory-search-tool.ts +95 -0
- package/dist/extensions/pi-hermes-memory/src/tools/memory-tool.ts +469 -0
- package/dist/extensions/pi-hermes-memory/src/tools/session-search-tool.ts +246 -0
- package/dist/extensions/pi-hermes-memory/src/tools/shared-output-view.ts +170 -0
- package/dist/extensions/pi-hermes-memory/src/tools/skill-tool.ts +333 -0
- package/dist/extensions/pi-hermes-memory/src/tools/tool-result-views.ts +105 -0
- package/dist/extensions/pi-hermes-memory/src/types.ts +214 -0
- package/dist/extensions/pi-hermes-memory/tests/config.test.ts +434 -0
- package/dist/extensions/pi-hermes-memory/tests/extension-root-migration.test.ts +368 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/auto-consolidate.test.ts +984 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/background-review.test.ts +950 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/correction-detector.test.ts +671 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/insights.test.ts +157 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/interview.test.ts +127 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/pi-child-process.test.ts +905 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/preview-context.test.ts +152 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/prompt-context.test.ts +166 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/resources-discover.test.ts +71 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/review-memory-ops.test.ts +614 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-backfill.test.ts +192 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-flush.test.ts +677 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-live-index.test.ts +225 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/skills-command.test.ts +827 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/standing-pin.test.ts +134 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/sync-markdown-memories.test.ts +491 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/system-prompt.test.ts +199 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/thinking-max.test.ts +64 -0
- package/dist/extensions/pi-hermes-memory/tests/index.test.ts +30 -0
- package/dist/extensions/pi-hermes-memory/tests/integration/flow.test.ts +126 -0
- package/dist/extensions/pi-hermes-memory/tests/lifecycle-timing.test.ts +76 -0
- package/dist/extensions/pi-hermes-memory/tests/paths.test.ts +23 -0
- package/dist/extensions/pi-hermes-memory/tests/project-memory-migration.test.ts +80 -0
- package/dist/extensions/pi-hermes-memory/tests/project-rebinding.test.ts +115 -0
- package/dist/extensions/pi-hermes-memory/tests/project.test.ts +120 -0
- package/dist/extensions/pi-hermes-memory/tests/run-all-timeout.test.ts +107 -0
- package/dist/extensions/pi-hermes-memory/tests/run-all.sh +45 -0
- package/dist/extensions/pi-hermes-memory/tests/store/atomic-lock-coordinator.test.ts +381 -0
- package/dist/extensions/pi-hermes-memory/tests/store/content-scanner.test.ts +388 -0
- package/dist/extensions/pi-hermes-memory/tests/store/db.test.ts +1046 -0
- package/dist/extensions/pi-hermes-memory/tests/store/markdown-mutation-lock.test.ts +34 -0
- package/dist/extensions/pi-hermes-memory/tests/store/memory-store.test.ts +2150 -0
- package/dist/extensions/pi-hermes-memory/tests/store/recovery-maintenance.test.ts +170 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-anchor-search.test.ts +210 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-indexer.test.ts +643 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-parser.test.ts +282 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-search.test.ts +287 -0
- package/dist/extensions/pi-hermes-memory/tests/store/skill-store.test.ts +678 -0
- package/dist/extensions/pi-hermes-memory/tests/store/skill-utils.test.ts +21 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-lazy-load.test.ts +78 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-memory-store.test.ts +543 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-native.test.ts +164 -0
- package/dist/extensions/pi-hermes-memory/tests/store/standing-instructions.test.ts +171 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/memory-search-tool.test.ts +84 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/memory-tool.test.ts +709 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/session-search-tool.test.ts +345 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/shared-output-view.test.ts +362 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/skill-tool.test.ts +478 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/tool-result-renderer-wiring.test.ts +40 -0
- package/dist/extensions/pi-hermes-memory/tsconfig.json +19 -0
- package/dist/extensions/pi-rewind-hook/README.md +4 -1
- package/dist/extensions/pi-rewind-hook/index.ts +151 -21
- package/dist/extensions/pi-rewind-hook/package.json +5 -3
- package/dist/extensions/pi-subagents/.oxlintrc.json +43 -0
- package/dist/extensions/pi-subagents/AGENTS.md +5 -0
- package/dist/extensions/pi-subagents/CHANGELOG.md +157 -0
- package/dist/extensions/pi-subagents/README.md +12 -6
- package/dist/extensions/pi-subagents/VISION.md +81 -0
- package/dist/extensions/pi-subagents/agents/claude-code-writer.md +15 -0
- package/dist/extensions/pi-subagents/agents/claude-code.md +15 -0
- package/dist/extensions/pi-subagents/agents/codex-exec-writer.md +15 -0
- package/dist/extensions/pi-subagents/agents/codex-exec.md +15 -0
- package/dist/extensions/pi-subagents/agents/cursor-agent-writer.md +14 -0
- package/dist/extensions/pi-subagents/agents/cursor-agent.md +14 -0
- package/dist/extensions/pi-subagents/agents/reviewer.md +1 -3
- package/dist/extensions/pi-subagents/docs/agents.md +488 -0
- package/dist/extensions/pi-subagents/docs/configuration.md +46 -9
- package/dist/extensions/pi-subagents/docs/extension-api.md +42 -3
- package/dist/extensions/pi-subagents/docs/models.md +27 -4
- package/dist/extensions/pi-subagents/docs/observability.md +10 -9
- package/dist/extensions/pi-subagents/docs/tool-reference.md +102 -6
- package/dist/extensions/pi-subagents/docs/workflows.md +135 -0
- package/dist/extensions/pi-subagents/package-lock.json +389 -2
- package/dist/extensions/pi-subagents/package.json +3 -1
- package/dist/extensions/pi-subagents/prompts/review-loop.md +2 -2
- package/dist/extensions/pi-subagents/skills/council-mode/SKILL.md +1 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +3 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +7 -3
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +2 -2
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +26 -5
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +41 -22
- package/dist/extensions/pi-subagents/src/agents/agent-refinements.ts +4 -4
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +9 -2
- package/dist/extensions/pi-subagents/src/agents/agents.ts +322 -75
- package/dist/extensions/pi-subagents/src/agents/builtin-names.ts +6 -0
- package/dist/extensions/pi-subagents/src/agents/runtime-agent-events.ts +70 -0
- package/dist/extensions/pi-subagents/src/agents/runtime-agent-registry.ts +27 -20
- package/dist/extensions/pi-subagents/src/api/agents.ts +10 -5
- package/dist/extensions/pi-subagents/src/api/background-work.ts +5 -1
- package/dist/extensions/pi-subagents/src/api/delegation.ts +0 -7
- package/dist/extensions/pi-subagents/src/api/preflight.ts +34 -12
- package/dist/extensions/pi-subagents/src/extension/config.ts +70 -0
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +3 -3
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +5 -3
- package/dist/extensions/pi-subagents/src/extension/index.ts +83 -30
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +44 -15
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +55 -19
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +41 -15
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +28 -31
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +2 -1
- package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +2 -10
- package/dist/extensions/pi-subagents/src/inspectors/herdr/session-roots-codec.ts +42 -0
- package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +51 -7
- package/dist/extensions/pi-subagents/src/intercom/result-intercom.ts +2 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +5 -6
- package/dist/extensions/pi-subagents/src/runs/background/active-async-capacity.ts +77 -10
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +176 -53
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +19 -12
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +29 -27
- package/dist/extensions/pi-subagents/src/runs/background/async-retention.ts +20 -3
- package/dist/extensions/pi-subagents/src/runs/background/async-status-snapshot.ts +23 -261
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +73 -7
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +8 -3
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +74 -8
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +37 -21
- package/dist/extensions/pi-subagents/src/runs/background/inspect-rpc.ts +8 -8
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +184 -9
- package/dist/extensions/pi-subagents/src/runs/background/result-delivery-ownership.ts +45 -0
- package/dist/extensions/pi-subagents/src/runs/background/result-files.ts +28 -14
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +38 -15
- package/dist/extensions/pi-subagents/src/runs/background/resume-guidance.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +50 -13
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +93 -8
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +10 -4
- package/dist/extensions/pi-subagents/src/runs/background/steering.ts +4 -14
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +549 -377
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +58 -10
- package/dist/extensions/pi-subagents/src/runs/background/terminal-run-index.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +26 -1
- package/dist/extensions/pi-subagents/src/runs/background/wait-config.ts +23 -9
- package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +9 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +204 -129
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-control.ts +9 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +23 -1
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +773 -311
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-detach-reconcile.ts +140 -115
- package/dist/extensions/pi-subagents/src/runs/shared/abort-recovery.ts +119 -0
- package/dist/extensions/pi-subagents/src/runs/shared/async-status-projection.ts +463 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-identity.ts +19 -4
- package/dist/extensions/pi-subagents/src/runs/shared/child-launch-plan.ts +151 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-protocol.ts +21 -7
- package/dist/extensions/pi-subagents/src/runs/shared/claude-code-adapter.ts +129 -0
- package/dist/extensions/pi-subagents/src/runs/shared/codex-exec-adapter.ts +129 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-evidence.ts +89 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +5 -4
- package/dist/extensions/pi-subagents/src/runs/shared/cursor-agent-adapter.ts +114 -0
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-contract.ts +167 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-preflight.ts +122 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +348 -55
- package/dist/extensions/pi-subagents/src/runs/shared/fast-mode-extension.ts +5 -5
- package/dist/extensions/pi-subagents/src/runs/shared/host-step-status.ts +230 -0
- package/dist/extensions/pi-subagents/src/runs/shared/lane-metadata.ts +105 -0
- package/dist/extensions/pi-subagents/src/runs/shared/launch-cwd.ts +16 -0
- package/dist/extensions/pi-subagents/src/runs/shared/long-running-guard.ts +2 -1
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-config-sources.ts +422 -0
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +221 -158
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-grant.ts +197 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-exclusions.ts +69 -7
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +47 -6
- package/dist/extensions/pi-subagents/src/runs/shared/mutation-evidence.ts +7 -2
- package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +9 -3
- package/dist/extensions/pi-subagents/src/runs/shared/nested-render.ts +9 -5
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +419 -7
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +15 -1
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +81 -8
- package/dist/extensions/pi-subagents/src/runs/shared/process-signal.ts +13 -0
- package/dist/extensions/pi-subagents/src/runs/shared/run-history.ts +21 -1
- package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +44 -4
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +98 -13
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-startup-retry.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/worktree-cleanup-plan.ts +847 -0
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +18 -0
- package/dist/extensions/pi-subagents/src/shared/child-session-name.ts +46 -0
- package/dist/extensions/pi-subagents/src/shared/extension-context.ts +24 -0
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +21 -0
- package/dist/extensions/pi-subagents/src/shared/formatters.ts +18 -3
- package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +5 -1
- package/dist/extensions/pi-subagents/src/shared/pruned-fork.ts +450 -0
- package/dist/extensions/pi-subagents/src/shared/session-file-trust.ts +19 -0
- package/dist/extensions/pi-subagents/src/shared/session-tokens.ts +14 -3
- package/dist/extensions/pi-subagents/src/shared/settings.ts +19 -105
- package/dist/extensions/pi-subagents/src/shared/shortcuts.ts +17 -0
- package/dist/extensions/pi-subagents/src/shared/types.ts +359 -40
- package/dist/extensions/pi-subagents/src/shared/utils.ts +41 -84
- package/dist/extensions/pi-subagents/src/shared/workflow-child-permit.ts +116 -0
- package/dist/extensions/pi-subagents/src/slash/delegation-adapters.ts +1 -9
- package/dist/extensions/pi-subagents/src/slash/delegation-request.ts +0 -4
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +1 -2
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +378 -88
- package/dist/extensions/pi-subagents/src/slash/slash-live-state.ts +22 -11
- package/dist/extensions/pi-subagents/src/slash/subagents-admin.ts +3 -0
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +147 -79
- package/dist/extensions/pi-subagents/src/tui/fleet-transcript.ts +11 -5
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +39 -18
- package/dist/extensions/pi-subagents/src/tui/render.ts +369 -46
- package/dist/extensions/pi-subagents/src/watchdog/turn-delta.ts +1 -1
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +6 -3
- package/dist/extensions/pi-subagents/src/workflows/host-command.ts +230 -0
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +740 -58
- package/dist/extensions/pi-subagents/src/workflows/workflow-child-summary.ts +121 -0
- package/dist/extensions/pi-subagents/src/workflows/workflow-preflight.ts +270 -0
- package/dist/extensions/pi-subagents/src/workflows/workflow-receipt.ts +195 -6
- package/dist/extensions/pi-subagents/src/workflows/workflow-settlement.ts +246 -0
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +1114 -260
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +34 -0
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +150 -3
- package/dist/extensions/pi-subagents/test/integration/claude-code-smoke.test.ts +52 -0
- package/dist/extensions/pi-subagents/test/integration/claude-code-writer-smoke.test.ts +55 -0
- package/dist/extensions/pi-subagents/test/integration/codex-exec-smoke.test.ts +53 -0
- package/dist/extensions/pi-subagents/test/integration/codex-exec-writer-smoke.test.ts +57 -0
- package/dist/extensions/pi-subagents/test/integration/cursor-agent-smoke.test.ts +59 -0
- package/dist/extensions/pi-subagents/test/integration/cursor-agent-writer-smoke.test.ts +62 -0
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +57 -1
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +20 -0
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +4 -3
- package/dist/extensions/pi-subagents/test/integration/orca-progress-tabs.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +54 -4
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +482 -4
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +157 -9
- package/dist/extensions/pi-subagents/test/integration/session-tokens.test.ts +5 -5
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +1508 -291
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +423 -1
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +8 -0
- package/dist/extensions/pi-subagents/test/support/cursor-smoke-inputs.ts +51 -0
- package/dist/extensions/pi-subagents/test/support/helpers.ts +2 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +5 -5
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +6 -6
- package/dist/extensions/pi-subagents/test/unit/abort-recovery.test.ts +152 -0
- package/dist/extensions/pi-subagents/test/unit/active-async-capacity.test.ts +48 -0
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +184 -6
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +66 -6
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +77 -0
- package/dist/extensions/pi-subagents/test/unit/agent-refinements.test.ts +18 -0
- package/dist/extensions/pi-subagents/test/unit/anti-slop-oxlint.test.ts +86 -0
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +101 -1
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +121 -0
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +28 -0
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +14 -7
- package/dist/extensions/pi-subagents/test/unit/async-retention.test.ts +53 -0
- package/dist/extensions/pi-subagents/test/unit/async-status-projection.test.ts +190 -0
- package/dist/extensions/pi-subagents/test/unit/async-status-snapshot.test.ts +42 -0
- package/dist/extensions/pi-subagents/test/unit/auto-drain.test.ts +8 -4
- package/dist/extensions/pi-subagents/test/unit/background-work.test.ts +23 -0
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +78 -1
- package/dist/extensions/pi-subagents/test/unit/child-launch-plan.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/unit/child-protocol.test.ts +21 -0
- package/dist/extensions/pi-subagents/test/unit/child-session-name.test.ts +50 -0
- package/dist/extensions/pi-subagents/test/unit/claude-code-adapter.test.ts +245 -0
- package/dist/extensions/pi-subagents/test/unit/codex-exec-adapter.test.ts +192 -0
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +27 -0
- package/dist/extensions/pi-subagents/test/unit/completion-evidence.test.ts +150 -0
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +21 -0
- package/dist/extensions/pi-subagents/test/unit/cursor-agent-adapter.test.ts +259 -0
- package/dist/extensions/pi-subagents/test/unit/cursor-smoke-inputs.test.ts +77 -0
- package/dist/extensions/pi-subagents/test/unit/delegation-api.test.ts +1 -4
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/extension-context.test.ts +27 -0
- package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +223 -0
- package/dist/extensions/pi-subagents/test/unit/fast-mode-extension.test.ts +27 -0
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +208 -2
- package/dist/extensions/pi-subagents/test/unit/fleet-transcript.test.ts +29 -1
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +110 -1
- package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +10 -0
- package/dist/extensions/pi-subagents/test/unit/formatters.test.ts +14 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +18 -9
- package/dist/extensions/pi-subagents/test/unit/herdr-session-roots-codec.test.ts +63 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-shell-command.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +136 -6
- package/dist/extensions/pi-subagents/test/unit/host-command.test.ts +156 -0
- package/dist/extensions/pi-subagents/test/unit/host-step-status.test.ts +98 -0
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +178 -26
- package/dist/extensions/pi-subagents/test/unit/index-segment.test.ts +2 -1
- package/dist/extensions/pi-subagents/test/unit/inspect-rpc.test.ts +21 -0
- package/dist/extensions/pi-subagents/test/unit/mcp-direct-tool-grant.test.ts +138 -0
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/model-exclusions.test.ts +91 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +72 -7
- package/dist/extensions/pi-subagents/test/unit/mutation-evidence.test.ts +21 -0
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +20 -2
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +129 -1
- package/dist/extensions/pi-subagents/test/unit/orca-progress-tabs.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +4 -0
- package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +358 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +574 -21
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +109 -1
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +71 -1
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +7 -7
- package/dist/extensions/pi-subagents/test/unit/pruned-fork.test.ts +214 -0
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +29 -8
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +53 -0
- package/dist/extensions/pi-subagents/test/unit/result-delivery-ownership.test.ts +34 -0
- package/dist/extensions/pi-subagents/test/unit/result-files.test.ts +101 -3
- package/dist/extensions/pi-subagents/test/unit/retained-children.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +10 -8
- package/dist/extensions/pi-subagents/test/unit/run-fanout-budget.test.ts +71 -1
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +41 -7
- package/dist/extensions/pi-subagents/test/unit/runtime-agent-registration.test.ts +136 -2
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +137 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +33 -12
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +504 -1
- package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +8 -0
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +12 -1
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +3 -5
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +5 -6
- package/dist/extensions/pi-subagents/test/unit/subagent-action-recovery.test.ts +0 -8
- package/dist/extensions/pi-subagents/test/unit/subagent-guide.test.ts +5 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +157 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-startup-retry.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +63 -4
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +27 -23
- package/dist/extensions/pi-subagents/test/unit/wait-completions.test.ts +44 -0
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +7 -5
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +106 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-detach-reconcile.test.ts +484 -9
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +38 -4
- package/dist/extensions/pi-subagents/test/unit/workflow-preflight.test.ts +155 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-receipt.test.ts +318 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-resume-hint.test.ts +365 -0
- package/dist/extensions/pi-subagents/test/unit/worktree-cleanup-plan.test.ts +349 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +21 -0
- package/dist/extensions/pi-subagents/test/unit/writer-budget-guidance.test.ts +2 -7
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/effect/index.ts +13 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/effect/rules/no-service-constructor-imports.ts +52 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/index.ts +41 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-chained-type-assertions.ts +77 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-conditional-empty-object-spread.ts +49 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-known-value-widening.ts +247 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-module-mocking.ts +91 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-object-parameters.ts +126 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-reflect-apply.ts +28 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-reflect-get.ts +28 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-runtime-typeof.ts +67 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-shape-in-symbol-names.ts +39 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unknown-parameters.ts +83 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unknown-returns.ts +115 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unknown-type-aliases.ts +72 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unsafe-dictionary-type.ts +134 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-widen-then-assert.ts +366 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/require-safety-comment-for-type-assertion.ts +62 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/shared/dictionary-types.ts +502 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/shared/lexical-type-parameters.ts +60 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/shared/reflect-method.ts +35 -0
- package/dist/extensions/pi-tool-display/tests/capabilities.test.ts +1 -1
- package/dist/extensions/pi-tool-display/tests/settings-inspector.test.ts +2 -2
- package/dist/extensions/pi-tool-display/tests/tool-overrides-mcp.test.ts +1 -1
- package/dist/modes/interactive/interactive-mode.js +7 -7
- package/dist/skills/workflow/SKILL.md +65 -50
- package/package.json +112 -110
- package/dist/extensions/enable-readonly-tools.test.ts +0 -63
- package/dist/extensions/enable-readonly-tools.ts +0 -24
- package/dist/extensions/model-prompt-injector/config.json +0 -16
- package/dist/extensions/model-prompt-injector/index.test.ts +0 -102
- package/dist/extensions/model-prompt-injector/index.ts +0 -148
- package/dist/extensions/pi-subagents/src/runs/shared/turn-budget.ts +0 -98
- package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +0 -250
|
@@ -147,8 +147,15 @@ describe("reconcileDetachedWorkflowChildCompletion", () => {
|
|
|
147
147
|
it("publishes a terminal result when the paused result file is already gone", () => {
|
|
148
148
|
const workflowRunId = "workflow-missing-result";
|
|
149
149
|
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
150
|
+
const childDir = path.join(DIRS.async, "child-1");
|
|
151
|
+
const requestedPath = path.join(asyncDir, "requested.md");
|
|
152
|
+
const savedPath = path.join(asyncDir, "saved.md");
|
|
153
|
+
const sessionFile = path.join(childDir, "session.jsonl");
|
|
150
154
|
fs.mkdirSync(asyncDir, { recursive: true });
|
|
155
|
+
fs.mkdirSync(childDir, { recursive: true });
|
|
151
156
|
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
157
|
+
fs.writeFileSync(sessionFile, "", "utf-8");
|
|
158
|
+
fs.writeFileSync(path.join(childDir, "status.json"), JSON.stringify({ runId: "child-1", mode: "single", state: "complete", startedAt: 1, lastUpdate: 2, sessionId: "session-1", steps: [{ agent: "worker", status: "complete", sessionFile }] }), "utf-8");
|
|
152
159
|
const status = { ...pausedWorkflow("child-1"), runId: workflowRunId, sessionId: "session-1" };
|
|
153
160
|
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
154
161
|
writeWorkflowReceipt(asyncDir, buildWorkflowReceipt({
|
|
@@ -173,19 +180,397 @@ describe("reconcileDetachedWorkflowChildCompletion", () => {
|
|
|
173
180
|
state,
|
|
174
181
|
workflowRunId,
|
|
175
182
|
childRunId: "child-1",
|
|
176
|
-
result: { index: 0, agent: "worker", task:
|
|
183
|
+
result: { index: 0, agent: "worker", task: `Write your findings to exactly this path: ${requestedPath}`, exitCode: 0, sessionFile, savedOutputPath: savedPath, usage: { input: 100, output: 50, cacheRead: 25, cacheWrite: 5, cost: 0.001, turns: 1 } },
|
|
177
184
|
}), true);
|
|
178
|
-
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { state?: string; success?: boolean; error?: string; sessionId?: string; workflowReceipt?: { receipt?: { state?: string; entries?: Record<string, { resumability?: { state?: string; reason?: string } }> } } };
|
|
185
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { state?: string; success?: boolean; summary?: string; error?: string; sessionId?: string; workflowResolution?: string; recovery?: unknown[]; results?: Array<{ outputReference?: string; outputPathMapping?: unknown }>; workflowReceipt?: { receipt?: { state?: string; workflowResolution?: string; recovery?: unknown[]; entries?: Record<string, { resumability?: { state?: string; reason?: string } }> } } };
|
|
179
186
|
assert.equal(published.state, "failed");
|
|
180
187
|
assert.equal(published.success, false);
|
|
181
188
|
assert.match(published.error ?? "", /unsupported-continuation/);
|
|
189
|
+
assert.equal(published.workflowResolution, "settled-awaiting-resume");
|
|
190
|
+
assert.match(published.summary ?? "", /Workflow lanes settled/);
|
|
191
|
+
assert.deepEqual(published.recovery, [{ key: "detaches", call: "runs.run", resume: { workflowRunId, key: "detaches", latest: true }, taskRequired: true }]);
|
|
192
|
+
assert.ok(published.summary?.includes(`Output path mappings: 'detaches': requested ${requestedPath} -> saved ${savedPath}`));
|
|
193
|
+
assert.equal(published.results?.[0]?.outputReference, savedPath);
|
|
194
|
+
assert.deepEqual(published.results?.[0]?.outputPathMapping, { requestedPath, savedPath });
|
|
195
|
+
const publishedChild = published.results?.[0] as { usage?: unknown; sessionFile?: string } | undefined;
|
|
196
|
+
assert.deepEqual(publishedChild?.usage, { input: 100, output: 50, cacheRead: 25, cacheWrite: 5, cost: 0.001, turns: 1 });
|
|
197
|
+
assert.equal(publishedChild?.sessionFile, sessionFile);
|
|
182
198
|
assert.equal(published.sessionId, "session-1");
|
|
183
199
|
assert.equal(published.workflowReceipt?.receipt?.state, "failed");
|
|
184
|
-
assert.equal(published.workflowReceipt?.receipt?.
|
|
185
|
-
assert.
|
|
200
|
+
assert.equal(published.workflowReceipt?.receipt?.workflowResolution, "settled-awaiting-resume");
|
|
201
|
+
assert.deepEqual(published.workflowReceipt?.receipt?.recovery, published.recovery);
|
|
202
|
+
assert.equal(published.workflowReceipt?.receipt?.entries?.detaches?.resumability?.state, "resumable");
|
|
186
203
|
const events = fs.readFileSync(path.join(asyncDir, "events.jsonl"), "utf-8");
|
|
187
204
|
assert.match(events, /"type":"subagent.workflow.completed"/);
|
|
188
205
|
assert.match(events, /"state":"failed"/);
|
|
206
|
+
assert.match(events, /"workflowResolution":"settled-awaiting-resume"/);
|
|
207
|
+
assert.match(events, /"call":"runs.run"/);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it("classifies interrupted detached settlement without losing child details", () => {
|
|
211
|
+
const workflowRunId = "workflow-interrupted-handoff";
|
|
212
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
213
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
214
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
215
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify({ ...pausedWorkflow("child-interrupted"), runId: workflowRunId, sessionId: "session-1" }), "utf-8");
|
|
216
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
217
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
218
|
+
state,
|
|
219
|
+
workflowRunId,
|
|
220
|
+
childRunId: "child-interrupted",
|
|
221
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 0, interrupted: true, error: "operator stopped child", usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
222
|
+
}), true);
|
|
223
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { workflowResolution?: string; error?: string; results?: Array<{ interrupted?: boolean; error?: string }> };
|
|
224
|
+
assert.equal(published.workflowResolution, "interrupted-child");
|
|
225
|
+
assert.equal(published.error, "operator stopped child");
|
|
226
|
+
assert.deepEqual(published.results, [{ workflowKey: "detaches", agent: "worker", runId: "child-interrupted", success: false, output: "", outputState: "absent", interrupted: true, error: "operator stopped child" }]);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it("prioritizes a failed sibling over interrupted detached evidence", () => {
|
|
230
|
+
const workflowRunId = "workflow-failed-sibling-handoff";
|
|
231
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
232
|
+
const status = { ...pausedWorkflow("child-interrupted"), runId: workflowRunId, sessionId: "session-1" };
|
|
233
|
+
status.steps!.push({ agent: "worker", workflowKey: "fails", runId: "child-failed", status: "paused", activityState: "needs_attention" });
|
|
234
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
235
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
236
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
237
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
238
|
+
let emitted: { name: string; payload: { error?: string; summary?: string; workflowResolution?: string } } | undefined;
|
|
239
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
240
|
+
state,
|
|
241
|
+
workflowRunId,
|
|
242
|
+
childRunId: "child-failed",
|
|
243
|
+
result: { index: 1, agent: "worker", task: "t", exitCode: 1, error: "sibling boom", usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
244
|
+
}), true);
|
|
245
|
+
const paused = JSON.parse(fs.readFileSync(path.join(asyncDir, "status.json"), "utf-8")) as { state?: string; error?: string; steps?: Array<{ runId?: string; error?: string }> };
|
|
246
|
+
assert.equal(paused.state, "paused");
|
|
247
|
+
assert.equal(paused.error, "Run 'worker' detached for intercom coordination.");
|
|
248
|
+
assert.equal(paused.steps?.find((step) => step.runId === "child-failed")?.error, "sibling boom");
|
|
249
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
250
|
+
state,
|
|
251
|
+
workflowRunId,
|
|
252
|
+
childRunId: "child-interrupted",
|
|
253
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 0, interrupted: true, error: "operator stopped child", usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
254
|
+
events: { emit: (name, payload) => { emitted = { name, payload: payload as { error?: string; summary?: string; workflowResolution?: string } }; } } as IntercomEventBus,
|
|
255
|
+
}), true);
|
|
256
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { workflowResolution?: string; error?: string; results?: Array<{ workflowKey?: string; interrupted?: boolean; error?: string }> };
|
|
257
|
+
assert.equal(published.workflowResolution, "failed-child");
|
|
258
|
+
assert.equal(published.error, "sibling boom");
|
|
259
|
+
assert.deepEqual(published.results?.find((child) => child.workflowKey === "detaches"), { workflowKey: "detaches", agent: "worker", runId: "child-interrupted", success: false, output: "", outputState: "absent", interrupted: true, error: "operator stopped child" });
|
|
260
|
+
assert.deepEqual(published.results?.find((child) => child.workflowKey === "fails"), { workflowKey: "fails", agent: "worker", runId: "child-failed", success: false, output: "", outputState: "absent", error: "sibling boom" });
|
|
261
|
+
assert.equal(emitted?.name, "subagent:async-complete");
|
|
262
|
+
assert.equal(emitted?.payload.summary, "sibling boom");
|
|
263
|
+
assert.equal(emitted?.payload.workflowResolution, "failed-child");
|
|
264
|
+
const events = fs.readFileSync(path.join(asyncDir, "events.jsonl"), "utf-8");
|
|
265
|
+
assert.match(events, /"workflowResolution":"failed-child"/);
|
|
266
|
+
assert.match(events, /"error":"sibling boom"/);
|
|
267
|
+
assert.doesNotMatch(events, /"error":"operator stopped child"/);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it("preserves a later failed child error after interruption settles first", () => {
|
|
271
|
+
const workflowRunId = "workflow-interrupted-first-handoff";
|
|
272
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
273
|
+
const status = { ...pausedWorkflow("child-interrupted"), runId: workflowRunId, sessionId: "session-1" };
|
|
274
|
+
status.steps!.push({ agent: "worker", workflowKey: "fails", runId: "child-failed", status: "paused", activityState: "needs_attention" });
|
|
275
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
276
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
277
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
278
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
279
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
280
|
+
state,
|
|
281
|
+
workflowRunId,
|
|
282
|
+
childRunId: "child-interrupted",
|
|
283
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 0, interrupted: true, error: "operator stopped child" },
|
|
284
|
+
}), true);
|
|
285
|
+
const paused = JSON.parse(fs.readFileSync(path.join(asyncDir, "status.json"), "utf-8")) as { state?: string; steps?: Array<{ runId?: string; error?: string; interrupted?: boolean }> };
|
|
286
|
+
assert.equal(paused.state, "paused");
|
|
287
|
+
assert.equal(paused.steps?.find((step) => step.runId === "child-interrupted")?.interrupted, true);
|
|
288
|
+
assert.equal(paused.steps?.find((step) => step.runId === "child-interrupted")?.error, "operator stopped child");
|
|
289
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
290
|
+
state,
|
|
291
|
+
workflowRunId,
|
|
292
|
+
childRunId: "child-failed",
|
|
293
|
+
result: { index: 1, agent: "worker", task: "t", exitCode: 1, error: "sibling boom" },
|
|
294
|
+
}), true);
|
|
295
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { workflowResolution?: string; error?: string; summary?: string; results?: Array<{ workflowKey?: string; error?: string; interrupted?: boolean }> };
|
|
296
|
+
assert.equal(published.workflowResolution, "failed-child");
|
|
297
|
+
assert.equal(published.error, "sibling boom");
|
|
298
|
+
assert.equal(published.summary, "sibling boom");
|
|
299
|
+
assert.equal(published.results?.find((child) => child.workflowKey === "detaches")?.error, "operator stopped child");
|
|
300
|
+
assert.equal(published.results?.find((child) => child.workflowKey === "detaches")?.interrupted, true);
|
|
301
|
+
assert.equal(published.results?.find((child) => child.workflowKey === "fails")?.error, "sibling boom");
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it("preserves an interrupted child error after a later sibling succeeds", () => {
|
|
305
|
+
const workflowRunId = "workflow-interrupted-first-success-final";
|
|
306
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
307
|
+
const status = { ...pausedWorkflow("child-interrupted"), runId: workflowRunId, sessionId: "session-1" };
|
|
308
|
+
status.steps!.push({ agent: "worker", workflowKey: "passes", runId: "child-passes", status: "paused", activityState: "needs_attention" });
|
|
309
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
310
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
311
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
312
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
313
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
314
|
+
state,
|
|
315
|
+
workflowRunId,
|
|
316
|
+
childRunId: "child-interrupted",
|
|
317
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 0, interrupted: true, error: "operator stopped child" },
|
|
318
|
+
}), true);
|
|
319
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
320
|
+
state,
|
|
321
|
+
workflowRunId,
|
|
322
|
+
childRunId: "child-passes",
|
|
323
|
+
result: { index: 1, agent: "worker", task: "t", exitCode: 0 },
|
|
324
|
+
}), true);
|
|
325
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { workflowResolution?: string; error?: string; summary?: string; results?: Array<{ workflowKey?: string; error?: string; interrupted?: boolean }> };
|
|
326
|
+
assert.equal(published.workflowResolution, "interrupted-child");
|
|
327
|
+
assert.equal(published.error, "operator stopped child");
|
|
328
|
+
assert.equal(published.summary, "operator stopped child");
|
|
329
|
+
assert.equal(published.results?.find((child) => child.workflowKey === "detaches")?.error, "operator stopped child");
|
|
330
|
+
assert.equal(published.results?.find((child) => child.workflowKey === "detaches")?.interrupted, true);
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
it("classifies a stopped detached child as interrupted evidence", () => {
|
|
334
|
+
const workflowRunId = "workflow-stopped-handoff";
|
|
335
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
336
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
337
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
338
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify({ ...pausedWorkflow("child-stopped"), runId: workflowRunId, sessionId: "session-1" }), "utf-8");
|
|
339
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
340
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
341
|
+
state,
|
|
342
|
+
workflowRunId,
|
|
343
|
+
childRunId: "child-stopped",
|
|
344
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 1, stopped: true, error: "Subagent stopped by user.", usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
345
|
+
}), true);
|
|
346
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { workflowResolution?: string; error?: string; results?: Array<{ workflowKey?: string; error?: string; interrupted?: boolean; stopped?: boolean }> };
|
|
347
|
+
assert.equal(published.workflowResolution, "interrupted-child");
|
|
348
|
+
assert.equal(published.error, "Subagent stopped by user.");
|
|
349
|
+
assert.deepEqual(published.results, [{ workflowKey: "detaches", agent: "worker", runId: "child-stopped", success: false, output: "", outputState: "absent", interrupted: true, stopped: true, error: "Subagent stopped by user." }]);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
it("reconciles a foreground child without a persisted run id", () => {
|
|
353
|
+
const workflowRunId = "workflow-unbound-foreground-handoff";
|
|
354
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
355
|
+
const sessionFile = "/tmp/current-child.jsonl";
|
|
356
|
+
const status = { ...pausedWorkflow("placeholder", { runId: undefined, sessionFile }), runId: workflowRunId, sessionId: "session-1" };
|
|
357
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
358
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
359
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
360
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
361
|
+
|
|
362
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
363
|
+
state,
|
|
364
|
+
workflowRunId,
|
|
365
|
+
childRunId: "current-child",
|
|
366
|
+
workflowKey: "detaches",
|
|
367
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 0, sessionFile },
|
|
368
|
+
}), true);
|
|
369
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { results?: Array<{ runId?: string; sessionFile?: string; success?: boolean }> };
|
|
370
|
+
assert.deepEqual(published.results, [{ workflowKey: "detaches", agent: "worker", runId: "current-child", sessionFile, success: true, output: "", outputState: "absent" }]);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
it("reconciles a live foreground child without persisted identity fields", () => {
|
|
374
|
+
const workflowRunId = "workflow-missing-identity-handoff";
|
|
375
|
+
const childRunId = "current-child";
|
|
376
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
377
|
+
const status = { ...pausedWorkflow("placeholder", { runId: undefined, sessionFile: undefined }), runId: workflowRunId, sessionId: "session-1" };
|
|
378
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
379
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
380
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
381
|
+
const state = {
|
|
382
|
+
asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]),
|
|
383
|
+
foregroundControls: new Map([[childRunId, { runId: childRunId, parentWorkflowRunId: workflowRunId, workflowKey: "detaches" }]]),
|
|
384
|
+
} as SubagentState;
|
|
385
|
+
|
|
386
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
387
|
+
state,
|
|
388
|
+
workflowRunId,
|
|
389
|
+
childRunId,
|
|
390
|
+
workflowKey: "detaches",
|
|
391
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 0, sessionFile: "/tmp/current-child.jsonl" },
|
|
392
|
+
}), true);
|
|
393
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { results?: Array<{ runId?: string; success?: boolean }> };
|
|
394
|
+
assert.equal(published.results?.[0]?.runId, childRunId);
|
|
395
|
+
assert.equal(published.results?.[0]?.success, true);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
it("does not reconcile ambiguous same-key live attempts without persisted identity", () => {
|
|
399
|
+
const workflowRunId = "workflow-ambiguous-missing-identity-handoff";
|
|
400
|
+
const childRunId = "stale-child";
|
|
401
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
402
|
+
const status = { ...pausedWorkflow("placeholder", { runId: undefined, sessionFile: undefined }), runId: workflowRunId, sessionId: "session-1" };
|
|
403
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
404
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
405
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
406
|
+
const state = {
|
|
407
|
+
asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]),
|
|
408
|
+
foregroundControls: new Map([
|
|
409
|
+
[childRunId, { runId: childRunId, parentWorkflowRunId: workflowRunId, workflowKey: "detaches" }],
|
|
410
|
+
["replacement-child", { runId: "replacement-child", parentWorkflowRunId: workflowRunId, workflowKey: "detaches" }],
|
|
411
|
+
]),
|
|
412
|
+
} as SubagentState;
|
|
413
|
+
|
|
414
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
415
|
+
state,
|
|
416
|
+
workflowRunId,
|
|
417
|
+
childRunId,
|
|
418
|
+
workflowKey: "detaches",
|
|
419
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 0, sessionFile: "/tmp/current-child.jsonl" },
|
|
420
|
+
}), false);
|
|
421
|
+
assert.equal(fs.existsSync(path.join(DIRS.results, `${workflowRunId}.json`)), false);
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
it("ignores stale completion when only the workflow key matches", () => {
|
|
425
|
+
const workflowRunId = "workflow-key-interrupted-handoff";
|
|
426
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
427
|
+
const status = { ...pausedWorkflow("placeholder", { runId: undefined, sessionFile: "/tmp/replacement-child.jsonl" }), runId: workflowRunId, sessionId: "session-1" };
|
|
428
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
429
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
430
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
431
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
432
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
433
|
+
state,
|
|
434
|
+
workflowRunId,
|
|
435
|
+
childRunId: "latest-child-run",
|
|
436
|
+
workflowKey: "detaches",
|
|
437
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 0, interrupted: true, sessionFile: "/tmp/stale-child.jsonl", usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
438
|
+
}), false);
|
|
439
|
+
const persisted = JSON.parse(fs.readFileSync(path.join(asyncDir, "status.json"), "utf-8")) as AsyncStatus;
|
|
440
|
+
assert.equal(persisted.steps?.[0]?.runId, undefined);
|
|
441
|
+
assert.equal(persisted.steps?.[0]?.sessionFile, "/tmp/replacement-child.jsonl");
|
|
442
|
+
assert.equal(persisted.steps?.[0]?.status, "paused");
|
|
443
|
+
assert.equal(fs.existsSync(path.join(DIRS.results, `${workflowRunId}.json`)), false);
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
it("classifies a stopped sibling as interrupted terminal evidence", () => {
|
|
447
|
+
const workflowRunId = "workflow-stopped-sibling-handoff";
|
|
448
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
449
|
+
const status = { ...pausedWorkflow("child-final"), runId: workflowRunId, sessionId: "session-1" };
|
|
450
|
+
status.steps!.push({ agent: "worker", workflowKey: "stopped", runId: "child-stopped", status: "stopped", stopped: true });
|
|
451
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
452
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
453
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
454
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
455
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({ state, workflowRunId, childRunId: "child-final", result: { index: 0, agent: "worker", task: "t", exitCode: 0, usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } } }), true);
|
|
456
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { workflowResolution?: string; results?: Array<{ workflowKey?: string; stopped?: boolean }> };
|
|
457
|
+
assert.equal(published.workflowResolution, "interrupted-child");
|
|
458
|
+
assert.equal(published.results?.find((child) => child.workflowKey === "stopped")?.stopped, true);
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
it("keeps a detached timeout outcome local after fail-closed workflow settlement", () => {
|
|
462
|
+
const workflowRunId = "workflow-child-timeout-handoff";
|
|
463
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
464
|
+
const outcome = { state: "partial" as const, reason: "timeout" as const };
|
|
465
|
+
const status = { ...pausedWorkflow("child-timeout"), runId: workflowRunId, sessionId: "session-1" };
|
|
466
|
+
status.steps!.push({ agent: "worker", workflowKey: "still-open", runId: "child-open", status: "paused", activityState: "needs_attention" });
|
|
467
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
468
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
469
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
470
|
+
writeWorkflowReceipt(asyncDir, buildWorkflowReceipt({
|
|
471
|
+
workflowRunId,
|
|
472
|
+
state: "paused",
|
|
473
|
+
children: [
|
|
474
|
+
{ key: "detaches", ok: false, agent: "worker", runId: "child-timeout", output: "paused", detached: true, artifactPaths: [], resumability: { state: "not-resumable", reason: "child detached" }, continuation: { runIds: ["child-timeout"] } },
|
|
475
|
+
{ key: "still-open", ok: false, agent: "worker", runId: "child-open", output: "paused", detached: true, artifactPaths: [], resumability: { state: "not-resumable", reason: "child detached" }, continuation: { runIds: ["child-open"] } },
|
|
476
|
+
],
|
|
477
|
+
}));
|
|
478
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
479
|
+
|
|
480
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
481
|
+
state,
|
|
482
|
+
workflowRunId,
|
|
483
|
+
childRunId: "child-timeout",
|
|
484
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 1, timedOut: true, error: "Subagent timed out after 50ms." },
|
|
485
|
+
}), true);
|
|
486
|
+
const paused = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { state?: string; terminalOutcome?: unknown; results?: Array<{ workflowKey?: string; terminalOutcome?: unknown }>; workflowReceipt?: { receipt?: { terminalOutcome?: unknown; entries?: Record<string, { terminalOutcome?: unknown }> } } };
|
|
487
|
+
assert.equal(paused.state, "paused");
|
|
488
|
+
assert.equal(paused.terminalOutcome, undefined);
|
|
489
|
+
assert.equal(paused.workflowReceipt?.receipt?.terminalOutcome, undefined);
|
|
490
|
+
assert.deepEqual(paused.results?.find((child) => child.workflowKey === "detaches")?.terminalOutcome, outcome);
|
|
491
|
+
assert.deepEqual(paused.workflowReceipt?.receipt?.entries?.detaches?.terminalOutcome, outcome);
|
|
492
|
+
|
|
493
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
494
|
+
state,
|
|
495
|
+
workflowRunId,
|
|
496
|
+
childRunId: "child-open",
|
|
497
|
+
result: { index: 1, agent: "worker", task: "t", exitCode: 0 },
|
|
498
|
+
}), true);
|
|
499
|
+
const terminal = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { state?: string; terminalOutcome?: unknown; results?: Array<{ workflowKey?: string; terminalOutcome?: unknown }>; workflowReceipt?: { receipt?: { terminalOutcome?: unknown; entries?: Record<string, { terminalOutcome?: unknown }> } } };
|
|
500
|
+
assert.equal(terminal.state, "failed");
|
|
501
|
+
assert.equal(terminal.terminalOutcome, undefined);
|
|
502
|
+
assert.equal(terminal.workflowReceipt?.receipt?.terminalOutcome, undefined);
|
|
503
|
+
assert.deepEqual(terminal.results?.find((child) => child.workflowKey === "detaches")?.terminalOutcome, outcome);
|
|
504
|
+
assert.deepEqual(terminal.workflowReceipt?.receipt?.entries?.detaches?.terminalOutcome, outcome);
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
it("preserves sibling output path mappings when rebuilding from workflow status", () => {
|
|
508
|
+
const workflowRunId = "workflow-sibling-mappings";
|
|
509
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
510
|
+
const firstRequestedPath = path.join(asyncDir, "first-requested.md");
|
|
511
|
+
const firstSavedPath = path.join(asyncDir, "first-saved.md");
|
|
512
|
+
const secondRequestedPath = path.join(asyncDir, "second-requested.md");
|
|
513
|
+
const secondSavedPath = path.join(asyncDir, "second-saved.md");
|
|
514
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
515
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
516
|
+
const status = { ...pausedWorkflow("child-1"), runId: workflowRunId, sessionId: "session-1" };
|
|
517
|
+
status.steps!.push({
|
|
518
|
+
agent: "worker",
|
|
519
|
+
workflowKey: "second",
|
|
520
|
+
runId: "child-2",
|
|
521
|
+
status: "paused",
|
|
522
|
+
activityState: "needs_attention",
|
|
523
|
+
});
|
|
524
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
525
|
+
const state = {
|
|
526
|
+
asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]),
|
|
527
|
+
} as SubagentState;
|
|
528
|
+
|
|
529
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
530
|
+
state,
|
|
531
|
+
workflowRunId,
|
|
532
|
+
childRunId: "child-1",
|
|
533
|
+
result: { index: 0, agent: "worker", task: `Write your findings to exactly this path: ${firstRequestedPath}`, exitCode: 0, savedOutputPath: firstSavedPath, usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
534
|
+
}), true);
|
|
535
|
+
fs.rmSync(path.join(DIRS.results, `${workflowRunId}.json`));
|
|
536
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
537
|
+
state,
|
|
538
|
+
workflowRunId,
|
|
539
|
+
childRunId: "child-2",
|
|
540
|
+
result: { index: 1, agent: "worker", task: `Write your findings to exactly this path: ${secondRequestedPath}`, exitCode: 0, savedOutputPath: secondSavedPath, usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
541
|
+
}), true);
|
|
542
|
+
|
|
543
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { summary?: string; results?: Array<{ workflowKey?: string; outputPathMapping?: unknown }> };
|
|
544
|
+
assert.deepEqual(published.results?.map((child) => [child.workflowKey, child.outputPathMapping]), [
|
|
545
|
+
["detaches", { requestedPath: firstRequestedPath, savedPath: firstSavedPath }],
|
|
546
|
+
["second", { requestedPath: secondRequestedPath, savedPath: secondSavedPath }],
|
|
547
|
+
]);
|
|
548
|
+
assert.ok(published.summary?.includes(`'detaches': requested ${firstRequestedPath} -> saved ${firstSavedPath}`));
|
|
549
|
+
assert.ok(published.summary?.includes(`'second': requested ${secondRequestedPath} -> saved ${secondSavedPath}`));
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
it("skips non-object existing result entries while summarizing output mappings", () => {
|
|
553
|
+
const workflowRunId = "workflow-existing-non-object-results";
|
|
554
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
555
|
+
const requestedPath = path.join(asyncDir, "requested.md");
|
|
556
|
+
const savedPath = path.join(asyncDir, "saved.md");
|
|
557
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
558
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
559
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify({ ...pausedWorkflow("child-1"), runId: workflowRunId, sessionId: "session-1" }), "utf-8");
|
|
560
|
+
fs.writeFileSync(path.join(DIRS.results, `${workflowRunId}.json`), JSON.stringify({ activityState: "needs_attention", results: [null, { workflowKey: "detaches", runId: "child-1", success: false, output: "old", outputState: "present" }] }), "utf-8");
|
|
561
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
562
|
+
|
|
563
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
564
|
+
state,
|
|
565
|
+
workflowRunId,
|
|
566
|
+
childRunId: "child-1",
|
|
567
|
+
result: { index: 0, agent: "worker", task: `Write your findings to exactly this path: ${requestedPath}`, exitCode: 0, savedOutputPath: savedPath, usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
568
|
+
}), true);
|
|
569
|
+
|
|
570
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { activityState?: string; summary?: string; results?: unknown[] };
|
|
571
|
+
assert.equal(published.activityState, undefined);
|
|
572
|
+
assert.equal(published.results?.[0], null);
|
|
573
|
+
assert.ok(published.summary?.includes(`'detaches': requested ${requestedPath} -> saved ${savedPath}`));
|
|
189
574
|
});
|
|
190
575
|
|
|
191
576
|
it("publishes detached completion when the workflow receipt is malformed", () => {
|
|
@@ -210,7 +595,7 @@ describe("reconcileDetachedWorkflowChildCompletion", () => {
|
|
|
210
595
|
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { state?: string; success?: boolean; error?: string; workflowReceipt?: unknown };
|
|
211
596
|
assert.equal(published.state, "failed");
|
|
212
597
|
assert.equal(published.success, false);
|
|
213
|
-
assert.match(published.error ?? "", /
|
|
598
|
+
assert.match(published.error ?? "", /evidence-persistence-failed/);
|
|
214
599
|
assert.equal(published.workflowReceipt, undefined);
|
|
215
600
|
const events = fs.readFileSync(path.join(asyncDir, "events.jsonl"), "utf-8");
|
|
216
601
|
assert.match(events, /"type":"subagent.workflow.receipt_write_failed"/);
|
|
@@ -245,10 +630,11 @@ describe("reconcileDetachedWorkflowChildCompletion", () => {
|
|
|
245
630
|
console.error = originalConsoleError;
|
|
246
631
|
}
|
|
247
632
|
|
|
248
|
-
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { state?: string; success?: boolean; error?: string; workflowReceipt?: unknown; reconciledFromDetachedChild?: string };
|
|
633
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { state?: string; success?: boolean; error?: string; summary?: string; workflowReceipt?: unknown; reconciledFromDetachedChild?: string };
|
|
249
634
|
assert.equal(published.state, "failed");
|
|
250
635
|
assert.equal(published.success, false);
|
|
251
|
-
assert.match(published.error ?? "", /
|
|
636
|
+
assert.match(published.error ?? "", /evidence-persistence-failed/);
|
|
637
|
+
assert.match(published.summary ?? "", /Available child evidence was preserved/);
|
|
252
638
|
assert.equal(published.workflowReceipt, undefined);
|
|
253
639
|
assert.equal(published.reconciledFromDetachedChild, "child-1");
|
|
254
640
|
assert.equal(emitted?.name, "subagent:async-complete");
|
|
@@ -260,7 +646,9 @@ describe("reconcileDetachedWorkflowChildCompletion", () => {
|
|
|
260
646
|
agent: "workflow",
|
|
261
647
|
success: false,
|
|
262
648
|
state: "failed",
|
|
263
|
-
|
|
649
|
+
workflowResolution: "settled-awaiting-resume",
|
|
650
|
+
recovery: [],
|
|
651
|
+
summary: published.summary,
|
|
264
652
|
reconciledFromDetachedChild: "child-1",
|
|
265
653
|
results: [{ workflowKey: "detaches", agent: "worker", runId: "child-1", success: true, output: "", outputState: "absent" }],
|
|
266
654
|
sessionId: "session-1",
|
|
@@ -270,6 +658,91 @@ describe("reconcileDetachedWorkflowChildCompletion", () => {
|
|
|
270
658
|
});
|
|
271
659
|
});
|
|
272
660
|
|
|
661
|
+
it("normalizes old external-cli child status while reconciling workflow receipts", () => {
|
|
662
|
+
const workflowRunId = "workflow-old-external-receipt";
|
|
663
|
+
const childRunId = "child-old-external";
|
|
664
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
665
|
+
const childDir = path.join(DIRS.async, childRunId);
|
|
666
|
+
fs.rmSync(asyncDir, { recursive: true, force: true });
|
|
667
|
+
fs.rmSync(childDir, { recursive: true, force: true });
|
|
668
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
669
|
+
fs.mkdirSync(childDir, { recursive: true });
|
|
670
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
671
|
+
const status = { ...pausedWorkflow(childRunId), runId: workflowRunId, sessionId: "session-1" };
|
|
672
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
673
|
+
fs.writeFileSync(path.join(childDir, "status.json"), JSON.stringify({
|
|
674
|
+
runId: childRunId,
|
|
675
|
+
mode: "single",
|
|
676
|
+
state: "complete",
|
|
677
|
+
startedAt: 1,
|
|
678
|
+
lastUpdate: 2,
|
|
679
|
+
steps: [{ agent: "external", status: "complete", runner: { type: "external-cli", command: "review-cli", args: [], promptDelivery: "stdin", capabilities: { stop: true, steer: false, resume: false, structuredOutput: false, toolEvents: false } } }],
|
|
680
|
+
}), "utf-8");
|
|
681
|
+
writeWorkflowReceipt(asyncDir, buildWorkflowReceipt({
|
|
682
|
+
workflowRunId,
|
|
683
|
+
state: "paused",
|
|
684
|
+
children: [{ key: "detaches", ok: false, agent: "external", runId: childRunId, output: "paused", detached: true, artifactPaths: [], resumability: { state: "not-resumable", reason: "child detached" }, continuation: { runIds: [childRunId] } }],
|
|
685
|
+
}));
|
|
686
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
687
|
+
|
|
688
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
689
|
+
state,
|
|
690
|
+
workflowRunId,
|
|
691
|
+
childRunId,
|
|
692
|
+
result: { index: 0, agent: "external", task: "t", exitCode: 0, usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
693
|
+
}), true);
|
|
694
|
+
|
|
695
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { workflowReceipt?: { receipt?: { entries?: Record<string, { externalAdapter?: { adapter?: { id?: string }; nonResumableReason?: string } }> } } };
|
|
696
|
+
assert.equal(published.workflowReceipt?.receipt?.entries?.detaches?.externalAdapter?.adapter?.id, "external-cli");
|
|
697
|
+
assert.match(published.workflowReceipt?.receipt?.entries?.detaches?.externalAdapter?.nonResumableReason ?? "", /no durable external session identity/);
|
|
698
|
+
assert.doesNotMatch(fs.readFileSync(path.join(asyncDir, "events.jsonl"), "utf-8"), /receipt_write_failed/);
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
it("keeps mixed Pi and external workflow receipt entries on their computed resumability", () => {
|
|
702
|
+
const workflowRunId = "workflow-mixed-receipt";
|
|
703
|
+
const childRunId = "child-mixed";
|
|
704
|
+
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
705
|
+
const childDir = path.join(DIRS.async, childRunId);
|
|
706
|
+
fs.rmSync(asyncDir, { recursive: true, force: true });
|
|
707
|
+
fs.rmSync(childDir, { recursive: true, force: true });
|
|
708
|
+
fs.mkdirSync(asyncDir, { recursive: true });
|
|
709
|
+
fs.mkdirSync(childDir, { recursive: true });
|
|
710
|
+
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
711
|
+
const status = { ...pausedWorkflow(childRunId), runId: workflowRunId, sessionId: "session-1" };
|
|
712
|
+
fs.writeFileSync(path.join(asyncDir, "status.json"), JSON.stringify(status), "utf-8");
|
|
713
|
+
const sessionFile = path.join(childDir, "pi-session.jsonl");
|
|
714
|
+
fs.writeFileSync(sessionFile, "", "utf-8");
|
|
715
|
+
fs.writeFileSync(path.join(childDir, "status.json"), JSON.stringify({
|
|
716
|
+
runId: childRunId,
|
|
717
|
+
mode: "parallel",
|
|
718
|
+
state: "complete",
|
|
719
|
+
startedAt: 1,
|
|
720
|
+
lastUpdate: 2,
|
|
721
|
+
steps: [
|
|
722
|
+
{ agent: "worker", status: "complete", sessionFile },
|
|
723
|
+
{ agent: "external", status: "complete", runner: { type: "external-cli", command: "review-cli", args: [], promptDelivery: "stdin" } },
|
|
724
|
+
],
|
|
725
|
+
}), "utf-8");
|
|
726
|
+
writeWorkflowReceipt(asyncDir, buildWorkflowReceipt({
|
|
727
|
+
workflowRunId,
|
|
728
|
+
state: "paused",
|
|
729
|
+
children: [{ key: "detaches", ok: false, agent: "worker", runId: childRunId, output: "paused", detached: true, artifactPaths: [], resumability: { state: "not-resumable", reason: "child detached" }, continuation: { runIds: [childRunId] } }],
|
|
730
|
+
}));
|
|
731
|
+
const state = { asyncJobs: new Map([[workflowRunId, { asyncId: workflowRunId, asyncDir, status: "paused" as const }]]) } as SubagentState;
|
|
732
|
+
|
|
733
|
+
assert.equal(reconcileDetachedWorkflowChildCompletion({
|
|
734
|
+
state,
|
|
735
|
+
workflowRunId,
|
|
736
|
+
childRunId,
|
|
737
|
+
result: { index: 0, agent: "worker", task: "t", exitCode: 0, sessionFile, usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
738
|
+
}), true);
|
|
739
|
+
|
|
740
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { workflowReceipt?: { receipt?: { entries?: Record<string, { resumability?: { state?: string; reason?: string }; externalAdapter?: unknown }> } } };
|
|
741
|
+
assert.equal(published.workflowReceipt?.receipt?.entries?.detaches?.resumability?.state, "not-resumable");
|
|
742
|
+
assert.doesNotMatch(published.workflowReceipt?.receipt?.entries?.detaches?.resumability?.reason ?? "", /no durable external session identity/);
|
|
743
|
+
assert.equal(published.workflowReceipt?.receipt?.entries?.detaches?.externalAdapter, undefined);
|
|
744
|
+
});
|
|
745
|
+
|
|
273
746
|
it("does not log workflow completion while another detached child is still open", () => {
|
|
274
747
|
const workflowRunId = "workflow-still-paused";
|
|
275
748
|
const asyncDir = path.join(DIRS.async, workflowRunId);
|
|
@@ -296,7 +769,9 @@ describe("reconcileDetachedWorkflowChildCompletion", () => {
|
|
|
296
769
|
result: { index: 0, agent: "worker", task: "t", exitCode: 0, usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 } },
|
|
297
770
|
}), true);
|
|
298
771
|
assert.equal(fs.existsSync(path.join(asyncDir, "events.jsonl")), false);
|
|
299
|
-
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { state?: string };
|
|
772
|
+
const published = JSON.parse(fs.readFileSync(path.join(DIRS.results, `${workflowRunId}.json`), "utf-8")) as { state?: string; workflowResolution?: string; recovery?: unknown };
|
|
300
773
|
assert.equal(published.state, "paused");
|
|
774
|
+
assert.equal(published.workflowResolution, undefined);
|
|
775
|
+
assert.equal(published.recovery, undefined);
|
|
301
776
|
});
|
|
302
777
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { describe, it } from "node:test";
|
|
3
|
-
import { prepareWorkflowLaunchParams, sanitizeRunPathSegment } from "../../src/runs/foreground/subagent-executor.ts";
|
|
3
|
+
import { prepareWorkflowLaunchParams, promptAuditRedoParams, sanitizeRunPathSegment } from "../../src/runs/foreground/subagent-executor.ts";
|
|
4
4
|
|
|
5
5
|
describe("workflow launch params", () => {
|
|
6
6
|
it("keeps omitted workflow child async foreground", () => {
|
|
@@ -21,6 +21,42 @@ describe("workflow launch params", () => {
|
|
|
21
21
|
);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
it("marks only new async workflow children to preserve live supervisor-detach awaits", () => {
|
|
25
|
+
// Retained workflow children already use the async result-file await path.
|
|
26
|
+
assert.equal(prepareWorkflowLaunchParams(
|
|
27
|
+
{},
|
|
28
|
+
{ agent: "worker", task: "Run" },
|
|
29
|
+
"workflow-run",
|
|
30
|
+
"run",
|
|
31
|
+
{ awaitDetachedChild: true },
|
|
32
|
+
).workflowAwaitDetached, true);
|
|
33
|
+
assert.equal(prepareWorkflowLaunchParams(
|
|
34
|
+
{},
|
|
35
|
+
{ resume: "retained-run", task: "Continue" },
|
|
36
|
+
"workflow-run",
|
|
37
|
+
"resume",
|
|
38
|
+
{ awaitDetachedChild: true },
|
|
39
|
+
).workflowAwaitDetached, undefined);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("scrubs the live workflow detach bridge from prompt-audit redo params", () => {
|
|
43
|
+
const workflowChild = prepareWorkflowLaunchParams(
|
|
44
|
+
{},
|
|
45
|
+
{ agent: "worker", task: "Run" },
|
|
46
|
+
"workflow-run",
|
|
47
|
+
"run",
|
|
48
|
+
{ awaitDetachedChild: true },
|
|
49
|
+
);
|
|
50
|
+
assert.equal(workflowChild.workflowAwaitDetached, true);
|
|
51
|
+
|
|
52
|
+
const redo = promptAuditRedoParams(workflowChild, "Run with narrower guidance");
|
|
53
|
+
assert.equal(redo.workflowAwaitDetached, undefined);
|
|
54
|
+
assert.equal(redo.workflowParentRunId, undefined);
|
|
55
|
+
assert.equal(redo.workflowKey, undefined);
|
|
56
|
+
assert.equal(redo.async, false);
|
|
57
|
+
assert.equal(redo.task, "Run with narrower guidance");
|
|
58
|
+
});
|
|
59
|
+
|
|
24
60
|
it("passes an omitted child timeout parent deadline for default resolution", () => {
|
|
25
61
|
const parentDeadlineAt = Date.now() + 60_000;
|
|
26
62
|
const params = prepareWorkflowLaunchParams(
|
|
@@ -262,12 +298,11 @@ describe("workflow launch params", () => {
|
|
|
262
298
|
it("preserves execution limits and fan-out identity when routing retained resume items", () => {
|
|
263
299
|
assert.deepEqual(
|
|
264
300
|
prepareWorkflowLaunchParams(
|
|
265
|
-
{
|
|
301
|
+
{ toolBudget: { hard: 12, block: ["read"] } },
|
|
266
302
|
{
|
|
267
303
|
resume: " retained-run ",
|
|
268
304
|
task: "Continue carefully",
|
|
269
305
|
maxRuntimeMs: 5_000,
|
|
270
|
-
turnBudget: { maxTurns: 3, graceTurns: 1 },
|
|
271
306
|
toolBudget: { soft: 2, hard: 4, block: "*" },
|
|
272
307
|
},
|
|
273
308
|
"workflow-run",
|
|
@@ -283,7 +318,6 @@ describe("workflow launch params", () => {
|
|
|
283
318
|
runFanoutBudget: { version: 1, rootRunId: "root-run", directory: "/tmp/fanout", limit: 64, parentPath: "parent/workflow[continue]" },
|
|
284
319
|
mission: false,
|
|
285
320
|
timeoutMs: 5_000,
|
|
286
|
-
turnBudget: { maxTurns: 3, graceTurns: 1 },
|
|
287
321
|
toolBudget: { soft: 2, hard: 4, block: "*" },
|
|
288
322
|
},
|
|
289
323
|
);
|