@oomol-lab/open-flow 0.1.0-beta.65 → 0.1.0-beta.67

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 (54) hide show
  1. package/dist/browser/{createResourceDialog-BAJXbzNH.js → createResourceDialog-BQVD8Rqb.js} +2 -2
  2. package/dist/browser/{icons-Db2Jb2iX.js → dialog-CS2Vt2if.js} +5736 -5621
  3. package/dist/browser/event-sources.d.ts +4 -1
  4. package/dist/browser/flow-authoring-node.d.ts +14 -3
  5. package/dist/browser/flow-authoring.js +120 -24
  6. package/dist/browser/flow-change-schema.d.ts +3 -1
  7. package/dist/browser/flow-change.d.ts +15 -3
  8. package/dist/browser/flow-change.js +117 -21
  9. package/dist/browser/{flowChanges-DkvG5uDq.js → flowChanges-VB9Y4iy7.js} +3423 -2380
  10. package/dist/browser/{flowRunInputEditorStore-B2Rw4VsT.js → flowRunInputEditorStore-DJqmR6Qh.js} +3 -2
  11. package/dist/browser/{flowWorkspace-BEp-lxqF.js → flowWorkspace-C1hlTnZq.js} +1410 -799
  12. package/dist/browser/preview.css +273 -119
  13. package/dist/browser/preview.js +17118 -15810
  14. package/dist/browser/theme.css +1 -0
  15. package/dist/browser/ui.css +119 -7
  16. package/dist/browser/ui.js +8 -5
  17. package/dist/browser/workbench-contract.d.ts +1 -1
  18. package/dist/browser/workbench.css +282 -162
  19. package/dist/browser/workbench.d.ts +0 -1
  20. package/dist/browser/workbench.js +503 -173
  21. package/dist/browser/{workbenchSelect-C-jf6NIM.js → workbenchSelect-CpXhjUou.js} +1 -1
  22. package/dist/command/index.js +49 -49
  23. package/dist/common/authoring.d.ts +7 -5
  24. package/dist/common/authoringExamples.d.ts +4 -4
  25. package/dist/common/authoringFields.d.ts +20 -0
  26. package/dist/common/authoringSchema.d.ts +404 -15
  27. package/dist/common/control-api-conformance.js +415 -146
  28. package/dist/common/control-api.d.ts +67 -8
  29. package/dist/common/control-api.js +3587 -3443
  30. package/dist/common/control-requests.d.ts +10 -3
  31. package/dist/common/control-requests.js +425 -49
  32. package/dist/common/decision.js +33 -7
  33. package/dist/common/flow-encoding.d.ts +4 -2
  34. package/dist/common/flow-encoding.js +151 -14
  35. package/dist/common/flow-graph.d.ts +1 -1
  36. package/dist/common/flow-semantics.d.ts +12 -2
  37. package/dist/common/flow-semantics.js +157 -41
  38. package/dist/common/integration-trigger.js +33 -7
  39. package/dist/common/liveDetails.d.ts +26 -11
  40. package/dist/common/mcp.d.ts +6 -3
  41. package/dist/common/mcp.js +219 -90
  42. package/dist/common/openapi.js +33 -7
  43. package/dist/common/poll-trigger.js +33 -7
  44. package/dist/common/run-events.d.ts +2 -0
  45. package/dist/common/run-events.js +9 -3
  46. package/dist/common/scheduler.d.ts +10 -1
  47. package/dist/common/scheduler.js +172 -49
  48. package/dist/common/trigger-contract.d.ts +2 -0
  49. package/dist/common/webhook-trigger.js +33 -7
  50. package/dist/common/workflow.d.ts +93 -0
  51. package/dist/common/workflow.js +10492 -0
  52. package/package.json +5 -1
  53. package/skills/open-flow/SKILL.md +9 -0
  54. package/skills/open-flow/references/flow-authoring.md +28 -16
@@ -8783,8 +8783,9 @@ var webhookMethods = [
8783
8783
  ];
8784
8784
  //#endregion
8785
8785
  //#region src/flow/common/changeSchema.ts
