@oomol-lab/open-flow 0.1.0-beta.6 → 0.1.0-beta.7

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.
@@ -1,7 +1,7 @@
1
1
  import { a as e } from "./main-DmjVyuWr.js";
2
2
  import { At as t, B as n, Ct as r, F as i, In as a, Kn as o, L as s, M as c, Mt as l, On as u, P as d, Pt as f, Qn as p, R as m, Rt as h, Tt as g, Un as _, V as v, Vn as y, W as b, Z as x, Zt as S, c as C, en as w, et as T, i as E, jt as D, kn as ee, lt as O, n as te, nt as k, o as ne, p as A, sr as j, tr as M, x as N, z as P } from "./getPseudoElementBounds-5LArT6Xc.js";
3
- import { c as F, d as re, f as I, l as L, o as ie, t as ae, u as oe } from "./icons-CRxvozBE.js";
4
- import { t as se } from "./workbenchSelect-Cf1zlVm9.js";
3
+ import { c as F, d as re, f as I, l as L, o as ie, t as ae, u as oe } from "./icons-KIOgjHpD.js";
4
+ import { t as se } from "./workbenchSelect-CbXrdwxW.js";
5
5
  import * as R from "react";
6
6
  import { useEffect as ce, useRef as z, useState as le } from "react";
7
7
  import { Fragment as ue, jsx as B, jsxs as V } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
1
  import { I as e, j as t, t as n } from "./dist-DxahK_I8.js";
2
2
  import { r } from "./dist-BKuSVKCC.js";
3
- import { r as i } from "./flowWorkspace-CPBHm14t.js";
3
+ import { r as i } from "./flowWorkspace-DnsRkjYz.js";
4
4
  //#region ../../node_modules/.bun/@uiw+codemirror-themes@4.25.11/node_modules/@uiw/codemirror-themes/esm/index.js
