@oomol-lab/open-flow 0.1.0-beta.3 → 0.1.0-beta.5

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 (47) hide show
  1. package/dist/browser/DesignerIcon-XKBRy_0Q.js +2066 -0
  2. package/dist/browser/{createResourceDialog-BkZns-oZ.js → createResourceDialog-Cf7QpXp6.js} +161 -160
  3. package/dist/browser/{dist-BMqL-qR5.js → dist-BMRLCebL.js} +291 -292
  4. package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
  5. package/dist/browser/{dist-CJpzJrLM.js → dist-Cc0y2Pli.js} +811 -812
  6. package/dist/browser/{dist-DUzA0Ukh.js → dist-Dg_VXC8f.js} +134 -135
  7. package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
  8. package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
  9. package/dist/browser/dist-DxahK_I8.js +2688 -0
  10. package/dist/browser/{dist-CPuF50D9.js → dist-meg_oHVR.js} +335 -335
  11. package/dist/browser/{esm-C2UUqIUP.js → esm-xWDFFpGd.js} +5 -6
  12. package/dist/browser/flow-authoring-module.d.ts +2 -2
  13. package/dist/browser/flow-authoring-node.d.ts +5 -2
  14. package/dist/browser/flow-authoring.d.ts +1 -1
  15. package/dist/browser/flow-authoring.js +489 -209
  16. package/dist/browser/flow-change.d.ts +110 -9
  17. package/dist/browser/flow-change.js +319 -96
  18. package/dist/browser/flow-notifications.d.ts +5 -0
  19. package/dist/browser/{diagnostics-SDCyFuxm.js → flowChanges-CeMiiZIO.js} +4234 -3825
  20. package/dist/browser/{flowRunInputEditorStore-CwvOiIiU.js → flowRunInputEditorStore-DDidwd8h.js} +10 -2
  21. package/dist/browser/{flowWorkspace-BZ_eiQNR.js → flowWorkspace-VnS8nLMT.js} +35268 -35081
  22. package/dist/browser/{getPseudoElementBounds-ESJExRFX.js → getPseudoElementBounds-5LArT6Xc.js} +1827 -2322
  23. package/dist/browser/icons-CRxvozBE.js +726 -0
  24. package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-Bj2HDFRd.js} +256 -257
  25. package/dist/browser/waitNotificationInputs-ClCAEIAM.js +26 -0
  26. package/dist/browser/workbench.css +1 -1
  27. package/dist/browser/workbench.d.ts +1 -0
  28. package/dist/browser/workbench.js +851 -840
  29. package/dist/browser/{workbenchSelect-B2s1HV-Y.js → workbenchSelect-Cf1zlVm9.js} +479 -478
  30. package/dist/common/control-api-conformance.d.ts +1 -0
  31. package/dist/common/control-api-conformance.js +80 -19
  32. package/dist/common/control-api-errors.d.ts +4 -0
  33. package/dist/common/control-api.d.ts +26 -14
  34. package/dist/common/control-api.js +138 -89
  35. package/dist/common/flow-encoding.js +20 -8
  36. package/dist/common/flow-notifications.d.ts +5 -0
  37. package/dist/common/flow-semantics.d.ts +1 -0
  38. package/dist/common/flow-semantics.js +467 -381
  39. package/dist/common/run-events.js +2 -1
  40. package/dist/common/run-lifecycle.d.ts +17 -2
  41. package/dist/common/run-lifecycle.js +53 -2
  42. package/dist/common/scheduler.d.ts +64 -3
  43. package/dist/common/scheduler.js +417 -142
  44. package/dist/index.d.ts +1 -0
  45. package/package.json +1 -1
  46. package/dist/browser/dist-BpopSHwP.js +0 -1543
  47. package/dist/browser/dist-CUSrALSX.js +0 -1620
@@ -21,22 +21,42 @@ var e = (e) => crypto.getRandomValues(new Uint8Array(e)), t = (e, t, n) => {
21
21
  for (; s--;) if (t[s] < r && (o += e[t[s] % e.length], o.length >= a)) return o;
22
22
  }
23
23
  };
24
- }, n = (n, r = 21) => t(n, r | 0, e), r = class extends Error {};
25
- function i() {
26
- throw new r();
24
+ }, n = (n, r = 21) => t(n, r | 0, e), r = Object.prototype.hasOwnProperty;
25
+ function i(e, t) {
26
+ var n, a;
27
+ if (e === t) return !0;
28
+ if (e && t && (n = e.constructor) === t.constructor) {
29
+ if (n === Date) return e.getTime() === t.getTime();
30
+ if (n === RegExp) return e.toString() === t.toString();
31
+ if (n === Array) {
32
+ if ((a = e.length) === t.length) for (; a-- && i(e[a], t[a]););
33
+ return a === -1;
34
+ }
35
+ if (!n || typeof e == "object") {
36
+ for (n in a = 0, e) if (r.call(e, n) && ++a && !r.call(t, n) || !(n in t) || !i(e[n], t[n])) return !1;
37
+ return Object.keys(t).length === a;
38
+ }
39
+ }
40
+ return e !== e && t !== t;
27
41
  }
