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

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 (58) hide show
  1. package/README.md +5 -1
  2. package/dist/browser/createResourceDialog-BkZns-oZ.js +504 -0
  3. package/dist/browser/diagnostics-giPSzyMo.js +9346 -0
  4. package/dist/browser/{dist-DhsGR_K3.js → dist-3Mj8q8Pr.js} +27 -27
  5. package/dist/browser/{dist-n9WmBm5w.js → dist-BKuSVKCC.js} +1 -1
  6. package/dist/browser/{dist-DQVavPcf.js → dist-BMqL-qR5.js} +469 -903
  7. package/dist/browser/{dist-D5mdziGP.js → dist-BN4ZCyOB.js} +9 -9
  8. package/dist/browser/{dist-CVtP-E2c.js → dist-BpopSHwP.js} +1 -1
  9. package/dist/browser/{dist-B0Q2Mn0n.js → dist-CJpzJrLM.js} +191 -191
  10. package/dist/browser/{dist-DXgEYMFx.js → dist-CPuF50D9.js} +196 -196
  11. package/dist/browser/{dist-CUkceEvN.js → dist-CUSrALSX.js} +113 -113
  12. package/dist/browser/dist-CeSZ2xSM.js +444 -0
  13. package/dist/browser/{dist-Bc9TvHYl.js → dist-DUzA0Ukh.js} +20 -20
  14. package/dist/browser/{dist-DWzdGVm9.js → dist-DWADUsVB.js} +74 -74
  15. package/dist/browser/{esm-YIGXG-Js.js → esm-B_PbUobB.js} +13 -13
  16. package/dist/browser/flow-authoring-node.d.ts +4 -2
  17. package/dist/browser/flow-authoring.d.ts +2 -1
  18. package/dist/browser/flow-authoring.js +400 -100
  19. package/dist/browser/flow-change.d.ts +9 -4
  20. package/dist/browser/flow-change.js +49 -46
  21. package/dist/browser/{flowRunInputEditorStore-DXOyyY7o.js → flowRunInputEditorStore-BeyUSWpO.js} +1644 -908
  22. package/dist/browser/{flowWorkspace-D7-rBA1-.js → flowWorkspace-DAMLVMcF.js} +18416 -16444
  23. package/dist/browser/getPseudoElementBounds-ESJExRFX.js +7642 -0
  24. package/dist/browser/languages-DgJehE1g.js +62 -0
  25. package/dist/browser/lib-C5Ipyfps.js +7856 -0
  26. package/dist/browser/licenses.md +119 -1
  27. package/dist/browser/main-DmjVyuWr.js +76 -0
  28. package/dist/browser/{markdownContent-ColGUxHy.js → markdownContent-DdlIRN3_.js} +4811 -4795
  29. package/dist/browser/theme.css +63 -0
  30. package/dist/browser/theme.css.d.ts +1 -0
  31. package/dist/browser/typeScriptSession-mPCiA9sV.js +2579 -0
  32. package/dist/browser/workbench-contract.d.ts +2 -1
  33. package/dist/browser/workbench.css +1 -1
  34. package/dist/browser/workbench.d.ts +46 -1
  35. package/dist/browser/workbench.js +1132 -1474
  36. package/dist/browser/workbenchSelect-B2s1HV-Y.js +1374 -0
  37. package/dist/common/connector-action.d.ts +6 -0
  38. package/dist/common/connector-action.js +37 -29
  39. package/dist/common/control-api-conformance.js +80 -29
  40. package/dist/common/control-api-errors.d.ts +24 -0
  41. package/dist/common/control-api.d.ts +54 -7
  42. package/dist/common/control-api.js +226 -95
  43. package/dist/common/flow-encoding.d.ts +2 -2
  44. package/dist/common/flow-encoding.js +4 -1
  45. package/dist/common/flow-semantics.d.ts +3 -0
  46. package/dist/common/flow-semantics.js +939 -851
  47. package/dist/common/integration-trigger.d.ts +1 -0
  48. package/dist/common/licenses.md +1 -25
  49. package/dist/common/localization.d.ts +21 -0
  50. package/dist/common/localization.js +62 -0
  51. package/dist/common/provider-triggers.js +4 -1
  52. package/dist/common/scheduler.d.ts +5 -5
  53. package/dist/common/scheduler.js +250 -236
  54. package/package.json +10 -1
  55. package/dist/browser/addNodeOptions-DRndy4EK.js +0 -6910
  56. package/dist/browser/createLucideIcon-CqjqCezK.js +0 -5537
  57. package/dist/browser/createResourceDialog-A64dDFCG.js +0 -467
  58. package/dist/browser/field-CKGQHCIi.js +0 -312
