@dudousxd/nestjs-durable-core 0.87.0 → 0.89.0

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/dist/index.d.ts CHANGED
@@ -943,6 +943,37 @@ interface DurableTopology {
943
943
  role: 'control-plane' | 'tenant';
944
944
  /** The tenant's isolation partition name; set only when `role` is 'tenant'. */
945
945
  tenant?: string;
946
+ /**
947
+ * The engine behind the gateway, when it is not nestjs-durable's own (e.g. `'@nestjs/workflows'`
948
+ * for `@dudousxd/nestjs-durable-workflows-gateway`). Shown in the console header. Absent: durable.
949
+ */
950
+ engine?: string;
951
+ /**
952
+ * Console features this gateway cannot serve, as `false`; the SPA hides their controls. A key
953
+ * left out (or no object at all, as from every durable gateway) means supported.
954
+ */
955
+ capabilities?: ConsoleCapabilities;
956
+ }
957
+ /** See {@link DurableTopology.capabilities}. `false` hides the control; absent means supported. */
958
+ interface ConsoleCapabilities {
959
+ /** Search-attribute filters (`attributes` in a run query). */
960
+ searchAttributes?: boolean;
961
+ /** The tenant/namespace picker. */
962
+ namespaces?: boolean;
963
+ /** Tag filters. */
964
+ tags?: boolean;
965
+ /** Origin chips (which package/app started a run). */
966
+ origins?: boolean;
967
+ /** Breakpoints (`Continue`). */
968
+ breakpoints?: boolean;
969
+ /** Re-dispatching lost remote steps. */
970
+ redispatch?: boolean;
971
+ /** Republishing lifecycle events. */
972
+ republishLifecycle?: boolean;
973
+ /** The schedules panel. */
974
+ schedules?: boolean;
975
+ /** The workers / partitions health panel. */
976
+ workers?: boolean;
946
977
  }
947
978
  /** The run whose settling started a run, as its detail names it. */
