@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,10 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cross-
|
|
3
|
-
*
|
|
4
|
-
* Resumes a workflow whose durable checkpoints live in the durable backend
|
|
5
|
-
* (and are mirrored to the session JSONL cache) but whose in-process run is no
|
|
6
|
-
* longer live. This is the production path behind `/workflow resume <id>` when
|
|
7
|
-
* the id names a durable workflow that is not present in the live run store.
|
|
2
|
+
* Cross-process workflow resume using DBOS as the sole source of state.
|
|
8
3
|
*
|
|
9
4
|
* Resume semantics (DBOS-aligned):
|
|
10
5
|
* 1. Look up the durable catalog entry (workflow name + cached inputs).
|
|
@@ -26,19 +21,22 @@
|
|
|
26
21
|
import type { WorkflowInputValues } from "../shared/types.js";
|
|
27
22
|
import type { WorkflowRegistry } from "../workflows/registry.js";
|
|
28
23
|
import type { RunOpts } from "../runs/foreground/executor-types.js";
|
|
29
|
-
import {
|
|
24
|
+
import { launchDetachedUntilStartup, workflowStartupFailureMessage } from "../runs/background/startup-admission.js";
|
|
25
|
+
import type { JobTracker } from "../runs/background/job-tracker.js";
|
|
30
26
|
import { resolveAndValidateInputs } from "../runs/foreground/executor-inputs.js";
|
|
31
27
|
import { getDurableBackend } from "./factory.js";
|
|
32
|
-
|
|
28
|
+
|
|
29
|
+
import { resumableEntryFromHandle, type DurableWorkflowBackend } from "./backend.js";
|
|
33
30
|
import type { ResumableWorkflowEntry } from "./types.js";
|
|
34
|
-
import { isDurableWorkflowResumable } from "./resume-eligibility.js";
|
|
31
|
+
import { isDurableWorkflowResumable, isForeignLiveWorkflow } from "./resume-eligibility.js";
|
|
32
|
+
import { getAtomicExecutorId } from "./dbos-sdk-handle.js";
|
|
35
33
|
import { workflowDefinitionRequirementMessage } from "../runs/foreground/executor-child-helpers.js";
|
|
36
34
|
import { isWorkflowDefinition } from "../runs/foreground/executor-child-helpers.js";
|
|
37
35
|
import type { RunSnapshot } from "../shared/store-types.js";
|
|
38
36
|
|
|
39
37
|
export type ResumeDurableResult =
|
|
40
38
|
| { ok: true; runId: string; workflowId: string; name: string; message: string }
|
|
41
|
-
| { ok: false; reason: "workflow_not_found" | "not_resumable" | "invalid_inputs" | "not_registered" | "stale"; message: string };
|
|
39
|
+
| { ok: false; reason: "workflow_not_found" | "not_resumable" | "invalid_inputs" | "not_registered" | "stale" | "startup_failed"; message: string };
|
|
42
40
|
|
|
43
41
|
export interface ResumeDurableDeps {
|
|
44
42
|
readonly registry: WorkflowRegistry;
|
|
@@ -46,44 +44,30 @@ export interface ResumeDurableDeps {
|
|
|
46
44
|
readonly baseRunOpts: RunOpts;
|
|
47
45
|
/** Durable backend override (defaults to the global singleton). */
|
|
48
46
|
readonly durableBackend?: DurableWorkflowBackend;
|
|
47
|
+
/** Job tracker used by the detached resume launch. */
|
|
48
|
+
readonly jobs?: JobTracker;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
/**
|
|
52
|
-
* Prepare a durable resume: hydrate the backend's in-memory mirror from the
|
|
53
|
-
* persistent store (DBOS) so synchronous reads in {@link resumeDurableWorkflow}
|
|
54
|
-
* find the workflow and its checkpoints. No-op for backends without hydration.
|
|
55
|
-
*
|
|
56
|
-
* Must be awaited before calling {@link resumeDurableWorkflow} when the backend
|
|
57
|
-
* might be a fresh DBOS process.
|
|
58
|
-
*/
|
|
51
|
+
/** Hydrate current DBOS metadata and checkpoints before synchronous replay reads. */
|
|
59
52
|
export async function prepareDurableResume(
|
|
60
53
|
workflowIdOrPrefix: string | undefined,
|
|
61
54
|
deps: ResumeDurableDeps,
|
|
62
55
|
): Promise<readonly ResumableWorkflowEntry[]> {
|
|
63
56
|
const backend = deps.durableBackend ?? getDurableBackend();
|
|
64
|
-
|
|
65
|
-
if (backend.hydrateResumableWorkflows !== undefined) {
|
|
66
|
-
await backend.hydrateResumableWorkflows();
|
|
67
|
-
}
|
|
57
|
+
await backend.hydrateResumableWorkflows();
|
|
68
58
|
const catalog = backend.listResumableWorkflows();
|
|
69
59
|
// If a specific target was requested, hydrate that workflow too (it might
|
|
70
60
|
// be resumable but not yet in the resumable filter — e.g. recently failed).
|
|
71
61
|
if (workflowIdOrPrefix !== undefined) {
|
|
72
62
|
const resolved = resolveDurableEntry(workflowIdOrPrefix, catalog);
|
|
73
63
|
if (resolved !== undefined && !("kind" in resolved)) {
|
|
74
|
-
|
|
75
|
-
await backend.hydrateWorkflow(resolved.workflowId);
|
|
76
|
-
}
|
|
64
|
+
await backend.hydrateWorkflow(resolved.workflowId);
|
|
77
65
|
}
|
|
78
66
|
}
|
|
79
67
|
return backend.listResumableWorkflows();
|
|
80
68
|
}
|
|
81
69
|
|
|
82
|
-
/**
|
|
83
|
-
* Resolve a durable catalog entry for a workflow id (full or prefix match).
|
|
84
|
-
* Prefers the durable backend's resumable list; falls back to an explicit
|
|
85
|
-
* session-scan catalog when provided by the caller.
|
|
86
|
-
*/
|
|
70
|
+
/** Resolve a current DBOS catalog entry by full id or unique prefix. */
|
|
87
71
|
export function resolveDurableEntry(
|
|
88
72
|
workflowIdOrPrefix: string,
|
|
89
73
|
catalog: readonly ResumableWorkflowEntry[],
|
|
@@ -96,32 +80,33 @@ export function resolveDurableEntry(
|
|
|
96
80
|
return { kind: "ambiguous", matches: prefixMatches };
|
|
97
81
|
}
|
|
98
82
|
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
* with the cached inputs and the original workflow id so durable checkpoints
|
|
102
|
-
* replay (skipping completed side effects).
|
|
103
|
-
*/
|
|
104
|
-
export function resumeDurableWorkflow(
|
|
83
|
+
/** Resume by DBOS workflow id and replay current persisted checkpoints. */
|
|
84
|
+
export async function resumeDurableWorkflow(
|
|
105
85
|
workflowIdOrPrefix: string,
|
|
106
86
|
deps: ResumeDurableDeps,
|
|
107
87
|
catalog?: readonly ResumableWorkflowEntry[],
|
|
108
|
-
): ResumeDurableResult {
|
|
88
|
+
): Promise<ResumeDurableResult> {
|
|
109
89
|
const backend = deps.durableBackend ?? getDurableBackend();
|
|
110
90
|
const resolvedCatalog = catalog ?? backend.listResumableWorkflows();
|
|
111
91
|
const resolved = resolveDurableEntry(workflowIdOrPrefix, resolvedCatalog);
|
|
112
92
|
if (resolved === undefined) {
|
|
113
|
-
if (!backend.isWorkflowLoadable(workflowIdOrPrefix)) {
|
|
114
|
-
return { ok: false, reason: "not_registered", message: `Durable workflow ${workflowIdOrPrefix.slice(0, 8)} uses an incompatible or unavailable persisted format and cannot be resumed.` };
|
|
115
|
-
}
|
|
116
|
-
// Not in the (filtered) resumable catalog. It may still be a workflow the
|
|
117
|
-
// backend knows about. Only surface "already running" when there is a live,
|
|
118
|
-
// actively-executing run for it in this session; otherwise a `running`
|
|
119
|
-
// durable handle is a crashed process and falls through to not-found.
|
|
120
93
|
const direct = backend.getWorkflow(workflowIdOrPrefix);
|
|
121
|
-
if (direct !== undefined && direct.status === "running"
|
|
122
|
-
|
|
94
|
+
if (direct !== undefined && direct.status === "running") {
|
|
95
|
+
if (hasActiveLiveRun(deps.baseRunOpts.store, direct.workflowId)) {
|
|
96
|
+
return alreadyRunningResult(direct.name, direct.workflowId, deps.baseRunOpts.store);
|
|
97
|
+
}
|
|
98
|
+
if (isForeignLiveWorkflow(direct, getAtomicExecutorId())) {
|
|
99
|
+
return foreignRunningResult(direct.name, direct.workflowId);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (!backend.isWorkflowLoadable(workflowIdOrPrefix)) {
|
|
103
|
+
return {
|
|
104
|
+
ok: false,
|
|
105
|
+
reason: "not_registered",
|
|
106
|
+
message: `Workflow ${workflowIdOrPrefix.slice(0, 8)} has no valid current DBOS state.`,
|
|
107
|
+
};
|
|
123
108
|
}
|
|
124
|
-
return { ok: false, reason: "not_registered", message: `No
|
|
109
|
+
return { ok: false, reason: "not_registered", message: `No resumable workflow found for id/prefix: ${workflowIdOrPrefix}` };
|
|
125
110
|
}
|
|
126
111
|
if ("kind" in resolved) {
|
|
127
112
|
return {
|
|
@@ -131,23 +116,31 @@ export function resumeDurableWorkflow(
|
|
|
131
116
|
};
|
|
132
117
|
}
|
|
133
118
|
if (!backend.isWorkflowLoadable(resolved.workflowId)) {
|
|
134
|
-
return {
|
|
119
|
+
return {
|
|
120
|
+
ok: false,
|
|
121
|
+
reason: "not_registered",
|
|
122
|
+
message: `Workflow ${resolved.workflowId.slice(0, 8)} has no valid current DBOS state.`,
|
|
123
|
+
};
|
|
135
124
|
}
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
// session — otherwise it is a crashed process and cross-session crash
|
|
140
|
-
// recovery should proceed.
|
|
125
|
+
// Revalidate the authoritative DBOS handle before resume. A running handle
|
|
126
|
+
// is refused when this process still has an actively executing run, or when
|
|
127
|
+
// fresh ownership metadata shows another Atomic session is executing it.
|
|
141
128
|
const handle = backend.getWorkflow(resolved.workflowId);
|
|
142
129
|
if (handle === undefined) {
|
|
143
130
|
return {
|
|
144
131
|
ok: false,
|
|
145
132
|
reason: "stale",
|
|
146
|
-
message: `Workflow ${resolved.workflowId.slice(0, 8)} has
|
|
133
|
+
message: `Workflow ${resolved.workflowId.slice(0, 8)} has no current DBOS checkpoint state; re-run the workflow to start fresh.`,
|
|
147
134
|
};
|
|
148
135
|
}
|
|
149
|
-
|
|
150
|
-
|
|
136
|
+
|
|
137
|
+
if (handle.status === "running") {
|
|
138
|
+
if (hasActiveLiveRun(deps.baseRunOpts.store, resolved.workflowId)) {
|
|
139
|
+
return alreadyRunningResult(handle.name, resolved.workflowId, deps.baseRunOpts.store);
|
|
140
|
+
}
|
|
141
|
+
if (isForeignLiveWorkflow(handle, getAtomicExecutorId())) {
|
|
142
|
+
return foreignRunningResult(handle.name, resolved.workflowId);
|
|
143
|
+
}
|
|
151
144
|
}
|
|
152
145
|
if (!isDurableWorkflowResumable(handle)) {
|
|
153
146
|
return { ok: false, reason: "not_resumable", message: `Workflow ${resolved.workflowId.slice(0, 8)} is ${handle.status}, not resumable.` };
|
|
@@ -169,10 +162,19 @@ export function resumeDurableWorkflow(
|
|
|
169
162
|
}
|
|
170
163
|
removeDurableResumeShadowRuns(deps.baseRunOpts.store, resolved.workflowId);
|
|
171
164
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
165
|
+
// Claim resume against concurrent deletion through the required transition seam.
|
|
166
|
+
const claimed = await backend.transitionWorkflowStatus(
|
|
167
|
+
resolved.workflowId,
|
|
168
|
+
[handle.status],
|
|
169
|
+
"running",
|
|
170
|
+
);
|
|
171
|
+
if (!claimed) {
|
|
172
|
+
return {
|
|
173
|
+
ok: false,
|
|
174
|
+
reason: "stale",
|
|
175
|
+
message: `Workflow ${resolved.workflowId.slice(0, 8)} changed while resume was pending; refresh the workflow list and try again.`,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
176
178
|
|
|
177
179
|
const resumeRunOpts: RunOpts = {
|
|
178
180
|
...deps.baseRunOpts,
|
|
@@ -181,7 +183,31 @@ export function resumeDurableWorkflow(
|
|
|
181
183
|
durableBackend: backend,
|
|
182
184
|
};
|
|
183
185
|
|
|
184
|
-
|
|
186
|
+
let launch: ReturnType<typeof launchDetachedUntilStartup>;
|
|
187
|
+
try {
|
|
188
|
+
launch = launchDetachedUntilStartup(def, inputs, {
|
|
189
|
+
...resumeRunOpts,
|
|
190
|
+
...(deps.jobs !== undefined ? { jobs: deps.jobs } : {}),
|
|
191
|
+
});
|
|
192
|
+
} catch (error) {
|
|
193
|
+
backend.setWorkflowStatus(resolved.workflowId, handle.status, handle.pendingPrompts, handle.resumable);
|
|
194
|
+
await backend.flush();
|
|
195
|
+
return { ok: false, reason: "startup_failed", message: `Failed to resume durable workflow ${resolved.workflowId.slice(0, 8)}: ${error instanceof Error ? error.message : String(error)}` };
|
|
196
|
+
}
|
|
197
|
+
const { accepted } = launch;
|
|
198
|
+
const admission = await launch.wait;
|
|
199
|
+
if (!admission.started) {
|
|
200
|
+
const snapshot = deps.baseRunOpts.store?.runs().find((run) => run.id === accepted.runId);
|
|
201
|
+
const error = workflowStartupFailureMessage(
|
|
202
|
+
admission,
|
|
203
|
+
snapshot?.error,
|
|
204
|
+
`Workflow ${resolved.workflowId.slice(0, 8)} ended before startup admission`,
|
|
205
|
+
);
|
|
206
|
+
deps.baseRunOpts.store?.removeRun(accepted.runId);
|
|
207
|
+
backend.setWorkflowStatus(resolved.workflowId, handle.status, handle.pendingPrompts, handle.resumable);
|
|
208
|
+
await backend.flush();
|
|
209
|
+
return { ok: false, reason: "startup_failed", message: `Failed to resume durable workflow ${resolved.workflowId.slice(0, 8)}: ${error}` };
|
|
210
|
+
}
|
|
185
211
|
|
|
186
212
|
return {
|
|
187
213
|
ok: true,
|
|
@@ -204,6 +230,15 @@ function removeDurableResumeShadowRuns(store: RunOpts["store"], workflowId: stri
|
|
|
204
230
|
if (!store.removeRun(workflowId)) return;
|
|
205
231
|
}
|
|
206
232
|
}
|
|
233
|
+
function foreignRunningResult(name: string, workflowId: string): ResumeDurableResult {
|
|
234
|
+
return {
|
|
235
|
+
ok: false,
|
|
236
|
+
reason: "not_resumable",
|
|
237
|
+
message: `Workflow "${name}" (${workflowId.slice(0, 8)}) is actively running in another Atomic session. `
|
|
238
|
+
+ "Control it from that session; it becomes resumable here only after that session pauses, quits, or crashes.",
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
207
242
|
|
|
208
243
|
function alreadyRunningResult(name: string, workflowId: string, store: RunOpts["store"]): ResumeDurableResult {
|
|
209
244
|
const here = store?.runs().some((r) => r.id === workflowId && r.endedAt === undefined) === true;
|
|
@@ -212,7 +247,7 @@ function alreadyRunningResult(name: string, workflowId: string, store: RunOpts["
|
|
|
212
247
|
reason: "not_resumable",
|
|
213
248
|
message: `Workflow "${name}" (${workflowId.slice(0, 8)}) is already running${
|
|
214
249
|
here ? " in this session" : " in another session"
|
|
215
|
-
}.
|
|
250
|
+
}. See agents working and chat with or steer each stage using \`/workflow connect ${workflowId.slice(0, 8)}\`; use \`/workflow quit ${workflowId.slice(0, 8)}\` to pause the run for later resume.`,
|
|
216
251
|
};
|
|
217
252
|
}
|
|
218
253
|
|
|
@@ -227,36 +262,7 @@ function hasActiveLiveRun(store: RunOpts["store"] | undefined, workflowId: strin
|
|
|
227
262
|
return store.runs().some((r) => r.id === workflowId && r.endedAt === undefined && r.exitReason !== "quit");
|
|
228
263
|
}
|
|
229
264
|
|
|
230
|
-
/**
|
|
231
|
-
* Check whether the durable backend records a TERMINAL (non-resumable) status
|
|
232
|
-
* for the given workflow id. Terminal status suppresses stale session-cache
|
|
233
|
-
* entries so a completed/cancelled workflow is not resurrected as resumable.
|
|
234
|
-
*
|
|
235
|
-
* Returns true only when the backend has a registered handle whose status is
|
|
236
|
-
* definitively terminal (completed, cancelled, or failed-and-non-resumable).
|
|
237
|
-
*/
|
|
238
|
-
export function isBackendTerminal(backend: DurableWorkflowBackend, workflowId: string): boolean {
|
|
239
|
-
const handle = backend.getWorkflow(workflowId);
|
|
240
|
-
if (handle === undefined) return false;
|
|
241
|
-
const status = handle.status;
|
|
242
|
-
if (status === "completed" || status === "cancelled") return true;
|
|
243
|
-
if (status === "failed" || status === "blocked") return handle.resumable === false;
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Runtime-facing async preparation: hydrate the durable backend from DBOS
|
|
250
|
-
* (when supported) then list resumable workflows with optional session-dir
|
|
251
|
-
* scan merge. Used by the ExtensionRuntime's `prepareDurableResumable`.
|
|
252
|
-
*
|
|
253
|
-
* Stale-cache suppression: when a session JSONL cache entry has no matching
|
|
254
|
-
* durable backend handle, it came from an older/non-checkpointed workflow
|
|
255
|
-
* engine and is hidden from selectors. When the backend knows a workflow is
|
|
256
|
-
* terminal (completed/cancelled/non-resumable), stale cache rows for that id
|
|
257
|
-
* are also suppressed. cross-ref: issue #1498.
|
|
258
|
-
*/
|
|
259
|
-
/** Remove restored/live snapshots whose authoritative durable format is non-loadable. */
|
|
265
|
+
/** Remove local snapshots that do not exist as valid current DBOS workflows. */
|
|
260
266
|
export function purgeSuppressedWorkflowRuns(backend: DurableWorkflowBackend, store: RunOpts["store"]): readonly string[] {
|
|
261
267
|
if (store === undefined) return [];
|
|
262
268
|
const removed: string[] = [];
|
|
@@ -267,36 +273,33 @@ export function purgeSuppressedWorkflowRuns(backend: DurableWorkflowBackend, sto
|
|
|
267
273
|
return removed;
|
|
268
274
|
}
|
|
269
275
|
|
|
276
|
+
/** Hydrate a bounded set of known DBOS workflow ids. */
|
|
277
|
+
export async function prepareTargetedDurableResumable(
|
|
278
|
+
backend: DurableWorkflowBackend,
|
|
279
|
+
workflowIds: readonly string[],
|
|
280
|
+
): Promise<readonly ResumableWorkflowEntry[]> {
|
|
281
|
+
const entries: ResumableWorkflowEntry[] = [];
|
|
282
|
+
const seen = new Set<string>();
|
|
283
|
+
for (const workflowId of workflowIds) {
|
|
284
|
+
if (seen.has(workflowId)) continue;
|
|
285
|
+
seen.add(workflowId);
|
|
286
|
+
await backend.hydrateWorkflow(workflowId);
|
|
287
|
+
const handle = backend.getLoadableWorkflow(workflowId);
|
|
288
|
+
if (handle === undefined || !isDurableWorkflowResumable(handle)) continue;
|
|
289
|
+
entries.push(resumableEntryFromHandle(handle));
|
|
290
|
+
}
|
|
291
|
+
return entries;
|
|
292
|
+
}
|
|
293
|
+
|
|
270
294
|
export async function prepareRuntimeDurableResumable(
|
|
271
295
|
getBackend: () => DurableWorkflowBackend,
|
|
272
|
-
resolveSessionDir: () => string | undefined,
|
|
273
296
|
workflowIdOrPrefix?: string,
|
|
274
|
-
sessionDir?: string,
|
|
275
297
|
): Promise<readonly ResumableWorkflowEntry[]> {
|
|
276
298
|
const backend = getBackend();
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const catalog = backend.listResumableWorkflows();
|
|
282
|
-
const resolved = resolveDurableEntry(workflowIdOrPrefix, catalog);
|
|
283
|
-
if (resolved !== undefined && !("kind" in resolved)) {
|
|
284
|
-
await backend.hydrateWorkflow(resolved.workflowId);
|
|
285
|
-
}
|
|
299
|
+
await backend.hydrateResumableWorkflows();
|
|
300
|
+
if (workflowIdOrPrefix !== undefined) {
|
|
301
|
+
const resolved = resolveDurableEntry(workflowIdOrPrefix, backend.listResumableWorkflows());
|
|
302
|
+
if (resolved !== undefined && !("kind" in resolved)) await backend.hydrateWorkflow(resolved.workflowId);
|
|
286
303
|
}
|
|
287
|
-
|
|
288
|
-
const effectiveSessionDir = sessionDir ?? resolveSessionDir();
|
|
289
|
-
if (effectiveSessionDir === undefined) return live;
|
|
290
|
-
const { scanResumableWorkflows } = await import("./resume-catalog.js");
|
|
291
|
-
const scanned = scanResumableWorkflows(effectiveSessionDir);
|
|
292
|
-
const liveIds = new Set(live.map((e) => e.workflowId));
|
|
293
|
-
// Suppress cache-only entries from older workflow engines. Without a
|
|
294
|
-
// durable backend handle/checkpoint state, selecting the row can only fail
|
|
295
|
-
// as stale (or risk re-running from scratch), so it should not clutter the
|
|
296
|
-
// resume selector.
|
|
297
|
-
const suppressed = scanned.filter((entry) => {
|
|
298
|
-
const handle = backend.getWorkflow(entry.workflowId);
|
|
299
|
-
return !liveIds.has(entry.workflowId) && handle !== undefined && isDurableWorkflowResumable(handle);
|
|
300
|
-
});
|
|
301
|
-
return [...live, ...suppressed];
|
|
304
|
+
return backend.listResumableWorkflows();
|
|
302
305
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { DurableWorkflowBackend } from "./backend.js";
|
|
2
|
+
|
|
3
|
+
export type DurableWorkflowDeleteOutcome =
|
|
4
|
+
| { readonly ok: true; readonly message: string }
|
|
5
|
+
| { readonly ok: false; readonly message: string };
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `/resume` parity keeps every eligible run regardless of age/count and only
|
|
9
|
+
* removes history after an explicit confirmed action. This helper is the
|
|
10
|
+
* workflow-aware deletion gate used after selector confirmation.
|
|
11
|
+
*/
|
|
12
|
+
export async function deleteDurableWorkflowIfSafe(
|
|
13
|
+
backend: DurableWorkflowBackend,
|
|
14
|
+
workflowId: string,
|
|
15
|
+
isInFlight: (workflowId: string) => boolean,
|
|
16
|
+
): Promise<DurableWorkflowDeleteOutcome> {
|
|
17
|
+
if (isInFlight(workflowId)) {
|
|
18
|
+
return { ok: false, message: "Cannot delete an in-flight workflow run." };
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const handle = backend.getLoadableWorkflow(workflowId);
|
|
22
|
+
if (handle === undefined) {
|
|
23
|
+
return { ok: false, message: "Workflow durable state is stale or no longer available." };
|
|
24
|
+
}
|
|
25
|
+
if (handle.status === "running") {
|
|
26
|
+
return { ok: false, message: "Cannot delete a workflow marked running; it may be active in another process." };
|
|
27
|
+
}
|
|
28
|
+
const result = await backend.deleteWorkflowIfInactive(workflowId);
|
|
29
|
+
if (!result.ok) {
|
|
30
|
+
return {
|
|
31
|
+
ok: false,
|
|
32
|
+
message: result.reason === "running"
|
|
33
|
+
? "Cannot delete a workflow that became active while deletion was pending."
|
|
34
|
+
: "Workflow durable state is stale or no longer available.",
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return { ok: true, message: "Workflow durable history deleted; retained session transcripts were not removed." };
|
|
38
|
+
} catch (error) {
|
|
39
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
40
|
+
return { ok: false, message: `Failed to delete workflow durable history: ${detail}` };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable run-level elapsed-time checkpoints.
|
|
3
|
+
*
|
|
4
|
+
* Persists the total accumulated elapsed time of a top-level workflow run so a
|
|
5
|
+
* durable `/workflow resume` can seed the new `RunSnapshot` with the prior
|
|
6
|
+
* elapsed time — the main-chat dashboard total then reports prior + current
|
|
7
|
+
* elapsed instead of restarting at zero.
|
|
8
|
+
*
|
|
9
|
+
* Storage shape: a reserved tool-kind checkpoint (name/argsHash
|
|
10
|
+
* `workflow-run-timing`). Tool checkpoints round-trip through the DBOS
|
|
11
|
+
* envelope untouched and are ignored by stage-graph reconstruction, so no
|
|
12
|
+
* phantom stages appear in durable inspection. Repeated updates use distinct
|
|
13
|
+
* checkpoint ids; the latest record (by `completedAt`) wins on hydration
|
|
14
|
+
* because the in-memory mirror replays checkpoints in completion order.
|
|
15
|
+
*
|
|
16
|
+
* cross-ref: packages/workflows/src/shared/timing.ts elapsedRunMs
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { DurableWorkflowBackend } from "./backend.js";
|
|
20
|
+
import type { DurableToolCheckpoint } from "./types.js";
|
|
21
|
+
import type { RunSnapshot } from "../shared/store-types.js";
|
|
22
|
+
import { elapsedRunMs } from "../shared/timing.js";
|
|
23
|
+
|
|
24
|
+
/** Reserved checkpoint name AND args-hash for run-level timing records. */
|
|
25
|
+
export const RUN_TIMING_CHECKPOINT_NAME = "workflow-run-timing";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Debounce granularity for run-timing updates, matching the stage-session
|
|
29
|
+
* duration bucket so piggybacked writes never outpace stage checkpoints.
|
|
30
|
+
*/
|
|
31
|
+
export const RUN_TIMING_DURATION_BUCKET_MS = 30_000;
|
|
32
|
+
|
|
33
|
+
function timingBucket(elapsedMs: number): number {
|
|
34
|
+
return Math.floor(elapsedMs / RUN_TIMING_DURATION_BUCKET_MS);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Prior accumulated run elapsed recorded durably, or undefined when absent. */
|
|
38
|
+
export function priorRunElapsedMs(backend: DurableWorkflowBackend, workflowId: string): number | undefined {
|
|
39
|
+
const output = backend.getToolOutput(workflowId, RUN_TIMING_CHECKPOINT_NAME);
|
|
40
|
+
if (typeof output !== "object" || output === null || Array.isArray(output)) return undefined;
|
|
41
|
+
const elapsedMs = (output as Record<string, unknown>)["elapsedMs"];
|
|
42
|
+
if (typeof elapsedMs !== "number" || !Number.isFinite(elapsedMs) || elapsedMs <= 0) return undefined;
|
|
43
|
+
return elapsedMs;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Record the run's current total elapsed time (prior + this session) durably.
|
|
48
|
+
*
|
|
49
|
+
* Skipped when the workflow has no durable progress yet (a timing record with
|
|
50
|
+
* nothing to resume would only manufacture resumability), when the elapsed
|
|
51
|
+
* value did not grow past the last record, or — with `debounce` — while the
|
|
52
|
+
* value stays inside the last 30 s bucket.
|
|
53
|
+
*/
|
|
54
|
+
export function recordRunTimingCheckpoint(
|
|
55
|
+
backend: DurableWorkflowBackend,
|
|
56
|
+
run: RunSnapshot,
|
|
57
|
+
options?: { readonly debounce?: boolean; readonly now?: number },
|
|
58
|
+
): boolean {
|
|
59
|
+
const now = options?.now ?? Date.now();
|
|
60
|
+
const elapsedMs = elapsedRunMs(run, now);
|
|
61
|
+
if (elapsedMs <= 0) return false;
|
|
62
|
+
if (backend.listCheckpoints(run.id).length === 0) return false;
|
|
63
|
+
const recorded = priorRunElapsedMs(backend, run.id);
|
|
64
|
+
if (recorded !== undefined) {
|
|
65
|
+
if (elapsedMs <= recorded) return false;
|
|
66
|
+
if (options?.debounce === true && timingBucket(elapsedMs) === timingBucket(recorded)) return false;
|
|
67
|
+
}
|
|
68
|
+
const checkpoint: DurableToolCheckpoint = {
|
|
69
|
+
kind: "tool",
|
|
70
|
+
workflowId: run.id,
|
|
71
|
+
checkpointId: `run-timing:${elapsedMs}`,
|
|
72
|
+
name: RUN_TIMING_CHECKPOINT_NAME,
|
|
73
|
+
argsHash: RUN_TIMING_CHECKPOINT_NAME,
|
|
74
|
+
output: { elapsedMs },
|
|
75
|
+
completedAt: now,
|
|
76
|
+
};
|
|
77
|
+
backend.recordCheckpoint(checkpoint);
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Elapsed time a freshly-created run inherits from its predecessor:
|
|
83
|
+
* continuation resumes measure the live source snapshot; durable re-dispatch
|
|
84
|
+
* resumes (same run id, no continuation) read the persisted timing record.
|
|
85
|
+
*/
|
|
86
|
+
export function inheritedRunElapsedMs(input: {
|
|
87
|
+
readonly backend: DurableWorkflowBackend;
|
|
88
|
+
readonly runId: string;
|
|
89
|
+
readonly continuationSource?: RunSnapshot;
|
|
90
|
+
readonly now?: number;
|
|
91
|
+
}): number | undefined {
|
|
92
|
+
const now = input.now ?? Date.now();
|
|
93
|
+
const source = input.continuationSource;
|
|
94
|
+
const inherited = source !== undefined
|
|
95
|
+
? elapsedRunMs(source, source.endedAt ?? now)
|
|
96
|
+
: priorRunElapsedMs(input.backend, input.runId);
|
|
97
|
+
return inherited !== undefined && inherited > 0 ? inherited : undefined;
|
|
98
|
+
}
|
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
* remaps every checkpoint identity to the root workflow id, prefixed by a stable
|
|
13
13
|
* child boundary key, so the same side effects are recovered on resume.
|
|
14
14
|
*
|
|
15
|
-
* Only checkpoint read/write methods are scoped.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* runs are never independently addressable — only the root workflow is.
|
|
15
|
+
* Only checkpoint read/write methods are scoped. Root lifecycle, catalog,
|
|
16
|
+
* metadata, and deletion methods are no-ops because child runs are not
|
|
17
|
+
* independently addressable.
|
|
19
18
|
*
|
|
20
19
|
* cross-ref: issue #1498 — child side effects under the root durable workflow.
|
|
21
20
|
*/
|
|
22
21
|
|
|
23
22
|
import type { DurableCheckpoint, DurableWorkflowStatus, ResumableWorkflowEntry } from "./types.js";
|
|
24
23
|
import type { WorkflowSerializableValue } from "../shared/types.js";
|
|
25
|
-
import type { DurableWorkflowBackend, WorkflowRegistrationInput } from "./backend.js";
|
|
24
|
+
import type { DurableInactiveDeleteResult, DurableWorkflowBackend, DurableWorkflowCatalogEntries, WorkflowRegistrationInput } from "./backend.js";
|
|
25
|
+
import { claimDurablePromptToken, durablePromptScope, releaseDurablePrompt, reserveDurablePrompt, type PromptReservationToken } from "./prompt-reservations.js";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Durable scope for a child workflow run.
|
|
@@ -62,16 +62,11 @@ export class ScopedDurableBackend implements DurableWorkflowBackend {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
async recordCheckpointAsync(checkpoint: DurableCheckpoint): Promise<void> {
|
|
65
|
-
|
|
66
|
-
await this.inner.recordCheckpointAsync(this.remap(checkpoint));
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
this.inner.recordCheckpoint(this.remap(checkpoint));
|
|
70
|
-
await this.inner.flush?.();
|
|
65
|
+
await this.inner.recordCheckpointAsync(this.remap(checkpoint));
|
|
71
66
|
}
|
|
72
67
|
|
|
73
68
|
flush(): Promise<void> {
|
|
74
|
-
return this.inner.flush
|
|
69
|
+
return this.inner.flush();
|
|
75
70
|
}
|
|
76
71
|
|
|
77
72
|
getToolOutput(_workflowId: string, argsHash: string): WorkflowSerializableValue | undefined {
|
|
@@ -97,7 +92,7 @@ export class ScopedDurableBackend implements DurableWorkflowBackend {
|
|
|
97
92
|
|
|
98
93
|
listCheckpoints(_workflowId: string): readonly DurableCheckpoint[] {
|
|
99
94
|
const all = this.inner.listCheckpoints(this.scope.rootWorkflowId);
|
|
100
|
-
const prefix = `${this.scope
|
|
95
|
+
const prefix = `${this.effectivePromptScope().scope}:`;
|
|
101
96
|
// Checkpoints are stored with their scope prefix already embedded in their
|
|
102
97
|
// ids (see remap()). Filter by the stored id directly — NOT by re-prefixing
|
|
103
98
|
// — so sibling scopes (e.g. "workflow:child:1") are excluded when the
|
|
@@ -111,10 +106,44 @@ export class ScopedDurableBackend implements DurableWorkflowBackend {
|
|
|
111
106
|
return undefined;
|
|
112
107
|
}
|
|
113
108
|
|
|
109
|
+
getLoadableWorkflow(_workflowId: string): undefined {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
|
|
114
113
|
setWorkflowStatus(_workflowId: string, _status: DurableWorkflowStatus, _pendingPrompts?: number, _resumable?: boolean): void {
|
|
115
114
|
// No-op: child status is reflected via the root workflow boundary.
|
|
116
115
|
}
|
|
117
116
|
|
|
117
|
+
async transitionWorkflowStatus(
|
|
118
|
+
_workflowId: string,
|
|
119
|
+
_expectedStatuses: readonly DurableWorkflowStatus[],
|
|
120
|
+
_status: DurableWorkflowStatus,
|
|
121
|
+
_pendingPrompts?: number,
|
|
122
|
+
_resumable?: boolean,
|
|
123
|
+
): Promise<boolean> {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
adjustPendingPrompts(_workflowId: string, delta: number): void {
|
|
128
|
+
this.inner.adjustPendingPrompts(this.scope.rootWorkflowId, delta);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
promptReservationScope(_workflowId: string): { readonly rootWorkflowId: string; readonly scope: string } {
|
|
132
|
+
return this.effectivePromptScope();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
pendingPromptToken(_workflowId: string, reservationId: string): PromptReservationToken | undefined {
|
|
136
|
+
return claimDurablePromptToken(this.inner, this.scope.rootWorkflowId, reservationId);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
reservePendingPrompt(_workflowId: string, reservationId: string): PromptReservationToken {
|
|
140
|
+
return reserveDurablePrompt(this.inner, this.scope.rootWorkflowId, reservationId);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
releasePendingPrompt(_workflowId: string, reservationId: string, token: PromptReservationToken): void {
|
|
144
|
+
releaseDurablePrompt(this.inner, this.scope.rootWorkflowId, reservationId, token);
|
|
145
|
+
}
|
|
146
|
+
|
|
118
147
|
listResumableWorkflows(): readonly ResumableWorkflowEntry[] {
|
|
119
148
|
return [];
|
|
120
149
|
}
|
|
@@ -123,7 +152,11 @@ export class ScopedDurableBackend implements DurableWorkflowBackend {
|
|
|
123
152
|
return [];
|
|
124
153
|
}
|
|
125
154
|
|
|
126
|
-
|
|
155
|
+
async prepareWorkflowCatalog(): Promise<DurableWorkflowCatalogEntries> {
|
|
156
|
+
return { resumable: [], completed: [] };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
toMetadata(_workflowId: string): undefined {
|
|
127
160
|
return undefined;
|
|
128
161
|
}
|
|
129
162
|
|
|
@@ -131,6 +164,10 @@ export class ScopedDurableBackend implements DurableWorkflowBackend {
|
|
|
131
164
|
// No-op: scoped children never own or delete root durable state.
|
|
132
165
|
}
|
|
133
166
|
|
|
167
|
+
async deleteWorkflowIfInactive(_workflowId: string): Promise<DurableInactiveDeleteResult> {
|
|
168
|
+
return { ok: false, reason: "not_found" };
|
|
169
|
+
}
|
|
170
|
+
|
|
134
171
|
isWorkflowLoadable(_workflowId: string): boolean {
|
|
135
172
|
return false;
|
|
136
173
|
}
|
|
@@ -147,6 +184,17 @@ export class ScopedDurableBackend implements DurableWorkflowBackend {
|
|
|
147
184
|
return Promise.resolve();
|
|
148
185
|
}
|
|
149
186
|
|
|
187
|
+
private effectivePromptScope(): { readonly rootWorkflowId: string; readonly scope: string } {
|
|
188
|
+
const parent = durablePromptScope(this.inner, this.scope.rootWorkflowId);
|
|
189
|
+
const scope = parent.scope === "root"
|
|
190
|
+
? this.scope.scopePrefix
|
|
191
|
+
: `${parent.scope}:${this.scope.scopePrefix}`;
|
|
192
|
+
return {
|
|
193
|
+
rootWorkflowId: parent.rootWorkflowId,
|
|
194
|
+
scope,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
150
198
|
private scopeKey(key: string): string {
|
|
151
199
|
return `${this.scope.scopePrefix}:${key}`;
|
|
152
200
|
}
|