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

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 (43) hide show
  1. package/README.md +5 -1
  2. package/dist/browser/addNodeOptions-JRHMwVOl.js +9597 -0
  3. package/dist/browser/{change-Cu6pQIit.js → change-BATEvjif.js} +2 -2
  4. package/dist/browser/createResourceDialog-CWD62rU0.js +467 -0
  5. package/dist/browser/{esm-CvAs_mAS.js → esm-C04lx1pd.js} +1 -1
  6. package/dist/browser/flow-authoring-node.d.ts +2 -0
  7. package/dist/browser/flow-authoring.d.ts +1 -1
  8. package/dist/browser/flow-authoring.js +387 -126
  9. package/dist/browser/flow-change.d.ts +9 -4
  10. package/dist/browser/flow-change.js +49 -46
  11. package/dist/browser/{flowRunInputEditorStore-DXOyyY7o.js → flowRunInputEditorStore-BUwR9Vbp.js} +1615 -882
  12. package/dist/browser/{flowWorkspace-X_T_DcQf.js → flowWorkspace-_qaqIyDi.js} +18174 -16631
  13. package/dist/browser/languages-DgJehE1g.js +62 -0
  14. package/dist/browser/lib-C5Ipyfps.js +7856 -0
  15. package/dist/browser/main-DmjVyuWr.js +76 -0
  16. package/dist/browser/{markdownContent-BI-2PmDX.js → markdownContent-CX77lBFM.js} +4795 -4787
  17. package/dist/browser/theme.css +63 -0
  18. package/dist/browser/theme.css.d.ts +1 -0
  19. package/dist/browser/typeScriptSession-D5neIpug.js +2560 -0
  20. package/dist/browser/{createLucideIcon-COMgwa_u.js → useOpenInteractionType-CRgOHg5M.js} +2484 -2254
  21. package/dist/browser/workbench-contract.d.ts +2 -1
  22. package/dist/browser/workbench.css +1 -1
  23. package/dist/browser/workbench.d.ts +16 -1
  24. package/dist/browser/workbench.js +1492 -1307
  25. package/dist/common/control-api-conformance.js +39 -0
  26. package/dist/common/control-api-errors.d.ts +12 -0
  27. package/dist/common/control-api.d.ts +13 -0
  28. package/dist/common/control-api.js +120 -73
  29. package/dist/common/flow-encoding.d.ts +2 -2
  30. package/dist/common/flow-encoding.js +4 -1
  31. package/dist/common/flow-semantics.d.ts +2 -0
  32. package/dist/common/flow-semantics.js +869 -838
  33. package/dist/common/licenses.md +1 -25
  34. package/dist/common/localization.d.ts +21 -0
  35. package/dist/common/localization.js +62 -0
  36. package/dist/common/scheduler.d.ts +1 -0
  37. package/dist/common/scheduler.js +64 -50
  38. package/package.json +9 -1
  39. package/dist/browser/addNodeOptions-BwrMvPQC.js +0 -5230
  40. package/dist/browser/assets/typeScriptWorker-CaA4llbX.js +0 -59850
  41. package/dist/browser/createResourceDialog-YgMLylQz.js +0 -467
  42. package/dist/browser/field-BrEG-7ap.js +0 -312
  43. package/dist/browser/typeScriptSession-Dagu_tRs.js +0 -2549
