@orkestrel/workflow 0.0.11 → 0.0.12

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.
@@ -19,28 +19,6 @@ import { Success } from '@orkestrel/contract';
19
19
  import { TableInterface } from '@orkestrel/database';
20
20
  import { TokenUsage } from '@orkestrel/budget';
21
21
 
22
- /**
23
- * Assert that a {@link WorkflowSnapshot} carries a `boolean` `bail` — at the workflow tier AND
24
- * on every phase — and that its every node's status (and its `override`, when present) is drawn
25
- * from the lifecycle vocabulary, throwing a `RESTORE` {@link WorkflowError} otherwise.
26
- *
27
- * @remarks
28
- * The boundary-narrowing guard (AGENTS §14) for {@link restoreWorkflow}: a snapshot is
29
- * untrusted JSON, so a status (or an override) outside
30
- * {@link import('./constants.js').WORKFLOW_STATUSES} /
31
- * {@link import('./constants.js').PHASE_STATUSES} / {@link import('./constants.js').TASK_STATUSES},
32
- * a non-boolean `bail` (the workflow's OR any phase's — both are REQUIRED persisted policy), a
33
- * present-but-invalid phase `concurrency` (not a positive integer), or a present-but-invalid task
34
- * `run` (an empty string) / `retries` / `timeout` (not a non-negative integer),
35
- * is rejected loudly (naming the offending node) rather than silently producing a broken tree.
36
- * The `override` / `concurrency` / `run` / `retries` / `timeout` are optional, so each is only
37
- * checked WHEN present. Structural shape beyond these fields is the contract's concern; this
38
- * guards exactly the fields the live state machine reads back.
39
- *
40
- * @param snapshot - The snapshot to validate
41
- */
42
- export declare function assertSnapshot(snapshot: unknown): void;
43
-
44
22
  /**
45
23
  * Build a {@link PhaseContext} — a phase's own identity plus a back-reference to its
46
24
  * workflow — from the parent {@link WorkflowContext} and the phase node's identity.
@@ -282,13 +260,13 @@ export declare interface ControllerInterface<TInput, TResult> {
282
260
  * @example
283
261
  * ```ts
284
262
  * import { createMemoryDriver } from '@orkestrel/database'
285
- * import { createDatabaseWorkflowStore, createWorkflow, restoreWorkflow } from '@orkestrel/workflow'
263
+ * import { createDatabaseWorkflowStore, createWorkflow, createRestoredWorkflow } from '@orkestrel/workflow'
286
264
  *
287
265
  * const store = createDatabaseWorkflowStore(createMemoryDriver()) // a durable driver swaps in here
288
266
  * const workflow = createWorkflow(definition)
289
267
  * await store.set(workflow.snapshot()) // persist the run state (one JSON column)
290
268
  * const snapshot = await store.get(definition.id)
291
- * const restored = snapshot && restoreWorkflow(snapshot) // an identical live tree
269
+ * const restored = snapshot && createRestoredWorkflow(snapshot) // an identical live tree
292
270
  * ```
293
271
  */
294
272
  export declare function createDatabaseWorkflowStore(driver?: DriverInterface): WorkflowStoreInterface;
@@ -315,23 +293,79 @@ export declare function createDeferred<T>(): DeferredInterface<T>;
315
293
  * {@link createDatabaseWorkflowStore} (the snapshot as one opaque JSON column over a `databases`
316
294
  * table) — for a DURABLE store (run-state surviving a restart) pass it a JSON / SQLite / IndexedDB
317
295
  * driver, and it swaps in WITHOUT touching the runner or the entity tree. Restore stays a caller
318
- * concern: read a snapshot back and rebuild the live tree with {@link restoreWorkflow}.
296
+ * concern: read a snapshot back and rebuild the live tree with {@link createRestoredWorkflow}.
319
297
  *
320
298
  * @returns A memory-backed {@link WorkflowStoreInterface}
321
299
  *
322
300
  * @example
323
301
  * ```ts
324
- * import { createMemoryWorkflowStore, createWorkflow, restoreWorkflow } from '@orkestrel/workflow'
302
+ * import { createMemoryWorkflowStore, createWorkflow, createRestoredWorkflow } from '@orkestrel/workflow'
325
303
  *
326
304
  * const store = createMemoryWorkflowStore()
327
305
  * const workflow = createWorkflow(definition)
328
306
  * await store.set(workflow.snapshot()) // persist the run state
329
307
  * const snapshot = await store.get(definition.id)
330
- * const restored = snapshot && restoreWorkflow(snapshot) // an identical live tree
308
+ * const restored = snapshot && createRestoredWorkflow(snapshot) // an identical live tree
331
309
  * ```
