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

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 (49) hide show
  1. package/dist/browser/{createResourceDialog-BAJXbzNH.js → createResourceDialog-C-Si_cYs.js} +2 -2
  2. package/dist/browser/flow-authoring-node.d.ts +12 -3
  3. package/dist/browser/flow-authoring.js +114 -19
  4. package/dist/browser/flow-change-schema.d.ts +3 -1
  5. package/dist/browser/flow-change.d.ts +15 -3
  6. package/dist/browser/flow-change.js +111 -16
  7. package/dist/browser/{flowChanges-DkvG5uDq.js → flowChanges-T4_R5p1f.js} +2654 -1858
  8. package/dist/browser/{flowRunInputEditorStore-B2Rw4VsT.js → flowRunInputEditorStore-DJqmR6Qh.js} +3 -2
  9. package/dist/browser/{flowWorkspace-BEp-lxqF.js → flowWorkspace-C0J5C0oM.js} +700 -224
  10. package/dist/browser/{icons-Db2Jb2iX.js → icons-BD3m0RQq.js} +4484 -4370
  11. package/dist/browser/preview.css +152 -64
  12. package/dist/browser/preview.js +4460 -3412
  13. package/dist/browser/ui.css +85 -3
  14. package/dist/browser/ui.js +8 -5
  15. package/dist/browser/workbench.css +152 -64
  16. package/dist/browser/workbench.js +146 -57
  17. package/dist/browser/{workbenchSelect-C-jf6NIM.js → workbenchSelect-B-PFpF_Q.js} +1 -1
  18. package/dist/command/index.js +49 -49
  19. package/dist/common/authoring.d.ts +7 -5
  20. package/dist/common/authoringExamples.d.ts +3 -3
  21. package/dist/common/authoringFields.d.ts +20 -0
  22. package/dist/common/authoringSchema.d.ts +404 -15
  23. package/dist/common/control-api-conformance.js +384 -137
  24. package/dist/common/control-api.d.ts +63 -7
  25. package/dist/common/control-api.js +3562 -3428
  26. package/dist/common/control-requests.d.ts +10 -3
  27. package/dist/common/control-requests.js +418 -43
  28. package/dist/common/decision.js +28 -3
  29. package/dist/common/flow-encoding.d.ts +4 -2
  30. package/dist/common/flow-encoding.js +144 -10
  31. package/dist/common/flow-graph.d.ts +1 -1
  32. package/dist/common/flow-semantics.d.ts +12 -2
  33. package/dist/common/flow-semantics.js +146 -33
  34. package/dist/common/integration-trigger.js +28 -3
  35. package/dist/common/liveDetails.d.ts +26 -11
  36. package/dist/common/mcp.d.ts +6 -3
  37. package/dist/common/mcp.js +203 -84
  38. package/dist/common/openapi.js +28 -3
  39. package/dist/common/poll-trigger.js +28 -3
  40. package/dist/common/run-events.d.ts +2 -0
  41. package/dist/common/run-events.js +9 -3
  42. package/dist/common/scheduler.d.ts +10 -1
  43. package/dist/common/scheduler.js +167 -45
  44. package/dist/common/trigger-contract.d.ts +2 -0
  45. package/dist/common/webhook-trigger.js +28 -3
  46. package/dist/common/workflow.d.ts +93 -0
  47. package/dist/common/workflow.js +10491 -0
  48. package/package.json +5 -1
  49. package/skills/open-flow/references/flow-authoring.md +26 -16
@@ -6605,6 +6605,7 @@ var port = object({
6605
6605
  nullable: boolean(),
6606
6606
  handle: text
6607
6607
  });
6608
+ var workflowInputDefs = array(port.strict());
6608
6609
  var input = port.extend({ value: json.optional() });