28
- function a(e, t) {
42
+ //#endregion
43
+ //#region src/flow/common/change.ts
44
+ var a = class extends Error {};
45
+ function o() {
46
+ throw new a();
47
+ }
48
+ function s(e, t) {
29
49
  if (t.kind == "flow") return e.graph;
30
50
  let n = e.subflows[t.id];
31
- return n ?? i(), n.graph;
51
+ return n ?? o(), n.graph;
32
52
  }
33
- function o(e, t, n) {
53
+ function c(e, t, n) {
34
54
  if (t.kind == "flow") return {
35
55
  ...e,
36
56
  graph: n
37
57
  };
38
58
  let r = e.subflows[t.id];
39
- return r ?? i(), {
59
+ return r ?? o(), {
40
60
  ...e,
41
61
  subflows: {
42
62
  ...e.subflows,
@@ -47,7 +67,7 @@ function o(e, t, n) {
47
67
  }
48
68
  };
49
69
  }
50
- function s(e, t) {
70
+ function l(e, t) {
51
71
  if (!("inputs" in e)) return e;
52
72
  let n = { ...e.inputs };
53
73
  for (let [e, r] of Object.entries(n)) {
@@ -63,87 +83,123 @@ function s(e, t) {
63
83
  inputs: n
64
84
  };
65
85
  }
66
- function c(e, t) {
86
+ function u(e, t) {
67
87
  let n = { ...e.document }, r = { ...e.modules };
68
88
  for (let e of t) switch (e.kind) {
69
89
  case "binding.create":
70
- n.bindings[e.bindingId] != null && i(), n.bindings = {
71
- ...n.bindings,
72
- [e.bindingId]: e.binding
73
- };
74
- break;
75
- case "binding.replace":
76
- n.bindings[e.bindingId] ?? i(), n.bindings = {
90
+ n.bindings[e.bindingId] != null && o(), n.bindings = {
77
91
  ...n.bindings,
78
92
  [e.bindingId]: e.binding
79
93
  };
80
94
  break;
81
95
  case "binding.delete": {
82
- n.bindings[e.bindingId] ?? i();
96
+ n.bindings[e.bindingId] ?? o();
83
97
  let t = { ...n.bindings };
84
98
  delete t[e.bindingId], n.bindings = t;
85
99
  break;
86
100
  }
101
+ case "binding.target.set": {
102
+ let t = n.bindings[e.bindingId];
103
+ (t == null || t.target != e.before) && o(), n.bindings = {
104
+ ...n.bindings,
105
+ [e.bindingId]: {
106
+ ...t,
107
+ target: e.value
108
+ }
109
+ };
110
+ break;
111
+ }
87
112
  case "graph.edge.connect": {
88
- let t = a(n, e.target);
89
- t.nodes[e.edge.source] ?? i();
113
+ let t = s(n, e.target);
114
+ t.nodes[e.edge.source] ?? o();
90
115
  let r = t.nodes[e.edge.target];
91
- (r == null || !("inputs" in r)) && i();
92
- let s = r.inputs[e.edge.targetHandle], c = {
116
+ (r == null || !("inputs" in r)) && o();
117
+ let a = r.inputs[e.edge.targetHandle];
118
+ i(a, e.before) || o();
119
+ let l = {
93
120
  kind: "node",
94
121
  nodeId: e.edge.source,
95
122
  output: e.edge.sourceHandle
96
- }, l = s?.kind == "sources" ? s.sources.filter((e) => e.kind != "binding" || n.bindings[e.bindingId]?.kind != "variable") : [];
97
- l.some((e) => e.kind == "node" && e.nodeId == c.nodeId && e.output == c.output) && i();
98
- let u = {
123
+ }, u = a?.kind == "sources" ? a.sources.filter((e) => e.kind != "binding" || n.bindings[e.bindingId]?.kind != "variable") : [];
124
+ u.some((e) => e.kind == "node" && e.nodeId == l.nodeId && e.output == l.output) && o();
125
+ let d = {
99
126
  ...r,
100
127
  inputs: {
101
128
  ...r.inputs,
102
129
  [e.edge.targetHandle]: {
103
130
  kind: "sources",
104
- sources: [...l, c]
131
+ sources: [...u, l]
105
132
  }
106
133
  }
107
134
  };
108
- Object.assign(n, o(n, e.target, { nodes: {
135
+ Object.assign(n, c(n, e.target, { nodes: {
109
136
  ...t.nodes,
110
- [e.edge.target]: u
137
+ [e.edge.target]: d
111
138
  } }));
112
139
  break;
113
140
  }
114
141
  case "graph.edge.disconnect": {
115
- let t = a(n, e.target), r = t.nodes[e.edge.target];
116
- (r == null || !("inputs" in r)) && i();
117
- let s = r.inputs[e.edge.targetHandle];
118
- s?.kind != "sources" && i();
119
- let c = s.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
120
- c.length == s.sources.length && i();
121
- let l = { ...r.inputs };
122
- c.length == 0 ? delete l[e.edge.targetHandle] : l[e.edge.targetHandle] = {
142
+ let t = s(n, e.target), r = t.nodes[e.edge.target];
143
+ (r == null || !("inputs" in r)) && o();
144
+ let a = r.inputs[e.edge.targetHandle];
145
+ (a?.kind != "sources" || !i(a, e.before)) && o();
146
+ let l = a.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
147
+ l.length == a.sources.length && o();
148
+ let u = { ...r.inputs };
149
+ l.length == 0 ? delete u[e.edge.targetHandle] : u[e.edge.targetHandle] = {
123
150
  kind: "sources",
124
- sources: c
125
- }, Object.assign(n, o(n, e.target, { nodes: {
151
+ sources: l
152
+ }, Object.assign(n, c(n, e.target, { nodes: {
126
153
  ...t.nodes,
127
154
  [e.edge.target]: {
128
155
  ...r,
129
- inputs: l
156
+ inputs: u
130
157
  }
131
158
  } }));
132
159
  break;
133
160
  }
161
+ case "graph.node.additional-inputs.set": {
162
+ let t = s(n, e.target), r = t.nodes[e.nodeId];
163
+ (r?.kind != "task" || !i(r.additionalInputs, e.before)) && o();
164
+ let { additionalInputs: a, ...l } = r, u = e.value == null ? l : {
165
+ ...l,
166
+ additionalInputs: e.value
167
+ };
168
+ Object.assign(n, c(n, e.target, { nodes: {
169
+ ...t.nodes,
170
+ [e.nodeId]: u
171
+ } }));
172
+ break;
173
+ }
174
+ case "graph.node.condition.set": {
175
+ let t = s(n, e.target), r = t.nodes[e.nodeId];
176
+ r?.kind != "condition" && o(), (!i(r.cases, e.before.cases) || r.defaultOutput != e.before.defaultOutput || !i(r.input, e.before.input)) && o();
177
+ let { defaultOutput: a, ...l } = r, u = e.value.defaultOutput == null ? {
178
+ ...l,
179
+ ...e.value
180
+ } : {
181
+ ...r,
182
+ ...e.value
183
+ };
184
+ Object.assign(n, c(n, e.target, { nodes: {
185
+ ...t.nodes,
186
+ [e.nodeId]: u
187
+ } }));
188
+ break;
189
+ }
134
190
  case "graph.node.create": {
135
- let t = a(n, e.target);
136
- (t.nodes[e.nodeId] != null || e.target.kind == "subflow" && !("inputs" in e.node)) && i(), Object.assign(n, o(n, e.target, { nodes: {
191
+ let t = s(n, e.target);
192
+ (t.nodes[e.nodeId] != null || e.target.kind == "subflow" && !("inputs" in e.node)) && o(), Object.assign(n, c(n, e.target, { nodes: {
137
193
  ...t.nodes,
138
194
  [e.nodeId]: e.node
139
195
  } }));
140
196
  break;
141
197
  }
142
198
  case "graph.node.delete": {
143
- let t = a(n, e.target);
144
- t.nodes[e.nodeId] ?? i();
145
- let r = /* @__PURE__ */ new Set([e.nodeId]), c = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => r.has(e) ? [] : [[e, s(t, r)]]));
146
- if (Object.assign(n, o(n, e.target, { nodes: c })), e.target.kind == "subflow") {
199
+ let t = s(n, e.target);
200
+ t.nodes[e.nodeId] ?? o();
201
+ let r = /* @__PURE__ */ new Set([e.nodeId]), i = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => r.has(e) ? [] : [[e, l(t, r)]]));
202
+ if (Object.assign(n, c(n, e.target, { nodes: i })), e.target.kind == "subflow") {
147
203
  let t = n.subflows[e.target.id], i = t.outputs.map((e) => ({
148
204
  ...e,
149
205
  sources: e.sources.filter((e) => e.kind != "node" || !r.has(e.nodeId))
@@ -158,23 +214,149 @@ function c(e, t) {
158
214
  }
159
215
  break;
160
216
  }
161
- case "graph.node.replace": {
162
- let t = a(n, e.target);
163
- (t.nodes[e.nodeId] == null || e.target.kind == "subflow" && !("inputs" in e.node)) && i(), Object.assign(n, o(n, e.target, { nodes: {
217
+ case "graph.node.field.set": {
218
+ let t = s(n, e.target), r = t.nodes[e.nodeId];
219
+ (r == null || !i(Reflect.get(r, e.field), e.before)) && o(), e.field == "concurrency" && e.value == null && o();
220
+ let a = { ...r };
221
+ e.value == null ? Reflect.deleteProperty(a, e.field) : Object.assign(a, { [e.field]: e.value }), Object.assign(n, c(n, e.target, { nodes: {
164
222
  ...t.nodes,
165
- [e.nodeId]: e.node
223
+ [e.nodeId]: a
224
+ } }));
225
+ break;
226
+ }
227
+ case "graph.node.input.set": {
228
+ let t = s(n, e.target), r = t.nodes[e.nodeId];
229
+ (r == null || !("inputs" in r) || !i(r.inputs[e.handle], e.before)) && o();
230
+ let a = { ...r.inputs };
231
+ e.value == null ? delete a[e.handle] : a[e.handle] = e.value, Object.assign(n, c(n, e.target, { nodes: {
232
+ ...t.nodes,
233
+ [e.nodeId]: {
234
+ ...r,
235
+ inputs: a
236
+ }
237
+ } }));
238
+ break;
239
+ }
240
+ case "graph.node.task.name.set": {
241
+ let t = s(n, e.target), r = t.nodes[e.nodeId];
242
+ (r?.kind != "task" || r.task == null || r.task.name != e.before) && o();
243
+ let i = {
244
+ ...r,
245
+ task: {
246
+ ...r.task,
247
+ name: e.value
248
+ }
249
+ };
250
+ Object.assign(n, c(n, e.target, { nodes: {
251
+ ...t.nodes,
252
+ [e.nodeId]: i
166
253
  } }));
167
254
  break;
168
255
  }
256
+ case "graph.node.task.ports.set": {
257
+ let t = s(n, e.target), r = t.nodes[e.nodeId];
258
+ (r?.kind != "task" || r.task == null || !i({
259
+ inputs: r.task.inputs,
260
+ outputs: r.task.outputs
261
+ }, e.before)) && o();
262
+ let a = {
263
+ ...r,
264
+ task: {
265
+ ...r.task,
266
+ ...e.value
267
+ }
268
+ };
269
+ Object.assign(n, c(n, e.target, { nodes: {
270
+ ...t.nodes,
271
+ [e.nodeId]: a
272
+ } }));
273
+ break;
274
+ }
275
+ case "graph.node.values.set": {
276
+ let t = s(n, e.target), r = t.nodes[e.nodeId];
277
+ (r?.kind != "value" || !i(r.values, e.before)) && o(), Object.assign(n, c(n, e.target, { nodes: {
278
+ ...t.nodes,
279
+ [e.nodeId]: {
280
+ ...r,
281
+ values: e.value
282
+ }
283
+ } }));
284
+ break;
285
+ }
286
+ case "graph.node.wait.set": {
287
+ let t = n.graph, r = t.nodes[e.nodeId];
288
+ (r?.kind != "wait" || !i({
289
+ actions: r.actions,
290
+ ...r.notification == null ? {} : { notification: r.notification },
291
+ prompt: r.prompt
292
+ }, e.before)) && o();
293
+ let { notification: a, ...s } = r, c = e.value.notification == null ? {
294
+ ...s,
295
+ ...e.value
296
+ } : {
297
+ ...r,
298
+ ...e.value
299
+ };
300
+ n.graph = { nodes: {
301
+ ...t.nodes,
302
+ [e.nodeId]: c
303
+ } };
304
+ break;
305
+ }
306
+ case "graph.node.webhook.set": {
307
+ let t = s(n, e.target), r = t.nodes[e.nodeId];
308
+ (r?.kind != "webhook" || !i(r.inputsDef, e.before.inputsDef) || !i(r.options, e.before.options)) && o();
309
+ let { options: a, ...l } = r, u = e.value.options == null ? {
310
+ ...l,
311
+ inputsDef: e.value.inputsDef
312
+ } : {
313
+ ...r,
314
+ ...e.value
315
+ };
316
+ Object.assign(n, c(n, e.target, { nodes: {
317
+ ...t.nodes,
318
+ [e.nodeId]: u
319
+ } }));
320
+ break;
321
+ }
322
+ case "graph.trigger.config.set": {
323
+ let t = n.graph, r = t.nodes[e.nodeId];
324
+ (r == null || r.kind != "integration" && r.kind != "poll" || !i(r.config[e.name], e.before)) && o();
325
+ let a = { ...r.config };
326
+ e.value === void 0 ? delete a[e.name] : a[e.name] = e.value, n.graph = { nodes: {
327
+ ...t.nodes,
328
+ [e.nodeId]: {
329
+ ...r,
330
+ config: a
331
+ }
332
+ } };
333
+ break;
334
+ }
335
+ case "graph.trigger.schedule.set": {
336
+ let t = n.graph, r = t.nodes[e.nodeId];
337
+ (r == null || r.kind != "cron" && r.kind != "poll") && o(), i(r.kind == "cron" ? r.cronTimes : r.pollTimes, e.before) || o();
338
+ let a = r.kind == "cron" ? {
339
+ ...r,
340
+ cronTimes: e.value
341
+ } : {
342
+ ...r,
343
+ pollTimes: e.value
344
+ };
345
+ n.graph = { nodes: {
346
+ ...t.nodes,
347
+ [e.nodeId]: a
348
+ } };
349
+ break;
350
+ }
169
351
  case "module.create":
170
- r[e.moduleId] != null && i(), r[e.moduleId] = e.module;
352
+ r[e.moduleId] != null && o(), r[e.moduleId] = e.module;
171
353
  break;
172
354
  case "module.delete":
173
- r[e.moduleId] ?? i(), delete r[e.moduleId];
355
+ r[e.moduleId] ?? o(), delete r[e.moduleId];
174
356
  break;
175
357
  case "module.rename": {
176
358
  let t = r[e.moduleId];
177
- t ?? i(), r[e.moduleId] = {
359
+ (t == null || t.name != e.before) && o(), r[e.moduleId] = {
178
360
  ...t,
179
361
  name: e.name
180
362
  };
@@ -182,7 +364,7 @@ function c(e, t) {
182
364
  }
183
365
  case "module.source.replace": {
184
366
  let t = r[e.moduleId];
185
- t ?? i(), r[e.moduleId] = {
367
+ (t == null || t.source != e.beforeSource || !i(t.imports, e.beforeImports)) && o(), r[e.moduleId] = {
186
368
  ...t,
187
369
  imports: e.imports,
188
370
  source: e.source
@@ -190,14 +372,18 @@ function c(e, t) {
190
372
  break;
191
373
  }
192
374
  case "subflow.create":
193
- n.subflows[e.subflowId] != null && i(), n.subflows = {
375
+ n.subflows[e.subflowId] != null && o(), n.subflows = {
194
376
  ...n.subflows,
195
377
  [e.subflowId]: e.subflow
196
378
  };
197
379
  break;
198
- case "subflow.definition.replace": {
380
+ case "subflow.definition.set": {
199
381
  let t = n.subflows[e.subflowId];
200
- t ?? i(), n.subflows = {
382
+ (t == null || !i({
383
+ inputs: t.inputs,
384
+ name: t.name,
385
+ outputs: t.outputs
386
+ }, e.before)) && o(), n.subflows = {
201
387
  ...n.subflows,
202
388
  [e.subflowId]: {
203
389
  ...e.definition,
@@ -207,27 +393,64 @@ function c(e, t) {
207
393
  break;
208
394
  }
209
395
  case "subflow.delete": {
210
- n.subflows[e.subflowId] ?? i();
396
+ n.subflows[e.subflowId] ?? o();
211
397
  let t = { ...n.subflows };
212
398
  delete t[e.subflowId], n.subflows = t;
213
399
  break;
214
400
  }
215
401
  case "task.create":
216
- n.tasks[e.taskId] != null && i(), n.tasks = {
402
+ n.tasks[e.taskId] != null && o(), n.tasks = {
217
403
  ...n.tasks,
218
404
  [e.taskId]: e.task
219
405
  };
220
406
  break;
407
+ case "task.connector.connection.set": {
408
+ let t = n.tasks[e.taskId];
409
+ (t == null || !("executor" in t) || t.executor.kind != "connector" || t.executor.connectionId != e.before) && o();
410
+ let { connectionId: r, ...i } = t.executor, a = e.value == null ? i : {
411
+ ...i,
412
+ connectionId: e.value
413
+ };
414
+ n.tasks = {
415
+ ...n.tasks,
416
+ [e.taskId]: {
417
+ ...t,
418
+ executor: a
419
+ }
420
+ };
421
+ break;
422
+ }
221
423
  case "task.delete": {
222
- n.tasks[e.taskId] ?? i();
424
+ n.tasks[e.taskId] ?? o();
223
425
  let t = { ...n.tasks };
224
426
  delete t[e.taskId], n.tasks = t;
225
427
  break;
226
428
  }
227
- case "task.replace": n.tasks[e.taskId] ?? i(), n.tasks = {
228
- ...n.tasks,
229
- [e.taskId]: e.task
230
- };
429
+ case "task.llm.mode.set": {
430
+ let t = n.tasks[e.taskId];
431
+ (t == null || !("executor" in t) || t.executor.kind != "llm" || t.executor.mode != e.before) && o(), n.tasks = {
432
+ ...n.tasks,
433
+ [e.taskId]: {
434
+ ...t,
435
+ executor: {
436
+ ...t.executor,
437
+ mode: e.value
438
+ }
439
+ }
440
+ };
441
+ break;
442
+ }
443
+ case "task.name.set": {
444
+ let t = n.tasks[e.taskId];
445
+ (t == null || t.name != e.before) && o(), n.tasks = {
446
+ ...n.tasks,
447
+ [e.taskId]: {
448
+ ...t,
449
+ name: e.value
450
+ }
451
+ };
452
+ break;
453
+ }
231
454
  }
232
455
  return {
233
456
  document: n,
@@ -237,8 +460,8 @@ function c(e, t) {
237
460
  }
238
461
  //#endregion
239
462
  //#region src/flow/common/nodeChanges.ts
240
- var l = "export default async function (input, context) {\n return { result: input.value }\n}\n";
241
- function u(e, t, n, r = void 0, i = {
463
+ var d = "export default async function (inputs, context) {\n return { result: inputs.value }\n}\n";
464
+ function f(e, t, n, r = void 0, i = {
242
465
  inputs: [{
243
466
  handle: "value",
244
467
  jsonSchema: {},
@@ -256,7 +479,7 @@ function u(e, t, n, r = void 0, i = {
256
479
  module: {
257
480
  ...r ?? {
258
481
  imports: [],
259
- source: l
482
+ source: d
260
483
  },
261
484
  name: n
262
485
  },
@@ -265,7 +488,7 @@ function u(e, t, n, r = void 0, i = {
265
488
  kind: "graph.node.create",
266
489
  node: {
267
490
  concurrency: 1,
268
- inputs: D(i.inputs),
491
+ inputs: A(i.inputs),
269
492
  kind: "task",
270
493
  name: n,
271
494
  task: {
@@ -279,7 +502,7 @@ function u(e, t, n, r = void 0, i = {
279
502
  target: e
280
503
  }];
281
504
  }
282
- function d(e, t, n) {
505
+ function p(e, t, n) {
283
506
  return [{
284
507
  kind: "task.create",
285
508
  task: n,
@@ -288,7 +511,7 @@ function d(e, t, n) {
288
511
  kind: "graph.node.create",
289
512
  node: {
290
513
  concurrency: 1,
291
- inputs: D(n.inputs),
514
+ inputs: A(n.inputs),
292
515
  kind: "task",
293
516
  name: n.name,
294
517
  taskId: t.taskId
@@ -297,9 +520,9 @@ function d(e, t, n) {
297
520
  target: e
298
521
  }];
299
522
  }
300
- function f(e, t, n, r, i, a = {}) {
523
+ function m(e, t, n, r, i, a = {}) {
301
524
  let o = a.inputs ?? {};
302
- return d(e, t, {
525
+ return p(e, t, {
303
526
  executor: {
304
527
  kind: "llm",
305
528
  mode: r
@@ -312,13 +535,13 @@ function f(e, t, n, r, i, a = {}) {
312
535
  type: "array"
313
536
  },
314
537
  nullable: !0,
315
- value: O(o, "messages", null)
538
+ value: j(o, "messages", null)
316
539
  },
317
540
  {
318
541
  handle: "input",
319
542
  jsonSchema: { type: "string" },
320
543
  nullable: !1,
321
- value: O(o, "input", "Alex")
544
+ value: j(o, "input", "Alex")
322
545
  },
323
546
  {
324
547
  handle: "template",
@@ -328,7 +551,7 @@ function f(e, t, n, r, i, a = {}) {
328
551
  type: "array"
329
552
  },
330
553
  nullable: !1,
331
- value: O(o, "template", [{
554
+ value: j(o, "template", [{
332
555
  content: "Hello, I'm {{input}}",
333
556
  role: "user"
334
557
  }])
@@ -337,7 +560,7 @@ function f(e, t, n, r, i, a = {}) {
337
560
  handle: "model",
338
561
  jsonSchema: { type: "object" },
339
562
  nullable: !1,
340
- value: O(o, "model", { model: "deepseek-v4-flash" })
563
+ value: j(o, "model", { model: "deepseek-v4-flash" })
341
564
  }
342
565
  ],
343
566
  name: n,
@@ -350,7 +573,7 @@ function f(e, t, n, r, i, a = {}) {
350
573
  }]
351
574
  });
352
575
  }
353
- function p(e, t, n) {
576
+ function h(e, t, n) {
354
577
  return [{
355
578
  kind: "graph.node.create",
356
579
  node: {
@@ -381,7 +604,7 @@ function p(e, t, n) {
381
604
  target: e
382
605
  }];
383
606
  }
384
- function m(e, t, n) {
607
+ function g(e, t, n) {
385
608
  return [{
386
609
  kind: "graph.node.create",
387
610
  node: {
@@ -400,7 +623,25 @@ function m(e, t, n) {
400
623
  target: e
401
624
  }];
402
625
  }
403
- function h(e, t, n) {
626
+ function _(e, t, n) {
627
+ return [{
628
+ kind: "graph.node.create",
629
+ node: {
630
+ actions: ["continue"],
631
+ concurrency: 1,
632
+ inputs: { value: {
633
+ kind: "value",
634
+ value: null
635
+ } },
636
+ kind: "wait",
637
+ name: n,
638
+ prompt: n
639
+ },
640
+ nodeId: t,
641
+ target: e
642
+ }];
643
+ }
644
+ function v(e, t, n) {
404
645
  return [{
405
646
  kind: "graph.node.create",
406
647
  node: n,
@@ -408,7 +649,7 @@ function h(e, t, n) {
408
649
  target: e
409
650
  }];
410
651
  }
411
- function g(e, t, n, r) {
652
+ function y(e, t, n, r) {
412
653
  let i = r.name ?? n.displayName, a = n.type == "poll" ? {
413
654
  bindingId: t.bindingId,
414
655
  config: r.config,
@@ -441,8 +682,8 @@ function g(e, t, n, r) {
441
682
  target: e
442
683
  }];
443
684
  }
444
- function _(e, t, n) {
445
- let r = E(e, t)?.nodes;
685
+ function b(e, t, n) {
686
+ let r = k(e, t)?.nodes;
446
687
  if (r == null) return [];
447
688
  let i = new Set(n), a = n.flatMap((e) => {
448
689
  let n = r[e];
@@ -455,7 +696,7 @@ function _(e, t, n) {
455
696
  moduleId: n.task.moduleId
456
697
  }] : []];
457
698
  });
458
- if (t.kind == "subflow") return x(e, a);
699
+ if (t.kind == "subflow") return w(e, a);
459
700
  let o = new Set(n.flatMap((e) => {
460
701
  let t = r[e];
461
702
  return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
@@ -464,144 +705,188 @@ function _(e, t, n) {
464
705
  bindingId: t,
465
706
  kind: "binding.delete"
466
707
  });
467
- return x(e, a);
708
+ return w(e, a);
468
709
  }
469
- function v(e, t, n, r) {
470
- let i = E(e, t)?.nodes[n];
710
+ function x(e, t, n, r) {
711
+ let i = k(e, t)?.nodes[n];
471
712
  if (i == null || !("inputs" in i)) return;
472
- let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
473
- return k(t, n, {
474
- ...c,
475
- ...r
476
- });
713
+ let a = [];
714
+ return i.concurrency != r.concurrency && a.push({
715
+ before: i.concurrency,
716
+ field: "concurrency",
717
+ kind: "graph.node.field.set",
718
+ nodeId: n,
719
+ target: t,
720
+ value: r.concurrency
721
+ }), i.name != r.name && a.push({
722
+ before: i.name,
723
+ field: "name",
724
+ kind: "graph.node.field.set",
725
+ nodeId: n,
726
+ target: t,
727
+ value: r.name
728
+ }), i.timeoutMs != r.timeoutMs && a.push({
729
+ before: i.timeoutMs,
730
+ field: "timeoutMs",
731
+ kind: "graph.node.field.set",
732
+ nodeId: n,
733
+ target: t,
734
+ value: r.timeoutMs
735
+ }), a;
477
736
  }
478
- function y(e, t, n, r) {
479
- let i = E(e, t)?.nodes[n];
480
- if (i == null || !("inputs" in i)) return;
481
- let a = { ...i.inputs };
482
- for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
483
- kind: "value",
484
- value: t
485
- };
486
- return x(e, k(t, n, {
487
- ...i,
488
- inputs: a
489
- }));
737
+ function S(e, t, n, r) {
738
+ let a = k(e, t)?.nodes[n];
739
+ if (a == null || !("inputs" in a)) return;
740
+ let o = [];
741
+ for (let [e, s] of Object.entries(r)) {
742
+ let r = a.inputs[e], c = s === void 0 ? void 0 : {
743
+ kind: "value",
744
+ value: s
745
+ };
746
+ i(r, c) || o.push({
747
+ before: r,
748
+ handle: e,
749
+ kind: "graph.node.input.set",
750
+ nodeId: n,
751
+ target: t,
752
+ value: c
753
+ });
754
+ }
755
+ return w(e, o);
490
756
  }
491
- function b(e, t, n, r, i, a) {
492
- let o = E(e, t)?.nodes[n];
757
+ function C(e, t, n, r, i, a) {
758
+ let o = k(e, t)?.nodes[n];
493
759
  if (o == null || !("inputs" in o)) return;
494
- let s = o.inputs[r], c = s?.kind == "sources" && s.sources.length == 1 && s.sources[0]?.kind == "binding" ? s.sources[0].bindingId : void 0, l = c == null ? void 0 : e.document.bindings[c], u = S(e.document);
495
- if (c != null && l?.kind == "variable" && (u.get(c) ?? 0) == 1) return l.target == i ? [] : [{
760
+ let s = o.inputs[r], c = s?.kind == "sources" && s.sources.length == 1 && s.sources[0]?.kind == "binding" ? s.sources[0].bindingId : void 0, l = c == null ? void 0 : e.document.bindings[c], u = T(e.document);
761
+ return c != null && l?.kind == "variable" && (u.get(c) ?? 0) == 1 ? l.target == i ? [] : [{
762
+ before: l.target,
763
+ bindingId: c,
764
+ kind: "binding.target.set",
765
+ value: i
766
+ }] : [{
496
767
  binding: {
497
768
  kind: "variable",
498
769
  target: i
499
770
  },
500
- bindingId: c,
501
- kind: "binding.replace"
502
- }];
503
- let d = {
504
- ...o.inputs,
505
- [r]: {
771
+ bindingId: a,
772
+ kind: "binding.create"
773
+ }, ...w(e, [{
774
+ before: s,
775
+ handle: r,
776
+ kind: "graph.node.input.set",
777
+ nodeId: n,
778
+ target: t,
779
+ value: {
506
780
  kind: "sources",
507
781
  sources: [{
508
782
  bindingId: a,
509
783
  kind: "binding"
510
784
  }]
511
785
  }
512
- };
513
- return [{
514
- binding: {
515
- kind: "variable",
516
- target: i
517
- },
518
- bindingId: a,
519
- kind: "binding.create"
520
- }, ...x(e, k(t, n, {
521
- ...o,
522
- inputs: d
523
- }))];
786
+ }])];
524
787
  }
525
- function x(e, t) {
526
- let n = S(e.document), r = c(e, t), i = S(r.document);
788
+ function w(e, t) {
789
+ let n = T(e.document), r = u(e, t), i = T(r.document);
527
790
  return [...t, ...[...n.keys()].flatMap((e) => i.has(e) || r.document.bindings[e]?.kind != "variable" ? [] : [{
528
791
  bindingId: e,
529
792
  kind: "binding.delete"
530
793
  }])];
531
794
  }
532
- function S(e) {
795
+ function T(e) {
533
796
  let t = /* @__PURE__ */ new Map(), n = (e) => {
534
797
  t.set(e, (t.get(e) ?? 0) + 1);
535
798
  };
536
- for (let t of [e.graph, ...Object.values(e.subflows).map((e) => e.graph)]) for (let e of Object.values(t.nodes)) if ((e.kind == "poll" || e.kind == "integration") && n(e.bindingId), "inputs" in e) {
537
- for (let t of Object.values(e.inputs)) if (t.kind == "sources") for (let e of t.sources) e.kind == "binding" && n(e.bindingId);
799
+ for (let t of [e.graph, ...Object.values(e.subflows).map((e) => e.graph)]) for (let e of Object.values(t.nodes)) {
800
+ if ((e.kind == "poll" || e.kind == "integration") && n(e.bindingId), !("inputs" in e)) continue;
801
+ let t = [...Object.values(e.inputs), ...e.kind == "wait" && e.notification != null ? Object.values(e.notification.inputs) : []];
802
+ for (let e of t) if (e.kind == "sources") for (let t of e.sources) t.kind == "binding" && n(t.bindingId);
538
803
  }
539
804
  return t;
540
805
  }
541
- function C(e, t, n) {
806
+ function E(e, t, n) {
542
807
  let r = e.document.tasks[t];
543
- if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
544
- kind: "task.replace",
545
- task: {
546
- ...r,
547
- executor: {
548
- ...r.executor,
549
- connectionId: n
550
- }
551
- },
552
- taskId: t
808
+ if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return r.executor.connectionId == n ? [] : [{
809
+ before: r.executor.connectionId,
810
+ kind: "task.connector.connection.set",
811
+ taskId: t,
812
+ value: n
553
813
  }];
554
814
  }
555
- function w(e, t, n, r) {
556
- let i = e.document.graph.nodes[n];
557
- if (i == null) return;
558
- let a = {
559
- ...r.description == null ? {} : { description: r.description },
560
- icon: i.icon,
561
- name: r.name
562
- }, o;
563
- switch (r.kind) {
564
- case "webhook":
565
- if (i.kind != "webhook") return;
566
- o = Object.keys(r.options).length == 0 ? {
567
- ...a,
815
+ function D(e, t, n, r) {
816
+ let a = e.document.graph.nodes[n];
817
+ if (a == null) return;
818
+ let o = [];
819
+ switch (a.name != r.name && o.push({
820
+ before: a.name,
821
+ field: "name",
822
+ kind: "graph.node.field.set",
823
+ nodeId: n,
824
+ target: t,
825
+ value: r.name
826
+ }), a.description != r.description && o.push({
827
+ before: a.description,
828
+ field: "description",
829
+ kind: "graph.node.field.set",
830
+ nodeId: n,
831
+ target: t,
832
+ value: r.description
833
+ }), r.kind) {
834
+ case "webhook": {
835
+ if (a.kind != "webhook") return;
836
+ let e = {
568
837
  inputsDef: r.inputs,
569
- kind: "webhook"
570
- } : {
571
- ...a,
572
- inputsDef: r.inputs,
573
- kind: "webhook",
574
- options: r.options
838
+ options: Object.keys(r.options).length == 0 ? void 0 : r.options
839
+ }, s = {
840
+ inputsDef: a.inputsDef,
841
+ options: a.options
575
842
  };
843
+ i(s, e) || o.push({
844
+ before: s,
845
+ kind: "graph.node.webhook.set",
846
+ nodeId: n,
847
+ target: t,
848
+ value: e
849
+ });
576
850
  break;
851
+ }
577
852
  case "cron":
578
- if (i.kind != "cron") return;
579
- o = {
580
- ...a,
581
- cronTimes: r.schedule,
582
- kind: "cron"
583
- };
853
+ if (a.kind != "cron") return;
854
+ i(a.cronTimes, r.schedule) || o.push({
855
+ before: a.cronTimes,
856
+ kind: "graph.trigger.schedule.set",
857
+ nodeId: n,
858
+ value: r.schedule
859
+ });
584
860
  break;
585
861
  case "poll":
586
- if (i.kind != "poll") return;
587
- o = {
588
- ...i,
589
- ...a,
590
- config: r.config,
591
- pollTimes: r.schedule
592
- };
862
+ if (a.kind != "poll") return;
863
+ for (let e of /* @__PURE__ */ new Set([...Object.keys(a.config), ...Object.keys(r.config)])) i(a.config[e], r.config[e]) || o.push({
864
+ before: a.config[e],
865
+ kind: "graph.trigger.config.set",
866
+ name: e,
867
+ nodeId: n,
868
+ value: r.config[e]
869
+ });
870
+ i(a.pollTimes, r.schedule) || o.push({
871
+ before: a.pollTimes,
872
+ kind: "graph.trigger.schedule.set",
873
+ nodeId: n,
874
+ value: r.schedule
875
+ });
593
876
  break;
594
877
  case "integration":
595
- if (i.kind != "integration") return;
596
- o = {
597
- ...i,
598
- ...a,
599
- config: r.config
600
- };
878
+ if (a.kind != "integration") return;
879
+ for (let e of /* @__PURE__ */ new Set([...Object.keys(a.config), ...Object.keys(r.config)])) i(a.config[e], r.config[e]) || o.push({
880
+ before: a.config[e],
881
+ kind: "graph.trigger.config.set",
882
+ name: e,
883
+ nodeId: n,
884
+ value: r.config[e]
885
+ });
601
886
  }
602
- return k(t, n, o);
887
+ return o;
603
888
  }
604
- function T(e, t, n, r) {
889
+ function O(e, t, n, r) {
605
890
  let i = e.document.graph.nodes[n];
606
891
  if (i == null || i.kind != "poll" && i.kind != "integration") return;
607
892
  let a = e.document.bindings[i.bindingId];
@@ -614,68 +899,60 @@ function T(e, t, n, r) {
614
899
  kind: "binding.create"
615
900
  }];
616
901
  if (a.kind == "connection") return a.target == r ? [] : [{
617
- binding: {
618
- kind: "connection",
619
- target: r
620
- },
902
+ before: a.target,
621
903
  bindingId: i.bindingId,
622
- kind: "binding.replace"
904
+ kind: "binding.target.set",
905
+ value: r
623
906
  }];
624
907
  }
625
- function E(e, t) {
908
+ function k(e, t) {
626
909
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
627
910
  }
628
- function D(e) {
911
+ function A(e) {
629
912
  return Object.fromEntries(e.flatMap((e) => "handle" in e && Object.hasOwn(e, "value") ? [[e.handle, {
630
913
  kind: "value",
631
914
  value: e.value
632
915
  }]] : []));
633
916
  }
634
- function O(e, t, n) {
917
+ function j(e, t, n) {
635
918
  return e != null && Object.hasOwn(e, t) ? e[t] : n;
636
919
  }
637
- function k(e, t, n) {
638
- return [{
639
- kind: "graph.node.replace",
640
- node: n,
641
- nodeId: t,
642
- target: e
643
- }];
644
- }
645
920
  //#endregion
646
921
  //#region src/flow/common/edgeChanges.ts
647
- function A(e, t, n) {
922
+ function M(e, t, n) {
648
923
  let r = {
649
924
  source: n.source,
650
925
  sourceHandle: n.sourceHandle,
651
926
  target: n.target,
652
927
  targetHandle: n.targetHandle
653
- }, i = M(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
654
- return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : x(e, [{
928
+ }, i = P(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
929
+ return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : w(e, [{
930
+ before: a,
655
931
  edge: r,
656
932
  kind: "graph.edge.connect",
657
933
  target: t
658
934
  }]);
659
935
  }
660
- function j(e, t, n) {
936
+ function N(e, t, n) {
661
937
  let r = {
662
938
  source: n.source,
663
939
  sourceHandle: n.sourceHandle,
664
940
  target: n.target,
665
941
  targetHandle: n.targetHandle
666
- }, i = M(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
942
+ }, i = P(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
667
943
  return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
944
+ before: a,
668
945
  edge: r,
669
946
  kind: "graph.edge.disconnect",
670
947
  target: t
671
948
  }];
672
949
  }
673
- function M(e, t) {
950
+ function P(e, t) {
674
951
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
675
952
  }
676
953
  //#endregion
677
954
  //#region src/flow/common/moduleChanges.ts
678
- async function N(e) {
955
+ async function F(e) {
679
956
  try {
680
957
  let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
681
958
  errorRecovery: !0,
@@ -691,21 +968,24 @@ async function N(e) {
691
968
  return [];
692
969
  }
693
970
  }
694
- function P(e, t, n) {
971
+ function I(e, t, n, r, i) {
695
972
  return [{
696
- imports: n,
973
+ beforeImports: n,
974
+ beforeSource: t,
975
+ imports: i,
697
976
  kind: "module.source.replace",
698
977
  moduleId: e,
699
- source: t
978
+ source: r
700
979
  }];
701
980
  }
702
- function F(e, t) {
981
+ function L(e, t, n) {
703
982
  return [{
983
+ before: t,
704
984
  kind: "module.rename",
705
985
  moduleId: e,
706
- name: t
986
+ name: n
707
987
  }];
708
988
  }
709
- var I = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
989
+ var R = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
710
990
  //#endregion
711
- export { x as cleanVariableBindings, A as connect, I as createAuthoringId, h as createBuiltinTrigger, u as createCodeTask, p as createCondition, f as createLlmTask, d as createManagedTask, g as createProviderTrigger, m as createValue, _ as deleteNodes, j as disconnect, N as moduleImports, F as renameModule, P as replaceModuleSource, C as setConnectorConnection, y as setInputValues, b as setInputVariable, T as setTriggerConnection, v as updateSettings, w as updateTrigger };
991
+ export { w as cleanVariableBindings, M as connect, R as createAuthoringId, v as createBuiltinTrigger, f as createCodeTask, h as createCondition, m as createLlmTask, p as createManagedTask, y as createProviderTrigger, g as createValue, _ as createWait, b as deleteNodes, N as disconnect, F as moduleImports, L as renameModule, I as replaceModuleSource, E as setConnectorConnection, S as setInputValues, C as setInputVariable, O as setTriggerConnection, x as updateSettings, D as updateTrigger };