@@ -1,72 +1,244 @@
1
- //#region src/flow/common/edgeChanges.ts
2
- function e(e, t, r) {
3
- let i = {
4
- source: r.source,
5
- sourceHandle: r.sourceHandle,
6
- target: r.target,
7
- targetHandle: r.targetHandle
8
- }, a = n(e, t)?.nodes[r.target], o = a != null && "inputs" in a ? a.inputs[r.targetHandle] : void 0;
9
- return o?.kind == "sources" && o.sources.some((e) => e.kind == "node" && e.nodeId == r.source && e.output == r.sourceHandle) ? [] : [{
10
- edge: i,
11
- kind: "graph.edge.connect",
12
- target: t
13
- }];
14
- }
15
- function t(e, t, r) {
16
- let i = {
17
- source: r.source,
18
- sourceHandle: r.sourceHandle,
19
- target: r.target,
20
- targetHandle: r.targetHandle
21
- }, a = n(e, t)?.nodes[r.target], o = a != null && "inputs" in a ? a.inputs[r.targetHandle] : void 0;
22
- return o?.kind != "sources" || !o.sources.some((e) => e.kind == "node" && e.nodeId == r.source && e.output == r.sourceHandle) ? [] : [{
23
- edge: i,
24
- kind: "graph.edge.disconnect",
25
- target: t
26
- }];
1
+ //#region ../../node_modules/.bun/nanoid@6.0.1/node_modules/nanoid/index.browser.js
2
+ var e = (e) => crypto.getRandomValues(new Uint8Array(e)), t = (e, t, n) => {
3
+ let r = 256 - 256 % e.length;
4
+ if (r === 256) {
5
+ let r = e.length - 1;
6
+ return (i = t) => {
7
+ if (!i) return "";
8
+ let a = "";
9
+ for (;;) {
10
+ let t = n(i), o = i;
11
+ for (; o--;) if (a += e[t[o] & r], a.length >= i) return a;
12
+ }
13
+ };
14
+ }
15
+ let i = Math.ceil(409.6 * t / r);
16
+ return (a = t) => {
17
+ if (!a) return "";
18
+ let o = "";
19
+ for (;;) {
20
+ let t = n(i), s = i;
21
+ for (; s--;) if (t[s] < r && (o += e[t[s] % e.length], o.length >= a)) return o;
22
+ }
23
+ };
24
+ }, n = (n, r = 21) => t(n, r | 0, e), r = class extends Error {};
25
+ function i() {
26
+ throw new r();
27
27
  }
28
- function n(e, t) {
29
- return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
28
+ function a(e, t) {
29
+ if (t.kind == "flow") return e.graph;
30
+ let n = e.subflows[t.id];
31
+ return n ?? i(), n.graph;
30
32
  }
31
- //#endregion
32
- //#region src/flow/common/moduleChanges.ts
33
- async function r(e) {
34
- try {
35
- let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
36
- errorRecovery: !0,
37
- sourceType: "module"
38
- }).program, r = /* @__PURE__ */ new Set();
39
- for (let e of n.body) {
40
- if (e.type != "ImportDeclaration") continue;
41
- let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
42
- t?.[1] != null && r.add(t[1]);
33
+ function o(e, t, n) {
34
+ if (t.kind == "flow") return {
35
+ ...e,
36
+ graph: n
37
+ };
38
+ let r = e.subflows[t.id];
39
+ return r ?? i(), {
40
+ ...e,
41
+ subflows: {
42
+ ...e.subflows,
43
+ [t.id]: {
44
+ ...r,
45
+ graph: n
46
+ }
43
47
  }
44
- return [...r].toSorted();
45
- } catch {
46
- return [];
47
- }
48
+ };
48
49
  }
49
- function i(e, t, n) {
50
- return [{
51
- imports: n,
52
- kind: "module.source.replace",
53
- moduleId: e,
54
- source: t
55
- }];
50
+ function s(e, t) {
51
+ if (!("inputs" in e)) return e;
52
+ let n = { ...e.inputs };
53
+ for (let [e, r] of Object.entries(n)) {
54
+ if (r.kind != "sources") continue;
55
+ let i = r.sources.filter((e) => e.kind != "node" || !t.has(e.nodeId));
56
+ i.length == 0 ? delete n[e] : n[e] = {
57
+ kind: "sources",
58
+ sources: i
59
+ };
60
+ }
61
+ return {
62
+ ...e,
63
+ inputs: n
64
+ };
56
65
  }
57
- function a(e, t) {
58
- return [{
59
- kind: "module.rename",
60
- moduleId: e,
61
- name: t
62
- }];
66
+ function c(e, t) {
67
+ let n = { ...e.document }, r = { ...e.modules };
68
+ for (let e of t) switch (e.kind) {
69
+ 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 = {
77
+ ...n.bindings,
78
+ [e.bindingId]: e.binding
79
+ };
80
+ break;
81
+ case "binding.delete": {
82
+ n.bindings[e.bindingId] ?? i();
83
+ let t = { ...n.bindings };
84
+ delete t[e.bindingId], n.bindings = t;
85
+ break;
86
+ }
87
+ case "graph.edge.connect": {
88
+ let t = a(n, e.target);
89
+ t.nodes[e.edge.source] ?? i();
90
+ let r = t.nodes[e.edge.target];
91
+ (r == null || !("inputs" in r)) && i();
92
+ let s = r.inputs[e.edge.targetHandle], c = {
93
+ kind: "node",
94
+ nodeId: e.edge.source,
95
+ 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 = {
99
+ ...r,
100
+ inputs: {
101
+ ...r.inputs,
102
+ [e.edge.targetHandle]: {
103
+ kind: "sources",
104
+ sources: [...l, c]
105
+ }
106
+ }
107
+ };
108
+ Object.assign(n, o(n, e.target, { nodes: {
109
+ ...t.nodes,
110
+ [e.edge.target]: u
111
+ } }));
112
+ break;
113
+ }
114
+ 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] = {
123
+ kind: "sources",
124
+ sources: c
125
+ }, Object.assign(n, o(n, e.target, { nodes: {
126
+ ...t.nodes,
127
+ [e.edge.target]: {
128
+ ...r,
129
+ inputs: l
130
+ }
131
+ } }));
132
+ break;
133
+ }
134
+ 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: {
137
+ ...t.nodes,
138
+ [e.nodeId]: e.node
139
+ } }));
140
+ break;
141
+ }
142
+ 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") {
147
+ let t = n.subflows[e.target.id], i = t.outputs.map((e) => ({
148
+ ...e,
149
+ sources: e.sources.filter((e) => e.kind != "node" || !r.has(e.nodeId))
150
+ }));
151
+ n.subflows = {
152
+ ...n.subflows,
153
+ [e.target.id]: {
154
+ ...t,
155
+ outputs: i
156
+ }
157
+ };
158
+ }
159
+ break;
160
+ }
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: {
164
+ ...t.nodes,
165
+ [e.nodeId]: e.node
166
+ } }));
167
+ break;
168
+ }
169
+ case "module.create":
170
+ r[e.moduleId] != null && i(), r[e.moduleId] = e.module;
171
+ break;
172
+ case "module.delete":
173
+ r[e.moduleId] ?? i(), delete r[e.moduleId];
174
+ break;
175
+ case "module.rename": {
176
+ let t = r[e.moduleId];
177
+ t ?? i(), r[e.moduleId] = {
178
+ ...t,
179
+ name: e.name
180
+ };
181
+ break;
182
+ }
183
+ case "module.source.replace": {
184
+ let t = r[e.moduleId];
185
+ t ?? i(), r[e.moduleId] = {
186
+ ...t,
187
+ imports: e.imports,
188
+ source: e.source
189
+ };
190
+ break;
191
+ }
192
+ case "subflow.create":
193
+ n.subflows[e.subflowId] != null && i(), n.subflows = {
194
+ ...n.subflows,
195
+ [e.subflowId]: e.subflow
196
+ };
197
+ break;
198
+ case "subflow.definition.replace": {
199
+ let t = n.subflows[e.subflowId];
200
+ t ?? i(), n.subflows = {
201
+ ...n.subflows,
202
+ [e.subflowId]: {
203
+ ...e.definition,
204
+ graph: t.graph
205
+ }
206
+ };
207
+ break;
208
+ }
209
+ case "subflow.delete": {
210
+ n.subflows[e.subflowId] ?? i();
211
+ let t = { ...n.subflows };
212
+ delete t[e.subflowId], n.subflows = t;
213
+ break;
214
+ }
215
+ case "task.create":
216
+ n.tasks[e.taskId] != null && i(), n.tasks = {
217
+ ...n.tasks,
218
+ [e.taskId]: e.task
219
+ };
220
+ break;
221
+ case "task.delete": {
222
+ n.tasks[e.taskId] ?? i();
223
+ let t = { ...n.tasks };
224
+ delete t[e.taskId], n.tasks = t;
225
+ break;
226
+ }
227
+ case "task.replace": n.tasks[e.taskId] ?? i(), n.tasks = {
228
+ ...n.tasks,
229
+ [e.taskId]: e.task
230
+ };
231
+ }
232
+ return {
233
+ document: n,
234
+ modelVersion: e.modelVersion,
235
+ modules: r
236
+ };
63
237
  }