8786
- var currentFlowModelVersion = 6;
8786
+ var currentFlowModelVersion = 8;
8787
8787
  var text = string();
8788
+ var actionConnection = text.describe("Account selection: omit while unconfigured; use an account ID to select it; use \"\" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.");
8788
8789
  var json = json$1();
8789
8790
  var strings = array(text);
8790
8791
  var port = object({
@@ -8793,6 +8794,7 @@ var port = object({
8793
8794
  nullable: boolean(),
8794
8795
  handle: text
8795
8796
  });
8797
+ var workflowInputDefs = array(port.strict());
8796
8798
  var input = port.extend({ value: json.optional() });
8797
8799
  var group = object({
8798
8800
  collapsed: boolean().optional(),
@@ -8839,7 +8841,7 @@ var capability = union([
8839
8841
  mode: literal("independent"),
8840
8842
  actions: array(strictObject({
8841
8843
  action: text,
8842
- connectionId: text.optional()
8844
+ connectionId: actionConnection.optional()
8843
8845
  }))
8844
8846
  }),
8845
8847
  strictObject({
@@ -8899,7 +8901,7 @@ var managedFields = object({
8899
8901
  object({
8900
8902
  kind: literal("connector"),
8901
8903
  action: text,
8902
- connectionId: text.optional(),
8904
+ connectionId: actionConnection.optional(),
8903
8905
  outputMode: literal("value").optional()
8904
8906
  }),
8905
8907
  object({
@@ -8939,17 +8941,22 @@ var managedFields = object({
8939
8941
  name: text,
8940
8942
  description: text,
8941
8943
  action: text,
8942
- connectionId: text.optional(),
8944
+ connectionId: actionConnection.optional(),
8943
8945
  approval: boolean(),
8944
8946
  inputs: array(input.extend({ source: agentInput }))
8945
8947
  })),
8946
8948
  notification: object({
8947
8949
  action: text,
8948
- connectionId: text.optional(),
8950
+ connectionId: actionConnection.optional(),
8949
8951
  inputDefinitions: array(input),
8950
8952
  messageHandle: text,
8951
8953
  inputs: record$1(text, agentValue)
8952
8954
  }).optional()
8955
+ }),
8956
+ strictObject({
8957
+ kind: literal("workflow"),
8958
+ flowId: text,
8959
+ revisionId: text
8953
8960
  })
8954
8961
  ])
8955
8962
  });
@@ -9058,6 +9065,12 @@ var base = {
9058
9065
  timeoutMs: number().optional()
9059
9066
  };
9060
9067
  var node = union([
9068
+ strictObject({
9069
+ ...base,
9070
+ kind: literal("outputs"),
9071
+ outputDefs: array(port.strict()),
9072
+ outputMappings: inputs
9073
+ }).omit({ inputs: true }),
9061
9074
  object({
9062
9075
  ...base,
9063
9076
  inputs: record$1(text, never()),
@@ -9090,6 +9103,11 @@ var node = union([
9090
9103
  ...trigger,
9091
9104
  kind: literal("manual")
9092
9105
  }),
9106
+ strictObject({
9107
+ ...trigger,
9108
+ kind: literal("start"),
9109
+ inputDefs: workflowInputDefs
9110
+ }),
9093
9111
  strictObject({
9094
9112
  ...trigger,
9095
9113
  kind: literal("error"),
@@ -9154,35 +9172,51 @@ var module = object({
9154
9172
  imports: strings,
9155
9173
  source: text
9156
9174
  });
9157
- var document = preprocess(rejectRetiredDefinitions, object({
9175
+ var document = preprocess(normalizeDocument, object({
9158
9176
  bindings: record$1(text, binding),
9159
9177
  graph
9160
9178
  }));
9161
- object({
9179
+ var revision = object({
9162
9180
  modelVersion: union([
9163
9181
  literal(2),
9164
9182
  literal(4),
9165
9183
  literal(5),
9166
- literal(6)
9184
+ literal(6),
9185
+ literal(7),
9186
+ literal(8)
9167
9187
  ]),
9168
9188
  document,
9169
9189
  modules: record$1(text, module)
9170
- }).extend({
9190
+ });
9191
+ revision.extend({
9171
9192
  kind: literal("open-flow-flow-revision"),
9172
9193
  version: literal(1)
9173
9194
  });
9174
- function rejectRetiredDefinitions(value) {
9195
+ function normalizeDocument(value) {
9175
9196
  const candidate = record(value);
9176
9197
  if (candidate.tasks !== void 0 && (candidate.tasks === null || typeof candidate.tasks !== "object" || Array.isArray(candidate.tasks) || Object.keys(candidate.tasks).length > 0)) throw new TypeError("Independent Task definitions are no longer supported.");
9177
9198
  if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
9178
9199
  const subflows = candidate.subflows;
9179
9200
  if (subflows !== void 0 && (subflows === null || typeof subflows !== "object" || Array.isArray(subflows) || Object.keys(subflows).length > 0)) throw new TypeError("Subflows are no longer supported.");
9180
9201
  if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
9202
+ if ([
9203
+ "inputDefs",
9204
+ "outputDefs",
9205
+ "outputMappings"
9206
+ ].some((field) => Object.hasOwn(candidate, field))) throw new TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");
9207
+ if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind == "start" && Object.hasOwn(record(candidateNode), "parameters"))) throw new TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");
9181
9208
  return value;
9182
9209
  }
9183
9210
  function record(value) {
9184
9211
  return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
9185
9212
  }
9213
+ function decodeRevisionContent(value) {
9214
+ checkJsonDepth(value);
9215
+ const content = revision.parse(value);
9216
+ checkModelVersion(content);
9217
+ assertOpenApiAuthBindings(content.document);
9218
+ return content;
9219
+ }
9186
9220
  var shapes = {
9187
9221
  "graph.trigger.sources.set": {
9188
9222
  nodeId: text,
@@ -9359,6 +9393,12 @@ function changeOperationsSchema(kind) {
9359
9393
  if (schema == null) throw new TypeError(`Unknown operation ${JSON.stringify(kind)}.`);
9360
9394
  return toJSONSchema(schema, { io: "input" });
9361
9395
  }
9396
+ function checkModelVersion(content) {
9397
+ if (content.modelVersion < 8 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "outputs")) throw new TypeError("Workflow outputs require Flow model version 8.");
9398
+ if (content.modelVersion < 7 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "start")) throw new TypeError("Start Triggers require Flow model version 7.");
9399
+ if (content.modelVersion < 6 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task)) throw new TypeError("Node-owned managed Tasks require Flow model version 6.");
9400
+ if (content.modelVersion < 5 && Object.values(content.document.graph.nodes).some((itemNode) => itemNode.kind == "error")) throw new TypeError("Error workflows require Flow model version 5.");
9401
+ }
9362
9402
  //#endregion
9363
9403
  //#region src/flow/common/condition.ts
9364
9404
  var unaryOperator = (operator) => operator.startsWith("is");
@@ -9378,6 +9418,7 @@ function conditionOperands(node) {
9378
9418
  }] : []])));
9379
9419
  }
9380
9420
  function nodeInputMappings(node) {
9421
+ if (node.kind == "outputs") return node.outputMappings;
9381
9422
  if (node.kind != "condition") return "inputs" in node ? node.inputs : {};
9382
9423
  return Object.fromEntries(conditionOperands(node).flatMap(({ handle, operand }) => operand.kind == "source" ? [[handle, {
9383
9424
  kind: "sources",
@@ -9475,7 +9516,7 @@ function decodeConnectorCapabilities(value) {
9475
9516
  const actions = source.actions.map((entry) => {
9476
9517
  if (entry == null || typeof entry != "object" || Array.isArray(entry)) throw new TypeError("Invalid Connector Action.");
9477
9518
  const action = entry;
9478
- if (Object.keys(action).some((key) => !["action", "connectionId"].includes(key)) || typeof action.action != "string" || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_.-]+$/.test(action.action) || Object.hasOwn(action, "connectionId") && (typeof action.connectionId != "string" || action.connectionId.length == 0)) throw new TypeError("Invalid Connector Action permission.");
9519
+ if (Object.keys(action).some((key) => !["action", "connectionId"].includes(key)) || typeof action.action != "string" || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_.-]+$/.test(action.action) || Object.hasOwn(action, "connectionId") && typeof action.connectionId != "string") throw new TypeError("Invalid Connector Action permission.");
9479
9520
  return action.connectionId == null ? { action: action.action } : {
9480
9521
  action: action.action,
9481
9522
  connectionId: action.connectionId
@@ -9567,6 +9608,45 @@ function decodeConnectorCapabilities(value) {
9567
9608
  };
9568
9609
  });
9569
9610
  }
9611
+ function isTriggerNode(node) {
9612
+ return [
9613
+ "manual",
9614
+ "start",
9615
+ "error",
9616
+ "webhook",
9617
+ "cron",
9618
+ "poll",
9619
+ "integration"
9620
+ ].includes(node.kind);
9621
+ }
9622
+ /** Lossless upgrade of readable content. Historical content and its encoding stay unchanged. */
9623
+ function upgradeRevisionContent(content) {
9624
+ const upgraded = upgradeDecodedRevisionContent(decodeRevisionContent(content));
9625
+ return dequal(content, upgraded) ? content : upgraded;
9626
+ }
9627
+ function upgradeDecodedRevisionContent(content) {
9628
+ const graph = content.document.graph;
9629
+ const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
9630
+ if (!hasManual && content.modelVersion == 8) return content;
9631
+ return {
9632
+ ...content,
9633
+ modelVersion: 8,
9634
+ document: {
9635
+ ...content.document,
9636
+ graph: hasManual ? {
9637
+ ...graph,
9638
+ nodes: Object.fromEntries(Object.entries(graph.nodes).map(([id, node]) => [id, upgradeManualTrigger(node)]))
9639
+ } : graph
9640
+ }
9641
+ };
9642
+ }
9643
+ function upgradeManualTrigger(node) {
9644
+ return node.kind == "manual" ? {
9645
+ ...node,
9646
+ kind: "start",
9647
+ inputDefs: []
9648
+ } : node;
9649
+ }
9570
9650
  function normalizeNodeName(value) {
9571
9651
  return value.trim().normalize("NFC");
9572
9652
  }
@@ -9597,8 +9677,9 @@ function invalid(message) {
9597
9677
  throw new FlowChangeError(message);
9598
9678
  }
9599
9679
  function applyFlowChanges(content, operations) {
9600
- const document = { ...content.document };
9601
- const modules = { ...content.modules };
9680
+ const source = content.modelVersion != 8 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
9681
+ const document = { ...source.document };
9682
+ const modules = { ...source.modules };
9602
9683
  for (const operation of operations) switch (operation.kind) {
9603
9684
  case "graph.trigger.sources.set": {
9604
9685
  const graph = document.graph;
@@ -9649,8 +9730,9 @@ function applyFlowChanges(content, operations) {
9649
9730
  case "graph.edge.connect": {
9650
9731
  const graph = document.graph;
9651
9732
  if (graph.nodes[operation.edge.source] == null) invalid("The source Node does not exist.");
9733
+ if (graph.nodes[operation.edge.source]?.kind == "outputs") invalid("Outputs cannot have downstream execution edges.");
9652
9734
  const node = graph.nodes[operation.edge.target];
9653
- if (node == null || !("inputs" in node)) invalid("The target Node does not accept execution dependencies.");
9735
+ if (node == null || isTriggerNode(node)) invalid("The target Node does not accept execution dependencies.");
9654
9736
  if (graph.edges.some((edge) => dequal(edge, operation.edge))) invalid("The Nodes are already connected.");
9655
9737
  Object.assign(document, { graph: {
9656
9738
  ...graph,
@@ -9730,9 +9812,10 @@ function applyFlowChanges(content, operations) {
9730
9812
  const graph = document.graph;
9731
9813
  if (graph.nodes[operation.nodeId] != null) invalid("A Node with this ID already exists in the target graph.");
9732
9814
  if (operation.node.kind == "error" && Object.values(graph.nodes).some((node) => node.kind == "error")) invalid("A graph can contain only one Flow Error node.");
9733
- if (operation.node.kind == "manual" && Object.values(graph.nodes).some((node) => node.kind == "manual")) invalid("A graph can contain only one manual Trigger.");
9815
+ if ((operation.node.kind == "manual" || operation.node.kind == "start") && Object.values(graph.nodes).some((node) => node.kind == "manual" || node.kind == "start")) invalid("A graph can contain only one Start Trigger.");
9734
9816
  if (operation.node.kind == "task" && "moduleId" in operation.node.task && operation.node.task.capabilities !== void 0) decodeConnectorCapabilities(operation.node.task.capabilities);
9735
9817
  if (operation.node.name == null) invalid("A Node name cannot be empty.");
9818
+ if (operation.node.kind == "outputs" && Object.values(graph.nodes).some((node) => node.kind == "outputs")) invalid("A graph can contain only one Outputs node.");
9736
9819
  const name = normalizeNodeName(operation.node.name);
9737
9820
  const issue = nodeNameIssue(graph, operation.nodeId, name);
9738
9821
  if (issue == "empty") invalid("A Node name cannot be empty.");
@@ -9790,11 +9873,24 @@ function applyFlowChanges(content, operations) {
9790
9873
  case "graph.node.input.set": {
9791
9874
  const graph = document.graph;
9792
9875
  const node = graph.nodes[operation.nodeId];
9793
- if (node == null || !("inputs" in node)) invalid("The Node does not accept inputs.");
9876
+ if (node == null || isTriggerNode(node)) invalid("The Node does not accept inputs.");
9794
9877
  if (!dequal(nodeInputMappings(node)[operation.handle], operation.before)) invalid("The Node input changed before this operation was applied.");
9795
- const inputs = { ...node.inputs };
9878
+ const inputs = { ...nodeInputMappings(node) };
9796
9879
  if (operation.value == null) delete inputs[operation.handle];
9797
9880
  else inputs[operation.handle] = operation.value;
9881
+ if (node.kind == "outputs") {
9882
+ document.graph = {
9883
+ ...graph,
9884
+ nodes: {
9885
+ ...graph.nodes,
9886
+ [operation.nodeId]: {
9887
+ ...node,
9888
+ outputMappings: inputs
9889
+ }
9890
+ }
9891
+ };
9892
+ break;
9893
+ }
9798
9894
  Object.assign(document, { graph: {
9799
9895
  ...graph,
9800
9896
  nodes: {
@@ -10022,11 +10118,11 @@ function applyFlowChanges(content, operations) {
10022
10118
  }
10023
10119
  }
10024
10120
  assertOpenApiAuthBindings(document);
10025
- return {
10121
+ return upgradeDecodedRevisionContent({
10026
10122
  document,
10027
- modelVersion: 6,
10123
+ modelVersion: 8,
10028
10124
  modules
10029
- };
10125
+ });
10030
10126
  }
10031
10127
  //#endregion
10032
- export { FlowChangeError, applyFlowChanges, changeOperationsSchema, currentFlowModelVersion, decodeChangeOperations, decodeConnectorCapabilities, fixedInputValue, inputValue, inputValues, isSchemaKeyword, nextNodeName, nodeNameIssue, normalizeNodeName, portsByHandle, resourceNameIssue, resourceNameMaxLength, validVariableName };
10128
+ export { FlowChangeError, applyFlowChanges, changeOperationsSchema, currentFlowModelVersion, decodeChangeOperations, decodeConnectorCapabilities, fixedInputValue, inputValue, inputValues, isSchemaKeyword, isTriggerNode, nextNodeName, nodeNameIssue, normalizeNodeName, portsByHandle, resourceNameIssue, resourceNameMaxLength, upgradeManualTrigger, upgradeRevisionContent, validVariableName };