@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.
@@ -4546,16 +4546,16 @@ var qs = I(z([L({
4546
4546
  graph: vc,
4547
4547
  subflows: B(U, _c.extend({ graph: vc })),
4548
4548
  tasks: B(U, sc)
4549
- });
4550
- L({
4551
- modelVersion: H(2),
4549
+ }), Sc = L({
4550
+ modelVersion: z([H(2), H(3)]),
4552
4551
  document: xc,
4553
4552
  modules: B(U, bc)
4554
- }).extend({
4553
+ });
4554
+ Sc.extend({ modelVersion: H(3) }), Sc.extend({
4555
4555
  kind: H("open-flow-flow-revision"),
4556
4556
  version: H(1)
4557
4557
  });
4558
- var Sc = {
4558
+ var Cc = {
4559
4559
  "binding.create": {
4560
4560
  bindingId: U,
4561
4561
  binding: yc
@@ -4717,28 +4717,28 @@ var Sc = {
4717
4717
  before: U,
4718
4718
  value: U
4719
4719
  }
4720
- }, Cc = new Map(Object.entries(Sc).map(([e, t]) => [e, t instanceof j ? t : L({
4720
+ }, wc = new Map(Object.entries(Cc).map(([e, t]) => [e, t instanceof j ? t : L({
4721
4721
  kind: H(e),
4722
4722
  ...t
4723
- })])), wc = I(z([...Cc.values()])).min(1);
4724
- function Tc(e, t, n) {
4723
+ })])), Tc = I(z([...wc.values()])).min(1);
4724
+ function Ec(e, t, n) {
4725
4725
  try {
4726
4726
  return n(e);
4727
4727
  } catch (e) {
4728
4728
  throw e instanceof go ? TypeError(`operations[${t}]: ${e.issues.map((e) => `${e.path.join(".")}: ${e.message}`).join("; ")}`, { cause: e }) : e;
4729
4729
  }
4730
4730
  }
4731
- function Ec(e, t) {
4732
- let { kind: n } = Tc(e, t, L({ kind: U }).parse), r = Cc.get(n);
4731
+ function Dc(e, t) {
4732
+ let { kind: n } = Ec(e, t, L({ kind: U }).parse), r = wc.get(n);
4733
4733
  if (r == null) throw TypeError(`operations[${t}]: Unknown operation ${JSON.stringify(n)}.`);
4734
- return Tc(e, t, r.parse);
4734
+ return Ec(e, t, r.parse);
4735
4735
  }
4736
- function Dc(e) {
4737
- let t = e == null ? wc : Cc.get(e);
4736
+ function Oc(e) {
4737
+ let t = e == null ? Tc : wc.get(e);
4738
4738
  if (t == null) throw TypeError(`Unknown operation ${JSON.stringify(e)}.`);
4739
4739
  return fo(t, { io: "input" });
4740
4740
  }
4741
- function Oc(e) {
4741
+ function kc(e) {
4742
4742
  let t = e.trim();
4743
4743
  if (t.length == 0) return "empty";
4744
4744
  if (t.length > 80) return "tooLong";
@@ -4750,8 +4750,8 @@ function Oc(e) {
4750
4750
  }
4751
4751
  //#endregion
4752
4752
  //#region src/flow/common/nodeChanges.ts
4753
- var kc = "export default async function (inputs, context) {\n return { result: inputs.value }\n}\n";
4754
- function Ac(e, t, n, r = void 0, i = {
4753
+ var Ac = "export default async function (inputs, context) {\n return { result: inputs.value }\n}\n";
4754
+ function jc(e, t, n, r = void 0, i = {
4755
4755
  inputs: [{
4756
4756
  handle: "value",
4757
4757
  jsonSchema: {},
@@ -4769,7 +4769,7 @@ function Ac(e, t, n, r = void 0, i = {
4769
4769
  module: {
4770
4770
  ...r ?? {
4771
4771
  imports: [],
4772
- source: kc
4772
+ source: Ac
4773
4773
  },
4774
4774
  name: n
4775
4775
  },
@@ -4777,7 +4777,7 @@ function Ac(e, t, n, r = void 0, i = {
4777
4777
  }, {
4778
4778
  kind: "graph.node.create",
4779
4779
  node: {
4780
- inputs: zc(i.inputs),
4780
+ inputs: Bc(i.inputs),
4781
4781
  kind: "task",
4782
4782
  name: n,
4783
4783
  task: {
@@ -4792,7 +4792,7 @@ function Ac(e, t, n, r = void 0, i = {
4792
4792
  target: e
4793
4793
  }];
4794
4794
  }
4795
- function jc(e, t, n) {
4795
+ function Mc(e, t, n) {
4796
4796
  return [{
4797
4797
  kind: "task.create",
4798
4798
  task: n,
@@ -4800,7 +4800,7 @@ function jc(e, t, n) {
4800
4800
  }, {
4801
4801
  kind: "graph.node.create",
4802
4802
  node: {
4803
- inputs: zc(n.inputs),
4803
+ inputs: Bc(n.inputs),
4804
4804
  kind: "task",
4805
4805
  name: n.name,
4806
4806
  taskId: t.taskId
@@ -4809,9 +4809,9 @@ function jc(e, t, n) {
4809
4809
  target: e
4810
4810
  }];
4811
4811
  }
4812
- function Mc(e, t, n, r, i, a = {}) {
4812
+ function Nc(e, t, n, r, i, a = {}) {
4813
4813
  let o = a.inputs ?? {};
4814
- return jc(e, t, {
4814
+ return Mc(e, t, {
4815
4815
  executor: {
4816
4816
  kind: "llm",
4817
4817
  mode: r
@@ -4824,13 +4824,13 @@ function Mc(e, t, n, r, i, a = {}) {
4824
4824
  type: "array"
4825
4825
  },
4826
4826
  nullable: !0,
4827
- value: Bc(o, "messages", null)
4827
+ value: Vc(o, "messages", null)
4828
4828
  },
4829
4829
  {
4830
4830
  handle: "input",
4831
4831
  jsonSchema: { type: "string" },
4832
4832
  nullable: !1,
4833
- value: Bc(o, "input", "Alex")
4833
+ value: Vc(o, "input", "Alex")
4834
4834
  },
4835
4835
  {
4836
4836
  handle: "template",
@@ -4840,7 +4840,7 @@ function Mc(e, t, n, r, i, a = {}) {
4840
4840
  type: "array"
4841
4841
  },
4842
4842
  nullable: !1,
4843
- value: Bc(o, "template", [{
4843
+ value: Vc(o, "template", [{
4844
4844
  content: "Hello, I'm {{input}}",
4845
4845
  role: "user"
4846
4846
  }])
@@ -4849,7 +4849,7 @@ function Mc(e, t, n, r, i, a = {}) {
4849
4849
  handle: "model",
4850
4850
  jsonSchema: { type: "object" },
4851
4851
  nullable: !1,
4852
- value: Bc(o, "model", { model: "deepseek-v4-flash" })
4852
+ value: Vc(o, "model", { model: "deepseek-v4-flash" })
4853
4853
  }
4854
4854
  ],
4855
4855
  name: n,
@@ -4862,7 +4862,7 @@ function Mc(e, t, n, r, i, a = {}) {
4862
4862
  }]
4863
4863
  });
4864
4864
  }
4865
- function Nc(e, t, n) {
4865
+ function Pc(e, t, n) {
4866
4866
  return [{
4867
4867
  kind: "graph.node.create",
4868
4868
  node: {
@@ -4892,7 +4892,7 @@ function Nc(e, t, n) {
4892
4892
  target: e
4893
4893
  }];
4894
4894
  }
4895
- function Pc(e, t, n) {
4895
+ function Fc(e, t, n) {
4896
4896
  return [{
4897
4897
  kind: "graph.node.create",
4898
4898
  node: {
@@ -4910,7 +4910,7 @@ function Pc(e, t, n) {
4910
4910
  target: e
4911
4911
  }];
4912
4912
  }
4913
- function Fc(e, t, n) {
4913
+ function Ic(e, t, n) {
4914
4914
  return [{
4915
4915
  kind: "graph.node.create",
4916
4916
  node: {
@@ -4932,7 +4932,7 @@ function Fc(e, t, n) {
4932
4932
  target: e
4933
4933
  }];
4934
4934
  }
4935
- function Ic(e, t, n) {
4935
+ function Lc(e, t, n) {
4936
4936
  return [{
4937
4937
  kind: "graph.node.create",
4938
4938
  node: {
@@ -4954,7 +4954,7 @@ function Ic(e, t, n) {
4954
4954
  target: e
4955
4955
  }];
4956
4956
  }
4957
- function Lc(e, t, n) {
4957
+ function Rc(e, t, n) {
4958
4958
  return [{
4959
4959
  kind: "graph.node.create",
4960
4960
  node: n,
@@ -4962,7 +4962,7 @@ function Lc(e, t, n) {
4962
4962
  target: e
4963
4963
  }];
4964
4964
  }
4965
- function Rc(e, t, n, r) {
4965
+ function zc(e, t, n, r) {
4966
4966
  let i = r.name ?? n.displayName, a = n.type == "poll" ? {
4967
4967
  bindingId: t.bindingId,
4968
4968
  config: r.config,
@@ -4995,74 +4995,74 @@ function Rc(e, t, n, r) {
4995
4995
  target: e
4996
4996
  }];
4997
4997
  }
4998
- function zc(e) {
4998
+ function Bc(e) {
4999
4999
  return Object.fromEntries(e.flatMap((e) => "handle" in e && Object.hasOwn(e, "value") ? [[e.handle, {
5000
5000
  kind: "value",
5001
5001
  value: e.value
5002
5002
  }]] : []));
5003
5003
  }
5004
- function Bc(e, t, n) {
5004
+ function Vc(e, t, n) {
5005
5005
  return e != null && Object.hasOwn(e, t) ? e[t] : n;
5006
5006
  }
5007
5007
  //#endregion
5008
5008
  //#region src/control/common/draftOperations.ts
5009
- var J = M().min(1), Vc = Gs(), Hc = R({
5009
+ var J = M().min(1), Hc = Gs(), Uc = R({
5010
5010
  kind: H("graph.trigger.create"),
5011
5011
  nodeId: J,
5012
5012
  bindingId: J,
5013
5013
  key: J,
5014
5014
  connectionId: J.optional(),
5015
5015
  name: J.optional(),
5016
- config: B(J, Vc),
5016
+ config: B(J, Hc),
5017
5017
  schedule: qs.readonly().optional()
5018
5018
  });
5019
- function Uc(e) {
5019
+ function Wc(e) {
5020
5020
  return Ks(e), I(ls()).min(1).parse(e).map((e, t) => {
5021
- let { kind: n } = Tc(e, t, L({ kind: J }).parse);
5022
- return n == "graph.trigger.create" ? Tc(e, t, Hc.parse) : Ec(e, t);
5021
+ let { kind: n } = Ec(e, t, L({ kind: J }).parse);
5022
+ return n == "graph.trigger.create" ? Ec(e, t, Uc.parse) : Dc(e, t);
5023
5023
  });
5024
5024
  }
5025
- function Wc(e) {
5026
- if (e != null && e != "graph.trigger.create") return Dc(e);
5027
- let t = fo(Hc);
5025
+ function Gc(e) {
5026
+ if (e != null && e != "graph.trigger.create") return Oc(e);
5027
+ let t = fo(Uc);
5028
5028
  if (e == "graph.trigger.create") return t;
5029
- let n = Dc();
5029
+ let n = Oc();
5030
5030
  return {
5031
5031
  ...n,
5032
5032
  items: { anyOf: [n.items, t] }
5033
5033
  };
5034
5034
  }
5035
- function Gc(e, t) {
5035
+ function Kc(e, t) {
5036
5036
  return e.flatMap((e) => {
5037
5037
  if (e.kind != "graph.trigger.create") return [e];
5038
5038
  let n = t(e.key);
5039
5039
  if (n.type != "poll" && e.schedule != null) throw Error("Only Poll triggers accept a schedule.");
5040
- return Rc({ kind: "flow" }, e, n, e);
5040
+ return zc({ kind: "flow" }, e, n, e);
5041
5041
  });
5042
5042
  }
5043
5043
  //#endregion
5044
5044
  //#region src/control/common/eventSourceSchemas.ts
5045
- var Kc = M().min(1).max(256), qc = M().regex(/^[a-z][a-z0-9_.]{0,127}$/), Jc = M().trim().min(1).max(128), Yc = M().min(1).max(256), Xc = R({
5045
+ var qc = M().min(1).max(256), Jc = M().regex(/^[a-z][a-z0-9_.]{0,127}$/), Yc = M().trim().min(1).max(128), Xc = M().min(1).max(256), Zc = R({
5046
5046
  version: H(1),
5047
- name: Jc,
5048
- connectionId: Kc,
5049
- teamId: Kc.nullable(),
5050
- verificationToken: Yc,
5051
- encryptKey: Yc,
5052
- eventTypes: I(qc).min(1).max(200).refine((e) => new Set(e).size == e.length),
5047
+ name: Yc,
5048
+ connectionId: qc,
5049
+ teamId: qc.nullable(),
5050
+ verificationToken: Xc,
5051
+ encryptKey: Xc,
5052
+ eventTypes: I(Jc).min(1).max(200).refine((e) => new Set(e).size == e.length),
5053
5053
  manageSubscriptions: F()
5054
- }), Zc = R({
5054
+ }), Qc = R({
5055
5055
  version: H(1),
5056
5056
  expectedRevision: is().positive(),
5057
- name: Jc,
5057
+ name: Yc,
5058
5058
  enabled: F(),
5059
- eventTypes: I(qc).min(1).max(200).refine((e) => new Set(e).size == e.length),
5060
- verificationToken: Yc.optional(),
5061
- encryptKey: Yc.optional()
5062
- }), Qc = R({
5059
+ eventTypes: I(Jc).min(1).max(200).refine((e) => new Set(e).size == e.length),
5060
+ verificationToken: Xc.optional(),
5061
+ encryptKey: Xc.optional()
5062
+ }), $c = R({
5063
5063
  version: H(1),
5064
5064
  expectedRevision: is().positive()
5065
- }), Y = { kind: "flow" }, $c = {
5065
+ }), Y = { kind: "flow" }, el = {
5066
5066
  manual: "A Manual start node.",
5067
5067
  webhook: "A Webhook start node.",
5068
5068
  cron: "An hourly scheduled start node.",
@@ -5078,28 +5078,28 @@ var Kc = M().min(1).max(256), qc = M().regex(/^[a-z][a-z0-9_.]{0,127}$/), Jc = M
5078
5078
  "llm-chat": "An LLM chat Task and its node; configure a model available in the deployment.",
5079
5079
  "llm-json": "An LLM JSON Task and its node; configure a model available in the deployment.",
5080
5080
  "poll-notification": "Gmail events → JavaScript text formatting → Connector notification. Replace connection/action IDs and match the notification input ports."
5081
- }, el = Object.keys($c).map((e) => ({
5081
+ }, tl = Object.keys(el).map((e) => ({
5082
5082
  name: e,
5083
- description: $c[e]
5083
+ description: el[e]
5084
5084
  }));
5085
- function tl(e) {
5085
+ function nl(e) {
5086
5086
  let t;
5087
5087
  switch (e) {
5088
5088
  case "manual":
5089
- t = Lc(Y, "start", {
5089
+ t = Rc(Y, "start", {
5090
5090
  kind: "manual",
5091
5091
  name: "Start"
5092
5092
  });
5093
5093
  break;
5094
5094
  case "webhook":
5095
- t = Lc(Y, "start", {
5095
+ t = Rc(Y, "start", {
5096
5096
  kind: "webhook",
5097
5097
  name: "Webhook",
5098
5098
  bodyFields: []
5099
5099
  });
5100
5100
  break;
5101
5101
  case "cron":
5102
- t = Lc(Y, "start", {
5102
+ t = Rc(Y, "start", {
5103
5103
  kind: "cron",
5104
5104
  name: "Schedule",
5105
5105
  cronTimes: [{
@@ -5135,7 +5135,7 @@ function tl(e) {
5135
5135
  }];
5136
5136
  break;
5137
5137
  case "agent":
5138
- t = jc(Y, {
5138
+ t = Mc(Y, {
5139
5139
  nodeId: "agent",
5140
5140
  taskId: "agent-task"
5141
5141
  }, {
@@ -5166,7 +5166,7 @@ function tl(e) {
5166
5166
  });
5167
5167
  break;
5168
5168
  case "connector":
5169
- t = jc(Y, {
5169
+ t = Mc(Y, {
5170
5170
  nodeId: "notify",
5171
5171
  taskId: "notify-task"
5172
5172
  }, {
@@ -5186,7 +5186,7 @@ function tl(e) {
5186
5186
  });
5187
5187
  break;
5188
5188
  case "code":
5189
- t = Ac(Y, {
5189
+ t = jc(Y, {
5190
5190
  nodeId: "format",
5191
5191
  moduleId: "format-module"
5192
5192
  }, "Format", {
@@ -5214,29 +5214,29 @@ function tl(e) {
5214
5214
  });
5215
5215
  break;
5216
5216
  case "condition":
5217
- t = Nc(Y, "condition", "Condition");
5217
+ t = Pc(Y, "condition", "Condition");
5218
5218
  break;
5219
5219
  case "value":
5220
- t = Pc(Y, "value", "Value");
5220
+ t = Fc(Y, "value", "Value");
5221
5221
  break;
5222
5222
  case "approval":
5223
- t = Ic(Y, "approval", "Approve?");
5223
+ t = Lc(Y, "approval", "Approve?");
5224
5224
  break;
5225
5225
  case "wait":
5226
- t = Fc(Y, "wait", "Continue?");
5226
+ t = Ic(Y, "wait", "Continue?");
5227
5227
  break;
5228
5228
  case "llm-chat":
5229
5229
  case "llm-json":
5230
- t = Mc(Y, {
5230
+ t = Nc(Y, {
5231
5231
  nodeId: "llm",
5232
5232
  taskId: "llm-task"
5233
5233
  }, "LLM", e == "llm-chat" ? "chat" : "json", "Generated response.");
5234
5234
  break;
5235
5235
  case "poll-notification":
5236
5236
  t = [
5237
- ...tl("poll").operations,
5238
- ...tl("code").operations,
5239
- ...tl("connector").operations,
5237
+ ...nl("poll").operations,
5238
+ ...nl("code").operations,
5239
+ ...nl("connector").operations,
5240
5240
  {
5241
5241
  kind: "graph.edge.connect",
5242
5242
  target: Y,
@@ -5300,24 +5300,24 @@ function tl(e) {
5300
5300
  }
5301
5301
  //#endregion
5302
5302
  //#region src/control/common/requests.ts
5303
- var nl = Gs(), X = M().min(1), Z = H(1), rl = X.refine((e) => e == e.trim() && Oc(e) == null, "Flow name is invalid."), il = B(M(), B(M(), nl)), al = R({
5303
+ var rl = Gs(), X = M().min(1), Z = H(1), il = X.refine((e) => e == e.trim() && kc(e) == null, "Flow name is invalid."), al = B(M(), B(M(), rl)), ol = R({
5304
5304
  nodeId: X,
5305
- outputs: B(M(), nl)
5305
+ outputs: B(M(), rl)
5306
5306
  }), Q = {
5307
- createEventSource: Xc,
5308
- updateEventSource: Zc,
5309
- eventSourceRevision: Qc,
5307
+ createEventSource: Zc,
5308
+ updateEventSource: Qc,
5309
+ eventSourceRevision: $c,
5310
5310
  createFlow: R({
5311
- name: rl,
5311
+ name: il,
5312
5312
  version: Z
5313
5313
  }),
5314
5314
  renameFlow: R({
5315
- name: rl,
5315
+ name: il,
5316
5316
  version: Z
5317
5317
  }),
5318
5318
  changeDraft: R({
5319
5319
  expectedRevisionId: X,
5320
- operations: I(nl).min(1),
5320
+ operations: I(rl).min(1),
5321
5321
  version: Z
5322
5322
  }),
5323
5323
  repairDraft: R({
@@ -5331,7 +5331,7 @@ var nl = Gs(), X = M().min(1), Z = H(1), rl = X.refine((e) => e == e.trim() && O
5331
5331
  }),
5332
5332
  updatePresentation: R({
5333
5333
  expectedRevision: is().positive(),
5334
- value: B(M(), nl),
5334
+ value: B(M(), rl),
5335
5335
  version: Z
5336
5336
  }),
5337
5337
  checkFlow: R({
@@ -5349,14 +5349,14 @@ var nl = Gs(), X = M().min(1), Z = H(1), rl = X.refine((e) => e == e.trim() && O
5349
5349
  }),
5350
5350
  createDraftRun: R({
5351
5351
  engineContract: X,
5352
- inputs: il,
5353
- trigger: al,
5352
+ inputs: al,
5353
+ trigger: ol,
5354
5354
  version: H(2)
5355
5355
  }),
5356
5356
  createLiveRun: R({
5357
5357
  publicationId: X,
5358
- inputs: il,
5359
- trigger: al,
5358
+ inputs: al,
5359
+ trigger: ol,
5360
5360
  version: H(2)
5361
5361
  }),
5362
5362
  resolveWait: R({
@@ -5373,7 +5373,7 @@ var nl = Gs(), X = M().min(1), Z = H(1), rl = X.refine((e) => e == e.trim() && O
5373
5373
  function $(e) {
5374
5374
  return (t) => e.parse(t);
5375
5375
  }
5376
- var ol = {
5376
+ var sl = {
5377
5377
  createEventSource: $(Q.createEventSource),
5378
5378
  updateEventSource: $(Q.updateEventSource),
5379
5379
  eventSourceRevision: $(Q.eventSourceRevision),
@@ -5383,7 +5383,7 @@ var ol = {
5383
5383
  let t = Q.changeDraft.parse(e);
5384
5384
  return {
5385
5385
  ...t,
5386
- operations: Uc(t.operations)
5386
+ operations: Wc(t.operations)
5387
5387
  };
5388
5388
  },
5389
5389
  repairDraft: $(Q.repairDraft),
@@ -5398,15 +5398,15 @@ var ol = {
5398
5398
  putVariable: $(Q.putVariable),
5399
5399
  versionOnly: $(Q.versionOnly)
5400
5400
  };
5401
- function sl(e) {
5401
+ function cl(e) {
5402
5402
  let t = fo(Q[e]);
5403
5403
  return e == "changeDraft" ? {
5404
5404
  ...t,
5405
5405
  properties: {
5406
5406
  ...t.properties,
5407
- operations: Wc()
5407
+ operations: Gc()
5408
5408
  }
5409
5409
  } : t;
5410
5410
  }
5411
5411
  //#endregion
5412
- export { tl as authoringExample, el as authoringExamples, sl as controlRequestSchema, ol as controlRequests, Uc as decodeDraftOperations, Wc as draftOperationsSchema, Gc as resolveDraftOperations };
5412
+ export { nl as authoringExample, tl as authoringExamples, cl as controlRequestSchema, sl as controlRequests, Wc as decodeDraftOperations, Gc as draftOperationsSchema, Kc as resolveDraftOperations };
@@ -6,6 +6,8 @@ export declare function digestBytes(bytes: Uint8Array): Promise<string>;
6
6
  export declare function canonicalPorts(value: readonly (InputPort | Port | Group)[]): JsonValue;
7
7
  export declare function canonicalOutputs(value: readonly (OutputMapping & Port)[]): JsonValue;
8
8
  export declare function canonicalGraph(value: Graph): JsonValue;
9
+ export declare function canonicalRevisionGraph(content: RevisionContent, graph: Graph): JsonValue;
10
+ export declare function canonicalRevisionOutputs(content: RevisionContent, value: readonly (OutputMapping & Port)[], graph: Graph): JsonValue;
9
11
  export declare function canonicalTask(task: FlowDocument['tasks'][string]): JsonValue;
10
12
  export declare function triggerRuntimeJson(trigger: TriggerNode): string;
11
13
  export declare function canonicalDocument(document: FlowDocument): JsonValue;