@oomol-lab/open-flow 0.1.0-alpha.9 → 0.1.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +5 -1
  2. package/dist/browser/DesignerIcon-DjgOMYI5.js +2065 -0
  3. package/dist/browser/createResourceDialog-DNBueSYZ.js +505 -0
  4. package/dist/browser/{dist-n9WmBm5w.js → dist-BKuSVKCC.js} +1 -1
  5. package/dist/browser/dist-BMRLCebL.js +1893 -0
  6. package/dist/browser/{dist-DWzdGVm9.js → dist-By46o5UV.js} +74 -74
  7. package/dist/browser/dist-CP0883sY.js +4 -0
  8. package/dist/browser/{dist-B0Q2Mn0n.js → dist-Cc0y2Pli.js} +809 -810
  9. package/dist/browser/dist-CeSZ2xSM.js +444 -0
  10. package/dist/browser/{dist-Bc9TvHYl.js → dist-Dg_VXC8f.js} +134 -135
  11. package/dist/browser/{dist-DhsGR_K3.js → dist-DmuE3M0R.js} +47 -48
  12. package/dist/browser/{dist-D5mdziGP.js → dist-DpDLsYtO.js} +18 -19
  13. package/dist/browser/dist-DxahK_I8.js +2688 -0
  14. package/dist/browser/{dist-DXgEYMFx.js → dist-meg_oHVR.js} +230 -230
  15. package/dist/browser/{esm-YIGXG-Js.js → esm-yhVU_KbQ.js} +14 -15
  16. package/dist/browser/flow-authoring-module.d.ts +2 -2
  17. package/dist/browser/flow-authoring-node.d.ts +9 -4
  18. package/dist/browser/flow-authoring.d.ts +2 -1
  19. package/dist/browser/flow-authoring.js +752 -162
  20. package/dist/browser/flow-change.d.ts +122 -13
  21. package/dist/browser/flow-change.js +326 -96
  22. package/dist/browser/flow-notifications.d.ts +5 -0
  23. package/dist/browser/flowChanges-B2ttnaj9.js +12265 -0
  24. package/dist/browser/{flowRunInputEditorStore-DXOyyY7o.js → flowRunInputEditorStore-DDidwd8h.js} +1528 -783
  25. package/dist/browser/{flowWorkspace-D7-rBA1-.js → flowWorkspace-Dr8-Hut9.js} +42428 -42499
  26. package/dist/browser/getPseudoElementBounds-5LArT6Xc.js +7147 -0
  27. package/dist/browser/icons-KIOgjHpD.js +730 -0
  28. package/dist/browser/languages-DgJehE1g.js +62 -0
  29. package/dist/browser/lib-C5Ipyfps.js +7856 -0
  30. package/dist/browser/licenses.md +119 -1
  31. package/dist/browser/main-DmjVyuWr.js +76 -0
  32. package/dist/browser/{markdownContent-ColGUxHy.js → markdownContent-DUfLdnUt.js} +4811 -4795
  33. package/dist/browser/theme.css +63 -0
  34. package/dist/browser/theme.css.d.ts +1 -0
  35. package/dist/browser/typeScriptSession-_TgJ_7Oq.js +2578 -0
  36. package/dist/browser/waitNotificationInputs-BPulOxYt.js +26 -0
  37. package/dist/browser/workbench-contract.d.ts +2 -1
  38. package/dist/browser/workbench.css +1 -1
  39. package/dist/browser/workbench.d.ts +47 -1
  40. package/dist/browser/workbench.js +1524 -1768
  41. package/dist/browser/workbenchSelect-CbXrdwxW.js +1375 -0
  42. package/dist/common/connector-action.d.ts +6 -0
  43. package/dist/common/connector-action.js +37 -29
  44. package/dist/common/control-api-conformance.d.ts +1 -0
  45. package/dist/common/control-api-conformance.js +171 -51
  46. package/dist/common/control-api-errors.d.ts +28 -0
  47. package/dist/common/control-api.d.ts +80 -21
  48. package/dist/common/control-api.js +311 -131
  49. package/dist/common/flow-encoding.d.ts +2 -2
  50. package/dist/common/flow-encoding.js +28 -9
  51. package/dist/common/flow-notifications.d.ts +5 -0
  52. package/dist/common/flow-semantics.d.ts +4 -0
  53. package/dist/common/flow-semantics.js +3544 -1098
  54. package/dist/common/integration-trigger.d.ts +1 -0
  55. package/dist/common/licenses.md +1 -25
  56. package/dist/common/localization.d.ts +21 -0
  57. package/dist/common/localization.js +62 -0
  58. package/dist/common/provider-triggers.js +4 -1
  59. package/dist/common/run-events.js +2 -1
  60. package/dist/common/run-lifecycle.d.ts +17 -2
  61. package/dist/common/run-lifecycle.js +53 -2
  62. package/dist/common/runtime-contract.d.ts +1 -1
  63. package/dist/common/runtime-contract.js +27 -0
  64. package/dist/common/scheduler.d.ts +68 -7
  65. package/dist/common/scheduler.js +528 -240
  66. package/dist/index.d.ts +2 -1
  67. package/package.json +10 -1
  68. package/dist/browser/addNodeOptions-DRndy4EK.js +0 -6910
  69. package/dist/browser/createLucideIcon-CqjqCezK.js +0 -5537
  70. package/dist/browser/createResourceDialog-A64dDFCG.js +0 -467
  71. package/dist/browser/dist-CUkceEvN.js +0 -1620
  72. package/dist/browser/dist-CVtP-E2c.js +0 -1543
  73. package/dist/browser/dist-DQVavPcf.js +0 -2328
  74. package/dist/browser/field-CKGQHCIi.js +0 -312
@@ -1,16 +1,26 @@
1
+ import * as e from "effect/Effect";
2
+ import * as t from "effect/Exit";
3
+ import * as n from "effect/FiberSet";
4
+ //#region ../../node_modules/.bun/nanoid@6.0.1/node_modules/nanoid/url-alphabet/index.js
5
+ var r = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", i = (e = 21) => {
6
+ let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
7
+ for (; e--;) t += r[n[e] & 63];
8
+ return t;
9
+ };
10
+ //#endregion
1
11
  //#region src/flow/common/change.ts