@@ -21,119 +21,50 @@ 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);
25
- //#endregion
26
- //#region src/flow/common/edgeChanges.ts
27
- function r(e, t, n) {
28
- let r = {
29
- source: n.source,
30
- sourceHandle: n.sourceHandle,
31
- target: n.target,
32
- targetHandle: n.targetHandle
33
- }, i = a(e, t)?.nodes[n.target], o = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
34
- return o?.kind == "sources" && o.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
35
- edge: r,
36
- kind: "graph.edge.connect",
37
- target: t
38
- }];
39
- }
40
- function i(e, t, n) {
41
- let r = {
42
- source: n.source,
43
- sourceHandle: n.sourceHandle,
44
- target: n.target,
45
- targetHandle: n.targetHandle
46
- }, i = a(e, t)?.nodes[n.target], o = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
47
- return o?.kind != "sources" || !o.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
48
- edge: r,
49
- kind: "graph.edge.disconnect",
50
- target: t
51
- }];
52
- }
24
+ }, n = (n, r = 21) => t(n, r | 0, e), r = "//#region generated meta", i = "//#endregion";
53
25
  function a(e, t) {
54
- return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
55
- }
56
- //#endregion
57
- //#region src/flow/common/moduleChanges.ts
58
- async function o(e) {
59
- try {
60
- let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
61
- errorRecovery: !0,
62
- sourceType: "module"
63
- }).program, r = /* @__PURE__ */ new Set();
64
- for (let e of n.body) {
65
- if (e.type != "ImportDeclaration") continue;
66
- let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
67
- t?.[1] != null && r.add(t[1]);
68
- }
69
- return [...r].toSorted();
70
- } catch {
71
- return [];
72
- }
73
- }
74
- function s(e, t, n) {
75
- return [{
76
- imports: n,
77
- kind: "module.source.replace",
78
- moduleId: e,
79
- source: t
80
- }];
81
- }
82
- function c(e, t) {
83
- return [{
84
- kind: "module.rename",
85
- moduleId: e,
86
- name: t
87
- }];
88
- }
89
- //#endregion
90
- //#region src/manifest/common/meta/block/generateTyping.ts
91
- var l = "//#region generated meta", u = "//#endregion";
92
- function d(e, t) {
93
- let n = e.indexOf(l);
26
+ let n = e.indexOf(r);
94
27
  if (n < 0) return e;
95
- let r = e.indexOf(`\n${u}`, n);
96
- if (r < 0) return e;
97
- let i = e.indexOf("\n", r + 1);
98
- return i < 0 && (i = e.length), `${e.slice(0, n)}${l}\n${t}${u}${e.slice(i)}`;
28
+ let a = e.indexOf(`\n${i}`, n);
29
+ if (a < 0) return e;
30
+ let o = e.indexOf("\n", a + 1);
31
+ return o < 0 && (o = e.length), `${e.slice(0, n)}${r}\n${t}${i}${e.slice(o)}`;
99
32
  }
