@dudousxd/nestjs-durable-core 0.78.0 → 0.79.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.cts CHANGED
@@ -195,6 +195,16 @@ interface WorkflowRegistration {
195
195
  /** The package that DECLARED the workflow (see `WorkflowRun.origin`). Absent = unknown; nothing
196
196
  * ever substitutes a default, because a wrong origin is worse than no origin. */
197
197
  origin?: string;
198
+ /**
199
+ * Where the engine routes a failed run of this workflow, by error `code` (`code` absent = the
200
+ * catch-all): the handler workflow it starts instead of failing the run. The one announced field
201
+ * the engine ACTS on, for a workflow it serves by convention rather than by local registration.
202
+ * Absent = not stated, which routes nothing.
203
+ */
204
+ onError?: {
205
+ code?: string;
206
+ workflow: string;
207
+ }[];
198
208
  }
199
209
  /**
200
210
  * A worker's (or control-plane's) advertised identity, wire-protocol support, feature capabilities
@@ -509,16 +519,28 @@ interface FanPage {
509
519
  items: StepCheckpoint[];
510
520
  /** Members matching the query, across all pages. */
511
521
  total: number;
522
+ /** A validator for this page, when the gateway can compute one without reading the members. */
523
+ etag?: string | undefined;
524
+ /**
525
+ * Set when the query's `ifNoneMatch` matched {@link etag}: the page has not changed, so nothing
526
+ * was read. `items` is empty and `total` is 0 as placeholders, not the fan's; keep the page the
527
+ * caller already holds.
528
+ */
529
+ notModified?: true | undefined;
512
530
  }
513
531
  interface FanPageQuery {
514
532
  offset?: number | undefined;
515
533
  limit?: number | undefined;
516
534
  /** Only failed members (a failed step, or a child that failed). */
517
535
  failedOnly?: boolean | undefined;
536
+ /** An HTTP `If-None-Match` value: a page whose `etag` it names comes back `notModified`. */
537
+ ifNoneMatch?: string | undefined;
518
538
  }
519
539
  declare const FAN_SUMMARY_FAILURES = 20;
520
540
  /** The most children a summarized detail lists by id; `childCount` carries the rest. */
521
541
  declare const SUMMARY_CHILD_LIMIT = 200;
542
+ /** How many children a folded `fan:` checkpoint stands for; undefined for any other checkpoint. */
543
+ declare function foldedCount(cp: StepCheckpoint): number | undefined;
522
544
  /** A failed member: a failed step, or a child whose completion reports `ok: false`. */
523
545
  declare function isFailedMember(cp: StepCheckpoint): boolean;
524
546
  /** Summarize one fan's members (in seq order). */
@@ -534,6 +556,11 @@ declare function summarizeTimeline(timeline: StepCheckpoint[], over: number): {
534
556
  };
535
557
  /** One page of a fan's members out of a run's timeline. */
536
558
  declare function pageFan(timeline: StepCheckpoint[], group: string, query: FanPageQuery): FanPage;
559
+ /** A {@link FanPageQuery}'s offset and limit, clamped to sane bounds. */
560
+ declare function fanPageBounds(query: FanPageQuery): {
561
+ offset: number;
562
+ limit: number;
563
+ };
537
564
 
538
565
  /** A run as returned by the gateway's list — the durable run plus an optional {@link RunWaiting}
539
566
  * descriptor the control plane resolves (what a suspended run is parked on), so the dashboard can
@@ -566,6 +593,16 @@ interface RunDetail {
566
593
  fans?: FanSummary[] | undefined;
567
594
  /** How many children the run has, when `children` lists only the first of them. */
568
595
  childCount?: number | undefined;
596
+ /**
597
+ * A validator for this detail, when the gateway can compute one without reading the timeline:
598
+ * it changes whenever the run or any of its checkpoints does. Absent when it cannot.
599
+ */
600
+ etag?: string | undefined;
601
+ /**
602
+ * Set when {@link RunDetailOptions.ifNoneMatch} matched {@link etag}: nothing changed, so only
603
+ * `run` was read — `timeline` and `children` are empty, not the run's.
604
+ */
605
+ notModified?: true | undefined;
569
606
  }
570
607
  /** How to shape a {@link RunDetail}. */