2
- function e(e) {
3
- return Object.fromEntries(e.map((e) => [e.handle, e]));
12
+ function a(e) {
13
+ return Object.fromEntries(e.flatMap((e) => "handle" in e ? [[e.handle, e]] : []));
4
14
  }
5
15
  //#endregion
6
16
  //#region src/execution/common/scheduler.ts
7
- function t(e, t) {
17
+ function o(e, t) {
8
18
  return t?.(e) ?? {
9
19
  code: "node.failed",
10
20
  message: e instanceof Error ? e.message : String(e)
11
21
  };
12
22
  }
13
- var n = class {
23
+ var s = class {
14
24
  #e = [];
15
25
  #t = 0;
16
26
  get length() {
@@ -23,14 +33,19 @@ var n = class {
23
33
  let e = this.#e[this.#t];
24
34
  return this.#t += 1, this.#t >= 64 && this.#t * 2 >= this.#e.length && (this.#e.splice(0, this.#t), this.#t = 0), e;
25
35
  }
26
- }, r = class {
36
+ restore(e) {
37
+ this.#e.push(...e);
38
+ }
39
+ snapshot() {
40
+ return this.#e.slice(this.#t);
41
+ }
42
+ }, c = class {
27
43
  #e;
28
- #t = new n();
44
+ #t = new s();
29
45
  #n;
30
46
  #r;
31
- constructor(e, t, n) {
32
- let r = e.inputs[t];
33
- this.#e = r?.kind == "sources", this.#n = !this.#e && (r?.kind == "value" || Object.hasOwn(n, "value")), this.#r = r?.kind == "value" ? r.value : n.value ?? null;
47
+ constructor(e, t) {
48
+ this.#e = e?.kind == "sources", this.#n = !this.#e && (e?.kind == "value" || Object.hasOwn(t, "value")), this.#r = e?.kind == "value" ? e.value : t.value ?? null;
34
49
  }
35
50
  get ready() {
36
51
  return this.#t.length > 0 || this.#n;
@@ -47,13 +62,26 @@ var n = class {
47
62
  take() {
48
63
  return this.#t.length > 0 ? this.#t.shift() : this.#r;
49
64
  }
50
- }, i = class {
65
+ restore(e) {
66
+ this.#n = e.provided, this.#r = e.value, this.#t.restore(e.queue);
67
+ }
68
+ snapshot() {
69
+ return {
70
+ provided: this.#n,
71
+ queue: this.#t.snapshot(),
72
+ value: this.#r
73
+ };
74
+ }
75
+ }, l = class {
51
76
  #e;
52
77
  #t;
53
78
  #n;
54
79
  #r = !1;
55
- constructor(e, t, n) {
56
- this.#t = e, this.#n = new Map(Object.entries(n).map(([e, n]) => [e, new r(t, e, n)])), this.#e = [...this.#n.values()].some((e) => e.dynamic);
80
+ constructor(e, t, n, r) {
81
+ this.#t = e, this.#n = new Map(Object.entries(n).map(([e, n]) => {
82
+ let i = new c(t[e], n), a = r?.slots[e];
83
+ return a != null && i.restore(a), [e, i];
84
+ })), this.#e = [...this.#n.values()].some((e) => e.dynamic), this.#r = r?.staticTaken ?? !1;
57
85
  }
58
86
  get ready() {
59
87
  return (!this.#r || this.#e) && [...this.#n.values()].every((e) => e.ready);
@@ -71,36 +99,59 @@ var n = class {
71
99
  if (!this.ready) throw Error(`Node "${this.#t}" inputs are not ready.`);
72
100
  return this.#e || (this.#r = !0), Object.fromEntries([...this.#n].map(([e, t]) => [e, t.take()]));
73
101
  }
74
- };
75
- function a(t, n) {
76
- switch (n.kind) {
77
- case "condition": return { [n.input.handle]: n.input };
102
+ snapshot() {
103
+ return {
104
+ slots: Object.fromEntries([...this.#n].map(([e, t]) => [e, t.snapshot()])),
105
+ staticTaken: this.#r
106
+ };
107
+ }
108
+ }, u = "notification:";
109
+ function d(e) {
110
+ return `${u}${e}`;
111
+ }
112
+ function f(e) {
113
+ return e.kind != "wait" || e.notification == null ? e.inputs : {
114
+ ...e.inputs,
115
+ ...Object.fromEntries(Object.entries(e.notification.inputs).map(([e, t]) => [d(e), t]))
116
+ };
117
+ }
118
+ function p(e, t) {
119
+ switch (t.kind) {
120
+ case "condition": return { [t.input.handle]: t.input };
78
121
  case "value": return {};
79
- case "subflow": return e(t.subflows[n.subflowId].inputs);
80
- case "task": return e(n.task == null ? t.tasks[n.taskId].inputs : n.task.inputs);
122
+ case "subflow": return a(e.subflows[t.subflowId].inputs);
123
+ case "task": return a([...t.task == null ? e.tasks[t.taskId].inputs : t.task.inputs, ...t.additionalInputs ?? []]);
124
+ case "wait": {
125
+ let n = t.notification, r = n == null ? void 0 : e.tasks[n.taskId];
126
+ return {
127
+ [t.input.handle]: t.input,
128
+ ...n == null || r == null ? {} : Object.fromEntries(r.inputs.flatMap((e) => "handle" in e && e.handle != n.messageHandle ? [[d(e.handle), e]] : []))
129
+ };
130
+ }
81
131
  }
82
132
  }
83
- function o(e, t) {
133
+ function m(e, t) {
84
134
  if (t.name != null) return t.name;
85
135
  switch (t.kind) {
86
136
  case "condition": return;
87
137
  case "value": return "Value";
88
138
  case "subflow": return e.subflows[t.subflowId].name;
89
139
  case "task": return t.task == null ? e.tasks[t.taskId].name : t.task.name;
140
+ case "wait": return "Wait";
90
141
  }
91
142
  }
92
- function s(e, t) {
143
+ function h(e, t) {
93
144
  return t.kind == "task" ? t.task == null ? e.tasks[t.taskId].executor.kind : "javascript" : t.kind;
94
145
  }
95
- function c(e, t, n, r) {
146
+ function g(e, t, n, r) {
96
147
  let i = e.get(t) ?? /* @__PURE__ */ new Map(), a = i.get(n) ?? [];
97
148
  a.push(r), i.set(n, a), e.set(t, i);
98
149
  }
99
- function l(e, t, n) {
150
+ function _(e, t, n) {
100
151
  return e.get(t)?.get(n) ?? [];
101
152
  }
102
- function u(e) {
103
- let t = new Map(Object.entries(e.nodes).map(([t, n]) => [t, new Set(Object.values(n.inputs).flatMap((t) => t.kind == "sources" ? t.sources.flatMap((t) => t.kind == "node" && e.nodes[t.nodeId] != null ? [t.nodeId] : []) : []))])), n = [];
153
+ function v(e) {
154
+ let t = new Map(Object.entries(e.nodes).map(([t, n]) => [t, new Set(Object.values(f(n)).flatMap((t) => t.kind == "sources" ? t.sources.flatMap((t) => t.kind == "node" && e.nodes[t.nodeId] != null ? [t.nodeId] : []) : []))])), n = [];
104
155
  for (; t.size > 0;) {
105
156
  let e = [...t].filter(([, e]) => e.size == 0).map(([e]) => e).toSorted();
106
157
  if (e.length == 0) throw Error("Prepared graph contains a dependency cycle.");
@@ -109,18 +160,124 @@ function u(e) {
109
160
  }
110
161
  return n;
111
162
  }
112
- function d(e, t) {
163
+ function y(e, t) {
164
+ let n = new Set(Object.values(e.nodes).flatMap((e) => Object.values(f(e)).flatMap((e) => e.kind == "sources" ? e.sources.filter((e) => e.kind == "node").map((e) => e.nodeId) : [])));
165
+ return t.filter((e) => !n.has(e));
166
+ }
167
+ function b(e, t) {
168
+ if (typeof e != "object" || !e || Array.isArray(e)) throw Error(`${t} must be an object.`);
169
+ return e;
170
+ }
171
+ function x(e, t, n) {
172
+ let r = Object.keys(e);
173
+ if (r.length != t.length || r.some((e) => !t.includes(e))) throw Error(`${n} contains unsupported fields.`);
174
+ }
175
+ function S(e, t) {
176
+ if (typeof e != "string" || e.length == 0) throw Error(`${t} must be a non-empty string.`);
177
+ return e;
178
+ }
179
+ function C(e, t) {
180
+ if (!Number.isSafeInteger(e) || Number(e) < 0) throw Error(`${t} must be a non-negative integer.`);
181
+ return Number(e);
182
+ }
183
+ function w(e, t, n = 0) {
184
+ if (n > 64) throw Error(`${t} exceeds the maximum JSON depth.`);
185
+ if (e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e)) return e;
186
+ if (Array.isArray(e)) return e.map((e) => w(e, t, n + 1));
187
+ let r = b(e, t);
188
+ return Object.fromEntries(Object.entries(r).map(([e, r]) => [e, w(r, t, n + 1)]));
189
+ }
190
+ function T(e) {
191
+ let t = b(e, "Flow Run checkpoint");
192
+ if (x(t, [
193
+ "bindingValues",
194
+ "buffers",
195
+ "completedNodes",
196
+ "nextJobs",
197
+ "outputs",
198
+ "results",
199
+ "version",
200
+ "wait"
201
+ ], "Flow Run checkpoint"), t.version != 1) throw Error("Flow Run checkpoint version is unsupported.");
202
+ let n = b(t.bindingValues, "Flow Run checkpoint bindings"), r = Object.fromEntries(Object.entries(n).map(([e, t]) => {
203
+ if (typeof t != "string") throw Error(`Flow Run checkpoint binding "${e}" must be a string.`);
204
+ return [e, t];
205
+ })), i = b(t.buffers, "Flow Run checkpoint buffers"), a = Object.fromEntries(Object.entries(i).map(([e, t]) => {
206
+ let n = b(t, `Flow Run checkpoint buffer "${e}"`);
207
+ if (x(n, ["slots", "staticTaken"], `Flow Run checkpoint buffer "${e}"`), typeof n.staticTaken != "boolean") throw Error(`Flow Run checkpoint buffer "${e}" staticTaken must be boolean.`);
208
+ let r = b(n.slots, `Flow Run checkpoint buffer "${e}" slots`);
209
+ return [e, {
210
+ slots: Object.fromEntries(Object.entries(r).map(([t, n]) => {
211
+ let r = b(n, `Flow Run checkpoint slot "${e}/${t}"`);
212
+ if (x(r, [
213
+ "provided",
214
+ "queue",
215
+ "value"
216
+ ], `Flow Run checkpoint slot "${e}/${t}"`), typeof r.provided != "boolean" || !Array.isArray(r.queue)) throw Error(`Flow Run checkpoint slot "${e}/${t}" is invalid.`);
217
+ return [t, {
218
+ provided: r.provided,
219
+ queue: r.queue.map((n) => w(n, `Flow Run checkpoint slot "${e}/${t}" queue`)),
220
+ value: w(r.value, `Flow Run checkpoint slot "${e}/${t}" value`)
221
+ }];
222
+ })),
223
+ staticTaken: n.staticTaken
224
+ }];
225
+ }));
226
+ if (!Array.isArray(t.completedNodes) || !Array.isArray(t.results)) throw Error("Flow Run checkpoint result state is invalid.");
227
+ let o = t.completedNodes.map((e) => S(e, "Flow Run checkpoint completed node")), s = Object.fromEntries(Object.entries(b(t.nextJobs, "Flow Run checkpoint next jobs")).map(([e, t]) => [e, C(t, `Flow Run checkpoint next job "${e}"`)])), c = Object.fromEntries(Object.entries(b(t.outputs, "Flow Run checkpoint outputs")).map(([e, t]) => [e, w(t, `Flow Run checkpoint output "${e}"`)])), l = t.results.map((e, t) => {
228
+ let n = b(e, `Flow Run checkpoint result ${t}`);
229
+ if (x(n, ["jobs", "nodeId"], `Flow Run checkpoint result ${t}`), !Array.isArray(n.jobs)) throw Error(`Flow Run checkpoint result ${t} jobs must be an array.`);
230
+ return {
231
+ jobs: n.jobs.map((e, n) => {
232
+ let r = b(e, `Flow Run checkpoint result ${t} job ${n}`);
233
+ return x(r, [
234
+ "jobId",
235
+ "order",
236
+ "outputs"
237
+ ], `Flow Run checkpoint result ${t} job ${n}`), {
238
+ jobId: S(r.jobId, `Flow Run checkpoint result ${t} job ${n} ID`),
239
+ order: C(r.order, `Flow Run checkpoint result ${t} job ${n} order`),
240
+ outputs: Object.fromEntries(Object.entries(b(r.outputs, `Flow Run checkpoint result ${t} job ${n} outputs`)).map(([e, r]) => [e, w(r, `Flow Run checkpoint result ${t} job ${n} output "${e}"`)]))
241
+ };
242
+ }),
243
+ nodeId: S(n.nodeId, `Flow Run checkpoint result ${t} node ID`)
244
+ };
245
+ }), u = b(t.wait, "Flow Run checkpoint wait");
246
+ return x(u, [
247
+ "jobId",
248
+ "nodeId",
249
+ "order",
250
+ "value",
251
+ "waitId"
252
+ ], "Flow Run checkpoint wait"), {
253
+ bindingValues: r,
254
+ buffers: a,
255
+ completedNodes: o,
256
+ nextJobs: s,
257
+ outputs: c,
258
+ results: l,
259
+ version: 1,
260
+ wait: {
261
+ jobId: S(u.jobId, "Flow Run checkpoint wait job ID"),
262
+ nodeId: S(u.nodeId, "Flow Run checkpoint wait node ID"),
263
+ order: C(u.order, "Flow Run checkpoint wait order"),
264
+ value: w(u.value, "Flow Run checkpoint wait value"),
265
+ waitId: S(u.waitId, "Flow Run checkpoint wait ID")
266
+ }
267
+ };
268
+ }
269
+ function E(e, t) {
113
270
  if (e === t) return !0;
114
271
  if (e == null || t == null || typeof e != "object" || typeof t != "object") return !1;
115
- if (Array.isArray(e) || Array.isArray(t)) return Array.isArray(e) && Array.isArray(t) && e.length == t.length && e.every((e, n) => d(e, t[n]));
272
+ if (Array.isArray(e) || Array.isArray(t)) return Array.isArray(e) && Array.isArray(t) && e.length == t.length && e.every((e, n) => E(e, t[n]));
116
273
  let n = Object.entries(e), r = Object.entries(t), i = t;
117
- return n.length == r.length && n.every(([e, t]) => Object.hasOwn(i, e) && d(t, i[e]));
274
+ return n.length == r.length && n.every(([e, t]) => Object.hasOwn(i, e) && E(t, i[e]));
118
275
  }
119
- function f(e, t, n) {
276
+ function D(e, t, n) {
120
277
  let r = Object.hasOwn(n, t.input) ? n[t.input] : null, i = t.value;
121
278
  switch (t.operator) {
122
- case "==": return i !== void 0 && d(r, i);
123
- case "!=": return i !== void 0 && !d(r, i);
279
+ case "==": return i !== void 0 && E(r, i);
280
+ case "!=": return i !== void 0 && !E(r, i);
124
281
  case ">": return typeof r == "number" && typeof i == "number" && r > i;
125
282
  case ">=": return typeof r == "number" && typeof i == "number" && r >= i;
126
283
  case "<": return typeof r == "number" && typeof i == "number" && r < i;
@@ -128,7 +285,7 @@ function f(e, t, n) {
128
285
  case "contains":
129
286
  case "notContains": {
130
287
  let e;
131
- return typeof r == "string" && typeof i == "string" ? e = r.includes(i) : Array.isArray(r) && i !== void 0 && (e = r.some((e) => d(e, i))), e == null ? !1 : t.operator == "contains" ? e : !e;
288
+ return typeof r == "string" && typeof i == "string" ? e = r.includes(i) : Array.isArray(r) && i !== void 0 && (e = r.some((e) => E(e, i))), e == null ? !1 : t.operator == "contains" ? e : !e;
132
289
  }
133
290
  case "startsWith": return typeof r == "string" && typeof i == "string" && r.startsWith(i);
134
291
  case "endsWith": return typeof r == "string" && typeof i == "string" && r.endsWith(i);
@@ -141,7 +298,7 @@ function f(e, t, n) {
141
298
  case "hasValue":
142
299
  case "notHasValue": {
143
300
  if (r == null || Array.isArray(r) || typeof r != "object" || i === void 0) return !1;
144
- let e = Object.values(r).some((e) => d(e, i));
301
+ let e = Object.values(r).some((e) => E(e, i));
145
302
  return t.operator == "hasValue" ? e : !e;
146
303
  }
147
304
  case "isEmpty":
@@ -155,230 +312,361 @@ function f(e, t, n) {
155
312
  case "isFalse": return r === !1;
156
313
  }
157
314
  }
158
- function p(e, t) {
315
+ function O(e, t) {
316
+ if (e === void 0) return {};
159
317
  if (typeof e != "object" || !e || Array.isArray(e)) throw Error(`Node "${t}" must return an object.`);
160
318
  return e;
161
319
  }
162
- function m(e) {
163
- return e.reason instanceof Error ? e.reason : /* @__PURE__ */ Error("Run canceled.");
164
- }
165
- function h(e, t) {
166
- return new Promise((n, r) => {
167
- let i = () => {
168
- t.removeEventListener("abort", i), r(m(t));
169
- };
170
- e.then((e) => {
171
- t.removeEventListener("abort", i), n(e);
172
- }, (e) => {
173
- t.removeEventListener("abort", i), r(e);
174
- }), t.aborted ? i() : t.addEventListener("abort", i, { once: !0 });
175
- });
176
- }
177
- async function g(n, r, d, m, _, y, b = {}, x, S) {
178
- _.throwIfAborted(), await n.emit({
179
- flowId: r.flowId,
180
- ...y == null ? {} : {
181
- parentJobId: y.jobId,
182
- parentRunId: y.runId
183
- },
184
- runId: d,
185
- type: "run.started"
186
- });
187
- let C = u(r.graph), w = C.length, T = new Map(Object.entries(r.graph.nodes).map(([e, t]) => [e, new i(e, t, a(n.prepared, t))])), E = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map();
188
- for (let [e, t] of Object.entries(r.graph.nodes)) for (let [n, r] of Object.entries(t.inputs)) if (r.kind == "sources") for (let t of r.sources) if (t.kind == "flow") {
189
- let r = E.get(t.input) ?? [];
190
- r.push({
320
+ function k(r, s, c, d, b, x = {}, S, C, w) {
321
+ return e.scoped(e.gen(function* () {
322
+ w ?? (yield* r.emit({
323
+ flowId: s.flowId,
324
+ ...b == null ? {} : {
325
+ parentJobId: b.jobId,
326
+ parentRunId: b.runId
327
+ },
328
+ runId: c,
329
+ type: "run.started"
330
+ }));
331
+ let E = v(s.graph), A = y(s.graph, E), M = E.length, N = new Map(Object.entries(s.graph.nodes).map(([e, t]) => [e, new l(e, f(t), p(r.prepared, t), w?.checkpoint.buffers[e])]));
332
+ if (w != null) {
333
+ let t = Object.keys(w.checkpoint.buffers).toSorted();
334
+ if (t.length != E.length || t.some((e, t) => e != [...E].toSorted()[t])) return yield* e.fail(/* @__PURE__ */ Error("Flow Run checkpoint buffers do not match the prepared graph."));
335
+ for (let [t, n] of Object.entries(s.graph.nodes)) {
336
+ let i = Object.keys(p(r.prepared, n)).toSorted(), a = Object.keys(w.checkpoint.buffers[t].slots).toSorted();
337
+ if (i.length != a.length || i.some((e, t) => e != a[t])) return yield* e.fail(/* @__PURE__ */ Error(`Flow Run checkpoint inputs do not match node "${t}".`));
338
+ }
339
+ }
340
+ let P = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new Map();
341
+ for (let [e, t] of Object.entries(s.graph.nodes)) for (let [n, r] of Object.entries(f(t))) if (r.kind == "sources") for (let t of r.sources) if (t.kind == "binding") {
342
+ let r = F.get(t.bindingId) ?? [];
343
+ r.push({
344
+ handle: n,
345
+ nodeId: e
346
+ }), F.set(t.bindingId, r);
347
+ } else if (t.kind == "flow") {
348
+ let r = P.get(t.input) ?? [];
349
+ r.push({
350
+ handle: n,
351
+ nodeId: e
352
+ }), P.set(t.input, r);
353
+ } else t.kind == "node" && g(I, t.nodeId, t.output, {
191
354
  handle: n,
192
355
  nodeId: e
193
- }), E.set(t.input, r);
194
- } else t.kind == "node" && c(D, t.nodeId, t.output, {
195
- handle: n,
196
- nodeId: e
197
- });
198
- for (let [e, t] of Object.entries(r.outputs)) for (let n of t.sources) n.kind == "node" && c(O, n.nodeId, n.output, e);
199
- let k = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Set(), F = new AbortController(), I = AbortSignal.any([_, F.signal]), L, R = !1, z, B = (e, t) => {
200
- F.signal.aborted || (T.get(e.nodeId).push(e.handle, t), z(e.nodeId));
201
- }, V = async (e, t, r, i) => {
202
- await n.emit({
203
- handle: r,
204
- jobId: t,
205
- nodeId: e,
206
- runId: d,
207
- type: "node.output",
208
- value: i
209
356
  });
210
- for (let t of l(D, e, r)) B(t, i);
211
- for (let t of l(O, e, r)) N.set(t, i), await x?.(t, i);
212
- }, H = async (t, r, i, a) => {
213
- let c = s(n.prepared, r), l = o(n.prepared, r);
214
- await n.emit({
215
- inputs: a,
216
- jobId: i,
217
- nodeId: t,
218
- nodeKind: c,
219
- ...l == null ? {} : { nodeTitle: l },
220
- runId: d,
221
- type: "node.started"
222
- });
223
- let u = r.timeoutMs == null ? void 0 : new AbortController(), m = u == null ? void 0 : setTimeout(() => u.abort(/* @__PURE__ */ Error(`Node "${t}" timed out.`)), r.timeoutMs), _ = u == null ? I : AbortSignal.any([I, u.signal]);
224
- try {
225
- let o;
226
- switch (r.kind) {
227
- case "condition": {
228
- let e = r.cases.find((e) => {
229
- if (e.expressions.length == 0) return !1;
230
- let t = e.expressions.map((e) => f(r, e, a));
231
- return e.relation == "all" ? t.every(Boolean) : t.some(Boolean);
232
- })?.output ?? r.defaultOutput;
233
- o = e == null ? {} : { [e]: a[r.input.handle] ?? null }, e != null && await V(t, i, e, o[e]);
234
- break;
357
+ for (let [e, t] of Object.entries(s.outputs)) for (let n of t.sources) n.kind == "node" && g(L, n.nodeId, n.output, e);
358
+ let R = /* @__PURE__ */ new Map(), z = yield* n.make(), B = yield* n.runtime(z)(), V = new Map(w?.checkpoint.results.map((e) => [e.nodeId, [...e.jobs]]) ?? []), H = new Map(Object.entries(w?.checkpoint.nextJobs ?? {})), U = new Map(Object.entries(w?.checkpoint.outputs ?? {})), W = new Set(w?.checkpoint.completedNodes ?? []), G, K, q = w != null, J, Y, X = (e, t) => {
359
+ G ?? (N.get(e.nodeId).push(e.handle, t), Y(e.nodeId));
360
+ }, Z = (t, n, i, a) => e.gen(function* () {
361
+ yield* r.emit({
362
+ handle: i,
363
+ jobId: n,
364
+ nodeId: t,
365
+ runId: c,
366
+ type: "node.output",
367
+ value: a
368
+ });
369
+ for (let e of _(I, t, i)) X(e, a);
370
+ for (let e of _(L, t, i)) U.set(e, a), S != null && (yield* S(e, a));
371
+ }), ee = (t, n, i, o) => {
372
+ let l = e.gen(function* () {
373
+ let l = h(r.prepared, n), u = m(r.prepared, n), d = Object.fromEntries(Object.entries(o).filter(([e]) => {
374
+ if (n.kind == "wait") return e == n.input.handle;
375
+ let t = n.inputs[e];
376
+ return t?.kind != "sources" || t.sources.every((e) => e.kind != "binding");
377
+ }));
378
+ yield* r.emit({
379
+ inputs: d,
380
+ jobId: i,
381
+ nodeId: t,
382
+ nodeKind: l,
383
+ ...u == null ? {} : { nodeTitle: u },
384
+ runId: c,
385
+ type: "node.started"
386
+ });
387
+ let f;
388
+ switch (n.kind) {
389
+ case "condition": {
390
+ let e = n.cases.find((e) => {
391
+ if (e.expressions.length == 0) return !1;
392
+ let t = e.expressions.map((e) => D(n, e, o));
393
+ return e.relation == "all" ? t.every(Boolean) : t.some(Boolean);
394
+ })?.output ?? n.defaultOutput;
395
+ f = e == null ? {} : { [e]: o[n.input.handle] ?? null }, e != null && (yield* Z(t, i, e, f[e]));
396
+ break;
397
+ }
398
+ case "value":
399
+ f = Object.fromEntries(n.values.map((e) => [e.handle, e.value ?? null]));
400
+ for (let [e, n] of Object.entries(f)) yield* Z(t, i, e, n);
401
+ break;
402
+ case "subflow": {
403
+ let e = r.prepared.subflows[n.subflowId];
404
+ f = yield* k(r, {
405
+ flowId: n.subflowId,
406
+ graph: j(e.graph),
407
+ inputs: a(e.inputs),
408
+ kind: "subflow",
409
+ outputs: a(e.outputs)
410
+ }, r.createId(), o, {
411
+ jobId: i,
412
+ runId: c
413
+ }, {}, (e, n) => Z(t, i, e, n));
414
+ break;
415
+ }
416
+ case "task": {
417
+ let a = new Set((n.additionalInputs ?? []).map((e) => e.handle)), l = /* @__PURE__ */ new Map(), u = (n) => e.gen(function* () {
418
+ let r = yield* e.try({
419
+ try: () => O(n, t),
420
+ catch: (e) => e instanceof Error ? e : Error(String(e))
421
+ });
422
+ for (let [e, n] of Object.entries(r)) yield* Z(t, i, e, n), l.set(e, n);
423
+ });
424
+ yield* u(yield* r.invokeTask({
425
+ additionalInputs: Object.fromEntries(Object.entries(o).filter(([e]) => a.has(e))),
426
+ blockId: n.task == null ? n.taskId : n.task.moduleId,
427
+ flowId: s.flowId,
428
+ input: Object.fromEntries(Object.entries(o).filter(([e]) => !a.has(e))),
429
+ invocationId: r.createId(),
430
+ jobId: i,
431
+ nodeId: t,
432
+ runId: c,
433
+ ...n.task == null ? { taskId: n.taskId } : {
434
+ capabilities: n.task.capabilities ?? [],
435
+ moduleId: n.task.moduleId
436
+ }
437
+ }, u)), f = Object.fromEntries(l);
438
+ break;
439
+ }
440
+ case "wait": return yield* e.fail(/* @__PURE__ */ Error("Wait jobs are handled by the Scheduler suspension boundary."));
235
441
  }
236
- case "value":
237
- o = Object.fromEntries(r.values.map((e) => [e.handle, e.value ?? null]));
238
- for (let [e, n] of Object.entries(o)) await V(t, i, e, n);
239
- break;
240
- case "subflow": {
241
- let s = n.prepared.subflows[r.subflowId];
242
- o = await h(g(n, {
243
- flowId: r.subflowId,
244
- graph: v(s.graph),
245
- inputs: e(s.inputs),
246
- kind: "subflow",
247
- outputs: e(s.outputs)
248
- }, n.createId(), a, _, {
249
- jobId: i,
250
- runId: d
251
- }, {}, (e, n) => V(t, i, e, n)), _);
252
- break;
442
+ return yield* r.emit({
443
+ jobId: i,
444
+ nodeId: t,
445
+ runId: c,
446
+ type: "node.completed"
447
+ }), f;
448
+ });
449
+ return n.timeoutMs == null ? l : l.pipe(e.timeoutOrElse({
450
+ duration: n.timeoutMs,
451
+ orElse: () => e.fail(/* @__PURE__ */ Error(`Node "${t}" timed out.`))
452
+ }));
453
+ }, te = (t) => {
454
+ let n = s.graph.nodes[t], a = N.get(t).take(), l = r.createId(), d = H.get(t) ?? 0;
455
+ if (H.set(t, d + 1), n.kind == "wait") {
456
+ q = !0, J = {
457
+ actions: n.actions,
458
+ jobId: l,
459
+ nodeId: t,
460
+ ...n.notification == null ? {} : { notification: {
461
+ input: Object.fromEntries(Object.entries(a).flatMap(([e, t]) => e.startsWith(u) ? [[e.slice(13), t]] : [])),
462
+ messageHandle: n.notification.messageHandle,
463
+ taskId: n.notification.taskId
464
+ } },
465
+ order: d,
466
+ value: a[n.input.handle] ?? null,
467
+ waitId: i()
468
+ };
469
+ let e = n.inputs[n.input.handle], o = e?.kind == "sources" && e.sources.some((e) => e.kind == "binding") ? {} : { [n.input.handle]: a[n.input.handle] ?? null };
470
+ B(r.emit({
471
+ inputs: o,
472
+ jobId: l,
473
+ nodeId: t,
474
+ nodeKind: "wait",
475
+ ...n.name == null ? {} : { nodeTitle: n.name },
476
+ runId: c,
477
+ type: "node.started"
478
+ }));
479
+ return;
480
+ }
481
+ R.set(t, (R.get(t) ?? 0) + 1), B(ee(t, n, l, a).pipe(e.tap((n) => e.gen(function* () {
482
+ let e = V.get(t) ?? [];
483
+ e.push({
484
+ jobId: l,
485
+ order: d,
486
+ outputs: n
487
+ }), V.set(t, e), W.has(t) || (W.add(t), yield* r.emit({
488
+ ...b == null ? {} : {
489
+ parentJobId: b.jobId,
490
+ parentRunId: b.runId
491
+ },
492
+ progress: W.size / M * 100,
493
+ runId: c,
494
+ type: "run.progress"
495
+ }));
496
+ })), e.tapError((n) => e.gen(function* () {
497
+ G ?? (K ??= n);
498
+ let i = o(n, r.projectFailure);
499
+ yield* r.emit({
500
+ ...i,
501
+ jobId: l,
502
+ nodeId: t,
503
+ runId: c,
504
+ type: "node.failed"
505
+ }).pipe(e.ignore);
506
+ })), e.tapCause((t) => e.sync(() => {
507
+ G ??= t;
508
+ })), e.ensuring(e.sync(() => {
509
+ R.set(t, (R.get(t) ?? 1) - 1), Y(t);
510
+ }))));
511
+ };
512
+ if (Y = (e) => {
513
+ if (G != null || q) return;
514
+ let t = s.graph.nodes[e], n = N.get(e);
515
+ for (; n.ready && (R.get(e) ?? 0) < t.concurrency;) if (te(e), q) return;
516
+ }, w == null) {
517
+ for (let [e, t] of Object.entries(x)) {
518
+ let n = N.get(e);
519
+ if (n != null) for (let [e, r] of Object.entries(t)) n.launch(e, r);
520
+ }
521
+ for (let [t, n] of F) {
522
+ if (!Object.hasOwn(r.bindingValues, t)) return yield* e.fail(/* @__PURE__ */ Error(`Variable binding "${t}" is unresolved.`));
523
+ for (let e of n) X(e, r.bindingValues[t]);
524
+ }
525
+ for (let [e, t] of Object.entries(s.inputs)) {
526
+ let n = Object.hasOwn(d, e) ? d[e] : t.value;
527
+ if (n !== void 0) {
528
+ for (let t of Object.entries(s.outputs)) t[1].sources.some((t) => t.kind == "flow" && t.input == e) && (U.set(t[0], n), S != null && (yield* S(t[0], n)));
529
+ for (let t of P.get(e) ?? []) X(t, n);
253
530
  }
254
- case "task":
255
- o = p(await h(n.invokeTask({
256
- input: a,
257
- invocationId: n.createId(),
258
- jobId: i,
259
- nodeId: t,
260
- runId: d,
261
- signal: _,
262
- ...r.task == null ? { taskId: r.taskId } : {
263
- capabilities: r.task.capabilities ?? [],
264
- moduleId: r.task.moduleId
265
- }
266
- }), _), t);
267
- for (let [e, n] of Object.entries(o)) await V(t, i, e, n);
268
531
  }
269
- return await n.emit({
270
- jobId: i,
271
- nodeId: t,
272
- runId: d,
532
+ if (C != null) for (let e of _(I, C.nodeId, "payload")) X(e, C.payload);
533
+ } else {
534
+ let t = w.checkpoint.wait, n = s.graph.nodes[t.nodeId];
535
+ if (n?.kind != "wait" || !n.actions.some((e) => e == w.action)) return yield* e.fail(/* @__PURE__ */ Error("Flow Run checkpoint resolution does not match the prepared Wait node."));
536
+ if (Object.keys(w.checkpoint.nextJobs).some((e) => s.graph.nodes[e] == null)) return yield* e.fail(/* @__PURE__ */ Error("Flow Run checkpoint job state does not match the prepared graph."));
537
+ let i = { [w.action]: t.value };
538
+ yield* Z(t.nodeId, t.jobId, w.action, t.value);
539
+ let a = V.get(t.nodeId) ?? [];
540
+ a.push({
541
+ jobId: t.jobId,
542
+ order: t.order,
543
+ outputs: i
544
+ }), V.set(t.nodeId, a), W.has(t.nodeId) || (W.add(t.nodeId), yield* r.emit({
545
+ progress: W.size / M * 100,
546
+ runId: c,
547
+ type: "run.progress"
548
+ })), yield* r.emit({
549
+ jobId: t.jobId,
550
+ nodeId: t.nodeId,
551
+ runId: c,
273
552
  type: "node.completed"
274
- }), o;
275
- } finally {
276
- m != null && clearTimeout(m);
553
+ }), q = !1;
277
554
  }
278
- }, U = (e) => {
279
- let i = r.graph.nodes[e], a = T.get(e).take(), o = n.createId(), s = M.get(e) ?? 0;
280
- M.set(e, s + 1), k.set(e, (k.get(e) ?? 0) + 1);
281
- let c = Promise.resolve();
282
- c = H(e, i, o, a).then(async (t) => {
283
- let r = j.get(e) ?? [];
284
- r.push({
285
- jobId: o,
286
- order: s,
287
- outputs: t
288
- }), j.set(e, r), P.has(e) || (P.add(e), await n.emit({
289
- ...y == null ? {} : {
290
- parentJobId: y.jobId,
291
- parentRunId: y.runId
555
+ for (let e of E) Y(e);
556
+ let Q = yield* e.raceFirst(n.awaitEmpty(z), n.join(z)).pipe(e.exit);
557
+ if (K != null) return yield* n.clear(z), yield* r.emit({
558
+ message: K.message,
559
+ runId: c,
560
+ type: "run.failed"
561
+ }).pipe(e.ignore), yield* e.fail(K);
562
+ if (G != null) return yield* n.clear(z), yield* e.failCause(G);
563
+ if (t.isFailure(Q)) return yield* e.failCause(Q.cause);
564
+ if (J != null) {
565
+ if (s.kind != "flow") return yield* e.fail(/* @__PURE__ */ Error("Subflow Wait is not supported."));
566
+ let t = {
567
+ bindingValues: r.bindingValues,
568
+ buffers: Object.fromEntries([...N].map(([e, t]) => [e, t.snapshot()])),
569
+ completedNodes: [...W].toSorted(),
570
+ nextJobs: Object.fromEntries(H),
571
+ outputs: Object.fromEntries(U),
572
+ results: A.map((e) => ({
573
+ jobs: (V.get(e) ?? []).toSorted((e, t) => e.order - t.order),
574
+ nodeId: e
575
+ })),
576
+ version: 1,
577
+ wait: {
578
+ jobId: J.jobId,
579
+ nodeId: J.nodeId,
580
+ order: J.order,
581
+ value: J.value,
582
+ waitId: J.waitId
583
+ }
584
+ }, n = JSON.stringify(t);
585
+ if (new TextEncoder().encode(n).byteLength > 16777216) {
586
+ let t = "Flow Run checkpoint exceeds 16 MiB.";
587
+ return yield* r.emit({
588
+ code: "run.checkpoint-too-large",
589
+ jobId: J.jobId,
590
+ message: t,
591
+ nodeId: J.nodeId,
592
+ runId: c,
593
+ type: "node.failed"
594
+ }), yield* r.emit({
595
+ message: t,
596
+ runId: c,
597
+ type: "run.failed"
598
+ }), yield* e.fail(/* @__PURE__ */ Error(`run.checkpoint-too-large: ${t}`));
599
+ }
600
+ return {
601
+ checkpoint: T(JSON.parse(n)),
602
+ kind: "waiting",
603
+ ...J.notification == null ? {} : { notification: J.notification },
604
+ wait: {
605
+ actions: J.actions,
606
+ jobId: J.jobId,
607
+ nodeId: J.nodeId,
608
+ order: J.order,
609
+ waitId: J.waitId
610
+ }
611
+ };
612
+ }
613
+ if (s.kind == "subflow") {
614
+ let e = Object.fromEntries(U);
615
+ return yield* r.emit({
616
+ result: {
617
+ kind: "function-outputs",
618
+ outputs: e,
619
+ target: "subflow"
292
620
  },
293
- progress: P.size / w * 100,
294
- runId: d,
295
- type: "run.progress"
296
- }));
297
- }).catch(async (r) => {
298
- R || (R = !0, L = r, F.abort(r));
299
- let i = t(r, n.projectFailure);
300
- await n.emit({
301
- ...i,
302
- jobId: o,
303
- nodeId: e,
304
- runId: d,
305
- type: "node.failed"
306
- }).catch(() => void 0);
307
- }).finally(() => {
308
- A.delete(c), k.set(e, (k.get(e) ?? 1) - 1), z(e);
309
- }), A.add(c);
310
- };
311
- z = (e) => {
312
- if (F.signal.aborted) return;
313
- let t = r.graph.nodes[e], n = T.get(e);
314
- for (; n.ready && (k.get(e) ?? 0) < t.concurrency;) U(e);
315
- };
316
- for (let [e, t] of Object.entries(b)) {
317
- let n = T.get(e);
318
- if (n != null) for (let [e, r] of Object.entries(t)) n.launch(e, r);
319
- }
320
- for (let [e, t] of Object.entries(r.inputs)) {
321
- let n = Object.hasOwn(m, e) ? m[e] : t.value;
322
- if (n !== void 0) {
323
- for (let t of Object.entries(r.outputs)) t[1].sources.some((t) => t.kind == "flow" && t.input == e) && (N.set(t[0], n), await x?.(t[0], n));
324
- for (let t of E.get(e) ?? []) B(t, n);
621
+ runId: c,
622
+ type: "run.completed"
623
+ }), e;
325
624
  }
326
- }
327
- if (S != null) for (let e of l(D, S.nodeId, "payload")) B(e, S.payload);
328
- for (let e of C) z(e);
329
- for (; A.size > 0;) await Promise.race(A);
330
- if (R) throw await n.emit({
331
- message: L instanceof Error ? L.message : String(L),
332
- runId: d,
333
- type: "run.failed"
334
- }).catch(() => void 0), L;
335
- if (I.throwIfAborted(), r.kind == "subflow") {
336
- let e = Object.fromEntries(N);
337
- return await n.emit({
338
- result: {
339
- kind: "function-outputs",
340
- outputs: e,
341
- target: "subflow"
342
- },
343
- runId: d,
625
+ let $ = {
626
+ kind: "node-results",
627
+ nodes: A.map((e) => ({
628
+ jobs: (V.get(e) ?? []).toSorted((e, t) => e.order - t.order).map(({ jobId: e, outputs: t }) => ({
629
+ jobId: e,
630
+ outputs: t
631
+ })),
632
+ nodeId: e
633
+ }))
634
+ };
635
+ return yield* r.emit({
636
+ result: $,
637
+ runId: c,
344
638
  type: "run.completed"
345
- }), e;
346
- }
347
- let W = new Set(Object.values(r.graph.nodes).flatMap((e) => Object.values(e.inputs).flatMap((e) => e.kind == "sources" ? e.sources.filter((e) => e.kind == "node").map((e) => e.nodeId) : []))), G = {
348
- kind: "node-results",
349
- nodes: C.filter((e) => !W.has(e)).map((e) => ({
350
- jobs: (j.get(e) ?? []).toSorted((e, t) => e.order - t.order).map(({ jobId: e, outputs: t }) => ({
351
- jobId: e,
352
- outputs: t
353
- })),
354
- nodeId: e
355
- }))
356
- };
357
- return await n.emit({
358
- result: G,
359
- runId: d,
360
- type: "run.completed"
361
- }), G;
639
+ }), $;
640
+ }));
362
641
  }
363
- async function _(e, t) {
364
- let n = async (e) => await t.emit?.(e), r = t.signal ?? new AbortController().signal, i = t.trigger == null ? void 0 : e.graph.nodes[t.trigger.nodeId];
365
- if (t.trigger != null && (i == null || "inputs" in i)) throw Error(`Node "${t.trigger.nodeId}" is not a TriggerNode in Flow "${t.flowId}".`);
366
- return await g({
367
- createId: t.createId,
368
- emit: n,
369
- invokeTask: t.invokeTask,
370
- prepared: e,
371
- projectFailure: t.projectFailure
372
- }, {
373
- flowId: t.flowId,
374
- graph: v(e.graph),
375
- inputs: {},
376
- kind: "flow",
377
- outputs: {}
378
- }, t.runId, {}, r, void 0, t.inputs, void 0, t.trigger);
642
+ function A(t, n) {
643
+ let r = n.emit ?? (() => e.void);
644
+ return e.gen(function* () {
645
+ if (n.resume != null && (n.inputs != null || n.trigger != null)) return yield* e.fail(/* @__PURE__ */ Error("A resumed Flow Run cannot accept launch inputs or a Trigger seed."));
646
+ let i = n.resume == null ? void 0 : T(n.resume.checkpoint);
647
+ if (i != null && new TextEncoder().encode(JSON.stringify(i)).byteLength > 16777216) return yield* e.fail(/* @__PURE__ */ Error("Flow Run checkpoint exceeds 16 MiB."));
648
+ let a = n.trigger == null ? void 0 : t.graph.nodes[n.trigger.nodeId];
649
+ return n.trigger != null && (a == null || "inputs" in a) ? yield* e.fail(/* @__PURE__ */ Error(`Node "${n.trigger.nodeId}" is not a TriggerNode in Flow "${n.flowId}".`)) : yield* k({
650
+ bindingValues: i?.bindingValues ?? n.bindingValues ?? {},
651
+ createId: n.createId,
652
+ emit: r,
653
+ invokeTask: n.invokeTask,
654
+ prepared: t,
655
+ projectFailure: n.projectFailure
656
+ }, {
657
+ flowId: n.flowId,
658
+ graph: j(t.graph),
659
+ inputs: {},
660
+ kind: "flow",
661
+ outputs: {}
662
+ }, n.runId, {}, void 0, n.inputs, void 0, n.trigger, i == null ? void 0 : {
663
+ action: n.resume.action,
664
+ checkpoint: i
665
+ });
666
+ });
379
667
  }
380
- function v(e) {
668
+ function j(e) {
381
669
  return { nodes: Object.fromEntries(Object.entries(e.nodes).filter((e) => "inputs" in e[1])) };
382
670
  }
383
671
  //#endregion
384
- export { _ as runFlow };
672
+ export { T as decodeFlowRunCheckpoint, A as runFlow };