@oomol-lab/open-flow 0.1.0-beta.56 → 0.1.0-beta.57

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 (36) hide show
  1. package/dist/browser/{createResourceDialog-Btjes3wD.js → createResourceDialog-C23SBjYd.js} +2 -2
  2. package/dist/browser/flow-authoring-node.d.ts +6 -2
  3. package/dist/browser/flow-authoring.js +44 -12
  4. package/dist/browser/flow-change-schema.d.ts +266 -0
  5. package/dist/browser/flow-change.d.ts +5 -0
  6. package/dist/browser/flow-change.js +33 -2
  7. package/dist/browser/{flowChanges-BxutPLYO.js → flowChanges-fBiAeTzR.js} +954 -487
  8. package/dist/browser/{flowWorkspace-Dg4mqfa6.js → flowWorkspace-MqcEfg7T.js} +3 -3
  9. package/dist/browser/{icons-p2A9zs8t.js → icons-6oQ8Q9Wm.js} +4298 -4252
  10. package/dist/browser/preview.js +354 -36
  11. package/dist/browser/workbench.js +21 -10
  12. package/dist/browser/{workbenchSelect-LRp_Xjeq.js → workbenchSelect-DpLbIr29.js} +1 -1
  13. package/dist/common/authoring.d.ts +207 -0
  14. package/dist/common/authoringSchema.d.ts +1293 -0
  15. package/dist/common/control-api-conformance.js +975 -505
  16. package/dist/common/control-api-errors.d.ts +2 -1
  17. package/dist/common/control-api.d.ts +81 -0
  18. package/dist/common/control-api.js +973 -586
  19. package/dist/common/control-requests.d.ts +128 -0
  20. package/dist/common/control-requests.js +3122 -346
  21. package/dist/common/decision.js +12 -2
  22. package/dist/common/flow-encoding.js +12 -2
  23. package/dist/common/flow-semantics.d.ts +9 -0
  24. package/dist/common/flow-semantics.js +28 -3
  25. package/dist/common/integration-trigger.js +12 -2
  26. package/dist/common/lib-DrKav3HG.js +11403 -0
  27. package/dist/common/mcp.d.ts +120 -11
  28. package/dist/common/mcp.js +423 -51
  29. package/dist/common/openapi.js +12 -2
  30. package/dist/common/poll-trigger.js +12 -2
  31. package/dist/common/scheduler.js +12 -2
  32. package/dist/common/webhook-trigger.js +12 -2
  33. package/package.json +7 -1
  34. package/skills/open-flow/SKILL.md +32 -0
  35. package/skills/open-flow/references/flow-authoring.md +356 -0
  36. package/skills/open-flow/references/flow-n8n-conversion.md +196 -0
@@ -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, c as DialogTitle, gi as Button, i as DialogContent, ir as Input, n as Dialog, o as DialogFooter, r as DialogClose, s as DialogHeader, t as Icon, w as FieldError, x as Spinner } from "./icons-p2A9zs8t.js";
3
- import { t as WorkbenchSelect } from "./workbenchSelect-LRp_Xjeq.js";
2
+ import { C as FieldDescription, E as FieldLabel, S as Field, T as FieldGroup, c as DialogTitle, i as DialogContent, n as Dialog, o as DialogFooter, or as Input, r as DialogClose, s as DialogHeader, t as Icon, vi as Button, w as FieldError, x as Spinner } from "./icons-6oQ8Q9Wm.js";
3
+ import { t as WorkbenchSelect } from "./workbenchSelect-DpLbIr29.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,8 @@
1
1
  import type { DecisionQuestion } from '../common/decision.js';