571
608
  interface RunDetailOptions {
@@ -575,6 +612,11 @@ interface RunDetailOptions {
575
612
  * with a wide fan should set it: the full detail of a 40k-member fan is megabytes.
576
613
  */
577
614
  summarizeFansOver?: number | undefined;
615
+ /**
616
+ * An HTTP `If-None-Match` value. When it names the detail's current {@link RunDetail.etag}, the
617
+ * gateway answers `notModified` without reading the timeline. A gateway that cannot tell ignores it.
618
+ */
619
+ ifNoneMatch?: string | undefined;
578
620
  }
579
621
  /**
580
622
  * Maps every `Date` (and `Date | undefined`) field of `T` to its ISO-string wire form — the shape a
@@ -1101,6 +1143,9 @@ interface StepError {
1101
1143
  message: string;
1102
1144
  /** Optional machine-readable code, e.g. `declined`, `timeout`. */
1103
1145
  code?: string | undefined;
1146
+ /** Structured, JSON-serializable detail of the failure (e.g. validation issues), from
1147
+ * `FatalError`'s third argument or a `details` on what a step handler threw. */
1148
+ details?: unknown;
1104
1149
  /** Whether the engine should treat this as retryable. */
1105
1150
  retryable?: boolean | undefined;
1106
1151
  stack?: string | undefined;
@@ -1171,6 +1216,16 @@ interface StateStore {
1171
1216
  * Optional: a store that omits it falls back to {@link saveCheckpoint}, which keeps that race.
1172
1217
  */
1173
1218
  saveCheckpointIfPending?(checkpoint: StepCheckpoint): Promise<boolean>;
1219
+ /**
1220
+ * {@link saveCheckpointIfPending} for many checkpoints in one call: resolves, per entry and in
1221
+ * input order, whether it wrote. Same result as calling it on each entry in turn (a later entry for
1222
+ * the same `(runId, seq)` is compared against the earlier one's write), with each row's
1223
+ * compare-and-set still atomic. The call as a whole is atomic too: if it rejects, nothing was
1224
+ * written. The engine settles a batch of one run's step results through it, one call per batch.
1225
+ *
1226
+ * Optional: a store that omits it gets one {@link saveCheckpointIfPending} per entry.
1227
+ */
1228
+ saveCheckpointsIfPending?(checkpoints: StepCheckpoint[]): Promise<boolean[]>;
1174
1229
  /** Used by recovery on boot to find runs to resume (crashed, left `running`). */
1175
1230
  listIncompleteRuns(namespace?: string): Promise<WorkflowRun[]>;
1176
1231
  /** The oldest `pending` runs awaiting dispatch (FIFO, by `createdAt`), capped at `limit`. */
@@ -1380,6 +1435,72 @@ interface StateStore {
1380
1435
  * and counts in JS, which loads the whole run on every result of a fan.
1381
1436
  */
1382
1437
  countCheckpoints?(runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]): Promise<number>;
1438
+ /**
1439
+ * The run's checkpoints aggregated into {@link CheckpointStat} buckets — one per
1440
+ * `(parallelGroup, status, nameKind)` present — with `opts.group` narrowing it to one group. A
1441
+ * `GROUP BY`, not a load: it is what lets a run detail draw a 40,000-member fan from a few rows.
1442
+ * Ungrouped checkpoints come back under `group: null`. Bucket order is unspecified.
1443
+ *
1444
+ * Optional: a store that omits it still works — the console's run detail then loads every
1445
+ * checkpoint and summarizes it in JS (`summarizeTimeline`), which is the same answer read the
1446
+ * expensive way. A store that implements it must implement {@link queryCheckpoints} too.
1447
+ */
1448
+ checkpointStats?(runId: string, opts?: {
1449
+ group?: string | undefined;
1450
+ }): Promise<CheckpointStat[]>;
1451
+ /**
1452
+ * The run's checkpoints that match `query`, in `seq` order (the order of {@link listCheckpoints}),
1453
+ * paged by `offset`/`limit`. Every filter is optional; an absent one does not narrow. An EMPTY
1454
+ * `statuses` or `namePrefixes` matches nothing; an empty `excludeGroups` excludes nothing.
1455
+ *
1456
+ * Optional, paired with {@link checkpointStats}: the run detail reads a fan's failures, its folded
1457
+ * checkpoints and one page of its members through it, instead of the run's whole history.
1458
+ */
1459
+ queryCheckpoints?(runId: string, query: CheckpointQuery): Promise<StepCheckpoint[]>;
1460
+ }
1461
+ /**
1462
+ * How a checkpoint's name classifies it, for {@link CheckpointStat}: an awaited child's
1463
+ * `signal:child:` checkpoint, a folded `fan:` checkpoint standing for many children, a `spawn:`
1464
+ * edge to a fire-and-forget child, or any other step.
1465
+ */
1466
+ type CheckpointNameKind = 'child' | 'folded' | 'spawn' | 'step';
1467
+ /** The {@link CheckpointNameKind} of a checkpoint name — what a store's SQL `CASE` must agree with. */
1468
+ declare function checkpointNameKind(name: string): CheckpointNameKind;
1469
+ /**
1470
+ * One bucket of {@link StateStore.checkpointStats}: the checkpoints of one run sharing a
1471
+ * `parallelGroup`, a `status` and a {@link CheckpointNameKind}, reduced to aggregates.
1472
+ */
1473
+ interface CheckpointStat {
1474
+ /** The bucket's `parallelGroup`, or `null` for ungrouped checkpoints. */
1475
+ group: string | null;
1476
+ status: StepCheckpoint['status'];
1477
+ nameKind: CheckpointNameKind;
1478
+ /** Rows in the bucket (at least 1). */
1479
+ count: number;
1480
+ minSeq: number;
1481
+ maxSeq: number;
1482
+ /** Smallest and largest `name`, by the database's string order. Equal when every row shares one. */
1483
+ minName: string;
1484
+ maxName: string;
1485
+ /** Earliest `enqueuedAt`, read as {@link StateStore.listCheckpoints} reads it (falling back to `startedAt`). */
1486
+ minEnqueuedAt: Date;
1487
+ minStartedAt: Date;
1488
+ maxStartedAt: Date;
1489
+ maxFinishedAt: Date;
1490
+ /** Sum of `attempts` — moves when a step is retried in place, so a change marker sees it. */
1491
+ sumAttempts: number;
1492
+ }
1493
+ /** What {@link StateStore.queryCheckpoints} selects. */
1494
+ interface CheckpointQuery {
1495
+ /** Only this `parallelGroup`'s checkpoints. */
1496
+ group?: string | undefined;
1497
+ /** Leave out these groups' checkpoints (ungrouped checkpoints are kept). */
1498
+ excludeGroups?: string[] | undefined;
1499
+ statuses?: StepCheckpoint['status'][] | undefined;
1500
+ /** Only names starting with one of these. */
1501
+ namePrefixes?: string[] | undefined;
1502
+ offset?: number | undefined;
1503
+ limit?: number | undefined;
1383
1504
  }
1384
1505
  /**
1385
1506
  * A persisted schedule as the STORE sees it: a handful of queryable columns plus two JSON documents
@@ -1705,6 +1826,26 @@ interface AllStepsOptions extends Omit<StepDispatchOpts, 'queue' | 'timeoutMs'>
1705
1826
  */
1706
1827
  concurrency?: number;
1707
1828
  }
1829
+ /** Options for {@link WorkflowCtx.allSettled} over child workflows: {@link AllOptions} without `mode`. */
1830
+ type AllSettledOptions = Omit<AllOptions, 'mode'>;
1831
+ /** Options for {@link WorkflowCtx.allSettled} over a `@Step`: {@link AllStepsOptions} without `mode`. */
1832
+ type AllStepsSettledOptions = Omit<AllStepsOptions, 'mode'>;
1833
+ /**
1834
+ * One item of a {@link WorkflowCtx.allSettled} fan, in input order. `id` is the child run id (child
1835
+ * fan) or the step id (step fan); `error` is the failure message the child or step settled with.
1836
+ */
1837
+ type Settled<T> = {
1838
+ status: 'fulfilled';
1839
+ value: T;
1840
+ } | {
1841
+ status: 'rejected';
1842
+ id: string;
1843
+ error: string;
1844
+ /** The failure's `code` (e.g. a `FatalError`'s), so a parent can tell its kinds apart. */
1845
+ code?: string | undefined;
1846
+ /** The failure's structured `details`, when it carried any. */
1847
+ details?: unknown;
1848
+ };
1708
1849
  /** One child of a fan as {@link StateStore.registerChildWaits} writes it. */
