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

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 (72) hide show
  1. package/dist/browser/ContentIcon-CsECY5id.js +11868 -0
  2. package/dist/browser/FlowCanvas-C5X22xQ7.js +22721 -0
  3. package/dist/browser/{createResourceDialog-BQVD8Rqb.js → createResourceDialog-Di5BBrQv.js} +3 -2
  4. package/dist/browser/dialog-Bjo-r9B0.js +8862 -0
  5. package/dist/browser/event-sources.d.ts +4 -2
  6. package/dist/browser/exportSvg-Cj6Spxx-.js +659 -0
  7. package/dist/browser/flow-authoring-node.d.ts +3 -1
  8. package/dist/browser/flow-authoring.js +68 -7
  9. package/dist/browser/flow-change-schema.d.ts +3 -1
  10. package/dist/browser/flow-change.d.ts +17 -2
  11. package/dist/browser/flow-change.js +82 -9
  12. package/dist/browser/{flowChanges-VB9Y4iy7.js → flowChanges-Dp-rcEJ6.js} +4312 -16566
  13. package/dist/browser/{flowRunInputEditorStore-DJqmR6Qh.js → flowRunInputEditorStore-ys1-w9GW.js} +2 -1
  14. package/dist/browser/{flowWorkspace-C1hlTnZq.js → flowWorkspace-CB1QACku.js} +1304 -23538
  15. package/dist/browser/languages-gYzoQqCi.js +68 -0
  16. package/dist/browser/licenses.md +24 -0
  17. package/dist/browser/preview.css +53 -41
  18. package/dist/browser/preview.js +3974 -4094
  19. package/dist/browser/{dialog-CS2Vt2if.js → tooltip-CJjYs_2I.js} +710 -9472
  20. package/dist/browser/{typeScriptSession-D0bjYDeg.js → typeScriptSession-B0hC-C8y.js} +1 -1
  21. package/dist/browser/ui.css +12 -0
  22. package/dist/browser/{value-BADHeZ9I.js → value-BbFQZZ_V.js} +1 -68
  23. package/dist/browser/workbench.css +2840 -2824
  24. package/dist/browser/workbench.js +437 -337
  25. package/dist/browser/{workbenchSelect-CpXhjUou.js → workbenchSelect-C3hxUcYm.js} +2 -1
  26. package/dist/command/index.js +55 -51
  27. package/dist/common/authoring.d.ts +20 -0
  28. package/dist/common/authoringSchema.d.ts +243 -0
  29. package/dist/common/connector-proxy.d.ts +4 -0
  30. package/dist/common/control-api-conformance.js +173 -36
  31. package/dist/common/control-api.d.ts +22 -8
  32. package/dist/common/control-api.js +156 -18
  33. package/dist/common/control-requests.d.ts +32 -19
  34. package/dist/common/control-requests.js +2854 -152
  35. package/dist/common/decision.js +27 -3
  36. package/dist/common/engine-contract.d.ts +2 -2
  37. package/dist/common/event-source-definition.d.ts +34 -16
  38. package/dist/common/event-source.d.ts +63 -5
  39. package/dist/common/event-source.js +5744 -261
  40. package/dist/common/event-sources.d.ts +99 -6
  41. package/dist/common/flow-encoding.js +49 -10
  42. package/dist/common/flow-errorHandling.d.ts +36 -0
  43. package/dist/common/flow-graph.d.ts +4 -2
  44. package/dist/common/flow-retry.d.ts +19 -0
  45. package/dist/common/flow-semantics.js +94 -10
  46. package/dist/common/{fr-Du5gv3kM.js → fr-CNTSedYU.js} +259 -18
  47. package/dist/common/integration-trigger.d.ts +1 -1
  48. package/dist/common/integration-trigger.js +27 -3
  49. package/dist/common/{ja-D2wyPdTF.js → ja-CxQBHr2J.js} +259 -18
  50. package/dist/common/{ko-Cuu2AOaC.js → ko-D1Exiv1h.js} +259 -18
  51. package/dist/common/mcp.d.ts +30 -0
  52. package/dist/common/mcp.js +158 -20
  53. package/dist/common/openapi.js +27 -3
  54. package/dist/common/poll-trigger.js +27 -3
  55. package/dist/common/provider-triggers.d.ts +0 -2
  56. package/dist/common/provider-triggers.js +358 -155
  57. package/dist/common/{ru-BjI_JSsx.js → ru-BzLZv0B7.js} +259 -18
  58. package/dist/common/run-events.d.ts +2 -0
  59. package/dist/common/run-events.js +4 -2
  60. package/dist/common/runtime-contract.d.ts +1 -0
  61. package/dist/common/runtime-contract.js +4 -4
  62. package/dist/common/scheduler.d.ts +13 -2
  63. package/dist/common/scheduler.js +288 -98
  64. package/dist/common/webhook-trigger.js +27 -3
  65. package/dist/common/workflow.js +27 -3
  66. package/dist/common/{zh-CN-CnnXkzLh.js → zh-CN-Dg_xSGde.js} +259 -18
  67. package/dist/common/{zh-TW-CJnR2dgF.js → zh-TW-oxuLwsV0.js} +259 -18
  68. package/dist/index.d.ts +1 -0
  69. package/package.json +1 -1
  70. package/dist/common/event-source-feishu.d.ts +0 -3
  71. package/dist/common/feishu-events.d.ts +0 -19
  72. package/dist/common/feishu-subscriptions.d.ts +0 -6
