@oomol-lab/open-flow 0.1.0-beta.50 → 0.1.0-beta.52

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 (44) hide show
  1. package/dist/browser/{createResourceDialog-CSltk-qY.js → createResourceDialog-BsaBMf7_.js} +2 -1
  2. package/dist/browser/flow-authoring-node.d.ts +3 -1
  3. package/dist/browser/flow-authoring.js +82 -3
  4. package/dist/browser/flow-change-schema.d.ts +1 -1
  5. package/dist/browser/flow-change.d.ts +15 -2
  6. package/dist/browser/flow-change.js +81 -3
  7. package/dist/browser/{flowChanges-DbYrpHnS.js → flowChanges-DtraMpva.js} +3858 -1921
  8. package/dist/browser/{flowWorkspace-CjwpbVBR.js → flowWorkspace-DLgti4Lk.js} +1353 -513
  9. package/dist/browser/{workbenchSelect-oVujN2z6.js → icons-0s-Q_3lp.js} +92 -35
  10. package/dist/browser/licenses.md +204 -0
  11. package/dist/browser/preview.css +302 -179
  12. package/dist/browser/preview.js +4829 -2198
  13. package/dist/browser/theme.css +2 -0
  14. package/dist/browser/ui-hostNavigationActions.d.ts +13 -0
  15. package/dist/browser/ui-hostTooltip.d.ts +8 -0
  16. package/dist/browser/ui-logo.d.ts +5 -0
  17. package/dist/browser/ui.css +102 -8
  18. package/dist/browser/ui.d.ts +3 -0
  19. package/dist/browser/ui.js +176 -11
  20. package/dist/browser/workbench-contract.d.ts +5 -11
  21. package/dist/browser/workbench.css +366 -200
  22. package/dist/browser/workbench.d.ts +1 -1
  23. package/dist/browser/workbench.js +1154 -379
  24. package/dist/browser/workbenchSelect-BqUPacsr.js +31 -0
  25. package/dist/common/authoringExamples.d.ts +4 -2
  26. package/dist/common/control-api-conformance.js +129 -11
  27. package/dist/common/control-api.d.ts +38 -5
  28. package/dist/common/control-api.js +198 -12
  29. package/dist/common/control-requests.d.ts +4 -0
  30. package/dist/common/control-requests.js +1320 -67
  31. package/dist/common/flow-encoding.js +64 -5
  32. package/dist/common/flow-semantics.js +823 -316
  33. package/dist/common/integration-trigger.js +39 -1
  34. package/dist/common/mcp.js +129 -11
  35. package/dist/common/openapi.d.ts +53 -0
  36. package/dist/common/openapi.js +10390 -0
  37. package/dist/common/poll-trigger.js +39 -1
  38. package/dist/common/provider-triggers.js +39 -1
  39. package/dist/common/run-events.js +26 -1
  40. package/dist/common/scheduler.d.ts +4 -1
  41. package/dist/common/scheduler.js +122 -6
  42. package/dist/common/trigger-contract.d.ts +2 -0
  43. package/dist/common/webhook-trigger.js +39 -1
  44. package/package.json +5 -1
@@ -1,5 +1,6 @@
1
1
  import { i as useTranslate } from "./main-BPABKzwN.js";
2
- import { C as FieldDescription, E as FieldLabel, Fr as Button, Mn as Input, S as Field, T as FieldGroup, a as DialogContent, c as DialogHeader, i as DialogClose, l as DialogTitle, n as Icon, r as Dialog, s as DialogFooter, t as WorkbenchSelect, w as FieldError, x as Spinner } from "./workbenchSelect-oVujN2z6.js";
2
+ import { C as FieldError, Pr as Button, S as FieldDescription, T as FieldLabel, b as Spinner, c as DialogTitle, i as DialogContent, jn as Input, n as Dialog, o as DialogFooter, r as DialogClose, s as DialogHeader, t as Icon, w as FieldGroup, x as Field } from "./icons-0s-Q_3lp.js";
3
+ import { t as WorkbenchSelect } from "./workbenchSelect-BqUPacsr.js";
3
4
  import { useEffect, useRef, useState } from "react";
