@bastani/atomic 0.9.9 → 0.9.10-alpha.1
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 +66 -0
- package/README.md +2 -0
- package/dist/builtin/cursor/CHANGELOG.md +6 -0
- package/dist/builtin/cursor/package.json +3 -3
- package/dist/builtin/intercom/CHANGELOG.md +15 -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 +11 -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 +21 -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 +11 -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 +77 -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,9 +1,9 @@
|
|
|
1
1
|
import type { Store } from "../shared/store.js";
|
|
2
|
-
import type { RunSnapshot
|
|
3
|
-
import {
|
|
2
|
+
import type { RunSnapshot } from "../shared/store-types.js";
|
|
3
|
+
import type { StageAdapters } from "../runs/foreground/stage-runner.js";
|
|
4
|
+
import { createPostMortemStageHandle } from "../runs/foreground/postmortem-stage-chat.js";
|
|
4
5
|
import {
|
|
5
6
|
stageControlRegistry as defaultStageControlRegistry,
|
|
6
|
-
type AgentSessionEventListener,
|
|
7
7
|
type StageControlHandle,
|
|
8
8
|
type StageControlRegistry,
|
|
9
9
|
} from "../runs/foreground/stage-control-registry.js";
|
|
@@ -117,7 +117,7 @@ function registerCompletedChatHandles(
|
|
|
117
117
|
} else if (existing !== undefined) {
|
|
118
118
|
disposeCompletedChatHandle(existing);
|
|
119
119
|
}
|
|
120
|
-
const handle =
|
|
120
|
+
const handle = createPostMortemStageHandle(snapshot.id, stage, stage.sessionFile, deps.adapters, deps.cwd, deps.defaultSessionDir);
|
|
121
121
|
const unregister = registry.register(handle);
|
|
122
122
|
registrations.set(key, { handle, unregister });
|
|
123
123
|
registry.detachControl(snapshot.id, stage.id, handle);
|
|
@@ -143,71 +143,3 @@ function disposeCompletedChatHandle(handle: StageControlHandle): void {
|
|
|
143
143
|
console.warn("atomic-workflows: completed chat handle dispose failed", error);
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
function createCompletedChatHandle(
|
|
148
|
-
run: RunSnapshot,
|
|
149
|
-
stage: StageSnapshot,
|
|
150
|
-
sessionFile: string,
|
|
151
|
-
adapters: StageAdapters,
|
|
152
|
-
cwd: string | undefined,
|
|
153
|
-
defaultSessionDir: string | undefined,
|
|
154
|
-
): StageControlHandle {
|
|
155
|
-
const context = createStageContext({
|
|
156
|
-
runId: run.id,
|
|
157
|
-
stageId: stage.id,
|
|
158
|
-
stageName: stage.name,
|
|
159
|
-
adapters,
|
|
160
|
-
stageOptions: {
|
|
161
|
-
resumeFromSessionFile: sessionFile,
|
|
162
|
-
...(cwd !== undefined ? { cwd } : {}),
|
|
163
|
-
},
|
|
164
|
-
...(defaultSessionDir !== undefined ? { defaultSessionDir } : {}),
|
|
165
|
-
});
|
|
166
|
-
let disposed = false;
|
|
167
|
-
const ensureAttached = async (): Promise<void> => {
|
|
168
|
-
if (disposed) throw new Error(`Completed stage chat "${stage.name}" is closed.`);
|
|
169
|
-
if (context.__sessionMeta().sessionFile === undefined) {
|
|
170
|
-
await context.__ensureSessionFromFile(sessionFile);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
return {
|
|
174
|
-
runId: run.id,
|
|
175
|
-
stageId: stage.id,
|
|
176
|
-
stageName: stage.name,
|
|
177
|
-
status: "completed",
|
|
178
|
-
get sessionId() { return context.__sessionMeta().sessionId ?? stage.sessionId; },
|
|
179
|
-
get sessionFile() { return context.__sessionMeta().sessionFile ?? sessionFile; },
|
|
180
|
-
get isStreaming() { return context.isStreaming; },
|
|
181
|
-
get isDisposed() { return disposed; },
|
|
182
|
-
get messages() { return context.messages; },
|
|
183
|
-
get agentSession() { return context.__agentSession(); },
|
|
184
|
-
async ensureAttached() { await ensureAttached(); },
|
|
185
|
-
async prompt(text: string) {
|
|
186
|
-
await ensureAttached();
|
|
187
|
-
await context.prompt(text);
|
|
188
|
-
},
|
|
189
|
-
async steer(text: string) {
|
|
190
|
-
await ensureAttached();
|
|
191
|
-
await context.steer(text);
|
|
192
|
-
},
|
|
193
|
-
async followUp(text: string) {
|
|
194
|
-
await ensureAttached();
|
|
195
|
-
await context.followUp(text);
|
|
196
|
-
},
|
|
197
|
-
async pause() {
|
|
198
|
-
throw new Error("Completed workflow snapshots cannot be paused or resumed.");
|
|
199
|
-
},
|
|
200
|
-
async resume(message?: string) {
|
|
201
|
-
if (message !== undefined && message.trim().length > 0) {
|
|
202
|
-
await ensureAttached();
|
|
203
|
-
await context.prompt(message);
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
subscribe(listener: AgentSessionEventListener) { return context.subscribe(listener); },
|
|
207
|
-
async dispose() {
|
|
208
|
-
if (disposed) return;
|
|
209
|
-
disposed = true;
|
|
210
|
-
await context.__dispose();
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
/** DBOS-backed durable backend adapter
|
|
1
|
+
/** DBOS-backed durable backend adapter. */
|
|
2
2
|
|
|
3
3
|
import type { DurableCheckpoint, DurableWorkflowHandle, DurableWorkflowStatus, ResumableWorkflowEntry } from "./types.js";
|
|
4
4
|
import type { WorkflowSerializableValue } from "../shared/types.js";
|
|
5
5
|
import type { WorkflowSerializableObject as DurableInputs } from "./types.js";
|
|
6
|
-
import { InMemoryDurableBackend, type DurableWorkflowBackend, type WorkflowRegistrationInput } from "./backend.js";
|
|
6
|
+
import { InMemoryDurableBackend, type DurableInactiveDeleteResult, type DurableWorkflowBackend, type DurableWorkflowCatalogEntries, type WorkflowRegistrationInput } from "./backend.js";
|
|
7
7
|
import { encodeCheckpoint, classifyCheckpointPayload } from "./dbos-envelope.js";
|
|
8
|
-
import {
|
|
8
|
+
import { transitionDbosWorkflowStatus } from "./dbos-status-transition.js";
|
|
9
|
+
import { claimMetadataStepName, classifyLatestMetadata, encodeMetadata, isMetadataStep, metadataStepName, parseCurrentMetadataRecord } from "./dbos-metadata.js";
|
|
10
|
+
import { inactivePromptReservationToken, type PromptReservationToken } from "./prompt-reservation-state.js";
|
|
9
11
|
import { DBOS_DELETION_STEP, classifyDbosDeletionTombstone, encodeDbosDeletionTombstone } from "./dbos-tombstone.js";
|
|
10
|
-
|
|
12
|
+
import { isLiveRunningWorkflow } from "./resume-eligibility.js";
|
|
13
|
+
import {
|
|
14
|
+
DbosPromptReservationTracker,
|
|
15
|
+
isDbosPromptStateStep,
|
|
16
|
+
} from "./dbos-prompt-reservations.js";
|
|
11
17
|
// ---------------------------------------------------------------------------
|
|
12
18
|
// SDK abstraction
|
|
13
19
|
// ---------------------------------------------------------------------------
|
|
@@ -48,63 +54,66 @@ export interface DbosStepRecord {
|
|
|
48
54
|
readonly output: WorkflowSerializableValue;
|
|
49
55
|
readonly completedAt?: number;
|
|
50
56
|
}
|
|
51
|
-
|
|
57
|
+
import {
|
|
58
|
+
createRealDbosHandle,
|
|
59
|
+
getAtomicExecutorId,
|
|
60
|
+
type DbosLogger,
|
|
61
|
+
type DbosStatic,
|
|
62
|
+
} from "./dbos-sdk-handle.js";
|
|
52
63
|
// ---------------------------------------------------------------------------
|
|
53
64
|
// Real SDK handle factory (lazy import, no top-level dependency)
|
|
54
65
|
// ---------------------------------------------------------------------------
|
|
55
66
|
|
|
56
|
-
interface
|
|
57
|
-
readonly
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
interface DbosStatus {
|
|
63
|
-
readonly workflowID?: string;
|
|
64
|
-
readonly workflowId?: string;
|
|
65
|
-
readonly workflowName?: string;
|
|
66
|
-
readonly name?: string;
|
|
67
|
-
readonly status?: string;
|
|
68
|
-
readonly createdAt?: number;
|
|
69
|
-
readonly input?: readonly WorkflowSerializableValue[];
|
|
67
|
+
export interface ConfiguredDbosDurability {
|
|
68
|
+
readonly backend: DbosDurableBackend;
|
|
69
|
+
readonly launch: () => Promise<void>;
|
|
70
|
+
readonly shutdown: () => Promise<void>;
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
config?: { readonly name?: string },
|
|
79
|
-
): (...args: Args) => Promise<WorkflowSerializableValue>;
|
|
80
|
-
startWorkflow<Args extends readonly WorkflowSerializableValue[]>(
|
|
81
|
-
target: (...args: Args) => Promise<WorkflowSerializableValue>,
|
|
82
|
-
params?: { readonly workflowID?: string },
|
|
83
|
-
): (...args: Args) => Promise<DbosWorkflowHandle>;
|
|
84
|
-
retrieveWorkflow(workflowId: string): DbosWorkflowHandle;
|
|
85
|
-
resumeWorkflow(workflowId: string): Promise<DbosWorkflowHandle>;
|
|
86
|
-
cancelWorkflow(workflowId: string, options?: { readonly cancelChildren?: boolean }): Promise<void>;
|
|
87
|
-
listWorkflows(input: Record<string, WorkflowSerializableValue>): Promise<readonly DbosStatus[]>;
|
|
88
|
-
deleteWorkflows(workflowIds: string[], deleteChildren?: boolean): Promise<void>;
|
|
89
|
-
}
|
|
73
|
+
const SILENT_DBOS_LOGGER: DbosLogger = {
|
|
74
|
+
info() {},
|
|
75
|
+
debug() {},
|
|
76
|
+
warn() {},
|
|
77
|
+
error() {},
|
|
78
|
+
};
|
|
90
79
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Effective system database URL: explicit config wins over
|
|
82
|
+
* `DBOS_SYSTEM_DATABASE_URL`. Values are trimmed so env-injected URLs
|
|
83
|
+
* (secrets managers, env files) with trailing whitespace/newlines connect
|
|
84
|
+
* cleanly, and a whitespace-only value means "not set".
|
|
85
|
+
*/
|
|
86
|
+
export function effectiveSystemDatabaseUrl(
|
|
87
|
+
configUrl: string | undefined,
|
|
88
|
+
envUrl: string | undefined = process.env.DBOS_SYSTEM_DATABASE_URL,
|
|
89
|
+
): string | undefined {
|
|
90
|
+
const url = (configUrl ?? envUrl)?.trim();
|
|
91
|
+
return url === undefined || url.length === 0 ? undefined : url;
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
|
|
94
|
+
/** Configure and register DBOS workflows without launching the executor. */
|
|
95
|
+
export async function configureDbosDurableBackend(config?: { readonly systemDatabaseUrl?: string }): Promise<ConfiguredDbosDurability> {
|
|
97
96
|
const sdk = await importDbosSdk();
|
|
98
|
-
const url = config?.systemDatabaseUrl
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const url = effectiveSystemDatabaseUrl(config?.systemDatabaseUrl);
|
|
98
|
+
sdk.setConfig({
|
|
99
|
+
name: "atomic-workflows",
|
|
100
|
+
...(url === undefined ? {} : { systemDatabaseUrl: url }),
|
|
101
|
+
runAdminServer: false,
|
|
102
|
+
// Unique per process: concurrent Atomic sessions share one database, and
|
|
103
|
+
// DBOS-level pending-workflow recovery must stay scoped to the owner.
|
|
104
|
+
executorID: getAtomicExecutorId(),
|
|
105
|
+
logger: SILENT_DBOS_LOGGER,
|
|
106
|
+
});
|
|
101
107
|
const mainWorkflow = sdk.registerWorkflow(async (_name: string, inputs: DurableInputs) => inputs, { name: "atomicWorkflowHandle" });
|
|
102
108
|
const checkpointWorkflow = sdk.registerWorkflow(async (_workflowId: string, _stepName: string, output: WorkflowSerializableValue) => output, { name: "atomicWorkflowCheckpoint" });
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
return {
|
|
110
|
+
backend: new DbosDurableBackend(createRealDbosHandle(sdk, mainWorkflow, checkpointWorkflow)),
|
|
111
|
+
launch: () => sdk.launch(),
|
|
112
|
+
shutdown: () => sdk.shutdown(),
|
|
113
|
+
};
|
|
105
114
|
}
|
|
106
115
|
|
|
107
|
-
async function importDbosSdk(): Promise<DbosStatic> {
|
|
116
|
+
export async function importDbosSdk(): Promise<DbosStatic> {
|
|
108
117
|
const spec = "@dbos-inc/dbos-sdk";
|
|
109
118
|
try {
|
|
110
119
|
const mod = await import(spec);
|
|
@@ -113,93 +122,9 @@ async function importDbosSdk(): Promise<DbosStatic> {
|
|
|
113
122
|
return dbos;
|
|
114
123
|
} catch (err) {
|
|
115
124
|
const msg = err instanceof Error ? err.message : String(err);
|
|
116
|
-
throw new Error(
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function createRealDbosHandle(
|
|
121
|
-
dbos: DbosStatic,
|
|
122
|
-
mainWorkflow: (name: string, inputs: Record<string, WorkflowSerializableValue>) => Promise<WorkflowSerializableValue>,
|
|
123
|
-
checkpointWorkflow: (workflowId: string, stepName: string, output: WorkflowSerializableValue) => Promise<WorkflowSerializableValue>,
|
|
124
|
-
): DbosSdkHandle {
|
|
125
|
-
const checkpointId = (workflowId: string, stepName: string): string => `${workflowId}:checkpoint:${stepName}`;
|
|
126
|
-
return {
|
|
127
|
-
launch: () => dbos.launch(),
|
|
128
|
-
shutdown: () => dbos.shutdown(),
|
|
129
|
-
async startWorkflow(workflowId, name, inputs) {
|
|
130
|
-
try {
|
|
131
|
-
await dbos.startWorkflow(mainWorkflow, { workflowID: workflowId })(name, { ...inputs });
|
|
132
|
-
} catch (err) {
|
|
133
|
-
if (!isDbosDuplicateWorkflowError(err)) throw err;
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
async retrieveWorkflow(workflowId) {
|
|
137
|
-
const statuses = await dbos.listWorkflows({ workflowIDs: [workflowId], loadInput: true, limit: 1 });
|
|
138
|
-
const status = statuses[0];
|
|
139
|
-
if (status === undefined) return undefined;
|
|
140
|
-
return statusToInfo(status, workflowId);
|
|
141
|
-
},
|
|
142
|
-
async cancelWorkflow(workflowId) { await dbos.cancelWorkflow(workflowId, { cancelChildren: true }); },
|
|
143
|
-
async resumeWorkflow(workflowId) { await dbos.resumeWorkflow(workflowId); },
|
|
144
|
-
async listAllWorkflows() {
|
|
145
|
-
const statuses = await dbos.listWorkflows({ workflowName: "atomicWorkflowHandle", loadInput: true, sortDesc: true });
|
|
146
|
-
return statuses.map((s) => statusToInfo(s, s.workflowID ?? s.workflowId ?? ""));
|
|
147
|
-
},
|
|
148
|
-
async listStepRecords(workflowId) {
|
|
149
|
-
const prefix = `${workflowId}:checkpoint:`;
|
|
150
|
-
const statuses = await dbos.listWorkflows({ workflow_id_prefix: prefix, loadOutput: true, sortDesc: false });
|
|
151
|
-
const records: DbosStepRecord[] = [];
|
|
152
|
-
for (const s of statuses) {
|
|
153
|
-
if (s.status !== "SUCCESS") continue;
|
|
154
|
-
const wid = s.workflowID ?? s.workflowId ?? "";
|
|
155
|
-
const stepName = wid.slice(prefix.length);
|
|
156
|
-
if (stepName.length === 0) continue;
|
|
157
|
-
const handle = dbos.retrieveWorkflow(wid);
|
|
158
|
-
const output = await handle.getResult();
|
|
159
|
-
records.push({ stepName, output, completedAt: s.createdAt });
|
|
160
|
-
}
|
|
161
|
-
return records;
|
|
162
|
-
},
|
|
163
|
-
async recordStepOutput(workflowId, stepName, output) {
|
|
164
|
-
await dbos.startWorkflow(checkpointWorkflow, { workflowID: checkpointId(workflowId, stepName) })(workflowId, stepName, output);
|
|
165
|
-
},
|
|
166
|
-
async deleteWorkflowData(workflowId) {
|
|
167
|
-
const prefix = `${workflowId}:checkpoint:`;
|
|
168
|
-
const checkpointIds: string[] = [];
|
|
169
|
-
const pageSize = 1_000;
|
|
170
|
-
for (let offset = 0;; offset += pageSize) {
|
|
171
|
-
const page = await dbos.listWorkflows({ workflow_id_prefix: prefix, limit: pageSize, offset });
|
|
172
|
-
checkpointIds.push(...page.map((status) => status.workflowID ?? status.workflowId ?? "").filter((id) => id.length > 0));
|
|
173
|
-
if (page.length < pageSize) break;
|
|
174
|
-
}
|
|
175
|
-
await dbos.deleteWorkflows([...new Set([workflowId, ...checkpointIds])], true);
|
|
176
|
-
},
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function isDbosDuplicateWorkflowError(err: unknown): boolean {
|
|
181
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
182
|
-
return /duplicate|conflict|already/i.test(msg);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function statusToInfo(status: DbosStatus, fallbackId: string): DbosWorkflowInfo {
|
|
186
|
-
const info: DbosWorkflowInfo = {
|
|
187
|
-
workflowId: status.workflowID ?? status.workflowId ?? fallbackId,
|
|
188
|
-
name: status.workflowName ?? status.name ?? "atomicWorkflowHandle",
|
|
189
|
-
status: status.status ?? "PENDING",
|
|
190
|
-
createdAt: status.createdAt ?? Date.now(),
|
|
191
|
-
};
|
|
192
|
-
// Inputs were passed as (name, inputs) to the main workflow; extract the
|
|
193
|
-
// inputs object from the second positional argument.
|
|
194
|
-
if (status.input !== undefined && status.input.length >= 2) {
|
|
195
|
-
const inputs = status.input[1];
|
|
196
|
-
if (typeof inputs === "object" && inputs !== null && !Array.isArray(inputs)) {
|
|
197
|
-
return { ...info, inputs: inputs as DurableInputs };
|
|
198
|
-
}
|
|
125
|
+
throw new Error(`@dbos-inc/dbos-sdk could not be loaded: ${msg}`);
|
|
199
126
|
}
|
|
200
|
-
return info;
|
|
201
127
|
}
|
|
202
|
-
|
|
203
128
|
// ---------------------------------------------------------------------------
|
|
204
129
|
// Backend adapter
|
|
205
130
|
// ---------------------------------------------------------------------------
|
|
@@ -217,22 +142,34 @@ export class DbosDurableBackend implements DurableWorkflowBackend {
|
|
|
217
142
|
public readonly persistent = true;
|
|
218
143
|
private readonly mem = new InMemoryDurableBackend();
|
|
219
144
|
private readonly sdk: DbosSdkHandle;
|
|
220
|
-
private readonly
|
|
221
|
-
private readonly
|
|
222
|
-
private readonly compatible = new Set<string>();
|
|
145
|
+
private readonly invalid = new Set<string>();
|
|
146
|
+
private readonly current = new Set<string>();
|
|
223
147
|
private readonly locallyRegistered = new Set<string>();
|
|
148
|
+
private readonly promptReservations: DbosPromptReservationTracker;
|
|
149
|
+
private readonly executorId: string;
|
|
224
150
|
private writeQueue: Promise<void> = Promise.resolve();
|
|
225
151
|
private writeErrors: Error[] = [];
|
|
226
152
|
|
|
227
|
-
constructor(sdk: DbosSdkHandle) {
|
|
153
|
+
constructor(sdk: DbosSdkHandle, options?: { readonly executorId?: string }) {
|
|
228
154
|
this.sdk = sdk;
|
|
155
|
+
this.executorId = options?.executorId ?? getAtomicExecutorId();
|
|
156
|
+
this.promptReservations = new DbosPromptReservationTracker({
|
|
157
|
+
pendingPrompts: (workflowId) => this.mem.getWorkflow(workflowId)?.pendingPrompts ?? 0,
|
|
158
|
+
adjustPendingPrompts: (workflowId, delta) => this.mem.adjustPendingPrompts(workflowId, delta),
|
|
159
|
+
persist: (workflowId, stepName, output) => {
|
|
160
|
+
this.enqueueWrite(() => this.sdk.recordStepOutput(workflowId, stepName, output));
|
|
161
|
+
},
|
|
162
|
+
});
|
|
229
163
|
}
|
|
230
164
|
|
|
231
165
|
registerWorkflow(handle: WorkflowRegistrationInput): void {
|
|
232
|
-
this.
|
|
233
|
-
this.
|
|
166
|
+
this.invalid.delete(handle.workflowId);
|
|
167
|
+
this.current.add(handle.workflowId);
|
|
234
168
|
this.locallyRegistered.add(handle.workflowId);
|
|
235
|
-
this.
|
|
169
|
+
const pendingPrompts = this.promptReservations.registerWorkflow(
|
|
170
|
+
handle.workflowId, handle.pendingPrompts, this.mem.getWorkflow(handle.workflowId)?.pendingPrompts ?? 0,
|
|
171
|
+
);
|
|
172
|
+
this.mem.registerWorkflow({ ...handle, pendingPrompts });
|
|
236
173
|
this.enqueueWrite(async () => {
|
|
237
174
|
await this.sdk.startWorkflow(handle.workflowId, handle.name, handle.inputs);
|
|
238
175
|
await this.writeMetadata(handle.workflowId);
|
|
@@ -270,9 +207,13 @@ export class DbosDurableBackend implements DurableWorkflowBackend {
|
|
|
270
207
|
getStageSession(workflowId: string, replayKey: string) { return this.mem.getStageSession(workflowId, replayKey); }
|
|
271
208
|
listCheckpoints(workflowId: string): readonly DurableCheckpoint[] { return this.mem.listCheckpoints(workflowId); }
|
|
272
209
|
getWorkflow(workflowId: string): DurableWorkflowHandle | undefined { return this.mem.getWorkflow(workflowId); }
|
|
210
|
+
getLoadableWorkflow(workflowId: string): DurableWorkflowHandle | undefined { return this.isWorkflowLoadable(workflowId) ? this.mem.getWorkflow(workflowId) : undefined; }
|
|
273
211
|
|
|
274
212
|
setWorkflowStatus(workflowId: string, status: DurableWorkflowStatus, pendingPrompts?: number, resumable?: boolean): void {
|
|
275
213
|
if (!this.isWorkflowLoadable(workflowId)) return;
|
|
214
|
+
if (pendingPrompts !== undefined) {
|
|
215
|
+
this.promptReservations.setBaseline(workflowId, pendingPrompts);
|
|
216
|
+
}
|
|
276
217
|
this.mem.setWorkflowStatus(workflowId, status, pendingPrompts, resumable);
|
|
277
218
|
this.enqueueWrite(async () => {
|
|
278
219
|
if (!this.isWorkflowLoadable(workflowId)) return;
|
|
@@ -282,34 +223,127 @@ export class DbosDurableBackend implements DurableWorkflowBackend {
|
|
|
282
223
|
});
|
|
283
224
|
}
|
|
284
225
|
|
|
226
|
+
async transitionWorkflowStatus(workflowId: string, expected: readonly DurableWorkflowStatus[], status: DurableWorkflowStatus, pendingPrompts?: number, resumable?: boolean): Promise<boolean> {
|
|
227
|
+
return await transitionDbosWorkflowStatus({
|
|
228
|
+
expectedStatuses: expected, status, flush: () => this.flush(), local: () => this.getLoadableWorkflow(workflowId),
|
|
229
|
+
read: async () => classifyLatestMetadata(await this.sdk.listStepRecords(workflowId), workflowId),
|
|
230
|
+
reconcile: (entry) => this.mem.setWorkflowStatus(workflowId, entry.status, undefined, entry.resumable),
|
|
231
|
+
claim: (authoritative, generation) => this.claimStatusTransition(
|
|
232
|
+
workflowId, authoritative, generation, status, pendingPrompts, resumable,
|
|
233
|
+
),
|
|
234
|
+
write: async () => { this.setWorkflowStatus(workflowId, status, pendingPrompts, resumable); await this.flush(); },
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The transition's metadata write IS the claim: every racer that observed
|
|
240
|
+
* first record, and a unique transition claim id identifies the winner even
|
|
241
|
+
* for concurrent callers sharing one executor. The claim itself carries the
|
|
242
|
+
* requested status metadata, so a crash cannot expose an intermediate state
|
|
243
|
+
* with stale resumability.
|
|
244
|
+
*/
|
|
245
|
+
private async claimStatusTransition(
|
|
246
|
+
workflowId: string,
|
|
247
|
+
authoritative: import("./types.js").DurableWorkflowMetadata,
|
|
248
|
+
generation: number,
|
|
249
|
+
status: DurableWorkflowStatus,
|
|
250
|
+
pendingPrompts?: number,
|
|
251
|
+
resumable?: boolean,
|
|
252
|
+
): Promise<boolean> {
|
|
253
|
+
const stepName = claimMetadataStepName(generation);
|
|
254
|
+
const transitionClaimId = crypto.randomUUID();
|
|
255
|
+
const claim: import("./types.js").DurableWorkflowMetadata = {
|
|
256
|
+
...authoritative,
|
|
257
|
+
status,
|
|
258
|
+
...(pendingPrompts !== undefined ? { pendingPrompts } : {}),
|
|
259
|
+
...(resumable !== undefined ? { resumable } : {}),
|
|
260
|
+
ownerExecutorId: this.executorId,
|
|
261
|
+
transitionClaimId,
|
|
262
|
+
updatedAt: Date.now(),
|
|
263
|
+
};
|
|
264
|
+
await this.sdk.recordStepOutput(workflowId, stepName, encodeMetadata(claim));
|
|
265
|
+
const records = await this.sdk.listStepRecords(workflowId);
|
|
266
|
+
const record = records.find((candidate) => candidate.stepName === stepName);
|
|
267
|
+
if (record === undefined) return false;
|
|
268
|
+
return parseCurrentMetadataRecord(record, workflowId)?.transitionClaimId === transitionClaimId;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
adjustPendingPrompts(workflowId: string, delta: number): void {
|
|
272
|
+
if (!this.isWorkflowLoadable(workflowId)) return;
|
|
273
|
+
this.promptReservations.adjust(workflowId, delta);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
promptReservationScope(workflowId: string): { readonly rootWorkflowId: string; readonly scope: string } {
|
|
277
|
+
return { rootWorkflowId: workflowId, scope: "root" };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
pendingPromptToken(workflowId: string, reservationId: string): PromptReservationToken | undefined {
|
|
281
|
+
return this.isWorkflowLoadable(workflowId) ? this.promptReservations.token(workflowId, reservationId) : undefined;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
reservePendingPrompt(workflowId: string, reservationId: string): PromptReservationToken {
|
|
285
|
+
if (!this.isWorkflowLoadable(workflowId)) return inactivePromptReservationToken(reservationId);
|
|
286
|
+
return this.promptReservations.reserve(workflowId, reservationId);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
releasePendingPrompt(workflowId: string, reservationId: string, token: PromptReservationToken): void {
|
|
290
|
+
if (this.isWorkflowLoadable(workflowId)) this.promptReservations.release(workflowId, reservationId, token);
|
|
291
|
+
}
|
|
285
292
|
listResumableWorkflows(): readonly ResumableWorkflowEntry[] {
|
|
286
|
-
|
|
293
|
+
// A running workflow with a fresh heartbeat is genuinely executing in SOME
|
|
294
|
+
// session; it is never a resume target (double dispatch). Only crashed
|
|
295
|
+
// (stale-heartbeat) running workflows remain listed.
|
|
296
|
+
return this.mem.listResumableWorkflows().filter((entry) =>
|
|
297
|
+
!this.invalid.has(entry.workflowId)
|
|
298
|
+
&& !isLiveRunningWorkflow({ status: entry.status, updatedAt: entry.updatedAt }));
|
|
287
299
|
}
|
|
300
|
+
|
|
288
301
|
listCompletedWorkflows(): readonly ResumableWorkflowEntry[] {
|
|
289
|
-
return this.mem.listCompletedWorkflows().filter((entry) => !this.
|
|
302
|
+
return this.mem.listCompletedWorkflows().filter((entry) => !this.invalid.has(entry.workflowId));
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
toMetadata(workflowId: string) {
|
|
306
|
+
return this.invalid.has(workflowId) ? undefined : this.mem.toMetadata(workflowId);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
async prepareWorkflowCatalog(): Promise<DurableWorkflowCatalogEntries> {
|
|
310
|
+
await this.hydrateResumableWorkflows();
|
|
311
|
+
return { resumable: this.listResumableWorkflows(), completed: this.listCompletedWorkflows() };
|
|
290
312
|
}
|
|
291
|
-
toCacheEntry(workflowId: string) { return this.incompatible.has(workflowId) ? undefined : this.mem.toCacheEntry(workflowId); }
|
|
292
313
|
async deleteWorkflow(workflowId: string): Promise<void> {
|
|
293
|
-
this.
|
|
294
|
-
this.
|
|
314
|
+
this.invalid.add(workflowId);
|
|
315
|
+
this.current.delete(workflowId);
|
|
295
316
|
this.locallyRegistered.delete(workflowId);
|
|
296
|
-
this.
|
|
317
|
+
this.promptReservations.delete(workflowId);
|
|
297
318
|
await this.mem.deleteWorkflow(workflowId);
|
|
298
319
|
await this.enqueueWrite(async () => {
|
|
299
320
|
await this.sdk.deleteWorkflowData(workflowId);
|
|
300
321
|
await this.sdk.recordStepOutput(workflowId, DBOS_DELETION_STEP, encodeDbosDeletionTombstone(workflowId));
|
|
301
322
|
});
|
|
302
323
|
}
|
|
324
|
+
|
|
325
|
+
async deleteWorkflowIfInactive(workflowId: string): Promise<DurableInactiveDeleteResult> {
|
|
326
|
+
await this.flush();
|
|
327
|
+
await this.hydrateWorkflow(workflowId);
|
|
328
|
+
const handle = this.getLoadableWorkflow(workflowId);
|
|
329
|
+
if (handle === undefined) return { ok: false, reason: "not_found" };
|
|
330
|
+
if (handle.status === "running") return { ok: false, reason: "running" };
|
|
331
|
+
const guarded = await this.transitionWorkflowStatus(workflowId, [handle.status], handle.status);
|
|
332
|
+
if (!guarded) return { ok: false, reason: "running" };
|
|
333
|
+
await this.deleteWorkflow(workflowId);
|
|
334
|
+
await this.flush();
|
|
335
|
+
return { ok: true };
|
|
336
|
+
}
|
|
303
337
|
isWorkflowLoadable(workflowId: string): boolean {
|
|
304
|
-
return !this.
|
|
305
|
-
&& (this.locallyRegistered.has(workflowId) || this.
|
|
338
|
+
return !this.invalid.has(workflowId)
|
|
339
|
+
&& (this.locallyRegistered.has(workflowId) || this.current.has(workflowId));
|
|
306
340
|
}
|
|
307
341
|
reset(): void {
|
|
308
342
|
this.mem.reset();
|
|
309
|
-
this.
|
|
310
|
-
this.
|
|
311
|
-
this.compatible.clear();
|
|
343
|
+
this.invalid.clear();
|
|
344
|
+
this.current.clear();
|
|
312
345
|
this.locallyRegistered.clear();
|
|
346
|
+
this.promptReservations.clear();
|
|
313
347
|
this.writeQueue = Promise.resolve();
|
|
314
348
|
this.writeErrors = [];
|
|
315
349
|
}
|
|
@@ -333,7 +367,6 @@ export class DbosDurableBackend implements DurableWorkflowBackend {
|
|
|
333
367
|
const deletion = classifyDbosDeletionTombstone(records, workflowId);
|
|
334
368
|
if (deletion !== "absent") await this.suppressWorkflow(workflowId);
|
|
335
369
|
}
|
|
336
|
-
|
|
337
370
|
async hydrateResumableWorkflows(): Promise<void> {
|
|
338
371
|
const all = await this.sdk.listAllWorkflows();
|
|
339
372
|
for (const info of all) {
|
|
@@ -345,22 +378,15 @@ export class DbosDurableBackend implements DurableWorkflowBackend {
|
|
|
345
378
|
private async hydrateInfo(info: DbosWorkflowInfo): Promise<void> {
|
|
346
379
|
const records = await this.sdk.listStepRecords(info.workflowId);
|
|
347
380
|
const metadata = classifyLatestMetadata(records, info.workflowId);
|
|
348
|
-
if (metadata.kind === "legacy") {
|
|
349
|
-
await this.cleanupLegacyWorkflow(info.workflowId);
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
381
|
if (metadata.kind !== "current") {
|
|
353
382
|
await this.suppressWorkflow(info.workflowId);
|
|
354
383
|
return;
|
|
355
384
|
}
|
|
356
385
|
const checkpoints: DurableCheckpoint[] = [];
|
|
357
386
|
for (const record of records) {
|
|
358
|
-
if (isMetadataStep(record.stepName) || record.stepName
|
|
387
|
+
if (isMetadataStep(record.stepName) || isDbosPromptStateStep(record.stepName)
|
|
388
|
+
|| record.stepName === DBOS_DELETION_STEP) continue;
|
|
359
389
|
const classified = classifyCheckpointPayload(info.workflowId, record.stepName, record.output);
|
|
360
|
-
if (classified.kind === "legacy") {
|
|
361
|
-
await this.cleanupLegacyWorkflow(info.workflowId);
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
390
|
if (classified.kind === "unknown") {
|
|
365
391
|
await this.suppressWorkflow(info.workflowId);
|
|
366
392
|
return;
|
|
@@ -368,27 +394,33 @@ export class DbosDurableBackend implements DurableWorkflowBackend {
|
|
|
368
394
|
checkpoints.push(classified.checkpoint);
|
|
369
395
|
}
|
|
370
396
|
await this.mem.deleteWorkflow(info.workflowId);
|
|
371
|
-
this.
|
|
372
|
-
this.
|
|
373
|
-
this.applyMetadata(info.workflowId, metadata.
|
|
397
|
+
this.invalid.delete(info.workflowId);
|
|
398
|
+
this.current.add(info.workflowId);
|
|
399
|
+
this.applyMetadata(info.workflowId, metadata.metadata);
|
|
374
400
|
checkpoints.forEach((checkpoint) => this.mem.recordCheckpoint(checkpoint));
|
|
375
|
-
this.
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
//
|
|
384
|
-
//
|
|
401
|
+
const current = this.mem.getWorkflow(info.workflowId);
|
|
402
|
+
if (current !== undefined) {
|
|
403
|
+
const pendingPrompts = this.promptReservations.hydrate(
|
|
404
|
+
info.workflowId,
|
|
405
|
+
metadata.metadata.pendingPrompts,
|
|
406
|
+
records,
|
|
407
|
+
metadata.metadata.promptReservationEpoch,
|
|
408
|
+
);
|
|
409
|
+
// Re-register instead of setWorkflowStatus: hydration is a read-side
|
|
410
|
+
// reconstruction and must preserve the authoritative updatedAt, which
|
|
411
|
+
// doubles as the cross-session liveness heartbeat for running handles.
|
|
412
|
+
this.applyMetadata(info.workflowId, {
|
|
413
|
+
...metadata.metadata,
|
|
414
|
+
pendingPrompts,
|
|
415
|
+
completedCheckpoints: current.completedCheckpoints,
|
|
416
|
+
});
|
|
385
417
|
}
|
|
386
418
|
}
|
|
387
419
|
|
|
388
420
|
private async suppressWorkflow(workflowId: string): Promise<void> {
|
|
389
|
-
this.
|
|
390
|
-
this.
|
|
391
|
-
this.
|
|
421
|
+
this.invalid.add(workflowId);
|
|
422
|
+
this.current.delete(workflowId);
|
|
423
|
+
this.promptReservations.delete(workflowId);
|
|
392
424
|
await this.mem.deleteWorkflow(workflowId);
|
|
393
425
|
}
|
|
394
426
|
|
|
@@ -397,34 +429,49 @@ export class DbosDurableBackend implements DurableWorkflowBackend {
|
|
|
397
429
|
this.writeQueue = next.catch((err) => {
|
|
398
430
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
399
431
|
this.writeErrors.push(error);
|
|
400
|
-
|
|
432
|
+
// The next readiness/flush boundary surfaces this fatal persistence error.
|
|
401
433
|
});
|
|
402
434
|
return next;
|
|
403
435
|
}
|
|
404
436
|
|
|
405
437
|
private async writeMetadata(workflowId: string): Promise<void> {
|
|
406
|
-
const
|
|
407
|
-
if (
|
|
408
|
-
|
|
438
|
+
const value = this.mem.toMetadata(workflowId);
|
|
439
|
+
if (value === undefined) return;
|
|
440
|
+
const metadata = {
|
|
441
|
+
...this.promptReservations.metadata(workflowId, value),
|
|
442
|
+
// Ownership provenance: consulted for `running` handles to distinguish a
|
|
443
|
+
// workflow live in another Atomic session from a crashed one.
|
|
444
|
+
ownerExecutorId: this.executorId,
|
|
445
|
+
};
|
|
446
|
+
await this.sdk.recordStepOutput(
|
|
447
|
+
workflowId,
|
|
448
|
+
metadataStepName(metadata.updatedAt),
|
|
449
|
+
encodeMetadata(metadata),
|
|
450
|
+
);
|
|
409
451
|
}
|
|
410
452
|
|
|
411
|
-
private applyMetadata(
|
|
453
|
+
private applyMetadata(
|
|
454
|
+
workflowId: string,
|
|
455
|
+
metadata: import("./types.js").DurableWorkflowMetadata,
|
|
456
|
+
): void {
|
|
412
457
|
this.mem.registerWorkflow({
|
|
413
458
|
workflowId,
|
|
414
|
-
name:
|
|
415
|
-
inputs:
|
|
416
|
-
createdAt:
|
|
417
|
-
updatedAt:
|
|
418
|
-
status:
|
|
419
|
-
completedCheckpoints:
|
|
420
|
-
pendingPrompts:
|
|
421
|
-
...(
|
|
422
|
-
...(
|
|
423
|
-
...(
|
|
424
|
-
...(
|
|
425
|
-
...(
|
|
426
|
-
...(
|
|
427
|
-
...(
|
|
459
|
+
name: metadata.name,
|
|
460
|
+
inputs: metadata.inputs,
|
|
461
|
+
createdAt: metadata.createdAt,
|
|
462
|
+
updatedAt: metadata.updatedAt,
|
|
463
|
+
status: metadata.status,
|
|
464
|
+
completedCheckpoints: metadata.completedCheckpoints,
|
|
465
|
+
pendingPrompts: metadata.pendingPrompts,
|
|
466
|
+
...(metadata.ownerExecutorId !== undefined ? { ownerExecutorId: metadata.ownerExecutorId } : {}),
|
|
467
|
+
...(metadata.sessionFile !== undefined ? { sessionFile: metadata.sessionFile } : {}),
|
|
468
|
+
...(metadata.label !== undefined ? { label: metadata.label } : {}),
|
|
469
|
+
...(metadata.rootWorkflowId !== undefined ? { rootWorkflowId: metadata.rootWorkflowId } : {}),
|
|
470
|
+
...(metadata.resumable !== undefined ? { resumable: metadata.resumable } : {}),
|
|
471
|
+
...(metadata.invocationCwd !== undefined ? { invocationCwd: metadata.invocationCwd } : {}),
|
|
472
|
+
...(metadata.workflowCwd !== undefined ? { workflowCwd: metadata.workflowCwd } : {}),
|
|
473
|
+
...(metadata.repositoryRoot !== undefined ? { repositoryRoot: metadata.repositoryRoot } : {}),
|
|
474
|
+
...(metadata.gitWorktreeRoot !== undefined ? { gitWorktreeRoot: metadata.gitWorktreeRoot } : {}),
|
|
428
475
|
});
|
|
429
476
|
}
|
|
430
477
|
}
|