@oomol-lab/open-flow 0.1.0-beta.3 → 0.1.0-beta.4

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 (36) hide show
  1. package/dist/browser/DesignerIcon-DdfuH2jW.js +2066 -0
  2. package/dist/browser/createResourceDialog-4YQKl8lG.js +505 -0
  3. package/dist/browser/{esm-C2UUqIUP.js → esm-C9jQK70n.js} +1 -1
  4. package/dist/browser/flow-authoring-node.d.ts +3 -0
  5. package/dist/browser/flow-authoring.d.ts +1 -1
  6. package/dist/browser/flow-authoring.js +66 -46
  7. package/dist/browser/flow-change.d.ts +14 -1
  8. package/dist/browser/flow-notifications.d.ts +5 -0
  9. package/dist/browser/{diagnostics-SDCyFuxm.js → flowChanges-Bs-ZcJV8.js} +3963 -3591
  10. package/dist/browser/{flowRunInputEditorStore-CwvOiIiU.js → flowRunInputEditorStore-BYa8zFLC.js} +1 -1
  11. package/dist/browser/{flowWorkspace-BZ_eiQNR.js → flowWorkspace-BewofPeU.js} +35223 -35041
  12. package/dist/browser/{getPseudoElementBounds-ESJExRFX.js → getPseudoElementBounds-qDxSDwzN.js} +1813 -2328
  13. package/dist/browser/icons-DRoMXL5h.js +521 -0
  14. package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-CwMPjseS.js} +1 -1
  15. package/dist/browser/waitNotificationInputs-DtrPBwA1.js +26 -0
  16. package/dist/browser/workbench.css +1 -1
  17. package/dist/browser/workbench.d.ts +1 -0
  18. package/dist/browser/workbench.js +611 -536
  19. package/dist/browser/{workbenchSelect-B2s1HV-Y.js → workbenchSelect-CX8KtT7L.js} +483 -482
  20. package/dist/common/control-api-conformance.d.ts +1 -0
  21. package/dist/common/control-api-conformance.js +59 -0
  22. package/dist/common/control-api-errors.d.ts +4 -0
  23. package/dist/common/control-api.d.ts +22 -3
  24. package/dist/common/control-api.js +134 -73
  25. package/dist/common/flow-encoding.js +20 -8
  26. package/dist/common/flow-notifications.d.ts +5 -0
  27. package/dist/common/flow-semantics.d.ts +1 -0
  28. package/dist/common/flow-semantics.js +467 -381
  29. package/dist/common/run-events.js +2 -1
  30. package/dist/common/run-lifecycle.d.ts +17 -2
  31. package/dist/common/run-lifecycle.js +53 -2
  32. package/dist/common/scheduler.d.ts +64 -3
  33. package/dist/common/scheduler.js +417 -142
  34. package/dist/index.d.ts +1 -0
  35. package/package.json +1 -1
  36. package/dist/browser/createResourceDialog-BkZns-oZ.js +0 -504
@@ -237,7 +237,7 @@ function c(e, t) {
237
237
  }
238
238
  //#endregion
239
239
  //#region src/flow/common/nodeChanges.ts