2
- import type { ChangeOperation, CodeModule, ConnectorCapability, GraphNode, InputMapping, InputValues, JsonValue, PortDefinition, RevisionContent, TaskDefinition, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookOptions } from './flow-change.js';
2
+ import type { ChangeOperation, CodeModule, ConnectorCapability, GraphNode, InputMapping, InputValues, InputPort, JsonValue, PortDefinition, RevisionContent, TaskDefinition, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookOptions } from './flow-change.js';
3
+ export declare const defaultCodeTaskPorts: Pick<Extract<TaskDefinition, {
4
+ readonly moduleId: string;
5
+ }>, 'inputs' | 'outputs' | 'capabilities'>;
3
6
  export interface Settings {
4
7
  readonly name?: string;
5
8
  readonly maxExecutions?: number;
@@ -56,12 +59,13 @@ export declare function createAgentTask(identity: {
56
59
  }, name: string, defaults?: {
57
60
  readonly prompt?: string;
58
61
  readonly outputDescription?: string;
62
+ readonly inputs?: TaskDefinition['inputs'];
59
63
  }): readonly ChangeOperation[];
60
64
  export declare function createLlmTask(identity: {
61
65
  readonly nodeId: string;
62
66
  }, name: string, mode: 'chat' | 'json', outputDescription: string, options?: LlmTaskOptions): readonly ChangeOperation[];
63
67
  export declare function createCondition(nodeId: string, name: string): readonly ChangeOperation[];
64
- export declare function createValue(nodeId: string, name: string): readonly ChangeOperation[];
68
+ export declare function createValue(nodeId: string, name: string, values?: readonly InputPort[]): readonly ChangeOperation[];
65
69
  export declare function createWait(nodeId: string, name: string): readonly ChangeOperation[];
66
70
  export declare function createApproval(nodeId: string, name: string): readonly ChangeOperation[];
67
71
  export declare function createBuiltinTrigger(nodeId: string, node: Extract<TriggerNode, {
@@ -5937,7 +5937,7 @@ var decisionQuestion = discriminatedUnion("type", [
5937
5937
  criteria: strings
5938
5938
  })
5939
5939
  ]);
5940
- var managed = object({
5940
+ var managedFields = object({
5941
5941
  ...ports,
5942
5942
  name: text,
5943
5943
  executor: union([
@@ -5996,7 +5996,8 @@ var managed = object({
5996
5996
  }).optional()
5997
5997
  })
5998
5998
  ])
5999
- }).transform(limitDecisionTask);
5999
+ });
6000
+ var managed = managedFields.transform(limitDecisionTask);
6000
6001
  var operand = union([object({
6001
6002
  kind: literal("value"),
6002
6003
  value: json.optional(),
@@ -6171,6 +6172,10 @@ var node = union([
6171
6172
  })
6172
6173
  })
6173
6174
  ]);