332
310
  */
333
311
  export declare function createMemoryWorkflowStore(): WorkflowStoreInterface;
334
312
 
313
+ /**
314
+ * Build an interrupted workflow back to life at its remaining retry budget.
315
+ *
316
+ * @remarks
317
+ * Each phase captures every unique initial `run` binding once before constructing tasks. Recovery
318
+ * validates those live tasks' captured callable handlers without rereading the registry, while the
319
+ * retained registry identity remains available to resolve future live additions at their mint time.
320
+ *
321
+ * @param snapshot - The hostile persisted snapshot
322
+ * @param options - Runtime handlers and entity options
323
+ * @returns A recoverable live {@link WorkflowInterface} root
324
+ *
325
+ * @example
326
+ * ```ts
327
+ * import { createRecoveredWorkflow } from '@orkestrel/workflow'
328
+ *
329
+ * const recovered = createRecoveredWorkflow(snapshot, { functions })
330
+ * recovered.status // 'pending' — interrupted running work returned to its remaining budget
331
+ * ```
332
+ */
333
+ export declare function createRecoveredWorkflow(snapshot: unknown, options?: WorkflowOptions): WorkflowInterface;
334
+
335
+ /**
336
+ * Build an equivalent live W-b entity tree from a {@link WorkflowSnapshot} — the
337
+ * inverse of {@link WorkflowInterface.snapshot}, restoring structure + each node's status
338
+ * + recorded results + positional order + the persisted `#override`.
339
+ *
340
+ * @remarks
341
+ * Round-trip fidelity is paramount: a `snapshot()` → `createRestoredWorkflow()` reproduces the
342
+ * same status at every node (each `#override` restored DIRECTLY from the snapshot's own
343
+ * `override` field, not guessed from a status divergence), the same recorded
344
+ * {@link import('./types.js').TaskResult}s, and the same positional order (an interior
345
+ * `skip` / `remove` survives). The snapshot is SELF-CONTAINED — it persists the `bail`
346
+ * policy it ran under, so the restore re-derives status IDENTICALLY without a silent
347
+ * default; the snapshot's `bail` is the source of truth, while an explicit `options.bail`
348
+ * still wins when supplied (to deliberately re-run under a different policy). A structurally
349
+ * invalid snapshot (a status — or override — outside the lifecycle vocabulary, or a
350
+ * non-boolean `bail`) throws a `RESTORE` {@link WorkflowError}.
351
+ * Runtime handlers are optional: without a matching `functions` entry, a persisted `run`
352
+ * remains visible with an undefined `handler` so the exact state is inspectable. The runner
353
+ * rejects that unresolved tree if execution is attempted.
354
+ *
355
+ * @param snapshot - The snapshot to restore (carries its own `bail` + `override`)
356
+ * @param options - Runtime options (initial listeners, an optional `bail` override, per-node options)
357
+ * @returns The restored live {@link WorkflowInterface} root
358
+ *
359
+ * @example
360
+ * ```ts
361
+ * import { createRestoredWorkflow } from '@orkestrel/workflow'
362
+ *
363
+ * const restored = createRestoredWorkflow(workflow.snapshot()) // bail comes from the snapshot
364
+ * restored.status === workflow.status // true
365
+ * ```
366
+ */
367
+ export declare function createRestoredWorkflow(snapshot: unknown, options?: WorkflowOptions): WorkflowInterface;
368
+
335
369
  /**
336
370
  * Create a thin generic orchestrator that drives declared units — and any they
337
371
  * `spawn` — through a bounded-concurrency queue, collecting their results in order.
@@ -496,11 +530,11 @@ export declare function createWorkflowContract(): ContractInterface<WorkflowDefi
496
530
  * @remarks
497
531
  * `options.functions` flows into every workflow the manager mints (`add`, via
498
532
  * {@link createWorkflow}) or hydrates (`open`'s registry-miss path, via
499
- * {@link restoreWorkflow}), so a hydrated workflow is RUNNABLE rather than a dead snapshot
533
+ * {@link createRestoredWorkflow}), so a hydrated workflow is RUNNABLE rather than a dead snapshot
500
534
  * mirror. `options.store` is the EXACT analogue of the twins' `store` seam — omitted ⇒ the
501
535
  * manager is registry-only (`open` resolves only what is registered, `save` is a no-op). This
502
536
  * is PURELY ADDITIVE: direct {@link WorkflowStoreInterface} use and
503
- * {@link restoreWorkflow} remain valid — the manager is one more caller-driven persistence
537
+ * {@link createRestoredWorkflow} remain valid — the manager is one more caller-driven persistence
504
538
  * seam, not a replacement.
505
539
  *
506
540
  * @param options - The optional `store` seam and the `functions` registry threaded into every mint/hydrate
@@ -603,18 +637,18 @@ export declare function createWorkflowRunner(options?: WorkflowRunnerOptions): W
603
637
  * idle-TTL / eviction — a persisted run-state is durable orchestration state that lives until an
604
638
  * explicit `delete`. The public surface is EXACTLY `get` / `set` / `delete` — no extra members (the
605
639
  * §22 method bijection with {@link WorkflowStoreInterface}). Restore stays a caller concern: read a
606
- * snapshot back and rebuild the live tree with {@link import('../factories.js').restoreWorkflow}.
640
+ * snapshot back and rebuild the live tree with {@link import('../factories.js').createRestoredWorkflow}.
607
641
  *
608
642
  * @example
609
643
  * ```ts
610
644
  * import { createMemoryDriver } from '@orkestrel/database'
611
- * import { createDatabaseWorkflowStore, createWorkflow, restoreWorkflow } from '@orkestrel/workflow'
645
+ * import { createDatabaseWorkflowStore, createWorkflow, createRestoredWorkflow } from '@orkestrel/workflow'
612
646
  *
613
647
  * const store = createDatabaseWorkflowStore(createMemoryDriver()) // a durable driver swaps in here
614
648
  * const workflow = createWorkflow(definition)
615
649
  * await store.set(workflow.snapshot()) // persist the run state (one JSON column)
616
650
  * const snapshot = await store.get(definition.id)
617
- * const restored = snapshot && restoreWorkflow(snapshot) // an identical live tree
651
+ * const restored = snapshot && createRestoredWorkflow(snapshot) // an identical live tree
618
652
  * await store.delete(definition.id) // drop it
619
653
  * ```
620
654
  */
