@valerypopoff/rivet2-core 2.0.6 → 2.0.8

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 (34) hide show
  1. package/dist/cjs/bundle.cjs +1440 -769
  2. package/dist/cjs/bundle.cjs.map +4 -4
  3. package/dist/esm/api/createProcessor.js +8 -2
  4. package/dist/esm/model/GraphPreprocessor.js +129 -7
  5. package/dist/esm/model/GraphProcessor.js +204 -82
  6. package/dist/esm/model/NodeExclusionPolicy.js +67 -0
  7. package/dist/esm/model/NodeExecutionPlanner.js +66 -22
  8. package/dist/esm/model/Nodes.js +3 -0
  9. package/dist/esm/model/chat-v2/chatV2Outputs.js +183 -0
  10. package/dist/esm/model/chat-v2/chatV2Pipeline.js +30 -212
  11. package/dist/esm/model/nodes/CodeNewNode.js +207 -0
  12. package/dist/esm/model/nodes/CodeNode.js +11 -10
  13. package/dist/esm/model/nodes/CommentNode.js +1 -1
  14. package/dist/esm/model/nodes/ExpressionNode.js +23 -39
  15. package/dist/esm/model/nodes/HttpCallNode.js +20 -18
  16. package/dist/esm/model/nodes/ObjectNode.js +1 -0
  17. package/dist/esm/model/nodes/ToolNode.js +1 -0
  18. package/dist/esm/model/nodes/codeNodeErrorDiagnostics.js +16 -11
  19. package/dist/esm/model/nodes/jsListCallbackHelpers.js +26 -30
  20. package/dist/esm/model/nodes/jsValueInterpolation.js +56 -2
  21. package/dist/esm/utils/serialization/serialization.js +22 -1
  22. package/dist/types/api/createProcessor.d.ts +8 -2
  23. package/dist/types/model/EditorDefinition.d.ts +2 -0
  24. package/dist/types/model/GraphPreprocessor.d.ts +36 -2
  25. package/dist/types/model/GraphProcessor.d.ts +12 -1
  26. package/dist/types/model/NodeExclusionPolicy.d.ts +21 -0
  27. package/dist/types/model/NodeExecutionPlanner.d.ts +3 -8
  28. package/dist/types/model/Nodes.d.ts +3 -2
  29. package/dist/types/model/ProcessContext.d.ts +2 -2
  30. package/dist/types/model/chat-v2/chatV2Outputs.d.ts +29 -0
  31. package/dist/types/model/nodes/CodeNewNode.d.ts +27 -0
  32. package/dist/types/model/nodes/codeNodeErrorDiagnostics.d.ts +4 -2
  33. package/dist/types/model/nodes/jsValueInterpolation.d.ts +20 -0
  34. package/package.json +1 -1