64
238
  //#endregion
65
239
  //#region src/flow/common/nodeChanges.ts
66
- function o(e, t, n, r = {
67
- imports: [],
68
- source: "export default function run(input) {\n return { result: input.value }\n}\n"
69
- }, i = {
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 = {
70
242
  inputs: [{
71
243
  handle: "value",
72
244
  jsonSchema: {},
@@ -82,7 +254,10 @@ function o(e, t, n, r = {
82
254
  return [{
83
255
  kind: "module.create",
84
256
  module: {
85
- ...r,
257
+ ...r ?? {
258
+ imports: [],
259
+ source: l
260
+ },
86
261
  name: n
87
262
  },
88
263
  moduleId: t.moduleId
@@ -90,7 +265,7 @@ function o(e, t, n, r = {
90
265
  kind: "graph.node.create",
91
266
  node: {
92
267
  concurrency: 1,
93
- inputs: b(i.inputs),
268
+ inputs: D(i.inputs),
94
269
  kind: "task",
95
270
  name: n,
96
271
  task: {
@@ -104,7 +279,7 @@ function o(e, t, n, r = {
104
279
  target: e
105
280
  }];
106
281
  }
107
- function s(e, t, n) {
282
+ function d(e, t, n) {
108
283
  return [{
109
284
  kind: "task.create",
110
285
  task: n,
@@ -113,7 +288,7 @@ function s(e, t, n) {
113
288
  kind: "graph.node.create",
114
289
  node: {
115
290
  concurrency: 1,
116
- inputs: b(n.inputs),
291
+ inputs: D(n.inputs),
117
292
  kind: "task",
118
293
  name: n.name,
119
294
  taskId: t.taskId
@@ -122,9 +297,9 @@ function s(e, t, n) {
122
297
  target: e
123
298
  }];
124
299
  }
125
- function c(e, t, n, r, i, a = {}) {
300
+ function f(e, t, n, r, i, a = {}) {
126
301
  let o = a.inputs ?? {};
127
- return s(e, t, {
302
+ return d(e, t, {
128
303
  executor: {
129
304
  kind: "llm",
130
305
  mode: r
@@ -137,13 +312,13 @@ function c(e, t, n, r, i, a = {}) {
137
312
  type: "array"
138
313
  },
139
314
  nullable: !0,
140
- value: x(o, "messages", null)
315
+ value: O(o, "messages", null)
141
316
  },
142
317
  {
143
318
  handle: "input",
144
319
  jsonSchema: { type: "string" },
145
320
  nullable: !1,
146
- value: x(o, "input", "Alex")
321
+ value: O(o, "input", "Alex")
147
322
  },
148
323
  {
149
324
  handle: "template",
@@ -153,7 +328,7 @@ function c(e, t, n, r, i, a = {}) {
153
328
  type: "array"
154
329
  },
155
330
  nullable: !1,
156
- value: x(o, "template", [{
331
+ value: O(o, "template", [{
157
332
  content: "Hello, I'm {{input}}",
158
333
  role: "user"
159
334
  }])
@@ -162,7 +337,7 @@ function c(e, t, n, r, i, a = {}) {
162
337
  handle: "model",
163
338
  jsonSchema: { type: "object" },
164
339
  nullable: !1,
165
- value: x(o, "model", { model: "deepseek-v4-flash" })
340
+ value: O(o, "model", { model: "deepseek-v4-flash" })
166
341
  }
167
342
  ],
168
343
  name: n,
@@ -175,7 +350,7 @@ function c(e, t, n, r, i, a = {}) {
175
350
  }]
176
351
  });
177
352
  }
178
- function l(e, t, n) {
353
+ function p(e, t, n) {
179
354
  return [{
180
355
  kind: "graph.node.create",
181
356
  node: {
@@ -206,7 +381,7 @@ function l(e, t, n) {
206
381
  target: e
207
382
  }];
208
383
  }
209
- function u(e, t, n) {
384
+ function m(e, t, n) {
210
385
  return [{
211
386
  kind: "graph.node.create",
212
387
  node: {
@@ -225,7 +400,7 @@ function u(e, t, n) {
225
400
  target: e
226
401
  }];
227
402
  }
228
- function d(e, t, n) {
403
+ function h(e, t, n) {
229
404
  return [{
230
405
  kind: "graph.node.create",
231
406
  node: n,
@@ -233,7 +408,7 @@ function d(e, t, n) {
233
408
  target: e
234
409
  }];
235
410
  }
236
- function f(e, t, n, r) {
411
+ function g(e, t, n, r) {
237
412
  let i = r.name ?? n.displayName, a = n.type == "poll" ? {
238
413
  bindingId: t.bindingId,
239
414
  config: r.config,
@@ -252,22 +427,22 @@ function f(e, t, n, r) {
252
427
  kind: "integration",
253
428
  name: i
254
429
  };
255
- return [{
430
+ return [...r.connectionId == null ? [] : [{
256
431
  binding: {
257
432
  kind: "connection",
258
433
  target: r.connectionId
259
434
  },
260
435
  bindingId: t.bindingId,
261
436
  kind: "binding.create"
262
- }, {
437
+ }], {
263
438
  kind: "graph.node.create",
264
439
  node: a,
265
440
  nodeId: t.nodeId,
266
441
  target: e
267
442
  }];
268
443
  }
269
- function p(e, t, n) {
270
- let r = y(e, t)?.nodes;
444
+ function _(e, t, n) {
445
+ let r = E(e, t)?.nodes;
271
446
  if (r == null) return [];
272
447
  let i = new Set(n), a = n.flatMap((e) => {
273
448
  let n = r[e];
@@ -280,40 +455,90 @@ function p(e, t, n) {
280
455
  moduleId: n.task.moduleId
281
456
  }] : []];
282
457
  });
283
- if (t.kind == "subflow") return a;
458
+ if (t.kind == "subflow") return x(e, a);
284
459
  let o = new Set(n.flatMap((e) => {
285
460
  let t = r[e];
286
461
  return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
287
462
  }));
288
- for (let t of o) Object.entries(e.document.graph.nodes).some(([e, n]) => !i.has(e) && (n.kind == "poll" || n.kind == "integration") && n.bindingId == t) || a.push({
463
+ for (let t of o) !Object.entries(e.document.graph.nodes).some(([e, n]) => !i.has(e) && (n.kind == "poll" || n.kind == "integration") && n.bindingId == t) && e.document.bindings[t] != null && a.push({
289
464
  bindingId: t,
290
465
  kind: "binding.delete"
291
466
  });
292
- return a;
467
+ return x(e, a);
293
468
  }
294
- function m(e, t, n, r) {
295
- let i = y(e, t)?.nodes[n];
469
+ function v(e, t, n, r) {
470
+ let i = E(e, t)?.nodes[n];
296
471
  if (i == null || !("inputs" in i)) return;
297
472
  let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
298
- return S(t, n, {
473
+ return k(t, n, {
299
474
  ...c,
300
475
  ...r
301
476
  });
302
477
  }
303
- function h(e, t, n, r) {
304
- let i = y(e, t)?.nodes[n];
478
+ function y(e, t, n, r) {
479
+ let i = E(e, t)?.nodes[n];
305
480
  if (i == null || !("inputs" in i)) return;
306
481
  let a = { ...i.inputs };
307
482
  for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
308
483
  kind: "value",
309
484
  value: t
310
485
  };
311
- return S(t, n, {
486
+ return x(e, k(t, n, {
312
487
  ...i,
313
488
  inputs: a
314
- });
489
+ }));
315
490
  }
316
- function g(e, t, n) {
491
+ function b(e, t, n, r, i, a) {
492
+ let o = E(e, t)?.nodes[n];
493
+ 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 ? [] : [{
496
+ binding: {
497
+ kind: "variable",
498
+ target: i
499
+ },
500
+ bindingId: c,
501
+ kind: "binding.replace"
502
+ }];
503
+ let d = {
504
+ ...o.inputs,
505
+ [r]: {
506
+ kind: "sources",
507
+ sources: [{
508
+ bindingId: a,
509
+ kind: "binding"
510
+ }]
511
+ }
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
+ }))];
524
+ }
525
+ function x(e, t) {
526
+ let n = S(e.document), r = c(e, t), i = S(r.document);
527
+ return [...t, ...[...n.keys()].flatMap((e) => i.has(e) || r.document.bindings[e]?.kind != "variable" ? [] : [{
528
+ bindingId: e,
529
+ kind: "binding.delete"
530
+ }])];
531
+ }
532
+ function S(e) {
533
+ let t = /* @__PURE__ */ new Map(), n = (e) => {
534
+ t.set(e, (t.get(e) ?? 0) + 1);
535
+ };
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);
538
+ }
539
+ return t;
540
+ }
541
+ function C(e, t, n) {
317
542
  let r = e.document.tasks[t];
318
543
  if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
319
544
  kind: "task.replace",
@@ -327,7 +552,7 @@ function g(e, t, n) {
327
552
  taskId: t
328
553
  }];
329
554
  }
330
- function _(e, t, n, r) {
555
+ function w(e, t, n, r) {
331
556
  let i = e.document.graph.nodes[n];
332
557
  if (i == null) return;
333
558
  let a = {
@@ -374,11 +599,21 @@ function _(e, t, n, r) {
374
599
  config: r.config
375
600
  };
376
601
  }
377
- return S(t, n, o);
602
+ return k(t, n, o);
378
603
  }
379
- function v(e, t, n, r) {
604
+ function T(e, t, n, r) {
380
605
  let i = e.document.graph.nodes[n];
381
- if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
606
+ if (i == null || i.kind != "poll" && i.kind != "integration") return;
607
+ let a = e.document.bindings[i.bindingId];
608
+ if (a == null) return [{
609
+ binding: {
610
+ kind: "connection",
611
+ target: r
612
+ },
613
+ bindingId: i.bindingId,
614
+ kind: "binding.create"
615
+ }];
616
+ if (a.kind == "connection") return a.target == r ? [] : [{
382
617
  binding: {
383
618
  kind: "connection",
384
619
  target: r
@@ -387,19 +622,19 @@ function v(e, t, n, r) {
387
622
  kind: "binding.replace"
388
623
  }];
389
624
  }
390
- function y(e, t) {
625
+ function E(e, t) {
391
626
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
392
627
  }
393
- function b(e) {
394
- return Object.fromEntries(e.flatMap((e) => Object.hasOwn(e, "value") ? [[e.handle, {
628
+ function D(e) {
629
+ return Object.fromEntries(e.flatMap((e) => "handle" in e && Object.hasOwn(e, "value") ? [[e.handle, {
395
630
  kind: "value",
396
631
  value: e.value
397
632
  }]] : []));
398
633
  }
399
- function x(e, t, n) {
634
+ function O(e, t, n) {
400
635
  return e != null && Object.hasOwn(e, t) ? e[t] : n;
401
636
  }
402
- function S(e, t, n) {
637
+ function k(e, t, n) {
403
638
  return [{
404
639
  kind: "graph.node.replace",
405
640
  node: n,
@@ -408,4 +643,69 @@ function S(e, t, n) {
408
643
  }];
409
644
  }
410
645
  //#endregion
411
- export { e as connect, d as createBuiltinTrigger, o as createCodeTask, l as createCondition, c as createLlmTask, s as createManagedTask, f as createProviderTrigger, u as createValue, p as deleteNodes, t as disconnect, r as moduleImports, a as renameModule, i as replaceModuleSource, g as setConnectorConnection, h as setInputValues, v as setTriggerConnection, m as updateSettings, _ as updateTrigger };
646
+ //#region src/flow/common/edgeChanges.ts
647
+ function A(e, t, n) {
648
+ let r = {
649
+ source: n.source,
650
+ sourceHandle: n.sourceHandle,
651
+ target: n.target,
652
+ 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, [{
655
+ edge: r,
656
+ kind: "graph.edge.connect",
657
+ target: t
658
+ }]);
659
+ }
660
+ function j(e, t, n) {
661
+ let r = {
662
+ source: n.source,
663
+ sourceHandle: n.sourceHandle,
664
+ target: n.target,
665
+ targetHandle: n.targetHandle
666
+ }, i = M(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
667
+ return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
668
+ edge: r,
669
+ kind: "graph.edge.disconnect",
670
+ target: t
671
+ }];
672
+ }
673
+ function M(e, t) {
674
+ return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
675
+ }
676
+ //#endregion
677
+ //#region src/flow/common/moduleChanges.ts
678
+ async function N(e) {
679
+ try {
680
+ let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
681
+ errorRecovery: !0,
682
+ sourceType: "module"
683
+ }).program, r = /* @__PURE__ */ new Set();
684
+ for (let e of n.body) {
685
+ if (e.type != "ImportDeclaration") continue;
686
+ let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
687
+ t?.[1] != null && r.add(t[1]);
688
+ }
689
+ return [...r].toSorted();
690
+ } catch {
691
+ return [];
692
+ }
693
+ }
694
+ function P(e, t, n) {
695
+ return [{
696
+ imports: n,
697
+ kind: "module.source.replace",
698
+ moduleId: e,
699
+ source: t
700
+ }];
701
+ }
702
+ function F(e, t) {
703
+ return [{
704
+ kind: "module.rename",
705
+ moduleId: e,
706
+ name: t
707
+ }];
708
+ }
709
+ var I = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
710
+ //#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 };