@@ -981,17 +1015,17 @@ export declare const MAX_TIMER_MS = 2147483647;
981
1015
  *
982
1016
  * The public surface is EXACTLY `get` / `set` / `delete` — no extra members (the §22 method
983
1017
  * bijection with {@link WorkflowStoreInterface}). Restore is a caller concern: read a snapshot
984
- * back and rebuild the live tree with {@link import('../factories.js').restoreWorkflow}.
1018
+ * back and rebuild the live tree with {@link import('../factories.js').createRestoredWorkflow}.
985
1019
  *
986
1020
  * @example
987
1021
  * ```ts
988
- * import { createMemoryWorkflowStore, createWorkflow, restoreWorkflow } from '@orkestrel/workflow'
1022
+ * import { createMemoryWorkflowStore, createWorkflow, createRestoredWorkflow } from '@orkestrel/workflow'
989
1023
  *
990
1024
  * const store = createMemoryWorkflowStore()
991
1025
  * const workflow = createWorkflow(definition)
992
1026
  * await store.set(workflow.snapshot()) // persist the run state
993
1027
  * const snapshot = await store.get(definition.id)
994
- * const restored = snapshot && restoreWorkflow(snapshot) // an identical live tree
1028
+ * const restored = snapshot && createRestoredWorkflow(snapshot) // an identical live tree
995
1029
  * await store.delete(definition.id) // drop it
996
1030
  * ```
997
1031
  */
@@ -1688,20 +1722,6 @@ export declare const phaseUpdateShape: ObjectShape<{
1688
1722
  bail: OptionalShape<LiteralShape<readonly [true, false]>>;
1689
1723
  }, false>;
1690
1724
 