948
979
  interface LifecycleSource {
@@ -1462,6 +1493,21 @@ interface StepSettlement {
1462
1493
  startedAt: Date;
1463
1494
  finishedAt: Date;
1464
1495
  }
1496
+ /**
1497
+ * A step's result as {@link StateStore.settleResultsIfPending} writes it onto the step's `pending`
1498
+ * checkpoint. Unlike a {@link StepSettlement}, what the result does not carry keeps the stored value:
1499
+ * `output` is written only for a `completed` result, `events` and `startedAt` only when present.
1500
+ */
1501
+ interface StepResultSettlement {
1502
+ runId: string;
1503
+ seq: number;
1504
+ status: 'completed' | 'failed';
1505
+ output?: unknown;
1506
+ error?: StepError | undefined;
1507
+ events?: StepEvent[] | undefined;
1508
+ startedAt?: Date | undefined;
1509
+ finishedAt: Date;
1510
+ }
1465
1511
  /**
1466
1512
  * A structured event a step (or its worker) emits while running — a log line and/or a sub-step
1467
1513
  * outcome. The dashboard renders these under the step, so you can see what happened inside a step
@@ -1714,6 +1760,29 @@ interface StateStore {
1714
1760
  * Optional: a store that omits it gets {@link saveCheckpointsIfPending} with the whole rows.
1715
1761
  */
1716
1762
  settleCheckpointsIfPending?(settlements: StepSettlement[]): Promise<boolean[]>;
1763
+ /**
1764
+ * Settle steps from their results and read them back, in one round trip where the store can: per
1765
+ * entry and in input order, while the row at `(runId, seq)` is still `pending` and its run is not
1766
+ * `cancelled` or `completed` (a late result for a finished run settles nothing), write the result
1767
+ * (see {@link StepResultSettlement} for what keeps its stored value) and resolve the row as it now
1768
+ * reads, without its `input` (as {@link getCheckpointsForSettle} reads it); `null` for an entry
1769
+ * that wrote nothing (the row is absent or already settled, or the run finished). Claims like
1770
+ * {@link settleCheckpointsIfPending}: a later entry for a row an earlier one settled loses, and a
1771
+ * rejection writes nothing. The engine settles a batch of one run's step results through it
1772
+ * without reading the rows first.
1773
+ *
1774
+ * Optional: a store that omits it gets {@link getCheckpointsForSettle} followed by
1775
+ * {@link settleCheckpointsIfPending}.
1776
+ */
1777
+ settleResultsIfPending?(results: StepResultSettlement[]): Promise<(StepCheckpoint | null)[]>;
1778
+ /**
1779
+ * Write `checkpoint` only if the run has no checkpoint at its `seq` yet; resolves whether it wrote.
1780
+ * The engine writes a step it dispatches for the first time through it, instead of reading the
1781
+ * position first: a row already there (written by a turn it did not see) is then read and acted on.
1782
+ *
1783
+ * Optional: a store that omits it gets a {@link getCheckpoint} before the {@link saveCheckpoint}.
1784
+ */
1785
+ insertCheckpointIfAbsent?(checkpoint: StepCheckpoint): Promise<boolean>;
1717
1786
  /** Used by recovery on boot to find runs to resume (crashed, left `running`). */
1718
1787
  listIncompleteRuns(namespace?: string): Promise<WorkflowRun[]>;
1719
1788
  /**
@@ -1736,6 +1805,16 @@ interface StateStore {
1736
1805
  listOrphanedRuns?(nowMs: number, limit: number, namespace?: string, ownedBy?: OwnedLeaseReclaim): Promise<WorkflowRun[]>;
1737
1806
  /** The oldest `pending` runs awaiting dispatch (FIFO, by `createdAt`), capped at `limit`. */
1738
1807
  listPendingRuns(limit: number, namespace?: string): Promise<WorkflowRun[]>;
1808
+ /**
1809
+ * Claim up to `limit` of the oldest `pending` runs that no instance holds (no lease, or one that
1810
+ * expired by `nowMs`): lease each to `owner` until `leaseUntilMs` and resolve them as locked, in
1811
+ * one statement where the store can. Rows another claimer is locking right now are skipped, not
1812
+ * waited on (`FOR UPDATE SKIP LOCKED`), so instances polling at once split the backlog instead of
1813
+ * racing for the same rows. `namespace` and the read scope filter like {@link listPendingRuns}.
1814
+ *
1815
+ * Optional: a store that omits it gets {@link listPendingRuns} and a {@link tryLockRun} per run.
1816
+ */
1817
+ claimPendingRuns?(limit: number, owner: string, leaseUntilMs: number, nowMs: number, namespace?: string): Promise<WorkflowRun[]>;
1739
1818
  /**
1740
1819
  * Suspended runs whose durable timer is due (`wakeAt <= nowMs`), ready to resume — the most
1741
1820
  * overdue first, at most `limit` of them when it is given. Every driving instance polls this each
@@ -1748,6 +1827,15 @@ interface StateStore {
1748
1827
  * acquired — so concurrent engine instances never recover the same run twice.
1749
1828
  */
1750
1829
  tryLockRun(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<boolean>;
1830
+ /**
1831
+ * {@link tryLockRun}, resolving the run as it reads once locked (`null` when the lease was not
1832
+ * acquired, or the run does not exist): the engine takes a run's lease and reads it in one round
1833
+ * trip where the store can. The read honors the store's read scope like {@link getRun}; a run
1834
+ * outside it is not locked.
1835
+ *
1836
+ * Optional: a store that omits it gets a {@link getRun} and a {@link tryLockRun}.
1837
+ */
1838
+ tryLockRunAndGet?(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<WorkflowRun | null>;
1751
1839
  /**
1752
1840
  * Release a run's recovery lease so another instance can pick it up (e.g. once it suspends).
1753
1841
  *
@@ -1828,6 +1916,40 @@ interface StateStore {
1828
1916
  takeBufferedSignal(token: string): Promise<{
1829
1917
  payload: unknown;
1830
1918
  } | null>;
1919
+ /**
1920
+ * Take the oldest buffered signal (lowest id) whose token is one of `tokens`, with that token, or
1921
+ * null if none is buffered. Atomic like {@link takeBufferedSignal}: two concurrent callers never
1922
+ * take the same row. `ctx.waitForAny` resolves with it, so when several of its signals are already
1923
+ * buffered the one sent first wins, whichever condition it matches.
1924
+ *
1925
+ * Optional: without it `waitForAny` takes {@link takeBufferedSignal} token by token in the order
1926
+ * the conditions are declared.
1927
+ */
1928
+ takeOldestBufferedSignal?(tokens: string[]): Promise<{
1929
+ token: string;
1930
+ payload: unknown;
1931
+ } | null>;
1932
+ /**
1933
+ * Record that the signal `id` was sent on `token`, unless it already was: resolves `true` when this
1934
+ * call recorded it (the signal is new) and `false` when an unexpired record for the same `token`
1935
+ * and `id` exists (a re-send). The record lasts until `expiresAt` (epoch ms); a record whose
1936
+ * `expiresAt <= nowMs` counts as absent and is replaced. Atomic: of two concurrent calls with the
1937
+ * same `token` and `id`, exactly one resolves `true`. Backs `engine.signal(token, payload, { id })`.
1938
+ *
1939
+ * Optional: a store without it can't deduplicate signals, and `signal(..., { id })` throws.
1940
+ */
1941
+ claimSignalId?(token: string, id: string, expiresAt: number, nowMs: number): Promise<boolean>;
1942
+ /**
1943
+ * Delete the record {@link claimSignalId} made for `token` and `id`, if any. The engine calls it
1944
+ * when delivering the signal failed after the claim, so the sender's retry is not taken for a
1945
+ * duplicate.
1946
+ */
1947
+ releaseSignalId?(token: string, id: string): Promise<void>;
1948
+ /**
1949
+ * Delete up to `limit` signal-id records that expired at or before `nowMs`; resolves how many it
1950
+ * deleted. Expired records are already ignored by {@link claimSignalId}; this only reclaims space.
1951
+ */
1952
+ deleteExpiredSignalIds?(nowMs: number, limit: number): Promise<number>;
1831
1953
  /**
1832
1954
  * A page of buffered signals whose token starts with `tokenPrefix`, in insertion (`id`) order,
1833
1955
  * starting after `afterId` (exclusive; `undefined` = from the start), at most `limit` rows. The
@@ -2424,9 +2546,83 @@ interface SignalWaiter {
2424
2546
  * group; without threading it through the waiter, the child-await checkpoint comes out untagged and the
2425
2547
  * dashboard renders the fan as a sequential chain instead of one parallel group. Undefined for an
2426
2548
  * ordinary (non-fan) signal/child await.
2549
+ *
2550
+ * `'$any'` (`ANY_WAIT_GROUP`) marks the waiter as one condition of a `ctx.waitForAny`: a signal
2551
+ * that takes it settles the wait only if no other condition did first, and is buffered again
2552
+ * otherwise (see `wait-any.ts`).
2427
2553
  */
2428
2554
  parallelGroup?: string | undefined;
2429
2555
  }
2556
+ /** Options for `engine.signal(token, payload, opts)`. */
2557
+ interface SignalOptions {
2558
+ /**
2559
+ * Deduplication id, unique per token — the id of the message, job or webhook delivery that causes
2560
+ * the signal. A signal sent again on the same token with the same id while the first is remembered
2561
+ * (see `idTtl`) is dropped: `signal()` resolves `null` and nothing is delivered or buffered, so a
2562
+ * sender that runs twice (a redelivered message, a retried job) signals once and the first payload
2563
+ * wins. The same id on another token is another signal. Needs a store with `claimSignalId` (every
2564
+ * bundled store).
2565
+ *
2566
+ * If storing the signal fails, `signal()` rejects and the id is forgotten, so a retry gets through.
2567
+ * A duplicate sent on the same engine while the first send is still in flight waits for it, and
2568
+ * sends in its place if it fails. Across instances a concurrent duplicate is dropped at once, so
2569
+ * the sender whose call rejected must retry.
2570
+ */
2571
+ id?: string | undefined;
2572
+ /**
2573
+ * How long this signal's `id` is remembered (ms, or a duration like `'30d'`). Default: the engine's
2574
+ * `signalIdTtl` (7 days).
2575
+ */
2576
+ idTtl?: string | number | undefined;
2577
+ }
2578
+ declare const waitConditionValue: unique symbol;
2579
+ /**
2580
+ * What a condition of {@link WorkflowCtx.waitForAny} waits for. Plain data: the same object travels
2581
+ * in a remote workflow's `waitAny` command.
2582
+ *
2583
+ * - `signal`: a signal sent on token `signal` (`engine.signal(token, payload)`); its value is the payload.
2584
+ * - `timer`: `ms` after the wait is first reached, or at `until` (epoch ms); its value is `null`.
2585
+ * - `child`: the run `childId` settling; its value is the run's output (a failed run throws).
2586
+ */
2587
+ type WaitConditionSpec = {
2588
+ kind: 'signal';
2589
+ signal: string;
2590
+ } | {
2591
+ kind: 'timer';
2592
+ ms?: number | undefined;
2593
+ until?: number | undefined;
2594
+ } | {
2595
+ kind: 'child';
2596
+ childId: string;
2597
+ };
2598
+ /**
2599
+ * A condition for {@link WorkflowCtx.waitForAny}, made by `ctx.signalWait()`, `ctx.timer()` or
2600
+ * `ctx.childWait()`. `T` is the value it resolves with (type-only). Only a description: nothing is
2601
+ * waited for, and nothing journaled, until it is passed to `waitForAny`.
2602
+ */
2603
+ type WaitCondition<T = unknown> = WaitConditionSpec & {
2604
+ /** Type-only: the `value` `waitForAny()` returns when this condition wins. Never set. */
2605
+ readonly [waitConditionValue]?: T;
2606
+ };
2607
+ /** One condition of a remote `waitAny` command: the spec plus its key in the conditions object. */
2608
+ type WaitAnyCondition = WaitConditionSpec & {
2609
+ key: string;
2610
+ };
2611
+ /** What a `waitForAny` resolved with, untyped: the winning condition's key and its value. */
2612
+ interface WaitAnyOutcome {
2613
+ key: string;
2614
+ value: unknown;
2615
+ }
2616
+ /**
2617
+ * What `ctx.waitForAny(name, conditions)` resolves with: the key of the condition that won and its
2618
+ * value, typed per key (check `key` to narrow `value`).
2619
+ */
2620
+ type WaitAnyResult<C extends Record<string, WaitCondition<unknown>>> = {
2621
+ [K in keyof C & string]: {
2622
+ key: K;
2623
+ value: C[K] extends WaitCondition<infer T> ? T : never;
2624
+ };
2625
+ }[keyof C & string];
2430
2626
  /**
2431
2627
  * A DB-less tenant worker → control plane request to start a run. Published by a worker that has
2432
2628
  * no direct DB access (the hosted-control-plane tenant model) onto the
@@ -2570,6 +2766,14 @@ interface RemoteTask {
2570
2766
  */
2571
2767
  priority?: number | undefined;
2572
2768
  attempt: number;
2769
+ /**
2770
+ * The engine instance that dispatched the task and wants its result back, when the transport
2771
+ * routes replies ({@link Transport.consumeRepliesFor}): that instance keeps the workflow body
2772
+ * parked on the step, so its result continues the body there instead of replaying it elsewhere.
2773
+ * A worker sends the result to that instance while it is alive, else to the shared results, like
2774
+ * a task without it. Absent when replies are not routed (a step fan's tasks never carry it).
2775
+ */
2776
+ replyTo?: string | undefined;
2573
2777
  }
2574
2778
  interface StepResult {
2575
2779
  runId: string;
@@ -2627,9 +2831,14 @@ interface WorkflowTask {
2627
2831
  /** One resolved durable op in a run's history — a superset of a completed {@link StepCheckpoint}. */
2628
2832
  interface HistoryEvent {
2629
2833
  seq: number;
2630
- kind: 'step' | 'call' | 'timer' | 'signal' | 'child';
2834
+ kind: 'step' | 'call' | 'timer' | 'signal' | 'child' | 'any';
2835
+ /** The op's name. For `any`, the `waitForAny` name. */
2631
2836
  name?: string | undefined;
2632
- /** Resolved value: a step/call output, a child run's output, a signal payload. */
2837
+ /**
2838
+ * Resolved value: a step/call output, a child run's output, a signal payload. For `any`, the
2839
+ * `{ key, value }` the wait resolved with (a winning child's output unwrapped; a failed child
2840
+ * sets `error` and leaves `{ key }`).
2841
+ */
2633
2842
  output?: unknown;
2634
2843
  /** Set when the op resolved to a failure (e.g. a failed remote step the workflow may catch). */
2635
2844
  error?: StepError | undefined;
@@ -2679,6 +2888,16 @@ type WorkflowCommand =
2679
2888
  seq: number;
2680
2889
  signal: string;
2681
2890
  }
2891
+ /** `ctx.waitForAny(name, conditions)` — block until the first of `conditions` happens. The engine
2892
+ * resolves it exactly as the in-process ctx does (see `wait-any.ts`), journals `{ key, value }` at
2893
+ * `seq` and replays it as an `any` {@link HistoryEvent}. A timer's `ms` counts from when the engine
2894
+ * first applies the command. */
2895
+ | {
2896
+ kind: 'waitAny';
2897
+ seq: number;
2898
+ name: string;
2899
+ conditions: WaitAnyCondition[];
2900
+ }
2682
2901
  /** `ctx.start_child(workflow, input)` — start a child run with its own lifecycle. A worker's
2683
2902
  * `ctx.all([...])` fan-out tags every dispatched child with the same `parallelGroup` so the
2684
2903
  * dashboard can render the fan as one group (parity with the gathered `recordStep` tag). */
@@ -2827,6 +3046,14 @@ interface Transport {
2827
3046
  dispatchMany?(tasks: RemoteTask[]): Promise<void>;
2828
3047
  /** worker → engine: a step finished (ok or error). */
2829
3048
  onResult(handler: (result: StepResult) => Promise<void>): void;
3049
+ /**
3050
+ * Also consume the results workers address to engine instance `replyTo` (tasks dispatched with
3051
+ * {@link RemoteTask.replyTo}), handing them to the {@link onResult} handlers. A transport that
3052
+ * implements it must never lose such a result: while `replyTo` is gone (crashed, scaled down,
3053
+ * drained), its results go, or are moved, to the shared results. Optional: a transport without it
3054
+ * gets tasks without `replyTo`, and every result comes back on the shared results.
3055
+ */
3056
+ consumeRepliesFor?(replyTo: string): void;
2830
3057
  /** worker → engine: liveness signal for an in-flight long step. */
2831
3058
  onHeartbeat(handler: (beat: Heartbeat) => Promise<void>): void;
2832
3059
  /** Release the transport's resources (broker workers, queues, connections) for a clean shutdown.
@@ -3079,7 +3306,24 @@ interface ChildCallOptions {
3079
3306
  * (TS class) child, which runs in the engine and never hits a broker queue.
3080
3307
  */
3081
3308
  priority?: number | undefined;
3309
+ /**
3310
+ * What happens to this child if it is still running when its parent ends:
3311
+ *
3312
+ * - `'cancel'`: cancelled with its saga undo (`cancel(child, { compensate: true })`);
3313
+ * - `'terminate'`: cancelled without compensating (`cancel(child)`);
3314
+ * - `'abandon'`: left running, also when the parent is CANCELLED (the cancel cascade skips it).
3315
+ *
3316
+ * Applied when the parent completes or fails in a workflow turn. A cancelled or timed-out parent
3317
+ * keeps cascading its cancel to its children as before, except `'abandon'` ones. Omitted: today's
3318
+ * behaviour (a finished parent leaves its children alone; a cancelled one cascades). In-process
3319
+ * (TS class) parents only: a workflow replayed by a remote worker ignores it.
3320
+ */
3321
+ parentClose?: ParentClosePolicy | undefined;
3082
3322
  }
3323
+ /** See {@link ChildCallOptions.parentClose}. */
3324
+ type ParentClosePolicy = 'cancel' | 'terminate' | 'abandon';
3325
+ /** The tag a child started with a `parentClose` policy carries: `parent-close:<policy>`. */
3326
+ declare const PARENT_CLOSE_TAG_PREFIX = "parent-close:";
3083
3327
  interface StepOptions {
3084
3328
  /** Max attempts before the step (and run) fails. */
3085
3329
  retries?: number;
@@ -3310,6 +3554,46 @@ interface WorkflowCtx<A extends SearchAttributes = SearchAttributes> {
3310
3554
  waitForSignal<TPayload>(token: string, opts?: {
3311
3555
  timeoutMs?: number;
3312
3556
  }): Promise<TPayload>;
3557
+ /**
3558
+ * Durable wait for whichever of several conditions happens first: a signal
3559
+ * ({@link signalWait}), a timer ({@link timer}) or a run settling ({@link childWait}). Resolves with
3560
+ * the winner's key and its value — a signal's payload, `null` for a timer, a child's output (a
3561
+ * child that failed throws, as {@link child} does) — journaled under `name` at ONE position, so a
3562
+ * replay returns the same winner.
3563
+ *
3564
+ * Only the winning signal is consumed: a signal that matched another condition stays buffered for
3565
+ * a later wait on its token. A losing timer never fires; a losing child keeps running, and a later
3566
+ * `ctx.child(..., childId)` still joins it. When several conditions are ready at once the signal
3567
+ * sent first wins (lowest buffered id), then a child that already finished, then the earliest due
3568
+ * timer. A signal that arrives after a timer's deadline loses to it, even if no worker ran at the
3569
+ * deadline. Timers count from when the wait is first reached.
3570
+ *
3571
+ * ```ts
3572
+ * const outcome = await ctx.waitForAny('delivery-or-cancel', {
3573
+ * delivered: ctx.signalWait<CarrierEvent>(`shipment.delivered:${order.id}`),
3574
+ * cancelled: ctx.signalWait<{ reason: string }>(`order.cancelled:${order.id}`),
3575
+ * timeout: ctx.timer('3d'),
3576
+ * });
3577
+ * if (outcome.key === 'delivered') await ctx.step(thank, outcome.value);
3578
+ * ```
3579
+ */
3580
+ waitForAny<C extends Record<string, WaitCondition<unknown>>>(name: string, conditions: C): Promise<WaitAnyResult<C>>;
3581
+ /** A signal condition for {@link waitForAny}: a signal sent on `token`. Its value is the payload. */
3582
+ signalWait<TPayload = unknown>(token: string): WaitCondition<TPayload>;
3583
+ /**
3584
+ * A timer condition for {@link waitForAny}: `duration` (ms, or `'30m'`, `'3d'`…) after the wait is
3585
+ * first reached, or at `{ until }` (a `Date` or epoch ms). Its value is `null`.
3586
+ */
3587
+ timer(duration: string | number | {
3588
+ until: Date | number;
3589
+ }): WaitCondition<null>;
3590
+ /**
3591
+ * A child condition for {@link waitForAny}: run `childId` settling (a child from
3592
+ * {@link startChild}, or any run id). Its value is the run's output; a run that failed, was
3593
+ * cancelled or died makes `waitForAny` throw. Pass the workflow class first to type the output.
3594
+ */
3595
+ childWait<C extends WorkflowClass>(workflow: C, childId: string): WaitCondition<WorkflowOutputOf<C>>;
3596
+ childWait<TOutput = unknown>(childId: string): WaitCondition<TOutput>;
3313
3597
  /**
3314
3598
  * Wait for a named **event** published via `engine.publishEvent(name, payload)`, then resume with
3315
3599
  * the payload. Unlike a signal (point-to-point by token), events are name-based pub/sub: pass an
@@ -4547,7 +4831,13 @@ interface ScheduleOptions {
4547
4831
  cron?: string | undefined;
4548
4832
  /** Fixed interval (`'15m'`, or ms), windows aligned to the epoch. Exclusive with `cron`. */
4549
4833
  every?: string | number | undefined;
4550
- /** IANA timezone the cron is evaluated in (e.g. `America/Sao_Paulo`). Default UTC. */
4834
+ /**
4835
+ * An RFC 5545 recurrence rule (`'FREQ=WEEKLY;BYDAY=MO;BYHOUR=8'`, optionally with a
4836
+ * `DTSTART:…` line), evaluated in `timezone`. Exactly one of `cron`, `every` and `rrule`. See
4837
+ * {@link parseRRule} for the supported parts. No peer needed.
4838
+ */
4839
+ rrule?: string | undefined;
4840
+ /** IANA timezone the cron / rrule is evaluated in (e.g. `America/Sao_Paulo`). Default UTC. */
4551
4841
  timezone?: string | undefined;
4552
4842
  /**
4553
4843
  * Delay each fire by up to this much (`'30s'` or ms) — a stable per-(schedule, window) offset, so
@@ -4592,6 +4882,7 @@ interface ScheduleDescription {
4592
4882
  namespace: string;
4593
4883
  cron?: string | undefined;
4594
4884
  everyMs?: number | undefined;
4885
+ rrule?: string | undefined;
4595
4886
  timezone?: string | undefined;
4596
4887
  jitterMs?: number | undefined;
4597
4888
  overlap: 'allow' | 'skip';
@@ -5059,6 +5350,13 @@ interface WorkflowEngineDeps {
5059
5350
  * bug to route around here.
5060
5351
  */
5061
5352
  eventBufferTtlMs?: number | undefined;
5353
+ /**
5354
+ * How long `signal(token, payload, { id })` remembers an `id` (ms, or a duration like `'7d'`): a
5355
+ * re-send with the same token and id within it is dropped. Records past it are ignored, and
5356
+ * {@link WorkflowEngine.sweepExpiredSignalIds} deletes them. Keep it longer than any sender's
5357
+ * redelivery window. Default 7 days; a call can pass its own `idTtl`.
5358
+ */
5359
+ signalIdTtl?: string | number | undefined;
5062
5360
  /**
5063
5361
  * Opt-in self-heal window (ms) for a remote step with NO `timeoutMs` whose dispatched job was LOST —
5064
5362
  * the worker crashed mid-step leaving no result, or the transport dropped the job (a Redis
@@ -5088,6 +5386,14 @@ interface WorkflowEngineDeps {
5088
5386
  * AND descriptors are published (a legacy fleet never parks blocked).
5089
5387
  */
5090
5388
  blockedPollMs?: number | undefined;
5389
+ /**
5390
+ * How long (ms) the routing guard reuses the worker descriptors it read for a queue token before
5391
+ * reading them again. Every dispatch consults them, and on BullMQ each read is a `SCAN` of the
5392
+ * Redis keyspace; workers rewrite their descriptor every 10 s with a 35 s TTL, so a couple of
5393
+ * seconds of reuse changes nothing the guard can observe. Concurrent reads of one token share a
5394
+ * single request. Default 2000; `0` reads on every dispatch.
5395
+ */
5396
+ workerDescriptorCacheMs?: number | undefined;
5091
5397
  /**
5092
5398
  * Build the public callback URL for a `ctx.webhook()` token (e.g.
5093
5399
  * ``(t) => `https://api.example.com/durable/webhooks/${t}` ``). Populates
@@ -5147,6 +5453,26 @@ interface WorkflowEngineDeps {
5147
5453
  * run `runPending` on a worker pod to pick those up; or a broker-backed one for a worker pool.
5148
5454
  */
5149
5455
  runDispatcher?: RunDispatcher | undefined;
5456
+ /**
5457
+ * How many parked workflow bodies this instance keeps in memory between turns (the sticky
5458
+ * continuation cache, see `sticky-continuation.ts`). A run whose body parked here on dispatched
5459
+ * `ctx.step` calls continues from where it stopped when its next turn runs on this instance,
5460
+ * instead of replaying from the top over its whole history: the turn re-reads only the steps it
5461
+ * parked on. Least recently used out first; an evicted run just replays. Default 1000 (about 26 KB
5462
+ * of heap per parked body, measured with a small body: ~26 MB at most). `0` turns
5463
+ * the cache off (every turn replays).
5464
+ */
5465
+ stickyRuns?: number | undefined;
5466
+ /** How long a parked body may sit idle in the sticky cache before it is dropped. Default 5 min. */
5467
+ stickyIdleMs?: number | undefined;
5468
+ /**
5469
+ * Ask the transports that can ({@link Transport.consumeRepliesFor}, e.g. BullMQ) to send the result
5470
+ * of a dispatched `ctx.step` back to this instance, which holds the body parked on it, rather
5471
+ * than to whichever engine instance takes it off the shared results. With several engine
5472
+ * instances, that is what keeps the sticky continuation hitting. A result whose instance is gone
5473
+ * goes to the shared results and replays elsewhere. Default `true` while the sticky cache is on.
5474
+ */
5475
+ routeReplies?: boolean | undefined;
5150
5476
  }
5151
5477
  /** Options for {@link WorkflowEngine.listStalledRuns}. */
5152
5478
  interface ListStalledRunsOptions {
@@ -5189,12 +5515,29 @@ declare class WorkflowEngine {
5189
5515
  private readonly unregisteredWorkflowGraceMs;
5190
5516
  private readonly remoteAdvanceSilenceMs?;
5191
5517
  private readonly reconcileMs;
5518
+ /** Parked workflow bodies kept between turns (see {@link WorkflowEngineDeps.stickyRuns}). */
5519
+ private readonly sticky;
5520
+ /** Pending runs claimed by {@link runPending} for the turn about to run them, as read by the claim. */
5521
+ private readonly claimedRuns;
5522
+ /** The continuation each turn executing here runs in, by run id, while the turn runs. */
5523
+ private readonly turnContinuations;
5524
+ /** Whether to ask transports to route step results back here (see {@link WorkflowEngineDeps.routeReplies}). */
5525
+ private readonly routeReplies;
5526
+ /** Whether a transport routes this instance's step results back to it. */
5527
+ private repliesRouted;
5528
+ /** The run row stamp (`updatedAt`, epoch ms) a turn here wrote when it settled `suspended`. */
5529
+ private readonly suspendStamps;
5192
5530
  private readonly timerBatchSize;
5193
5531
  private readonly eventBufferTtlMs;
5532
+ private readonly signalIdTtlMs;
5533
+ /** The deduplicated {@link signal} sends in flight here, by `token \u0000 id`. */
5534
+ private readonly signalIdSends;
5194
5535
  private readonly remoteRedispatchMs;
5195
5536
  private readonly remoteRedispatchMax;
5196
5537
  /** How long a `blocked` run waits before the recovery poll re-checks the live fleet (design §7.5). */
5197
5538
  private readonly blockedPollMs;
5539
+ private readonly workerDescriptorCacheMs;
5540
+ private readonly descriptorCache;
5198
5541
  /** This engine's control-plane handshake descriptor — negotiated against each worker (design §7.3). */
5199
5542
  private readonly cpDescriptor;
5200
5543
  private readonly webhookUrl?;
@@ -5219,6 +5562,10 @@ declare class WorkflowEngine {
5219
5562
  private readonly workflows;
5220
5563
  /** The newest registered version per workflow name — used to `start` new runs. */
5221
5564
  private readonly latest;
5565
+ /** Workflows this instance starts but never runs, keyed `name@version` (like {@link workflows}), so every version stays startable. See {@link registerStartOnly}. */
5566
+ private readonly startOnly;
5567
+ /** The latest start-only registration per name, for unpinned starts (like {@link latest}). */
5568
+ private readonly startOnlyLatest;
5222
5569
  /** Event name → subscribing workflow name → that workflow's subscriptions to it. See `onEvent`. */
5223
5570
  private readonly eventTriggers;
5224
5571
  /** Durable-entity subsystem (registers the `__entity` runner; see `registerEntity`). */
@@ -5349,6 +5696,8 @@ declare class WorkflowEngine {
5349
5696
  private readonly claimsMade;
5350
5697
  /** Pager hooks for stranded runs (see {@link onStalled}). */
5351
5698
  private readonly stalledListeners;
5699
+ /** `parentClose` policies recorded by the turn in flight, per parent run (see {@link settleParentClose}). */
5700
+ private readonly parentCloseIntents;
5352
5701
  /** Runs already paged about, by id → the `updatedAt` of the paged episode (see {@link sweepStalled}). */
5353
5702
  private readonly notifiedStalled;
5354
5703
  private lastStalledSweepAt;
@@ -5496,6 +5845,23 @@ declare class WorkflowEngine {
5496
5845
  /** Handler workflows a matching failure is routed to — see {@link OnErrorRoute}. */
5497
5846
  onError?: OnErrorRoute[] | undefined;
5498
5847
  }): void;
5848
+ /**
5849
+ * Let {@link start} create runs of `name@version` on this instance without registering a body here:
5850
+ * the run is stored and left for an instance that {@link register}ed the workflow, and this one
5851
+ * never executes it. For a process that only emits work (an API pod) while workers run it.
5852
+ *
5853
+ * Runs this instance picks up anyway (a driving poll, the run queue) are released for another
5854
+ * instance without a log line, and dead-lettered after `unregisteredWorkflowGraceMs` like any run
5855
+ * whose workflow nobody registered. A {@link register} of the same name on this instance wins.
5856
+ */
5857
+ registerStartOnly(name: string, version: string, opts?: {
5858
+ tags?: string[] | undefined;
5859
+ /** The declaring package, stamped onto every run started here. See {@link register}'s `origin`. */
5860
+ origin?: string | undefined;
5861
+ validateInput?: ((input: unknown) => void | Promise<void>) | undefined;
5862
+ }): void;
5863
+ /** Whether `run` is of a workflow this instance only starts (see {@link registerStartOnly}). */
5864
+ private isStartOnlyHere;
5499
5865
  /**
5500
5866
  * The retained in-process body for `name@version`, for an IN-APP worker that consumes this engine's
5501
5867
  * own group to SERVE a group-served `register(..., { group, executor })` workflow (uniform dispatch):
@@ -5611,6 +5977,13 @@ declare class WorkflowEngine {
5611
5977
  * store without `listBufferedSignals`/`deleteBufferedSignals`. Returns how many rows it deleted.
5612
5978
  */
5613
5979
  sweepBufferedSignals(now?: number, budgetMs?: number): Promise<number>;
5980
+ /**
5981
+ * Delete the signal-id records (`signal(..., { id })`) that expired by `now`, in batches of
5982
+ * {@link SIGNAL_ID_SWEEP_BATCH}, at most `maxBatches` per call. Expired records already stop
5983
+ * deduplicating; this reclaims their rows. The NestJS timer poller calls it every tick. Returns how
5984
+ * many it deleted; 0 on a store without `deleteExpiredSignalIds`.
5985
+ */
5986
+ sweepExpiredSignalIds(now?: number, maxBatches?: number): Promise<number>;
5614
5987
  /**
5615
5988
  * Register a pager hook for STRANDED runs: an in-flight run untouched past `stalledAfterMs` that is
5616
5989
  * either suspended with NO wake timer (wake-forever: nothing will ever re-drive it) or parked on an
@@ -6026,6 +6399,7 @@ declare class WorkflowEngine {
6026
6399
  */
6027
6400
  private updateRunIfFallback;
6028
6401
  private resumeRunNow;
6402
+ private resumeLoadedRun;
6029
6403
  /**
6030
6404
  * The registration for an UNREGISTERED run, INHERITED from its nearest REMOTE ancestor — or
6031
6405
  * `undefined` if it has none (the skew-protection error case in {@link resume}). Callers check the
@@ -6361,6 +6735,11 @@ declare class WorkflowEngine {
6361
6735
  * for a pod that does have the workflow — which is exactly what the skew-protection error asks
6362
6736
  * for. Same posture as `publishEvent`'s per-subscriber isolation.
6363
6737
  */
6738
+ /**
6739
+ * Run `claimed` (pending runs this instance just leased, read as locked): every turn starts at
6740
+ * once, and each re-enters the lease taken for it without reading the run again.
6741
+ */
6742
+ private runClaimed;
6364
6743
  private resumeLeased;
6365
6744
  /**
6366
6745
  * Deliver an external signal to the run waiting on `token` and resume it with `payload`.
@@ -6401,6 +6780,19 @@ declare class WorkflowEngine {
6401
6780
  * same way.
6402
6781
  */
6403
6782
  private deliverSignal;
6783
+ /**
6784
+ * Deliver to a waiter that is one condition of a `ctx.waitForAny` (see `wait-any.ts`): settle the
6785
+ * wait with this condition through the checkpoint's compare-and-set, then wake the run. A signal
6786
+ * that loses — the wait was settled by another condition first, or a timer of the wait came due
6787
+ * before it arrived (the timer then wins) — is not consumed: it is sent again on its token, where
6788
+ * it is buffered for the next wait (or reaches a waiter registered since).
6789
+ */
6790
+ private deliverToWaitAny;
6791
+ /**
6792
+ * Put back a signal a `waitForAny` condition took but did not win with. A child's completion is
6793
+ * kept only where a parent can still consume it, as {@link deliverToParent} decides.
6794
+ */
6795
+ private redeliverLosingSignal;
6404
6796
  /**
6405
6797
  * The `ctx.all` join barrier: true when `waiter` was one child of a fan (or of one wave of it)
6406
6798
  * whose siblings are still out, so waking the parent now would only replay the fan and re-suspend.
@@ -6496,7 +6888,14 @@ declare class WorkflowEngine {
6496
6888
  * Either way, the destructive `take*` ops (on the waiter row, on the buffer) arbitrate: whichever
6497
6889
  * side actually removes the row is the one that delivers, so a signal is never delivered twice.
6498
6890
  */
6499
- signal(token: string, payload: unknown): Promise<RunResult | null>;
6891
+ signal(token: string, payload: unknown, opts?: SignalOptions): Promise<RunResult | null>;
6892
+ /** One deduplicated {@link signal}: claim `id`, then deliver or buffer; a failure forgets the id. */
6893
+ private signalOnce;
6894
+ /**
6895
+ * {@link signal} without deduplication: deliver to the waiter on `token`, or buffer. `committed`
6896
+ * is called once the signal is durably delivered or buffered.
6897
+ */
6898
+ private deliverOrBuffer;
6500
6899
  /**
6501
6900
  * Wake the run parked on `token` with `payload`, if there is one; otherwise do nothing — unlike
6502
6901
  * {@link signal}, it never buffers. For a wake-up whose real payload is ALREADY buffered on the
@@ -6635,6 +7034,12 @@ declare class WorkflowEngine {
6635
7034
  * explicitly cancelled one's does, or the children are orphans nobody is holding a reference to.
6636
7035
  */
6637
7036
  private cancelChildren;
7037
+ /**
7038
+ * Apply the `parentClose` policies a parent's turn recorded (see {@link ChildCallOptions.parentClose})
7039
+ * when that parent completes or fails; forget them when it suspends (its next turn, here or on
7040
+ * another instance, records them again). Local events only: this is the instance that ran the turn.
7041
+ */
7042
+ private settleParentClose;
6638
7043
  /**
6639
7044
  * The ids of the runs a run spawned — both awaited (`ctx.child`) and fire-and-forget
6640
7045
  * (`ctx.startChild`, found via its `spawn:<id>` checkpoint). The canonical parent→children edge,
@@ -6764,12 +7169,9 @@ declare class WorkflowEngine {
6764
7169
  * the timer poll of another instance runs it once this instance's hold on it would have lapsed.
6765
7170
  */
6766
7171
  private honorWakeRequests;
6767
- /**
6768
- * The wake requests kept for `runId`. With `legacy`, also those an older engine kept as buffered
6769
- * signals, which are taken as they are read.
6770
- */
7172
+ /** The wake requests kept for `runId`. */
6771
7173
  private listWakeRequests;
6772
- /** Delete `requests` (the ones kept as buffered events). */
7174
+ /** Delete `requests`. */
6773
7175
  private dropWakeRequests;
6774
7176
  /**
6775
7177
  * Record, for the turn executing `runId` here, the wakes kept for the run so far. Called before the
@@ -7119,6 +7521,8 @@ declare class WorkflowEngine {
7119
7521
  * - a `blocked` plan — descriptors exist but none can run it (park the run, never dispatch into it).
7120
7522
  */
7121
7523
  private planRoute;
7524
+ /** The live descriptors for `token`, reused for {@link workerDescriptorCacheMs}; one read in flight. */
7525
+ private liveWorkerDescriptors;
7122
7526
  /** Throw {@link WorkflowBlocked} when no live worker can run a dispatch to `token` — so the caller's
7123
7527
  * run-execution catch parks the run `blocked` (with the plan) instead of persisting a `pending`
7124
7528
  * checkpoint + dispatching into a queue nobody consumes (design §7.5). A no-op when the guard does
@@ -7139,6 +7543,13 @@ declare class WorkflowEngine {
7139
7543
  * capable+compatible worker has appeared, else re-parks with a fresh `wakeAt` (design §7.5). */
7140
7544
  private dueBlockedRuns;
7141
7545
  private callRemote;
7546
+ /**
7547
+ * {@link callRemote}'s first dispatch of a step, written with
7548
+ * {@link StateStore.insertCheckpointIfAbsent}: resolves whether it wrote the `pending` row and
7549
+ * dispatched. `false` when the position already has a row, or when no live worker can take the
7550
+ * step (the read-first path then decides, so a step that is in fact done is never blocked).
7551
+ */
7552
+ private dispatchIfAbsent;
7142
7553
  /**
7143
7554
  * Whether a `pending` step a turn just read only waits for its result: {@link callRemote} would
7144
7555
  * suspend on it without writing (no redispatch deadline to stamp, the one stamped not yet due).
@@ -7184,6 +7595,29 @@ declare class WorkflowEngine {
7184
7595
  * all at its front: pruning stops at the first fresh entry instead of walking the whole map.
7185
7596
  */
7186
7597
  private noteRecent;
7598
+ /**
7599
+ * Whether this turn of `run` may run in a sticky continuation (see `sticky-continuation.ts`). Not
7600
+ * while the engine drains, for a cancel being compensated, nor when execution wrappers are
7601
+ * registered: a resumed body runs in the async scope of the turn that started it, and a wrapper
7602
+ * (a span, a log batch) expects one scope per turn.
7603
+ */
7604
+ private stickyEligible;
7605
+ /**
7606
+ * The continuation this instance parked for `run`, if it is still the run's latest turn: the run
7607
+ * is `suspended` with the very stamp this instance's suspend wrote, on the same body and version.
7608
+ * Any other settle in between (another instance's turn, a retry, a cancel) changed the stamp, and
7609
+ * the run replays instead. Taking it removes it from the cache.
7610
+ */
7611
+ private takeContinuation;
7612
+ /** Keep `cont` (parked, detached) for the run's next turn here, stamped with its suspend write. */
7613
+ private keepContinuation;
7614
+ /**
7615
+ * The checkpoints of the steps `cont` is parked on, as a replay would see them: in one read when
7616
+ * the store batches, and without the input of a step that completed (what
7617
+ * {@link StateStore.getCheckpointsForSettle} leaves out). A step still open or failed is read
7618
+ * whole, since a re-dispatch or a retry sends its input again.
7619
+ */
7620
+ private readParked;
7187
7621
  /**
7188
7622
  * The run's checkpoints as a turn replays them: {@link StateStore.listCheckpointsForReplay} when
7189
7623
  * the store has it (no input on a completed row), else {@link StateStore.listCheckpoints}.
@@ -7250,6 +7684,14 @@ declare class WorkflowEngine {
7250
7684
  * under a backlog the barrier is read once per drained queue rather than once per batch.
7251
7685
  */
7252
7686
  private completeRemoteResults;
7687
+ /**
7688
+ * {@link completeRemoteResults} on a store with {@link StateStore.settleResultsIfPending}: the
7689
+ * results settle their `pending` rows and read them back in one call, instead of a read of the rows
7690
+ * followed by the write. Only an entry that wrote nothing (a redelivery, or a step gone) is read
7691
+ * afterwards. A settled `completed` row is also handed to the run's parked body, if this instance
7692
+ * holds one, so its next turn does not read it again.
7693
+ */
7694
+ private settleResultsReturning;
7253
7695
  /**
7254
7696
  * The outcomes for a batch of redelivered results (their steps already settled): one of them
7255
7697
  * resumes the run if it is `suspended` and, for a step of a fan, the fan's barrier is open. A
@@ -7996,6 +8438,15 @@ declare class CodecStateStore implements StateStore {
7996
8438
  /** Encodes each settlement's payloads like {@link saveCheckpoint}. Bound only when the inner store
7997
8439
  * has it, so the engine's whole-row fallback still kicks in through the wrapper. */
7998
8440
  readonly settleCheckpointsIfPending?: (settlements: StepSettlement[]) => Promise<boolean[]>;
8441
+ /** Encodes each result's payloads, decodes each row read back. Bound only when the inner store
8442
+ * has it. */
8443
+ readonly settleResultsIfPending?: (results: StepResultSettlement[]) => Promise<(StepCheckpoint | null)[]>;
8444
+ /** Encodes like {@link saveCheckpoint}. Bound only when the inner store has it. */
8445
+ readonly insertCheckpointIfAbsent?: (checkpoint: StepCheckpoint) => Promise<boolean>;
8446
+ /** Decodes each run claimed. Bound only when the inner store has it. */
8447
+ readonly claimPendingRuns?: (limit: number, owner: string, leaseUntilMs: number, nowMs: number, namespace?: string) => Promise<WorkflowRun[]>;
8448
+ /** Decodes the run read. Bound only when the inner store has it. */
8449
+ readonly tryLockRunAndGet?: (runId: string, owner: string, leaseUntilMs: number, nowMs: number) => Promise<WorkflowRun | null>;
7999
8450
  /** Encodes each checkpoint written. Bound only when the inner store has it. */
8000
8451
  readonly saveCheckpoints?: (checkpoints: StepCheckpoint[]) => Promise<void>;
8001
8452
  /** Decodes each checkpoint read like {@link listCheckpoints}. Bound only when the inner store has
@@ -8033,6 +8484,17 @@ declare class CodecStateStore implements StateStore {
8033
8484
  readonly listBufferedSignals?: (tokenPrefix: string, afterId: string | undefined, limit: number) => Promise<BufferedSignalRow[]>;
8034
8485
  /** Forwarded verbatim — deletes by row id. */
8035
8486
  readonly deleteBufferedSignals?: (ids: string[]) => Promise<void>;
8487
+ /** Decodes the payload like {@link takeBufferedSignal}. Bound only when the inner store has it. */
8488
+ readonly takeOldestBufferedSignal?: (tokens: string[]) => Promise<{
8489
+ token: string;
8490
+ payload: unknown;
8491
+ } | null>;
8492
+ /** Forwarded verbatim — a signal id record carries no payload. */
8493
+ readonly claimSignalId?: (token: string, id: string, expiresAt: number, nowMs: number) => Promise<boolean>;
8494
+ /** Forwarded verbatim. */
8495
+ readonly releaseSignalId?: (token: string, id: string) => Promise<void>;
8496
+ /** Forwarded verbatim. */
8497
+ readonly deleteExpiredSignalIds?: (nowMs: number, limit: number) => Promise<number>;
8036
8498
  /** Forwarded verbatim — a waiter carries no payload. */
8037
8499
  readonly listSignalWaitersByRun?: (runIds: string[]) => Promise<SignalWaiter[]>;
8038
8500
  /** Forwarded verbatim — a waiter carries no payload. */
@@ -8524,6 +8986,41 @@ interface WorkflowHandler<TInput = unknown, TOutput = unknown, A extends SearchA
8524
8986
  run(ctx: WorkflowCtx<A>, input: TInput): Promise<TOutput> | TOutput;
8525
8987
  }
8526
8988
 
8989
+ /**
8990
+ * `ctx.waitForAny(name, conditions)`: one durable wait over several conditions (signals, timers,
8991
+ * child runs), resolved by the FIRST of them, journaled at one position. The machinery lives here so
8992
+ * the in-process ctx (`workflow-ctx.ts`) and the remote `waitAny` command (`engine.applyCommands`)
8993
+ * resolve it the same way, and the engine's signal delivery ({@link isAnyMember}) can settle it from
8994
+ * the sending side.
8995
+ *
8996
+ * How it stays exactly-once, and why a losing signal is not consumed:
8997
+ *
8998
+ * - The wait's position holds ONE checkpoint, `any:<name>`, written `pending` the first time the wait
8999
+ * is reached, with the conditions (timers resolved to absolute deadlines) as its `input`. Whoever
9000
+ * flips it to `completed` — through the store's compare-and-set {@link StateStore.saveCheckpointIfPending}
9001
+ * — is the winner. Nothing else arbitrates, so two conditions landing at once can't both win.
9002
+ * - Every signal/child condition registers an ordinary waiter on its own token, at the wait's
9003
+ * position, tagged {@link ANY_WAIT_GROUP}. A signal sent while the run waits takes that waiter, as
9004
+ * any signal does, and then tries the compare-and-set. If it loses (another condition already
9005
+ * won, or a timer's deadline passed first) the engine sends the payload again on its token
9006
+ * ({@link WorkflowEngine.signal}), so it is buffered for the next wait on that token instead of
9007
+ * being consumed.
9008
+ * - A signal buffered before the wait, or between registering and suspending, is taken here
9009
+ * ({@link takeOldestBuffered}); if that take then loses the compare-and-set, it goes back into the
9010
+ * buffer.
9011
+ * - The winner removes the other conditions' waiters. A losing timer is simply never fired (the run's
9012
+ * wake time moves on with its next wait). A losing child keeps running: its completion is buffered
9013
+ * as for any child nobody waits on, so a later `ctx.child(..., id)` still joins it.
9014
+ */
9015
+ /** The `parallelGroup` that marks a signal waiter as one condition of a `waitForAny`. */
9016
+ declare const ANY_WAIT_GROUP = "$any";
9017
+ /** The checkpoint name of the wait called `name`. */
9018
+ declare function anyCheckpointName(name: string): string;
9019
+ /** Whether `cp` is a `waitForAny` checkpoint. */
9020
+ declare function isAnyCheckpoint(cp: StepCheckpoint): boolean;
9021
+ /** Whether `waiter` is one condition of a `waitForAny`. */
9022
+ declare function isAnyMember(waiter: SignalWaiter): boolean;
9023
+
8527
9024
  /**
8528
9025
  * A non-durable, in-process `StateStore` for tests and local development.
8529
9026
  * The shipped `@dudousxd/nestjs-durable-store` package re-exports an equivalent.
@@ -8574,6 +9071,16 @@ declare class InMemoryStateStore implements StateStore {
8574
9071
  saveCheckpointIfPending(checkpoint: StepCheckpoint): Promise<boolean>;
8575
9072
  saveCheckpointsIfPending(checkpoints: StepCheckpoint[]): Promise<boolean[]>;
8576
9073
  settleCheckpointsIfPending(settlements: StepSettlement[]): Promise<boolean[]>;
9074
+ readonly settleResultsIfPending?: (results: StepResultSettlement[]) => Promise<(StepCheckpoint | null)[]>;
9075
+ readonly insertCheckpointIfAbsent?: (checkpoint: StepCheckpoint) => Promise<boolean>;
9076
+ readonly tryLockRunAndGet?: (runId: string, owner: string, leaseUntilMs: number, nowMs: number) => Promise<WorkflowRun | null>;
9077
+ readonly claimPendingRuns?: (limit: number, owner: string, leaseUntilMs: number, nowMs: number, namespace?: string) => Promise<WorkflowRun[]>;
9078
+ constructor(opts?: {
9079
+ roundTripMethods?: boolean;
9080
+ });
9081
+ private settleResultsFallback;
9082
+ private insertIfAbsentFallback;
9083
+ private lockAndGetFallback;
8577
9084
  listOrphanedRuns(nowMs: number, limit: number, namespace?: string, ownedBy?: OwnedLeaseReclaim): Promise<WorkflowRun[]>;
8578
9085
  listIncompleteRuns(namespace?: string): Promise<WorkflowRun[]>;
8579
9086
  listPendingRuns(limit: number, namespace?: string): Promise<WorkflowRun[]>;
@@ -8599,6 +9106,15 @@ declare class InMemoryStateStore implements StateStore {
8599
9106
  takeBufferedSignal(token: string): Promise<{
8600
9107
  payload: unknown;
8601
9108
  } | null>;
9109
+ takeOldestBufferedSignal(tokens: string[]): Promise<{
9110
+ token: string;
9111
+ payload: unknown;
9112
+ } | null>;
9113
+ /** `token \u0000 id -> expiresAt` of the signal ids {@link claimSignalId} recorded. */
9114
+ private readonly signalIds;
9115
+ claimSignalId(token: string, id: string, expiresAt: number, nowMs: number): Promise<boolean>;
9116
+ releaseSignalId(token: string, id: string): Promise<void>;
9117
+ deleteExpiredSignalIds(nowMs: number, limit: number): Promise<number>;
8602
9118
  listBufferedSignals(tokenPrefix: string, afterId: string | undefined, limit: number): Promise<BufferedSignalRow[]>;
8603
9119
  deleteBufferedSignals(ids: string[]): Promise<void>;
8604
9120
  /** `id -> row`, so {@link removeBufferedEvent} can delete an exact row regardless of iteration
@@ -8762,4 +9278,63 @@ declare function singletonAdmissionDenialPatch(runs: WorkflowRun[], runId: strin
8762
9278
  updatedAt: Date;
8763
9279
  } | undefined;
8764
9280
 
8765
- export { ACCUMULATOR_SEEN_MAX, type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AllOptions, type AllSettledOptions, type AllStepsOptions, type AllStepsSettledOptions, type AnnouncedWorkflow, type AnnouncementEvidence, type AttributeFilter, type AttributeOp, type AttributePredicateOperand, type AttributeValue, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, type BufferedSignalRow, CHILD_EDGE_PREFIXES, CONTROL_FLOW_SIGNAL, CORE_ORIGIN, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type CheckpointAggregatingStore, type CheckpointNameKind, type CheckpointQuery, type CheckpointStat, type ChildCallOptions, type ChildWait, CodecStateStore, type CodecStateStoreOptions, type ConcurrencyConfig, ConcurrencyLimitError, type ConcurrencyQuota, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_CONCURRENCY_STATUSES, DEFAULT_PARTITION, DEFAULT_STALLED_AFTER_MS, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type Disagreement, type DispatchDiagnostics, type DispatchPlan, type DurableExecution, type DurableExecutionWrapper, type DurableTopology, type DurableWebhook, DurableWorkflow, type DynamicWorkflowCtx, ENGINE_MINTED_TAG_PREFIXES, ENTITY_WORKFLOW, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, type EntityWorkflowHost, EventAccumulators, type EventBatchConfig, type EventSubscription, FAN_SUMMARY_FAILURES, type FanJoin, type FanPage, type FanPageQuery, type FanSummary, type FanWait, FatalError, type FindStalledRunsOptions, GatherError, type GatherItemFailure, type GroupHealth, HANDOFF_SEQ_BASE, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryRunQueue, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, LIFECYCLE_COALESCED_TAG_PREFIX, LIFECYCLE_HEAL_WINDOW_MS, LIFECYCLE_ORPHAN_MS, LIFECYCLE_OWED_TAG_PREFIX, LIFECYCLE_PENDING_TAG, LIFECYCLE_REGISTRY_HEARTBEAT_MS, LIFECYCLE_REGISTRY_STALE_MS, LIFECYCLE_REGISTRY_TAG, LIFECYCLE_REGISTRY_TTL_MS, LIFECYCLE_REGISTRY_WORKFLOW, LIFECYCLE_TRACE_TAG_PREFIX, LIFECYCLE_TRIGGERED_TAG_PREFIX, LIFECYCLE_TRIGGER_FAILED_TAG_PREFIX, type LifecycleDelivery, type LifecycleDeliveryState, type LifecycleEventOf, type LifecycleKind, type LifecycleRegistryEntry, type LifecycleSource, type LifecycleSubscriptionLink, type ListStalledRunsOptions, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NestedWorkflowCallError, NonDeterminismError, type OnErrorInput, type OnErrorRoute, type OnEventEntry, type OwnedLeaseReclaim, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, REMOTE_EVENT, RUN_HISTORY_FIXTURE_VERSION, RUN_VALUE_FACET_LIMIT, RUN_VALUE_FACET_SCAN, RUN_WAIT_TOKEN_PREFIX, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RepublishLifecycleResult, type RepublishLifecycleTarget, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAttributeRow, type RunConsumerOptions, type RunDetail, type RunDetailOptions, type RunDispatch, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunQueueOptions, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunScope, type RunStatus, type RunValueAxis, type RunValueFacetOptions, type RunValueFacetOrder, type RunValueFacetRow, type RunWaitLink, type RunWaiting, SINGLETON_ACTIVE_STATUSES, SINGLETON_ADMITTED_TAG, SINGLETON_LOCK_CHUNK, SINGLETON_RESERVED_TAGS, SINGLETON_TRACKED_TAG, STATE_STORE, STATE_STORE_CANONICAL, SUMMARY_CHILD_LIMIT, type ScalarAttributeFilter, ScheduleAlreadyExistsError, ScheduleClient, type ScheduleClientOptions, type ScheduleDescription, type ScheduleHost, type ScheduleListQuery, ScheduleNotFoundError, type ScheduleOptions, type ScheduleQuery, type ScheduleRecord, type ScheduledWorkflow, type SchemaIssue, type SchemaValidationCode, SchemaValidationError, type SearchAttributes, type SearchAttributesSchema, type Settled, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, type StalePendingStep, type StalledRunInfo, StandardSchemaV1, type StartOptions, type StartRunMessage, type StateStore, type StepCheckpoint, type StepConfig, type StepDef, type StepDispatchOpts, type StepError, type StepEvent, type StepHandler, type StepInterceptor, type StepInvocation, type StepKind, type StepLogger, type StepOptions, type StepRef, type StepResult, type StepScope, type StepSettlement, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type TenantTokenSource, type TenantVerifier, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, type VerifiedTenant, WORKFLOW_NAME_KEY, type WaitForRunOptions, type WireDates, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerDescriptor, type WorkerHeartbeat, type WorkerLifecycle, type WorkerStatus, type WorkflowAnnouncement, WorkflowBlocked, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, type WorkflowDirectory, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowHandler, type WorkflowInputOf, type WorkflowLifecycleEvent, type WorkflowLifecycleLinks, WorkflowNotRegistered, type WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, acceptingSubscription, accumulatorRunId, aggregateAnnouncements, aggregatesCheckpoints, announcementsOf, applyAttributeQuery, assertConcurrency, assertRoutes, attributeColumnFor, attributeOperand, attributePredicateOperands, axisIsRunColumn, bindWorkflowClass, breakpointToken, buildWorkflowDirectory, canRoute, capableWorkers, carriesLifecyclePending, checkpointNameKind, checkpointStatsOf, childIdsOf, classifyWaiterToken, clearDurableExecutionWrappers, clearTerminalSingletonAdmission, coalescedSubscribersOf, codeAndDetails, codeOf, collectMetrics, concurrencyTag, controlPlaneDescriptor, countRuns, coveredTokens, createStepLogger, currentStep, currentStepScope, currentWorkflowCtx, debug, describeWorker, descriptorHash, detailsOf, error, etagMatches, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, extendEtag, facetOrigin, fanPageBounds, fanPageEtag, findStalledRuns, foldedCount, getRunsByIds, handoffHandlerId, handoffName, hasDurableExecutionWrappers, heartbeatStatus, hmacTenantVerifier, indexWaitersByRun, info, isEngineMintedTag, isEventToken, isFailedMember, isLegacyDescriptor, isLifecycleTag, isNonEmptyRunScope, isRemoteEvent, isWorkflowControlFlowSignal, legacySingletonHolders, lifecycleDeliveriesOf, lifecycleEventName, lifecycleEventOf, lifecycleKindOf, lifecycleRegistryNamespace, lifecycleRegistryRunId, lifecycleRegistrySubscriptions, lifecycleRunId, lifecycleSourceOf, lifecycleTraceparentOf, listSignalWaitersOfRuns, liveHandoff, log, markRemoteEvent, matchesAttributes, mergeRunFacetRows, mergeRunValueFacetRows, missingCapabilities, negotiate, nextCronFireMs, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, onErrorRunId, owedSubscribersOf, pageFan, pageFanFromStore, parentRunIdOf, parseDuration, parseLifecycleEvent, parseWebhookToken, partitionOfToken, planDispatch, poolNamespace, prevCronFireMs, queryCheckpointsOf, readRunsByIds, readSearchAttributes, requiredCapabilities, resolveConcurrency, resolveRouting, resolveRunWaiting, resolveTenantToken, resolveWireTenant, retentionKeeps, retiredHandoffName, routeFor, runCompletedEvent, runDetailEtag, runDurableExecution, runFailedEvent, runInStepLogger, runInStepScope, runInWorkflowCtx, runOutsideWorkflowCtx, runSchedules, runStepHandler, runValueFacetsFromRuns, runWaitPrefix, runWaitTargetOf, runWaitToken, sanitizeQueueToken, scheduleRunIdAt, scheduledRunId, signTenantToken, singletonAdmissionDenialPatch, singletonAdmissionTags, singletonClaimantIds, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, summarizeFan, summarizeRunFromStore, summarizeTimeline, tenantGroup, toEventSubscription, traceIdOfTraceparent, triggerFailedSubscribersOf, triggeredRunsOf, triggeredSubscribersOf, useDurableExecution, warn, withSingletonTracked, withoutSingletonMarkers, workflowName };
9281
+ /**
9282
+ * RFC 5545 recurrence rules for persisted schedules (`engine.schedules.create({ rrule })`), evaluated
9283
+ * in an IANA time zone with no dependency.
9284
+ *
9285
+ * Accepted text: `FREQ=WEEKLY;BYDAY=MO;BYHOUR=8`, optionally prefixed `RRULE:`, optionally preceded by
9286
+ * a `DTSTART:20260105T080000` line (local time in the schedule's zone, or UTC with a trailing `Z`).
9287
+ *
9288
+ * Supported parts: `FREQ` (`YEARLY`, `MONTHLY`, `WEEKLY`, `DAILY`, `HOURLY`, `MINUTELY`), `INTERVAL`,
9289
+ * `COUNT`, `UNTIL`, `BYMONTH`, `BYMONTHDAY` (negative counts from the month's end), `BYDAY` (with an
9290
+ * ordinal such as `1MO` or `-1FR` under `MONTHLY`/`YEARLY`), `BYHOUR`, `BYMINUTE`, `BYSECOND`, `WKST`.
9291
+ * Anything else (`BYSETPOS`, `BYWEEKNO`, `BYYEARDAY`, `SECONDLY`) is refused by name rather than
9292
+ * ignored.
9293
+ *
9294
+ * Without `DTSTART` the rule is anchored at 1970-01-01T00:00 in the zone: give one when the rule
9295
+ * uses `INTERVAL` > 1 or `COUNT`, or relies on DTSTART's defaults (a `WEEKLY` rule without `BYDAY`
9296
+ * repeats DTSTART's weekday; a missing `BYHOUR`/`BYMINUTE`/`BYSECOND` takes DTSTART's).
9297
+ *
9298
+ * Local times that don't exist (the hour skipped when clocks go forward) are skipped, as RFC 5545
9299
+ * says; an ambiguous one (the hour repeated when they go back) fires once, at its first instant.
9300
+ */
9301
+ type Freq = 'YEARLY' | 'MONTHLY' | 'WEEKLY' | 'DAILY' | 'HOURLY' | 'MINUTELY';
9302
+ interface ByDay {
9303
+ weekday: number;
9304
+ nth?: number;
9305
+ }
9306
+ interface ParsedRRule {
9307
+ freq: Freq;
9308
+ interval: number;
9309
+ count?: number;
9310
+ /** Epoch ms, inclusive. */
9311
+ until?: number;
9312
+ byMonth?: number[];
9313
+ byMonthDay?: number[];
9314
+ byDay?: ByDay[];
9315
+ byHour?: number[];
9316
+ byMinute?: number[];
9317
+ bySecond?: number[];
9318
+ wkst: number;
9319
+ /** Epoch ms of DTSTART. */
9320
+ start: number;
9321
+ timezone: string;
9322
+ }
9323
+ /** Parse and validate a rule. Throws with the offending part named. */
9324
+ declare function parseRRule(text: string, timezone?: string): ParsedRRule;
9325
+ /** The first occurrence strictly after `afterMs`, or `null` when the rule has ended. */
9326
+ declare function nextRRuleFireMs(rule: ParsedRRule, afterMs: number): number | null;
9327
+ /** The latest occurrence at or before `atMs`, or `null` when there is none yet. */
9328
+ declare function prevRRuleFireMs(rule: ParsedRRule, atMs: number): number | null;
9329
+
9330
+ /**
9331
+ * {@link StateStore.settleResultsIfPending} built on a store's batched plain calls, for an adapter on
9332
+ * a database without `RETURNING` (MySQL) settling a batch of results: the batch's runs and rows are
9333
+ * read once each, the rows still `pending` of runs not finished are settled with
9334
+ * {@link StateStore.settleCheckpointsIfPending} (one batched, transactional call), and the rows it
9335
+ * settled are read back. A fixed number of statements however wide the batch, where settling each
9336
+ * result on its own would cost two per result.
9337
+ */
9338
+ declare function settleResultsWithPlainCalls(store: Pick<StateStore, 'getRun' | 'getCheckpoint'> & Partial<Pick<StateStore, 'getRuns' | 'getCheckpointsForSettle' | 'getCheckpoints' | 'settleCheckpointsIfPending'>>, results: StepResultSettlement[]): Promise<(StepCheckpoint | null)[]>;
9339
+
9340
+ export { ACCUMULATOR_SEEN_MAX, ANY_WAIT_GROUP, type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AllOptions, type AllSettledOptions, type AllStepsOptions, type AllStepsSettledOptions, type AnnouncedWorkflow, type AnnouncementEvidence, type AttributeFilter, type AttributeOp, type AttributePredicateOperand, type AttributeValue, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, type BufferedSignalRow, CHILD_EDGE_PREFIXES, CONTROL_FLOW_SIGNAL, CORE_ORIGIN, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type CheckpointAggregatingStore, type CheckpointNameKind, type CheckpointQuery, type CheckpointStat, type ChildCallOptions, type ChildWait, CodecStateStore, type CodecStateStoreOptions, type ConcurrencyConfig, ConcurrencyLimitError, type ConcurrencyQuota, type ConsoleCapabilities, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_CONCURRENCY_STATUSES, DEFAULT_PARTITION, DEFAULT_STALLED_AFTER_MS, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type Disagreement, type DispatchDiagnostics, type DispatchPlan, type DurableExecution, type DurableExecutionWrapper, type DurableTopology, type DurableWebhook, DurableWorkflow, type DynamicWorkflowCtx, ENGINE_MINTED_TAG_PREFIXES, ENTITY_WORKFLOW, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, type EntityWorkflowHost, EventAccumulators, type EventBatchConfig, type EventSubscription, FAN_SUMMARY_FAILURES, type FanJoin, type FanPage, type FanPageQuery, type FanSummary, type FanWait, FatalError, type FindStalledRunsOptions, GatherError, type GatherItemFailure, type GroupHealth, HANDOFF_SEQ_BASE, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryRunQueue, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, LIFECYCLE_COALESCED_TAG_PREFIX, LIFECYCLE_HEAL_WINDOW_MS, LIFECYCLE_ORPHAN_MS, LIFECYCLE_OWED_TAG_PREFIX, LIFECYCLE_PENDING_TAG, LIFECYCLE_REGISTRY_HEARTBEAT_MS, LIFECYCLE_REGISTRY_STALE_MS, LIFECYCLE_REGISTRY_TAG, LIFECYCLE_REGISTRY_TTL_MS, LIFECYCLE_REGISTRY_WORKFLOW, LIFECYCLE_TRACE_TAG_PREFIX, LIFECYCLE_TRIGGERED_TAG_PREFIX, LIFECYCLE_TRIGGER_FAILED_TAG_PREFIX, type LifecycleDelivery, type LifecycleDeliveryState, type LifecycleEventOf, type LifecycleKind, type LifecycleRegistryEntry, type LifecycleSource, type LifecycleSubscriptionLink, type ListStalledRunsOptions, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NestedWorkflowCallError, NonDeterminismError, type OnErrorInput, type OnErrorRoute, type OnEventEntry, type OwnedLeaseReclaim, PARENT_CLOSE_TAG_PREFIX, type ParentClosePolicy, type ParsedRRule, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, REMOTE_EVENT, RUN_HISTORY_FIXTURE_VERSION, RUN_VALUE_FACET_LIMIT, RUN_VALUE_FACET_SCAN, RUN_WAIT_TOKEN_PREFIX, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RepublishLifecycleResult, type RepublishLifecycleTarget, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAttributeRow, type RunConsumerOptions, type RunDetail, type RunDetailOptions, type RunDispatch, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunQueueOptions, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunScope, type RunStatus, type RunValueAxis, type RunValueFacetOptions, type RunValueFacetOrder, type RunValueFacetRow, type RunWaitLink, type RunWaiting, SINGLETON_ACTIVE_STATUSES, SINGLETON_ADMITTED_TAG, SINGLETON_LOCK_CHUNK, SINGLETON_RESERVED_TAGS, SINGLETON_TRACKED_TAG, STATE_STORE, STATE_STORE_CANONICAL, SUMMARY_CHILD_LIMIT, type ScalarAttributeFilter, ScheduleAlreadyExistsError, ScheduleClient, type ScheduleClientOptions, type ScheduleDescription, type ScheduleHost, type ScheduleListQuery, ScheduleNotFoundError, type ScheduleOptions, type ScheduleQuery, type ScheduleRecord, type ScheduledWorkflow, type SchemaIssue, type SchemaValidationCode, SchemaValidationError, type SearchAttributes, type SearchAttributesSchema, type Settled, type SignalOptions, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, type StalePendingStep, type StalledRunInfo, StandardSchemaV1, type StartOptions, type StartRunMessage, type StateStore, type StepCheckpoint, type StepConfig, type StepDef, type StepDispatchOpts, type StepError, type StepEvent, type StepHandler, type StepInterceptor, type StepInvocation, type StepKind, type StepLogger, type StepOptions, type StepRef, type StepResult, type StepResultSettlement, type StepScope, type StepSettlement, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type TenantTokenSource, type TenantVerifier, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, type VerifiedTenant, WORKFLOW_NAME_KEY, type WaitAnyCondition, type WaitAnyOutcome, type WaitAnyResult, type WaitCondition, type WaitConditionSpec, type WaitForRunOptions, type WireDates, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerDescriptor, type WorkerHeartbeat, type WorkerLifecycle, type WorkerStatus, type WorkflowAnnouncement, WorkflowBlocked, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, type WorkflowDirectory, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowHandler, type WorkflowInputOf, type WorkflowLifecycleEvent, type WorkflowLifecycleLinks, WorkflowNotRegistered, type WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, acceptingSubscription, accumulatorRunId, aggregateAnnouncements, aggregatesCheckpoints, announcementsOf, anyCheckpointName, applyAttributeQuery, assertConcurrency, assertRoutes, attributeColumnFor, attributeOperand, attributePredicateOperands, axisIsRunColumn, bindWorkflowClass, breakpointToken, buildWorkflowDirectory, canRoute, capableWorkers, carriesLifecyclePending, checkpointNameKind, checkpointStatsOf, childIdsOf, classifyWaiterToken, clearDurableExecutionWrappers, clearTerminalSingletonAdmission, coalescedSubscribersOf, codeAndDetails, codeOf, collectMetrics, concurrencyTag, controlPlaneDescriptor, countRuns, coveredTokens, createStepLogger, currentStep, currentStepScope, currentWorkflowCtx, debug, describeWorker, descriptorHash, detailsOf, error, etagMatches, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, extendEtag, facetOrigin, fanPageBounds, fanPageEtag, findStalledRuns, foldedCount, getRunsByIds, handoffHandlerId, handoffName, hasDurableExecutionWrappers, heartbeatStatus, hmacTenantVerifier, indexWaitersByRun, info, isAnyCheckpoint, isAnyMember, isEngineMintedTag, isEventToken, isFailedMember, isLegacyDescriptor, isLifecycleTag, isNonEmptyRunScope, isRemoteEvent, isWorkflowControlFlowSignal, legacySingletonHolders, lifecycleDeliveriesOf, lifecycleEventName, lifecycleEventOf, lifecycleKindOf, lifecycleRegistryNamespace, lifecycleRegistryRunId, lifecycleRegistrySubscriptions, lifecycleRunId, lifecycleSourceOf, lifecycleTraceparentOf, listSignalWaitersOfRuns, liveHandoff, log, markRemoteEvent, matchesAttributes, mergeRunFacetRows, mergeRunValueFacetRows, missingCapabilities, negotiate, nextCronFireMs, nextRRuleFireMs, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, onErrorRunId, owedSubscribersOf, pageFan, pageFanFromStore, parentRunIdOf, parseDuration, parseLifecycleEvent, parseRRule, parseWebhookToken, partitionOfToken, planDispatch, poolNamespace, prevCronFireMs, prevRRuleFireMs, queryCheckpointsOf, readRunsByIds, readSearchAttributes, requiredCapabilities, resolveConcurrency, resolveRouting, resolveRunWaiting, resolveTenantToken, resolveWireTenant, retentionKeeps, retiredHandoffName, routeFor, runCompletedEvent, runDetailEtag, runDurableExecution, runFailedEvent, runInStepLogger, runInStepScope, runInWorkflowCtx, runOutsideWorkflowCtx, runSchedules, runStepHandler, runValueFacetsFromRuns, runWaitPrefix, runWaitTargetOf, runWaitToken, sanitizeQueueToken, scheduleRunIdAt, scheduledRunId, settleResultsWithPlainCalls, signTenantToken, singletonAdmissionDenialPatch, singletonAdmissionTags, singletonClaimantIds, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, summarizeFan, summarizeRunFromStore, summarizeTimeline, tenantGroup, toEventSubscription, traceIdOfTraceparent, triggerFailedSubscribersOf, triggeredRunsOf, triggeredSubscribersOf, useDurableExecution, warn, withSingletonTracked, withoutSingletonMarkers, workflowName };