@@ -38,12 +38,14 @@ __export(src_exports, {
38
38
  AudioNodeImpl: () => AudioNodeImpl,
39
39
  BooleanNodeImpl: () => BooleanNodeImpl,
40
40
  BrowserNativeApi: () => BrowserNativeApi,
41
+ CODE_NEW_OUTPUT_PORT_ID: () => CODE_NEW_OUTPUT_PORT_ID,
41
42
  CallGraphNodeImpl: () => CallGraphNodeImpl,
42
43
  ChatLoopNodeImpl: () => ChatLoopNodeImpl,
43
44
  ChatNodeBase: () => ChatNodeBase,
44
45
  ChatNodeImpl: () => ChatNodeImpl,
45
46
  ChunkNodeImpl: () => ChunkNodeImpl,
46
47
  CoalesceNodeImpl: () => CoalesceNodeImpl,
48
+ CodeNewNodeImpl: () => CodeNewNodeImpl,
47
49
  CodeNodeImpl: () => CodeNodeImpl,
48
50
  CommentNodeImpl: () => CommentNodeImpl,
49
51
  CompareNodeImpl: () => CompareNodeImpl,
@@ -175,6 +177,7 @@ __export(src_exports, {
175
177
  chunkStringByTokenCount: () => chunkStringByTokenCount,
176
178
  cleanHeaders: () => cleanHeaders,
177
179
  coalesceNode: () => coalesceNode,
180
+ codeNewNode: () => codeNewNode,
178
181
  codeNode: () => codeNode,
179
182
  coerceType: () => coerceType,
180
183
  coerceTypeOptional: () => coerceTypeOptional,
@@ -267,6 +270,7 @@ __export(src_exports, {
267
270
  imageNode: () => imageNode,
268
271
  inferType: () => inferType,
269
272
  interpolate: () => interpolate,
273
+ interpolateCodeNewSource: () => interpolateCodeNewSource,
270
274
  interpolateExpressionSource: () => interpolateExpressionSource,
271
275
  interpolateExtractObjectPathSource: () => interpolateExtractObjectPathSource,
272
276
  interpolateJSListCallbackBody: () => interpolateJSListCallbackBody,
@@ -393,12 +397,14 @@ __export(exports_exports, {
393
397
  AudioNodeImpl: () => AudioNodeImpl,
394
398
  BooleanNodeImpl: () => BooleanNodeImpl,
395
399
  BrowserNativeApi: () => BrowserNativeApi,
400
+ CODE_NEW_OUTPUT_PORT_ID: () => CODE_NEW_OUTPUT_PORT_ID,
396
401
  CallGraphNodeImpl: () => CallGraphNodeImpl,
397
402
  ChatLoopNodeImpl: () => ChatLoopNodeImpl,
398
403
  ChatNodeBase: () => ChatNodeBase,
399
404
  ChatNodeImpl: () => ChatNodeImpl,
400
405
  ChunkNodeImpl: () => ChunkNodeImpl,
401
406
  CoalesceNodeImpl: () => CoalesceNodeImpl,
407
+ CodeNewNodeImpl: () => CodeNewNodeImpl,
402
408
  CodeNodeImpl: () => CodeNodeImpl,
403
409
  CommentNodeImpl: () => CommentNodeImpl,
404
410
  CompareNodeImpl: () => CompareNodeImpl,
@@ -529,6 +535,7 @@ __export(exports_exports, {
529
535
  chunkStringByTokenCount: () => chunkStringByTokenCount,
530
536
  cleanHeaders: () => cleanHeaders,
531
537
  coalesceNode: () => coalesceNode,
538
+ codeNewNode: () => codeNewNode,
532
539
  codeNode: () => codeNode,
533
540
  coerceType: () => coerceType,
534
541
  coerceTypeOptional: () => coerceTypeOptional,
@@ -621,6 +628,7 @@ __export(exports_exports, {
621
628
  imageNode: () => imageNode,
622
629
  inferType: () => inferType,
623
630
  interpolate: () => interpolate,
631
+ interpolateCodeNewSource: () => interpolateCodeNewSource,
624
632
  interpolateExpressionSource: () => interpolateExpressionSource,
625
633
  interpolateExtractObjectPathSource: () => interpolateExtractObjectPathSource,
626
634
  interpolateJSListCallbackBody: () => interpolateJSListCallbackBody,
@@ -1823,6 +1831,7 @@ function deserializeProject(serializedProject, path = null) {
1823
1831
  const version = detectSerializationVersion(serializedProject);
1824
1832
  try {
1825
1833
  const result = deserializeProjectByVersion(serializedProject, version);
1834
+ normalizeProjectDefaultNodeTitles(result[0]);
1826
1835
  if (path !== null) {
1827
1836
  result[0].metadata.path = path;
1828
1837
  }
@@ -1841,7 +1850,9 @@ function serializeGraph(graph) {
1841
1850
  function deserializeGraph(serializedGraph) {
1842
1851
  const version = detectSerializationVersion(serializedGraph);
1843
1852
  try {
1844
- return deserializeGraphByVersion(serializedGraph, version);
1853
+ const graph = deserializeGraphByVersion(serializedGraph, version);
1854
+ normalizeGraphDefaultNodeTitles(graph);
1855
+ return graph;
1845
1856
  } catch (err) {
1846
1857
  if (err instanceof yaml3.YAMLError) {
1847
1858
  yamlProblem(err);
@@ -1850,6 +1861,23 @@ function deserializeGraph(serializedGraph) {
1850
1861
  throw new Error("Could not deserialize graph");
1851
1862
  }
1852
1863
  }
1864
+ function normalizeProjectDefaultNodeTitles(project) {
1865
+ for (const graph of Object.values(project.graphs)) {
1866
+ normalizeGraphDefaultNodeTitles(graph);
1867
+ }
1868
+ }
1869
+ function normalizeGraphDefaultNodeTitles(graph) {
1870
+ for (const node of graph.nodes) {
1871
+ normalizeDefaultCodeNodeTitle(node);
1872
+ }
1873
+ }
1874
+ function normalizeDefaultCodeNodeTitle(node) {
1875
+ if (node.type === "code" && node.title === "Code") {
1876
+ node.title = "Code (legacy)";
1877
+ } else if (node.type === "codeNew" && node.title === "Code new") {
1878
+ node.title = "Code";
1879
+ }
1880
+ }
1853
1881
  function deserializeProjectByVersion(serializedProject, version) {
1854
1882
  switch (version) {
1855
1883
  case 4:
@@ -2234,7 +2262,7 @@ function findStronglyConnectedComponents(nodes, getAdjacentNodes) {
2234
2262
  // src/model/GraphPreprocessor.ts
2235
2263
  function preprocessGraphState(options2) {
2236
2264
  var _a, _b;
2237
- const { graph, loadedProjects, project, registry, warnOnInvalidGraph } = options2;
2265
+ const { buildExecutionPlan, graph, loadedProjects, project, registry, warnOnInvalidGraph } = options2;
2238
2266
  const nodeInstances = {};
2239
2267
  const nodesById = {};
2240
2268
  const connections = {};
@@ -2274,14 +2302,49 @@ function preprocessGraphState(options2) {
2274
2302
  const nodeConnections = connections[node.id] ?? [];
2275
2303
  return nodeConnections.filter((connection) => connection.outputNodeId === node.id).map((connection) => nodesById[connection.inputNodeId]).filter(Boolean);
2276
2304
  });
2277
- return {
2305
+ const nodesNotInCycle = stronglyConnectedComponents.filter((component) => component.length === 1).flat();
2306
+ const result = {
2278
2307
  connections,
2279
2308
  definitions,
2280
2309
  nodeInstances,
2281
2310
  nodesById,
2282
- nodesNotInCycle: stronglyConnectedComponents.filter((component) => component.length === 1).flat(),
2311
+ nodesNotInCycle,
2283
2312
  stronglyConnectedComponents
2284
2313
  };
2314
+ if (!buildExecutionPlan) {
2315
+ return result;
2316
+ }
2317
+ return {
2318
+ ...result,
2319
+ ...buildGraphExecutionPlan({
2320
+ connections,
2321
+ definitions,
2322
+ graphNodes: graph.nodes,
2323
+ nodesById,
2324
+ stronglyConnectedComponents
2325
+ })
2326
+ };
2327
+ }
2328
+ function isGraphExecutionPlan(preprocessedGraph) {
2329
+ return "inputConnectionByNodeAndPort" in preprocessedGraph;
2330
+ }
2331
+ function toReusableGraphExecutionPlan(preprocessedGraph) {
2332
+ return {
2333
+ connections: preprocessedGraph.connections,
2334
+ cycleIndexByNode: preprocessedGraph.cycleIndexByNode,
2335
+ definitions: preprocessedGraph.definitions,
2336
+ graphNodes: preprocessedGraph.graphNodes,
2337
+ inputConnectionByNodeAndPort: preprocessedGraph.inputConnectionByNodeAndPort,
2338
+ inputConnectionsByNode: preprocessedGraph.inputConnectionsByNode,
2339
+ inputNodesByNode: preprocessedGraph.inputNodesByNode,
2340
+ missingRequiredInputsByNode: preprocessedGraph.missingRequiredInputsByNode,
2341
+ nodesById: preprocessedGraph.nodesById,
2342
+ nodesNotInCycle: preprocessedGraph.nodesNotInCycle,
2343
+ outputConnectionsByNodeAndPort: preprocessedGraph.outputConnectionsByNodeAndPort,
2344
+ outputNodeResultsByNode: preprocessedGraph.outputNodeResultsByNode,
2345
+ startNodes: preprocessedGraph.startNodes,
2346
+ stronglyConnectedComponents: preprocessedGraph.stronglyConnectedComponents
2347
+ };
2285
2348
  }
2286
2349
  function loadInputOutputDefinitions(options2) {
2287
2350
  const { connections, loadedProjects, nodeInstances, nodesById, project, warnOnInvalidGraph } = options2;
@@ -2330,17 +2393,114 @@ function loadInputOutputDefinitions(options2) {
2330
2393
  }
2331
2394
  return false;
2332
2395
  });
2333
- for (const nodeConnections of values(connections)) {
2396
+ if (invalidConnections.length > 0) {
2334
2397
  for (const invalidConnection of invalidConnections) {
2335
- const invalidConnectionIndex = nodeConnections.indexOf(invalidConnection);
2336
- if (invalidConnectionIndex !== -1) {
2337
- nodeConnections.splice(invalidConnectionIndex, 1);
2398
+ removeConnectionFromNode(connections, invalidConnection, invalidConnection.inputNodeId);
2399
+ if (invalidConnection.outputNodeId !== invalidConnection.inputNodeId) {
2400
+ removeConnectionFromNode(connections, invalidConnection, invalidConnection.outputNodeId);
2338
2401
  }
2339
2402
  }
2340
2403
  }
2341
2404
  }
2342
2405
  return definitions;
2343
2406
  }
2407
+ function removeConnectionFromNode(connections, connection, nodeId) {
2408
+ const nodeConnections = connections[nodeId];
2409
+ if (!nodeConnections) {
2410
+ return;
2411
+ }
2412
+ const invalidConnectionIndex = nodeConnections.indexOf(connection);
2413
+ if (invalidConnectionIndex !== -1) {
2414
+ nodeConnections.splice(invalidConnectionIndex, 1);
2415
+ }
2416
+ }
2417
+ function buildGraphExecutionPlan(options2) {
2418
+ var _a, _b;
2419
+ const { connections, definitions, graphNodes, nodesById, stronglyConnectedComponents } = options2;
2420
+ const cycleIndexByNode = {};
2421
+ const inputConnectionByNodeAndPort = {};
2422
+ const inputConnectionsByNode = {};
2423
+ const inputNodesByNode = {};
2424
+ const missingRequiredInputsByNode = {};
2425
+ const outputConnectionsByNodeAndPort = {};
2426
+ const outputNodeResultsByNode = {};
2427
+ stronglyConnectedComponents.forEach((component, index) => {
2428
+ for (const node of component) {
2429
+ cycleIndexByNode[node.id] = index;
2430
+ }
2431
+ });
2432
+ for (const node of graphNodes) {
2433
+ const nodeConnections = connections[node.id] ?? [];
2434
+ const inputDefinitions = ((_a = definitions[node.id]) == null ? void 0 : _a.inputs) ?? [];
2435
+ const outputDefinitions = ((_b = definitions[node.id]) == null ? void 0 : _b.outputs) ?? [];
2436
+ const validInputIds = new Set(inputDefinitions.map((definition) => definition.id));
2437
+ const validOutputIds = new Set(outputDefinitions.map((definition) => definition.id));
2438
+ const inputConnections = nodeConnections.filter(
2439
+ (connection) => connection.inputNodeId === node.id && validInputIds.has(connection.inputId)
2440
+ );
2441
+ const outputConnections = nodeConnections.filter(
2442
+ (connection) => connection.outputNodeId === node.id && validOutputIds.has(connection.outputId)
2443
+ );
2444
+ inputConnectionsByNode[node.id] = inputConnections;
2445
+ outputConnectionsByNodeAndPort[node.id] = {};
2446
+ inputConnectionByNodeAndPort[node.id] = {};
2447
+ for (const connection of inputConnections) {
2448
+ inputConnectionByNodeAndPort[node.id][connection.inputId] ??= connection;
2449
+ }
2450
+ for (const connection of outputConnections) {
2451
+ outputConnectionsByNodeAndPort[node.id][connection.outputId] ??= [];
2452
+ outputConnectionsByNodeAndPort[node.id][connection.outputId].push(connection);
2453
+ }
2454
+ inputNodesByNode[node.id] = inputConnections.map((connection) => nodesById[connection.outputNodeId]).filter((inputNode) => inputNode != null);
2455
+ missingRequiredInputsByNode[node.id] = inputDefinitions.filter(
2456
+ (input) => {
2457
+ var _a2;
2458
+ return input.required && ((_a2 = inputConnectionByNodeAndPort[node.id]) == null ? void 0 : _a2[input.id]) == null;
2459
+ }
2460
+ );
2461
+ const outputNodes = [];
2462
+ const seenOutputNodeIds = /* @__PURE__ */ new Set();
2463
+ const outputConnectionsByNode = /* @__PURE__ */ new Map();
2464
+ for (const connection of outputConnections) {
2465
+ const outputNode = nodesById[connection.inputNodeId];
2466
+ if (!outputNode) {
2467
+ continue;
2468
+ }
2469
+ if (!seenOutputNodeIds.has(outputNode.id)) {
2470
+ outputNodes.push(outputNode);
2471
+ seenOutputNodeIds.add(outputNode.id);
2472
+ }
2473
+ const nodeConnections2 = outputConnectionsByNode.get(outputNode.id);
2474
+ if (nodeConnections2) {
2475
+ nodeConnections2.push(connection);
2476
+ } else {
2477
+ outputConnectionsByNode.set(outputNode.id, [connection]);
2478
+ }
2479
+ }
2480
+ outputNodeResultsByNode[node.id] = {
2481
+ connections: outputConnections,
2482
+ connectionsToNodes: outputNodes.map((outputNode) => ({
2483
+ connections: outputConnectionsByNode.get(outputNode.id) ?? [],
2484
+ node: outputNode
2485
+ })),
2486
+ nodes: outputNodes
2487
+ };
2488
+ }
2489
+ return {
2490
+ cycleIndexByNode,
2491
+ graphNodes,
2492
+ inputConnectionByNodeAndPort,
2493
+ inputConnectionsByNode,
2494
+ inputNodesByNode,
2495
+ missingRequiredInputsByNode,
2496
+ outputConnectionsByNodeAndPort,
2497
+ outputNodeResultsByNode,
2498
+ startNodes: graphNodes.filter((node) => {
2499
+ var _a2;
2500
+ return ((_a2 = outputNodeResultsByNode[node.id]) == null ? void 0 : _a2.nodes.length) === 0;
2501
+ })
2502
+ };
2503
+ }
2344
2504
 
2345
2505
  // src/model/RecordingPlayer.ts
2346
2506
  var import_non_secure3 = require("nanoid/non-secure");
@@ -2800,41 +2960,75 @@ function aggregateOutputs(results) {
2800
2960
  }
2801
2961
 
2802
2962
  // src/model/NodeExecutionPlanner.ts
2803
- var import_lodash_es4 = require("lodash");
2804
2963
  function getStartNodes(state, graphNodes, runToNodeIds) {
2805
- return runToNodeIds ? graphNodes.filter((node) => runToNodeIds.includes(node.id)) : graphNodes.filter((node) => getOutputNodesFrom(state, node).nodes.length === 0);
2964
+ var _a;
2965
+ if (runToNodeIds) {
2966
+ return graphNodes.filter((node) => runToNodeIds.includes(node.id));
2967
+ }
2968
+ return ((_a = state.executionPlan) == null ? void 0 : _a.startNodes) ?? graphNodes.filter((node) => getOutputNodesFrom(state, node).nodes.length === 0);
2806
2969
  }
2807
2970
  function getInputNodesTo(state, node) {
2808
- var _a;
2971
+ var _a, _b;
2972
+ const plannedInputNodes = (_a = state.executionPlan) == null ? void 0 : _a.inputNodesByNode[node.id];
2973
+ if (plannedInputNodes) {
2974
+ return plannedInputNodes;
2975
+ }
2809
2976
  const connections = state.connections[node.id];
2810
2977
  if (!connections) {
2811
2978
  return [];
2812
2979
  }
2813
- const connectionsToNode = connections.filter((conn) => conn.inputNodeId === node.id).filter(isNotNull);
2814
- const inputDefinitions = ((_a = state.definitions[node.id]) == null ? void 0 : _a.inputs) ?? [];
2815
- return connectionsToNode.filter((connection) => {
2816
- const connectionDefinition = inputDefinitions.find((def) => def.id === connection.inputId);
2817
- return connectionDefinition != null;
2818
- }).map((conn) => state.nodesById[conn.outputNodeId]).filter(isNotNull);
2980
+ const inputDefinitions = ((_b = state.definitions[node.id]) == null ? void 0 : _b.inputs) ?? [];
2981
+ const validInputIds = new Set(inputDefinitions.map((definition) => definition.id));
2982
+ const inputNodes = [];
2983
+ for (const connection of connections) {
2984
+ if (connection.inputNodeId !== node.id || !validInputIds.has(connection.inputId)) {
2985
+ continue;
2986
+ }
2987
+ const inputNode = state.nodesById[connection.outputNodeId];
2988
+ if (inputNode) {
2989
+ inputNodes.push(inputNode);
2990
+ }
2991
+ }
2992
+ return inputNodes;
2819
2993
  }
2820
2994
  function getOutputNodesFrom(state, node) {
2821
- var _a;
2995
+ var _a, _b;
2996
+ const plannedOutputNodes = (_a = state.executionPlan) == null ? void 0 : _a.outputNodeResultsByNode[node.id];
2997
+ if (plannedOutputNodes) {
2998
+ return plannedOutputNodes;
2999
+ }
2822
3000
  const connections = state.connections[node.id];
2823
3001
  if (!connections) {
2824
3002
  return { nodes: [], connections: [], connectionsToNodes: [] };
2825
3003
  }
2826
- const connectionsFromNode = connections.filter((conn) => conn.outputNodeId === node.id);
2827
- const outputDefinitions = ((_a = state.definitions[node.id]) == null ? void 0 : _a.outputs) ?? [];
2828
- const outputConnections = connectionsFromNode.filter((connection) => {
2829
- const connectionDefinition = outputDefinitions.find((def) => def.id === connection.outputId);
2830
- return connectionDefinition != null;
2831
- });
2832
- const outputNodes = (0, import_lodash_es4.uniqBy)(
2833
- outputConnections.map((conn) => state.nodesById[conn.inputNodeId]).filter(isNotNull),
2834
- (candidate) => candidate.id
2835
- );
3004
+ const outputDefinitions = ((_b = state.definitions[node.id]) == null ? void 0 : _b.outputs) ?? [];
3005
+ const validOutputIds = new Set(outputDefinitions.map((definition) => definition.id));
3006
+ const outputConnections = [];
3007
+ const outputConnectionsByNode = /* @__PURE__ */ new Map();
3008
+ const outputNodes = [];
3009
+ const seenOutputNodeIds = /* @__PURE__ */ new Set();
3010
+ for (const connection of connections) {
3011
+ if (connection.outputNodeId !== node.id || !validOutputIds.has(connection.outputId)) {
3012
+ continue;
3013
+ }
3014
+ outputConnections.push(connection);
3015
+ const outputNode = state.nodesById[connection.inputNodeId];
3016
+ if (!outputNode) {
3017
+ continue;
3018
+ }
3019
+ if (!seenOutputNodeIds.has(outputNode.id)) {
3020
+ outputNodes.push(outputNode);
3021
+ seenOutputNodeIds.add(outputNode.id);
3022
+ }
3023
+ const nodeConnections = outputConnectionsByNode.get(outputNode.id);
3024
+ if (nodeConnections) {
3025
+ nodeConnections.push(connection);
3026
+ } else {
3027
+ outputConnectionsByNode.set(outputNode.id, [connection]);
3028
+ }
3029
+ }
2836
3030
  const connectionsToNodes = outputNodes.map((outputNode) => ({
2837
- connections: outputConnections.filter((conn) => conn.inputNodeId === outputNode.id),
3031
+ connections: outputConnectionsByNode.get(outputNode.id) ?? [],
2838
3032
  node: outputNode
2839
3033
  }));
2840
3034
  return { nodes: outputNodes, connections: outputConnections, connectionsToNodes };
@@ -2849,10 +3043,20 @@ function hasErroredInputNode(state, node, inputNodes, onTrace) {
2849
3043
  return false;
2850
3044
  }
2851
3045
  function getMissingRequiredInputs(state, node) {
3046
+ var _a;
3047
+ const plannedMissingInputs = (_a = state.executionPlan) == null ? void 0 : _a.missingRequiredInputsByNode[node.id];
3048
+ if (plannedMissingInputs) {
3049
+ return plannedMissingInputs;
3050
+ }
2852
3051
  const connections = state.connections[node.id] ?? [];
3052
+ const connectedInputIds = /* @__PURE__ */ new Set();
3053
+ for (const connection of connections) {
3054
+ if (connection.inputNodeId === node.id) {
3055
+ connectedInputIds.add(connection.inputId);
3056
+ }
3057
+ }
2853
3058
  return state.definitions[node.id].inputs.filter((input) => {
2854
- const connectionToInput = connections.find((conn) => conn.inputId === input.id && conn.inputNodeId === node.id);
2855
- return input.required && !connectionToInput;
3059
+ return input.required && !connectedInputIds.has(input.id);
2856
3060
  });
2857
3061
  }
2858
3062
  function getWaitingForInputNode(state, node, inputNodes, inputValues) {
@@ -2873,6 +3077,11 @@ function getWaitingForInputNode(state, node, inputNodes, inputValues) {
2873
3077
  return waitingForInputNode;
2874
3078
  }
2875
3079
  function nodesAreInSameCycle(state, a, b) {
3080
+ var _a;
3081
+ const plannedCycleIndexByNode = (_a = state.executionPlan) == null ? void 0 : _a.cycleIndexByNode;
3082
+ if (plannedCycleIndexByNode) {
3083
+ return plannedCycleIndexByNode[a] != null && plannedCycleIndexByNode[a] === plannedCycleIndexByNode[b];
3084
+ }
2876
3085
  return state.stronglyConnectedComponents.find(
2877
3086
  (cycle) => cycle.find((node) => node.id === a) && cycle.find((node) => node.id === b)
2878
3087
  );
@@ -2979,6 +3188,77 @@ function wireSubprocessorLifecycle(processor, options2) {
2979
3188
  unsubscribers.push(subscribeOwnGraphRunLifecycle(processor, cleanup));
2980
3189
  }
2981
3190
 
3191
+ // src/model/NodeExclusionPolicy.ts
3192
+ var nodesAllowedToConsumeExcludedValue = /* @__PURE__ */ new Set([
3193
+ "if",
3194
+ "ifElse",
3195
+ "coalesce",
3196
+ "graphOutput",
3197
+ "raceInputs",
3198
+ "loopController"
3199
+ ]);
3200
+ function isControlFlowExcluded2(value) {
3201
+ return value != null && getScalarTypeOf(value.type) === "control-flow-excluded";
3202
+ }
3203
+ function getControlFlowExclusionDecision({
3204
+ inputValues,
3205
+ node,
3206
+ typeOfExclusion
3207
+ }) {
3208
+ var _a;
3209
+ if (node.disabled) {
3210
+ return {
3211
+ action: "exclude",
3212
+ reason: "disabled",
3213
+ traceMessage: `Excluding node ${node.title} because it's disabled`
3214
+ };
3215
+ }
3216
+ if (node.isConditional && typeOfExclusion === void 0) {
3217
+ const ifValue = coerceTypeOptional(inputValues[IF_PORT.id], "boolean");
3218
+ if (ifValue === false) {
3219
+ return {
3220
+ action: "exclude",
3221
+ reason: "if port is false",
3222
+ traceMessage: `Excluding node ${node.title} because if port is false`
3223
+ };
3224
+ }
3225
+ }
3226
+ const controlFlowExcludedValues = entries(inputValues).filter(
3227
+ ([, value]) => isControlFlowExcluded2(value) && (typeOfExclusion === void 0 || value.value === typeOfExclusion)
3228
+ );
3229
+ const isWaitingForLoop = controlFlowExcludedValues.some(([, value]) => (value == null ? void 0 : value.value) === LOOP_NOT_BROKEN_SENTINEL);
3230
+ const allowedToConsumeExcludedValue = nodesAllowedToConsumeExcludedValue.has(node.type) && !isWaitingForLoop;
3231
+ if (controlFlowExcludedValues.length === 0 || allowedToConsumeExcludedValue) {
3232
+ return { action: "continue" };
3233
+ }
3234
+ if (isWaitingForLoop) {
3235
+ return { action: "defer" };
3236
+ }
3237
+ return {
3238
+ action: "exclude",
3239
+ reason: "input is excluded value",
3240
+ traceMessage: `Excluding node ${node.title} because of control flow. Input is has excluded value: ${(_a = controlFlowExcludedValues[0]) == null ? void 0 : _a[0]}`
3241
+ };
3242
+ }
3243
+ function getMissingRequiredInputExclusion(node, missingRequiredInputs) {
3244
+ const missingInputNames = missingRequiredInputs.map((input) => input.title || input.id).join(", ");
3245
+ return {
3246
+ action: "exclude",
3247
+ reason: "missing required input",
3248
+ traceMessage: `Excluding node ${node.title} because required inputs are not connected: ${missingInputNames}`
3249
+ };
3250
+ }
3251
+ function createExcludedNodeOutputs(node, outputDefinitions) {
3252
+ const outputs = {};
3253
+ for (const output of outputDefinitions) {
3254
+ outputs[output.id] = { type: "control-flow-excluded", value: void 0 };
3255
+ }
3256
+ if (node.type === "loopController") {
3257
+ outputs["break"] = { type: "control-flow-excluded", value: LOOP_NOT_BROKEN_SENTINEL };
3258
+ }
3259
+ return outputs;
3260
+ }
3261
+
2982
3262
  // src/integrations/CodeRunner.ts
2983
3263
  var IsomorphicCodeRunner = class {
2984
3264
  async runCode(code, inputs, options2, graphInputs, contextValues) {
@@ -3027,6 +3307,13 @@ var NotAllowedCodeRunner = class {
3027
3307
  // src/model/GraphProcessor.ts
3028
3308
  var DEFAULT_NODE_CONCURRENCY = 8;
3029
3309
  var DEFAULT_SPLIT_RUN_CONCURRENCY = 4;
3310
+ var FAST_ACYCLIC_UNSUPPORTED_NODE_TYPES = /* @__PURE__ */ new Set([
3311
+ "loopController",
3312
+ "loopUntil",
3313
+ "raceInputs",
3314
+ "userInput",
3315
+ "waitForEvent"
3316
+ ]);
3030
3317
  function normalizeConcurrencyValue(value, fallback) {
3031
3318
  return typeof value === "number" && Number.isFinite(value) && value >= 1 ? Math.floor(value) : fallback;
3032
3319
  }
@@ -3052,6 +3339,10 @@ var GraphProcessor = class _GraphProcessor {
3052
3339
  #parent;
3053
3340
  #registry;
3054
3341
  #concurrency;
3342
+ #executionPlanCacheMode;
3343
+ #runtimeCache;
3344
+ #cacheLoadedProjects;
3345
+ #scheduler;
3055
3346
  id = (0, import_non_secure4.nanoid)();
3056
3347
  #includeTrace = true;
3057
3348
  executor;
@@ -3095,7 +3386,7 @@ var GraphProcessor = class _GraphProcessor {
3095
3386
  #loadedProjects = void 0;
3096
3387
  #definitions = void 0;
3097
3388
  #scc = void 0;
3098
- // @ts-expect-error
3389
+ #graphExecutionPlan;
3099
3390
  #nodesNotInCycle = void 0;
3100
3391
  #nodeAbortControllers = /* @__PURE__ */ new Map();
3101
3392
  #graphInputNodeValues = {};
@@ -3119,6 +3410,10 @@ var GraphProcessor = class _GraphProcessor {
3119
3410
  this.#nodesById = {};
3120
3411
  this.#registry = registry;
3121
3412
  this.#concurrency = resolveGraphProcessorConcurrency(options2 == null ? void 0 : options2.concurrency);
3413
+ this.#executionPlanCacheMode = (options2 == null ? void 0 : options2.executionPlanCacheMode) ?? "all";
3414
+ this.#runtimeCache = options2 == null ? void 0 : options2.runtimeCache;
3415
+ this.#cacheLoadedProjects = (options2 == null ? void 0 : options2.cacheLoadedProjects) ?? false;
3416
+ this.#scheduler = (options2 == null ? void 0 : options2.scheduler) ?? "compatible";
3122
3417
  this.#emitter.bindMethods(this, ["on", "off", "once", "onAny", "offAny"]);
3123
3418
  this.setExternalFunction("echo", async (value) => ({ type: "any", value }));
3124
3419
  this.#emitter.on("globalSet", ({ id, value }) => {
@@ -3126,19 +3421,53 @@ var GraphProcessor = class _GraphProcessor {
3126
3421
  });
3127
3422
  }
3128
3423
  #preprocessGraph() {
3424
+ var _a;
3425
+ const runtimeCache = this.#canUseRuntimeExecutionPlanCache() ? this.#runtimeCache : void 0;
3426
+ const shouldUseRuntimeCache = runtimeCache != null;
3427
+ const cachedPlan = (_a = runtimeCache == null ? void 0 : runtimeCache.executionPlans) == null ? void 0 : _a.get(this.#graph);
3428
+ if (cachedPlan) {
3429
+ this.#applyPreprocessedGraph(cachedPlan, { recreateNodeInstances: true });
3430
+ return;
3431
+ }
3129
3432
  const preprocessedGraph = preprocessGraphState({
3130
3433
  graph: this.#graph,
3131
3434
  loadedProjects: this.#loadedProjects,
3132
3435
  project: this.#project,
3133
3436
  registry: this.#registry,
3134
- warnOnInvalidGraph: this.warnOnInvalidGraph
3437
+ warnOnInvalidGraph: this.warnOnInvalidGraph,
3438
+ buildExecutionPlan: shouldUseRuntimeCache
3135
3439
  });
3136
- Object.assign(this.#nodeInstances, preprocessedGraph.nodeInstances);
3440
+ if (shouldUseRuntimeCache && isGraphExecutionPlan(preprocessedGraph)) {
3441
+ runtimeCache.executionPlans ??= /* @__PURE__ */ new WeakMap();
3442
+ runtimeCache.executionPlans.set(this.#graph, toReusableGraphExecutionPlan(preprocessedGraph));
3443
+ }
3444
+ this.#applyPreprocessedGraph(preprocessedGraph);
3445
+ }
3446
+ #canUseRuntimeExecutionPlanCache() {
3447
+ var _a;
3448
+ if (this.warnOnInvalidGraph || this.#runtimeCache == null) {
3449
+ return false;
3450
+ }
3451
+ if (this.#executionPlanCacheMode === "subprocessors" && !this.#isSubProcessor) {
3452
+ return false;
3453
+ }
3454
+ if (!this.#cacheLoadedProjects && (((_a = this.#project.references) == null ? void 0 : _a.length) ?? 0) > 0) {
3455
+ return false;
3456
+ }
3457
+ return true;
3458
+ }
3459
+ #applyPreprocessedGraph(preprocessedGraph, options2 = {}) {
3460
+ const nodeInstances = options2.recreateNodeInstances || !("nodeInstances" in preprocessedGraph) ? this.#createNodeInstances(isGraphExecutionPlan(preprocessedGraph) ? preprocessedGraph.graphNodes : this.#graph.nodes) : preprocessedGraph.nodeInstances;
3461
+ Object.assign(this.#nodeInstances, nodeInstances);
3137
3462
  Object.assign(this.#nodesById, preprocessedGraph.nodesById);
3138
3463
  Object.assign(this.#connections, preprocessedGraph.connections);
3139
3464
  this.#definitions = preprocessedGraph.definitions;
3140
3465
  this.#scc = preprocessedGraph.stronglyConnectedComponents;
3141
3466
  this.#nodesNotInCycle = preprocessedGraph.nodesNotInCycle;
3467
+ this.#graphExecutionPlan = isGraphExecutionPlan(preprocessedGraph) ? preprocessedGraph : void 0;
3468
+ }
3469
+ #createNodeInstances(nodes) {
3470
+ return Object.fromEntries(nodes.map((node) => [node.id, this.#registry.createDynamicImpl(node)]));
3142
3471
  }
3143
3472
  #emitTraceEvent(eventData) {
3144
3473
  if (this.#includeTrace) {
@@ -3294,6 +3623,7 @@ var GraphProcessor = class _GraphProcessor {
3294
3623
  this.#preprocessGraph();
3295
3624
  }
3296
3625
  #collectDependencyNodesDeep(nodeId, dependencyNodes) {
3626
+ var _a;
3297
3627
  if (dependencyNodes.has(nodeId)) {
3298
3628
  return;
3299
3629
  }
@@ -3302,7 +3632,7 @@ var GraphProcessor = class _GraphProcessor {
3302
3632
  return;
3303
3633
  }
3304
3634
  dependencyNodes.add(nodeId);
3305
- const connections = this.#connections[nodeId] ?? [];
3635
+ const connections = ((_a = this.#graphExecutionPlan) == null ? void 0 : _a.inputConnectionsByNode[nodeId]) ?? this.#connections[nodeId] ?? [];
3306
3636
  for (const connection of connections) {
3307
3637
  if (connection.inputNodeId === nodeId) {
3308
3638
  this.#collectDependencyNodesDeep(connection.outputNodeId, dependencyNodes);
@@ -3339,6 +3669,7 @@ var GraphProcessor = class _GraphProcessor {
3339
3669
  return this.#graphOutputs;
3340
3670
  }
3341
3671
  #initProcessState() {
3672
+ var _a;
3342
3673
  this.#running = true;
3343
3674
  this.#finishEmitted = false;
3344
3675
  if (!this.#hasPreloadedData) {
@@ -3366,7 +3697,7 @@ var GraphProcessor = class _GraphProcessor {
3366
3697
  this.#abortError = void 0;
3367
3698
  this.#abortSuccessfully = false;
3368
3699
  this.#nodeAbortControllers = /* @__PURE__ */ new Map();
3369
- this.#loadedProjects = {};
3700
+ this.#loadedProjects = this.#cacheLoadedProjects && ((_a = this.#runtimeCache) == null ? void 0 : _a.loadedProjects) ? { ...this.#runtimeCache.loadedProjects } : {};
3370
3701
  this.#graphInputNodeValues = {};
3371
3702
  }
3372
3703
  /** Main function for running a graph. Runs a graph and returns the outputs from the output nodes of the graph. */
@@ -3381,9 +3712,13 @@ var GraphProcessor = class _GraphProcessor {
3381
3712
  await this.#emitGraphStart();
3382
3713
  await this.#emitPreloadedNodeResults();
3383
3714
  await this.#waitUntilUnpaused();
3384
- await this.#queueStartNodes(getStartNodes(this.#executionState, this.#graph.nodes, this.runToNodeIds));
3385
- await this.#processingQueue.onIdle();
3386
- this.#markUnqueuedNodesIgnored();
3715
+ if (this.#canUseFastAcyclicScheduler()) {
3716
+ await this.#processFastAcyclicGraph();
3717
+ } else {
3718
+ await this.#queueStartNodes(getStartNodes(this.#executionState, this.#graph.nodes, this.runToNodeIds));
3719
+ await this.#processingQueue.onIdle();
3720
+ this.#markUnqueuedNodesIgnored();
3721
+ }
3387
3722
  await this.#throwIfGraphErrored();
3388
3723
  return await this.#finalizeGraphRun();
3389
3724
  } finally {
@@ -3470,6 +3805,87 @@ var GraphProcessor = class _GraphProcessor {
3470
3805
  });
3471
3806
  }
3472
3807
  }
3808
+ #canUseFastAcyclicScheduler() {
3809
+ if (this.#scheduler !== "fast-acyclic") {
3810
+ return false;
3811
+ }
3812
+ if (this.#hasPreloadedData || this.runToNodeIds || this.slowMode || this.#includeTrace) {
3813
+ return false;
3814
+ }
3815
+ if (this.#nodesNotInCycle.length !== this.#graph.nodes.length) {
3816
+ return false;
3817
+ }
3818
+ if (this.#graph.connections.some((connection) => connection.inputNodeId === connection.outputNodeId)) {
3819
+ return false;
3820
+ }
3821
+ return this.#graph.nodes.every((node) => {
3822
+ if (node.isSplitRun) {
3823
+ return false;
3824
+ }
3825
+ return !FAST_ACYCLIC_UNSUPPORTED_NODE_TYPES.has(node.type);
3826
+ });
3827
+ }
3828
+ async #processFastAcyclicGraph() {
3829
+ const remainingInputsByNode = /* @__PURE__ */ new Map();
3830
+ const readyNodes = [];
3831
+ const queuedNodeIds = /* @__PURE__ */ new Set();
3832
+ for (const node of this.#graph.nodes) {
3833
+ const inputNodeIds = /* @__PURE__ */ new Set();
3834
+ for (const inputNode of getInputNodesTo(this.#executionState, node)) {
3835
+ inputNodeIds.add(inputNode.id);
3836
+ }
3837
+ const inputCount = inputNodeIds.size;
3838
+ remainingInputsByNode.set(node.id, inputCount);
3839
+ if (inputCount === 0) {
3840
+ readyNodes.push(node);
3841
+ queuedNodeIds.add(node.id);
3842
+ }
3843
+ }
3844
+ await new Promise((resolve, reject) => {
3845
+ let activeCount = 0;
3846
+ let settled = false;
3847
+ const queueReadyOutputs = (outputNodes) => {
3848
+ for (const outputNode of outputNodes) {
3849
+ const remainingInputs = (remainingInputsByNode.get(outputNode.id) ?? 0) - 1;
3850
+ remainingInputsByNode.set(outputNode.id, remainingInputs);
3851
+ if (remainingInputs <= 0 && !queuedNodeIds.has(outputNode.id)) {
3852
+ readyNodes.push(outputNode);
3853
+ queuedNodeIds.add(outputNode.id);
3854
+ }
3855
+ }
3856
+ };
3857
+ const settle = () => {
3858
+ if (settled) {
3859
+ return;
3860
+ }
3861
+ if (activeCount === 0 && readyNodes.length === 0) {
3862
+ settled = true;
3863
+ resolve();
3864
+ }
3865
+ };
3866
+ const pump = () => {
3867
+ if (settled) {
3868
+ return;
3869
+ }
3870
+ while (activeCount < this.#concurrency.nodeConcurrency && readyNodes.length > 0) {
3871
+ const node = readyNodes.shift();
3872
+ activeCount += 1;
3873
+ void this.#processNodeIfAllInputsAvailable(node, { queueOutputNodes: false }).then(queueReadyOutputs).then(() => {
3874
+ activeCount -= 1;
3875
+ pump();
3876
+ settle();
3877
+ }).catch((error) => {
3878
+ if (!settled) {
3879
+ settled = true;
3880
+ reject(error);
3881
+ }
3882
+ });
3883
+ }
3884
+ settle();
3885
+ };
3886
+ pump();
3887
+ });
3888
+ }
3473
3889
  #markUnqueuedNodesIgnored() {
3474
3890
  if (!this.runToNodeIds) {
3475
3891
  return;
@@ -3530,8 +3946,12 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
3530
3946
  return outputValues;
3531
3947
  }
3532
3948
  async #loadProjectReferences() {
3533
- var _a;
3949
+ var _a, _b;
3534
3950
  if ((((_a = this.#project.references) == null ? void 0 : _a.length) ?? 0) > 0) {
3951
+ if (this.#cacheLoadedProjects && ((_b = this.#runtimeCache) == null ? void 0 : _b.loadedProjects)) {
3952
+ this.#loadedProjects = { ...this.#runtimeCache.loadedProjects };
3953
+ return;
3954
+ }
3535
3955
  if (!this.#context.projectReferenceLoader) {
3536
3956
  throw new Error(
3537
3957
  "Project references are set, but no projectReferenceLoader is set in the context. Since this project uses project references, you must provide a projectReferenceLoader in the context."
@@ -3552,6 +3972,9 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
3552
3972
  for (const reference of this.#project.references) {
3553
3973
  await loadProject(reference);
3554
3974
  }
3975
+ if (this.#cacheLoadedProjects && this.#runtimeCache) {
3976
+ this.#runtimeCache.loadedProjects = { ...this.#loadedProjects };
3977
+ }
3555
3978
  }
3556
3979
  }
3557
3980
  /** Returns true if any input node has errored. Optionally emits a trace event. */
@@ -3574,10 +3997,6 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
3574
3997
  this.#totalCost += coerceTypeOptional(output["cost"], "number") ?? 0;
3575
3998
  }
3576
3999
  }
3577
- /** Checks if a data value represents a control-flow-excluded signal. */
3578
- #isControlFlowExcluded(value) {
3579
- return value != null && getScalarTypeOf(value.type) === "control-flow-excluded";
3580
- }
3581
4000
  async #fetchNodeDataAndProcessNode(node) {
3582
4001
  var _a;
3583
4002
  if (this.#currentlyProcessing.has(node.id) || this.#queuedNodes.has(node.id)) {
@@ -3618,37 +4037,47 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
3618
4037
  await this.#processNodeIfAllInputsAvailable(node);
3619
4038
  }
3620
4039
  /** If all inputs are present, all conditions met, processes the node. */
3621
- async #processNodeIfAllInputsAvailable(node) {
4040
+ async #processNodeIfAllInputsAvailable(node, options2 = {}) {
4041
+ const { queueOutputNodes = true } = options2;
3622
4042
  const builtInNode = node;
3623
4043
  const inputNodes = getInputNodesTo(this.#executionState, node);
3624
4044
  if (this.#shouldSkipNodeProcessing(node, inputNodes)) {
3625
- return;
4045
+ return [];
3626
4046
  }
3627
4047
  const attachedData = this.#getAttachedDataTo(node);
3628
4048
  if (this.#shouldSkipCompletedRaceNode(node, attachedData)) {
3629
- return;
4049
+ return [];
3630
4050
  }
3631
4051
  const inputValues = this.#getInputValuesForNode(node);
3632
- if (this.#excludedDueToControlFlow(node, inputValues, (0, import_non_secure4.nanoid)(), LOOP_NOT_BROKEN_SENTINEL)) {
4052
+ const loopExclusion = this.#excludedDueToControlFlow(
4053
+ node,
4054
+ inputValues,
4055
+ (0, import_non_secure4.nanoid)(),
4056
+ LOOP_NOT_BROKEN_SENTINEL,
4057
+ { queueOutputNodes }
4058
+ );
4059
+ if (loopExclusion) {
3633
4060
  this.#emitTraceEvent(`Node ${node.title} is excluded due to control flow`);
3634
- return;
4061
+ return loopExclusion === true ? [] : loopExclusion;
3635
4062
  }
3636
4063
  const waitingForInputNode = getWaitingForInputNode(this.#executionState, node, inputNodes, inputValues);
3637
4064
  if (waitingForInputNode) {
3638
4065
  this.#emitTraceEvent(`Node ${node.title} is waiting for input node ${waitingForInputNode}`);
3639
- return;
4066
+ return [];
3640
4067
  }
3641
- if (this.#excludedDueToControlFlow(node, inputValues, (0, import_non_secure4.nanoid)())) {
4068
+ const exclusion = this.#excludedDueToControlFlow(node, inputValues, (0, import_non_secure4.nanoid)(), void 0, {
4069
+ queueOutputNodes
4070
+ });
4071
+ if (exclusion) {
3642
4072
  this.#emitTraceEvent(`Node ${node.title} is excluded due to control flow`);
3643
- return;
4073
+ return exclusion === true ? [] : exclusion;
3644
4074
  }
3645
4075
  const missingRequiredInputs = this.#getMissingRequiredInputs(node);
3646
4076
  if (missingRequiredInputs.length > 0) {
3647
- this.#excludeNodeWithMissingRequiredInputs(node, inputValues, missingRequiredInputs);
3648
- return;
4077
+ return this.#excludeNodeWithMissingRequiredInputs(node, inputValues, missingRequiredInputs, { queueOutputNodes });
3649
4078
  }
3650
4079
  if (this.#beginNodeProcessing(node, attachedData) === false) {
3651
- return;
4080
+ return [];
3652
4081
  }
3653
4082
  const processId = await this.#processNode(node);
3654
4083
  if (this.slowMode) {
@@ -3662,10 +4091,13 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
3662
4091
  this.#handleLoopControllerPostProcess(node, attachedData);
3663
4092
  this.#handleCompletedRace(node);
3664
4093
  if (!this.#assignChildLoopInfo(node, builtInNode, attachedData, processId)) {
3665
- return;
4094
+ return [];
3666
4095
  }
3667
4096
  this.#propagateAttachedDataToOutputNodes(node, attachedData, outputNodes.connectionsToNodes);
3668
- this.#queueOutputNodes(node, outputNodes.nodes);
4097
+ if (queueOutputNodes) {
4098
+ this.#queueOutputNodes(node, outputNodes.nodes);
4099
+ }
4100
+ return outputNodes.nodes;
3669
4101
  }
3670
4102
  #shouldSkipNodeProcessing(node, inputNodes) {
3671
4103
  if (this.#ignoreNodes.has(node.id)) {
@@ -3696,11 +4128,11 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
3696
4128
  }
3697
4129
  return false;
3698
4130
  }
3699
- #excludeNodeWithMissingRequiredInputs(node, inputValues, missingRequiredInputs) {
3700
- const missingInputNames = missingRequiredInputs.map((input) => input.title || input.id).join(", ");
4131
+ #excludeNodeWithMissingRequiredInputs(node, inputValues, missingRequiredInputs, options2 = {}) {
4132
+ const exclusion = getMissingRequiredInputExclusion(node, missingRequiredInputs);
3701
4133
  const processId = (0, import_non_secure4.nanoid)();
3702
- this.#emitTraceEvent(`Excluding node ${node.title} because required inputs are not connected: ${missingInputNames}`);
3703
- this.#excludeNode(node, processId, inputValues, "missing required input");
4134
+ this.#emitTraceEvent(exclusion.traceMessage);
4135
+ return this.#excludeNode(node, processId, inputValues, exclusion.reason, options2);
3704
4136
  }
3705
4137
  #beginNodeProcessing(node, attachedData) {
3706
4138
  if (this.#shouldSkipCompletedRaceNode(node, attachedData)) {
@@ -3851,7 +4283,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
3851
4283
  async #processSplitRunNode(node, processId) {
3852
4284
  return processSplitRunNode(node, processId, {
3853
4285
  getInputValues: (n) => this.#getInputValuesForNode(n),
3854
- isExcludedDueToControlFlow: (n, inputs, pid) => this.#excludedDueToControlFlow(n, inputs, pid),
4286
+ isExcludedDueToControlFlow: (n, inputs, pid) => this.#excludedDueToControlFlow(n, inputs, pid) !== false,
3855
4287
  processNodeWithInputData: (n, inputs, idx, pid, partial) => this.#processNodeWithInputData(n, inputs, idx, pid, partial),
3856
4288
  splitRunConcurrency: this.#concurrency.splitRunConcurrency,
3857
4289
  accumulateCost: (output) => this.#accumulateCost(output),
@@ -4030,7 +4462,11 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
4030
4462
  }
4031
4463
  #createSubProcessor(node, index, processId, subGraphId, { signal, project } = {}) {
4032
4464
  const processor = new _GraphProcessor(project ?? this.#project, subGraphId, this.#registry, this.#includeTrace, {
4033
- concurrency: this.#concurrency
4465
+ cacheLoadedProjects: this.#cacheLoadedProjects,
4466
+ concurrency: this.#concurrency,
4467
+ executionPlanCacheMode: this.#executionPlanCacheMode,
4468
+ runtimeCache: this.#runtimeCache,
4469
+ scheduler: this.#scheduler
4034
4470
  });
4035
4471
  processor.executor = this.executor;
4036
4472
  processor.#isSubProcessor = true;
@@ -4102,53 +4538,19 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
4102
4538
  );
4103
4539
  });
4104
4540
  }
4105
- #excludedDueToControlFlow(node, inputValues, processId, typeOfExclusion = void 0) {
4106
- var _a;
4107
- if (node.disabled) {
4108
- this.#emitTraceEvent(`Excluding node ${node.title} because it's disabled`);
4109
- this.#excludeNode(node, processId, inputValues, "disabled");
4110
- return true;
4111
- }
4112
- if (node.isConditional && typeOfExclusion === void 0) {
4113
- const ifValue = coerceTypeOptional(inputValues[IF_PORT.id], "boolean");
4114
- if (ifValue === false) {
4115
- this.#emitTraceEvent(`Excluding node ${node.title} because if port is false`);
4116
- this.#excludeNode(node, processId, inputValues, "if port is false");
4117
- return true;
4118
- }
4541
+ #excludedDueToControlFlow(node, inputValues, processId, typeOfExclusion, options2 = {}) {
4542
+ const exclusion = getControlFlowExclusionDecision({ node, inputValues, typeOfExclusion });
4543
+ if (exclusion.action === "continue") {
4544
+ return false;
4119
4545
  }
4120
- const inputsWithValues = entries(inputValues);
4121
- const controlFlowExcludedValues = inputsWithValues.filter(
4122
- ([, value]) => this.#isControlFlowExcluded(value) && (!typeOfExclusion || value.value === typeOfExclusion)
4123
- );
4124
- const inputIsExcludedValue = inputsWithValues.length > 0 && controlFlowExcludedValues.length > 0;
4125
- const isWaitingForLoop = controlFlowExcludedValues.some((value) => {
4126
- var _a2;
4127
- return ((_a2 = value == null ? void 0 : value[1]) == null ? void 0 : _a2.value) === LOOP_NOT_BROKEN_SENTINEL;
4128
- });
4129
- const nodesAllowedToConsumeExcludedValue = [
4130
- "if",
4131
- "ifElse",
4132
- "coalesce",
4133
- "graphOutput",
4134
- "raceInputs",
4135
- "loopController"
4136
- ];
4137
- const allowedToConsumedExcludedValue = nodesAllowedToConsumeExcludedValue.includes(node.type) && !isWaitingForLoop;
4138
- if (inputIsExcludedValue && !allowedToConsumedExcludedValue) {
4139
- if (!isWaitingForLoop) {
4140
- if (inputIsExcludedValue) {
4141
- this.#emitTraceEvent(
4142
- `Excluding node ${node.title} because of control flow. Input is has excluded value: ${(_a = controlFlowExcludedValues[0]) == null ? void 0 : _a[0]}`
4143
- );
4144
- }
4145
- this.#excludeNode(node, processId, inputValues, "input is excluded value");
4146
- }
4147
- return true;
4546
+ if (exclusion.action === "exclude") {
4547
+ this.#emitTraceEvent(exclusion.traceMessage);
4548
+ return this.#excludeNode(node, processId, inputValues, exclusion.reason, options2);
4148
4549
  }
4149
- return false;
4550
+ return true;
4150
4551
  }
4151
- #excludeNode(node, processId, inputValues, reason) {
4552
+ #excludeNode(node, processId, inputValues, reason, options2 = {}) {
4553
+ const { queueOutputNodes = true } = options2;
4152
4554
  const attachedData = this.#getAttachedDataTo(node);
4153
4555
  this.#registerNodeInActiveLoop(node, attachedData);
4154
4556
  this.#visitedNodes.add(node.id);
@@ -4157,16 +4559,13 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
4157
4559
  this.#remainingNodes.delete(node.id);
4158
4560
  const outputNodes = getOutputNodesFrom(this.#executionState, node);
4159
4561
  this.#propagateAttachedDataToOutputNodes(node, attachedData, outputNodes.connectionsToNodes);
4160
- this.#queueOutputNodes(node, outputNodes.nodes);
4562
+ if (queueOutputNodes) {
4563
+ this.#queueOutputNodes(node, outputNodes.nodes);
4564
+ }
4565
+ return outputNodes.nodes;
4161
4566
  }
4162
4567
  #markAsExcluded(node, processId, inputValues, reason) {
4163
- const outputs = {};
4164
- for (const output of this.#definitions[node.id].outputs) {
4165
- outputs[output.id] = { type: "control-flow-excluded", value: void 0 };
4166
- }
4167
- if (node.type === "loopController") {
4168
- outputs["break"] = { type: "control-flow-excluded", value: LOOP_NOT_BROKEN_SENTINEL };
4169
- }
4568
+ const outputs = createExcludedNodeOutputs(node, this.#definitions[node.id].outputs);
4170
4569
  this.#nodeResults.set(node.id, outputs);
4171
4570
  emitDetached(
4172
4571
  this.#emitter,
@@ -4184,10 +4583,8 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
4184
4583
  const connections = this.#connections[node.id];
4185
4584
  return this.#definitions[node.id].inputs.reduce(
4186
4585
  (values2, input) => {
4187
- if (!connections) {
4188
- return values2;
4189
- }
4190
- const connection = connections.find((conn) => conn.inputId === input.id && conn.inputNodeId === node.id);
4586
+ var _a, _b;
4587
+ const connection = ((_b = (_a = this.#graphExecutionPlan) == null ? void 0 : _a.inputConnectionByNodeAndPort[node.id]) == null ? void 0 : _b[input.id]) ?? (connections == null ? void 0 : connections.find((conn) => conn.inputId === input.id && conn.inputNodeId === node.id));
4191
4588
  if (connection) {
4192
4589
  const outputNode = this.#nodeInstances[connection.outputNodeId].chartNode;
4193
4590
  const outputNodeOutputs = this.#nodeResults.get(outputNode.id);
@@ -4204,6 +4601,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
4204
4601
  connections: this.#connections,
4205
4602
  definitions: this.#definitions,
4206
4603
  erroredNodes: this.#erroredNodes,
4604
+ executionPlan: this.#graphExecutionPlan,
4207
4605
  loopControllersSeen: this.#loopControllersSeen,
4208
4606
  nodesById: this.#nodesById,
4209
4607
  stronglyConnectedComponents: this.#scc,
@@ -4429,7 +4827,7 @@ var NodeRegistration = class {
4429
4827
 
4430
4828
  // src/model/nodes/UserInputNode.ts
4431
4829
  var import_non_secure5 = require("nanoid/non-secure");
4432
- var import_lodash_es5 = require("lodash");
4830
+ var import_lodash_es4 = require("lodash");
4433
4831
  var import_ts_dedent2 = require("ts-dedent");
4434
4832
  var UserInputNodeImpl = class extends NodeImpl {
4435
4833
  static create() {
@@ -4526,7 +4924,7 @@ var UserInputNodeImpl = class extends NodeImpl {
4526
4924
  },
4527
4925
  ["questionsAndAnswers"]: {
4528
4926
  type: "string[]",
4529
- value: (0, import_lodash_es5.zip)(questions, response.value).map(([q, a]) => `${q}
4927
+ value: (0, import_lodash_es4.zip)(questions, response.value).map(([q, a]) => `${q}
4530
4928
  ${a}`)
4531
4929
  }
4532
4930
  };
@@ -4539,7 +4937,7 @@ var import_non_secure6 = require("nanoid/non-secure");
4539
4937
  var import_ts_dedent3 = require("ts-dedent");
4540
4938
 
4541
4939
  // src/utils/interpolation.ts
4542
- var import_lodash_es6 = require("lodash");
4940
+ var import_lodash_es5 = require("lodash");
4543
4941
  var ESCAPED_TOKEN_REGEX = /\{\{\{([^}]+?)\}\}\}/g;
4544
4942
  var ESCAPED_ESCAPED_TOKEN_REGEX = /\\\{\\\{([^}]+?)\\\}\\\}/g;
4545
4943
  var processingFunctions = {
@@ -4629,7 +5027,7 @@ function resolveExpressionRawValue(source, expression, sourceType) {
4629
5027
  let finalValue;
4630
5028
  if (path) {
4631
5029
  try {
4632
- finalValue = (0, import_lodash_es6.get)(baseValue, path);
5030
+ finalValue = (0, import_lodash_es5.get)(baseValue, path);
4633
5031
  finalValue = unwrapPotentialDataValue(finalValue);
4634
5032
  } catch (error) {
4635
5033
  console.warn(`Error accessing path "${path}" in ${sourceType} value for key "${key}":`, error);
@@ -4971,7 +5369,7 @@ __export(openai_exports, {
4971
5369
  openaiModels: () => openaiModels,
4972
5370
  streamChatCompletions: () => streamChatCompletions
4973
5371
  });
4974
- var import_lodash_es7 = require("lodash");
5372
+ var import_lodash_es6 = require("lodash");
4975
5373
 
4976
5374
  // src/utils/fetchEventSource.ts
4977
5375
  var EventSourceResponse = class extends Response {
@@ -5216,7 +5614,7 @@ var openaiModels = {
5216
5614
  displayName: "Local Model"
5217
5615
  }
5218
5616
  };
5219
- var openAiModelOptions = (0, import_lodash_es7.orderBy)(
5617
+ var openAiModelOptions = (0, import_lodash_es6.orderBy)(
5220
5618
  Object.entries(openaiModels).map(([id, { displayName }]) => ({
5221
5619
  value: id,
5222
5620
  label: displayName
@@ -9649,21 +10047,9 @@ function normalizeChatV2ProviderError(error, context) {
9649
10047
  return normalized;
9650
10048
  }
9651
10049
 
9652
- // src/model/chat-v2/chatV2Pipeline.ts
9653
- var REQUEST_STATUS_PORT_ID = "requestStatus";
9654
- var REQUEST_ERROR_PORT_ID = "requestError";
9655
- var StreamChatV2RetryFailure = class extends Error {
9656
- constructor(error, requestStatuses, requestErrors) {
9657
- super("Chat v2 retry attempts failed");
9658
- this.error = error;
9659
- this.requestStatuses = requestStatuses;
9660
- this.requestErrors = requestErrors;
9661
- this.name = "StreamChatV2RetryFailure";
9662
- }
9663
- };
9664
- function isStreamChatV2RetryFailure(error) {
9665
- return error instanceof StreamChatV2RetryFailure;
9666
- }
10050
+ // src/model/chat-v2/chatV2Outputs.ts
10051
+ var CHAT_V2_REQUEST_STATUS_PORT_ID = "requestStatus";
10052
+ var CHAT_V2_REQUEST_ERROR_PORT_ID = "requestError";
9667
10053
  function toFunctionCallOutputValue(functionCall) {
9668
10054
  let argumentsValue = functionCall.lastParsedArguments;
9669
10055
  if (argumentsValue == null) {
@@ -9679,7 +10065,13 @@ function toFunctionCallOutputValue(functionCall) {
9679
10065
  id: functionCall.id
9680
10066
  };
9681
10067
  }
9682
- function normalizeUsage(usage, options2) {
10068
+ function createControlFlowExcludedOutput() {
10069
+ return {
10070
+ type: "control-flow-excluded",
10071
+ value: void 0
10072
+ };
10073
+ }
10074
+ function normalizeChatV2Usage(usage, options2) {
9683
10075
  var _a, _b, _c;
9684
10076
  if (usage == null) {
9685
10077
  return void 0;
@@ -9705,19 +10097,57 @@ function tryParseStructuredResponseText(response) {
9705
10097
  return void 0;
9706
10098
  }
9707
10099
  }
9708
- function buildResponseOutput(response, structuredOutput, responseFormat) {
10100
+ function createChatV2ResponseOutput2(response, structuredOutput, responseFormat) {
9709
10101
  if (!isChatV2StructuredResponseFormat(responseFormat)) {
9710
10102
  return { type: "string", value: response };
9711
10103
  }
9712
10104
  const parsedOutput = structuredOutput !== void 0 ? structuredOutput : tryParseStructuredResponseText(response);
9713
10105
  return parsedOutput !== void 0 ? inferType(parsedOutput) : { type: "string", value: response };
9714
10106
  }
9715
- function buildCommonOutputs(requestMessages, response, structuredOutput, functionCalls, usage, reasoning, requestStatus, responseError, requestStatuses, requestErrors, options2) {
10107
+ function createChatV2ReasoningOutput(reasoning) {
10108
+ if (Array.isArray(reasoning)) {
10109
+ const nonEmptyReasoning = reasoning.filter((part) => typeof part === "string" && part.trim().length > 0);
10110
+ return nonEmptyReasoning.length > 0 ? {
10111
+ type: "string[]",
10112
+ value: nonEmptyReasoning
10113
+ } : createControlFlowExcludedOutput();
10114
+ }
10115
+ const reasoningText = typeof reasoning === "string" ? reasoning : "";
10116
+ return reasoningText.trim().length > 0 ? {
10117
+ type: "string",
10118
+ value: reasoningText
10119
+ } : createControlFlowExcludedOutput();
10120
+ }
10121
+ function createChatV2RetryAttemptOutput(type, values2) {
10122
+ return values2.length > 0 ? {
10123
+ type,
10124
+ value: values2
10125
+ } : createControlFlowExcludedOutput();
10126
+ }
10127
+ function createChatV2CommonOutputs({
10128
+ requestMessages,
10129
+ response,
10130
+ structuredOutput,
10131
+ functionCalls,
10132
+ usage,
10133
+ reasoning,
10134
+ requestStatus,
10135
+ responseError,
10136
+ requestStatuses,
10137
+ requestErrors,
10138
+ outputUsage,
10139
+ outputReasoning,
10140
+ outputRequestStatus,
10141
+ includeFunctionCalls,
10142
+ functionCallMode,
10143
+ retryOnNon200,
10144
+ responseFormat
10145
+ }) {
9716
10146
  const outputs = {
9717
- ["response"]: buildResponseOutput(response, structuredOutput, options2.responseFormat),
10147
+ ["response"]: createChatV2ResponseOutput2(response, structuredOutput, responseFormat),
9718
10148
  ["in-messages"]: { type: "chat-message[]", value: requestMessages },
9719
10149
  ["all-messages"]: createAssistantMessagesOutput(requestMessages, response, functionCalls, {
9720
- functionCallMode: options2.functionCallMode
10150
+ functionCallMode
9721
10151
  }),
9722
10152
  ["responseTokens"]: { type: "number", value: (usage == null ? void 0 : usage.completionTokens) ?? 0 }
9723
10153
  };
@@ -9726,13 +10156,10 @@ function buildCommonOutputs(requestMessages, response, structuredOutput, functio
9726
10156
  type: "object[]",
9727
10157
  value: functionCalls.map(toFunctionCallOutputValue)
9728
10158
  };
9729
- } else if (options2.includeFunctionCalls) {
9730
- outputs["function-calls"] = {
9731
- type: "control-flow-excluded",
9732
- value: void 0
9733
- };
10159
+ } else if (includeFunctionCalls) {
10160
+ outputs["function-calls"] = createControlFlowExcludedOutput();
9734
10161
  }
9735
- if (options2.outputUsage) {
10162
+ if (outputUsage) {
9736
10163
  outputs["usage"] = {
9737
10164
  type: "object",
9738
10165
  value: usage ?? {
@@ -9745,76 +10172,53 @@ function buildCommonOutputs(requestMessages, response, structuredOutput, functio
9745
10172
  }
9746
10173
  };
9747
10174
  }
9748
- if (options2.outputReasoning) {
9749
- outputs["reasoning"] = buildReasoningOutput(reasoning);
10175
+ if (outputReasoning) {
10176
+ outputs["reasoning"] = createChatV2ReasoningOutput(reasoning);
9750
10177
  }
9751
- if (options2.outputRequestStatus) {
9752
- if (options2.retryOnNon200) {
9753
- outputs[REQUEST_STATUS_PORT_ID] = buildRetryAttemptOutput(
10178
+ if (outputRequestStatus) {
10179
+ if (retryOnNon200) {
10180
+ outputs[CHAT_V2_REQUEST_STATUS_PORT_ID] = createChatV2RetryAttemptOutput(
9754
10181
  "number[]",
9755
10182
  requestStatuses.length > 0 ? requestStatuses : [requestStatus ?? 200]
9756
10183
  );
9757
- outputs[REQUEST_ERROR_PORT_ID] = buildRetryAttemptOutput("string[]", requestErrors);
10184
+ outputs[CHAT_V2_REQUEST_ERROR_PORT_ID] = createChatV2RetryAttemptOutput("string[]", requestErrors);
9758
10185
  } else {
9759
- outputs[REQUEST_STATUS_PORT_ID] = {
10186
+ outputs[CHAT_V2_REQUEST_STATUS_PORT_ID] = {
9760
10187
  type: "number",
9761
10188
  value: requestStatus ?? 200
9762
10189
  };
9763
- outputs[REQUEST_ERROR_PORT_ID] = responseError != null ? {
10190
+ outputs[CHAT_V2_REQUEST_ERROR_PORT_ID] = responseError != null ? {
9764
10191
  type: "string",
9765
10192
  value: responseError
9766
- } : {
9767
- type: "control-flow-excluded",
9768
- value: void 0
9769
- };
10193
+ } : createControlFlowExcludedOutput();
9770
10194
  }
9771
10195
  }
9772
10196
  return outputs;
9773
10197
  }
9774
- function buildReasoningOutput(reasoning) {
9775
- if (Array.isArray(reasoning)) {
9776
- const nonEmptyReasoning = reasoning.filter((part) => typeof part === "string" && part.trim().length > 0);
9777
- return nonEmptyReasoning.length > 0 ? {
9778
- type: "string[]",
9779
- value: nonEmptyReasoning
9780
- } : {
9781
- type: "control-flow-excluded",
9782
- value: void 0
9783
- };
9784
- }
9785
- const reasoningText = typeof reasoning === "string" ? reasoning : "";
9786
- return reasoningText.trim().length > 0 ? {
9787
- type: "string",
9788
- value: reasoningText
9789
- } : {
9790
- type: "control-flow-excluded",
9791
- value: void 0
9792
- };
9793
- }
9794
- function getProviderFailureMessage(error) {
9795
- if (error instanceof Error) {
9796
- return error.message;
9797
- }
9798
- return String(error);
9799
- }
9800
- function buildProviderFailureOutputs(requestMessages, responseStatus, responseError, requestStatuses, requestErrors, options2) {
9801
- const outputs = {};
9802
- Object.assign(outputs, {
9803
- [REQUEST_ERROR_PORT_ID]: options2.retryOnNon200 ? buildRetryAttemptOutput("string[]", requestErrors) : {
10198
+ function createChatV2ProviderFailureOutputs({
10199
+ requestMessages,
10200
+ responseStatus,
10201
+ responseError,
10202
+ requestStatuses,
10203
+ requestErrors,
10204
+ outputUsage,
10205
+ outputReasoning,
10206
+ includeFunctionCalls,
10207
+ retryOnNon200
10208
+ }) {
10209
+ const outputs = {
10210
+ [CHAT_V2_REQUEST_ERROR_PORT_ID]: retryOnNon200 ? createChatV2RetryAttemptOutput("string[]", requestErrors) : {
9804
10211
  type: "string",
9805
10212
  value: responseError
9806
10213
  },
9807
- [REQUEST_STATUS_PORT_ID]: options2.retryOnNon200 ? buildRetryAttemptOutput("number[]", requestStatuses) : responseStatus == null ? {
10214
+ [CHAT_V2_REQUEST_STATUS_PORT_ID]: retryOnNon200 ? createChatV2RetryAttemptOutput("number[]", requestStatuses) : responseStatus == null ? {
9808
10215
  type: "control-flow-excluded",
9809
10216
  value: void 0
9810
10217
  } : {
9811
10218
  type: "number",
9812
10219
  value: responseStatus
9813
10220
  },
9814
- ["response"]: {
9815
- type: "control-flow-excluded",
9816
- value: void 0
9817
- },
10221
+ ["response"]: createControlFlowExcludedOutput(),
9818
10222
  ["in-messages"]: {
9819
10223
  type: "chat-message[]",
9820
10224
  value: requestMessages
@@ -9823,39 +10227,38 @@ function buildProviderFailureOutputs(requestMessages, responseStatus, responseEr
9823
10227
  type: "chat-message[]",
9824
10228
  value: requestMessages
9825
10229
  },
9826
- ["responseTokens"]: {
9827
- type: "control-flow-excluded",
9828
- value: void 0
9829
- }
9830
- });
9831
- if (options2.includeFunctionCalls) {
9832
- outputs["function-calls"] = {
9833
- type: "control-flow-excluded",
9834
- value: void 0
9835
- };
10230
+ ["responseTokens"]: createControlFlowExcludedOutput()
10231
+ };
10232
+ if (includeFunctionCalls) {
10233
+ outputs["function-calls"] = createControlFlowExcludedOutput();
9836
10234
  }
9837
- if (options2.outputUsage) {
9838
- outputs["usage"] = {
9839
- type: "control-flow-excluded",
9840
- value: void 0
9841
- };
10235
+ if (outputUsage) {
10236
+ outputs["usage"] = createControlFlowExcludedOutput();
9842
10237
  }
9843
- if (options2.outputReasoning) {
9844
- outputs["reasoning"] = {
9845
- type: "control-flow-excluded",
9846
- value: void 0
9847
- };
10238
+ if (outputReasoning) {
10239
+ outputs["reasoning"] = createControlFlowExcludedOutput();
9848
10240
  }
9849
10241
  return outputs;
9850
10242
  }
9851
- function buildRetryAttemptOutput(type, values2) {
9852
- return values2.length > 0 ? {
9853
- type,
9854
- value: values2
9855
- } : {
9856
- type: "control-flow-excluded",
9857
- value: void 0
9858
- };
10243
+
10244
+ // src/model/chat-v2/chatV2Pipeline.ts
10245
+ var StreamChatV2RetryFailure = class extends Error {
10246
+ constructor(error, requestStatuses, requestErrors) {
10247
+ super("Chat v2 retry attempts failed");
10248
+ this.error = error;
10249
+ this.requestStatuses = requestStatuses;
10250
+ this.requestErrors = requestErrors;
10251
+ this.name = "StreamChatV2RetryFailure";
10252
+ }
10253
+ };
10254
+ function isStreamChatV2RetryFailure(error) {
10255
+ return error instanceof StreamChatV2RetryFailure;
10256
+ }
10257
+ function getProviderFailureMessage(error) {
10258
+ if (error instanceof Error) {
10259
+ return error.message;
10260
+ }
10261
+ return String(error);
9859
10262
  }
9860
10263
  function buildNon200StatusError(statusCode) {
9861
10264
  const error = new Error(`Provider request returned non-200 status: ${statusCode}`);
@@ -9920,19 +10323,17 @@ function buildProviderFailureResult(requestMessages, options2, normalizedError,
9920
10323
  const responseError = getProviderFailureMessage(normalizedError);
9921
10324
  const retryRequestStatuses = options2.retryOnNon200 ? requestStatuses.length > 0 ? requestStatuses : statusCode == null ? [] : [statusCode] : [];
9922
10325
  const retryRequestErrors = options2.retryOnNon200 ? requestErrors.length > 0 ? requestErrors : [responseError] : [];
9923
- const commonOutputs = buildProviderFailureOutputs(
10326
+ const commonOutputs = createChatV2ProviderFailureOutputs({
9924
10327
  requestMessages,
9925
- statusCode,
10328
+ responseStatus: statusCode,
9926
10329
  responseError,
9927
- retryRequestStatuses,
9928
- retryRequestErrors,
9929
- {
9930
- outputUsage: options2.outputUsage,
9931
- outputReasoning: options2.outputReasoning,
9932
- includeFunctionCalls: options2.includeFunctionCalls,
9933
- retryOnNon200: options2.retryOnNon200
9934
- }
9935
- );
10330
+ requestStatuses: retryRequestStatuses,
10331
+ requestErrors: retryRequestErrors,
10332
+ outputUsage: options2.outputUsage,
10333
+ outputReasoning: options2.outputReasoning,
10334
+ includeFunctionCalls: options2.includeFunctionCalls,
10335
+ retryOnNon200: options2.retryOnNon200
10336
+ });
9936
10337
  const allMessagesOutput = commonOutputs["all-messages"];
9937
10338
  if ((allMessagesOutput == null ? void 0 : allMessagesOutput.type) !== "chat-message[]") {
9938
10339
  throw new Error("Chat v2 provider failure expected all-messages output to be chat-message[].");
@@ -9985,27 +10386,25 @@ async function runChatV2Pipeline(options2) {
9985
10386
  var _a, _b;
9986
10387
  (_b = (_a = options2.context).onPartialOutputs) == null ? void 0 : _b.call(
9987
10388
  _a,
9988
- buildCommonOutputs(
10389
+ createChatV2CommonOutputs({
9989
10390
  requestMessages,
9990
- text,
9991
- void 0,
10391
+ response: text,
10392
+ structuredOutput: void 0,
9992
10393
  functionCalls,
9993
- void 0,
9994
- "",
9995
- void 0,
9996
- void 0,
9997
- [],
9998
- [],
9999
- {
10000
- outputUsage: false,
10001
- outputReasoning: false,
10002
- outputRequestStatus: false,
10003
- includeFunctionCalls: options2.includeFunctionCalls,
10004
- functionCallMode: options2.functionCallMode,
10005
- retryOnNon200: false,
10006
- responseFormat: void 0
10007
- }
10008
- )
10394
+ usage: void 0,
10395
+ reasoning: "",
10396
+ requestStatus: void 0,
10397
+ responseError: void 0,
10398
+ requestStatuses: [],
10399
+ requestErrors: [],
10400
+ outputUsage: false,
10401
+ outputReasoning: false,
10402
+ outputRequestStatus: false,
10403
+ includeFunctionCalls: options2.includeFunctionCalls,
10404
+ functionCallMode: options2.functionCallMode,
10405
+ retryOnNon200: false,
10406
+ responseFormat: void 0
10407
+ })
10009
10408
  );
10010
10409
  }
10011
10410
  },
@@ -10035,31 +10434,29 @@ async function runChatV2Pipeline(options2) {
10035
10434
  if ("commonOutputs" in streamed) {
10036
10435
  return streamed;
10037
10436
  }
10038
- const usage = normalizeUsage(streamed.result.usage, options2);
10437
+ const usage = normalizeChatV2Usage(streamed.result.usage, options2);
10039
10438
  const requestStatuses = streamed.requestStatuses;
10040
10439
  const requestErrors = normalizeProviderFailureMessages(streamed.requestErrors, options2);
10041
10440
  const responseError = streamed.responseError ? normalizeProviderFailureMessage(streamed.responseError, options2) : void 0;
10042
- const commonOutputs = buildCommonOutputs(
10441
+ const commonOutputs = createChatV2CommonOutputs({
10043
10442
  requestMessages,
10044
- streamed.result.responseText,
10045
- streamed.result.structuredOutput,
10046
- streamed.result.functionCalls,
10443
+ response: streamed.result.responseText,
10444
+ structuredOutput: streamed.result.structuredOutput,
10445
+ functionCalls: streamed.result.functionCalls,
10047
10446
  usage,
10048
- streamed.result.reasoning,
10049
- streamed.result.requestStatus,
10447
+ reasoning: streamed.result.reasoning,
10448
+ requestStatus: streamed.result.requestStatus,
10050
10449
  responseError,
10051
10450
  requestStatuses,
10052
10451
  requestErrors,
10053
- {
10054
- outputUsage: options2.outputUsage,
10055
- outputReasoning: options2.outputReasoning,
10056
- outputRequestStatus: options2.outputRequestStatus,
10057
- includeFunctionCalls: options2.includeFunctionCalls,
10058
- functionCallMode: options2.functionCallMode,
10059
- retryOnNon200: options2.retryOnNon200,
10060
- responseFormat: options2.responseFormat
10061
- }
10062
- );
10452
+ outputUsage: options2.outputUsage,
10453
+ outputReasoning: options2.outputReasoning,
10454
+ outputRequestStatus: options2.outputRequestStatus,
10455
+ includeFunctionCalls: options2.includeFunctionCalls,
10456
+ functionCallMode: options2.functionCallMode,
10457
+ retryOnNon200: options2.retryOnNon200,
10458
+ responseFormat: options2.responseFormat
10459
+ });
10063
10460
  const allMessagesOutput = commonOutputs["all-messages"];
10064
10461
  if ((allMessagesOutput == null ? void 0 : allMessagesOutput.type) !== "chat-message[]") {
10065
10462
  throw new Error("Chat v2 pipeline expected all-messages output to be chat-message[].");
@@ -10192,7 +10589,7 @@ async function runChatV2PipelineWithToolContinuation(options2) {
10192
10589
  }
10193
10590
 
10194
10591
  // src/model/nodes/toolCallDelegation.ts
10195
- var import_lodash_es8 = require("lodash");
10592
+ var import_lodash_es7 = require("lodash");
10196
10593
  function isDelegatedToolCallRecord(input) {
10197
10594
  const maybeRecord = input;
10198
10595
  const maybeMessage = maybeRecord == null ? void 0 : maybeRecord.message;
@@ -10280,7 +10677,7 @@ async function delegateToolCall(rawFunctionCall, context, config) {
10280
10677
  const externalFunction = context.externalFunctions[functionCall.name];
10281
10678
  if (externalFunction) {
10282
10679
  try {
10283
- const externalContext = (0, import_lodash_es8.omit)(context, ["setGlobal"]);
10680
+ const externalContext = (0, import_lodash_es7.omit)(context, ["setGlobal"]);
10284
10681
  const result = await externalFunction(externalContext, functionCall.arguments ?? {});
10285
10682
  const outputString2 = stringifyToolOutput(result);
10286
10683
  return {
@@ -11033,9 +11430,8 @@ function escapeRegExp(value) {
11033
11430
  function sanitizeSourceUrlPart(value) {
11034
11431
  return String(value).replace(/[^a-zA-Z0-9_-]/g, "_");
11035
11432
  }
11036
- function buildCodeNodeSourceUrl(nodeId, processId) {
11037
- const processPart = processId ? `-${sanitizeSourceUrlPart(processId)}` : "";
11038
- return `rivet-code-node-${sanitizeSourceUrlPart(nodeId)}${processPart}.js`;
11433
+ function buildCodeNodeSourceUrl(nodeId) {
11434
+ return `rivet-code-node-${sanitizeSourceUrlPart(nodeId)}.js`;
11039
11435
  }
11040
11436
  function appendCodeNodeSourceUrl(code, sourceUrl) {
11041
11437
  return `${code}
@@ -11053,7 +11449,7 @@ function getRuntimeErrorLocationFromStack(params) {
11053
11449
  }
11054
11450
  const generatedLine = Number(match10[1]);
11055
11451
  const column = Number(match10[2]);
11056
- const line = generatedLine - ASYNC_FUNCTION_LINE_OFFSET;
11452
+ const line = generatedLine - ASYNC_FUNCTION_LINE_OFFSET - (params.userCodeLineOffset ?? 0);
11057
11453
  const lineCount = Math.max(params.code.split(/\r?\n/).length, 1);
11058
11454
  if (!Number.isFinite(line) || line < 1 || line > lineCount) {
11059
11455
  return void 0;
@@ -11076,12 +11472,12 @@ function getParserErrorLocation(error) {
11076
11472
  line: loc.line
11077
11473
  };
11078
11474
  }
11079
- async function getSyntaxErrorLocation(code, error) {
11475
+ async function getSyntaxErrorLocation(code, error, options2 = {}) {
11080
11476
  if (error.name !== "SyntaxError") {
11081
11477
  return void 0;
11082
11478
  }
11083
11479
  const wrappedCode = `async function __rivetCodeNode__() {
11084
- ${code}
11480
+ ${options2.diagnosticCode ?? code}
11085
11481
  }`;
11086
11482
  try {
11087
11483
  const { parse: parse4 } = await import("acorn");
@@ -11097,7 +11493,10 @@ ${code}
11097
11493
  }
11098
11494
  const lineCount = Math.max(code.split(/\r?\n/).length, 1);
11099
11495
  const line = Math.min(
11100
- Math.max(parserLocation.line - SYNTAX_PARSE_WRAPPER_LINE_OFFSET, 1),
11496
+ Math.max(
11497
+ parserLocation.line - SYNTAX_PARSE_WRAPPER_LINE_OFFSET - (options2.userCodeLineOffset ?? 0),
11498
+ 1
11499
+ ),
11101
11500
  lineCount
11102
11501
  );
11103
11502
  return {
@@ -11107,9 +11506,9 @@ ${code}
11107
11506
  }
11108
11507
  return void 0;
11109
11508
  }
11110
- function formatLocationSuffix(location) {
11509
+ function formatLocationSuffix(location, locationLabel) {
11111
11510
  const columnText = location.column != null ? `, column ${location.column}` : "";
11112
- return `Code node line ${location.line}${columnText}`;
11511
+ return `${locationLabel} line ${location.line}${columnText}`;
11113
11512
  }
11114
11513
  function replaceStackHeader(stack, error) {
11115
11514
  if (!stack) {
@@ -11121,15 +11520,20 @@ function replaceStackHeader(stack, error) {
11121
11520
  }
11122
11521
  async function enrichCodeNodeErrorWithLocation(params) {
11123
11522
  const originalError = getError(params.error);
11523
+ const userCodeLineOffset = params.userCodeLineOffset ?? 0;
11124
11524
  const location = getRuntimeErrorLocationFromStack({
11125
11525
  code: params.code,
11126
11526
  error: originalError,
11127
- sourceUrl: params.sourceUrl
11128
- }) ?? await getSyntaxErrorLocation(params.code, originalError);
11527
+ sourceUrl: params.sourceUrl,
11528
+ userCodeLineOffset
11529
+ }) ?? await getSyntaxErrorLocation(params.code, originalError, {
11530
+ diagnosticCode: params.diagnosticCode,
11531
+ userCodeLineOffset
11532
+ });
11129
11533
  if (!location) {
11130
11534
  return originalError;
11131
11535
  }
11132
- originalError.message = `${originalError.message} (${formatLocationSuffix(location)})`;
11536
+ originalError.message = `${originalError.message} (${formatLocationSuffix(location, params.locationLabel ?? "Code node")})`;
11133
11537
  originalError.stack = replaceStackHeader(originalError.stack, originalError);
11134
11538
  return originalError;
11135
11539
  }
@@ -11139,7 +11543,7 @@ var CodeNodeImpl = class extends NodeImpl {
11139
11543
  static create() {
11140
11544
  const chartNode = {
11141
11545
  type: "code",
11142
- title: "Code",
11546
+ title: "Code (legacy)",
11143
11547
  id: (0, import_non_secure11.nanoid)(),
11144
11548
  visualData: {
11145
11549
  x: 0,
@@ -11147,10 +11551,10 @@ var CodeNodeImpl = class extends NodeImpl {
11147
11551
  },
11148
11552
  data: {
11149
11553
  code: import_ts_dedent8.dedent`
11150
- // This is a code node, you can write and JS in here and it will be executed.
11554
+ // This is a Code (legacy) node. Write JavaScript here and it will be executed.
11151
11555
  // Inputs are accessible via an object \`inputs\` and data is typed (i.e. inputs.foo.type, inputs.foo.value)
11152
11556
  // Return an object with named outputs that match the output names specified in the node's config.
11153
- // Output values must by typed as well (e.g. { bar: { type: 'string', value: 'bar' } }
11557
+ // Output values must be typed as well (e.g. { bar: { type: 'string', value: 'bar' } }
11154
11558
  return {
11155
11559
  output1: {
11156
11560
  type: inputs.input1.type,
@@ -11276,15 +11680,15 @@ var CodeNodeImpl = class extends NodeImpl {
11276
11680
  static getUIData() {
11277
11681
  return {
11278
11682
  infoBoxBody: import_ts_dedent8.dedent`
11279
- Executes a piece of JavaScript code. See the Rivet Documentation for more information on how to write code for the Code Node.
11683
+ Executes legacy JavaScript code with manually configured inputs and outputs.
11280
11684
  `,
11281
- infoBoxTitle: "Code Node",
11282
- contextMenuTitle: "Code",
11685
+ infoBoxTitle: "Code (legacy) Node",
11686
+ contextMenuTitle: "Code (legacy)",
11283
11687
  group: ["Advanced"]
11284
11688
  };
11285
11689
  }
11286
11690
  async process(inputs, context) {
11287
- const sourceUrl = buildCodeNodeSourceUrl(this.chartNode.id, context.processId);
11691
+ const sourceUrl = buildCodeNodeSourceUrl(this.chartNode.id);
11288
11692
  let outputs;
11289
11693
  try {
11290
11694
  outputs = await context.codeRunner.runCode(
@@ -11304,29 +11708,48 @@ var CodeNodeImpl = class extends NodeImpl {
11304
11708
  throw await enrichCodeNodeErrorWithLocation({
11305
11709
  code: this.data.code,
11306
11710
  error,
11711
+ locationLabel: "Code (legacy) node",
11307
11712
  sourceUrl
11308
11713
  });
11309
11714
  }
11310
11715
  if (outputs == null || typeof outputs !== "object" || "then" in outputs && typeof outputs.then === "function") {
11311
- throw new Error("Code node must return an object with output values.");
11716
+ throw new Error("Code (legacy) node must return an object with output values.");
11312
11717
  }
11313
11718
  const missingOutputs = this.getOutputDefinitions().filter((output) => !(output.id in outputs));
11314
11719
  if (missingOutputs.length > 0) {
11315
11720
  throw new Error(
11316
- `Code node must return an object with output values for all outputs. To not run an output, return { "type": "control-flow-excluded", "value": undefined }. To return undefined, return { "type": "any", "value": undefined }. Missing: ${missingOutputs.map((output) => output.id).join(", ")}`
11721
+ `Code (legacy) node must return an object with output values for all outputs. To not run an output, return { "type": "control-flow-excluded", "value": undefined }. To return undefined, return { "type": "any", "value": undefined }. Missing: ${missingOutputs.map((output) => output.id).join(", ")}`
11317
11722
  );
11318
11723
  }
11319
11724
  return outputs;
11320
11725
  }
11321
11726
  };
11322
- var codeNode = nodeDefinition(CodeNodeImpl, "Code");
11727
+ var codeNode = nodeDefinition(CodeNodeImpl, "Code (legacy)");
11323
11728
 
11324
- // src/model/nodes/ExpressionNode.ts
11729
+ // src/model/nodes/CodeNewNode.ts
11325
11730
  var import_non_secure12 = require("nanoid/non-secure");
11326
11731
  var import_ts_dedent10 = require("ts-dedent");
11327
11732
 
11328
11733
  // src/model/nodes/jsValueInterpolation.ts
11329
11734
  var import_ts_dedent9 = require("ts-dedent");
11735
+ function escapeRegExp2(value) {
11736
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
11737
+ }
11738
+ function containsIdentifier(source, identifier) {
11739
+ return new RegExp(`(^|[^A-Za-z0-9_$])${escapeRegExp2(identifier)}($|[^A-Za-z0-9_$])`).test(source);
11740
+ }
11741
+ function getSafeJsValueInterpolationIdentifier(source, baseIdentifier) {
11742
+ let index = 0;
11743
+ let candidate = baseIdentifier;
11744
+ while (containsIdentifier(source, candidate)) {
11745
+ index += 1;
11746
+ candidate = `${baseIdentifier}_${index}`;
11747
+ }
11748
+ return candidate;
11749
+ }
11750
+ function buildJsValuePreview(source, maxLines) {
11751
+ return source.split("\n").slice(0, maxLines).join("\n").trim();
11752
+ }
11330
11753
  function isSpecialReference(inputName) {
11331
11754
  return inputName.startsWith("@graphInputs.") || inputName.startsWith("@context.");
11332
11755
  }
@@ -11375,18 +11798,33 @@ function getJsValueInterpolationInputNames(template, options2 = {}) {
11375
11798
  return !((_a = options2.localIdentifiers) == null ? void 0 : _a.has(inputName));
11376
11799
  });
11377
11800
  }
11801
+ function getJsValueInterpolationInputDefinitions(template, options2 = {}) {
11802
+ return getJsValueInterpolationInputNames(template, options2).map(
11803
+ (inputName) => createInterpolationInputDefinition({
11804
+ interpolationName: inputName,
11805
+ dataType: "any",
11806
+ required: false
11807
+ })
11808
+ );
11809
+ }
11810
+ function getJsValueInterpolationRuntimeContext(template, baseInputsIdentifier, options2 = {}) {
11811
+ return {
11812
+ inputNames: getJsValueInterpolationInputNames(template, options2),
11813
+ inputsIdentifier: getSafeJsValueInterpolationIdentifier(template, baseInputsIdentifier)
11814
+ };
11815
+ }
11378
11816
  function buildJsValueInterpolatedSource(template, targetIdentifier, options2 = {}) {
11379
11817
  return replaceInterpolationTokens(
11380
11818
  template,
11381
11819
  (token) => buildJsValueReference(token.tokenName, targetIdentifier, options2),
11382
11820
  {
11383
- trim: true
11821
+ trim: options2.trim ?? true
11384
11822
  }
11385
11823
  );
11386
11824
  }
11387
11825
  function interpolateJsValuePreviewSource(template, inputs, options2 = {}) {
11388
11826
  return replaceInterpolationTokens(template, (token) => formatJsValuePreviewValue(token.tokenName, inputs, options2), {
11389
- trim: true
11827
+ trim: options2.trim ?? true
11390
11828
  });
11391
11829
  }
11392
11830
  function buildCloneJsInputValueFunction() {
@@ -11486,6 +11924,26 @@ function buildClonedInputValueAssignments(inputNames, targetIdentifier, cacheIde
11486
11924
  )}]?.value, ${cacheIdentifier});`
11487
11925
  ).join("\n");
11488
11926
  }
11927
+ function buildJsValueInputClonePreamble({
11928
+ cacheIdentifier,
11929
+ inputsIdentifier
11930
+ }) {
11931
+ return import_ts_dedent9.dedent`
11932
+ ${buildCloneJsInputValueFunction()}
11933
+ const ${inputsIdentifier} = Object.create(null);
11934
+ const ${cacheIdentifier} = new WeakMap();
11935
+ `;
11936
+ }
11937
+ function buildJsValueInputsInitializer({
11938
+ cacheIdentifier,
11939
+ inputNames,
11940
+ inputsIdentifier
11941
+ }) {
11942
+ return import_ts_dedent9.dedent`
11943
+ ${buildJsValueInputClonePreamble({ cacheIdentifier, inputsIdentifier })}
11944
+ ${buildClonedInputValueAssignments(inputNames, inputsIdentifier, cacheIdentifier)}
11945
+ `;
11946
+ }
11489
11947
  function sanitizeGeneratedJsValueText(text, inputNames, targetIdentifier, fallbackLabel) {
11490
11948
  if (!text) {
11491
11949
  return text;
@@ -11497,51 +11955,255 @@ function sanitizeGeneratedJsValueText(text, inputNames, targetIdentifier, fallba
11497
11955
  }
11498
11956
  return sanitized.replaceAll(targetIdentifier, fallbackLabel);
11499
11957
  }
11958
+ function sanitizeGeneratedJsValueError(error, inputNames, targetIdentifier, fallbackLabel) {
11959
+ const jsValueError = getError(error);
11960
+ jsValueError.message = sanitizeGeneratedJsValueText(jsValueError.message, inputNames, targetIdentifier, fallbackLabel) ?? jsValueError.message;
11961
+ jsValueError.stack = sanitizeGeneratedJsValueText(
11962
+ jsValueError.stack,
11963
+ inputNames,
11964
+ targetIdentifier,
11965
+ fallbackLabel
11966
+ );
11967
+ return jsValueError;
11968
+ }
11969
+
11970
+ // src/model/nodes/CodeNewNode.ts
11971
+ var DEFAULT_CODE_NEW = import_ts_dedent10.dedent`
11972
+ // This is a Code node. Write JavaScript here and return one value.
11973
+ // Interpolation tokens create input ports and evaluate as connected values.
11974
+ // The returned value becomes the node's single output.
11975
+ const value = {{input}};
11976
+ return value;
11977
+ `;
11978
+ var MAX_BODY_PREVIEW_LINES2 = 15;
11979
+ var CODE_NEW_INPUTS_IDENTIFIER = "__codeNewInputs";
11980
+ var CODE_NEW_INPUT_CLONE_CACHE_IDENTIFIER = "codeNewInputCloneCache";
11981
+ var CODE_NEW_OUTPUT_PORT_ID = "output";
11982
+ function buildCodeNewPreview(code) {
11983
+ return buildJsValuePreview(code, MAX_BODY_PREVIEW_LINES2);
11984
+ }
11985
+ function buildCodeNewRuntimeSource(code, inputsIdentifier) {
11986
+ return buildJsValueInterpolatedSource(code, inputsIdentifier, { trim: false });
11987
+ }
11988
+ function buildCodeNewInputsInitializer(inputNames, inputsIdentifier) {
11989
+ return buildJsValueInputsInitializer({
11990
+ cacheIdentifier: CODE_NEW_INPUT_CLONE_CACHE_IDENTIFIER,
11991
+ inputNames,
11992
+ inputsIdentifier
11993
+ });
11994
+ }
11995
+ function interpolateCodeNewSource(code, inputs) {
11996
+ return interpolateJsValuePreviewSource(code, inputs, { trim: false });
11997
+ }
11998
+ function sanitizeCodeNewError(error, inputNames, inputsIdentifier) {
11999
+ return sanitizeGeneratedJsValueError(error, inputNames, inputsIdentifier, "code input");
12000
+ }
12001
+ function buildCodeNewWrapper(code, interpolationContext) {
12002
+ const { inputNames, inputsIdentifier } = interpolationContext;
12003
+ const beforeUserCodeLines = [
12004
+ ...buildCodeNewInputsInitializer(inputNames, inputsIdentifier).split(/\r?\n/),
12005
+ "",
12006
+ "const __codeNewResult = await (async () => {"
12007
+ ];
12008
+ const afterUserCodeLines = [
12009
+ "})();",
12010
+ "",
12011
+ "return {",
12012
+ " output: {",
12013
+ " type: 'any',",
12014
+ " value: __codeNewResult,",
12015
+ " },",
12016
+ "};"
12017
+ ];
12018
+ return {
12019
+ source: [...beforeUserCodeLines, buildCodeNewRuntimeSource(code, inputsIdentifier), ...afterUserCodeLines].join(
12020
+ "\n"
12021
+ ),
12022
+ userCodeLineOffset: beforeUserCodeLines.length
12023
+ };
12024
+ }
12025
+ function isDataValueLike(value) {
12026
+ return typeof value === "object" && value !== null && typeof value.type === "string" && Object.prototype.hasOwnProperty.call(value, "value");
12027
+ }
12028
+ function validateCodeNewRunnerOutputs(outputs) {
12029
+ if (outputs == null || typeof outputs !== "object" || "then" in outputs && typeof outputs.then === "function") {
12030
+ throw new Error("Code node runner must return an object containing the Output value.");
12031
+ }
12032
+ const output = outputs[CODE_NEW_OUTPUT_PORT_ID];
12033
+ if (!isDataValueLike(output)) {
12034
+ throw new Error("Code node runner must return a DataValue for the Output port.");
12035
+ }
12036
+ if (output.type !== "any") {
12037
+ throw new Error("Code node runner must return an any DataValue for the Output port.");
12038
+ }
12039
+ return outputs;
12040
+ }
12041
+ var CodeNewNodeImpl = class extends NodeImpl {
12042
+ static create() {
12043
+ return {
12044
+ type: "codeNew",
12045
+ title: "Code",
12046
+ id: (0, import_non_secure12.nanoid)(),
12047
+ visualData: {
12048
+ x: 0,
12049
+ y: 0,
12050
+ width: 260
12051
+ },
12052
+ data: {
12053
+ code: DEFAULT_CODE_NEW,
12054
+ allowFetch: false,
12055
+ allowRequire: false,
12056
+ allowRivet: false,
12057
+ allowProcess: false,
12058
+ allowConsole: false
12059
+ }
12060
+ };
12061
+ }
12062
+ getInputDefinitions() {
12063
+ return getJsValueInterpolationInputDefinitions(this.data.code);
12064
+ }
12065
+ getOutputDefinitions() {
12066
+ return [
12067
+ {
12068
+ id: CODE_NEW_OUTPUT_PORT_ID,
12069
+ title: "Output",
12070
+ dataType: "any"
12071
+ }
12072
+ ];
12073
+ }
12074
+ getEditors() {
12075
+ return [
12076
+ {
12077
+ type: "code",
12078
+ label: "Code",
12079
+ helperMessage: "Use {{var}} to create input ports. Interpolated variables evaluate as the connected values.",
12080
+ dataKey: "code",
12081
+ language: "javascript",
12082
+ interpolationSyntax: "js-value",
12083
+ enableFolding: true
12084
+ },
12085
+ {
12086
+ type: "group",
12087
+ label: "Runtime permissions",
12088
+ defaultOpen: true,
12089
+ editors: [
12090
+ {
12091
+ type: "toggle",
12092
+ label: 'Allow "fetch"',
12093
+ dataKey: "allowFetch"
12094
+ },
12095
+ {
12096
+ type: "toggle",
12097
+ label: 'Allow "Rivet"',
12098
+ dataKey: "allowRivet"
12099
+ },
12100
+ {
12101
+ type: "toggle",
12102
+ label: 'Allow "console"',
12103
+ dataKey: "allowConsole"
12104
+ },
12105
+ {
12106
+ type: "toggle",
12107
+ label: 'Allow "require"',
12108
+ dataKey: "allowRequire",
12109
+ helperMessage: "Only available with the Node executor"
12110
+ },
12111
+ {
12112
+ type: "toggle",
12113
+ label: 'Allow "process"',
12114
+ dataKey: "allowProcess",
12115
+ helperMessage: "Only available with the Node executor"
12116
+ }
12117
+ ]
12118
+ }
12119
+ ];
12120
+ }
12121
+ getBody() {
12122
+ return {
12123
+ type: "colorized",
12124
+ text: buildCodeNewPreview(this.data.code),
12125
+ language: "javascript",
12126
+ fontSize: 12,
12127
+ fontFamily: "monospace"
12128
+ };
12129
+ }
12130
+ static getUIData() {
12131
+ return {
12132
+ infoBoxBody: import_ts_dedent10.dedent`
12133
+ Runs JavaScript code that can use interpolation-created input ports and emits the returned value as the node output.
12134
+ `,
12135
+ infoBoxTitle: "Code Node",
12136
+ contextMenuTitle: "Code",
12137
+ group: ["Advanced"]
12138
+ };
12139
+ }
12140
+ async process(inputs, context) {
12141
+ const sourceUrl = buildCodeNodeSourceUrl(this.chartNode.id);
12142
+ const interpolationContext = getJsValueInterpolationRuntimeContext(this.data.code, CODE_NEW_INPUTS_IDENTIFIER);
12143
+ const { inputNames, inputsIdentifier } = interpolationContext;
12144
+ const { source, userCodeLineOffset } = buildCodeNewWrapper(this.data.code, interpolationContext);
12145
+ try {
12146
+ const outputs = await context.codeRunner.runCode(
12147
+ appendCodeNodeSourceUrl(source, sourceUrl),
12148
+ inputs,
12149
+ {
12150
+ includeFetch: this.data.allowFetch ?? false,
12151
+ includeRequire: this.data.allowRequire ?? false,
12152
+ includeRivet: this.data.allowRivet ?? false,
12153
+ includeProcess: this.data.allowProcess ?? false,
12154
+ includeConsole: this.data.allowConsole ?? false
12155
+ },
12156
+ context.graphInputNodeValues,
12157
+ context.contextValues
12158
+ );
12159
+ return validateCodeNewRunnerOutputs(outputs);
12160
+ } catch (error) {
12161
+ const enrichedError = await enrichCodeNodeErrorWithLocation({
12162
+ code: this.data.code,
12163
+ diagnosticCode: source,
12164
+ error,
12165
+ locationLabel: "Code node",
12166
+ sourceUrl,
12167
+ userCodeLineOffset
12168
+ });
12169
+ throw sanitizeCodeNewError(enrichedError, inputNames, inputsIdentifier);
12170
+ }
12171
+ }
12172
+ };
12173
+ var codeNewNode = nodeDefinition(CodeNewNodeImpl, "Code");
11500
12174
 
11501
12175
  // src/model/nodes/ExpressionNode.ts
12176
+ var import_non_secure13 = require("nanoid/non-secure");
12177
+ var import_ts_dedent11 = require("ts-dedent");
11502
12178
  var DEFAULT_EXPRESSION = '{{a}} == "123" ? {{b}} : {{c}}';
11503
- var MAX_BODY_PREVIEW_LINES2 = 15;
12179
+ var MAX_BODY_PREVIEW_LINES3 = 15;
11504
12180
  var EXPRESSION_INPUTS_IDENTIFIER = "__expressionInputs";
11505
12181
  var EXPRESSION_INPUT_CLONE_CACHE_IDENTIFIER = "expressionInputCloneCache";
11506
12182
  var EXPRESSION_OUTPUT_PORT_ID = "output";
11507
12183
  function buildExpressionPreview(expression) {
11508
- return expression.split("\n").slice(0, MAX_BODY_PREVIEW_LINES2).join("\n").trim();
11509
- }
11510
- function getExpressionInputNames(expression) {
11511
- return getJsValueInterpolationInputNames(expression);
12184
+ return buildJsValuePreview(expression, MAX_BODY_PREVIEW_LINES3);
11512
12185
  }
11513
- function buildExpressionRuntimeSource(expression) {
11514
- return buildJsValueInterpolatedSource(expression, EXPRESSION_INPUTS_IDENTIFIER);
12186
+ function buildExpressionRuntimeSource(expression, inputsIdentifier) {
12187
+ return buildJsValueInterpolatedSource(expression, inputsIdentifier);
11515
12188
  }
11516
- function buildExpressionInputsInitializer(inputNames) {
11517
- return import_ts_dedent10.dedent`
11518
- ${buildCloneJsInputValueFunction()}
11519
- const ${EXPRESSION_INPUTS_IDENTIFIER} = Object.create(null);
11520
- const ${EXPRESSION_INPUT_CLONE_CACHE_IDENTIFIER} = new WeakMap();
11521
- ${buildClonedInputValueAssignments(
12189
+ function buildExpressionInputsInitializer(inputNames, inputsIdentifier) {
12190
+ return buildJsValueInputsInitializer({
12191
+ cacheIdentifier: EXPRESSION_INPUT_CLONE_CACHE_IDENTIFIER,
11522
12192
  inputNames,
11523
- EXPRESSION_INPUTS_IDENTIFIER,
11524
- EXPRESSION_INPUT_CLONE_CACHE_IDENTIFIER
11525
- )}
11526
- `;
12193
+ inputsIdentifier
12194
+ });
11527
12195
  }
11528
12196
  function interpolateExpressionSource(expression, inputs) {
11529
12197
  return interpolateJsValuePreviewSource(expression, inputs);
11530
12198
  }
11531
- function sanitizeGeneratedExpressionText(text, inputNames) {
11532
- return sanitizeGeneratedJsValueText(text, inputNames, EXPRESSION_INPUTS_IDENTIFIER, "expression input");
11533
- }
11534
- function sanitizeExpressionError(error, inputNames) {
11535
- const expressionError = getError(error);
11536
- expressionError.message = sanitizeGeneratedExpressionText(expressionError.message, inputNames) ?? expressionError.message;
11537
- expressionError.stack = sanitizeGeneratedExpressionText(expressionError.stack, inputNames);
11538
- return expressionError;
12199
+ function sanitizeExpressionError(error, inputNames, inputsIdentifier) {
12200
+ return sanitizeGeneratedJsValueError(error, inputNames, inputsIdentifier, "expression input");
11539
12201
  }
11540
- function buildExpressionWrapper(expression) {
11541
- const inputNames = getExpressionInputNames(expression);
11542
- const expressionSource = buildExpressionRuntimeSource(expression);
11543
- return import_ts_dedent10.dedent`
11544
- ${buildExpressionInputsInitializer(inputNames)}
12202
+ function buildExpressionWrapper(expression, interpolationContext) {
12203
+ const { inputNames, inputsIdentifier } = interpolationContext;
12204
+ const expressionSource = buildExpressionRuntimeSource(expression, inputsIdentifier);
12205
+ return import_ts_dedent11.dedent`
12206
+ ${buildExpressionInputsInitializer(inputNames, inputsIdentifier)}
11545
12207
 
11546
12208
  return {
11547
12209
  output: {
@@ -11556,7 +12218,7 @@ var ExpressionNodeImpl = class extends NodeImpl {
11556
12218
  const chartNode = {
11557
12219
  type: "expression",
11558
12220
  title: "Expression",
11559
- id: (0, import_non_secure12.nanoid)(),
12221
+ id: (0, import_non_secure13.nanoid)(),
11560
12222
  visualData: {
11561
12223
  x: 0,
11562
12224
  y: 0,
@@ -11569,13 +12231,7 @@ var ExpressionNodeImpl = class extends NodeImpl {
11569
12231
  return chartNode;
11570
12232
  }
11571
12233
  getInputDefinitions() {
11572
- return getExpressionInputNames(this.data.expression).map((inputName) => {
11573
- return createInterpolationInputDefinition({
11574
- interpolationName: inputName,
11575
- dataType: "any",
11576
- required: false
11577
- });
11578
- });
12234
+ return getJsValueInterpolationInputDefinitions(this.data.expression);
11579
12235
  }
11580
12236
  getOutputDefinitions() {
11581
12237
  return [
@@ -11594,6 +12250,7 @@ var ExpressionNodeImpl = class extends NodeImpl {
11594
12250
  helperMessage: "Use {{var}} to create input ports. Interpolated variables evaluate as the connected values.",
11595
12251
  dataKey: "expression",
11596
12252
  language: "javascript",
12253
+ interpolationSyntax: "js-value",
11597
12254
  enableFolding: true
11598
12255
  }
11599
12256
  ];
@@ -11609,7 +12266,7 @@ var ExpressionNodeImpl = class extends NodeImpl {
11609
12266
  }
11610
12267
  static getUIData() {
11611
12268
  return {
11612
- infoBoxBody: import_ts_dedent10.dedent`
12269
+ infoBoxBody: import_ts_dedent11.dedent`
11613
12270
  Evaluates a single JavaScript expression and returns the resulting value.
11614
12271
 
11615
12272
  <code>{{interpolation}}</code> creates dynamic input ports. Interpolated variables evaluate as connected values, so arrays, objects, strings, numbers, and booleans can be used directly.
@@ -11620,10 +12277,15 @@ var ExpressionNodeImpl = class extends NodeImpl {
11620
12277
  };
11621
12278
  }
11622
12279
  async process(inputs, context) {
11623
- const inputNames = getExpressionInputNames(this.data.expression);
12280
+ const interpolationContext = getJsValueInterpolationRuntimeContext(
12281
+ this.data.expression,
12282
+ EXPRESSION_INPUTS_IDENTIFIER
12283
+ );
12284
+ const { inputNames, inputsIdentifier } = interpolationContext;
12285
+ const source = buildExpressionWrapper(this.data.expression, interpolationContext);
11624
12286
  try {
11625
12287
  return await context.codeRunner.runCode(
11626
- buildExpressionWrapper(this.data.expression),
12288
+ source,
11627
12289
  inputs,
11628
12290
  {
11629
12291
  includeFetch: false,
@@ -11636,21 +12298,21 @@ var ExpressionNodeImpl = class extends NodeImpl {
11636
12298
  context.contextValues
11637
12299
  );
11638
12300
  } catch (error) {
11639
- throw sanitizeExpressionError(error, inputNames);
12301
+ throw sanitizeExpressionError(error, inputNames, inputsIdentifier);
11640
12302
  }
11641
12303
  }
11642
12304
  };
11643
12305
  var expressionNode = nodeDefinition(ExpressionNodeImpl, "Expression");
11644
12306
 
11645
12307
  // src/model/nodes/MatchNode.ts
11646
- var import_non_secure13 = require("nanoid/non-secure");
11647
- var import_ts_dedent11 = require("ts-dedent");
12308
+ var import_non_secure14 = require("nanoid/non-secure");
12309
+ var import_ts_dedent12 = require("ts-dedent");
11648
12310
  var MatchNodeImpl = class extends NodeImpl {
11649
12311
  static create() {
11650
12312
  const chartNode = {
11651
12313
  type: "match",
11652
12314
  title: "Match",
11653
- id: (0, import_non_secure13.nanoid)(),
12315
+ id: (0, import_non_secure14.nanoid)(),
11654
12316
  visualData: {
11655
12317
  x: 0,
11656
12318
  y: 0,
@@ -11658,7 +12320,7 @@ var MatchNodeImpl = class extends NodeImpl {
11658
12320
  },
11659
12321
  data: {
11660
12322
  cases: ["YES", "NO"],
11661
- casePortIds: [(0, import_non_secure13.nanoid)(), (0, import_non_secure13.nanoid)()]
12323
+ casePortIds: [(0, import_non_secure14.nanoid)(), (0, import_non_secure14.nanoid)()]
11662
12324
  }
11663
12325
  };
11664
12326
  return chartNode;
@@ -11706,7 +12368,7 @@ var MatchNodeImpl = class extends NodeImpl {
11706
12368
  return outputs;
11707
12369
  }
11708
12370
  getBody() {
11709
- return import_ts_dedent11.dedent`
12371
+ return import_ts_dedent12.dedent`
11710
12372
  ${this.data.exclusive ? "First Matching Case" : "All Matching Cases"}
11711
12373
  ${this.data.cases.length} Cases
11712
12374
  `;
@@ -11741,7 +12403,7 @@ var MatchNodeImpl = class extends NodeImpl {
11741
12403
  }
11742
12404
  static getUIData() {
11743
12405
  return {
11744
- infoBoxBody: import_ts_dedent11.dedent`
12406
+ infoBoxBody: import_ts_dedent12.dedent`
11745
12407
  Any number of regular expressions can be configured, each corresponding to an output of the node. The output port of the first matching regex will be ran, and all other output ports will not be ran.
11746
12408
  `,
11747
12409
  infoBoxTitle: "Match Node",
@@ -11796,14 +12458,14 @@ var MatchNodeImpl = class extends NodeImpl {
11796
12458
  var matchNode = nodeDefinition(MatchNodeImpl, "Match");
11797
12459
 
11798
12460
  // src/model/nodes/IfNode.ts
11799
- var import_non_secure14 = require("nanoid/non-secure");
11800
- var import_ts_dedent12 = require("ts-dedent");
12461
+ var import_non_secure15 = require("nanoid/non-secure");
12462
+ var import_ts_dedent13 = require("ts-dedent");
11801
12463
  var IfNodeImpl = class extends NodeImpl {
11802
12464
  static create = () => {
11803
12465
  const chartNode = {
11804
12466
  type: "if",
11805
12467
  title: "If",
11806
- id: (0, import_non_secure14.nanoid)(),
12468
+ id: (0, import_non_secure15.nanoid)(),
11807
12469
  data: {
11808
12470
  // Legacy behavior is false
11809
12471
  unconnectedControlFlowExcluded: true
@@ -11850,7 +12512,7 @@ var IfNodeImpl = class extends NodeImpl {
11850
12512
  }
11851
12513
  static getUIData() {
11852
12514
  return {
11853
- infoBoxBody: import_ts_dedent12.dedent`
12515
+ infoBoxBody: import_ts_dedent13.dedent`
11854
12516
  Takes in a condition and a value. If the condition is truthy, the value is passed through the True port, and the False port is not ran.
11855
12517
  If the condition is falsy, the value is passed through the False port, and the True port is not ran.
11856
12518
  `,
@@ -11920,8 +12582,8 @@ var IfNodeImpl = class extends NodeImpl {
11920
12582
  var ifNode = nodeDefinition(IfNodeImpl, "If");
11921
12583
 
11922
12584
  // src/model/nodes/ReadDirectoryNode.ts
11923
- var import_non_secure15 = require("nanoid/non-secure");
11924
- var import_ts_dedent13 = require("ts-dedent");
12585
+ var import_non_secure16 = require("nanoid/non-secure");
12586
+ var import_ts_dedent14 = require("ts-dedent");
11925
12587
 
11926
12588
  // src/utils/paths.ts
11927
12589
  function createTreeFromPaths(paths, rootPath) {
@@ -11996,7 +12658,7 @@ function createTreeFromPaths(paths, rootPath) {
11996
12658
  var ReadDirectoryNodeImpl = class extends NodeImpl {
11997
12659
  static create() {
11998
12660
  return {
11999
- id: (0, import_non_secure15.nanoid)(),
12661
+ id: (0, import_non_secure16.nanoid)(),
12000
12662
  type: "readDirectory",
12001
12663
  title: "Read Directory",
12002
12664
  visualData: { x: 0, y: 0 },
@@ -12085,7 +12747,7 @@ var ReadDirectoryNodeImpl = class extends NodeImpl {
12085
12747
  ];
12086
12748
  }
12087
12749
  getBody() {
12088
- return import_ts_dedent13.dedent`
12750
+ return import_ts_dedent14.dedent`
12089
12751
  Path: ${this.data.usePathInput ? "(Input)" : this.data.path}
12090
12752
  Recursive: ${this.data.useRecursiveInput ? "(Input)" : this.data.recursive}
12091
12753
  Include Directories: ${this.data.useIncludeDirectoriesInput ? "(Input)" : this.data.includeDirectories}
@@ -12095,7 +12757,7 @@ var ReadDirectoryNodeImpl = class extends NodeImpl {
12095
12757
  }
12096
12758
  static getUIData() {
12097
12759
  return {
12098
- infoBoxBody: import_ts_dedent13.dedent`
12760
+ infoBoxBody: import_ts_dedent14.dedent`
12099
12761
  Reads the contents of the specified directory and outputs:
12100
12762
  1. An array of filenames
12101
12763
  2. The root path of the search
@@ -12151,12 +12813,12 @@ var ReadDirectoryNodeImpl = class extends NodeImpl {
12151
12813
  var readDirectoryNode = nodeDefinition(ReadDirectoryNodeImpl, "Read Directory");
12152
12814
 
12153
12815
  // src/model/nodes/ReadFileNode.ts
12154
- var import_non_secure16 = require("nanoid/non-secure");
12155
- var import_ts_dedent14 = require("ts-dedent");
12816
+ var import_non_secure17 = require("nanoid/non-secure");
12817
+ var import_ts_dedent15 = require("ts-dedent");
12156
12818
  var ReadFileNodeImpl = class extends NodeImpl {
12157
12819
  static create() {
12158
12820
  return {
12159
- id: (0, import_non_secure16.nanoid)(),
12821
+ id: (0, import_non_secure17.nanoid)(),
12160
12822
  type: "readFile",
12161
12823
  title: "Read File",
12162
12824
  visualData: { x: 0, y: 0, width: 250 },
@@ -12191,7 +12853,7 @@ var ReadFileNodeImpl = class extends NodeImpl {
12191
12853
  }
12192
12854
  static getUIData() {
12193
12855
  return {
12194
- infoBoxBody: import_ts_dedent14.dedent`
12856
+ infoBoxBody: import_ts_dedent15.dedent`
12195
12857
  Reads the contents of the specified file and outputs it as a string.
12196
12858
  `,
12197
12859
  infoBoxTitle: "Read File Node",
@@ -12220,7 +12882,7 @@ var ReadFileNodeImpl = class extends NodeImpl {
12220
12882
  ];
12221
12883
  }
12222
12884
  getBody() {
12223
- return import_ts_dedent14.dedent`
12885
+ return import_ts_dedent15.dedent`
12224
12886
  ${this.data.asBinary ? "Read as Binary" : "Read as Text"}
12225
12887
  ${this.data.usePathInput ? "" : `Path: ${this.data.path}`}
12226
12888
  `;
@@ -12258,14 +12920,14 @@ var ReadFileNodeImpl = class extends NodeImpl {
12258
12920
  var readFileNode = nodeDefinition(ReadFileNodeImpl, "Read File");
12259
12921
 
12260
12922
  // src/model/nodes/IfElseNode.ts
12261
- var import_non_secure17 = require("nanoid/non-secure");
12262
- var import_ts_dedent15 = require("ts-dedent");
12923
+ var import_non_secure18 = require("nanoid/non-secure");
12924
+ var import_ts_dedent16 = require("ts-dedent");
12263
12925
  var IfElseNodeImpl = class extends NodeImpl {
12264
12926
  static create = () => {
12265
12927
  const chartNode = {
12266
12928
  type: "ifElse",
12267
12929
  title: "If/Else",
12268
- id: (0, import_non_secure17.nanoid)(),
12930
+ id: (0, import_non_secure18.nanoid)(),
12269
12931
  data: {
12270
12932
  // Legacy behavior is false
12271
12933
  unconnectedControlFlowExcluded: true
@@ -12312,7 +12974,7 @@ var IfElseNodeImpl = class extends NodeImpl {
12312
12974
  }
12313
12975
  static getUIData() {
12314
12976
  return {
12315
- infoBoxBody: import_ts_dedent15.dedent`
12977
+ infoBoxBody: import_ts_dedent16.dedent`
12316
12978
  Takes in three inputs: a condition, a true value, and a false value. If the condition is truthy, the true value is passed through the output port. If the condition is not truthy, the false value is passed through the output port.
12317
12979
 
12318
12980
  This node can "consume" a \`Not Ran\` to continue a graph from that point.
@@ -12391,14 +13053,14 @@ var IfElseNodeImpl = class extends NodeImpl {
12391
13053
  var ifElseNode = nodeDefinition(IfElseNodeImpl, "If/Else");
12392
13054
 
12393
13055
  // src/model/nodes/ChunkNode.ts
12394
- var import_non_secure18 = require("nanoid/non-secure");
12395
- var import_ts_dedent16 = require("ts-dedent");
13056
+ var import_non_secure19 = require("nanoid/non-secure");
13057
+ var import_ts_dedent17 = require("ts-dedent");
12396
13058
  var ChunkNodeImpl = class extends NodeImpl {
12397
13059
  static create() {
12398
13060
  const chartNode = {
12399
13061
  type: "chunk",
12400
13062
  title: "Chunk",
12401
- id: (0, import_non_secure18.nanoid)(),
13063
+ id: (0, import_non_secure19.nanoid)(),
12402
13064
  visualData: {
12403
13065
  x: 0,
12404
13066
  y: 0,
@@ -12487,7 +13149,7 @@ var ChunkNodeImpl = class extends NodeImpl {
12487
13149
  ];
12488
13150
  }
12489
13151
  getBody() {
12490
- return import_ts_dedent16.dedent`
13152
+ return import_ts_dedent17.dedent`
12491
13153
  Model: ${this.data.model}
12492
13154
  Token Count: ${this.data.numTokensPerChunk.toLocaleString()}
12493
13155
  ${this.data.overlap ? `Overlap: ${this.data.overlap}%` : ""}
@@ -12495,7 +13157,7 @@ var ChunkNodeImpl = class extends NodeImpl {
12495
13157
  }
12496
13158
  static getUIData() {
12497
13159
  return {
12498
- infoBoxBody: import_ts_dedent16.dedent`
13160
+ infoBoxBody: import_ts_dedent17.dedent`
12499
13161
  Splits the input text into an array of chunks based on an approximate GPT token count per chunk.
12500
13162
 
12501
13163
  The "overlap" setting allows you to partially overlap the chunks for redundancy.
@@ -12561,14 +13223,14 @@ async function chunkStringByTokenCount(tokenizer, tokenizerInfo, input, targetTo
12561
13223
  }
12562
13224
 
12563
13225
  // src/model/nodes/GraphInputNode.ts
12564
- var import_non_secure19 = require("nanoid/non-secure");
12565
- var import_ts_dedent17 = require("ts-dedent");
13226
+ var import_non_secure20 = require("nanoid/non-secure");
13227
+ var import_ts_dedent18 = require("ts-dedent");
12566
13228
  var GraphInputNodeImpl = class extends NodeImpl {
12567
13229
  static create() {
12568
13230
  const chartNode = {
12569
13231
  type: "graphInput",
12570
13232
  title: "Graph Input",
12571
- id: (0, import_non_secure19.nanoid)(),
13233
+ id: (0, import_non_secure20.nanoid)(),
12572
13234
  visualData: {
12573
13235
  x: 0,
12574
13236
  y: 0,
@@ -12643,7 +13305,7 @@ var GraphInputNodeImpl = class extends NodeImpl {
12643
13305
  ];
12644
13306
  }
12645
13307
  getBody() {
12646
- return import_ts_dedent17.dedent`
13308
+ return import_ts_dedent18.dedent`
12647
13309
  ${this.data.id}
12648
13310
  Type: ${this.data.dataType}
12649
13311
  ${this.data.defaultValue == null ? "" : `Default: ${this.data.defaultValue}`}
@@ -12651,7 +13313,7 @@ var GraphInputNodeImpl = class extends NodeImpl {
12651
13313
  }
12652
13314
  static getUIData() {
12653
13315
  return {
12654
- infoBoxBody: import_ts_dedent17.dedent`
13316
+ infoBoxBody: import_ts_dedent18.dedent`
12655
13317
  Defines an input for the graph which can be passed in when the graph is called, or defines one of the input ports when the graph is a subgraph.
12656
13318
  `,
12657
13319
  infoBoxTitle: "Graph Input Node",
@@ -12681,14 +13343,14 @@ var GraphInputNodeImpl = class extends NodeImpl {
12681
13343
  var graphInputNode = nodeDefinition(GraphInputNodeImpl, "Graph Input");
12682
13344
 
12683
13345
  // src/model/nodes/GraphOutputNode.ts
12684
- var import_non_secure20 = require("nanoid/non-secure");
12685
- var import_ts_dedent18 = require("ts-dedent");
13346
+ var import_non_secure21 = require("nanoid/non-secure");
13347
+ var import_ts_dedent19 = require("ts-dedent");
12686
13348
  var GraphOutputNodeImpl = class extends NodeImpl {
12687
13349
  static create() {
12688
13350
  const chartNode = {
12689
13351
  type: "graphOutput",
12690
13352
  title: "Graph Output",
12691
- id: (0, import_non_secure20.nanoid)(),
13353
+ id: (0, import_non_secure21.nanoid)(),
12692
13354
  visualData: {
12693
13355
  x: 0,
12694
13356
  y: 0,
@@ -12734,14 +13396,14 @@ var GraphOutputNodeImpl = class extends NodeImpl {
12734
13396
  ];
12735
13397
  }
12736
13398
  getBody() {
12737
- return import_ts_dedent18.dedent`
13399
+ return import_ts_dedent19.dedent`
12738
13400
  ${this.data.id}
12739
13401
  Type: ${this.data.dataType}
12740
13402
  `;
12741
13403
  }
12742
13404
  static getUIData() {
12743
13405
  return {
12744
- infoBoxBody: import_ts_dedent18.dedent`
13406
+ infoBoxBody: import_ts_dedent19.dedent`
12745
13407
  Each instance of this node represents an individual output of the graph. The value passed into this node becomes part of the overall output of the graph.
12746
13408
  `,
12747
13409
  infoBoxTitle: "Graph Output Node",
@@ -12777,14 +13439,14 @@ var GraphOutputNodeImpl = class extends NodeImpl {
12777
13439
  var graphOutputNode = nodeDefinition(GraphOutputNodeImpl, "Graph Output");
12778
13440
 
12779
13441
  // src/model/nodes/SubGraphNode.ts
12780
- var import_non_secure21 = require("nanoid/non-secure");
12781
- var import_ts_dedent19 = require("ts-dedent");
13442
+ var import_non_secure22 = require("nanoid/non-secure");
13443
+ var import_ts_dedent20 = require("ts-dedent");
12782
13444
  var SubGraphNodeImpl = class extends NodeImpl {
12783
13445
  static create() {
12784
13446
  const chartNode = {
12785
13447
  type: "subGraph",
12786
13448
  title: "Subgraph",
12787
- id: (0, import_non_secure21.nanoid)(),
13449
+ id: (0, import_non_secure22.nanoid)(),
12788
13450
  visualData: {
12789
13451
  x: 0,
12790
13452
  y: 0,
@@ -12876,7 +13538,7 @@ var SubGraphNodeImpl = class extends NodeImpl {
12876
13538
  }
12877
13539
  static getUIData() {
12878
13540
  return {
12879
- infoBoxBody: import_ts_dedent19.dedent`
13541
+ infoBoxBody: import_ts_dedent20.dedent`
12880
13542
  Executes another graph. Inputs and outputs are defined by Graph Input and Graph Output nodes within the subgraph.
12881
13543
  `,
12882
13544
  infoBoxTitle: "Subgraph Node",
@@ -12958,15 +13620,15 @@ var SubGraphNodeImpl = class extends NodeImpl {
12958
13620
  var subGraphNode = nodeDefinition(SubGraphNodeImpl, "Subgraph");
12959
13621
 
12960
13622
  // src/model/nodes/ArrayNode.ts
12961
- var import_non_secure22 = require("nanoid/non-secure");
12962
- var import_lodash_es9 = require("lodash");
12963
- var import_ts_dedent20 = require("ts-dedent");
13623
+ var import_non_secure23 = require("nanoid/non-secure");
13624
+ var import_lodash_es8 = require("lodash");
13625
+ var import_ts_dedent21 = require("ts-dedent");
12964
13626
  var ArrayNodeImpl = class extends NodeImpl {
12965
13627
  static create() {
12966
13628
  const chartNode = {
12967
13629
  type: "array",
12968
13630
  title: "Array",
12969
- id: (0, import_non_secure22.nanoid)(),
13631
+ id: (0, import_non_secure23.nanoid)(),
12970
13632
  visualData: {
12971
13633
  x: 0,
12972
13634
  y: 0,
@@ -13040,7 +13702,7 @@ var ArrayNodeImpl = class extends NodeImpl {
13040
13702
  }
13041
13703
  static getUIData() {
13042
13704
  return {
13043
- infoBoxBody: import_ts_dedent20.dedent`
13705
+ infoBoxBody: import_ts_dedent21.dedent`
13044
13706
  Creates an array from the input values. By default, flattens any arrays which are inputs into a single array. Can be configured to keep the arrays separate, or deeply flatten arrays.
13045
13707
 
13046
13708
  Useful for both creating and merging arrays.
@@ -13053,7 +13715,7 @@ var ArrayNodeImpl = class extends NodeImpl {
13053
13715
  };
13054
13716
  }
13055
13717
  getBody() {
13056
- return import_ts_dedent20.dedent`
13718
+ return import_ts_dedent21.dedent`
13057
13719
  ${this.data.flatten ? this.data.flattenDeep ? "Flatten (Deep)" : "Flatten" : "No Flatten"}
13058
13720
  `;
13059
13721
  }
@@ -13065,7 +13727,7 @@ var ArrayNodeImpl = class extends NodeImpl {
13065
13727
  if (Array.isArray(input == null ? void 0 : input.value)) {
13066
13728
  for (const value of (input == null ? void 0 : input.value) ?? []) {
13067
13729
  if (this.data.flattenDeep) {
13068
- outputArray.push(...Array.isArray(value) ? (0, import_lodash_es9.flattenDeep)(value) : [value]);
13730
+ outputArray.push(...Array.isArray(value) ? (0, import_lodash_es8.flattenDeep)(value) : [value]);
13069
13731
  } else {
13070
13732
  outputArray.push(value);
13071
13733
  }
@@ -13097,14 +13759,14 @@ var ArrayNodeImpl = class extends NodeImpl {
13097
13759
  var arrayNode = nodeDefinition(ArrayNodeImpl, "Array");
13098
13760
 
13099
13761
  // src/model/nodes/ExtractJsonNode.ts
13100
- var import_non_secure23 = require("nanoid/non-secure");
13101
- var import_ts_dedent21 = require("ts-dedent");
13762
+ var import_non_secure24 = require("nanoid/non-secure");
13763
+ var import_ts_dedent22 = require("ts-dedent");
13102
13764
  var ExtractJsonNodeImpl = class extends NodeImpl {
13103
13765
  static create() {
13104
13766
  const chartNode = {
13105
13767
  type: "extractJson",
13106
13768
  title: "Extract JSON",
13107
- id: (0, import_non_secure23.nanoid)(),
13769
+ id: (0, import_non_secure24.nanoid)(),
13108
13770
  visualData: {
13109
13771
  x: 0,
13110
13772
  y: 0,
@@ -13141,7 +13803,7 @@ var ExtractJsonNodeImpl = class extends NodeImpl {
13141
13803
  }
13142
13804
  static getUIData() {
13143
13805
  return {
13144
- infoBoxBody: import_ts_dedent21.dedent`
13806
+ infoBoxBody: import_ts_dedent22.dedent`
13145
13807
  Finds and parses the first JSON object in input text, or passes through an already-structured input object.
13146
13808
 
13147
13809
  Outputs the parsed or passed-through object.
@@ -13221,15 +13883,15 @@ function createMatchedOutput(value) {
13221
13883
  }
13222
13884
 
13223
13885
  // src/model/nodes/AssemblePromptNode.ts
13224
- var import_non_secure24 = require("nanoid/non-secure");
13225
- var import_lodash_es10 = require("lodash");
13226
- var import_ts_dedent22 = require("ts-dedent");
13886
+ var import_non_secure25 = require("nanoid/non-secure");
13887
+ var import_lodash_es9 = require("lodash");
13888
+ var import_ts_dedent23 = require("ts-dedent");
13227
13889
  var AssemblePromptNodeImpl = class extends NodeImpl {
13228
13890
  static create() {
13229
13891
  const chartNode = {
13230
13892
  type: "assemblePrompt",
13231
13893
  title: "Assemble Prompt",
13232
- id: (0, import_non_secure24.nanoid)(),
13894
+ id: (0, import_non_secure25.nanoid)(),
13233
13895
  visualData: {
13234
13896
  x: 0,
13235
13897
  y: 0,
@@ -13295,7 +13957,7 @@ var AssemblePromptNodeImpl = class extends NodeImpl {
13295
13957
  }
13296
13958
  static getUIData() {
13297
13959
  return {
13298
- infoBoxBody: import_ts_dedent22.dedent`
13960
+ infoBoxBody: import_ts_dedent23.dedent`
13299
13961
  Assembles an array of chat messages for use with a Chat node. The inputs can be strings or chat messages.
13300
13962
 
13301
13963
  The number of inputs is dynamic based on the number of connections.
@@ -13329,7 +13991,7 @@ var AssemblePromptNodeImpl = class extends NodeImpl {
13329
13991
  const output = {};
13330
13992
  const isLastMessageCacheBreakpoint = getInputOrData(this.data, inputs, "isLastMessageCacheBreakpoint", "boolean");
13331
13993
  const outMessages = [];
13332
- const inputMessages = (0, import_lodash_es10.orderBy)(
13994
+ const inputMessages = (0, import_lodash_es9.orderBy)(
13333
13995
  Object.entries(inputs).filter(([key]) => key.startsWith("message")),
13334
13996
  ([key]) => key,
13335
13997
  "asc"
@@ -13372,16 +14034,16 @@ var AssemblePromptNodeImpl = class extends NodeImpl {
13372
14034
  var assemblePromptNode = nodeDefinition(AssemblePromptNodeImpl, "Assemble Prompt");
13373
14035
 
13374
14036
  // src/model/nodes/ExtractYamlNode.ts
13375
- var import_non_secure25 = require("nanoid/non-secure");
14037
+ var import_non_secure26 = require("nanoid/non-secure");
13376
14038
  var import_yaml = __toESM(require("yaml"), 1);
13377
14039
  var import_jsonpath_plus = require("jsonpath-plus");
13378
- var import_ts_dedent23 = require("ts-dedent");
14040
+ var import_ts_dedent24 = require("ts-dedent");
13379
14041
  var ExtractYamlNodeImpl = class extends NodeImpl {
13380
14042
  static create() {
13381
14043
  const chartNode = {
13382
14044
  type: "extractYaml",
13383
14045
  title: "Extract YAML",
13384
- id: (0, import_non_secure25.nanoid)(),
14046
+ id: (0, import_non_secure26.nanoid)(),
13385
14047
  visualData: {
13386
14048
  x: 0,
13387
14049
  y: 0,
@@ -13461,14 +14123,14 @@ var ExtractYamlNodeImpl = class extends NodeImpl {
13461
14123
  ];
13462
14124
  }
13463
14125
  getBody() {
13464
- return import_ts_dedent23.dedent`
14126
+ return import_ts_dedent24.dedent`
13465
14127
  Root: ${this.data.useRootPropertyNameInput ? "(Using Input)" : this.data.rootPropertyName}
13466
14128
  ${this.data.useObjectPathInput ? "Path: (Using Input)" : this.data.objectPath ? `Path: ${this.data.objectPath}` : ``}
13467
14129
  `;
13468
14130
  }
13469
14131
  static getUIData() {
13470
14132
  return {
13471
- infoBoxBody: import_ts_dedent23.dedent`
14133
+ infoBoxBody: import_ts_dedent24.dedent`
13472
14134
  Finds and parses a YAML object in the input text with a predefined root property name (configurable).
13473
14135
 
13474
14136
  Defaults to \`yamlDocument\`, which means the input text must have a \`yamlDocument:\` root node somewhere in it. All indented text after that is considered part of the YAML.
@@ -13568,14 +14230,14 @@ var ExtractYamlNodeImpl = class extends NodeImpl {
13568
14230
  var extractYamlNode = nodeDefinition(ExtractYamlNodeImpl, "Extract YAML");
13569
14231
 
13570
14232
  // src/model/nodes/LoopControllerNode.ts
13571
- var import_non_secure26 = require("nanoid/non-secure");
13572
- var import_ts_dedent24 = require("ts-dedent");
14233
+ var import_non_secure27 = require("nanoid/non-secure");
14234
+ var import_ts_dedent25 = require("ts-dedent");
13573
14235
  var LoopControllerNodeImpl = class extends NodeImpl {
13574
14236
  static create() {
13575
14237
  const chartNode = {
13576
14238
  type: "loopController",
13577
14239
  title: "Loop Controller",
13578
- id: (0, import_non_secure26.nanoid)(),
14240
+ id: (0, import_non_secure27.nanoid)(),
13579
14241
  visualData: {
13580
14242
  x: 0,
13581
14243
  y: 0,
@@ -13681,7 +14343,7 @@ var LoopControllerNodeImpl = class extends NodeImpl {
13681
14343
  }
13682
14344
  static getUIData() {
13683
14345
  return {
13684
- infoBoxBody: import_ts_dedent24.dedent`
14346
+ infoBoxBody: import_ts_dedent25.dedent`
13685
14347
  Defines the entry point for a loop. Values from inside the loop should be passed back through the "Input" ports, and their corresponding "Default" values can be specified on the input ports as well.
13686
14348
 
13687
14349
  If the "continue" input is falsey, then the "break" output will run.
@@ -13767,14 +14429,14 @@ var LoopControllerNodeImpl = class extends NodeImpl {
13767
14429
  var loopControllerNode = nodeDefinition(LoopControllerNodeImpl, "Loop Controller");
13768
14430
 
13769
14431
  // src/model/nodes/TrimChatMessagesNode.ts
13770
- var import_non_secure27 = require("nanoid/non-secure");
13771
- var import_ts_dedent25 = require("ts-dedent");
14432
+ var import_non_secure28 = require("nanoid/non-secure");
14433
+ var import_ts_dedent26 = require("ts-dedent");
13772
14434
  var TrimChatMessagesNodeImpl = class extends NodeImpl {
13773
14435
  static create() {
13774
14436
  const chartNode = {
13775
14437
  type: "trimChatMessages",
13776
14438
  title: "Trim Chat Messages",
13777
- id: (0, import_non_secure27.nanoid)(),
14439
+ id: (0, import_non_secure28.nanoid)(),
13778
14440
  visualData: {
13779
14441
  x: 0,
13780
14442
  y: 0,
@@ -13837,14 +14499,14 @@ var TrimChatMessagesNodeImpl = class extends NodeImpl {
13837
14499
  ];
13838
14500
  }
13839
14501
  getBody() {
13840
- return import_ts_dedent25.dedent`
14502
+ return import_ts_dedent26.dedent`
13841
14503
  Max Token Count: ${this.data.useMaxTokenCountInput ? "(From Input)" : this.data.maxTokenCount}
13842
14504
  Remove From Beginning: ${this.data.useRemoveFromBeginningInput ? "(From Input)" : this.data.removeFromBeginning ? "Yes" : "No"}
13843
14505
  `;
13844
14506
  }
13845
14507
  static getUIData() {
13846
14508
  return {
13847
- infoBoxBody: import_ts_dedent25.dedent`
14509
+ infoBoxBody: import_ts_dedent26.dedent`
13848
14510
  Takes an array of chat messages, and slices messages from the beginning or the end of the list until the total length of the messages is under the configured token length.
13849
14511
 
13850
14512
  Useful for setting up infinite message chains that stay under the LLM context limit.
@@ -13882,13 +14544,13 @@ var TrimChatMessagesNodeImpl = class extends NodeImpl {
13882
14544
  var trimChatMessagesNode = nodeDefinition(TrimChatMessagesNodeImpl, "Trim Chat Messages");
13883
14545
 
13884
14546
  // src/model/nodes/ExternalCallNode.ts
13885
- var import_non_secure28 = require("nanoid/non-secure");
13886
- var import_lodash_es11 = require("lodash");
13887
- var import_ts_dedent26 = require("ts-dedent");
14547
+ var import_non_secure29 = require("nanoid/non-secure");
14548
+ var import_lodash_es10 = require("lodash");
14549
+ var import_ts_dedent27 = require("ts-dedent");
13888
14550
  var ExternalCallNodeImpl = class extends NodeImpl {
13889
14551
  static create() {
13890
14552
  return {
13891
- id: (0, import_non_secure28.nanoid)(),
14553
+ id: (0, import_non_secure29.nanoid)(),
13892
14554
  type: "externalCall",
13893
14555
  title: "External Call",
13894
14556
  visualData: { x: 0, y: 0, width: 150 },
@@ -13952,7 +14614,7 @@ var ExternalCallNodeImpl = class extends NodeImpl {
13952
14614
  }
13953
14615
  static getUIData() {
13954
14616
  return {
13955
- infoBoxBody: import_ts_dedent26.dedent`
14617
+ infoBoxBody: import_ts_dedent27.dedent`
13956
14618
  Provides a way to call into the host project from inside a Rivet graph when Rivet graphs are integrated into another project.
13957
14619
  `,
13958
14620
  infoBoxTitle: "External Call Node",
@@ -13978,7 +14640,7 @@ var ExternalCallNodeImpl = class extends NodeImpl {
13978
14640
  }
13979
14641
  }
13980
14642
  const fn = context.externalFunctions[functionName];
13981
- const externalContext = (0, import_lodash_es11.omit)(context, ["setGlobal"]);
14643
+ const externalContext = (0, import_lodash_es10.omit)(context, ["setGlobal"]);
13982
14644
  if (!fn) {
13983
14645
  if (this.data.useErrorOutput) {
13984
14646
  return {
@@ -14031,9 +14693,9 @@ var ExternalCallNodeImpl = class extends NodeImpl {
14031
14693
  var externalCallNode = nodeDefinition(ExternalCallNodeImpl, "External Call");
14032
14694
 
14033
14695
  // src/model/nodes/ExtractObjectPathNode.ts
14034
- var import_non_secure29 = require("nanoid/non-secure");
14696
+ var import_non_secure30 = require("nanoid/non-secure");
14035
14697
  var import_jsonpath_plus2 = require("jsonpath-plus");
14036
- var import_ts_dedent27 = require("ts-dedent");
14698
+ var import_ts_dedent28 = require("ts-dedent");
14037
14699
  var RESERVED_INPUT_IDS = /* @__PURE__ */ new Set(["object"]);
14038
14700
  function getExtractObjectPathInterpolationInputNames(path) {
14039
14701
  return extractInterpolationVariables(path).filter((inputName) => !RESERVED_INPUT_IDS.has(inputName));
@@ -14059,7 +14721,7 @@ var ExtractObjectPathNodeImpl = class extends NodeImpl {
14059
14721
  const chartNode = {
14060
14722
  type: "extractObjectPath",
14061
14723
  title: "Extract Object Path",
14062
- id: (0, import_non_secure29.nanoid)(),
14724
+ id: (0, import_non_secure30.nanoid)(),
14063
14725
  visualData: {
14064
14726
  x: 0,
14065
14727
  y: 0,
@@ -14136,7 +14798,7 @@ var ExtractObjectPathNodeImpl = class extends NodeImpl {
14136
14798
  }
14137
14799
  static getUIData() {
14138
14800
  return {
14139
- infoBoxBody: import_ts_dedent27.dedent`
14801
+ infoBoxBody: import_ts_dedent28.dedent`
14140
14802
  Extracts the value at the specified path from the input value. The path uses JSONPath notation to navigate through the value.
14141
14803
  `,
14142
14804
  infoBoxTitle: "Extract Object Path Node",
@@ -14186,12 +14848,12 @@ var ExtractObjectPathNodeImpl = class extends NodeImpl {
14186
14848
  var extractObjectPathNode = nodeDefinition(ExtractObjectPathNodeImpl, "Extract Object Path");
14187
14849
 
14188
14850
  // src/model/nodes/RaiseEventNode.ts
14189
- var import_non_secure30 = require("nanoid/non-secure");
14190
- var import_ts_dedent28 = require("ts-dedent");
14851
+ var import_non_secure31 = require("nanoid/non-secure");
14852
+ var import_ts_dedent29 = require("ts-dedent");
14191
14853
  var RaiseEventNodeImpl = class extends NodeImpl {
14192
14854
  static create() {
14193
14855
  return {
14194
- id: (0, import_non_secure30.nanoid)(),
14856
+ id: (0, import_non_secure31.nanoid)(),
14195
14857
  type: "raiseEvent",
14196
14858
  title: "Raise Event",
14197
14859
  visualData: { x: 0, y: 0, width: 150 },
@@ -14241,7 +14903,7 @@ var RaiseEventNodeImpl = class extends NodeImpl {
14241
14903
  }
14242
14904
  static getUIData() {
14243
14905
  return {
14244
- infoBoxBody: import_ts_dedent28.dedent`
14906
+ infoBoxBody: import_ts_dedent29.dedent`
14245
14907
  Raises an event that the host project or a 'Wait For Event' node can listen for.
14246
14908
  `,
14247
14909
  infoBoxTitle: "Raise Event Node",
@@ -14261,14 +14923,14 @@ var RaiseEventNodeImpl = class extends NodeImpl {
14261
14923
  var raiseEventNode = nodeDefinition(RaiseEventNodeImpl, "Raise Event");
14262
14924
 
14263
14925
  // src/model/nodes/ContextNode.ts
14264
- var import_non_secure31 = require("nanoid/non-secure");
14265
- var import_ts_dedent29 = require("ts-dedent");
14926
+ var import_non_secure32 = require("nanoid/non-secure");
14927
+ var import_ts_dedent30 = require("ts-dedent");
14266
14928
  var ContextNodeImpl = class extends NodeImpl {
14267
14929
  static create() {
14268
14930
  const chartNode = {
14269
14931
  type: "context",
14270
14932
  title: "Context",
14271
- id: (0, import_non_secure31.nanoid)(),
14933
+ id: (0, import_non_secure32.nanoid)(),
14272
14934
  visualData: {
14273
14935
  x: 0,
14274
14936
  y: 0,
@@ -14317,14 +14979,14 @@ var ContextNodeImpl = class extends NodeImpl {
14317
14979
  ];
14318
14980
  }
14319
14981
  getBody() {
14320
- return import_ts_dedent29.dedent`
14982
+ return import_ts_dedent30.dedent`
14321
14983
  ${this.data.id}
14322
14984
  Type: ${this.data.dataType}
14323
14985
  `;
14324
14986
  }
14325
14987
  static getUIData() {
14326
14988
  return {
14327
- infoBoxBody: import_ts_dedent29.dedent`
14989
+ infoBoxBody: import_ts_dedent30.dedent`
14328
14990
  Retrieves a value from the graph's context using a configured id. The context serves as a "global graph input", allowing the same values to be accessible from any graph or subgraph.
14329
14991
  `,
14330
14992
  infoBoxTitle: "Context Node",
@@ -14362,8 +15024,8 @@ var ContextNodeImpl = class extends NodeImpl {
14362
15024
  var contextNode = nodeDefinition(ContextNodeImpl, "Context");
14363
15025
 
14364
15026
  // src/model/nodes/CoalesceNode.ts
14365
- var import_non_secure32 = require("nanoid/non-secure");
14366
- var import_ts_dedent30 = require("ts-dedent");
15027
+ var import_non_secure33 = require("nanoid/non-secure");
15028
+ var import_ts_dedent31 = require("ts-dedent");
14367
15029
  var INPUT_PORT_ID_PATTERN = /^input(\d+)$/;
14368
15030
  var IGNORE_NULL_LABEL = "Ignore 'null'";
14369
15031
  var IGNORE_UNDEFINED_LABEL = "Ignore 'undefined'";
@@ -14372,7 +15034,7 @@ var CoalesceNodeImpl = class extends NodeImpl {
14372
15034
  const chartNode = {
14373
15035
  type: "coalesce",
14374
15036
  title: "Coalesce",
14375
- id: (0, import_non_secure32.nanoid)(),
15037
+ id: (0, import_non_secure33.nanoid)(),
14376
15038
  data: {
14377
15039
  ignoreNull: false,
14378
15040
  ignoreUndefined: false
@@ -14437,7 +15099,7 @@ var CoalesceNodeImpl = class extends NodeImpl {
14437
15099
  }
14438
15100
  static getUIData() {
14439
15101
  return {
14440
- infoBoxBody: import_ts_dedent30.dedent`
15102
+ infoBoxBody: import_ts_dedent31.dedent`
14441
15103
  Takes in any number of inputs and outputs the first value that is not "Not Ran". Useful for consolidating branches after a Match node.
14442
15104
 
14443
15105
  Null and undefined input values are emitted by default, but the node can be configured to skip either value and continue checking later inputs.
@@ -14513,14 +15175,14 @@ var CoalesceNodeImpl = class extends NodeImpl {
14513
15175
  var coalesceNode = nodeDefinition(CoalesceNodeImpl, "Coalesce");
14514
15176
 
14515
15177
  // src/model/nodes/DidRunNode.ts
14516
- var import_non_secure33 = require("nanoid/non-secure");
14517
- var import_ts_dedent31 = require("ts-dedent");
15178
+ var import_non_secure34 = require("nanoid/non-secure");
15179
+ var import_ts_dedent32 = require("ts-dedent");
14518
15180
  var DidRunNodeImpl = class extends NodeImpl {
14519
15181
  static create() {
14520
15182
  return {
14521
15183
  type: "didRun",
14522
15184
  title: "Did Run",
14523
- id: (0, import_non_secure33.nanoid)(),
15185
+ id: (0, import_non_secure34.nanoid)(),
14524
15186
  data: {},
14525
15187
  visualData: {
14526
15188
  x: 0,
@@ -14552,7 +15214,7 @@ var DidRunNodeImpl = class extends NodeImpl {
14552
15214
  }
14553
15215
  static getUIData() {
14554
15216
  return {
14555
- infoBoxBody: import_ts_dedent31.dedent`
15217
+ infoBoxBody: import_ts_dedent32.dedent`
14556
15218
  Outputs true when all connected inputs have run. Falsy or empty values still count as having run, so this is useful for adapting "did this branch run at all?" into a boolean If port.
14557
15219
  `,
14558
15220
  infoBoxTitle: "Did Run Node",
@@ -14598,14 +15260,14 @@ var DidRunNodeImpl = class extends NodeImpl {
14598
15260
  var didRunNode = nodeDefinition(DidRunNodeImpl, "Did Run");
14599
15261
 
14600
15262
  // src/model/nodes/PassthroughNode.ts
14601
- var import_non_secure34 = require("nanoid/non-secure");
14602
- var import_ts_dedent32 = require("ts-dedent");
15263
+ var import_non_secure35 = require("nanoid/non-secure");
15264
+ var import_ts_dedent33 = require("ts-dedent");
14603
15265
  var PassthroughNodeImpl = class extends NodeImpl {
14604
15266
  static create = () => {
14605
15267
  const chartNode = {
14606
15268
  type: "passthrough",
14607
15269
  title: "Passthrough",
14608
- id: (0, import_non_secure34.nanoid)(),
15270
+ id: (0, import_non_secure35.nanoid)(),
14609
15271
  data: {},
14610
15272
  visualData: {
14611
15273
  x: 0,
@@ -14641,7 +15303,7 @@ var PassthroughNodeImpl = class extends NodeImpl {
14641
15303
  }
14642
15304
  static getUIData() {
14643
15305
  return {
14644
- infoBoxBody: import_ts_dedent32.dedent`
15306
+ infoBoxBody: import_ts_dedent33.dedent`
14645
15307
  Simply passes the input value to the output without any modifications.
14646
15308
  `,
14647
15309
  infoBoxTitle: "Passthrough Node",
@@ -14676,14 +15338,14 @@ var PassthroughNodeImpl = class extends NodeImpl {
14676
15338
  var passthroughNode = nodeDefinition(PassthroughNodeImpl, "Passthrough");
14677
15339
 
14678
15340
  // src/model/nodes/PopNode.ts
14679
- var import_non_secure35 = require("nanoid/non-secure");
14680
- var import_ts_dedent33 = require("ts-dedent");
15341
+ var import_non_secure36 = require("nanoid/non-secure");
15342
+ var import_ts_dedent34 = require("ts-dedent");
14681
15343
  var PopNodeImpl = class extends NodeImpl {
14682
15344
  static create() {
14683
15345
  const baseNode = {
14684
15346
  type: "pop",
14685
15347
  title: "Pop",
14686
- id: (0, import_non_secure35.nanoid)(),
15348
+ id: (0, import_non_secure36.nanoid)(),
14687
15349
  visualData: {
14688
15350
  x: 0,
14689
15351
  y: 0,
@@ -14728,7 +15390,7 @@ var PopNodeImpl = class extends NodeImpl {
14728
15390
  }
14729
15391
  static getUIData() {
14730
15392
  return {
14731
- infoBoxBody: import_ts_dedent33.dedent`
15393
+ infoBoxBody: import_ts_dedent34.dedent`
14732
15394
  Pops the last value off the input array and outputs the new array and the popped value.
14733
15395
 
14734
15396
  Can also be used to just extract the last value from an array.
@@ -14764,14 +15426,14 @@ var PopNodeImpl = class extends NodeImpl {
14764
15426
  var popNode = nodeDefinition(PopNodeImpl, "Pop");
14765
15427
 
14766
15428
  // src/model/nodes/SetGlobalNode.ts
14767
- var import_non_secure36 = require("nanoid/non-secure");
14768
- var import_ts_dedent34 = require("ts-dedent");
15429
+ var import_non_secure37 = require("nanoid/non-secure");
15430
+ var import_ts_dedent35 = require("ts-dedent");
14769
15431
  var SetGlobalNodeImpl = class extends NodeImpl {
14770
15432
  static create() {
14771
15433
  const chartNode = {
14772
15434
  type: "setGlobal",
14773
15435
  title: "Set Global",
14774
- id: (0, import_non_secure36.nanoid)(),
15436
+ id: (0, import_non_secure37.nanoid)(),
14775
15437
  visualData: {
14776
15438
  x: 0,
14777
15439
  y: 0,
@@ -14838,14 +15500,14 @@ var SetGlobalNodeImpl = class extends NodeImpl {
14838
15500
  ];
14839
15501
  }
14840
15502
  getBody() {
14841
- return import_ts_dedent34.dedent`
15503
+ return import_ts_dedent35.dedent`
14842
15504
  ${this.data.id}
14843
15505
  Type: ${this.data.dataType}
14844
15506
  `;
14845
15507
  }
14846
15508
  static getUIData() {
14847
15509
  return {
14848
- infoBoxBody: import_ts_dedent34.dedent`
15510
+ infoBoxBody: import_ts_dedent35.dedent`
14849
15511
  Sets a global value that is shared across all graphs and subgraphs. The id of the global value and the value itself are configured in this node.
14850
15512
  `,
14851
15513
  infoBoxTitle: "Set Global Node",
@@ -14880,14 +15542,14 @@ var SetGlobalNodeImpl = class extends NodeImpl {
14880
15542
  var setGlobalNode = nodeDefinition(SetGlobalNodeImpl, "Set Global");
14881
15543
 
14882
15544
  // src/model/nodes/GetGlobalNode.ts
14883
- var import_non_secure37 = require("nanoid/non-secure");
14884
- var import_ts_dedent35 = require("ts-dedent");
15545
+ var import_non_secure38 = require("nanoid/non-secure");
15546
+ var import_ts_dedent36 = require("ts-dedent");
14885
15547
  var GetGlobalNodeImpl = class extends NodeImpl {
14886
15548
  static create() {
14887
15549
  const chartNode = {
14888
15550
  type: "getGlobal",
14889
15551
  title: "Get Global",
14890
- id: (0, import_non_secure37.nanoid)(),
15552
+ id: (0, import_non_secure38.nanoid)(),
14891
15553
  visualData: {
14892
15554
  x: 0,
14893
15555
  y: 0,
@@ -14956,7 +15618,7 @@ var GetGlobalNodeImpl = class extends NodeImpl {
14956
15618
  ];
14957
15619
  }
14958
15620
  getBody() {
14959
- return import_ts_dedent35.dedent`
15621
+ return import_ts_dedent36.dedent`
14960
15622
  ${this.data.useIdInput ? "(ID from input)" : this.data.id}
14961
15623
  Type: ${this.data.dataType}
14962
15624
  ${this.data.wait ? "Waits for available data" : ""}
@@ -14964,7 +15626,7 @@ var GetGlobalNodeImpl = class extends NodeImpl {
14964
15626
  }
14965
15627
  static getUIData() {
14966
15628
  return {
14967
- infoBoxBody: import_ts_dedent35.dedent`
15629
+ infoBoxBody: import_ts_dedent36.dedent`
14968
15630
  Retrieves a global value that is shared across all graphs and subgraphs. The id of the global value is configured in this node.
14969
15631
  `,
14970
15632
  infoBoxTitle: "Get Global Node",
@@ -15011,12 +15673,12 @@ var GetGlobalNodeImpl = class extends NodeImpl {
15011
15673
  var getGlobalNode = nodeDefinition(GetGlobalNodeImpl, "Get Global");
15012
15674
 
15013
15675
  // src/model/nodes/WaitForEventNode.ts
15014
- var import_non_secure38 = require("nanoid/non-secure");
15015
- var import_ts_dedent36 = require("ts-dedent");
15676
+ var import_non_secure39 = require("nanoid/non-secure");
15677
+ var import_ts_dedent37 = require("ts-dedent");
15016
15678
  var WaitForEventNodeImpl = class extends NodeImpl {
15017
15679
  static create() {
15018
15680
  return {
15019
- id: (0, import_non_secure38.nanoid)(),
15681
+ id: (0, import_non_secure39.nanoid)(),
15020
15682
  type: "waitForEvent",
15021
15683
  title: "Wait For Event",
15022
15684
  visualData: { x: 0, y: 0, width: 150 },
@@ -15071,7 +15733,7 @@ var WaitForEventNodeImpl = class extends NodeImpl {
15071
15733
  }
15072
15734
  static getUIData() {
15073
15735
  return {
15074
- infoBoxBody: import_ts_dedent36.dedent`
15736
+ infoBoxBody: import_ts_dedent37.dedent`
15075
15737
  Waits for a specific event to be raised by a 'Raise Event' node or the host project. The event name can be configured.
15076
15738
  `,
15077
15739
  infoBoxTitle: "Wait For Event Node",
@@ -15091,14 +15753,14 @@ var WaitForEventNodeImpl = class extends NodeImpl {
15091
15753
  var waitForEventNode = nodeDefinition(WaitForEventNodeImpl, "Wait For Event");
15092
15754
 
15093
15755
  // src/model/nodes/ToolNode.ts
15094
- var import_non_secure39 = require("nanoid/non-secure");
15095
- var import_ts_dedent37 = require("ts-dedent");
15756
+ var import_non_secure40 = require("nanoid/non-secure");
15757
+ var import_ts_dedent38 = require("ts-dedent");
15096
15758
  var GptFunctionNodeImpl = class extends NodeImpl {
15097
15759
  static create() {
15098
15760
  const chartNode = {
15099
15761
  type: "gptFunction",
15100
15762
  title: "Tool",
15101
- id: (0, import_non_secure39.nanoid)(),
15763
+ id: (0, import_non_secure40.nanoid)(),
15102
15764
  visualData: {
15103
15765
  x: 0,
15104
15766
  y: 0,
@@ -15107,7 +15769,7 @@ var GptFunctionNodeImpl = class extends NodeImpl {
15107
15769
  data: {
15108
15770
  name: "newTool",
15109
15771
  description: "No description provided",
15110
- schema: import_ts_dedent37.dedent`
15772
+ schema: import_ts_dedent38.dedent`
15111
15773
  {
15112
15774
  "type": "object",
15113
15775
  "properties": {}
@@ -15193,6 +15855,7 @@ var GptFunctionNodeImpl = class extends NodeImpl {
15193
15855
  label: "Schema",
15194
15856
  dataKey: "schema",
15195
15857
  language: "json",
15858
+ interpolationSyntax: "json-template",
15196
15859
  useInputToggleDataKey: "useSchemaInput",
15197
15860
  enableFolding: true
15198
15861
  },
@@ -15213,7 +15876,7 @@ ${this.data.description}`
15213
15876
  }
15214
15877
  static getUIData() {
15215
15878
  return {
15216
- infoBoxBody: import_ts_dedent37.dedent`
15879
+ infoBoxBody: import_ts_dedent38.dedent`
15217
15880
  Defines a tool, which is a method that the LLM can call in its responses.
15218
15881
  `,
15219
15882
  infoBoxTitle: "Tool Node",
@@ -15256,15 +15919,15 @@ ${this.data.description}`
15256
15919
  var gptFunctionNode = nodeDefinition(GptFunctionNodeImpl, "Tool");
15257
15920
 
15258
15921
  // src/model/nodes/ToYamlNode.ts
15259
- var import_non_secure40 = require("nanoid/non-secure");
15922
+ var import_non_secure41 = require("nanoid/non-secure");
15260
15923
  var import_yaml2 = __toESM(require("yaml"), 1);
15261
- var import_ts_dedent38 = require("ts-dedent");
15924
+ var import_ts_dedent39 = require("ts-dedent");
15262
15925
  var ToYamlNodeImpl = class extends NodeImpl {
15263
15926
  static create() {
15264
15927
  const chartNode = {
15265
15928
  type: "toYaml",
15266
15929
  title: "To YAML",
15267
- id: (0, import_non_secure40.nanoid)(),
15930
+ id: (0, import_non_secure41.nanoid)(),
15268
15931
  visualData: {
15269
15932
  x: 0,
15270
15933
  y: 0,
@@ -15295,7 +15958,7 @@ var ToYamlNodeImpl = class extends NodeImpl {
15295
15958
  }
15296
15959
  static getUIData() {
15297
15960
  return {
15298
- infoBoxBody: import_ts_dedent38.dedent`
15961
+ infoBoxBody: import_ts_dedent39.dedent`
15299
15962
  Turns the input object into YAML text.
15300
15963
  `,
15301
15964
  infoBoxTitle: "To YAML Node",
@@ -15320,8 +15983,8 @@ var ToYamlNodeImpl = class extends NodeImpl {
15320
15983
  var toYamlNode = nodeDefinition(ToYamlNodeImpl, "To YAML");
15321
15984
 
15322
15985
  // src/model/nodes/GetEmbeddingNode.ts
15323
- var import_non_secure41 = require("nanoid/non-secure");
15324
- var import_ts_dedent39 = require("ts-dedent");
15986
+ var import_non_secure42 = require("nanoid/non-secure");
15987
+ var import_ts_dedent40 = require("ts-dedent");
15325
15988
 
15326
15989
  // src/integrations/integrations.ts
15327
15990
  var registeredIntegrations = {
@@ -15344,7 +16007,7 @@ function getIntegration(type, integrationKey, context) {
15344
16007
  var GetEmbeddingNodeImpl = class extends NodeImpl {
15345
16008
  static create() {
15346
16009
  return {
15347
- id: (0, import_non_secure41.nanoid)(),
16010
+ id: (0, import_non_secure42.nanoid)(),
15348
16011
  type: "getEmbedding",
15349
16012
  title: "Get Embedding",
15350
16013
  visualData: { x: 0, y: 0, width: 250 },
@@ -15428,7 +16091,7 @@ var GetEmbeddingNodeImpl = class extends NodeImpl {
15428
16091
  }
15429
16092
  static getUIData() {
15430
16093
  return {
15431
- infoBoxBody: import_ts_dedent39.dedent`
16094
+ infoBoxBody: import_ts_dedent40.dedent`
15432
16095
  Gets a OpenAI vector embedding for the input text provided.
15433
16096
 
15434
16097
  Can be used with the Vector Store and Vector KNN nodes.
@@ -15459,12 +16122,12 @@ var GetEmbeddingNodeImpl = class extends NodeImpl {
15459
16122
  var getEmbeddingNode = nodeDefinition(GetEmbeddingNodeImpl, "Get Embedding");
15460
16123
 
15461
16124
  // src/model/nodes/VectorStoreNode.ts
15462
- var import_non_secure42 = require("nanoid/non-secure");
15463
- var import_ts_dedent40 = require("ts-dedent");
16125
+ var import_non_secure43 = require("nanoid/non-secure");
16126
+ var import_ts_dedent41 = require("ts-dedent");
15464
16127
  var VectorStoreNodeImpl = class extends NodeImpl {
15465
16128
  static create() {
15466
16129
  return {
15467
- id: (0, import_non_secure42.nanoid)(),
16130
+ id: (0, import_non_secure43.nanoid)(),
15468
16131
  type: "vectorStore",
15469
16132
  title: "Vector Store",
15470
16133
  visualData: { x: 0, y: 0, width: 200 },
@@ -15540,14 +16203,14 @@ var VectorStoreNodeImpl = class extends NodeImpl {
15540
16203
  ];
15541
16204
  }
15542
16205
  getBody() {
15543
- return import_ts_dedent40.dedent`
16206
+ return import_ts_dedent41.dedent`
15544
16207
  Integration: ${this.data.useIntegrationInput ? "(using input)" : this.data.integration}
15545
16208
  Collection Id: ${this.data.useCollectionIdInput ? "(using input)" : this.data.collectionId}
15546
16209
  `;
15547
16210
  }
15548
16211
  static getUIData() {
15549
16212
  return {
15550
- infoBoxBody: import_ts_dedent40.dedent`
16213
+ infoBoxBody: import_ts_dedent41.dedent`
15551
16214
  Takes in a vector, as well as data to store with the vector. This data is stored in the configured vector DB integration for later retrieval.
15552
16215
  `,
15553
16216
  infoBoxTitle: "Vector Store Node",
@@ -15582,12 +16245,12 @@ var VectorStoreNodeImpl = class extends NodeImpl {
15582
16245
  var vectorStoreNode = nodeDefinition(VectorStoreNodeImpl, "Vector Store");
15583
16246
 
15584
16247
  // src/model/nodes/VectorNearestNeighborsNode.ts
15585
- var import_non_secure43 = require("nanoid/non-secure");
15586
- var import_ts_dedent41 = require("ts-dedent");
16248
+ var import_non_secure44 = require("nanoid/non-secure");
16249
+ var import_ts_dedent42 = require("ts-dedent");
15587
16250
  var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
15588
16251
  static create() {
15589
16252
  return {
15590
- id: (0, import_non_secure43.nanoid)(),
16253
+ id: (0, import_non_secure44.nanoid)(),
15591
16254
  type: "vectorNearestNeighbors",
15592
16255
  title: "Vector KNN",
15593
16256
  visualData: { x: 0, y: 0, width: 200 },
@@ -15670,7 +16333,7 @@ var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
15670
16333
  ];
15671
16334
  }
15672
16335
  getBody() {
15673
- return import_ts_dedent41.dedent`
16336
+ return import_ts_dedent42.dedent`
15674
16337
  Integration: ${this.data.useIntegrationInput ? "(using input)" : this.data.integration}
15675
16338
  K: ${this.data.useKInput ? "(using input)" : this.data.k}
15676
16339
  Collection Id: ${this.data.useCollectionIdInput ? "(using input)" : this.data.collectionId}
@@ -15678,7 +16341,7 @@ var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
15678
16341
  }
15679
16342
  static getUIData() {
15680
16343
  return {
15681
- infoBoxBody: import_ts_dedent41.dedent`
16344
+ infoBoxBody: import_ts_dedent42.dedent`
15682
16345
  Performs a k-nearest neighbors search on the vectors stored in the configured vector DB integration. Takes in a vector and returns the k closest vectors and their corresponding data.
15683
16346
  `,
15684
16347
  infoBoxTitle: "Vector KNN Node",
@@ -15708,17 +16371,17 @@ var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
15708
16371
  var vectorNearestNeighborsNode = nodeDefinition(VectorNearestNeighborsNodeImpl, "Vector KNN");
15709
16372
 
15710
16373
  // src/model/nodes/HashNode.ts
15711
- var import_non_secure44 = require("nanoid/non-secure");
16374
+ var import_non_secure45 = require("nanoid/non-secure");
15712
16375
  var crypto = __toESM(require("crypto-js"), 1);
15713
16376
  var import_ts_pattern4 = require("ts-pattern");
15714
- var import_ts_dedent42 = require("ts-dedent");
16377
+ var import_ts_dedent43 = require("ts-dedent");
15715
16378
  var { SHA256, SHA512, MD5, SHA1 } = crypto;
15716
16379
  var HashNodeImpl = class extends NodeImpl {
15717
16380
  static create() {
15718
16381
  const chartNode = {
15719
16382
  type: "hash",
15720
16383
  title: "Hash",
15721
- id: (0, import_non_secure44.nanoid)(),
16384
+ id: (0, import_non_secure45.nanoid)(),
15722
16385
  visualData: {
15723
16386
  x: 0,
15724
16387
  y: 0,
@@ -15769,7 +16432,7 @@ var HashNodeImpl = class extends NodeImpl {
15769
16432
  }
15770
16433
  static getUIData() {
15771
16434
  return {
15772
- infoBoxBody: import_ts_dedent42.dedent`
16435
+ infoBoxBody: import_ts_dedent43.dedent`
15773
16436
  Computes a hash of the input value using the configured hash function.
15774
16437
  `,
15775
16438
  infoBoxTitle: "Hash Node",
@@ -15797,14 +16460,14 @@ var algorithmDisplayName = {
15797
16460
  var hashNode = nodeDefinition(HashNodeImpl, "Hash");
15798
16461
 
15799
16462
  // src/model/nodes/AbortGraphNode.ts
15800
- var import_non_secure45 = require("nanoid/non-secure");
15801
- var import_ts_dedent43 = require("ts-dedent");
16463
+ var import_non_secure46 = require("nanoid/non-secure");
16464
+ var import_ts_dedent44 = require("ts-dedent");
15802
16465
  var AbortGraphNodeImpl = class extends NodeImpl {
15803
16466
  static create() {
15804
16467
  const chartNode = {
15805
16468
  type: "abortGraph",
15806
16469
  title: "Abort Graph",
15807
- id: (0, import_non_secure45.nanoid)(),
16470
+ id: (0, import_non_secure46.nanoid)(),
15808
16471
  visualData: {
15809
16472
  x: 0,
15810
16473
  y: 0,
@@ -15855,13 +16518,13 @@ var AbortGraphNodeImpl = class extends NodeImpl {
15855
16518
  ];
15856
16519
  }
15857
16520
  getBody() {
15858
- return import_ts_dedent43.dedent`
16521
+ return import_ts_dedent44.dedent`
15859
16522
  ${this.data.useSuccessfullyInput ? "Success depends on input" : this.data.successfully ? "Successfully Abort" : this.data.errorMessage ? `Error Abort: ${this.data.errorMessage}` : "Error Abort"}
15860
16523
  `;
15861
16524
  }
15862
16525
  static getUIData() {
15863
16526
  return {
15864
- infoBoxBody: import_ts_dedent43.dedent`
16527
+ infoBoxBody: import_ts_dedent44.dedent`
15865
16528
  Aborts the execution of the entire graph immediately.
15866
16529
 
15867
16530
  Can either "successfully" abort the graph (early-exit), or "error" abort the graph.
@@ -15886,14 +16549,14 @@ var AbortGraphNodeImpl = class extends NodeImpl {
15886
16549
  var abortGraphNode = nodeDefinition(AbortGraphNodeImpl, "Abort Graph");
15887
16550
 
15888
16551
  // src/model/nodes/RaceInputsNode.ts
15889
- var import_non_secure46 = require("nanoid/non-secure");
15890
- var import_ts_dedent44 = require("ts-dedent");
16552
+ var import_non_secure47 = require("nanoid/non-secure");
16553
+ var import_ts_dedent45 = require("ts-dedent");
15891
16554
  var RaceInputsNodeImpl = class extends NodeImpl {
15892
16555
  static create() {
15893
16556
  const chartNode = {
15894
16557
  type: "raceInputs",
15895
16558
  title: "Race Inputs",
15896
- id: (0, import_non_secure46.nanoid)(),
16559
+ id: (0, import_non_secure47.nanoid)(),
15897
16560
  visualData: {
15898
16561
  x: 0,
15899
16562
  y: 0,
@@ -15943,7 +16606,7 @@ var RaceInputsNodeImpl = class extends NodeImpl {
15943
16606
  }
15944
16607
  static getUIData() {
15945
16608
  return {
15946
- infoBoxBody: import_ts_dedent44.dedent`
16609
+ infoBoxBody: import_ts_dedent45.dedent`
15947
16610
  Takes in multiple inputs and outputs the value of the first one to finish. The other inputs are cancelled.
15948
16611
  `,
15949
16612
  infoBoxTitle: "Race Inputs Node",
@@ -15971,14 +16634,14 @@ var RaceInputsNodeImpl = class extends NodeImpl {
15971
16634
  var raceInputsNode = nodeDefinition(RaceInputsNodeImpl, "Race Inputs");
15972
16635
 
15973
16636
  // src/model/nodes/ToJsonNode.ts
15974
- var import_non_secure47 = require("nanoid/non-secure");
15975
- var import_ts_dedent45 = require("ts-dedent");
16637
+ var import_non_secure48 = require("nanoid/non-secure");
16638
+ var import_ts_dedent46 = require("ts-dedent");
15976
16639
  var ToJsonNodeImpl = class extends NodeImpl {
15977
16640
  static create() {
15978
16641
  const chartNode = {
15979
16642
  type: "toJson",
15980
16643
  title: "To JSON",
15981
- id: (0, import_non_secure47.nanoid)(),
16644
+ id: (0, import_non_secure48.nanoid)(),
15982
16645
  visualData: {
15983
16646
  x: 0,
15984
16647
  y: 0,
@@ -16023,7 +16686,7 @@ var ToJsonNodeImpl = class extends NodeImpl {
16023
16686
  }
16024
16687
  static getUIData() {
16025
16688
  return {
16026
- infoBoxBody: import_ts_dedent45.dedent`
16689
+ infoBoxBody: import_ts_dedent46.dedent`
16027
16690
  Turns the input value into its JSON equivalent (stringifies the value).
16028
16691
  `,
16029
16692
  infoBoxTitle: "To JSON Node",
@@ -16045,14 +16708,14 @@ var ToJsonNodeImpl = class extends NodeImpl {
16045
16708
  var toJsonNode = nodeDefinition(ToJsonNodeImpl, "To JSON");
16046
16709
 
16047
16710
  // src/model/nodes/JoinNode.ts
16048
- var import_non_secure48 = require("nanoid/non-secure");
16049
- var import_ts_dedent46 = require("ts-dedent");
16711
+ var import_non_secure49 = require("nanoid/non-secure");
16712
+ var import_ts_dedent47 = require("ts-dedent");
16050
16713
  var JoinNodeImpl = class extends NodeImpl {
16051
16714
  static create = () => {
16052
16715
  const chartNode = {
16053
16716
  type: "join",
16054
16717
  title: "Join",
16055
- id: (0, import_non_secure48.nanoid)(),
16718
+ id: (0, import_non_secure49.nanoid)(),
16056
16719
  data: {
16057
16720
  flatten: true,
16058
16721
  joinString: "\n"
@@ -16128,7 +16791,7 @@ var JoinNodeImpl = class extends NodeImpl {
16128
16791
  }
16129
16792
  static getUIData() {
16130
16793
  return {
16131
- infoBoxBody: import_ts_dedent46.dedent`
16794
+ infoBoxBody: import_ts_dedent47.dedent`
16132
16795
  Takes an array of strings, and joins them using the configured delimiter.
16133
16796
 
16134
16797
  Defaults to a newline.
@@ -16165,15 +16828,15 @@ var JoinNodeImpl = class extends NodeImpl {
16165
16828
  var joinNode = nodeDefinition(JoinNodeImpl, "Coalesce");
16166
16829
 
16167
16830
  // src/model/nodes/FilterNode.ts
16168
- var import_non_secure49 = require("nanoid/non-secure");
16169
- var import_lodash_es12 = require("lodash");
16170
- var import_ts_dedent47 = require("ts-dedent");
16831
+ var import_non_secure50 = require("nanoid/non-secure");
16832
+ var import_lodash_es11 = require("lodash");
16833
+ var import_ts_dedent48 = require("ts-dedent");
16171
16834
  var FilterNodeImpl = class extends NodeImpl {
16172
16835
  static create() {
16173
16836
  const chartNode = {
16174
16837
  type: "filter",
16175
16838
  title: "Filter",
16176
- id: (0, import_non_secure49.nanoid)(),
16839
+ id: (0, import_non_secure50.nanoid)(),
16177
16840
  visualData: {
16178
16841
  x: 0,
16179
16842
  y: 0,
@@ -16210,7 +16873,7 @@ var FilterNodeImpl = class extends NodeImpl {
16210
16873
  }
16211
16874
  static getUIData() {
16212
16875
  return {
16213
- infoBoxBody: import_ts_dedent47.dedent`
16876
+ infoBoxBody: import_ts_dedent48.dedent`
16214
16877
  Takes in both an array of values, and an array of booleans of the same length, and filters the array where the corresponding boolean is true.
16215
16878
  `,
16216
16879
  infoBoxTitle: "Filter Node",
@@ -16222,7 +16885,7 @@ var FilterNodeImpl = class extends NodeImpl {
16222
16885
  var _a;
16223
16886
  const array = coerceType(inputs["array"], "any[]");
16224
16887
  const include = coerceType(inputs["include"], "boolean[]");
16225
- const zipped = (0, import_lodash_es12.zip)(array, include);
16888
+ const zipped = (0, import_lodash_es11.zip)(array, include);
16226
16889
  const filtered = zipped.filter(([_, include2]) => include2).map(([value, _]) => value);
16227
16890
  return {
16228
16891
  ["filtered"]: {
@@ -16235,11 +16898,11 @@ var FilterNodeImpl = class extends NodeImpl {
16235
16898
  var filterNode = nodeDefinition(FilterNodeImpl, "Filter");
16236
16899
 
16237
16900
  // src/model/nodes/JSFilterNode.ts
16238
- var import_non_secure50 = require("nanoid/non-secure");
16239
- var import_ts_dedent49 = require("ts-dedent");
16901
+ var import_non_secure51 = require("nanoid/non-secure");
16902
+ var import_ts_dedent50 = require("ts-dedent");
16240
16903
 
16241
16904
  // src/model/nodes/jsListCallbackHelpers.ts
16242
- var import_ts_dedent48 = require("ts-dedent");
16905
+ var import_ts_dedent49 = require("ts-dedent");
16243
16906
  var MAX_CALLBACK_PREVIEW_BODY_LINES = 13;
16244
16907
  var JS_LIST_CALLBACK_SIGNATURE = "(item, index, array)";
16245
16908
  var JS_LIST_CALLBACK_LOCAL_NAMES = /* @__PURE__ */ new Set(["item", "index", "array"]);
@@ -16260,44 +16923,42 @@ function assertSynchronousCallbackResult(result, nodeName) {
16260
16923
  throw new Error(`${nodeName} callbacks must be synchronous.`);
16261
16924
  }
16262
16925
  }
16263
- function getJSListCallbackInterpolationInputNames(callbackBody) {
16264
- return getJsValueInterpolationInputNames(callbackBody, {
16926
+ function getJSListInterpolationContext(callbackBody) {
16927
+ return getJsValueInterpolationRuntimeContext(callbackBody, JS_LIST_INPUTS_IDENTIFIER, {
16265
16928
  localIdentifiers: JS_LIST_CALLBACK_LOCAL_NAMES
16266
16929
  });
16267
16930
  }
16268
- function buildJSListRuntimePreamble(callbackBody) {
16269
- const inputNames = getJSListCallbackInterpolationInputNames(callbackBody);
16270
- return import_ts_dedent48.dedent`
16931
+ function buildJSListRuntimePreamble(interpolationContext) {
16932
+ return import_ts_dedent49.dedent`
16271
16933
  const assertSynchronousCallbackResult = ${assertSynchronousCallbackResult.toString()};
16272
- ${buildCloneJsInputValueFunction()}
16273
- const ${JS_LIST_INPUTS_IDENTIFIER} = Object.create(null);
16274
- const ${JS_LIST_INPUT_CLONE_CACHE_IDENTIFIER} = new WeakMap();
16934
+ ${buildJsValueInputClonePreamble({
16935
+ cacheIdentifier: JS_LIST_INPUT_CLONE_CACHE_IDENTIFIER,
16936
+ inputsIdentifier: interpolationContext.inputsIdentifier
16937
+ })}
16275
16938
  const array = cloneJsInputValue(inputs.array?.value, ${JS_LIST_INPUT_CLONE_CACHE_IDENTIFIER});
16276
- ${buildClonedInputValueAssignments(inputNames, JS_LIST_INPUTS_IDENTIFIER, JS_LIST_INPUT_CLONE_CACHE_IDENTIFIER)}
16939
+ ${buildClonedInputValueAssignments(
16940
+ interpolationContext.inputNames,
16941
+ interpolationContext.inputsIdentifier,
16942
+ JS_LIST_INPUT_CLONE_CACHE_IDENTIFIER
16943
+ )}
16277
16944
  `;
16278
16945
  }
16279
- function buildJSListCallbackRuntimeSource(callbackBody) {
16280
- return buildJsValueInterpolatedSource(callbackBody, JS_LIST_INPUTS_IDENTIFIER, {
16946
+ function buildJSListCallbackRuntimeSource(callbackBody, inputsIdentifier) {
16947
+ return buildJsValueInterpolatedSource(callbackBody, inputsIdentifier, {
16281
16948
  localIdentifiers: JS_LIST_CALLBACK_LOCAL_NAMES
16282
16949
  });
16283
16950
  }
16284
16951
  function sanitizeJSListError(error, callbackBody, nodeName) {
16285
- const jsListError = getError(error);
16286
- const inputNames = getJSListCallbackInterpolationInputNames(callbackBody);
16952
+ const { inputNames, inputsIdentifier } = getJSListInterpolationContext(callbackBody);
16287
16953
  const fallbackLabel = `${nodeName} input`;
16288
- jsListError.message = sanitizeGeneratedJsValueText(jsListError.message, inputNames, JS_LIST_INPUTS_IDENTIFIER, fallbackLabel) ?? jsListError.message;
16289
- jsListError.stack = sanitizeGeneratedJsValueText(
16290
- jsListError.stack,
16291
- inputNames,
16292
- JS_LIST_INPUTS_IDENTIFIER,
16293
- fallbackLabel
16294
- );
16295
- return jsListError;
16954
+ return sanitizeGeneratedJsValueError(error, inputNames, inputsIdentifier, fallbackLabel);
16296
16955
  }
16297
16956
  function buildJSFilterWrapper(callbackBody) {
16298
- const callbackBodySource = buildJSListCallbackRuntimeSource(callbackBody);
16299
- return import_ts_dedent48.dedent`
16300
- ${buildJSListRuntimePreamble(callbackBody)}
16957
+ const interpolationContext = getJSListInterpolationContext(callbackBody);
16958
+ const { inputsIdentifier } = interpolationContext;
16959
+ const callbackBodySource = buildJSListCallbackRuntimeSource(callbackBody, inputsIdentifier);
16960
+ return import_ts_dedent49.dedent`
16961
+ ${buildJSListRuntimePreamble(interpolationContext)}
16301
16962
 
16302
16963
  if (!Array.isArray(array)) {
16303
16964
  throw new Error('JS Filter input "array" must be an array.');
@@ -16330,9 +16991,11 @@ function buildJSFilterWrapper(callbackBody) {
16330
16991
  `;
16331
16992
  }
16332
16993
  function buildJSMapWrapper(callbackBody) {
16333
- const callbackBodySource = buildJSListCallbackRuntimeSource(callbackBody);
16334
- return import_ts_dedent48.dedent`
16335
- ${buildJSListRuntimePreamble(callbackBody)}
16994
+ const interpolationContext = getJSListInterpolationContext(callbackBody);
16995
+ const { inputsIdentifier } = interpolationContext;
16996
+ const callbackBodySource = buildJSListCallbackRuntimeSource(callbackBody, inputsIdentifier);
16997
+ return import_ts_dedent49.dedent`
16998
+ ${buildJSListRuntimePreamble(interpolationContext)}
16336
16999
 
16337
17000
  if (!Array.isArray(array)) {
16338
17001
  throw new Error('JS Map input "array" must be an array.');
@@ -16362,13 +17025,9 @@ function buildJSMapWrapper(callbackBody) {
16362
17025
  `;
16363
17026
  }
16364
17027
  function getJSListCallbackInterpolationInputDefinitions(callbackBody) {
16365
- return getJSListCallbackInterpolationInputNames(callbackBody).map(
16366
- (inputName) => createInterpolationInputDefinition({
16367
- interpolationName: inputName,
16368
- dataType: "any",
16369
- required: false
16370
- })
16371
- );
17028
+ return getJsValueInterpolationInputDefinitions(callbackBody, {
17029
+ localIdentifiers: JS_LIST_CALLBACK_LOCAL_NAMES
17030
+ });
16372
17031
  }
16373
17032
  function getJSListInputDefinitions(callbackBody) {
16374
17033
  return [
@@ -16390,6 +17049,7 @@ function getJSListEditors() {
16390
17049
  postEditorHelperMessage: "};\n\n//Use {{var}} to create input ports that evaluate as connected values.",
16391
17050
  dataKey: "callbackBody",
16392
17051
  language: "javascript",
17052
+ interpolationSyntax: "js-value",
16393
17053
  enableFolding: true
16394
17054
  }
16395
17055
  ];
@@ -16400,10 +17060,10 @@ function interpolateJSListCallbackBody(callbackBody, inputs) {
16400
17060
  });
16401
17061
  }
16402
17062
  function getJSListNodeBody(callbackBody) {
16403
- const previewBody = callbackBody.split("\n").slice(0, MAX_CALLBACK_PREVIEW_BODY_LINES).join("\n").trim();
17063
+ const previewBody = buildJsValuePreview(callbackBody, MAX_CALLBACK_PREVIEW_BODY_LINES);
16404
17064
  return {
16405
17065
  type: "colorized",
16406
- text: import_ts_dedent48.dedent`
17066
+ text: import_ts_dedent49.dedent`
16407
17067
  ${JS_LIST_CALLBACK_SIGNATURE} => {
16408
17068
  ${indentLines(previewBody, " ")}
16409
17069
  }
@@ -16451,7 +17111,7 @@ var JSFilterNodeImpl = class extends NodeImpl {
16451
17111
  const chartNode = {
16452
17112
  type: "jsFilter",
16453
17113
  title: "JS Filter",
16454
- id: (0, import_non_secure50.nanoid)(),
17114
+ id: (0, import_non_secure51.nanoid)(),
16455
17115
  visualData: {
16456
17116
  x: 0,
16457
17117
  y: 0,
@@ -16483,7 +17143,7 @@ var JSFilterNodeImpl = class extends NodeImpl {
16483
17143
  }
16484
17144
  static getUIData() {
16485
17145
  return {
16486
- infoBoxBody: import_ts_dedent49.dedent`
17146
+ infoBoxBody: import_ts_dedent50.dedent`
16487
17147
  Filters an input array using the body of a JavaScript callback.
16488
17148
 
16489
17149
  Available callback parameters are <code>item</code>, <code>index</code>, and <code>array</code>.
@@ -16509,15 +17169,15 @@ var JSFilterNodeImpl = class extends NodeImpl {
16509
17169
  var jsFilterNode = nodeDefinition(JSFilterNodeImpl, "JS Filter");
16510
17170
 
16511
17171
  // src/model/nodes/JSMapNode.ts
16512
- var import_non_secure51 = require("nanoid/non-secure");
16513
- var import_ts_dedent50 = require("ts-dedent");
17172
+ var import_non_secure52 = require("nanoid/non-secure");
17173
+ var import_ts_dedent51 = require("ts-dedent");
16514
17174
  var DEFAULT_CALLBACK_BODY2 = "return item;";
16515
17175
  var JSMapNodeImpl = class extends NodeImpl {
16516
17176
  static create() {
16517
17177
  const chartNode = {
16518
17178
  type: "jsMap",
16519
17179
  title: "JS Map",
16520
- id: (0, import_non_secure51.nanoid)(),
17180
+ id: (0, import_non_secure52.nanoid)(),
16521
17181
  visualData: {
16522
17182
  x: 0,
16523
17183
  y: 0,
@@ -16549,7 +17209,7 @@ var JSMapNodeImpl = class extends NodeImpl {
16549
17209
  }
16550
17210
  static getUIData() {
16551
17211
  return {
16552
- infoBoxBody: import_ts_dedent50.dedent`
17212
+ infoBoxBody: import_ts_dedent51.dedent`
16553
17213
  Maps an input array using the body of a JavaScript callback.
16554
17214
 
16555
17215
  Available callback parameters are <code>item</code>, <code>index</code>, and <code>array</code>.
@@ -16575,8 +17235,8 @@ var JSMapNodeImpl = class extends NodeImpl {
16575
17235
  var jsMapNode = nodeDefinition(JSMapNodeImpl, "JS Map");
16576
17236
 
16577
17237
  // src/model/nodes/ObjectNode.ts
16578
- var import_non_secure52 = require("nanoid/non-secure");
16579
- var import_ts_dedent51 = require("ts-dedent");
17238
+ var import_non_secure53 = require("nanoid/non-secure");
17239
+ var import_ts_dedent52 = require("ts-dedent");
16580
17240
  var DEFAULT_JSON_TEMPLATE = `{
16581
17241
  "key": "{{input}}"
16582
17242
  }`;
@@ -16623,7 +17283,7 @@ var ObjectNodeImpl = class extends NodeImpl {
16623
17283
  const chartNode = {
16624
17284
  type: "object",
16625
17285
  title: "Object",
16626
- id: (0, import_non_secure52.nanoid)(),
17286
+ id: (0, import_non_secure53.nanoid)(),
16627
17287
  visualData: {
16628
17288
  x: 0,
16629
17289
  y: 0,
@@ -16666,6 +17326,7 @@ var ObjectNodeImpl = class extends NodeImpl {
16666
17326
  label: "JSON Template",
16667
17327
  dataKey: "jsonTemplate",
16668
17328
  language: "json",
17329
+ interpolationSyntax: "json-template",
16669
17330
  theme: "prompt-interpolation",
16670
17331
  enableFolding: true
16671
17332
  }
@@ -16673,7 +17334,7 @@ var ObjectNodeImpl = class extends NodeImpl {
16673
17334
  }
16674
17335
  static getUIData() {
16675
17336
  return {
16676
- infoBoxBody: import_ts_dedent51.dedent`
17337
+ infoBoxBody: import_ts_dedent52.dedent`
16677
17338
  Creates an object from input values and a JSON template, escaping the input values and inserting them into the template.
16678
17339
 
16679
17340
  Use double-quotes around the input values to escape them. String values are automatically escaped.
@@ -16760,14 +17421,14 @@ var ObjectNodeImpl = class extends NodeImpl {
16760
17421
  var objectNode = nodeDefinition(ObjectNodeImpl, "Object");
16761
17422
 
16762
17423
  // src/model/nodes/BooleanNode.ts
16763
- var import_non_secure53 = require("nanoid/non-secure");
16764
- var import_ts_dedent52 = require("ts-dedent");
17424
+ var import_non_secure54 = require("nanoid/non-secure");
17425
+ var import_ts_dedent53 = require("ts-dedent");
16765
17426
  var BooleanNodeImpl = class extends NodeImpl {
16766
17427
  static create() {
16767
17428
  const chartNode = {
16768
17429
  type: "boolean",
16769
17430
  title: "Bool",
16770
- id: (0, import_non_secure53.nanoid)(),
17431
+ id: (0, import_non_secure54.nanoid)(),
16771
17432
  visualData: {
16772
17433
  x: 0,
16773
17434
  y: 0,
@@ -16805,7 +17466,7 @@ var BooleanNodeImpl = class extends NodeImpl {
16805
17466
  }
16806
17467
  static getUIData() {
16807
17468
  return {
16808
- infoBoxBody: import_ts_dedent52.dedent`
17469
+ infoBoxBody: import_ts_dedent53.dedent`
16809
17470
  Outputs a boolean constant, or converts an input value into a boolean.
16810
17471
  `,
16811
17472
  infoBoxTitle: "Bool Node",
@@ -16826,16 +17487,16 @@ var BooleanNodeImpl = class extends NodeImpl {
16826
17487
  var booleanNode = nodeDefinition(BooleanNodeImpl, "Boolean");
16827
17488
 
16828
17489
  // src/model/nodes/CompareNode.ts
16829
- var import_non_secure54 = require("nanoid/non-secure");
16830
- var import_lodash_es13 = require("lodash");
17490
+ var import_non_secure55 = require("nanoid/non-secure");
17491
+ var import_lodash_es12 = require("lodash");
16831
17492
  var import_ts_pattern5 = require("ts-pattern");
16832
- var import_ts_dedent53 = require("ts-dedent");
17493
+ var import_ts_dedent54 = require("ts-dedent");
16833
17494
  var CompareNodeImpl = class extends NodeImpl {
16834
17495
  static create() {
16835
17496
  const chartNode = {
16836
17497
  type: "compare",
16837
17498
  title: "Compare",
16838
- id: (0, import_non_secure54.nanoid)(),
17499
+ id: (0, import_non_secure55.nanoid)(),
16839
17500
  visualData: {
16840
17501
  x: 0,
16841
17502
  y: 0,
@@ -16907,7 +17568,7 @@ var CompareNodeImpl = class extends NodeImpl {
16907
17568
  }
16908
17569
  static getUIData() {
16909
17570
  return {
16910
- infoBoxBody: import_ts_dedent53.dedent`
17571
+ infoBoxBody: import_ts_dedent54.dedent`
16911
17572
  Compares two values using the configured operator and outputs the result.
16912
17573
 
16913
17574
  If the data types of the values do not match, then the B value is converted to the type of the A value.
@@ -16940,7 +17601,7 @@ var CompareNodeImpl = class extends NodeImpl {
16940
17601
  return {
16941
17602
  ["output"]: {
16942
17603
  type: "boolean",
16943
- value: (0, import_ts_pattern5.match)(comparisonFunction).with("==", () => (0, import_lodash_es13.isEqual)(value1, value2)).with("!=", () => !(0, import_lodash_es13.isEqual)(value1, value2)).with("<", () => compareValues(value1, value2)["<"]).with(">", () => compareValues(value1, value2)[">"]).with("<=", () => compareValues(value1, value2)["<="]).with(">=", () => compareValues(value1, value2)[">="]).with("and", () => !!(value1 && value2)).with("or", () => !!(value1 || value2)).with("xor", () => !!(value1 ? !value2 : value2)).with("nand", () => !(value1 && value2)).with("nor", () => !(value1 || value2)).with("xnor", () => !(value1 ? !value2 : value2)).exhaustive()
17604
+ value: (0, import_ts_pattern5.match)(comparisonFunction).with("==", () => (0, import_lodash_es12.isEqual)(value1, value2)).with("!=", () => !(0, import_lodash_es12.isEqual)(value1, value2)).with("<", () => compareValues(value1, value2)["<"]).with(">", () => compareValues(value1, value2)[">"]).with("<=", () => compareValues(value1, value2)["<="]).with(">=", () => compareValues(value1, value2)[">="]).with("and", () => !!(value1 && value2)).with("or", () => !!(value1 || value2)).with("xor", () => !!(value1 ? !value2 : value2)).with("nand", () => !(value1 && value2)).with("nor", () => !(value1 || value2)).with("xnor", () => !(value1 ? !value2 : value2)).exhaustive()
16944
17605
  }
16945
17606
  };
16946
17607
  }
@@ -16948,9 +17609,9 @@ var CompareNodeImpl = class extends NodeImpl {
16948
17609
  var compareNode = nodeDefinition(CompareNodeImpl, "Compare");
16949
17610
 
16950
17611
  // src/model/nodes/EvaluateNode.ts
16951
- var import_non_secure55 = require("nanoid/non-secure");
17612
+ var import_non_secure56 = require("nanoid/non-secure");
16952
17613
  var import_ts_pattern6 = require("ts-pattern");
16953
- var import_ts_dedent54 = require("ts-dedent");
17614
+ var import_ts_dedent55 = require("ts-dedent");
16954
17615
  var unaryOperation = ["abs", "negate"];
16955
17616
  var isUnaryOp = (operation) => unaryOperation.includes(operation);
16956
17617
  var EvaluateNodeImpl = class extends NodeImpl {
@@ -16958,7 +17619,7 @@ var EvaluateNodeImpl = class extends NodeImpl {
16958
17619
  const chartNode = {
16959
17620
  type: "evaluate",
16960
17621
  title: "Evaluate",
16961
- id: (0, import_non_secure55.nanoid)(),
17622
+ id: (0, import_non_secure56.nanoid)(),
16962
17623
  visualData: {
16963
17624
  x: 0,
16964
17625
  y: 0,
@@ -17036,7 +17697,7 @@ var EvaluateNodeImpl = class extends NodeImpl {
17036
17697
  }
17037
17698
  static getUIData() {
17038
17699
  return {
17039
- infoBoxBody: import_ts_dedent54.dedent`
17700
+ infoBoxBody: import_ts_dedent55.dedent`
17040
17701
  Evaluates the configured mathematical operation on the input values and outputs the result.
17041
17702
 
17042
17703
  For more complex operations, you should use the \`Code\` node.
@@ -17072,14 +17733,14 @@ var EvaluateNodeImpl = class extends NodeImpl {
17072
17733
  var evaluateNode = nodeDefinition(EvaluateNodeImpl, "Evaluate");
17073
17734
 
17074
17735
  // src/model/nodes/NumberNode.ts
17075
- var import_non_secure56 = require("nanoid/non-secure");
17076
- var import_ts_dedent55 = require("ts-dedent");
17736
+ var import_non_secure57 = require("nanoid/non-secure");
17737
+ var import_ts_dedent56 = require("ts-dedent");
17077
17738
  var NumberNodeImpl = class extends NodeImpl {
17078
17739
  static create() {
17079
17740
  const chartNode = {
17080
17741
  type: "number",
17081
17742
  title: "Number",
17082
- id: (0, import_non_secure56.nanoid)(),
17743
+ id: (0, import_non_secure57.nanoid)(),
17083
17744
  visualData: {
17084
17745
  x: 0,
17085
17746
  y: 0,
@@ -17123,7 +17784,7 @@ var NumberNodeImpl = class extends NodeImpl {
17123
17784
  }
17124
17785
  static getUIData() {
17125
17786
  return {
17126
- infoBoxBody: import_ts_dedent55.dedent`
17787
+ infoBoxBody: import_ts_dedent56.dedent`
17127
17788
  Outputs a number constant, or converts an input value into a number.
17128
17789
 
17129
17790
  Can be configured to round the number to a certain number of decimal places.
@@ -17150,8 +17811,8 @@ var NumberNodeImpl = class extends NodeImpl {
17150
17811
  var numberNode = nodeDefinition(NumberNodeImpl, "Number");
17151
17812
 
17152
17813
  // src/model/nodes/RandomNumberNode.ts
17153
- var import_non_secure57 = require("nanoid/non-secure");
17154
- var import_ts_dedent56 = require("ts-dedent");
17814
+ var import_non_secure58 = require("nanoid/non-secure");
17815
+ var import_ts_dedent57 = require("ts-dedent");
17155
17816
  var randomNumberTypeOptions = [
17156
17817
  { value: false, label: "Float" },
17157
17818
  { value: true, label: "Integer" }
@@ -17161,7 +17822,7 @@ var RandomNumberNodeImpl = class extends NodeImpl {
17161
17822
  const chartNode = {
17162
17823
  type: "randomNumber",
17163
17824
  title: "Random number",
17164
- id: (0, import_non_secure57.nanoid)(),
17825
+ id: (0, import_non_secure58.nanoid)(),
17165
17826
  visualData: {
17166
17827
  x: 0,
17167
17828
  y: 0,
@@ -17219,7 +17880,7 @@ var RandomNumberNodeImpl = class extends NodeImpl {
17219
17880
  ];
17220
17881
  }
17221
17882
  getBody() {
17222
- return import_ts_dedent56.dedent`
17883
+ return import_ts_dedent57.dedent`
17223
17884
  Min: ${this.data.useMinInput ? "(Input)" : this.data.min ?? 0}
17224
17885
  Max: ${this.data.useMaxInput ? "(Input)" : this.data.max ?? 1}
17225
17886
  ${this.data.integers ? "Integers" : "Floats"}
@@ -17228,7 +17889,7 @@ var RandomNumberNodeImpl = class extends NodeImpl {
17228
17889
  }
17229
17890
  static getUIData() {
17230
17891
  return {
17231
- infoBoxBody: import_ts_dedent56.dedent`
17892
+ infoBoxBody: import_ts_dedent57.dedent`
17232
17893
  Outputs a random number between the configured min and max values.
17233
17894
 
17234
17895
  Can be configured to output only integers, and whether the max value is inclusive or exclusive.
@@ -17257,17 +17918,17 @@ var RandomNumberNodeImpl = class extends NodeImpl {
17257
17918
  }
17258
17919
  };
17259
17920
  var randomNumberNode = nodeDefinition(RandomNumberNodeImpl, "Random number");
17260
-
17261
- // src/model/nodes/ShuffleNode.ts
17262
- var import_non_secure58 = require("nanoid/non-secure");
17263
- var import_lodash_es14 = require("lodash");
17264
- var import_ts_dedent57 = require("ts-dedent");
17921
+
17922
+ // src/model/nodes/ShuffleNode.ts
17923
+ var import_non_secure59 = require("nanoid/non-secure");
17924
+ var import_lodash_es13 = require("lodash");
17925
+ var import_ts_dedent58 = require("ts-dedent");
17265
17926
  var ShuffleNodeImpl = class extends NodeImpl {
17266
17927
  static create() {
17267
17928
  const chartNode = {
17268
17929
  type: "shuffle",
17269
17930
  title: "Shuffle",
17270
- id: (0, import_non_secure58.nanoid)(),
17931
+ id: (0, import_non_secure59.nanoid)(),
17271
17932
  visualData: {
17272
17933
  x: 0,
17273
17934
  y: 0,
@@ -17297,7 +17958,7 @@ var ShuffleNodeImpl = class extends NodeImpl {
17297
17958
  }
17298
17959
  static getUIData() {
17299
17960
  return {
17300
- infoBoxBody: import_ts_dedent57.dedent`
17961
+ infoBoxBody: import_ts_dedent58.dedent`
17301
17962
  Shuffles the input array. Outputs the shuffled array.
17302
17963
  `,
17303
17964
  infoBoxTitle: "Shuffle Node",
@@ -17309,7 +17970,7 @@ var ShuffleNodeImpl = class extends NodeImpl {
17309
17970
  var _a;
17310
17971
  const input = inputs["array"];
17311
17972
  const items = input ? isArrayDataValue(input) ? input.value : [input.value] : [];
17312
- const shuffled = (0, import_lodash_es14.shuffle)(items);
17973
+ const shuffled = (0, import_lodash_es13.shuffle)(items);
17313
17974
  return {
17314
17975
  ["shuffled"]: {
17315
17976
  type: ((_a = inputs["array"]) == null ? void 0 : _a.type) ?? "any[]",
@@ -17321,14 +17982,14 @@ var ShuffleNodeImpl = class extends NodeImpl {
17321
17982
  var shuffleNode = nodeDefinition(ShuffleNodeImpl, "Shuffle");
17322
17983
 
17323
17984
  // src/model/nodes/CommentNode.ts
17324
- var import_non_secure59 = require("nanoid/non-secure");
17325
- var import_ts_dedent58 = require("ts-dedent");
17985
+ var import_non_secure60 = require("nanoid/non-secure");
17986
+ var import_ts_dedent59 = require("ts-dedent");
17326
17987
  var CommentNodeImpl = class extends NodeImpl {
17327
17988
  static create() {
17328
17989
  const chartNode = {
17329
17990
  type: "comment",
17330
17991
  title: "Comment",
17331
- id: (0, import_non_secure59.nanoid)(),
17992
+ id: (0, import_non_secure60.nanoid)(),
17332
17993
  visualData: {
17333
17994
  x: 0,
17334
17995
  y: 0,
@@ -17338,7 +17999,7 @@ var CommentNodeImpl = class extends NodeImpl {
17338
17999
  text: "",
17339
18000
  height: 600,
17340
18001
  color: "rgba(255,255,255,1)",
17341
- backgroundColor: "rgba(0,0,0,0.05)"
18002
+ backgroundColor: "rgba(128,128,128,0.05)"
17342
18003
  }
17343
18004
  };
17344
18005
  return chartNode;
@@ -17374,7 +18035,7 @@ var CommentNodeImpl = class extends NodeImpl {
17374
18035
  }
17375
18036
  static getUIData() {
17376
18037
  return {
17377
- infoBoxBody: import_ts_dedent58.dedent`
18038
+ infoBoxBody: import_ts_dedent59.dedent`
17378
18039
  A comment node is a node that does nothing. It is useful for adding notes to a graph.
17379
18040
  `,
17380
18041
  infoBoxTitle: "Comment Node",
@@ -17389,11 +18050,11 @@ var CommentNodeImpl = class extends NodeImpl {
17389
18050
  var commentNode = nodeDefinition(CommentNodeImpl, "Comment");
17390
18051
 
17391
18052
  // src/model/nodes/ImageNode.ts
17392
- var import_non_secure60 = require("nanoid/non-secure");
18053
+ var import_non_secure61 = require("nanoid/non-secure");
17393
18054
  var ImageNodeImpl = class extends NodeImpl {
17394
18055
  static create() {
17395
18056
  return {
17396
- id: (0, import_non_secure60.nanoid)(),
18057
+ id: (0, import_non_secure61.nanoid)(),
17397
18058
  type: "image",
17398
18059
  title: "Image",
17399
18060
  visualData: { x: 0, y: 0, width: 250 },
@@ -17490,11 +18151,11 @@ var ImageNodeImpl = class extends NodeImpl {
17490
18151
  var imageNode = nodeDefinition(ImageNodeImpl, "Image");
17491
18152
 
17492
18153
  // src/model/nodes/AudioNode.ts
17493
- var import_non_secure61 = require("nanoid/non-secure");
18154
+ var import_non_secure62 = require("nanoid/non-secure");
17494
18155
  var AudioNodeImpl = class extends NodeImpl {
17495
18156
  static create() {
17496
18157
  return {
17497
- id: (0, import_non_secure61.nanoid)(),
18158
+ id: (0, import_non_secure62.nanoid)(),
17498
18159
  type: "audio",
17499
18160
  title: "Audio",
17500
18161
  visualData: { x: 0, y: 0, width: 300 },
@@ -17587,7 +18248,7 @@ var AudioNodeImpl = class extends NodeImpl {
17587
18248
  var audioNode = nodeDefinition(AudioNodeImpl, "Audio");
17588
18249
 
17589
18250
  // src/model/nodes/HttpCallNode.ts
17590
- var import_non_secure62 = require("nanoid/non-secure");
18251
+ var import_non_secure63 = require("nanoid/non-secure");
17591
18252
  var REQUEST_FAILED_OUTPUT_ID = "requestFailed";
17592
18253
  var REQUEST_ERROR_OUTPUT_ID = "requestError";
17593
18254
  var STATUS_CODE_OUTPUT_ID = "statusCode";
@@ -17657,7 +18318,7 @@ function recordHttpCallThrownAttempt(attempts, error, signal) {
17657
18318
  attempts.requestFailedValues.push(true);
17658
18319
  attempts.requestErrorMessages.push(formatCaughtRequestFailureError(error));
17659
18320
  }
17660
- function buildRetryAttemptOutput2(type, values2) {
18321
+ function buildRetryAttemptOutput(type, values2) {
17661
18322
  return values2.length > 0 ? {
17662
18323
  type,
17663
18324
  value: values2
@@ -17732,7 +18393,7 @@ async function waitForRetryCooldown(cooldownMs, signal) {
17732
18393
  }
17733
18394
  function buildRequestFailedOutputs(params) {
17734
18395
  const sharedOutputs = {
17735
- [STATUS_CODE_OUTPUT_ID]: params.retryOnNon200 ? buildRetryAttemptOutput2("number[]", params.attempts.statusCodeValues) : {
18396
+ [STATUS_CODE_OUTPUT_ID]: params.retryOnNon200 ? buildRetryAttemptOutput("number[]", params.attempts.statusCodeValues) : {
17736
18397
  type: "control-flow-excluded",
17737
18398
  value: void 0
17738
18399
  },
@@ -17765,11 +18426,11 @@ function buildRequestFailedOutputs(params) {
17765
18426
  function buildCaughtRequestFailedResult(params) {
17766
18427
  const attempts = params.retryOnNon200 ? withCaughtFailureAttemptFallback(params.attempts, params.error) : params.attempts;
17767
18428
  const outputs = {
17768
- [REQUEST_ERROR_OUTPUT_ID]: params.retryOnNon200 ? buildRetryAttemptOutput2("string[]", attempts.requestErrorMessages) : {
18429
+ [REQUEST_ERROR_OUTPUT_ID]: params.retryOnNon200 ? buildRetryAttemptOutput("string[]", attempts.requestErrorMessages) : {
17769
18430
  type: "string",
17770
18431
  value: formatCaughtRequestFailureError(params.error)
17771
18432
  },
17772
- [REQUEST_FAILED_OUTPUT_ID]: params.retryOnNon200 ? buildRetryAttemptOutput2("boolean[]", attempts.requestFailedValues) : {
18433
+ [REQUEST_FAILED_OUTPUT_ID]: params.retryOnNon200 ? buildRetryAttemptOutput("boolean[]", attempts.requestFailedValues) : {
17773
18434
  type: "boolean",
17774
18435
  value: true
17775
18436
  },
@@ -17816,7 +18477,7 @@ var HttpCallNodeImpl = class extends NodeImpl {
17816
18477
  const chartNode = {
17817
18478
  type: "httpCall",
17818
18479
  title: "Http Call",
17819
- id: (0, import_non_secure62.nanoid)(),
18480
+ id: (0, import_non_secure63.nanoid)(),
17820
18481
  visualData: {
17821
18482
  x: 0,
17822
18483
  y: 0,
@@ -18014,7 +18675,7 @@ var HttpCallNodeImpl = class extends NodeImpl {
18014
18675
  }
18015
18676
  async process(inputs, context) {
18016
18677
  var _a;
18017
- const requestAttempts = createHttpCallRequestAttempts();
18678
+ const requestAttempts = this.data.retryOnNon200 ? createHttpCallRequestAttempts() : void 0;
18018
18679
  try {
18019
18680
  const method = getInputOrData(this.data, inputs, "method", "string");
18020
18681
  const url = getInputOrData(this.data, inputs, "url", "string");
@@ -18072,7 +18733,7 @@ var HttpCallNodeImpl = class extends NodeImpl {
18072
18733
  throw err;
18073
18734
  }
18074
18735
  };
18075
- const performTrackedRequest = async () => {
18736
+ const performTrackedRequest = requestAttempts ? async () => {
18076
18737
  try {
18077
18738
  const response2 = await performRequest();
18078
18739
  recordHttpCallResponseAttempt(requestAttempts, response2);
@@ -18081,9 +18742,9 @@ var HttpCallNodeImpl = class extends NodeImpl {
18081
18742
  recordHttpCallThrownAttempt(requestAttempts, error, context.signal);
18082
18743
  throw error;
18083
18744
  }
18084
- };
18745
+ } : performRequest;
18085
18746
  let response = await performTrackedRequest();
18086
- if (this.data.retryOnNon200) {
18747
+ if (requestAttempts) {
18087
18748
  const repeatTimes = normalizeHttpRetryCount(this.data.retryOnNon200RepeatTimes);
18088
18749
  const cooldownMs = normalizeHttpRetryCooldownMs(this.data.retryOnNon200CooldownMs);
18089
18750
  for (let attempt = 0; response.status !== 200 && attempt < repeatTimes; attempt++) {
@@ -18095,7 +18756,7 @@ var HttpCallNodeImpl = class extends NodeImpl {
18095
18756
  throw buildNon2xxStatusCodeError(response.status);
18096
18757
  }
18097
18758
  const output = {
18098
- [STATUS_CODE_OUTPUT_ID]: this.data.retryOnNon200 ? buildRetryAttemptOutput2("number[]", requestAttempts.statusCodeValues) : {
18759
+ [STATUS_CODE_OUTPUT_ID]: requestAttempts ? buildRetryAttemptOutput("number[]", requestAttempts.statusCodeValues) : {
18099
18760
  type: "number",
18100
18761
  value: response.status
18101
18762
  },
@@ -18129,12 +18790,12 @@ var HttpCallNodeImpl = class extends NodeImpl {
18129
18790
  };
18130
18791
  }
18131
18792
  }
18132
- if (this.data.catchRequestFailed || this.data.retryOnNon200) {
18133
- output[REQUEST_FAILED_OUTPUT_ID] = this.data.retryOnNon200 ? buildRetryAttemptOutput2("boolean[]", requestAttempts.requestFailedValues) : {
18793
+ if (this.data.catchRequestFailed || requestAttempts) {
18794
+ output[REQUEST_FAILED_OUTPUT_ID] = requestAttempts ? buildRetryAttemptOutput("boolean[]", requestAttempts.requestFailedValues) : {
18134
18795
  type: "boolean",
18135
18796
  value: false
18136
18797
  };
18137
- output[REQUEST_ERROR_OUTPUT_ID] = this.data.retryOnNon200 ? buildRetryAttemptOutput2("string[]", requestAttempts.requestErrorMessages) : {
18798
+ output[REQUEST_ERROR_OUTPUT_ID] = requestAttempts ? buildRetryAttemptOutput("string[]", requestAttempts.requestErrorMessages) : {
18138
18799
  type: "control-flow-excluded",
18139
18800
  value: void 0
18140
18801
  };
@@ -18145,8 +18806,8 @@ var HttpCallNodeImpl = class extends NodeImpl {
18145
18806
  return buildCaughtRequestFailedResult({
18146
18807
  isBinaryOutput: Boolean(this.data.isBinaryOutput),
18147
18808
  error,
18148
- retryOnNon200: Boolean(this.data.retryOnNon200),
18149
- attempts: requestAttempts
18809
+ retryOnNon200: requestAttempts != null,
18810
+ attempts: requestAttempts ?? createHttpCallRequestAttempts()
18150
18811
  });
18151
18812
  }
18152
18813
  throw error;
@@ -18156,14 +18817,14 @@ var HttpCallNodeImpl = class extends NodeImpl {
18156
18817
  var httpCallNode = nodeDefinition(HttpCallNodeImpl, "Http Call");
18157
18818
 
18158
18819
  // src/model/nodes/DelayNode.ts
18159
- var import_non_secure63 = require("nanoid/non-secure");
18160
- var import_ts_dedent59 = require("ts-dedent");
18820
+ var import_non_secure64 = require("nanoid/non-secure");
18821
+ var import_ts_dedent60 = require("ts-dedent");
18161
18822
  var DelayNodeImpl = class extends NodeImpl {
18162
18823
  static create() {
18163
18824
  const chartNode = {
18164
18825
  type: "delay",
18165
18826
  title: "Delay",
18166
- id: (0, import_non_secure63.nanoid)(),
18827
+ id: (0, import_non_secure64.nanoid)(),
18167
18828
  visualData: {
18168
18829
  x: 0,
18169
18830
  y: 0,
@@ -18208,7 +18869,7 @@ var DelayNodeImpl = class extends NodeImpl {
18208
18869
  }
18209
18870
  static getUIData() {
18210
18871
  return {
18211
- infoBoxBody: import_ts_dedent59.dedent`
18872
+ infoBoxBody: import_ts_dedent60.dedent`
18212
18873
  Delays the execution and then passes the input value to the output without any modifications.
18213
18874
  `,
18214
18875
  infoBoxTitle: "Delay Node",
@@ -18259,12 +18920,12 @@ var DelayNodeImpl = class extends NodeImpl {
18259
18920
  var delayNode = nodeDefinition(DelayNodeImpl, "Delay");
18260
18921
 
18261
18922
  // src/model/nodes/AppendToDatasetNode.ts
18262
- var import_non_secure64 = require("nanoid/non-secure");
18263
- var import_ts_dedent60 = require("ts-dedent");
18923
+ var import_non_secure65 = require("nanoid/non-secure");
18924
+ var import_ts_dedent61 = require("ts-dedent");
18264
18925
  var AppendToDatasetNodeImpl = class extends NodeImpl {
18265
18926
  static create() {
18266
18927
  return {
18267
- id: (0, import_non_secure64.nanoid)(),
18928
+ id: (0, import_non_secure65.nanoid)(),
18268
18929
  type: "appendToDataset",
18269
18930
  title: "Append to Dataset",
18270
18931
  visualData: { x: 0, y: 0, width: 250 },
@@ -18320,7 +18981,7 @@ var AppendToDatasetNodeImpl = class extends NodeImpl {
18320
18981
  }
18321
18982
  static getUIData() {
18322
18983
  return {
18323
- infoBoxBody: import_ts_dedent60.dedent`
18984
+ infoBoxBody: import_ts_dedent61.dedent`
18324
18985
  Appends a row of data to the specified dataset.
18325
18986
  `,
18326
18987
  infoBoxTitle: "Append to Dataset Node",
@@ -18870,14 +19531,14 @@ var GetDatasetRowNodeImpl = class extends NodeImpl {
18870
19531
  var getDatasetRowNode = nodeDefinition(GetDatasetRowNodeImpl, "Get Dataset Row");
18871
19532
 
18872
19533
  // src/model/nodes/SliceNode.ts
18873
- var import_non_secure65 = require("nanoid/non-secure");
18874
- var import_ts_dedent61 = require("ts-dedent");
19534
+ var import_non_secure66 = require("nanoid/non-secure");
19535
+ var import_ts_dedent62 = require("ts-dedent");
18875
19536
  var SliceNodeImpl = class extends NodeImpl {
18876
19537
  static create() {
18877
19538
  const chartNode = {
18878
19539
  type: "slice",
18879
19540
  title: "Slice",
18880
- id: (0, import_non_secure65.nanoid)(),
19541
+ id: (0, import_non_secure66.nanoid)(),
18881
19542
  visualData: {
18882
19543
  x: 0,
18883
19544
  y: 0,
@@ -18930,14 +19591,14 @@ var SliceNodeImpl = class extends NodeImpl {
18930
19591
  ];
18931
19592
  }
18932
19593
  getBody() {
18933
- return import_ts_dedent61.dedent`
19594
+ return import_ts_dedent62.dedent`
18934
19595
  Start: ${this.data.useStartInput ? "(Using Input)" : this.data.start == null ? "0" : this.data.start}
18935
19596
  Count: ${this.data.useCountInput ? "(Using Input)" : this.data.count == null ? "All" : this.data.count}
18936
19597
  `;
18937
19598
  }
18938
19599
  static getUIData() {
18939
19600
  return {
18940
- infoBoxBody: import_ts_dedent61.dedent`
19601
+ infoBoxBody: import_ts_dedent62.dedent`
18941
19602
  Slices an array from the start index for the count number of elements.
18942
19603
 
18943
19604
  Useful for extracting a portion of an array.
@@ -18963,14 +19624,14 @@ var SliceNodeImpl = class extends NodeImpl {
18963
19624
  var sliceNode = nodeDefinition(SliceNodeImpl, "Slice");
18964
19625
 
18965
19626
  // src/model/nodes/ExtractMarkdownCodeBlocksNode.ts
18966
- var import_non_secure66 = require("nanoid/non-secure");
18967
- var import_ts_dedent62 = require("ts-dedent");
19627
+ var import_non_secure67 = require("nanoid/non-secure");
19628
+ var import_ts_dedent63 = require("ts-dedent");
18968
19629
  var ExtractMarkdownCodeBlocksNodeImpl = class extends NodeImpl {
18969
19630
  static create() {
18970
19631
  const chartNode = {
18971
19632
  type: "extractMarkdownCodeBlocks",
18972
19633
  title: "Extract Markdown Code Blocks",
18973
- id: (0, import_non_secure66.nanoid)(),
19634
+ id: (0, import_non_secure67.nanoid)(),
18974
19635
  visualData: {
18975
19636
  x: 0,
18976
19637
  y: 0,
@@ -19011,7 +19672,7 @@ var ExtractMarkdownCodeBlocksNodeImpl = class extends NodeImpl {
19011
19672
  }
19012
19673
  static getUIData() {
19013
19674
  return {
19014
- infoBoxBody: import_ts_dedent62.dedent`
19675
+ infoBoxBody: import_ts_dedent63.dedent`
19015
19676
  Extracts the code blocks in the input Markdown text.
19016
19677
 
19017
19678
  Outputs the first matched block, all matched blocks, and the languages specified for the blocks.
@@ -19062,8 +19723,8 @@ var extractMarkdownCodeBlocksNode = nodeDefinition(
19062
19723
  );
19063
19724
 
19064
19725
  // src/model/nodes/AssembleMessageNode.ts
19065
- var import_non_secure67 = require("nanoid/non-secure");
19066
- var import_lodash_es15 = require("lodash");
19726
+ var import_non_secure68 = require("nanoid/non-secure");
19727
+ var import_lodash_es14 = require("lodash");
19067
19728
  var import_ts_pattern7 = require("ts-pattern");
19068
19729
  var messageTypeToTitle = {
19069
19730
  assistant: "Assistant",
@@ -19076,7 +19737,7 @@ var AssembleMessageNodeImpl = class extends NodeImpl {
19076
19737
  const chartNode = {
19077
19738
  type: "assembleMessage",
19078
19739
  title: "Assemble Message",
19079
- id: (0, import_non_secure67.nanoid)(),
19740
+ id: (0, import_non_secure68.nanoid)(),
19080
19741
  visualData: {
19081
19742
  x: 0,
19082
19743
  y: 0,
@@ -19220,7 +19881,7 @@ var AssembleMessageNodeImpl = class extends NodeImpl {
19220
19881
  ).otherwise(() => {
19221
19882
  throw new Error(`Invalid type: ${type}`);
19222
19883
  });
19223
- const inputParts = (0, import_lodash_es15.orderBy)(
19884
+ const inputParts = (0, import_lodash_es14.orderBy)(
19224
19885
  Object.entries(inputs).filter(([key]) => key.startsWith("part")),
19225
19886
  ([key]) => key,
19226
19887
  "asc"
@@ -19273,13 +19934,13 @@ var AssembleMessageNodeImpl = class extends NodeImpl {
19273
19934
  var assembleMessageNode = nodeDefinition(AssembleMessageNodeImpl, "Assemble Prompt");
19274
19935
 
19275
19936
  // src/model/nodes/URLReferenceNode.ts
19276
- var import_non_secure68 = require("nanoid/non-secure");
19937
+ var import_non_secure69 = require("nanoid/non-secure");
19277
19938
  var UrlReferenceNodeImpl = class extends NodeImpl {
19278
19939
  static create() {
19279
19940
  const chartNode = {
19280
19941
  type: "urlReference",
19281
19942
  title: "URL Reference",
19282
- id: (0, import_non_secure68.nanoid)(),
19943
+ id: (0, import_non_secure69.nanoid)(),
19283
19944
  visualData: {
19284
19945
  x: 0,
19285
19946
  y: 0,
@@ -19348,15 +20009,15 @@ var UrlReferenceNodeImpl = class extends NodeImpl {
19348
20009
  var urlReferenceNode = nodeDefinition(UrlReferenceNodeImpl, "URL Reference");
19349
20010
 
19350
20011
  // src/model/nodes/DestructureNode.ts
19351
- var import_non_secure69 = require("nanoid/non-secure");
20012
+ var import_non_secure70 = require("nanoid/non-secure");
19352
20013
  var import_jsonpath_plus3 = require("jsonpath-plus");
19353
- var import_ts_dedent63 = require("ts-dedent");
20014
+ var import_ts_dedent64 = require("ts-dedent");
19354
20015
  var DestructureNodeImpl = class extends NodeImpl {
19355
20016
  static create() {
19356
20017
  const chartNode = {
19357
20018
  type: "destructure",
19358
20019
  title: "Destructure",
19359
- id: (0, import_non_secure69.nanoid)(),
20020
+ id: (0, import_non_secure70.nanoid)(),
19360
20021
  visualData: {
19361
20022
  x: 0,
19362
20023
  y: 0,
@@ -19364,7 +20025,7 @@ var DestructureNodeImpl = class extends NodeImpl {
19364
20025
  },
19365
20026
  data: {
19366
20027
  paths: ["$.value"],
19367
- pathPortIds: [(0, import_non_secure69.nanoid)()]
20028
+ pathPortIds: [(0, import_non_secure70.nanoid)()]
19368
20029
  }
19369
20030
  };
19370
20031
  return chartNode;
@@ -19418,7 +20079,7 @@ var DestructureNodeImpl = class extends NodeImpl {
19418
20079
  }
19419
20080
  static getUIData() {
19420
20081
  return {
19421
- infoBoxBody: import_ts_dedent63.dedent`
20082
+ infoBoxBody: import_ts_dedent64.dedent`
19422
20083
  Destructures the input value by extracting values at the specified paths. The paths use JSONPath notation to navigate through the value.
19423
20084
  `,
19424
20085
  infoBoxTitle: "Destructure Node",
@@ -19452,12 +20113,12 @@ var DestructureNodeImpl = class extends NodeImpl {
19452
20113
  var destructureNode = nodeDefinition(DestructureNodeImpl, "Destructure");
19453
20114
 
19454
20115
  // src/model/nodes/ReplaceDatasetNode.ts
19455
- var import_non_secure70 = require("nanoid/non-secure");
19456
- var import_ts_dedent64 = require("ts-dedent");
20116
+ var import_non_secure71 = require("nanoid/non-secure");
20117
+ var import_ts_dedent65 = require("ts-dedent");
19457
20118
  var ReplaceDatasetNodeImpl = class extends NodeImpl {
19458
20119
  static create() {
19459
20120
  return {
19460
- id: (0, import_non_secure70.nanoid)(),
20121
+ id: (0, import_non_secure71.nanoid)(),
19461
20122
  type: "replaceDataset",
19462
20123
  title: "Replace Dataset",
19463
20124
  visualData: { x: 0, y: 0, width: 250 },
@@ -19496,7 +20157,7 @@ var ReplaceDatasetNodeImpl = class extends NodeImpl {
19496
20157
  }
19497
20158
  static getUIData() {
19498
20159
  return {
19499
- infoBoxBody: import_ts_dedent64.dedent`
20160
+ infoBoxBody: import_ts_dedent65.dedent`
19500
20161
  Replaces the data in a dataset with the given data. If no data is given, the dataset will be cleared instead.
19501
20162
  `,
19502
20163
  infoBoxTitle: "Replace Dataset Node",
@@ -19628,14 +20289,14 @@ var ListGraphsNodeImpl = class extends NodeImpl {
19628
20289
  var listGraphsNode = nodeDefinition(ListGraphsNodeImpl, "List Graphs");
19629
20290
 
19630
20291
  // src/model/nodes/GraphReferenceNode.ts
19631
- var import_non_secure71 = require("nanoid/non-secure");
19632
- var import_ts_dedent65 = require("ts-dedent");
20292
+ var import_non_secure72 = require("nanoid/non-secure");
20293
+ var import_ts_dedent66 = require("ts-dedent");
19633
20294
  var GraphReferenceNodeImpl = class extends NodeImpl {
19634
20295
  static create() {
19635
20296
  const chartNode = {
19636
20297
  type: "graphReference",
19637
20298
  title: "Graph Reference",
19638
- id: (0, import_non_secure71.nanoid)(),
20299
+ id: (0, import_non_secure72.nanoid)(),
19639
20300
  visualData: {
19640
20301
  x: 0,
19641
20302
  y: 0,
@@ -19684,7 +20345,7 @@ var GraphReferenceNodeImpl = class extends NodeImpl {
19684
20345
  }
19685
20346
  static getUIData() {
19686
20347
  return {
19687
- infoBoxBody: import_ts_dedent65.dedent`
20348
+ infoBoxBody: import_ts_dedent66.dedent`
19688
20349
  Gets a reference to another graph, that can be used to pass around graphs to call using a Call Graph node.
19689
20350
  `,
19690
20351
  infoBoxTitle: "Graph Reference Node",
@@ -19750,13 +20411,13 @@ var GraphReferenceNodeImpl = class extends NodeImpl {
19750
20411
  var graphReferenceNode = nodeDefinition(GraphReferenceNodeImpl, "Graph Reference");
19751
20412
 
19752
20413
  // src/model/nodes/CallGraphNode.ts
19753
- var import_non_secure72 = require("nanoid/non-secure");
19754
- var import_ts_dedent66 = require("ts-dedent");
20414
+ var import_non_secure73 = require("nanoid/non-secure");
20415
+ var import_ts_dedent67 = require("ts-dedent");
19755
20416
 
19756
20417
  // src/api/looseDataValue.ts
19757
- var import_lodash_es16 = require("lodash");
20418
+ var import_lodash_es15 = require("lodash");
19758
20419
  function looseDataValuesToDataValues(values2) {
19759
- return (0, import_lodash_es16.mapValues)(values2, (val) => looseDataValueToDataValue(val));
20420
+ return (0, import_lodash_es15.mapValues)(values2, (val) => looseDataValueToDataValue(val));
19760
20421
  }
19761
20422
  function looseDataValueToDataValue(value) {
19762
20423
  if (typeof value === "string") {
@@ -19777,7 +20438,7 @@ var CallGraphNodeImpl = class extends NodeImpl {
19777
20438
  const chartNode = {
19778
20439
  type: "callGraph",
19779
20440
  title: "Call Graph",
19780
- id: (0, import_non_secure72.nanoid)(),
20441
+ id: (0, import_non_secure73.nanoid)(),
19781
20442
  visualData: {
19782
20443
  x: 0,
19783
20444
  y: 0,
@@ -19827,7 +20488,7 @@ var CallGraphNodeImpl = class extends NodeImpl {
19827
20488
  }
19828
20489
  static getUIData() {
19829
20490
  return {
19830
- infoBoxBody: import_ts_dedent66.dedent`
20491
+ infoBoxBody: import_ts_dedent67.dedent`
19831
20492
  Calls another graph and passes inputs to it. Use in combination with the Graph Reference node to call dynamic graphs.
19832
20493
  `,
19833
20494
  infoBoxTitle: "Call Graph Node",
@@ -19899,7 +20560,7 @@ var callGraphNode = nodeDefinition(CallGraphNodeImpl, "Call Graph");
19899
20560
 
19900
20561
  // src/model/nodes/DelegateFunctionCallNode.ts
19901
20562
  var import_nanoid = require("nanoid");
19902
- var import_ts_dedent67 = require("ts-dedent");
20563
+ var import_ts_dedent68 = require("ts-dedent");
19903
20564
  var DelegateFunctionCallNodeImpl = class extends NodeImpl {
19904
20565
  static create() {
19905
20566
  const chartNode = {
@@ -19951,7 +20612,7 @@ var DelegateFunctionCallNodeImpl = class extends NodeImpl {
19951
20612
  }
19952
20613
  static getUIData() {
19953
20614
  return {
19954
- infoBoxBody: import_ts_dedent67.dedent`
20615
+ infoBoxBody: import_ts_dedent68.dedent`
19955
20616
  Handles a tool call by delegating it to a different subgraph depending on the tool call.
19956
20617
  `,
19957
20618
  infoBoxTitle: "Delegate Tool Call Node",
@@ -20072,11 +20733,11 @@ function buildDelegatedToolCallOutputs(records) {
20072
20733
  var delegateFunctionCallNode = nodeDefinition(DelegateFunctionCallNodeImpl, "Delegate Tool Call");
20073
20734
 
20074
20735
  // src/model/nodes/PlayAudioNode.ts
20075
- var import_non_secure73 = require("nanoid/non-secure");
20736
+ var import_non_secure74 = require("nanoid/non-secure");
20076
20737
  var PlayAudioNodeImpl = class extends NodeImpl {
20077
20738
  static create() {
20078
20739
  return {
20079
- id: (0, import_non_secure73.nanoid)(),
20740
+ id: (0, import_non_secure74.nanoid)(),
20080
20741
  type: "playAudio",
20081
20742
  title: "Play Audio",
20082
20743
  visualData: { x: 0, y: 0, width: 200 },
@@ -20130,11 +20791,11 @@ var PlayAudioNodeImpl = class extends NodeImpl {
20130
20791
  var playAudioNode = nodeDefinition(PlayAudioNodeImpl, "Play Audio");
20131
20792
 
20132
20793
  // src/model/nodes/DocumentNode.ts
20133
- var import_non_secure74 = require("nanoid/non-secure");
20794
+ var import_non_secure75 = require("nanoid/non-secure");
20134
20795
  var DocumentNodeImpl = class extends NodeImpl {
20135
20796
  static create() {
20136
20797
  return {
20137
- id: (0, import_non_secure74.nanoid)(),
20798
+ id: (0, import_non_secure75.nanoid)(),
20138
20799
  type: "document",
20139
20800
  title: "Document",
20140
20801
  visualData: { x: 0, y: 0, width: 300 },
@@ -20300,14 +20961,14 @@ var DocumentNodeImpl = class extends NodeImpl {
20300
20961
  var documentNode = nodeDefinition(DocumentNodeImpl, "Document");
20301
20962
 
20302
20963
  // src/model/nodes/ChatLoopNode.ts
20303
- var import_non_secure75 = require("nanoid/non-secure");
20304
- var import_ts_dedent68 = require("ts-dedent");
20964
+ var import_non_secure76 = require("nanoid/non-secure");
20965
+ var import_ts_dedent69 = require("ts-dedent");
20305
20966
  var ChatLoopNodeImpl = class extends NodeImpl {
20306
20967
  static create() {
20307
20968
  const chartNode = {
20308
20969
  type: "chatLoop",
20309
20970
  title: "Chat Loop",
20310
- id: (0, import_non_secure75.nanoid)(),
20971
+ id: (0, import_non_secure76.nanoid)(),
20311
20972
  visualData: {
20312
20973
  x: 0,
20313
20974
  y: 0,
@@ -20340,7 +21001,7 @@ var ChatLoopNodeImpl = class extends NodeImpl {
20340
21001
  }
20341
21002
  static getUIData() {
20342
21003
  return {
20343
- infoBoxBody: import_ts_dedent68.dedent`
21004
+ infoBoxBody: import_ts_dedent69.dedent`
20344
21005
  Creates an interactive chat loop with an AI model. The node will:
20345
21006
  1. Send the initial prompt to the AI
20346
21007
  2. Show the AI's response and prompt for user input
@@ -20440,12 +21101,12 @@ var ChatLoopNodeImpl = class extends NodeImpl {
20440
21101
  var chatLoopNode = nodeDefinition(ChatLoopNodeImpl, "Chat Loop");
20441
21102
 
20442
21103
  // src/model/nodes/ReadAllFilesNode.ts
20443
- var import_non_secure76 = require("nanoid/non-secure");
20444
- var import_ts_dedent69 = require("ts-dedent");
21104
+ var import_non_secure77 = require("nanoid/non-secure");
21105
+ var import_ts_dedent70 = require("ts-dedent");
20445
21106
  var ReadAllFilesNodeImpl = class extends NodeImpl {
20446
21107
  static create() {
20447
21108
  return {
20448
- id: (0, import_non_secure76.nanoid)(),
21109
+ id: (0, import_non_secure77.nanoid)(),
20449
21110
  type: "readAllFiles",
20450
21111
  title: "Read All Files",
20451
21112
  visualData: { x: 0, y: 0, width: 250 },
@@ -20556,7 +21217,7 @@ var ReadAllFilesNodeImpl = class extends NodeImpl {
20556
21217
  ];
20557
21218
  }
20558
21219
  getBody() {
20559
- return import_ts_dedent69.dedent`
21220
+ return import_ts_dedent70.dedent`
20560
21221
  ${this.data.asBinary ? "Read as Binary" : "Read as Text"}
20561
21222
  Path: ${this.data.usePathInput ? "(Input)" : this.data.path}
20562
21223
  Recursive: ${this.data.useRecursiveInput ? "(Input)" : this.data.recursive}
@@ -20565,7 +21226,7 @@ var ReadAllFilesNodeImpl = class extends NodeImpl {
20565
21226
  }
20566
21227
  static getUIData() {
20567
21228
  return {
20568
- infoBoxBody: import_ts_dedent69.dedent`
21229
+ infoBoxBody: import_ts_dedent70.dedent`
20569
21230
  Reads all files in the specified directory and outputs an array of objects containing each file's path and contents.
20570
21231
  Each object has a 'path' (string) and 'content' (string or binary) property.
20571
21232
  `,
@@ -20638,14 +21299,14 @@ var ReadAllFilesNodeImpl = class extends NodeImpl {
20638
21299
  var readAllFilesNode = nodeDefinition(ReadAllFilesNodeImpl, "Read All Files");
20639
21300
 
20640
21301
  // src/model/nodes/ToMarkdownTableNode.ts
20641
- var import_non_secure77 = require("nanoid/non-secure");
20642
- var import_ts_dedent70 = require("ts-dedent");
21302
+ var import_non_secure78 = require("nanoid/non-secure");
21303
+ var import_ts_dedent71 = require("ts-dedent");
20643
21304
  var ToMarkdownTableNodeImpl = class extends NodeImpl {
20644
21305
  static create() {
20645
21306
  const chartNode = {
20646
21307
  type: "toMarkdownTable",
20647
21308
  title: "To Markdown Table",
20648
- id: (0, import_non_secure77.nanoid)(),
21309
+ id: (0, import_non_secure78.nanoid)(),
20649
21310
  visualData: {
20650
21311
  x: 0,
20651
21312
  y: 0,
@@ -20701,7 +21362,7 @@ var ToMarkdownTableNodeImpl = class extends NodeImpl {
20701
21362
  }
20702
21363
  static getUIData() {
20703
21364
  return {
20704
- infoBoxBody: import_ts_dedent70.dedent`
21365
+ infoBoxBody: import_ts_dedent71.dedent`
20705
21366
  Converts an array of objects into a markdown table format.
20706
21367
  Input should be an array of objects with consistent keys.
20707
21368
  `,
@@ -20753,7 +21414,7 @@ var toMarkdownTableNode = nodeDefinition(ToMarkdownTableNodeImpl, "To Markdown T
20753
21414
 
20754
21415
  // src/model/nodes/CronNode.ts
20755
21416
  var import_nanoid2 = require("nanoid");
20756
- var import_ts_dedent71 = require("ts-dedent");
21417
+ var import_ts_dedent72 = require("ts-dedent");
20757
21418
  var cronParser = __toESM(require("cron-parser"), 1);
20758
21419
  var CronNodeImpl = class extends NodeImpl {
20759
21420
  static create() {
@@ -20823,7 +21484,7 @@ var CronNodeImpl = class extends NodeImpl {
20823
21484
  }
20824
21485
  static getUIData() {
20825
21486
  return {
20826
- infoBoxBody: import_ts_dedent71.dedent`
21487
+ infoBoxBody: import_ts_dedent72.dedent`
20827
21488
  Executes a subgraph on a schedule. Supports:
20828
21489
  - Natural language (e.g., "every 5 minutes", "daily at 3pm")
20829
21490
  - Cron expressions (e.g., "0 * * * *")
@@ -20863,7 +21524,7 @@ var CronNodeImpl = class extends NodeImpl {
20863
21524
  type: "string",
20864
21525
  dataKey: "schedule",
20865
21526
  label: "Schedule",
20866
- helperMessage: import_ts_dedent71.dedent`
21527
+ helperMessage: import_ts_dedent72.dedent`
20867
21528
  Examples:
20868
21529
  Cron: "*/5 * * * *", "0 15 * * *"
20869
21530
  Interval: "5 minutes", "1 hour", "7 days"
@@ -20994,15 +21655,15 @@ ${this.data.schedule}`;
20994
21655
  var cronNode = nodeDefinition(CronNodeImpl, "Cron");
20995
21656
 
20996
21657
  // src/model/nodes/ToTreeNode.ts
20997
- var import_non_secure78 = require("nanoid/non-secure");
20998
- var import_ts_dedent72 = require("ts-dedent");
20999
- var import_lodash_es17 = require("lodash");
21658
+ var import_non_secure79 = require("nanoid/non-secure");
21659
+ var import_ts_dedent73 = require("ts-dedent");
21660
+ var import_lodash_es16 = require("lodash");
21000
21661
  var ToTreeNodeImpl = class extends NodeImpl {
21001
21662
  static create() {
21002
21663
  const chartNode = {
21003
21664
  type: "toTree",
21004
21665
  title: "To Tree",
21005
- id: (0, import_non_secure78.nanoid)(),
21666
+ id: (0, import_non_secure79.nanoid)(),
21006
21667
  visualData: {
21007
21668
  x: 0,
21008
21669
  y: 0,
@@ -21057,7 +21718,7 @@ var ToTreeNodeImpl = class extends NodeImpl {
21057
21718
  ];
21058
21719
  }
21059
21720
  getBody() {
21060
- return import_ts_dedent72.dedent`
21721
+ return import_ts_dedent73.dedent`
21061
21722
  Format: ${this.data.format}
21062
21723
  Children: ${this.data.childrenProperty}
21063
21724
  Sort: ${this.data.useSortAlphabetically ? "Yes" : "No"}
@@ -21065,7 +21726,7 @@ var ToTreeNodeImpl = class extends NodeImpl {
21065
21726
  }
21066
21727
  static getUIData() {
21067
21728
  return {
21068
- infoBoxBody: import_ts_dedent72.dedent`
21729
+ infoBoxBody: import_ts_dedent73.dedent`
21069
21730
  Converts an array of objects into a tree structure and renders it as text.
21070
21731
 
21071
21732
  The format field supports interpolation using {{property}} syntax to determine
@@ -21082,7 +21743,7 @@ var ToTreeNodeImpl = class extends NodeImpl {
21082
21743
  if (!Array.isArray(objects) || objects.length === 0)
21083
21744
  return "";
21084
21745
  let result = "";
21085
- const sortedObjects = this.data.useSortAlphabetically ? (0, import_lodash_es17.sortBy)(objects, (obj) => String((0, import_lodash_es17.get)(obj, "path", ""))) : objects;
21746
+ const sortedObjects = this.data.useSortAlphabetically ? (0, import_lodash_es16.sortBy)(objects, (obj) => String((0, import_lodash_es16.get)(obj, "path", ""))) : objects;
21086
21747
  sortedObjects.forEach((obj, index) => {
21087
21748
  const isLastItem = index === sortedObjects.length - 1;
21088
21749
  const prefix = level === 0 ? "" : isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
@@ -21091,14 +21752,14 @@ var ToTreeNodeImpl = class extends NodeImpl {
21091
21752
  const interpolationVars = matches.reduce(
21092
21753
  (acc, match10) => {
21093
21754
  const key = match10;
21094
- acc[key] = String((0, import_lodash_es17.get)(obj, key, ""));
21755
+ acc[key] = String((0, import_lodash_es16.get)(obj, key, ""));
21095
21756
  return acc;
21096
21757
  },
21097
21758
  {}
21098
21759
  );
21099
21760
  const formattedNode = interpolate(this.data.format, interpolationVars);
21100
21761
  result += indent + prefix + formattedNode + "\n";
21101
- const children = (0, import_lodash_es17.get)(obj, this.data.childrenProperty);
21762
+ const children = (0, import_lodash_es16.get)(obj, this.data.childrenProperty);
21102
21763
  if (Array.isArray(children) && children.length > 0) {
21103
21764
  const newPath = parentPath ? `${parentPath}/${formattedNode}` : formattedNode;
21104
21765
  result += this.buildTree(children, newPath, level + 1, isLastItem);
@@ -21120,14 +21781,14 @@ var ToTreeNodeImpl = class extends NodeImpl {
21120
21781
  var toTreeNode = nodeDefinition(ToTreeNodeImpl, "To Tree");
21121
21782
 
21122
21783
  // src/model/nodes/LoopUntilNode.ts
21123
- var import_non_secure79 = require("nanoid/non-secure");
21124
- var import_ts_dedent73 = require("ts-dedent");
21784
+ var import_non_secure80 = require("nanoid/non-secure");
21785
+ var import_ts_dedent74 = require("ts-dedent");
21125
21786
  var LoopUntilNodeImpl = class extends NodeImpl {
21126
21787
  static create() {
21127
21788
  const chartNode = {
21128
21789
  type: "loopUntil",
21129
21790
  title: "Loop Until",
21130
- id: (0, import_non_secure79.nanoid)(),
21791
+ id: (0, import_non_secure80.nanoid)(),
21131
21792
  visualData: {
21132
21793
  x: 0,
21133
21794
  y: 0,
@@ -21251,7 +21912,7 @@ var LoopUntilNodeImpl = class extends NodeImpl {
21251
21912
  }
21252
21913
  static getUIData() {
21253
21914
  return {
21254
- infoBoxBody: import_ts_dedent73.dedent`
21915
+ infoBoxBody: import_ts_dedent74.dedent`
21255
21916
  Executes a subgraph in a loop until a condition is met. Each iteration's outputs become
21256
21917
  the inputs for the next iteration. Supports different stopping conditions and optional
21257
21918
  maximum iterations.
@@ -21609,14 +22270,14 @@ var MCPDiscoveryNodeImpl = class extends NodeImpl {
21609
22270
  var mcpDiscoveryNode = nodeDefinition(MCPDiscoveryNodeImpl, "MCP Discovery");
21610
22271
 
21611
22272
  // src/model/nodes/MCPToolCallNode.ts
21612
- var import_non_secure80 = require("nanoid/non-secure");
21613
- var import_ts_dedent74 = require("ts-dedent");
22273
+ var import_non_secure81 = require("nanoid/non-secure");
22274
+ var import_ts_dedent75 = require("ts-dedent");
21614
22275
  var MCPToolCallNodeImpl = class extends NodeImpl {
21615
22276
  static create() {
21616
22277
  const chartNode = {
21617
22278
  type: "mcpToolCall",
21618
22279
  title: "MCP Tool Call",
21619
- id: (0, import_non_secure80.nanoid)(),
22280
+ id: (0, import_non_secure81.nanoid)(),
21620
22281
  visualData: {
21621
22282
  x: 0,
21622
22283
  y: 0,
@@ -21629,7 +22290,7 @@ var MCPToolCallNodeImpl = class extends NodeImpl {
21629
22290
  serverUrl: "http://localhost:8080/mcp",
21630
22291
  serverId: "",
21631
22292
  toolName: "",
21632
- toolArguments: import_ts_dedent74.dedent`
22293
+ toolArguments: import_ts_dedent75.dedent`
21633
22294
  {
21634
22295
  "key": "value"
21635
22296
  }`,
@@ -21769,7 +22430,7 @@ var MCPToolCallNodeImpl = class extends NodeImpl {
21769
22430
  }
21770
22431
  static getUIData() {
21771
22432
  return {
21772
- infoBoxBody: import_ts_dedent74.dedent`
22433
+ infoBoxBody: import_ts_dedent75.dedent`
21773
22434
  Connects to an MCP (Model Context Protocol) server and gets a tool call response.
21774
22435
  `,
21775
22436
  infoBoxTitle: "MCP Tool Call Node",
@@ -21858,13 +22519,13 @@ var MCPToolCallNodeImpl = class extends NodeImpl {
21858
22519
  var mcpToolCallNode = nodeDefinition(MCPToolCallNodeImpl, "MCP Tool Call");
21859
22520
 
21860
22521
  // src/model/nodes/MCPGetPromptNode.ts
21861
- var import_non_secure81 = require("nanoid/non-secure");
22522
+ var import_non_secure82 = require("nanoid/non-secure");
21862
22523
  var MCPGetPromptNodeImpl = class extends NodeImpl {
21863
22524
  static create() {
21864
22525
  const chartNode = {
21865
22526
  type: "mcpGetPrompt",
21866
22527
  title: "MCP Get Prompt",
21867
- id: (0, import_non_secure81.nanoid)(),
22528
+ id: (0, import_non_secure82.nanoid)(),
21868
22529
  visualData: {
21869
22530
  x: 0,
21870
22531
  y: 0,
@@ -22080,15 +22741,15 @@ var MCPGetPromptNodeImpl = class extends NodeImpl {
22080
22741
  var mcpGetPromptNode = nodeDefinition(MCPGetPromptNodeImpl, "MCP Get Prompt");
22081
22742
 
22082
22743
  // src/model/nodes/ReferencedGraphAliasNode.ts
22083
- var import_non_secure82 = require("nanoid/non-secure");
22084
- var import_ts_dedent75 = require("ts-dedent");
22744
+ var import_non_secure83 = require("nanoid/non-secure");
22745
+ var import_ts_dedent76 = require("ts-dedent");
22085
22746
  var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
22086
22747
  static create() {
22087
22748
  const chartNode = {
22088
22749
  type: "referencedGraphAlias",
22089
22750
  title: "",
22090
22751
  // Always set initially by the editor
22091
- id: (0, import_non_secure82.nanoid)(),
22752
+ id: (0, import_non_secure83.nanoid)(),
22092
22753
  visualData: {
22093
22754
  x: 0,
22094
22755
  y: 0,
@@ -22195,7 +22856,7 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
22195
22856
  }
22196
22857
  static getUIData() {
22197
22858
  return {
22198
- infoBoxBody: import_ts_dedent75.dedent`
22859
+ infoBoxBody: import_ts_dedent76.dedent`
22199
22860
  References a graph from another project. Inputs and outputs are defined by Graph Input and Graph Output nodes within the referenced graph.
22200
22861
  `,
22201
22862
  infoBoxTitle: "Referenced Graph Alias Node",
@@ -22289,7 +22950,7 @@ var referencedGraphAliasNode = nodeDefinition(ReferencedGraphAliasNodeImpl, "Ref
22289
22950
 
22290
22951
  // src/model/Nodes.ts
22291
22952
  var registerBuiltInNodes = (registry) => {
22292
- return registry.register(toYamlNode).register(userInputNode).register(textNode).register(llmChatV2Node).register(chatNode).register(promptNode).register(extractRegexNode).register(codeNode).register(expressionNode).register(matchNode).register(ifNode).register(readDirectoryNode).register(readFileNode).register(ifElseNode).register(chunkNode).register(graphInputNode).register(graphOutputNode).register(subGraphNode).register(arrayNode).register(extractJsonNode).register(assemblePromptNode).register(loopControllerNode).register(trimChatMessagesNode).register(extractYamlNode).register(externalCallNode).register(extractObjectPathNode).register(raiseEventNode).register(contextNode).register(coalesceNode).register(didRunNode).register(passthroughNode).register(popNode).register(setGlobalNode).register(getGlobalNode).register(waitForEventNode).register(gptFunctionNode).register(getEmbeddingNode).register(vectorStoreNode).register(vectorNearestNeighborsNode).register(hashNode).register(abortGraphNode).register(raceInputsNode).register(toJsonNode).register(joinNode).register(filterNode).register(jsFilterNode).register(jsMapNode).register(objectNode).register(booleanNode).register(compareNode).register(evaluateNode).register(numberNode).register(randomNumberNode).register(shuffleNode).register(commentNode).register(imageNode).register(audioNode).register(httpCallNode).register(delayNode).register(appendToDatasetNode).register(createDatasetNode).register(loadDatasetNode).register(getAllDatasetsNode).register(splitNode).register(datasetNearestNeighborsNode).register(getDatasetRowNode).register(sliceNode).register(extractMarkdownCodeBlocksNode).register(assembleMessageNode).register(urlReferenceNode).register(destructureNode).register(replaceDatasetNode).register(listGraphsNode).register(graphReferenceNode).register(callGraphNode).register(delegateFunctionCallNode).register(playAudioNode).register(documentNode).register(chatLoopNode).register(readAllFilesNode).register(toMarkdownTableNode).register(cronNode).register(toTreeNode).register(loopUntilNode).register(mcpDiscoveryNode).register(mcpToolCallNode).register(mcpGetPromptNode).register(referencedGraphAliasNode);
22953
+ return registry.register(toYamlNode).register(userInputNode).register(textNode).register(llmChatV2Node).register(chatNode).register(promptNode).register(extractRegexNode).register(codeNode).register(codeNewNode).register(expressionNode).register(matchNode).register(ifNode).register(readDirectoryNode).register(readFileNode).register(ifElseNode).register(chunkNode).register(graphInputNode).register(graphOutputNode).register(subGraphNode).register(arrayNode).register(extractJsonNode).register(assemblePromptNode).register(loopControllerNode).register(trimChatMessagesNode).register(extractYamlNode).register(externalCallNode).register(extractObjectPathNode).register(raiseEventNode).register(contextNode).register(coalesceNode).register(didRunNode).register(passthroughNode).register(popNode).register(setGlobalNode).register(getGlobalNode).register(waitForEventNode).register(gptFunctionNode).register(getEmbeddingNode).register(vectorStoreNode).register(vectorNearestNeighborsNode).register(hashNode).register(abortGraphNode).register(raceInputsNode).register(toJsonNode).register(joinNode).register(filterNode).register(jsFilterNode).register(jsMapNode).register(objectNode).register(booleanNode).register(compareNode).register(evaluateNode).register(numberNode).register(randomNumberNode).register(shuffleNode).register(commentNode).register(imageNode).register(audioNode).register(httpCallNode).register(delayNode).register(appendToDatasetNode).register(createDatasetNode).register(loadDatasetNode).register(getAllDatasetsNode).register(splitNode).register(datasetNearestNeighborsNode).register(getDatasetRowNode).register(sliceNode).register(extractMarkdownCodeBlocksNode).register(assembleMessageNode).register(urlReferenceNode).register(destructureNode).register(replaceDatasetNode).register(listGraphsNode).register(graphReferenceNode).register(callGraphNode).register(delegateFunctionCallNode).register(playAudioNode).register(documentNode).register(chatLoopNode).register(readAllFilesNode).register(toMarkdownTableNode).register(cronNode).register(toTreeNode).register(loopUntilNode).register(mcpDiscoveryNode).register(mcpToolCallNode).register(mcpGetPromptNode).register(referencedGraphAliasNode);
22293
22954
  };
22294
22955
  var globalRivetNodeRegistry = registerBuiltInNodes(new NodeRegistration());
22295
22956
  function resetGlobalRivetNodeRegistry() {
@@ -22380,9 +23041,9 @@ var OpenAIEmbeddingGenerator = class {
22380
23041
  registerIntegration("embeddingGenerator", "openai", (context) => new OpenAIEmbeddingGenerator(context.settings));
22381
23042
 
22382
23043
  // src/recording/ExecutionRecorder.ts
22383
- var import_non_secure83 = require("nanoid/non-secure");
23044
+ var import_non_secure84 = require("nanoid/non-secure");
22384
23045
  var import_emittery2 = __toESM(require("emittery-0-13"), 1);
22385
- var import_lodash_es18 = require("lodash");
23046
+ var import_lodash_es17 = require("lodash");
22386
23047
  var import_json_stream_es = require("json-stream-es");
22387
23048
 
22388
23049
  // src/vendor/fnv1a.js
@@ -22543,16 +23204,16 @@ function toRecordedEvent(event, data) {
22543
23204
  function mapValuesDeep(obj, fn) {
22544
23205
  if (Array.isArray(obj)) {
22545
23206
  return obj.map((value) => {
22546
- if ((0, import_lodash_es18.isPlainObject)(value) || Array.isArray(value)) {
23207
+ if ((0, import_lodash_es17.isPlainObject)(value) || Array.isArray(value)) {
22547
23208
  return mapValuesDeep(value, fn);
22548
23209
  }
22549
23210
  return fn(value);
22550
23211
  });
22551
23212
  }
22552
- if ((0, import_lodash_es18.isPlainObject)(obj)) {
23213
+ if ((0, import_lodash_es17.isPlainObject)(obj)) {
22553
23214
  return Object.fromEntries(
22554
23215
  Object.entries(obj).map(([key, value]) => {
22555
- if ((0, import_lodash_es18.isPlainObject)(value) || Array.isArray(value)) {
23216
+ if ((0, import_lodash_es17.isPlainObject)(value) || Array.isArray(value)) {
22556
23217
  return [key, mapValuesDeep(value, fn)];
22557
23218
  }
22558
23219
  return [key, fn(value)];
@@ -22573,7 +23234,7 @@ function serializeToObject(recording) {
22573
23234
  const asString = uint8ArrayToBase64Sync(val);
22574
23235
  const existingAsset = Object.entries(serialized.assets).find(([, asset]) => asset === asString);
22575
23236
  if (!existingAsset) {
22576
- const id = (0, import_non_secure83.nanoid)();
23237
+ const id = (0, import_non_secure84.nanoid)();
22577
23238
  serialized.assets[id] = asString;
22578
23239
  return `$ASSET:${id}`;
22579
23240
  } else {
@@ -22632,7 +23293,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
22632
23293
  once = void 0;
22633
23294
  recordSocket(channel) {
22634
23295
  return new Promise((resolve) => {
22635
- this.recordingId = (0, import_non_secure83.nanoid)();
23296
+ this.recordingId = (0, import_non_secure84.nanoid)();
22636
23297
  const listener = (event) => {
22637
23298
  const { message, data } = JSON.parse(event.data);
22638
23299
  if (this.#includePartialOutputs === false && message === "partialOutput") {
@@ -22657,7 +23318,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
22657
23318
  });
22658
23319
  }
22659
23320
  record(processor) {
22660
- this.recordingId = (0, import_non_secure83.nanoid)();
23321
+ this.recordingId = (0, import_non_secure84.nanoid)();
22661
23322
  processor.onAny((event, data) => {
22662
23323
  if (this.#includePartialOutputs === false && event === "partialOutput") {
22663
23324
  return;
@@ -22713,8 +23374,8 @@ var ExecutionRecorder = class _ExecutionRecorder {
22713
23374
  };
22714
23375
 
22715
23376
  // src/plugins/anthropic/nodes/ChatAnthropicNode.ts
22716
- var import_non_secure84 = require("nanoid/non-secure");
22717
- var import_ts_dedent76 = require("ts-dedent");
23377
+ var import_non_secure85 = require("nanoid/non-secure");
23378
+ var import_ts_dedent77 = require("ts-dedent");
22718
23379
  var import_p_retry2 = __toESM(require("p-retry-4"), 1);
22719
23380
 
22720
23381
  // src/utils/assertNever.ts
@@ -22729,7 +23390,7 @@ var ChatAnthropicNodeImpl = {
22729
23390
  const chartNode = {
22730
23391
  type: "chatAnthropic",
22731
23392
  title: "Chat (Anthropic, Legacy)",
22732
- id: (0, import_non_secure84.nanoid)(),
23393
+ id: (0, import_non_secure85.nanoid)(),
22733
23394
  visualData: {
22734
23395
  x: 0,
22735
23396
  y: 0,
@@ -22873,7 +23534,7 @@ var ChatAnthropicNodeImpl = {
22873
23534
  getBody(data) {
22874
23535
  var _a;
22875
23536
  const modelName = data.overrideModel ? data.overrideModel : ((_a = anthropicModels[data.model]) == null ? void 0 : _a.displayName) ?? "Unknown Model";
22876
- return import_ts_dedent76.dedent`
23537
+ return import_ts_dedent77.dedent`
22877
23538
  ${modelName}
22878
23539
  ${data.useTopP ? `Top P: ${data.useTopPInput ? "(Using Input)" : data.top_p}` : `Temperature: ${data.useTemperatureInput ? "(Using Input)" : data.temperature}`}
22879
23540
  Max Tokens: ${data.maxTokens}
@@ -22998,7 +23659,7 @@ var ChatAnthropicNodeImpl = {
22998
23659
  },
22999
23660
  getUIData() {
23000
23661
  return {
23001
- infoBoxBody: import_ts_dedent76.dedent`
23662
+ infoBoxBody: import_ts_dedent77.dedent`
23002
23663
  Legacy Anthropic chat node.
23003
23664
 
23004
23665
  For new work, prefer \`LLM Chat\`, which keeps provider selection inside one shared node.
@@ -23471,8 +24132,8 @@ var anthropicPlugin = {
23471
24132
  var anthropic_default = anthropicPlugin;
23472
24133
 
23473
24134
  // src/plugins/autoevals/AutoEvalsNode.ts
23474
- var import_non_secure85 = require("nanoid/non-secure");
23475
- var import_ts_dedent77 = require("ts-dedent");
24135
+ var import_non_secure86 = require("nanoid/non-secure");
24136
+ var import_ts_dedent78 = require("ts-dedent");
23476
24137
  var import_autoevals = require("autoevals");
23477
24138
  var import_ts_pattern8 = require("ts-pattern");
23478
24139
  var options = [
@@ -23491,7 +24152,7 @@ var AutoEvalsNodeImpl = {
23491
24152
  const chartNode = {
23492
24153
  type: "autoevals",
23493
24154
  title: "Autoevals",
23494
- id: (0, import_non_secure85.nanoid)(),
24155
+ id: (0, import_non_secure86.nanoid)(),
23495
24156
  visualData: {
23496
24157
  x: 0,
23497
24158
  y: 0,
@@ -23606,7 +24267,7 @@ var AutoEvalsNodeImpl = {
23606
24267
  },
23607
24268
  getUIData() {
23608
24269
  return {
23609
- infoBoxBody: import_ts_dedent77.dedent`
24270
+ infoBoxBody: import_ts_dedent78.dedent`
23610
24271
  Evaluates the validity of a response using the autoevals library.
23611
24272
  `,
23612
24273
  infoBoxTitle: "Autoevals Node",
@@ -23686,8 +24347,8 @@ var autoevalsPlugin = {
23686
24347
  var autoevals_default = autoevalsPlugin;
23687
24348
 
23688
24349
  // src/plugins/assemblyAi/LemurQaNode.ts
23689
- var import_non_secure86 = require("nanoid/non-secure");
23690
- var import_ts_dedent78 = require("ts-dedent");
24350
+ var import_non_secure87 = require("nanoid/non-secure");
24351
+ var import_ts_dedent79 = require("ts-dedent");
23691
24352
 
23692
24353
  // src/plugins/assemblyAi/lemurHelpers.ts
23693
24354
  var import_assemblyai = require("assemblyai");
@@ -23807,7 +24468,7 @@ var LemurQaNodeImpl = {
23807
24468
  const chartNode = {
23808
24469
  type: "assemblyAiLemurQa",
23809
24470
  title: "LeMUR Question & Answers",
23810
- id: (0, import_non_secure86.nanoid)(),
24471
+ id: (0, import_non_secure87.nanoid)(),
23811
24472
  visualData: {
23812
24473
  x: 0,
23813
24474
  y: 0,
@@ -23873,7 +24534,7 @@ var LemurQaNodeImpl = {
23873
24534
  },
23874
24535
  getUIData() {
23875
24536
  return {
23876
- infoBoxBody: import_ts_dedent78.dedent`Use AssemblyAI LeMUR to ask questions about transcripts`,
24537
+ infoBoxBody: import_ts_dedent79.dedent`Use AssemblyAI LeMUR to ask questions about transcripts`,
23877
24538
  infoBoxTitle: "Use AssemblyAI LeMUR Question & Answer",
23878
24539
  contextMenuTitle: "LeMUR Q&A",
23879
24540
  group: ["AI", "AssemblyAI"]
@@ -23945,14 +24606,14 @@ function applyQuestionEditors(data, question) {
23945
24606
  var lemurQaNode = pluginNodeDefinition(LemurQaNodeImpl, "LeMUR Q&A");
23946
24607
 
23947
24608
  // src/plugins/assemblyAi/TranscribeAudioNode.ts
23948
- var import_non_secure87 = require("nanoid/non-secure");
23949
- var import_ts_dedent79 = require("ts-dedent");
24609
+ var import_non_secure88 = require("nanoid/non-secure");
24610
+ var import_ts_dedent80 = require("ts-dedent");
23950
24611
  var TranscribeAudioNodeImpl = {
23951
24612
  create() {
23952
24613
  const chartNode = {
23953
24614
  type: "assemblyAiTranscribeAudio",
23954
24615
  title: "Transcribe Audio",
23955
- id: (0, import_non_secure87.nanoid)(),
24616
+ id: (0, import_non_secure88.nanoid)(),
23956
24617
  visualData: {
23957
24618
  x: 0,
23958
24619
  y: 0,
@@ -24008,7 +24669,7 @@ var TranscribeAudioNodeImpl = {
24008
24669
  },
24009
24670
  getUIData() {
24010
24671
  return {
24011
- infoBoxBody: import_ts_dedent79.dedent`Use AssemblyAI to transcribe audio`,
24672
+ infoBoxBody: import_ts_dedent80.dedent`Use AssemblyAI to transcribe audio`,
24012
24673
  infoBoxTitle: "Transcribe Audio Node",
24013
24674
  contextMenuTitle: "Transcribe Audio",
24014
24675
  group: ["AI", "AssemblyAI"]
@@ -24067,15 +24728,15 @@ function getAdditionalParameters(data) {
24067
24728
  }
24068
24729
 
24069
24730
  // src/plugins/assemblyAi/LemurSummaryNode.ts
24070
- var import_non_secure88 = require("nanoid/non-secure");
24071
- var import_ts_dedent80 = require("ts-dedent");
24731
+ var import_non_secure89 = require("nanoid/non-secure");
24732
+ var import_ts_dedent81 = require("ts-dedent");
24072
24733
  var import_assemblyai3 = require("assemblyai");
24073
24734
  var LemurSummaryNodeImpl = {
24074
24735
  create() {
24075
24736
  const chartNode = {
24076
24737
  type: "assemblyAiLemurSummary",
24077
24738
  title: "LeMUR Summary",
24078
- id: (0, import_non_secure88.nanoid)(),
24739
+ id: (0, import_non_secure89.nanoid)(),
24079
24740
  visualData: {
24080
24741
  x: 0,
24081
24742
  y: 0,
@@ -24121,7 +24782,7 @@ var LemurSummaryNodeImpl = {
24121
24782
  },
24122
24783
  getUIData() {
24123
24784
  return {
24124
- infoBoxBody: import_ts_dedent80.dedent`Use AssemblyAI LeMUR Summary to summarize transcripts`,
24785
+ infoBoxBody: import_ts_dedent81.dedent`Use AssemblyAI LeMUR Summary to summarize transcripts`,
24125
24786
  infoBoxTitle: "Use AssemblyAI LeMUR Summary",
24126
24787
  contextMenuTitle: "LeMUR Summary",
24127
24788
  group: ["AI", "AssemblyAI"]
@@ -24145,15 +24806,15 @@ var LemurSummaryNodeImpl = {
24145
24806
  var lemurSummaryNode = pluginNodeDefinition(LemurSummaryNodeImpl, "LeMUR Summary");
24146
24807
 
24147
24808
  // src/plugins/assemblyAi/LemurTaskNode.ts
24148
- var import_non_secure89 = require("nanoid/non-secure");
24149
- var import_ts_dedent81 = require("ts-dedent");
24809
+ var import_non_secure90 = require("nanoid/non-secure");
24810
+ var import_ts_dedent82 = require("ts-dedent");
24150
24811
  var import_assemblyai4 = require("assemblyai");
24151
24812
  var LemurTaskNodeImpl = {
24152
24813
  create() {
24153
24814
  const chartNode = {
24154
24815
  type: "assemblyAiLemurTask",
24155
24816
  title: "LeMUR Task",
24156
- id: (0, import_non_secure89.nanoid)(),
24817
+ id: (0, import_non_secure90.nanoid)(),
24157
24818
  visualData: {
24158
24819
  x: 0,
24159
24820
  y: 0,
@@ -24199,7 +24860,7 @@ var LemurTaskNodeImpl = {
24199
24860
  },
24200
24861
  getUIData() {
24201
24862
  return {
24202
- infoBoxBody: import_ts_dedent81.dedent`Use AssemblyAI LeMUR Custom Task to ask anything.`,
24863
+ infoBoxBody: import_ts_dedent82.dedent`Use AssemblyAI LeMUR Custom Task to ask anything.`,
24203
24864
  infoBoxTitle: "Use AssemblyAI LeMUR Custom Task",
24204
24865
  contextMenuTitle: "LeMUR Custom Task",
24205
24866
  group: ["AI", "AssemblyAI"]
@@ -24225,14 +24886,14 @@ var LemurTaskNodeImpl = {
24225
24886
  var lemurTaskNode = pluginNodeDefinition(LemurTaskNodeImpl, "LeMUR Task");
24226
24887
 
24227
24888
  // src/plugins/assemblyAi/LemurActionItemsNode.ts
24228
- var import_non_secure90 = require("nanoid/non-secure");
24229
- var import_ts_dedent82 = require("ts-dedent");
24889
+ var import_non_secure91 = require("nanoid/non-secure");
24890
+ var import_ts_dedent83 = require("ts-dedent");
24230
24891
  var LemurActionItemsNodeImpl = {
24231
24892
  create() {
24232
24893
  const chartNode = {
24233
24894
  type: "assemblyAiLemurActionItems",
24234
24895
  title: "LeMUR Action Items",
24235
- id: (0, import_non_secure90.nanoid)(),
24896
+ id: (0, import_non_secure91.nanoid)(),
24236
24897
  visualData: {
24237
24898
  x: 0,
24238
24899
  y: 0,
@@ -24278,7 +24939,7 @@ var LemurActionItemsNodeImpl = {
24278
24939
  },
24279
24940
  getUIData() {
24280
24941
  return {
24281
- infoBoxBody: import_ts_dedent82.dedent`Use AssemblyAI LeMUR Action Items to extract action items`,
24942
+ infoBoxBody: import_ts_dedent83.dedent`Use AssemblyAI LeMUR Action Items to extract action items`,
24282
24943
  infoBoxTitle: "Use AssemblyAI LeMUR Action Items",
24283
24944
  contextMenuTitle: "LeMUR Action Items",
24284
24945
  group: ["AI", "AssemblyAI"]
@@ -24330,12 +24991,12 @@ var assemblyAiPlugin = {
24330
24991
  var assemblyAi_default = assemblyAiPlugin;
24331
24992
 
24332
24993
  // src/plugins/huggingface/nodes/ChatHuggingFace.ts
24333
- var import_non_secure91 = require("nanoid/non-secure");
24994
+ var import_non_secure92 = require("nanoid/non-secure");
24334
24995
  var import_inference = require("@huggingface/inference");
24335
24996
  var ChatHuggingFaceNodeImpl = {
24336
24997
  create() {
24337
24998
  return {
24338
- id: (0, import_non_secure91.nanoid)(),
24999
+ id: (0, import_non_secure92.nanoid)(),
24339
25000
  type: "chatHuggingFace",
24340
25001
  data: {
24341
25002
  model: "",
@@ -24565,13 +25226,13 @@ var ChatHuggingFaceNodeImpl = {
24565
25226
  var chatHuggingFaceNode = pluginNodeDefinition(ChatHuggingFaceNodeImpl, "Chat (Hugging Face, Legacy)");
24566
25227
 
24567
25228
  // src/plugins/huggingface/nodes/TextToImageHuggingFace.ts
24568
- var import_non_secure92 = require("nanoid/non-secure");
25229
+ var import_non_secure93 = require("nanoid/non-secure");
24569
25230
  var import_inference2 = require("@huggingface/inference");
24570
- var import_ts_dedent83 = require("ts-dedent");
25231
+ var import_ts_dedent84 = require("ts-dedent");
24571
25232
  var TextToImageHuggingFaceNodeImpl = {
24572
25233
  create() {
24573
25234
  return {
24574
- id: (0, import_non_secure92.nanoid)(),
25235
+ id: (0, import_non_secure93.nanoid)(),
24575
25236
  type: "textToImageHuggingFace",
24576
25237
  data: {
24577
25238
  model: "",
@@ -24712,7 +25373,7 @@ var TextToImageHuggingFaceNodeImpl = {
24712
25373
  ];
24713
25374
  },
24714
25375
  getBody(data) {
24715
- return import_ts_dedent83.dedent`
25376
+ return import_ts_dedent84.dedent`
24716
25377
  Model: ${data.useModelInput ? "(Using Input)" : data.model}
24717
25378
  `;
24718
25379
  },
@@ -24888,7 +25549,7 @@ var pinecone_default = pineconePlugin;
24888
25549
 
24889
25550
  // src/plugins/gentrace/plugin.ts
24890
25551
  var import_core = require("@gentrace/core");
24891
- var import_lodash_es19 = require("lodash");
25552
+ var import_lodash_es18 = require("lodash");
24892
25553
 
24893
25554
  // src/integrations/GptTokenizerTokenizer.ts
24894
25555
  var import_emittery3 = __toESM(require("emittery-0-13"), 1);
@@ -24986,7 +25647,7 @@ var runGentraceTests = async (gentracePipelineSlug, settings, project, graph, na
24986
25647
  slug: gentracePipelineSlug
24987
25648
  });
24988
25649
  const runner = pipeline.start();
24989
- const rivetFormattedInputs = (0, import_lodash_es19.mapValues)(testCase.inputs, inferType);
25650
+ const rivetFormattedInputs = (0, import_lodash_es18.mapValues)(testCase.inputs, inferType);
24990
25651
  const tempProject = {
24991
25652
  ...project,
24992
25653
  graphs: {
@@ -24998,7 +25659,7 @@ var runGentraceTests = async (gentracePipelineSlug, settings, project, graph, na
24998
25659
  const processor = new GraphProcessor(tempProject, graphId, globalRivetNodeRegistry);
24999
25660
  processor.executor = "browser";
25000
25661
  recorder.record(processor);
25001
- const runContextValues = (0, import_lodash_es19.cloneDeep)(contextValues);
25662
+ const runContextValues = (0, import_lodash_es18.cloneDeep)(contextValues);
25002
25663
  await processor.processGraph(
25003
25664
  {
25004
25665
  settings,
@@ -25036,7 +25697,7 @@ var runRemoteGentraceTests = async (gentracePipelineSlug, settings, project, gra
25036
25697
  slug: gentracePipelineSlug
25037
25698
  });
25038
25699
  const runner = pipeline.start();
25039
- const rivetFormattedInputs = (0, import_lodash_es19.mapValues)(testCase.inputs, inferType);
25700
+ const rivetFormattedInputs = (0, import_lodash_es18.mapValues)(testCase.inputs, inferType);
25040
25701
  const fullRecording = await runAndRecord(rivetFormattedInputs);
25041
25702
  const stepRuns = convertRecordingToStepRuns(fullRecording, project, graphId);
25042
25703
  for (const stepRun of stepRuns) {
@@ -27716,7 +28377,7 @@ ${additional.join("\n")}`;
27716
28377
  var runThreadNode = pluginNodeDefinition(RunThreadNodeImpl, "Run Thread");
27717
28378
 
27718
28379
  // src/plugins/openai/nodes/ThreadMessageNode.ts
27719
- var import_lodash_es20 = require("lodash");
28380
+ var import_lodash_es19 = require("lodash");
27720
28381
  var ThreadMessageNodeImpl = {
27721
28382
  create() {
27722
28383
  return {
@@ -27839,7 +28500,7 @@ var ThreadMessageNodeImpl = {
27839
28500
  if (data.useMetadataInput && inputData["metadata"]) {
27840
28501
  metadata = coerceTypeOptional(inputData["metadata"], "object");
27841
28502
  }
27842
- const inputMap = (0, import_lodash_es20.mapValues)(inputData, (input) => coerceType(input, "string"));
28503
+ const inputMap = (0, import_lodash_es19.mapValues)(inputData, (input) => coerceType(input, "string"));
27843
28504
  const interpolated = interpolate(text, inputMap);
27844
28505
  return {
27845
28506
  ["message"]: {
@@ -27887,12 +28548,12 @@ var openAIPlugin = {
27887
28548
  };
27888
28549
 
27889
28550
  // src/plugins/google/nodes/ChatGoogleNode.ts
27890
- var import_non_secure93 = require("nanoid/non-secure");
27891
- var import_ts_dedent84 = require("ts-dedent");
28551
+ var import_non_secure94 = require("nanoid/non-secure");
28552
+ var import_ts_dedent85 = require("ts-dedent");
27892
28553
  var import_p_retry3 = __toESM(require("p-retry-4"), 1);
27893
28554
  var import_ts_pattern9 = require("ts-pattern");
27894
28555
  var import_genai2 = require("@google/genai");
27895
- var import_lodash_es21 = require("lodash");
28556
+ var import_lodash_es20 = require("lodash");
27896
28557
  function toGoogleSchemaType(type) {
27897
28558
  switch (type) {
27898
28559
  case "string":
@@ -27916,7 +28577,7 @@ var ChatGoogleNodeImpl = {
27916
28577
  const chartNode = {
27917
28578
  type: "chatGoogle",
27918
28579
  title: "Chat (Google, Legacy)",
27919
- id: (0, import_non_secure93.nanoid)(),
28580
+ id: (0, import_non_secure94.nanoid)(),
27920
28581
  visualData: {
27921
28582
  x: 0,
27922
28583
  y: 0,
@@ -28051,7 +28712,7 @@ var ChatGoogleNodeImpl = {
28051
28712
  },
28052
28713
  getBody(data) {
28053
28714
  var _a;
28054
- return import_ts_dedent84.dedent`
28715
+ return import_ts_dedent85.dedent`
28055
28716
  ${((_a = generativeAiGoogleModels[data.model]) == null ? void 0 : _a.displayName) ?? `Google (${data.model})`}
28056
28717
  ${data.useTopP ? `Top P: ${data.useTopPInput ? "(Using Input)" : data.top_p}` : `Temperature: ${data.useTemperatureInput ? "(Using Input)" : data.temperature}`}
28057
28718
  Max Tokens: ${data.maxTokens}
@@ -28138,7 +28799,7 @@ var ChatGoogleNodeImpl = {
28138
28799
  },
28139
28800
  getUIData() {
28140
28801
  return {
28141
- infoBoxBody: import_ts_dedent84.dedent`
28802
+ infoBoxBody: import_ts_dedent85.dedent`
28142
28803
  Legacy Google chat node.
28143
28804
 
28144
28805
  For new work, prefer \`LLM Chat\`, which keeps provider selection inside one shared node.
@@ -28264,7 +28925,7 @@ var ChatGoogleNodeImpl = {
28264
28925
  description: tool.description,
28265
28926
  parameters: Object.keys(parameters.properties ?? {}).length === 0 ? void 0 : {
28266
28927
  type: import_genai2.Type.OBJECT,
28267
- properties: (0, import_lodash_es21.mapValues)(parameters.properties ?? {}, (property) => ({
28928
+ properties: (0, import_lodash_es20.mapValues)(parameters.properties ?? {}, (property) => ({
28268
28929
  // gemini doesn't support union property types, it uses openapi style not jsonschema, what a mess
28269
28930
  type: toGoogleSchemaType(
28270
28931
  Array.isArray(property.type) ? property.type.find((type) => type !== "null") : property.type
@@ -28547,7 +29208,7 @@ async function assembleRegistry(specs, loadPlugin) {
28547
29208
  }
28548
29209
 
28549
29210
  // src/integrations/DatasetProvider.ts
28550
- var import_lodash_es22 = require("lodash");
29211
+ var import_lodash_es21 = require("lodash");
28551
29212
  var InMemoryDatasetProvider = class {
28552
29213
  #datasets;
28553
29214
  constructor(datasets) {
@@ -28627,7 +29288,7 @@ var InMemoryDatasetProvider = class {
28627
29288
  return sorted.slice(0, k).map((r) => ({ ...r.row, distance: r.similarity }));
28628
29289
  }
28629
29290
  async exportDatasetsForProject(_projectId) {
28630
- return (0, import_lodash_es22.cloneDeep)(this.#datasets);
29291
+ return (0, import_lodash_es21.cloneDeep)(this.#datasets);
28631
29292
  }
28632
29293
  };
28633
29294
  var dotProductSimilarity = (a, b) => {
@@ -28750,7 +29411,7 @@ function resolveProcessSettings(settings = {}, fallbacks = {}) {
28750
29411
  }
28751
29412
 
28752
29413
  // src/api/createProcessor.ts
28753
- function coreCreateProcessor(project, options2) {
29414
+ function coreCreateProcessor(project, options2, internalOptions = {}) {
28754
29415
  var _a, _b, _c;
28755
29416
  const { graph, inputs = {}, context = {} } = options2;
28756
29417
  const graphId = graph ? graph in project.graphs ? graph : (_b = (_a = Object.values(project.graphs).find((g) => {
@@ -28765,7 +29426,13 @@ function coreCreateProcessor(project, options2) {
28765
29426
  graphId,
28766
29427
  options2.registry ?? globalRivetNodeRegistry,
28767
29428
  options2.includeTrace,
28768
- { concurrency: options2.concurrency }
29429
+ {
29430
+ cacheLoadedProjects: internalOptions.cacheLoadedProjects,
29431
+ concurrency: options2.concurrency,
29432
+ executionPlanCacheMode: internalOptions.executionPlanCacheMode,
29433
+ runtimeCache: internalOptions.runtimeCache,
29434
+ scheduler: internalOptions.scheduler
29435
+ }
28769
29436
  );
28770
29437
  if (options2.onStart) {
28771
29438
  processor.on("start", options2.onStart);
@@ -28880,12 +29547,14 @@ var Rivet = void 0;
28880
29547
  AudioNodeImpl,
28881
29548
  BooleanNodeImpl,
28882
29549
  BrowserNativeApi,
29550
+ CODE_NEW_OUTPUT_PORT_ID,
28883
29551
  CallGraphNodeImpl,
28884
29552
  ChatLoopNodeImpl,
28885
29553
  ChatNodeBase,
28886
29554
  ChatNodeImpl,
28887
29555
  ChunkNodeImpl,
28888
29556
  CoalesceNodeImpl,
29557
+ CodeNewNodeImpl,
28889
29558
  CodeNodeImpl,
28890
29559
  CommentNodeImpl,
28891
29560
  CompareNodeImpl,
@@ -29017,6 +29686,7 @@ var Rivet = void 0;
29017
29686
  chunkStringByTokenCount,
29018
29687
  cleanHeaders,
29019
29688
  coalesceNode,
29689
+ codeNewNode,
29020
29690
  codeNode,
29021
29691
  coerceType,
29022
29692
  coerceTypeOptional,
@@ -29109,6 +29779,7 @@ var Rivet = void 0;
29109
29779
  imageNode,
29110
29780
  inferType,
29111
29781
  interpolate,
29782
+ interpolateCodeNewSource,
29112
29783
  interpolateExpressionSource,
29113
29784
  interpolateExtractObjectPathSource,
29114
29785
  interpolateJSListCallbackBody,