@bastani/atomic 0.9.11-alpha.9 → 0.9.11
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 +134 -0
- package/README.md +1 -1
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/subagent-relay.ts +8 -5
- package/dist/builtin/mcp/CHANGELOG.md +10 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +20 -0
- package/dist/builtin/subagents/agents/code-simplifier.md +2 -2
- package/dist/builtin/subagents/agents/codebase-analyzer.md +2 -2
- package/dist/builtin/subagents/agents/codebase-locator.md +2 -2
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +2 -2
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +2 -2
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +2 -2
- package/dist/builtin/subagents/agents/codebase-research-locator.md +2 -2
- package/dist/builtin/subagents/agents/worker.md +2 -2
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/notification-content.ts +14 -9
- package/dist/builtin/subagents/src/runs/background/notify.ts +20 -4
- package/dist/builtin/web-access/CHANGELOG.md +20 -0
- package/dist/builtin/web-access/content-tools.ts +1 -0
- package/dist/builtin/web-access/flat-string.ts +37 -0
- package/dist/builtin/web-access/github-api.ts +2 -1
- package/dist/builtin/web-access/github-extract.ts +3 -2
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +57 -0
- package/dist/builtin/workflows/builtin/goal-ledger.ts +6 -4
- package/dist/builtin/workflows/builtin/goal-runner.ts +2 -1
- package/dist/builtin/workflows/builtin/goal.ts +1 -1
- package/dist/builtin/workflows/builtin/ralph-core.ts +8 -9
- package/dist/builtin/workflows/builtin/ralph-forked-prompts.ts +2 -4
- package/dist/builtin/workflows/builtin/ralph-models.ts +4 -4
- package/dist/builtin/workflows/builtin/ralph-runner.ts +5 -8
- package/dist/builtin/workflows/builtin/ralph.ts +2 -1
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/durable/completed-catalog.ts +14 -8
- package/dist/builtin/workflows/src/durable/completed-inspection.ts +10 -11
- package/dist/builtin/workflows/src/durable/resume-catalog.ts +1 -1
- package/dist/builtin/workflows/src/durable/resume-eligibility.ts +42 -0
- package/dist/builtin/workflows/src/durable/resume-runtime.ts +36 -37
- package/dist/builtin/workflows/src/durable/tool-primitive.ts +10 -2
- package/dist/builtin/workflows/src/engine/run.ts +1 -0
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +12 -8
- package/dist/builtin/workflows/src/extension/hil-answer-notifications.ts +5 -2
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +1966 -880
- package/dist/builtin/workflows/src/extension/lifecycle-notifications.ts +6 -3
- package/dist/builtin/workflows/src/extension/postmortem-deps.ts +3 -2
- package/dist/builtin/workflows/src/extension/render-result.ts +4 -11
- package/dist/builtin/workflows/src/extension/runtime-durable-resume.ts +17 -20
- package/dist/builtin/workflows/src/extension/runtime.ts +3 -3
- package/dist/builtin/workflows/src/extension/workflow-command-completions.ts +1 -1
- package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +3 -7
- package/dist/builtin/workflows/src/extension/workflow-durable-resume-command.ts +21 -24
- package/dist/builtin/workflows/src/extension/workflow-resume-picker-rows.ts +38 -26
- package/dist/builtin/workflows/src/extension/workflow-resume-shadow.ts +2 -1
- package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +56 -64
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +2 -2
- package/dist/builtin/workflows/src/extension/workflow-status-summary.ts +0 -5
- package/dist/builtin/workflows/src/extension/workflow-targets.ts +17 -20
- package/dist/builtin/workflows/src/extension/workflow-tool-content.ts +1 -1
- package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +24 -51
- package/dist/builtin/workflows/src/extension/workflow-tool-inspection.ts +7 -29
- package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +5 -13
- package/dist/builtin/workflows/src/extension/workflow-tool.ts +4 -13
- package/dist/builtin/workflows/src/runs/background/quit.ts +4 -3
- package/dist/builtin/workflows/src/runs/background/run-inspect.ts +8 -8
- package/dist/builtin/workflows/src/runs/background/status.ts +2 -1
- package/dist/builtin/workflows/src/runs/background/workflow-lifecycle-aggregate.ts +2 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +5 -5
- package/dist/builtin/workflows/src/runs/foreground/executor-lifecycle.ts +4 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-scheduler.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +23 -8
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +6 -2
- package/dist/builtin/workflows/src/runs/foreground/executor-task-prompts.ts +5 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +56 -10
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +6 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-output.ts +137 -6
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +2 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +2 -0
- package/dist/builtin/workflows/src/shared/expanded-workflow-graph.ts +159 -10
- package/dist/builtin/workflows/src/shared/flat-string.ts +33 -0
- package/dist/builtin/workflows/src/shared/graph-store-snapshot.ts +144 -0
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +2 -3
- package/dist/builtin/workflows/src/shared/run-id.ts +36 -0
- package/dist/builtin/workflows/src/shared/store-internal.ts +32 -3
- package/dist/builtin/workflows/src/shared/store-observation.ts +10 -0
- package/dist/builtin/workflows/src/shared/store-public-types.ts +8 -0
- package/dist/builtin/workflows/src/shared/store-run-methods.ts +14 -0
- package/dist/builtin/workflows/src/shared/store-types.ts +4 -0
- package/dist/builtin/workflows/src/shared/types.ts +2 -0
- package/dist/builtin/workflows/src/shared/workflow-artifacts.ts +261 -0
- package/dist/builtin/workflows/src/tui/dispatch-confirm.ts +39 -23
- package/dist/builtin/workflows/src/tui/graph-canvas.ts +26 -9
- package/dist/builtin/workflows/src/tui/graph-view-constants.ts +3 -0
- package/dist/builtin/workflows/src/tui/graph-view-graph-render.ts +95 -98
- package/dist/builtin/workflows/src/tui/graph-view-render.ts +7 -20
- package/dist/builtin/workflows/src/tui/graph-view-state.ts +160 -13
- package/dist/builtin/workflows/src/tui/layout.ts +8 -2
- package/dist/builtin/workflows/src/tui/node-card.ts +57 -45
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +4 -2
- package/dist/builtin/workflows/src/tui/prompt-card-render.ts +291 -21
- package/dist/builtin/workflows/src/tui/prompt-card.ts +1 -1
- package/dist/builtin/workflows/src/tui/renderers.ts +0 -1
- package/dist/builtin/workflows/src/tui/run-detail.ts +52 -35
- package/dist/builtin/workflows/src/tui/run-identity-rows.ts +97 -0
- package/dist/builtin/workflows/src/tui/session-overlays.ts +24 -3
- package/dist/builtin/workflows/src/tui/session-picker.ts +94 -41
- package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +190 -26
- package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +52 -18
- package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +9 -5
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +44 -4
- package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +3 -1
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +3 -2
- package/dist/builtin/workflows/src/tui/status-list.ts +67 -45
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +7 -6
- package/dist/builtin/workflows/src/tui/widget.ts +49 -40
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +15 -10
- package/dist/builtin/workflows/src/tui/workflow-resume-selector.ts +21 -8
- package/dist/core/agent-session-accessors.d.ts.map +1 -1
- package/dist/core/agent-session-accessors.js +5 -0
- package/dist/core/agent-session-accessors.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +5 -0
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +3 -0
- 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 +2 -1
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +3 -7
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +27 -13
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +5 -3
- 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-persistent-custom-messages.d.ts.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.js +6 -3
- package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.js +11 -2
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +5 -3
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-tree.d.ts.map +1 -1
- package/dist/core/agent-session-tree.js +4 -0
- package/dist/core/agent-session-tree.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +4 -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 +2 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage-backends.d.ts.map +1 -1
- package/dist/core/auth-storage-backends.js +12 -1
- package/dist/core/auth-storage-backends.js.map +1 -1
- package/dist/core/bounded-model-refresh.d.ts +14 -0
- package/dist/core/bounded-model-refresh.d.ts.map +1 -0
- package/dist/core/bounded-model-refresh.js +38 -0
- package/dist/core/bounded-model-refresh.js.map +1 -0
- package/dist/core/context-tool-pairing.d.ts +4 -4
- package/dist/core/context-tool-pairing.js +4 -4
- package/dist/core/context-tool-pairing.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +26 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/messages.d.ts +18 -6
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +46 -18
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-refresh-timeout.d.ts +9 -0
- package/dist/core/model-refresh-timeout.d.ts.map +1 -0
- package/dist/core/model-refresh-timeout.js +9 -0
- package/dist/core/model-refresh-timeout.js.map +1 -0
- package/dist/core/model-runtime-snapshot.d.ts +3 -0
- package/dist/core/model-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/model-runtime-snapshot.js +59 -0
- package/dist/core/model-runtime-snapshot.js.map +1 -1
- package/dist/core/model-runtime.d.ts +7 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +72 -17
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +4 -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 +2 -2
- 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 +2 -1
- package/dist/core/session-manager-entries.js.map +1 -1
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +2 -2
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +3 -0
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main-app-mode.d.ts +1 -0
- package/dist/main-app-mode.d.ts.map +1 -1
- package/dist/main-app-mode.js +3 -0
- package/dist/main-app-mode.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +8 -3
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts +7 -2
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +13 -4
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-editor.d.ts +3 -1
- package/dist/modes/interactive/components/chat-session-host-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-editor.js +2 -2
- package/dist/modes/interactive/components/chat-session-host-editor.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts +3 -0
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +5 -4
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +16 -2
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +35 -5
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +0 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +25 -35
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +2 -1
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +1 -1
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +4 -1
- 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-model-routing.js +4 -1
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-pause.d.ts +3 -1
- package/dist/modes/interactive/interactive-pause.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-pause.js +5 -1
- package/dist/modes/interactive/interactive-pause.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +3 -3
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive-engine/engine-health.d.ts +6 -0
- package/dist/modes/interactive-engine/engine-health.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-health.js +15 -1
- package/dist/modes/interactive-engine/engine-health.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-auth.js +1 -1
- package/dist/modes/interactive-engine/isolated-auth.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +1 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +7 -1
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.js +5 -1
- package/dist/modes/interactive-engine/remote-model-catalog.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +23 -7
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-input-scheduler.js +1 -1
- package/dist/modes/rpc/rpc-input-scheduler.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +2 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/custom-provider.md +3 -3
- package/docs/extensions.md +3 -1
- package/docs/index.md +10 -0
- package/docs/keybindings.md +1 -1
- package/docs/models.md +2 -0
- package/docs/providers.md +7 -3
- package/docs/quickstart.md +7 -1
- package/docs/session-format.md +2 -0
- package/docs/termux.md +3 -1
- package/docs/usage.md +3 -2
- package/docs/workflows.md +82 -46
- package/npm-shrinkwrap.json +59 -27
- package/package.json +3 -3
- package/dist/builtin/workflows/src/tui/toast.ts +0 -107
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
} from "../runs/foreground/executor-child-helpers.js";
|
|
27
27
|
import { resolveAndValidateInputs } from "../runs/foreground/executor-inputs.js";
|
|
28
28
|
import type { RunOpts } from "../runs/foreground/executor-types.js";
|
|
29
|
+
import { isFullRunId, malformedRunIdMessage } from "../shared/run-id.js";
|
|
29
30
|
import type { RunSnapshot } from "../shared/store-types.js";
|
|
30
31
|
import type { WorkflowDefinition, WorkflowInputValues } from "../shared/types.js";
|
|
31
32
|
import type { WorkflowRegistry } from "../workflows/registry.js";
|
|
@@ -63,7 +64,7 @@ export interface ResumeDurableDeps {
|
|
|
63
64
|
|
|
64
65
|
/** Hydrate current DBOS metadata and checkpoints before synchronous replay reads. */
|
|
65
66
|
export async function prepareDurableResume(
|
|
66
|
-
|
|
67
|
+
workflowId: string | undefined,
|
|
67
68
|
deps: ResumeDurableDeps,
|
|
68
69
|
): Promise<readonly ResumableWorkflowEntry[]> {
|
|
69
70
|
const backend = deps.durableBackend ?? getDurableBackend();
|
|
@@ -71,8 +72,8 @@ export async function prepareDurableResume(
|
|
|
71
72
|
const catalog = backend.listResumableWorkflows();
|
|
72
73
|
// If a specific target was requested, hydrate that workflow too (it might
|
|
73
74
|
// be resumable but not yet in the resumable filter — e.g. recently failed).
|
|
74
|
-
if (
|
|
75
|
-
const resolved = resolveDurableEntry(
|
|
75
|
+
if (workflowId !== undefined) {
|
|
76
|
+
const resolved = resolveDurableEntry(workflowId, catalog);
|
|
76
77
|
if (resolved !== undefined && !("kind" in resolved)) {
|
|
77
78
|
await backend.hydrateWorkflow(resolved.workflowId);
|
|
78
79
|
}
|
|
@@ -80,30 +81,32 @@ export async function prepareDurableResume(
|
|
|
80
81
|
return backend.listResumableWorkflows();
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Resolve a current DBOS catalog entry by its full run id.
|
|
86
|
+
*
|
|
87
|
+
* The durable `workflowId` is the live run id, so it takes the same strict
|
|
88
|
+
* contract: a full UUID or nothing. A malformed target is reported separately
|
|
89
|
+
* from an absent one.
|
|
90
|
+
*/
|
|
84
91
|
export function resolveDurableEntry(
|
|
85
|
-
|
|
92
|
+
workflowId: string,
|
|
86
93
|
catalog: readonly ResumableWorkflowEntry[],
|
|
87
|
-
): ResumableWorkflowEntry | { kind: "
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const prefixMatches = catalog.filter((entry) => entry.workflowId.startsWith(workflowIdOrPrefix));
|
|
91
|
-
if (prefixMatches.length === 0) return undefined;
|
|
92
|
-
if (prefixMatches.length === 1) return prefixMatches[0];
|
|
93
|
-
return { kind: "ambiguous", matches: prefixMatches };
|
|
94
|
+
): ResumableWorkflowEntry | { kind: "malformed"; message: string } | undefined {
|
|
95
|
+
if (!isFullRunId(workflowId)) return { kind: "malformed", message: malformedRunIdMessage(workflowId) };
|
|
96
|
+
return catalog.find((entry) => entry.workflowId === workflowId);
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
/** Resume by DBOS workflow id and replay current persisted checkpoints. */
|
|
97
100
|
export async function resumeDurableWorkflow(
|
|
98
|
-
|
|
101
|
+
workflowId: string,
|
|
99
102
|
deps: ResumeDurableDeps,
|
|
100
103
|
catalog?: readonly ResumableWorkflowEntry[],
|
|
101
104
|
): Promise<ResumeDurableResult> {
|
|
102
105
|
const backend = deps.durableBackend ?? getDurableBackend();
|
|
103
106
|
const resolvedCatalog = catalog ?? backend.listResumableWorkflows();
|
|
104
|
-
const resolved = resolveDurableEntry(
|
|
107
|
+
const resolved = resolveDurableEntry(workflowId, resolvedCatalog);
|
|
105
108
|
if (resolved === undefined) {
|
|
106
|
-
const direct = backend.getWorkflow(
|
|
109
|
+
const direct = backend.getWorkflow(workflowId);
|
|
107
110
|
if (direct !== undefined && direct.status === "running") {
|
|
108
111
|
if (hasActiveLiveRun(deps.baseRunOpts.store, direct.workflowId)) {
|
|
109
112
|
return alreadyRunningResult(direct.name, direct.workflowId, deps.baseRunOpts.store);
|
|
@@ -112,31 +115,27 @@ export async function resumeDurableWorkflow(
|
|
|
112
115
|
return foreignRunningResult(direct.name, direct.workflowId);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
|
-
if (!backend.isWorkflowLoadable(
|
|
118
|
+
if (!backend.isWorkflowLoadable(workflowId)) {
|
|
116
119
|
return {
|
|
117
120
|
ok: false,
|
|
118
121
|
reason: "not_registered",
|
|
119
|
-
message: `Workflow ${
|
|
122
|
+
message: `Workflow ${workflowId} has no valid current DBOS state.`,
|
|
120
123
|
};
|
|
121
124
|
}
|
|
122
125
|
return {
|
|
123
126
|
ok: false,
|
|
124
127
|
reason: "not_registered",
|
|
125
|
-
message: `No resumable workflow found for id
|
|
128
|
+
message: `No resumable workflow found for id: ${workflowId}`,
|
|
126
129
|
};
|
|
127
130
|
}
|
|
128
131
|
if ("kind" in resolved) {
|
|
129
|
-
return {
|
|
130
|
-
ok: false,
|
|
131
|
-
reason: "not_registered",
|
|
132
|
-
message: `Ambiguous workflow prefix "${workflowIdOrPrefix}" matches: ${resolved.matches.map((m) => `${m.name} (${m.workflowId.slice(0, 8)})`).join(", ")}`,
|
|
133
|
-
};
|
|
132
|
+
return { ok: false, reason: "not_registered", message: resolved.message };
|
|
134
133
|
}
|
|
135
134
|
if (!backend.isWorkflowLoadable(resolved.workflowId)) {
|
|
136
135
|
return {
|
|
137
136
|
ok: false,
|
|
138
137
|
reason: "not_registered",
|
|
139
|
-
message: `Workflow ${resolved.workflowId
|
|
138
|
+
message: `Workflow ${resolved.workflowId} has no valid current DBOS state.`,
|
|
140
139
|
};
|
|
141
140
|
}
|
|
142
141
|
// Revalidate the authoritative DBOS handle before resume. A running handle
|
|
@@ -147,7 +146,7 @@ export async function resumeDurableWorkflow(
|
|
|
147
146
|
return {
|
|
148
147
|
ok: false,
|
|
149
148
|
reason: "stale",
|
|
150
|
-
message: `Workflow ${resolved.workflowId
|
|
149
|
+
message: `Workflow ${resolved.workflowId} has no current DBOS checkpoint state; re-run the workflow to start fresh.`,
|
|
151
150
|
};
|
|
152
151
|
}
|
|
153
152
|
|
|
@@ -163,7 +162,7 @@ export async function resumeDurableWorkflow(
|
|
|
163
162
|
return {
|
|
164
163
|
ok: false,
|
|
165
164
|
reason: "not_resumable",
|
|
166
|
-
message: `Workflow ${resolved.workflowId
|
|
165
|
+
message: `Workflow ${resolved.workflowId} is ${handle.status}, not resumable.`,
|
|
167
166
|
};
|
|
168
167
|
}
|
|
169
168
|
|
|
@@ -200,7 +199,7 @@ export async function resumeDurableWorkflow(
|
|
|
200
199
|
return {
|
|
201
200
|
ok: false,
|
|
202
201
|
reason: "stale",
|
|
203
|
-
message: `Workflow ${resolved.workflowId
|
|
202
|
+
message: `Workflow ${resolved.workflowId} changed while resume was pending; refresh the workflow list and try again.`,
|
|
204
203
|
};
|
|
205
204
|
}
|
|
206
205
|
|
|
@@ -223,7 +222,7 @@ export async function resumeDurableWorkflow(
|
|
|
223
222
|
return {
|
|
224
223
|
ok: false,
|
|
225
224
|
reason: "startup_failed",
|
|
226
|
-
message: `Failed to resume durable workflow ${resolved.workflowId
|
|
225
|
+
message: `Failed to resume durable workflow ${resolved.workflowId}: ${error instanceof Error ? error.message : String(error)}`,
|
|
227
226
|
};
|
|
228
227
|
}
|
|
229
228
|
const { accepted } = launch;
|
|
@@ -233,7 +232,7 @@ export async function resumeDurableWorkflow(
|
|
|
233
232
|
const error = workflowStartupFailureMessage(
|
|
234
233
|
admission,
|
|
235
234
|
snapshot?.error,
|
|
236
|
-
`Workflow ${resolved.workflowId
|
|
235
|
+
`Workflow ${resolved.workflowId} ended before startup admission`,
|
|
237
236
|
);
|
|
238
237
|
deps.baseRunOpts.store?.removeRun(accepted.runId);
|
|
239
238
|
backend.setWorkflowStatus(resolved.workflowId, handle.status, handle.pendingPrompts, handle.resumable);
|
|
@@ -241,7 +240,7 @@ export async function resumeDurableWorkflow(
|
|
|
241
240
|
return {
|
|
242
241
|
ok: false,
|
|
243
242
|
reason: "startup_failed",
|
|
244
|
-
message: `Failed to resume durable workflow ${resolved.workflowId
|
|
243
|
+
message: `Failed to resume durable workflow ${resolved.workflowId}: ${error}`,
|
|
245
244
|
};
|
|
246
245
|
}
|
|
247
246
|
|
|
@@ -250,7 +249,7 @@ export async function resumeDurableWorkflow(
|
|
|
250
249
|
runId: accepted.runId,
|
|
251
250
|
workflowId: resolved.workflowId,
|
|
252
251
|
name: handle.name,
|
|
253
|
-
message: `Resuming durable workflow "${handle.name}" (${resolved.workflowId
|
|
252
|
+
message: `Resuming durable workflow "${handle.name}" (${resolved.workflowId}) — completed checkpoints will be replayed.`,
|
|
254
253
|
};
|
|
255
254
|
}
|
|
256
255
|
|
|
@@ -271,7 +270,7 @@ function foreignRunningResult(name: string, workflowId: string): ResumeDurableRe
|
|
|
271
270
|
ok: false,
|
|
272
271
|
reason: "not_resumable",
|
|
273
272
|
message:
|
|
274
|
-
`Workflow "${name}" (${workflowId
|
|
273
|
+
`Workflow "${name}" (${workflowId}) is actively running in another Atomic session. ` +
|
|
275
274
|
"Control it from that session; it becomes resumable here only after that session pauses, quits, or crashes.",
|
|
276
275
|
};
|
|
277
276
|
}
|
|
@@ -281,9 +280,9 @@ function alreadyRunningResult(name: string, workflowId: string, store: RunOpts["
|
|
|
281
280
|
return {
|
|
282
281
|
ok: false,
|
|
283
282
|
reason: "not_resumable",
|
|
284
|
-
message: `Workflow "${name}" (${workflowId
|
|
283
|
+
message: `Workflow "${name}" (${workflowId}) is already running${
|
|
285
284
|
here ? " in this session" : " in another session"
|
|
286
|
-
}. See agents working and chat with or steer each stage using \`/workflow connect ${workflowId
|
|
285
|
+
}. See agents working and chat with or steer each stage using \`/workflow connect ${workflowId}\`; use \`/workflow quit ${workflowId}\` to pause the run for later resume.`,
|
|
287
286
|
};
|
|
288
287
|
}
|
|
289
288
|
|
|
@@ -332,12 +331,12 @@ export async function prepareTargetedDurableResumable(
|
|
|
332
331
|
|
|
333
332
|
export async function prepareRuntimeDurableResumable(
|
|
334
333
|
getBackend: () => DurableWorkflowBackend,
|
|
335
|
-
|
|
334
|
+
workflowId?: string,
|
|
336
335
|
): Promise<readonly ResumableWorkflowEntry[]> {
|
|
337
336
|
const backend = getBackend();
|
|
338
337
|
await backend.hydrateResumableWorkflows();
|
|
339
|
-
if (
|
|
340
|
-
const resolved = resolveDurableEntry(
|
|
338
|
+
if (workflowId !== undefined) {
|
|
339
|
+
const resolved = resolveDurableEntry(workflowId, backend.listResumableWorkflows());
|
|
341
340
|
if (resolved !== undefined && !("kind" in resolved)) await backend.hydrateWorkflow(resolved.workflowId);
|
|
342
341
|
}
|
|
343
342
|
return backend.listResumableWorkflows();
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { runCallback } from "@bastani/atomic";
|
|
19
|
+
import { flattenTruncatedString } from "../shared/flat-string.js";
|
|
19
20
|
import type { ToolNodeSnapshot } from "../shared/store-types.js";
|
|
20
21
|
import type {
|
|
21
22
|
WorkflowSerializableValue,
|
|
@@ -609,10 +610,17 @@ async function recordReplayedToolTopology(
|
|
|
609
610
|
});
|
|
610
611
|
input.throwIfCancelled();
|
|
611
612
|
}
|
|
613
|
+
/**
|
|
614
|
+
* Summaries are written into durable checkpoints and read back by status and
|
|
615
|
+
* graph inspection, so they outlive the value they came from. Flatten the
|
|
616
|
+
* truncation: a bare `slice` leaves a SlicedString pointing at the whole
|
|
617
|
+
* serialized payload, and the 240-character bound would cap what you can read
|
|
618
|
+
* without capping what is retained.
|
|
619
|
+
*/
|
|
612
620
|
function summarizeToolResult(value: WorkflowSerializableValue): string {
|
|
613
621
|
const serialized = JSON.stringify(value);
|
|
614
|
-
if (serialized === undefined) return String(value).slice(0, 240);
|
|
615
|
-
return serialized.length <= 240 ? serialized : `${serialized.slice(0, 237)}...`;
|
|
622
|
+
if (serialized === undefined) return flattenTruncatedString(String(value).slice(0, 240));
|
|
623
|
+
return serialized.length <= 240 ? serialized : `${flattenTruncatedString(serialized.slice(0, 237))}...`;
|
|
616
624
|
}
|
|
617
625
|
|
|
618
626
|
export async function recordCheckpointDurably(
|
|
@@ -3,6 +3,7 @@ import type { StageAdapters } from "../runs/foreground/stage-runner.js";
|
|
|
3
3
|
import type { SessionManager } from "../shared/persistence-restore.js";
|
|
4
4
|
import { stageUiBroker } from "../shared/stage-ui-broker.js";
|
|
5
5
|
import { store } from "../shared/store.js";
|
|
6
|
+
import { readGraphStoreSnapshot } from "../shared/store-observation.js";
|
|
6
7
|
import type { RunSnapshot } from "../shared/store-types.js";
|
|
7
8
|
import type {
|
|
8
9
|
WorkflowExecutionPolicy,
|
|
@@ -87,7 +88,10 @@ export function createWorkflowExtensionRuntimeState(
|
|
|
87
88
|
const lifecycleNotificationState = createWorkflowLifecycleNotificationState();
|
|
88
89
|
const hilAnswerNotificationState = createWorkflowHilAnswerNotificationState();
|
|
89
90
|
const beforeRestoreCompleted = (snapshots: readonly RunSnapshot[]): void => {
|
|
90
|
-
seedWorkflowLifecycleNotificationState(lifecycleNotificationState, {
|
|
91
|
+
seedWorkflowLifecycleNotificationState(lifecycleNotificationState, {
|
|
92
|
+
...readGraphStoreSnapshot(store),
|
|
93
|
+
runs: snapshots,
|
|
94
|
+
});
|
|
91
95
|
};
|
|
92
96
|
const lifecycleNotificationConfigRef: { current: WorkflowLifecycleNotificationConfig } = {
|
|
93
97
|
current: WORKFLOW_CONFIG_DEFAULTS.workflowNotifications,
|
|
@@ -152,14 +156,14 @@ export function createWorkflowExtensionRuntimeState(
|
|
|
152
156
|
resumeFailedRun(sourceRunId, stageId, options) {
|
|
153
157
|
return runtimeRef.current.resumeFailedRun(sourceRunId, stageId, options);
|
|
154
158
|
},
|
|
155
|
-
resumeDurableWorkflow(
|
|
156
|
-
return runtimeRef.current.resumeDurableWorkflow(
|
|
159
|
+
resumeDurableWorkflow(workflowId, options) {
|
|
160
|
+
return runtimeRef.current.resumeDurableWorkflow(workflowId, options);
|
|
157
161
|
},
|
|
158
162
|
listDurableResumable() {
|
|
159
163
|
return runtimeRef.current.listDurableResumable();
|
|
160
164
|
},
|
|
161
|
-
prepareDurableResumable(
|
|
162
|
-
return runtimeRef.current.prepareDurableResumable(
|
|
165
|
+
prepareDurableResumable(workflowId) {
|
|
166
|
+
return runtimeRef.current.prepareDurableResumable(workflowId);
|
|
163
167
|
},
|
|
164
168
|
prepareDurableResumableForIds(workflowIds) {
|
|
165
169
|
const targeted = runtimeRef.current.prepareDurableResumableForIds;
|
|
@@ -169,16 +173,16 @@ export function createWorkflowExtensionRuntimeState(
|
|
|
169
173
|
prepareCompletedDurable() {
|
|
170
174
|
return runtimeRef.current.prepareCompletedDurable?.() ?? Promise.resolve([]);
|
|
171
175
|
},
|
|
172
|
-
openCompletedDurableWorkflow(
|
|
176
|
+
openCompletedDurableWorkflow(workflowId, catalog) {
|
|
173
177
|
const open = runtimeRef.current.openCompletedDurableWorkflow;
|
|
174
178
|
if (open === undefined) {
|
|
175
179
|
return {
|
|
176
180
|
ok: false,
|
|
177
181
|
reason: "not_found",
|
|
178
|
-
message: `No completed durable workflow found for id
|
|
182
|
+
message: `No completed durable workflow found for id: ${workflowId}`,
|
|
179
183
|
};
|
|
180
184
|
}
|
|
181
|
-
return open(
|
|
185
|
+
return open(workflowId, catalog);
|
|
182
186
|
},
|
|
183
187
|
};
|
|
184
188
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StageUiBroker } from "../shared/stage-ui-broker.js";
|
|
2
2
|
import type { Store } from "../shared/store.js";
|
|
3
|
+
import { readGraphStoreSnapshot, subscribeStoreInvalidation } from "../shared/store-observation.js";
|
|
3
4
|
import type {
|
|
4
5
|
PendingPrompt,
|
|
5
6
|
PromptKind,
|
|
@@ -99,10 +100,12 @@ export function installWorkflowHilAnswerNotifications(options: WorkflowHilAnswer
|
|
|
99
100
|
}
|
|
100
101
|
};
|
|
101
102
|
|
|
102
|
-
const unsubscribeStore = options.store
|
|
103
|
+
const unsubscribeStore = subscribeStoreInvalidation(options.store, () =>
|
|
104
|
+
inspectWorkflowPromptAnswers(readGraphStoreSnapshot(options.store)),
|
|
105
|
+
);
|
|
103
106
|
const unsubscribeBroker = options.stageUiBroker?.onStagePromptResolved((event) => {
|
|
104
107
|
if (event.answerSource === "workflow_tool") return;
|
|
105
|
-
const answeredStage = findStageSnapshot(options.store
|
|
108
|
+
const answeredStage = findStageSnapshot(readGraphStoreSnapshot(options.store), event.runId, event.stageId);
|
|
106
109
|
if (answeredStage === undefined) return;
|
|
107
110
|
|
|
108
111
|
emitOnce(
|