4
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
6
  //#region src/workbench/browser/runtime/shell/createResourceDialog.tsx
@@ -17,6 +17,8 @@ interface TriggerSettingsBase {
17
17
  }
18
18
  export type TriggerSettings = (TriggerSettingsBase & {
19
19
  readonly kind: 'manual';
20
+ }) | (TriggerSettingsBase & {
21
+ readonly kind: 'error';
20
22
  }) | (TriggerSettingsBase & {
21
23
  readonly bodyFields: Extract<TriggerNode, {
22
24
  readonly kind: 'webhook';
@@ -71,7 +73,7 @@ export declare function createApproval(target: Extract<GraphTarget, {
71
73
  export declare function createBuiltinTrigger(target: Extract<GraphTarget, {
72
74
  readonly kind: 'flow';
73
75
  }>, nodeId: string, node: Extract<TriggerNode, {
74
- readonly kind: 'cron' | 'manual' | 'webhook';
76
+ readonly kind: 'error' | 'cron' | 'manual' | 'webhook';
75
77
  }>): readonly ChangeOperation[];
76
78
  export declare function createProviderTrigger(target: Extract<GraphTarget, {
77
79
  readonly kind: 'flow';
@@ -128,6 +128,15 @@ function rename(moduleId, before, name) {
128
128
  }];
129
129
  }
130
130
  //#endregion
131
+ //#region src/openapi/common/authBindings.ts
132
+ /** Never allow credentials to enter a Revision as literal node inputs. */
133
+ function assertOpenApiAuthBindings(document) {
134
+ for (const graph of [document.graph, ...Object.values(document.subflows).map((subflow) => subflow.graph)]) for (const node of Object.values(graph.nodes)) {
135
+ if (node.kind != "task" || node.taskId == null || document.tasks[node.taskId]?.executor.kind != "openapi") continue;
136
+ for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && (mapping.kind == "value" || mapping.kind == "sources" && mapping.sources.some((source) => source.kind == "flow"))) throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
137
+ }
138
+ }
139
+ //#endregion
131
140
  //#region src/flow/common/inputValue.ts
132
141
  /** Converts explicit user values at authoring boundaries, never persisted legacy data. */
133
142
  function inputValues(values) {
@@ -5847,6 +5856,24 @@ var managed = object({
5847
5856
  action: text,
5848
5857
  connectionId: text.optional()
5849
5858
  }),
5859
+ object({
5860
+ kind: literal("openapi"),
5861
+ sourceUrl: text,
5862
+ method: text,
5863
+ path: text,
5864
+ serverUrl: text,
5865
+ document: json,
5866
+ auth: array(object({
5867
+ id: text,
5868
+ type: _enum([
5869
+ "bearer",
5870
+ "basic",
5871
+ "apiKey"
5872
+ ]),
5873
+ name: text.optional(),
5874
+ in: _enum(["header", "query"]).optional()
5875
+ }))
5876
+ }),
5850
5877
  object({
5851
5878
  kind: literal("llm"),
5852
5879
  mode: _enum(["chat", "json"])
@@ -5963,6 +5990,7 @@ var endpoint = object({
5963
5990
  ])),
5964
5991
  successStatus: number()
5965
5992
  });
5993
+ var sourceFlowIds = array(text.min(1)).refine((ids) => new Set(ids).size === ids.length, "Duplicate source Flow ID.");
5966
5994
  var trigger = {
5967
5995
  name: text,
5968
5996
  description: text.optional(),
@@ -6020,6 +6048,11 @@ var node = union([
6020
6048
  ...trigger,
6021
6049
  kind: literal("manual")
6022
6050
  }),
6051
+ strictObject({
6052
+ ...trigger,
6053
+ kind: literal("error"),
6054
+ sourceFlowIds: sourceFlowIds.optional()
6055
+ }),
6023
6056
  object({
6024
6057
  ...trigger,
6025
6058
  kind: literal("webhook"),
@@ -6091,7 +6124,11 @@ var document = object({
6091
6124
  tasks: record(text, managed)
6092
6125
  });
6093
6126
  object({
6094
- modelVersion: union([literal(2), literal(4)]),
6127
+ modelVersion: union([
6128
+ literal(2),
6129
+ literal(4),
6130
+ literal(5)
6131
+ ]),
6095
6132
  document,
6096
6133
  modules: record(text, module)
6097
6134
  }).extend({
@@ -6099,6 +6136,11 @@ object({
6099
6136
  version: literal(1)
6100
6137
  });
6101
6138
  var shapes = {
6139
+ "graph.trigger.sources.set": {
6140
+ nodeId: text,
6141
+ before: sourceFlowIds.optional(),
6142
+ value: sourceFlowIds.optional()
6143
+ },
6102
6144
  "binding.create": {
6103
6145
  bindingId: text,
6104
6146
  binding
@@ -6252,6 +6294,11 @@ var shapes = {
6252
6294
  before: text.optional(),
6253
6295
  value: text.optional()
6254
6296
  },
6297
+ "task.openapi.set": {
6298
+ taskId: text,
6299
+ before: managed,
6300
+ value: managed
6301
+ },
6255
6302
  "task.agent.set": {
6256
6303
  taskId: text,
6257
6304
  before: managed,
@@ -6487,6 +6534,25 @@ function applyFlowChanges(content, operations) {
6487
6534
  const document = { ...content.document };
6488
6535
  const modules = { ...content.modules };
6489
6536
  for (const operation of operations) switch (operation.kind) {
6537
+ case "graph.trigger.sources.set": {
6538
+ const graph = document.graph;
6539
+ const node = graph.nodes[operation.nodeId];
6540
+ if (node?.kind != "error") invalid("The Flow Error node does not exist.");
6541
+ if (!dequal(node.sourceFlowIds, operation.before)) invalid("The Flow Error node’s sources changed before this operation was applied.");
6542
+ const { sourceFlowIds: _, ...base } = node;
6543
+ const updated = operation.value == null ? base : {
6544
+ ...base,
6545
+ sourceFlowIds: operation.value
6546
+ };
6547
+ document.graph = {
6548
+ ...graph,
6549
+ nodes: {
6550
+ ...graph.nodes,
6551
+ [operation.nodeId]: updated
6552
+ }
6553
+ };
6554
+ break;
6555
+ }
6490
6556
  case "binding.create":
6491
6557
  if (document.bindings[operation.bindingId] != null) invalid("A Binding with this ID already exists.");
6492
6558
  document.bindings = {
@@ -6577,6 +6643,7 @@ function applyFlowChanges(content, operations) {
6577
6643
  const graph = selectedGraph(document, operation.target);
6578
6644
  if (graph.nodes[operation.nodeId] != null) invalid("A Node with this ID already exists in the target graph.");
6579
6645
  if (operation.target.kind == "subflow" && !("inputs" in operation.node)) invalid("Trigger Nodes cannot be created inside a Subflow.");
6646
+ if (operation.node.kind == "error" && Object.values(graph.nodes).some((node) => node.kind == "error")) invalid("A graph can contain only one Flow Error node.");
6580
6647
  if (operation.node.kind == "manual" && Object.values(graph.nodes).some((node) => node.kind == "manual")) invalid("A graph can contain only one manual Trigger.");
6581
6648
  if (operation.node.kind == "task" && operation.node.task?.capabilities !== void 0) decodeConnectorCapabilities(operation.node.task.capabilities);
6582
6649
  if (operation.node.name == null) invalid("A Node name cannot be empty.");
@@ -6914,6 +6981,16 @@ function applyFlowChanges(content, operations) {
6914
6981
  document.tasks = tasks;
6915
6982
  break;
6916
6983
  }
6984
+ case "task.openapi.set": {
6985
+ const task = document.tasks[operation.taskId];
6986
+ if (task?.executor.kind != "openapi" || operation.value.executor.kind != "openapi") invalid("The OpenAPI Task does not exist.");
6987
+ if (!dequal(task, operation.before)) invalid("The OpenAPI Task changed before this operation was applied.");
6988
+ document.tasks = {
6989
+ ...document.tasks,
6990
+ [operation.taskId]: operation.value
6991
+ };
6992
+ break;
6993
+ }
6917
6994
  case "task.agent.set": {
6918
6995
  const task = document.tasks[operation.taskId];
6919
6996
  if (task?.executor.kind != "agent" || operation.value.executor.kind != "agent") invalid("The Agent Task does not exist.");
@@ -6954,9 +7031,10 @@ function applyFlowChanges(content, operations) {
6954
7031
  break;
6955
7032
  }
6956
7033
  }
7034
+ assertOpenApiAuthBindings(document);
6957
7035
  return {
6958
7036
  document,
6959
- modelVersion: 4,
7037
+ modelVersion: 5,
6960
7038
  modules
6961
7039
  };
6962
7040
  }
@@ -21760,8 +21838,9 @@ function updateTrigger(content, target, nodeId, settings) {
21760
21838
  value: settings.description
21761
21839
  });
21762
21840
  switch (settings.kind) {
21841
+ case "error":
21763
21842
  case "manual":
21764
- if (trigger.kind != "manual") return;
21843
+ if (trigger.kind != settings.kind) return;
21765
21844
  break;
21766
21845
  case "webhook": {
21767
21846
  if (trigger.kind != "webhook") return;
@@ -1,5 +1,5 @@
1
1
  import type { ChangeOperation, FlowDocument, JsonValue, RevisionContent } from './flow-change.js';
2
- export declare const currentFlowModelVersion = 4;
2
+ export declare const currentFlowModelVersion = 5;
3
3
  /** Best-effort recovery for a parseable Revision envelope. Invalid collection entries are discarded. */
4
4
  export declare function repairRevisionEnvelope(value: unknown): RevisionContent;
5
5
  export declare function decodeFlowDocument(value: unknown): FlowDocument;
@@ -119,7 +119,7 @@ export interface ConditionNode extends GraphNodeBase {
119
119
  readonly matchMode: 'first' | 'all';
120
120
  readonly kind: 'condition';
121
121
  }
122
- export type ManagedTaskExecutor = {
122
+ export type ManagedTaskExecutor = import('../common/openapi.js').OpenApiExecutor | {
123
123
  readonly kind: 'connector';
124
124
  readonly action: string;
125
125
  readonly connectionId?: string;
@@ -271,6 +271,9 @@ interface TriggerNodeBase {
271
271
  }
272
272
  export type TriggerNode = (TriggerNodeBase & {
273
273
  readonly kind: 'manual';
274
+ }) | (TriggerNodeBase & {
275
+ readonly kind: 'error';
276
+ readonly sourceFlowIds?: readonly string[];
274
277
  }) | (TriggerNodeBase & {
275
278
  readonly bodyFields: readonly WebhookBodyField[];
276
279
  readonly kind: 'webhook';
@@ -317,7 +320,7 @@ export interface CodeModule {
317
320
  }
318
321
  export interface RevisionContent {
319
322
  readonly document: FlowDocument;
320
- readonly modelVersion: 2 | typeof currentFlowModelVersion;
323
+ readonly modelVersion: 2 | 4 | typeof currentFlowModelVersion;
321
324
  readonly modules: Readonly<Record<string, CodeModule>>;
322
325
  }
323
326
  export type GraphTarget = {
@@ -340,6 +343,11 @@ export type ChangeOperation = {
340
343
  readonly nodeId: string;
341
344
  readonly target: GraphTarget;
342
345
  readonly value?: readonly ConnectorCapability[];
346
+ } | {
347
+ readonly kind: 'graph.trigger.sources.set';
348
+ readonly nodeId: string;
349
+ readonly before?: readonly string[];
350
+ readonly value?: readonly string[];
343
351
  } | {
344
352
  readonly binding: FlowDocument['bindings'][string];
345
353
  readonly bindingId: string;
@@ -487,6 +495,11 @@ export type ChangeOperation = {
487
495
  } | {
488
496
  readonly kind: 'task.delete';
489
497
  readonly taskId: string;
498
+ } | {
499
+ readonly before: ManagedTaskDefinition;
500
+ readonly kind: 'task.openapi.set';
501
+ readonly taskId: string;
502
+ readonly value: ManagedTaskDefinition;
490
503
  } | {
491
504
  readonly before: ManagedTaskDefinition;
492
505
  readonly kind: 'task.agent.set';
@@ -1,3 +1,12 @@
1
+ //#region src/openapi/common/authBindings.ts
2
+ /** Never allow credentials to enter a Revision as literal node inputs. */
3
+ function assertOpenApiAuthBindings(document) {
4
+ for (const graph of [document.graph, ...Object.values(document.subflows).map((subflow) => subflow.graph)]) for (const node of Object.values(graph.nodes)) {
5
+ if (node.kind != "task" || node.taskId == null || document.tasks[node.taskId]?.executor.kind != "openapi") continue;
6
+ for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && (mapping.kind == "value" || mapping.kind == "sources" && mapping.sources.some((source) => source.kind == "flow"))) throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
7
+ }
8
+ }
9
+ //#endregion
1
10
  //#region src/flow/common/inputValue.ts
2
11
  /** An explicit clear suppresses the default; absent mappings still inherit it. */
3
12
  function inputValue(mapping, fallback) {
@@ -5838,7 +5847,7 @@ var webhookMethods = [
5838
5847
  ];
5839
5848
  //#endregion
5840
5849
  //#region src/flow/common/changeSchema.ts
5841
- var currentFlowModelVersion = 4;
5850
+ var currentFlowModelVersion = 5;
5842
5851
  var text = string();
5843
5852
  var json = json$1();
5844
5853
  var strings = array(text);
@@ -5939,6 +5948,24 @@ var managed = object({
5939
5948
  action: text,
5940
5949
  connectionId: text.optional()
5941
5950
  }),
5951
+ object({
5952
+ kind: literal("openapi"),
5953
+ sourceUrl: text,
5954
+ method: text,
5955
+ path: text,
5956
+ serverUrl: text,
5957
+ document: json,
5958
+ auth: array(object({
5959
+ id: text,
5960
+ type: _enum([
5961
+ "bearer",
5962
+ "basic",
5963
+ "apiKey"
5964
+ ]),
5965
+ name: text.optional(),
5966
+ in: _enum(["header", "query"]).optional()
5967
+ }))
5968
+ }),
5942
5969
  object({
5943
5970
  kind: literal("llm"),
5944
5971
  mode: _enum(["chat", "json"])
@@ -6055,6 +6082,7 @@ var endpoint = object({
6055
6082
  ])),
6056
6083
  successStatus: number()
6057
6084
  });
6085
+ var sourceFlowIds = array(text.min(1)).refine((ids) => new Set(ids).size === ids.length, "Duplicate source Flow ID.");
6058
6086
  var trigger = {
6059
6087
  name: text,
6060
6088
  description: text.optional(),
@@ -6112,6 +6140,11 @@ var node = union([
6112
6140
  ...trigger,
6113
6141
  kind: literal("manual")
6114
6142
  }),
6143
+ strictObject({
6144
+ ...trigger,
6145
+ kind: literal("error"),
6146
+ sourceFlowIds: sourceFlowIds.optional()
6147
+ }),
6115
6148
  object({
6116
6149
  ...trigger,
6117
6150
  kind: literal("webhook"),
@@ -6183,7 +6216,11 @@ var document = object({
6183
6216
  tasks: record(text, managed)
6184
6217
  });
6185
6218
  object({
6186
- modelVersion: union([literal(2), literal(4)]),
6219
+ modelVersion: union([
6220
+ literal(2),
6221
+ literal(4),
6222
+ literal(5)
6223
+ ]),
6187
6224
  document,
6188
6225
  modules: record(text, module)
6189
6226
  }).extend({
@@ -6191,6 +6228,11 @@ object({
6191
6228
  version: literal(1)
6192
6229
  });
6193
6230
  var shapes = {
6231
+ "graph.trigger.sources.set": {
6232
+ nodeId: text,
6233
+ before: sourceFlowIds.optional(),
6234
+ value: sourceFlowIds.optional()
6235
+ },
6194
6236
  "binding.create": {
6195
6237
  bindingId: text,
6196
6238
  binding
@@ -6344,6 +6386,11 @@ var shapes = {
6344
6386
  before: text.optional(),
6345
6387
  value: text.optional()
6346
6388
  },
6389
+ "task.openapi.set": {
6390
+ taskId: text,
6391
+ before: managed,
6392
+ value: managed
6393
+ },
6347
6394
  "task.agent.set": {
6348
6395
  taskId: text,
6349
6396
  before: managed,
@@ -6653,6 +6700,25 @@ function applyFlowChanges(content, operations) {
6653
6700
  const document = { ...content.document };
6654
6701
  const modules = { ...content.modules };
6655
6702
  for (const operation of operations) switch (operation.kind) {
6703
+ case "graph.trigger.sources.set": {
6704
+ const graph = document.graph;
6705
+ const node = graph.nodes[operation.nodeId];
6706
+ if (node?.kind != "error") invalid("The Flow Error node does not exist.");
6707
+ if (!dequal(node.sourceFlowIds, operation.before)) invalid("The Flow Error node’s sources changed before this operation was applied.");
6708
+ const { sourceFlowIds: _, ...base } = node;
6709
+ const updated = operation.value == null ? base : {
6710
+ ...base,
6711
+ sourceFlowIds: operation.value
6712
+ };
6713
+ document.graph = {
6714
+ ...graph,
6715
+ nodes: {
6716
+ ...graph.nodes,
6717
+ [operation.nodeId]: updated
6718
+ }
6719
+ };
6720
+ break;
6721
+ }
6656
6722
  case "binding.create":
6657
6723
  if (document.bindings[operation.bindingId] != null) invalid("A Binding with this ID already exists.");
6658
6724
  document.bindings = {
@@ -6743,6 +6809,7 @@ function applyFlowChanges(content, operations) {
6743
6809
  const graph = selectedGraph(document, operation.target);
6744
6810
  if (graph.nodes[operation.nodeId] != null) invalid("A Node with this ID already exists in the target graph.");
6745
6811
  if (operation.target.kind == "subflow" && !("inputs" in operation.node)) invalid("Trigger Nodes cannot be created inside a Subflow.");
6812
+ if (operation.node.kind == "error" && Object.values(graph.nodes).some((node) => node.kind == "error")) invalid("A graph can contain only one Flow Error node.");
6746
6813
  if (operation.node.kind == "manual" && Object.values(graph.nodes).some((node) => node.kind == "manual")) invalid("A graph can contain only one manual Trigger.");
6747
6814
  if (operation.node.kind == "task" && operation.node.task?.capabilities !== void 0) decodeConnectorCapabilities(operation.node.task.capabilities);
6748
6815
  if (operation.node.name == null) invalid("A Node name cannot be empty.");
@@ -7080,6 +7147,16 @@ function applyFlowChanges(content, operations) {
7080
7147
  document.tasks = tasks;
7081
7148
  break;
7082
7149
  }
7150
+ case "task.openapi.set": {
7151
+ const task = document.tasks[operation.taskId];
7152
+ if (task?.executor.kind != "openapi" || operation.value.executor.kind != "openapi") invalid("The OpenAPI Task does not exist.");
7153
+ if (!dequal(task, operation.before)) invalid("The OpenAPI Task changed before this operation was applied.");
7154
+ document.tasks = {
7155
+ ...document.tasks,
7156
+ [operation.taskId]: operation.value
7157
+ };
7158
+ break;
7159
+ }
7083
7160
  case "task.agent.set": {
7084
7161
  const task = document.tasks[operation.taskId];
7085
7162
  if (task?.executor.kind != "agent" || operation.value.executor.kind != "agent") invalid("The Agent Task does not exist.");
@@ -7120,9 +7197,10 @@ function applyFlowChanges(content, operations) {
7120
7197
  break;
7121
7198
  }
7122
7199
  }
7200
+ assertOpenApiAuthBindings(document);
7123
7201
  return {
7124
7202
  document,
7125
- modelVersion: 4,
7203
+ modelVersion: 5,
7126
7204
  modules
7127
7205
  };
7128
7206
  }