@dudousxd/nestjs-durable-core 0.99.0 → 0.101.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -161,6 +161,60 @@ declare class InMemoryAdmissionBackend implements AdmissionBackend {
161
161
  release(queue: string, _slotId: string): Promise<void>;
162
162
  }
163
163
 
164
+ /**
165
+ * A start-time concurrency quota for ONE start: at most `limit` runs sharing `key` may be in flight
166
+ * (in `countStatuses`) at once; a start that would exceed it is rejected with
167
+ * {@link ConcurrencyLimitError} before any run is created.
168
+ *
169
+ * The key is global — not per workflow — so different workflows started with the same key share the
170
+ * quota (e.g. `tenant:acme` capping every kind of run a tenant can have executing). Passed per start
171
+ * as `StartOptions.concurrency`, or derived from the input by a workflow's {@link ConcurrencyConfig}.
172
+ */
173
+ interface ConcurrencyQuota {
174
+ /** The quota bucket, e.g. `tenant:acme`. Stamped on the run as the tag `concurrency:<key>`. */
175
+ key: string;
176
+ /** Max runs of this key in flight at once. `limit <= 0` rejects every start. */
177
+ limit: number;
178
+ /**
179
+ * Which statuses occupy a slot. Default: every non-terminal status
180
+ * ({@link DEFAULT_CONCURRENCY_STATUSES}). Narrow it to e.g. `['pending', 'running']` so runs parked
181
+ * on a human (`suspended`) stop counting against the quota.
182
+ */
183
+ countStatuses?: RunStatus[] | undefined;
184
+ }
185
+ /**
186
+ * A workflow's standing concurrency quota, declared at registration (`register(..., { concurrency })`
187
+ * / `@Workflow({ concurrency })`): the key is derived from each start's input, and the limit may be a
188
+ * function of the key (per-tenant plans). A `StartOptions.concurrency` on one start overrides it.
189
+ */
190
+ interface ConcurrencyConfig {
191
+ /** Derive the quota key from the input. Return `undefined` to leave this start unlimited. */
192
+ key: (input: unknown) => string | undefined;
193
+ /** Max in-flight runs per key — a number, or resolved per key (e.g. from the tenant's plan). */
194
+ limit: number | ((key: string) => number | Promise<number>);
195
+ /** Which statuses occupy a slot. See {@link ConcurrencyQuota.countStatuses}. */
196
+ countStatuses?: RunStatus[] | undefined;
197
+ }
198
+ /** Every non-terminal status: what "in flight" means when a quota doesn't narrow it. */
199
+ declare const DEFAULT_CONCURRENCY_STATUSES: readonly RunStatus[];
200
+ /** The tag a quota-bearing run carries, so its siblings can be counted by one tag+status query. */
201
+ declare function concurrencyTag(key: string): string;
202
+ /** Resolve the quota that applies to one start: the per-start override, else the workflow's config. */
203
+ declare function resolveConcurrency(override: ConcurrencyQuota | undefined, config: ConcurrencyConfig | undefined, input: unknown): Promise<ConcurrencyQuota | undefined>;
204
+ /** Count the runs matching `query` as cheaply as the store allows (count → facets → listing). */
205
+ declare function countRuns(store: StateStore, query: Omit<RunQuery, 'limit' | 'offset'>): Promise<number>;
206
+ /**
207
+ * Reject a start that would exceed `quota`: counts the in-flight runs carrying the quota's tag and
208
+ * throws {@link ConcurrencyLimitError} once they reach the limit.
209
+ *
210
+ * A SOFT cap under a race: the count and the run's creation are separate statements, so N starts
211
+ * racing on the last free slot can each see it free (the same guarantee a hand-rolled
212
+ * `SELECT count(*)` gate gives). It is exact whenever starts for a key are not simultaneous, and the
213
+ * overshoot is bounded by the number of truly concurrent starts. Use `singleton` when you need a
214
+ * strict, queueing per-key limit instead of a rejecting one.
215
+ */
216
+ declare function assertConcurrency(store: StateStore, workflow: string, quota: ConcurrencyQuota): Promise<void>;
217
+
164
218
  /**
165
219
  * Worker/control-plane handshake descriptor — the single source of truth for routing, compatibility
166
220
  * and observability across a store-less durable cluster (design §7.1). Pure data + a deterministic,
@@ -213,6 +267,41 @@ interface WorkflowRegistration {
213
267
  */
214
268
  subscribes?: string[];
215
269
  }
270
+ /**
271
+ * One recurring start a tenant app declares (its `schedules` module option), as its worker
272
+ * ANNOUNCES it to the control plane, which adopts it as a persisted schedule and fires it (see
273
+ * `WorkflowEngine.syncAnnouncedSchedules`). JSON-safe: a workflow class is announced by its name.
274
+ */
275
+ interface AnnouncedSchedule {
276
+ /** The schedule's key in the app. The control plane's schedule id is `app:<namespace>:<key>`. */
277
+ key: string;
278
+ /** Registered workflow name. */
279
+ workflow: string;
280
+ /** The input every run starts with. */
281
+ input?: unknown;
282
+ /** Fixed interval in ms. Exactly one of `everyMs` and `cron`. */
283
+ everyMs?: number;
284
+ /** Cron expression (5 fields, or 6 with leading seconds). */
285
+ cron?: string;
286
+ /** IANA timezone the cron is evaluated in. Default UTC. */
287
+ timezone?: string;
288
+ /** Declared paused. */
289
+ paused?: boolean;
290
+ /** `'skip'`: no new window while the previous run is still in flight. Default `'allow'`. */
291
+ overlap?: 'allow' | 'skip';
292
+ /** Delay each fire by a stable offset of up to this many ms. */
293
+ jitterMs?: number;
294
+ }
295
+ /**
296
+ * The schedules a tenant worker announces, and the wire tenant they belong to: the partition, or
297
+ * the signed tenant token when the app has one (verified by the control plane exactly like a
298
+ * start-run's `tenant`). `items: []` is a statement too ("this app declares no schedules"), which is
299
+ * what lets the control plane withdraw a schedule the app stopped declaring.
300
+ */
301
+ interface ScheduleAnnouncement {
302
+ tenant: string;
303
+ items: AnnouncedSchedule[];
304
+ }
216
305
  /**
217
306
  * A worker's (or control-plane's) advertised identity, wire-protocol support, feature capabilities
218
307
  * and registered handlers. Published on startup + on change (design §7.2) and consumed by
@@ -258,6 +347,13 @@ interface WorkerDescriptor {
258
347
  * that fails at run time.
259
348
  */
260
349
  registrations?: WorkflowRegistration[];
350
+ /**
351
+ * The recurring starts this app declares (see {@link ScheduleAnnouncement}). OPTIONAL and additive:
352
+ * absent = this SDK does not announce schedules (a control plane then neither adopts nor withdraws
353
+ * any for it); a control plane that predates the field ignores it. Rides the descriptor so it
354
+ * inherits its liveness: the control plane only reconciles against what LIVE workers announce.
355
+ */
356
+ schedules?: ScheduleAnnouncement;
261
357
  /** Optional routing partition (queue/group sharding). */
