@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
@@ -1,6 +1,6 @@
1
1
  import { l as useTranslate } from "./dist-BFmpkX4P.js";
2
- import { C as FieldDescription, E as FieldLabel, S as Field, T as FieldGroup, a as DialogDescription, c as DialogTitle, i as DialogContent, lr as Input, n as Dialog, o as DialogFooter, r as DialogClose, s as DialogHeader, t as Icon, w as FieldError, x as Spinner, xi as Button } from "./icons-Db2Jb2iX.js";
3
- import { t as WorkbenchSelect } from "./workbenchSelect-C-jf6NIM.js";
2
+ import { C as FieldDescription, E as FieldLabel, S as Field, T as FieldGroup, a as DialogDescription, c as DialogTitle, fr as Input, i as DialogContent, n as Dialog, o as DialogFooter, r as DialogClose, s as DialogHeader, t as Icon, w as FieldError, wi as Button, x as Spinner } from "./icons-BD3m0RQq.js";
3
+ import { t as WorkbenchSelect } from "./workbenchSelect-B-PFpF_Q.js";
4
4
  import { useEffect, useRef, useState } from "react";
5
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/workbench/browser/runtime/shell/createResourceDialog.tsx
@@ -1,5 +1,5 @@
1
1
  import type { DecisionQuestion } from '../common/decision.js';
2
- import type { ChangeOperation, CodeModule, ConnectorCapability, GraphNode, InputMapping, InputValues, InputPort, JsonValue, PortDefinition, RevisionContent, TaskDefinition, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookOptions } from './flow-change.js';
2
+ import type { ChangeOperation, CodeModule, ConnectorCapability, Group, GraphNode, InputMapping, InputValues, InputPort, JsonValue, Port, PortDefinition, RevisionContent, TaskDefinition, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookOptions } from './flow-change.js';
3
3
  export declare const defaultCodeTaskPorts: Pick<Extract<TaskDefinition, {
4
4
  readonly moduleId: string;
5
5
  }>, 'inputs' | 'outputs' | 'capabilities'>;
@@ -14,13 +14,17 @@ export interface LlmTaskOptions {
14
14
  }
15
15
  export type LlmInputHandle = 'input' | 'messages' | 'model' | 'template';
16
16
  export declare function defaultNodeName(_content: RevisionContent, node: GraphNode): string;
17
- export declare function repairNodeNames(content: RevisionContent): readonly ChangeOperation[];
17
+ export declare function repairNodeNames(content: RevisionContent, defaults?: {
18
+ readonly start?: string;
19
+ }): readonly ChangeOperation[];
18
20
  interface TriggerSettingsBase {
19
21
  readonly description?: string;
20
22
  readonly name: string;
21
23
  }
