@dudousxd/nestjs-durable-core 0.27.0 → 0.28.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.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.cjs +3923 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +2044 -0
  5. package/dist/index.d.ts +2044 -20
  6. package/dist/index.js +3857 -38
  7. package/dist/index.js.map +1 -1
  8. package/package.json +19 -5
  9. package/dist/backoff.d.ts +0 -5
  10. package/dist/backoff.d.ts.map +0 -1
  11. package/dist/backoff.js +0 -14
  12. package/dist/backoff.js.map +0 -1
  13. package/dist/checkpoints.d.ts +0 -17
  14. package/dist/checkpoints.d.ts.map +0 -1
  15. package/dist/checkpoints.js +0 -28
  16. package/dist/checkpoints.js.map +0 -1
  17. package/dist/codec-state-store.d.ts +0 -57
  18. package/dist/codec-state-store.d.ts.map +0 -1
  19. package/dist/codec-state-store.js +0 -111
  20. package/dist/codec-state-store.js.map +0 -1
  21. package/dist/completion.d.ts +0 -15
  22. package/dist/completion.d.ts.map +0 -1
  23. package/dist/completion.js +0 -13
  24. package/dist/completion.js.map +0 -1
  25. package/dist/duration.d.ts +0 -6
  26. package/dist/duration.d.ts.map +0 -1
  27. package/dist/duration.js +0 -42
  28. package/dist/duration.js.map +0 -1
  29. package/dist/engine.d.ts +0 -525
  30. package/dist/engine.d.ts.map +0 -1
  31. package/dist/engine.js +0 -1773
  32. package/dist/engine.js.map +0 -1
  33. package/dist/entities.d.ts +0 -44
  34. package/dist/entities.d.ts.map +0 -1
  35. package/dist/entities.js +0 -68
  36. package/dist/entities.js.map +0 -1
  37. package/dist/errors.d.ts +0 -56
  38. package/dist/errors.d.ts.map +0 -1
  39. package/dist/errors.js +0 -93
  40. package/dist/errors.js.map +0 -1
  41. package/dist/event-accumulators.d.ts +0 -39
  42. package/dist/event-accumulators.d.ts.map +0 -1
  43. package/dist/event-accumulators.js +0 -74
  44. package/dist/event-accumulators.js.map +0 -1
  45. package/dist/events.d.ts +0 -9
  46. package/dist/events.d.ts.map +0 -1
  47. package/dist/events.js +0 -41
  48. package/dist/events.js.map +0 -1
  49. package/dist/index.d.ts.map +0 -1
  50. package/dist/interfaces.d.ts +0 -830
  51. package/dist/interfaces.d.ts.map +0 -1
  52. package/dist/interfaces.js +0 -3
  53. package/dist/interfaces.js.map +0 -1
  54. package/dist/metrics.d.ts +0 -44
  55. package/dist/metrics.d.ts.map +0 -1
  56. package/dist/metrics.js +0 -76
  57. package/dist/metrics.js.map +0 -1
  58. package/dist/protocol.d.ts +0 -17
  59. package/dist/protocol.d.ts.map +0 -1
  60. package/dist/protocol.js +0 -53
  61. package/dist/protocol.js.map +0 -1
  62. package/dist/queue.d.ts +0 -48
  63. package/dist/queue.d.ts.map +0 -1
  64. package/dist/queue.js +0 -45
  65. package/dist/queue.js.map +0 -1
  66. package/dist/remote-step-factory.d.ts +0 -15
  67. package/dist/remote-step-factory.d.ts.map +0 -1
  68. package/dist/remote-step-factory.js +0 -15
  69. package/dist/remote-step-factory.js.map +0 -1
  70. package/dist/remote-workflow-executor.d.ts +0 -24
  71. package/dist/remote-workflow-executor.d.ts.map +0 -1
  72. package/dist/remote-workflow-executor.js +0 -73
  73. package/dist/remote-workflow-executor.js.map +0 -1
  74. package/dist/scheduler.d.ts +0 -42
  75. package/dist/scheduler.d.ts.map +0 -1
  76. package/dist/scheduler.js +0 -70
  77. package/dist/scheduler.js.map +0 -1
  78. package/dist/search-attributes.d.ts +0 -17
  79. package/dist/search-attributes.d.ts.map +0 -1
  80. package/dist/search-attributes.js +0 -47
  81. package/dist/search-attributes.js.map +0 -1
  82. package/dist/step-logger.d.ts +0 -9
  83. package/dist/step-logger.d.ts.map +0 -1
  84. package/dist/step-logger.js +0 -92
  85. package/dist/step-logger.js.map +0 -1
  86. package/dist/test-helpers.d.ts +0 -11
  87. package/dist/test-helpers.d.ts.map +0 -1
  88. package/dist/test-helpers.js +0 -15
  89. package/dist/test-helpers.js.map +0 -1
  90. package/dist/testing/in-memory-state-store.d.ts +0 -37
  91. package/dist/testing/in-memory-state-store.d.ts.map +0 -1
  92. package/dist/testing/in-memory-state-store.js +0 -134
  93. package/dist/testing/in-memory-state-store.js.map +0 -1
  94. package/dist/testing/in-memory-transport.d.ts +0 -25
  95. package/dist/testing/in-memory-transport.d.ts.map +0 -1
  96. package/dist/testing/in-memory-transport.js +0 -53
  97. package/dist/testing/in-memory-transport.js.map +0 -1
  98. package/dist/tokens.d.ts +0 -8
  99. package/dist/tokens.d.ts.map +0 -1
  100. package/dist/tokens.js +0 -11
  101. package/dist/tokens.js.map +0 -1
  102. package/dist/transport-pool.d.ts +0 -30
  103. package/dist/transport-pool.d.ts.map +0 -1
  104. package/dist/transport-pool.js +0 -86
  105. package/dist/transport-pool.js.map +0 -1
  106. package/dist/workflow-ctx.d.ts +0 -52
  107. package/dist/workflow-ctx.d.ts.map +0 -1
  108. package/dist/workflow-ctx.js +0 -432
  109. package/dist/workflow-ctx.js.map +0 -1
  110. package/dist/workflow-ref.d.ts +0 -34
  111. package/dist/workflow-ref.d.ts.map +0 -1
  112. package/dist/workflow-ref.js +0 -32
  113. package/dist/workflow-ref.js.map +0 -1