262
358
  partition?: string;
263
359
  /** Optional tenant namespace this instance serves. */
@@ -381,6 +477,8 @@ declare function describeWorker(opts: {
381
477
  * the descriptor entirely when absent or empty, so a worker with nothing to announce keeps the
382
478
  * pre-registrations bytes (and therefore the pre-registrations hash). */
383
479
  registrations?: readonly WorkflowRegistration[] | undefined;
480
+ /** The schedules this app announces. Omitted from the descriptor when absent; `items: []` is kept. */
481
+ schedules?: ScheduleAnnouncement | undefined;
384
482
  startedAt: number;
385
483
  partition?: string | undefined;
386
484
  namespace?: string | undefined;
@@ -929,60 +1027,6 @@ declare function lifecycleDeliveriesOf(run: Pick<WorkflowRun, 'id' | 'status' |
929
1027
  /** The trace id of a W3C `traceparent` (`00-<trace id>-<span id>-<flags>`), or undefined. */
930
1028
  declare function traceIdOfTraceparent(traceparent: string | undefined): string | undefined;
931
1029
 
932
- /**
933
- * A start-time concurrency quota for ONE start: at most `limit` runs sharing `key` may be in flight
934
- * (in `countStatuses`) at once; a start that would exceed it is rejected with
935
- * {@link ConcurrencyLimitError} before any run is created.
936
- *
937
- * The key is global — not per workflow — so different workflows started with the same key share the
938
- * quota (e.g. `tenant:acme` capping every kind of run a tenant can have executing). Passed per start
939
- * as `StartOptions.concurrency`, or derived from the input by a workflow's {@link ConcurrencyConfig}.
940
- */
941
- interface ConcurrencyQuota {
942
- /** The quota bucket, e.g. `tenant:acme`. Stamped on the run as the tag `concurrency:<key>`. */
943
- key: string;
944
- /** Max runs of this key in flight at once. `limit <= 0` rejects every start. */
945
- limit: number;
946
- /**
947
- * Which statuses occupy a slot. Default: every non-terminal status
948
- * ({@link DEFAULT_CONCURRENCY_STATUSES}). Narrow it to e.g. `['pending', 'running']` so runs parked
949
- * on a human (`suspended`) stop counting against the quota.
950
- */
951
- countStatuses?: RunStatus[] | undefined;
952
- }
953
- /**
954
- * A workflow's standing concurrency quota, declared at registration (`register(..., { concurrency })`
955
- * / `@Workflow({ concurrency })`): the key is derived from each start's input, and the limit may be a
956
- * function of the key (per-tenant plans). A `StartOptions.concurrency` on one start overrides it.
957
- */
958
- interface ConcurrencyConfig {
959
- /** Derive the quota key from the input. Return `undefined` to leave this start unlimited. */
960
- key: (input: unknown) => string | undefined;
961
- /** Max in-flight runs per key — a number, or resolved per key (e.g. from the tenant's plan). */
962
- limit: number | ((key: string) => number | Promise<number>);
963
- /** Which statuses occupy a slot. See {@link ConcurrencyQuota.countStatuses}. */
964
- countStatuses?: RunStatus[] | undefined;
965
- }
966
- /** Every non-terminal status: what "in flight" means when a quota doesn't narrow it. */
967
- declare const DEFAULT_CONCURRENCY_STATUSES: readonly RunStatus[];
968
- /** The tag a quota-bearing run carries, so its siblings can be counted by one tag+status query. */
969
- declare function concurrencyTag(key: string): string;
970
- /** Resolve the quota that applies to one start: the per-start override, else the workflow's config. */
971
- declare function resolveConcurrency(override: ConcurrencyQuota | undefined, config: ConcurrencyConfig | undefined, input: unknown): Promise<ConcurrencyQuota | undefined>;
972
- /** Count the runs matching `query` as cheaply as the store allows (count → facets → listing). */
973
- declare function countRuns(store: StateStore, query: Omit<RunQuery, 'limit' | 'offset'>): Promise<number>;
974
- /**
975
- * Reject a start that would exceed `quota`: counts the in-flight runs carrying the quota's tag and
976
- * throws {@link ConcurrencyLimitError} once they reach the limit.
977
- *
978
- * A SOFT cap under a race: the count and the run's creation are separate statements, so N starts
979
- * racing on the last free slot can each see it free (the same guarantee a hand-rolled
980
- * `SELECT count(*)` gate gives). It is exact whenever starts for a key are not simultaneous, and the
981
- * overshoot is bounded by the number of truly concurrent starts. Use `singleton` when you need a
982
- * strict, queueing per-key limit instead of a rejecting one.
983
- */
984
- declare function assertConcurrency(store: StateStore, workflow: string, quota: ConcurrencyQuota): Promise<void>;
985
-
986
1030
  /**
987
1031
  * One loaded copy of this package: its version and the real path of its package root. Two copies are
988
1032
  * the same when their roots are, so the `src` and `dist` builds of one checkout, the ESM and CJS
@@ -1994,14 +2038,16 @@ interface StartOptions {
1994
2038
  * `latest` — a silent fallback is the exact failure this option exists to prevent (a caller that
1995
2039
  * asked for `name@3` and got `name@4` has no way to tell, and its run is already going).
1996
2040
  *
1997
- * NOT available on the two SYNTHESIZED registration paths, which exist precisely because nothing is
1998
- * registered: a child inheriting its remote ancestor's routing (see `findInheritedRegistration`),
1999
- * and convention routing to a live worker group of the same name (`resolveRemoteByConvention`).
2000
- * Both INVENT the version they stamp — the ancestor's, and the `'1'` convention default — as a
2001
- * routing placeholder; neither is evidence that the worker has a body at the version you asked for.
2002
- * A pinned start that reaches them therefore throws rather than pretending to have honoured the pin.
2003
- * To pin a cross-SDK workflow, register it for real — `engine.remote('name', { version: '2', group })`
2004
- * — which puts `name@2` in the registry and pins like any other registration.
2041
+ * NOT available on a child inheriting its remote ancestor's routing (see `findInheritedRegistration`),
2042
+ * which INVENTS the version it stamps (the ancestor's). Convention routing to a live worker group of
2043
+ * the same name (`resolveRemoteByConvention`) honours a pin only when the live workers on that group
2044
+ * themselves DECLARE the pinned version (their announced registrations); a fleet that declares
2045
+ * another version, or none, is no evidence, and the pinned start throws rather than pretending. To
2046
+ * pin a cross-SDK workflow whose workers declare nothing, register it for real —
2047
+ * `engine.remote('name', { version: '2', group })` — which puts `name@2` in the registry.
2048
+ *
2049
+ * A tenant's start ({@link StartRunMessage.version}) does not throw: with no live worker declaring
2050
+ * the version yet, the run waits `blocked` (`no_live_worker`) until one does.
2005
2051
  */
2006
2052
  version?: string | undefined;
2007
2053
  /** Run-scoped tags, merged with the workflow's static `@Workflow({ tags })` onto the run. */
@@ -2089,6 +2135,20 @@ interface SingletonConfig {
2089
2135
  * and a pin against it is genuinely checked.
2090
2136
  */
2091
2137
  declare const VERSION_UNDECLARED_TAG = "version:undeclared";
2138
+ /**
2139
+ * The `error.code` of a run a tenant started while no live worker served it yet (see
2140
+ * `WorkflowEngine.startForTenant`). The run is parked `blocked` and the blocked-recovery poll starts
2141
+ * it as soon as a worker on its group (declaring its pinned version, when it has one) is live. It is
2142
+ * never dead-lettered for waiting: a start is a request queued for its consumer, however late that
2143
+ * consumer boots. Cancel it to drop it.
2144
+ */
2145
+ declare const NO_LIVE_WORKER = "no_live_worker";
2146
+ /**
2147
+ * How long an adopted tenant schedule may go unannounced by every live worker of its app before the
2148
+ * control plane pauses it (see `WorkflowEngine.syncAnnouncedSchedules`). Long enough to ride out a
2149
+ * rolling deploy; a schedule is never deleted for missing.
2150
+ */
2151
+ declare const DEFAULT_ANNOUNCED_SCHEDULE_GRACE_MS: number;
2092
2152
  interface WorkflowEngineDeps {
2093
2153
  store: StateStore;
2094
2154
  /** A single task transport. Shorthand for a one-entry `transports` pool (id `default`). */
@@ -2161,6 +2221,11 @@ interface WorkflowEngineDeps {
2161
2221
  * for the prior unbounded await — byte-identical behavior when unset. If a `RemoteWorkflowExecutor` is
2162
2222
  * ALSO constructed with its own `timeoutMs`, the shorter of the two deadlines wins; prefer setting only
2163
2223
  * one (this rearmed window for heartbeat-aware workers, or the fixed `timeoutMs` otherwise).
2224
+ *
2225
+ * A turn DISPATCHED over a broker (a tenant's or another SDK's worker) is never left without a
2226
+ * deadline: unset, its window is {@link reconcileMs} (5 min by default), so a run whose worker died
2227
+ * holding the turn is re-driven instead of waiting forever. `reconcileMs: 0` with this unset keeps
2228
+ * the old unbounded wait.
2164
2229
  */
2165
2230
  remoteAdvanceSilenceMs?: number | undefined;
2166
2231
  /**
@@ -2174,6 +2239,9 @@ interface WorkflowEngineDeps {
2174
2239
  * advances), so it's a safe self-heal, not a retry that can double-dispatch. The primary event path
2175
2240
  * still wins first for a healthy run (it re-drives long before this fires), so this only ever fires
2176
2241
  * for a genuinely-orphaned run. Default 5min; set `0` to disable (the prior wake-forever behavior).
2242
+ *
2243
+ * Also the default re-drive window of a workflow turn dispatched to a remote worker when
2244
+ * {@link remoteAdvanceSilenceMs} is unset (see there).
2177
2245
  */
2178
2246
  reconcileMs?: number | undefined;
2179
2247
  /**
@@ -2375,6 +2443,13 @@ declare class WorkflowEngine {
2375
2443
  private readonly maxRecoveryAttempts?;
2376
2444
  private readonly unregisteredWorkflowGraceMs;
2377
2445
  private readonly remoteAdvanceSilenceMs?;
2446
+ /**
2447
+ * The re-drive window of a DISPATCHED workflow turn (a remote worker's `advance` sent over the
2448
+ * broker): {@link WorkflowEngineDeps.remoteAdvanceSilenceMs} when set, else `reconcileMs`. Without
2449
+ * it a run suspended on a turn whose worker died (and whose job was lost with it) had no `wakeAt`
2450
+ * and nothing re-drove it, ever. Heartbeats rearm it like the explicit window.
2451
+ */
2452
+ private readonly dispatchedTurnSilenceMs;
2378
2453
  private readonly reconcileMs;
2379
2454
  /** Parked workflow bodies kept between turns (see {@link WorkflowEngineDeps.stickyRuns}). */
2380
2455
  private readonly sticky;
@@ -2397,6 +2472,10 @@ declare class WorkflowEngine {
2397
2472
  private readonly remoteRedispatchMax;
2398
2473
  /** How long a `blocked` run waits before the recovery poll re-checks the live fleet (design §7.5). */
2399
2474
  private readonly blockedPollMs;
2475
+ /** Verifies the wire tenant of a start-run, and of a worker's schedule announcement. */
2476
+ private readonly verifyTenant;
2477
+ /** Wire tenants whose schedule announcement failed verification, warned about once. */
2478
+ private readonly rejectedScheduleTenants;
2400
2479
  private readonly workerDescriptorCacheMs;
2401
2480
  private readonly descriptorCache;
2402
2481
  /** This engine's control-plane handshake descriptor — negotiated against each worker (design §7.3). */
@@ -2602,11 +2681,13 @@ declare class WorkflowEngine {
2602
2681
  * The earliest known time (epoch ms) the poll has work, if it is at or before `byMs`: this
2603
2682
  * namespace's next due timer (`listDueTimers` up to `byMs`, limit one: it returns the most overdue
2604
2683
  * first), the next `blocked` run's recovery poll, and with `persistedSchedules` the next persisted
2605
- * schedule to fire (see {@link ScheduleClient.nextFireAt}). `undefined` when nothing is due by
2684
+ * schedule to fire (see {@link ScheduleClient.nextFireAt}; with `announcedSchedules` alone, the next
2685
+ * schedule adopted from a tenant). `undefined` when nothing is due by
2606
2686
  * then. A poller reads it before waiting longer than its tick, so the wait never outlasts a timer.
2607
2687
  */
2608
2688
  nextDueAt(byMs: number, opts?: {
2609
2689
  persistedSchedules?: boolean;
2690
+ announcedSchedules?: boolean;
2610
2691
  }): Promise<number | undefined>;
2611
2692
  /**
2612
2693
  * Pick up a run another instance announced as enqueued: run it here if it is still `pending`.
@@ -3226,6 +3307,38 @@ declare class WorkflowEngine {
3226
3307
  private deliver;
3227
3308
  start<C extends WorkflowClass>(workflow: C, input: WorkflowInputOf<C>, runId: string, opts?: StartOptions): Promise<RunResult>;
3228
3309
  start<TInput>(workflow: string, input: TInput, runId: string, opts?: StartOptions): Promise<RunResult>;
3310
+ /**
3311
+ * {@link start}'s body. `parkUnroutable` is the tenant start path ({@link startForTenant}): a
3312
+ * workflow that nothing here can route yet (no registration, no live worker group serving it at
3313
+ * the asked version) is created `blocked` with code {@link NO_LIVE_WORKER} instead of throwing, so
3314
+ * a start whose caller has already returned is never lost.
3315
+ */
3316
+ private startWith;
3317
+ /**
3318
+ * Create the run of a tenant start that nothing can route yet, parked `blocked` with code
3319
+ * {@link NO_LIVE_WORKER} (see {@link startWith}). Idempotent by run id like {@link start}, counts
3320
+ * against a concurrency quota like it, and keeps the start's options on the row: its version (the
3321
+ * pin, else the `'1'` placeholder tagged {@link VERSION_UNDECLARED_TAG} that the first live worker's
3322
+ * declared version replaces), priority, tags, search attributes and customer tenant. A delayed
3323
+ * start is checked first at its `startAt`.
3324
+ */
3325
+ private parkStartForWorker;
3326
+ /**
3327
+ * The control plane's half of a tenant start ({@link StartRunMessage}): start the run with every
3328
+ * option the message carries, under the tenant's namespace. The tenant caller has already returned
3329
+ * `pending`, so nothing here may lose the start:
3330
+ * - a workflow no live worker serves yet is parked `blocked` ({@link NO_LIVE_WORKER}) and started
3331
+ * by the blocked-recovery poll once one is live;
3332
+ * - a start the quota or singleton back-pressure rejects, or whose input a registration here
3333
+ * rejects, is recorded as a `failed` run carrying the reason, so the caller's run id resolves
3334
+ * to an answer instead of nothing (and a deterministic failure is never redelivered);
3335
+ * - a message with no `workflow` is logged and dropped: there is nothing to start;
3336
+ * - any other error (a store blip) is rethrown for the transport to redeliver the message, and a
3337
+ * redelivery is a no-op once the run exists (idempotent by run id).
3338
+ */
3339
+ startForTenant(message: StartRunMessage, namespace: string, tenant: Pick<StartOptions, 'tenantId' | 'tenantKind'>): Promise<RunResult>;
3340
+ /** A tenant start {@link startForTenant} could not admit, kept as a `failed` run with the reason. */
3341
+ private recordRejectedStart;
3229
3342
  /**
3230
3343
  * The tenant columns a new run gets: an explicit `opts.tenantId` (`null` = none) wins, else the
3231
3344
  * context tenant when tenancy is on, else none (no keys at all, so a run row is unchanged when
@@ -3579,6 +3692,19 @@ declare class WorkflowEngine {
3579
3692
  * `cancel()`: settled, not ours to touch), or `undefined` when it was left for later.
3580
3693
  */
3581
3694
  private settleUnregistered;
3695
+ /**
3696
+ * Due runs whose workflow nothing could resolve on the last try (`runId` → clock ms of the next
3697
+ * try): a tenant run whose worker is down, say. The timer poll ticks every second and the run stays
3698
+ * due, so without this each tick would lease it, fail to resolve it and log it again. The next try
3699
+ * backs off with the time it has been due ({@link noteUnroutable}). In memory on purpose: the run
3700
+ * row is not touched, so its age toward `unregisteredWorkflowGraceMs` is unchanged, and another
3701
+ * instance (or a restart) simply tries it sooner.
3702
+ */
3703
+ private readonly unroutableUntil;
3704
+ /** Whether `runId` is inside its {@link unroutableUntil} back-off at `nowMs`. */
3705
+ private unroutableBackoff;
3706
+ /** Back off the next timer-poll try of `run`, left for later as unresolvable (see {@link unroutableUntil}). */
3707
+ private noteUnroutable;
3582
3708
  /** Log a run skipped for an unregistered workflow — still there, still not progressing. */
3583
3709
  private logUnregisteredSkip;
3584
3710
  /**
@@ -4071,6 +4197,23 @@ declare class WorkflowEngine {
4071
4197
  *
4072
4198
  * Workflows only, and deliberately: see the "steps are out of scope" note in `handshake/announced`.
4073
4199
  */
4200
+ /**
4201
+ * Adopt the schedules tenant apps announce (their `schedules` module option, carried on their live
4202
+ * workers' descriptors) as persisted schedules, and withdraw the ones an app stopped announcing.
4203
+ * The control plane's timer poll calls it; {@link ScheduleClient.tick} fires them.
4204
+ *
4205
+ * Per app (the namespace its announcement's verified `tenant` maps to, as for a start-run): the
4206
+ * schedules announced by its live workers, where two workers disagree on a key the one that
4207
+ * started last (its deploy is the newer one) wins. An app with no live worker that states its
4208
+ * schedules is left alone, so its schedules keep firing into runs that wait for a worker. See
4209
+ * {@link ScheduleClient.syncAnnounced} for the reconciliation rule and `graceMs` (default 10
4210
+ * minutes). A namespaced engine adopts only its own namespace's. Nothing without a store that
4211
+ * persists schedules or a transport that reads worker descriptors.
4212
+ */
4213
+ syncAnnouncedSchedules(opts?: {
4214
+ graceMs?: number;
4215
+ nowMs?: number;
4216
+ }): Promise<Map<string, AnnouncedScheduleSync>>;
4074
4217
  announcedWorkflows(): Promise<AnnouncedWorkflow[]>;
4075
4218
  /**
4076
4219
  * {@link announcedWorkflows}, plus the thing a list of workflows can never say: why it is the
@@ -4543,6 +4686,20 @@ declare class WorkflowEngine {
4543
4686
  * own `finally` also releases (the run-execution path) is safe.
4544
4687
  */
4545
4688
  private parkBlocked;
4689
+ /**
4690
+ * Of the due `blocked` runs, the ones to re-drive now. A run parked {@link NO_LIVE_WORKER} (a tenant
4691
+ * start nothing could route) is re-driven only once a live worker serves its group, at its pinned
4692
+ * version when it has one; until then it is re-parked with a longer wait each time, up to
4693
+ * {@link NO_LIVE_WORKER_MAX_POLL_MS}, and never reaches `resume` (which would treat it as an
4694
+ * unregistered workflow and dead-letter it after `unregisteredWorkflowGraceMs`). Every other
4695
+ * blocked run is re-driven as before.
4696
+ */
4697
+ private routableBlocked;
4698
+ /**
4699
+ * One {@link NO_LIVE_WORKER} run: the run to re-drive (its version taken from the live worker when
4700
+ * the start did not pin one and the worker declares it), or `undefined` after re-parking it.
4701
+ */
4702
+ private routeParkedStart;
4546
4703
  /** Runs parked `blocked` whose recovery poll is due (`wakeAt <= nowMs`), namespace-scoped like
4547
4704
  * {@link resumeDueTimers}. Re-driving one re-checks the live fleet: it dispatches if a
4548
4705
  * capable+compatible worker has appeared, else re-parks with a fresh `wakeAt` (design §7.5). */
@@ -4872,9 +5029,22 @@ interface ScheduleDescription {
4872
5029
  /** The customer the schedule and its runs belong to, when it has one. */
4873
5030
  tenantId?: string | undefined;
4874
5031
  tenantKind?: string | undefined;
5032
+ /**
5033
+ * Set on a schedule a tenant app ANNOUNCED (its `schedules` module option) and the control plane
5034
+ * adopted: the key the app declares it under. Its `namespace` is the app (partition).
5035
+ */
5036
+ announcedKey?: string | undefined;
5037
+ /** An announced schedule that no live worker of its app announces any more: since when. */
5038
+ unannouncedSince?: Date | undefined;
5039
+ /** When the control plane paused it for staying unannounced past the grace period. */
5040
+ withdrawnAt?: Date | undefined;
4875
5041
  createdAt: Date;
4876
5042
  updatedAt: Date;
4877
5043
  }
5044
+ /** The tag on every schedule adopted from a tenant's announcement (and on the runs it starts). */
5045
+ declare const ANNOUNCED_SCHEDULE_TAG = "schedule:announced";
5046
+ /** The control plane's schedule id for the schedule `key` announced by the app on `namespace`. */
5047
+ declare function announcedScheduleId(namespace: string, key: string): string;
4878
5048
  /** Filter for `engine.schedules.list`. */
4879
5049
  type ScheduleListQuery = Omit<ScheduleQuery, 'dueBy'>;
4880
5050
  /** Thrown by `engine.schedules.create` when the id is taken (use `upsert` to replace). */
@@ -4887,9 +5057,30 @@ declare class ScheduleNotFoundError extends Error {
4887
5057
  readonly scheduleId: string;
4888
5058
  constructor(scheduleId: string);
4889
5059
  }
5060
+ /** What {@link ScheduleClient.syncAnnounced} did to a namespace's adopted schedules. */
5061
+ interface AnnouncedScheduleSync {
5062
+ /** Created, or re-applied because the announced definition changed. */
5063
+ adopted: string[];
5064
+ /** Announced again after missing (and resumed, when it had been withdrawn). */
5065
+ restored: string[];
5066
+ /** Missing from the announcement for the first time: the grace period starts. */
5067
+ missing: string[];
5068
+ /** Paused because it stayed unannounced past the grace period. */
5069
+ withdrawn: string[];
5070
+ /** Announced, but the definition does not evaluate (bad cron, both or neither cadence). */
5071
+ invalid: {
5072
+ key: string;
5073
+ error: string;
5074
+ }[];
5075
+ }
4890
5076
  /** The engine surface the schedule client drives. */
4891
5077
  interface ScheduleHost {
4892
5078
  start(workflow: string, input: unknown, runId: string, opts?: StartOptions): Promise<RunResult>;
5079
+ /**
5080
+ * The tenant start path, used to fire an announced schedule: a workflow no live worker serves yet
5081
+ * is parked `blocked` (`no_live_worker`) until one is, instead of throwing. Absent = `start`.
5082
+ */
5083
+ startParked?(workflow: string, input: unknown, runId: string, opts?: StartOptions): Promise<RunResult>;
4893
5084
  getRun(runId: string): Promise<WorkflowRun | null>;
4894
5085
  /** True once the engine has begun shutting down; `tick` fires nothing more after that. */
4895
5086
  isDraining?(): boolean;
@@ -4953,21 +5144,60 @@ declare class ScheduleClient {
4953
5144
  */
4954
5145
  trigger(id: string): Promise<RunResult>;
4955
5146
  /**
4956
- * Fire every due schedule (in this engine's namespace; all namespaces for an operator engine):
5147
+ * Start one run of `record`: through the tenant start path for an announced schedule (its run waits
5148
+ * `blocked` for a live worker of its app instead of failing), else a plain `start`.
5149
+ */
5150
+ private startFor;
5151
+ /**
5152
+ * Fire every due schedule (in this engine's namespace; all namespaces for an operator engine; only
5153
+ * those carrying `opts.tag` when given):
4957
5154
  * start its window's run and advance it to the next window. Called by the NestJS timer poller on
4958
5155
  * each tick when `persistedSchedules` is on; call it yourself from any other driver. Returns the
4959
5156
  * run ids started (or re-found, for an idempotent re-fire).
4960
5157
  */
4961
- tick(nowMs?: number): Promise<string[]>;
5158
+ tick(nowMs?: number, opts?: {
5159
+ tag?: string;
5160
+ }): Promise<string[]>;
4962
5161
  /**
4963
5162
  * When {@link tick} next has a schedule to fire, if one is due by `byMs`: the earliest `nextFireAt`
4964
- * of the unpaused schedules (of this engine's namespace) due by then, else `undefined`. One indexed
5163
+ * of the unpaused schedules (of this engine's namespace, carrying `opts.tag` when given) due by
5164
+ * then, else `undefined`. One indexed
4965
5165
  * read (the due-schedule scan `tick` makes, with a later bound and a limit of one). A store that
4966
5166
  * does not persist schedules has none.
4967
5167
  */
4968
- nextFireAt(byMs: number): Promise<number | undefined>;
5168
+ nextFireAt(byMs: number, opts?: {
5169
+ tag?: string;
5170
+ }): Promise<number | undefined>;
4969
5171
  /** Fire one due schedule and advance it. Returns the run id started, if any. */
4970
5172
  private fire;
5173
+ /**
5174
+ * An announced schedule whose previous run is still parked waiting for a live worker of its app
5175
+ * (the app is down): this window is folded into that run instead of parking one more. However long
5176
+ * the app is down, it finds at most one run per schedule waiting when it comes back, the same
5177
+ * bound `catchup: 'latest'` puts on windows missed while no scheduler polled.
5178
+ */
5179
+ private waitingForWorker;
5180
+ /**
5181
+ * Reconcile the schedules adopted from one app (`namespace`) with what its LIVE workers announce
5182
+ * now (`items`, one per key; the caller resolved disagreeing workers). The rule:
5183
+ * - an announced key with no schedule yet is created (id {@link announcedScheduleId}, tagged
5184
+ * {@link ANNOUNCED_SCHEDULE_TAG}, `catchup: 'latest'`); one whose definition changed is
5185
+ * re-applied like `upsert` (its history kept, its next fire recomputed from now). An equal
5186
+ * definition writes nothing, so any number of replicas announcing the same set is a no-op;
5187
+ * - a pause or resume made from the console survives: a re-applied definition keeps the current
5188
+ * paused state, unless the app's own declared `paused` changed;
5189
+ * - an adopted schedule the app no longer announces is marked missing, and paused ("withdrawn")
5190
+ * once it has stayed missing for `graceMs`. It is never deleted: its history stays, and an app
5191
+ * that announces it again (a rollback) gets it back, resumed unless an operator had paused it.
5192
+ *
5193
+ * Call it only for an app that has at least one live worker stating its schedules: with none (the
5194
+ * app is down, or runs an SDK that does not announce schedules), nothing is withdrawn, and its
5195
+ * schedules keep firing into runs that wait for a worker.
5196
+ */
5197
+ syncAnnounced(namespace: string, items: readonly AnnouncedSchedule[], opts: {
5198
+ nowMs?: number;
5199
+ graceMs: number;
5200
+ }): Promise<AnnouncedScheduleSync>;
4971
5201
  /** `overlap: 'skip'` and the previous run of this schedule is still in flight. */
4972
5202
  private overlapping;
4973
5203
  private mustGet;
@@ -6764,6 +6994,25 @@ interface StartRunMessage {
6764
6994
  tenantId?: string | undefined;
6765
6995
  /** The kind of {@link tenantId} (`organization`, `clinic`, …). */
6766
6996
  tenantKind?: string | undefined;
6997
+ /**
6998
+ * Start THIS version (see `StartOptions.version`). The control plane starts it only on a live
6999
+ * worker that declares that version; until one does, the run waits `blocked` (`no_live_worker`).
7000
+ * A control plane older than this field ignores it and starts the newest version.
7001
+ */
7002
+ version?: string | undefined;
7003
+ /** Dispatch priority stamped on the run (see `StartOptions.priority`). Higher wins. */
7004
+ priority?: number | undefined;
7005
+ /**
7006
+ * Delayed start, as epoch ms (see `StartOptions.startAt`). Always a number on the wire: a `Date`
7007
+ * does not survive JSON. A time not in the future starts the run at once.
7008
+ */
7009
+ startAt?: number | undefined;
7010
+ /**
7011
+ * A start-time concurrency quota (see `StartOptions.concurrency`), checked on the control plane.
7012
+ * A start over it is recorded as a `failed` run (`concurrency_limit`) instead of throwing, since
7013
+ * the tenant caller has already returned.
7014
+ */
7015
+ concurrency?: ConcurrencyQuota | undefined;
6767
7016
  }
6768
7017
  /**
6769
7018
  * A tenant worker → control plane read/control request over the shared transport. Enqueued on
@@ -9864,4 +10113,4 @@ declare function prevRRuleFireMs(rule: ParsedRRule, atMs: number): number | null
9864
10113
  */
9865
10114
  declare function settleResultsWithPlainCalls(store: Pick<StateStore, 'getRun' | 'getCheckpoint'> & Partial<Pick<StateStore, 'getRuns' | 'getCheckpointsForSettle' | 'getCheckpoints' | 'settleCheckpointsIfPending'>>, results: StepResultSettlement[]): Promise<(StepCheckpoint | null)[]>;
9866
10115
 
9867
- export { ACCUMULATOR_SEEN_MAX, ANY_WAIT_GROUP, type AccumulatorHost, type AccumulatorStartOptions, 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 AttributedEngineEvent, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, type BufferedSignalRow, CHILD_EDGE_PREFIXES, CONTROL_FLOW_SIGNAL, CORE_ORIGIN, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type CheckpointAggregatingStore, type CheckpointNameKind, type CheckpointQuery, type CheckpointStat, type ChildCallOptions, type ChildWait, CodecStateStore, type CodecStateStoreOptions, type ConcurrencyConfig, ConcurrencyLimitError, type ConcurrencyQuota, type ConsoleCapabilities, type ConsoleFederation, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_CONCURRENCY_STATUSES, DEFAULT_PARTITION, DEFAULT_STALLED_AFTER_MS, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type Disagreement, type DispatchDiagnostics, type DispatchPlan, DuplicateDurableCopyError, type DurableCopy, type DurableExecution, type DurableExecutionWrapper, type DurableTopology, type DurableWebhook, DurableWorkflow, type DynamicWorkflowCtx, ENGINE_MINTED_TAG_PREFIXES, ENTITY_WORKFLOW, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, type EngineTenancy, Entities, type EntityConfig, type EntityHandler, type EntityHost, type EntityWorkflowHost, EventAccumulators, type EventBatchConfig, type EventSubscription, FAN_SUMMARY_FAILURES, type FanJoin, type FanPage, type FanPageQuery, type FanSummary, type FanWait, FatalError, type FindStalledRunsOptions, GatherError, type GatherItemFailure, type GroupHealth, HANDOFF_SEQ_BASE, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryRunQueue, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, LIFECYCLE_COALESCED_TAG_PREFIX, LIFECYCLE_HEAL_WINDOW_MS, LIFECYCLE_ORPHAN_MS, LIFECYCLE_OWED_TAG_PREFIX, LIFECYCLE_PENDING_TAG, LIFECYCLE_REGISTRY_HEARTBEAT_MS, LIFECYCLE_REGISTRY_STALE_MS, LIFECYCLE_REGISTRY_TAG, LIFECYCLE_REGISTRY_TTL_MS, LIFECYCLE_REGISTRY_WORKFLOW, LIFECYCLE_TRACE_TAG_PREFIX, LIFECYCLE_TRIGGERED_TAG_PREFIX, LIFECYCLE_TRIGGER_FAILED_TAG_PREFIX, type LifecycleDelivery, type LifecycleDeliveryState, type LifecycleEventOf, type LifecycleKind, type LifecycleRegistryEntry, type LifecycleSource, type LifecycleSubscriptionLink, type ListStalledRunsOptions, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NestedWorkflowCallError, NonDeterminismError, type OnErrorInput, type OnErrorRoute, type OnEventEntry, type OwnedLeaseReclaim, PARENT_CLOSE_TAG_PREFIX, type ParentClosePolicy, type ParsedRRule, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, REMOTE_EVENT, RUN_HISTORY_FIXTURE_VERSION, RUN_VALUE_FACET_LIMIT, RUN_VALUE_FACET_SCAN, RUN_WAIT_TOKEN_PREFIX, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RepublishLifecycleResult, type RepublishLifecycleTarget, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAppAttribution, RunAppStamper, type RunAppTopologyOptions, type RunAttributeRow, type RunConsumerOptions, type RunDetail, type RunDetailOptions, type RunDispatch, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunQueueOptions, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunScope, type RunStatus, type RunTenant, type RunValueAxis, type RunValueFacetOptions, type RunValueFacetOrder, type RunValueFacetRow, type RunWaitLink, type RunWaiting, SINGLETON_ACTIVE_STATUSES, SINGLETON_ADMITTED_TAG, SINGLETON_LOCK_CHUNK, SINGLETON_RESERVED_TAGS, SINGLETON_TRACKED_TAG, STATE_STORE, STATE_STORE_CANONICAL, SUMMARY_CHILD_LIMIT, type ScalarAttributeFilter, type ScheduleAction, ScheduleAlreadyExistsError, ScheduleClient, type ScheduleClientOptions, type ScheduleDescription, type ScheduleHost, type ScheduleListQuery, ScheduleNotFoundError, type ScheduleOptions, type ScheduleQuery, type ScheduleRecord, type ScheduleTickEngine, type ScheduledWorkflow, type SchemaIssue, type SchemaValidationCode, SchemaValidationError, type SearchAttributes, type SearchAttributesSchema, type Settled, type SignalOptions, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, type StalePendingStep, type StalledRunInfo, StandardSchemaV1, type StartOptions, type StartRunMessage, type StateStore, type StepCheckpoint, type StepConfig, type StepDef, type StepDispatchOpts, type StepError, type StepEvent, type StepHandler, type StepInterceptor, type StepInvocation, type StepKind, type StepLogger, type StepOptions, type StepRef, type StepResult, type StepResultSettlement, type StepScope, type StepSettlement, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type TenantFilter, type TenantRow, type TenantTokenSource, type TenantVerifier, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, type VerifiedTenant, WORKFLOW_NAME_KEY, type WaitAnyCondition, type WaitAnyOutcome, type WaitAnyResult, type WaitCondition, type WaitConditionSpec, type WaitForRunOptions, type WireDates, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerDescriptor, type WorkerHeartbeat, type WorkerLifecycle, type WorkerStatus, type WorkflowAnnouncement, WorkflowBlocked, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, type WorkflowDirectory, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowHandler, type WorkflowInputOf, type WorkflowLifecycleEvent, type WorkflowLifecycleLinks, WorkflowNotRegistered, type WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, acceptingSubscription, accumulatorRunId, aggregateAnnouncements, aggregatesCheckpoints, announcementsOf, anyCheckpointName, applyAttributeQuery, assertConcurrency, assertRoutes, assertSingleDurableCopy, attributeColumnFor, attributeOperand, attributePredicateOperands, axisIsRunColumn, bindWorkflowClass, breakpointToken, bufferedEventReaches, buildWorkflowDirectory, canRoute, capableWorkers, carriesLifecyclePending, checkpointNameKind, checkpointStatsOf, childIdsOf, classifyWaiterToken, clearDurableExecutionWrappers, clearTerminalSingletonAdmission, coalescedSubscribersOf, codeAndDetails, codeOf, collectMetrics, concurrencyTag, controlPlaneAttribution, controlPlaneDescriptor, countRuns, coveredTokens, createStepLogger, currentStep, currentStepScope, currentWorkflowCtx, debug, describeWorker, descriptorHash, detailsOf, durableCopies, error, etagMatches, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, extendEtag, facetOrigin, fanPageBounds, fanPageEtag, findStalledRuns, foldedCount, getRunsByIds, grantsClientTenant, handoffHandlerId, handoffName, hasDurableExecutionWrappers, heartbeatStatus, hmacTenantVerifier, indexWaitersByRun, info, inheritTenant, isAnyCheckpoint, isAnyMember, isEngineMintedTag, isEventToken, isFailedMember, isLegacyDescriptor, isLifecycleTag, isNonEmptyRunScope, isRemoteEvent, isWorkflowControlFlowSignal, legacySingletonHolders, lifecycleDeliveriesOf, lifecycleEventName, lifecycleEventOf, lifecycleKindOf, lifecycleRegistryNamespace, lifecycleRegistryRunId, lifecycleRegistrySubscriptions, lifecycleRunId, lifecycleSourceOf, lifecycleTraceparentOf, listSignalWaitersOfRuns, liveHandoff, log, markRemoteEvent, matchesAttributes, matchesTenantPredicates, mergeRunFacetRows, mergeRunValueFacetRows, missingCapabilities, negotiate, nextCronFireMs, nextRRuleFireMs, nextScheduleFireAt, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, onErrorRunId, owedSubscribersOf, pageFan, pageFanFromStore, parentRunIdOf, parseDuration, parseLifecycleEvent, parseRRule, parseWebhookToken, partitionOfToken, planDispatch, poolNamespace, prevCronFireMs, prevRRuleFireMs, queryCheckpointsOf, readBufferedEvent, readRunsByIds, readSearchAttributes, requiredCapabilities, resolveConcurrency, resolveRouting, resolveRunWaiting, resolveTenantToken, resolveWireTenant, retentionKeeps, retiredHandoffName, routeFor, rowTenant, runCompletedEvent, runDetailEtag, runDurableExecution, runFailedEvent, runInStepLogger, runInStepScope, runInWorkflowCtx, runOutsideWorkflowCtx, runSchedules, runStepHandler, runTraceId, runValueFacetsFromRuns, runWaitPrefix, runWaitTargetOf, runWaitToken, sanitizeQueueToken, scheduleRunIdAt, scheduledRunId, scopeBufferedEvent, scopeTenantQuery, sealDurableCopies, settleResultsWithPlainCalls, signTenantToken, singletonAdmissionDenialPatch, singletonAdmissionTags, singletonClaimantIds, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, summarizeFan, summarizeRunFromStore, summarizeTimeline, tenantAppOf, tenantGroup, tenantIdsFor, tenantVisible, toEventSubscription, traceIdOfTraceparent, triggerFailedSubscribersOf, triggeredRunsOf, triggeredSubscribersOf, useDurableExecution, verifyWireTenant, warn, withSingletonTracked, withoutSingletonMarkers, workflowName };
10116
+ export { ACCUMULATOR_SEEN_MAX, ANNOUNCED_SCHEDULE_TAG, ANY_WAIT_GROUP, type AccumulatorHost, type AccumulatorStartOptions, type Admission, type AdmissionBackend, type AdmissionItem, type AllOptions, type AllSettledOptions, type AllStepsOptions, type AllStepsSettledOptions, type AnnouncedSchedule, type AnnouncedScheduleSync, type AnnouncedWorkflow, type AnnouncementEvidence, type AttributeFilter, type AttributeOp, type AttributePredicateOperand, type AttributeValue, type AttributedEngineEvent, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, type BufferedSignalRow, CHILD_EDGE_PREFIXES, CONTROL_FLOW_SIGNAL, CORE_ORIGIN, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type CheckpointAggregatingStore, type CheckpointNameKind, type CheckpointQuery, type CheckpointStat, type ChildCallOptions, type ChildWait, CodecStateStore, type CodecStateStoreOptions, type ConcurrencyConfig, ConcurrencyLimitError, type ConcurrencyQuota, type ConsoleCapabilities, type ConsoleFederation, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_ANNOUNCED_SCHEDULE_GRACE_MS, DEFAULT_CONCURRENCY_STATUSES, DEFAULT_PARTITION, DEFAULT_STALLED_AFTER_MS, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type Disagreement, type DispatchDiagnostics, type DispatchPlan, DuplicateDurableCopyError, type DurableCopy, type DurableExecution, type DurableExecutionWrapper, type DurableTopology, type DurableWebhook, DurableWorkflow, type DynamicWorkflowCtx, ENGINE_MINTED_TAG_PREFIXES, ENTITY_WORKFLOW, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, type EngineTenancy, Entities, type EntityConfig, type EntityHandler, type EntityHost, type EntityWorkflowHost, EventAccumulators, type EventBatchConfig, type EventSubscription, FAN_SUMMARY_FAILURES, type FanJoin, type FanPage, type FanPageQuery, type FanSummary, type FanWait, FatalError, type FindStalledRunsOptions, GatherError, type GatherItemFailure, type GroupHealth, HANDOFF_SEQ_BASE, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryRunQueue, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, LIFECYCLE_COALESCED_TAG_PREFIX, LIFECYCLE_HEAL_WINDOW_MS, LIFECYCLE_ORPHAN_MS, LIFECYCLE_OWED_TAG_PREFIX, LIFECYCLE_PENDING_TAG, LIFECYCLE_REGISTRY_HEARTBEAT_MS, LIFECYCLE_REGISTRY_STALE_MS, LIFECYCLE_REGISTRY_TAG, LIFECYCLE_REGISTRY_TTL_MS, LIFECYCLE_REGISTRY_WORKFLOW, LIFECYCLE_TRACE_TAG_PREFIX, LIFECYCLE_TRIGGERED_TAG_PREFIX, LIFECYCLE_TRIGGER_FAILED_TAG_PREFIX, type LifecycleDelivery, type LifecycleDeliveryState, type LifecycleEventOf, type LifecycleKind, type LifecycleRegistryEntry, type LifecycleSource, type LifecycleSubscriptionLink, type ListStalledRunsOptions, type MetricsCollector, type MetricsSnapshot, NO_LIVE_WORKER, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NestedWorkflowCallError, NonDeterminismError, type OnErrorInput, type OnErrorRoute, type OnEventEntry, type OwnedLeaseReclaim, PARENT_CLOSE_TAG_PREFIX, type ParentClosePolicy, type ParsedRRule, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, REMOTE_EVENT, RUN_HISTORY_FIXTURE_VERSION, RUN_VALUE_FACET_LIMIT, RUN_VALUE_FACET_SCAN, RUN_WAIT_TOKEN_PREFIX, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RepublishLifecycleResult, type RepublishLifecycleTarget, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAppAttribution, RunAppStamper, type RunAppTopologyOptions, type RunAttributeRow, type RunConsumerOptions, type RunDetail, type RunDetailOptions, type RunDispatch, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunQueueOptions, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunScope, type RunStatus, type RunTenant, type RunValueAxis, type RunValueFacetOptions, type RunValueFacetOrder, type RunValueFacetRow, type RunWaitLink, type RunWaiting, SINGLETON_ACTIVE_STATUSES, SINGLETON_ADMITTED_TAG, SINGLETON_LOCK_CHUNK, SINGLETON_RESERVED_TAGS, SINGLETON_TRACKED_TAG, STATE_STORE, STATE_STORE_CANONICAL, SUMMARY_CHILD_LIMIT, type ScalarAttributeFilter, type ScheduleAction, ScheduleAlreadyExistsError, type ScheduleAnnouncement, ScheduleClient, type ScheduleClientOptions, type ScheduleDescription, type ScheduleHost, type ScheduleListQuery, ScheduleNotFoundError, type ScheduleOptions, type ScheduleQuery, type ScheduleRecord, type ScheduleTickEngine, type ScheduledWorkflow, type SchemaIssue, type SchemaValidationCode, SchemaValidationError, type SearchAttributes, type SearchAttributesSchema, type Settled, type SignalOptions, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, type StalePendingStep, type StalledRunInfo, StandardSchemaV1, type StartOptions, type StartRunMessage, type StateStore, type StepCheckpoint, type StepConfig, type StepDef, type StepDispatchOpts, type StepError, type StepEvent, type StepHandler, type StepInterceptor, type StepInvocation, type StepKind, type StepLogger, type StepOptions, type StepRef, type StepResult, type StepResultSettlement, type StepScope, type StepSettlement, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type TenantFilter, type TenantRow, type TenantTokenSource, type TenantVerifier, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, type VerifiedTenant, WORKFLOW_NAME_KEY, type WaitAnyCondition, type WaitAnyOutcome, type WaitAnyResult, type WaitCondition, type WaitConditionSpec, type WaitForRunOptions, type WireDates, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerDescriptor, type WorkerHeartbeat, type WorkerLifecycle, type WorkerStatus, type WorkflowAnnouncement, WorkflowBlocked, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, type WorkflowDirectory, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowHandler, type WorkflowInputOf, type WorkflowLifecycleEvent, type WorkflowLifecycleLinks, WorkflowNotRegistered, type WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, acceptingSubscription, accumulatorRunId, aggregateAnnouncements, aggregatesCheckpoints, announcedScheduleId, announcementsOf, anyCheckpointName, applyAttributeQuery, assertConcurrency, assertRoutes, assertSingleDurableCopy, attributeColumnFor, attributeOperand, attributePredicateOperands, axisIsRunColumn, bindWorkflowClass, breakpointToken, bufferedEventReaches, buildWorkflowDirectory, canRoute, capableWorkers, carriesLifecyclePending, checkpointNameKind, checkpointStatsOf, childIdsOf, classifyWaiterToken, clearDurableExecutionWrappers, clearTerminalSingletonAdmission, coalescedSubscribersOf, codeAndDetails, codeOf, collectMetrics, concurrencyTag, controlPlaneAttribution, controlPlaneDescriptor, countRuns, coveredTokens, createStepLogger, currentStep, currentStepScope, currentWorkflowCtx, debug, describeWorker, descriptorHash, detailsOf, durableCopies, error, etagMatches, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, extendEtag, facetOrigin, fanPageBounds, fanPageEtag, findStalledRuns, foldedCount, getRunsByIds, grantsClientTenant, handoffHandlerId, handoffName, hasDurableExecutionWrappers, heartbeatStatus, hmacTenantVerifier, indexWaitersByRun, info, inheritTenant, isAnyCheckpoint, isAnyMember, isEngineMintedTag, isEventToken, isFailedMember, isLegacyDescriptor, isLifecycleTag, isNonEmptyRunScope, isRemoteEvent, isWorkflowControlFlowSignal, legacySingletonHolders, lifecycleDeliveriesOf, lifecycleEventName, lifecycleEventOf, lifecycleKindOf, lifecycleRegistryNamespace, lifecycleRegistryRunId, lifecycleRegistrySubscriptions, lifecycleRunId, lifecycleSourceOf, lifecycleTraceparentOf, listSignalWaitersOfRuns, liveHandoff, log, markRemoteEvent, matchesAttributes, matchesTenantPredicates, mergeRunFacetRows, mergeRunValueFacetRows, missingCapabilities, negotiate, nextCronFireMs, nextRRuleFireMs, nextScheduleFireAt, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, onErrorRunId, owedSubscribersOf, pageFan, pageFanFromStore, parentRunIdOf, parseDuration, parseLifecycleEvent, parseRRule, parseWebhookToken, partitionOfToken, planDispatch, poolNamespace, prevCronFireMs, prevRRuleFireMs, queryCheckpointsOf, readBufferedEvent, readRunsByIds, readSearchAttributes, requiredCapabilities, resolveConcurrency, resolveRouting, resolveRunWaiting, resolveTenantToken, resolveWireTenant, retentionKeeps, retiredHandoffName, routeFor, rowTenant, runCompletedEvent, runDetailEtag, runDurableExecution, runFailedEvent, runInStepLogger, runInStepScope, runInWorkflowCtx, runOutsideWorkflowCtx, runSchedules, runStepHandler, runTraceId, runValueFacetsFromRuns, runWaitPrefix, runWaitTargetOf, runWaitToken, sanitizeQueueToken, scheduleRunIdAt, scheduledRunId, scopeBufferedEvent, scopeTenantQuery, sealDurableCopies, settleResultsWithPlainCalls, signTenantToken, singletonAdmissionDenialPatch, singletonAdmissionTags, singletonClaimantIds, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, summarizeFan, summarizeRunFromStore, summarizeTimeline, tenantAppOf, tenantGroup, tenantIdsFor, tenantVisible, toEventSubscription, traceIdOfTraceparent, triggerFailedSubscribersOf, triggeredRunsOf, triggeredSubscribersOf, useDurableExecution, verifyWireTenant, warn, withSingletonTracked, withoutSingletonMarkers, workflowName };