22
24
  export type TriggerSettings = (TriggerSettingsBase & {
23
25
  readonly kind: 'manual';
26
+ }) | (TriggerSettingsBase & {
27
+ readonly kind: 'start';
24
28
  }) | (TriggerSettingsBase & {
25
29
  readonly kind: 'error';
26
30
  }) | (TriggerSettingsBase & {
@@ -69,7 +73,7 @@ export declare function createValue(nodeId: string, name: string, values?: reado
69
73
  export declare function createWait(nodeId: string, name: string): readonly ChangeOperation[];
70
74
  export declare function createApproval(nodeId: string, name: string): readonly ChangeOperation[];
71
75
  export declare function createBuiltinTrigger(nodeId: string, node: Extract<TriggerNode, {
72
- readonly kind: 'error' | 'cron' | 'manual' | 'webhook';
76
+ readonly kind: 'error' | 'cron' | 'manual' | 'start' | 'webhook';
73
77
  }>): readonly ChangeOperation[];
74
78
  export declare function createProviderTrigger(nodeId: string, definition: TriggerKeySnapshot, options: {
75
79
  readonly config: Readonly<Record<string, JsonValue>>;
@@ -89,6 +93,8 @@ export declare function setInputSources(content: RevisionContent, nodeId: string
89
93
  export declare function setInputVariable(content: RevisionContent, nodeId: string, handle: string, name: string, bindingId: string): readonly ChangeOperation[] | undefined;
90
94
  export declare function cleanVariableBindings(content: RevisionContent, operations: readonly ChangeOperation[]): readonly ChangeOperation[];
91
95
  export declare function setConnectorConnection(content: RevisionContent, nodeId: string, connectionId: string | undefined): readonly ChangeOperation[] | undefined;
96
+ /** Edit the workflow input contract and preserve references on a single-field rename. */
97
+ export declare function updateStartInputDefs(content: RevisionContent, nodeId: string, value: readonly Port[]): readonly ChangeOperation[];
92
98
  export declare function updateTrigger(content: RevisionContent, nodeId: string, settings: TriggerSettings): readonly ChangeOperation[] | undefined;
93
99
  export declare function updateTriggerConfig(content: RevisionContent, nodeId: string, name: string, value: JsonValue | undefined): readonly ChangeOperation[] | undefined;
94
100
  export declare function updateTriggerSchedule(content: RevisionContent, nodeId: string, schedule: readonly TriggerSchedule[]): readonly ChangeOperation[] | undefined;
@@ -97,4 +103,7 @@ export declare function setCodeActions(content: RevisionContent, nodeId: string,
97
103
  export declare function createDecisionTask(identity: {
98
104
  readonly nodeId: string;
99
105
  }, name?: string, questions?: readonly DecisionQuestion[]): readonly ChangeOperation[];
106
+ /** Edit an Outputs node's definitions and mappings as one undoable change. */
107
+ export declare function updateOutputsDefs(content: RevisionContent, nodeId: string, value: readonly Port[], outputMappings?: Readonly<Record<string, InputMapping>>): readonly ChangeOperation[];
108
+ export declare function renameFlowOutputSources(content: RevisionContent, nodeIds: ReadonlySet<string>, previous: readonly (Port | Group)[], next: readonly (Port | Group)[]): readonly ChangeOperation[];
100
109
  export {};
@@ -5822,6 +5822,10 @@ function preprocess(fn, schema) {
5822
5822
  out: schema
5823
5823
  });
5824
5824
  }
5825
+ function checkJsonDepth(value, depth = 0) {
5826
+ if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
5827
+ if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
5828
+ }
5825
5829
  //#endregion
5826
5830
  //#region src/flow/common/triggerScheduleSchema.ts
5827
5831
  var triggerScheduleSchema = array(union([object({
@@ -5857,6 +5861,7 @@ var port = object({
5857
5861
  nullable: boolean(),
5858
5862
  handle: text
5859
5863
  });
5864
+ var workflowInputDefs = array(port.strict());
5860
5865
  var input = port.extend({ value: json.optional() });
5861
5866
  var group = object({
5862
5867
  collapsed: boolean().optional(),
@@ -6014,6 +6019,11 @@ var managedFields = object({
6014
6019
  messageHandle: text,
6015
6020
  inputs: record$1(text, agentValue)
6016
6021
  }).optional()
6022
+ }),
6023
+ strictObject({
6024
+ kind: literal("workflow"),
6025
+ flowId: text,
6026
+ revisionId: text
6017
6027
  })
6018
6028
  ])
6019
6029
  });
@@ -6122,6 +6132,12 @@ var base = {
6122
6132
  timeoutMs: number().optional()
6123
6133
  };
6124
6134
  var node = union([
6135
+ strictObject({
6136
+ ...base,
6137
+ kind: literal("outputs"),
6138
+ outputDefs: array(port.strict()),
6139
+ outputMappings: inputs
6140
+ }).omit({ inputs: true }),
6125
6141
  object({
6126
6142
  ...base,
6127
6143
  inputs: record$1(text, never()),
@@ -6154,6 +6170,11 @@ var node = union([
6154
6170
  ...trigger,
6155
6171
  kind: literal("manual")
6156
6172
  }),
6173
+ strictObject({
6174
+ ...trigger,
6175
+ kind: literal("start"),
6176
+ inputDefs: workflowInputDefs
6177
+ }),
6157
6178
  strictObject({
6158
6179
  ...trigger,
6159
6180
  kind: literal("error"),
@@ -6218,35 +6239,51 @@ var module = object({
6218
6239
  imports: strings,
6219
6240
  source: text
6220
6241
  });
6221
- var document = preprocess(rejectRetiredDefinitions, object({
6242
+ var document = preprocess(normalizeDocument, object({
6222
6243
  bindings: record$1(text, binding),
6223
6244
  graph
6224
6245
  }));
6225
- object({
6246
+ var revision = object({
6226
6247
  modelVersion: union([
6227
6248
  literal(2),
6228
6249
  literal(4),
6229
6250
  literal(5),
6230
- literal(6)
6251
+ literal(6),
6252
+ literal(7),
6253
+ literal(8)
6231
6254
  ]),
6232
6255
  document,
6233
6256
  modules: record$1(text, module)
6234
- }).extend({
6257
+ });
6258
+ revision.extend({
6235
6259
  kind: literal("open-flow-flow-revision"),
6236
6260
  version: literal(1)
6237
6261
  });
6238
- function rejectRetiredDefinitions(value) {
6262
+ function normalizeDocument(value) {
6239
6263
  const candidate = record(value);
6240
6264
  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.");
6241
6265
  if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
6242
6266
  const subflows = candidate.subflows;
6243
6267
  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.");
6244
6268
  if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
6269
+ if ([
6270
+ "inputDefs",
6271
+ "outputDefs",
6272
+ "outputMappings"
6273
+ ].some((field) => Object.hasOwn(candidate, field))) throw new TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");
6274
+ 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.");
6245
6275
  return value;
6246
6276
  }
6247
6277
  function record(value) {
6248
6278
  return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
6249
6279
  }
6280
+ function decodeRevisionContent(value) {
6281
+ checkJsonDepth(value);
6282
+ const content = revision.parse(value);
6283
+ checkModelVersion(content);
6284
+ assertOpenApiAuthBindings(content.document);
6285
+ return content;
6286
+ }
6250
6287
  var shapes = {
6251
6288
  "graph.trigger.sources.set": {
6252
6289
  nodeId: text,
@@ -6399,6 +6436,12 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
6399
6436
  kind: literal(kind),
6400
6437
  ...shape
6401
6438
  })])).values()])).min(1);
6439
+ function checkModelVersion(content) {
6440
+ 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.");
6441
+ 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.");
6442
+ 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.");
6443
+ 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.");
6444
+ }
6402
6445
  //#endregion
6403
6446
  //#region src/flow/common/condition.ts
6404
6447
  var unaryOperator = (operator) => operator.startsWith("is");
@@ -6418,6 +6461,7 @@ function conditionOperands(node) {
6418
6461
  }] : []])));
6419
6462
  }
6420
6463
  function nodeInputMappings(node) {
6464
+ if (node.kind == "outputs") return node.outputMappings;
6421
6465
  if (node.kind != "condition") return "inputs" in node ? node.inputs : {};
6422
6466
  return Object.fromEntries(conditionOperands(node).flatMap(({ handle, operand }) => operand.kind == "source" ? [[handle, {
6423
6467
  kind: "sources",
@@ -6569,6 +6613,40 @@ function decodeConnectorCapabilities(value) {
6569
6613
  };
6570
6614
  });
6571
6615
  }
6616
+ function isTriggerNode(node) {
6617
+ return [
6618
+ "manual",
6619
+ "start",
6620
+ "error",
6621
+ "webhook",
6622
+ "cron",
6623
+ "poll",
6624
+ "integration"
6625
+ ].includes(node.kind);
6626
+ }
6627
+ function upgradeDecodedRevisionContent(content) {
6628
+ const graph = content.document.graph;
6629
+ const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
6630
+ if (!hasManual && content.modelVersion == 8) return content;
6631
+ return {
6632
+ ...content,
6633
+ modelVersion: 8,
6634
+ document: {
6635
+ ...content.document,
6636
+ graph: hasManual ? {
6637
+ ...graph,
6638
+ nodes: Object.fromEntries(Object.entries(graph.nodes).map(([id, node]) => [id, upgradeManualTrigger(node)]))
6639
+ } : graph
6640
+ }
6641
+ };
6642
+ }
6643
+ function upgradeManualTrigger(node) {
6644
+ return node.kind == "manual" ? {
6645
+ ...node,
6646
+ kind: "start",
6647
+ inputDefs: []
6648
+ } : node;
6649
+ }
6572
6650
  function normalizeNodeName(value) {
6573
6651
  return value.trim().normalize("NFC");
6574
6652
  }
@@ -6587,8 +6665,9 @@ function invalid(message) {
6587
6665
  throw new FlowChangeError(message);
6588
6666
  }
6589
6667
  function applyFlowChanges(content, operations) {
6590
- const document = { ...content.document };
6591
- const modules = { ...content.modules };
6668
+ const source = content.modelVersion != 8 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
6669
+ const document = { ...source.document };
6670
+ const modules = { ...source.modules };
6592
6671
  for (const operation of operations) switch (operation.kind) {
6593
6672
  case "graph.trigger.sources.set": {
6594
6673
  const graph = document.graph;
@@ -6639,8 +6718,9 @@ function applyFlowChanges(content, operations) {
6639
6718
  case "graph.edge.connect": {
6640
6719
  const graph = document.graph;
6641
6720
  if (graph.nodes[operation.edge.source] == null) invalid("The source Node does not exist.");
6721
+ if (graph.nodes[operation.edge.source]?.kind == "outputs") invalid("Outputs cannot have downstream execution edges.");
6642
6722
  const node = graph.nodes[operation.edge.target];
6643
- if (node == null || !("inputs" in node)) invalid("The target Node does not accept execution dependencies.");
6723
+ if (node == null || isTriggerNode(node)) invalid("The target Node does not accept execution dependencies.");
6644
6724
  if (graph.edges.some((edge) => dequal(edge, operation.edge))) invalid("The Nodes are already connected.");
6645
6725
  Object.assign(document, { graph: {
6646
6726
  ...graph,
@@ -6720,9 +6800,10 @@ function applyFlowChanges(content, operations) {
6720
6800
  const graph = document.graph;
6721
6801
  if (graph.nodes[operation.nodeId] != null) invalid("A Node with this ID already exists in the target graph.");
6722
6802
  if (operation.node.kind == "error" && Object.values(graph.nodes).some((node) => node.kind == "error")) invalid("A graph can contain only one Flow Error node.");
6723
- if (operation.node.kind == "manual" && Object.values(graph.nodes).some((node) => node.kind == "manual")) invalid("A graph can contain only one manual Trigger.");
6803
+ 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.");
6724
6804
  if (operation.node.kind == "task" && "moduleId" in operation.node.task && operation.node.task.capabilities !== void 0) decodeConnectorCapabilities(operation.node.task.capabilities);
6725
6805
  if (operation.node.name == null) invalid("A Node name cannot be empty.");
6806
+ if (operation.node.kind == "outputs" && Object.values(graph.nodes).some((node) => node.kind == "outputs")) invalid("A graph can contain only one Outputs node.");
6726
6807
  const name = normalizeNodeName(operation.node.name);
6727
6808
  const issue = nodeNameIssue(graph, operation.nodeId, name);
6728
6809
  if (issue == "empty") invalid("A Node name cannot be empty.");
@@ -6780,11 +6861,24 @@ function applyFlowChanges(content, operations) {
6780
6861
  case "graph.node.input.set": {
6781
6862
  const graph = document.graph;
6782
6863
  const node = graph.nodes[operation.nodeId];
6783
- if (node == null || !("inputs" in node)) invalid("The Node does not accept inputs.");
6864
+ if (node == null || isTriggerNode(node)) invalid("The Node does not accept inputs.");
6784
6865
  if (!dequal(nodeInputMappings(node)[operation.handle], operation.before)) invalid("The Node input changed before this operation was applied.");
6785
- const inputs = { ...node.inputs };
6866
+ const inputs = { ...nodeInputMappings(node) };
6786
6867
  if (operation.value == null) delete inputs[operation.handle];
6787
6868
  else inputs[operation.handle] = operation.value;
6869
+ if (node.kind == "outputs") {
6870
+ document.graph = {
6871
+ ...graph,
6872
+ nodes: {
6873
+ ...graph.nodes,
6874
+ [operation.nodeId]: {
6875
+ ...node,
6876
+ outputMappings: inputs
6877
+ }
6878
+ }
6879
+ };
6880
+ break;
6881
+ }
6788
6882
  Object.assign(document, { graph: {
6789
6883
  ...graph,
6790
6884
  nodes: {
@@ -7012,11 +7106,11 @@ function applyFlowChanges(content, operations) {
7012
7106
  }
7013
7107
  }
7014
7108
  assertOpenApiAuthBindings(document);
7015
- return {
7109
+ return upgradeDecodedRevisionContent({
7016
7110
  document,
7017
- modelVersion: 6,
7111
+ modelVersion: 8,
7018
7112
  modules
7019
- };
7113
+ });
7020
7114
  }
7021
7115
  //#endregion
7022
7116
  //#region src/json-schema-subset/utils.ts
@@ -10136,7 +10230,7 @@ function deleteNodes(content, nodeIds) {
10136
10230
  }
10137
10231
  function updateSettings(content, nodeId, settings) {
10138
10232
  const node = content.document.graph?.nodes[nodeId];
10139
- if (node == null || !("inputs" in node)) return;
10233
+ if (node == null || isTriggerNode(node)) return;
10140
10234
  const operations = [];
10141
10235
  if (node.name != settings.name) operations.push({
10142
10236
  before: node.name,
@@ -10163,7 +10257,7 @@ function updateSettings(content, nodeId, settings) {
10163
10257
  }
10164
10258
  function setInputValues(content, nodeId, values) {
10165
10259
  const node = content.document.graph?.nodes[nodeId];
10166
- if (node == null || !("inputs" in node)) return;
10260
+ if (node == null || isTriggerNode(node)) return;
10167
10261
  const operations = [];
10168
10262
  for (const [handle, value] of Object.entries(values)) {
10169
10263
  const before = nodeInputMappings(node)[handle];
@@ -10181,7 +10275,7 @@ function setInputValues(content, nodeId, values) {
10181
10275
  }
10182
10276
  function setInputSources(content, nodeId, handle, sources) {
10183
10277
  const node = content.document.graph?.nodes[nodeId];
10184
- if (node == null || !("inputs" in node)) return [];
10278
+ if (node == null || isTriggerNode(node)) return [];
10185
10279
  return cleanVariableBindings(content, [{
10186
10280
  kind: "graph.node.input.set",
10187
10281
  nodeId,
@@ -10195,7 +10289,7 @@ function setInputSources(content, nodeId, handle, sources) {
10195
10289
  }
10196
10290
  function setInputVariable(content, nodeId, handle, name, bindingId) {
10197
10291
  const node = content.document.graph?.nodes[nodeId];
10198
- if (node == null || !("inputs" in node)) return;
10292
+ if (node == null || isTriggerNode(node)) return;
10199
10293
  const mapping = nodeInputMappings(node)[handle];
10200
10294
  const currentId = mapping?.kind == "sources" && mapping.sources.length == 1 && mapping.sources[0]?.kind == "binding" ? mapping.sources[0].bindingId : void 0;
10201
10295
  const current = currentId == null ? void 0 : content.document.bindings[currentId];
@@ -10245,7 +10339,7 @@ function bindingReferences(document) {
10245
10339
  references.set(bindingId, (references.get(bindingId) ?? 0) + 1);
10246
10340
  };
10247
10341
  for (const node of Object.values(document.graph.nodes)) {
10248
- if (!("inputs" in node)) continue;
10342
+ if (isTriggerNode(node)) continue;
10249
10343
  const inputs = Object.values(nodeInputMappings(node));
10250
10344
  for (const mapping of inputs) {
10251
10345
  if (mapping.kind != "sources") continue;
@@ -10293,6 +10387,7 @@ function updateTrigger(content, nodeId, settings) {
10293
10387
  value: settings.description
10294
10388
  });
10295
10389
  switch (settings.kind) {
10390
+ case "start":
10296
10391
  case "error":
10297
10392
  case "manual":
10298
10393
  if (trigger.kind != settings.kind) return;
@@ -1,6 +1,6 @@
1
1
  import type { ChangeOperation, FlowDocument, JsonValue, RevisionContent } from './flow-change.js';
2
2
  import { z } from 'zod';
3
- export declare const currentFlowModelVersion = 6;
3
+ export declare const currentFlowModelVersion = 8;
4
4
  /** Configuration schemas shared by the node authoring boundary. */
5
5
  export declare const authoringDefinitionSchemas: {
6
6
  input: z.ZodObject<{
@@ -267,6 +267,8 @@ export declare const authoringDefinitionSchemas: {
267
267
  }, z.core.$strip>>;
268
268
  }, z.core.$strict>;
269
269
  };
270
+ /** Explicit storage upgrade only. Normal reads and authoring still reject retired fields. */
271
+ export declare function upgradeWorkflowInterfaceDocument(value: unknown): unknown;
270
272
  /** Best-effort recovery for a parseable Revision envelope. Invalid collection entries are discarded. */
271
273
  export declare function repairRevisionEnvelope(value: unknown): RevisionContent;
272
274
  export declare function decodeFlowDocument(value: unknown): FlowDocument;
@@ -108,7 +108,7 @@ export interface ConditionNode extends GraphNodeBase {
108
108
  readonly matchMode: 'first' | 'all';
109
109
  readonly kind: 'condition';
110
110
  }
111
- export type ManagedTaskExecutor = import('../common/decision.js').DecisionExecutor | import('../common/openapi.js').OpenApiExecutor | {
111
+ export type ManagedTaskExecutor = import('../common/workflow.js').WorkflowExecutor | import('../common/decision.js').DecisionExecutor | import('../common/openapi.js').OpenApiExecutor | {
112
112
  readonly kind: 'connector';
113
113
  readonly action: string;
114
114
  readonly connectionId?: string;
@@ -257,6 +257,9 @@ interface TriggerNodeBase {
257
257
  }
258
258
  export type TriggerNode = (TriggerNodeBase & {
259
259
  readonly kind: 'manual';
260
+ }) | (TriggerNodeBase & {
261
+ readonly kind: 'start';
262
+ readonly inputDefs: readonly Port[];
260
263
  }) | (TriggerNodeBase & {
261
264
  readonly kind: 'error';
262
265
  readonly sourceFlowIds?: readonly string[];
@@ -284,7 +287,13 @@ export type TriggerNode = (TriggerNodeBase & {
284
287
  };
285
288
  readonly kind: 'integration';
286
289
  });
287
- export type GraphNode = ApprovalNode | ConditionNode | TaskNode | TriggerNode | ValueNode | WaitNode;
290
+ export interface OutputsNode extends Omit<GraphNodeBase, 'inputs'> {
291
+ readonly kind: 'outputs';
292
+ readonly outputDefs: readonly Port[];
293
+ readonly outputMappings: Readonly<Record<string, InputMapping>>;
294
+ }
295
+ export declare function isTriggerNode(node: GraphNode): node is TriggerNode;
296
+ export type GraphNode = OutputsNode | ApprovalNode | ConditionNode | TaskNode | TriggerNode | ValueNode | WaitNode;
288
297
  export interface FlowDocument {
289
298
  readonly bindings: Readonly<Record<string, {
290
299
  readonly kind: 'variable';
@@ -299,7 +308,7 @@ export interface CodeModule {
299
308
  }
300
309
  export interface RevisionContent {
301
310
  readonly document: FlowDocument;
302
- readonly modelVersion: 2 | 4 | 5 | typeof currentFlowModelVersion;
311
+ readonly modelVersion: 2 | 4 | 5 | 6 | 7 | typeof currentFlowModelVersion;
303
312
  readonly modules: Readonly<Record<string, CodeModule>>;
304
313
  }
305
314
  export interface GraphEdge {
@@ -307,6 +316,9 @@ export interface GraphEdge {
307
316
  readonly sourceHandle?: string;
308
317
  readonly target: string;
309
318
  }
319
+ /** Lossless upgrade of readable content. Historical content and its encoding stay unchanged. */
320
+ export declare function upgradeRevisionContent(content: RevisionContent): RevisionContent;
321
+ export declare function upgradeManualTrigger(node: GraphNode): GraphNode;
310
322
  export declare function normalizeNodeName(value: string): string;
311
323
  export declare function nextNodeName(value: string, names: Iterable<string>): string;
312
324
  export declare function nodeNameIssue(graph: Graph, nodeId: string, value: string): 'duplicate' | 'empty' | undefined;