1709
1850
  interface ChildWait {
1710
1851
  waiter: SignalWaiter;
@@ -2595,6 +2736,17 @@ interface WorkflowCtx<A extends SearchAttributes = SearchAttributes> {
2595
2736
  */
2596
2737
  all<TInput, TOutput>(step: StepRef<TInput, TOutput>, inputs: TInput[], opts?: AllStepsOptions): Promise<TOutput[]>;
2597
2738
  all<TOutput = unknown>(workflow: string, inputs: unknown[], opts?: AllOptions): Promise<TOutput[]>;
2739
+ /**
2740
+ * {@link all} that never throws for a failed item: waits for every child (or step) to settle, then
2741
+ * resolves with one {@link Settled} per input, in **input order** — the durable
2742
+ * `Promise.allSettled`. Same fan as `all` in `waitAll` mode (ids, `parallelGroup`, `concurrency`
2743
+ * waves, one parent turn per settled wave); only the ending differs. Use it when one item failing
2744
+ * is an expected outcome the parent handles (record it, dead-letter it) rather than a reason to
2745
+ * fail the whole run. Cancelling the parent still propagates.
2746
+ */
2747
+ allSettled<C extends WorkflowClass>(workflow: C, inputs: WorkflowInputOf<C>[], opts?: AllSettledOptions): Promise<Settled<WorkflowOutputOf<C>>[]>;
2748
+ allSettled<TInput, TOutput>(step: StepRef<TInput, TOutput>, inputs: TInput[], opts?: AllStepsSettledOptions): Promise<Settled<TOutput>[]>;
2749
+ allSettled<TOutput = unknown>(workflow: string, inputs: unknown[], opts?: AllSettledOptions): Promise<Settled<TOutput>[]>;
2598
2750
  /**
2599
2751
  * Pause the run at this point until a human resumes it from the dashboard (or
2600
2752
  * `engine.continue(runId)`). Records a visible `pending` checkpoint so the breakpoint shows up
@@ -2687,8 +2839,8 @@ interface WorkflowCtx<A extends SearchAttributes = SearchAttributes> {
2687
2839
  localStep<TOutput>(name: string, fn: (log: StepLogger) => Promise<TOutput>, options?: StepOptions): Promise<TOutput>;
2688
2840
  }
2689
2841
  /**
2690
- * {@link WorkflowCtx} with ONE signature per method: the string-addressed forms of the four overloaded
2691
- * methods (`step`, `child`, `startChild`, `all`), everything else unchanged.
2842
+ * {@link WorkflowCtx} with ONE signature per method: the string-addressed forms of the five overloaded
2843
+ * methods (`step`, `child`, `startChild`, `all`, `allSettled`), everything else unchanged.
2692
2844
  *
2693
2845
  * For code that drives the ctx DYNAMICALLY — an interpreter that runs a user-defined graph and only
2694
2846
  * ever knows workflow/step names as strings — and for test fakes. An overloaded method is awkward to
@@ -2707,7 +2859,7 @@ interface WorkflowCtx<A extends SearchAttributes = SearchAttributes> {
2707
2859
  * Every `WorkflowCtx<A>` is assignable to `DynamicWorkflowCtx<A>` (guarded by
2708
2860
  * `dynamic-workflow-ctx.type-test.ts`), and a `Pick` of it is a plain object literal in a test.
2709
2861
  */
2710
- interface DynamicWorkflowCtx<A extends SearchAttributes = SearchAttributes> extends Omit<WorkflowCtx<A>, 'step' | 'child' | 'startChild' | 'all'> {
2862
+ interface DynamicWorkflowCtx<A extends SearchAttributes = SearchAttributes> extends Omit<WorkflowCtx<A>, 'step' | 'child' | 'startChild' | 'all' | 'allSettled'> {
2711
2863
  /** {@link WorkflowCtx.step} by step name (a cross-runtime handler, or a `@Step` by its name). */
2712
2864
  step<TOutput = unknown, TInput = unknown>(name: string, input: TInput, opts?: StepDispatchOpts & {
2713
2865
  compensate?: string;
@@ -2718,6 +2870,8 @@ interface DynamicWorkflowCtx<A extends SearchAttributes = SearchAttributes> exte
2718
2870
  startChild(workflow: string, input: unknown, options?: string | ChildCallOptions): Promise<string>;
2719
2871
  /** {@link WorkflowCtx.all} by workflow name. */
2720
2872
  all<TOutput = unknown>(workflow: string, inputs: unknown[], opts?: AllOptions): Promise<TOutput[]>;
2873
+ /** {@link WorkflowCtx.allSettled} by workflow name. */
2874
+ allSettled<TOutput = unknown>(workflow: string, inputs: unknown[], opts?: AllSettledOptions): Promise<Settled<TOutput>[]>;
2721
2875
  }
2722
2876
  /** Result of executing or resuming a workflow run. */
2723
2877
  interface RunResult {
@@ -2740,7 +2894,7 @@ type UpdateResult = {
2740
2894
  accepted: true;
2741
2895
  run: RunResult | null;
2742
2896
  };
2743
- type EngineEventType = 'run.started' | 'run.completed' | 'run.failed' | 'run.suspended' | 'step.started' | 'step.completed' | 'step.failed' | 'step.progress' | 'run.blocked';
2897
+ type EngineEventType = 'run.started' | 'run.completed' | 'run.failed' | 'run.suspended' | 'step.started' | 'step.completed' | 'step.failed' | 'step.progress' | 'run.blocked' | 'run.routed' | 'run.unrouted';
2744
2898
  /**
2745
2899
  * A lifecycle event emitted by the engine. The observability surfaces (dashboard, OTel, the
2746
2900
  * Telescope integration) all subscribe to these rather than reaching into the store.
@@ -2780,6 +2934,8 @@ interface EngineEvent {
2780
2934
  * gap fired, how many live workers were considered, and both descriptors — enough for the health
2781
2935
  * panel/telescope to render the reason. Absent on all other event types. */
2782
2936
  diagnostics?: DispatchDiagnostics | undefined;
2937
+ /** Why a `run.unrouted` run's onError routes were not applied. */
2938
+ reason?: string | undefined;
2783
2939
  at: Date;
2784
2940
  }
2785
2941
  type EngineListener = (event: EngineEvent) => void;
@@ -3180,7 +3336,7 @@ interface WorkflowAnnouncement extends WorkflowRegistration {
3180
3336
  /** An axis on which the live announcers of one workflow do not agree. `values` holds every distinct
3181
3337
  * DECLARED value (sorted); an announcer that stated nothing on the axis contributes nothing. */
3182
3338
  interface Disagreement {
3183
- axis: 'group' | 'origin' | 'requires';
3339
+ axis: 'group' | 'origin' | 'requires' | 'onError';
3184
3340
  values: string[];
3185
3341
  }
3186
3342
  /**
@@ -3216,6 +3372,12 @@ interface AnnouncedWorkflow {
3216
3372
  /** Every distinct capability demand announced, each de-duplicated + sorted. Empty = nobody stated
3217
3373
  * one. Two entries here means two workers demand different capabilities for the same version. */
3218
3374
  requires: string[][];
3375
+ /** Every distinct set of `onError` routes announced, each in canonical order. Empty = nobody stated
3376
+ * one. Two entries here means the live workers route this workflow's failures differently. */
3377
+ onError: {
3378
+ code?: string;
3379
+ workflow: string;
3380
+ }[][];
3219
3381
  /** Runtimes of the live announcers (sorted, de-duplicated). EMPTY on an `'observed'` entry: a
3220
3382
  * heartbeat does not say what runtime wrote it, and the instance id's shape is a convention, not
3221
3383
  * a statement, so it is not read as one. */
@@ -3529,6 +3691,64 @@ type RoutingResolution = RoutableResolution | BlockedResolution;
3529
3691
  */
3530
3692
  declare function resolveRouting(handler: CapabilityRequirement, workers: readonly (RawWorkerDescriptor | WorkerDescriptor)[]): RoutingResolution;
3531
3693
 
3694
+ /**
3695
+ * Routes a failed run to a handler workflow instead of failing it: when a run of the workflow ends
3696
+ * `failed` with an error whose `code` matches (or with any error, for the route without a `code`), the
3697
+ * engine starts `workflow` with an {@link OnErrorInput} and the failed run waits for it. The run then
3698
+ * settles with the handler's outcome: its output on success, its error on failure.
3699
+ */
3700
+ interface OnErrorRoute {
3701
+ /** The error `code` to route. Omitted: routes any failure no other route's `code` matches. */
3702
+ code?: string | undefined;
3703
+ /** The registered handler workflow's name. */
3704
+ workflow: string;
3705
+ }
3706
+ /** The input an {@link OnErrorRoute} handler workflow is started with. */
3707
+ interface OnErrorInput<TInput = unknown> {
3708
+ /** The run that failed; it completes with this handler's output. */
3709
+ runId: string;
3710
+ /** The failed run's workflow. */
3711
+ workflow: string;
3712
+ /** The failed run's input. */
3713
+ input: TInput;
3714
+ /** The failure, as the run recorded it. */
3715
+ error: StepError;
3716
+ }
3717
+ /**
3718
+ * Handoff checkpoints live at seqs from here up, one per handoff, so a body that runs again after a
3719
+ * retry can never reach one. Fits a 32-bit `seq` column.
3720
+ */
3721
+ declare const HANDOFF_SEQ_BASE = 1000000000;
3722
+ /** The id of the handler run of a run's `attempt`-th handoff. */
3723
+ declare const onErrorRunId: (runId: string, attempt: number) => string;
3724
+ /** The waiter checkpoint a run waits on its handler under; renamed {@link retiredHandoffName} on retry. */
3725
+ declare const handoffName: (handlerId: string) => string;
3726
+ /** What a retry renames a handoff checkpoint to: kept in the timeline, never followed again. */
3727
+ declare const retiredHandoffName: (handlerId: string) => string;
3728
+ /** The handler run id a live handoff checkpoint of `runId` names, or undefined for any other one. */
3729
+ declare function handoffHandlerId(runId: string, cp: {
3730
+ seq: number;
3731
+ name: string;
3732
+ }): string | undefined;
3733
+ /** The run's live handoff (its latest, unretired one), if it handed a failure off. */
3734
+ declare function liveHandoff<C extends {
3735
+ seq: number;
3736
+ name: string;
3737
+ }>(runId: string, checkpoints: readonly C[]): C | undefined;
3738
+ /** The route a failure takes: the one for its exact code, else the catch-all, else none. */
3739
+ declare function routeFor(routes: OnErrorRoute[] | undefined, error: StepError): OnErrorRoute | undefined;
3740
+ /** Reject two routes for one code, or two catch-alls — ambiguous config, caught at registration. */
3741
+ declare function assertRoutes(workflow: string, routes: OnErrorRoute[]): void;
3742
+ /** The `code` carried by a thrown value: its own, a dispatched step's, or a thin-worker step's. */
3743
+ declare function codeOf(err: unknown): string | undefined;
3744
+ /** The `details` carried by a thrown value, from the same places as {@link codeOf}. */
3745
+ declare function detailsOf(err: unknown): unknown;
3746
+ /** `code` and `details` as optional keys, so an absent one is not written as `undefined`. */
3747
+ declare function codeAndDetails(err: unknown): {
3748
+ code?: string;
3749
+ details?: unknown;
3750
+ };
3751
+
3532
3752
  /**
3533
3753
  * A schedule definition — what `engine.schedules.create/upsert` take. Temporal-style: a persisted,
3534
3754
  * runtime-managed recurring start of `workflow` with `input`, fired by every driving engine's timer
@@ -4042,6 +4262,8 @@ declare class WorkflowEngine {
4042
4262
  private readonly updateValidators;
4043
4263
  /** Runs being cancelled WITH saga compensation — see `cancel({ compensate: true })`. */
4044
4264
  private readonly cancelRequested;
4265
+ /** {@link announcedRoutes} reads, by group + workflow + version. */
4266
+ private readonly announcedRoutesCache;
4045
4267
  /**
4046
4268
  * Seqs of the dispatched remote steps a turn suspended on, by run, while that turn executes on
4047
4269
  * THIS instance — so the turn can re-check them once its lease is released (see
@@ -4063,6 +4285,8 @@ declare class WorkflowEngine {
4063
4285
  private readonly stepFansFiredHere;
4064
4286
  /** The tail of each run's queue of results being handled on this instance — see {@link serializedPerRun}. */
4065
4287
  private readonly resultChains;
4288
+ /** Each run's results waiting to be settled on this instance — see {@link completeRemoteResult}. */
4289
+ private readonly resultQueues;
4066
4290
  /** Flow-control admission backend for remote steps (see {@link registerQueue}). */
4067
4291
  private readonly admission;
4068
4292
  /** Runs on THIS instance blocked on admission, by queue — woken early on a freed-slot signal. */
@@ -4137,6 +4361,8 @@ declare class WorkflowEngine {
4137
4361
  * when it cannot be derived with confidence: absent means UNKNOWN, and an absent origin is far
4138
4362
  * cheaper to live with than a wrong one. */
4139
4363
  origin?: string | undefined;
4364
+ /** Handler workflows a matching failure is routed to — see {@link OnErrorRoute}. */
4365
+ onError?: OnErrorRoute[] | undefined;
4140
4366
  }): void;
4141
4367
  /**
4142
4368
  * The retained in-process body for `name@version`, for an IN-APP worker that consumes this engine's
@@ -4166,6 +4392,8 @@ declare class WorkflowEngine {
4166
4392
  validateInput?: (input: unknown) => void | Promise<void>;
4167
4393
  /** Capabilities a live worker must advertise to run this remote workflow's turns (handshake §7.5). */
4168
4394
  requires?: string[];
4395
+ /** Handler workflows a matching failure is routed to — see {@link OnErrorRoute}. */
4396
+ onError?: OnErrorRoute[];
4169
4397
  }): void;
4170
4398
  /**
4171
4399
  * The convenience form of {@link registerRemote}: register a workflow whose body runs on a worker
@@ -4192,6 +4420,8 @@ declare class WorkflowEngine {
4192
4420
  validateInput?: (input: unknown) => void | Promise<void>;
4193
4421
  /** Capabilities a live worker must advertise to run this workflow's turns (handshake §7.5). */
4194
4422
  requires?: string[];
4423
+ /** Handler workflows a matching failure is routed to — see {@link OnErrorRoute}. */
4424
+ onError?: OnErrorRoute[];
4195
4425
  }): void;
4196
4426
  /**
4197
4427
  * Register a flow-control queue referenced by `ctx.step(step, input, { queue })`. Caps concurrent
@@ -4842,6 +5072,47 @@ declare class WorkflowEngine {
4842
5072
  * {@link runExecution}'s settle/suspend; the lease is held by {@link execute}. The result that lands
4843
5073
  * us back here (a remote step finished, a timer fired) goes through `resume` like any TS workflow.
4844
5074
  */
5075
+ /**
5076
+ * The registered onError routes whose handler workflow nothing can run: not registered on this
5077
+ * engine, and no live worker group serves it. Meant for a boot-time warning: a typo in a handler's
5078
+ * name would otherwise surface only when the first run fails.
5079
+ */
5080
+ unservedOnErrorRoutes(): Promise<{
5081
+ workflow: string;
5082
+ route: OnErrorRoute;
5083
+ }[]>;
5084
+ /** Validate a workflow's {@link OnErrorRoute}s at registration. */
5085
+ private checkedRoutes;
5086
+ /**
5087
+ * Route a failed run to its {@link OnErrorRoute} handler, read from the workflow's local registration
5088
+ * or, for one served by convention, from what its live workers announce. Starts the handler run and
5089
+ * waits for it the way a parent waits for a `ctx.child`: a `child:<handlerId>` waiter plus a
5090
+ * `running` placeholder checkpoint carrying the handler's name and input, so the handler's terminal
5091
+ * state wakes the run (buffered and reconciled like any child). From then on every execution of the
5092
+ * run only follows the handler ({@link followHandoff}); the body never runs again. Undefined when no
5093
+ * route matches: the run fails as usual.
5094
+ *
5095
+ * The placeholder sits past every seq the body used and is left out of {@link remoteHistory}.
5096
+ */
5097
+ private routeFailure;
5098
+ /** A run's handoff checkpoints, live and retired: the only ones at {@link HANDOFF_SEQ_BASE} and up. */
5099
+ private handoffCheckpoints;
5100
+ /**
5101
+ * Where a run that handed its failure off stands: the handler's outcome once it settled (from the
5102
+ * wake's checkpoint, or off the handler run when the wake never arrived), else still waiting. Starts
5103
+ * the handler if the turn that handed off crashed before its deferred start ran.
5104
+ */
5105
+ private followHandoff;
5106
+ /**
5107
+ * The onError routes the live workers announce for a workflow the engine serves by convention: the
5108
+ * one set they agree on, or none when they state none or cannot be read. Workers that announce
5109
+ * different sets (a rollout in progress) route nothing, and the run's failure is reported as a
5110
+ * `run.unrouted` event. Announcers of another version of the workflow are ignored. The read is
5111
+ * cached for {@link ANNOUNCED_ROUTES_TTL_MS}, so a burst of failures costs one descriptor read.
5112
+ */
5113
+ private announcedRoutes;
5114
+ /** Every distinct onError route set the live workers of `group` announce for the run's workflow. */
5115
+ private readAnnouncedRoutes;
4845
5116
  /**
4846
5117
  * Apply a terminal/suspended transition once: persist the new run status, emit the matching
4847
5118
  * lifecycle event, and (on completion/failure) wake a waiting parent. Both the TS and remote
@@ -5127,6 +5398,13 @@ declare class WorkflowEngine {
5127
5398
  private noteRecent;
5128
5399
  /** {@link StateStore.saveCheckpointIfPending}, or a plain save on a store without it. */
5129
5400
  private savePendingCheckpoint;
5401
+ /**
5402
+ * {@link savePendingCheckpoint} for checkpoints at distinct seqs of one run: one
5403
+ * {@link StateStore.saveCheckpointsIfPending} call when the store has it, else one write each.
5404
+ * Never rejects as a whole: a write that failed is reported as that entry's error, and the batch
5405
+ * call rejecting means it wrote nothing, so the entries are then written one by one.
5406
+ */
5407
+ private savePendingCheckpoints;
5130
5408
  /** Enqueue a remote step task to its worker group via the transport pool. Shared by the initial
5131
5409
  * dispatch, the opt-in self-heal re-dispatch (see `remoteRedispatchMs`), and the explicit
5132
5410
  * {@link redispatchPending}. Carries the current trace/context so a re-dispatch is traceable. */
@@ -5143,15 +5421,33 @@ declare class WorkflowEngine {
5143
5421
  * result (the dispatching one may be gone), so the run is crash/scale-safe. Resolves whether the
5144
5422
  * run should now be resumed: not for a duplicate or late delivery (the checkpoint isn't `pending`),
5145
5423
  * a run already finished, or a step fan whose barrier is still closed.
5424
+ *
5425
+ * Results of one run are settled in batches: the first starts a batch, and the ones that arrive
5426
+ * while it is being written form the next. Under load a wide fan's results are written by one
5427
+ * {@link StateStore.saveCheckpointsIfPending} call per batch, and the fan's barrier is asked once
5428
+ * per batch, not once per result. A result resolves only once its own write has committed, so the
5429
+ * transport acknowledges nothing that is not durable yet.
5146
5430
  */
5147
5431
  private completeRemoteResult;
5432
+ /** Settle `queue` (a run's queued results) batch by batch until it is empty, then retire it. */
5433
+ private drainResultQueue;
5434
+ /**
5435
+ * Settle a batch of one run's step results. At most one of them resolves `true` (resume the run):
5436
+ * that resume replays every write of the batch, so a second would only replay it again. A result
5437
+ * whose read or write failed resolves its error, and the transport redelivers just that one.
5438
+ */
5439
+ private completeRemoteResults;
5148
5440
  /**
5149
5441
  * The join barrier of a step fan: a result for one of its steps resumes the parent only once no
5150
5442
  * step of the fan is still `pending` (a settled wave), or on a failure (failFast surfaces it, and a
5151
5443
  * retry needs the parent to schedule it). Without it every result would replay the whole parent,
5152
- * which makes a fan of N steps cost O(N²) checkpoint reads.
5444
+ * which makes a fan of N steps cost O(N²) checkpoint reads. `barriers` holds the answer per fan
5445
+ * for the rest of a batch. A barrier that cannot be read counts as open: a spare resume replays and
5446
+ * re-suspends, a lost one strands the run.
5153
5447
  */
5154
5448
  private stepFanStillRunning;
5449
+ /** How many steps of a step fan's seq range are still `pending`. */
5450
+ private stepFanPending;
5155
5451
  /**
5156
5452
  * Apply a remote workflow-turn {@link WorkflowDecision} durably — runs on WHATEVER instance receives
5157
5453
  * it over the broker (the dispatching one may be gone, or a point-to-point broker handed it to a
@@ -5205,6 +5501,8 @@ declare class RemoteStepError extends Error {
5205
5501
  readonly stepError?: StepError | undefined;
5206
5502
  constructor(stepError?: StepError);
5207
5503
  }
5504
+ /** Checkpoint names that record a parent→child edge: an awaited child, a folded group of them, a spawn. */
5505
+ declare const CHILD_EDGE_PREFIXES: string[];
5208
5506
  /** The child run ids a parent's {@link CHILD_EDGE_PREFIXES} checkpoints point at (others are skipped). */
5209
5507
  declare function childIdsOf(checkpoints: StepCheckpoint[]): string[];
5210
5508
 
@@ -5288,7 +5586,12 @@ declare function parseDuration(duration: string | number): number;
5288
5586
  */
5289
5587
  declare class FatalError extends Error {
5290
5588
  readonly code?: string | undefined;
5291
- constructor(message: string, code?: string);
5589
+ /** Structured, JSON-serializable detail (e.g. validation issues). It travels with the failure to
5590
+ * the run's error, a parent's `allSettled` item and an onError handler's input. */
5591
+ readonly details?: unknown;
5592
+ /** Read by the step result builders, so a dispatched step's retry policy honours it too. */
5593
+ readonly retryable = false;
5594
+ constructor(message: string, code?: string, details?: unknown);
5292
5595
  }
5293
5596
  /**
5294
5597
  * Thrown by `start` when a run would exceed its concurrency quota: `active` runs sharing the quota
@@ -5366,6 +5669,8 @@ declare class RemoteWorkflowTimeout extends Error {
5366
5669
  * breaking changes (old runs finish on the version they started on).
5367
5670
  */
5368
5671
  declare class NonDeterminismError extends Error {
5672
+ /** Marks the failure as a broken deploy, which an `onError` route never takes. */
5673
+ readonly code = "non_determinism";
5369
5674
  readonly runId: string;
5370
5675
  readonly seq: number;
5371
5676
  constructor(runId: string, seq: number, expected: string, recorded: string);
@@ -5396,17 +5701,17 @@ declare class NestedWorkflowCallError extends FatalError {
5396
5701
  * and the failing ids — the wait-all/fail-fast counterpart to a single child's FatalError. Mirrors
5397
5702
  * the Python SDK's `GatherFailed`.
5398
5703
  */
5704
+ /** One failed item of a fan: its input index, the child run or step id, and its failure. */
5705
+ interface GatherItemFailure {
5706
+ index: number;
5707
+ id: string;
5708
+ error: string;
5709
+ code?: string | undefined;
5710
+ details?: unknown;
5711
+ }
5399
5712
  declare class GatherError extends Error {
5400
- readonly failures: {
5401
- index: number;
5402
- id: string;
5403
- error: string;
5404
- }[];
5405
- constructor(failures: {
5406
- index: number;
5407
- id: string;
5408
- error: string;
5409
- }[], total?: number);
5713
+ readonly failures: GatherItemFailure[];
5714
+ constructor(failures: GatherItemFailure[], total?: number);
5410
5715
  }
5411
5716
  declare class WorkflowSuspended extends Error {
5412
5717
  /** Epoch ms to auto-resume (durable sleep), or undefined when waiting on an external signal. */
@@ -5637,6 +5942,49 @@ declare function mergeRunValueFacetRows(rows: readonly {
5637
5942
  */
5638
5943
  declare function runValueFacetsFromRuns(runs: readonly WorkflowRun[], axis: RunValueAxis, opts?: RunValueFacetOptions): RunValueFacetRow[];
5639
5944
 
5945
+ /** A store that aggregates checkpoints itself: both halves of the pair are present. */
5946
+ type CheckpointAggregatingStore = StateStore & Required<Pick<StateStore, 'checkpointStats' | 'queryCheckpoints'>>;
5947
+ declare function aggregatesCheckpoints(store: StateStore): store is CheckpointAggregatingStore;
5948
+ /**
5949
+ * {@link StateStore.checkpointStats} over checkpoints already in memory — the reference a store's
5950
+ * `GROUP BY` must agree with, and the in-memory store's implementation.
5951
+ */
5952
+ declare function checkpointStatsOf(checkpoints: StepCheckpoint[], opts?: {
5953
+ group?: string | undefined;
5954
+ }): CheckpointStat[];
5955
+ /** {@link StateStore.queryCheckpoints} over checkpoints already in memory, sorted by `seq` here. */
5956
+ declare function queryCheckpointsOf(checkpoints: StepCheckpoint[], query: CheckpointQuery): StepCheckpoint[];
5957
+ /**
5958
+ * What `summarizeTimeline` plus `childIdsOf` make of a run's whole checkpoint list, read through the
5959
+ * store's aggregates instead: the checkpoints outside wide fans, one {@link FanSummary} per wide fan,
5960
+ * and the run's children capped at {@link SUMMARY_CHILD_LIMIT} with their count.
5961
+ *
5962
+ * What it reads besides the aggregates: the rows outside wide fans, every folded `fan:` checkpoint
5963
+ * (one per settled wave), up to {@link FAN_SUMMARY_FAILURES} failed rows per wide fan, the first
5964
+ * child-edge rows, and — while a wide child fan is in flight — that fan's completed `signal:child:`
5965
+ * rows, whose `ok: false` payload is what marks a failed child.
5966
+ *
5967
+ * `childCount` counts each `spawn:` checkpoint as one child: the engine always writes the child's id
5968
+ * as its output, which is what `childIdsOf` reads.
5969
+ */
5970
+ declare function summarizeRunFromStore(store: CheckpointAggregatingStore, runId: string, over: number, stats?: CheckpointStat[]): Promise<{
5971
+ timeline: StepCheckpoint[];
5972
+ fans: FanSummary[];
5973
+ children: string[];
5974
+ childCount: number;
5975
+ }>;
5976
+ /** What `pageFan` makes of a run's whole checkpoint list, read one page at a time from the store. */
5977
+ declare function pageFanFromStore(store: CheckpointAggregatingStore, runId: string, group: string, query: FanPageQuery, stats?: CheckpointStat[]): Promise<FanPage>;
5978
+ /**
5979
+ * The ETag of a summarized run detail: the run row as read (so any run field that changes shows)
5980
+ * plus its checkpoint buckets, and the threshold it was summarized with.
5981
+ */
5982
+ declare function runDetailEtag(run: WorkflowRun, stats: CheckpointStat[], over: number): string;
5983
+ /** The ETag of one page of a fan: its group's buckets and the page asked for. */
5984
+ declare function fanPageEtag(group: string, stats: CheckpointStat[], query: FanPageQuery): string;
5985
+ /** Whether an `If-None-Match` header value names `etag` (weak comparison, as RFC 9110 asks for). */
5986
+ declare function etagMatches(ifNoneMatch: string | undefined, etag: string): boolean;
5987
+
5640
5988
  /**
5641
5989
  * Resolve WHAT a suspended run is parked on from the token of the {@link SignalWaiter} it registered.
5642
5990
  * The token prefix carries the kind — no extra store lookup and no new persisted field. Used by the
@@ -5668,9 +6016,10 @@ declare function indexWaitersByRun(waiters: readonly SignalWaiter[]): Map<string
5668
6016
 
5669
6017
  /**
5670
6018
  * The parent of a child run whose id the engine minted: a `ctx.all` child
5671
- * (`<parent>.all.<seq>.<i>`, or `.w<k>.<i>` under a `concurrency` limit) or a `ctx.child` /
5672
- * `ctx.startChild` child without an explicit id (`<parent>.child.<seq>`). Undefined for any other
5673
- * run, including a child started with a caller-chosen id.
6019
+ * (`<parent>.all.<seq>.<i>`, or `.w<k>.<i>` under a `concurrency` limit), a `ctx.child` /
6020
+ * `ctx.startChild` child without an explicit id (`<parent>.child.<seq>`), or the onError handler of
6021
+ * a failed run (`<parent>.onError.<attempt>`). Undefined for any other run, including a child started with a
6022
+ * caller-chosen id.
5674
6023
  */
5675
6024
  declare function parentRunIdOf(runId: string): string | undefined;
5676
6025
 
@@ -5717,11 +6066,21 @@ declare class CodecStateStore implements StateStore {
5717
6066
  /** Encodes like {@link saveCheckpoint}. Bound only when the inner store has it, so the engine's
5718
6067
  * plain-save fallback still kicks in through the wrapper. */
5719
6068
  readonly saveCheckpointIfPending?: (checkpoint: StepCheckpoint) => Promise<boolean>;
6069
+ /** Encodes each checkpoint like {@link saveCheckpoint}. Bound only when the inner store has it. */
6070
+ readonly saveCheckpointsIfPending?: (checkpoints: StepCheckpoint[]) => Promise<boolean[]>;
5720
6071
  /** Forwarded verbatim — a count reads no payload. Bound only when the inner store has it. */
5721
6072
  readonly countCheckpoints?: (runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]) => Promise<number>;
5722
6073
  /** Forwarded verbatim — retention selects by status/updatedAt/scope, never by payload. Bound only
5723
6074
  * when the inner store prunes, so the retention poller still sees (and warns about) its absence. */
5724
6075
  readonly pruneTerminalRuns?: (policy: RetentionPolicy, nowMs: number, limit: number) => Promise<number>;
6076
+ /** Forwarded verbatim — the buckets aggregate names, statuses and timestamps, never a payload.
6077
+ * Bound only when the inner store aggregates, so the run detail's fallback still applies. */
6078
+ readonly checkpointStats?: (runId: string, opts?: {
6079
+ group?: string | undefined;
6080
+ }) => Promise<CheckpointStat[]>;
6081
+ /** Filters on unencoded columns, then decodes the rows like {@link listCheckpoints}. Bound only
6082
+ * when the inner store has it. */
6083
+ readonly queryCheckpoints?: (runId: string, query: CheckpointQuery) => Promise<StepCheckpoint[]>;
5725
6084
  /** Forwarded verbatim — a count reads no payload. Bound only when the inner store counts, so the
5726
6085
  * engine's facet/listing fallback still applies through the wrapper. */
5727
6086
  readonly countRuns?: (query: Omit<RunQuery, 'limit' | 'offset'>) => Promise<number>;
@@ -5821,12 +6180,17 @@ declare function eventMatchOf(token: string): Record<string, unknown>;
5821
6180
  declare function eventMatches(payload: unknown, match: Record<string, unknown>): boolean;
5822
6181
 
5823
6182
  interface MetricsSnapshot {
6183
+ /** `routed`: failures handed to an onError handler; `unrouted`: routes the engine could not apply. */
5824
6184
  runs: {
5825
6185
  started: number;
5826
6186
  completed: number;
5827
6187
  failed: number;
5828
6188
  suspended: number;
6189
+ routed: number;
6190
+ unrouted: number;
5829
6191
  };
6192
+ /** Routed failures by error code (`*` for a failure without one). */
6193
+ routedByCode: Record<string, number>;
5830
6194
  steps: {
5831
6195
  started: number;
5832
6196
  completed: number;
@@ -6176,6 +6540,11 @@ declare class InMemoryStateStore implements StateStore {
6176
6540
  * so this lets the benchmark contrast "fetch N, scan in JS" against "fetch the k that match".
6177
6541
  */
6178
6542
  lastCheckpointRowsRead: number;
6543
+ /**
6544
+ * Test/observability hook: checkpoint rows materialized since construction, across every
6545
+ * checkpoint read that returns rows — what a run-detail benchmark compares between paths.
6546
+ */
6547
+ checkpointRowsRead: number;
6179
6548
  private key;
6180
6549
  /** Drop then re-add a run's normalized attribute rows so the index tracks its current attributes. */
6181
6550
  private reindexAttributes;
@@ -6189,6 +6558,7 @@ declare class InMemoryStateStore implements StateStore {
6189
6558
  getCheckpoint(runId: string, seq: number): Promise<StepCheckpoint | null>;
6190
6559
  saveCheckpoint(checkpoint: StepCheckpoint): Promise<void>;
6191
6560
  saveCheckpointIfPending(checkpoint: StepCheckpoint): Promise<boolean>;
6561
+ saveCheckpointsIfPending(checkpoints: StepCheckpoint[]): Promise<boolean[]>;
6192
6562
  listIncompleteRuns(namespace?: string): Promise<WorkflowRun[]>;
6193
6563
  listPendingRuns(limit: number, namespace?: string): Promise<WorkflowRun[]>;
6194
6564
  listDueTimers(nowMs: number, namespace?: string, limit?: number): Promise<WorkflowRun[]>;
@@ -6250,6 +6620,11 @@ declare class InMemoryStateStore implements StateStore {
6250
6620
  deleteSchedule(id: string): Promise<boolean>;
6251
6621
  listSchedules(query: ScheduleQuery): Promise<ScheduleRecord[]>;
6252
6622
  listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
6623
+ private runCheckpoints;
6624
+ checkpointStats(runId: string, opts?: {
6625
+ group?: string | undefined;
6626
+ }): Promise<CheckpointStat[]>;
6627
+ queryCheckpoints(runId: string, query: CheckpointQuery): Promise<StepCheckpoint[]>;
6253
6628
  getLatestCheckpointByName(runId: string, name: string): Promise<StepCheckpoint | undefined>;
6254
6629
  countCheckpoints(runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]): Promise<number>;
6255
6630
  listCheckpointsByNamePrefix(runId: string, prefixes: string[]): Promise<StepCheckpoint[]>;
@@ -6295,4 +6670,4 @@ declare function singletonAdmissionDenialPatch(runs: WorkflowRun[], runId: strin
6295
6670
  updatedAt: Date;
6296
6671
  } | undefined;
6297
6672
 
6298
- export { type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AllOptions, type AllStepsOptions, type AnnouncedWorkflow, type AnnouncementEvidence, type AttributeFilter, type AttributeOp, type AttributePredicateOperand, type AttributeValue, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, CONTROL_FLOW_SIGNAL, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type ChildCallOptions, type ChildWait, CodecStateStore, type ConcurrencyConfig, ConcurrencyLimitError, type ConcurrencyQuota, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_CONCURRENCY_STATUSES, DEFAULT_PARTITION, 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, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, EventAccumulators, type EventBatchConfig, FAN_SUMMARY_FAILURES, type FanJoin, type FanPage, type FanPageQuery, type FanSummary, type FanWait, FatalError, GatherError, type GroupHealth, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NestedWorkflowCallError, NonDeterminismError, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, RUN_VALUE_FACET_LIMIT, RUN_VALUE_FACET_SCAN, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAttributeRow, type RunDetail, type RunDetailOptions, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, 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 RunWaiting, SINGLETON_ACTIVE_STATUSES, SINGLETON_ADMITTED_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 SearchAttributes, type SearchAttributesSchema, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, 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 StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, WORKFLOW_NAME_KEY, 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 WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, aggregateAnnouncements, announcementsOf, applyAttributeQuery, assertConcurrency, attributeColumnFor, attributeOperand, attributePredicateOperands, axisIsRunColumn, bindWorkflowClass, breakpointToken, buildWorkflowDirectory, canRoute, capableWorkers, childIdsOf, classifyWaiterToken, clearDurableExecutionWrappers, clearTerminalSingletonAdmission, collectMetrics, concurrencyTag, controlPlaneDescriptor, countRuns, coveredTokens, createStepLogger, currentStep, currentStepScope, currentWorkflowCtx, debug, describeWorker, descriptorHash, error, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, facetOrigin, hasDurableExecutionWrappers, heartbeatStatus, indexWaitersByRun, info, isEngineMintedTag, isEventToken, isFailedMember, isLegacyDescriptor, isNonEmptyRunScope, isWorkflowControlFlowSignal, listSignalWaitersOfRuns, log, matchesAttributes, mergeRunFacetRows, mergeRunValueFacetRows, missingCapabilities, negotiate, nextCronFireMs, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, pageFan, parentRunIdOf, parseDuration, partitionOfToken, planDispatch, prevCronFireMs, readSearchAttributes, requiredCapabilities, resolveConcurrency, resolveRouting, resolveRunWaiting, runDurableExecution, runInStepLogger, runInStepScope, runInWorkflowCtx, runOutsideWorkflowCtx, runSchedules, runStepHandler, runValueFacetsFromRuns, sanitizeQueueToken, scheduledRunId, singletonAdmissionDenialPatch, singletonAdmissionTags, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, summarizeFan, summarizeTimeline, tenantGroup, useDurableExecution, warn, workflowName };
6673
+ export { 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, CHILD_EDGE_PREFIXES, CONTROL_FLOW_SIGNAL, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type CheckpointAggregatingStore, type CheckpointNameKind, type CheckpointQuery, type CheckpointStat, type ChildCallOptions, type ChildWait, CodecStateStore, type ConcurrencyConfig, ConcurrencyLimitError, type ConcurrencyQuota, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_CONCURRENCY_STATUSES, DEFAULT_PARTITION, 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, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, EventAccumulators, type EventBatchConfig, FAN_SUMMARY_FAILURES, type FanJoin, type FanPage, type FanPageQuery, type FanSummary, type FanWait, FatalError, GatherError, type GatherItemFailure, type GroupHealth, HANDOFF_SEQ_BASE, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NestedWorkflowCallError, NonDeterminismError, type OnErrorInput, type OnErrorRoute, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, RUN_VALUE_FACET_LIMIT, RUN_VALUE_FACET_SCAN, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAttributeRow, type RunDetail, type RunDetailOptions, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, 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 RunWaiting, SINGLETON_ACTIVE_STATUSES, SINGLETON_ADMITTED_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 SearchAttributes, type SearchAttributesSchema, type Settled, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, 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 StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, WORKFLOW_NAME_KEY, 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 WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, aggregateAnnouncements, aggregatesCheckpoints, announcementsOf, applyAttributeQuery, assertConcurrency, assertRoutes, attributeColumnFor, attributeOperand, attributePredicateOperands, axisIsRunColumn, bindWorkflowClass, breakpointToken, buildWorkflowDirectory, canRoute, capableWorkers, checkpointNameKind, checkpointStatsOf, childIdsOf, classifyWaiterToken, clearDurableExecutionWrappers, clearTerminalSingletonAdmission, codeAndDetails, codeOf, collectMetrics, concurrencyTag, controlPlaneDescriptor, countRuns, coveredTokens, createStepLogger, currentStep, currentStepScope, currentWorkflowCtx, debug, describeWorker, descriptorHash, detailsOf, error, etagMatches, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, facetOrigin, fanPageBounds, fanPageEtag, foldedCount, handoffHandlerId, handoffName, hasDurableExecutionWrappers, heartbeatStatus, indexWaitersByRun, info, isEngineMintedTag, isEventToken, isFailedMember, isLegacyDescriptor, isNonEmptyRunScope, isWorkflowControlFlowSignal, listSignalWaitersOfRuns, liveHandoff, log, matchesAttributes, mergeRunFacetRows, mergeRunValueFacetRows, missingCapabilities, negotiate, nextCronFireMs, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, onErrorRunId, pageFan, pageFanFromStore, parentRunIdOf, parseDuration, partitionOfToken, planDispatch, prevCronFireMs, queryCheckpointsOf, readSearchAttributes, requiredCapabilities, resolveConcurrency, resolveRouting, resolveRunWaiting, retiredHandoffName, routeFor, runDetailEtag, runDurableExecution, runInStepLogger, runInStepScope, runInWorkflowCtx, runOutsideWorkflowCtx, runSchedules, runStepHandler, runValueFacetsFromRuns, sanitizeQueueToken, scheduledRunId, singletonAdmissionDenialPatch, singletonAdmissionTags, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, summarizeFan, summarizeRunFromStore, summarizeTimeline, tenantGroup, useDurableExecution, warn, workflowName };