@bastani/atomic 0.9.9 → 0.9.10
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 +132 -0
- package/README.md +2 -0
- package/dist/builtin/cursor/CHANGELOG.md +12 -0
- package/dist/builtin/cursor/package.json +3 -3
- package/dist/builtin/intercom/CHANGELOG.md +30 -0
- package/dist/builtin/intercom/README.md +12 -4
- package/dist/builtin/intercom/broker/broker.ts +96 -14
- package/dist/builtin/intercom/broker/client-message-validation.ts +39 -0
- package/dist/builtin/intercom/broker/client.ts +101 -92
- package/dist/builtin/intercom/broker/group-isolation.ts +28 -0
- package/dist/builtin/intercom/broker/send-handler.ts +62 -10
- package/dist/builtin/intercom/broker/send-signature.ts +3 -0
- package/dist/builtin/intercom/broker/supervisor-channel.ts +126 -0
- package/dist/builtin/intercom/closed-workflow-stage-message.ts +66 -0
- package/dist/builtin/intercom/config.ts +10 -0
- package/dist/builtin/intercom/contact-supervisor-tool.ts +14 -10
- package/dist/builtin/intercom/foreground-detach-handoff.ts +12 -2
- package/dist/builtin/intercom/group.ts +46 -0
- package/dist/builtin/intercom/inbound-message-admission.ts +79 -0
- package/dist/builtin/intercom/incoming-message-delivery.ts +49 -0
- package/dist/builtin/intercom/index-heavy.ts +148 -94
- package/dist/builtin/intercom/index.ts +66 -4
- package/dist/builtin/intercom/intercom-test-seams.ts +6 -0
- package/dist/builtin/intercom/intercom-tool.ts +71 -20
- package/dist/builtin/intercom/intercom-utils.ts +15 -2
- package/dist/builtin/intercom/late-stage-message-router.ts +148 -0
- package/dist/builtin/intercom/lifecycle.ts +10 -4
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/intercom/reconnect-backoff.ts +6 -0
- package/dist/builtin/intercom/reply-tracker.ts +8 -0
- package/dist/builtin/intercom/skills/intercom/SKILL.md +2 -0
- package/dist/builtin/intercom/stable-delivery-retry.ts +32 -0
- package/dist/builtin/intercom/subagent-relay.ts +67 -14
- package/dist/builtin/intercom/supervisor-authorization-registry.ts +22 -0
- package/dist/builtin/intercom/terminal-ordering-barrier.ts +144 -25
- package/dist/builtin/intercom/types.ts +18 -5
- package/dist/builtin/intercom/workflow-reply-tracker.ts +19 -0
- package/dist/builtin/intercom/workflow-stage-admission.ts +43 -0
- package/dist/builtin/intercom/workflow-stage-delivery-failure.ts +77 -0
- package/dist/builtin/mcp/CHANGELOG.md +22 -0
- package/dist/builtin/mcp/README.md +6 -2
- package/dist/builtin/mcp/config.ts +8 -8
- package/dist/builtin/mcp/direct-tool-executor.ts +7 -6
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/mcp/proxy-call.ts +5 -4
- package/dist/builtin/mcp/sampling-handler.ts +7 -2
- package/dist/builtin/mcp/tool-call-timeout.ts +101 -0
- package/dist/builtin/mcp/tool-result-renderer.ts +3 -2
- package/dist/builtin/mcp/types.ts +5 -0
- package/dist/builtin/mcp/ui-server.ts +3 -2
- package/dist/builtin/subagents/CHANGELOG.md +42 -0
- package/dist/builtin/subagents/README.md +6 -3
- package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
- package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-locator.md +1 -1
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +1 -1
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-locator.md +1 -1
- package/dist/builtin/subagents/agents/debugger.md +1 -1
- package/dist/builtin/subagents/agents/worker.md +1 -1
- package/dist/builtin/subagents/package.json +4 -4
- package/dist/builtin/subagents/skills/subagent/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.ts +37 -61
- package/dist/builtin/subagents/src/extension/notification-content.ts +80 -0
- package/dist/builtin/subagents/src/extension/schemas.ts +9 -0
- package/dist/builtin/subagents/src/extension/tool-description.ts +1 -0
- package/dist/builtin/subagents/src/intercom/supervisor-authorization.ts +23 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-chain.ts +4 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +2 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +4 -0
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +75 -13
- package/dist/builtin/subagents/src/runs/background/async-status.ts +19 -0
- package/dist/builtin/subagents/src/runs/background/completion-notification.ts +4 -3
- package/dist/builtin/subagents/src/runs/background/notify.ts +76 -15
- package/dist/builtin/subagents/src/runs/background/stale-run-reconciler.ts +1 -1
- package/dist/builtin/subagents/src/runs/background/subagent-runner-dynamic.ts +13 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-parallel.ts +1 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-sequential.ts +1 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-step.ts +2 -1
- package/dist/builtin/subagents/src/runs/background/subagent-runner-types.ts +4 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +13 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +19 -2
- package/dist/builtin/subagents/src/runs/foreground/detached-cleanup-barrier.ts +26 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +19 -30
- package/dist/builtin/subagents/src/runs/foreground/execution-intercom-detach.ts +47 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +60 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +21 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +21 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-resume.ts +6 -1
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +1 -1
- package/dist/builtin/subagents/src/runs/shared/intercom-group.ts +50 -0
- package/dist/builtin/subagents/src/runs/shared/pi-args.ts +16 -0
- package/dist/builtin/subagents/src/runs/shared/worktree-post-create.ts +75 -0
- package/dist/builtin/subagents/src/runs/shared/worktree-root.ts +51 -0
- package/dist/builtin/subagents/src/runs/shared/worktree.ts +69 -77
- package/dist/builtin/subagents/src/shared/types-config.ts +6 -0
- package/dist/builtin/subagents/src/slash/slash-commands.ts +3 -2
- package/dist/builtin/subagents/src/tui/render-result-compact.ts +5 -3
- package/dist/builtin/subagents/src/tui/render-result.ts +5 -3
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +7 -4
- package/dist/builtin/web-access/CHANGELOG.md +22 -0
- package/dist/builtin/web-access/extract-frames.ts +14 -13
- package/dist/builtin/web-access/extract.ts +2 -2
- package/dist/builtin/web-access/gemini-api.ts +0 -3
- package/dist/builtin/web-access/gemini-web-config.ts +1 -3
- package/dist/builtin/web-access/gemini-web.ts +1 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/web-access/perplexity.ts +0 -3
- package/dist/builtin/web-access/result-renderers.ts +7 -5
- package/dist/builtin/web-access/subprocess.ts +100 -0
- package/dist/builtin/web-access/summary-review.ts +14 -3
- package/dist/builtin/web-access/video-extract.ts +12 -17
- package/dist/builtin/web-access/web-search-browser.ts +18 -10
- package/dist/builtin/web-access/web-search-summary.ts +9 -2
- package/dist/builtin/web-access/youtube-extract.ts +22 -25
- package/dist/builtin/workflows/CHANGELOG.md +153 -0
- package/dist/builtin/workflows/README.md +76 -38
- package/dist/builtin/workflows/ambient.d.ts +30 -0
- package/dist/builtin/workflows/builtin/adversarial-verification-prompts.ts +15 -0
- package/dist/builtin/workflows/builtin/adversarial-verification-runner.ts +93 -0
- package/dist/builtin/workflows/builtin/adversarial-verification.d.ts +11 -0
- package/dist/builtin/workflows/builtin/adversarial-verification.ts +24 -0
- package/dist/builtin/workflows/builtin/classify-and-act-prompts.ts +11 -0
- package/dist/builtin/workflows/builtin/classify-and-act-runner.ts +110 -0
- package/dist/builtin/workflows/builtin/classify-and-act.d.ts +24 -0
- package/dist/builtin/workflows/builtin/classify-and-act.ts +35 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase-utils.ts +8 -2
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize-prompts.ts +11 -0
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize-runner.ts +96 -0
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.d.ts +23 -0
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.ts +32 -0
- package/dist/builtin/workflows/builtin/generate-and-filter-prompts.ts +15 -0
- package/dist/builtin/workflows/builtin/generate-and-filter-runner.ts +75 -0
- package/dist/builtin/workflows/builtin/generate-and-filter.d.ts +11 -0
- package/dist/builtin/workflows/builtin/generate-and-filter.ts +26 -0
- package/dist/builtin/workflows/builtin/goal-models.ts +72 -0
- package/dist/builtin/workflows/builtin/goal-runner.ts +2 -64
- package/dist/builtin/workflows/builtin/index.d.ts +44 -0
- package/dist/builtin/workflows/builtin/index.ts +6 -0
- package/dist/builtin/workflows/builtin/loop-until-done-prompts.ts +79 -0
- package/dist/builtin/workflows/builtin/loop-until-done-runner.ts +189 -0
- package/dist/builtin/workflows/builtin/loop-until-done.d.ts +34 -0
- package/dist/builtin/workflows/builtin/loop-until-done.ts +31 -0
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +6 -1
- package/dist/builtin/workflows/builtin/pattern-artifact-root.ts +28 -0
- package/dist/builtin/workflows/builtin/ralph-models.ts +26 -5
- package/dist/builtin/workflows/builtin/ralph-runner.ts +1 -0
- package/dist/builtin/workflows/builtin/tournament-prompts.ts +79 -0
- package/dist/builtin/workflows/builtin/tournament-runner.ts +188 -0
- package/dist/builtin/workflows/builtin/tournament.d.ts +33 -0
- package/dist/builtin/workflows/builtin/tournament.ts +34 -0
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/authoring.d.ts +2 -6
- package/dist/builtin/workflows/src/durable/backend.ts +163 -120
- package/dist/builtin/workflows/src/durable/completed-catalog.ts +37 -64
- package/dist/builtin/workflows/src/durable/completed-inspection.ts +4 -72
- package/dist/builtin/workflows/src/durable/dbos-backend.ts +242 -195
- package/dist/builtin/workflows/src/durable/dbos-embedded-postgres.ts +207 -0
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +42 -42
- package/dist/builtin/workflows/src/durable/dbos-lifecycle.ts +155 -0
- package/dist/builtin/workflows/src/durable/dbos-local-postgres.ts +126 -0
- package/dist/builtin/workflows/src/durable/dbos-metadata.ts +105 -58
- package/dist/builtin/workflows/src/durable/dbos-prompt-reservations.ts +320 -0
- package/dist/builtin/workflows/src/durable/dbos-sdk-handle.ts +161 -0
- package/dist/builtin/workflows/src/durable/dbos-status-transition.ts +62 -0
- package/dist/builtin/workflows/src/durable/dbos-tombstone.ts +2 -2
- package/dist/builtin/workflows/src/durable/durable-hash.ts +20 -0
- package/dist/builtin/workflows/src/durable/factory.ts +23 -83
- package/dist/builtin/workflows/src/durable/format-version.ts +4 -10
- package/dist/builtin/workflows/src/durable/index.ts +16 -20
- package/dist/builtin/workflows/src/durable/local-command.ts +63 -0
- package/dist/builtin/workflows/src/durable/prompt-reservation-state.ts +177 -0
- package/dist/builtin/workflows/src/durable/prompt-reservations.ts +36 -0
- package/dist/builtin/workflows/src/durable/resume-catalog.ts +2 -200
- package/dist/builtin/workflows/src/durable/resume-eligibility.ts +42 -2
- package/dist/builtin/workflows/src/durable/resume-runtime.ts +121 -118
- package/dist/builtin/workflows/src/durable/retention-policy.ts +42 -0
- package/dist/builtin/workflows/src/durable/run-timing.ts +98 -0
- package/dist/builtin/workflows/src/durable/scoped-backend.ts +62 -14
- package/dist/builtin/workflows/src/durable/stage-primitive.ts +15 -2
- package/dist/builtin/workflows/src/durable/tool-primitive.ts +11 -7
- package/dist/builtin/workflows/src/durable/types.ts +25 -18
- package/dist/builtin/workflows/src/durable/ui-primitive.ts +117 -29
- package/dist/builtin/workflows/src/durable/workflow-status-transition.ts +30 -0
- package/dist/builtin/workflows/src/engine/primitives/parallel.ts +20 -5
- package/dist/builtin/workflows/src/engine/primitives/task.ts +3 -2
- package/dist/builtin/workflows/src/engine/primitives/ui.ts +6 -3
- package/dist/builtin/workflows/src/engine/run-durable-finalize.ts +14 -22
- package/dist/builtin/workflows/src/engine/run-durable-stage-session.ts +14 -14
- package/dist/builtin/workflows/src/engine/run.ts +35 -37
- package/dist/builtin/workflows/src/engine/runtime.ts +3 -0
- package/dist/builtin/workflows/src/engine/workflow-activity.ts +9 -0
- package/dist/builtin/workflows/src/extension/completed-stage-intercom-ask.ts +155 -0
- package/dist/builtin/workflows/src/extension/config-file-loader.ts +13 -0
- package/dist/builtin/workflows/src/extension/config-loader.ts +20 -0
- package/dist/builtin/workflows/src/extension/dispatcher.ts +56 -17
- package/dist/builtin/workflows/src/extension/extension-factory.ts +13 -10
- package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +37 -59
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +16 -18
- package/dist/builtin/workflows/src/extension/lifecycle-notification-delivery.ts +83 -0
- package/dist/builtin/workflows/src/extension/lifecycle-notifications.ts +80 -41
- package/dist/builtin/workflows/src/extension/postmortem-deps.ts +73 -0
- package/dist/builtin/workflows/src/extension/public-types.ts +11 -51
- package/dist/builtin/workflows/src/extension/render-call.ts +3 -9
- package/dist/builtin/workflows/src/extension/render-result.ts +22 -7
- package/dist/builtin/workflows/src/extension/runtime-active-block-claim.ts +78 -0
- package/dist/builtin/workflows/src/extension/runtime-durable-resume.ts +50 -29
- package/dist/builtin/workflows/src/extension/runtime.ts +70 -219
- package/dist/builtin/workflows/src/extension/ui-surface.ts +107 -3
- package/dist/builtin/workflows/src/extension/wiring.ts +76 -7
- package/dist/builtin/workflows/src/extension/workflow-command-completions.ts +10 -5
- package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +27 -5
- package/dist/builtin/workflows/src/extension/workflow-durable-resume-command.ts +49 -19
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +8 -8
- package/dist/builtin/workflows/src/extension/workflow-resume-picker-rows.ts +81 -0
- package/dist/builtin/workflows/src/extension/workflow-resume-shadow.ts +55 -0
- package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +193 -145
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +9 -133
- package/dist/builtin/workflows/src/extension/workflow-status-summary.ts +189 -0
- package/dist/builtin/workflows/src/extension/workflow-targets.ts +1 -1
- package/dist/builtin/workflows/src/extension/workflow-tool-content.ts +78 -3
- package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +185 -89
- package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +92 -11
- package/dist/builtin/workflows/src/extension/workflow-tool.ts +18 -24
- package/dist/builtin/workflows/src/runs/background/durable-resume-transition.ts +63 -0
- package/dist/builtin/workflows/src/runs/background/quit.ts +139 -29
- package/dist/builtin/workflows/src/runs/background/resume-acknowledgements.ts +97 -0
- package/dist/builtin/workflows/src/runs/background/run-inspect.ts +111 -0
- package/dist/builtin/workflows/src/runs/background/runner.ts +46 -17
- package/dist/builtin/workflows/src/runs/background/startup-admission.ts +77 -0
- package/dist/builtin/workflows/src/runs/background/status.ts +133 -224
- package/dist/builtin/workflows/src/runs/background/workflow-lifecycle-aggregate.ts +44 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +57 -256
- package/dist/builtin/workflows/src/runs/foreground/executor-hil.ts +7 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-lifecycle.ts +12 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +39 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-queued-user-message.ts +75 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +44 -12
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +63 -12
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +30 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +3 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +4 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-task-prompts.ts +0 -67
- package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +6 -0
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +0 -1
- package/dist/builtin/workflows/src/runs/foreground/postmortem-stage-chat.ts +169 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +38 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-candidate.ts +21 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +21 -3
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +85 -84
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-message-admission.ts +195 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-options.ts +12 -5
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-replacement.ts +42 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-send-user-message.ts +100 -8
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-session-options.ts +51 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-session.ts +19 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +28 -2
- package/dist/builtin/workflows/src/runs/shared/prompt-callsite.ts +4 -6
- package/dist/builtin/workflows/src/runs/shared/worktree-git-runner.ts +89 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-git.ts +29 -133
- package/dist/builtin/workflows/src/runs/shared/worktree-post-create.ts +130 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-root.ts +84 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-setup.ts +77 -63
- package/dist/builtin/workflows/src/runs/shared/worktree-types.ts +4 -0
- package/dist/builtin/workflows/src/sdk-surface.ts +1 -1
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +29 -22
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +26 -24
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +5 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +5 -0
- package/dist/builtin/workflows/src/shared/intercom-group.ts +51 -0
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +6 -0
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +4 -0
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +3 -0
- package/dist/builtin/workflows/src/shared/prompt-callsite-context.ts +13 -0
- package/dist/builtin/workflows/src/shared/returned-run-status.ts +2 -1
- package/dist/builtin/workflows/src/shared/session-transcript.ts +74 -0
- package/dist/builtin/workflows/src/shared/store-stage-methods.ts +1 -0
- package/dist/builtin/workflows/src/shared/store-types.ts +8 -0
- package/dist/builtin/workflows/src/shared/timing.ts +4 -1
- package/dist/builtin/workflows/src/shared/types.ts +2 -6
- package/dist/builtin/workflows/src/tui/chat-surface-message.ts +2 -42
- package/dist/builtin/workflows/src/tui/dispatch-confirm.ts +2 -2
- package/dist/builtin/workflows/src/tui/graph-view-constants.ts +7 -3
- package/dist/builtin/workflows/src/tui/graph-view-input.ts +29 -67
- package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +15 -10
- package/dist/builtin/workflows/src/tui/graph-view-state.ts +0 -2
- package/dist/builtin/workflows/src/tui/graph-view-types.ts +3 -9
- package/dist/builtin/workflows/src/tui/host-input-form.ts +62 -0
- package/dist/builtin/workflows/src/tui/mouse-input.ts +63 -0
- package/dist/builtin/workflows/src/tui/node-card.ts +1 -0
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +67 -42
- package/dist/builtin/workflows/src/tui/overlay-terminal-modes.ts +49 -0
- package/dist/builtin/workflows/src/tui/session-overlays.ts +3 -104
- package/dist/builtin/workflows/src/tui/session-picker.ts +3 -12
- package/dist/builtin/workflows/src/tui/stage-chat-composer-drafts.ts +19 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +30 -10
- package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +19 -9
- package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +25 -38
- package/dist/builtin/workflows/src/tui/stage-chat-view-render-helpers.ts +1 -1
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +7 -6
- package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +7 -1
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +3 -1
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +19 -20
- package/dist/builtin/workflows/src/tui/switcher.ts +4 -4
- package/dist/builtin/workflows/src/tui/widget.ts +46 -33
- package/dist/builtin/workflows/src/tui/workflow-attach-pane-handle.ts +26 -0
- package/dist/builtin/workflows/src/tui/workflow-attach-pane-types.ts +14 -2
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +26 -27
- package/dist/builtin/workflows/src/tui/workflow-resume-selector.ts +208 -69
- package/dist/bun/cli.js +3 -0
- package/dist/bun/cli.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +3 -0
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +19 -2
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.js +2 -2
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +5 -3
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-export.js +1 -1
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts +2 -4
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +9 -2
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +6 -0
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +107 -36
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +18 -7
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts +3 -1
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js +1 -1
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.d.ts +16 -0
- package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -0
- package/dist/core/agent-session-post-tool-compaction.js +113 -0
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -0
- package/dist/core/agent-session-prompt.d.ts +12 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +22 -5
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +3 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +21 -0
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-tree.d.ts.map +1 -1
- package/dist/core/agent-session-tree.js +2 -1
- package/dist/core/agent-session-tree.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +7 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +6 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +18 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/async/job-manager.d.ts +1 -0
- package/dist/core/async/job-manager.d.ts.map +1 -1
- package/dist/core/async/job-manager.js +29 -5
- package/dist/core/async/job-manager.js.map +1 -1
- package/dist/core/async/session-manager.d.ts +2 -4
- package/dist/core/async/session-manager.d.ts.map +1 -1
- package/dist/core/async/session-manager.js +5 -32
- package/dist/core/async/session-manager.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +2 -0
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/auth-storage.d.ts +20 -10
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +151 -92
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/callback-activity.d.ts +27 -0
- package/dist/core/callback-activity.d.ts.map +1 -0
- package/dist/core/callback-activity.js +44 -0
- package/dist/core/callback-activity.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +4 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +4 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction-boundary.d.ts +1 -1
- package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
- package/dist/core/compaction/compaction-boundary.js +10 -23
- package/dist/core/compaction/compaction-boundary.js.map +1 -1
- package/dist/core/compaction/compaction-runner.d.ts +4 -1
- package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/compaction-runner.js +1 -1
- package/dist/core/compaction/compaction-runner.js.map +1 -1
- package/dist/core/compaction/compaction-types.d.ts +3 -2
- package/dist/core/compaction/compaction-types.d.ts.map +1 -1
- package/dist/core/compaction/compaction-types.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +6 -6
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +12 -9
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/index.d.ts +1 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +1 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/range-planner-diagnostics.d.ts +101 -0
- package/dist/core/compaction/range-planner-diagnostics.d.ts.map +1 -0
- package/dist/core/compaction/range-planner-diagnostics.js +116 -0
- package/dist/core/compaction/range-planner-diagnostics.js.map +1 -0
- package/dist/core/compaction/range-planner.d.ts +13 -3
- package/dist/core/compaction/range-planner.d.ts.map +1 -1
- package/dist/core/compaction/range-planner.js +117 -68
- package/dist/core/compaction/range-planner.js.map +1 -1
- package/dist/core/compaction/truncated-range-recovery.d.ts +47 -0
- package/dist/core/compaction/truncated-range-recovery.d.ts.map +1 -0
- package/dist/core/compaction/truncated-range-recovery.js +112 -0
- package/dist/core/compaction/truncated-range-recovery.js.map +1 -0
- package/dist/core/extensions/api-types.d.ts +2 -2
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +23 -1
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader-api.js +2 -2
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +8 -1
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +9 -6
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/message-types.d.ts +17 -0
- package/dist/core/extensions/message-types.d.ts.map +1 -1
- package/dist/core/extensions/message-types.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +3 -0
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/extensions/runner-events.d.ts.map +1 -1
- package/dist/core/extensions/runner-events.js +11 -10
- package/dist/core/extensions/runner-events.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +2 -2
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +78 -0
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/model-registry-auth.d.ts +2 -1
- package/dist/core/model-registry-auth.d.ts.map +1 -1
- package/dist/core/model-registry-auth.js +25 -6
- package/dist/core/model-registry-auth.js.map +1 -1
- package/dist/core/model-registry-builtins.d.ts +3 -2
- package/dist/core/model-registry-builtins.d.ts.map +1 -1
- package/dist/core/model-registry-builtins.js +12 -6
- package/dist/core/model-registry-builtins.js.map +1 -1
- package/dist/core/model-registry-dynamic.d.ts +1 -0
- package/dist/core/model-registry-dynamic.d.ts.map +1 -1
- package/dist/core/model-registry-dynamic.js +53 -13
- package/dist/core/model-registry-dynamic.js.map +1 -1
- package/dist/core/model-registry-loader.d.ts +2 -1
- package/dist/core/model-registry-loader.d.ts.map +1 -1
- package/dist/core/model-registry-loader.js +2 -2
- package/dist/core/model-registry-loader.js.map +1 -1
- package/dist/core/model-registry-types.d.ts +10 -3
- package/dist/core/model-registry-types.d.ts.map +1 -1
- package/dist/core/model-registry-types.js.map +1 -1
- package/dist/core/model-registry.d.ts +15 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +214 -30
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/models-store.d.ts +25 -0
- package/dist/core/models-store.d.ts.map +1 -0
- package/dist/core/models-store.js +73 -0
- package/dist/core/models-store.js.map +1 -0
- package/dist/core/oauth-compat.d.ts +17 -0
- package/dist/core/oauth-compat.d.ts.map +1 -0
- package/dist/core/oauth-compat.js +2 -0
- package/dist/core/oauth-compat.js.map +1 -0
- package/dist/core/oauth-provider-bridge.d.ts +40 -0
- package/dist/core/oauth-provider-bridge.d.ts.map +1 -0
- package/dist/core/oauth-provider-bridge.js +169 -0
- package/dist/core/oauth-provider-bridge.js.map +1 -0
- package/dist/core/output-guard.d.ts +2 -0
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js +14 -0
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -0
- package/dist/core/remote-catalog-provider.js +138 -0
- package/dist/core/remote-catalog-provider.js.map +1 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +8 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +1 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +1 -1
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-entries.d.ts +1 -1
- package/dist/core/session-manager-entries.d.ts.map +1 -1
- package/dist/core/session-manager-entries.js.map +1 -1
- package/dist/core/session-manager-history.d.ts +2 -2
- package/dist/core/session-manager-history.js +2 -2
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +65 -23
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +3 -2
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +9 -5
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +2 -3
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/find.js +2 -2
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.js +2 -2
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.js +2 -2
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +4 -3
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/todos-render.d.ts.map +1 -1
- package/dist/core/tools/todos-render.js +3 -2
- package/dist/core/tools/todos-render.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +3 -2
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/write.js +2 -2
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +29 -0
- package/dist/core/workflow-stage-admission.d.ts.map +1 -0
- package/dist/core/workflow-stage-admission.js +81 -0
- package/dist/core/workflow-stage-admission.js.map +1 -0
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/main-types.d.ts +13 -0
- package/dist/main-types.d.ts.map +1 -0
- package/dist/main-types.js +2 -0
- package/dist/main-types.js.map +1 -0
- package/dist/main.d.ts +2 -5
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +25 -17
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +17 -12
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/atomic-banner.d.ts +7 -0
- package/dist/modes/interactive/components/atomic-banner.d.ts.map +1 -1
- package/dist/modes/interactive/components/atomic-banner.js +20 -0
- package/dist/modes/interactive/components/atomic-banner.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +5 -3
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +3 -4
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +4 -0
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +4 -0
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +79 -8
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +4 -2
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +1 -0
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +4 -1
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.js +3 -4
- package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
- package/dist/modes/interactive/components/host-input-form-mount.d.ts +14 -0
- package/dist/modes/interactive/components/host-input-form-mount.d.ts.map +1 -0
- package/dist/modes/interactive/components/host-input-form-mount.js +79 -0
- package/dist/modes/interactive/components/host-input-form-mount.js.map +1 -0
- package/dist/modes/interactive/components/host-input-form.d.ts +52 -0
- package/dist/modes/interactive/components/host-input-form.d.ts.map +1 -0
- package/dist/modes/interactive/components/host-input-form.js +278 -0
- package/dist/modes/interactive/components/host-input-form.js.map +1 -0
- package/dist/modes/interactive/components/host-session-picker.d.ts +46 -0
- package/dist/modes/interactive/components/host-session-picker.d.ts.map +1 -0
- package/dist/modes/interactive/components/host-session-picker.js +183 -0
- package/dist/modes/interactive/components/host-session-picker.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +2 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +12 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +3 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +8 -2
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +7 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +57 -10
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +15 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +35 -3
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +3 -2
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +24 -10
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.js +7 -1
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js +3 -3
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +49 -0
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-bash-compact.js +2 -0
- package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-context.js +14 -0
- package/dist/modes/interactive/interactive-extension-context.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-global-clear.d.ts +13 -0
- package/dist/modes/interactive/interactive-global-clear.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-global-clear.js +11 -0
- package/dist/modes/interactive/interactive-global-clear.js.map +1 -0
- package/dist/modes/interactive/interactive-input-handling.js +17 -10
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +6 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +25 -2
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +4 -3
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +2 -2
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts +4 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +14 -1
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +3 -2
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +7 -4
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +2 -2
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +25 -4
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +3 -0
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +5 -2
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +22 -9
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-terminal-title.d.ts +6 -0
- package/dist/modes/interactive/interactive-terminal-title.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-terminal-title.js +7 -0
- package/dist/modes/interactive/interactive-terminal-title.js.map +1 -0
- package/dist/modes/interactive-engine/activity-watchdog.d.ts +45 -0
- package/dist/modes/interactive-engine/activity-watchdog.d.ts.map +1 -0
- package/dist/modes/interactive-engine/activity-watchdog.js +74 -0
- package/dist/modes/interactive-engine/activity-watchdog.js.map +1 -0
- package/dist/modes/interactive-engine/create-isolated-runtime.d.ts +14 -0
- package/dist/modes/interactive-engine/create-isolated-runtime.d.ts.map +1 -0
- package/dist/modes/interactive-engine/create-isolated-runtime.js +56 -0
- package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -0
- package/dist/modes/interactive-engine/engine-args.d.ts +10 -0
- package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-args.js +55 -0
- package/dist/modes/interactive-engine/engine-args.js.map +1 -0
- package/dist/modes/interactive-engine/engine-child-liveness.d.ts +7 -0
- package/dist/modes/interactive-engine/engine-child-liveness.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-child-liveness.js +50 -0
- package/dist/modes/interactive-engine/engine-child-liveness.js.map +1 -0
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts +47 -0
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-custom-ui.js +276 -0
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -0
- package/dist/modes/interactive-engine/engine-input-form.d.ts +13 -0
- package/dist/modes/interactive-engine/engine-input-form.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-input-form.js +49 -0
- package/dist/modes/interactive-engine/engine-input-form.js.map +1 -0
- package/dist/modes/interactive-engine/engine-monitor.d.ts +18 -0
- package/dist/modes/interactive-engine/engine-monitor.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-monitor.js +63 -0
- package/dist/modes/interactive-engine/engine-monitor.js.map +1 -0
- package/dist/modes/interactive-engine/engine-render-service.d.ts +17 -0
- package/dist/modes/interactive-engine/engine-render-service.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-render-service.js +150 -0
- package/dist/modes/interactive-engine/engine-render-service.js.map +1 -0
- package/dist/modes/interactive-engine/engine-session-picker.d.ts +22 -0
- package/dist/modes/interactive-engine/engine-session-picker.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-session-picker.js +106 -0
- package/dist/modes/interactive-engine/engine-session-picker.js.map +1 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +23 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.js +126 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -0
- package/dist/modes/interactive-engine/input-form-host.d.ts +15 -0
- package/dist/modes/interactive-engine/input-form-host.d.ts.map +1 -0
- package/dist/modes/interactive-engine/input-form-host.js +44 -0
- package/dist/modes/interactive-engine/input-form-host.js.map +1 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +75 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -0
- package/dist/modes/interactive-engine/isolated-runtime.js +448 -0
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -0
- package/dist/modes/interactive-engine/protocol.d.ts +184 -0
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -0
- package/dist/modes/interactive-engine/protocol.js +254 -0
- package/dist/modes/interactive-engine/protocol.js.map +1 -0
- package/dist/modes/interactive-engine/remote-command-catalog.d.ts +33 -0
- package/dist/modes/interactive-engine/remote-command-catalog.d.ts.map +1 -0
- package/dist/modes/interactive-engine/remote-command-catalog.js +51 -0
- package/dist/modes/interactive-engine/remote-command-catalog.js.map +1 -0
- package/dist/modes/interactive-engine/remote-component.d.ts +16 -0
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -0
- package/dist/modes/interactive-engine/remote-component.js +209 -0
- package/dist/modes/interactive-engine/remote-component.js.map +1 -0
- package/dist/modes/interactive-engine/remote-frame-clamp.d.ts +25 -0
- package/dist/modes/interactive-engine/remote-frame-clamp.d.ts.map +1 -0
- package/dist/modes/interactive-engine/remote-frame-clamp.js +43 -0
- package/dist/modes/interactive-engine/remote-frame-clamp.js.map +1 -0
- package/dist/modes/interactive-engine/remote-renderer.d.ts +59 -0
- package/dist/modes/interactive-engine/remote-renderer.d.ts.map +1 -0
- package/dist/modes/interactive-engine/remote-renderer.js +123 -0
- package/dist/modes/interactive-engine/remote-renderer.js.map +1 -0
- package/dist/modes/interactive-engine/session-picker-host.d.ts +25 -0
- package/dist/modes/interactive-engine/session-picker-host.d.ts.map +1 -0
- package/dist/modes/interactive-engine/session-picker-host.js +75 -0
- package/dist/modes/interactive-engine/session-picker-host.js.map +1 -0
- package/dist/modes/interactive-engine/terminal-mode-controller.d.ts +43 -0
- package/dist/modes/interactive-engine/terminal-mode-controller.d.ts.map +1 -0
- package/dist/modes/interactive-engine/terminal-mode-controller.js +109 -0
- package/dist/modes/interactive-engine/terminal-mode-controller.js.map +1 -0
- package/dist/modes/rpc/bounded-writer.d.ts +27 -0
- package/dist/modes/rpc/bounded-writer.d.ts.map +1 -0
- package/dist/modes/rpc/bounded-writer.js +103 -0
- package/dist/modes/rpc/bounded-writer.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +15 -12
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js +102 -28
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +83 -0
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client-api.js +64 -0
- package/dist/modes/rpc/rpc-client-api.js.map +1 -0
- package/dist/modes/rpc/rpc-client-process.d.ts +19 -0
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client-process.js +79 -0
- package/dist/modes/rpc/rpc-client-process.js.map +1 -0
- package/dist/modes/rpc/rpc-client-waits.d.ts +8 -0
- package/dist/modes/rpc/rpc-client-waits.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client-waits.js +33 -0
- package/dist/modes/rpc/rpc-client-waits.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +48 -124
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +295 -249
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts +5 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +79 -3
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.d.ts +11 -0
- package/dist/modes/rpc/rpc-event-buffer.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-event-buffer.js +30 -0
- package/dist/modes/rpc/rpc-event-buffer.js.map +1 -0
- package/dist/modes/rpc/rpc-extension-ui.d.ts +7 -1
- package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.js +54 -32
- package/dist/modes/rpc/rpc-extension-ui.js.map +1 -1
- package/dist/modes/rpc/rpc-input-scheduler.d.ts +16 -0
- package/dist/modes/rpc/rpc-input-scheduler.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-input-scheduler.js +69 -0
- package/dist/modes/rpc/rpc-input-scheduler.js.map +1 -0
- package/dist/modes/rpc/rpc-input.d.ts +2 -1
- package/dist/modes/rpc/rpc-input.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-input.js +4 -9
- package/dist/modes/rpc/rpc-input.js.map +1 -1
- package/dist/modes/rpc/rpc-keybindings-reload.d.ts +27 -0
- package/dist/modes/rpc/rpc-keybindings-reload.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-keybindings-reload.js +69 -0
- package/dist/modes/rpc/rpc-keybindings-reload.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +63 -8
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-output-buffer.d.ts +10 -0
- package/dist/modes/rpc/rpc-output-buffer.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-output-buffer.js +70 -0
- package/dist/modes/rpc/rpc-output-buffer.js.map +1 -0
- package/dist/modes/rpc/rpc-session-binding.d.ts +16 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +16 -3
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +109 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli-parser.d.ts +2 -0
- package/dist/package-manager-cli-parser.d.ts.map +1 -1
- package/dist/package-manager-cli-parser.js +24 -5
- package/dist/package-manager-cli-parser.js.map +1 -1
- package/dist/package-manager-cli.d.ts +7 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +65 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/shell.d.ts +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +46 -0
- package/dist/utils/shell.js.map +1 -1
- package/docs/changelog.mdx +11 -0
- package/docs/compaction.md +53 -17
- package/docs/custom-provider.md +24 -5
- package/docs/development.md +9 -7
- package/docs/docs.json +1 -0
- package/docs/extensions.md +30 -16
- package/docs/intercom.md +489 -0
- package/docs/json.md +1 -1
- package/docs/keybindings.md +1 -1
- package/docs/packages.md +1 -0
- package/docs/quickstart.md +11 -5
- package/docs/rpc.md +9 -7
- package/docs/sdk.md +6 -0
- package/docs/session-format.md +7 -6
- package/docs/sessions.md +4 -2
- package/docs/settings.md +2 -2
- package/docs/subagents.md +7 -2
- package/docs/tui.md +61 -2
- package/docs/usage.md +6 -5
- package/docs/workflows.md +2572 -1379
- package/examples/extensions/handoff.ts +1 -1
- package/examples/extensions/qna.ts +1 -1
- package/examples/extensions/summarize.ts +1 -1
- package/npm-shrinkwrap.json +225 -76
- package/package.json +7 -6
- package/dist/builtin/workflows/src/durable/file-backend.ts +0 -439
- package/dist/builtin/workflows/src/durable/file-lock.ts +0 -153
- package/dist/builtin/workflows/src/durable/file-state.ts +0 -104
- package/dist/builtin/workflows/src/extension/runtime-direct.ts +0 -96
- package/dist/builtin/workflows/src/extension/workflow-tool-helpers.ts +0 -66
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-output.ts +0 -91
- package/dist/builtin/workflows/src/runs/foreground/executor-direct.ts +0 -282
- package/dist/builtin/workflows/src/shared/resumable-workflow-notices.ts +0 -43
- package/dist/builtin/workflows/src/tui/session-confirm.ts +0 -299
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nextEventLoopTurn, runWorkflowDefinitionCallback } from "./workflow-activity.js";
|
|
1
2
|
import type { RunSnapshot, StageSnapshot } from "../shared/store-types.js";
|
|
2
3
|
import type { WorkflowDefinition, WorkflowInputValues, WorkflowOutputValues, WorkflowRunContext } from "../shared/types.js";
|
|
3
4
|
import type { WorkflowFailure } from "../shared/workflow-failures.js";
|
|
@@ -29,6 +30,7 @@ import {
|
|
|
29
30
|
finalizeKilled,
|
|
30
31
|
finalizeKilledByFailure,
|
|
31
32
|
recordActiveBlockedFailure,
|
|
33
|
+
normalizeStageLessFailureMetadata,
|
|
32
34
|
reconcileTerminalRunResult,
|
|
33
35
|
selectRunFailureDisposition,
|
|
34
36
|
} from "../runs/foreground/executor-lifecycle.js";
|
|
@@ -37,8 +39,8 @@ import { isWorkflowDefinition, workflowDefinitionRequirementMessage } from "../r
|
|
|
37
39
|
import { getDurableBackend } from "../durable/factory.js";
|
|
38
40
|
import { classifyReturnedRunStatus } from "./run-returned-status.js";
|
|
39
41
|
import { createToolPrimitive, createCheckpointIdGenerator } from "../durable/tool-primitive.js";
|
|
40
|
-
import { persistDurableCacheEntry } from "../durable/resume-catalog.js";
|
|
41
42
|
import { createDurableStagePrimitive, createDurableTaskPrimitive, recordStageCheckpoint, createStageReplayKeyGenerator, recordCachedStageWithTracker } from "../durable/stage-primitive.js";
|
|
43
|
+
import { inheritedRunElapsedMs } from "../durable/run-timing.js";
|
|
42
44
|
import type { DurableCompletedStageCheckpoint } from "../durable/stage-primitive.js";
|
|
43
45
|
import { createDurableChildWorkflowPrimitive } from "../durable/child-primitive.js";
|
|
44
46
|
import { ScopedDurableBackend, type DurableScope } from "../durable/scoped-backend.js";
|
|
@@ -46,10 +48,6 @@ import { finalizeDurableTerminalStatus } from "./run-durable-finalize.js";
|
|
|
46
48
|
import { createDurableStageSessionRecorder } from "./run-durable-stage-session.js";
|
|
47
49
|
import type { DurableWorkflowBackend } from "../durable/backend.js";
|
|
48
50
|
|
|
49
|
-
function nextEventLoopTurn(): Promise<void> {
|
|
50
|
-
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
51
|
type WorkflowRunInputArgument = Parameters<typeof resolveAndValidateInputs>[1];
|
|
54
52
|
|
|
55
53
|
export function run<
|
|
@@ -100,6 +98,19 @@ export async function run<
|
|
|
100
98
|
else callerSignal.addEventListener("abort", () => { ownController.abort(callerSignal.reason); }, { once: true });
|
|
101
99
|
}
|
|
102
100
|
const exit = createWorkflowExitManager({ runId, exitScope, controller: ownController });
|
|
101
|
+
// Durable workflow backend — registers this run and wires ctx.tool/ui/stage.
|
|
102
|
+
// Declared early so the stage-end recorder can attach to stageOptions and so
|
|
103
|
+
// resume can seed inherited elapsed time. Child runs with a durable scope
|
|
104
|
+
// route their internal side-effect checkpoints under the root workflow so
|
|
105
|
+
// interrupted children do not re-execute completed side effects on parent
|
|
106
|
+
// resume. cross-ref: issue #1498 — DBOS-backed cross-session resumability.
|
|
107
|
+
const rootBackend: DurableWorkflowBackend = opts.durableBackend ?? getDurableBackend();
|
|
108
|
+
const durableBackend: DurableWorkflowBackend = opts.durableScope !== undefined
|
|
109
|
+
? new ScopedDurableBackend(rootBackend, opts.durableScope)
|
|
110
|
+
: rootBackend;
|
|
111
|
+
const inheritedElapsedMs = opts.parentRun === undefined
|
|
112
|
+
? inheritedRunElapsedMs({ backend: durableBackend, runId, continuationSource: opts.continuation?.source })
|
|
113
|
+
: undefined;
|
|
103
114
|
|
|
104
115
|
const runSnapshot: RunSnapshot = {
|
|
105
116
|
id: runId,
|
|
@@ -117,6 +128,7 @@ export async function run<
|
|
|
117
128
|
resumedFromRunId: opts.continuation.source.id,
|
|
118
129
|
resumeFromStageId: opts.continuation.resumeFromStageId,
|
|
119
130
|
} : {}),
|
|
131
|
+
...(inheritedElapsedMs !== undefined ? { accumulatedDurationMs: inheritedElapsedMs } : {}),
|
|
120
132
|
};
|
|
121
133
|
|
|
122
134
|
const classifiedFailures = new Map<unknown, WorkflowFailure>();
|
|
@@ -146,6 +158,7 @@ export async function run<
|
|
|
146
158
|
...(runSnapshot.rootRunId !== undefined ? { rootRunId: runSnapshot.rootRunId } : {}),
|
|
147
159
|
...(runSnapshot.resumedFromRunId !== undefined ? { resumedFromRunId: runSnapshot.resumedFromRunId } : {}),
|
|
148
160
|
...(runSnapshot.resumeFromStageId !== undefined ? { resumeFromStageId: runSnapshot.resumeFromStageId } : {}),
|
|
161
|
+
...(runSnapshot.accumulatedDurationMs !== undefined ? { accumulatedDurationMs: runSnapshot.accumulatedDurationMs } : {}),
|
|
149
162
|
ts: runSnapshot.startedAt,
|
|
150
163
|
});
|
|
151
164
|
}
|
|
@@ -185,16 +198,6 @@ export async function run<
|
|
|
185
198
|
classifyExecutorFailure,
|
|
186
199
|
drainWorkflowExitCleanups: exit.drainWorkflowExitCleanups,
|
|
187
200
|
});
|
|
188
|
-
// Durable workflow backend — registers this run and wires ctx.tool/ui/stage.
|
|
189
|
-
// Declared early so the stage-end recorder can attach to stageOptions.
|
|
190
|
-
// cross-ref: issue #1498 — DBOS-backed cross-session resumability.
|
|
191
|
-
// Child runs with a durable scope route their internal side-effect
|
|
192
|
-
// checkpoints under the root workflow so interrupted children do not
|
|
193
|
-
// re-execute completed side effects on parent resume.
|
|
194
|
-
const rootBackend: DurableWorkflowBackend = opts.durableBackend ?? getDurableBackend();
|
|
195
|
-
const durableBackend: DurableWorkflowBackend = opts.durableScope !== undefined
|
|
196
|
-
? new ScopedDurableBackend(rootBackend, opts.durableScope)
|
|
197
|
-
: rootBackend;
|
|
198
201
|
const checkpointIdGenerator = createCheckpointIdGenerator();
|
|
199
202
|
const stageReplayKeyGenerator = createStageReplayKeyGenerator(runId);
|
|
200
203
|
const completedStageReplayKeys = new Map<string, string>();
|
|
@@ -209,14 +212,13 @@ export async function run<
|
|
|
209
212
|
const durableOnStageEnd = async (stageRunId: string, snapshot: StageSnapshot): Promise<void> => {
|
|
210
213
|
if (stageRunId === runId && snapshot.status === "completed") {
|
|
211
214
|
await recordStageCheckpoint(durableStageDeps, snapshot);
|
|
212
|
-
if (opts.persistence && durableBackend.persistent) {
|
|
213
|
-
const cacheEntry = durableBackend.toCacheEntry(runId);
|
|
214
|
-
if (cacheEntry) persistDurableCacheEntry(opts.persistence, cacheEntry);
|
|
215
|
-
}
|
|
216
215
|
}
|
|
217
216
|
await userOnStageEnd?.(stageRunId, snapshot);
|
|
218
217
|
};
|
|
219
|
-
const durableOnStageSession = createDurableStageSessionRecorder({
|
|
218
|
+
const durableOnStageSession = createDurableStageSessionRecorder({
|
|
219
|
+
runId, deps: durableStageDeps, onStageSession: opts.onStageSession,
|
|
220
|
+
...(opts.parentRun === undefined ? { runSnapshot } : {}),
|
|
221
|
+
});
|
|
220
222
|
const stageOptions: EngineStageRuntimeOptions = {
|
|
221
223
|
continuation: opts.continuation,
|
|
222
224
|
models: opts.models,
|
|
@@ -273,6 +275,7 @@ export async function run<
|
|
|
273
275
|
inputRuntimeDefaults,
|
|
274
276
|
workflowInvocationCwd,
|
|
275
277
|
stageRegistry, gitWorktreeSetupCache,
|
|
278
|
+
worktreeSymlinkDirectories: opts.config?.worktree?.symlinkDirectories,
|
|
276
279
|
exit,
|
|
277
280
|
classifyExecutorFailure,
|
|
278
281
|
});
|
|
@@ -321,11 +324,8 @@ export async function run<
|
|
|
321
324
|
resumable: true,
|
|
322
325
|
...(opts.persistence !== undefined ? { sessionFile: undefined } : {}),
|
|
323
326
|
};
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
} else if (opts.parentRun === undefined) {
|
|
327
|
-
durableBackend.setWorkflowStatus(runId, "running");
|
|
328
|
-
}
|
|
327
|
+
const shouldRegisterDurableRoot = opts.parentRun === undefined
|
|
328
|
+
&& (opts.continuation === undefined || opts.continuation.source.id !== runId);
|
|
329
329
|
const tool = createToolPrimitive({
|
|
330
330
|
workflowId: runId,
|
|
331
331
|
backend: durableBackend,
|
|
@@ -365,6 +365,7 @@ export async function run<
|
|
|
365
365
|
runId,
|
|
366
366
|
activeStore,
|
|
367
367
|
opts,
|
|
368
|
+
stageControlRegistry: stageRegistry,
|
|
368
369
|
tracker,
|
|
369
370
|
replayIndex,
|
|
370
371
|
signal: ownController.signal,
|
|
@@ -406,11 +407,13 @@ export async function run<
|
|
|
406
407
|
}
|
|
407
408
|
}
|
|
408
409
|
|
|
409
|
-
if (
|
|
410
|
+
if (shouldRegisterDurableRoot) {
|
|
410
411
|
durableBackend.registerWorkflow({ ...durableRootWorkflowRegistration, ...workflowInvocationMetadata(inputRuntimeDefaults, workflowInvocationCwd, gitWorktreeSetupCache) });
|
|
412
|
+
} else if (opts.parentRun === undefined) {
|
|
413
|
+
durableBackend.setWorkflowStatus(runId, "running");
|
|
411
414
|
}
|
|
412
|
-
|
|
413
|
-
const rawResult = await def.run(ctx);
|
|
415
|
+
if (opts.deferWorkflowStart === true) opts.onWorkflowStartReady?.();
|
|
416
|
+
const rawResult = await runWorkflowDefinitionCallback(def.name, runId, () => def.run(ctx));
|
|
414
417
|
if (ownController.signal.aborted) {
|
|
415
418
|
const selectedExit = findWorkflowExitSignal(ownController.signal.reason, exitScope);
|
|
416
419
|
if (selectedExit !== undefined) return await finalizers.finalizeWorkflowExit(selectedExit);
|
|
@@ -422,16 +425,12 @@ export async function run<
|
|
|
422
425
|
const result = normalizeWorkflowRunOutput(def.name, rawResult);
|
|
423
426
|
assertWorkflowRunOutputs(def.name, result, def.outputs);
|
|
424
427
|
assertWorkflowCreatedStage(runSnapshot);
|
|
425
|
-
await durableBackend.flush
|
|
428
|
+
await durableBackend.flush();
|
|
426
429
|
const returned = classifyReturnedRunStatus(result, runSnapshot);
|
|
427
430
|
const recorded = activeStore.recordRunEnd(runId, returned.status, result, returned.error, returned.metadata);
|
|
428
431
|
appendRunEndWhenRecorded(opts.persistence, recorded, { runId, status: returned.status, result, ...(returned.error !== undefined ? { error: returned.error } : {}), ...(returned.metadata ?? {}), ...(runSnapshot.endedAt !== undefined ? { endedAt: runSnapshot.endedAt } : {}), ...(runSnapshot.durationMs !== undefined ? { durationMs: runSnapshot.durationMs } : {}), ts: Date.now() });
|
|
429
432
|
durableBackend.setWorkflowStatus(runId, returned.status, undefined, returned.metadata?.resumable);
|
|
430
|
-
await durableBackend.flush
|
|
431
|
-
if (opts.persistence && durableBackend.persistent) {
|
|
432
|
-
const cacheEntry = durableBackend.toCacheEntry(runId);
|
|
433
|
-
if (cacheEntry) persistDurableCacheEntry(opts.persistence, cacheEntry);
|
|
434
|
-
}
|
|
433
|
+
await durableBackend.flush();
|
|
435
434
|
return reconcileTerminalRunResult(runId, runSnapshot, activeStore, { status: returned.status, result, error: returned.error }, opts.onRunEnd);
|
|
436
435
|
} catch (err) {
|
|
437
436
|
const selectedExit = findWorkflowExitSignal(err, exitScope) ?? findWorkflowExitSignal(ownController.signal.reason, exitScope);
|
|
@@ -444,12 +443,12 @@ export async function run<
|
|
|
444
443
|
}
|
|
445
444
|
|
|
446
445
|
const failure = classifyExecutorFailure(err);
|
|
447
|
-
const metadata = selectRunFailureDisposition({
|
|
446
|
+
const metadata = normalizeStageLessFailureMetadata(selectRunFailureDisposition({
|
|
448
447
|
outerFailure: failure,
|
|
449
448
|
thrownError: err,
|
|
450
449
|
stages: runSnapshot.stages,
|
|
451
450
|
classifyFailure: classifyExecutorFailure,
|
|
452
|
-
});
|
|
451
|
+
}), runSnapshot.stages.length);
|
|
453
452
|
|
|
454
453
|
if (metadata.failureDisposition === "terminal_killed") {
|
|
455
454
|
for (const failedStageId of metadata.failedStageIds) scheduler.blockKnownNonTerminalDescendants(failedStageId);
|
|
@@ -491,7 +490,6 @@ export async function run<
|
|
|
491
490
|
runSnapshot,
|
|
492
491
|
isRoot: opts.parentRun === undefined,
|
|
493
492
|
durableBackend,
|
|
494
|
-
persistence: opts.persistence,
|
|
495
493
|
});
|
|
496
494
|
} finally {
|
|
497
495
|
gitWorktreeSetupCacheOwner.release(() => opts.cancellation?.unregister(runId));
|
|
@@ -33,6 +33,7 @@ export interface EngineRuntimeInput {
|
|
|
33
33
|
readonly inputRuntimeDefaults: Partial<StageOptions>;
|
|
34
34
|
readonly workflowInvocationCwd: string;
|
|
35
35
|
readonly gitWorktreeSetupCache: GitWorktreeSetupCache;
|
|
36
|
+
readonly worktreeSymlinkDirectories?: readonly string[];
|
|
36
37
|
readonly stageRegistry: StageControlRegistry;
|
|
37
38
|
readonly exit: WorkflowExitManager;
|
|
38
39
|
readonly classifyExecutorFailure: LiveStageRuntime["classifyExecutorFailure"];
|
|
@@ -76,6 +77,7 @@ export class EngineRuntime {
|
|
|
76
77
|
readonly inputRuntimeDefaults: Partial<StageOptions>;
|
|
77
78
|
readonly workflowInvocationCwd: string;
|
|
78
79
|
readonly gitWorktreeSetupCache: GitWorktreeSetupCache;
|
|
80
|
+
readonly worktreeSymlinkDirectories?: readonly string[];
|
|
79
81
|
|
|
80
82
|
private readonly spawnAgentStage: (
|
|
81
83
|
name: string,
|
|
@@ -97,6 +99,7 @@ export class EngineRuntime {
|
|
|
97
99
|
this.inputRuntimeDefaults = input.inputRuntimeDefaults;
|
|
98
100
|
this.workflowInvocationCwd = input.workflowInvocationCwd;
|
|
99
101
|
this.gitWorktreeSetupCache = input.gitWorktreeSetupCache;
|
|
102
|
+
this.worktreeSymlinkDirectories = input.worktreeSymlinkDirectories;
|
|
100
103
|
|
|
101
104
|
// The runtime only wires host-injected ports; stage sessions are still
|
|
102
105
|
// created lazily by the stage runner through input.adapters.agentSession.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { runCallback } from "@bastani/atomic";
|
|
2
|
+
|
|
3
|
+
export function nextEventLoopTurn(): Promise<void> {
|
|
4
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function runWorkflowDefinitionCallback<T>(name: string, runId: string, callback: () => T | Promise<T>): Promise<T> {
|
|
8
|
+
return runCallback({ kind: "workflow.run", name, runId }, callback);
|
|
9
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { StageControlHandle } from "../runs/foreground/stage-control-registry.js";
|
|
2
|
+
import type {
|
|
3
|
+
EnsurePostMortemStageHandleResult,
|
|
4
|
+
PostMortemUnavailableReason,
|
|
5
|
+
} from "../runs/foreground/postmortem-stage-chat.js";
|
|
6
|
+
|
|
7
|
+
const LATE_STAGE_MESSAGE_EVENT = "atomic:workflow-stage-late-message";
|
|
8
|
+
const POST_MORTEM_ATTACH_TIMEOUT_MS = 10_000;
|
|
9
|
+
|
|
10
|
+
interface IntercomAskMessage {
|
|
11
|
+
readonly customType: "intercom_message";
|
|
12
|
+
readonly content: string;
|
|
13
|
+
readonly details?: {
|
|
14
|
+
readonly message?: {
|
|
15
|
+
readonly expectsReply?: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface CompletedStageAskEvent {
|
|
21
|
+
handled: boolean;
|
|
22
|
+
completion?: Promise<void>;
|
|
23
|
+
readonly batch: boolean;
|
|
24
|
+
readonly workflowRunId?: string;
|
|
25
|
+
readonly workflowStageId?: string;
|
|
26
|
+
readonly messages: readonly IntercomAskMessage[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface WorkflowEventSurface {
|
|
30
|
+
readonly events?: {
|
|
31
|
+
on?(event: string, listener: (payload: unknown) => void): (() => void) | void;
|
|
32
|
+
};
|
|
33
|
+
on?(event: "session_shutdown", listener: () => void): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type CompletedStageHandleResolver = (
|
|
37
|
+
runId: string,
|
|
38
|
+
stageId: string,
|
|
39
|
+
) => EnsurePostMortemStageHandleResult | undefined;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Claims late blocking Intercom asks for completed workflow stages and runs one
|
|
43
|
+
* post-mortem turn in the retained conversation. Ordinary late notifications
|
|
44
|
+
* keep using the existing parent-chat route.
|
|
45
|
+
*/
|
|
46
|
+
export function registerCompletedStageIntercomAskRouter(
|
|
47
|
+
pi: WorkflowEventSurface,
|
|
48
|
+
resolveHandle: CompletedStageHandleResolver,
|
|
49
|
+
): () => void {
|
|
50
|
+
const queues = new Map<string, Promise<void>>();
|
|
51
|
+
let disposed = false;
|
|
52
|
+
const unsubscribe = pi.events?.on?.(LATE_STAGE_MESSAGE_EVENT, (payload) => {
|
|
53
|
+
if (disposed || !isCompletedStageAskEvent(payload) || payload.handled === true) return;
|
|
54
|
+
payload.handled = true;
|
|
55
|
+
payload.completion = enqueueTargetTurn(
|
|
56
|
+
queues,
|
|
57
|
+
`${payload.workflowRunId}:${payload.workflowStageId}`,
|
|
58
|
+
() => deliverAsPostMortemTurn(payload, resolveHandle),
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
const dispose = (): void => {
|
|
62
|
+
disposed = true;
|
|
63
|
+
queues.clear();
|
|
64
|
+
unsubscribe?.();
|
|
65
|
+
};
|
|
66
|
+
pi.on?.("session_shutdown", dispose);
|
|
67
|
+
return dispose;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function isCompletedStageAskEvent(payload: unknown): payload is CompletedStageAskEvent & {
|
|
71
|
+
readonly workflowRunId: string;
|
|
72
|
+
readonly workflowStageId: string;
|
|
73
|
+
} {
|
|
74
|
+
if (typeof payload !== "object" || payload === null) return false;
|
|
75
|
+
const event = payload as Partial<CompletedStageAskEvent>;
|
|
76
|
+
return typeof event.workflowRunId === "string"
|
|
77
|
+
&& event.workflowRunId.length > 0
|
|
78
|
+
&& typeof event.workflowStageId === "string"
|
|
79
|
+
&& event.workflowStageId.length > 0
|
|
80
|
+
&& Array.isArray(event.messages)
|
|
81
|
+
&& event.messages.length > 0
|
|
82
|
+
&& event.messages.every((message) =>
|
|
83
|
+
message?.customType === "intercom_message"
|
|
84
|
+
&& typeof message.content === "string"
|
|
85
|
+
&& message.details?.message?.expectsReply === true,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function enqueueTargetTurn(
|
|
90
|
+
queues: Map<string, Promise<void>>,
|
|
91
|
+
key: string,
|
|
92
|
+
deliver: () => Promise<void>,
|
|
93
|
+
): Promise<void> {
|
|
94
|
+
const previous = queues.get(key) ?? Promise.resolve();
|
|
95
|
+
const current = previous.catch(() => {}).then(deliver);
|
|
96
|
+
queues.set(key, current);
|
|
97
|
+
void current.finally(() => {
|
|
98
|
+
if (queues.get(key) === current) queues.delete(key);
|
|
99
|
+
}).catch(() => {});
|
|
100
|
+
return current;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function deliverAsPostMortemTurn(
|
|
104
|
+
event: CompletedStageAskEvent & { readonly workflowRunId: string; readonly workflowStageId: string },
|
|
105
|
+
resolveHandle: CompletedStageHandleResolver,
|
|
106
|
+
): Promise<void> {
|
|
107
|
+
const resolution = resolveHandle(event.workflowRunId, event.workflowStageId);
|
|
108
|
+
if (resolution === undefined) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
`Intercom ask target is unavailable: completed workflow stage ${event.workflowRunId}/${event.workflowStageId} was deleted or is no longer retained.`,
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
if (!resolution.ok) {
|
|
114
|
+
throw new Error(unavailableReason(event.workflowRunId, event.workflowStageId, resolution.reason));
|
|
115
|
+
}
|
|
116
|
+
const handle = resolution.handle;
|
|
117
|
+
if (handle.status !== "completed" || handle.isDisposed === true) {
|
|
118
|
+
throw new Error(
|
|
119
|
+
`Intercom ask target is not resumable: workflow stage ${event.workflowRunId}/${event.workflowStageId} has no retained completed conversation.`,
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
await attachWithTimeout(handle);
|
|
123
|
+
for (const message of event.messages) {
|
|
124
|
+
if (handle.isStreaming) await handle.followUp(message.content);
|
|
125
|
+
else await handle.prompt(message.content);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function attachWithTimeout(handle: StageControlHandle): Promise<void> {
|
|
130
|
+
let timeout: ReturnType<typeof setTimeout> | undefined;
|
|
131
|
+
const bounded = new Promise<never>((_, reject) => {
|
|
132
|
+
timeout = setTimeout(() => reject(new Error(
|
|
133
|
+
`Intercom ask target failed to resume within ${POST_MORTEM_ATTACH_TIMEOUT_MS}ms: retained stage conversation ${handle.runId}/${handle.stageId}.`,
|
|
134
|
+
)), POST_MORTEM_ATTACH_TIMEOUT_MS);
|
|
135
|
+
});
|
|
136
|
+
try {
|
|
137
|
+
await Promise.race([handle.ensureAttached(), bounded]);
|
|
138
|
+
} finally {
|
|
139
|
+
if (timeout !== undefined) clearTimeout(timeout);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function unavailableReason(runId: string, stageId: string, reason: PostMortemUnavailableReason): string {
|
|
144
|
+
const target = `${runId}/${stageId}`;
|
|
145
|
+
switch (reason) {
|
|
146
|
+
case "not_terminal":
|
|
147
|
+
return `Intercom ask target is not resumable: workflow stage ${target} is not a completed stage with a retained conversation.`;
|
|
148
|
+
case "no_session":
|
|
149
|
+
return `Intercom ask target is unavailable: completed workflow stage ${target} has no retained conversation.`;
|
|
150
|
+
case "invalid_session":
|
|
151
|
+
return `Intercom ask target is unavailable: retained conversation for completed workflow stage ${target} is missing, deleted, or invalid.`;
|
|
152
|
+
case "no_adapter":
|
|
153
|
+
return `Intercom ask target is not resumable: no workflow stage session adapter can reopen ${target}.`;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -73,6 +73,19 @@ function validateConfig(value: unknown): string | null {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
+
if ("worktree" in c) {
|
|
77
|
+
const worktree = c["worktree"];
|
|
78
|
+
if (worktree === null || typeof worktree !== "object" || Array.isArray(worktree)) {
|
|
79
|
+
return `"worktree" must be a JSON object, got ${JSON.stringify(typeof worktree)}`;
|
|
80
|
+
}
|
|
81
|
+
const config = worktree as Record<string, unknown>;
|
|
82
|
+
if ("symlinkDirectories" in config) {
|
|
83
|
+
const directories = config["symlinkDirectories"];
|
|
84
|
+
if (!Array.isArray(directories) || directories.some((entry) => typeof entry !== "string")) {
|
|
85
|
+
return `"worktree.symlinkDirectories" must be an array of strings`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
76
89
|
|
|
77
90
|
if ("workflows" in c) {
|
|
78
91
|
if (c["workflows"] === null || typeof c["workflows"] !== "object" || Array.isArray(c["workflows"])) {
|
|
@@ -42,6 +42,10 @@ export interface WorkflowNotificationsConfig {
|
|
|
42
42
|
readonly notifyOn?: readonly WorkflowLifecycleNoticeKind[];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export interface WorkflowWorktreeConfig {
|
|
46
|
+
/** Main-root directories symlinked into temporary worktrees. */
|
|
47
|
+
readonly symlinkDirectories?: readonly string[];
|
|
48
|
+
}
|
|
45
49
|
export interface WorkflowExtensionConfig {
|
|
46
50
|
/** Explicit named workflows to register by module path. */
|
|
47
51
|
readonly workflows?: Readonly<Record<string, WorkflowConfigEntry>>;
|
|
@@ -57,6 +61,8 @@ export interface WorkflowExtensionConfig {
|
|
|
57
61
|
readonly resumeInFlight?: "ask" | "auto" | "never";
|
|
58
62
|
/** Main-chat workflow lifecycle notices. */
|
|
59
63
|
readonly workflowNotifications?: WorkflowNotificationsConfig;
|
|
64
|
+
/** Temporary-worktree post-creation settings. */
|
|
65
|
+
readonly worktree?: WorkflowWorktreeConfig;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
/** Severity of a config diagnostic. */
|
|
@@ -159,6 +165,9 @@ function mergeConfigs(
|
|
|
159
165
|
},
|
|
160
166
|
}
|
|
161
167
|
: {}),
|
|
168
|
+
...(base.worktree !== undefined || override.worktree !== undefined
|
|
169
|
+
? { worktree: { ...(base.worktree ?? {}), ...(override.worktree ?? {}) } }
|
|
170
|
+
: {}),
|
|
162
171
|
...(workflows !== undefined ? { workflows } : {}),
|
|
163
172
|
};
|
|
164
173
|
}
|
|
@@ -184,6 +193,9 @@ export const WORKFLOW_CONFIG_DEFAULTS = {
|
|
|
184
193
|
enabled: true,
|
|
185
194
|
notifyOn: ["completed", "failed", "blocked", "awaiting_input"] as const,
|
|
186
195
|
},
|
|
196
|
+
worktree: {
|
|
197
|
+
symlinkDirectories: ["node_modules"] as readonly string[],
|
|
198
|
+
},
|
|
187
199
|
} as const;
|
|
188
200
|
|
|
189
201
|
/**
|
|
@@ -200,6 +212,9 @@ export interface WorkflowEffectiveConfig {
|
|
|
200
212
|
readonly enabled: boolean;
|
|
201
213
|
readonly notifyOn: readonly WorkflowLifecycleNoticeKind[];
|
|
202
214
|
};
|
|
215
|
+
readonly worktree: {
|
|
216
|
+
readonly symlinkDirectories: readonly string[];
|
|
217
|
+
};
|
|
203
218
|
readonly workflows?: Readonly<Record<string, WorkflowConfigEntry>>;
|
|
204
219
|
}
|
|
205
220
|
|
|
@@ -228,6 +243,11 @@ export function withWorkflowDefaults(
|
|
|
228
243
|
config.workflowNotifications?.notifyOn
|
|
229
244
|
?? WORKFLOW_CONFIG_DEFAULTS.workflowNotifications.notifyOn,
|
|
230
245
|
},
|
|
246
|
+
worktree: {
|
|
247
|
+
symlinkDirectories:
|
|
248
|
+
config.worktree?.symlinkDirectories
|
|
249
|
+
?? WORKFLOW_CONFIG_DEFAULTS.worktree.symlinkDirectories,
|
|
250
|
+
},
|
|
231
251
|
...(config.workflows !== undefined ? { workflows: config.workflows } : {}),
|
|
232
252
|
};
|
|
233
253
|
}
|
|
@@ -13,10 +13,12 @@ import { store as defaultStore, type Store } from "../shared/store.js";
|
|
|
13
13
|
import type { CancellationRegistry } from "../runs/background/cancellation-registry.js";
|
|
14
14
|
import { jobTracker as defaultJobTracker, type JobTracker } from "../runs/background/job-tracker.js";
|
|
15
15
|
import { resolveAndValidateInputs } from "../runs/foreground/executor.js";
|
|
16
|
-
import {
|
|
16
|
+
import { launchDetachedUntilStartup, workflowStartupFailureMessage } from "../runs/background/startup-admission.js";
|
|
17
17
|
import type { WorkflowToolResult, WorkflowInputEntry } from "./render-result.js";
|
|
18
18
|
import { deriveInputFields, schemaIsRequired } from "../shared/schema-introspection.js";
|
|
19
|
+
import { effectiveRunStatus } from "../shared/returned-run-status.js";
|
|
19
20
|
import type { WorkflowToolArgs } from "./index.js";
|
|
21
|
+
import { getDurableBackend } from "../durable/factory.js";
|
|
20
22
|
import {
|
|
21
23
|
INTERACTIVE_WORKFLOW_POLICY,
|
|
22
24
|
type WorkflowExecutionPolicy,
|
|
@@ -38,6 +40,19 @@ function failedRunResult(name: string | undefined, runId: string, error: string)
|
|
|
38
40
|
stages: [],
|
|
39
41
|
};
|
|
40
42
|
}
|
|
43
|
+
async function discardUnadmittedRun(runId: string, activeStore: Store): Promise<void> {
|
|
44
|
+
activeStore.removeRun(runId);
|
|
45
|
+
const backend = getDurableBackend();
|
|
46
|
+
const handle = backend.getWorkflow(runId);
|
|
47
|
+
if (handle?.status === "running") {
|
|
48
|
+
backend.setWorkflowStatus(runId, "failed", handle.pendingPrompts, false);
|
|
49
|
+
await backend.flush();
|
|
50
|
+
}
|
|
51
|
+
const deleted = await backend.deleteWorkflowIfInactive(runId);
|
|
52
|
+
if (!deleted.ok && deleted.reason !== "not_found") {
|
|
53
|
+
throw new Error(`workflow ${runId} remained ${deleted.reason}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
41
56
|
|
|
42
57
|
// ---------------------------------------------------------------------------
|
|
43
58
|
// Options
|
|
@@ -163,20 +178,44 @@ export async function dispatch(
|
|
|
163
178
|
);
|
|
164
179
|
}
|
|
165
180
|
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
181
|
+
const runId = crypto.randomUUID();
|
|
182
|
+
let launch: ReturnType<typeof launchDetachedUntilStartup>;
|
|
183
|
+
try {
|
|
184
|
+
launch = launchDetachedUntilStartup(def, inputs, {
|
|
185
|
+
registry: opts.registry,
|
|
186
|
+
adapters: opts.adapters,
|
|
187
|
+
store: opts.store,
|
|
188
|
+
cancellation: opts.cancellation,
|
|
189
|
+
jobs: opts.jobs,
|
|
190
|
+
persistence: opts.persistence,
|
|
191
|
+
mcp: opts.mcp,
|
|
192
|
+
config: opts.config,
|
|
193
|
+
models: opts.models,
|
|
194
|
+
executionMode: policy.mode,
|
|
195
|
+
cwd: opts.cwd,
|
|
196
|
+
defaultSessionDir: opts.defaultSessionDir,
|
|
197
|
+
runId,
|
|
198
|
+
});
|
|
199
|
+
} catch (error) {
|
|
200
|
+
return failedRunResult(def.name, runId, error instanceof Error ? error.message : String(error));
|
|
201
|
+
}
|
|
202
|
+
const { accepted } = launch;
|
|
203
|
+
const admission = await launch.wait;
|
|
204
|
+
if (!admission.started) {
|
|
205
|
+
const activeStore = opts.store ?? defaultStore;
|
|
206
|
+
const snapshot = activeStore.runs().find((run) => run.id === accepted.runId);
|
|
207
|
+
const error = workflowStartupFailureMessage(
|
|
208
|
+
admission,
|
|
209
|
+
snapshot?.error,
|
|
210
|
+
`Workflow run ${accepted.runId} ended before startup admission`,
|
|
211
|
+
);
|
|
212
|
+
try {
|
|
213
|
+
await discardUnadmittedRun(accepted.runId, activeStore);
|
|
214
|
+
} catch (cleanupError) {
|
|
215
|
+
return failedRunResult(accepted.name, accepted.runId, `${error}; startup cleanup failed: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
|
|
216
|
+
}
|
|
217
|
+
return failedRunResult(accepted.name, accepted.runId, error);
|
|
218
|
+
}
|
|
180
219
|
if (policy.awaitTerminalRun === true) {
|
|
181
220
|
const tracker = opts.jobs ?? defaultJobTracker;
|
|
182
221
|
const job = tracker.get(accepted.runId);
|
|
@@ -201,7 +240,7 @@ export async function dispatch(
|
|
|
201
240
|
action: "run",
|
|
202
241
|
name: snapshot.name,
|
|
203
242
|
runId: snapshot.id,
|
|
204
|
-
status: snapshot
|
|
243
|
+
status: effectiveRunStatus(snapshot),
|
|
205
244
|
result: snapshot.result,
|
|
206
245
|
error: snapshot.error,
|
|
207
246
|
exited: snapshot.exited,
|
|
@@ -220,7 +259,7 @@ export async function dispatch(
|
|
|
220
259
|
}
|
|
221
260
|
|
|
222
261
|
default:
|
|
223
|
-
//
|
|
262
|
+
// Status and run-control actions are not routed here; unknown actions are bugs.
|
|
224
263
|
throw new Error(`WorkflowDispatcher: unknown action "${action}"`);
|
|
225
264
|
}
|
|
226
265
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { quitRun } from "../runs/background/quit.js";
|
|
2
1
|
import { store } from "../shared/store.js";
|
|
3
2
|
import { subscribeIntercomControl } from "../intercom/result-intercom.js";
|
|
4
3
|
import { buildIntercomCallbacks } from "../intercom/intercom-routing.js";
|
|
@@ -15,6 +14,9 @@ import { createWorkflowExtensionRuntimeState } from "./extension-runtime-state.j
|
|
|
15
14
|
import { registerWorkflowLifecycleHandlers } from "./extension-lifecycle.js";
|
|
16
15
|
import { dynamicTextRenderComponent } from "./render-component.js";
|
|
17
16
|
import { makeExecuteWorkflowTool } from "./workflow-tool.js";
|
|
17
|
+
import { createPostMortemHandleResolver, postMortemDepsForRun } from "./postmortem-deps.js";
|
|
18
|
+
import { registerCompletedStageIntercomAskRouter } from "./completed-stage-intercom-ask.js";
|
|
19
|
+
import type { PostMortemHandleResolution } from "../tui/workflow-attach-pane-types.js";
|
|
18
20
|
import { registerWorkflowTool } from "./workflow-tool-registration.js";
|
|
19
21
|
import { registerWorkflowSlashCommand } from "./workflow-command-registration.js";
|
|
20
22
|
import { installInputInterceptor, type WorkflowCommandHandler } from "./workflow-command-utils.js";
|
|
@@ -34,13 +36,9 @@ function registerWorkflowMessageRenderers(pi: ExtensionAPI): void {
|
|
|
34
36
|
|
|
35
37
|
function buildWorkflowOverlay(
|
|
36
38
|
pi: ExtensionAPI,
|
|
39
|
+
resolvePostMortemHandle: (runId: string, stageId: string) => PostMortemHandleResolution,
|
|
37
40
|
): GraphOverlayPort {
|
|
38
|
-
return buildGraphOverlayAdapter(pi, store, {
|
|
39
|
-
onQuitRun: (runId) => {
|
|
40
|
-
quitRun(runId, { store });
|
|
41
|
-
pi.ui?.notify?.(`Workflow quit; resume with /workflow resume.`, "info");
|
|
42
|
-
},
|
|
43
|
-
});
|
|
41
|
+
return buildGraphOverlayAdapter(pi, store, { resolvePostMortemHandle });
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
function registerWorkflowShortcut(pi: ExtensionAPI, overlay: GraphOverlayPort): void {
|
|
@@ -77,15 +75,21 @@ function registerIntercomControl(
|
|
|
77
75
|
function factory(pi: ExtensionAPI): void {
|
|
78
76
|
const adapters = buildRuntimeAdapters(pi);
|
|
79
77
|
const runtimeState = createWorkflowExtensionRuntimeState(pi, adapters);
|
|
80
|
-
const
|
|
78
|
+
const postMortemResolverDeps = {
|
|
79
|
+
adapters,
|
|
80
|
+
resolveDefaultStageSessionDir: runtimeState.resolveDefaultStageSessionDir,
|
|
81
|
+
};
|
|
82
|
+
const postMortemHandleResolver = createPostMortemHandleResolver(postMortemResolverDeps);
|
|
83
|
+
const overlay = buildWorkflowOverlay(pi, postMortemHandleResolver);
|
|
84
|
+
registerCompletedStageIntercomAskRouter(pi, postMortemHandleResolver);
|
|
81
85
|
const workflowCommands = new Map<string, WorkflowCommandHandler>();
|
|
82
86
|
const storeWidgetRef: { current: (() => void) | null } = { current: null };
|
|
83
87
|
const intercomControlRef: { current: (() => void) | null } = { current: null };
|
|
84
88
|
const executeWorkflowTool = makeExecuteWorkflowTool(
|
|
85
89
|
(ctx) => runtimeState.runtimeForContext(ctx),
|
|
86
|
-
() => runtimeState.persistenceRef.current,
|
|
87
90
|
runtimeState.reloadWorkflowResources,
|
|
88
91
|
runtimeState.ensureWorkflowResourcesLoaded,
|
|
92
|
+
{ resolvePostMortemDeps: (runId) => postMortemDepsForRun(runId, postMortemResolverDeps) },
|
|
89
93
|
);
|
|
90
94
|
|
|
91
95
|
registerWorkflowTool(pi, executeWorkflowTool, runtimeState.runWithLifecycleSuppressedForPolicy);
|
|
@@ -99,7 +103,6 @@ function factory(pi: ExtensionAPI): void {
|
|
|
99
103
|
runControl: {
|
|
100
104
|
pi,
|
|
101
105
|
overlay,
|
|
102
|
-
getPersistence: () => runtimeState.persistenceRef.current,
|
|
103
106
|
runtimeForContext: runtimeState.runtimeForContext,
|
|
104
107
|
ensureWorkflowResourcesLoaded: runtimeState.ensureWorkflowResourcesLoaded,
|
|
105
108
|
},
|