@oomol-lab/open-flow 0.1.0-beta.29 → 0.1.0-beta.30

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.
@@ -1,6 +1,6 @@
1
1
  import { i as e } from "./main-BDnNHhkU.js";
2
2
  import { Bn as t, kt as n } from "./lite-BuKZ8joP.js";
3
- import { a as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, p, r as m, s as h, t as g } from "./workbenchSelect-CQOvpteT.js";
3
+ import { a as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, p, r as m, s as h, t as g } from "./workbenchSelect-BDPIQxYK.js";
4
4
  import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
5
5
  import { useEffect as b, useRef as x, useState as S } from "react";
6
6
  //#region src/workbench/browser/runtime/shell/createResourceDialog.tsx
@@ -4505,16 +4505,16 @@ var Fs = z(V([B({
4505
4505
  graph: oc,
4506
4506
  subflows: H(G, ac.extend({ graph: oc })),
4507
4507
  tasks: H(G, Ys)
4508
- });
4509
- B({
4510
- modelVersion: W(2),
4508
+ }), uc = B({
4509
+ modelVersion: V([W(2), W(3)]),
4511
4510
  document: lc,
4512
4511
  modules: H(G, cc)
4513
- }).extend({
4512
+ });
4513
+ uc.extend({ modelVersion: W(3) }), uc.extend({
4514
4514
  kind: W("open-flow-flow-revision"),
4515
4515
  version: W(1)
4516
4516
  });
4517
- var uc = {
4517
+ var dc = {
4518
4518
  "binding.create": {
4519
4519
  bindingId: G,
4520
4520
  binding: sc
@@ -4677,13 +4677,13 @@ var uc = {
4677
4677
  value: G
4678
4678
  }
4679
4679
  };
4680
- z(V([...new Map(Object.entries(uc).map(([e, t]) => [e, t instanceof F ? t : B({
4680
+ z(V([...new Map(Object.entries(dc).map(([e, t]) => [e, t instanceof F ? t : B({
4681
4681
  kind: W(e),
4682
4682
  ...t
4683
4683
  })])).values()])).min(1);
4684
4684
  //#endregion
4685
4685
  //#region src/flow/common/change.ts
4686
- function dc(e) {
4686
+ function fc(e) {
4687
4687
  if (!Array.isArray(e)) throw TypeError("Connector capabilities must be an array.");
4688
4688
  let t = /* @__PURE__ */ new Set();
4689
4689
  return e.map((e) => {
@@ -4719,20 +4719,20 @@ function dc(e) {
4719
4719
  };
4720
4720
  });
4721
4721
  }
4722
- function fc(e) {
4722
+ function pc(e) {
4723
4723
  return e.trim().normalize("NFC");
4724
4724
  }
4725
- function pc(e, t, n) {
4726
- let r = fc(n);
4727
- return r.length == 0 ? "empty" : Object.entries(e.nodes).some(([e, n]) => e != t && n.name != null && fc(n.name) == r) ? "duplicate" : void 0;
4725
+ function mc(e, t, n) {
4726
+ let r = pc(n);
4727
+ return r.length == 0 ? "empty" : Object.entries(e.nodes).some(([e, n]) => e != t && n.name != null && pc(n.name) == r) ? "duplicate" : void 0;
4728
4728
  }
4729
- var mc = class extends Error {
4729
+ var hc = class extends Error {
4730
4730
  constructor(e) {
4731
4731
  super(e), this.name = "FlowChangeError";
4732
4732
  }
4733
4733
  };
4734
4734
  function X(e) {
4735
- throw new mc(e);
4735
+ throw new hc(e);
4736
4736
  }
4737
4737
  function Z(e, t) {
4738
4738
  if (t.kind == "flow") return e.graph;
@@ -4756,7 +4756,7 @@ function Q(e, t, n) {
4756
4756
  }
4757
4757
  };
4758
4758
  }
4759
- function hc(e, t) {
4759
+ function gc(e, t) {
4760
4760
  let n = { ...e.document }, r = { ...e.modules };
4761
4761
  for (let e of t) switch (e.kind) {
4762
4762
  case "binding.create":
@@ -4837,8 +4837,8 @@ function hc(e, t) {
4837
4837
  }
4838
4838
  case "graph.node.create": {
4839
4839
  let t = Z(n, e.target);
4840
- t.nodes[e.nodeId] != null && X("A Node with this ID already exists in the target graph."), e.target.kind == "subflow" && !("inputs" in e.node) && X("Trigger Nodes cannot be created inside a Subflow."), e.node.kind == "manual" && Object.values(t.nodes).some((e) => e.kind == "manual") && X("A graph can contain only one manual Trigger."), e.node.kind == "task" && e.node.task?.capabilities !== void 0 && dc(e.node.task.capabilities), e.node.name ?? X("A Node name cannot be empty.");
4841
- let r = fc(e.node.name), i = pc(t, e.nodeId, r);
4840
+ t.nodes[e.nodeId] != null && X("A Node with this ID already exists in the target graph."), e.target.kind == "subflow" && !("inputs" in e.node) && X("Trigger Nodes cannot be created inside a Subflow."), e.node.kind == "manual" && Object.values(t.nodes).some((e) => e.kind == "manual") && X("A graph can contain only one manual Trigger."), e.node.kind == "task" && e.node.task?.capabilities !== void 0 && fc(e.node.task.capabilities), e.node.name ?? X("A Node name cannot be empty.");
4841
+ let r = pc(e.node.name), i = mc(t, e.nodeId, r);
4842
4842
  i == "empty" && X("A Node name cannot be empty."), i == "duplicate" && X("A Node with this name already exists in the target graph.");
4843
4843
  let a = r == e.node.name ? e.node : {
4844
4844
  ...e.node,
@@ -4870,7 +4870,7 @@ function hc(e, t) {
4870
4870
  let a = { ...r };
4871
4871
  if (e.field == "name") {
4872
4872
  typeof e.value != "string" && X("A Node name cannot be empty.");
4873
- let n = fc(e.value), r = pc(t, e.nodeId, n);
4873
+ let n = pc(e.value), r = mc(t, e.nodeId, n);
4874
4874
  r == "empty" && X("A Node name cannot be empty."), r == "duplicate" && X("A Node with this name already exists in the target graph."), Object.assign(a, { name: n });
4875
4875
  } else e.value == null ? Reflect.deleteProperty(a, e.field) : Object.assign(a, { [e.field]: e.value });
4876
4876
  Object.assign(n, Q(n, e.target, {
@@ -4902,7 +4902,7 @@ function hc(e, t) {
4902
4902
  let t = Z(n, e.target), r = t.nodes[e.nodeId];
4903
4903
  (r?.kind != "task" || r.task == null) && X("The inline Task Node does not exist."), i(r.task.capabilities, e.before) || X("The inline Task capabilities changed before this operation was applied.");
4904
4904
  let a = { ...r.task };
4905
- e.value === void 0 ? delete a.capabilities : a.capabilities = dc(e.value), Object.assign(n, Q(n, e.target, {
4905
+ e.value === void 0 ? delete a.capabilities : a.capabilities = fc(e.value), Object.assign(n, Q(n, e.target, {
4906
4906
  ...t,
4907
4907
  nodes: {
4908
4908
  ...t.nodes,
@@ -5065,7 +5065,7 @@ function hc(e, t) {
5065
5065
  }
5066
5066
  case "subflow.create":
5067
5067
  n.subflows[e.subflowId] != null && X("A Subflow with this ID already exists.");
5068
- for (let t of Object.values(e.subflow.graph.nodes)) t.kind == "task" && t.task?.capabilities !== void 0 && dc(t.task.capabilities);
5068
+ for (let t of Object.values(e.subflow.graph.nodes)) t.kind == "task" && t.task?.capabilities !== void 0 && fc(t.task.capabilities);
5069
5069
  n.subflows = {
5070
5070
  ...n.subflows,
5071
5071
  [e.subflowId]: e.subflow
@@ -5156,14 +5156,14 @@ function hc(e, t) {
5156
5156
  }
5157
5157
  return {
5158
5158
  document: n,
5159
- modelVersion: e.modelVersion,
5159
+ modelVersion: 3,
5160
5160
  modules: r
5161
5161
  };
5162
5162
  }
5163
5163
  //#endregion
5164
5164
  //#region src/flow/common/nodeChanges.ts
5165
- var gc = "export default async function (inputs, context) {\n return { result: inputs.value }\n}\n";
5166
- function _c(e, t, n, r = void 0, i = {
5165
+ var _c = "export default async function (inputs, context) {\n return { result: inputs.value }\n}\n";
5166
+ function vc(e, t, n, r = void 0, i = {
5167
5167
  inputs: [{
5168
5168
  handle: "value",
5169
5169
  jsonSchema: {},
@@ -5181,7 +5181,7 @@ function _c(e, t, n, r = void 0, i = {
5181
5181
  module: {
5182
5182
  ...r ?? {
5183
5183
  imports: [],
5184
- source: gc
5184
+ source: _c
5185
5185
  },
5186
5186
  name: n
5187
5187
  },
@@ -5189,7 +5189,7 @@ function _c(e, t, n, r = void 0, i = {
5189
5189
  }, {
5190
5190
  kind: "graph.node.create",
5191
5191
  node: {
5192
- inputs: Ic(i.inputs),
5192
+ inputs: Lc(i.inputs),
5193
5193
  kind: "task",
5194
5194
  name: n,
5195
5195
  task: {
@@ -5204,7 +5204,7 @@ function _c(e, t, n, r = void 0, i = {
5204
5204
  target: e
5205
5205
  }];
5206
5206
  }
5207
- function vc(e, t, n) {
5207
+ function yc(e, t, n) {
5208
5208
  return [{
5209
5209
  kind: "task.create",
5210
5210
  task: n,
@@ -5212,7 +5212,7 @@ function vc(e, t, n) {
5212
5212
  }, {
5213
5213
  kind: "graph.node.create",
5214
5214
  node: {
5215
- inputs: Ic(n.inputs),
5215
+ inputs: Lc(n.inputs),
5216
5216
  kind: "task",
5217
5217
  name: n.name,
5218
5218
  taskId: t.taskId
@@ -5221,9 +5221,9 @@ function vc(e, t, n) {
5221
5221
  target: e
5222
5222
  }];
5223
5223
  }
5224
- function yc(e, t, n) {
5224
+ function bc(e, t, n) {
5225
5225
  if (e.kind != "flow") throw Error("Agent nodes are only supported in the root Flow.");
5226
- return vc(e, t, {
5226
+ return yc(e, t, {
5227
5227
  name: n,
5228
5228
  inputs: [{
5229
5229
  handle: "input",
@@ -5249,9 +5249,9 @@ function yc(e, t, n) {
5249
5249
  }
5250
5250
  });
5251
5251
  }
5252
- function bc(e, t, n, r, i, a = {}) {
5252
+ function xc(e, t, n, r, i, a = {}) {
5253
5253
  let o = a.inputs ?? {};
5254
- return vc(e, t, {
5254
+ return yc(e, t, {
5255
5255
  executor: {
5256
5256
  kind: "llm",
5257
5257
  mode: r
@@ -5264,13 +5264,13 @@ function bc(e, t, n, r, i, a = {}) {
5264
5264
  type: "array"
5265
5265
  },
5266
5266
  nullable: !0,
5267
- value: Lc(o, "messages", null)
5267
+ value: Rc(o, "messages", null)
5268
5268
  },
5269
5269
  {
5270
5270
  handle: "input",
5271
5271
  jsonSchema: { type: "string" },
5272
5272
  nullable: !1,
5273
- value: Lc(o, "input", "Alex")
5273
+ value: Rc(o, "input", "Alex")
5274
5274
  },
5275
5275
  {
5276
5276
  handle: "template",
@@ -5280,7 +5280,7 @@ function bc(e, t, n, r, i, a = {}) {
5280
5280
  type: "array"
5281
5281
  },
5282
5282
  nullable: !1,
5283
- value: Lc(o, "template", [{
5283
+ value: Rc(o, "template", [{
5284
5284
  content: "Hello, I'm {{input}}",
5285
5285
  role: "user"
5286
5286
  }])
@@ -5289,7 +5289,7 @@ function bc(e, t, n, r, i, a = {}) {
5289
5289
  handle: "model",
5290
5290
  jsonSchema: { type: "object" },
5291
5291
  nullable: !1,
5292
- value: Lc(o, "model", { model: "deepseek-v4-flash" })
5292
+ value: Rc(o, "model", { model: "deepseek-v4-flash" })
5293
5293
  }
5294
5294
  ],
5295
5295
  name: n,
@@ -5302,7 +5302,7 @@ function bc(e, t, n, r, i, a = {}) {
5302
5302
  }]
5303
5303
  });
5304
5304
  }
5305
- function xc(e, t, n) {
5305
+ function Sc(e, t, n) {
5306
5306
  return [{
5307
5307
  kind: "graph.node.create",
5308
5308
  node: {
@@ -5332,7 +5332,7 @@ function xc(e, t, n) {
5332
5332
  target: e
5333
5333
  }];
5334
5334
  }
5335
- function Sc(e, t, n) {
5335
+ function Cc(e, t, n) {
5336
5336
  return [{
5337
5337
  kind: "graph.node.create",
5338
5338
  node: {
@@ -5350,7 +5350,7 @@ function Sc(e, t, n) {
5350
5350
  target: e
5351
5351
  }];
5352
5352
  }
5353
- function Cc(e, t, n) {
5353
+ function wc(e, t, n) {
5354
5354
  return [{
5355
5355
  kind: "graph.node.create",
5356
5356
  node: {
@@ -5372,7 +5372,7 @@ function Cc(e, t, n) {
5372
5372
  target: e
5373
5373
  }];
5374
5374
  }
5375
- function wc(e, t, n) {
5375
+ function Tc(e, t, n) {
5376
5376
  return [{
5377
5377
  kind: "graph.node.create",
5378
5378
  node: n,
@@ -5380,7 +5380,7 @@ function wc(e, t, n) {
5380
5380
  target: e
5381
5381
  }];
5382
5382
  }
5383
- function Tc(e, t, n, r) {
5383
+ function Ec(e, t, n, r) {
5384
5384
  let i = r.name ?? n.displayName, a = n.type == "poll" ? {
5385
5385
  bindingId: t.bindingId,
5386
5386
  config: r.config,
@@ -5413,8 +5413,8 @@ function Tc(e, t, n, r) {
5413
5413
  target: e
5414
5414
  }];
5415
5415
  }
5416
- function Ec(e, t, n) {
5417
- let r = Fc(e, t)?.nodes;
5416
+ function Dc(e, t, n) {
5417
+ let r = Ic(e, t)?.nodes;
5418
5418
  if (r == null) return [];
5419
5419
  let i = new Set(n), a = n.flatMap((e) => {
5420
5420
  let n = r[e];
@@ -5438,8 +5438,8 @@ function Ec(e, t, n) {
5438
5438
  });
5439
5439
  return $(e, a);
5440
5440
  }
5441
- function Dc(e, t, n, r) {
5442
- let i = Fc(e, t)?.nodes[n];
5441
+ function Oc(e, t, n, r) {
5442
+ let i = Ic(e, t)?.nodes[n];
5443
5443
  if (i == null || !("inputs" in i)) return;
5444
5444
  let a = [];
5445
5445
  return i.name != r.name && a.push({
@@ -5465,8 +5465,8 @@ function Dc(e, t, n, r) {
5465
5465
  value: r.timeoutMs
5466
5466
  }), a;
5467
5467
  }
5468
- function Oc(e, t, n, r) {
5469
- let a = Fc(e, t)?.nodes[n];
5468
+ function kc(e, t, n, r) {
5469
+ let a = Ic(e, t)?.nodes[n];
5470
5470
  if (a == null || !("inputs" in a)) return;
5471
5471
  let o = [];
5472
5472
  for (let [e, s] of Object.entries(r)) {
@@ -5485,7 +5485,7 @@ function Oc(e, t, n, r) {
5485
5485
  }
5486
5486
  return $(e, o);
5487
5487
  }
5488
- function kc(e, t, n, r, i) {
5488
+ function Ac(e, t, n, r, i) {
5489
5489
  let a = (t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph)?.nodes[n];
5490
5490
  return a == null || !("inputs" in a) ? [] : $(e, [{
5491
5491
  kind: "graph.node.input.set",
@@ -5499,10 +5499,10 @@ function kc(e, t, n, r, i) {
5499
5499
  }
5500
5500
  }]);
5501
5501
  }
5502
- function Ac(e, t, n, r, i, a) {
5503
- let o = Fc(e, t)?.nodes[n];
5502
+ function jc(e, t, n, r, i, a) {
5503
+ let o = Ic(e, t)?.nodes[n];
5504
5504
  if (o == null || !("inputs" in o)) return;
5505
- 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 = jc(e.document);
5505
+ 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 = Mc(e.document);
5506
5506
  return c != null && l?.kind == "variable" && (u.get(c) ?? 0) == 1 ? l.target == i ? [] : [{
5507
5507
  before: l.target,
5508
5508
  bindingId: c,
@@ -5531,13 +5531,13 @@ function Ac(e, t, n, r, i, a) {
5531
5531
  }])];
5532
5532
  }
5533
5533
  function $(e, t) {
5534
- let n = jc(e.document), r = hc(e, t), i = jc(r.document);
5534
+ let n = Mc(e.document), r = gc(e, t), i = Mc(r.document);
5535
5535
  return [...t, ...[...n.keys()].flatMap((e) => i.has(e) || r.document.bindings[e]?.kind != "variable" ? [] : [{
5536
5536
  bindingId: e,
5537
5537
  kind: "binding.delete"
5538
5538
  }])];
5539
5539
  }
5540
- function jc(e) {
5540
+ function Mc(e) {
5541
5541
  let t = /* @__PURE__ */ new Map(), n = (e) => {
5542
5542
  t.set(e, (t.get(e) ?? 0) + 1);
5543
5543
  };
@@ -5548,7 +5548,7 @@ function jc(e) {
5548
5548
  }
5549
5549
  return t;
5550
5550
  }
5551
- function Mc(e, t, n) {
5551
+ function Nc(e, t, n) {
5552
5552
  let r = e.document.tasks[t];
5553
5553
  if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return r.executor.connectionId == n ? [] : [{
5554
5554
  before: r.executor.connectionId,
@@ -5557,7 +5557,7 @@ function Mc(e, t, n) {
5557
5557
  value: n
5558
5558
  }];
5559
5559
  }
5560
- function Nc(e, t, n, r) {
5560
+ function Pc(e, t, n, r) {
5561
5561
  let a = e.document.graph.nodes[n];
5562
5562
  if (a == null) return;
5563
5563
  let o = [];
@@ -5634,7 +5634,7 @@ function Nc(e, t, n, r) {
5634
5634
  }
5635
5635
  return o;
5636
5636
  }
5637
- function Pc(e, t, n, r) {
5637
+ function Fc(e, t, n, r) {
5638
5638
  let i = e.document.graph.nodes[n];
5639
5639
  if (i == null || i.kind != "poll" && i.kind != "integration") return;
5640
5640
  let a = e.document.bindings[i.bindingId];
@@ -5653,19 +5653,19 @@ function Pc(e, t, n, r) {
5653
5653
  value: r
5654
5654
  }];
5655
5655
  }
5656
- function Fc(e, t) {
5656
+ function Ic(e, t) {
5657
5657
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
5658
5658
  }
5659
- function Ic(e) {
5659
+ function Lc(e) {
5660
5660
  return Object.fromEntries(e.flatMap((e) => "handle" in e && Object.hasOwn(e, "value") ? [[e.handle, {
5661
5661
  kind: "value",
5662
5662
  value: e.value
5663
5663
  }]] : []));
5664
5664
  }
5665
- function Lc(e, t, n) {
5665
+ function Rc(e, t, n) {
5666
5666
  return e != null && Object.hasOwn(e, t) ? e[t] : n;
5667
5667
  }
5668
- function Rc(e, t, n, r) {
5668
+ function zc(e, t, n, r) {
5669
5669
  let a = (t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph)?.nodes[n];
5670
5670
  if (!(a?.kind != "task" || a.task == null || i(a.task.capabilities ?? [], r))) return [{
5671
5671
  kind: "graph.node.task.capabilities.set",
@@ -5675,6 +5675,6 @@ function Rc(e, t, n, r) {
5675
5675
  value: r
5676
5676
  }];
5677
5677
  }
5678
- var zc = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
5678
+ var Bc = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
5679
5679
  //#endregion
5680
- export { $ as cleanVariableBindings, a as connect, yc as createAgentTask, zc as createAuthoringId, wc as createBuiltinTrigger, _c as createCodeTask, xc as createCondition, bc as createLlmTask, vc as createManagedTask, Tc as createProviderTrigger, Sc as createValue, Cc as createWait, Ec as deleteNodes, o as disconnect, c as moduleImports, u as renameModule, l as replaceModuleSource, Rc as setCodeActions, Mc as setConnectorConnection, kc as setInputSources, Oc as setInputValues, Ac as setInputVariable, Pc as setTriggerConnection, Dc as updateSettings, Nc as updateTrigger };
5680
+ export { $ as cleanVariableBindings, a as connect, bc as createAgentTask, Bc as createAuthoringId, Tc as createBuiltinTrigger, vc as createCodeTask, Sc as createCondition, xc as createLlmTask, yc as createManagedTask, Ec as createProviderTrigger, Cc as createValue, wc as createWait, Dc as deleteNodes, o as disconnect, c as moduleImports, u as renameModule, l as replaceModuleSource, zc as setCodeActions, Nc as setConnectorConnection, Ac as setInputSources, kc as setInputValues, jc as setInputVariable, Fc as setTriggerConnection, Oc as updateSettings, Pc as updateTrigger };
@@ -1,4 +1,5 @@
1
1
  import type { ChangeOperation, FlowDocument, JsonValue, RevisionContent } from './flow-change.js';
2
+ export declare const currentFlowModelVersion = 3;
2
3
  /** Best-effort recovery for a parseable Revision envelope. Invalid collection entries are discarded. */
3
4
  export declare function repairRevisionEnvelope(value: unknown): RevisionContent;
4
5
  export declare function decodeFlowDocument(value: unknown): FlowDocument;
@@ -1,4 +1,5 @@
1
- export { changeOperationsSchema, decodeChangeOperations } from './flow-change-schema.js';
1
+ import { currentFlowModelVersion } from './flow-change-schema.js';
2
+ export { changeOperationsSchema, currentFlowModelVersion, decodeChangeOperations } from './flow-change-schema.js';
2
3
  export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
3
4
  readonly [key: string]: JsonValue;
4
5
  };
@@ -289,7 +290,7 @@ export interface CodeModule {
289
290
  }
290
291
  export interface RevisionContent {
291
292
  readonly document: FlowDocument;
292
- readonly modelVersion: 2;
293
+ readonly modelVersion: 2 | typeof currentFlowModelVersion;
293
294
  readonly modules: Readonly<Record<string, CodeModule>>;
294
295
  }
295
296
  export type GraphTarget = {