@oomol-lab/open-flow 0.1.0-beta.4 → 0.1.0-beta.6

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 (41) hide show
  1. package/dist/browser/{DesignerIcon-DdfuH2jW.js → DesignerIcon-XKBRy_0Q.js} +640 -640
  2. package/dist/browser/createResourceDialog-Cf7QpXp6.js +505 -0
  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-C9jQK70n.js → esm-CTcBY7hh.js} +5 -6
  12. package/dist/browser/flow-authoring-module.d.ts +2 -2
  13. package/dist/browser/flow-authoring-node.d.ts +2 -2
  14. package/dist/browser/flow-authoring.js +475 -209
  15. package/dist/browser/flow-change.d.ts +98 -8
  16. package/dist/browser/flow-change.js +319 -96
  17. package/dist/browser/{flowChanges-Bs-ZcJV8.js → flowChanges-BDqD_Q4G.js} +1628 -1555
  18. package/dist/browser/{flowRunInputEditorStore-BYa8zFLC.js → flowRunInputEditorStore-DDidwd8h.js} +9 -1
  19. package/dist/browser/{flowWorkspace-BewofPeU.js → flowWorkspace-CPBHm14t.js} +9803 -9769
  20. package/dist/browser/{getPseudoElementBounds-qDxSDwzN.js → getPseudoElementBounds-5LArT6Xc.js} +494 -474
  21. package/dist/browser/icons-CRxvozBE.js +726 -0
  22. package/dist/browser/{typeScriptSession-CwMPjseS.js → typeScriptSession-_TgJ_7Oq.js} +256 -257
  23. package/dist/browser/{waitNotificationInputs-DtrPBwA1.js → waitNotificationInputs-lPrLDTOd.js} +2 -2
  24. package/dist/browser/workbench.css +1 -1
  25. package/dist/browser/workbench.js +573 -578
  26. package/dist/browser/{workbenchSelect-CX8KtT7L.js → workbenchSelect-Cf1zlVm9.js} +398 -398
  27. package/dist/common/control-api-conformance.js +27 -19
  28. package/dist/common/control-api.d.ts +4 -11
  29. package/dist/common/control-api.js +6 -18
  30. package/dist/common/flow-encoding.js +4 -0
  31. package/dist/common/flow-semantics.js +8 -10
  32. package/dist/common/runtime-contract.d.ts +1 -1
  33. package/dist/common/runtime-contract.js +27 -0
  34. package/dist/common/scheduler.d.ts +1 -1
  35. package/dist/common/scheduler.js +17 -18
  36. package/dist/index.d.ts +1 -1
  37. package/package.json +1 -1
  38. package/dist/browser/createResourceDialog-4YQKl8lG.js +0 -505
  39. package/dist/browser/dist-BpopSHwP.js +0 -1543
  40. package/dist/browser/dist-CUSrALSX.js +0 -1620
  41. package/dist/browser/icons-DRoMXL5h.js +0 -521