1691
- /**
1692
- * Rebuild an interrupted workflow at its remaining retry budget.
1693
- *
1694
- * @remarks
1695
- * Each phase captures every unique initial `run` binding once before constructing tasks. Recovery
1696
- * validates those live tasks' captured callable handlers without rereading the registry, while the
1697
- * retained registry identity remains available to resolve future live additions at their mint time.
1698
- *
1699
- * @param snapshot - The hostile persisted snapshot
1700
- * @param options - Runtime handlers and entity options
1701
- * @returns A recoverable live workflow
1702
- */
1703
- export declare function recoverWorkflow(snapshot: unknown, options?: WorkflowOptions): WorkflowInterface;
1704
-
1705
1725
  /**
1706
1726
  * Convert interrupted running work into a recoverable pending suffix or an
1707
1727
  * exhausted recovery failure without replenishing attempts.
@@ -1720,40 +1740,6 @@ export declare function recoverWorkflowSnapshot(snapshot: WorkflowSnapshot): Wor
1720
1740
  */
1721
1741
  export declare function resolveTaskSilence(value: number | undefined, fallback: number | undefined): number | undefined;
1722
1742
 
1723
- /**
1724
- * Rebuild an equivalent live W-b entity tree from a {@link WorkflowSnapshot} — the
1725
- * inverse of {@link WorkflowInterface.snapshot}, restoring structure + each node's status
1726
- * + recorded results + positional order + the persisted `#override`.
1727
- *
1728
- * @remarks
1729
- * Round-trip fidelity is paramount: a `snapshot()` → `restoreWorkflow()` reproduces the
1730
- * same status at every node (each `#override` restored DIRECTLY from the snapshot's own
1731
- * `override` field, not guessed from a status divergence), the same recorded
1732
- * {@link import('./types.js').TaskResult}s, and the same positional order (an interior
1733
- * `skip` / `remove` survives). The snapshot is SELF-CONTAINED — it persists the `bail`
1734
- * policy it ran under, so the restore re-derives status IDENTICALLY without a silent
1735
- * default; the snapshot's `bail` is the source of truth, while an explicit `options.bail`
1736
- * still wins when supplied (to deliberately re-run under a different policy). A structurally
1737
- * invalid snapshot (a status — or override — outside the lifecycle vocabulary, or a
1738
- * non-boolean `bail`) throws a `RESTORE` {@link WorkflowError}.
1739
- * Runtime handlers are optional: without a matching `functions` entry, a persisted `run`
1740
- * remains visible with an undefined `handler` so the exact state is inspectable. The runner
1741
- * rejects that unresolved tree if execution is attempted.
1742
- *
1743
- * @param snapshot - The snapshot to restore (carries its own `bail` + `override`)
1744
- * @param options - Runtime options (initial listeners, an optional `bail` override, per-node options)
1745
- * @returns The restored live {@link WorkflowInterface} root
1746
- *
1747
- * @example
1748
- * ```ts
1749
- * import { restoreWorkflow } from '@orkestrel/workflow'
1750
- *
1751
- * const restored = restoreWorkflow(workflow.snapshot()) // bail comes from the snapshot
1752
- * restored.status === workflow.status // true
1753
- * ```
1754
- */
1755
- export declare function restoreWorkflow(snapshot: unknown, options?: WorkflowOptions): WorkflowInterface;
1756
-
1757
1743
  /**
1758
1744
  * A thin generic orchestrator that drives declared units — and any they `spawn` —
1759
1745
  * through a bounded-concurrency {@link createQueue}, collecting ordered results.
@@ -2504,7 +2490,7 @@ export declare interface TaskDefinition {
2504
2490
  * Extra attempts after the first on failure (a non-negative integer); the runner threads it
2505
2491
  * to this task's substrate unit, OVERRIDING the phase Runner's `retries` default. Omitted ⇒
2506
2492
  * the default (no extra attempts). PERSISTED in a {@link TaskSnapshot} (like `bail` and
2507
- * `concurrency`), so `restoreWorkflow(snapshot, { functions })` resumes with the same
2493
+ * `concurrency`), so `createRestoredWorkflow(snapshot, { functions })` resumes with the same
2508
2494
  * reliability config; only the resolved handler itself is runtime-only.
2509
2495
  */
2510
2496
  readonly retries?: number;
