@oomol-lab/open-flow 0.1.0-beta.4 → 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 (34) 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-xWDFFpGd.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 +469 -209
  15. package/dist/browser/flow-change.d.ts +96 -8
  16. package/dist/browser/flow-change.js +319 -96
  17. package/dist/browser/{flowChanges-Bs-ZcJV8.js → flowChanges-CeMiiZIO.js} +1578 -1541
  18. package/dist/browser/{flowRunInputEditorStore-BYa8zFLC.js → flowRunInputEditorStore-DDidwd8h.js} +9 -1
  19. package/dist/browser/{flowWorkspace-BewofPeU.js → flowWorkspace-VnS8nLMT.js} +9354 -9349
  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-Bj2HDFRd.js} +255 -256
  23. package/dist/browser/{waitNotificationInputs-DtrPBwA1.js → waitNotificationInputs-ClCAEIAM.js} +2 -2
  24. package/dist/browser/workbench.css +1 -1
  25. package/dist/browser/workbench.js +547 -611
  26. package/dist/browser/{workbenchSelect-CX8KtT7L.js → workbenchSelect-Cf1zlVm9.js} +398 -398
  27. package/dist/common/control-api-conformance.js +21 -19
  28. package/dist/common/control-api.d.ts +4 -11
  29. package/dist/common/control-api.js +6 -18
  30. package/package.json +1 -1
  31. package/dist/browser/createResourceDialog-4YQKl8lG.js +0 -505
  32. package/dist/browser/dist-BpopSHwP.js +0 -1543
  33. package/dist/browser/dist-CUSrALSX.js +0 -1620
  34. 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;
41
+ }
42
+ //#endregion
43
+ //#region src/flow/common/change.ts
44
+ var a = class extends Error {};
45
+ function o() {
46
+ throw new a();
27
47
  }
28
- function a(e, t) {
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
+ }
166
237
  } }));
167
238
  break;
168
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
253
+ } }));
254
+ break;
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,7 +623,7 @@ 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: {
@@ -418,7 +641,7 @@ function h(e, t, n) {
418
641
  target: e
419
642
  }];
420
643
  }
421
- function g(e, t, n) {
644
+ function v(e, t, n) {
422
645
  return [{
423
646
  kind: "graph.node.create",
424
647
  node: n,
@@ -426,7 +649,7 @@ function g(e, t, n) {
426
649
  target: e
427
650
  }];
428
651
  }
429
- function _(e, t, n, r) {
652
+ function y(e, t, n, r) {
430
653
  let i = r.name ?? n.displayName, a = n.type == "poll" ? {
431
654
  bindingId: t.bindingId,
432
655
  config: r.config,
@@ -459,8 +682,8 @@ function _(e, t, n, r) {
459
682
  target: e
460
683
  }];
461
684
  }
462
- function v(e, t, n) {
463
- let r = D(e, t)?.nodes;
685
+ function b(e, t, n) {
686
+ let r = k(e, t)?.nodes;
464
687
  if (r == null) return [];
465
688
  let i = new Set(n), a = n.flatMap((e) => {
466
689
  let n = r[e];
@@ -473,7 +696,7 @@ function v(e, t, n) {
473
696
  moduleId: n.task.moduleId
474
697
  }] : []];
475
698
  });
476
- if (t.kind == "subflow") return S(e, a);
699
+ if (t.kind == "subflow") return w(e, a);
477
700
  let o = new Set(n.flatMap((e) => {
478
701
  let t = r[e];
479
702
  return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
@@ -482,72 +705,94 @@ function v(e, t, n) {
482
705
  bindingId: t,
483
706
  kind: "binding.delete"
484
707
  });
485
- return S(e, a);
708
+ return w(e, a);
486
709
  }
487
- function y(e, t, n, r) {
488
- let i = D(e, t)?.nodes[n];
710
+ function x(e, t, n, r) {
711
+ let i = k(e, t)?.nodes[n];
489
712
  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
- });
495
- }
496
- function b(e, t, n, r) {
497
- let i = D(e, t)?.nodes[n];
498
- 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
- }));
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;
736
+ }
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);
508
756
  }
509
- function x(e, t, n, r, i, a) {
510
- let o = D(e, t)?.nodes[n];
757
+ function C(e, t, n, r, i, a) {
758
+ let o = k(e, t)?.nodes[n];
511
759
  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 ? [] : [{
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
+ }] : [{
514
767
  binding: {
515
768
  kind: "variable",
516
769
  target: i
517
770
  },
518
- bindingId: c,
519
- kind: "binding.replace"
520
- }];
521
- let d = {
522
- ...o.inputs,
523
- [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: {
524
780
  kind: "sources",
525
781
  sources: [{
526
782
  bindingId: a,
527
783
  kind: "binding"
528
784
  }]
529
785
  }
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
- }))];
786
+ }])];
542
787
  }
