@adonis-agora/durable 0.9.1 → 0.11.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/CHANGELOG.md +12 -0
- package/dist/assets/dashboard.html +116 -3
- package/dist/commands/durable_worker.d.ts +25 -0
- package/dist/commands/durable_worker.d.ts.map +1 -0
- package/dist/commands/durable_worker.js +113 -0
- package/dist/commands/durable_worker.js.map +1 -0
- package/dist/commands/main.d.ts +6 -5
- package/dist/commands/main.d.ts.map +1 -1
- package/dist/commands/main.js +11 -4
- package/dist/commands/main.js.map +1 -1
- package/dist/providers/dashboard_provider.d.ts +38 -0
- package/dist/providers/dashboard_provider.d.ts.map +1 -1
- package/dist/providers/dashboard_provider.js +103 -10
- package/dist/providers/dashboard_provider.js.map +1 -1
- package/dist/providers/durable_provider.d.ts +24 -16
- package/dist/providers/durable_provider.d.ts.map +1 -1
- package/dist/providers/durable_provider.js +195 -20
- package/dist/providers/durable_provider.js.map +1 -1
- package/dist/src/config_types.d.ts +92 -0
- package/dist/src/config_types.d.ts.map +1 -0
- package/dist/src/config_types.js +2 -0
- package/dist/src/config_types.js.map +1 -0
- package/dist/src/dashboard/compat-view.d.ts +13 -0
- package/dist/src/dashboard/compat-view.d.ts.map +1 -0
- package/dist/src/dashboard/compat-view.js +32 -0
- package/dist/src/dashboard/compat-view.js.map +1 -0
- package/dist/src/dashboard/compat.d.ts +76 -0
- package/dist/src/dashboard/compat.d.ts.map +1 -0
- package/dist/src/dashboard/compat.js +130 -0
- package/dist/src/dashboard/compat.js.map +1 -0
- package/dist/src/dashboard/diagnostics-recorder.d.ts +59 -0
- package/dist/src/dashboard/diagnostics-recorder.d.ts.map +1 -0
- package/dist/src/dashboard/diagnostics-recorder.js +75 -0
- package/dist/src/dashboard/diagnostics-recorder.js.map +1 -0
- package/dist/src/dashboard/gateway-adapter.d.ts +37 -0
- package/dist/src/dashboard/gateway-adapter.d.ts.map +1 -0
- package/dist/src/dashboard/gateway-adapter.js +49 -0
- package/dist/src/dashboard/gateway-adapter.js.map +1 -0
- package/dist/src/dashboard/handlers.d.ts +38 -8
- package/dist/src/dashboard/handlers.d.ts.map +1 -1
- package/dist/src/dashboard/handlers.js +17 -1
- package/dist/src/dashboard/handlers.js.map +1 -1
- package/dist/src/dashboard/index.d.ts +10 -3
- package/dist/src/dashboard/index.d.ts.map +1 -1
- package/dist/src/dashboard/index.js +8 -2
- package/dist/src/dashboard/index.js.map +1 -1
- package/dist/src/define_config.d.ts +31 -5
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js +4 -3
- package/dist/src/define_config.js.map +1 -1
- package/dist/src/dispatch-routing.d.ts +105 -0
- package/dist/src/dispatch-routing.d.ts.map +1 -0
- package/dist/src/dispatch-routing.js +114 -0
- package/dist/src/dispatch-routing.js.map +1 -0
- package/dist/src/engine.d.ts +129 -3
- package/dist/src/engine.d.ts.map +1 -1
- package/dist/src/engine.js +354 -12
- package/dist/src/engine.js.map +1 -1
- package/dist/src/handshake/descriptor.d.ts +128 -0
- package/dist/src/handshake/descriptor.d.ts.map +1 -0
- package/dist/src/handshake/descriptor.js +133 -0
- package/dist/src/handshake/descriptor.js.map +1 -0
- package/dist/src/handshake/negotiate.d.ts +83 -0
- package/dist/src/handshake/negotiate.d.ts.map +1 -0
- package/dist/src/handshake/negotiate.js +108 -0
- package/dist/src/handshake/negotiate.js.map +1 -0
- package/dist/src/handshake/routing.d.ts +51 -0
- package/dist/src/handshake/routing.d.ts.map +1 -0
- package/dist/src/handshake/routing.js +57 -0
- package/dist/src/handshake/routing.js.map +1 -0
- package/dist/src/index.d.ts +14 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +12 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/interfaces.d.ts +184 -7
- package/dist/src/interfaces.d.ts.map +1 -1
- package/dist/src/remote-workflow-executor.d.ts +25 -1
- package/dist/src/remote-workflow-executor.d.ts.map +1 -1
- package/dist/src/remote-workflow-executor.js +41 -0
- package/dist/src/remote-workflow-executor.js.map +1 -1
- package/dist/src/role_bindings.d.ts +85 -0
- package/dist/src/role_bindings.d.ts.map +1 -0
- package/dist/src/role_bindings.js +73 -0
- package/dist/src/role_bindings.js.map +1 -0
- package/dist/src/run-gateway/interface.d.ts +89 -0
- package/dist/src/run-gateway/interface.d.ts.map +1 -0
- package/dist/src/run-gateway/interface.js +2 -0
- package/dist/src/run-gateway/interface.js.map +1 -0
- package/dist/src/run-gateway/proxy-run-gateway.d.ts +84 -0
- package/dist/src/run-gateway/proxy-run-gateway.d.ts.map +1 -0
- package/dist/src/run-gateway/proxy-run-gateway.js +142 -0
- package/dist/src/run-gateway/proxy-run-gateway.js.map +1 -0
- package/dist/src/run-gateway/run-request-responder.d.ts +67 -0
- package/dist/src/run-gateway/run-request-responder.d.ts.map +1 -0
- package/dist/src/run-gateway/run-request-responder.js +228 -0
- package/dist/src/run-gateway/run-request-responder.js.map +1 -0
- package/dist/src/run-gateway/store-run-gateway.d.ts +90 -0
- package/dist/src/run-gateway/store-run-gateway.d.ts.map +1 -0
- package/dist/src/run-gateway/store-run-gateway.js +80 -0
- package/dist/src/run-gateway/store-run-gateway.js.map +1 -0
- package/dist/src/run-gateway/tenant-auth.d.ts +19 -0
- package/dist/src/run-gateway/tenant-auth.d.ts.map +1 -0
- package/dist/src/run-gateway/tenant-auth.js +71 -0
- package/dist/src/run-gateway/tenant-auth.js.map +1 -0
- package/dist/src/services/main.d.ts +16 -3
- package/dist/src/services/main.d.ts.map +1 -1
- package/dist/src/services/main.js +23 -4
- package/dist/src/services/main.js.map +1 -1
- package/dist/src/step-name-symbol.d.ts +3 -0
- package/dist/src/step-name-symbol.d.ts.map +1 -1
- package/dist/src/step-name-symbol.js.map +1 -1
- package/dist/src/step-ref.d.ts +4 -0
- package/dist/src/step-ref.d.ts.map +1 -1
- package/dist/src/step-ref.js +2 -0
- package/dist/src/step-ref.js.map +1 -1
- package/dist/src/transports/bullmq/bullmq-transport.d.ts +130 -0
- package/dist/src/transports/bullmq/bullmq-transport.d.ts.map +1 -0
- package/dist/src/transports/bullmq/bullmq-transport.js +562 -0
- package/dist/src/transports/bullmq/bullmq-transport.js.map +1 -0
- package/dist/src/transports/bullmq/deps.d.ts +59 -0
- package/dist/src/transports/bullmq/deps.d.ts.map +1 -0
- package/dist/src/transports/bullmq/deps.js +41 -0
- package/dist/src/transports/bullmq/deps.js.map +1 -0
- package/dist/src/transports/bullmq/index.d.ts +5 -0
- package/dist/src/transports/bullmq/index.d.ts.map +1 -0
- package/dist/src/transports/bullmq/index.js +5 -0
- package/dist/src/transports/bullmq/index.js.map +1 -0
- package/dist/src/transports/bullmq/naming.d.ts +71 -0
- package/dist/src/transports/bullmq/naming.d.ts.map +1 -0
- package/dist/src/transports/bullmq/naming.js +101 -0
- package/dist/src/transports/bullmq/naming.js.map +1 -0
- package/dist/src/transports/bullmq/serialization.d.ts +56 -0
- package/dist/src/transports/bullmq/serialization.d.ts.map +1 -0
- package/dist/src/transports/bullmq/serialization.js +101 -0
- package/dist/src/transports/bullmq/serialization.js.map +1 -0
- package/dist/src/transports/factory.d.ts +31 -0
- package/dist/src/transports/factory.d.ts.map +1 -1
- package/dist/src/transports/factory.js +21 -0
- package/dist/src/transports/factory.js.map +1 -1
- package/dist/src/worker-runtime/index.d.ts +22 -0
- package/dist/src/worker-runtime/index.d.ts.map +1 -0
- package/dist/src/worker-runtime/index.js +27 -0
- package/dist/src/worker-runtime/index.js.map +1 -0
- package/dist/src/worker-runtime/naming.d.ts +24 -0
- package/dist/src/worker-runtime/naming.d.ts.map +1 -0
- package/dist/src/worker-runtime/naming.js +28 -0
- package/dist/src/worker-runtime/naming.js.map +1 -0
- package/dist/src/worker-runtime/registry.d.ts +81 -0
- package/dist/src/worker-runtime/registry.d.ts.map +1 -0
- package/dist/src/worker-runtime/registry.js +44 -0
- package/dist/src/worker-runtime/registry.js.map +1 -0
- package/dist/src/worker-runtime/worker-runtime.d.ts +155 -0
- package/dist/src/worker-runtime/worker-runtime.d.ts.map +1 -0
- package/dist/src/worker-runtime/worker-runtime.js +265 -0
- package/dist/src/worker-runtime/worker-runtime.js.map +1 -0
- package/dist/src/workflow-ctx.d.ts +9 -0
- package/dist/src/workflow-ctx.d.ts.map +1 -1
- package/dist/src/workflow-ctx.js +78 -27
- package/dist/src/workflow-ctx.js.map +1 -1
- package/dist/src/workflow-turn.d.ts +167 -0
- package/dist/src/workflow-turn.d.ts.map +1 -0
- package/dist/src/workflow-turn.js +372 -0
- package/dist/src/workflow-turn.js.map +1 -0
- package/package.json +7 -1
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared, PURE "run one workflow turn" body — the TypeScript twin of the Python
|
|
3
|
+
* `durable_worker/workflow.py` (`WorkflowContext` + `process_workflow_task`). Given a {@link WorkflowTask}
|
|
4
|
+
* (a workflow name + input + the run's resolved `history`) it REPLAYS the registered body
|
|
5
|
+
* deterministically and produces a {@link WorkflowDecision} (dispatch steps / sleep / wait-signal /
|
|
6
|
+
* start-child / complete / fail / suspend). It owns NO store and does NO I/O beyond the body itself, so
|
|
7
|
+
* BOTH a store-less worker (the {@link import('./worker-runtime/worker-runtime.js').WorkerRuntime}
|
|
8
|
+
* consuming `workflow` jobs off `${P}-tasks-<token>`) AND the engine (via
|
|
9
|
+
* {@link import('./remote-workflow-executor.js').LocalWorkflowTurnExecutor}) drive a TS workflow turn
|
|
10
|
+
* through the exact same code — the same way the engine's `RemoteWorkflowExecutor` drives a Python
|
|
11
|
+
* worker's turn. It is Lucid-free (imports only interface TYPES), so it rides the lean `/worker` subpath.
|
|
12
|
+
*
|
|
13
|
+
* The wire it emits is byte-compatible with aviary: every `ctx.*` op is keyed by a deterministic `seq`;
|
|
14
|
+
* an op already resolved in `history` returns its recorded value (never re-run), and the FIRST
|
|
15
|
+
* unresolved blocking op (step/sleep/waitSignal/startChild) suspends the turn, emitting its command.
|
|
16
|
+
* `ctx.now()`/`ctx.sideEffect()` run inline and record their result once (a `recordStep` local step) so
|
|
17
|
+
* a non-deterministic capture happens exactly once and replays the same value.
|
|
18
|
+
*/
|
|
19
|
+
/** A step/call/child the workflow awaited resolved to a FAILURE. Thrown by the replaying op so a
|
|
20
|
+
* workflow body can `try/catch` it (compensate, or let it propagate to fail the run) — the TS twin of
|
|
21
|
+
* the Python `StepFailed`. Carries the structured {@link StepError} the engine recorded. */
|
|
22
|
+
export class WorkflowStepFailedError extends Error {
|
|
23
|
+
error;
|
|
24
|
+
constructor(error) {
|
|
25
|
+
super(error?.message ?? 'step failed');
|
|
26
|
+
this.name = 'WorkflowStepFailedError';
|
|
27
|
+
this.error = error ?? { message: 'step failed' };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** One or more members of a parallel fan-out ({@link WorkflowTurnCtx.gatherCalls} /
|
|
31
|
+
* {@link WorkflowTurnCtx.gatherChildren}) resolved to a failure. Subclasses {@link WorkflowStepFailedError}
|
|
32
|
+
* so it is catchable in a workflow body exactly like any awaited failure AND settles the turn as a
|
|
33
|
+
* `failed` decision via {@link runWorkflowTurn}'s existing catch — the TS twin of the Python `GatherFailed`.
|
|
34
|
+
* Its wire {@link StepError} carries the aggregate `message` (count + failing names), a `gather_failed`
|
|
35
|
+
* `code`, and the per-item `errors` list (byte-parity with what Python emits). */
|
|
36
|
+
export class WorkflowGatherFailedError extends WorkflowStepFailedError {
|
|
37
|
+
failures;
|
|
38
|
+
constructor(failures) {
|
|
39
|
+
const names = failures.map((f) => f.name).join(', ');
|
|
40
|
+
super({
|
|
41
|
+
message: `gather: ${failures.length} item(s) failed: ${names}`,
|
|
42
|
+
code: 'gather_failed',
|
|
43
|
+
// `errors` is additive runtime data (parity with the Python `GatherFailed` dict); it rides the
|
|
44
|
+
// wire but is not part of the strict {@link StepError} type, hence the cast.
|
|
45
|
+
errors: failures,
|
|
46
|
+
});
|
|
47
|
+
this.name = 'WorkflowGatherFailedError';
|
|
48
|
+
this.failures = failures;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** The history at `seq` did not match what the replay produced there — the workflow code changed under
|
|
52
|
+
* an in-flight run. The run fails loudly rather than silently diverging (Python `NondeterminismError`). */
|
|
53
|
+
export class WorkflowNondeterminismError extends Error {
|
|
54
|
+
constructor(message) {
|
|
55
|
+
super(message);
|
|
56
|
+
this.name = 'WorkflowNondeterminismError';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** A cooperative cancellation raised at an op boundary when the run was cancelled mid-turn — the turn
|
|
60
|
+
* bails with a `cancelled` decision (Python `Cancelled`). */
|
|
61
|
+
export class WorkflowTurnCancelled extends Error {
|
|
62
|
+
runId;
|
|
63
|
+
constructor(runId) {
|
|
64
|
+
super(`workflow run ${runId} cancelled`);
|
|
65
|
+
this.runId = runId;
|
|
66
|
+
this.name = 'WorkflowTurnCancelled';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Internal: stop the replay at the first unresolved blocking op (Python `_Suspend`). Never escapes. */
|
|
70
|
+
class TurnSuspend extends Error {
|
|
71
|
+
}
|
|
72
|
+
/** Convert an arbitrary thrown value into the wire {@link StepError} (message + optional code + stack). */
|
|
73
|
+
function toStepError(err) {
|
|
74
|
+
const e = err;
|
|
75
|
+
const out = { message: err instanceof Error ? err.message : String(err) };
|
|
76
|
+
if (typeof e?.code === 'string')
|
|
77
|
+
out.code = e.code;
|
|
78
|
+
if (err instanceof Error && typeof e.stack === 'string')
|
|
79
|
+
out.stack = e.stack;
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
function resolveBody(resolver, name) {
|
|
83
|
+
return typeof resolver === 'function' ? resolver(name) : resolver.get(name);
|
|
84
|
+
}
|
|
85
|
+
class TurnContext {
|
|
86
|
+
runId;
|
|
87
|
+
commands = [];
|
|
88
|
+
#history;
|
|
89
|
+
#signalsBySeq;
|
|
90
|
+
#partition;
|
|
91
|
+
#onStep;
|
|
92
|
+
#isCancelled;
|
|
93
|
+
#now;
|
|
94
|
+
#seq = 0;
|
|
95
|
+
constructor(runId, history, pendingSignals, opts) {
|
|
96
|
+
this.runId = runId;
|
|
97
|
+
this.#history = new Map(history.map((e) => [e.seq, e]));
|
|
98
|
+
this.#signalsBySeq = new Map((pendingSignals ?? []).map((s) => [s.seq, s]));
|
|
99
|
+
this.#partition = opts.partition;
|
|
100
|
+
this.#onStep = opts.onStep;
|
|
101
|
+
this.#isCancelled = opts.isCancelled;
|
|
102
|
+
this.#now = opts.now ?? Date.now;
|
|
103
|
+
}
|
|
104
|
+
/** Every durable op takes its seq from here — the single choke point where between-op cancellation
|
|
105
|
+
* is enforced for the whole workflow API. */
|
|
106
|
+
#next() {
|
|
107
|
+
if (this.#isCancelled && this.runId !== undefined && this.#isCancelled(this.runId)) {
|
|
108
|
+
throw new WorkflowTurnCancelled(this.runId);
|
|
109
|
+
}
|
|
110
|
+
return this.#seq++;
|
|
111
|
+
}
|
|
112
|
+
/** The raw history entry at `seq` (or undefined), enforcing the kind/name nondeterminism guard. */
|
|
113
|
+
#replayEntry(seq, kind, name) {
|
|
114
|
+
const ev = this.#history.get(seq);
|
|
115
|
+
if (ev === undefined)
|
|
116
|
+
return undefined;
|
|
117
|
+
const nameMismatch = name !== undefined && ev.name !== undefined && ev.name !== name;
|
|
118
|
+
if (ev.kind !== kind || nameMismatch) {
|
|
119
|
+
throw new WorkflowNondeterminismError(`history at seq ${seq} is ${ev.kind}/${String(ev.name)}, but replay reached ${kind}/${String(name)}`);
|
|
120
|
+
}
|
|
121
|
+
return ev;
|
|
122
|
+
}
|
|
123
|
+
/** `[found, output]` for a resolved op in history; throws on a recorded failure (a catchable
|
|
124
|
+
* {@link WorkflowStepFailedError}) so awaited failures surface exactly like a rejected await. */
|
|
125
|
+
#replay(seq, kind, name) {
|
|
126
|
+
const ev = this.#replayEntry(seq, kind, name);
|
|
127
|
+
if (ev === undefined)
|
|
128
|
+
return [false, undefined];
|
|
129
|
+
if (ev.error != null)
|
|
130
|
+
throw new WorkflowStepFailedError(ev.error);
|
|
131
|
+
return [true, ev.output];
|
|
132
|
+
}
|
|
133
|
+
#emitStep(event) {
|
|
134
|
+
if (!this.#onStep)
|
|
135
|
+
return;
|
|
136
|
+
try {
|
|
137
|
+
this.#onStep(event);
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
/* live-tail is best-effort observability — a broken sink must never fail the workflow */
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
step(name, input = undefined, opts = {}) {
|
|
144
|
+
const seq = this.#next();
|
|
145
|
+
const [found, output] = this.#replay(seq, 'call', name);
|
|
146
|
+
if (found)
|
|
147
|
+
return output;
|
|
148
|
+
const group = opts.group ?? this.#partition ?? '';
|
|
149
|
+
this.commands.push({ kind: 'call', seq, name, group, input });
|
|
150
|
+
throw new TurnSuspend();
|
|
151
|
+
}
|
|
152
|
+
sleep(ms) {
|
|
153
|
+
const seq = this.#next();
|
|
154
|
+
const [found] = this.#replay(seq, 'timer');
|
|
155
|
+
if (found)
|
|
156
|
+
return;
|
|
157
|
+
this.commands.push({ kind: 'sleep', seq, ms });
|
|
158
|
+
throw new TurnSuspend();
|
|
159
|
+
}
|
|
160
|
+
waitSignal(name) {
|
|
161
|
+
const seq = this.#next();
|
|
162
|
+
const [found, output] = this.#replay(seq, 'signal', name);
|
|
163
|
+
if (found)
|
|
164
|
+
return output;
|
|
165
|
+
const sig = this.#signalsBySeq.get(seq);
|
|
166
|
+
if (sig !== undefined)
|
|
167
|
+
return sig.payload;
|
|
168
|
+
this.commands.push({ kind: 'waitSignal', seq, signal: name });
|
|
169
|
+
throw new TurnSuspend();
|
|
170
|
+
}
|
|
171
|
+
startChild(workflow, input = undefined) {
|
|
172
|
+
const seq = this.#next();
|
|
173
|
+
const [found, output] = this.#replay(seq, 'child', workflow);
|
|
174
|
+
if (found)
|
|
175
|
+
return output;
|
|
176
|
+
this.commands.push({ kind: 'startChild', seq, workflow, input });
|
|
177
|
+
throw new TurnSuspend();
|
|
178
|
+
}
|
|
179
|
+
/** Collect outputs from a list of history entries in list order, throwing an aggregate
|
|
180
|
+
* {@link WorkflowGatherFailedError} if any member resolved to a failure — the shared tail of both
|
|
181
|
+
* gather ops (the TS twin of the Python `_aggregate`). `label` names the failing member in the
|
|
182
|
+
* aggregate error (the step/child `name`). */
|
|
183
|
+
#aggregate(entries, label) {
|
|
184
|
+
const outputs = [];
|
|
185
|
+
const failures = [];
|
|
186
|
+
for (const ev of entries) {
|
|
187
|
+
if (ev !== undefined && ev.error != null) {
|
|
188
|
+
failures.push({ name: label(ev), error: ev.error });
|
|
189
|
+
outputs.push(undefined);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
outputs.push(ev?.output);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (failures.length > 0)
|
|
196
|
+
throw new WorkflowGatherFailedError(failures);
|
|
197
|
+
return outputs;
|
|
198
|
+
}
|
|
199
|
+
gatherCalls(calls, opts = {}) {
|
|
200
|
+
// Empty fan: reserve no seqs and produce no side effects (degenerate identity) — matches Python.
|
|
201
|
+
if (calls.length === 0)
|
|
202
|
+
return [];
|
|
203
|
+
const mode = opts.mode ?? 'waitAll';
|
|
204
|
+
// Reserve the whole block in list order BEFORE any dispatch — replay re-derives identical seqs.
|
|
205
|
+
const seqs = calls.map(() => this.#next());
|
|
206
|
+
const firstSeq = seqs[0];
|
|
207
|
+
const parallelGroup = `gather:${firstSeq}`;
|
|
208
|
+
const entries = calls.map((c, i) => this.#replayEntry(seqs[i], 'call', c.name));
|
|
209
|
+
// failFast: bail the moment any ALREADY-resolved member is a failure (siblings are left in flight).
|
|
210
|
+
if (mode === 'failFast') {
|
|
211
|
+
for (let i = 0; i < entries.length; i += 1) {
|
|
212
|
+
const ev = entries[i];
|
|
213
|
+
if (ev !== undefined && ev.error != null) {
|
|
214
|
+
throw new WorkflowGatherFailedError([
|
|
215
|
+
{ name: ev.name ?? calls[i].name, error: ev.error },
|
|
216
|
+
]);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// Dispatch every member not yet in history — all stamped with the shared fan group — then suspend
|
|
221
|
+
// ONCE. A member already resolved is skipped (no re-dispatch); a re-emit of a still-pending call is
|
|
222
|
+
// idempotent on the engine, so the turn re-suspends until EVERY member has resolved.
|
|
223
|
+
let pending = false;
|
|
224
|
+
for (let i = 0; i < calls.length; i += 1) {
|
|
225
|
+
if (entries[i] !== undefined)
|
|
226
|
+
continue;
|
|
227
|
+
const c = calls[i];
|
|
228
|
+
const group = c.group ?? this.#partition ?? '';
|
|
229
|
+
this.commands.push({
|
|
230
|
+
kind: 'call',
|
|
231
|
+
seq: seqs[i],
|
|
232
|
+
name: c.name,
|
|
233
|
+
group,
|
|
234
|
+
input: c.input,
|
|
235
|
+
parallelGroup,
|
|
236
|
+
});
|
|
237
|
+
pending = true;
|
|
238
|
+
}
|
|
239
|
+
if (pending)
|
|
240
|
+
throw new TurnSuspend();
|
|
241
|
+
// All resolved: outputs in INPUT order, aggregating any failures (waitAll).
|
|
242
|
+
return this.#aggregate(entries, (ev) => ev.name ?? '');
|
|
243
|
+
}
|
|
244
|
+
gatherChildren(workflow, inputs, opts = {}) {
|
|
245
|
+
if (inputs.length === 0)
|
|
246
|
+
return [];
|
|
247
|
+
const mode = opts.mode ?? 'waitAll';
|
|
248
|
+
const seqs = inputs.map(() => this.#next());
|
|
249
|
+
const firstSeq = seqs[0];
|
|
250
|
+
const parallelGroup = `gather:${firstSeq}`;
|
|
251
|
+
const entries = seqs.map((seq) => this.#replayEntry(seq, 'child', workflow));
|
|
252
|
+
if (mode === 'failFast') {
|
|
253
|
+
for (const ev of entries) {
|
|
254
|
+
if (ev !== undefined && ev.error != null) {
|
|
255
|
+
throw new WorkflowGatherFailedError([{ name: workflow, error: ev.error }]);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
let pending = false;
|
|
260
|
+
for (let i = 0; i < inputs.length; i += 1) {
|
|
261
|
+
if (entries[i] !== undefined)
|
|
262
|
+
continue;
|
|
263
|
+
this.commands.push({
|
|
264
|
+
kind: 'startChild',
|
|
265
|
+
seq: seqs[i],
|
|
266
|
+
workflow,
|
|
267
|
+
input: inputs[i],
|
|
268
|
+
parallelGroup,
|
|
269
|
+
});
|
|
270
|
+
pending = true;
|
|
271
|
+
}
|
|
272
|
+
if (pending)
|
|
273
|
+
throw new TurnSuspend();
|
|
274
|
+
return this.#aggregate(entries, () => workflow);
|
|
275
|
+
}
|
|
276
|
+
now() {
|
|
277
|
+
// The seq _localStep's own #next() is about to allocate — mirror the Python `now#<seq>` name.
|
|
278
|
+
return this.#localStep(`now#${this.#seq}`, () => this.#now());
|
|
279
|
+
}
|
|
280
|
+
sideEffect(fn) {
|
|
281
|
+
return this.#localStep('sideEffect', fn);
|
|
282
|
+
}
|
|
283
|
+
/** Run a LOCAL step once and record its result (a `recordStep` command), so a captured value happens
|
|
284
|
+
* exactly once and replay returns it. Backs {@link now} and {@link sideEffect}. */
|
|
285
|
+
#localStep(name, body) {
|
|
286
|
+
const seq = this.#next();
|
|
287
|
+
const [found, output] = this.#replay(seq, 'step', name);
|
|
288
|
+
if (found)
|
|
289
|
+
return output;
|
|
290
|
+
const startedAt = this.#now();
|
|
291
|
+
this.#emitStep({ runId: this.runId ?? '', seq, name, phase: 'running', startedAt });
|
|
292
|
+
let result;
|
|
293
|
+
try {
|
|
294
|
+
result = body();
|
|
295
|
+
}
|
|
296
|
+
catch (err) {
|
|
297
|
+
const error = toStepError(err);
|
|
298
|
+
const finishedAt = this.#now();
|
|
299
|
+
this.commands.push({ kind: 'recordStep', seq, name, error, startedAt, finishedAt });
|
|
300
|
+
this.#emitStep({ runId: this.runId ?? '', seq, name, phase: 'failed', startedAt, finishedAt, error });
|
|
301
|
+
throw new WorkflowStepFailedError(error);
|
|
302
|
+
}
|
|
303
|
+
const finishedAt = this.#now();
|
|
304
|
+
this.commands.push({ kind: 'recordStep', seq, name, output: result, startedAt, finishedAt });
|
|
305
|
+
this.#emitStep({
|
|
306
|
+
runId: this.runId ?? '',
|
|
307
|
+
seq,
|
|
308
|
+
name,
|
|
309
|
+
phase: 'completed',
|
|
310
|
+
startedAt,
|
|
311
|
+
finishedAt,
|
|
312
|
+
output: result,
|
|
313
|
+
});
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Replay one turn of `task`'s workflow against the registered `bodies` and return the wire
|
|
319
|
+
* {@link WorkflowDecision}. The shared core behind the store-less worker's workflow path AND the
|
|
320
|
+
* engine's in-process {@link import('./remote-workflow-executor.js').LocalWorkflowTurnExecutor} —
|
|
321
|
+
* transport-free and store-free, so it is testable with a plain task object.
|
|
322
|
+
*
|
|
323
|
+
* Outcomes (byte-compatible with aviary / the Python `process_workflow_task`):
|
|
324
|
+
* - body returns → `completed` (with `output` + any `recordStep` commands run this turn);
|
|
325
|
+
* - {@link TurnSuspend} (first unresolved blocking op) → `continue` (with the blocking `commands`);
|
|
326
|
+
* - {@link WorkflowTurnCancelled} → `cancelled` (partial `commands` that DID run this turn);
|
|
327
|
+
* - {@link WorkflowStepFailedError} → `failed` with that step's error;
|
|
328
|
+
* - any other throw → `failed` with the converted error;
|
|
329
|
+
* - no registered body → `failed` `{ code: 'no_workflow' }`.
|
|
330
|
+
*/
|
|
331
|
+
export async function runWorkflowTurn(bodies, task, opts = {}) {
|
|
332
|
+
const base = { taskId: task.taskId, runId: task.runId };
|
|
333
|
+
const body = resolveBody(bodies, task.workflow);
|
|
334
|
+
if (body === undefined) {
|
|
335
|
+
return {
|
|
336
|
+
...base,
|
|
337
|
+
status: 'failed',
|
|
338
|
+
commands: [],
|
|
339
|
+
error: { message: `no workflow registered for '${task.workflow}'`, code: 'no_workflow' },
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
const ctx = new TurnContext(task.runId, task.history, task.pendingSignals, opts);
|
|
343
|
+
try {
|
|
344
|
+
const output = await body(ctx, task.input);
|
|
345
|
+
return { ...base, status: 'completed', commands: ctx.commands, output };
|
|
346
|
+
}
|
|
347
|
+
catch (err) {
|
|
348
|
+
if (err instanceof TurnSuspend) {
|
|
349
|
+
return { ...base, status: 'continue', commands: ctx.commands };
|
|
350
|
+
}
|
|
351
|
+
if (err instanceof WorkflowTurnCancelled) {
|
|
352
|
+
return { ...base, status: 'cancelled', commands: ctx.commands };
|
|
353
|
+
}
|
|
354
|
+
if (err instanceof WorkflowStepFailedError) {
|
|
355
|
+
return { ...base, status: 'failed', commands: ctx.commands, error: err.error };
|
|
356
|
+
}
|
|
357
|
+
return { ...base, status: 'failed', commands: ctx.commands, error: toStepError(err) };
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* True when `task` is a WORKFLOW turn (vs a step task) — discriminated BY SHAPE (spec §6.3), byte-for-
|
|
362
|
+
* byte with the Python `is_workflow_task` (`runner-core.ts`): a workflow task carries a string
|
|
363
|
+
* `workflow` name AND a `history` array. Both ride the SAME `${P}-tasks-<token>` queue, so a unified
|
|
364
|
+
* consumer routes turns through the replay body and steps through `runStepHandler` on this predicate.
|
|
365
|
+
*/
|
|
366
|
+
export function isWorkflowTask(data) {
|
|
367
|
+
if (typeof data !== 'object' || data === null)
|
|
368
|
+
return false;
|
|
369
|
+
const t = data;
|
|
370
|
+
return typeof t.workflow === 'string' && Array.isArray(t.history);
|
|
371
|
+
}
|
|
372
|
+
//# sourceMappingURL=workflow-turn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-turn.js","sourceRoot":"","sources":["../../src/workflow-turn.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;6FAE6F;AAC7F,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACvC,KAAK,CAAY;IAC1B,YAAY,KAA4B;QACtC,KAAK,CAAC,KAAK,EAAE,OAAO,IAAI,aAAa,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,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,CAAC,EAAE,CAAC;IACxF,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAa;IAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC5D,MAAM,CAAC,GAAG,IAA+B,CAAC;IAC1C,OAAO,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACpE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/durable",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Durable cross-app workflows for AdonisJS — deterministic replay engine, AdonisJS binding, ace commands, dashboard, OpenTelemetry, Telescope, testing harness and Redis admission, all in one package. Part of the Agora ecosystem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
"import": "./dist/src/services/main.js",
|
|
24
24
|
"default": "./dist/src/services/main.js"
|
|
25
25
|
},
|
|
26
|
+
"./worker": {
|
|
27
|
+
"types": "./dist/src/worker-runtime/index.d.ts",
|
|
28
|
+
"import": "./dist/src/worker-runtime/index.js",
|
|
29
|
+
"default": "./dist/src/worker-runtime/index.js"
|
|
30
|
+
},
|
|
26
31
|
"./durable_provider": {
|
|
27
32
|
"types": "./dist/providers/durable_provider.d.ts",
|
|
28
33
|
"import": "./dist/providers/durable_provider.js",
|
|
@@ -101,6 +106,7 @@
|
|
|
101
106
|
],
|
|
102
107
|
"sideEffects": false,
|
|
103
108
|
"dependencies": {
|
|
109
|
+
"bullmq": "^5.0.0",
|
|
104
110
|
"zod": "^3.23.0"
|
|
105
111
|
},
|
|
106
112
|
"peerDependencies": {
|