@@ -2512,7 +2498,7 @@ export declare interface TaskDefinition {
2512
2498
  * @remarks
2513
2499
  * The workflow-owned per-attempt deadline in milliseconds, an integer from `0` through
2514
2500
  * `MAX_TIMER_MS`. Zero or omission means no deadline. PERSISTED in a {@link TaskSnapshot},
2515
- * so `restoreWorkflow(snapshot, { functions })` resumes with the same reliability config;
2501
+ * so `createRestoredWorkflow(snapshot, { functions })` resumes with the same reliability config;
2516
2502
  * only the resolved handler itself is runtime-only.
2517
2503
  */
2518
2504
  readonly timeout?: number;
@@ -2926,7 +2912,7 @@ export declare const taskShape: ObjectShape<{
2926
2912
  * like a {@link PhaseSnapshot}'s `bail` / `concurrency`, so a restore reinstates the same
2927
2913
  * behavior reference and reliability overrides (`run` re-resolves against the
2928
2914
  * {@link WorkflowOptions.functions} registry supplied to
2929
- * {@link import('./factories.js').restoreWorkflow}); each omitted ⇒ the corresponding
2915
+ * {@link import('./factories.js').createRestoredWorkflow}); each omitted ⇒ the corresponding
2930
2916
  * unset default.
2931
2917
  */
2932
2918
  export declare interface TaskSnapshot {
@@ -3037,7 +3023,7 @@ export declare type UnitOutcome<TResult> = {
3037
3023
  * @remarks
3038
3024
  * - **Construction.** Built from a {@link WorkflowSnapshot} (the unified input —
3039
3025
  * {@link import('./factories.js').createWorkflow} seeds an initial snapshot from a
3040
- * {@link import('./types.js').WorkflowDefinition}, {@link import('./factories.js').restoreWorkflow}
3026
+ * {@link import('./types.js').WorkflowDefinition}, {@link import('./factories.js').createRestoredWorkflow}
3041
3027
  * passes a persisted one). Each child {@link Phase} is wired to escalate to `#recompute`.
3042
3028
  * - **Derived status.** `status` is `#override` when forced, else
3043
3029
  * {@link deriveWorkflowStatus} over the live phases' statuses feeding `bail`. `failed` is
@@ -3052,7 +3038,7 @@ export declare type UnitOutcome<TResult> = {
3052
3038
  * workflow tier; `phase(id)` + each `phase.task(id)` navigate DOWN, a task's `phase` / `workflow`
3053
3039
  * navigate UP.
3054
3040
  * - **Snapshot.** `snapshot()` serializes the whole live tree to a {@link WorkflowSnapshot} (pure
3055
- * JSON); {@link import('./factories.js').restoreWorkflow} rebuilds an equivalent live tree.
3041
+ * JSON); {@link import('./factories.js').createRestoredWorkflow} rebuilds an equivalent live tree.
3056
3042
  * - **Observable (AGENTS §13).** The owned {@link emitter} ({@link WorkflowEventMap}) fires
3057
3043
  * `start` / `complete` / `fail` / `pause` / `resume` / `skip` / `stop` after the
3058
3044
  * corresponding status or runtime-gate change; the emitter isolates a listener throw and
@@ -3170,7 +3156,7 @@ export declare class WorkflowError extends Error {
3170
3156
  * - `TRANSITION` — an illegal state-machine transition (e.g. `start`ing a task that is
3171
3157
  * not `pending`, or `complete`/`fail`ing one that is not `running`); the guard names
3172
3158
  * the offending current status + requested transition in the error `context`.
3173
- * - `RESTORE` — a {@link import('./factories.js').restoreWorkflow} given a structurally
3159
+ * - `RESTORE` — a {@link import('./factories.js').createRestoredWorkflow} given a structurally
3174
3160
  * invalid {@link WorkflowSnapshot} (a status outside the lifecycle vocabulary).
3175
3161
  * - `MUTATION` — a GATED structural or patch edit was refused: a duplicate id on
3176
3162
  * `append`/`add`, a target that does not exist or is not `pending`, an out-of-bounds
@@ -3298,7 +3284,7 @@ export declare type WorkflowInput = Partial<WorkflowContext>;
3298
3284
  * may force only a task-free, otherwise-pending tree. The override survives a snapshot.
3299
3285
  * - **Snapshot.** `snapshot()` serializes the whole live tree to a {@link WorkflowSnapshot}
3300
3286
  * (pure JSON — structure + each node's status + recorded results + positional order);
3301
- * {@link restoreWorkflow} rebuilds an equivalent live tree.
3287
+ * {@link createRestoredWorkflow} rebuilds an equivalent live tree.
3302
3288
  * - **Observable (AGENTS §13).** The owned {@link emitter} ({@link WorkflowEventMap}) fires
3303
3289
  * `start` / `complete` / `fail` / `pause` / `resume` / `stop` after the corresponding
3304
3290
  * status or runtime-gate change; the emitter isolates a listener throw and routes it to
@@ -3559,7 +3545,7 @@ export declare class WorkflowManager implements WorkflowManagerInterface {
3559
3545
  * is supplied (the `store` option), `open(id)` resolves an already-registered workflow
3560
3546
  * directly (no store hit); same-id registry misses share one in-flight hydration. On a MISS
3561
3547
  * it HYDRATES one from `store.get(id)` through
3562
- * {@link import('./factories.js').restoreWorkflow} — flowing this manager's `functions`
3548
+ * {@link import('./factories.js').createRestoredWorkflow} — flowing this manager's `functions`
3563
3549
  * registry in so the rehydrated tree is RUNNABLE — registers it, and returns it. Registry
3564
3550
  * mutation wins over an earlier pending hydration: `add` supplies the live result, while
3565
3551
  * `remove` (even for an absent id) and `clear` invalidate the earlier read. Missed and failed
@@ -3573,7 +3559,7 @@ export declare class WorkflowManager implements WorkflowManagerInterface {
3573
3559
  * `ConversationManagerInterface.open` / `.save` and `WorkspaceManagerInterface.open` /
3574
3560
  * `.save` — this is the workflow line's caller-driven persistence gaining the standard
3575
3561
  * open/save seam, ADDITIVE alongside direct {@link WorkflowStoreInterface} use and
3576
- * {@link import('./factories.js').restoreWorkflow} (both remain valid).
3562
+ * {@link import('./factories.js').createRestoredWorkflow} (both remain valid).
3577
3563
  * - **Removal.** `remove` drops one by id, or a batch (§9.2, array overload FIRST) — `true`
3578
3564
  * when any was removed. `clear` empties the registry.
3579
3565
  * - **Event-free.** A purely registry store — no `Emitter`, no events (each
@@ -3618,7 +3604,7 @@ export declare interface WorkflowManagerInterface {
3618
3604
  * - Same-id registry misses share one in-flight `store.get(id)` and resolve to the same live
3619
3605
  * object. On a HIT the snapshot is
3620
3606
  * rehydrated into a fresh {@link WorkflowInterface} via
3621
- * {@link import('./factories.js').restoreWorkflow}, flowing this manager's `functions`
3607
+ * {@link import('./factories.js').createRestoredWorkflow}, flowing this manager's `functions`
3622
3608
  * registry in (so the rehydrated tree carries real resolved `handler`s and can RESUME
3623
3609
  * real work), registers it, and returns it. A payload whose own id differs from `id` rejects
3624
3610
  * with a normalized `RESTORE` error carrying the requested and payload ids.
@@ -3663,7 +3649,7 @@ export declare interface WorkflowManagerInterface {
3663
3649
  * already registered, and {@link WorkflowManagerInterface.save} is a no-op (`false`). `functions`
3664
3650
  * is the workflow-specific addition: the SAME {@link WorkflowFunctions} registry threaded into
3665
3651
  * every {@link import('./factories.js').createWorkflow} ({@link WorkflowManagerInterface.add})
3666
- * and every {@link import('./factories.js').restoreWorkflow}
3652
+ * and every {@link import('./factories.js').createRestoredWorkflow}
3667
3653
  * ({@link WorkflowManagerInterface.open}'s hydration path) the manager performs — so a
3668
3654
  * hydrated workflow carries real resolved `handler`s and is RUNNABLE. Omitted ⇒ named work
3669
3655
  * remains inspectable but cannot be driven; omitted-`run` tasks remain deliberate no-ops.
@@ -3680,7 +3666,7 @@ export declare interface WorkflowManagerOptions {
3680
3666
  /**
3681
3667
  * The {@link WorkflowFunctions} registry threaded into every workflow this manager mints
3682
3668
  * (`add`, via {@link import('./factories.js').createWorkflow}) or hydrates (`open`'s
3683
- * registry-miss path, via {@link import('./factories.js').restoreWorkflow}) — so a
3669
+ * registry-miss path, via {@link import('./factories.js').createRestoredWorkflow}) — so a
3684
3670
  * hydrated workflow is RUNNABLE, its tasks carrying real resolved `handler`s. Omitted ⇒
3685
3671
  * named tasks remain inspectable but execution rejects them.
3686
3672
  */
@@ -3704,7 +3690,7 @@ export declare interface WorkflowOptions {
3704
3690
  * The failure policy (AGENTS §4.4) the live tree applies — the same boolean toggle as
3705
3691
  * {@link WorkflowDefinition.bail}, fed to {@link import('./helpers.js').deriveWorkflowStatus}.
3706
3692
  * {@link import('./factories.js').createWorkflow} defaults it to the definition's `bail`. A
3707
- * {@link WorkflowSnapshot} PERSISTS the policy, so {@link import('./factories.js').restoreWorkflow}
3693
+ * {@link WorkflowSnapshot} PERSISTS the policy, so {@link import('./factories.js').createRestoredWorkflow}
3708
3694
  * takes it from the snapshot (the source of truth); an explicit `options.bail` on restore still
3709
3695
  * wins when supplied. Omitted on a fresh build ⇒ the graceful {@link import('./constants.js').DEFAULT_BAIL}.
3710
3696
  */
@@ -3718,7 +3704,7 @@ export declare interface WorkflowOptions {
3718
3704
  * {@link TaskDefinition.run} / {@link TaskSnapshot.run} name resolves against ONCE at
3719
3705
  * construction into its runtime {@link TaskInterface.handler} — the SAME registry a
3720
3706
  * fresh build ({@link import('./factories.js').createWorkflow}) and a restore
3721
- * ({@link import('./factories.js').restoreWorkflow}) both consume, and the same shape a
3707
+ * ({@link import('./factories.js').createRestoredWorkflow}) both consume, and the same shape a
3722
3708
  * live {@link WorkflowInterface.add} / {@link PhaseInterface.add} mint resolves a newly
3723
3709
  * minted task against. An omitted `run` resolves to no handler and is the deliberate
3724
3710
  * no-op form. A present name absent from `functions` also has no handler so exact restore
@@ -4046,7 +4032,7 @@ export declare interface WorkflowRunnerInterface {
4046
4032
  * does not apply, since the tree already exists.
4047
4033
  *
4048
4034
  * **Run round-trips through the snapshot.** Driving a tree rebuilt by
4049
- * {@link import('./factories.js').restoreWorkflow} behaves according to whether a
4035
+ * {@link import('./factories.js').createRestoredWorkflow} behaves according to whether a
4050
4036
  * {@link WorkflowFunctions} registry was supplied at that build: WITH a registry,
4051
4037
  * each task's `run` name is re-resolved against it, so a matched task carries a real
4052
4038
  * handler and this overload actually DISPATCHES it, resuming real work. Without a registry,
@@ -4158,7 +4144,7 @@ export declare const workflowShape: ObjectShape<{
4158
4144
  * designed in full at W-a so its shape is fixed from the start. It can be written to disk,
4159
4145
  * sent to a prompt companion, loaded across conversations, or reviewed by an agent. Because
4160
4146
  * it is self-contained, it carries the policy it ran under: `bail` (AGENTS §4.4) is the
4161
- * failure policy, so {@link import('./factories.js').restoreWorkflow} re-derives status
4147
+ * failure policy, so {@link import('./factories.js').createRestoredWorkflow} re-derives status
4162
4148
  * IDENTICALLY without a silent default. `status` is the EFFECTIVE status (override-or-derived)
4163
4149
  * at snapshot time; `override` is the forced status of a whole-workflow `skip` / `stop` or
4164
4150
  * vacuous `completed`. The completed override is valid only for an otherwise-derived pending
@@ -4228,7 +4214,7 @@ export declare type WorkflowStatus = LifecycleStatus;
4228
4214
  * {@link import('./stores/MemoryWorkflowStore.js').MemoryWorkflowStore} and its driver-pluggable
4229
4215
  * twin {@link import('./stores/DatabaseWorkflowStore.js').DatabaseWorkflowStore} (the snapshot as
4230
4216
  * one opaque JSON column) share THIS one interface. Restore is NOT a store concern — a caller reads
4231
- * a snapshot back and rebuilds the live tree with the shipped {@link import('./factories.js').restoreWorkflow}.
4217
+ * a snapshot back and rebuilds the live tree with the shipped {@link import('./factories.js').createRestoredWorkflow}.
4232
4218
  *
4233
4219
  * Every primitive is async (a `Promise`), so a durable backend (a database round-trip) fits the
4234
4220
  * same shape as the memory one. The snapshot carries its OWN id, so `set` takes no separate id