@@ -1,5 +1,5 @@
1
1
  import type { DecisionQuestion } from '../common/decision.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';
2
+ import type { ChangeOperation, CodeModule, ConnectorCapability, Group, GraphNode, InputMapping, InputValues, InputPort, JsonValue, Port, PortDefinition, RetryConfiguration, 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'>;
@@ -7,6 +7,8 @@ export interface Settings {
7
7
  readonly name?: string;
8
8
  readonly maxExecutions?: number;
9
9
  readonly timeoutMs?: number;
10
+ readonly onError?: 'stop' | 'error';
11
+ readonly retry?: RetryConfiguration;
10
12
  }
11
13
  export interface LlmTaskOptions {
12
14
  readonly inputs?: Readonly<Partial<Record<LlmInputHandle, JsonValue>>>;
@@ -5827,6 +5827,28 @@ function checkJsonDepth(value, depth = 0) {
5827
5827
  if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
5828
5828
  }
5829
5829
  //#endregion
5830
+ //#region src/flow/common/retry.ts
5831
+ var retryNodeTypes = [
5832
+ "code",
5833
+ "connector",
5834
+ "openapi",
5835
+ "llm",
5836
+ "decision"
5837
+ ];
5838
+ var nodeRetryLimits = {
5839
+ maxRetries: 5,
5840
+ minIntervalMs: 1e3,
5841
+ maxIntervalMs: 6e4,
5842
+ intervalStepMs: 1e3
5843
+ };
5844
+ var retryConfigurationSchema = strictObject({
5845
+ maxRetries: number().int().min(0).max(nodeRetryLimits.maxRetries),
5846
+ intervalMs: number().int().min(nodeRetryLimits.minIntervalMs).max(nodeRetryLimits.maxIntervalMs).multipleOf(nodeRetryLimits.intervalStepMs)
5847
+ });
5848
+ function supportsNodeRetry(node) {
5849
+ return node.kind == "task" && retryNodeTypes.some((type) => type == ("moduleId" in node.task ? "code" : node.task.executor.kind));
5850
+ }
5851
+ //#endregion
5830
5852
  //#region src/flow/common/triggerScheduleSchema.ts
5831
5853
  var triggerScheduleSchema = array(union([object({
5832
5854
  type: literal("cron"),
@@ -5872,6 +5894,7 @@ var source = union([object({
5872
5894
  kind: literal("node"),
5873
5895
  nodeId: text,
5874
5896
  output: text,
5897
+ system: literal(true).optional(),
5875
5898
  field: text.optional()
5876
5899
  }), object({
5877
5900
  kind: literal("binding"),
@@ -6130,7 +6153,9 @@ var base = {
6130
6153
  name: text.optional(),
6131
6154
  description: text.optional(),
6132
6155
  icon: text.optional(),
6133
- timeoutMs: number().optional()
6156
+ timeoutMs: number().optional(),
6157
+ retry: retryConfigurationSchema.optional(),
6158
+ onError: _enum(["stop", "error"]).optional()
6134
6159
  };
6135
6160
  var node = union([
6136
6161
  strictObject({
@@ -6251,7 +6276,8 @@ var revision = object({
6251
6276
  literal(5),
6252
6277
  literal(6),
6253
6278
  literal(7),
6254
- literal(8)
6279
+ literal(8),
6280
+ literal(9)
6255
6281
  ]),
6256
6282
  document,
6257
6283
  modules: record$1(text, module)
@@ -6320,6 +6346,13 @@ var shapes = {
6320
6346
  },
6321
6347
  "graph.node.delete": at,
6322
6348
  "graph.node.field.set": union([
6349
+ object({
6350
+ ...at,
6351
+ kind: literal("graph.node.field.set"),
6352
+ field: literal("retry"),
6353
+ before: retryConfigurationSchema.optional(),
6354
+ value: retryConfigurationSchema.optional()
6355
+ }),
6323
6356
  object({
6324
6357
  ...at,
6325
6358
  kind: literal("graph.node.field.set"),
@@ -6333,7 +6366,8 @@ var shapes = {
6333
6366
  field: _enum([
6334
6367
  "description",
6335
6368
  "icon",
6336
- "name"
6369
+ "name",
6370
+ "onError"
6337
6371
  ]),
6338
6372
  before: text.optional(),
6339
6373
  value: text.optional()
@@ -6438,6 +6472,12 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
6438
6472
  ...shape
6439
6473
  })])).values()])).min(1);
6440
6474
  function checkModelVersion(content) {
6475
+ if (content.modelVersion < 9 && Object.values(content.document.graph.nodes).some((candidateNode) => "retry" in candidateNode && candidateNode.retry != null)) throw new TypeError("Node retries require Flow model version 9.");
6476
+ if (content.modelVersion < 9 && Object.values(content.document.graph.nodes).some((candidateNode) => {
6477
+ if (candidateNode.onError != null) return true;
6478
+ if ([...Object.values("inputs" in candidateNode ? candidateNode.inputs : {}), ...Object.values(candidateNode.kind == "outputs" ? candidateNode.outputMappings : {})].some((candidateMapping) => candidateMapping.kind == "sources" && candidateMapping.sources.some((candidateSource) => candidateSource.kind == "node" && candidateSource.system))) return true;
6479
+ return candidateNode.kind == "condition" && candidateNode.cases.some((item) => item.groups.some((candidateGroup) => candidateGroup.expressions.some((expression) => [expression.left, expression.right].some((candidateOperand) => candidateOperand?.kind == "source" && candidateOperand.source.kind == "node" && candidateOperand.source.system))));
6480
+ })) throw new TypeError("Node error handling requires Flow model version 9.");
6441
6481
  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.");
6442
6482
  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.");
6443
6483
  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.");
@@ -6500,6 +6540,11 @@ function setConditionInput(node, handle, mapping) {
6500
6540
  };
6501
6541
  }
6502
6542
  //#endregion
6543
+ //#region src/flow/common/errorHandling.ts
6544
+ function supportsNodeErrorHandling(node) {
6545
+ return supportsNodeRetry(node);
6546
+ }
6547
+ //#endregion
6503
6548
  //#region src/flow/common/change.ts
6504
6549
  function decodeConnectorCapabilities(value) {
6505
6550
  if (!Array.isArray(value)) throw new TypeError("Connector capabilities must be an array.");
@@ -6628,10 +6673,10 @@ function isTriggerNode(node) {
6628
6673
  function upgradeDecodedRevisionContent(content) {
6629
6674
  const graph = content.document.graph;
6630
6675
  const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
6631
- if (!hasManual && content.modelVersion == 8) return content;
6676
+ if (!hasManual && content.modelVersion == 9) return content;
6632
6677
  return {
6633
6678
  ...content,
6634
- modelVersion: 8,
6679
+ modelVersion: 9,
6635
6680
  document: {
6636
6681
  ...content.document,
6637
6682
  graph: hasManual ? {
@@ -6666,7 +6711,7 @@ function invalid(message) {
6666
6711
  throw new FlowChangeError(message);
6667
6712
  }
6668
6713
  function applyFlowChanges(content, operations) {
6669
- const source = content.modelVersion != 8 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
6714
+ const source = content.modelVersion != 9 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
6670
6715
  const document = { ...source.document };
6671
6716
  const modules = { ...source.modules };
6672
6717
  for (const operation of operations) switch (operation.kind) {
@@ -6838,6 +6883,8 @@ function applyFlowChanges(content, operations) {
6838
6883
  const graph = document.graph;
6839
6884
  const node = graph.nodes[operation.nodeId];
6840
6885
  if (node == null) invalid("The Node does not exist in the target graph.");
6886
+ if (operation.field == "onError" && operation.value != null && (!supportsNodeErrorHandling(node) || !["stop", "error"].includes(String(operation.value)))) invalid("This node does not support this error handling setting.");
6887
+ if (operation.field == "retry" && operation.value != null && !supportsNodeRetry(node)) invalid("This node does not support retries.");
6841
6888
  if (operation.field == "connectionId" && node.kind != "poll" && node.kind != "integration") invalid("Only provider Triggers select a node Connection.");
6842
6889
  if (!dequal(Reflect.get(node, operation.field), operation.before)) invalid("The Node field changed before this operation was applied.");
6843
6890
  const updated = { ...node };
@@ -7109,7 +7156,7 @@ function applyFlowChanges(content, operations) {
7109
7156
  assertOpenApiAuthBindings(document);
7110
7157
  return upgradeDecodedRevisionContent({
7111
7158
  document,
7112
- modelVersion: 8,
7159
+ modelVersion: 9,
7113
7160
  modules
7114
7161
  });
7115
7162
  }
@@ -10254,6 +10301,20 @@ function updateSettings(content, nodeId, settings) {
10254
10301
  nodeId,
10255
10302
  value: settings.timeoutMs
10256
10303
  });
10304
+ if (Object.hasOwn(settings, "onError") && node.onError != settings.onError) operations.push({
10305
+ before: node.onError,
10306
+ field: "onError",
10307
+ kind: "graph.node.field.set",
10308
+ nodeId,
10309
+ value: settings.onError
10310
+ });
10311
+ if (Object.hasOwn(settings, "retry") && !dequal(node.retry, settings.retry)) operations.push({
10312
+ before: node.retry,
10313
+ field: "retry",
10314
+ kind: "graph.node.field.set",
10315
+ nodeId,
10316
+ value: settings.retry
10317
+ });
10257
10318
  return operations;
10258
10319
  }
10259
10320
  function setInputValues(content, nodeId, values) {
@@ -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 = 8;
3
+ export declare const currentFlowModelVersion = 9;
4
4
  /** Configuration schemas shared by the node authoring boundary. */
5
5
  export declare const authoringDefinitionSchemas: {
6
6
  input: z.ZodObject<{
@@ -57,6 +57,7 @@ export declare const authoringDefinitionSchemas: {
57
57
  kind: z.ZodLiteral<"node">;
58
58
  nodeId: z.ZodString;
59
59
  output: z.ZodString;
60
+ system: z.ZodOptional<z.ZodLiteral<true>>;
60
61
  field: z.ZodOptional<z.ZodString>;
61
62
  }, z.core.$strip>, z.ZodObject<{
62
63
  kind: z.ZodLiteral<"binding">;
@@ -95,6 +96,7 @@ export declare const authoringDefinitionSchemas: {
95
96
  kind: z.ZodLiteral<"node">;
96
97
  nodeId: z.ZodString;
97
98
  output: z.ZodString;
99
+ system: z.ZodOptional<z.ZodLiteral<true>>;
98
100
  field: z.ZodOptional<z.ZodString>;
99
101
  }, z.core.$strip>, z.ZodObject<{
100
102
  kind: z.ZodLiteral<"binding">;
@@ -1,8 +1,13 @@
1
1
  import type { JsonValue, Port, PortDefinition } from '../index.js';
2
2
  export { fixedInputValue, inputValue, inputValues } from './flow-input-value.js';
3
+ import type { RetryConfiguration } from '../common/flow-retry.js';
3
4
  import type { WebhookMethod } from './webhook-method.js';
4
5
  import { currentFlowModelVersion } from './flow-change-schema.js';
5
6
  export { changeOperationsSchema, currentFlowModelVersion, decodeChangeOperations } from './flow-change-schema.js';
7
+ export type { RetryConfiguration } from '../common/flow-retry.js';
8
+ export { supportsNodeRetry } from '../common/flow-retry.js';
9
+ export { nodeSystemOutputPorts, supportsNodeErrorHandling, nodeErrorSchema } from '../common/flow-errorHandling.js';
10
+ export type { NodeErrorData } from '../common/flow-errorHandling.js';
6
11
  export type { WebhookMethod };
7
12
  export type { JsonValue, Port, PortDefinition } from '../index.js';
8
13
  export type SchemaKeyword = 'const' | 'enum' | 'exclusiveMaximum' | 'exclusiveMinimum' | 'maximum' | 'maxItems' | 'maxLength' | 'maxProperties' | 'minimum' | 'minItems' | 'minLength' | 'minProperties' | 'multipleOf' | 'pattern' | 'required' | 'type';
@@ -35,6 +40,7 @@ export interface Group {
35
40
  }
36
41
  export declare function portsByHandle<Value extends Port>(ports: readonly (Value | Group)[]): Readonly<Record<string, Value>>;
37
42
  export interface NodeSource {
43
+ readonly system?: true;
38
44
  readonly field?: string;
39
45
  readonly kind: 'node';
40
46
  readonly nodeId: string;
@@ -62,6 +68,8 @@ interface GraphNodeBase {
62
68
  readonly name?: string;
63
69
  readonly maxExecutions?: number;
64
70
  readonly timeoutMs?: number;
71
+ readonly retry?: RetryConfiguration;
72
+ readonly onError?: 'stop' | 'error';
65
73
  }
66
74
  export interface ValueNode extends GraphNodeBase {
67
75
  readonly kind: 'value';
@@ -251,6 +259,7 @@ export interface WebhookOptions {
251
259
  readonly responseStatusCode?: number;
252
260
  }
253
261
  interface TriggerNodeBase {
262
+ readonly onError?: never;
254
263
  readonly description?: string;
255
264
  readonly icon?: string;
256
265
  readonly name: string;
@@ -308,7 +317,7 @@ export interface CodeModule {
308
317
  }
309
318
  export interface RevisionContent {
310
319
  readonly document: FlowDocument;
311
- readonly modelVersion: 2 | 4 | 5 | 6 | 7 | typeof currentFlowModelVersion;
320
+ readonly modelVersion: 2 | 4 | 5 | 6 | 7 | 8 | typeof currentFlowModelVersion;
312
321
  readonly modules: Readonly<Record<string, CodeModule>>;
313
322
  }
314
323
  export interface GraphEdge {
@@ -374,10 +383,16 @@ export type ChangeOperation = {
374
383
  readonly nodeId: string;
375
384
  } | {
376
385
  readonly before?: number | string;
377
- readonly field: 'connectionId' | 'description' | 'icon' | 'maxExecutions' | 'name' | 'timeoutMs';
386
+ readonly field: 'connectionId' | 'description' | 'icon' | 'maxExecutions' | 'name' | 'timeoutMs' | 'onError';
378
387
  readonly kind: 'graph.node.field.set';
379
388
  readonly nodeId: string;
380
389
  readonly value?: number | string;
390
+ } | {
391
+ readonly before?: RetryConfiguration;
392
+ readonly field: 'retry';
393
+ readonly kind: 'graph.node.field.set';
394
+ readonly nodeId: string;
395
+ readonly value?: RetryConfiguration;
381
396
  } | {
382
397
  readonly before?: InputMapping;
383
398
  readonly handle: string;
@@ -8756,6 +8756,28 @@ function checkJsonDepth(value, depth = 0) {
8756
8756
  if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
8757
8757
  }
8758
8758
  //#endregion
8759
+ //#region src/flow/common/retry.ts
8760
+ var retryNodeTypes = [
8761
+ "code",
8762
+ "connector",
8763
+ "openapi",
8764
+ "llm",
8765
+ "decision"
8766
+ ];
8767
+ var nodeRetryLimits = {
8768
+ maxRetries: 5,
8769
+ minIntervalMs: 1e3,
8770
+ maxIntervalMs: 6e4,
8771
+ intervalStepMs: 1e3
8772
+ };
8773
+ var retryConfigurationSchema = strictObject({
8774
+ maxRetries: number().int().min(0).max(nodeRetryLimits.maxRetries),
8775
+ intervalMs: number().int().min(nodeRetryLimits.minIntervalMs).max(nodeRetryLimits.maxIntervalMs).multipleOf(nodeRetryLimits.intervalStepMs)
8776
+ });
8777
+ function supportsNodeRetry(node) {
8778
+ return node.kind == "task" && retryNodeTypes.some((type) => type == ("moduleId" in node.task ? "code" : node.task.executor.kind));
8779
+ }
8780
+ //#endregion
8759
8781
  //#region src/flow/common/triggerScheduleSchema.ts
8760
8782
  var triggerScheduleSchema = array(union([object({
8761
8783
  type: literal("cron"),
@@ -8783,7 +8805,7 @@ var webhookMethods = [
8783
8805
  ];
8784
8806
  //#endregion
8785
8807
  //#region src/flow/common/changeSchema.ts
8786
- var currentFlowModelVersion = 8;
8808
+ var currentFlowModelVersion = 9;
8787
8809
  var text = string();
8788
8810
  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.");
8789
8811
  var json = json$1();
@@ -8804,6 +8826,7 @@ var source = union([object({
8804
8826
  kind: literal("node"),
8805
8827
  nodeId: text,
8806
8828
  output: text,
8829
+ system: literal(true).optional(),
8807
8830
  field: text.optional()
8808
8831
  }), object({
8809
8832
  kind: literal("binding"),
@@ -9062,7 +9085,9 @@ var base = {
9062
9085
  name: text.optional(),
9063
9086
  description: text.optional(),
9064
9087
  icon: text.optional(),
9065
- timeoutMs: number().optional()
9088
+ timeoutMs: number().optional(),
9089
+ retry: retryConfigurationSchema.optional(),
9090
+ onError: _enum(["stop", "error"]).optional()
9066
9091
  };
9067
9092
  var node = union([
9068
9093
  strictObject({
@@ -9183,7 +9208,8 @@ var revision = object({
9183
9208
  literal(5),
9184
9209
  literal(6),
9185
9210
  literal(7),
9186
- literal(8)
9211
+ literal(8),
9212
+ literal(9)
9187
9213
  ]),
9188
9214
  document,
9189
9215
  modules: record$1(text, module)
@@ -9252,6 +9278,13 @@ var shapes = {
9252
9278
  },
9253
9279
  "graph.node.delete": at,
9254
9280
  "graph.node.field.set": union([
9281
+ object({
9282
+ ...at,
9283
+ kind: literal("graph.node.field.set"),
9284
+ field: literal("retry"),
9285
+ before: retryConfigurationSchema.optional(),
9286
+ value: retryConfigurationSchema.optional()
9287
+ }),
9255
9288
  object({
9256
9289
  ...at,
9257
9290
  kind: literal("graph.node.field.set"),
@@ -9265,7 +9298,8 @@ var shapes = {
9265
9298
  field: _enum([
9266
9299
  "description",
9267
9300
  "icon",
9268
- "name"
9301
+ "name",
9302
+ "onError"
9269
9303
  ]),
9270
9304
  before: text.optional(),
9271
9305
  value: text.optional()
@@ -9394,6 +9428,12 @@ function changeOperationsSchema(kind) {
9394
9428
  return toJSONSchema(schema, { io: "input" });
9395
9429
  }
9396
9430
  function checkModelVersion(content) {
9431
+ if (content.modelVersion < 9 && Object.values(content.document.graph.nodes).some((candidateNode) => "retry" in candidateNode && candidateNode.retry != null)) throw new TypeError("Node retries require Flow model version 9.");
9432
+ if (content.modelVersion < 9 && Object.values(content.document.graph.nodes).some((candidateNode) => {
9433
+ if (candidateNode.onError != null) return true;
9434
+ if ([...Object.values("inputs" in candidateNode ? candidateNode.inputs : {}), ...Object.values(candidateNode.kind == "outputs" ? candidateNode.outputMappings : {})].some((candidateMapping) => candidateMapping.kind == "sources" && candidateMapping.sources.some((candidateSource) => candidateSource.kind == "node" && candidateSource.system))) return true;
9435
+ return candidateNode.kind == "condition" && candidateNode.cases.some((item) => item.groups.some((candidateGroup) => candidateGroup.expressions.some((expression) => [expression.left, expression.right].some((candidateOperand) => candidateOperand?.kind == "source" && candidateOperand.source.kind == "node" && candidateOperand.source.system))));
9436
+ })) throw new TypeError("Node error handling requires Flow model version 9.");
9397
9437
  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
9438
  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
9439
  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.");
@@ -9456,6 +9496,37 @@ function setConditionInput(node, handle, mapping) {
9456
9496
  };
9457
9497
  }
9458
9498
  //#endregion
9499
+ //#region src/flow/common/errorHandling.ts
9500
+ var nodeErrorSchema = {
9501
+ type: "object",
9502
+ additionalProperties: false,
9503
+ required: [
9504
+ "code",
9505
+ "message",
9506
+ "nodeId",
9507
+ "nodeName",
9508
+ "runId",
9509
+ "executionId"
9510
+ ],
9511
+ properties: {
9512
+ code: { type: "string" },
9513
+ message: { type: "string" },
9514
+ nodeId: { type: "string" },
9515
+ nodeName: { type: "string" },
9516
+ runId: { type: "string" },
9517
+ executionId: { type: "string" }
9518
+ }
9519
+ };
9520
+ function supportsNodeErrorHandling(node) {
9521
+ return supportsNodeRetry(node);
9522
+ }
9523
+ function nodeSystemOutputPorts(node) {
9524
+ return supportsNodeErrorHandling(node) && node.onError == "error" ? { error: {
9525
+ jsonSchema: nodeErrorSchema,
9526
+ nullable: true
9527
+ } } : {};
9528
+ }
9529
+ //#endregion
9459
9530
  //#region src/flow/common/change.ts
9460
9531
  var schemaKeywords = /* @__PURE__ */ new Set([
9461
9532
  "const",
@@ -9627,10 +9698,10 @@ function upgradeRevisionContent(content) {
9627
9698
  function upgradeDecodedRevisionContent(content) {
9628
9699
  const graph = content.document.graph;
9629
9700
  const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
9630
- if (!hasManual && content.modelVersion == 8) return content;
9701
+ if (!hasManual && content.modelVersion == 9) return content;
9631
9702
  return {
9632
9703
  ...content,
9633
- modelVersion: 8,
9704
+ modelVersion: 9,
9634
9705
  document: {
9635
9706
  ...content.document,
9636
9707
  graph: hasManual ? {
@@ -9677,7 +9748,7 @@ function invalid(message) {
9677
9748
  throw new FlowChangeError(message);
9678
9749
  }
9679
9750
  function applyFlowChanges(content, operations) {
9680
- const source = content.modelVersion != 8 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
9751
+ const source = content.modelVersion != 9 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
9681
9752
  const document = { ...source.document };
9682
9753
  const modules = { ...source.modules };
9683
9754
  for (const operation of operations) switch (operation.kind) {
@@ -9849,6 +9920,8 @@ function applyFlowChanges(content, operations) {
9849
9920
  const graph = document.graph;
9850
9921
  const node = graph.nodes[operation.nodeId];
9851
9922
  if (node == null) invalid("The Node does not exist in the target graph.");
9923
+ if (operation.field == "onError" && operation.value != null && (!supportsNodeErrorHandling(node) || !["stop", "error"].includes(String(operation.value)))) invalid("This node does not support this error handling setting.");
9924
+ if (operation.field == "retry" && operation.value != null && !supportsNodeRetry(node)) invalid("This node does not support retries.");
9852
9925
  if (operation.field == "connectionId" && node.kind != "poll" && node.kind != "integration") invalid("Only provider Triggers select a node Connection.");
9853
9926
  if (!dequal(Reflect.get(node, operation.field), operation.before)) invalid("The Node field changed before this operation was applied.");
9854
9927
  const updated = { ...node };
@@ -10120,9 +10193,9 @@ function applyFlowChanges(content, operations) {
10120
10193
  assertOpenApiAuthBindings(document);
10121
10194
  return upgradeDecodedRevisionContent({
10122
10195
  document,
10123
- modelVersion: 8,
10196
+ modelVersion: 9,
10124
10197
  modules
10125
10198
  });
10126
10199
  }
10127
10200
  //#endregion
10128
- export { FlowChangeError, applyFlowChanges, changeOperationsSchema, currentFlowModelVersion, decodeChangeOperations, decodeConnectorCapabilities, fixedInputValue, inputValue, inputValues, isSchemaKeyword, isTriggerNode, nextNodeName, nodeNameIssue, normalizeNodeName, portsByHandle, resourceNameIssue, resourceNameMaxLength, upgradeManualTrigger, upgradeRevisionContent, validVariableName };
10201
+ export { FlowChangeError, applyFlowChanges, changeOperationsSchema, currentFlowModelVersion, decodeChangeOperations, decodeConnectorCapabilities, fixedInputValue, inputValue, inputValues, isSchemaKeyword, isTriggerNode, nextNodeName, nodeErrorSchema, nodeNameIssue, nodeSystemOutputPorts, normalizeNodeName, portsByHandle, resourceNameIssue, resourceNameMaxLength, supportsNodeErrorHandling, supportsNodeRetry, upgradeManualTrigger, upgradeRevisionContent, validVariableName };