100
- function f(e, t, n) {
101
- return e === "typescript" ? _(t, n) + "\n" : v(t, n) + "\n";
33
+ function o(e, t, n) {
34
+ return e === "typescript" ? d(t, n) + "\n" : f(t, n) + "\n";
102
35
  }
103
- var p = /* @__PURE__ */ new Set(["color", "text"]), m = (e) => e.includes(" | ") ? `(${e})` : e;
104
- function h(e) {
105
- return !e || typeof e != "object" ? !1 : e.contentMediaType === "oomol/artifact" ? !0 : Array.isArray(e.anyOf) ? e.anyOf.some(h) : e.type === "object" ? Object.values(e.properties || {}).some(h) : e.type === "array" && h(e.items);
36
+ var s = /* @__PURE__ */ new Set(["color", "text"]), c = (e) => e.includes(" | ") ? `(${e})` : e;
37
+ function l(e) {
38
+ return !e || typeof e != "object" ? !1 : e.contentMediaType === "oomol/artifact" ? !0 : Array.isArray(e.anyOf) ? e.anyOf.some(l) : e.type === "object" ? Object.values(e.properties || {}).some(l) : e.type === "array" && l(e.items);
106
39
  }
107
- function g(e, t) {
108
- return [...e, ...t].some((e) => h(e.json_schema));
40
+ function u(e, t) {
41
+ return [...e, ...t].some((e) => l(e.json_schema));
109
42
  }
110
- function _(e = [], t = []) {
43
+ function d(e = [], t = []) {
111
44
  let n = ["type Inputs = {"];
112
- for (let t of e) n.push(` ${t.handle}: ${y(t.json_schema, t.nullable)};`);
45
+ for (let t of e) n.push(` ${t.handle}: ${p(t.json_schema, t.nullable)};`);
113
46
  n.push("};"), n.push("type Outputs = {");
114
- for (let e of t) n.push(` ${e.handle}: ${y(e.json_schema, e.nullable)};`);
115
- return n.push("};"), g(e, t) && n.unshift("import type { ArtifactRef } from '@oomol-lab/open-flow'", ""), n.join("\n");
47
+ for (let e of t) n.push(` ${e.handle}: ${p(e.json_schema, e.nullable)};`);
48
+ return n.push("};"), u(e, t) && n.unshift("import type { ArtifactRef } from '@oomol-lab/open-flow'", ""), n.join("\n");
116
49
  }
117
- function v(e = [], t = []) {
50
+ function f(e = [], t = []) {
118
51
  let n = ["@typedef {{"];
119
- for (let t of e) n.push(` ${t.handle}: ${y(t.json_schema, t.nullable)};`);
52
+ for (let t of e) n.push(` ${t.handle}: ${p(t.json_schema, t.nullable)};`);
120
53
  n.push("}} Inputs;"), n.push("@typedef {{");
121
- for (let e of t) n.push(` ${e.handle}: ${y(e.json_schema, e.nullable)};`);
122
- n.push("}} Outputs;"), g(e, t) && n.unshift("@import { ArtifactRef } from \"@oomol-lab/open-flow\"");
54
+ for (let e of t) n.push(` ${e.handle}: ${p(e.json_schema, e.nullable)};`);
55
+ n.push("}} Outputs;"), u(e, t) && n.unshift("@import { ArtifactRef } from \"@oomol-lab/open-flow\"");
123
56
  let r = n.map((e) => ` * ${e}`);
124
57
  return r.unshift("/**"), r.push(" */"), r.join("\n");
125
58
  }
126
- function y(e, t) {
59
+ function p(e, t) {
127
60
  if (!e) return "any";
128
61
  switch (e.contentMediaType) {
129
- case "oomol/secret": return t ? "string | null" : "string";
130
62
  case "oomol/bin": return t ? "Uint8Array | null" : "Uint8Array";
131
- case "oomol/var": return "any";
132
63
  case "oomol/artifact": return t ? "ArtifactRef | null" : "ArtifactRef";
133
64
  }
134
- if (p.has(e["ui:widget"])) return t ? "string | null" : "string";
135
- if (Array.isArray(e.anyOf)) return b((t ? e.anyOf.concat({ type: "null" }) : e.anyOf).map((e) => m(y(e, !1)))) || "any";
136
- if (Array.isArray(e.enum)) return b((t ? e.enum.concat(null) : e.enum).map((e) => JSON.stringify(e))) || "any";
65
+ if (s.has(e["ui:widget"])) return t ? "string | null" : "string";
66
+ if (Array.isArray(e.anyOf)) return m((t ? e.anyOf.concat({ type: "null" }) : e.anyOf).map((e) => c(p(e, !1)))) || "any";
67
+ if (Array.isArray(e.enum)) return m((t ? e.enum.concat(null) : e.enum).map((e) => JSON.stringify(e))) || "any";
137
68
  switch (e.type) {
138
69
  case "null": return "null";
139
70
  case "boolean": return t ? "boolean | null" : "boolean";
@@ -143,26 +74,242 @@ function y(e, t) {
143
74
  case "object": {
144
75
  let n = Object.keys(e.properties || {});
145
76
  if (n.length === 0) return "Record<string, any>";
146
- let r = Array.isArray(e?.required) ? new Set(e.required) : void 0, i = `{ ${n.map((t) => `${t}${r && !r.has(t) ? "?" : ""}: ${y(e.properties[t], !1)}`).join("; ")} }`;
77
+ let r = Array.isArray(e?.required) ? new Set(e.required) : void 0, i = `{ ${n.map((t) => `${t}${r && !r.has(t) ? "?" : ""}: ${p(e.properties[t], !1)}`).join("; ")} }`;
147
78
  return t ? `${i} | null` : i;
148
79
  }
149
80
  case "array":
150
81
  if (e.uniqueItems && Array.isArray(e.items?.enum)) {
151
- let n = `${m(y(e.items, !1))}[]`;
82
+ let n = `${c(p(e.items, !1))}[]`;
152
83
  return t ? `${n} | null` : n;
153
84
  }
154
85
  {
155
- let n = `${m(y(e.items, !1))}[]`;
86
+ let n = `${c(p(e.items, !1))}[]`;
156
87
  return t ? `${n} | null` : n;
157
88
  }
158
89
  default: return "any";
159
90
  }
160
91
  }
161
- function b(e) {
92
+ function m(e) {
162
93
  let t = Array.from(new Set(e.filter((e) => !!e)));
163
94
  return t.length === 0 || t.includes("any") ? "any" : t.join(" | ");
164
95
  }
165
96
  //#endregion
97
+ //#region src/flow/common/change.ts
98
+ var h = class extends Error {};
99
+ function g() {
100
+ throw new h();
101
+ }
102
+ function _(e, t) {
103
+ if (t.kind == "flow") return e.graph;
104
+ let n = e.subflows[t.id];
105
+ return n ?? g(), n.graph;
106
+ }
107
+ function v(e, t, n) {
108
+ if (t.kind == "flow") return {
109
+ ...e,
110
+ graph: n
111
+ };
112
+ let r = e.subflows[t.id];
113
+ return r ?? g(), {
114
+ ...e,
115
+ subflows: {
116
+ ...e.subflows,
117
+ [t.id]: {
118
+ ...r,
119
+ graph: n
120
+ }
121
+ }
122
+ };
123
+ }
124
+ function y(e, t) {
125
+ if (!("inputs" in e)) return e;
126
+ let n = { ...e.inputs };
127
+ for (let [e, r] of Object.entries(n)) {
128
+ if (r.kind != "sources") continue;
129
+ let i = r.sources.filter((e) => e.kind != "node" || !t.has(e.nodeId));
130
+ i.length == 0 ? delete n[e] : n[e] = {
131
+ kind: "sources",
132
+ sources: i
133
+ };
134
+ }
135
+ return {
136
+ ...e,
137
+ inputs: n
138
+ };
139
+ }
140
+ function b(e, t) {
141
+ let n = { ...e.document }, r = { ...e.modules };
142
+ for (let e of t) switch (e.kind) {
143
+ case "binding.create":
144
+ n.bindings[e.bindingId] != null && g(), n.bindings = {
145
+ ...n.bindings,
146
+ [e.bindingId]: e.binding
147
+ };
148
+ break;
149
+ case "binding.replace":
150
+ n.bindings[e.bindingId] ?? g(), n.bindings = {
151
+ ...n.bindings,
152
+ [e.bindingId]: e.binding
153
+ };
154
+ break;
155
+ case "binding.delete": {
156
+ n.bindings[e.bindingId] ?? g();
157
+ let t = { ...n.bindings };
158
+ delete t[e.bindingId], n.bindings = t;
159
+ break;
160
+ }
161
+ case "graph.edge.connect": {
162
+ let t = _(n, e.target);
163
+ t.nodes[e.edge.source] ?? g();
164
+ let r = t.nodes[e.edge.target];
165
+ (r == null || !("inputs" in r)) && g();
166
+ let i = r.inputs[e.edge.targetHandle], a = {
167
+ kind: "node",
168
+ nodeId: e.edge.source,
169
+ output: e.edge.sourceHandle
170
+ }, o = i?.kind == "sources" ? i.sources.filter((e) => e.kind != "binding" || n.bindings[e.bindingId]?.kind != "variable") : [];
171
+ o.some((e) => e.kind == "node" && e.nodeId == a.nodeId && e.output == a.output) && g();
172
+ let s = {
173
+ ...r,
174
+ inputs: {
175
+ ...r.inputs,
176
+ [e.edge.targetHandle]: {
177
+ kind: "sources",
178
+ sources: [...o, a]
179
+ }
180
+ }
181
+ };
182
+ Object.assign(n, v(n, e.target, { nodes: {
183
+ ...t.nodes,
184
+ [e.edge.target]: s
185
+ } }));
186
+ break;
187
+ }
188
+ case "graph.edge.disconnect": {
189
+ let t = _(n, e.target), r = t.nodes[e.edge.target];
190
+ (r == null || !("inputs" in r)) && g();
191
+ let i = r.inputs[e.edge.targetHandle];
192
+ i?.kind != "sources" && g();
193
+ let a = i.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
194
+ a.length == i.sources.length && g();
195
+ let o = { ...r.inputs };
196
+ a.length == 0 ? delete o[e.edge.targetHandle] : o[e.edge.targetHandle] = {
197
+ kind: "sources",
198
+ sources: a
199
+ }, Object.assign(n, v(n, e.target, { nodes: {
200
+ ...t.nodes,
201
+ [e.edge.target]: {
202
+ ...r,
203
+ inputs: o
204
+ }
205
+ } }));
206
+ break;
207
+ }
208
+ case "graph.node.create": {
209
+ let t = _(n, e.target);
210
+ (t.nodes[e.nodeId] != null || e.target.kind == "subflow" && !("inputs" in e.node)) && g(), Object.assign(n, v(n, e.target, { nodes: {
211
+ ...t.nodes,
212
+ [e.nodeId]: e.node
213
+ } }));
214
+ break;
215
+ }
216
+ case "graph.node.delete": {
217
+ let t = _(n, e.target);
218
+ t.nodes[e.nodeId] ?? g();
219
+ let r = /* @__PURE__ */ new Set([e.nodeId]), i = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => r.has(e) ? [] : [[e, y(t, r)]]));
220
+ if (Object.assign(n, v(n, e.target, { nodes: i })), e.target.kind == "subflow") {
221
+ let t = n.subflows[e.target.id], i = t.outputs.map((e) => ({
222
+ ...e,
223
+ sources: e.sources.filter((e) => e.kind != "node" || !r.has(e.nodeId))
224
+ }));
225
+ n.subflows = {
226
+ ...n.subflows,
227
+ [e.target.id]: {
228
+ ...t,
229
+ outputs: i
230
+ }
231
+ };
232
+ }
233
+ break;
234
+ }
235
+ case "graph.node.replace": {
236
+ let t = _(n, e.target);
237
+ (t.nodes[e.nodeId] == null || e.target.kind == "subflow" && !("inputs" in e.node)) && g(), Object.assign(n, v(n, e.target, { nodes: {
238
+ ...t.nodes,
239
+ [e.nodeId]: e.node
240
+ } }));
241
+ break;
242
+ }
243
+ case "module.create":
244
+ r[e.moduleId] != null && g(), r[e.moduleId] = e.module;
245
+ break;
246
+ case "module.delete":
247
+ r[e.moduleId] ?? g(), delete r[e.moduleId];
248
+ break;
249
+ case "module.rename": {
250
+ let t = r[e.moduleId];
251
+ t ?? g(), r[e.moduleId] = {
252
+ ...t,
253
+ name: e.name
254
+ };
255
+ break;
256
+ }
257
+ case "module.source.replace": {
258
+ let t = r[e.moduleId];
259
+ t ?? g(), r[e.moduleId] = {
260
+ ...t,
261
+ imports: e.imports,
262
+ source: e.source
263
+ };
264
+ break;
265
+ }
266
+ case "subflow.create":
267
+ n.subflows[e.subflowId] != null && g(), n.subflows = {
268
+ ...n.subflows,
269
+ [e.subflowId]: e.subflow
270
+ };
271
+ break;
272
+ case "subflow.definition.replace": {
273
+ let t = n.subflows[e.subflowId];
274
+ t ?? g(), n.subflows = {
275
+ ...n.subflows,
276
+ [e.subflowId]: {
277
+ ...e.definition,
278
+ graph: t.graph
279
+ }
280
+ };
281
+ break;
282
+ }
283
+ case "subflow.delete": {
284
+ n.subflows[e.subflowId] ?? g();
285
+ let t = { ...n.subflows };
286
+ delete t[e.subflowId], n.subflows = t;
287
+ break;
288
+ }
289
+ case "task.create":
290
+ n.tasks[e.taskId] != null && g(), n.tasks = {
291
+ ...n.tasks,
292
+ [e.taskId]: e.task
293
+ };
294
+ break;
295
+ case "task.delete": {
296
+ n.tasks[e.taskId] ?? g();
297
+ let t = { ...n.tasks };
298
+ delete t[e.taskId], n.tasks = t;
299
+ break;
300
+ }
301
+ case "task.replace": n.tasks[e.taskId] ?? g(), n.tasks = {
302
+ ...n.tasks,
303
+ [e.taskId]: e.task
304
+ };
305
+ }
306
+ return {
307
+ document: n,
308
+ modelVersion: e.modelVersion,
309
+ modules: r
310
+ };
311
+ }
312
+ //#endregion
166
313
  //#region src/flow/common/nodeChanges.ts
167
314
  var x = "//#region generated meta\n/**\n * @typedef {{}} Inputs\n * @typedef {{}} Outputs\n */\n//#endregion\n\n/**\n * @import { TaskContext } from \"@oomol-lab/open-flow\"\n * @param {Inputs} input\n * @param {TaskContext<Outputs>} context\n * @returns {Promise<Partial<Outputs> | undefined | void>}\n */\nexport default async function (input, context) {\n return { result: input.value }\n}\n";
168
315
  function S(e, t, n, r = void 0, i = {
@@ -183,15 +330,15 @@ function S(e, t, n, r = void 0, i = {
183
330
  module: {
184
331
  ...r ?? {
185
332
  imports: [],
186
- source: d(x, f("javascript", i.inputs.map((e) => ({
333
+ source: a(x, o("javascript", i.inputs.flatMap((e) => "handle" in e ? [{
187
334
  handle: e.handle,
188
335
  json_schema: e.jsonSchema,
189
336
  nullable: e.nullable
190
- })), i.outputs.map((e) => ({
337
+ }] : []), i.outputs.flatMap((e) => "handle" in e ? [{
191
338
  handle: e.handle,
192
339
  json_schema: e.jsonSchema,
193
340
  nullable: e.nullable
194
- }))))
341
+ }] : [])))
195
342
  },
196
343
  name: n
197
344
  },
@@ -200,7 +347,7 @@ function S(e, t, n, r = void 0, i = {
200
347
  kind: "graph.node.create",
201
348
  node: {
202
349
  concurrency: 1,
203
- inputs: I(i.inputs),
350
+ inputs: z(i.inputs),
204
351
  kind: "task",
205
352
  name: n,
206
353
  task: {
@@ -223,7 +370,7 @@ function C(e, t, n) {
223
370
  kind: "graph.node.create",
224
371
  node: {
225
372
  concurrency: 1,
226
- inputs: I(n.inputs),
373
+ inputs: z(n.inputs),
227
374
  kind: "task",
228
375
  name: n.name,
229
376
  taskId: t.taskId
@@ -247,13 +394,13 @@ function w(e, t, n, r, i, a = {}) {
247
394
  type: "array"
248
395
  },
249
396
  nullable: !0,
250
- value: L(o, "messages", null)
397
+ value: B(o, "messages", null)
251
398
  },
252
399
  {
253
400
  handle: "input",
254
401
  jsonSchema: { type: "string" },
255
402
  nullable: !1,
256
- value: L(o, "input", "Alex")
403
+ value: B(o, "input", "Alex")
257
404
  },
258
405
  {
259
406
  handle: "template",
@@ -263,7 +410,7 @@ function w(e, t, n, r, i, a = {}) {
263
410
  type: "array"
264
411
  },
265
412
  nullable: !1,
266
- value: L(o, "template", [{
413
+ value: B(o, "template", [{
267
414
  content: "Hello, I'm {{input}}",
268
415
  role: "user"
269
416
  }])
@@ -272,7 +419,7 @@ function w(e, t, n, r, i, a = {}) {
272
419
  handle: "model",
273
420
  jsonSchema: { type: "object" },
274
421
  nullable: !1,
275
- value: L(o, "model", { model: "deepseek-v4-flash" })
422
+ value: B(o, "model", { model: "deepseek-v4-flash" })
276
423
  }
277
424
  ],
278
425
  name: n,
@@ -377,7 +524,7 @@ function O(e, t, n, r) {
377
524
  }];
378
525
  }
379
526
  function k(e, t, n) {
380
- let r = F(e, t)?.nodes;
527
+ let r = R(e, t)?.nodes;
381
528
  if (r == null) return [];
382
529
  let i = new Set(n), a = n.flatMap((e) => {
383
530
  let n = r[e];
@@ -390,7 +537,7 @@ function k(e, t, n) {
390
537
  moduleId: n.task.moduleId
391
538
  }] : []];
392
539
  });
393
- if (t.kind == "subflow") return a;
540
+ if (t.kind == "subflow") return N(e, a);
394
541
  let o = new Set(n.flatMap((e) => {
395
542
  let t = r[e];
396
543
  return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
@@ -399,31 +546,81 @@ function k(e, t, n) {
399
546
  bindingId: t,
400
547
  kind: "binding.delete"
401
548
  });
402
- return a;
549
+ return N(e, a);
403
550
  }
404
551
  function A(e, t, n, r) {
405
- let i = F(e, t)?.nodes[n];
552
+ let i = R(e, t)?.nodes[n];
406
553
  if (i == null || !("inputs" in i)) return;
407
554
  let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
408
- return R(t, n, {
555
+ return V(t, n, {
409
556
  ...c,
410
557
  ...r
411
558
  });
412
559
  }
413
560
  function j(e, t, n, r) {
414
- let i = F(e, t)?.nodes[n];
561
+ let i = R(e, t)?.nodes[n];
415
562
  if (i == null || !("inputs" in i)) return;
416
563
  let a = { ...i.inputs };
417
564
  for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
418
565
  kind: "value",
419
566
  value: t
420
567
  };
421
- return R(t, n, {
568
+ return N(e, V(t, n, {
422
569
  ...i,
423
570
  inputs: a
424
- });
571
+ }));
572
+ }
573
+ function M(e, t, n, r, i, a) {
574
+ let o = R(e, t)?.nodes[n];
575
+ if (o == null || !("inputs" in o)) return;
576
+ 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 = P(e.document);
577
+ if (c != null && l?.kind == "variable" && (u.get(c) ?? 0) == 1) return l.target == i ? [] : [{
578
+ binding: {
579
+ kind: "variable",
580
+ target: i
581
+ },
582
+ bindingId: c,
583
+ kind: "binding.replace"
584
+ }];
585
+ let d = {
586
+ ...o.inputs,
587
+ [r]: {
588
+ kind: "sources",
589
+ sources: [{
590
+ bindingId: a,
591
+ kind: "binding"
592
+ }]
593
+ }
594
+ };
595
+ return [{
596
+ binding: {
597
+ kind: "variable",
598
+ target: i
599
+ },
600
+ bindingId: a,
601
+ kind: "binding.create"
602
+ }, ...N(e, V(t, n, {
603
+ ...o,
604
+ inputs: d
605
+ }))];
606
+ }
607
+ function N(e, t) {
608
+ let n = P(e.document), r = b(e, t), i = P(r.document);
609
+ return [...t, ...[...n.keys()].flatMap((e) => i.has(e) || r.document.bindings[e]?.kind != "variable" ? [] : [{
610
+ bindingId: e,
611
+ kind: "binding.delete"
612
+ }])];
425
613
  }
426
- function M(e, t, n) {
614
+ function P(e) {
615
+ let t = /* @__PURE__ */ new Map(), n = (e) => {
616
+ t.set(e, (t.get(e) ?? 0) + 1);
617
+ };
618
+ 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) {
619
+ for (let t of Object.values(e.inputs)) if (t.kind == "sources") for (let e of t.sources) e.kind == "binding" && n(e.bindingId);
620
+ }
621
+ return t;
622
+ }
623
+ function F(e, t, n) {
427
624
  let r = e.document.tasks[t];
428
625
  if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
429
626
  kind: "task.replace",
@@ -437,7 +634,7 @@ function M(e, t, n) {
437
634
  taskId: t
438
635
  }];
439
636
  }
440
- function N(e, t, n, r) {
637
+ function I(e, t, n, r) {
441
638
  let i = e.document.graph.nodes[n];
442
639
  if (i == null) return;
443
640
  let a = {
@@ -484,9 +681,9 @@ function N(e, t, n, r) {
484
681
  config: r.config
485
682
  };
486
683
  }
487
- return R(t, n, o);
684
+ return V(t, n, o);
488
685
  }
489
- function P(e, t, n, r) {
686
+ function L(e, t, n, r) {
490
687
  let i = e.document.graph.nodes[n];
491
688
  if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
492
689
  binding: {
@@ -497,19 +694,19 @@ function P(e, t, n, r) {
497
694
  kind: "binding.replace"
498
695
  }];
499
696
  }
500
- function F(e, t) {
697
+ function R(e, t) {
501
698
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
502
699
  }
503
- function I(e) {
504
- return Object.fromEntries(e.flatMap((e) => Object.hasOwn(e, "value") ? [[e.handle, {
700
+ function z(e) {
701
+ return Object.fromEntries(e.flatMap((e) => "handle" in e && Object.hasOwn(e, "value") ? [[e.handle, {
505
702
  kind: "value",
506
703
  value: e.value
507
704
  }]] : []));
508
705
  }
509
- function L(e, t, n) {
706
+ function B(e, t, n) {
510
707
  return e != null && Object.hasOwn(e, t) ? e[t] : n;
511
708
  }
512
- function R(e, t, n) {
709
+ function V(e, t, n) {
513
710
  return [{
514
711
  kind: "graph.node.replace",
515
712
  node: n,
@@ -517,6 +714,70 @@ function R(e, t, n) {
517
714
  target: e
518
715
  }];
519
716
  }
520
- var z = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
521
717
  //#endregion
522
- export { r as connect, z as createAuthoringId, D as createBuiltinTrigger, S as createCodeTask, T as createCondition, w as createLlmTask, C as createManagedTask, O as createProviderTrigger, E as createValue, k as deleteNodes, i as disconnect, o as moduleImports, c as renameModule, s as replaceModuleSource, M as setConnectorConnection, j as setInputValues, P as setTriggerConnection, A as updateSettings, N as updateTrigger };
718
+ //#region src/flow/common/edgeChanges.ts
719
+ function H(e, t, n) {
720
+ let r = {
721
+ source: n.source,
722
+ sourceHandle: n.sourceHandle,
723
+ target: n.target,
724
+ targetHandle: n.targetHandle
725
+ }, i = W(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
726
+ return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : N(e, [{
727
+ edge: r,
728
+ kind: "graph.edge.connect",
729
+ target: t
730
+ }]);
731
+ }
732
+ function U(e, t, n) {
733
+ let r = {
734
+ source: n.source,
735
+ sourceHandle: n.sourceHandle,
736
+ target: n.target,
737
+ targetHandle: n.targetHandle
738
+ }, i = W(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
739
+ return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
740
+ edge: r,
741
+ kind: "graph.edge.disconnect",
742
+ target: t
743
+ }];
744
+ }
745
+ function W(e, t) {
746
+ return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
747
+ }
748
+ //#endregion
749
+ //#region src/flow/common/moduleChanges.ts
750
+ async function G(e) {
751
+ try {
752
+ let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
753
+ errorRecovery: !0,
754
+ sourceType: "module"
755
+ }).program, r = /* @__PURE__ */ new Set();
756
+ for (let e of n.body) {
757
+ if (e.type != "ImportDeclaration") continue;
758
+ let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
759
+ t?.[1] != null && r.add(t[1]);
760
+ }
761
+ return [...r].toSorted();
762
+ } catch {
763
+ return [];
764
+ }
765
+ }
766
+ function K(e, t, n) {
767
+ return [{
768
+ imports: n,
769
+ kind: "module.source.replace",
770
+ moduleId: e,
771
+ source: t
772
+ }];
773
+ }
774
+ function q(e, t) {
775
+ return [{
776
+ kind: "module.rename",
777
+ moduleId: e,
778
+ name: t
779
+ }];
780
+ }
781
+ var J = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
782
+ //#endregion
783
+ export { N as cleanVariableBindings, H as connect, J as createAuthoringId, D as createBuiltinTrigger, S as createCodeTask, T as createCondition, w as createLlmTask, C as createManagedTask, O as createProviderTrigger, E as createValue, k as deleteNodes, U as disconnect, G as moduleImports, q as renameModule, K as replaceModuleSource, F as setConnectorConnection, j as setInputValues, M as setInputVariable, L as setTriggerConnection, A as updateSettings, I as updateTrigger };