6175
+ strictObject(condition), strictObject(wait), strictObject(webhook), managedFields.shape.executor.options[0].omit({ kind: true }).strict(), managedFields.shape.executor.options[1].omit({ kind: true }).strict(), managedFields.shape.executor.options[2].omit({ kind: true }).strict(), managedFields.shape.executor.options[3].omit({ kind: true }).strict(), managedFields.shape.executor.options[4].omit({
6176
+ kind: true,
6177
+ notification: true
6178
+ }).strict();
6174
6179
  var edge = object({
6175
6180
  source: text,
6176
6181
  target: text,
@@ -6250,6 +6255,11 @@ var shapes = {
6250
6255
  ...at,
6251
6256
  node
6252
6257
  },
6258
+ "graph.node.replace": {
6259
+ ...at,
6260
+ before: node,
6261
+ node
6262
+ },
6253
6263
  "graph.node.delete": at,
6254
6264
  "graph.node.field.set": union([
6255
6265
  object({
@@ -6665,6 +6675,27 @@ function applyFlowChanges(content, operations) {
6665
6675
  } });
6666
6676
  break;
6667
6677
  }
6678
+ case "graph.node.replace": {
6679
+ const graph = document.graph;
6680
+ if (!dequal(graph.nodes[operation.nodeId], operation.before)) invalid("The Node changed before this operation was applied.");
6681
+ if (operation.node.kind != operation.before.kind) invalid("Replacing a Node cannot change its kind.");
6682
+ if (operation.node.kind == "task" && "moduleId" in operation.node.task && operation.node.task.capabilities !== void 0) decodeConnectorCapabilities(operation.node.task.capabilities);
6683
+ const name = normalizeNodeName(operation.node.name ?? "");
6684
+ const issue = nodeNameIssue(graph, operation.nodeId, name);
6685
+ if (issue != null) invalid(`Node name is ${issue}.`);
6686
+ const node = name == operation.node.name ? operation.node : {
6687
+ ...operation.node,
6688
+ name
6689
+ };
6690
+ Object.assign(document, { graph: {
6691
+ ...graph,
6692
+ nodes: {
6693
+ ...graph.nodes,
6694
+ [operation.nodeId]: node
6695
+ }
6696
+ } });
6697
+ break;
6698
+ }
6668
6699
  case "graph.node.create": {
6669
6700
  const graph = document.graph;
6670
6701
  if (graph.nodes[operation.nodeId] != null) invalid("A Node with this ID already exists in the target graph.");
@@ -9852,7 +9883,7 @@ var codeTaskTemplate = `export default async function (inputs, context) {
9852
9883
  return { result: inputs.value }
9853
9884
  }
9854
9885
  `;
9855
- function createCodeTask(identity, name, module = void 0, ports = {
9886
+ var defaultCodeTaskPorts = {
9856
9887
  inputs: [{
9857
9888
  handle: "value",
9858
9889
  jsonSchema: { type: "string" },
@@ -9864,7 +9895,8 @@ function createCodeTask(identity, name, module = void 0, ports = {
9864
9895
  jsonSchema: {},
9865
9896
  nullable: true
9866
9897
  }]
9867
- }) {
9898
+ };
9899
+ function createCodeTask(identity, name, module = void 0, ports = defaultCodeTaskPorts) {
9868
9900
  return [{
9869
9901
  kind: "module.create",
9870
9902
  module: {
@@ -9911,7 +9943,7 @@ function createManagedTask(identity, task) {
9911
9943
  function createAgentTask(identity, name, defaults = {}) {
9912
9944
  return createManagedTask(identity, {
9913
9945
  name,
9914
- inputs: [{
9946
+ inputs: defaults.inputs ?? [{
9915
9947
  handle: "input",
9916
9948
  jsonSchema: { type: "string" },
9917
9949
  nullable: false,
@@ -10005,19 +10037,19 @@ function createCondition(nodeId, name) {
10005
10037
  nodeId
10006
10038
  }];
10007
10039
  }
10008
- function createValue(nodeId, name) {
10040
+ function createValue(nodeId, name, values = [{
10041
+ handle: "value",
10042
+ jsonSchema: {},
10043
+ nullable: true,
10044
+ value: null
10045
+ }]) {
10009
10046
  return [{
10010
10047
  kind: "graph.node.create",
10011
10048
  node: {
10012
10049
  inputs: {},
10013
10050
  kind: "value",
10014
10051
  name,
10015
- values: [{
10016
- handle: "value",
10017
- jsonSchema: {},
10018
- nullable: true,
10019
- value: null
10020
- }]
10052
+ values
10021
10053
  },
10022
10054
  nodeId
10023
10055
  }];
@@ -1,5 +1,271 @@
1
1
  import type { ChangeOperation, FlowDocument, JsonValue, RevisionContent } from './flow-change.js';
2
+ import { z } from 'zod';
2
3
  export declare const currentFlowModelVersion = 6;
4
+ /** Configuration schemas shared by the node authoring boundary. */
5
+ export declare const authoringDefinitionSchemas: {
6
+ input: z.ZodObject<{
7
+ description: z.ZodOptional<z.ZodString>;
8
+ jsonSchema: z.ZodJSONSchema;
9
+ nullable: z.ZodBoolean;
10
+ handle: z.ZodString;
11
+ value: z.ZodOptional<z.ZodJSONSchema>;
12
+ }, z.core.$strip>;
13
+ port: z.ZodObject<{
14
+ description: z.ZodOptional<z.ZodString>;
15
+ jsonSchema: z.ZodJSONSchema;
16
+ nullable: z.ZodBoolean;
17
+ handle: z.ZodString;
18
+ }, z.core.$strip>;
19
+ ports: {
20
+ inputs: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
21
+ description: z.ZodOptional<z.ZodString>;
22
+ jsonSchema: z.ZodJSONSchema;
23
+ nullable: z.ZodBoolean;
24
+ handle: z.ZodString;
25
+ value: z.ZodOptional<z.ZodJSONSchema>;
26
+ }, z.core.$strip>, z.ZodObject<{
27
+ collapsed: z.ZodOptional<z.ZodBoolean>;
28
+ group: z.ZodString;
29
+ }, z.core.$strip>]>>;
30
+ outputs: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
31
+ description: z.ZodOptional<z.ZodString>;
32
+ jsonSchema: z.ZodJSONSchema;
33
+ nullable: z.ZodBoolean;
34
+ handle: z.ZodString;
35
+ }, z.core.$strip>, z.ZodObject<{
36
+ collapsed: z.ZodOptional<z.ZodBoolean>;
37
+ group: z.ZodString;
38
+ }, z.core.$strip>]>>;
39
+ };
40
+ condition: z.ZodObject<{
41
+ matchMode: z.ZodEnum<{
42
+ all: "all";
43
+ first: "first";
44
+ }>;
45
+ cases: z.ZodArray<z.ZodObject<{
46
+ description: z.ZodOptional<z.ZodString>;
47
+ output: z.ZodString;
48
+ groups: z.ZodArray<z.ZodObject<{
49
+ expressions: z.ZodArray<z.ZodObject<{
50
+ left: z.ZodUnion<readonly [z.ZodObject<{
51
+ kind: z.ZodLiteral<"value">;
52
+ value: z.ZodOptional<z.ZodJSONSchema>;
53
+ jsonSchema: z.ZodOptional<z.ZodJSONSchema>;
54
+ }, z.core.$strip>, z.ZodObject<{
55
+ kind: z.ZodLiteral<"source">;
56
+ source: z.ZodUnion<readonly [z.ZodObject<{
57
+ kind: z.ZodLiteral<"node">;
58
+ nodeId: z.ZodString;
59
+ output: z.ZodString;
60
+ field: z.ZodOptional<z.ZodString>;
61
+ }, z.core.$strip>, z.ZodObject<{
62
+ kind: z.ZodLiteral<"binding">;
63
+ bindingId: z.ZodString;
64
+ }, z.core.$strip>]>;
65
+ }, z.core.$strip>]>;
66
+ operator: z.ZodEnum<{
67
+ "!=": "!=";
68
+ "<": "<";
69
+ "<=": "<=";
70
+ "==": "==";
71
+ ">": ">";
72
+ ">=": ">=";
73
+ contains: "contains";
74
+ endsWith: "endsWith";
75
+ hasKey: "hasKey";
76
+ hasValue: "hasValue";
77
+ isEmpty: "isEmpty";
78
+ isFalse: "isFalse";
79
+ isNotEmpty: "isNotEmpty";
80
+ isNotNull: "isNotNull";
81
+ isNull: "isNull";
82
+ isTrue: "isTrue";
83
+ notContains: "notContains";
84
+ notHasKey: "notHasKey";
85
+ notHasValue: "notHasValue";
86
+ startsWith: "startsWith";
87
+ }>;
88
+ right: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
89
+ kind: z.ZodLiteral<"value">;
90
+ value: z.ZodOptional<z.ZodJSONSchema>;
91
+ jsonSchema: z.ZodOptional<z.ZodJSONSchema>;
92
+ }, z.core.$strip>, z.ZodObject<{
93
+ kind: z.ZodLiteral<"source">;
94
+ source: z.ZodUnion<readonly [z.ZodObject<{
95
+ kind: z.ZodLiteral<"node">;
96
+ nodeId: z.ZodString;
97
+ output: z.ZodString;
98
+ field: z.ZodOptional<z.ZodString>;
99
+ }, z.core.$strip>, z.ZodObject<{
100
+ kind: z.ZodLiteral<"binding">;
101
+ bindingId: z.ZodString;
102
+ }, z.core.$strip>]>;
103
+ }, z.core.$strip>]>>;
104
+ }, z.core.$strip>>;
105
+ }, z.core.$strip>>;
106
+ }, z.core.$strip>>;
107
+ }, z.core.$strict>;
108
+ wait: z.ZodObject<{
109
+ inputDefinitions: z.ZodArray<z.ZodObject<{
110
+ description: z.ZodOptional<z.ZodString>;
111
+ jsonSchema: z.ZodJSONSchema;
112
+ nullable: z.ZodBoolean;
113
+ handle: z.ZodString;
114
+ value: z.ZodOptional<z.ZodJSONSchema>;
115
+ }, z.core.$strip>>;
116
+ prompt: z.ZodString;
117
+ }, z.core.$strict>;
118
+ webhook: z.ZodObject<{
119
+ bodyFields: z.ZodArray<z.ZodObject<{
120
+ description: z.ZodOptional<z.ZodString>;
121
+ jsonSchema: z.ZodJSONSchema;
122
+ nullable: z.ZodBoolean;
123
+ handle: z.ZodString;
124
+ value: z.ZodOptional<z.ZodJSONSchema>;
125
+ }, z.core.$strip>>;
126
+ method: z.ZodEnum<{
127
+ DELETE: "DELETE";
128
+ GET: "GET";
129
+ PATCH: "PATCH";
130
+ POST: "POST";
131
+ PUT: "PUT";
132
+ }>;
133
+ options: z.ZodOptional<z.ZodObject<{
134
+ allowedMethods: z.ZodOptional<z.ZodNever>;
135
+ allowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
136
+ noResponseBody: z.ZodOptional<z.ZodNever>;
137
+ responseData: z.ZodOptional<z.ZodString>;
138
+ responseHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
139
+ responseStatusCode: z.ZodOptional<z.ZodNumber>;
140
+ }, z.core.$strip>>;
141
+ }, z.core.$strict>;
142
+ schedule: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
143
+ type: z.ZodLiteral<"cron">;
144
+ expression: z.ZodString;
145
+ timezone: z.ZodString;
146
+ }, z.core.$strip>, z.ZodObject<{
147
+ type: z.ZodLiteral<"every">;
148
+ unit: z.ZodEnum<{
149
+ day: "day";
150
+ hour: "hour";
151
+ minute: "minute";
152
+ month: "month";
153
+ week: "week";
154
+ }>;
155
+ value: z.ZodNumber;
156
+ }, z.core.$strip>]>>;
157
+ capabilities: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
158
+ kind: z.ZodLiteral<"connector">;
159
+ action: z.ZodString;
160
+ connectionId: z.ZodOptional<z.ZodString>;
161
+ connections: z.ZodArray<z.ZodObject<{
162
+ connectionId: z.ZodString;
163
+ alias: z.ZodOptional<z.ZodString>;
164
+ }, z.core.$strict>>;
165
+ }, z.core.$strict>, z.ZodObject<{
166
+ kind: z.ZodLiteral<"connector">;
167
+ mode: z.ZodLiteral<"shared">;
168
+ }, z.core.$strict>, z.ZodObject<{
169
+ kind: z.ZodLiteral<"connector">;
170
+ mode: z.ZodLiteral<"independent">;
171
+ actions: z.ZodArray<z.ZodObject<{
172
+ action: z.ZodString;
173
+ connectionId: z.ZodOptional<z.ZodString>;
174
+ }, z.core.$strict>>;
175
+ }, z.core.$strict>, z.ZodObject<{
176
+ kind: z.ZodLiteral<"connector">;
177
+ actionHints: z.ZodOptional<z.ZodArray<z.ZodString>>;
178
+ connectionHints: z.ZodOptional<z.ZodArray<z.ZodObject<{
179
+ action: z.ZodString;
180
+ connectionId: z.ZodString;
181
+ alias: z.ZodOptional<z.ZodString>;
182
+ }, z.core.$strict>>>;
183
+ }, z.core.$strict>]>>;
184
+ connector: z.ZodObject<{
185
+ action: z.ZodString;
186
+ connectionId: z.ZodOptional<z.ZodString>;
187
+ }, z.core.$strict>;
188
+ openapi: z.ZodObject<{
189
+ sourceUrl: z.ZodString;
190
+ method: z.ZodString;
191
+ path: z.ZodString;
192
+ serverUrl: z.ZodString;
193
+ document: z.ZodJSONSchema;
194
+ auth: z.ZodArray<z.ZodObject<{
195
+ id: z.ZodString;
196
+ type: z.ZodEnum<{
197
+ apiKey: "apiKey";
198
+ basic: "basic";
199
+ bearer: "bearer";
200
+ }>;
201
+ name: z.ZodOptional<z.ZodString>;
202
+ in: z.ZodOptional<z.ZodEnum<{
203
+ header: "header";
204
+ query: "query";
205
+ }>>;
206
+ }, z.core.$strip>>;
207
+ }, z.core.$strict>;
208
+ decision: z.ZodObject<{
209
+ questions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
210
+ name: z.ZodString;
211
+ instructions: z.ZodString;
212
+ type: z.ZodLiteral<"noul">;
213
+ criteria: z.ZodOptional<z.ZodObject<{
214
+ true: z.ZodOptional<z.ZodString>;
215
+ false: z.ZodOptional<z.ZodString>;
216
+ }, z.core.$strict>>;
217
+ }, z.core.$strict>, z.ZodObject<{
218
+ name: z.ZodString;
219
+ instructions: z.ZodString;
220
+ type: z.ZodLiteral<"choice">;
221
+ criteria: z.ZodArray<z.ZodObject<{
222
+ name: z.ZodString;
223
+ description: z.ZodString;
224
+ }, z.core.$strict>>;
225
+ }, z.core.$strict>, z.ZodObject<{
226
+ name: z.ZodString;
227
+ instructions: z.ZodString;
228
+ type: z.ZodLiteral<"score">;
229
+ criteria: z.ZodArray<z.ZodString>;
230
+ }, z.core.$strict>], "type">>;
231
+ }, z.core.$strict>;
232
+ llm: z.ZodObject<{
233
+ mode: z.ZodEnum<{
234
+ chat: "chat";
235
+ json: "json";
236
+ }>;
237
+ }, z.core.$strict>;
238
+ agent: z.ZodObject<{
239
+ code: z.ZodOptional<z.ZodBoolean>;
240
+ model: z.ZodString;
241
+ prompt: z.ZodString;
242
+ maxRounds: z.ZodNumber;
243
+ tools: z.ZodArray<z.ZodObject<{
244
+ id: z.ZodString;
245
+ name: z.ZodString;
246
+ description: z.ZodString;
247
+ action: z.ZodString;
248
+ connectionId: z.ZodOptional<z.ZodString>;
249
+ approval: z.ZodBoolean;
250
+ inputs: z.ZodArray<z.ZodObject<{
251
+ description: z.ZodOptional<z.ZodString>;
252
+ jsonSchema: z.ZodJSONSchema;
253
+ nullable: z.ZodBoolean;
254
+ handle: z.ZodString;
255
+ value: z.ZodOptional<z.ZodJSONSchema>;
256
+ source: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
257
+ kind: z.ZodLiteral<"value">;
258
+ value: z.ZodJSONSchema;
259
+ }, z.core.$strip>, z.ZodObject<{
260
+ kind: z.ZodLiteral<"input">;
261
+ input: z.ZodString;
262
+ }, z.core.$strip>]>, z.ZodObject<{
263
+ kind: z.ZodLiteral<"model">;
264
+ }, z.core.$strip>]>;
265
+ }, z.core.$strip>>;
266
+ }, z.core.$strip>>;
267
+ }, z.core.$strict>;
268
+ };
3
269
  /** Best-effort recovery for a parseable Revision envelope. Invalid collection entries are discarded. */
4
270
  export declare function repairRevisionEnvelope(value: unknown): RevisionContent;
5
271
  export declare function decodeFlowDocument(value: unknown): FlowDocument;
@@ -310,6 +310,11 @@ export declare function normalizeNodeName(value: string): string;
310
310
  export declare function nextNodeName(value: string, names: Iterable<string>): string;
311
311
  export declare function nodeNameIssue(graph: Graph, nodeId: string, value: string): 'duplicate' | 'empty' | undefined;
312
312
  export type ChangeOperation = {
313
+ readonly kind: 'graph.node.replace';
314
+ readonly nodeId: string;
315
+ readonly before: GraphNode;
316
+ readonly node: GraphNode;
317
+ } | {
313
318
  readonly before?: readonly ConnectorCapability[];
314
319
  readonly kind: 'graph.node.task.capabilities.set';
315
320
  readonly nodeId: string;
@@ -8892,7 +8892,7 @@ var decisionQuestion = discriminatedUnion("type", [
8892
8892
  criteria: strings
8893
8893
  })
8894
8894
  ]);
8895
- var managed = object({
8895
+ var managedFields = object({
8896
8896
  ...ports,
8897
8897
  name: text,
8898
8898
  executor: union([
@@ -8951,7 +8951,8 @@ var managed = object({
8951
8951
  }).optional()
8952
8952
  })
8953
8953
  ])
8954
- }).transform(limitDecisionTask);
8954
+ });
8955
+ var managed = managedFields.transform(limitDecisionTask);
8955
8956
  var operand = union([object({
8956
8957
  kind: literal("value"),
8957
8958
  value: json.optional(),
@@ -9126,6 +9127,10 @@ var node = union([
9126
9127
  })
9127
9128
  })
9128
9129
  ]);
9130
+ strictObject(condition), strictObject(wait), strictObject(webhook), managedFields.shape.executor.options[0].omit({ kind: true }).strict(), managedFields.shape.executor.options[1].omit({ kind: true }).strict(), managedFields.shape.executor.options[2].omit({ kind: true }).strict(), managedFields.shape.executor.options[3].omit({ kind: true }).strict(), managedFields.shape.executor.options[4].omit({
9131
+ kind: true,
9132
+ notification: true
9133
+ }).strict();
9129
9134
  var edge = object({
9130
9135
  source: text,
9131
9136
  target: text,
@@ -9205,6 +9210,11 @@ var shapes = {
9205
9210
  ...at,
9206
9211
  node
9207
9212
  },
9213
+ "graph.node.replace": {
9214
+ ...at,
9215
+ before: node,
9216
+ node
9217
+ },
9208
9218
  "graph.node.delete": at,
9209
9219
  "graph.node.field.set": union([
9210
9220
  object({
@@ -9694,6 +9704,27 @@ function applyFlowChanges(content, operations) {
9694
9704
  } });
9695
9705
  break;
9696
9706
  }
9707
+ case "graph.node.replace": {
9708
+ const graph = document.graph;
9709
+ if (!dequal(graph.nodes[operation.nodeId], operation.before)) invalid("The Node changed before this operation was applied.");
9710
+ if (operation.node.kind != operation.before.kind) invalid("Replacing a Node cannot change its kind.");
9711
+ if (operation.node.kind == "task" && "moduleId" in operation.node.task && operation.node.task.capabilities !== void 0) decodeConnectorCapabilities(operation.node.task.capabilities);
9712
+ const name = normalizeNodeName(operation.node.name ?? "");
9713
+ const issue = nodeNameIssue(graph, operation.nodeId, name);
9714
+ if (issue != null) invalid(`Node name is ${issue}.`);
9715
+ const node = name == operation.node.name ? operation.node : {
9716
+ ...operation.node,
9717
+ name
9718
+ };
9719
+ Object.assign(document, { graph: {
9720
+ ...graph,
9721
+ nodes: {
9722
+ ...graph.nodes,
9723
+ [operation.nodeId]: node
9724
+ }
9725
+ } });
9726
+ break;
9727
+ }
9697
9728
  case "graph.node.create": {
9698
9729
  const graph = document.graph;
9699
9730
  if (graph.nodes[operation.nodeId] != null) invalid("A Node with this ID already exists in the target graph.");