@fluidgrids/workflows 2026.1027.0 → 2026.1028.1
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/README.md +170 -18
- package/dist/activation-BBh1p82z.d.cts +57 -0
- package/dist/activation-DnhG7SmF.d.ts +57 -0
- package/dist/assemble-BLqQ8lSu.d.cts +39 -0
- package/dist/assemble-DWgaXHd-.d.ts +39 -0
- package/dist/chunk-2DP2Y6EU.cjs +832 -0
- package/dist/chunk-2J6TF7YI.cjs +86 -0
- package/dist/chunk-3FOTFQ3J.js +1622 -0
- package/dist/chunk-4LYSEANA.js +199 -0
- package/dist/{chunk-KUTMY2IO.cjs → chunk-57MSZ24T.cjs} +162 -98
- package/dist/{chunk-BWSLWF2E.js → chunk-5HDSBTBX.js} +99 -32
- package/dist/chunk-623FVQSN.cjs +251 -0
- package/dist/{chunk-4DPEGDPW.js → chunk-6FSHT5IL.js} +4 -4
- package/dist/{chunk-REV7ZOA4.js → chunk-7AAZGVKD.js} +1 -35
- package/dist/chunk-7NQ37GZU.js +73 -0
- package/dist/chunk-ABFZWYHT.js +612 -0
- package/dist/{chunk-SS4LT2IP.js → chunk-BD7ZPG53.js} +5 -10
- package/dist/chunk-BO6OVILK.js +79 -0
- package/dist/chunk-C5OLWZ42.js +245 -0
- package/dist/chunk-CBL5JSCC.cjs +75 -0
- package/dist/{chunk-LSKSBVL4.cjs → chunk-CPDK3K5N.cjs} +6 -6
- package/dist/chunk-CSNWNFKU.cjs +1635 -0
- package/dist/chunk-DJYMDLV5.js +227 -0
- package/dist/{chunk-X4HKU3MX.js → chunk-E2VK7J2C.js} +3 -1
- package/dist/chunk-FMSW2HDF.cjs +267 -0
- package/dist/chunk-FQIHX7YI.cjs +80 -0
- package/dist/chunk-FR7KYWRO.cjs +41 -0
- package/dist/{chunk-AU3YW7FZ.cjs → chunk-GBQ33SIZ.cjs} +46 -51
- package/dist/{chunk-RRQ5HOBF.cjs → chunk-GVTZMA5C.cjs} +4 -4
- package/dist/chunk-H7KEVW2M.js +816 -0
- package/dist/chunk-HR3BN4C4.cjs +27 -0
- package/dist/chunk-IISBRUWJ.js +13 -0
- package/dist/chunk-JD2VQIDZ.cjs +15 -0
- package/dist/{chunk-PL73GJR4.js → chunk-JZ4TOOLN.js} +1 -1
- package/dist/chunk-L24YIZY7.cjs +207 -0
- package/dist/chunk-LNUQE6D6.js +39 -0
- package/dist/{chunk-BYJ7QTLY.cjs → chunk-NEIUQASE.cjs} +13 -13
- package/dist/chunk-P6TA5EZT.cjs +634 -0
- package/dist/chunk-PDHLTDZB.js +72 -0
- package/dist/chunk-PMCM2OH4.js +46 -0
- package/dist/chunk-PZCVF76Q.cjs +868 -0
- package/dist/{chunk-GO34UHSY.js → chunk-QAN5MZEM.js} +3 -3
- package/dist/{chunk-27HASETB.cjs → chunk-QKZL3ONM.cjs} +3 -1
- package/dist/chunk-SAENRNBJ.cjs +52 -0
- package/dist/{chunk-LMX35GNQ.js → chunk-SMCANK3F.js} +5 -4
- package/dist/{chunk-IZQNUNSU.cjs → chunk-SX2PNKKT.cjs} +18 -17
- package/dist/{chunk-LRM6JXJA.cjs → chunk-TBDXTV22.cjs} +0 -37
- package/dist/chunk-VOKMAAJP.js +848 -0
- package/dist/chunk-XB53G2DK.js +25 -0
- package/dist/chunk-Z2Y65YOY.cjs +7 -0
- package/dist/codegen/index.cjs +9 -7
- package/dist/codegen/index.d.cts +2 -2
- package/dist/codegen/index.d.ts +2 -2
- package/dist/codegen/index.js +6 -5
- package/dist/file-BOoHZgoQ.d.cts +1557 -0
- package/dist/file-yuPCFU5b.d.ts +1557 -0
- package/dist/history/index.cjs +287 -0
- package/dist/history/index.d.cts +157 -0
- package/dist/history/index.d.ts +157 -0
- package/dist/history/index.js +5 -0
- package/dist/index.cjs +134 -36
- package/dist/index.d.cts +137 -9
- package/dist/index.d.ts +137 -9
- package/dist/index.js +8 -3
- package/dist/ir/index.cjs +161 -165
- package/dist/ir/index.d.cts +32 -12
- package/dist/ir/index.d.ts +32 -12
- package/dist/ir/index.js +54 -61
- package/dist/lower-BuSvAFqi.d.cts +129 -0
- package/dist/lower-C_Qv_34S.d.ts +129 -0
- package/dist/lower-types-nofRXw9c.d.cts +15 -0
- package/dist/lower-types-nofRXw9c.d.ts +15 -0
- package/dist/{manifest-Duf-gHdO.d.cts → manifest-0OLw0i7k.d.cts} +1 -1
- package/dist/{manifest-Bp9ZJlav.d.ts → manifest-C8N6HDYl.d.ts} +1 -1
- package/dist/node-evaluator-CJNP4GHX.js +12 -0
- package/dist/node-evaluator-DMKPKUWA.cjs +22 -0
- package/dist/quickjs/index.cjs +256 -78
- package/dist/quickjs/index.d.cts +48 -7
- package/dist/quickjs/index.d.ts +48 -7
- package/dist/quickjs/index.js +254 -79
- package/dist/roundtrip/index.cjs +404 -129
- package/dist/roundtrip/index.d.cts +43 -8
- package/dist/roundtrip/index.d.ts +43 -8
- package/dist/roundtrip/index.js +260 -19
- package/dist/runtime/index.cjs +90 -0
- package/dist/runtime/index.d.cts +297 -0
- package/dist/runtime/index.d.ts +297 -0
- package/dist/runtime/index.js +8 -0
- package/dist/testing/index.cjs +1057 -0
- package/dist/testing/index.d.cts +305 -0
- package/dist/testing/index.d.ts +305 -0
- package/dist/testing/index.js +1037 -0
- package/dist/{types-Dr2Fn1Ax.d.ts → types-BGoPzgcl.d.cts} +1 -1
- package/dist/{types-Dr2Fn1Ax.d.cts → types-BGoPzgcl.d.ts} +1 -1
- package/dist/types-CpBBjaGX.d.cts +380 -0
- package/dist/types-DV-HX_Gt.d.ts +380 -0
- package/dist/{assemble-DMOuaxRI.d.ts → workflow-Bpr3vnA_.d.ts} +60 -162
- package/dist/workflow-C2a05WUJ.d.ts +444 -0
- package/dist/{assemble-BJo9TECS.d.cts → workflow-FXUkpIBc.d.cts} +60 -162
- package/dist/workflow-J-yYixny.d.cts +444 -0
- package/fixtures/README.md +128 -0
- package/fixtures/histories/activity-failure-fails-run.history.json +163 -0
- package/fixtures/histories/activity-retry-then-success.history.json +147 -0
- package/fixtures/histories/cancel-activity-abandon.history.json +126 -0
- package/fixtures/histories/cancel-activity-compensate.history.json +307 -0
- package/fixtures/histories/cancel-concurrent-non-cancellable.history.json +234 -0
- package/fixtures/histories/cancel-concurrent-scope-timeout.history.json +184 -0
- package/fixtures/histories/cancel-condition-after-cancel.history.json +200 -0
- package/fixtures/histories/cancel-during-timer.history.json +123 -0
- package/fixtures/histories/cancel-saga-compensations.history.json +325 -0
- package/fixtures/histories/cancel-scope-timeout.history.json +148 -0
- package/fixtures/histories/child-abandon-outlives-parent.history.json +191 -0
- package/fixtures/histories/child-cancel-default.history.json +234 -0
- package/fixtures/histories/child-cancel-request.history.json +206 -0
- package/fixtures/histories/child-durable-child-side.history.json +124 -0
- package/fixtures/histories/child-durable-result.history.json +163 -0
- package/fixtures/histories/child-failure-caught.history.json +166 -0
- package/fixtures/histories/child-graph-by-key.history.json +138 -0
- package/fixtures/histories/child-terminated-by-parent-close.history.json +85 -0
- package/fixtures/histories/continue-as-new-first-run.history.json +146 -0
- package/fixtures/histories/continue-as-new-history-limit.history.json +489 -0
- package/fixtures/histories/continue-as-new-last-run.history.json +147 -0
- package/fixtures/histories/continue-as-new-suggested.history.json +352 -0
- package/fixtures/histories/details-and-context.history.json +176 -0
- package/fixtures/histories/deterministic-values.history.json +128 -0
- package/fixtures/histories/engine-builtins.history.json +172 -0
- package/fixtures/histories/gather-activities.history.json +291 -0
- package/fixtures/histories/gather-all-settled.history.json +219 -0
- package/fixtures/histories/gather-mixed.history.json +281 -0
- package/fixtures/histories/input-during-running-task.history.json +111 -0
- package/fixtures/histories/nondeterminism-reordered.history.json +218 -0
- package/fixtures/histories/patched-deprecated.history.json +271 -0
- package/fixtures/histories/patched-new-run.history.json +270 -0
- package/fixtures/histories/patched-old-history.history.json +190 -0
- package/fixtures/histories/race-activity-wins.history.json +152 -0
- package/fixtures/histories/race-signal-beats-child.history.json +161 -0
- package/fixtures/histories/race-timeout-wins.history.json +118 -0
- package/fixtures/histories/side-effect-recorded.history.json +153 -0
- package/fixtures/histories/signal-buffered-at-start.history.json +157 -0
- package/fixtures/histories/signal-default-handler.history.json +187 -0
- package/fixtures/histories/signal-handler.history.json +191 -0
- package/fixtures/histories/signal-parent-child-side.history.json +132 -0
- package/fixtures/histories/signal-parent.history.json +202 -0
- package/fixtures/histories/signal-run-delivered.history.json +128 -0
- package/fixtures/histories/signal-run-undelivered.history.json +134 -0
- package/fixtures/histories/signal-wait.history.json +111 -0
- package/fixtures/histories/task-failure-code-error.history.json +137 -0
- package/fixtures/histories/task-failure-then-transient-attempt.history.json +140 -0
- package/fixtures/histories/timer-condition-met.history.json +201 -0
- package/fixtures/histories/timer-condition-timeout.history.json +118 -0
- package/fixtures/histories/timer-sleep-once.history.json +118 -0
- package/fixtures/histories/timer-sleep-sequence.history.json +210 -0
- package/fixtures/histories/update-accepted-completed.history.json +149 -0
- package/fixtures/histories/update-with-start-rejected-validation.history.json +91 -0
- package/package.json +85 -20
- package/schema/history-file.schema.json +2544 -0
- package/schema/ir-v2.schema.json +16 -0
- package/schema/run-event.schema.json +2374 -0
- package/schema/workflow-command.schema.json +1095 -0
- package/schema/workflow-task.schema.json +3560 -0
- package/dist/chunk-265J2FCH.cjs +0 -33
- package/dist/chunk-LUXCXFOE.cjs +0 -269
- package/dist/chunk-S34NJE3A.js +0 -262
- package/dist/chunk-SRQRLWOS.js +0 -31
- package/dist/lower-DcOY8ux0.d.cts +0 -49
- package/dist/lower-Dw5grNrI.d.ts +0 -49
- package/dist/node-evaluator-2GTUZVPK.cjs +0 -17
- package/dist/node-evaluator-RMYEWCXZ.js +0 -8
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { W as WorkflowContext, h as DurableWorkflow, C as CancellationScope, O as Operation, R as RunOptions, j as Duration, l as SignalDefinition, e as ChildTarget, d as ChildOptions, c as ChildHandle, f as ContinueAsNewOptions, b as CancellationScopeOptions } from '../workflow-J-yYixny.cjs';
|
|
2
|
+
export { A as Activation, s as splitActivations } from '../activation-BBh1p82z.cjs';
|
|
3
|
+
import { W as WorkflowCommand, U as RunEventRecord, a7 as WorkflowTaskRequest, a8 as WorkflowTaskResult, a as WorkflowTaskFailureCause, X as RunTarget } from '../types-CpBBjaGX.cjs';
|
|
4
|
+
import { a as Json, J as JsonObject } from '../types-BGoPzgcl.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Determinism shims for workflow tasks (C-ABI, spec 04 §4).
|
|
8
|
+
*
|
|
9
|
+
* `TASK_PRELUDE` runs in the isolate before the bundle, in place of the
|
|
10
|
+
* lowering prelude (`DETERMINISM_PRELUDE`, which refuses the clock outright).
|
|
11
|
+
* Inside a workflow task the clock and the random source resolve through the
|
|
12
|
+
* runtime: `Date.now()`, `new Date()` and `Date()` read the workflow clock,
|
|
13
|
+
* `Math.random()` and `crypto.getRandomValues()` read the per-run seeded
|
|
14
|
+
* generator.
|
|
15
|
+
*
|
|
16
|
+
* The prelude also gives every engine and host the same built-ins: local time
|
|
17
|
+
* is UTC (the `Date` local getters, setters, constructor, `Date.parse` of
|
|
18
|
+
* strings without an offset and `toString` ignore the host's TZ), the
|
|
19
|
+
* `toLocale*` and `localeCompare` methods are locale-independent (fixed en-US
|
|
20
|
+
* shapes without ICU), `Intl` is absent, and `WeakRef` and
|
|
21
|
+
* `FinalizationRegistry` throw, because garbage collection is observable and
|
|
22
|
+
* not deterministic. QuickJS and `vm` otherwise differ on all of these. Outside a task (module top level) they throw
|
|
23
|
+
* `DeterminismViolation`, as do the timer functions and network entry points,
|
|
24
|
+
* which have no deterministic meaning in workflow code.
|
|
25
|
+
*
|
|
26
|
+
* The prelude leaves one hook, `globalThis.__fluidgridsShims`, which the
|
|
27
|
+
* runtime takes (and deletes) when the bundle installs it. This is not a
|
|
28
|
+
* security boundary (the isolate is); it only keeps workflow code honest.
|
|
29
|
+
*/
|
|
30
|
+
/** The `name` of the error the shims throw. */
|
|
31
|
+
declare const SHIM_VIOLATION = "DeterminismViolation";
|
|
32
|
+
/** Global the prelude leaves for the runtime. */
|
|
33
|
+
declare const SHIM_HOOK = "__fluidgridsShims";
|
|
34
|
+
declare const TASK_PRELUDE: string;
|
|
35
|
+
/** What the runtime gives the shims while a task runs. */
|
|
36
|
+
interface ShimHooks {
|
|
37
|
+
now(): number;
|
|
38
|
+
random(): number;
|
|
39
|
+
}
|
|
40
|
+
/** The control the prelude leaves behind. */
|
|
41
|
+
interface ShimControl {
|
|
42
|
+
attach(hooks: ShimHooks): void;
|
|
43
|
+
detach(): void;
|
|
44
|
+
}
|
|
45
|
+
/** A 32-bit FNV-1a hash of a string: the seed of a run's random generator. */
|
|
46
|
+
declare function seedOf(text: string): number;
|
|
47
|
+
/** mulberry32: a small, fast, deterministic generator of numbers in [0, 1). */
|
|
48
|
+
declare function createRandom(seed: number): () => number;
|
|
49
|
+
/** A version-4 UUID from a random source. */
|
|
50
|
+
declare function uuidFrom(random: () => number): string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Replay matching (spec 04 §4): each command a replayed activation issues must
|
|
54
|
+
* match the command event recorded at the same position. Activities match on
|
|
55
|
+
* id and `nodeType + operation`, children on id and target, everything else on
|
|
56
|
+
* type and id. A recorded patch marker that the code no longer issues is
|
|
57
|
+
* skipped (the patch was deprecated and removed, spec 06 §4).
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/** Why `command` does not match `event`, or undefined when it does. */
|
|
61
|
+
declare function mismatch(command: WorkflowCommand, event: RunEventRecord): string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Match the commands of a replayed activation against what it recorded.
|
|
64
|
+
* Returns the first mismatch and the seq it concerns, or undefined.
|
|
65
|
+
*/
|
|
66
|
+
declare function matchActivation(commands: readonly WorkflowCommand[], recorded: readonly RunEventRecord[]): {
|
|
67
|
+
message: string;
|
|
68
|
+
seq?: number;
|
|
69
|
+
} | undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Command ids (C-HIST): one counter per kind, in issue order, so a replay that
|
|
73
|
+
* issues the same commands in the same order derives the same ids, and a
|
|
74
|
+
* reordered await is caught as a mismatch. Patch markers use `patch:<id>`.
|
|
75
|
+
*/
|
|
76
|
+
type CommandIdKind = 'a' | 't' | 'c' | 's' | 'x' | 'm';
|
|
77
|
+
declare class CommandIds {
|
|
78
|
+
private readonly counters;
|
|
79
|
+
/** The next id of a kind: `a1`, `a2`, ... */
|
|
80
|
+
next(kind: CommandIdKind): string;
|
|
81
|
+
}
|
|
82
|
+
/** The marker id of a patch. */
|
|
83
|
+
declare function patchMarkerId(patchId: string): string;
|
|
84
|
+
/** True for a patch marker id. */
|
|
85
|
+
declare function isPatchMarkerId(markerId: string): boolean;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The deterministic scheduler of one workflow task (spec 04 §4-5): it runs a
|
|
89
|
+
* tier-2 function through the activations of its history, resolving awaitables
|
|
90
|
+
* in history order, and turns what the code does into commands.
|
|
91
|
+
*
|
|
92
|
+
* The host drives it with the runtime ABI: `start()`, then `step()` until it
|
|
93
|
+
* returns `done`, draining promise jobs between calls, then `complete()`. One
|
|
94
|
+
* `step()` either begins the next activation (delivers its inputs) or, once
|
|
95
|
+
* the jobs of the current one have settled and no `condition` fires any more,
|
|
96
|
+
* finishes it: a replayed activation must have issued exactly the commands it
|
|
97
|
+
* recorded, and the open activation's commands are the task's result.
|
|
98
|
+
*
|
|
99
|
+
* Pure JavaScript; it runs inside the isolate.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/** The SDK name reported by `__enhanced_stack_trace`. */
|
|
103
|
+
declare const SDK_NAME = "@fluidgrids/workflows";
|
|
104
|
+
/** A thrown value that ends the run with `CONTINUE_AS_NEW`. */
|
|
105
|
+
declare class ContinueAsNewRequest {
|
|
106
|
+
readonly input: Json;
|
|
107
|
+
readonly options: JsonObject;
|
|
108
|
+
constructor(input: Json, options: JsonObject);
|
|
109
|
+
}
|
|
110
|
+
declare class Scope implements CancellationScope {
|
|
111
|
+
readonly parent: Scope | undefined;
|
|
112
|
+
readonly nonCancellable: boolean;
|
|
113
|
+
consideredCancelled: boolean;
|
|
114
|
+
readonly cancelRequested: Promise<never>;
|
|
115
|
+
private rejectRequested;
|
|
116
|
+
private readonly handlers;
|
|
117
|
+
private readonly children;
|
|
118
|
+
constructor(parent: Scope | undefined, nonCancellable: boolean);
|
|
119
|
+
/** Register a reaction to cancellation; returns its removal. */
|
|
120
|
+
onCancel(handler: () => void): () => void;
|
|
121
|
+
/**
|
|
122
|
+
* Cancel the scope and its children. Every handler and child runs even when
|
|
123
|
+
* one throws; the first error is rethrown once the fan-out is complete.
|
|
124
|
+
*/
|
|
125
|
+
cancel(): void;
|
|
126
|
+
detach(): void;
|
|
127
|
+
}
|
|
128
|
+
/** Everything one workflow task needs to run. */
|
|
129
|
+
interface ExecutionInput {
|
|
130
|
+
definition: DurableWorkflow<never, unknown>;
|
|
131
|
+
/** Export names of the bundle's tier-2 functions, to name `ctx.child` targets. */
|
|
132
|
+
exportNames: ReadonlyMap<DurableWorkflow<never, unknown>, string>;
|
|
133
|
+
request: WorkflowTaskRequest;
|
|
134
|
+
sdkVersion: string;
|
|
135
|
+
}
|
|
136
|
+
/** One workflow task in progress. */
|
|
137
|
+
declare class WorkflowExecution {
|
|
138
|
+
readonly request: WorkflowTaskRequest;
|
|
139
|
+
private readonly definition;
|
|
140
|
+
private readonly exportNames;
|
|
141
|
+
private readonly sdkVersion;
|
|
142
|
+
private readonly activations;
|
|
143
|
+
private index;
|
|
144
|
+
private activationOpen;
|
|
145
|
+
private replaying;
|
|
146
|
+
private clock;
|
|
147
|
+
private readonly random;
|
|
148
|
+
private readonly ids;
|
|
149
|
+
private commands;
|
|
150
|
+
private newCommands;
|
|
151
|
+
private readonly logs;
|
|
152
|
+
private failure;
|
|
153
|
+
private closed;
|
|
154
|
+
private readonly captureStacks;
|
|
155
|
+
/** History length and inline bytes the current activation reports (see `Activation.historyLength`). */
|
|
156
|
+
private historyLength;
|
|
157
|
+
private historyBytes;
|
|
158
|
+
/** `bytesUpTo[n]`: UTF-8 bytes of the payloads of events 1..n. */
|
|
159
|
+
private readonly bytesUpTo;
|
|
160
|
+
private readonly limitEvents;
|
|
161
|
+
private readonly limitBytes;
|
|
162
|
+
private readonly root;
|
|
163
|
+
/**
|
|
164
|
+
* Scopes whose function is running synchronously right now, innermost
|
|
165
|
+
* last. The outer `ctx` uses the innermost one, else the root: a scope is
|
|
166
|
+
* ambient only during the synchronous part of its function, never across
|
|
167
|
+
* an await, so concurrent branches never see each other's scopes.
|
|
168
|
+
*/
|
|
169
|
+
private readonly syncScopes;
|
|
170
|
+
/** A scope that is never cancelled, for waits that ignore cancellation. */
|
|
171
|
+
private readonly detachedScope;
|
|
172
|
+
private cancelRequested;
|
|
173
|
+
private readonly activities;
|
|
174
|
+
private readonly timers;
|
|
175
|
+
private readonly children;
|
|
176
|
+
private readonly externals;
|
|
177
|
+
private readonly issued;
|
|
178
|
+
private readonly recordedSideEffects;
|
|
179
|
+
private readonly recordedMarkers;
|
|
180
|
+
private readonly patches;
|
|
181
|
+
private readonly signalBuffers;
|
|
182
|
+
private readonly signalOrder;
|
|
183
|
+
private readonly signalHandlers;
|
|
184
|
+
private readonly signalWaiters;
|
|
185
|
+
private defaultSignalHandler;
|
|
186
|
+
private runningHandlers;
|
|
187
|
+
private conditions;
|
|
188
|
+
private currentDetails;
|
|
189
|
+
readonly context: WorkflowContext;
|
|
190
|
+
private readonly info;
|
|
191
|
+
constructor(input: ExecutionInput);
|
|
192
|
+
private continueAsNewSuggested;
|
|
193
|
+
/** The workflow clock. */
|
|
194
|
+
now(): number;
|
|
195
|
+
/** The next deterministic random number. */
|
|
196
|
+
nextRandom(): number;
|
|
197
|
+
/** Begin or finish an activation; `done` when there is nothing left to do. */
|
|
198
|
+
step(): 'more' | 'done';
|
|
199
|
+
/** The task's result. Call after `step()` returned `done` and jobs were drained. */
|
|
200
|
+
complete(): WorkflowTaskResult;
|
|
201
|
+
/** Fail the task (the runtime's own failures and code errors). */
|
|
202
|
+
failTask(cause: WorkflowTaskFailureCause, message: string, stackTrace?: string, seq?: number, errorType?: string): void;
|
|
203
|
+
private beginActivation;
|
|
204
|
+
private finishActivation;
|
|
205
|
+
private deliver;
|
|
206
|
+
private expectIssued;
|
|
207
|
+
private settleActivity;
|
|
208
|
+
private settleChild;
|
|
209
|
+
private dispatchSignal;
|
|
210
|
+
private takeBuffered;
|
|
211
|
+
private runHandler;
|
|
212
|
+
private startFunction;
|
|
213
|
+
private onReturn;
|
|
214
|
+
private isFailureType;
|
|
215
|
+
/** What an error thrown out of workflow code does (11 §2.25, §2.37). */
|
|
216
|
+
onWorkflowError(error: unknown): void;
|
|
217
|
+
private currentScope;
|
|
218
|
+
/**
|
|
219
|
+
* Throw `HistoryLimitExceeded` from 95 % of the cap. It runs on replay too:
|
|
220
|
+
* the history length is the activation's cutoff and the command count is
|
|
221
|
+
* the activation's own, so replay sees what the first execution saw.
|
|
222
|
+
*/
|
|
223
|
+
private checkLimit;
|
|
224
|
+
/** Issue a command; false when the run is already closed (the command is dropped). */
|
|
225
|
+
private push;
|
|
226
|
+
private pushTerminal;
|
|
227
|
+
private stack;
|
|
228
|
+
private never;
|
|
229
|
+
scheduleActivity<In, Out>(scope: Scope, operation: Operation<In, Out>, options: RunOptions<In>): Promise<Out>;
|
|
230
|
+
startTimer(scope: Scope, durationMs: number, summary: string | undefined): Promise<void>;
|
|
231
|
+
/** Start a durable timer; `timerId` is undefined when no timer was needed or issued. */
|
|
232
|
+
private timer;
|
|
233
|
+
/** Cancel a pending timer the runtime started for itself (condition and scope timeouts). */
|
|
234
|
+
private cancelOwnTimer;
|
|
235
|
+
condition(scope: Scope, predicate: () => boolean, timeout: Duration | undefined): Promise<boolean>;
|
|
236
|
+
/** Resolve conditions whose predicate now holds; true when any did. */
|
|
237
|
+
private checkConditions;
|
|
238
|
+
signalReceived<P>(scope: Scope, signal: SignalDefinition<P> | string): Promise<P>;
|
|
239
|
+
onSignal(signal: SignalDefinition<unknown> | string, handler: (payload: unknown) => unknown): void;
|
|
240
|
+
setDefaultSignalHandler(handler: (name: string, payload: unknown) => unknown): void;
|
|
241
|
+
private childTarget;
|
|
242
|
+
private childCommand;
|
|
243
|
+
private startChildRun;
|
|
244
|
+
/** What cancelling the scope of a child's awaitable does (see `ChildOptions.cancellationType`). */
|
|
245
|
+
private onChildCancel;
|
|
246
|
+
child<Out>(scope: Scope, target: ChildTarget<Out>, options: ChildOptions): Promise<Out>;
|
|
247
|
+
private childResult;
|
|
248
|
+
startChild<Out>(scope: Scope, target: ChildTarget<Out>, options: ChildOptions): Promise<ChildHandle<Out>>;
|
|
249
|
+
signalExternal(target: RunTarget, name: string, payload: unknown): Promise<void>;
|
|
250
|
+
cancelExternal(target: RunTarget): Promise<void>;
|
|
251
|
+
sideEffect<T extends Json>(fn: () => T): T;
|
|
252
|
+
patched(patchId: string, deprecated: boolean): boolean;
|
|
253
|
+
setCurrentDetails(markdown: string): void;
|
|
254
|
+
upsertContext(entries: JsonObject): void;
|
|
255
|
+
/** The request a `ctx.continueAsNew` call throws; the run ends with `CONTINUE_AS_NEW`. */
|
|
256
|
+
continueAsNew(input: unknown, options: ContinueAsNewOptions): ContinueAsNewRequest;
|
|
257
|
+
cancellationScope<T>(parent: Scope, fn: (ctx: WorkflowContext) => Promise<T>, options: CancellationScopeOptions): Promise<T>;
|
|
258
|
+
/** Waits for the signal handlers regardless of cancellation, as Temporal does. */
|
|
259
|
+
allHandlersFinished(): Promise<void>;
|
|
260
|
+
private pendingStacks;
|
|
261
|
+
private answerQueries;
|
|
262
|
+
private contextFor;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** The global a tier-2 bundle defines. */
|
|
266
|
+
declare const RUNTIME_GLOBAL = "__fluidgridsRuntime";
|
|
267
|
+
/** The runtime ABI, protocol 1. */
|
|
268
|
+
interface FluidgridsRuntimeAbi {
|
|
269
|
+
readonly protocol: 1;
|
|
270
|
+
readonly sdkVersion: string;
|
|
271
|
+
start(requestJson: string): void;
|
|
272
|
+
step(): 'more' | 'done';
|
|
273
|
+
complete(): string;
|
|
274
|
+
}
|
|
275
|
+
/** The tier-2 functions of a bundle, by export name. */
|
|
276
|
+
interface WorkflowRegistry {
|
|
277
|
+
byName: ReadonlyMap<string, DurableWorkflow<never, unknown>>;
|
|
278
|
+
exportNames: ReadonlyMap<DurableWorkflow<never, unknown>, string>;
|
|
279
|
+
/** Export names declared by more than one module; starting one fails the task. */
|
|
280
|
+
ambiguous: ReadonlySet<string>;
|
|
281
|
+
}
|
|
282
|
+
/** Build the registry from the bundle's modules (`[path, namespace]` pairs). */
|
|
283
|
+
declare function buildWorkflowRegistry(modules: ReadonlyArray<readonly [string, Record<string, unknown>]>): WorkflowRegistry;
|
|
284
|
+
/**
|
|
285
|
+
* Create the ABI over a registry. `shims` connects the isolate's clock and
|
|
286
|
+
* random source to the running task (absent in-process).
|
|
287
|
+
*/
|
|
288
|
+
declare function createWorkflowRuntime(registry: WorkflowRegistry, shims?: ShimControl | undefined): FluidgridsRuntimeAbi;
|
|
289
|
+
/**
|
|
290
|
+
* Define `globalThis.__fluidgridsRuntime` for a bundle's modules. Called by
|
|
291
|
+
* the generated bundle entry; harmless when the bundle is only lowered.
|
|
292
|
+
*/
|
|
293
|
+
declare function installWorkflowRuntime(modules: ReadonlyArray<readonly [string, Record<string, unknown>]>): void;
|
|
294
|
+
/** True when `value` looks like the runtime ABI (it crossed a realm or an isolate boundary). */
|
|
295
|
+
declare function isRuntimeAbi(value: unknown): value is FluidgridsRuntimeAbi;
|
|
296
|
+
|
|
297
|
+
export { CommandIds, type FluidgridsRuntimeAbi, RUNTIME_GLOBAL, SDK_NAME, SHIM_HOOK, SHIM_VIOLATION, TASK_PRELUDE, WorkflowExecution, type WorkflowRegistry, buildWorkflowRegistry, createRandom, createWorkflowRuntime, installWorkflowRuntime, isPatchMarkerId, isRuntimeAbi, matchActivation, mismatch, patchMarkerId, seedOf, uuidFrom };
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { W as WorkflowContext, h as DurableWorkflow, C as CancellationScope, O as Operation, R as RunOptions, j as Duration, l as SignalDefinition, e as ChildTarget, d as ChildOptions, c as ChildHandle, f as ContinueAsNewOptions, b as CancellationScopeOptions } from '../workflow-C2a05WUJ.js';
|
|
2
|
+
export { A as Activation, s as splitActivations } from '../activation-DnhG7SmF.js';
|
|
3
|
+
import { W as WorkflowCommand, U as RunEventRecord, a7 as WorkflowTaskRequest, a8 as WorkflowTaskResult, a as WorkflowTaskFailureCause, X as RunTarget } from '../types-DV-HX_Gt.js';
|
|
4
|
+
import { a as Json, J as JsonObject } from '../types-BGoPzgcl.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Determinism shims for workflow tasks (C-ABI, spec 04 §4).
|
|
8
|
+
*
|
|
9
|
+
* `TASK_PRELUDE` runs in the isolate before the bundle, in place of the
|
|
10
|
+
* lowering prelude (`DETERMINISM_PRELUDE`, which refuses the clock outright).
|
|
11
|
+
* Inside a workflow task the clock and the random source resolve through the
|
|
12
|
+
* runtime: `Date.now()`, `new Date()` and `Date()` read the workflow clock,
|
|
13
|
+
* `Math.random()` and `crypto.getRandomValues()` read the per-run seeded
|
|
14
|
+
* generator.
|
|
15
|
+
*
|
|
16
|
+
* The prelude also gives every engine and host the same built-ins: local time
|
|
17
|
+
* is UTC (the `Date` local getters, setters, constructor, `Date.parse` of
|
|
18
|
+
* strings without an offset and `toString` ignore the host's TZ), the
|
|
19
|
+
* `toLocale*` and `localeCompare` methods are locale-independent (fixed en-US
|
|
20
|
+
* shapes without ICU), `Intl` is absent, and `WeakRef` and
|
|
21
|
+
* `FinalizationRegistry` throw, because garbage collection is observable and
|
|
22
|
+
* not deterministic. QuickJS and `vm` otherwise differ on all of these. Outside a task (module top level) they throw
|
|
23
|
+
* `DeterminismViolation`, as do the timer functions and network entry points,
|
|
24
|
+
* which have no deterministic meaning in workflow code.
|
|
25
|
+
*
|
|
26
|
+
* The prelude leaves one hook, `globalThis.__fluidgridsShims`, which the
|
|
27
|
+
* runtime takes (and deletes) when the bundle installs it. This is not a
|
|
28
|
+
* security boundary (the isolate is); it only keeps workflow code honest.
|
|
29
|
+
*/
|
|
30
|
+
/** The `name` of the error the shims throw. */
|
|
31
|
+
declare const SHIM_VIOLATION = "DeterminismViolation";
|
|
32
|
+
/** Global the prelude leaves for the runtime. */
|
|
33
|
+
declare const SHIM_HOOK = "__fluidgridsShims";
|
|
34
|
+
declare const TASK_PRELUDE: string;
|
|
35
|
+
/** What the runtime gives the shims while a task runs. */
|
|
36
|
+
interface ShimHooks {
|
|
37
|
+
now(): number;
|
|
38
|
+
random(): number;
|
|
39
|
+
}
|
|
40
|
+
/** The control the prelude leaves behind. */
|
|
41
|
+
interface ShimControl {
|
|
42
|
+
attach(hooks: ShimHooks): void;
|
|
43
|
+
detach(): void;
|
|
44
|
+
}
|
|
45
|
+
/** A 32-bit FNV-1a hash of a string: the seed of a run's random generator. */
|
|
46
|
+
declare function seedOf(text: string): number;
|
|
47
|
+
/** mulberry32: a small, fast, deterministic generator of numbers in [0, 1). */
|
|
48
|
+
declare function createRandom(seed: number): () => number;
|
|
49
|
+
/** A version-4 UUID from a random source. */
|
|
50
|
+
declare function uuidFrom(random: () => number): string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Replay matching (spec 04 §4): each command a replayed activation issues must
|
|
54
|
+
* match the command event recorded at the same position. Activities match on
|
|
55
|
+
* id and `nodeType + operation`, children on id and target, everything else on
|
|
56
|
+
* type and id. A recorded patch marker that the code no longer issues is
|
|
57
|
+
* skipped (the patch was deprecated and removed, spec 06 §4).
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/** Why `command` does not match `event`, or undefined when it does. */
|
|
61
|
+
declare function mismatch(command: WorkflowCommand, event: RunEventRecord): string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Match the commands of a replayed activation against what it recorded.
|
|
64
|
+
* Returns the first mismatch and the seq it concerns, or undefined.
|
|
65
|
+
*/
|
|
66
|
+
declare function matchActivation(commands: readonly WorkflowCommand[], recorded: readonly RunEventRecord[]): {
|
|
67
|
+
message: string;
|
|
68
|
+
seq?: number;
|
|
69
|
+
} | undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Command ids (C-HIST): one counter per kind, in issue order, so a replay that
|
|
73
|
+
* issues the same commands in the same order derives the same ids, and a
|
|
74
|
+
* reordered await is caught as a mismatch. Patch markers use `patch:<id>`.
|
|
75
|
+
*/
|
|
76
|
+
type CommandIdKind = 'a' | 't' | 'c' | 's' | 'x' | 'm';
|
|
77
|
+
declare class CommandIds {
|
|
78
|
+
private readonly counters;
|
|
79
|
+
/** The next id of a kind: `a1`, `a2`, ... */
|
|
80
|
+
next(kind: CommandIdKind): string;
|
|
81
|
+
}
|
|
82
|
+
/** The marker id of a patch. */
|
|
83
|
+
declare function patchMarkerId(patchId: string): string;
|
|
84
|
+
/** True for a patch marker id. */
|
|
85
|
+
declare function isPatchMarkerId(markerId: string): boolean;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The deterministic scheduler of one workflow task (spec 04 §4-5): it runs a
|
|
89
|
+
* tier-2 function through the activations of its history, resolving awaitables
|
|
90
|
+
* in history order, and turns what the code does into commands.
|
|
91
|
+
*
|
|
92
|
+
* The host drives it with the runtime ABI: `start()`, then `step()` until it
|
|
93
|
+
* returns `done`, draining promise jobs between calls, then `complete()`. One
|
|
94
|
+
* `step()` either begins the next activation (delivers its inputs) or, once
|
|
95
|
+
* the jobs of the current one have settled and no `condition` fires any more,
|
|
96
|
+
* finishes it: a replayed activation must have issued exactly the commands it
|
|
97
|
+
* recorded, and the open activation's commands are the task's result.
|
|
98
|
+
*
|
|
99
|
+
* Pure JavaScript; it runs inside the isolate.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/** The SDK name reported by `__enhanced_stack_trace`. */
|
|
103
|
+
declare const SDK_NAME = "@fluidgrids/workflows";
|
|
104
|
+
/** A thrown value that ends the run with `CONTINUE_AS_NEW`. */
|
|
105
|
+
declare class ContinueAsNewRequest {
|
|
106
|
+
readonly input: Json;
|
|
107
|
+
readonly options: JsonObject;
|
|
108
|
+
constructor(input: Json, options: JsonObject);
|
|
109
|
+
}
|
|
110
|
+
declare class Scope implements CancellationScope {
|
|
111
|
+
readonly parent: Scope | undefined;
|
|
112
|
+
readonly nonCancellable: boolean;
|
|
113
|
+
consideredCancelled: boolean;
|
|
114
|
+
readonly cancelRequested: Promise<never>;
|
|
115
|
+
private rejectRequested;
|
|
116
|
+
private readonly handlers;
|
|
117
|
+
private readonly children;
|
|
118
|
+
constructor(parent: Scope | undefined, nonCancellable: boolean);
|
|
119
|
+
/** Register a reaction to cancellation; returns its removal. */
|
|
120
|
+
onCancel(handler: () => void): () => void;
|
|
121
|
+
/**
|
|
122
|
+
* Cancel the scope and its children. Every handler and child runs even when
|
|
123
|
+
* one throws; the first error is rethrown once the fan-out is complete.
|
|
124
|
+
*/
|
|
125
|
+
cancel(): void;
|
|
126
|
+
detach(): void;
|
|
127
|
+
}
|
|
128
|
+
/** Everything one workflow task needs to run. */
|
|
129
|
+
interface ExecutionInput {
|
|
130
|
+
definition: DurableWorkflow<never, unknown>;
|
|
131
|
+
/** Export names of the bundle's tier-2 functions, to name `ctx.child` targets. */
|
|
132
|
+
exportNames: ReadonlyMap<DurableWorkflow<never, unknown>, string>;
|
|
133
|
+
request: WorkflowTaskRequest;
|
|
134
|
+
sdkVersion: string;
|
|
135
|
+
}
|
|
136
|
+
/** One workflow task in progress. */
|
|
137
|
+
declare class WorkflowExecution {
|
|
138
|
+
readonly request: WorkflowTaskRequest;
|
|
139
|
+
private readonly definition;
|
|
140
|
+
private readonly exportNames;
|
|
141
|
+
private readonly sdkVersion;
|
|
142
|
+
private readonly activations;
|
|
143
|
+
private index;
|
|
144
|
+
private activationOpen;
|
|
145
|
+
private replaying;
|
|
146
|
+
private clock;
|
|
147
|
+
private readonly random;
|
|
148
|
+
private readonly ids;
|
|
149
|
+
private commands;
|
|
150
|
+
private newCommands;
|
|
151
|
+
private readonly logs;
|
|
152
|
+
private failure;
|
|
153
|
+
private closed;
|
|
154
|
+
private readonly captureStacks;
|
|
155
|
+
/** History length and inline bytes the current activation reports (see `Activation.historyLength`). */
|
|
156
|
+
private historyLength;
|
|
157
|
+
private historyBytes;
|
|
158
|
+
/** `bytesUpTo[n]`: UTF-8 bytes of the payloads of events 1..n. */
|
|
159
|
+
private readonly bytesUpTo;
|
|
160
|
+
private readonly limitEvents;
|
|
161
|
+
private readonly limitBytes;
|
|
162
|
+
private readonly root;
|
|
163
|
+
/**
|
|
164
|
+
* Scopes whose function is running synchronously right now, innermost
|
|
165
|
+
* last. The outer `ctx` uses the innermost one, else the root: a scope is
|
|
166
|
+
* ambient only during the synchronous part of its function, never across
|
|
167
|
+
* an await, so concurrent branches never see each other's scopes.
|
|
168
|
+
*/
|
|
169
|
+
private readonly syncScopes;
|
|
170
|
+
/** A scope that is never cancelled, for waits that ignore cancellation. */
|
|
171
|
+
private readonly detachedScope;
|
|
172
|
+
private cancelRequested;
|
|
173
|
+
private readonly activities;
|
|
174
|
+
private readonly timers;
|
|
175
|
+
private readonly children;
|
|
176
|
+
private readonly externals;
|
|
177
|
+
private readonly issued;
|
|
178
|
+
private readonly recordedSideEffects;
|
|
179
|
+
private readonly recordedMarkers;
|
|
180
|
+
private readonly patches;
|
|
181
|
+
private readonly signalBuffers;
|
|
182
|
+
private readonly signalOrder;
|
|
183
|
+
private readonly signalHandlers;
|
|
184
|
+
private readonly signalWaiters;
|
|
185
|
+
private defaultSignalHandler;
|
|
186
|
+
private runningHandlers;
|
|
187
|
+
private conditions;
|
|
188
|
+
private currentDetails;
|
|
189
|
+
readonly context: WorkflowContext;
|
|
190
|
+
private readonly info;
|
|
191
|
+
constructor(input: ExecutionInput);
|
|
192
|
+
private continueAsNewSuggested;
|
|
193
|
+
/** The workflow clock. */
|
|
194
|
+
now(): number;
|
|
195
|
+
/** The next deterministic random number. */
|
|
196
|
+
nextRandom(): number;
|
|
197
|
+
/** Begin or finish an activation; `done` when there is nothing left to do. */
|
|
198
|
+
step(): 'more' | 'done';
|
|
199
|
+
/** The task's result. Call after `step()` returned `done` and jobs were drained. */
|
|
200
|
+
complete(): WorkflowTaskResult;
|
|
201
|
+
/** Fail the task (the runtime's own failures and code errors). */
|
|
202
|
+
failTask(cause: WorkflowTaskFailureCause, message: string, stackTrace?: string, seq?: number, errorType?: string): void;
|
|
203
|
+
private beginActivation;
|
|
204
|
+
private finishActivation;
|
|
205
|
+
private deliver;
|
|
206
|
+
private expectIssued;
|
|
207
|
+
private settleActivity;
|
|
208
|
+
private settleChild;
|
|
209
|
+
private dispatchSignal;
|
|
210
|
+
private takeBuffered;
|
|
211
|
+
private runHandler;
|
|
212
|
+
private startFunction;
|
|
213
|
+
private onReturn;
|
|
214
|
+
private isFailureType;
|
|
215
|
+
/** What an error thrown out of workflow code does (11 §2.25, §2.37). */
|
|
216
|
+
onWorkflowError(error: unknown): void;
|
|
217
|
+
private currentScope;
|
|
218
|
+
/**
|
|
219
|
+
* Throw `HistoryLimitExceeded` from 95 % of the cap. It runs on replay too:
|
|
220
|
+
* the history length is the activation's cutoff and the command count is
|
|
221
|
+
* the activation's own, so replay sees what the first execution saw.
|
|
222
|
+
*/
|
|
223
|
+
private checkLimit;
|
|
224
|
+
/** Issue a command; false when the run is already closed (the command is dropped). */
|
|
225
|
+
private push;
|
|
226
|
+
private pushTerminal;
|
|
227
|
+
private stack;
|
|
228
|
+
private never;
|
|
229
|
+
scheduleActivity<In, Out>(scope: Scope, operation: Operation<In, Out>, options: RunOptions<In>): Promise<Out>;
|
|
230
|
+
startTimer(scope: Scope, durationMs: number, summary: string | undefined): Promise<void>;
|
|
231
|
+
/** Start a durable timer; `timerId` is undefined when no timer was needed or issued. */
|
|
232
|
+
private timer;
|
|
233
|
+
/** Cancel a pending timer the runtime started for itself (condition and scope timeouts). */
|
|
234
|
+
private cancelOwnTimer;
|
|
235
|
+
condition(scope: Scope, predicate: () => boolean, timeout: Duration | undefined): Promise<boolean>;
|
|
236
|
+
/** Resolve conditions whose predicate now holds; true when any did. */
|
|
237
|
+
private checkConditions;
|
|
238
|
+
signalReceived<P>(scope: Scope, signal: SignalDefinition<P> | string): Promise<P>;
|
|
239
|
+
onSignal(signal: SignalDefinition<unknown> | string, handler: (payload: unknown) => unknown): void;
|
|
240
|
+
setDefaultSignalHandler(handler: (name: string, payload: unknown) => unknown): void;
|
|
241
|
+
private childTarget;
|
|
242
|
+
private childCommand;
|
|
243
|
+
private startChildRun;
|
|
244
|
+
/** What cancelling the scope of a child's awaitable does (see `ChildOptions.cancellationType`). */
|
|
245
|
+
private onChildCancel;
|
|
246
|
+
child<Out>(scope: Scope, target: ChildTarget<Out>, options: ChildOptions): Promise<Out>;
|
|
247
|
+
private childResult;
|
|
248
|
+
startChild<Out>(scope: Scope, target: ChildTarget<Out>, options: ChildOptions): Promise<ChildHandle<Out>>;
|
|
249
|
+
signalExternal(target: RunTarget, name: string, payload: unknown): Promise<void>;
|
|
250
|
+
cancelExternal(target: RunTarget): Promise<void>;
|
|
251
|
+
sideEffect<T extends Json>(fn: () => T): T;
|
|
252
|
+
patched(patchId: string, deprecated: boolean): boolean;
|
|
253
|
+
setCurrentDetails(markdown: string): void;
|
|
254
|
+
upsertContext(entries: JsonObject): void;
|
|
255
|
+
/** The request a `ctx.continueAsNew` call throws; the run ends with `CONTINUE_AS_NEW`. */
|
|
256
|
+
continueAsNew(input: unknown, options: ContinueAsNewOptions): ContinueAsNewRequest;
|
|
257
|
+
cancellationScope<T>(parent: Scope, fn: (ctx: WorkflowContext) => Promise<T>, options: CancellationScopeOptions): Promise<T>;
|
|
258
|
+
/** Waits for the signal handlers regardless of cancellation, as Temporal does. */
|
|
259
|
+
allHandlersFinished(): Promise<void>;
|
|
260
|
+
private pendingStacks;
|
|
261
|
+
private answerQueries;
|
|
262
|
+
private contextFor;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** The global a tier-2 bundle defines. */
|
|
266
|
+
declare const RUNTIME_GLOBAL = "__fluidgridsRuntime";
|
|
267
|
+
/** The runtime ABI, protocol 1. */
|
|
268
|
+
interface FluidgridsRuntimeAbi {
|
|
269
|
+
readonly protocol: 1;
|
|
270
|
+
readonly sdkVersion: string;
|
|
271
|
+
start(requestJson: string): void;
|
|
272
|
+
step(): 'more' | 'done';
|
|
273
|
+
complete(): string;
|
|
274
|
+
}
|
|
275
|
+
/** The tier-2 functions of a bundle, by export name. */
|
|
276
|
+
interface WorkflowRegistry {
|
|
277
|
+
byName: ReadonlyMap<string, DurableWorkflow<never, unknown>>;
|
|
278
|
+
exportNames: ReadonlyMap<DurableWorkflow<never, unknown>, string>;
|
|
279
|
+
/** Export names declared by more than one module; starting one fails the task. */
|
|
280
|
+
ambiguous: ReadonlySet<string>;
|
|
281
|
+
}
|
|
282
|
+
/** Build the registry from the bundle's modules (`[path, namespace]` pairs). */
|
|
283
|
+
declare function buildWorkflowRegistry(modules: ReadonlyArray<readonly [string, Record<string, unknown>]>): WorkflowRegistry;
|
|
284
|
+
/**
|
|
285
|
+
* Create the ABI over a registry. `shims` connects the isolate's clock and
|
|
286
|
+
* random source to the running task (absent in-process).
|
|
287
|
+
*/
|
|
288
|
+
declare function createWorkflowRuntime(registry: WorkflowRegistry, shims?: ShimControl | undefined): FluidgridsRuntimeAbi;
|
|
289
|
+
/**
|
|
290
|
+
* Define `globalThis.__fluidgridsRuntime` for a bundle's modules. Called by
|
|
291
|
+
* the generated bundle entry; harmless when the bundle is only lowered.
|
|
292
|
+
*/
|
|
293
|
+
declare function installWorkflowRuntime(modules: ReadonlyArray<readonly [string, Record<string, unknown>]>): void;
|
|
294
|
+
/** True when `value` looks like the runtime ABI (it crossed a realm or an isolate boundary). */
|
|
295
|
+
declare function isRuntimeAbi(value: unknown): value is FluidgridsRuntimeAbi;
|
|
296
|
+
|
|
297
|
+
export { CommandIds, type FluidgridsRuntimeAbi, RUNTIME_GLOBAL, SDK_NAME, SHIM_HOOK, SHIM_VIOLATION, TASK_PRELUDE, WorkflowExecution, type WorkflowRegistry, buildWorkflowRegistry, createRandom, createWorkflowRuntime, installWorkflowRuntime, isPatchMarkerId, isRuntimeAbi, matchActivation, mismatch, patchMarkerId, seedOf, uuidFrom };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { CommandIds, RUNTIME_GLOBAL, SDK_NAME, WorkflowExecution, buildWorkflowRegistry, createWorkflowRuntime, installWorkflowRuntime, isPatchMarkerId, isRuntimeAbi, matchActivation, mismatch, patchMarkerId } from '../chunk-3FOTFQ3J.js';
|
|
2
|
+
import '../chunk-C5OLWZ42.js';
|
|
3
|
+
import '../chunk-LNUQE6D6.js';
|
|
4
|
+
export { SHIM_HOOK, SHIM_VIOLATION, TASK_PRELUDE, createRandom, seedOf, uuidFrom } from '../chunk-4LYSEANA.js';
|
|
5
|
+
import '../chunk-7NQ37GZU.js';
|
|
6
|
+
export { splitActivations } from '../chunk-ABFZWYHT.js';
|
|
7
|
+
import '../chunk-DJYMDLV5.js';
|
|
8
|
+
import '../chunk-BO6OVILK.js';
|