5
5
  var a = (e) => {
6
6
  var i = e.theme, a = e.settings, o = a === void 0 ? {} : a, s = e.styles, c = s === void 0 ? [] : s, l = { ".cm-gutters": {} }, u = {};
@@ -41,14 +41,18 @@ function i(e, t) {
41
41
  }
42
42
  //#endregion
43
43
  //#region src/flow/common/change.ts
44
- var a = class extends Error {};
45
- function o() {
46
- throw new a();
44
+ var a = class extends Error {
45
+ constructor(e) {
46
+ super(e), this.name = "FlowChangeError";
47
+ }
48
+ };
49
+ function o(e) {
50
+ throw new a(e);
47
51
  }
48
52
  function s(e, t) {
49
53
  if (t.kind == "flow") return e.graph;
50
54
  let n = e.subflows[t.id];
51
- return n ?? o(), n.graph;
55
+ return n ?? o("The target Subflow does not exist."), n.graph;
52
56
  }
53
57
  function c(e, t, n) {
54
58
  if (t.kind == "flow") return {
@@ -56,7 +60,7 @@ function c(e, t, n) {
56
60
  graph: n
57
61
  };
58
62
  let r = e.subflows[t.id];
59
- return r ?? o(), {
63
+ return r ?? o("The target Subflow does not exist."), {
60
64
  ...e,
61
65
  subflows: {
62
66
  ...e.subflows,
@@ -87,20 +91,20 @@ function u(e, t) {
87
91
  let n = { ...e.document }, r = { ...e.modules };
88
92
  for (let e of t) switch (e.kind) {
89
93
  case "binding.create":
90
- n.bindings[e.bindingId] != null && o(), n.bindings = {
94
+ n.bindings[e.bindingId] != null && o("A Binding with this ID already exists."), n.bindings = {
91
95
  ...n.bindings,
92
96
  [e.bindingId]: e.binding
93
97
  };
94
98
  break;
95
99
  case "binding.delete": {
96
- n.bindings[e.bindingId] ?? o();
100
+ n.bindings[e.bindingId] ?? o("The Binding does not exist.");
97
101
  let t = { ...n.bindings };
98
102
  delete t[e.bindingId], n.bindings = t;
99
103
  break;
100
104
  }
101
105
  case "binding.target.set": {
102
106
  let t = n.bindings[e.bindingId];
103
- (t == null || t.target != e.before) && o(), n.bindings = {
107
+ t ?? o("The Binding does not exist."), t.target != e.before && o("The Binding target changed before this operation was applied."), n.bindings = {
104
108
  ...n.bindings,
105
109
  [e.bindingId]: {
106
110
  ...t,
@@ -111,17 +115,17 @@ function u(e, t) {
111
115
  }
112
116
  case "graph.edge.connect": {
113
117
  let t = s(n, e.target);
114
- t.nodes[e.edge.source] ?? o();
118
+ t.nodes[e.edge.source] ?? o("The source Node does not exist.");
115
119
  let r = t.nodes[e.edge.target];
116
- (r == null || !("inputs" in r)) && o();
120
+ (r == null || !("inputs" in r)) && o("The target Node does not accept inputs.");
117
121
  let a = r.inputs[e.edge.targetHandle];
118
- i(a, e.before) || o();
122
+ i(a, e.before) || o("The target input changed before this operation was applied.");
119
123
  let l = {
120
124
  kind: "node",
121
125
  nodeId: e.edge.source,
122
126
  output: e.edge.sourceHandle
123
127
  }, u = a?.kind == "sources" ? a.sources.filter((e) => e.kind != "binding" || n.bindings[e.bindingId]?.kind != "variable") : [];
124
- u.some((e) => e.kind == "node" && e.nodeId == l.nodeId && e.output == l.output) && o();
128
+ u.some((e) => e.kind == "node" && e.nodeId == l.nodeId && e.output == l.output) && o("The Nodes are already connected.");
125
129
  let d = {
126
130
  ...r,
127
131
  inputs: {
@@ -140,11 +144,11 @@ function u(e, t) {
140
144
  }
141
145
  case "graph.edge.disconnect": {
142
146
  let t = s(n, e.target), r = t.nodes[e.edge.target];
143
- (r == null || !("inputs" in r)) && o();
147
+ (r == null || !("inputs" in r)) && o("The target Node does not accept inputs.");
144
148
  let a = r.inputs[e.edge.targetHandle];
145
- (a?.kind != "sources" || !i(a, e.before)) && o();
149
+ (a?.kind != "sources" || !i(a, e.before)) && o("The target input changed before this operation was applied.");
146
150
  let l = a.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
147
- l.length == a.sources.length && o();
151
+ l.length == a.sources.length && o("The Nodes are not connected.");
148
152
  let u = { ...r.inputs };
149
153
  l.length == 0 ? delete u[e.edge.targetHandle] : u[e.edge.targetHandle] = {
150
154
  kind: "sources",
@@ -160,7 +164,7 @@ function u(e, t) {
160
164
  }
161
165
  case "graph.node.additional-inputs.set": {
162
166
  let t = s(n, e.target), r = t.nodes[e.nodeId];
163
- (r?.kind != "task" || !i(r.additionalInputs, e.before)) && o();
167
+ r?.kind != "task" && o("The Task Node does not exist."), i(r.additionalInputs, e.before) || o("The Task Node inputs changed before this operation was applied.");
164
168
  let { additionalInputs: a, ...l } = r, u = e.value == null ? l : {
165
169
  ...l,
166
170
  additionalInputs: e.value
@@ -173,7 +177,7 @@ function u(e, t) {
173
177
  }
174
178
  case "graph.node.condition.set": {
175
179
  let t = s(n, e.target), r = t.nodes[e.nodeId];
176
- r?.kind != "condition" && o(), (!i(r.cases, e.before.cases) || r.defaultOutput != e.before.defaultOutput || !i(r.input, e.before.input)) && o();
180
+ r?.kind != "condition" && o("The Condition Node does not exist."), (!i(r.cases, e.before.cases) || r.defaultOutput != e.before.defaultOutput || !i(r.input, e.before.input)) && o("The Condition Node changed before this operation was applied.");
177
181
  let { defaultOutput: a, ...l } = r, u = e.value.defaultOutput == null ? {
178
182
  ...l,
179
183
  ...e.value
@@ -189,7 +193,7 @@ function u(e, t) {
189
193
  }
190
194
  case "graph.node.create": {
191
195
  let t = s(n, e.target);
192
- (t.nodes[e.nodeId] != null || e.target.kind == "subflow" && !("inputs" in e.node)) && o(), Object.assign(n, c(n, e.target, { nodes: {
196
+ t.nodes[e.nodeId] != null && o("A Node with this ID already exists in the target graph."), e.target.kind == "subflow" && !("inputs" in e.node) && o("Trigger Nodes cannot be created inside a Subflow."), Object.assign(n, c(n, e.target, { nodes: {
193
197
  ...t.nodes,
194
198
  [e.nodeId]: e.node
195
199
  } }));
@@ -197,7 +201,7 @@ function u(e, t) {
197
201
  }
198
202
  case "graph.node.delete": {
199
203
  let t = s(n, e.target);
200
- t.nodes[e.nodeId] ?? o();
204
+ t.nodes[e.nodeId] ?? o("The Node does not exist in the target graph.");
201
205
  let r = /* @__PURE__ */ new Set([e.nodeId]), i = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => r.has(e) ? [] : [[e, l(t, r)]]));
202
206
  if (Object.assign(n, c(n, e.target, { nodes: i })), e.target.kind == "subflow") {
203
207
  let t = n.subflows[e.target.id], i = t.outputs.map((e) => ({
@@ -216,7 +220,7 @@ function u(e, t) {
216
220
  }
217
221
  case "graph.node.field.set": {
218
222
  let t = s(n, e.target), r = t.nodes[e.nodeId];
219
- (r == null || !i(Reflect.get(r, e.field), e.before)) && o(), e.field == "concurrency" && e.value == null && o();
223
+ r ?? o("The Node does not exist in the target graph."), i(Reflect.get(r, e.field), e.before) || o("The Node field changed before this operation was applied."), e.field == "concurrency" && e.value == null && o("Node concurrency cannot be removed.");
220
224
  let a = { ...r };
221
225
  e.value == null ? Reflect.deleteProperty(a, e.field) : Object.assign(a, { [e.field]: e.value }), Object.assign(n, c(n, e.target, { nodes: {
222
226
  ...t.nodes,
@@ -226,7 +230,7 @@ function u(e, t) {
226
230
  }
227
231
  case "graph.node.input.set": {
228
232
  let t = s(n, e.target), r = t.nodes[e.nodeId];
229
- (r == null || !("inputs" in r) || !i(r.inputs[e.handle], e.before)) && o();
233
+ (r == null || !("inputs" in r)) && o("The Node does not accept inputs."), i(r.inputs[e.handle], e.before) || o("The Node input changed before this operation was applied.");
230
234
  let a = { ...r.inputs };
231
235
  e.value == null ? delete a[e.handle] : a[e.handle] = e.value, Object.assign(n, c(n, e.target, { nodes: {
232
236
  ...t.nodes,
@@ -239,7 +243,7 @@ function u(e, t) {
239
243
  }
240
244
  case "graph.node.task.name.set": {
241
245
  let t = s(n, e.target), r = t.nodes[e.nodeId];
242
- (r?.kind != "task" || r.task == null || r.task.name != e.before) && o();
246
+ (r?.kind != "task" || r.task == null) && o("The inline Task Node does not exist."), r.task.name != e.before && o("The inline Task name changed before this operation was applied.");
243
247
  let i = {
244
248
  ...r,
245
249
  task: {
@@ -255,10 +259,10 @@ function u(e, t) {
255
259
  }
256
260
  case "graph.node.task.ports.set": {
257
261
  let t = s(n, e.target), r = t.nodes[e.nodeId];
258
- (r?.kind != "task" || r.task == null || !i({
262
+ (r?.kind != "task" || r.task == null) && o("The inline Task Node does not exist."), i({
259
263
  inputs: r.task.inputs,
260
264
  outputs: r.task.outputs
261
- }, e.before)) && o();
265
+ }, e.before) || o("The inline Task ports changed before this operation was applied.");
262
266
  let a = {
263
267
  ...r,
264
268
  task: {
@@ -274,7 +278,7 @@ function u(e, t) {
274
278
  }
275
279
  case "graph.node.values.set": {
276
280
  let t = s(n, e.target), r = t.nodes[e.nodeId];
277
- (r?.kind != "value" || !i(r.values, e.before)) && o(), Object.assign(n, c(n, e.target, { nodes: {
281
+ r?.kind != "value" && o("The Value Node does not exist."), i(r.values, e.before) || o("The Value Node changed before this operation was applied."), Object.assign(n, c(n, e.target, { nodes: {
278
282
  ...t.nodes,
279
283
  [e.nodeId]: {
280
284
  ...r,
@@ -289,7 +293,7 @@ function u(e, t) {
289
293
  actions: r.actions,
290
294
  ...r.notification == null ? {} : { notification: r.notification },
291
295
  prompt: r.prompt
292
- }, e.before)) && o();
296
+ }, e.before)) && o("The Wait Node changed before this operation was applied.");
293
297
  let { notification: a, ...s } = r, c = e.value.notification == null ? {
294
298
  ...s,
295
299
  ...e.value
@@ -305,7 +309,7 @@ function u(e, t) {
305
309
  }
306
310
  case "graph.node.webhook.set": {
307
311
  let t = s(n, e.target), r = t.nodes[e.nodeId];
308
- (r?.kind != "webhook" || !i(r.inputsDef, e.before.inputsDef) || !i(r.options, e.before.options)) && o();
312
+ r?.kind != "webhook" && o("The Webhook Node does not exist."), (!i(r.inputsDef, e.before.inputsDef) || !i(r.options, e.before.options)) && o("The Webhook Node changed before this operation was applied.");
309
313
  let { options: a, ...l } = r, u = e.value.options == null ? {
310
314
  ...l,
311
315
  inputsDef: e.value.inputsDef
@@ -321,7 +325,7 @@ function u(e, t) {
321
325
  }
322
326
  case "graph.trigger.config.set": {
323
327
  let t = n.graph, r = t.nodes[e.nodeId];
324
- (r == null || r.kind != "integration" && r.kind != "poll" || !i(r.config[e.name], e.before)) && o();
328
+ (r == null || r.kind != "integration" && r.kind != "poll") && o("The configurable Trigger Node does not exist."), i(r.config[e.name], e.before) || o("The Trigger configuration changed before this operation was applied.");
325
329
  let a = { ...r.config };
326
330
  e.value === void 0 ? delete a[e.name] : a[e.name] = e.value, n.graph = { nodes: {
327
331
  ...t.nodes,
@@ -334,7 +338,7 @@ function u(e, t) {
334
338
  }
335
339
  case "graph.trigger.schedule.set": {
336
340
  let t = n.graph, r = t.nodes[e.nodeId];
337
- (r == null || r.kind != "cron" && r.kind != "poll") && o(), i(r.kind == "cron" ? r.cronTimes : r.pollTimes, e.before) || o();
341
+ (r == null || r.kind != "cron" && r.kind != "poll") && o("The scheduled Trigger Node does not exist."), i(r.kind == "cron" ? r.cronTimes : r.pollTimes, e.before) || o("The Trigger schedule changed before this operation was applied.");
338
342
  let a = r.kind == "cron" ? {
339
343
  ...r,
340
344
  cronTimes: e.value
@@ -349,14 +353,14 @@ function u(e, t) {
349
353
  break;
350
354
  }
351
355
  case "module.create":
352
- r[e.moduleId] != null && o(), r[e.moduleId] = e.module;
356
+ r[e.moduleId] != null && o("A CodeModule with this ID already exists."), r[e.moduleId] = e.module;
353
357
  break;
354
358
  case "module.delete":
355
- r[e.moduleId] ?? o(), delete r[e.moduleId];
359
+ r[e.moduleId] ?? o("The CodeModule does not exist."), delete r[e.moduleId];
356
360
  break;
357
361
  case "module.rename": {
358
362
  let t = r[e.moduleId];
359
- (t == null || t.name != e.before) && o(), r[e.moduleId] = {
363
+ t ?? o("The CodeModule does not exist."), t.name != e.before && o("The CodeModule name changed before this operation was applied."), r[e.moduleId] = {
360
364
  ...t,
361
365
  name: e.name
362
366
  };
@@ -364,7 +368,7 @@ function u(e, t) {
364
368
  }
365
369
  case "module.source.replace": {
366
370
  let t = r[e.moduleId];
367
- (t == null || t.source != e.beforeSource || !i(t.imports, e.beforeImports)) && o(), r[e.moduleId] = {
371
+ t ?? o("The CodeModule does not exist."), (t.source != e.beforeSource || !i(t.imports, e.beforeImports)) && o("The CodeModule source changed before this operation was applied."), r[e.moduleId] = {
368
372
  ...t,
369
373
  imports: e.imports,
370
374
  source: e.source
@@ -372,18 +376,18 @@ function u(e, t) {
372
376
  break;
373
377
  }
374
378
  case "subflow.create":
375
- n.subflows[e.subflowId] != null && o(), n.subflows = {
379
+ n.subflows[e.subflowId] != null && o("A Subflow with this ID already exists."), n.subflows = {
376
380
  ...n.subflows,
377
381
  [e.subflowId]: e.subflow
378
382
  };
379
383
  break;
380
384
  case "subflow.definition.set": {
381
385
  let t = n.subflows[e.subflowId];
382
- (t == null || !i({
386
+ t ?? o("The Subflow does not exist."), i({
383
387
  inputs: t.inputs,
384
388
  name: t.name,
385
389
  outputs: t.outputs
386
- }, e.before)) && o(), n.subflows = {
390
+ }, e.before) || o("The Subflow definition changed before this operation was applied."), n.subflows = {
387
391
  ...n.subflows,
388
392
  [e.subflowId]: {
389
393
  ...e.definition,
@@ -393,20 +397,20 @@ function u(e, t) {
393
397
  break;
394
398
  }
395
399
  case "subflow.delete": {
396
- n.subflows[e.subflowId] ?? o();
400
+ n.subflows[e.subflowId] ?? o("The Subflow does not exist.");
397
401
  let t = { ...n.subflows };
398
402
  delete t[e.subflowId], n.subflows = t;
399
403
  break;
400
404
  }
401
405
  case "task.create":
402
- n.tasks[e.taskId] != null && o(), n.tasks = {
406
+ n.tasks[e.taskId] != null && o("A Task with this ID already exists."), n.tasks = {
403
407
  ...n.tasks,
404
408
  [e.taskId]: e.task
405
409
  };
406
410
  break;
407
411
  case "task.connector.connection.set": {
408
412
  let t = n.tasks[e.taskId];
409
- (t == null || !("executor" in t) || t.executor.kind != "connector" || t.executor.connectionId != e.before) && o();
413
+ (t == null || !("executor" in t) || t.executor.kind != "connector") && o("The Connector Task does not exist."), t.executor.connectionId != e.before && o("The Connector Task connection changed before this operation was applied.");
410
414
  let { connectionId: r, ...i } = t.executor, a = e.value == null ? i : {
411
415
  ...i,
412
416
  connectionId: e.value
@@ -421,14 +425,14 @@ function u(e, t) {
421
425
  break;
422
426
  }
423
427
  case "task.delete": {
424
- n.tasks[e.taskId] ?? o();
428
+ n.tasks[e.taskId] ?? o("The Task does not exist.");
425
429
  let t = { ...n.tasks };
426
430
  delete t[e.taskId], n.tasks = t;
427
431
  break;
428
432
  }
429
433
  case "task.llm.mode.set": {
430
434
  let t = n.tasks[e.taskId];
431
- (t == null || !("executor" in t) || t.executor.kind != "llm" || t.executor.mode != e.before) && o(), n.tasks = {
435
+ (t == null || !("executor" in t) || t.executor.kind != "llm") && o("The LLM Task does not exist."), t.executor.mode != e.before && o("The LLM Task mode changed before this operation was applied."), n.tasks = {
432
436
  ...n.tasks,
433
437
  [e.taskId]: {
434
438
  ...t,
@@ -442,7 +446,7 @@ function u(e, t) {
442
446
  }
443
447
  case "task.name.set": {
444
448
  let t = n.tasks[e.taskId];
445
- (t == null || t.name != e.before) && o(), n.tasks = {
449
+ t ?? o("The Task does not exist."), t.name != e.before && o("The Task name changed before this operation was applied."), n.tasks = {
446
450
  ...n.tasks,
447
451
  [e.taskId]: {
448
452
  ...t,
@@ -405,6 +405,7 @@ export type ChangeOperation = {
405
405
  readonly value: string;
406
406
  };
407
407
  export declare class FlowChangeError extends Error {
408
+ constructor(message: string);
408
409
  }
409
410
  export declare function applyFlowChanges(content: RevisionContent, operations: readonly ChangeOperation[]): RevisionContent;
410
411
  export {};
@@ -36,14 +36,18 @@ function i(e) {
36
36
  function a(e) {
37
37
  return Object.fromEntries(e.flatMap((e) => "handle" in e ? [[e.handle, e]] : []));
38
38
  }
39
- var o = class extends Error {};
40
- function s() {
41
- throw new o();
39
+ var o = class extends Error {
40
+ constructor(e) {
41
+ super(e), this.name = "FlowChangeError";
42
+ }
43
+ };
44
+ function s(e) {
45
+ throw new o(e);
42
46
  }
43
47
  function c(e, t) {
44
48
  if (t.kind == "flow") return e.graph;
45
49
  let n = e.subflows[t.id];
46
- return n ?? s(), n.graph;
50
+ return n ?? s("The target Subflow does not exist."), n.graph;
47
51
  }
48
52
  function l(e, t, n) {
49
53
  if (t.kind == "flow") return {
@@ -51,7 +55,7 @@ function l(e, t, n) {
51
55
  graph: n
52
56
  };
53
57
  let r = e.subflows[t.id];
54
- return r ?? s(), {
58
+ return r ?? s("The target Subflow does not exist."), {
55
59
  ...e,
56
60
  subflows: {
57
61
  ...e.subflows,
@@ -82,20 +86,20 @@ function d(e, n) {
82
86
  let r = { ...e.document }, i = { ...e.modules };
83
87
  for (let e of n) switch (e.kind) {
84
88
  case "binding.create":
85
- r.bindings[e.bindingId] != null && s(), r.bindings = {
89
+ r.bindings[e.bindingId] != null && s("A Binding with this ID already exists."), r.bindings = {
86
90
  ...r.bindings,
87
91
  [e.bindingId]: e.binding
88
92
  };
89
93
  break;
90
94
  case "binding.delete": {
91
- r.bindings[e.bindingId] ?? s();
95
+ r.bindings[e.bindingId] ?? s("The Binding does not exist.");
92
96
  let t = { ...r.bindings };
93
97
  delete t[e.bindingId], r.bindings = t;
94
98
  break;
95
99
  }
96
100
  case "binding.target.set": {
97
101
  let t = r.bindings[e.bindingId];
98
- (t == null || t.target != e.before) && s(), r.bindings = {
102
+ t ?? s("The Binding does not exist."), t.target != e.before && s("The Binding target changed before this operation was applied."), r.bindings = {
99
103
  ...r.bindings,
100
104
  [e.bindingId]: {
101
105
  ...t,
@@ -106,17 +110,17 @@ function d(e, n) {
106
110
  }
107
111
  case "graph.edge.connect": {
108
112
  let n = c(r, e.target);
109
- n.nodes[e.edge.source] ?? s();
113
+ n.nodes[e.edge.source] ?? s("The source Node does not exist.");
110
114
  let i = n.nodes[e.edge.target];
111
- (i == null || !("inputs" in i)) && s();
115
+ (i == null || !("inputs" in i)) && s("The target Node does not accept inputs.");
112
116
  let a = i.inputs[e.edge.targetHandle];
113
- t(a, e.before) || s();
117
+ t(a, e.before) || s("The target input changed before this operation was applied.");
114
118
  let o = {
115
119
  kind: "node",
116
120
  nodeId: e.edge.source,
117
121
  output: e.edge.sourceHandle
118
122
  }, u = a?.kind == "sources" ? a.sources.filter((e) => e.kind != "binding" || r.bindings[e.bindingId]?.kind != "variable") : [];
119
- u.some((e) => e.kind == "node" && e.nodeId == o.nodeId && e.output == o.output) && s();
123
+ u.some((e) => e.kind == "node" && e.nodeId == o.nodeId && e.output == o.output) && s("The Nodes are already connected.");
120
124
  let d = {
121
125
  ...i,
122
126
  inputs: {
@@ -135,11 +139,11 @@ function d(e, n) {
135
139
  }
136
140
  case "graph.edge.disconnect": {
137
141
  let n = c(r, e.target), i = n.nodes[e.edge.target];
138
- (i == null || !("inputs" in i)) && s();
142
+ (i == null || !("inputs" in i)) && s("The target Node does not accept inputs.");
139
143
  let a = i.inputs[e.edge.targetHandle];
140
- (a?.kind != "sources" || !t(a, e.before)) && s();
144
+ (a?.kind != "sources" || !t(a, e.before)) && s("The target input changed before this operation was applied.");
141
145
  let o = a.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
142
- o.length == a.sources.length && s();
146
+ o.length == a.sources.length && s("The Nodes are not connected.");
143
147
  let u = { ...i.inputs };
144
148
  o.length == 0 ? delete u[e.edge.targetHandle] : u[e.edge.targetHandle] = {
145
149
  kind: "sources",
@@ -155,7 +159,7 @@ function d(e, n) {
155
159
  }
156
160
  case "graph.node.additional-inputs.set": {
157
161
  let n = c(r, e.target), i = n.nodes[e.nodeId];
158
- (i?.kind != "task" || !t(i.additionalInputs, e.before)) && s();
162
+ i?.kind != "task" && s("The Task Node does not exist."), t(i.additionalInputs, e.before) || s("The Task Node inputs changed before this operation was applied.");
159
163
  let { additionalInputs: a, ...o } = i, u = e.value == null ? o : {
160
164
  ...o,
161
165
  additionalInputs: e.value
@@ -168,7 +172,7 @@ function d(e, n) {
168
172
  }
169
173
  case "graph.node.condition.set": {
170
174
  let n = c(r, e.target), i = n.nodes[e.nodeId];
171
- i?.kind != "condition" && s(), (!t(i.cases, e.before.cases) || i.defaultOutput != e.before.defaultOutput || !t(i.input, e.before.input)) && s();
175
+ i?.kind != "condition" && s("The Condition Node does not exist."), (!t(i.cases, e.before.cases) || i.defaultOutput != e.before.defaultOutput || !t(i.input, e.before.input)) && s("The Condition Node changed before this operation was applied.");
172
176
  let { defaultOutput: a, ...o } = i, u = e.value.defaultOutput == null ? {
173
177
  ...o,
174
178
  ...e.value
@@ -184,7 +188,7 @@ function d(e, n) {
184
188
  }
185
189
  case "graph.node.create": {
186
190
  let t = c(r, e.target);
187
- (t.nodes[e.nodeId] != null || e.target.kind == "subflow" && !("inputs" in e.node)) && s(), Object.assign(r, l(r, e.target, { nodes: {
191
+ t.nodes[e.nodeId] != null && s("A Node with this ID already exists in the target graph."), e.target.kind == "subflow" && !("inputs" in e.node) && s("Trigger Nodes cannot be created inside a Subflow."), Object.assign(r, l(r, e.target, { nodes: {
188
192
  ...t.nodes,
189
193
  [e.nodeId]: e.node
190
194
  } }));
@@ -192,7 +196,7 @@ function d(e, n) {
192
196
  }
193
197
  case "graph.node.delete": {
194
198
  let t = c(r, e.target);
195
- t.nodes[e.nodeId] ?? s();
199
+ t.nodes[e.nodeId] ?? s("The Node does not exist in the target graph.");
196
200
  let n = /* @__PURE__ */ new Set([e.nodeId]), i = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => n.has(e) ? [] : [[e, u(t, n)]]));
197
201
  if (Object.assign(r, l(r, e.target, { nodes: i })), e.target.kind == "subflow") {
198
202
  let t = r.subflows[e.target.id], i = t.outputs.map((e) => ({
@@ -211,7 +215,7 @@ function d(e, n) {
211
215
  }
212
216
  case "graph.node.field.set": {
213
217
  let n = c(r, e.target), i = n.nodes[e.nodeId];
214
- (i == null || !t(Reflect.get(i, e.field), e.before)) && s(), e.field == "concurrency" && e.value == null && s();
218
+ i ?? s("The Node does not exist in the target graph."), t(Reflect.get(i, e.field), e.before) || s("The Node field changed before this operation was applied."), e.field == "concurrency" && e.value == null && s("Node concurrency cannot be removed.");
215
219
  let a = { ...i };
216
220
  e.value == null ? Reflect.deleteProperty(a, e.field) : Object.assign(a, { [e.field]: e.value }), Object.assign(r, l(r, e.target, { nodes: {
217
221
  ...n.nodes,
@@ -221,7 +225,7 @@ function d(e, n) {
221
225
  }
222
226
  case "graph.node.input.set": {
223
227
  let n = c(r, e.target), i = n.nodes[e.nodeId];
224
- (i == null || !("inputs" in i) || !t(i.inputs[e.handle], e.before)) && s();
228
+ (i == null || !("inputs" in i)) && s("The Node does not accept inputs."), t(i.inputs[e.handle], e.before) || s("The Node input changed before this operation was applied.");
225
229
  let a = { ...i.inputs };
226
230
  e.value == null ? delete a[e.handle] : a[e.handle] = e.value, Object.assign(r, l(r, e.target, { nodes: {
227
231
  ...n.nodes,
@@ -234,7 +238,7 @@ function d(e, n) {
234
238
  }
235
239
  case "graph.node.task.name.set": {
236
240
  let t = c(r, e.target), n = t.nodes[e.nodeId];
237
- (n?.kind != "task" || n.task == null || n.task.name != e.before) && s();
241
+ (n?.kind != "task" || n.task == null) && s("The inline Task Node does not exist."), n.task.name != e.before && s("The inline Task name changed before this operation was applied.");
238
242
  let i = {
239
243
  ...n,
240
244
  task: {
@@ -250,10 +254,10 @@ function d(e, n) {
250
254
  }
251
255
  case "graph.node.task.ports.set": {
252
256
  let n = c(r, e.target), i = n.nodes[e.nodeId];
253
- (i?.kind != "task" || i.task == null || !t({
257
+ (i?.kind != "task" || i.task == null) && s("The inline Task Node does not exist."), t({
254
258
  inputs: i.task.inputs,
255
259
  outputs: i.task.outputs
256
- }, e.before)) && s();
260
+ }, e.before) || s("The inline Task ports changed before this operation was applied.");
257
261
  let a = {
258
262
  ...i,
259
263
  task: {
@@ -269,7 +273,7 @@ function d(e, n) {
269
273
  }
270
274
  case "graph.node.values.set": {
271
275
  let n = c(r, e.target), i = n.nodes[e.nodeId];
272
- (i?.kind != "value" || !t(i.values, e.before)) && s(), Object.assign(r, l(r, e.target, { nodes: {
276
+ i?.kind != "value" && s("The Value Node does not exist."), t(i.values, e.before) || s("The Value Node changed before this operation was applied."), Object.assign(r, l(r, e.target, { nodes: {
273
277
  ...n.nodes,
274
278
  [e.nodeId]: {
275
279
  ...i,
@@ -284,7 +288,7 @@ function d(e, n) {
284
288
  actions: i.actions,
285
289
  ...i.notification == null ? {} : { notification: i.notification },
286
290
  prompt: i.prompt
287
- }, e.before)) && s();
291
+ }, e.before)) && s("The Wait Node changed before this operation was applied.");
288
292
  let { notification: a, ...o } = i, c = e.value.notification == null ? {
289
293
  ...o,
290
294
  ...e.value
@@ -300,7 +304,7 @@ function d(e, n) {
300
304
  }
301
305
  case "graph.node.webhook.set": {
302
306
  let n = c(r, e.target), i = n.nodes[e.nodeId];
303
- (i?.kind != "webhook" || !t(i.inputsDef, e.before.inputsDef) || !t(i.options, e.before.options)) && s();
307
+ i?.kind != "webhook" && s("The Webhook Node does not exist."), (!t(i.inputsDef, e.before.inputsDef) || !t(i.options, e.before.options)) && s("The Webhook Node changed before this operation was applied.");
304
308
  let { options: a, ...o } = i, u = e.value.options == null ? {
305
309
  ...o,
306
310
  inputsDef: e.value.inputsDef
@@ -316,7 +320,7 @@ function d(e, n) {
316
320
  }
317
321
  case "graph.trigger.config.set": {
318
322
  let n = r.graph, i = n.nodes[e.nodeId];
319
- (i == null || i.kind != "integration" && i.kind != "poll" || !t(i.config[e.name], e.before)) && s();
323
+ (i == null || i.kind != "integration" && i.kind != "poll") && s("The configurable Trigger Node does not exist."), t(i.config[e.name], e.before) || s("The Trigger configuration changed before this operation was applied.");
320
324
  let a = { ...i.config };
321
325
  e.value === void 0 ? delete a[e.name] : a[e.name] = e.value, r.graph = { nodes: {
322
326
  ...n.nodes,
@@ -329,7 +333,7 @@ function d(e, n) {
329
333
  }
330
334
  case "graph.trigger.schedule.set": {
331
335
  let n = r.graph, i = n.nodes[e.nodeId];
332
- (i == null || i.kind != "cron" && i.kind != "poll") && s(), t(i.kind == "cron" ? i.cronTimes : i.pollTimes, e.before) || s();
336
+ (i == null || i.kind != "cron" && i.kind != "poll") && s("The scheduled Trigger Node does not exist."), t(i.kind == "cron" ? i.cronTimes : i.pollTimes, e.before) || s("The Trigger schedule changed before this operation was applied.");
333
337
  let a = i.kind == "cron" ? {
334
338
  ...i,
335
339
  cronTimes: e.value
@@ -344,14 +348,14 @@ function d(e, n) {
344
348
  break;
345
349
  }
346
350
  case "module.create":
347
- i[e.moduleId] != null && s(), i[e.moduleId] = e.module;
351
+ i[e.moduleId] != null && s("A CodeModule with this ID already exists."), i[e.moduleId] = e.module;
348
352
  break;
349
353
  case "module.delete":
350
- i[e.moduleId] ?? s(), delete i[e.moduleId];
354
+ i[e.moduleId] ?? s("The CodeModule does not exist."), delete i[e.moduleId];
351
355
  break;
352
356
  case "module.rename": {
353
357
  let t = i[e.moduleId];
354
- (t == null || t.name != e.before) && s(), i[e.moduleId] = {
358
+ t ?? s("The CodeModule does not exist."), t.name != e.before && s("The CodeModule name changed before this operation was applied."), i[e.moduleId] = {
355
359
  ...t,
356
360
  name: e.name
357
361
  };
@@ -359,7 +363,7 @@ function d(e, n) {
359
363
  }
360
364
  case "module.source.replace": {
361
365
  let n = i[e.moduleId];
362
- (n == null || n.source != e.beforeSource || !t(n.imports, e.beforeImports)) && s(), i[e.moduleId] = {
366
+ n ?? s("The CodeModule does not exist."), (n.source != e.beforeSource || !t(n.imports, e.beforeImports)) && s("The CodeModule source changed before this operation was applied."), i[e.moduleId] = {
363
367
  ...n,
364
368
  imports: e.imports,
365
369
  source: e.source
@@ -367,18 +371,18 @@ function d(e, n) {
367
371
  break;
368
372
  }
369
373
  case "subflow.create":
370
- r.subflows[e.subflowId] != null && s(), r.subflows = {
374
+ r.subflows[e.subflowId] != null && s("A Subflow with this ID already exists."), r.subflows = {
371
375
  ...r.subflows,
372
376
  [e.subflowId]: e.subflow
373
377
  };
374
378
  break;
375
379
  case "subflow.definition.set": {
376
380
  let n = r.subflows[e.subflowId];
377
- (n == null || !t({
381
+ n ?? s("The Subflow does not exist."), t({
378
382
  inputs: n.inputs,
379
383
  name: n.name,
380
384
  outputs: n.outputs
381
- }, e.before)) && s(), r.subflows = {
385
+ }, e.before) || s("The Subflow definition changed before this operation was applied."), r.subflows = {
382
386
  ...r.subflows,
383
387
  [e.subflowId]: {
384
388
  ...e.definition,
@@ -388,20 +392,20 @@ function d(e, n) {
388
392
  break;
389
393
  }
390
394
  case "subflow.delete": {
391
- r.subflows[e.subflowId] ?? s();
395
+ r.subflows[e.subflowId] ?? s("The Subflow does not exist.");
392
396
  let t = { ...r.subflows };
393
397
  delete t[e.subflowId], r.subflows = t;
394
398
  break;
395
399
  }
396
400
  case "task.create":
397
- r.tasks[e.taskId] != null && s(), r.tasks = {
401
+ r.tasks[e.taskId] != null && s("A Task with this ID already exists."), r.tasks = {
398
402
  ...r.tasks,
399
403
  [e.taskId]: e.task
400
404
  };
401
405
  break;
402
406
  case "task.connector.connection.set": {
403
407
  let t = r.tasks[e.taskId];
404
- (t == null || !("executor" in t) || t.executor.kind != "connector" || t.executor.connectionId != e.before) && s();
408
+ (t == null || !("executor" in t) || t.executor.kind != "connector") && s("The Connector Task does not exist."), t.executor.connectionId != e.before && s("The Connector Task connection changed before this operation was applied.");
405
409
  let { connectionId: n, ...i } = t.executor, a = e.value == null ? i : {
406
410
  ...i,
407
411
  connectionId: e.value
@@ -416,14 +420,14 @@ function d(e, n) {
416
420
  break;
417
421
  }
418
422
  case "task.delete": {
419
- r.tasks[e.taskId] ?? s();
423
+ r.tasks[e.taskId] ?? s("The Task does not exist.");
420
424
  let t = { ...r.tasks };
421
425
  delete t[e.taskId], r.tasks = t;
422
426
  break;
423
427
  }
424
428
  case "task.llm.mode.set": {
425
429
  let t = r.tasks[e.taskId];
426
- (t == null || !("executor" in t) || t.executor.kind != "llm" || t.executor.mode != e.before) && s(), r.tasks = {
430
+ (t == null || !("executor" in t) || t.executor.kind != "llm") && s("The LLM Task does not exist."), t.executor.mode != e.before && s("The LLM Task mode changed before this operation was applied."), r.tasks = {
427
431
  ...r.tasks,
428
432
  [e.taskId]: {
429
433
  ...t,
@@ -437,7 +441,7 @@ function d(e, n) {
437
441
  }
438
442
  case "task.name.set": {
439
443
  let t = r.tasks[e.taskId];
440
- (t == null || t.name != e.before) && s(), r.tasks = {
444
+ t ?? s("The Task does not exist."), t.name != e.before && s("The Task name changed before this operation was applied."), r.tasks = {
441
445
  ...r.tasks,
442
446
  [e.taskId]: {
443
447
  ...t,