543
- function S(e, t) {
544
- let n = C(e.document), r = c(e, t), i = C(r.document);
788
+ function w(e, t) {
789
+ let n = T(e.document), r = u(e, t), i = T(r.document);
545
790
  return [...t, ...[...n.keys()].flatMap((e) => i.has(e) || r.document.bindings[e]?.kind != "variable" ? [] : [{
546
791
  bindingId: e,
547
792
  kind: "binding.delete"
548
793
  }])];
549
794
  }
550
- function C(e) {
795
+ function T(e) {
551
796
  let t = /* @__PURE__ */ new Map(), n = (e) => {
552
797
  t.set(e, (t.get(e) ?? 0) + 1);
553
798
  };
@@ -558,70 +803,90 @@ function C(e) {
558
803
  }
559
804
  return t;
560
805
  }
561
- function w(e, t, n) {
806
+ function E(e, t, n) {
562
807
  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
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
573
813
  }];
574
814
  }
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,
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 = {
588
837
  inputsDef: r.inputs,
589
- kind: "webhook"
590
- } : {
591
- ...a,
592
- inputsDef: r.inputs,
593
- kind: "webhook",
594
- 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
595
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
+ });
596
850
  break;
851
+ }
597
852
  case "cron":
598
- if (i.kind != "cron") return;
599
- o = {
600
- ...a,
601
- cronTimes: r.schedule,
602
- kind: "cron"
603
- };
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
+ });
604
860
  break;
605
861
  case "poll":
606
- if (i.kind != "poll") return;
607
- o = {
608
- ...i,
609
- ...a,
610
- config: r.config,
611
- pollTimes: r.schedule
612
- };
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
+ });
613
876
  break;
614
877
  case "integration":
615
- if (i.kind != "integration") return;
616
- o = {
617
- ...i,
618
- ...a,
619
- config: r.config
620
- };
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
+ });
621
886
  }
622
- return A(t, n, o);
887
+ return o;
623
888
  }
624
- function E(e, t, n, r) {
889
+ function O(e, t, n, r) {
625
890
  let i = e.document.graph.nodes[n];
626
891
  if (i == null || i.kind != "poll" && i.kind != "integration") return;
627
892
  let a = e.document.bindings[i.bindingId];
@@ -634,68 +899,60 @@ function E(e, t, n, r) {
634
899
  kind: "binding.create"
635
900
  }];
636
901
  if (a.kind == "connection") return a.target == r ? [] : [{
637
- binding: {
638
- kind: "connection",
639
- target: r
640
- },
902
+ before: a.target,
641
903
  bindingId: i.bindingId,
642
- kind: "binding.replace"
904
+ kind: "binding.target.set",
905
+ value: r
643
906
  }];
644
907
  }
645
- function D(e, t) {
908
+ function k(e, t) {
646
909
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
647
910
  }
648
- function O(e) {
911
+ function A(e) {
649
912
  return Object.fromEntries(e.flatMap((e) => "handle" in e && Object.hasOwn(e, "value") ? [[e.handle, {
650
913
  kind: "value",
651
914
  value: e.value
652
915
  }]] : []));
653
916
  }
654
- function k(e, t, n) {
917
+ function j(e, t, n) {
655
918
  return e != null && Object.hasOwn(e, t) ? e[t] : n;
656
919
  }
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
920
  //#endregion
666
921
  //#region src/flow/common/edgeChanges.ts
667
- function j(e, t, n) {
922
+ function M(e, t, n) {
668
923
  let r = {
669
924
  source: n.source,
670
925
  sourceHandle: n.sourceHandle,
671
926
  target: n.target,
672
927
  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, [{
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,
675
931
  edge: r,
676
932
  kind: "graph.edge.connect",
677
933
  target: t
678
934
  }]);
679
935
  }
680
- function M(e, t, n) {
936
+ function N(e, t, n) {
681
937
  let r = {
682
938
  source: n.source,
683
939
  sourceHandle: n.sourceHandle,
684
940
  target: n.target,
685
941
  targetHandle: n.targetHandle
686
- }, i = N(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;
687
943
  return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
944
+ before: a,
688
945
  edge: r,
689
946
  kind: "graph.edge.disconnect",
690
947
  target: t
691
948
  }];
692
949
  }
693
- function N(e, t) {
950
+ function P(e, t) {
694
951
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
695
952
  }
696
953
  //#endregion
697
954
  //#region src/flow/common/moduleChanges.ts
698
- async function P(e) {
955
+ async function F(e) {
699
956
  try {
700
957
  let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
701
958
  errorRecovery: !0,
@@ -711,21 +968,24 @@ async function P(e) {
711
968
  return [];
712
969
  }
713
970
  }
714
- function F(e, t, n) {
971
+ function I(e, t, n, r, i) {
715
972
  return [{
716
- imports: n,
973
+ beforeImports: n,
974
+ beforeSource: t,
975
+ imports: i,
717
976
  kind: "module.source.replace",
718
977
  moduleId: e,
719
- source: t
978
+ source: r
720
979
  }];
721
980
  }
722
- function I(e, t) {
981
+ function L(e, t, n) {
723
982
  return [{
983
+ before: t,
724
984
  kind: "module.rename",
725
985
  moduleId: e,
726
- name: t
986
+ name: n
727
987
  }];
728
988
  }
729
- var L = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
989
+ var R = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
730
990
  //#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 };
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 };