package/dist/engine.d.ts DELETED
@@ -1,525 +0,0 @@
1
- import { type EntityConfig } from './entities';
2
- import { type EventBatchConfig } from './event-accumulators';
3
- import type { ControlPlane, EngineListener, GroupHealth, NamedTransport, RunDispatcher, RunResult, SearchAttributes, StateStore, StepError, StepInterceptor, Transport, UpdateResult, UpdateValidator, WorkflowCtx, WorkflowExecutor, WorkflowRun } from './interfaces';
4
- import { type QueueConfig } from './queue';
5
- import { type WorkflowClass, type WorkflowInputOf, type WorkflowRef } from './workflow-ref';
6
- type WorkflowFn = (ctx: WorkflowCtx, input: unknown) => Promise<unknown>;
7
- /** Options for {@link WorkflowEngine.start}. */
8
- export interface StartOptions {
9
- /** Run-scoped tags, merged with the workflow's static `@Workflow({ tags })` onto the run. */
10
- tags?: string[];
11
- /** Typed, queryable run data stamped on the run (e.g. `{ amount: 200, tier: 'pro' }`). */
12
- searchAttributes?: SearchAttributes;
13
- }
14
- /**
15
- * Serialize runs of a workflow that share a key — a durable, FIFO mutex (e.g. one pipeline per base).
16
- * Excess runs are admitted in creation order, `limit` at a time; the rest wait (suspended) and retry
17
- * admission on a timer until a slot frees. Race-free on a consistent store (admission order is the
18
- * same `(createdAt, id)` view for every instance).
19
- */
20
- export interface SingletonConfig {
21
- /** Derive the serialization key from the workflow input. */
22
- key: (input: unknown) => string;
23
- /** Max concurrent runs sharing the key. Default 1 (a mutex). */
24
- limit?: number;
25
- }
26
- export interface WorkflowEngineDeps {
27
- store: StateStore;
28
- /** A single task transport. Shorthand for a one-entry `transports` pool (id `default`). */
29
- transport?: Transport;
30
- /**
31
- * An ordered pool of named transports. The engine dispatches on the first and fails over to the
32
- * next on a dispatch error; a step pins one via `ctx.call(step, input, { transport: id })`. Use
33
- * this instead of `transport` for failover / multi-broker setups.
34
- */
35
- transports?: NamedTransport[];
36
- /**
37
- * Cross-instance broadcast pub/sub for lifecycle events + cancellation (see {@link ControlPlane}).
38
- * Separate from the task `transport`; omit for a single-instance / local-only setup. A transport
39
- * that can also broadcast may be passed here as well.
40
- */
41
- controlPlane?: ControlPlane;
42
- /** Epoch-ms clock; injectable for tests. Defaults to `Date.now`. */
43
- clock?: () => number;
44
- /** Unique id for this engine instance, used for recovery leases. Defaults to a random id. */
45
- instanceId?: string;
46
- /** Recovery lease duration in ms — how long this instance owns a run it picked up. Default 30s. */
47
- leaseMs?: number;
48
- /**
49
- * Cap how many times crash-recovery may pick up the same still-`running` run before giving up and
50
- * moving it to the `dead` dead-letter state (a poison pill that crashes the process every boot).
51
- * Omit for unlimited (the default — recovery always retries).
52
- */
53
- maxRecoveryAttempts?: number;
54
- /**
55
- * Build the public callback URL for a `ctx.webhook()` token (e.g.
56
- * ``(t) => `https://api.example.com/durable/webhooks/${t}` ``). Populates
57
- * {@link DurableWebhook.url}. Omit if you build URLs yourself from the token.
58
- */
59
- webhookUrl?: (token: string) => string;
60
- /**
61
- * Provide the current W3C `traceparent` to stamp on each dispatched {@link RemoteTask}, so a
62
- * worker (including the Python SDK) continues the distributed trace. Keep core OTel-free: supply
63
- * `otelTraceparent` from `@dudousxd/nestjs-durable-otel`, or your own context reader. Omit to send none.
64
- */
65
- traceparent?: () => string | undefined;
66
- /**
67
- * Provide an opaque context carrier (tenant / user / correlation ids) to attach to each dispatched
68
- * {@link RemoteTask} as its `context`, so a worker (including the Python SDK) re-exposes it to the
69
- * step handler — cross-process propagation alongside the {@link traceparent}. Keep core dependency-free:
70
- * supply this from `@dudousxd/nestjs-context` or your own request-scoped reader. The engine never
71
- * inspects the returned object's shape. Omit to send none.
72
- *
73
- * Re-evaluated at each (re)dispatch — including a retry or a resume that the engine drives AFTER a
74
- * crash/scale-down, which runs OUTSIDE the originating request scope. On such a path this provider
75
- * may return empty or stale values (the request-scoped tenant/user is gone). Treat the carrier as
76
- * best-effort correlation/propagation metadata only — do NOT treat it as an authorization boundary.
77
- */
78
- context?: () => Record<string, unknown> | undefined;
79
- /**
80
- * Re-hydrate the originating context around a LOCAL step body, so a `@DurableStep` reader sees the
81
- * tenant / user / correlation ids that were live when the run was started — even on a path the
82
- * engine drives outside the originating request scope (a resume after crash/scale-down, a timer).
83
- * Given the carrier produced by {@link context} (may be empty/undefined) and the step body `fn`, it
84
- * runs `fn` with that context ambiently established (e.g. inside `@dudousxd/nestjs-context`'s ALS)
85
- * and returns its result. Keep core dependency-free: supply this from the nestjs wiring (which owns
86
- * nestjs-context) or your own ALS bridge. The handler signature is unchanged — re-hydration is
87
- * ambient. Default: passthrough (`(_, fn) => fn()`), so behavior is byte-identical when unset.
88
- */
89
- rehydrate?: <T>(carrier: Record<string, unknown> | undefined, fn: () => T) => T;
90
- /**
91
- * Attempts for each saga compensation when the run fails (a transient undo — e.g. a refund API
92
- * hiccup — gets another try). Default 1 (no retry). Compensations must be idempotent.
93
- */
94
- compensationRetries?: number;
95
- /**
96
- * Persist a `running` checkpoint when a local step's body begins, so an in-flight step shows up
97
- * in the dashboard (and a fresh page load / REST query) the moment it starts — not only once it
98
- * completes. The `step.started` lifecycle event is emitted either way (the live SSE view always
99
- * sees the start); this flag only controls the extra checkpoint write. Default `true`. Set
100
- * `false` on hot paths with many short local steps to halve their checkpoint writes — you keep
101
- * the live event but lose reload-survivable in-flight visibility.
102
- */
103
- trackStepStart?: boolean;
104
- /**
105
- * Where a freshly-`start`ed run executes (see {@link RunDispatcher}). Defaults to in-process: the
106
- * run executes on this instance asynchronously (a microtask), so `start` returns without blocking.
107
- * Pass a no-op dispatcher on a caller that must NOT run workflows (e.g. an API/dashboard pod), and
108
- * run `runPending` on a worker pod to pick those up; or a broker-backed one for a worker pool.
109
- */
110
- runDispatcher?: RunDispatcher;
111
- }
112
- /**
113
- * The orchestrator. Owns workflow state and replays runs deterministically: each step's
114
- * result is checkpointed, so on resume a completed step returns its saved output instead of
115
- * re-executing. Remote steps are dispatched over the Transport; their results checkpoint the
116
- * same way local steps do.
117
- */
118
- export declare class WorkflowEngine {
119
- private readonly store;
120
- /** Ordered transport pool (dispatch + failover). Empty = no remote steps. */
121
- private readonly pool;
122
- private readonly controlPlane?;
123
- private readonly clock;
124
- private readonly instanceId;
125
- private readonly leaseMs;
126
- private readonly maxRecoveryAttempts?;
127
- private readonly webhookUrl?;
128
- private readonly traceparent?;
129
- private readonly context?;
130
- /** Establish the originating context ambiently around a local step body (see {@link WorkflowEngineDeps.rehydrate}). Default passthrough. */
131
- private readonly rehydrate;
132
- private readonly compensationRetries;
133
- /** Persist a `running` checkpoint at the start of a local step body (see {@link WorkflowEngineDeps.trackStepStart}). */
134
- private readonly trackStepStart;
135
- /** Where a freshly-started run executes — in-process by default (see {@link RunDispatcher}). */
136
- private readonly runDispatcher;
137
- /** Every registered workflow, keyed by `name@version` — so old versions stay runnable. */
138
- private readonly workflows;
139
- /** The newest registered version per workflow name — used to `start` new runs. */
140
- private readonly latest;
141
- /** Event name → workflow names started when that event is published (see `onEvent`). */
142
- private readonly eventTriggers;
143
- /** Durable-entity subsystem (registers the `__entity` runner; see `registerEntity`). */
144
- private readonly entities;
145
- /** Event debounce/batch accumulators (register the `__evt_*` runners; see `accumulators.route`). */
146
- private readonly accumulators;
147
- /** In-flight remote steps awaiting a worker result, keyed by stepId. */
148
- private readonly pending;
149
- /** Per-step "reset the liveness timer" callbacks, called when a heartbeat arrives. */
150
- private readonly heartbeatResets;
151
- private readonly listeners;
152
- /** Step interceptors (onion middleware around real local-step execution), first = outermost. */
153
- private readonly interceptors;
154
- /** Callbacks notified (on any instance) when a run is cancelled — for cooperative cancellation. */
155
- private readonly cancelListeners;
156
- /** Callbacks notified when a run is enqueued elsewhere — for low-latency cross-pod dispatch. */
157
- private readonly enqueuedListeners;
158
- /** Notified when a run is dead-lettered (moved to `dead`) — a hook for a DLQ handler. */
159
- private readonly deadListeners;
160
- /** Validators gating `engine.update`, keyed by `<workflow>:<updateName>`. */
161
- private readonly updateValidators;
162
- /** Runs being cancelled WITH saga compensation — see `cancel({ compensate: true })`. */
163
- private readonly cancelRequested;
164
- /** Flow-control queues for remote steps, keyed by name (see {@link registerQueue}). */
165
- private readonly queues;
166
- /** Which queue a dispatched step took a slot from, by stepId — so the result can release it. */
167
- private readonly stepQueue;
168
- /** Executions currently in flight, so a graceful shutdown can wait for them to settle. */
169
- private readonly inflight;
170
- private draining;
171
- constructor(deps: WorkflowEngineDeps);
172
- /**
173
- * Register a **durable entity** (a virtual object): a keyed actor whose `handlers` run **serialized
174
- * per key** over **durable state**, exactly once. Drive it with `signalEntity` (fire) /
175
- * `ctx.callEntity` (call + await result) and read its state with `getEntityState`. See {@link Entities}.
176
- */
177
- registerEntity<S>(name: string, config: EntityConfig<S>): void;
178
- /** Send an operation to an entity (fire-and-forget). Ordered + exactly-once per key. */
179
- signalEntity(name: string, key: string, op: string, arg?: unknown): Promise<void>;
180
- /** Read an entity's current durable state (published after each op), or undefined if it has none yet. */
181
- getEntityState<S = unknown>(name: string, key: string): Promise<S | undefined>;
182
- /**
183
- * Be notified when a run is enqueued on ANOTHER instance (via the control plane), so a worker can
184
- * pick it up at once — e.g. `engine.onEnqueued((runId) => engine.runOne(runId))`. Returns an
185
- * unsubscribe function. Only wire this on instances that should execute runs (workers).
186
- */
187
- onEnqueued(listener: (runId: string) => void): () => void;
188
- /** Fire cooperative-cancellation listeners for `runId` (a worker bridge aborts in-flight work). */
189
- private notifyCancelled;
190
- /**
191
- * Register a workflow version. Register multiple versions of the same name to keep in-flight
192
- * runs working across a breaking change: old runs resume on the version they started on, new
193
- * runs start on the newest registered version.
194
- */
195
- register(name: string, version: string, fn: WorkflowFn, opts?: {
196
- tags?: string[];
197
- singleton?: SingletonConfig;
198
- executionTimeout?: string | number;
199
- validateInput?: (input: unknown) => void | Promise<void>;
200
- onEvent?: string[];
201
- eventBatch?: EventBatchConfig;
202
- }): void;
203
- /**
204
- * Register a workflow whose body runs in another SDK (e.g. Python). The engine owns the run exactly
205
- * as for a TS workflow — it persists checkpoints, recovers, runs timers — but advances it by handing
206
- * the run's history to `executor` (which dispatches a {@link WorkflowTask} to the worker) and applying
207
- * the {@link WorkflowDecision} the worker's replay returns. The worker never touches the store.
208
- */
209
- registerRemote(name: string, version: string, opts: {
210
- group: string;
211
- executor: WorkflowExecutor;
212
- tags?: string[];
213
- singleton?: SingletonConfig;
214
- executionTimeout?: string | number;
215
- validateInput?: (input: unknown) => void | Promise<void>;
216
- }): void;
217
- /**
218
- * Register a flow-control queue referenced by `ctx.call(step, input, { queue })`. Caps concurrent
219
- * in-flight steps and/or the admission rate; blocked calls re-suspend and retry, so the limit is
220
- * durable. Per engine instance (see {@link QueueConfig}). Registering the same name replaces it.
221
- */
222
- registerQueue(config: QueueConfig): void;
223
- /** Subscribe to lifecycle events. Returns an unsubscribe function. */
224
- subscribe(listener: EngineListener): () => void;
225
- /**
226
- * Register a {@link StepInterceptor} — onion middleware run around the real execution of every
227
- * local `ctx.step` (timing, logging, tracing, error enrichment, context propagation). First
228
- * registered is outermost; interceptors fire only when a step executes, never on replay. Returns
229
- * an unsubscribe function.
230
- */
231
- use(interceptor: StepInterceptor): () => void;
232
- /**
233
- * Fold the registered interceptors around a local step body (identity when there are none), then
234
- * run the whole thing inside the re-hydrated originating context. The carrier is read at execution
235
- * time from {@link context} — the SAME reader stamped on dispatched remote tasks — so a local step
236
- * sees the live tenant / user / trace ids ambiently (via the {@link rehydrate} bridge). Default
237
- * `rehydrate` is a passthrough, so this is byte-identical to a bare body call when unwired.
238
- */
239
- private interceptStep;
240
- /**
241
- * Be notified when a run is cancelled — on ANY instance, via the transport control plane. A
242
- * worker bridge can use this for cooperative cancellation: abort the in-flight work for `runId`
243
- * instead of finishing it just to have the result discarded. Returns an unsubscribe function.
244
- */
245
- onCancel(listener: (runId: string) => void): () => void;
246
- /**
247
- * Be notified when a run is **dead-lettered** — moved to `dead` after exceeding
248
- * `maxRecoveryAttempts`. The listener receives the dead run (status `dead`, with its error), so a
249
- * DLQ handler can do something other than just leaving it parked: alert, push to a real queue, or
250
- * start a dead-letter workflow (e.g. `engine.onDead((run) => engine.start('pipeline-dlq', run, ...))`).
251
- * Returns an unsubscribe function.
252
- */
253
- onDead(listener: (run: WorkflowRun) => void): () => void;
254
- private notifyDead;
255
- /** Emit a locally-produced lifecycle event: deliver to subscribers AND broadcast it on the
256
- * control plane so other instances (e.g. a dashboard pod) can live-tail this run. */
257
- private emit;
258
- /** Deliver an event to local subscribers only (no re-broadcast) — used for both locally-produced
259
- * events and ones received from the control plane, so an event shows up once on every instance. */
260
- private deliver;
261
- start<C extends WorkflowClass>(workflow: C, input: WorkflowInputOf<C>, runId: string, opts?: StartOptions): Promise<RunResult>;
262
- start<TInput>(workflow: string, input: TInput, runId: string, opts?: StartOptions): Promise<RunResult>;
263
- /** Read a run's current persisted state (or null if unknown). A thin pass-through to the store. */
264
- getRun(runId: string): Promise<WorkflowRun | null>;
265
- resume(runId: string): Promise<RunResult>;
266
- /** Track an in-flight execution so {@link drain} can wait for it. */
267
- private track;
268
- /**
269
- * Graceful shutdown: stop picking up new runs (recovery/timer become no-ops) and wait for
270
- * in-flight executions to settle, up to `timeoutMs`. Call from your app's shutdown hook so a
271
- * deploy hands off cleanly instead of leaving runs to the lease timeout.
272
- */
273
- drain(timeoutMs?: number): Promise<void>;
274
- /**
275
- * Cancel in-flight runs that have outlived their workflow's `executionTimeout`. Call it from the
276
- * timer poller alongside {@link resumeDueTimers}. A timed-out run is moved to `cancelled` with an
277
- * `execution_timeout` error (terminal, so a late step result can't resurrect it).
278
- */
279
- sweepTimeouts(now?: number): Promise<void>;
280
- /**
281
- * Resume every run left incomplete by a crash or deploy. Called on boot. Completed steps
282
- * replay from their checkpoints, so only the work that had not finished runs again.
283
- */
284
- recoverIncomplete(nowMs?: number): Promise<RunResult[]>;
285
- /**
286
- * Per-recovery bookkeeping (called once the lease is held): count the attempt, or — past
287
- * `maxRecoveryAttempts` — move a poison pill to the `dead` dead-letter state. Returns a terminal
288
- * result to skip the resume, or `undefined` to proceed.
289
- */
290
- private countRecovery;
291
- /**
292
- * Resume every suspended run whose durable timer is due. Call periodically (a poller) and on
293
- * boot. A run still not due re-suspends cheaply without running new work.
294
- */
295
- resumeDueTimers(nowMs?: number): Promise<RunResult[]>;
296
- /**
297
- * Lease and execute one run by id — the worker side of dispatch. Acquires the recovery lease (so
298
- * exactly one instance runs it), then resumes the body. Returns the result, or null if another
299
- * instance holds the lease or the engine is draining. The default in-process dispatcher calls this;
300
- * a broker-backed worker calls it per consumed run id.
301
- */
302
- runOne(runId: string): Promise<RunResult | null>;
303
- /**
304
- * Re-enqueue a run for a worker to (re-)execute — the dispatch-model **retry**. Sets it back to
305
- * `pending`, clears any stale lease, and dispatches; a worker resumes it (replaying its checkpoints,
306
- * re-attempting the failed step). Returns the enqueued state immediately — never runs the body
307
- * inline — or null if the run is unknown. The dashboard "retry" goes through here so it can't block
308
- * the HTTP request on workflow execution.
309
- */
310
- requeue(runId: string): Promise<RunResult | null>;
311
- /**
312
- * **Fix-and-replay**: re-run a run (typically a `dead`/`failed` one) with a corrected `input`, as a
313
- * fresh run with clean history. It's a NEW run — `newRunId` defaults to `<runId>~retry~<uuid>` — so
314
- * the original stays inspectable. Returns the new run's id, or null if `runId` is unknown.
315
- */
316
- retryWithInput(runId: string, input: unknown, newRunId?: string): Promise<{
317
- runId: string;
318
- } | null>;
319
- /**
320
- * Pick up and execute every `pending` run — the poll-based side of dispatch for a worker pod with
321
- * no broker. Runs enqueued by other pods (or by a caller using a no-op dispatcher) sit `pending`
322
- * in the store until polled; leasing ensures exactly one pod runs each. Call periodically alongside
323
- * {@link resumeDueTimers}.
324
- */
325
- runPending(nowMs?: number): Promise<RunResult[]>;
326
- /**
327
- * Resolve once `runId` reaches a settled state — terminal (completed/failed/cancelled/dead) or
328
- * suspended (handed off to a timer/signal/event). The async counterpart to dispatch: pair it with
329
- * `start` when a call site needs the outcome — `await start(...); const r = await waitForRun(id)`.
330
- */
331
- waitForRun(runId: string, opts?: {
332
- timeoutMs?: number;
333
- }): Promise<RunResult>;
334
- /**
335
- * Resume each run only if this instance can acquire its recovery lease — so when several
336
- * replicas recover or poll at once, each run is picked up by exactly one of them.
337
- */
338
- private resumeLeased;
339
- /**
340
- * Deliver an external signal to the run waiting on `token` and resume it with `payload`.
341
- * Returns the run result, or null if no run is waiting for that token.
342
- */
343
- /**
344
- * Publish a named event. It does two things, and returns how many runs it touched (the sum):
345
- * 1. **Resumes** every in-flight run waiting on it via `ctx.waitForEvent(name, { match })` whose
346
- * match the payload satisfies (fan-out, vs `signal`'s point-to-point token).
347
- * 2. **Starts** a fresh run of every workflow registered with `onEvent: [name]`, passing the
348
- * payload as input. Idempotent by `evt:<id>:<workflow>` — pass `opts.id` to dedupe redeliveries
349
- * of the same logical event (default: a fresh uuid, so each publish triggers once).
350
- */
351
- publishEvent(name: string, payload: unknown, opts?: {
352
- id?: string;
353
- }): Promise<number>;
354
- signal(token: string, payload: unknown): Promise<RunResult | null>;
355
- /**
356
- * Ensure a run exists for `runId`, then deliver a signal to it — atomically race-free thanks to
357
- * signal buffering: if the run is new (or busy / not yet waiting), the signal is buffered and
358
- * consumed when it reaches `waitForSignal(token)`. The canonical **durable-entity / accumulator**
359
- * pattern: one long-lived run per key (the `runId`) that loops on `waitForSignal`, fed events by
360
- * many `signalWithStart` calls. `start` is idempotent by `runId`, so concurrent callers converge on
361
- * one run. (Use a per-run `token`, e.g. derived from `runId`, so the signal targets this entity.)
362
- */
363
- signalWithStart(workflow: WorkflowRef, input: unknown, runId: string, signal: {
364
- token: string;
365
- payload?: unknown;
366
- }, opts?: StartOptions): Promise<{
367
- runId: string;
368
- }>;
369
- /**
370
- * Report the result of a `ctx.task(name, …)` back to its run (async completion). The external
371
- * worker that the task dispatched to calls this when done; the run resumes with `result`. Returns
372
- * null if no run is waiting on the task (e.g. a duplicate/late delivery) — a safe no-op.
373
- */
374
- completeTask(runId: string, name: string, result: unknown): Promise<RunResult | null>;
375
- /** Report that a `ctx.task` failed — the run resumes and throws a FatalError at the task. */
376
- failTask(runId: string, name: string, error: string): Promise<RunResult | null>;
377
- /**
378
- * Notify a parent that's waiting on `runId` as a child of its terminal outcome (the `ctx.child`
379
- * rendezvous). A no-op when no parent is waiting, so `execute()` can call it on every run without
380
- * knowing about the child feature.
381
- */
382
- private notifyParent;
383
- /**
384
- * Cancel a run (e.g. from the dashboard). Returns null if the run does not exist. Pass
385
- * `{ compensate: true }` to undo the saga first: the suspended run is resumed so its completed
386
- * steps' compensations run in reverse (visible as `compensate:<step>` events), then it's marked
387
- * cancelled. Without it, cancellation is immediate (no undo).
388
- */
389
- cancel(runId: string, opts?: {
390
- compensate?: boolean;
391
- }): Promise<RunResult | null>;
392
- /**
393
- * Cascade cancellation to a run's children — both awaited (`ctx.child`, found via its live
394
- * `child:<id>` waiter) and fire-and-forget (`ctx.startChild`, found via its `spawn:<id>`
395
- * checkpoint). Recursive, so a whole subtree is cancelled; the terminal guard in `cancel` stops it
396
- * at finished / already-cancelled runs (no loops, no re-cancel).
397
- */
398
- private cancelChildren;
399
- /**
400
- * The ids of the runs a run spawned — both awaited (`ctx.child`) and fire-and-forget
401
- * (`ctx.startChild`, found via its `spawn:<id>` checkpoint). The canonical parent→children edge,
402
- * used for both cancellation cascades and the dashboard run-tree.
403
- *
404
- * An awaited child is discovered two ways, because the live `child:<id>` waiter only exists WHILE
405
- * the parent is suspended on it: the waiter resolves and is consumed the moment the child settles,
406
- * so a completed parent (or a completed awaited child) would otherwise drop out of the tree. The
407
- * `signal:child:<id>` checkpoint (the placeholder written when the parent first awaits the child,
408
- * overwritten as completed/failed when it settles) persists across completion, so we read both and
409
- * dedupe — the edge stays stable for a finished run, not just a live one.
410
- */
411
- getRunChildren(parentRunId: string): Promise<string[]>;
412
- /** The worker groups this engine dispatches to: every registered remote workflow's group, plus any
413
- * `extra` the caller declares. Local-step groups (a group consumed by in-process `@DurableStep`
414
- * workers, e.g. `pipeline`) aren't derivable from registrations — pass them via `extra` so a group
415
- * with backlog and ZERO workers is still reported (the alert case has no heartbeat to discover). */
416
- knownGroups(extra?: string[]): string[];
417
- /** Per-group worker health (queue backlog + live worker heartbeats). Covers {@link knownGroups}
418
- * (so a registered group with backlog and ZERO workers still reports — the alert case) UNION the
419
- * groups discovered from live heartbeats (so a local-step group like `pipeline`, not derivable
420
- * from registrations, shows once its workers beat). Empty when no transport can introspect health
421
- * (only the BullMQ transport implements `groupHealth`). */
422
- workerHealth(extra?: string[]): Promise<GroupHealth[]>;
423
- /**
424
- * Persist a streamed local-step lifecycle event from a remote workflow worker (see
425
- * {@link WorkflowStepEvent}). A Python `@workflow` runs its `ctx.step`s inline over one turn that
426
- * can last minutes; the worker streams each step's start/finish so the engine checkpoints it LIVE —
427
- * a step shows `running` the moment its body begins, then resolves to `completed`/`failed` with its
428
- * real wall-clock window and sub-process events — instead of every step appearing at once when the
429
- * turn ends. The turn's final `recordStep` command re-persists the same (runId, seq) checkpoint
430
- * idempotently, so this is purely additive observability and never changes the run's outcome.
431
- */
432
- private persistStepEvent;
433
- /**
434
- * Announce a local step's body has begun and (when `trackStepStart`) checkpoint it as `running`,
435
- * so it's visible in flight rather than appearing only on completion. The checkpoint is a
436
- * placeholder overwritten by {@link completeStep}/{@link failStep}; it never short-circuits replay
437
- * (only `completed` does), so a crash mid-body just re-runs the step. The `step.started` event
438
- * fires regardless — the live SSE view sees the start even with persistence off.
439
- */
440
- private startStep;
441
- /** Checkpoint a finished step and announce it — the two things that must always happen together. */
442
- private completeStep;
443
- /** Checkpoint a step that failed terminally, so the failure point is visible (not just the run). */
444
- private failStep;
445
- /**
446
- * Whether `run` may run now under its singleton key: it's among the `limit` oldest in-flight runs
447
- * (running or suspended) sharing the key, by `(createdAt, id)` order. A consistent store gives every
448
- * instance the same ordering, so admission is race-free + FIFO.
449
- */
450
- private admitSingleton;
451
- private execute;
452
- /**
453
- * Advance a remote (cross-SDK) workflow one turn: hand its history to the executor (which dispatches
454
- * a workflow task to the worker and awaits its replay) and apply the decision. Mirrors
455
- * {@link runExecution}'s settle/suspend; the lease is held by {@link execute}. The result that lands
456
- * us back here (a remote step finished, a timer fired) goes through `resume` like any TS workflow.
457
- */
458
- private runRemoteExecution;
459
- /** The run's resolved durable ops as replay inputs: completed/failed steps + elapsed timers. */
460
- private remoteHistory;
461
- /** Apply a turn's commands: persist recorded local steps, dispatch remote calls, schedule timers.
462
- * Returns the earliest timer deadline to suspend on (or undefined — suspended on a result). */
463
- private applyCommands;
464
- /** The run body, lease held + renewed by {@link execute}. */
465
- private runExecution;
466
- /**
467
- * Run one saga compensation, retried up to `compensationRetries`, emitting a `compensate:<step>`
468
- * step event for its outcome so a stranded undo is visible. Never throws — a permanently-failing
469
- * compensation is skipped so it can't mask the original failure.
470
- */
471
- private runCompensation;
472
- /** The seam handed to {@link createWorkflowCtx}: the authoring API reaches durability + lifecycle
473
- * (checkpointing, dispatch, child start) through this, so the ctx primitives live in their own
474
- * module and the engine stays the orchestrator. */
475
- private get ctxHost();
476
- /**
477
- * Resume a run paused at a {@link WorkflowCtx.breakpoint} (e.g. the dashboard "continue" button).
478
- * Finds the run's pending breakpoint checkpoint and signals it. Returns null if the run isn't
479
- * paused at a breakpoint.
480
- */
481
- continue(runId: string): Promise<RunResult | null>;
482
- /**
483
- * Read the latest value a run published for `key` via {@link WorkflowCtx.setEvent} — a
484
- * side-effect-free query of a live (or finished) run's state. Returns `undefined` if the run
485
- * never published that key. The suspend-model counterpart of a Temporal query.
486
- */
487
- getEvent<TValue = unknown>(runId: string, key: string): Promise<TValue | undefined>;
488
- /**
489
- * Register a validator gating `engine.update(runId, name, …)` for runs of `workflow`. The
490
- * validator runs BEFORE the update is delivered, so a rejection leaves the run untouched. One
491
- * validator per (workflow, update name); registering again replaces it.
492
- */
493
- registerUpdateValidator<TArg>(workflow: string, name: string, validate: UpdateValidator<TArg>): void;
494
- /**
495
- * Deliver a validated update to the run waiting at `ctx.onUpdate(name)`. Runs the registered
496
- * validator (if any) first: on rejection returns `{ accepted: false, reason }` without disturbing
497
- * the run; otherwise delivers `arg` and resumes, returning `{ accepted: true, run }` (`run` is null
498
- * if nothing was waiting — a too-early or duplicate update).
499
- */
500
- update(runId: string, name: string, arg: unknown): Promise<UpdateResult>;
501
- private callRemote;
502
- /**
503
- * Complete a durable remote step from its worker result and resume the run — runs on whichever
504
- * instance receives the result (the dispatching one may be gone), so the run is crash/scale-safe.
505
- * A no-op if the checkpoint isn't `pending` (a duplicate or late delivery).
506
- */
507
- private completeRemoteResult;
508
- /** Release the flow-control slot a dispatched step held (if any), by its stepId. */
509
- private releaseQueueSlot;
510
- /** In-memory await path for a remote step with a liveness `timeoutMs` (re-dispatch on timeout). */
511
- private callRemoteInMemory;
512
- /**
513
- * Await a remote result, but reject with `RemoteStepTimeout` if neither the result nor a heartbeat
514
- * arrives within `timeoutMs`. Each heartbeat (delivered via `transport.onHeartbeat`) rearms the
515
- * window, so a worker that keeps beating stays alive past `timeoutMs`.
516
- */
517
- private awaitWithHeartbeat;
518
- }
519
- /** Raised inside the workflow when a remote worker reports a step failure. */
520
- export declare class RemoteStepError extends Error {
521
- readonly stepError?: StepError;
522
- constructor(stepError?: StepError);
523
- }
524
- export {};
525
- //# sourceMappingURL=engine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AASzD,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,KAAK,EACV,YAAY,EAEZ,cAAc,EACd,WAAW,EACX,cAAc,EAGd,aAAa,EACb,SAAS,EAET,gBAAgB,EAChB,UAAU,EACV,SAAS,EAET,eAAe,EAIf,SAAS,EACT,YAAY,EACZ,eAAe,EAEf,WAAW,EAEX,gBAAgB,EAChB,WAAW,EAEZ,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,SAAS,CAAC;AAQ5D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AAExB,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEzE,gDAAgD;AAChD,MAAM,WAAW,YAAY;IAC3B,6FAA6F;IAC7F,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,0FAA0F;IAC1F,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;IAChC,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAsED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,U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