240
- var l = "export default async function (input, context) {\n return { result: input.value }\n}\n";
240
+ var l = "export default async function (inputs, context) {\n return { result: inputs.value }\n}\n";
241
241
  function u(e, t, n, r = void 0, i = {
242
242
  inputs: [{
243
243
  handle: "value",
@@ -265,7 +265,7 @@ function u(e, t, n, r = void 0, i = {
265
265
  kind: "graph.node.create",
266
266
  node: {
267
267
  concurrency: 1,
268
- inputs: D(i.inputs),
268
+ inputs: O(i.inputs),
269
269
  kind: "task",
270
270
  name: n,
271
271
  task: {
@@ -288,7 +288,7 @@ function d(e, t, n) {
288
288
  kind: "graph.node.create",
289
289
  node: {
290
290
  concurrency: 1,
291
- inputs: D(n.inputs),
291
+ inputs: O(n.inputs),
292
292
  kind: "task",
293
293
  name: n.name,
294
294
  taskId: t.taskId
@@ -312,13 +312,13 @@ function f(e, t, n, r, i, a = {}) {
312
312
  type: "array"
313
313
  },
314
314
  nullable: !0,
315
- value: O(o, "messages", null)
315
+ value: k(o, "messages", null)
316
316
  },
317
317
  {
318
318
  handle: "input",
319
319
  jsonSchema: { type: "string" },
320
320
  nullable: !1,
321
- value: O(o, "input", "Alex")
321
+ value: k(o, "input", "Alex")
322
322
  },
323
323
  {
324
324
  handle: "template",
@@ -328,7 +328,7 @@ function f(e, t, n, r, i, a = {}) {
328
328
  type: "array"
329
329
  },
330
330
  nullable: !1,
331
- value: O(o, "template", [{
331
+ value: k(o, "template", [{
332
332
  content: "Hello, I'm {{input}}",
333
333
  role: "user"
334
334
  }])
@@ -337,7 +337,7 @@ function f(e, t, n, r, i, a = {}) {
337
337
  handle: "model",
338
338
  jsonSchema: { type: "object" },
339
339
  nullable: !1,
340
- value: O(o, "model", { model: "deepseek-v4-flash" })
340
+ value: k(o, "model", { model: "deepseek-v4-flash" })
341
341
  }
342
342
  ],
343
343
  name: n,
@@ -401,6 +401,24 @@ function m(e, t, n) {
401
401
  }];
402
402
  }
403
403
  function h(e, t, n) {
404
+ return [{
405
+ kind: "graph.node.create",
406
+ node: {
407
+ actions: ["continue"],
408
+ concurrency: 1,
409
+ inputs: { value: {
410
+ kind: "value",
411
+ value: null
412
+ } },
413
+ kind: "wait",
414
+ name: n,
415
+ prompt: n
416
+ },
417
+ nodeId: t,
418
+ target: e
419
+ }];
420
+ }
421
+ function g(e, t, n) {
404
422
  return [{
405
423
  kind: "graph.node.create",
406
424
  node: n,
@@ -408,7 +426,7 @@ function h(e, t, n) {
408
426
  target: e
409
427
  }];
410
428
  }
411
- function g(e, t, n, r) {
429
+ function _(e, t, n, r) {
412
430
  let i = r.name ?? n.displayName, a = n.type == "poll" ? {
413
431
  bindingId: t.bindingId,
414
432
  config: r.config,
@@ -441,8 +459,8 @@ function g(e, t, n, r) {
441
459
  target: e
442
460
  }];
443
461
  }
444
- function _(e, t, n) {
445
- let r = E(e, t)?.nodes;
462
+ function v(e, t, n) {
463
+ let r = D(e, t)?.nodes;
446
464
  if (r == null) return [];
447
465
  let i = new Set(n), a = n.flatMap((e) => {
448
466
  let n = r[e];
@@ -455,7 +473,7 @@ function _(e, t, n) {
455
473
  moduleId: n.task.moduleId
456
474
  }] : []];
457
475
  });
458
- if (t.kind == "subflow") return x(e, a);
476
+ if (t.kind == "subflow") return S(e, a);
459
477
  let o = new Set(n.flatMap((e) => {
460
478
  let t = r[e];
461
479
  return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
@@ -464,34 +482,34 @@ function _(e, t, n) {
464
482
  bindingId: t,
465
483
  kind: "binding.delete"
466
484
  });
467
- return x(e, a);
485
+ return S(e, a);
468
486
  }
469
- function v(e, t, n, r) {
470
- let i = E(e, t)?.nodes[n];
487
+ function y(e, t, n, r) {
488
+ let i = D(e, t)?.nodes[n];
471
489
  if (i == null || !("inputs" in i)) return;
472
490
  let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
473
- return k(t, n, {
491
+ return A(t, n, {
474
492
  ...c,
475
493
  ...r
476
494
  });
477
495
  }
478
- function y(e, t, n, r) {
479
- let i = E(e, t)?.nodes[n];
496
+ function b(e, t, n, r) {
497
+ let i = D(e, t)?.nodes[n];
480
498
  if (i == null || !("inputs" in i)) return;
481
499
  let a = { ...i.inputs };
482
500
  for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
483
501
  kind: "value",
484
502
  value: t
485
503
  };
486
- return x(e, k(t, n, {
504
+ return S(e, A(t, n, {
487
505
  ...i,
488
506
  inputs: a
489
507
  }));
490
508
  }
491
- function b(e, t, n, r, i, a) {
492
- let o = E(e, t)?.nodes[n];
509
+ function x(e, t, n, r, i, a) {
510
+ let o = D(e, t)?.nodes[n];
493
511
  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);
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);
495
513
  if (c != null && l?.kind == "variable" && (u.get(c) ?? 0) == 1) return l.target == i ? [] : [{
496
514
  binding: {
497
515
  kind: "variable",
@@ -517,28 +535,30 @@ function b(e, t, n, r, i, a) {
517
535
  },
518
536
  bindingId: a,
519
537
  kind: "binding.create"
520
- }, ...x(e, k(t, n, {
538
+ }, ...S(e, A(t, n, {
521
539
  ...o,
522
540
  inputs: d
523
541
  }))];
524
542
  }
525
- function x(e, t) {
526
- let n = S(e.document), r = c(e, t), i = S(r.document);
543
+ function S(e, t) {
544
+ let n = C(e.document), r = c(e, t), i = C(r.document);
527
545
  return [...t, ...[...n.keys()].flatMap((e) => i.has(e) || r.document.bindings[e]?.kind != "variable" ? [] : [{
528
546
  bindingId: e,
529
547
  kind: "binding.delete"
530
548
  }])];
531
549
  }
532
- function S(e) {
550
+ function C(e) {
533
551
  let t = /* @__PURE__ */ new Map(), n = (e) => {
534
552
  t.set(e, (t.get(e) ?? 0) + 1);
535
553
  };
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);
554
+ for (let t of [e.graph, ...Object.values(e.subflows).map((e) => e.graph)]) for (let e of Object.values(t.nodes)) {
555
+ if ((e.kind == "poll" || e.kind == "integration") && n(e.bindingId), !("inputs" in e)) continue;
556
+ let t = [...Object.values(e.inputs), ...e.kind == "wait" && e.notification != null ? Object.values(e.notification.inputs) : []];
557
+ for (let e of t) if (e.kind == "sources") for (let t of e.sources) t.kind == "binding" && n(t.bindingId);
538
558
  }
539
559
  return t;
540
560
  }
541
- function C(e, t, n) {
561
+ function w(e, t, n) {
542
562
  let r = e.document.tasks[t];
543
563
  if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
544
564
  kind: "task.replace",
@@ -552,7 +572,7 @@ function C(e, t, n) {
552
572
  taskId: t
553
573
  }];
554
574
  }
555
- function w(e, t, n, r) {
575
+ function T(e, t, n, r) {
556
576
  let i = e.document.graph.nodes[n];
557
577
  if (i == null) return;
558
578
  let a = {
@@ -599,9 +619,9 @@ function w(e, t, n, r) {
599
619
  config: r.config
600
620
  };
601
621
  }
602
- return k(t, n, o);
622
+ return A(t, n, o);
603
623
  }
604
- function T(e, t, n, r) {
624
+ function E(e, t, n, r) {
605
625
  let i = e.document.graph.nodes[n];
606
626
  if (i == null || i.kind != "poll" && i.kind != "integration") return;
607
627
  let a = e.document.bindings[i.bindingId];
@@ -622,19 +642,19 @@ function T(e, t, n, r) {
622
642
  kind: "binding.replace"
623
643
  }];
624
644
  }
625
- function E(e, t) {
645
+ function D(e, t) {
626
646
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
627
647
  }
628
- function D(e) {
648
+ function O(e) {
629
649
  return Object.fromEntries(e.flatMap((e) => "handle" in e && Object.hasOwn(e, "value") ? [[e.handle, {
630
650
  kind: "value",
631
651
  value: e.value
632
652
  }]] : []));
633
653
  }
634
- function O(e, t, n) {
654
+ function k(e, t, n) {
635
655
  return e != null && Object.hasOwn(e, t) ? e[t] : n;
636
656
  }
637
- function k(e, t, n) {
657
+ function A(e, t, n) {
638
658
  return [{
639
659
  kind: "graph.node.replace",
640
660
  node: n,
@@ -644,38 +664,38 @@ function k(e, t, n) {
644
664
  }
645
665
  //#endregion
646
666
  //#region src/flow/common/edgeChanges.ts
647
- function A(e, t, n) {
667
+ function j(e, t, n) {
648
668
  let r = {
649
669
  source: n.source,
650
670
  sourceHandle: n.sourceHandle,
651
671
  target: n.target,
652
672
  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, [{
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, [{
655
675
  edge: r,
656
676
  kind: "graph.edge.connect",
657
677
  target: t
658
678
  }]);
659
679
  }
660
- function j(e, t, n) {
680
+ function M(e, t, n) {
661
681
  let r = {
662
682
  source: n.source,
663
683
  sourceHandle: n.sourceHandle,
664
684
  target: n.target,
665
685
  targetHandle: n.targetHandle
666
- }, i = M(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
686
+ }, i = N(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
667
687
  return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
668
688
  edge: r,
669
689
  kind: "graph.edge.disconnect",
670
690
  target: t
671
691
  }];
672
692
  }
673
- function M(e, t) {
693
+ function N(e, t) {
674
694
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
675
695
  }
676
696
  //#endregion
677
697
  //#region src/flow/common/moduleChanges.ts
678
- async function N(e) {
698
+ async function P(e) {
679
699
  try {
680
700
  let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
681
701
  errorRecovery: !0,
@@ -691,7 +711,7 @@ async function N(e) {
691
711
  return [];
692
712
  }
693
713
  }
694
- function P(e, t, n) {
714
+ function F(e, t, n) {
695
715
  return [{
696
716
  imports: n,
697
717
  kind: "module.source.replace",
@@ -699,13 +719,13 @@ function P(e, t, n) {
699
719
  source: t
700
720
  }];
701
721
  }
702
- function F(e, t) {
722
+ function I(e, t) {
703
723
  return [{
704
724
  kind: "module.rename",
705
725
  moduleId: e,
706
726
  name: t
707
727
  }];
708
728
  }
709
- var I = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
729
+ var L = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
710
730
  //#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 };
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 };
@@ -63,6 +63,17 @@ export interface ValueNode extends GraphNodeBase {
63
63
  readonly kind: 'value';
64
64
  readonly values: readonly InputPort[];
65
65
  }
66
+ export type WaitAction = 'approve' | 'continue' | 'reject';
67
+ export interface WaitNode extends GraphNodeBase {
68
+ readonly actions: readonly ['continue'] | readonly ['approve', 'reject'];
69
+ readonly kind: 'wait';
70
+ readonly notification?: {
71
+ readonly inputs: Readonly<Record<string, InputMapping>>;
72
+ readonly messageHandle: string;
73
+ readonly taskId: string;
74
+ };
75
+ readonly prompt: string;
76
+ }
66
77
  export type ConditionOperator = '!=' | '<' | '<=' | '==' | '>' | '>=' | 'contains' | 'endsWith' | 'hasKey' | 'hasValue' | 'isEmpty' | 'isFalse' | 'isNotEmpty' | 'isNotNull' | 'isNull' | 'isTrue' | 'notContains' | 'notHasKey' | 'notHasValue' | 'startsWith';
67
78
  export interface ConditionExpression {
68
79
  readonly input: string;
@@ -109,9 +120,11 @@ export type TaskDefinition = InlineTaskDefinition | ManagedTaskDefinition;
109
120
  export type TaskNode = GraphNodeBase & {
110
121
  readonly kind: 'task';
111
122
  } & ({
123
+ readonly additionalInputs?: readonly InputPort[];
112
124
  readonly task: InlineTaskDefinition;
113
125
  readonly taskId?: never;
114
126
  } | {
127
+ readonly additionalInputs?: readonly InputPort[];
115
128
  readonly task?: never;
116
129
  readonly taskId: string;
117
130
  });
@@ -192,7 +205,7 @@ export type TriggerNode = (TriggerNodeBase & {
192
205
  };
193
206
  readonly kind: 'integration';
194
207
  });
195
- export type GraphNode = ConditionNode | SubflowNode | TaskNode | TriggerNode | ValueNode;
208
+ export type GraphNode = ConditionNode | SubflowNode | TaskNode | TriggerNode | ValueNode | WaitNode;
196
209
  export interface FlowDocument {
197
210
  readonly bindings: Readonly<Record<string, {
198
211
  readonly kind: 'connection' | 'variable';
@@ -12,4 +12,9 @@ export type FlowChangeEvent = {
12
12
  readonly kind: 'run.created';
13
13
  readonly runId: string;
14
14
  readonly version: 1;
15
+ } | {
16
+ readonly flowId: string;
17
+ readonly kind: 'run.changed';
18
+ readonly runId: string;
19
+ readonly version: 1;
15
20
  };