@@ -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 (inputs, context) {\n return { result: inputs.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: O(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: O(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: k(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: k(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: k(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: k(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,12 +623,18 @@ function m(e, t, n) {
400
623
  target: e
401
624
  }];
402
625
  }
403
- function h(e, t, n) {
626
+ function _(e, t, n) {
404
627
  return [{
405
628
  kind: "graph.node.create",
406
629
  node: {
407
630
  actions: ["continue"],
408
631
  concurrency: 1,
632
+ input: {
633
+ handle: "value",
634
+ jsonSchema: {},
635
+ nullable: !0,
636
+ value: null
637
+ },
409
638
  inputs: { value: {
410
639
  kind: "value",
411
640
  value: null
@@ -418,7 +647,7 @@ function h(e, t, n) {
418
647
  target: e
419
648
  }];
420
649
  }
421
- function g(e, t, n) {
650
+ function v(e, t, n) {
422
651
  return [{
423
652
  kind: "graph.node.create",
424
653
  node: n,
@@ -426,7 +655,7 @@ function g(e, t, n) {
426
655
  target: e
427
656
  }];
428
657
  }
429
- function _(e, t, n, r) {
658
+ function y(e, t, n, r) {
430
659
  let i = r.name ?? n.displayName, a = n.type == "poll" ? {
431
660
  bindingId: t.bindingId,
432
661
  config: r.config,
@@ -459,8 +688,8 @@ function _(e, t, n, r) {
459
688
  target: e
460
689
  }];
461
690
  }
462
- function v(e, t, n) {
463
- let r = D(e, t)?.nodes;
691
+ function b(e, t, n) {
692
+ let r = k(e, t)?.nodes;
464
693
  if (r == null) return [];
465
694
  let i = new Set(n), a = n.flatMap((e) => {
466
695
  let n = r[e];
@@ -473,7 +702,7 @@ function v(e, t, n) {
473
702
  moduleId: n.task.moduleId
474
703
  }] : []];
475
704
  });
476
- if (t.kind == "subflow") return S(e, a);
705
+ if (t.kind == "subflow") return w(e, a);
477
706
  let o = new Set(n.flatMap((e) => {
478
707
  let t = r[e];
479
708
  return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
@@ -482,72 +711,94 @@ function v(e, t, n) {
482
711
  bindingId: t,
483
712
  kind: "binding.delete"
484
713
  });
485
- return S(e, a);
486
- }
487
- function y(e, t, n, r) {
488
- let i = D(e, t)?.nodes[n];
489
- if (i == null || !("inputs" in i)) return;
490
- let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
491
- return A(t, n, {
492
- ...c,
493
- ...r
494
- });
714
+ return w(e, a);
495
715
  }
496
- function b(e, t, n, r) {
497
- let i = D(e, t)?.nodes[n];
716
+ function x(e, t, n, r) {
717
+ let i = k(e, t)?.nodes[n];
498
718
  if (i == null || !("inputs" in i)) return;
499
- let a = { ...i.inputs };
500
- for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
501
- kind: "value",
502
- value: t
503
- };
504
- return S(e, A(t, n, {
505
- ...i,
506
- inputs: a
507
- }));
719
+ let a = [];
720
+ return i.concurrency != r.concurrency && a.push({
721
+ before: i.concurrency,
722
+ field: "concurrency",
723
+ kind: "graph.node.field.set",
724
+ nodeId: n,
725
+ target: t,
726
+ value: r.concurrency
727
+ }), i.name != r.name && a.push({
728
+ before: i.name,
729
+ field: "name",
730
+ kind: "graph.node.field.set",
731
+ nodeId: n,
732
+ target: t,
733
+ value: r.name
734
+ }), i.timeoutMs != r.timeoutMs && a.push({
735
+ before: i.timeoutMs,
736
+ field: "timeoutMs",
737
+ kind: "graph.node.field.set",
738
+ nodeId: n,
739
+ target: t,
740
+ value: r.timeoutMs
741
+ }), a;
742
+ }
743
+ function S(e, t, n, r) {
744
+ let a = k(e, t)?.nodes[n];
745
+ if (a == null || !("inputs" in a)) return;
746
+ let o = [];
747
+ for (let [e, s] of Object.entries(r)) {
748
+ let r = a.inputs[e], c = s === void 0 ? void 0 : {
749
+ kind: "value",
750
+ value: s
751
+ };
752
+ i(r, c) || o.push({
753
+ before: r,
754
+ handle: e,
755
+ kind: "graph.node.input.set",
756
+ nodeId: n,
757
+ target: t,
758
+ value: c
759
+ });
760
+ }
761
+ return w(e, o);
508
762
  }
509
- function x(e, t, n, r, i, a) {
510
- let o = D(e, t)?.nodes[n];
763
+ function C(e, t, n, r, i, a) {
764
+ let o = k(e, t)?.nodes[n];
511
765
  if (o == null || !("inputs" in o)) return;
512
- 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 = C(e.document);
513
- if (c != null && l?.kind == "variable" && (u.get(c) ?? 0) == 1) return l.target == i ? [] : [{
766
+ 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);
767
+ return c != null && l?.kind == "variable" && (u.get(c) ?? 0) == 1 ? l.target == i ? [] : [{
768
+ before: l.target,
769
+ bindingId: c,
770
+ kind: "binding.target.set",
771
+ value: i
772
+ }] : [{
514
773
  binding: {
515
774
  kind: "variable",
516
775
  target: i
517
776
  },
518
- bindingId: c,
519
- kind: "binding.replace"
520
- }];
521
- let d = {
522
- ...o.inputs,
523
- [r]: {
777
+ bindingId: a,
778
+ kind: "binding.create"
779
+ }, ...w(e, [{
780
+ before: s,
781
+ handle: r,
782
+ kind: "graph.node.input.set",
783
+ nodeId: n,
784
+ target: t,
785
+ value: {
524
786
  kind: "sources",
525
787
  sources: [{
526
788
  bindingId: a,
527
789
  kind: "binding"
528
790
  }]
529
791
  }
530
- };
531
- return [{
532
- binding: {
533
- kind: "variable",
534
- target: i
535
- },
536
- bindingId: a,
537
- kind: "binding.create"
538
- }, ...S(e, A(t, n, {
539
- ...o,
540
- inputs: d
541
- }))];
792
+ }])];
542
793
  }
543
- function S(e, t) {
544
- let n = C(e.document), r = c(e, t), i = C(r.document);
794
+ function w(e, t) {
795
+ let n = T(e.document), r = u(e, t), i = T(r.document);
545
796
  return [...t, ...[...n.keys()].flatMap((e) => i.has(e) || r.document.bindings[e]?.kind != "variable" ? [] : [{
546
797
  bindingId: e,
547
798
  kind: "binding.delete"
548
799
  }])];
549
800
  }
550
- function C(e) {
801
+ function T(e) {
551
802
  let t = /* @__PURE__ */ new Map(), n = (e) => {
552
803
  t.set(e, (t.get(e) ?? 0) + 1);
553
804
  };
@@ -558,70 +809,90 @@ function C(e) {
558
809
  }
559
810
  return t;
560
811
  }
561
- function w(e, t, n) {
812
+ function E(e, t, n) {
562
813
  let r = e.document.tasks[t];
563
- if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
564
- kind: "task.replace",
565
- task: {
566
- ...r,
567
- executor: {
568
- ...r.executor,
569
- connectionId: n
570
- }
571
- },
572
- taskId: t
814
+ if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return r.executor.connectionId == n ? [] : [{
815
+ before: r.executor.connectionId,
816
+ kind: "task.connector.connection.set",
817
+ taskId: t,
818
+ value: n
573
819
  }];
574
820
  }
575
- function T(e, t, n, r) {
576
- let i = e.document.graph.nodes[n];
577
- if (i == null) return;
578
- let a = {
579
- ...r.description == null ? {} : { description: r.description },
580
- icon: i.icon,
581
- name: r.name
582
- }, o;
583
- switch (r.kind) {
584
- case "webhook":
585
- if (i.kind != "webhook") return;
586
- o = Object.keys(r.options).length == 0 ? {
587
- ...a,
588
- inputsDef: r.inputs,
589
- kind: "webhook"
590
- } : {
591
- ...a,
821
+ function D(e, t, n, r) {
822
+ let a = e.document.graph.nodes[n];
823
+ if (a == null) return;
824
+ let o = [];
825
+ switch (a.name != r.name && o.push({
826
+ before: a.name,
827
+ field: "name",
828
+ kind: "graph.node.field.set",
829
+ nodeId: n,
830
+ target: t,
831
+ value: r.name
832
+ }), a.description != r.description && o.push({
833
+ before: a.description,
834
+ field: "description",
835
+ kind: "graph.node.field.set",
836
+ nodeId: n,
837
+ target: t,
838
+ value: r.description
839
+ }), r.kind) {
840
+ case "webhook": {
841
+ if (a.kind != "webhook") return;
842
+ let e = {
592
843
  inputsDef: r.inputs,
593
- kind: "webhook",
594
- options: r.options
844
+ options: Object.keys(r.options).length == 0 ? void 0 : r.options
845
+ }, s = {
846
+ inputsDef: a.inputsDef,
847
+ options: a.options
595
848
  };
849
+ i(s, e) || o.push({
850
+ before: s,
851
+ kind: "graph.node.webhook.set",
852
+ nodeId: n,
853
+ target: t,
854
+ value: e
855
+ });
596
856
  break;
857
+ }
597
858
  case "cron":
598
- if (i.kind != "cron") return;
599
- o = {
600
- ...a,
601
- cronTimes: r.schedule,
602
- kind: "cron"
603
- };
859
+ if (a.kind != "cron") return;
860
+ i(a.cronTimes, r.schedule) || o.push({
861
+ before: a.cronTimes,
862
+ kind: "graph.trigger.schedule.set",
863
+ nodeId: n,
864
+ value: r.schedule
865
+ });
604
866
  break;
605
867
  case "poll":
606
- if (i.kind != "poll") return;
607
- o = {
608
- ...i,
609
- ...a,
610
- config: r.config,
611
- pollTimes: r.schedule
612
- };
868
+ if (a.kind != "poll") return;
869
+ for (let e of /* @__PURE__ */ new Set([...Object.keys(a.config), ...Object.keys(r.config)])) i(a.config[e], r.config[e]) || o.push({
870
+ before: a.config[e],
871
+ kind: "graph.trigger.config.set",
872
+ name: e,
873
+ nodeId: n,
874
+ value: r.config[e]
875
+ });
876
+ i(a.pollTimes, r.schedule) || o.push({
877
+ before: a.pollTimes,
878
+ kind: "graph.trigger.schedule.set",
879
+ nodeId: n,
880
+ value: r.schedule
881
+ });
613
882
  break;
614
883
  case "integration":
615
- if (i.kind != "integration") return;
616
- o = {
617
- ...i,
618
- ...a,
619
- config: r.config
620
- };
884
+ if (a.kind != "integration") return;
885
+ for (let e of /* @__PURE__ */ new Set([...Object.keys(a.config), ...Object.keys(r.config)])) i(a.config[e], r.config[e]) || o.push({
886
+ before: a.config[e],
887
+ kind: "graph.trigger.config.set",
888
+ name: e,
889
+ nodeId: n,
890
+ value: r.config[e]
891
+ });
621
892
  }
622
- return A(t, n, o);
893
+ return o;
623
894
  }
624
- function E(e, t, n, r) {
895
+ function O(e, t, n, r) {
625
896
  let i = e.document.graph.nodes[n];
626
897
  if (i == null || i.kind != "poll" && i.kind != "integration") return;
627
898
  let a = e.document.bindings[i.bindingId];
@@ -634,68 +905,60 @@ function E(e, t, n, r) {
634
905
  kind: "binding.create"
635
906
  }];
636
907
  if (a.kind == "connection") return a.target == r ? [] : [{
637
- binding: {
638
- kind: "connection",
639
- target: r
640
- },
908
+ before: a.target,
641
909
  bindingId: i.bindingId,
642
- kind: "binding.replace"
910
+ kind: "binding.target.set",
911
+ value: r
643
912
  }];
644
913
  }
645
- function D(e, t) {
914
+ function k(e, t) {
646
915
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
647
916
  }
648
- function O(e) {
917
+ function A(e) {
649
918
  return Object.fromEntries(e.flatMap((e) => "handle" in e && Object.hasOwn(e, "value") ? [[e.handle, {
650
919
  kind: "value",
651
920
  value: e.value
652
921
  }]] : []));
653
922
  }
654
- function k(e, t, n) {
923
+ function j(e, t, n) {
655
924
  return e != null && Object.hasOwn(e, t) ? e[t] : n;
656
925
  }
657
- function A(e, t, n) {
658
- return [{
659
- kind: "graph.node.replace",
660
- node: n,
661
- nodeId: t,
662
- target: e
663
- }];
664
- }
665
926
  //#endregion
666
927
  //#region src/flow/common/edgeChanges.ts
667
- function j(e, t, n) {
928
+ function M(e, t, n) {
668
929
  let r = {
669
930
  source: n.source,
670
931
  sourceHandle: n.sourceHandle,
671
932
  target: n.target,
672
933
  targetHandle: n.targetHandle
673
- }, i = N(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
674
- return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : S(e, [{
934
+ }, i = P(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
935
+ return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : w(e, [{
936
+ before: a,
675
937
  edge: r,
676
938
  kind: "graph.edge.connect",
677
939
  target: t
678
940
  }]);
679
941
  }
680
- function M(e, t, n) {
942
+ function N(e, t, n) {
681
943
  let r = {
682
944
  source: n.source,
683
945
  sourceHandle: n.sourceHandle,
684
946
  target: n.target,
685
947
  targetHandle: n.targetHandle
686
- }, i = N(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
948
+ }, i = P(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
687
949
  return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
950
+ before: a,
688
951
  edge: r,
689
952
  kind: "graph.edge.disconnect",
690
953
  target: t
691
954
  }];
692
955
  }
693
- function N(e, t) {
956
+ function P(e, t) {
694
957
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
695
958
  }
696
959
  //#endregion
697
960
  //#region src/flow/common/moduleChanges.ts
698
- async function P(e) {
961
+ async function F(e) {
699
962
  try {
700
963
  let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
701
964
  errorRecovery: !0,
@@ -711,21 +974,24 @@ async function P(e) {
711
974
  return [];
712
975
  }
713
976
  }
714
- function F(e, t, n) {
977
+ function I(e, t, n, r, i) {
715
978
  return [{
716
- imports: n,
979
+ beforeImports: n,
980
+ beforeSource: t,
981
+ imports: i,
717
982
  kind: "module.source.replace",
718
983
  moduleId: e,
719
- source: t
984
+ source: r
720
985
  }];
721
986
  }
722
- function I(e, t) {
987
+ function L(e, t, n) {
723
988
  return [{
989
+ before: t,
724
990
  kind: "module.rename",
725
991
  moduleId: e,
726
- name: t
992
+ name: n
727
993
  }];
728
994
  }
729
- var L = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
995
+ var R = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
730
996
  //#endregion
731
- export { S as cleanVariableBindings, j as connect, L as createAuthoringId, g as createBuiltinTrigger, u as createCodeTask, p as createCondition, f as createLlmTask, d as createManagedTask, _ as createProviderTrigger, m as createValue, h as createWait, v as deleteNodes, M as disconnect, P as moduleImports, I as renameModule, F as replaceModuleSource, w as setConnectorConnection, b as setInputValues, x as setInputVariable, E as setTriggerConnection, y as updateSettings, T as updateTrigger };
997
+ 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 };