6609
6610
  var group = object({
6610
6611
  collapsed: boolean().optional(),
@@ -6762,6 +6763,11 @@ var managedFields = object({
6762
6763
  messageHandle: text,
6763
6764
  inputs: record$1(text, agentValue)
6764
6765
  }).optional()
6766
+ }),
6767
+ strictObject({
6768
+ kind: literal("workflow"),
6769
+ flowId: text,
6770
+ revisionId: text
6765
6771
  })
6766
6772
  ])
6767
6773
  });
@@ -6870,6 +6876,12 @@ var base = {
6870
6876
  timeoutMs: number().optional()
6871
6877
  };
6872
6878
  var node = union([
6879
+ strictObject({
6880
+ ...base,
6881
+ kind: literal("outputs"),
6882
+ outputDefs: array(port.strict()),
6883
+ outputMappings: inputs
6884
+ }).omit({ inputs: true }),
6873
6885
  object({
6874
6886
  ...base,
6875
6887
  inputs: record$1(text, never()),
@@ -6902,6 +6914,11 @@ var node = union([
6902
6914
  ...trigger,
6903
6915
  kind: literal("manual")
6904
6916
  }),
6917
+ strictObject({
6918
+ ...trigger,
6919
+ kind: literal("start"),
6920
+ inputDefs: workflowInputDefs
6921
+ }),
6905
6922
  strictObject({
6906
6923
  ...trigger,
6907
6924
  kind: literal("error"),
@@ -6966,7 +6983,7 @@ var module = object({
6966
6983
  imports: strings,
6967
6984
  source: text
6968
6985
  });
6969
- var document = preprocess(rejectRetiredDefinitions, object({
6986
+ var document = preprocess(normalizeDocument, object({
6970
6987
  bindings: record$1(text, binding),
6971
6988
  graph
6972
6989
  }));
@@ -6975,7 +6992,9 @@ object({
6975
6992
  literal(2),
6976
6993
  literal(4),
6977
6994
  literal(5),
6978
- literal(6)
6995
+ literal(6),
6996
+ literal(7),
6997
+ literal(8)
6979
6998
  ]),
6980
6999
  document,
6981
7000
  modules: record$1(text, module)
@@ -6983,13 +7002,19 @@ object({
6983
7002
  kind: literal("open-flow-flow-revision"),
6984
7003
  version: literal(1)
6985
7004
  });
6986
- function rejectRetiredDefinitions(value) {
7005
+ function normalizeDocument(value) {
6987
7006
  const candidate = record(value);
6988
7007
  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.");
6989
7008
  if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
6990
7009
  const subflows = candidate.subflows;
6991
7010
  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.");
6992
7011
  if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
7012
+ if ([
7013
+ "inputDefs",
7014
+ "outputDefs",
7015
+ "outputMappings"
7016
+ ].some((field) => Object.hasOwn(candidate, field))) throw new TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");
7017
+ 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.");
6993
7018
  return value;
6994
7019
  }
6995
7020
  function record(value) {
@@ -1,10 +1,12 @@
1
- import type { CodeModule, FlowDocument, Graph, Group, InputPort, JsonValue, ManagedTaskDefinition, Port, RevisionContent, TriggerNode } from '@oomol-lab/open-flow/flow-change';
1
+ import type { CodeModule, FlowDocument, Graph, Group, InputMapping, InputPort, JsonValue, ManagedTaskDefinition, Port, RevisionContent, TriggerNode } from '@oomol-lab/open-flow/flow-change';
2
2
  export * from './flow-workflowFile.js';
3
3
  export { maxJsonDepth } from './flow-json.js';
4
- export { decodeFlowDocument, decodeRevisionContent } from '../browser/flow-change-schema.js';
4
+ export { decodeFlowDocument, decodeRevisionContent, upgradeWorkflowInterfaceDocument } from '../browser/flow-change-schema.js';
5
+ export { upgradeRevisionContent } from '@oomol-lab/open-flow/flow-change';
5
6
  export declare function canonicalJsonBytes(value: JsonValue): Uint8Array;
6
7
  export declare function digestBytes(bytes: Uint8Array): Promise<string>;
7
8
  export declare function canonicalPorts(value: readonly (InputPort | Port | Group)[]): JsonValue;
9
+ export declare function canonicalInputs(value: Readonly<Record<string, InputMapping>>): JsonValue;
8
10
  export declare function canonicalGraph(value: Graph): JsonValue;
9
11
  export declare function canonicalRevisionGraph(content: RevisionContent, graph: Graph): JsonValue;
10
12
  export declare function canonicalTask(task: ManagedTaskDefinition): JsonValue;
@@ -8587,6 +8587,7 @@ var port = object({
8587
8587
  nullable: boolean(),
8588
8588
  handle: text
8589
8589
  });
8590
+ var workflowInputDefs = array(port.strict());
8590
8591
  var input = port.extend({ value: json.optional() });
8591
8592
  var group = object({
8592
8593
  collapsed: boolean().optional(),
@@ -8744,6 +8745,11 @@ var managedFields = object({
8744
8745
  messageHandle: text,
8745
8746
  inputs: record$1(text, agentValue)
8746
8747
  }).optional()
8748
+ }),
8749
+ strictObject({
8750
+ kind: literal("workflow"),
8751
+ flowId: text,
8752
+ revisionId: text
8747
8753
  })
8748
8754
  ])
8749
8755
  });
@@ -8852,6 +8858,12 @@ var base = {
8852
8858
  timeoutMs: number().optional()
8853
8859
  };
8854
8860
  var node = union([
8861
+ strictObject({
8862
+ ...base,
8863
+ kind: literal("outputs"),
8864
+ outputDefs: array(port.strict()),
8865
+ outputMappings: inputs
8866
+ }).omit({ inputs: true }),
8855
8867
  object({
8856
8868
  ...base,
8857
8869
  inputs: record$1(text, never()),
@@ -8884,6 +8896,11 @@ var node = union([
8884
8896
  ...trigger,
8885
8897
  kind: literal("manual")
8886
8898
  }),
8899
+ strictObject({
8900
+ ...trigger,
8901
+ kind: literal("start"),
8902
+ inputDefs: workflowInputDefs
8903
+ }),
8887
8904
  strictObject({
8888
8905
  ...trigger,
8889
8906
  kind: literal("error"),
@@ -8948,7 +8965,7 @@ var module = object({
8948
8965
  imports: strings,
8949
8966
  source: text
8950
8967
  });
8951
- var document = preprocess(rejectRetiredDefinitions, object({
8968
+ var document = preprocess(normalizeDocument, object({
8952
8969
  bindings: record$1(text, binding),
8953
8970
  graph
8954
8971
  }));
@@ -8957,7 +8974,9 @@ var revision = object({
8957
8974
  literal(2),
8958
8975
  literal(4),
8959
8976
  literal(5),
8960
- literal(6)
8977
+ literal(6),
8978
+ literal(7),
8979
+ literal(8)
8961
8980
  ]),
8962
8981
  document,
8963
8982
  modules: record$1(text, module)
@@ -8966,15 +8985,73 @@ var envelope$1 = revision.extend({
8966
8985
  kind: literal("open-flow-flow-revision"),
8967
8986
  version: literal(1)
8968
8987
  });
8969
- function rejectRetiredDefinitions(value) {
8988
+ function normalizeDocument(value) {
8970
8989
  const candidate = record(value);
8971
8990
  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.");
8972
8991
  if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
8973
8992
  const subflows = candidate.subflows;
8974
8993
  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.");
8975
8994
  if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
8995
+ if ([
8996
+ "inputDefs",
8997
+ "outputDefs",
8998
+ "outputMappings"
8999
+ ].some((field) => Object.hasOwn(candidate, field))) throw new TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");
9000
+ 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.");
8976
9001
  return value;
8977
9002
  }
9003
+ /** Explicit storage upgrade only. Normal reads and authoring still reject retired fields. */
9004
+ function upgradeWorkflowInterfaceDocument(value) {
9005
+ const candidate = record(value);
9006
+ const sourceGraph = record(candidate.graph);
9007
+ const sourceNodes = record(sourceGraph.nodes);
9008
+ if (!([
9009
+ "inputDefs",
9010
+ "outputDefs",
9011
+ "outputMappings"
9012
+ ].some((field) => Object.hasOwn(candidate, field)) || Object.values(sourceNodes).some((entry) => {
9013
+ const candidateNode = record(entry);
9014
+ return candidateNode.kind == "start" && (!Object.hasOwn(candidateNode, "inputDefs") || Object.hasOwn(candidateNode, "parameters")) || candidateNode.kind == "outputs" && (!Object.hasOwn(candidateNode, "outputDefs") || !Object.hasOwn(candidateNode, "outputMappings"));
9015
+ }))) return value;
9016
+ if (candidate.graph !== sourceGraph || sourceGraph.nodes !== sourceNodes) throw new TypeError("Cannot migrate an invalid workflow graph.");
9017
+ const starts = Object.values(sourceNodes).filter((entry) => record(entry).kind == "start");
9018
+ const outputs = Object.values(sourceNodes).filter((entry) => record(entry).kind == "outputs");
9019
+ if (starts.length > 1 || outputs.length > 1) throw new TypeError("Cannot migrate duplicate Start or Outputs nodes.");
9020
+ const { inputDefs, outputDefs, outputMappings, ...sourceDocument } = candidate;
9021
+ if (starts.length == 0 && inputDefs !== void 0 && workflowInputDefs.parse(inputDefs).length > 0) throw new TypeError("Cannot migrate inputDefs without a Start node.");
9022
+ if (outputs.length == 0 && (outputDefs !== void 0 && workflowInputDefs.parse(outputDefs).length > 0 || outputMappings !== void 0 && Object.keys(inputs.parse(outputMappings)).length > 0)) throw new TypeError("Cannot migrate output configuration without an Outputs node.");
9023
+ return {
9024
+ ...sourceDocument,
9025
+ graph: {
9026
+ ...sourceGraph,
9027
+ nodes: Object.fromEntries(Object.entries(sourceNodes).map(([id, nodeValue]) => {
9028
+ const candidateNode = record(nodeValue);
9029
+ if (candidateNode.kind == "start") {
9030
+ const { parameters, ...rest } = candidateNode;
9031
+ return [id, {
9032
+ ...rest,
9033
+ inputDefs: workflowInputDefs.parse(mergeInterfaceConfiguration([
9034
+ candidateNode.inputDefs,
9035
+ parameters,
9036
+ inputDefs
9037
+ ], []))
9038
+ }];
9039
+ }
9040
+ if (candidateNode.kind == "outputs") return [id, {
9041
+ ...candidateNode,
9042
+ outputDefs: workflowInputDefs.parse(mergeInterfaceConfiguration([candidateNode.outputDefs, outputDefs], [])),
9043
+ outputMappings: inputs.parse(mergeInterfaceConfiguration([candidateNode.outputMappings, outputMappings], {}))
9044
+ }];
9045
+ return [id, nodeValue];
9046
+ }))
9047
+ }
9048
+ };
9049
+ }
9050
+ function mergeInterfaceConfiguration(values, fallback) {
9051
+ const present = values.filter((value) => value !== void 0);
9052
+ if (present.some((value) => !dequal(value, present[0]))) throw new TypeError("Conflicting workflow interface configuration.");
9053
+ return present.length == 0 ? fallback : present[0];
9054
+ }
8978
9055
  function record(value) {
8979
9056
  return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
8980
9057
  }
@@ -9154,14 +9231,14 @@ function repairRevisionEnvelope(value) {
9154
9231
  checkJsonDepth(value);
9155
9232
  const envelopeSource = record(value);
9156
9233
  if (envelopeSource.kind != "open-flow-flow-revision" || envelopeSource.version != 1) throw new TypeError("The value is not an Open Flow Revision envelope.");
9157
- if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion > 6) throw new TypeError("The Flow model is newer than this package.");
9234
+ if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion > 8) throw new TypeError("The Flow model is newer than this package.");
9158
9235
  let sourceDocument = record(envelopeSource.modelVersion == 1 || envelopeSource.modelVersion == 2 ? upgradeLegacyDocument(envelopeSource.document) : envelopeSource.document);
9159
9236
  if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion < 6) sourceDocument = upgradeTaskNodes(sourceDocument);
9160
- rejectRetiredDefinitions(sourceDocument);
9237
+ sourceDocument = record(normalizeDocument(sourceDocument));
9161
9238
  const bindings = record(sourceDocument.bindings);
9162
9239
  const sourceGraph = repairGraph(sourceDocument.graph, bindings);
9163
9240
  return decodeRevisionContent({
9164
- modelVersion: 6,
9241
+ modelVersion: 8,
9165
9242
  document: {
9166
9243
  bindings: repairedEntries(sourceDocument.bindings, binding),
9167
9244
  graph: sourceGraph
@@ -9349,6 +9426,8 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
9349
9426
  ...shape
9350
9427
  })])).values()])).min(1);
9351
9428
  function checkModelVersion(content) {
9429
+ 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.");
9430
+ 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.");
9352
9431
  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.");
9353
9432
  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.");
9354
9433
  }
@@ -9374,6 +9453,47 @@ function clearConditionBindings(node) {
9374
9453
  };
9375
9454
  }
9376
9455
  //#endregion
9456
+ //#region src/flow/common/change.ts
9457
+ function isTriggerNode(node) {
9458
+ return [
9459
+ "manual",
9460
+ "start",
9461
+ "error",
9462
+ "webhook",
9463
+ "cron",
9464
+ "poll",
9465
+ "integration"
9466
+ ].includes(node.kind);
9467
+ }
9468
+ /** Lossless upgrade of readable content. Historical content and its encoding stay unchanged. */
9469
+ function upgradeRevisionContent(content) {
9470
+ const upgraded = upgradeDecodedRevisionContent(decodeRevisionContent(content));
9471
+ return dequal(content, upgraded) ? content : upgraded;
9472
+ }
9473
+ function upgradeDecodedRevisionContent(content) {
9474
+ const graph = content.document.graph;
9475
+ const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
9476
+ if (!hasManual && content.modelVersion == 8) return content;
9477
+ return {
9478
+ ...content,
9479
+ modelVersion: 8,
9480
+ document: {
9481
+ ...content.document,
9482
+ graph: hasManual ? {
9483
+ ...graph,
9484
+ nodes: Object.fromEntries(Object.entries(graph.nodes).map(([id, node]) => [id, upgradeManualTrigger(node)]))
9485
+ } : graph
9486
+ }
9487
+ };
9488
+ }
9489
+ function upgradeManualTrigger(node) {
9490
+ return node.kind == "manual" ? {
9491
+ ...node,
9492
+ kind: "start",
9493
+ inputDefs: []
9494
+ } : node;
9495
+ }
9496
+ //#endregion
9377
9497
  //#region src/trigger/common/config.ts
9378
9498
  /** Deployment-bound selections owned by the Trigger configuration contract. */
9379
9499
  function clearTriggerExternalConfig(key, config) {
@@ -9502,6 +9622,10 @@ function cleanWorkflowFile(value) {
9502
9622
  ...node,
9503
9623
  inputs: Object.fromEntries(Object.entries(node.inputs).map(([key, input]) => [key, cleanInput(input)]))
9504
9624
  };
9625
+ if (node.kind == "outputs") node = {
9626
+ ...node,
9627
+ outputMappings: Object.fromEntries(Object.entries(node.outputMappings).map(([key, input]) => [key, cleanInput(input)]))
9628
+ };
9505
9629
  if (node.kind == "condition") node = clearConditionBindings(node);
9506
9630
  if (node.kind == "error" && node.sourceFlowIds != null) node = {
9507
9631
  ...node,
@@ -9606,16 +9730,22 @@ function canonicalOperand(operand) {
9606
9730
  };
9607
9731
  }
9608
9732
  function canonicalNode(value) {
9609
- if (!("inputs" in value)) return canonicalTriggerNode(value);
9733
+ if (isTriggerNode(value)) return canonicalTriggerNode(value);
9610
9734
  const common = {
9611
9735
  ...value.description == null ? {} : { description: value.description },
9612
9736
  ...value.icon == null ? {} : { icon: value.icon },
9613
- inputs: canonicalInputs(value.inputs),
9737
+ ...value.kind == "outputs" ? {} : { inputs: canonicalInputs(value.inputs) },
9614
9738
  ...value.name == null ? {} : { name: value.name },
9615
9739
  ...value.maxExecutions == null ? {} : { maxExecutions: value.maxExecutions },
9616
9740
  ...value.timeoutMs == null ? {} : { timeoutMs: value.timeoutMs }
9617
9741
  };
9618
9742
  switch (value.kind) {
9743
+ case "outputs": return {
9744
+ ...common,
9745
+ kind: value.kind,
9746
+ outputDefs: canonicalPorts(value.outputDefs),
9747
+ outputMappings: canonicalInputs(value.outputMappings)
9748
+ };
9619
9749
  case "condition": return {
9620
9750
  ...common,
9621
9751
  cases: value.cases.map((item) => ({
@@ -9795,6 +9925,10 @@ function canonicalTriggerNode(trigger) {
9795
9925
  ...trigger.sourceFlowIds == null ? {} : { sourceFlowIds: [...trigger.sourceFlowIds] }
9796
9926
  };
9797
9927
  case "manual": return common(trigger.kind);
9928
+ case "start": return {
9929
+ ...common(trigger.kind),
9930
+ inputDefs: canonicalPorts(trigger.inputDefs)
9931
+ };
9798
9932
  case "webhook": return {
9799
9933
  ...common(trigger.kind),
9800
9934
  bodyFields: trigger.bodyFields.map((input) => ({
@@ -9886,10 +10020,10 @@ function revisionRepairKind(bytes) {
9886
10020
  return;
9887
10021
  }
9888
10022
  const source = value;
9889
- return typeof source.modelVersion == "number" && source.modelVersion < 6 ? "upgrade" : "repair";
10023
+ return typeof source.modelVersion == "number" && source.modelVersion < 8 ? "upgrade" : "repair";
9890
10024
  }
9891
10025
  function repairRevision(bytes) {
9892
10026
  return repairRevisionEnvelope(revisionValue(bytes));
9893
10027
  }
9894
10028
  //#endregion
9895
- export { canonicalDocument, canonicalGraph, canonicalJsonBytes, canonicalModule, canonicalPorts, canonicalRevisionGraph, canonicalTask, cleanWorkflowFile, decodeFlowDocument, decodeRevision, decodeRevisionContent, decodeWorkflowFile, digestBytes, encodeRevision, encodeWorkflowFile, maxJsonDepth, parseWorkflowFile, repairRevision, revisionRepairKind, triggerRuntimeJson, workflowFileName, workflowNameFromFile };
10029
+ export { canonicalDocument, canonicalGraph, canonicalInputs, canonicalJsonBytes, canonicalModule, canonicalPorts, canonicalRevisionGraph, canonicalTask, cleanWorkflowFile, decodeFlowDocument, decodeRevision, decodeRevisionContent, decodeWorkflowFile, digestBytes, encodeRevision, encodeWorkflowFile, maxJsonDepth, parseWorkflowFile, repairRevision, revisionRepairKind, triggerRuntimeJson, upgradeRevisionContent, upgradeWorkflowInterfaceDocument, workflowFileName, workflowNameFromFile };
@@ -54,6 +54,6 @@ export declare function checkInputSource(graph: Graph, target: string, handle: s
54
54
  export declare function checkInputSources(graph: Graph, target: string, handle: string, sources: readonly Pick<NodeSource, 'nodeId' | 'output' | 'field'>[]): InputSourcesCheck;
55
55
  /** Enumerate structurally available outputs while retaining their compatibility with one input. */
56
56
  export declare function inputSourceCandidates(graph: Graph, target: string, handle: string): Readonly<Record<string, readonly InputSourceCandidate[]>>;
57
- export declare function availableOutputs(graph: Graph, target: string, handle?: string): Readonly<Record<string, readonly string[]>>;
57
+ export declare function availableOutputs(graph: Graph, target: string, handle: string | undefined): Readonly<Record<string, readonly string[]>>;
58
58
  export declare function validateFlowGraph(revision: RevisionContent): readonly Diagnostic[];
59
59
  export {};
@@ -1,9 +1,9 @@
1
1
  export { renderPrompt } from './flow-promptTemplate.js';
2
2
  export { connectionUsage, removeConnectionUsage } from './flow-connectionUsage.js';
3
- export { matchesTriggerOutputs, triggerOutputDefinitions, triggerOutputPorts } from './trigger-contract.js';
3
+ export { matchesTriggerOutputs, normalizeTriggerOutputs, triggerOutputDefinitions, triggerOutputPorts } from './trigger-contract.js';
4
4
  import type { EngineContract } from './engine-contract.js';
5
5
  import type { RuntimeProgram } from './runtime-contract.js';
6
- import type { ConnectorActionCapability, ConnectorCapability, Graph, RevisionContent, SchemaMismatch } from '../browser/flow-change.js';
6
+ import type { ConnectorActionCapability, ConnectorCapability, Graph, InputMapping, JsonValue, Port, RevisionContent, SchemaMismatch } from '../browser/flow-change.js';
7
7
  export { availableOutputs, graphOrder, nodeInputPorts } from './flow-graph.js';
8
8
  export { validateModules } from './flow-modules.js';
9
9
  export { matchesSchema, schemaValidationErrors, variableInputCompatible } from './flow-schema.js';
@@ -18,8 +18,11 @@ export interface SemanticClosure {
18
18
  }
19
19
  export declare function flowDependencies(content: RevisionContent, triggerId?: string): SemanticClosure['dependencies'];
20
20
  export declare function flowClosure(content: RevisionContent): Promise<SemanticClosure>;
21
+ /** Canonical semantic bytes, also used by transactional storage upgrades. */
22
+ export declare function encodeFlowClosure(content: RevisionContent, triggerId?: string): Uint8Array;
21
23
  export declare function variableBindings(revision: RevisionContent, bindingIds: Iterable<string>): Readonly<Record<string, string>>;
22
24
  export interface FlowResourceReferences {
25
+ readonly calledFlowIds?: readonly string[];
23
26
  readonly variableNames: readonly string[];
24
27
  readonly connections: readonly {
25
28
  readonly providerId: string;
@@ -45,9 +48,16 @@ export interface FlowValidation {
45
48
  }
46
49
  export type FlowInputsValidation = 'invalid' | 'valid';
47
50
  export declare function validRunTrigger(revision: RevisionContent, value: unknown): boolean;
51
+ export declare function normalizeRunTrigger(revision: RevisionContent, value: unknown): {
52
+ readonly nodeId: string;
53
+ readonly outputs: Readonly<Record<string, JsonValue>>;
54
+ } | undefined;
48
55
  export declare function validateFlowInputs(revision: RevisionContent, value: unknown): FlowInputsValidation;
49
56
  export declare function validateFlow(revision: RevisionContent, engine: EngineContract): Promise<FlowValidation>;
50
57
  export interface PreparedFlow {
58
+ readonly inputDefs: readonly Port[];
59
+ readonly outputDefs: readonly Port[];
60
+ readonly outputMappings: Readonly<Record<string, InputMapping>>;
51
61
  readonly closureDigest: string;
52
62
  readonly engineContract: string;
53
63
  readonly graph: Graph;