@valerypopoff/rivet2-core 2.0.8 → 2.0.10
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.
- package/dist/cjs/bundle.cjs +1187 -589
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/esm/api/createProcessor.js +1 -0
- package/dist/esm/api/streaming.js +1 -0
- package/dist/esm/exports.js +1 -0
- package/dist/esm/model/DebuggerTransportSentinel.js +78 -0
- package/dist/esm/model/GraphAbortReasons.js +69 -0
- package/dist/esm/model/GraphBoundaryCache.js +92 -0
- package/dist/esm/model/GraphPreprocessor.js +88 -30
- package/dist/esm/model/GraphProcessor.js +295 -96
- package/dist/esm/model/NodeImpl.js +6 -4
- package/dist/esm/model/ProcessContextBuilder.js +2 -17
- package/dist/esm/model/RecordingPlayer.js +27 -7
- package/dist/esm/model/SplitRunProcessor.js +48 -9
- package/dist/esm/model/SubprocessorBridge.js +30 -23
- package/dist/esm/model/nodes/DidRunNode.js +12 -7
- package/dist/esm/model/nodes/GetGlobalNode.js +14 -4
- package/dist/esm/model/nodes/GraphOutputNode.js +31 -2
- package/dist/esm/model/nodes/LoopUntilNode.js +18 -45
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +24 -63
- package/dist/esm/model/nodes/SetGlobalNode.js +2 -1
- package/dist/esm/model/nodes/SubGraphNode.js +22 -63
- package/dist/esm/recording/ExecutionRecorder.js +19 -6
- package/dist/esm/utils/emitDetached.js +2 -2
- package/dist/esm/utils/interpolation.js +41 -1
- package/dist/esm/utils/serialization/serialization.js +6 -5
- package/dist/esm/utils/serialization/serializationHelpers.js +2 -2
- package/dist/esm/utils/serialization/serializationInput.js +48 -0
- package/dist/esm/utils/serialization/serializationUtils.js +2 -33
- package/dist/esm/utils/serialization/serialization_v2.js +8 -8
- package/dist/types/api/createProcessor.d.ts +1 -0
- package/dist/types/api/streaming.d.ts +1 -0
- package/dist/types/exports.d.ts +1 -0
- package/dist/types/model/DebuggerTransportSentinel.d.ts +21 -0
- package/dist/types/model/EditorDefinition.d.ts +7 -1
- package/dist/types/model/ExecutorProtocol.d.ts +5 -0
- package/dist/types/model/GraphAbortReasons.d.ts +23 -0
- package/dist/types/model/GraphBoundaryCache.d.ts +27 -0
- package/dist/types/model/GraphPreprocessor.d.ts +3 -1
- package/dist/types/model/GraphProcessor.d.ts +8 -0
- package/dist/types/model/NodeImpl.d.ts +10 -5
- package/dist/types/model/Nodes.d.ts +2 -2
- package/dist/types/model/ProcessContext.d.ts +3 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +4 -20
- package/dist/types/model/SplitRunProcessor.d.ts +8 -3
- package/dist/types/model/nodes/DidRunNode.d.ts +2 -1
- package/dist/types/model/nodes/LoopUntilNode.d.ts +5 -4
- package/dist/types/model/nodes/ReferencedGraphAliasNode.d.ts +5 -4
- package/dist/types/model/nodes/SubGraphNode.d.ts +6 -5
- package/dist/types/recording/RecordedEvents.d.ts +4 -0
- package/dist/types/utils/emitDetached.d.ts +2 -2
- package/dist/types/utils/serialization/serializationInput.d.ts +7 -0
- package/package.json +1 -1
package/dist/cjs/bundle.cjs
CHANGED
|
@@ -191,12 +191,16 @@ __export(src_exports, {
|
|
|
191
191
|
createChatV2Model: () => createChatV2Model,
|
|
192
192
|
createChatV2ResponseOutput: () => createChatV2ResponseOutput,
|
|
193
193
|
createDatasetNode: () => createDatasetNode,
|
|
194
|
+
createDebuggerTransportEscapedSentinel: () => createDebuggerTransportEscapedSentinel,
|
|
195
|
+
createDebuggerTransportEscapedSentinelEnvelope: () => createDebuggerTransportEscapedSentinelEnvelope,
|
|
196
|
+
createDebuggerTransportUndefinedSentinel: () => createDebuggerTransportUndefinedSentinel,
|
|
194
197
|
createInterpolationInputDefinition: () => createInterpolationInputDefinition,
|
|
195
198
|
createsLLMChatV2ToolResponseFormatConflictForEdit: () => createsLLMChatV2ToolResponseFormatConflictForEdit,
|
|
196
199
|
cronNode: () => cronNode,
|
|
197
200
|
dataTypeDisplayNames: () => dataTypeDisplayNames,
|
|
198
201
|
dataTypes: () => dataTypes,
|
|
199
202
|
datasetNearestNeighborsNode: () => datasetNearestNeighborsNode,
|
|
203
|
+
decodeDebuggerTransportSentinels: () => decodeDebuggerTransportSentinels,
|
|
200
204
|
dedent: () => import_ts_dedent.dedent,
|
|
201
205
|
delayNode: () => delayNode,
|
|
202
206
|
delegateFunctionCallNode: () => delegateFunctionCallNode,
|
|
@@ -280,6 +284,7 @@ __export(src_exports, {
|
|
|
280
284
|
isChatV2StructuredResponseFormat: () => isChatV2StructuredResponseFormat,
|
|
281
285
|
isDataTypeAccepted: () => isDataTypeAccepted,
|
|
282
286
|
isDataTypeCompatible: () => isDataTypeCompatible,
|
|
287
|
+
isDebuggerTransportSentinelEnvelope: () => isDebuggerTransportSentinelEnvelope,
|
|
283
288
|
isFunctionDataType: () => isFunctionDataType,
|
|
284
289
|
isFunctionDataValue: () => isFunctionDataValue,
|
|
285
290
|
isInterpolationInputDefinition: () => isInterpolationInputDefinition,
|
|
@@ -549,12 +554,16 @@ __export(exports_exports, {
|
|
|
549
554
|
createChatV2Model: () => createChatV2Model,
|
|
550
555
|
createChatV2ResponseOutput: () => createChatV2ResponseOutput,
|
|
551
556
|
createDatasetNode: () => createDatasetNode,
|
|
557
|
+
createDebuggerTransportEscapedSentinel: () => createDebuggerTransportEscapedSentinel,
|
|
558
|
+
createDebuggerTransportEscapedSentinelEnvelope: () => createDebuggerTransportEscapedSentinelEnvelope,
|
|
559
|
+
createDebuggerTransportUndefinedSentinel: () => createDebuggerTransportUndefinedSentinel,
|
|
552
560
|
createInterpolationInputDefinition: () => createInterpolationInputDefinition,
|
|
553
561
|
createsLLMChatV2ToolResponseFormatConflictForEdit: () => createsLLMChatV2ToolResponseFormatConflictForEdit,
|
|
554
562
|
cronNode: () => cronNode,
|
|
555
563
|
dataTypeDisplayNames: () => dataTypeDisplayNames,
|
|
556
564
|
dataTypes: () => dataTypes,
|
|
557
565
|
datasetNearestNeighborsNode: () => datasetNearestNeighborsNode,
|
|
566
|
+
decodeDebuggerTransportSentinels: () => decodeDebuggerTransportSentinels,
|
|
558
567
|
dedent: () => import_ts_dedent.dedent,
|
|
559
568
|
delayNode: () => delayNode,
|
|
560
569
|
delegateFunctionCallNode: () => delegateFunctionCallNode,
|
|
@@ -638,6 +647,7 @@ __export(exports_exports, {
|
|
|
638
647
|
isChatV2StructuredResponseFormat: () => isChatV2StructuredResponseFormat,
|
|
639
648
|
isDataTypeAccepted: () => isDataTypeAccepted,
|
|
640
649
|
isDataTypeCompatible: () => isDataTypeCompatible,
|
|
650
|
+
isDebuggerTransportSentinelEnvelope: () => isDebuggerTransportSentinelEnvelope,
|
|
641
651
|
isFunctionDataType: () => isFunctionDataType,
|
|
642
652
|
isFunctionDataValue: () => isFunctionDataValue,
|
|
643
653
|
isInterpolationInputDefinition: () => isInterpolationInputDefinition,
|
|
@@ -1364,8 +1374,56 @@ var yaml3 = __toESM(require("yaml"), 1);
|
|
|
1364
1374
|
// src/utils/serialization/serialization_v3.ts
|
|
1365
1375
|
var import_lodash_es = require("lodash");
|
|
1366
1376
|
|
|
1367
|
-
// src/utils/serialization/
|
|
1377
|
+
// src/utils/serialization/serializationInput.ts
|
|
1368
1378
|
var YAML = __toESM(require("yaml"), 1);
|
|
1379
|
+
function prepareSerializedInput(data) {
|
|
1380
|
+
if (typeof data !== "string") {
|
|
1381
|
+
return {
|
|
1382
|
+
deserializerInput: data,
|
|
1383
|
+
version: 1
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
const trimmed = data.trim();
|
|
1387
|
+
if (!trimmed) {
|
|
1388
|
+
return {
|
|
1389
|
+
deserializerInput: data,
|
|
1390
|
+
version: 1
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
1394
|
+
try {
|
|
1395
|
+
const parsed2 = JSON.parse(trimmed);
|
|
1396
|
+
const version2 = getParsedSerializationVersion(parsed2);
|
|
1397
|
+
return {
|
|
1398
|
+
deserializerInput: version2 === 1 ? data : parsed2,
|
|
1399
|
+
version: version2
|
|
1400
|
+
};
|
|
1401
|
+
} catch {
|
|
1402
|
+
return {
|
|
1403
|
+
deserializerInput: data,
|
|
1404
|
+
version: 1
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
const parsed = YAML.parse(trimmed);
|
|
1409
|
+
const version = getParsedSerializationVersion(parsed);
|
|
1410
|
+
return {
|
|
1411
|
+
deserializerInput: version === 1 ? data : parsed,
|
|
1412
|
+
version
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
function getParsedSerializationVersion(parsed) {
|
|
1416
|
+
if (!parsed || typeof parsed !== "object") {
|
|
1417
|
+
return 1;
|
|
1418
|
+
}
|
|
1419
|
+
const version = parsed.version;
|
|
1420
|
+
if (version === 2 || version === 3 || version === 4) {
|
|
1421
|
+
return version;
|
|
1422
|
+
}
|
|
1423
|
+
return 1;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
// src/utils/serialization/serializationUtils.ts
|
|
1369
1427
|
function validateProject(project) {
|
|
1370
1428
|
const errors = [];
|
|
1371
1429
|
const warnings = [];
|
|
@@ -1436,29 +1494,7 @@ function yamlProblem(err) {
|
|
|
1436
1494
|
throw new Error(`YAML error: ${code} ${message} at ${pos} ${linePos}`);
|
|
1437
1495
|
}
|
|
1438
1496
|
function detectSerializationVersion(data) {
|
|
1439
|
-
|
|
1440
|
-
return 1;
|
|
1441
|
-
}
|
|
1442
|
-
const trimmed = data.trim();
|
|
1443
|
-
if (!trimmed) {
|
|
1444
|
-
return 1;
|
|
1445
|
-
}
|
|
1446
|
-
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
1447
|
-
try {
|
|
1448
|
-
const parsed2 = JSON.parse(trimmed);
|
|
1449
|
-
if (typeof parsed2 === "object" && parsed2 != null && typeof parsed2.version === "number" && parsed2.version >= 2 && parsed2.version <= 4) {
|
|
1450
|
-
return parsed2.version;
|
|
1451
|
-
}
|
|
1452
|
-
return 1;
|
|
1453
|
-
} catch {
|
|
1454
|
-
return 1;
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
const parsed = YAML.parse(trimmed);
|
|
1458
|
-
if (parsed && typeof parsed === "object" && typeof parsed.version === "number" && parsed.version >= 2 && parsed.version <= 4) {
|
|
1459
|
-
return parsed.version;
|
|
1460
|
-
}
|
|
1461
|
-
return 1;
|
|
1497
|
+
return prepareSerializedInput(data).version;
|
|
1462
1498
|
}
|
|
1463
1499
|
|
|
1464
1500
|
// src/utils/serialization/serializationHelpers.ts
|
|
@@ -1506,10 +1542,10 @@ function wrapInYamlEnvelope(version, data) {
|
|
|
1506
1542
|
return yaml.stringify({ version, data: stabilized }, null, { indent: 2 });
|
|
1507
1543
|
}
|
|
1508
1544
|
function unwrapYamlEnvelope(raw, expectedVersion, label) {
|
|
1509
|
-
if (typeof raw !== "string") {
|
|
1545
|
+
if (typeof raw !== "string" && (!raw || typeof raw !== "object" || Array.isArray(raw))) {
|
|
1510
1546
|
throw new Error(`${label} deserializer requires a string`);
|
|
1511
1547
|
}
|
|
1512
|
-
const parsed = yaml.parse(raw);
|
|
1548
|
+
const parsed = typeof raw === "string" ? yaml.parse(raw) : raw;
|
|
1513
1549
|
if (parsed.version !== expectedVersion) {
|
|
1514
1550
|
throw new Error(`${label} deserializer requires a version ${expectedVersion} ${label.toLowerCase()}`);
|
|
1515
1551
|
}
|
|
@@ -1780,10 +1816,7 @@ function datasetV4Deserializer(serializedDatasets) {
|
|
|
1780
1816
|
// src/utils/serialization/serialization_v2.ts
|
|
1781
1817
|
var yaml2 = __toESM(require("yaml"), 1);
|
|
1782
1818
|
function projectV2Deserializer(data) {
|
|
1783
|
-
|
|
1784
|
-
throw new Error("Project v2 deserializer requires a string");
|
|
1785
|
-
}
|
|
1786
|
-
const project = yaml2.parse(data);
|
|
1819
|
+
const project = unwrapV2Envelope(data, "Project v2");
|
|
1787
1820
|
if (project.version !== 2) {
|
|
1788
1821
|
throw new Error("Project v2 deserializer requires a version 2 project");
|
|
1789
1822
|
}
|
|
@@ -1791,15 +1824,18 @@ function projectV2Deserializer(data) {
|
|
|
1791
1824
|
return project.data;
|
|
1792
1825
|
}
|
|
1793
1826
|
function graphV2Deserializer(data) {
|
|
1794
|
-
|
|
1795
|
-
throw new Error("Graph v2 deserializer requires a string");
|
|
1796
|
-
}
|
|
1797
|
-
const graph = yaml2.parse(data);
|
|
1827
|
+
const graph = unwrapV2Envelope(data, "Graph v2");
|
|
1798
1828
|
if (graph.version !== 2) {
|
|
1799
1829
|
throw new Error("Graph v2 deserializer requires a version 2 graph");
|
|
1800
1830
|
}
|
|
1801
1831
|
return graph.data;
|
|
1802
1832
|
}
|
|
1833
|
+
function unwrapV2Envelope(data, label) {
|
|
1834
|
+
if (typeof data !== "string" && (!data || typeof data !== "object" || Array.isArray(data))) {
|
|
1835
|
+
throw new Error(`${label} deserializer requires a string`);
|
|
1836
|
+
}
|
|
1837
|
+
return typeof data === "string" ? yaml2.parse(data) : data;
|
|
1838
|
+
}
|
|
1803
1839
|
|
|
1804
1840
|
// src/utils/serialization/serialization_v1.ts
|
|
1805
1841
|
function projectV1Deserializer(data) {
|
|
@@ -1828,9 +1864,9 @@ function serializeProject(project, attachedData) {
|
|
|
1828
1864
|
var errMessage = (err) => `${getError(err).message}
|
|
1829
1865
|
${getError(err).stack}`;
|
|
1830
1866
|
function deserializeProject(serializedProject, path = null) {
|
|
1831
|
-
const version =
|
|
1867
|
+
const { deserializerInput, version } = prepareSerializedInput(serializedProject);
|
|
1832
1868
|
try {
|
|
1833
|
-
const result = deserializeProjectByVersion(
|
|
1869
|
+
const result = deserializeProjectByVersion(deserializerInput, version);
|
|
1834
1870
|
normalizeProjectDefaultNodeTitles(result[0]);
|
|
1835
1871
|
if (path !== null) {
|
|
1836
1872
|
result[0].metadata.path = path;
|
|
@@ -1848,9 +1884,9 @@ function serializeGraph(graph) {
|
|
|
1848
1884
|
return graphV4Serializer(graph);
|
|
1849
1885
|
}
|
|
1850
1886
|
function deserializeGraph(serializedGraph) {
|
|
1851
|
-
const version =
|
|
1887
|
+
const { deserializerInput, version } = prepareSerializedInput(serializedGraph);
|
|
1852
1888
|
try {
|
|
1853
|
-
const graph = deserializeGraphByVersion(
|
|
1889
|
+
const graph = deserializeGraphByVersion(deserializerInput, version);
|
|
1854
1890
|
normalizeGraphDefaultNodeTitles(graph);
|
|
1855
1891
|
return graph;
|
|
1856
1892
|
} catch (err) {
|
|
@@ -2262,7 +2298,8 @@ function findStronglyConnectedComponents(nodes, getAdjacentNodes) {
|
|
|
2262
2298
|
// src/model/GraphPreprocessor.ts
|
|
2263
2299
|
function preprocessGraphState(options2) {
|
|
2264
2300
|
var _a, _b;
|
|
2265
|
-
const { buildExecutionPlan, graph, loadedProjects, project, registry, warnOnInvalidGraph } = options2;
|
|
2301
|
+
const { buildExecutionPlan, definitionContext, graph, loadedProjects, project, registry, warnOnInvalidGraph } = options2;
|
|
2302
|
+
const effectiveDefinitionContext = definitionContext && graph.nodes.some(usesGraphBoundaryDefinitionContext) ? definitionContext : void 0;
|
|
2266
2303
|
const nodeInstances = {};
|
|
2267
2304
|
const nodesById = {};
|
|
2268
2305
|
const connections = {};
|
|
@@ -2296,6 +2333,7 @@ function preprocessGraphState(options2) {
|
|
|
2296
2333
|
nodeInstances,
|
|
2297
2334
|
nodesById,
|
|
2298
2335
|
project,
|
|
2336
|
+
definitionContext: effectiveDefinitionContext,
|
|
2299
2337
|
warnOnInvalidGraph
|
|
2300
2338
|
});
|
|
2301
2339
|
const stronglyConnectedComponents = findStronglyConnectedComponents(graph.nodes, (node) => {
|
|
@@ -2334,6 +2372,7 @@ function toReusableGraphExecutionPlan(preprocessedGraph) {
|
|
|
2334
2372
|
cycleIndexByNode: preprocessedGraph.cycleIndexByNode,
|
|
2335
2373
|
definitions: preprocessedGraph.definitions,
|
|
2336
2374
|
graphNodes: preprocessedGraph.graphNodes,
|
|
2375
|
+
nodeIds: preprocessedGraph.nodeIds,
|
|
2337
2376
|
inputConnectionByNodeAndPort: preprocessedGraph.inputConnectionByNodeAndPort,
|
|
2338
2377
|
inputConnectionsByNode: preprocessedGraph.inputConnectionsByNode,
|
|
2339
2378
|
inputNodesByNode: preprocessedGraph.inputNodesByNode,
|
|
@@ -2347,62 +2386,140 @@ function toReusableGraphExecutionPlan(preprocessedGraph) {
|
|
|
2347
2386
|
};
|
|
2348
2387
|
}
|
|
2349
2388
|
function loadInputOutputDefinitions(options2) {
|
|
2350
|
-
const { connections, loadedProjects, nodeInstances, nodesById, project, warnOnInvalidGraph } = options2;
|
|
2389
|
+
const { connections, definitionContext, loadedProjects, nodeInstances, nodesById, project, warnOnInvalidGraph } = options2;
|
|
2351
2390
|
const definitions = {};
|
|
2391
|
+
if (!definitionContext) {
|
|
2392
|
+
for (const node of values(nodesById)) {
|
|
2393
|
+
const connectionsForNode = connections[node.id] ?? [];
|
|
2394
|
+
const inputDefinitions = nodeInstances[node.id].getInputDefinitionsIncludingBuiltIn(
|
|
2395
|
+
connectionsForNode,
|
|
2396
|
+
nodesById,
|
|
2397
|
+
project,
|
|
2398
|
+
loadedProjects
|
|
2399
|
+
);
|
|
2400
|
+
const outputDefinitions = nodeInstances[node.id].getOutputDefinitions(
|
|
2401
|
+
connectionsForNode,
|
|
2402
|
+
nodesById,
|
|
2403
|
+
project,
|
|
2404
|
+
loadedProjects
|
|
2405
|
+
);
|
|
2406
|
+
definitions[node.id] = {
|
|
2407
|
+
inputs: inputDefinitions,
|
|
2408
|
+
outputs: outputDefinitions
|
|
2409
|
+
};
|
|
2410
|
+
const invalidConnections = connectionsForNode.filter((connection) => {
|
|
2411
|
+
if (connection.inputNodeId === node.id) {
|
|
2412
|
+
const inputDefinition = inputDefinitions.find((definition) => definition.id === connection.inputId);
|
|
2413
|
+
if (!inputDefinition) {
|
|
2414
|
+
if (warnOnInvalidGraph) {
|
|
2415
|
+
const sourceNode = nodesById[connection.outputNodeId];
|
|
2416
|
+
console.warn(
|
|
2417
|
+
`[Warn] Invalid connection going from "${sourceNode == null ? void 0 : sourceNode.title}".${connection.outputId} to "${node.title}".${connection.inputId}`
|
|
2418
|
+
);
|
|
2419
|
+
}
|
|
2420
|
+
return true;
|
|
2421
|
+
}
|
|
2422
|
+
} else {
|
|
2423
|
+
const outputDefinition = outputDefinitions.find((definition) => definition.id === connection.outputId);
|
|
2424
|
+
if (!outputDefinition) {
|
|
2425
|
+
if (warnOnInvalidGraph) {
|
|
2426
|
+
const targetNode = nodesById[connection.inputNodeId];
|
|
2427
|
+
console.warn(
|
|
2428
|
+
`[Warn] Invalid connection going from "${node.title}".${connection.outputId} to "${targetNode == null ? void 0 : targetNode.title}".${connection.inputId}`
|
|
2429
|
+
);
|
|
2430
|
+
}
|
|
2431
|
+
return true;
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
return false;
|
|
2435
|
+
});
|
|
2436
|
+
if (invalidConnections.length > 0) {
|
|
2437
|
+
for (const invalidConnection of invalidConnections) {
|
|
2438
|
+
removeConnectionFromNode(connections, invalidConnection, invalidConnection.inputNodeId);
|
|
2439
|
+
if (invalidConnection.outputNodeId !== invalidConnection.inputNodeId) {
|
|
2440
|
+
removeConnectionFromNode(connections, invalidConnection, invalidConnection.outputNodeId);
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
return definitions;
|
|
2446
|
+
}
|
|
2352
2447
|
for (const node of values(nodesById)) {
|
|
2353
2448
|
const connectionsForNode = connections[node.id] ?? [];
|
|
2354
|
-
const
|
|
2449
|
+
const nodeDefinitionContext = usesGraphBoundaryDefinitionContext(node) ? definitionContext : void 0;
|
|
2450
|
+
const inputDefinitions = nodeDefinitionContext ? nodeInstances[node.id].getInputDefinitionsIncludingBuiltIn(
|
|
2355
2451
|
connectionsForNode,
|
|
2356
2452
|
nodesById,
|
|
2357
2453
|
project,
|
|
2358
|
-
loadedProjects
|
|
2359
|
-
|
|
2360
|
-
|
|
2454
|
+
loadedProjects,
|
|
2455
|
+
nodeDefinitionContext
|
|
2456
|
+
) : nodeInstances[node.id].getInputDefinitionsIncludingBuiltIn(
|
|
2361
2457
|
connectionsForNode,
|
|
2362
2458
|
nodesById,
|
|
2363
2459
|
project,
|
|
2364
2460
|
loadedProjects
|
|
2365
2461
|
);
|
|
2462
|
+
const outputDefinitions = nodeDefinitionContext ? nodeInstances[node.id].getOutputDefinitions(
|
|
2463
|
+
connectionsForNode,
|
|
2464
|
+
nodesById,
|
|
2465
|
+
project,
|
|
2466
|
+
loadedProjects,
|
|
2467
|
+
nodeDefinitionContext
|
|
2468
|
+
) : nodeInstances[node.id].getOutputDefinitions(connectionsForNode, nodesById, project, loadedProjects);
|
|
2366
2469
|
definitions[node.id] = {
|
|
2367
2470
|
inputs: inputDefinitions,
|
|
2368
2471
|
outputs: outputDefinitions
|
|
2369
2472
|
};
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2473
|
+
removeInvalidDefinitionConnections(
|
|
2474
|
+
connections,
|
|
2475
|
+
connectionsForNode,
|
|
2476
|
+
inputDefinitions,
|
|
2477
|
+
node,
|
|
2478
|
+
nodesById,
|
|
2479
|
+
outputDefinitions,
|
|
2480
|
+
warnOnInvalidGraph
|
|
2481
|
+
);
|
|
2482
|
+
}
|
|
2483
|
+
return definitions;
|
|
2484
|
+
}
|
|
2485
|
+
function removeInvalidDefinitionConnections(connections, connectionsForNode, inputDefinitions, node, nodesById, outputDefinitions, warnOnInvalidGraph) {
|
|
2486
|
+
const invalidConnections = connectionsForNode.filter((connection) => {
|
|
2487
|
+
if (connection.inputNodeId === node.id) {
|
|
2488
|
+
const inputDefinition = inputDefinitions.find((definition) => definition.id === connection.inputId);
|
|
2489
|
+
if (!inputDefinition) {
|
|
2490
|
+
if (warnOnInvalidGraph) {
|
|
2491
|
+
const sourceNode = nodesById[connection.outputNodeId];
|
|
2492
|
+
console.warn(
|
|
2493
|
+
`[Warn] Invalid connection going from "${sourceNode == null ? void 0 : sourceNode.title}".${connection.outputId} to "${node.title}".${connection.inputId}`
|
|
2494
|
+
);
|
|
2392
2495
|
}
|
|
2496
|
+
return true;
|
|
2393
2497
|
}
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2498
|
+
} else {
|
|
2499
|
+
const outputDefinition = outputDefinitions.find((definition) => definition.id === connection.outputId);
|
|
2500
|
+
if (!outputDefinition) {
|
|
2501
|
+
if (warnOnInvalidGraph) {
|
|
2502
|
+
const targetNode = nodesById[connection.inputNodeId];
|
|
2503
|
+
console.warn(
|
|
2504
|
+
`[Warn] Invalid connection going from "${node.title}".${connection.outputId} to "${targetNode == null ? void 0 : targetNode.title}".${connection.inputId}`
|
|
2505
|
+
);
|
|
2401
2506
|
}
|
|
2507
|
+
return true;
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
return false;
|
|
2511
|
+
});
|
|
2512
|
+
if (invalidConnections.length > 0) {
|
|
2513
|
+
for (const invalidConnection of invalidConnections) {
|
|
2514
|
+
removeConnectionFromNode(connections, invalidConnection, invalidConnection.inputNodeId);
|
|
2515
|
+
if (invalidConnection.outputNodeId !== invalidConnection.inputNodeId) {
|
|
2516
|
+
removeConnectionFromNode(connections, invalidConnection, invalidConnection.outputNodeId);
|
|
2402
2517
|
}
|
|
2403
2518
|
}
|
|
2404
2519
|
}
|
|
2405
|
-
|
|
2520
|
+
}
|
|
2521
|
+
function usesGraphBoundaryDefinitionContext(node) {
|
|
2522
|
+
return node.type === "subGraph" || node.type === "referencedGraphAlias" || node.type === "loopUntil";
|
|
2406
2523
|
}
|
|
2407
2524
|
function removeConnectionFromNode(connections, connection, nodeId) {
|
|
2408
2525
|
const nodeConnections = connections[nodeId];
|
|
@@ -2489,6 +2606,7 @@ function buildGraphExecutionPlan(options2) {
|
|
|
2489
2606
|
return {
|
|
2490
2607
|
cycleIndexByNode,
|
|
2491
2608
|
graphNodes,
|
|
2609
|
+
nodeIds: graphNodes.map((node) => node.id),
|
|
2492
2610
|
inputConnectionByNodeAndPort,
|
|
2493
2611
|
inputConnectionsByNode,
|
|
2494
2612
|
inputNodesByNode,
|
|
@@ -2502,6 +2620,99 @@ function buildGraphExecutionPlan(options2) {
|
|
|
2502
2620
|
};
|
|
2503
2621
|
}
|
|
2504
2622
|
|
|
2623
|
+
// src/model/GraphBoundaryCache.ts
|
|
2624
|
+
function getGraphBoundary(project, graphId, cache4) {
|
|
2625
|
+
if (!graphId) {
|
|
2626
|
+
return void 0;
|
|
2627
|
+
}
|
|
2628
|
+
const graph = project.graphs[graphId];
|
|
2629
|
+
if (!graph) {
|
|
2630
|
+
return void 0;
|
|
2631
|
+
}
|
|
2632
|
+
if (!cache4) {
|
|
2633
|
+
return deriveGraphBoundary(graph);
|
|
2634
|
+
}
|
|
2635
|
+
const cached = cache4.get(graph);
|
|
2636
|
+
if (cached) {
|
|
2637
|
+
return cached;
|
|
2638
|
+
}
|
|
2639
|
+
const boundary = deriveGraphBoundary(graph);
|
|
2640
|
+
cache4.set(graph, boundary);
|
|
2641
|
+
return boundary;
|
|
2642
|
+
}
|
|
2643
|
+
function getGraphBoundaryInputDefinitions(boundary) {
|
|
2644
|
+
return boundary.inputs.map(
|
|
2645
|
+
(input) => ({
|
|
2646
|
+
id: input.portId,
|
|
2647
|
+
title: input.id,
|
|
2648
|
+
dataType: input.dataType
|
|
2649
|
+
})
|
|
2650
|
+
);
|
|
2651
|
+
}
|
|
2652
|
+
function getGraphBoundaryOutputDefinitions(boundary) {
|
|
2653
|
+
return boundary.outputs.map(
|
|
2654
|
+
(output) => ({
|
|
2655
|
+
id: output.portId,
|
|
2656
|
+
title: output.id,
|
|
2657
|
+
dataType: output.dataType
|
|
2658
|
+
})
|
|
2659
|
+
);
|
|
2660
|
+
}
|
|
2661
|
+
function buildGraphBoundaryInputData(boundary, inputs, defaults) {
|
|
2662
|
+
const inputData = {};
|
|
2663
|
+
for (const input of boundary.inputs) {
|
|
2664
|
+
const inputValue = inputs[input.portId];
|
|
2665
|
+
if (inputValue != null) {
|
|
2666
|
+
inputData[input.portId] = inputValue;
|
|
2667
|
+
continue;
|
|
2668
|
+
}
|
|
2669
|
+
const defaultValue = defaults == null ? void 0 : defaults[input.id];
|
|
2670
|
+
if (defaultValue != null) {
|
|
2671
|
+
inputData[input.portId] = defaultValue;
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
return inputData;
|
|
2675
|
+
}
|
|
2676
|
+
function buildExcludedGraphBoundaryOutputs(boundary) {
|
|
2677
|
+
const outputs = {};
|
|
2678
|
+
for (const output of boundary.outputs) {
|
|
2679
|
+
outputs[output.portId] = {
|
|
2680
|
+
type: "control-flow-excluded",
|
|
2681
|
+
value: void 0
|
|
2682
|
+
};
|
|
2683
|
+
}
|
|
2684
|
+
return outputs;
|
|
2685
|
+
}
|
|
2686
|
+
function deriveGraphBoundary(graph) {
|
|
2687
|
+
const inputsById = /* @__PURE__ */ new Map();
|
|
2688
|
+
const outputsById = /* @__PURE__ */ new Map();
|
|
2689
|
+
for (const node of graph.nodes) {
|
|
2690
|
+
if (node.type === "graphInput" && !inputsById.has(getBoundaryNodeId(node))) {
|
|
2691
|
+
const inputNode = node;
|
|
2692
|
+
inputsById.set(inputNode.data.id, {
|
|
2693
|
+
dataType: inputNode.data.dataType,
|
|
2694
|
+
editor: inputNode.data.editor,
|
|
2695
|
+
id: inputNode.data.id,
|
|
2696
|
+
portId: inputNode.data.id
|
|
2697
|
+
});
|
|
2698
|
+
} else if (node.type === "graphOutput" && !outputsById.has(getBoundaryNodeId(node))) {
|
|
2699
|
+
const outputNode = node;
|
|
2700
|
+
outputsById.set(outputNode.data.id, {
|
|
2701
|
+
dataType: outputNode.data.dataType,
|
|
2702
|
+
id: outputNode.data.id,
|
|
2703
|
+
portId: outputNode.data.id
|
|
2704
|
+
});
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
return {
|
|
2708
|
+
inputs: Array.from(inputsById.keys()).sort().map((id) => inputsById.get(id)),
|
|
2709
|
+
outputs: Array.from(outputsById.keys()).sort().map((id) => outputsById.get(id))
|
|
2710
|
+
};
|
|
2711
|
+
}
|
|
2712
|
+
function getBoundaryNodeId(node) {
|
|
2713
|
+
return node.data.id;
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2505
2716
|
// src/model/RecordingPlayer.ts
|
|
2506
2717
|
var import_non_secure3 = require("nanoid/non-secure");
|
|
2507
2718
|
|
|
@@ -2511,6 +2722,13 @@ function emitDetached(emitter, event, data) {
|
|
|
2511
2722
|
}
|
|
2512
2723
|
|
|
2513
2724
|
// src/model/RecordingPlayer.ts
|
|
2725
|
+
function withOptionalDuration(payload, durationMs, splitRunDurationMs) {
|
|
2726
|
+
return {
|
|
2727
|
+
...payload,
|
|
2728
|
+
...durationMs === void 0 ? {} : { durationMs },
|
|
2729
|
+
...splitRunDurationMs === void 0 ? {} : { splitRunDurationMs }
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2514
2732
|
async function replayExecutionRecording(options2) {
|
|
2515
2733
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2516
2734
|
const {
|
|
@@ -2562,6 +2780,7 @@ async function replayExecutionRecording(options2) {
|
|
|
2562
2780
|
try {
|
|
2563
2781
|
const legacyRootRunId = (0, import_non_secure3.nanoid)();
|
|
2564
2782
|
const legacyGraphRunsByGraphId = /* @__PURE__ */ new Map();
|
|
2783
|
+
const nodeStartTimestamps = /* @__PURE__ */ new Map();
|
|
2565
2784
|
const getExecution = (graphId, recordedExecution) => {
|
|
2566
2785
|
if (recordedExecution) {
|
|
2567
2786
|
return recordedExecution;
|
|
@@ -2577,6 +2796,14 @@ async function replayExecutionRecording(options2) {
|
|
|
2577
2796
|
rootRunId: legacyRootRunId
|
|
2578
2797
|
};
|
|
2579
2798
|
};
|
|
2799
|
+
const getNodeRunKey = (execution, nodeId, processId) => `${execution.rootRunId}:${execution.graphRunId}:${nodeId}:${processId}`;
|
|
2800
|
+
const getRecordedDuration = (recordedDuration, execution, nodeId, processId, terminalTs) => {
|
|
2801
|
+
if (recordedDuration !== void 0) {
|
|
2802
|
+
return recordedDuration;
|
|
2803
|
+
}
|
|
2804
|
+
const startedAt = nodeStartTimestamps.get(getNodeRunKey(execution, nodeId, processId));
|
|
2805
|
+
return startedAt === void 0 ? void 0 : Math.max(0, terminalTs - startedAt);
|
|
2806
|
+
};
|
|
2580
2807
|
for (const event of recorder.events) {
|
|
2581
2808
|
if (isAborted()) {
|
|
2582
2809
|
break;
|
|
@@ -2668,11 +2895,13 @@ async function replayExecutionRecording(options2) {
|
|
|
2668
2895
|
case "nodeStart": {
|
|
2669
2896
|
const { data } = event;
|
|
2670
2897
|
const node = getNode(data.nodeId);
|
|
2898
|
+
const execution = getExecution(((_b = data.execution) == null ? void 0 : _b.graphId) ?? getGraphIdForNode(data.nodeId), data.execution);
|
|
2899
|
+
nodeStartTimestamps.set(getNodeRunKey(execution, data.nodeId, data.processId), event.ts);
|
|
2671
2900
|
emitDetached(emitter, "nodeStart", {
|
|
2672
2901
|
node,
|
|
2673
2902
|
inputs: data.inputs,
|
|
2674
2903
|
processId: data.processId,
|
|
2675
|
-
execution
|
|
2904
|
+
execution
|
|
2676
2905
|
});
|
|
2677
2906
|
if (node.type === "chat") {
|
|
2678
2907
|
await new Promise((resolve) => setTimeout(resolve, recordingPlaybackChatLatency));
|
|
@@ -2682,12 +2911,21 @@ async function replayExecutionRecording(options2) {
|
|
|
2682
2911
|
case "nodeFinish": {
|
|
2683
2912
|
const { data } = event;
|
|
2684
2913
|
const node = getNode(data.nodeId);
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2914
|
+
const execution = getExecution(((_c = data.execution) == null ? void 0 : _c.graphId) ?? getGraphIdForNode(data.nodeId), data.execution);
|
|
2915
|
+
emitDetached(
|
|
2916
|
+
emitter,
|
|
2917
|
+
"nodeFinish",
|
|
2918
|
+
withOptionalDuration(
|
|
2919
|
+
{
|
|
2920
|
+
node,
|
|
2921
|
+
outputs: data.outputs,
|
|
2922
|
+
processId: data.processId,
|
|
2923
|
+
execution
|
|
2924
|
+
},
|
|
2925
|
+
getRecordedDuration(data.durationMs, execution, data.nodeId, data.processId, event.ts),
|
|
2926
|
+
data.splitRunDurationMs
|
|
2927
|
+
)
|
|
2928
|
+
);
|
|
2691
2929
|
nodeResults.set(data.nodeId, data.outputs);
|
|
2692
2930
|
visitedNodes.add(data.nodeId);
|
|
2693
2931
|
break;
|
|
@@ -2695,12 +2933,21 @@ async function replayExecutionRecording(options2) {
|
|
|
2695
2933
|
case "nodeError": {
|
|
2696
2934
|
const { data } = event;
|
|
2697
2935
|
const node = getNode(data.nodeId);
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2936
|
+
const execution = getExecution(((_d = data.execution) == null ? void 0 : _d.graphId) ?? getGraphIdForNode(data.nodeId), data.execution);
|
|
2937
|
+
emitDetached(
|
|
2938
|
+
emitter,
|
|
2939
|
+
"nodeError",
|
|
2940
|
+
withOptionalDuration(
|
|
2941
|
+
{
|
|
2942
|
+
node,
|
|
2943
|
+
error: data.error,
|
|
2944
|
+
processId: data.processId,
|
|
2945
|
+
execution
|
|
2946
|
+
},
|
|
2947
|
+
getRecordedDuration(data.durationMs, execution, data.nodeId, data.processId, event.ts),
|
|
2948
|
+
data.splitRunDurationMs
|
|
2949
|
+
)
|
|
2950
|
+
);
|
|
2704
2951
|
erroredNodes.set(data.nodeId, data.error);
|
|
2705
2952
|
visitedNodes.add(data.nodeId);
|
|
2706
2953
|
break;
|
|
@@ -2802,69 +3049,113 @@ function didLoopControllerBreak(breakValue) {
|
|
|
2802
3049
|
function buildNodeProcessContext(options2) {
|
|
2803
3050
|
const {
|
|
2804
3051
|
attachedData,
|
|
2805
|
-
|
|
2806
|
-
context,
|
|
2807
|
-
contextValues,
|
|
3052
|
+
base,
|
|
2808
3053
|
createSubProcessor,
|
|
2809
3054
|
execution,
|
|
2810
|
-
executionCache,
|
|
2811
|
-
executor,
|
|
2812
3055
|
externalFunctions,
|
|
2813
|
-
getGlobal,
|
|
2814
3056
|
getPluginConfig: getPluginConfig2,
|
|
2815
|
-
graphInputNodeValues,
|
|
2816
|
-
graphInputs,
|
|
2817
|
-
graphOutputs,
|
|
2818
|
-
loadedProjects,
|
|
2819
3057
|
node,
|
|
2820
3058
|
nodeAbortController,
|
|
2821
3059
|
onPartialOutputs,
|
|
2822
3060
|
processId,
|
|
2823
|
-
project,
|
|
2824
|
-
raiseEvent,
|
|
2825
3061
|
requestUserInput,
|
|
2826
3062
|
setGlobal,
|
|
2827
|
-
|
|
2828
|
-
trace,
|
|
2829
|
-
waitEvent,
|
|
2830
|
-
waitForGlobal,
|
|
2831
|
-
abortGraph
|
|
3063
|
+
waitEvent
|
|
2832
3064
|
} = options2;
|
|
2833
3065
|
return {
|
|
2834
|
-
...
|
|
3066
|
+
...base,
|
|
2835
3067
|
node,
|
|
2836
|
-
tokenizer,
|
|
2837
|
-
executor,
|
|
2838
|
-
project,
|
|
2839
|
-
executionCache,
|
|
2840
|
-
graphInputs,
|
|
2841
|
-
graphOutputs,
|
|
2842
3068
|
attachedData,
|
|
2843
|
-
codeRunner,
|
|
2844
|
-
referencedProjects: loadedProjects,
|
|
2845
3069
|
waitEvent,
|
|
2846
|
-
raiseEvent,
|
|
2847
|
-
contextValues,
|
|
2848
3070
|
externalFunctions: { ...externalFunctions },
|
|
2849
3071
|
onPartialOutputs,
|
|
2850
3072
|
signal: nodeAbortController.signal,
|
|
2851
3073
|
processId,
|
|
2852
|
-
getGlobal,
|
|
2853
3074
|
setGlobal,
|
|
2854
|
-
waitForGlobal,
|
|
2855
3075
|
createSubProcessor,
|
|
2856
|
-
trace,
|
|
2857
|
-
abortGraph,
|
|
2858
3076
|
getPluginConfig: getPluginConfig2,
|
|
2859
3077
|
requestUserInput,
|
|
2860
|
-
graphInputNodeValues,
|
|
2861
3078
|
execution
|
|
2862
3079
|
};
|
|
2863
3080
|
}
|
|
2864
3081
|
|
|
2865
3082
|
// src/model/SplitRunProcessor.ts
|
|
2866
3083
|
var import_lodash_es3 = require("lodash");
|
|
3084
|
+
|
|
3085
|
+
// src/model/GraphAbortReasons.ts
|
|
3086
|
+
var RACE_LOSER_EXCLUSION_REASON = "Race branch lost";
|
|
3087
|
+
var SUCCESSFUL_GRAPH_ABORT_EXCLUSION_REASON = "Graph aborted successfully";
|
|
3088
|
+
var GRAPH_ABORT_ERROR_MARKER = "rivet:graph-abort-error";
|
|
3089
|
+
var GRAPH_ABORT_REASON_MARKER = "rivet:graph-abort-reason";
|
|
3090
|
+
function createGraphAbortReason(successful, error) {
|
|
3091
|
+
return {
|
|
3092
|
+
error,
|
|
3093
|
+
marker: GRAPH_ABORT_REASON_MARKER,
|
|
3094
|
+
successful
|
|
3095
|
+
};
|
|
3096
|
+
}
|
|
3097
|
+
function createGraphAbortError(reason, message = "Processing aborted") {
|
|
3098
|
+
const error = new Error(message);
|
|
3099
|
+
Object.defineProperties(error, {
|
|
3100
|
+
graphAbortReason: {
|
|
3101
|
+
configurable: true,
|
|
3102
|
+
value: reason
|
|
3103
|
+
},
|
|
3104
|
+
marker: {
|
|
3105
|
+
configurable: true,
|
|
3106
|
+
value: GRAPH_ABORT_ERROR_MARKER
|
|
3107
|
+
}
|
|
3108
|
+
});
|
|
3109
|
+
return error;
|
|
3110
|
+
}
|
|
3111
|
+
function createGraphAbortErrorFromSignal(signal, message = "Processing aborted") {
|
|
3112
|
+
return createGraphAbortError(getGraphAbortReasonFromSignal(signal), message);
|
|
3113
|
+
}
|
|
3114
|
+
function getAbortSignalReason(signal) {
|
|
3115
|
+
return signal ? signal.reason : void 0;
|
|
3116
|
+
}
|
|
3117
|
+
function getGraphAbortReasonFromSignal(signal) {
|
|
3118
|
+
return getGraphAbortReason(getAbortSignalReason(signal));
|
|
3119
|
+
}
|
|
3120
|
+
function getGraphAbortReasonFromError(error) {
|
|
3121
|
+
if (!isGraphAbortError(error)) {
|
|
3122
|
+
return void 0;
|
|
3123
|
+
}
|
|
3124
|
+
return error.graphAbortReason;
|
|
3125
|
+
}
|
|
3126
|
+
function isRaceLoserGraphAbortReason(reason) {
|
|
3127
|
+
return (reason == null ? void 0 : reason.successful) === true && reason.error === RACE_LOSER_EXCLUSION_REASON;
|
|
3128
|
+
}
|
|
3129
|
+
function isSuccessfulNonRaceGraphAbortReason(reason) {
|
|
3130
|
+
return (reason == null ? void 0 : reason.successful) === true && !isRaceLoserGraphAbortReason(reason);
|
|
3131
|
+
}
|
|
3132
|
+
function isAbortLikeError(error) {
|
|
3133
|
+
const normalized = `${error.name}: ${error.message}`.trim();
|
|
3134
|
+
return /^(Error:\s*)?(Aborted|Processing aborted|Process aborted)\.?$/i.test(error.message.trim()) || /^AbortError\b/i.test(normalized) || /\boperation was aborted\.?$/i.test(error.message.trim());
|
|
3135
|
+
}
|
|
3136
|
+
function getGraphAbortReason(reason) {
|
|
3137
|
+
if (!isGraphAbortReason(reason)) {
|
|
3138
|
+
return void 0;
|
|
3139
|
+
}
|
|
3140
|
+
return reason;
|
|
3141
|
+
}
|
|
3142
|
+
function isGraphAbortReason(reason) {
|
|
3143
|
+
return typeof reason === "object" && reason != null && reason.marker === GRAPH_ABORT_REASON_MARKER && typeof reason.successful === "boolean";
|
|
3144
|
+
}
|
|
3145
|
+
function isGraphAbortError(error) {
|
|
3146
|
+
return typeof error === "object" && error != null && error.marker === GRAPH_ABORT_ERROR_MARKER;
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
// src/model/SplitRunProcessor.ts
|
|
3150
|
+
function withOptionalDuration2(payload, durationMs, splitRunDurationMs) {
|
|
3151
|
+
return {
|
|
3152
|
+
...payload,
|
|
3153
|
+
...durationMs === void 0 ? {} : { durationMs },
|
|
3154
|
+
...splitRunDurationMs === void 0 ? {} : { splitRunDurationMs }
|
|
3155
|
+
};
|
|
3156
|
+
}
|
|
2867
3157
|
async function processSplitRunNode(node, processId, deps) {
|
|
3158
|
+
var _a, _b, _c;
|
|
2868
3159
|
const inputValues = deps.getInputValues(node);
|
|
2869
3160
|
if (deps.isExcludedDueToControlFlow(node, inputValues, processId)) {
|
|
2870
3161
|
return;
|
|
@@ -2873,7 +3164,9 @@ async function processSplitRunNode(node, processId, deps) {
|
|
|
2873
3164
|
(0, import_lodash_es3.max)(values(inputValues).map((value) => Array.isArray(value == null ? void 0 : value.value) ? value == null ? void 0 : value.value.length : 1)) ?? 1,
|
|
2874
3165
|
node.splitRunMax ?? 10
|
|
2875
3166
|
);
|
|
2876
|
-
deps.emit("nodeStart", { node, inputs: inputValues, processId });
|
|
3167
|
+
await deps.emit("nodeStart", { node, inputs: inputValues, processId });
|
|
3168
|
+
const timingStart = (_a = deps.startNodeTiming) == null ? void 0 : _a.call(deps);
|
|
3169
|
+
let splitRunDurationMs;
|
|
2877
3170
|
try {
|
|
2878
3171
|
let results;
|
|
2879
3172
|
if (node.isSplitSequential) {
|
|
@@ -2881,35 +3174,52 @@ async function processSplitRunNode(node, processId, deps) {
|
|
|
2881
3174
|
} else {
|
|
2882
3175
|
results = await runParallel(node, inputValues, splittingAmount, processId, deps);
|
|
2883
3176
|
}
|
|
3177
|
+
splitRunDurationMs = getSplitRunDurationMs(results);
|
|
2884
3178
|
const errors = results.filter((r) => r.type === "error").map((r) => r.error);
|
|
2885
3179
|
if (errors.length === 1) {
|
|
2886
3180
|
throw errors[0];
|
|
2887
3181
|
} else if (errors.length > 0) {
|
|
3182
|
+
if (deps.isAborted() && errors.every(isGraphAbortOrAbortLikeError)) {
|
|
3183
|
+
throw deps.getAbortError();
|
|
3184
|
+
}
|
|
2888
3185
|
throw new AggregateError(errors);
|
|
2889
3186
|
}
|
|
2890
3187
|
const aggregateResults = aggregateOutputs(results);
|
|
2891
3188
|
deps.setNodeResults(node.id, aggregateResults);
|
|
2892
3189
|
deps.markNodeVisited(node.id);
|
|
2893
|
-
deps.emit(
|
|
3190
|
+
await deps.emit(
|
|
3191
|
+
"nodeFinish",
|
|
3192
|
+
withOptionalDuration2(
|
|
3193
|
+
{
|
|
3194
|
+
node,
|
|
3195
|
+
outputs: aggregateResults,
|
|
3196
|
+
processId
|
|
3197
|
+
},
|
|
3198
|
+
(_b = deps.finishNodeTiming) == null ? void 0 : _b.call(deps, timingStart),
|
|
3199
|
+
splitRunDurationMs
|
|
3200
|
+
)
|
|
3201
|
+
);
|
|
2894
3202
|
} catch (error) {
|
|
2895
|
-
deps.nodeErrored(node, error, processId);
|
|
3203
|
+
await deps.nodeErrored(node, error, processId, (_c = deps.finishNodeTiming) == null ? void 0 : _c.call(deps, timingStart), splitRunDurationMs);
|
|
2896
3204
|
}
|
|
2897
3205
|
}
|
|
2898
3206
|
async function runSequential(node, inputValues, splittingAmount, processId, deps) {
|
|
3207
|
+
var _a, _b, _c;
|
|
2899
3208
|
const results = [];
|
|
2900
3209
|
for (let i = 0; i < splittingAmount; i++) {
|
|
2901
3210
|
if (deps.isAborted()) {
|
|
2902
|
-
throw
|
|
3211
|
+
throw deps.getAbortError();
|
|
2903
3212
|
}
|
|
2904
3213
|
const inputs = splitInputsAtIndex(inputValues, i);
|
|
3214
|
+
const splitTimingStart = (_a = deps.startNodeTiming) == null ? void 0 : _a.call(deps);
|
|
2905
3215
|
try {
|
|
2906
3216
|
const output = await deps.processNodeWithInputData(node, inputs, i, processId, (n, partialOutputs, index) => {
|
|
2907
3217
|
deps.emit("partialOutput", { node: n, outputs: partialOutputs, index, processId });
|
|
2908
3218
|
});
|
|
2909
3219
|
deps.accumulateCost(output);
|
|
2910
|
-
results.push({ type: "output", output });
|
|
3220
|
+
results.push({ type: "output", output, durationMs: (_b = deps.finishNodeTiming) == null ? void 0 : _b.call(deps, splitTimingStart) });
|
|
2911
3221
|
} catch (error) {
|
|
2912
|
-
results.push({ type: "error", error: getError(error) });
|
|
3222
|
+
results.push({ type: "error", error: getError(error), durationMs: (_c = deps.finishNodeTiming) == null ? void 0 : _c.call(deps, splitTimingStart) });
|
|
2913
3223
|
}
|
|
2914
3224
|
}
|
|
2915
3225
|
return results;
|
|
@@ -2919,15 +3229,24 @@ async function runParallel(node, inputValues, splittingAmount, processId, deps)
|
|
|
2919
3229
|
return Promise.all(
|
|
2920
3230
|
(0, import_lodash_es3.range)(0, splittingAmount).map(async (i) => {
|
|
2921
3231
|
const result = await queue.add(async () => {
|
|
2922
|
-
|
|
3232
|
+
var _a, _b, _c;
|
|
3233
|
+
const splitTimingStart = (_a = deps.startNodeTiming) == null ? void 0 : _a.call(deps);
|
|
2923
3234
|
try {
|
|
3235
|
+
if (deps.isAborted()) {
|
|
3236
|
+
throw deps.getAbortError();
|
|
3237
|
+
}
|
|
3238
|
+
const inputs = splitInputsAtIndex(inputValues, i);
|
|
2924
3239
|
const output = await deps.processNodeWithInputData(node, inputs, i, processId, (n, partialOutputs, index) => {
|
|
2925
3240
|
deps.emit("partialOutput", { node: n, outputs: partialOutputs, index, processId });
|
|
2926
3241
|
});
|
|
2927
3242
|
deps.accumulateCost(output);
|
|
2928
|
-
return { type: "output", output };
|
|
3243
|
+
return { type: "output", output, durationMs: (_b = deps.finishNodeTiming) == null ? void 0 : _b.call(deps, splitTimingStart) };
|
|
2929
3244
|
} catch (error) {
|
|
2930
|
-
return {
|
|
3245
|
+
return {
|
|
3246
|
+
type: "error",
|
|
3247
|
+
error: getError(error),
|
|
3248
|
+
durationMs: (_c = deps.finishNodeTiming) == null ? void 0 : _c.call(deps, splitTimingStart)
|
|
3249
|
+
};
|
|
2931
3250
|
}
|
|
2932
3251
|
});
|
|
2933
3252
|
if (!result) {
|
|
@@ -2958,6 +3277,18 @@ function aggregateOutputs(results) {
|
|
|
2958
3277
|
return acc;
|
|
2959
3278
|
}, {});
|
|
2960
3279
|
}
|
|
3280
|
+
function getSplitRunDurationMs(results) {
|
|
3281
|
+
const durations = {};
|
|
3282
|
+
for (const [index, result] of results.entries()) {
|
|
3283
|
+
if (result.durationMs !== void 0) {
|
|
3284
|
+
durations[index] = result.durationMs;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
return Object.keys(durations).length > 0 ? durations : void 0;
|
|
3288
|
+
}
|
|
3289
|
+
function isGraphAbortOrAbortLikeError(error) {
|
|
3290
|
+
return getGraphAbortReasonFromError(error) != null || isAbortLikeError(error);
|
|
3291
|
+
}
|
|
2961
3292
|
|
|
2962
3293
|
// src/model/NodeExecutionPlanner.ts
|
|
2963
3294
|
function getStartNodes(state, graphNodes, runToNodeIds) {
|
|
@@ -3112,20 +3443,20 @@ function subscribeOwnGraphRunLifecycle(processor, onLifecycleEvent) {
|
|
|
3112
3443
|
};
|
|
3113
3444
|
}
|
|
3114
3445
|
function wireSubprocessorEvents(processor, parentEmitter, parentState) {
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3446
|
+
processor.on("nodeError", (event) => parentEmitter.emit("nodeError", event));
|
|
3447
|
+
processor.on("nodeFinish", (event) => parentEmitter.emit("nodeFinish", event));
|
|
3448
|
+
processor.on("partialOutput", (event) => parentEmitter.emit("partialOutput", event));
|
|
3449
|
+
processor.on("nodeExcluded", (event) => parentEmitter.emit("nodeExcluded", event));
|
|
3450
|
+
processor.on("nodeStart", (event) => parentEmitter.emit("nodeStart", event));
|
|
3451
|
+
processor.on("graphAbort", (event) => parentEmitter.emit("graphAbort", event));
|
|
3452
|
+
processor.on("graphError", (event) => parentEmitter.emit("graphError", event));
|
|
3453
|
+
processor.on("userInput", (event) => parentEmitter.emit("userInput", event));
|
|
3454
|
+
processor.on("graphStart", (event) => parentEmitter.emit("graphStart", event));
|
|
3455
|
+
processor.on("graphFinish", (event) => parentEmitter.emit("graphFinish", event));
|
|
3456
|
+
processor.on("nodeOutputsCleared", (event) => parentEmitter.emit("nodeOutputsCleared", event));
|
|
3457
|
+
processor.on("globalSet", (event) => parentEmitter.emit("globalSet", event));
|
|
3458
|
+
processor.on("newAbortController", (event) => parentEmitter.emit("newAbortController", event));
|
|
3459
|
+
const controlUnsubscribers = [
|
|
3129
3460
|
processor.on("pause", () => {
|
|
3130
3461
|
if (!parentState.isPaused()) {
|
|
3131
3462
|
parentState.pause();
|
|
@@ -3137,28 +3468,30 @@ function wireSubprocessorEvents(processor, parentEmitter, parentState) {
|
|
|
3137
3468
|
}
|
|
3138
3469
|
})
|
|
3139
3470
|
];
|
|
3140
|
-
|
|
3471
|
+
processor.onAny((event, data) => {
|
|
3141
3472
|
if (event.startsWith("globalSet:")) {
|
|
3142
3473
|
void parentEmitter.emit(event, data);
|
|
3143
3474
|
}
|
|
3144
3475
|
});
|
|
3145
|
-
let
|
|
3146
|
-
const
|
|
3147
|
-
if (
|
|
3476
|
+
let controlsCleanedUp = false;
|
|
3477
|
+
const cleanupControls = () => {
|
|
3478
|
+
if (controlsCleanedUp) {
|
|
3148
3479
|
return;
|
|
3149
3480
|
}
|
|
3150
|
-
|
|
3151
|
-
|
|
3481
|
+
controlsCleanedUp = true;
|
|
3482
|
+
controlUnsubscribers.forEach((unsubscribe) => unsubscribe());
|
|
3152
3483
|
};
|
|
3153
|
-
|
|
3484
|
+
controlUnsubscribers.push(subscribeOwnGraphRunLifecycle(processor, cleanupControls));
|
|
3154
3485
|
}
|
|
3155
3486
|
function wireSubprocessorLifecycle(processor, options2) {
|
|
3156
3487
|
var _a;
|
|
3157
3488
|
const abortFromSignal = () => {
|
|
3158
|
-
|
|
3489
|
+
const abortReason = getGraphAbortReasonFromSignal(options2.signal);
|
|
3490
|
+
void processor.abort((abortReason == null ? void 0 : abortReason.successful) ?? false, abortReason == null ? void 0 : abortReason.error);
|
|
3159
3491
|
};
|
|
3160
3492
|
const abortFromParent = () => {
|
|
3161
|
-
|
|
3493
|
+
const abortReason = getGraphAbortReasonFromSignal(options2.parentAbortSignal);
|
|
3494
|
+
void processor.abort((abortReason == null ? void 0 : abortReason.successful) ?? false, abortReason == null ? void 0 : abortReason.error);
|
|
3162
3495
|
};
|
|
3163
3496
|
const pauseProcessor = () => {
|
|
3164
3497
|
void processor.pause();
|
|
@@ -3307,6 +3640,7 @@ var NotAllowedCodeRunner = class {
|
|
|
3307
3640
|
// src/model/GraphProcessor.ts
|
|
3308
3641
|
var DEFAULT_NODE_CONCURRENCY = 8;
|
|
3309
3642
|
var DEFAULT_SPLIT_RUN_CONCURRENCY = 4;
|
|
3643
|
+
var DEFAULT_ISOMORPHIC_CODE_RUNNER = new IsomorphicCodeRunner();
|
|
3310
3644
|
var FAST_ACYCLIC_UNSUPPORTED_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
3311
3645
|
"loopController",
|
|
3312
3646
|
"loopUntil",
|
|
@@ -3314,6 +3648,17 @@ var FAST_ACYCLIC_UNSUPPORTED_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
|
3314
3648
|
"userInput",
|
|
3315
3649
|
"waitForEvent"
|
|
3316
3650
|
]);
|
|
3651
|
+
function getMonotonicTimeMs() {
|
|
3652
|
+
var _a, _b;
|
|
3653
|
+
return ((_b = (_a = globalThis.performance) == null ? void 0 : _a.now) == null ? void 0 : _b.call(_a)) ?? Date.now();
|
|
3654
|
+
}
|
|
3655
|
+
function withOptionalDuration3(payload, durationMs, splitRunDurationMs) {
|
|
3656
|
+
return {
|
|
3657
|
+
...payload,
|
|
3658
|
+
...durationMs === void 0 ? {} : { durationMs },
|
|
3659
|
+
...splitRunDurationMs === void 0 ? {} : { splitRunDurationMs }
|
|
3660
|
+
};
|
|
3661
|
+
}
|
|
3317
3662
|
function normalizeConcurrencyValue(value, fallback) {
|
|
3318
3663
|
return typeof value === "number" && Number.isFinite(value) && value >= 1 ? Math.floor(value) : fallback;
|
|
3319
3664
|
}
|
|
@@ -3323,6 +3668,21 @@ function resolveGraphProcessorConcurrency(concurrency) {
|
|
|
3323
3668
|
splitRunConcurrency: normalizeConcurrencyValue(concurrency == null ? void 0 : concurrency.splitRunConcurrency, DEFAULT_SPLIT_RUN_CONCURRENCY)
|
|
3324
3669
|
};
|
|
3325
3670
|
}
|
|
3671
|
+
function resolveProcessorGraph(project, graphId) {
|
|
3672
|
+
if (graphId) {
|
|
3673
|
+
return project.graphs[graphId];
|
|
3674
|
+
}
|
|
3675
|
+
return project.metadata.mainGraphId ? project.graphs[project.metadata.mainGraphId] : void 0;
|
|
3676
|
+
}
|
|
3677
|
+
function replaceRecordContents(target, source) {
|
|
3678
|
+
if (target === source) {
|
|
3679
|
+
return;
|
|
3680
|
+
}
|
|
3681
|
+
for (const key of Object.keys(target)) {
|
|
3682
|
+
delete target[key];
|
|
3683
|
+
}
|
|
3684
|
+
Object.assign(target, source);
|
|
3685
|
+
}
|
|
3326
3686
|
var GraphProcessor = class _GraphProcessor {
|
|
3327
3687
|
// Per-instance state
|
|
3328
3688
|
#graph;
|
|
@@ -3343,6 +3703,8 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3343
3703
|
#runtimeCache;
|
|
3344
3704
|
#cacheLoadedProjects;
|
|
3345
3705
|
#scheduler;
|
|
3706
|
+
#captureNodeTimings;
|
|
3707
|
+
#useSeededExecutionPlanOnNextRun = false;
|
|
3346
3708
|
id = (0, import_non_secure4.nanoid)();
|
|
3347
3709
|
#includeTrace = true;
|
|
3348
3710
|
executor;
|
|
@@ -3380,6 +3742,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3380
3742
|
#aborted = false;
|
|
3381
3743
|
#abortSuccessfully = false;
|
|
3382
3744
|
#abortError = void 0;
|
|
3745
|
+
#successfulAbortTerminalProcessIds = void 0;
|
|
3383
3746
|
#totalCost = 0;
|
|
3384
3747
|
#ignoreNodes = void 0;
|
|
3385
3748
|
#hasPreloadedData = false;
|
|
@@ -3387,6 +3750,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3387
3750
|
#definitions = void 0;
|
|
3388
3751
|
#scc = void 0;
|
|
3389
3752
|
#graphExecutionPlan;
|
|
3753
|
+
#nodeProcessContextBase = void 0;
|
|
3390
3754
|
#nodesNotInCycle = void 0;
|
|
3391
3755
|
#nodeAbortControllers = /* @__PURE__ */ new Map();
|
|
3392
3756
|
#graphInputNodeValues = {};
|
|
@@ -3397,9 +3761,18 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3397
3761
|
get isRunning() {
|
|
3398
3762
|
return this.#running;
|
|
3399
3763
|
}
|
|
3764
|
+
#startNodeTiming() {
|
|
3765
|
+
return this.#captureNodeTimings ? getMonotonicTimeMs() : void 0;
|
|
3766
|
+
}
|
|
3767
|
+
#finishNodeTiming(start) {
|
|
3768
|
+
if (start == null) {
|
|
3769
|
+
return void 0;
|
|
3770
|
+
}
|
|
3771
|
+
return Math.max(0, getMonotonicTimeMs() - start);
|
|
3772
|
+
}
|
|
3400
3773
|
constructor(project, graphId, registry, includeTrace, options2) {
|
|
3401
3774
|
this.#project = project;
|
|
3402
|
-
const graph =
|
|
3775
|
+
const graph = resolveProcessorGraph(project, graphId);
|
|
3403
3776
|
if (!graph) {
|
|
3404
3777
|
throw new Error(`Graph ${graphId} not found in project`);
|
|
3405
3778
|
}
|
|
@@ -3414,11 +3787,16 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3414
3787
|
this.#runtimeCache = options2 == null ? void 0 : options2.runtimeCache;
|
|
3415
3788
|
this.#cacheLoadedProjects = (options2 == null ? void 0 : options2.cacheLoadedProjects) ?? false;
|
|
3416
3789
|
this.#scheduler = (options2 == null ? void 0 : options2.scheduler) ?? "compatible";
|
|
3790
|
+
this.#captureNodeTimings = (options2 == null ? void 0 : options2.captureNodeTimings) ?? false;
|
|
3417
3791
|
this.#emitter.bindMethods(this, ["on", "off", "once", "onAny", "offAny"]);
|
|
3418
3792
|
this.setExternalFunction("echo", async (value) => ({ type: "any", value }));
|
|
3419
3793
|
this.#emitter.on("globalSet", ({ id, value }) => {
|
|
3420
3794
|
emitDetached(this.#emitter, `globalSet:${id}`, value);
|
|
3421
3795
|
});
|
|
3796
|
+
if (options2 == null ? void 0 : options2.initialExecutionPlan) {
|
|
3797
|
+
this.#applyPreprocessedGraph(options2.initialExecutionPlan, { recreateNodeInstances: true });
|
|
3798
|
+
this.#useSeededExecutionPlanOnNextRun = true;
|
|
3799
|
+
}
|
|
3422
3800
|
}
|
|
3423
3801
|
#preprocessGraph() {
|
|
3424
3802
|
var _a;
|
|
@@ -3435,7 +3813,10 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3435
3813
|
project: this.#project,
|
|
3436
3814
|
registry: this.#registry,
|
|
3437
3815
|
warnOnInvalidGraph: this.warnOnInvalidGraph,
|
|
3438
|
-
buildExecutionPlan: shouldUseRuntimeCache
|
|
3816
|
+
buildExecutionPlan: shouldUseRuntimeCache,
|
|
3817
|
+
definitionContext: this.#runtimeCache ? {
|
|
3818
|
+
getGraphBoundary: (project, graphId) => this.#getGraphBoundary(project, graphId)
|
|
3819
|
+
} : void 0
|
|
3439
3820
|
});
|
|
3440
3821
|
if (shouldUseRuntimeCache && isGraphExecutionPlan(preprocessedGraph)) {
|
|
3441
3822
|
runtimeCache.executionPlans ??= /* @__PURE__ */ new WeakMap();
|
|
@@ -3444,30 +3825,50 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3444
3825
|
this.#applyPreprocessedGraph(preprocessedGraph);
|
|
3445
3826
|
}
|
|
3446
3827
|
#canUseRuntimeExecutionPlanCache() {
|
|
3828
|
+
return this.#canUseRuntimeExecutionPlanCacheFor(this.#project, this.#isSubProcessor);
|
|
3829
|
+
}
|
|
3830
|
+
#canUseRuntimeExecutionPlanCacheFor(project, isSubProcessor) {
|
|
3447
3831
|
var _a;
|
|
3448
3832
|
if (this.warnOnInvalidGraph || this.#runtimeCache == null) {
|
|
3449
3833
|
return false;
|
|
3450
3834
|
}
|
|
3451
|
-
if (this.#executionPlanCacheMode === "subprocessors" && !
|
|
3835
|
+
if (this.#executionPlanCacheMode === "subprocessors" && !isSubProcessor) {
|
|
3452
3836
|
return false;
|
|
3453
3837
|
}
|
|
3454
|
-
if (!this.#cacheLoadedProjects && (((_a =
|
|
3838
|
+
if (!this.#cacheLoadedProjects && (((_a = project.references) == null ? void 0 : _a.length) ?? 0) > 0) {
|
|
3455
3839
|
return false;
|
|
3456
3840
|
}
|
|
3457
3841
|
return true;
|
|
3458
3842
|
}
|
|
3843
|
+
#getGraphBoundary(project, graphId) {
|
|
3844
|
+
if (!this.#runtimeCache) {
|
|
3845
|
+
return getGraphBoundary(project, graphId);
|
|
3846
|
+
}
|
|
3847
|
+
this.#runtimeCache.graphBoundaries ??= /* @__PURE__ */ new WeakMap();
|
|
3848
|
+
return getGraphBoundary(project, graphId, this.#runtimeCache.graphBoundaries);
|
|
3849
|
+
}
|
|
3459
3850
|
#applyPreprocessedGraph(preprocessedGraph, options2 = {}) {
|
|
3460
3851
|
const nodeInstances = options2.recreateNodeInstances || !("nodeInstances" in preprocessedGraph) ? this.#createNodeInstances(isGraphExecutionPlan(preprocessedGraph) ? preprocessedGraph.graphNodes : this.#graph.nodes) : preprocessedGraph.nodeInstances;
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3852
|
+
replaceRecordContents(this.#nodeInstances, nodeInstances);
|
|
3853
|
+
replaceRecordContents(this.#nodesById, preprocessedGraph.nodesById);
|
|
3854
|
+
replaceRecordContents(this.#connections, preprocessedGraph.connections);
|
|
3464
3855
|
this.#definitions = preprocessedGraph.definitions;
|
|
3465
3856
|
this.#scc = preprocessedGraph.stronglyConnectedComponents;
|
|
3466
3857
|
this.#nodesNotInCycle = preprocessedGraph.nodesNotInCycle;
|
|
3467
3858
|
this.#graphExecutionPlan = isGraphExecutionPlan(preprocessedGraph) ? preprocessedGraph : void 0;
|
|
3468
3859
|
}
|
|
3860
|
+
#seededExecutionPlanForNextRun() {
|
|
3861
|
+
if (!this.#useSeededExecutionPlanOnNextRun || this.warnOnInvalidGraph) {
|
|
3862
|
+
return void 0;
|
|
3863
|
+
}
|
|
3864
|
+
return this.#graphExecutionPlan;
|
|
3865
|
+
}
|
|
3469
3866
|
#createNodeInstances(nodes) {
|
|
3470
|
-
|
|
3867
|
+
const nodeInstances = {};
|
|
3868
|
+
for (const node of nodes) {
|
|
3869
|
+
nodeInstances[node.id] = this.#registry.createDynamicImpl(node);
|
|
3870
|
+
}
|
|
3871
|
+
return nodeInstances;
|
|
3471
3872
|
}
|
|
3472
3873
|
#emitTraceEvent(eventData) {
|
|
3473
3874
|
if (this.#includeTrace) {
|
|
@@ -3534,7 +3935,9 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3534
3935
|
}
|
|
3535
3936
|
this.#abortSuccessfully = successful;
|
|
3536
3937
|
this.#abortError = error;
|
|
3537
|
-
|
|
3938
|
+
const abortReason = createGraphAbortReason(successful, error);
|
|
3939
|
+
this.#abortController.abort(abortReason);
|
|
3940
|
+
this.#abortActiveNodeControllers(abortReason);
|
|
3538
3941
|
emitDetached(this.#emitter, "graphAbort", this.#withExecution({ successful, error, graph: this.#graph }));
|
|
3539
3942
|
if (!this.#isSubProcessor) {
|
|
3540
3943
|
emitDetached(this.#emitter, "abort", { successful, error });
|
|
@@ -3669,7 +4072,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3669
4072
|
return this.#graphOutputs;
|
|
3670
4073
|
}
|
|
3671
4074
|
#initProcessState() {
|
|
3672
|
-
var _a;
|
|
4075
|
+
var _a, _b;
|
|
3673
4076
|
this.#running = true;
|
|
3674
4077
|
this.#finishEmitted = false;
|
|
3675
4078
|
if (!this.#hasPreloadedData) {
|
|
@@ -3678,7 +4081,10 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3678
4081
|
}
|
|
3679
4082
|
this.#erroredNodes = /* @__PURE__ */ new Map();
|
|
3680
4083
|
this.#currentlyProcessing = /* @__PURE__ */ new Set();
|
|
3681
|
-
|
|
4084
|
+
const seededExecutionPlan = this.#seededExecutionPlanForNextRun();
|
|
4085
|
+
this.#remainingNodes = new Set(
|
|
4086
|
+
seededExecutionPlan ? seededExecutionPlan.nodeIds : this.#graph.nodes.map((node) => node.id)
|
|
4087
|
+
);
|
|
3682
4088
|
this.#pendingUserInputs = {};
|
|
3683
4089
|
this.#processingQueue = new pQueueCompat_default({ concurrency: this.#concurrency.nodeConcurrency });
|
|
3684
4090
|
this.#graphOutputs = {};
|
|
@@ -3689,6 +4095,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3689
4095
|
this.#attachedNodeData = /* @__PURE__ */ new Map();
|
|
3690
4096
|
this.#globals ??= /* @__PURE__ */ new Map();
|
|
3691
4097
|
this.#ignoreNodes = /* @__PURE__ */ new Set();
|
|
4098
|
+
this.#nodeProcessContextBase = void 0;
|
|
3692
4099
|
this.#abortController = this.#newAbortController();
|
|
3693
4100
|
this.#abortController.signal.addEventListener("abort", () => {
|
|
3694
4101
|
this.#aborted = true;
|
|
@@ -3696,8 +4103,14 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3696
4103
|
this.#aborted = false;
|
|
3697
4104
|
this.#abortError = void 0;
|
|
3698
4105
|
this.#abortSuccessfully = false;
|
|
4106
|
+
this.#successfulAbortTerminalProcessIds = /* @__PURE__ */ new Set();
|
|
3699
4107
|
this.#nodeAbortControllers = /* @__PURE__ */ new Map();
|
|
3700
4108
|
this.#loadedProjects = this.#cacheLoadedProjects && ((_a = this.#runtimeCache) == null ? void 0 : _a.loadedProjects) ? { ...this.#runtimeCache.loadedProjects } : {};
|
|
4109
|
+
if (!this.#cacheLoadedProjects && (((_b = this.#project.references) == null ? void 0 : _b.length) ?? 0) > 0) {
|
|
4110
|
+
if (this.#runtimeCache) {
|
|
4111
|
+
this.#runtimeCache.graphBoundaries = void 0;
|
|
4112
|
+
}
|
|
4113
|
+
}
|
|
3701
4114
|
this.#graphInputNodeValues = {};
|
|
3702
4115
|
}
|
|
3703
4116
|
/** Main function for running a graph. Runs a graph and returns the outputs from the output nodes of the graph. */
|
|
@@ -3708,7 +4121,12 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3708
4121
|
try {
|
|
3709
4122
|
this.#initializeGraphRun(context, inputs, contextValues);
|
|
3710
4123
|
await this.#loadProjectReferences();
|
|
3711
|
-
this.#
|
|
4124
|
+
this.#prepareNodeProcessContextBase();
|
|
4125
|
+
const shouldUseSeededExecutionPlan = this.#seededExecutionPlanForNextRun() != null;
|
|
4126
|
+
this.#useSeededExecutionPlanOnNextRun = false;
|
|
4127
|
+
if (!shouldUseSeededExecutionPlan) {
|
|
4128
|
+
this.#preprocessGraph();
|
|
4129
|
+
}
|
|
3712
4130
|
await this.#emitGraphStart();
|
|
3713
4131
|
await this.#emitPreloadedNodeResults();
|
|
3714
4132
|
await this.#waitUntilUnpaused();
|
|
@@ -3748,6 +4166,39 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3748
4166
|
});
|
|
3749
4167
|
this.#unsubscribeTokenizerError = typeof unsubscribeTokenizerError === "function" ? unsubscribeTokenizerError : void 0;
|
|
3750
4168
|
}
|
|
4169
|
+
#prepareNodeProcessContextBase() {
|
|
4170
|
+
this.#nodeProcessContextBase = {
|
|
4171
|
+
...this.#context,
|
|
4172
|
+
abortGraph: (error) => {
|
|
4173
|
+
void this.abort(error === void 0, error);
|
|
4174
|
+
},
|
|
4175
|
+
codeRunner: this.#context.codeRunner ?? DEFAULT_ISOMORPHIC_CODE_RUNNER,
|
|
4176
|
+
contextValues: this.#contextValues,
|
|
4177
|
+
executionCache: this.#executionCache,
|
|
4178
|
+
executor: this.executor ?? "nodejs",
|
|
4179
|
+
getGlobal: (id) => this.#globals.get(id),
|
|
4180
|
+
getGraphBoundary: (project, graphId) => this.#getGraphBoundary(project, graphId),
|
|
4181
|
+
graphInputNodeValues: this.#graphInputNodeValues,
|
|
4182
|
+
graphInputs: this.#graphInputs,
|
|
4183
|
+
graphOutputs: this.#graphOutputs,
|
|
4184
|
+
project: this.#project,
|
|
4185
|
+
raiseEvent: (event, data) => {
|
|
4186
|
+
this.getRootProcessor().raiseEvent(event, data);
|
|
4187
|
+
},
|
|
4188
|
+
referencedProjects: this.#loadedProjects,
|
|
4189
|
+
tokenizer: this.#getTokenizer(),
|
|
4190
|
+
trace: (message) => {
|
|
4191
|
+
this.#emitTraceEvent(message);
|
|
4192
|
+
},
|
|
4193
|
+
waitForGlobal: async (id) => {
|
|
4194
|
+
if (this.#globals.has(id)) {
|
|
4195
|
+
return this.#globals.get(id);
|
|
4196
|
+
}
|
|
4197
|
+
await this.getRootProcessor().#emitter.once(`globalSet:${id}`);
|
|
4198
|
+
return this.#globals.get(id);
|
|
4199
|
+
}
|
|
4200
|
+
};
|
|
4201
|
+
}
|
|
3751
4202
|
#cleanupTokenizerErrorListener() {
|
|
3752
4203
|
const unsubscribeTokenizerError = this.#unsubscribeTokenizerError;
|
|
3753
4204
|
this.#unsubscribeTokenizerError = void 0;
|
|
@@ -4079,7 +4530,8 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4079
4530
|
if (this.#beginNodeProcessing(node, attachedData) === false) {
|
|
4080
4531
|
return [];
|
|
4081
4532
|
}
|
|
4082
|
-
const
|
|
4533
|
+
const processResult = await this.#processNode(node);
|
|
4534
|
+
const { processId } = processResult;
|
|
4083
4535
|
if (this.slowMode) {
|
|
4084
4536
|
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
4085
4537
|
}
|
|
@@ -4090,14 +4542,16 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4090
4542
|
const outputNodes = getOutputNodesFrom(this.#executionState, node);
|
|
4091
4543
|
this.#handleLoopControllerPostProcess(node, attachedData);
|
|
4092
4544
|
this.#handleCompletedRace(node);
|
|
4093
|
-
|
|
4545
|
+
const childLoopInfoError = this.#assignChildLoopInfo(node, builtInNode, attachedData);
|
|
4546
|
+
if (childLoopInfoError) {
|
|
4547
|
+
await this.#nodeErrored(node, childLoopInfoError, processId);
|
|
4094
4548
|
return [];
|
|
4095
4549
|
}
|
|
4096
4550
|
this.#propagateAttachedDataToOutputNodes(node, attachedData, outputNodes.connectionsToNodes);
|
|
4097
|
-
if (queueOutputNodes) {
|
|
4551
|
+
if (queueOutputNodes && processResult.shouldQueueOutputNodes) {
|
|
4098
4552
|
this.#queueOutputNodes(node, outputNodes.nodes);
|
|
4099
4553
|
}
|
|
4100
|
-
return outputNodes.nodes;
|
|
4554
|
+
return processResult.shouldQueueOutputNodes ? outputNodes.nodes : [];
|
|
4101
4555
|
}
|
|
4102
4556
|
#shouldSkipNodeProcessing(node, inputNodes) {
|
|
4103
4557
|
if (this.#ignoreNodes.has(node.id)) {
|
|
@@ -4184,31 +4638,30 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4184
4638
|
if (node.type !== "raceInputs") {
|
|
4185
4639
|
return;
|
|
4186
4640
|
}
|
|
4641
|
+
const raceId = `race-${node.id}`;
|
|
4187
4642
|
const allNodesForRace = [...this.#attachedNodeData.entries()].filter(
|
|
4188
|
-
([, { races }]) => races == null ? void 0 : races.raceIds.includes(
|
|
4643
|
+
([, { races }]) => races == null ? void 0 : races.raceIds.includes(raceId)
|
|
4189
4644
|
);
|
|
4190
|
-
for (const [
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
this.#emitTraceEvent(`Aborting node ${nodeId} because other race branch won`);
|
|
4194
|
-
abortController.abort();
|
|
4195
|
-
}
|
|
4196
|
-
}
|
|
4197
|
-
for (const [, nodeAttachedData] of [...this.#attachedNodeData.entries()]) {
|
|
4198
|
-
if ((_a = nodeAttachedData.races) == null ? void 0 : _a.raceIds.includes(`race-${node.id}`)) {
|
|
4199
|
-
nodeAttachedData.races.completed = true;
|
|
4200
|
-
}
|
|
4645
|
+
for (const [, nodeAttachedData] of allNodesForRace) {
|
|
4646
|
+
if ((_a = nodeAttachedData.races) == null ? void 0 : _a.raceIds.includes(raceId)) {
|
|
4647
|
+
nodeAttachedData.races.completed = true;
|
|
4201
4648
|
}
|
|
4202
4649
|
}
|
|
4650
|
+
for (const [nodeId] of allNodesForRace) {
|
|
4651
|
+
this.#abortNodeControllersForNode(
|
|
4652
|
+
nodeId,
|
|
4653
|
+
`Aborting node ${nodeId} because other race branch won`,
|
|
4654
|
+
createGraphAbortReason(true, RACE_LOSER_EXCLUSION_REASON)
|
|
4655
|
+
);
|
|
4656
|
+
}
|
|
4203
4657
|
}
|
|
4204
|
-
#assignChildLoopInfo(node, builtInNode, attachedData
|
|
4658
|
+
#assignChildLoopInfo(node, builtInNode, attachedData) {
|
|
4205
4659
|
if (builtInNode.type !== "loopController") {
|
|
4206
|
-
return
|
|
4660
|
+
return void 0;
|
|
4207
4661
|
}
|
|
4208
4662
|
let childLoopInfo = attachedData.loopInfo;
|
|
4209
4663
|
if (childLoopInfo != null && childLoopInfo.loopControllerId !== builtInNode.id) {
|
|
4210
|
-
|
|
4211
|
-
return false;
|
|
4664
|
+
return new Error("Nested loops are not supported");
|
|
4212
4665
|
}
|
|
4213
4666
|
childLoopInfo = {
|
|
4214
4667
|
propagate: (parent, connectionsFromParent) => {
|
|
@@ -4222,7 +4675,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4222
4675
|
iterationCount: ((childLoopInfo == null ? void 0 : childLoopInfo.iterationCount) ?? 0) + 1
|
|
4223
4676
|
};
|
|
4224
4677
|
attachedData.loopInfo = childLoopInfo;
|
|
4225
|
-
return
|
|
4678
|
+
return void 0;
|
|
4226
4679
|
}
|
|
4227
4680
|
#propagateAttachedDataToOutputNodes(node, attachedData, outputConnections) {
|
|
4228
4681
|
for (const { node: outputNode, connections: connectionsToOutputNode } of outputConnections) {
|
|
@@ -4261,24 +4714,17 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4261
4714
|
async #processNode(node) {
|
|
4262
4715
|
const processId = (0, import_non_secure4.nanoid)();
|
|
4263
4716
|
if (this.#abortController.signal.aborted) {
|
|
4264
|
-
this.#nodeErrored(node,
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
const inputNodes = getInputNodesTo(this.#executionState, node);
|
|
4268
|
-
const erroredInputNodes = inputNodes.filter((inputNode) => this.#erroredNodes.has(inputNode.id));
|
|
4269
|
-
if (erroredInputNodes.length > 0) {
|
|
4270
|
-
const error = new Error(
|
|
4271
|
-
`Cannot process node ${node.title} (${node.id}) because it depends on errored nodes: ${erroredInputNodes.map((n) => `${n.title} (${n.id})`).join(", ")}`
|
|
4272
|
-
);
|
|
4273
|
-
this.#nodeErrored(node, error, processId);
|
|
4274
|
-
return processId;
|
|
4717
|
+
await this.#nodeErrored(node, createGraphAbortErrorFromSignal(this.#abortController.signal), processId);
|
|
4718
|
+
this.#successfulAbortTerminalProcessIds.delete(processId);
|
|
4719
|
+
return { processId, shouldQueueOutputNodes: false };
|
|
4275
4720
|
}
|
|
4276
4721
|
if (node.isSplitRun) {
|
|
4277
4722
|
await this.#processSplitRunNode(node, processId);
|
|
4278
4723
|
} else {
|
|
4279
4724
|
await this.#processNormalNode(node, processId);
|
|
4280
4725
|
}
|
|
4281
|
-
|
|
4726
|
+
const successfulAbortTerminal = this.#successfulAbortTerminalProcessIds.delete(processId);
|
|
4727
|
+
return { processId, shouldQueueOutputNodes: !successfulAbortTerminal };
|
|
4282
4728
|
}
|
|
4283
4729
|
async #processSplitRunNode(node, processId) {
|
|
4284
4730
|
return processSplitRunNode(node, processId, {
|
|
@@ -4289,11 +4735,18 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4289
4735
|
accumulateCost: (output) => this.#accumulateCost(output),
|
|
4290
4736
|
setNodeResults: (nodeId, outputs) => this.#nodeResults.set(nodeId, outputs),
|
|
4291
4737
|
markNodeVisited: (nodeId) => this.#visitedNodes.add(nodeId),
|
|
4292
|
-
nodeErrored: (n, err, pid) => this.#nodeErrored(n, err, pid),
|
|
4738
|
+
nodeErrored: (n, err, pid, durationMs, splitRunDurationMs) => this.#nodeErrored(n, err, pid, durationMs, splitRunDurationMs),
|
|
4293
4739
|
isAborted: () => this.#aborted,
|
|
4740
|
+
getAbortError: () => createGraphAbortErrorFromSignal(this.#abortController.signal),
|
|
4294
4741
|
emit: (event, data) => {
|
|
4295
|
-
|
|
4296
|
-
|
|
4742
|
+
if (event === "partialOutput") {
|
|
4743
|
+
emitDetached(this.#emitter, event, this.#withExecution(data));
|
|
4744
|
+
return;
|
|
4745
|
+
}
|
|
4746
|
+
return this.#emitter.emit(event, this.#withExecution(data));
|
|
4747
|
+
},
|
|
4748
|
+
startNodeTiming: this.#captureNodeTimings ? () => this.#startNodeTiming() : void 0,
|
|
4749
|
+
finishNodeTiming: this.#captureNodeTimings ? (start) => this.#finishNodeTiming(start) : void 0
|
|
4297
4750
|
});
|
|
4298
4751
|
}
|
|
4299
4752
|
async #processNormalNode(node, processId) {
|
|
@@ -4302,6 +4755,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4302
4755
|
return;
|
|
4303
4756
|
}
|
|
4304
4757
|
await this.#emitter.emit("nodeStart", this.#withExecution({ node, inputs: inputValues, processId }));
|
|
4758
|
+
const timingStart = this.#startNodeTiming();
|
|
4305
4759
|
try {
|
|
4306
4760
|
const outputValues = await this.#processNodeWithInputData(
|
|
4307
4761
|
node,
|
|
@@ -4319,16 +4773,59 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4319
4773
|
this.#nodeResults.set(node.id, outputValues);
|
|
4320
4774
|
this.#visitedNodes.add(node.id);
|
|
4321
4775
|
this.#accumulateCost(outputValues);
|
|
4322
|
-
await this.#emitter.emit(
|
|
4776
|
+
await this.#emitter.emit(
|
|
4777
|
+
"nodeFinish",
|
|
4778
|
+
this.#withExecution(
|
|
4779
|
+
withOptionalDuration3(
|
|
4780
|
+
{
|
|
4781
|
+
node,
|
|
4782
|
+
outputs: outputValues,
|
|
4783
|
+
processId
|
|
4784
|
+
},
|
|
4785
|
+
this.#finishNodeTiming(timingStart)
|
|
4786
|
+
)
|
|
4787
|
+
)
|
|
4788
|
+
);
|
|
4323
4789
|
} catch (error) {
|
|
4324
|
-
this.#nodeErrored(node, error, processId);
|
|
4790
|
+
await this.#nodeErrored(node, error, processId, this.#finishNodeTiming(timingStart));
|
|
4325
4791
|
}
|
|
4326
4792
|
}
|
|
4327
|
-
#nodeErrored(node, e, processId) {
|
|
4793
|
+
async #nodeErrored(node, e, processId, durationMs, splitRunDurationMs) {
|
|
4328
4794
|
const error = getError(e);
|
|
4329
|
-
|
|
4330
|
-
|
|
4795
|
+
const exclusionReason = this.#getErrorExclusionReason(node, error, processId);
|
|
4796
|
+
if (exclusionReason) {
|
|
4797
|
+
await this.#emitNodeExcluded(node, processId, this.#getInputValuesForNode(node), exclusionReason);
|
|
4798
|
+
this.#emitTraceEvent(`Node ${node.title} (${node.id}-${processId}) was excluded: ${exclusionReason}`);
|
|
4799
|
+
return;
|
|
4800
|
+
}
|
|
4331
4801
|
this.#erroredNodes.set(node.id, error);
|
|
4802
|
+
await this.#emitter.emit(
|
|
4803
|
+
"nodeError",
|
|
4804
|
+
this.#withExecution(withOptionalDuration3({ node, error, processId }, durationMs, splitRunDurationMs))
|
|
4805
|
+
);
|
|
4806
|
+
this.#emitTraceEvent(`Node ${node.title} (${node.id}-${processId}) errored: ${error.stack}`);
|
|
4807
|
+
}
|
|
4808
|
+
#getErrorExclusionReason(node, error, processId) {
|
|
4809
|
+
var _a;
|
|
4810
|
+
if ((_a = this.#getAttachedDataTo(node).races) == null ? void 0 : _a.completed) {
|
|
4811
|
+
return RACE_LOSER_EXCLUSION_REASON;
|
|
4812
|
+
}
|
|
4813
|
+
const abortReason = getGraphAbortReasonFromError(error);
|
|
4814
|
+
if (isRaceLoserGraphAbortReason(abortReason)) {
|
|
4815
|
+
return RACE_LOSER_EXCLUSION_REASON;
|
|
4816
|
+
}
|
|
4817
|
+
if (isSuccessfulNonRaceGraphAbortReason(abortReason)) {
|
|
4818
|
+
this.#successfulAbortTerminalProcessIds.add(processId);
|
|
4819
|
+
return SUCCESSFUL_GRAPH_ABORT_EXCLUSION_REASON;
|
|
4820
|
+
}
|
|
4821
|
+
if (this.#abortSuccessfully && isAbortLikeError(error)) {
|
|
4822
|
+
const exclusionReason = this.#abortError === RACE_LOSER_EXCLUSION_REASON ? RACE_LOSER_EXCLUSION_REASON : SUCCESSFUL_GRAPH_ABORT_EXCLUSION_REASON;
|
|
4823
|
+
if (exclusionReason === SUCCESSFUL_GRAPH_ABORT_EXCLUSION_REASON) {
|
|
4824
|
+
this.#successfulAbortTerminalProcessIds.add(processId);
|
|
4825
|
+
}
|
|
4826
|
+
return exclusionReason;
|
|
4827
|
+
}
|
|
4828
|
+
return void 0;
|
|
4332
4829
|
}
|
|
4333
4830
|
getRootProcessor() {
|
|
4334
4831
|
let processor = this;
|
|
@@ -4349,14 +4846,71 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4349
4846
|
emitDetached(this.#emitter, "newAbortController", controller);
|
|
4350
4847
|
return controller;
|
|
4351
4848
|
}
|
|
4849
|
+
#registerNodeAbortController(nodeId, abortController) {
|
|
4850
|
+
const existingAbortControllers = this.#nodeAbortControllers.get(nodeId);
|
|
4851
|
+
if (!existingAbortControllers) {
|
|
4852
|
+
this.#nodeAbortControllers.set(nodeId, abortController);
|
|
4853
|
+
return;
|
|
4854
|
+
}
|
|
4855
|
+
if (existingAbortControllers instanceof Set) {
|
|
4856
|
+
existingAbortControllers.add(abortController);
|
|
4857
|
+
return;
|
|
4858
|
+
}
|
|
4859
|
+
if (existingAbortControllers === abortController) {
|
|
4860
|
+
return;
|
|
4861
|
+
}
|
|
4862
|
+
this.#nodeAbortControllers.set(nodeId, /* @__PURE__ */ new Set([existingAbortControllers, abortController]));
|
|
4863
|
+
}
|
|
4864
|
+
#unregisterNodeAbortController(nodeId, abortController) {
|
|
4865
|
+
const existingAbortControllers = this.#nodeAbortControllers.get(nodeId);
|
|
4866
|
+
if (!existingAbortControllers) {
|
|
4867
|
+
return;
|
|
4868
|
+
}
|
|
4869
|
+
if (existingAbortControllers === abortController) {
|
|
4870
|
+
this.#nodeAbortControllers.delete(nodeId);
|
|
4871
|
+
return;
|
|
4872
|
+
}
|
|
4873
|
+
if (!(existingAbortControllers instanceof Set)) {
|
|
4874
|
+
return;
|
|
4875
|
+
}
|
|
4876
|
+
existingAbortControllers.delete(abortController);
|
|
4877
|
+
if (existingAbortControllers.size === 0) {
|
|
4878
|
+
this.#nodeAbortControllers.delete(nodeId);
|
|
4879
|
+
} else if (existingAbortControllers.size === 1) {
|
|
4880
|
+
this.#nodeAbortControllers.set(nodeId, existingAbortControllers.values().next().value);
|
|
4881
|
+
}
|
|
4882
|
+
}
|
|
4883
|
+
#abortNodeControllersForNode(nodeId, traceMessage, reason) {
|
|
4884
|
+
const abortControllerEntry = this.#nodeAbortControllers.get(nodeId);
|
|
4885
|
+
if (!abortControllerEntry) {
|
|
4886
|
+
return;
|
|
4887
|
+
}
|
|
4888
|
+
if (!(abortControllerEntry instanceof Set)) {
|
|
4889
|
+
if (traceMessage) {
|
|
4890
|
+
this.#emitTraceEvent(traceMessage);
|
|
4891
|
+
}
|
|
4892
|
+
abortControllerEntry.abort(reason);
|
|
4893
|
+
return;
|
|
4894
|
+
}
|
|
4895
|
+
for (const abortController of abortControllerEntry) {
|
|
4896
|
+
if (traceMessage) {
|
|
4897
|
+
this.#emitTraceEvent(traceMessage);
|
|
4898
|
+
}
|
|
4899
|
+
abortController.abort(reason);
|
|
4900
|
+
}
|
|
4901
|
+
}
|
|
4902
|
+
#abortActiveNodeControllers(reason) {
|
|
4903
|
+
for (const nodeId of [...this.#nodeAbortControllers.keys()]) {
|
|
4904
|
+
this.#abortNodeControllersForNode(nodeId, void 0, reason);
|
|
4905
|
+
}
|
|
4906
|
+
}
|
|
4352
4907
|
async #processNodeWithInputData(node, inputValues, index, processId, partialOutput) {
|
|
4353
4908
|
const instance = this.#nodeInstances[node.id];
|
|
4354
4909
|
const nodeAbortController = this.#newAbortController();
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
this.#abortController.signal.addEventListener("abort", abortListener);
|
|
4910
|
+
this.#registerNodeAbortController(node.id, nodeAbortController);
|
|
4911
|
+
if (this.#abortController.signal.aborted) {
|
|
4912
|
+
nodeAbortController.abort(getAbortSignalReason(this.#abortController.signal));
|
|
4913
|
+
}
|
|
4360
4914
|
const context = this.#createNodeProcessContext(
|
|
4361
4915
|
node,
|
|
4362
4916
|
inputValues,
|
|
@@ -4365,16 +4919,20 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4365
4919
|
nodeAbortController,
|
|
4366
4920
|
partialOutput
|
|
4367
4921
|
);
|
|
4368
|
-
await this.#waitUntilUnpaused();
|
|
4369
4922
|
let results;
|
|
4370
4923
|
try {
|
|
4924
|
+
await this.#waitUntilUnpaused();
|
|
4371
4925
|
results = await instance.process(inputValues, context);
|
|
4372
4926
|
} finally {
|
|
4373
|
-
this.#
|
|
4374
|
-
this.#abortController.signal.removeEventListener("abort", abortListener);
|
|
4927
|
+
this.#unregisterNodeAbortController(node.id, nodeAbortController);
|
|
4375
4928
|
}
|
|
4929
|
+
const abortReason = getGraphAbortReasonFromSignal(nodeAbortController.signal);
|
|
4376
4930
|
if (nodeAbortController.signal.aborted) {
|
|
4377
|
-
|
|
4931
|
+
if (isSuccessfulNonRaceGraphAbortReason(abortReason)) {
|
|
4932
|
+
this.#successfulAbortTerminalProcessIds.add(processId);
|
|
4933
|
+
} else {
|
|
4934
|
+
throw createGraphAbortError(abortReason, "Aborted");
|
|
4935
|
+
}
|
|
4378
4936
|
}
|
|
4379
4937
|
return results;
|
|
4380
4938
|
}
|
|
@@ -4384,24 +4942,12 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4384
4942
|
#createNodeProcessContext(node, inputValues, index, processId, nodeAbortController, partialOutput) {
|
|
4385
4943
|
const plugin = this.#registry.getPluginFor(node.type);
|
|
4386
4944
|
return buildNodeProcessContext({
|
|
4387
|
-
abortGraph: (error) => {
|
|
4388
|
-
void this.abort(error === void 0, error);
|
|
4389
|
-
},
|
|
4390
4945
|
attachedData: this.#getAttachedDataTo(node),
|
|
4391
|
-
|
|
4392
|
-
context: this.#context,
|
|
4393
|
-
contextValues: this.#contextValues,
|
|
4946
|
+
base: this.#nodeProcessContextBase,
|
|
4394
4947
|
createSubProcessor: (subGraphId, options2 = {}) => this.#createSubProcessor(node, index, processId, subGraphId, options2),
|
|
4395
4948
|
execution: this.#buildExecutionMetadata(),
|
|
4396
|
-
executionCache: this.#executionCache,
|
|
4397
|
-
executor: this.executor ?? "nodejs",
|
|
4398
4949
|
externalFunctions: this.#externalFunctions,
|
|
4399
|
-
getGlobal: (id) => this.#globals.get(id),
|
|
4400
4950
|
getPluginConfig: (name) => getPluginConfig(plugin, this.#context.settings, name),
|
|
4401
|
-
graphInputNodeValues: this.#graphInputNodeValues,
|
|
4402
|
-
graphInputs: this.#graphInputs,
|
|
4403
|
-
graphOutputs: this.#graphOutputs,
|
|
4404
|
-
loadedProjects: this.#loadedProjects,
|
|
4405
4951
|
node,
|
|
4406
4952
|
nodeAbortController,
|
|
4407
4953
|
onPartialOutputs: (partialOutputs) => {
|
|
@@ -4409,36 +4955,21 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4409
4955
|
this.#emitGraphPartialOutputIfNeeded(node, partialOutputs);
|
|
4410
4956
|
},
|
|
4411
4957
|
processId,
|
|
4412
|
-
project: this.#project,
|
|
4413
|
-
raiseEvent: (event, data) => {
|
|
4414
|
-
this.getRootProcessor().raiseEvent(event, data);
|
|
4415
|
-
},
|
|
4416
4958
|
requestUserInput: async (inputStrings, renderingType) => this.#requestUserInput(node, inputStrings, inputValues, renderingType, processId),
|
|
4417
4959
|
setGlobal: (id, value) => {
|
|
4418
4960
|
this.#globals.set(id, value);
|
|
4419
4961
|
emitDetached(this.#emitter, "globalSet", this.#withExecution({ id, value, processId }));
|
|
4420
4962
|
},
|
|
4421
|
-
tokenizer: this.#getTokenizer(),
|
|
4422
|
-
trace: (message) => {
|
|
4423
|
-
this.#emitTraceEvent(message);
|
|
4424
|
-
},
|
|
4425
4963
|
waitEvent: async (event) => {
|
|
4426
4964
|
return new Promise((resolve, reject) => {
|
|
4427
4965
|
const abortListener = () => {
|
|
4428
|
-
reject(
|
|
4966
|
+
reject(createGraphAbortErrorFromSignal(nodeAbortController.signal, "Process aborted"));
|
|
4429
4967
|
};
|
|
4430
4968
|
this.#emitter.once(`userEvent:${event}`).then(resolve).catch(reject).finally(() => {
|
|
4431
4969
|
nodeAbortController.signal.removeEventListener("abort", abortListener);
|
|
4432
4970
|
});
|
|
4433
4971
|
nodeAbortController.signal.addEventListener("abort", abortListener, { once: true });
|
|
4434
4972
|
});
|
|
4435
|
-
},
|
|
4436
|
-
waitForGlobal: async (id) => {
|
|
4437
|
-
if (this.#globals.has(id)) {
|
|
4438
|
-
return this.#globals.get(id);
|
|
4439
|
-
}
|
|
4440
|
-
await this.getRootProcessor().#emitter.once(`globalSet:${id}`);
|
|
4441
|
-
return this.#globals.get(id);
|
|
4442
4973
|
}
|
|
4443
4974
|
});
|
|
4444
4975
|
}
|
|
@@ -4461,10 +4992,16 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4461
4992
|
});
|
|
4462
4993
|
}
|
|
4463
4994
|
#createSubProcessor(node, index, processId, subGraphId, { signal, project } = {}) {
|
|
4464
|
-
|
|
4995
|
+
var _a, _b;
|
|
4996
|
+
const subprocessorProject = project ?? this.#project;
|
|
4997
|
+
const subprocessorGraph = resolveProcessorGraph(subprocessorProject, subGraphId);
|
|
4998
|
+
const initialExecutionPlan = subprocessorGraph && this.#canUseRuntimeExecutionPlanCacheFor(subprocessorProject, true) ? (_b = (_a = this.#runtimeCache) == null ? void 0 : _a.executionPlans) == null ? void 0 : _b.get(subprocessorGraph) : void 0;
|
|
4999
|
+
const processor = new _GraphProcessor(subprocessorProject, subGraphId, this.#registry, this.#includeTrace, {
|
|
4465
5000
|
cacheLoadedProjects: this.#cacheLoadedProjects,
|
|
5001
|
+
captureNodeTimings: this.#captureNodeTimings,
|
|
4466
5002
|
concurrency: this.#concurrency,
|
|
4467
5003
|
executionPlanCacheMode: this.#executionPlanCacheMode,
|
|
5004
|
+
initialExecutionPlan,
|
|
4468
5005
|
runtimeCache: this.#runtimeCache,
|
|
4469
5006
|
scheduler: this.#scheduler
|
|
4470
5007
|
});
|
|
@@ -4513,7 +5050,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4513
5050
|
return await new Promise((resolve, reject) => {
|
|
4514
5051
|
const abortListener = () => {
|
|
4515
5052
|
delete this.#pendingUserInputs[node.id];
|
|
4516
|
-
reject(
|
|
5053
|
+
reject(createGraphAbortErrorFromSignal(this.#abortController.signal));
|
|
4517
5054
|
};
|
|
4518
5055
|
this.#pendingUserInputs[node.id] = {
|
|
4519
5056
|
resolve,
|
|
@@ -4565,19 +5102,21 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4565
5102
|
return outputNodes.nodes;
|
|
4566
5103
|
}
|
|
4567
5104
|
#markAsExcluded(node, processId, inputValues, reason) {
|
|
5105
|
+
emitDetached(this.#emitter, "nodeExcluded", this.#createNodeExcludedEvent(node, processId, inputValues, reason));
|
|
5106
|
+
}
|
|
5107
|
+
async #emitNodeExcluded(node, processId, inputValues, reason) {
|
|
5108
|
+
await this.#emitter.emit("nodeExcluded", this.#createNodeExcludedEvent(node, processId, inputValues, reason));
|
|
5109
|
+
}
|
|
5110
|
+
#createNodeExcludedEvent(node, processId, inputValues, reason) {
|
|
4568
5111
|
const outputs = createExcludedNodeOutputs(node, this.#definitions[node.id].outputs);
|
|
4569
5112
|
this.#nodeResults.set(node.id, outputs);
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
outputs,
|
|
4578
|
-
reason
|
|
4579
|
-
})
|
|
4580
|
-
);
|
|
5113
|
+
return this.#withExecution({
|
|
5114
|
+
node,
|
|
5115
|
+
processId,
|
|
5116
|
+
inputs: inputValues,
|
|
5117
|
+
outputs,
|
|
5118
|
+
reason
|
|
5119
|
+
});
|
|
4581
5120
|
}
|
|
4582
5121
|
#getInputValuesForNode(node) {
|
|
4583
5122
|
const connections = this.#connections[node.id];
|
|
@@ -4631,8 +5170,8 @@ var NodeImpl = class {
|
|
|
4631
5170
|
get data() {
|
|
4632
5171
|
return this.chartNode.data;
|
|
4633
5172
|
}
|
|
4634
|
-
getInputDefinitionsIncludingBuiltIn(connections, nodes, project, referencedProjects) {
|
|
4635
|
-
const ports = [...this.getInputDefinitions(connections, nodes, project, referencedProjects)];
|
|
5173
|
+
getInputDefinitionsIncludingBuiltIn(connections, nodes, project, referencedProjects, definitionContext) {
|
|
5174
|
+
const ports = definitionContext ? [...this.getInputDefinitions(connections, nodes, project, referencedProjects, definitionContext)] : [...this.getInputDefinitions(connections, nodes, project, referencedProjects)];
|
|
4636
5175
|
if (this.chartNode.isConditional) {
|
|
4637
5176
|
ports.push(IF_PORT);
|
|
4638
5177
|
}
|
|
@@ -4651,10 +5190,10 @@ var PluginNodeImplClass = class extends NodeImpl {
|
|
|
4651
5190
|
super(chartNode);
|
|
4652
5191
|
this.impl = impl;
|
|
4653
5192
|
}
|
|
4654
|
-
getInputDefinitions(connections, nodes, project) {
|
|
5193
|
+
getInputDefinitions(connections, nodes, project, _referencedProjects, _definitionContext) {
|
|
4655
5194
|
return this.impl.getInputDefinitions(this.data, connections, nodes, project);
|
|
4656
5195
|
}
|
|
4657
|
-
getOutputDefinitions(connections, nodes, project) {
|
|
5196
|
+
getOutputDefinitions(connections, nodes, project, _referencedProjects, _definitionContext) {
|
|
4658
5197
|
return this.impl.getOutputDefinitions(this.data, connections, nodes, project);
|
|
4659
5198
|
}
|
|
4660
5199
|
process(inputData, context) {
|
|
@@ -4940,6 +5479,12 @@ var import_ts_dedent3 = require("ts-dedent");
|
|
|
4940
5479
|
var import_lodash_es5 = require("lodash");
|
|
4941
5480
|
var ESCAPED_TOKEN_REGEX = /\{\{\{([^}]+?)\}\}\}/g;
|
|
4942
5481
|
var ESCAPED_ESCAPED_TOKEN_REGEX = /\\\{\\\{([^}]+?)\\\}\\\}/g;
|
|
5482
|
+
var EXTRACT_INTERPOLATION_VARIABLES_CACHE_MAX_ENTRIES = 2048;
|
|
5483
|
+
var EXTRACT_INTERPOLATION_VARIABLES_CACHE_MAX_TEMPLATE_LENGTH = 64 * 1024;
|
|
5484
|
+
var EXTRACT_INTERPOLATION_VARIABLES_CACHE_MAX_TEMPLATE_CHARS = 1024 * 1024;
|
|
5485
|
+
var extractedInterpolationVariablesCache = /* @__PURE__ */ new Map();
|
|
5486
|
+
var extractedInterpolationVariablesCacheTemplateChars = 0;
|
|
5487
|
+
var lastUncachedInterpolationVariableTemplate;
|
|
4943
5488
|
var processingFunctions = {
|
|
4944
5489
|
indent: (input, spaces = 0) => {
|
|
4945
5490
|
const indent = " ".repeat(spaces);
|
|
@@ -5166,6 +5711,13 @@ function interpolate(template, variables, graphInputValues, contextValues) {
|
|
|
5166
5711
|
});
|
|
5167
5712
|
}
|
|
5168
5713
|
function extractInterpolationVariables(template) {
|
|
5714
|
+
if (!template.includes("{{")) {
|
|
5715
|
+
return [];
|
|
5716
|
+
}
|
|
5717
|
+
const cachedVariables = getCachedInterpolationVariables(template);
|
|
5718
|
+
if (cachedVariables) {
|
|
5719
|
+
return [...cachedVariables];
|
|
5720
|
+
}
|
|
5169
5721
|
const protectedTemplate = protectEscapedInterpolationTokens(template);
|
|
5170
5722
|
const variables = /* @__PURE__ */ new Set();
|
|
5171
5723
|
for (const match10 of findInterpolationTokenSpans(protectedTemplate)) {
|
|
@@ -5174,7 +5726,32 @@ function extractInterpolationVariables(template) {
|
|
|
5174
5726
|
variables.add(token);
|
|
5175
5727
|
}
|
|
5176
5728
|
}
|
|
5177
|
-
|
|
5729
|
+
const extractedVariables = Array.from(variables);
|
|
5730
|
+
cacheInterpolationVariables(template, extractedVariables);
|
|
5731
|
+
return extractedVariables;
|
|
5732
|
+
}
|
|
5733
|
+
function getCachedInterpolationVariables(template) {
|
|
5734
|
+
var _a;
|
|
5735
|
+
return (_a = extractedInterpolationVariablesCache.get(template)) == null ? void 0 : _a.variables;
|
|
5736
|
+
}
|
|
5737
|
+
function cacheInterpolationVariables(template, variables) {
|
|
5738
|
+
if (template.length > EXTRACT_INTERPOLATION_VARIABLES_CACHE_MAX_TEMPLATE_LENGTH) {
|
|
5739
|
+
return;
|
|
5740
|
+
}
|
|
5741
|
+
if (extractedInterpolationVariablesCache.size >= EXTRACT_INTERPOLATION_VARIABLES_CACHE_MAX_ENTRIES || extractedInterpolationVariablesCacheTemplateChars + template.length > EXTRACT_INTERPOLATION_VARIABLES_CACHE_MAX_TEMPLATE_CHARS) {
|
|
5742
|
+
if (lastUncachedInterpolationVariableTemplate !== template) {
|
|
5743
|
+
lastUncachedInterpolationVariableTemplate = template;
|
|
5744
|
+
return;
|
|
5745
|
+
}
|
|
5746
|
+
extractedInterpolationVariablesCache.clear();
|
|
5747
|
+
extractedInterpolationVariablesCacheTemplateChars = 0;
|
|
5748
|
+
}
|
|
5749
|
+
lastUncachedInterpolationVariableTemplate = void 0;
|
|
5750
|
+
extractedInterpolationVariablesCache.set(template, {
|
|
5751
|
+
templateLength: template.length,
|
|
5752
|
+
variables: Object.freeze([...variables])
|
|
5753
|
+
});
|
|
5754
|
+
extractedInterpolationVariablesCacheTemplateChars += template.length;
|
|
5178
5755
|
}
|
|
5179
5756
|
|
|
5180
5757
|
// src/model/interpolationInputDefinition.ts
|
|
@@ -13345,6 +13922,34 @@ var graphInputNode = nodeDefinition(GraphInputNodeImpl, "Graph Input");
|
|
|
13345
13922
|
// src/model/nodes/GraphOutputNode.ts
|
|
13346
13923
|
var import_non_secure21 = require("nanoid/non-secure");
|
|
13347
13924
|
var import_ts_dedent19 = require("ts-dedent");
|
|
13925
|
+
function isPlainObjectRecordValue(value) {
|
|
13926
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
13927
|
+
return false;
|
|
13928
|
+
}
|
|
13929
|
+
const prototype = Object.getPrototypeOf(value);
|
|
13930
|
+
return prototype === Object.prototype || prototype === null;
|
|
13931
|
+
}
|
|
13932
|
+
function coerceAnyGraphOutputValue(value, dataType) {
|
|
13933
|
+
if (value.type === "control-flow-excluded" || dataType === "any" || value.type === dataType) {
|
|
13934
|
+
return value;
|
|
13935
|
+
}
|
|
13936
|
+
if (value.type !== "any") {
|
|
13937
|
+
return value;
|
|
13938
|
+
}
|
|
13939
|
+
if (dataType === "object" && isPlainObjectRecordValue(value.value)) {
|
|
13940
|
+
return {
|
|
13941
|
+
type: "object",
|
|
13942
|
+
value: value.value
|
|
13943
|
+
};
|
|
13944
|
+
}
|
|
13945
|
+
if (dataType === "object[]" && Array.isArray(value.value) && value.value.every(isPlainObjectRecordValue)) {
|
|
13946
|
+
return {
|
|
13947
|
+
type: "object[]",
|
|
13948
|
+
value: value.value
|
|
13949
|
+
};
|
|
13950
|
+
}
|
|
13951
|
+
return value;
|
|
13952
|
+
}
|
|
13348
13953
|
var GraphOutputNodeImpl = class extends NodeImpl {
|
|
13349
13954
|
static create() {
|
|
13350
13955
|
const chartNode = {
|
|
@@ -13413,14 +14018,15 @@ var GraphOutputNodeImpl = class extends NodeImpl {
|
|
|
13413
14018
|
}
|
|
13414
14019
|
async process(inputs, context) {
|
|
13415
14020
|
var _a;
|
|
13416
|
-
const
|
|
14021
|
+
const inputValue = inputs["value"];
|
|
14022
|
+
const value = coerceAnyGraphOutputValue(inputValue ?? { type: "any", value: void 0 }, this.data.dataType);
|
|
13417
14023
|
const isExcluded = value.type === "control-flow-excluded";
|
|
13418
14024
|
if (isExcluded && context.graphOutputs[this.data.id] == null) {
|
|
13419
14025
|
context.graphOutputs[this.data.id] = {
|
|
13420
14026
|
type: "control-flow-excluded",
|
|
13421
14027
|
value: void 0
|
|
13422
14028
|
};
|
|
13423
|
-
} else if ((context.graphOutputs[this.data.id] == null || ((_a = context.graphOutputs[this.data.id]) == null ? void 0 : _a.type) === "control-flow-excluded") &&
|
|
14029
|
+
} else if ((context.graphOutputs[this.data.id] == null || ((_a = context.graphOutputs[this.data.id]) == null ? void 0 : _a.type) === "control-flow-excluded") && inputValue) {
|
|
13424
14030
|
context.graphOutputs[this.data.id] = value;
|
|
13425
14031
|
}
|
|
13426
14032
|
if (isExcluded) {
|
|
@@ -13460,40 +14066,17 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
13460
14066
|
};
|
|
13461
14067
|
return chartNode;
|
|
13462
14068
|
}
|
|
13463
|
-
getInputDefinitions(_connections, _nodes, project) {
|
|
13464
|
-
const
|
|
13465
|
-
|
|
13466
|
-
return [];
|
|
13467
|
-
}
|
|
13468
|
-
const inputNodes = graph.nodes.filter((node) => node.type === "graphInput");
|
|
13469
|
-
const inputIds = [...new Set(inputNodes.map((node) => node.data.id))].sort();
|
|
13470
|
-
return inputIds.map(
|
|
13471
|
-
(id) => ({
|
|
13472
|
-
id,
|
|
13473
|
-
title: id,
|
|
13474
|
-
dataType: inputNodes.find((node) => node.data.id === id).data.dataType
|
|
13475
|
-
})
|
|
13476
|
-
);
|
|
14069
|
+
getInputDefinitions(_connections, _nodes, project, _referencedProjects, definitionContext) {
|
|
14070
|
+
const boundary = this.getBoundary(project, definitionContext);
|
|
14071
|
+
return boundary ? getGraphBoundaryInputDefinitions(boundary) : [];
|
|
13477
14072
|
}
|
|
13478
|
-
getGraphOutputs(project) {
|
|
13479
|
-
const
|
|
13480
|
-
|
|
13481
|
-
return [];
|
|
13482
|
-
}
|
|
13483
|
-
const outputNodes = graph.nodes.filter((node) => node.type === "graphOutput");
|
|
13484
|
-
const outputIds = [...new Set(outputNodes.map((node) => node.data.id))].sort();
|
|
13485
|
-
const outputs = outputIds.map(
|
|
13486
|
-
(id) => ({
|
|
13487
|
-
id,
|
|
13488
|
-
title: id,
|
|
13489
|
-
dataType: outputNodes.find((node) => node.data.id === id).data.dataType
|
|
13490
|
-
})
|
|
13491
|
-
);
|
|
13492
|
-
return outputs;
|
|
14073
|
+
getGraphOutputs(project, definitionContext) {
|
|
14074
|
+
const boundary = this.getBoundary(project, definitionContext);
|
|
14075
|
+
return boundary ? getGraphBoundaryOutputDefinitions(boundary) : [];
|
|
13493
14076
|
}
|
|
13494
|
-
getOutputDefinitions(_connections, _nodes, project) {
|
|
14077
|
+
getOutputDefinitions(_connections, _nodes, project, _referencedProjects, definitionContext) {
|
|
13495
14078
|
const outputs = [];
|
|
13496
|
-
outputs.push(...this.getGraphOutputs(project));
|
|
14079
|
+
outputs.push(...this.getGraphOutputs(project, definitionContext));
|
|
13497
14080
|
if (this.data.useErrorOutput) {
|
|
13498
14081
|
outputs.push({
|
|
13499
14082
|
id: "error",
|
|
@@ -13503,6 +14086,9 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
13503
14086
|
}
|
|
13504
14087
|
return outputs;
|
|
13505
14088
|
}
|
|
14089
|
+
getBoundary(project, definitionContext) {
|
|
14090
|
+
return (definitionContext == null ? void 0 : definitionContext.getGraphBoundary(project, this.data.graphId)) ?? getGraphBoundary(project, this.data.graphId);
|
|
14091
|
+
}
|
|
13506
14092
|
getEditors(context) {
|
|
13507
14093
|
const definitions = [
|
|
13508
14094
|
{
|
|
@@ -13517,19 +14103,16 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
13517
14103
|
}
|
|
13518
14104
|
];
|
|
13519
14105
|
if (this.data.graphId) {
|
|
13520
|
-
const
|
|
13521
|
-
if (
|
|
13522
|
-
const
|
|
13523
|
-
const inputIds = [...new Set(inputNodes.map((node) => node.data.id))].sort();
|
|
13524
|
-
for (const inputId of inputIds) {
|
|
13525
|
-
const inputNode = inputNodes.find((node) => node.data.id === inputId);
|
|
14106
|
+
const boundary = getGraphBoundary(context.project, this.data.graphId);
|
|
14107
|
+
if (boundary) {
|
|
14108
|
+
for (const input of boundary.inputs) {
|
|
13526
14109
|
definitions.push({
|
|
13527
14110
|
type: "dynamic",
|
|
13528
14111
|
dataKey: "inputData",
|
|
13529
|
-
dynamicDataKey:
|
|
13530
|
-
dataType:
|
|
13531
|
-
label:
|
|
13532
|
-
editor:
|
|
14112
|
+
dynamicDataKey: input.id,
|
|
14113
|
+
dataType: input.dataType,
|
|
14114
|
+
label: input.id,
|
|
14115
|
+
editor: input.editor ?? "auto"
|
|
13533
14116
|
});
|
|
13534
14117
|
}
|
|
13535
14118
|
}
|
|
@@ -13547,6 +14130,7 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
13547
14130
|
};
|
|
13548
14131
|
}
|
|
13549
14132
|
async process(inputs, context) {
|
|
14133
|
+
var _a;
|
|
13550
14134
|
const { project } = context;
|
|
13551
14135
|
if (!project) {
|
|
13552
14136
|
throw new Error("SubGraphNode requires a project to be set in the context.");
|
|
@@ -13555,24 +14139,8 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
13555
14139
|
if (!graph) {
|
|
13556
14140
|
throw new Error(`SubGraphNode requires a graph with id ${this.data.graphId} to be present in the project.`);
|
|
13557
14141
|
}
|
|
13558
|
-
const
|
|
13559
|
-
const
|
|
13560
|
-
const inputData = inputIds.reduce((obj, id) => {
|
|
13561
|
-
var _a;
|
|
13562
|
-
if (inputs[id] != null) {
|
|
13563
|
-
return {
|
|
13564
|
-
...obj,
|
|
13565
|
-
[id]: inputs[id]
|
|
13566
|
-
};
|
|
13567
|
-
}
|
|
13568
|
-
if (((_a = this.data.inputData) == null ? void 0 : _a[id]) != null) {
|
|
13569
|
-
return {
|
|
13570
|
-
...obj,
|
|
13571
|
-
[id]: this.data.inputData[id]
|
|
13572
|
-
};
|
|
13573
|
-
}
|
|
13574
|
-
return obj;
|
|
13575
|
-
}, {});
|
|
14142
|
+
const boundary = ((_a = context.getGraphBoundary) == null ? void 0 : _a.call(context, project, this.data.graphId)) ?? getGraphBoundary(project, this.data.graphId);
|
|
14143
|
+
const inputData = buildGraphBoundaryInputData(boundary, inputs, this.data.inputData);
|
|
13576
14144
|
const subGraphProcessor = context.createSubProcessor(this.data.graphId, { signal: context.signal });
|
|
13577
14145
|
try {
|
|
13578
14146
|
const startTime = Date.now();
|
|
@@ -13599,16 +14167,7 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
13599
14167
|
if (!this.data.useErrorOutput) {
|
|
13600
14168
|
throw err;
|
|
13601
14169
|
}
|
|
13602
|
-
const outputs =
|
|
13603
|
-
(obj, output) => ({
|
|
13604
|
-
...obj,
|
|
13605
|
-
[output.id]: {
|
|
13606
|
-
type: "control-flow-excluded",
|
|
13607
|
-
value: void 0
|
|
13608
|
-
}
|
|
13609
|
-
}),
|
|
13610
|
-
{}
|
|
13611
|
-
);
|
|
14170
|
+
const outputs = buildExcludedGraphBoundaryOutputs(boundary);
|
|
13612
14171
|
outputs["error"] = {
|
|
13613
14172
|
type: "string",
|
|
13614
14173
|
value: getError(err).message
|
|
@@ -15176,7 +15735,7 @@ var coalesceNode = nodeDefinition(CoalesceNodeImpl, "Coalesce");
|
|
|
15176
15735
|
|
|
15177
15736
|
// src/model/nodes/DidRunNode.ts
|
|
15178
15737
|
var import_non_secure34 = require("nanoid/non-secure");
|
|
15179
|
-
var
|
|
15738
|
+
var DID_RUN_EXPLANATION = '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.';
|
|
15180
15739
|
var DidRunNodeImpl = class extends NodeImpl {
|
|
15181
15740
|
static create() {
|
|
15182
15741
|
return {
|
|
@@ -15187,7 +15746,7 @@ var DidRunNodeImpl = class extends NodeImpl {
|
|
|
15187
15746
|
visualData: {
|
|
15188
15747
|
x: 0,
|
|
15189
15748
|
y: 0,
|
|
15190
|
-
width:
|
|
15749
|
+
width: 167
|
|
15191
15750
|
}
|
|
15192
15751
|
};
|
|
15193
15752
|
}
|
|
@@ -15214,16 +15773,20 @@ var DidRunNodeImpl = class extends NodeImpl {
|
|
|
15214
15773
|
}
|
|
15215
15774
|
static getUIData() {
|
|
15216
15775
|
return {
|
|
15217
|
-
infoBoxBody:
|
|
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.
|
|
15219
|
-
`,
|
|
15776
|
+
infoBoxBody: DID_RUN_EXPLANATION,
|
|
15220
15777
|
infoBoxTitle: "Did Run Node",
|
|
15221
15778
|
contextMenuTitle: "Did Run",
|
|
15222
15779
|
group: ["Logic"]
|
|
15223
15780
|
};
|
|
15224
15781
|
}
|
|
15225
|
-
|
|
15226
|
-
return
|
|
15782
|
+
getEditors() {
|
|
15783
|
+
return [
|
|
15784
|
+
{
|
|
15785
|
+
type: "info",
|
|
15786
|
+
label: "Behavior",
|
|
15787
|
+
helperMessage: DID_RUN_EXPLANATION
|
|
15788
|
+
}
|
|
15789
|
+
];
|
|
15227
15790
|
}
|
|
15228
15791
|
#getInputPortCount(connections) {
|
|
15229
15792
|
const inputNodeId = this.chartNode.id;
|
|
@@ -15261,7 +15824,7 @@ var didRunNode = nodeDefinition(DidRunNodeImpl, "Did Run");
|
|
|
15261
15824
|
|
|
15262
15825
|
// src/model/nodes/PassthroughNode.ts
|
|
15263
15826
|
var import_non_secure35 = require("nanoid/non-secure");
|
|
15264
|
-
var
|
|
15827
|
+
var import_ts_dedent32 = require("ts-dedent");
|
|
15265
15828
|
var PassthroughNodeImpl = class extends NodeImpl {
|
|
15266
15829
|
static create = () => {
|
|
15267
15830
|
const chartNode = {
|
|
@@ -15303,7 +15866,7 @@ var PassthroughNodeImpl = class extends NodeImpl {
|
|
|
15303
15866
|
}
|
|
15304
15867
|
static getUIData() {
|
|
15305
15868
|
return {
|
|
15306
|
-
infoBoxBody:
|
|
15869
|
+
infoBoxBody: import_ts_dedent32.dedent`
|
|
15307
15870
|
Simply passes the input value to the output without any modifications.
|
|
15308
15871
|
`,
|
|
15309
15872
|
infoBoxTitle: "Passthrough Node",
|
|
@@ -15339,7 +15902,7 @@ var passthroughNode = nodeDefinition(PassthroughNodeImpl, "Passthrough");
|
|
|
15339
15902
|
|
|
15340
15903
|
// src/model/nodes/PopNode.ts
|
|
15341
15904
|
var import_non_secure36 = require("nanoid/non-secure");
|
|
15342
|
-
var
|
|
15905
|
+
var import_ts_dedent33 = require("ts-dedent");
|
|
15343
15906
|
var PopNodeImpl = class extends NodeImpl {
|
|
15344
15907
|
static create() {
|
|
15345
15908
|
const baseNode = {
|
|
@@ -15390,7 +15953,7 @@ var PopNodeImpl = class extends NodeImpl {
|
|
|
15390
15953
|
}
|
|
15391
15954
|
static getUIData() {
|
|
15392
15955
|
return {
|
|
15393
|
-
infoBoxBody:
|
|
15956
|
+
infoBoxBody: import_ts_dedent33.dedent`
|
|
15394
15957
|
Pops the last value off the input array and outputs the new array and the popped value.
|
|
15395
15958
|
|
|
15396
15959
|
Can also be used to just extract the last value from an array.
|
|
@@ -15427,7 +15990,7 @@ var popNode = nodeDefinition(PopNodeImpl, "Pop");
|
|
|
15427
15990
|
|
|
15428
15991
|
// src/model/nodes/SetGlobalNode.ts
|
|
15429
15992
|
var import_non_secure37 = require("nanoid/non-secure");
|
|
15430
|
-
var
|
|
15993
|
+
var import_ts_dedent34 = require("ts-dedent");
|
|
15431
15994
|
var SetGlobalNodeImpl = class extends NodeImpl {
|
|
15432
15995
|
static create() {
|
|
15433
15996
|
const chartNode = {
|
|
@@ -15489,7 +16052,8 @@ var SetGlobalNodeImpl = class extends NodeImpl {
|
|
|
15489
16052
|
type: "string",
|
|
15490
16053
|
dataKey: "id",
|
|
15491
16054
|
useInputToggleDataKey: "useIdInput",
|
|
15492
|
-
label: "ID"
|
|
16055
|
+
label: "ID",
|
|
16056
|
+
includeInGraphSearch: true
|
|
15493
16057
|
},
|
|
15494
16058
|
{
|
|
15495
16059
|
type: "dataTypeSelector",
|
|
@@ -15500,14 +16064,14 @@ var SetGlobalNodeImpl = class extends NodeImpl {
|
|
|
15500
16064
|
];
|
|
15501
16065
|
}
|
|
15502
16066
|
getBody() {
|
|
15503
|
-
return
|
|
16067
|
+
return import_ts_dedent34.dedent`
|
|
15504
16068
|
${this.data.id}
|
|
15505
16069
|
Type: ${this.data.dataType}
|
|
15506
16070
|
`;
|
|
15507
16071
|
}
|
|
15508
16072
|
static getUIData() {
|
|
15509
16073
|
return {
|
|
15510
|
-
infoBoxBody:
|
|
16074
|
+
infoBoxBody: import_ts_dedent34.dedent`
|
|
15511
16075
|
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.
|
|
15512
16076
|
`,
|
|
15513
16077
|
infoBoxTitle: "Set Global Node",
|
|
@@ -15524,7 +16088,7 @@ var SetGlobalNodeImpl = class extends NodeImpl {
|
|
|
15524
16088
|
if (!id) {
|
|
15525
16089
|
throw new Error("Missing variable ID");
|
|
15526
16090
|
}
|
|
15527
|
-
let previousValue = context.getGlobal(
|
|
16091
|
+
let previousValue = context.getGlobal(id);
|
|
15528
16092
|
if (!previousValue && isArrayDataType(this.data.dataType)) {
|
|
15529
16093
|
previousValue = { type: this.data.dataType, value: [] };
|
|
15530
16094
|
} else if (!previousValue && isScalarDataType(this.data.dataType)) {
|
|
@@ -15543,7 +16107,7 @@ var setGlobalNode = nodeDefinition(SetGlobalNodeImpl, "Set Global");
|
|
|
15543
16107
|
|
|
15544
16108
|
// src/model/nodes/GetGlobalNode.ts
|
|
15545
16109
|
var import_non_secure38 = require("nanoid/non-secure");
|
|
15546
|
-
var
|
|
16110
|
+
var import_ts_dedent35 = require("ts-dedent");
|
|
15547
16111
|
var GetGlobalNodeImpl = class extends NodeImpl {
|
|
15548
16112
|
static create() {
|
|
15549
16113
|
const chartNode = {
|
|
@@ -15558,9 +16122,9 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
15558
16122
|
data: {
|
|
15559
16123
|
id: "variable-name",
|
|
15560
16124
|
dataType: "string",
|
|
15561
|
-
onDemand:
|
|
16125
|
+
onDemand: false,
|
|
15562
16126
|
useIdInput: false,
|
|
15563
|
-
wait:
|
|
16127
|
+
wait: true
|
|
15564
16128
|
}
|
|
15565
16129
|
};
|
|
15566
16130
|
return chartNode;
|
|
@@ -15571,7 +16135,7 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
15571
16135
|
{
|
|
15572
16136
|
id: "id",
|
|
15573
16137
|
title: "Variable ID",
|
|
15574
|
-
dataType:
|
|
16138
|
+
dataType: "string"
|
|
15575
16139
|
}
|
|
15576
16140
|
];
|
|
15577
16141
|
}
|
|
@@ -15594,11 +16158,18 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
15594
16158
|
}
|
|
15595
16159
|
getEditors() {
|
|
15596
16160
|
return [
|
|
16161
|
+
{
|
|
16162
|
+
type: "custom",
|
|
16163
|
+
label: "Search Global Variables",
|
|
16164
|
+
customEditorId: "GetGlobalVariableSelector",
|
|
16165
|
+
autoFocus: true
|
|
16166
|
+
},
|
|
15597
16167
|
{
|
|
15598
16168
|
type: "string",
|
|
15599
16169
|
label: "Variable ID",
|
|
15600
16170
|
dataKey: "id",
|
|
15601
|
-
useInputToggleDataKey: "useIdInput"
|
|
16171
|
+
useInputToggleDataKey: "useIdInput",
|
|
16172
|
+
includeInGraphSearch: true
|
|
15602
16173
|
},
|
|
15603
16174
|
{
|
|
15604
16175
|
type: "dataTypeSelector",
|
|
@@ -15608,17 +16179,19 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
15608
16179
|
{
|
|
15609
16180
|
type: "toggle",
|
|
15610
16181
|
label: "On Demand",
|
|
15611
|
-
dataKey: "onDemand"
|
|
16182
|
+
dataKey: "onDemand",
|
|
16183
|
+
turnOffDataKeysWhenEnabled: ["wait"]
|
|
15612
16184
|
},
|
|
15613
16185
|
{
|
|
15614
16186
|
type: "toggle",
|
|
15615
16187
|
label: "Wait",
|
|
15616
|
-
dataKey: "wait"
|
|
16188
|
+
dataKey: "wait",
|
|
16189
|
+
turnOffDataKeysWhenEnabled: ["onDemand"]
|
|
15617
16190
|
}
|
|
15618
16191
|
];
|
|
15619
16192
|
}
|
|
15620
16193
|
getBody() {
|
|
15621
|
-
return
|
|
16194
|
+
return import_ts_dedent35.dedent`
|
|
15622
16195
|
${this.data.useIdInput ? "(ID from input)" : this.data.id}
|
|
15623
16196
|
Type: ${this.data.dataType}
|
|
15624
16197
|
${this.data.wait ? "Waits for available data" : ""}
|
|
@@ -15626,7 +16199,7 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
15626
16199
|
}
|
|
15627
16200
|
static getUIData() {
|
|
15628
16201
|
return {
|
|
15629
|
-
infoBoxBody:
|
|
16202
|
+
infoBoxBody: import_ts_dedent35.dedent`
|
|
15630
16203
|
Retrieves a global value that is shared across all graphs and subgraphs. The id of the global value is configured in this node.
|
|
15631
16204
|
`,
|
|
15632
16205
|
infoBoxTitle: "Get Global Node",
|
|
@@ -15639,11 +16212,11 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
15639
16212
|
if (this.data.wait) {
|
|
15640
16213
|
throw new Error("Cannot use onDemand and wait together");
|
|
15641
16214
|
}
|
|
16215
|
+
const id2 = this.data.useIdInput ? coerceType(inputs["id"], "string") : this.data.id;
|
|
15642
16216
|
return {
|
|
15643
16217
|
["value"]: {
|
|
15644
16218
|
type: `fn<${this.data.dataType}>`,
|
|
15645
16219
|
value: () => {
|
|
15646
|
-
const id2 = this.data.useIdInput ? coerceType(inputs["id"], "string") : this.data.id;
|
|
15647
16220
|
const value2 = context.getGlobal(id2);
|
|
15648
16221
|
if (value2) {
|
|
15649
16222
|
return value2.value;
|
|
@@ -15653,7 +16226,8 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
15653
16226
|
}
|
|
15654
16227
|
return scalarDefaults[this.data.dataType];
|
|
15655
16228
|
}
|
|
15656
|
-
}
|
|
16229
|
+
},
|
|
16230
|
+
["variable_id_out"]: { type: "string", value: id2 }
|
|
15657
16231
|
};
|
|
15658
16232
|
}
|
|
15659
16233
|
const id = this.data.useIdInput ? coerceType(inputs["id"], "string") : this.data.id;
|
|
@@ -15674,7 +16248,7 @@ var getGlobalNode = nodeDefinition(GetGlobalNodeImpl, "Get Global");
|
|
|
15674
16248
|
|
|
15675
16249
|
// src/model/nodes/WaitForEventNode.ts
|
|
15676
16250
|
var import_non_secure39 = require("nanoid/non-secure");
|
|
15677
|
-
var
|
|
16251
|
+
var import_ts_dedent36 = require("ts-dedent");
|
|
15678
16252
|
var WaitForEventNodeImpl = class extends NodeImpl {
|
|
15679
16253
|
static create() {
|
|
15680
16254
|
return {
|
|
@@ -15733,7 +16307,7 @@ var WaitForEventNodeImpl = class extends NodeImpl {
|
|
|
15733
16307
|
}
|
|
15734
16308
|
static getUIData() {
|
|
15735
16309
|
return {
|
|
15736
|
-
infoBoxBody:
|
|
16310
|
+
infoBoxBody: import_ts_dedent36.dedent`
|
|
15737
16311
|
Waits for a specific event to be raised by a 'Raise Event' node or the host project. The event name can be configured.
|
|
15738
16312
|
`,
|
|
15739
16313
|
infoBoxTitle: "Wait For Event Node",
|
|
@@ -15754,7 +16328,7 @@ var waitForEventNode = nodeDefinition(WaitForEventNodeImpl, "Wait For Event");
|
|
|
15754
16328
|
|
|
15755
16329
|
// src/model/nodes/ToolNode.ts
|
|
15756
16330
|
var import_non_secure40 = require("nanoid/non-secure");
|
|
15757
|
-
var
|
|
16331
|
+
var import_ts_dedent37 = require("ts-dedent");
|
|
15758
16332
|
var GptFunctionNodeImpl = class extends NodeImpl {
|
|
15759
16333
|
static create() {
|
|
15760
16334
|
const chartNode = {
|
|
@@ -15769,7 +16343,7 @@ var GptFunctionNodeImpl = class extends NodeImpl {
|
|
|
15769
16343
|
data: {
|
|
15770
16344
|
name: "newTool",
|
|
15771
16345
|
description: "No description provided",
|
|
15772
|
-
schema:
|
|
16346
|
+
schema: import_ts_dedent37.dedent`
|
|
15773
16347
|
{
|
|
15774
16348
|
"type": "object",
|
|
15775
16349
|
"properties": {}
|
|
@@ -15876,7 +16450,7 @@ ${this.data.description}`
|
|
|
15876
16450
|
}
|
|
15877
16451
|
static getUIData() {
|
|
15878
16452
|
return {
|
|
15879
|
-
infoBoxBody:
|
|
16453
|
+
infoBoxBody: import_ts_dedent37.dedent`
|
|
15880
16454
|
Defines a tool, which is a method that the LLM can call in its responses.
|
|
15881
16455
|
`,
|
|
15882
16456
|
infoBoxTitle: "Tool Node",
|
|
@@ -15921,7 +16495,7 @@ var gptFunctionNode = nodeDefinition(GptFunctionNodeImpl, "Tool");
|
|
|
15921
16495
|
// src/model/nodes/ToYamlNode.ts
|
|
15922
16496
|
var import_non_secure41 = require("nanoid/non-secure");
|
|
15923
16497
|
var import_yaml2 = __toESM(require("yaml"), 1);
|
|
15924
|
-
var
|
|
16498
|
+
var import_ts_dedent38 = require("ts-dedent");
|
|
15925
16499
|
var ToYamlNodeImpl = class extends NodeImpl {
|
|
15926
16500
|
static create() {
|
|
15927
16501
|
const chartNode = {
|
|
@@ -15958,7 +16532,7 @@ var ToYamlNodeImpl = class extends NodeImpl {
|
|
|
15958
16532
|
}
|
|
15959
16533
|
static getUIData() {
|
|
15960
16534
|
return {
|
|
15961
|
-
infoBoxBody:
|
|
16535
|
+
infoBoxBody: import_ts_dedent38.dedent`
|
|
15962
16536
|
Turns the input object into YAML text.
|
|
15963
16537
|
`,
|
|
15964
16538
|
infoBoxTitle: "To YAML Node",
|
|
@@ -15984,7 +16558,7 @@ var toYamlNode = nodeDefinition(ToYamlNodeImpl, "To YAML");
|
|
|
15984
16558
|
|
|
15985
16559
|
// src/model/nodes/GetEmbeddingNode.ts
|
|
15986
16560
|
var import_non_secure42 = require("nanoid/non-secure");
|
|
15987
|
-
var
|
|
16561
|
+
var import_ts_dedent39 = require("ts-dedent");
|
|
15988
16562
|
|
|
15989
16563
|
// src/integrations/integrations.ts
|
|
15990
16564
|
var registeredIntegrations = {
|
|
@@ -16091,7 +16665,7 @@ var GetEmbeddingNodeImpl = class extends NodeImpl {
|
|
|
16091
16665
|
}
|
|
16092
16666
|
static getUIData() {
|
|
16093
16667
|
return {
|
|
16094
|
-
infoBoxBody:
|
|
16668
|
+
infoBoxBody: import_ts_dedent39.dedent`
|
|
16095
16669
|
Gets a OpenAI vector embedding for the input text provided.
|
|
16096
16670
|
|
|
16097
16671
|
Can be used with the Vector Store and Vector KNN nodes.
|
|
@@ -16123,7 +16697,7 @@ var getEmbeddingNode = nodeDefinition(GetEmbeddingNodeImpl, "Get Embedding");
|
|
|
16123
16697
|
|
|
16124
16698
|
// src/model/nodes/VectorStoreNode.ts
|
|
16125
16699
|
var import_non_secure43 = require("nanoid/non-secure");
|
|
16126
|
-
var
|
|
16700
|
+
var import_ts_dedent40 = require("ts-dedent");
|
|
16127
16701
|
var VectorStoreNodeImpl = class extends NodeImpl {
|
|
16128
16702
|
static create() {
|
|
16129
16703
|
return {
|
|
@@ -16203,14 +16777,14 @@ var VectorStoreNodeImpl = class extends NodeImpl {
|
|
|
16203
16777
|
];
|
|
16204
16778
|
}
|
|
16205
16779
|
getBody() {
|
|
16206
|
-
return
|
|
16780
|
+
return import_ts_dedent40.dedent`
|
|
16207
16781
|
Integration: ${this.data.useIntegrationInput ? "(using input)" : this.data.integration}
|
|
16208
16782
|
Collection Id: ${this.data.useCollectionIdInput ? "(using input)" : this.data.collectionId}
|
|
16209
16783
|
`;
|
|
16210
16784
|
}
|
|
16211
16785
|
static getUIData() {
|
|
16212
16786
|
return {
|
|
16213
|
-
infoBoxBody:
|
|
16787
|
+
infoBoxBody: import_ts_dedent40.dedent`
|
|
16214
16788
|
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.
|
|
16215
16789
|
`,
|
|
16216
16790
|
infoBoxTitle: "Vector Store Node",
|
|
@@ -16246,7 +16820,7 @@ var vectorStoreNode = nodeDefinition(VectorStoreNodeImpl, "Vector Store");
|
|
|
16246
16820
|
|
|
16247
16821
|
// src/model/nodes/VectorNearestNeighborsNode.ts
|
|
16248
16822
|
var import_non_secure44 = require("nanoid/non-secure");
|
|
16249
|
-
var
|
|
16823
|
+
var import_ts_dedent41 = require("ts-dedent");
|
|
16250
16824
|
var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
|
|
16251
16825
|
static create() {
|
|
16252
16826
|
return {
|
|
@@ -16333,7 +16907,7 @@ var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
|
|
|
16333
16907
|
];
|
|
16334
16908
|
}
|
|
16335
16909
|
getBody() {
|
|
16336
|
-
return
|
|
16910
|
+
return import_ts_dedent41.dedent`
|
|
16337
16911
|
Integration: ${this.data.useIntegrationInput ? "(using input)" : this.data.integration}
|
|
16338
16912
|
K: ${this.data.useKInput ? "(using input)" : this.data.k}
|
|
16339
16913
|
Collection Id: ${this.data.useCollectionIdInput ? "(using input)" : this.data.collectionId}
|
|
@@ -16341,7 +16915,7 @@ var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
|
|
|
16341
16915
|
}
|
|
16342
16916
|
static getUIData() {
|
|
16343
16917
|
return {
|
|
16344
|
-
infoBoxBody:
|
|
16918
|
+
infoBoxBody: import_ts_dedent41.dedent`
|
|
16345
16919
|
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.
|
|
16346
16920
|
`,
|
|
16347
16921
|
infoBoxTitle: "Vector KNN Node",
|
|
@@ -16374,7 +16948,7 @@ var vectorNearestNeighborsNode = nodeDefinition(VectorNearestNeighborsNodeImpl,
|
|
|
16374
16948
|
var import_non_secure45 = require("nanoid/non-secure");
|
|
16375
16949
|
var crypto = __toESM(require("crypto-js"), 1);
|
|
16376
16950
|
var import_ts_pattern4 = require("ts-pattern");
|
|
16377
|
-
var
|
|
16951
|
+
var import_ts_dedent42 = require("ts-dedent");
|
|
16378
16952
|
var { SHA256, SHA512, MD5, SHA1 } = crypto;
|
|
16379
16953
|
var HashNodeImpl = class extends NodeImpl {
|
|
16380
16954
|
static create() {
|
|
@@ -16432,7 +17006,7 @@ var HashNodeImpl = class extends NodeImpl {
|
|
|
16432
17006
|
}
|
|
16433
17007
|
static getUIData() {
|
|
16434
17008
|
return {
|
|
16435
|
-
infoBoxBody:
|
|
17009
|
+
infoBoxBody: import_ts_dedent42.dedent`
|
|
16436
17010
|
Computes a hash of the input value using the configured hash function.
|
|
16437
17011
|
`,
|
|
16438
17012
|
infoBoxTitle: "Hash Node",
|
|
@@ -16461,7 +17035,7 @@ var hashNode = nodeDefinition(HashNodeImpl, "Hash");
|
|
|
16461
17035
|
|
|
16462
17036
|
// src/model/nodes/AbortGraphNode.ts
|
|
16463
17037
|
var import_non_secure46 = require("nanoid/non-secure");
|
|
16464
|
-
var
|
|
17038
|
+
var import_ts_dedent43 = require("ts-dedent");
|
|
16465
17039
|
var AbortGraphNodeImpl = class extends NodeImpl {
|
|
16466
17040
|
static create() {
|
|
16467
17041
|
const chartNode = {
|
|
@@ -16518,13 +17092,13 @@ var AbortGraphNodeImpl = class extends NodeImpl {
|
|
|
16518
17092
|
];
|
|
16519
17093
|
}
|
|
16520
17094
|
getBody() {
|
|
16521
|
-
return
|
|
17095
|
+
return import_ts_dedent43.dedent`
|
|
16522
17096
|
${this.data.useSuccessfullyInput ? "Success depends on input" : this.data.successfully ? "Successfully Abort" : this.data.errorMessage ? `Error Abort: ${this.data.errorMessage}` : "Error Abort"}
|
|
16523
17097
|
`;
|
|
16524
17098
|
}
|
|
16525
17099
|
static getUIData() {
|
|
16526
17100
|
return {
|
|
16527
|
-
infoBoxBody:
|
|
17101
|
+
infoBoxBody: import_ts_dedent43.dedent`
|
|
16528
17102
|
Aborts the execution of the entire graph immediately.
|
|
16529
17103
|
|
|
16530
17104
|
Can either "successfully" abort the graph (early-exit), or "error" abort the graph.
|
|
@@ -16550,7 +17124,7 @@ var abortGraphNode = nodeDefinition(AbortGraphNodeImpl, "Abort Graph");
|
|
|
16550
17124
|
|
|
16551
17125
|
// src/model/nodes/RaceInputsNode.ts
|
|
16552
17126
|
var import_non_secure47 = require("nanoid/non-secure");
|
|
16553
|
-
var
|
|
17127
|
+
var import_ts_dedent44 = require("ts-dedent");
|
|
16554
17128
|
var RaceInputsNodeImpl = class extends NodeImpl {
|
|
16555
17129
|
static create() {
|
|
16556
17130
|
const chartNode = {
|
|
@@ -16606,7 +17180,7 @@ var RaceInputsNodeImpl = class extends NodeImpl {
|
|
|
16606
17180
|
}
|
|
16607
17181
|
static getUIData() {
|
|
16608
17182
|
return {
|
|
16609
|
-
infoBoxBody:
|
|
17183
|
+
infoBoxBody: import_ts_dedent44.dedent`
|
|
16610
17184
|
Takes in multiple inputs and outputs the value of the first one to finish. The other inputs are cancelled.
|
|
16611
17185
|
`,
|
|
16612
17186
|
infoBoxTitle: "Race Inputs Node",
|
|
@@ -16635,7 +17209,7 @@ var raceInputsNode = nodeDefinition(RaceInputsNodeImpl, "Race Inputs");
|
|
|
16635
17209
|
|
|
16636
17210
|
// src/model/nodes/ToJsonNode.ts
|
|
16637
17211
|
var import_non_secure48 = require("nanoid/non-secure");
|
|
16638
|
-
var
|
|
17212
|
+
var import_ts_dedent45 = require("ts-dedent");
|
|
16639
17213
|
var ToJsonNodeImpl = class extends NodeImpl {
|
|
16640
17214
|
static create() {
|
|
16641
17215
|
const chartNode = {
|
|
@@ -16686,7 +17260,7 @@ var ToJsonNodeImpl = class extends NodeImpl {
|
|
|
16686
17260
|
}
|
|
16687
17261
|
static getUIData() {
|
|
16688
17262
|
return {
|
|
16689
|
-
infoBoxBody:
|
|
17263
|
+
infoBoxBody: import_ts_dedent45.dedent`
|
|
16690
17264
|
Turns the input value into its JSON equivalent (stringifies the value).
|
|
16691
17265
|
`,
|
|
16692
17266
|
infoBoxTitle: "To JSON Node",
|
|
@@ -16709,7 +17283,7 @@ var toJsonNode = nodeDefinition(ToJsonNodeImpl, "To JSON");
|
|
|
16709
17283
|
|
|
16710
17284
|
// src/model/nodes/JoinNode.ts
|
|
16711
17285
|
var import_non_secure49 = require("nanoid/non-secure");
|
|
16712
|
-
var
|
|
17286
|
+
var import_ts_dedent46 = require("ts-dedent");
|
|
16713
17287
|
var JoinNodeImpl = class extends NodeImpl {
|
|
16714
17288
|
static create = () => {
|
|
16715
17289
|
const chartNode = {
|
|
@@ -16791,7 +17365,7 @@ var JoinNodeImpl = class extends NodeImpl {
|
|
|
16791
17365
|
}
|
|
16792
17366
|
static getUIData() {
|
|
16793
17367
|
return {
|
|
16794
|
-
infoBoxBody:
|
|
17368
|
+
infoBoxBody: import_ts_dedent46.dedent`
|
|
16795
17369
|
Takes an array of strings, and joins them using the configured delimiter.
|
|
16796
17370
|
|
|
16797
17371
|
Defaults to a newline.
|
|
@@ -16830,7 +17404,7 @@ var joinNode = nodeDefinition(JoinNodeImpl, "Coalesce");
|
|
|
16830
17404
|
// src/model/nodes/FilterNode.ts
|
|
16831
17405
|
var import_non_secure50 = require("nanoid/non-secure");
|
|
16832
17406
|
var import_lodash_es11 = require("lodash");
|
|
16833
|
-
var
|
|
17407
|
+
var import_ts_dedent47 = require("ts-dedent");
|
|
16834
17408
|
var FilterNodeImpl = class extends NodeImpl {
|
|
16835
17409
|
static create() {
|
|
16836
17410
|
const chartNode = {
|
|
@@ -16873,7 +17447,7 @@ var FilterNodeImpl = class extends NodeImpl {
|
|
|
16873
17447
|
}
|
|
16874
17448
|
static getUIData() {
|
|
16875
17449
|
return {
|
|
16876
|
-
infoBoxBody:
|
|
17450
|
+
infoBoxBody: import_ts_dedent47.dedent`
|
|
16877
17451
|
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.
|
|
16878
17452
|
`,
|
|
16879
17453
|
infoBoxTitle: "Filter Node",
|
|
@@ -16899,10 +17473,10 @@ var filterNode = nodeDefinition(FilterNodeImpl, "Filter");
|
|
|
16899
17473
|
|
|
16900
17474
|
// src/model/nodes/JSFilterNode.ts
|
|
16901
17475
|
var import_non_secure51 = require("nanoid/non-secure");
|
|
16902
|
-
var
|
|
17476
|
+
var import_ts_dedent49 = require("ts-dedent");
|
|
16903
17477
|
|
|
16904
17478
|
// src/model/nodes/jsListCallbackHelpers.ts
|
|
16905
|
-
var
|
|
17479
|
+
var import_ts_dedent48 = require("ts-dedent");
|
|
16906
17480
|
var MAX_CALLBACK_PREVIEW_BODY_LINES = 13;
|
|
16907
17481
|
var JS_LIST_CALLBACK_SIGNATURE = "(item, index, array)";
|
|
16908
17482
|
var JS_LIST_CALLBACK_LOCAL_NAMES = /* @__PURE__ */ new Set(["item", "index", "array"]);
|
|
@@ -16929,7 +17503,7 @@ function getJSListInterpolationContext(callbackBody) {
|
|
|
16929
17503
|
});
|
|
16930
17504
|
}
|
|
16931
17505
|
function buildJSListRuntimePreamble(interpolationContext) {
|
|
16932
|
-
return
|
|
17506
|
+
return import_ts_dedent48.dedent`
|
|
16933
17507
|
const assertSynchronousCallbackResult = ${assertSynchronousCallbackResult.toString()};
|
|
16934
17508
|
${buildJsValueInputClonePreamble({
|
|
16935
17509
|
cacheIdentifier: JS_LIST_INPUT_CLONE_CACHE_IDENTIFIER,
|
|
@@ -16957,7 +17531,7 @@ function buildJSFilterWrapper(callbackBody) {
|
|
|
16957
17531
|
const interpolationContext = getJSListInterpolationContext(callbackBody);
|
|
16958
17532
|
const { inputsIdentifier } = interpolationContext;
|
|
16959
17533
|
const callbackBodySource = buildJSListCallbackRuntimeSource(callbackBody, inputsIdentifier);
|
|
16960
|
-
return
|
|
17534
|
+
return import_ts_dedent48.dedent`
|
|
16961
17535
|
${buildJSListRuntimePreamble(interpolationContext)}
|
|
16962
17536
|
|
|
16963
17537
|
if (!Array.isArray(array)) {
|
|
@@ -16994,7 +17568,7 @@ function buildJSMapWrapper(callbackBody) {
|
|
|
16994
17568
|
const interpolationContext = getJSListInterpolationContext(callbackBody);
|
|
16995
17569
|
const { inputsIdentifier } = interpolationContext;
|
|
16996
17570
|
const callbackBodySource = buildJSListCallbackRuntimeSource(callbackBody, inputsIdentifier);
|
|
16997
|
-
return
|
|
17571
|
+
return import_ts_dedent48.dedent`
|
|
16998
17572
|
${buildJSListRuntimePreamble(interpolationContext)}
|
|
16999
17573
|
|
|
17000
17574
|
if (!Array.isArray(array)) {
|
|
@@ -17063,7 +17637,7 @@ function getJSListNodeBody(callbackBody) {
|
|
|
17063
17637
|
const previewBody = buildJsValuePreview(callbackBody, MAX_CALLBACK_PREVIEW_BODY_LINES);
|
|
17064
17638
|
return {
|
|
17065
17639
|
type: "colorized",
|
|
17066
|
-
text:
|
|
17640
|
+
text: import_ts_dedent48.dedent`
|
|
17067
17641
|
${JS_LIST_CALLBACK_SIGNATURE} => {
|
|
17068
17642
|
${indentLines(previewBody, " ")}
|
|
17069
17643
|
}
|
|
@@ -17143,7 +17717,7 @@ var JSFilterNodeImpl = class extends NodeImpl {
|
|
|
17143
17717
|
}
|
|
17144
17718
|
static getUIData() {
|
|
17145
17719
|
return {
|
|
17146
|
-
infoBoxBody:
|
|
17720
|
+
infoBoxBody: import_ts_dedent49.dedent`
|
|
17147
17721
|
Filters an input array using the body of a JavaScript callback.
|
|
17148
17722
|
|
|
17149
17723
|
Available callback parameters are <code>item</code>, <code>index</code>, and <code>array</code>.
|
|
@@ -17170,7 +17744,7 @@ var jsFilterNode = nodeDefinition(JSFilterNodeImpl, "JS Filter");
|
|
|
17170
17744
|
|
|
17171
17745
|
// src/model/nodes/JSMapNode.ts
|
|
17172
17746
|
var import_non_secure52 = require("nanoid/non-secure");
|
|
17173
|
-
var
|
|
17747
|
+
var import_ts_dedent50 = require("ts-dedent");
|
|
17174
17748
|
var DEFAULT_CALLBACK_BODY2 = "return item;";
|
|
17175
17749
|
var JSMapNodeImpl = class extends NodeImpl {
|
|
17176
17750
|
static create() {
|
|
@@ -17209,7 +17783,7 @@ var JSMapNodeImpl = class extends NodeImpl {
|
|
|
17209
17783
|
}
|
|
17210
17784
|
static getUIData() {
|
|
17211
17785
|
return {
|
|
17212
|
-
infoBoxBody:
|
|
17786
|
+
infoBoxBody: import_ts_dedent50.dedent`
|
|
17213
17787
|
Maps an input array using the body of a JavaScript callback.
|
|
17214
17788
|
|
|
17215
17789
|
Available callback parameters are <code>item</code>, <code>index</code>, and <code>array</code>.
|
|
@@ -17236,7 +17810,7 @@ var jsMapNode = nodeDefinition(JSMapNodeImpl, "JS Map");
|
|
|
17236
17810
|
|
|
17237
17811
|
// src/model/nodes/ObjectNode.ts
|
|
17238
17812
|
var import_non_secure53 = require("nanoid/non-secure");
|
|
17239
|
-
var
|
|
17813
|
+
var import_ts_dedent51 = require("ts-dedent");
|
|
17240
17814
|
var DEFAULT_JSON_TEMPLATE = `{
|
|
17241
17815
|
"key": "{{input}}"
|
|
17242
17816
|
}`;
|
|
@@ -17334,7 +17908,7 @@ var ObjectNodeImpl = class extends NodeImpl {
|
|
|
17334
17908
|
}
|
|
17335
17909
|
static getUIData() {
|
|
17336
17910
|
return {
|
|
17337
|
-
infoBoxBody:
|
|
17911
|
+
infoBoxBody: import_ts_dedent51.dedent`
|
|
17338
17912
|
Creates an object from input values and a JSON template, escaping the input values and inserting them into the template.
|
|
17339
17913
|
|
|
17340
17914
|
Use double-quotes around the input values to escape them. String values are automatically escaped.
|
|
@@ -17422,7 +17996,7 @@ var objectNode = nodeDefinition(ObjectNodeImpl, "Object");
|
|
|
17422
17996
|
|
|
17423
17997
|
// src/model/nodes/BooleanNode.ts
|
|
17424
17998
|
var import_non_secure54 = require("nanoid/non-secure");
|
|
17425
|
-
var
|
|
17999
|
+
var import_ts_dedent52 = require("ts-dedent");
|
|
17426
18000
|
var BooleanNodeImpl = class extends NodeImpl {
|
|
17427
18001
|
static create() {
|
|
17428
18002
|
const chartNode = {
|
|
@@ -17466,7 +18040,7 @@ var BooleanNodeImpl = class extends NodeImpl {
|
|
|
17466
18040
|
}
|
|
17467
18041
|
static getUIData() {
|
|
17468
18042
|
return {
|
|
17469
|
-
infoBoxBody:
|
|
18043
|
+
infoBoxBody: import_ts_dedent52.dedent`
|
|
17470
18044
|
Outputs a boolean constant, or converts an input value into a boolean.
|
|
17471
18045
|
`,
|
|
17472
18046
|
infoBoxTitle: "Bool Node",
|
|
@@ -17490,7 +18064,7 @@ var booleanNode = nodeDefinition(BooleanNodeImpl, "Boolean");
|
|
|
17490
18064
|
var import_non_secure55 = require("nanoid/non-secure");
|
|
17491
18065
|
var import_lodash_es12 = require("lodash");
|
|
17492
18066
|
var import_ts_pattern5 = require("ts-pattern");
|
|
17493
|
-
var
|
|
18067
|
+
var import_ts_dedent53 = require("ts-dedent");
|
|
17494
18068
|
var CompareNodeImpl = class extends NodeImpl {
|
|
17495
18069
|
static create() {
|
|
17496
18070
|
const chartNode = {
|
|
@@ -17568,7 +18142,7 @@ var CompareNodeImpl = class extends NodeImpl {
|
|
|
17568
18142
|
}
|
|
17569
18143
|
static getUIData() {
|
|
17570
18144
|
return {
|
|
17571
|
-
infoBoxBody:
|
|
18145
|
+
infoBoxBody: import_ts_dedent53.dedent`
|
|
17572
18146
|
Compares two values using the configured operator and outputs the result.
|
|
17573
18147
|
|
|
17574
18148
|
If the data types of the values do not match, then the B value is converted to the type of the A value.
|
|
@@ -17611,7 +18185,7 @@ var compareNode = nodeDefinition(CompareNodeImpl, "Compare");
|
|
|
17611
18185
|
// src/model/nodes/EvaluateNode.ts
|
|
17612
18186
|
var import_non_secure56 = require("nanoid/non-secure");
|
|
17613
18187
|
var import_ts_pattern6 = require("ts-pattern");
|
|
17614
|
-
var
|
|
18188
|
+
var import_ts_dedent54 = require("ts-dedent");
|
|
17615
18189
|
var unaryOperation = ["abs", "negate"];
|
|
17616
18190
|
var isUnaryOp = (operation) => unaryOperation.includes(operation);
|
|
17617
18191
|
var EvaluateNodeImpl = class extends NodeImpl {
|
|
@@ -17697,7 +18271,7 @@ var EvaluateNodeImpl = class extends NodeImpl {
|
|
|
17697
18271
|
}
|
|
17698
18272
|
static getUIData() {
|
|
17699
18273
|
return {
|
|
17700
|
-
infoBoxBody:
|
|
18274
|
+
infoBoxBody: import_ts_dedent54.dedent`
|
|
17701
18275
|
Evaluates the configured mathematical operation on the input values and outputs the result.
|
|
17702
18276
|
|
|
17703
18277
|
For more complex operations, you should use the \`Code\` node.
|
|
@@ -17734,7 +18308,7 @@ var evaluateNode = nodeDefinition(EvaluateNodeImpl, "Evaluate");
|
|
|
17734
18308
|
|
|
17735
18309
|
// src/model/nodes/NumberNode.ts
|
|
17736
18310
|
var import_non_secure57 = require("nanoid/non-secure");
|
|
17737
|
-
var
|
|
18311
|
+
var import_ts_dedent55 = require("ts-dedent");
|
|
17738
18312
|
var NumberNodeImpl = class extends NodeImpl {
|
|
17739
18313
|
static create() {
|
|
17740
18314
|
const chartNode = {
|
|
@@ -17784,7 +18358,7 @@ var NumberNodeImpl = class extends NodeImpl {
|
|
|
17784
18358
|
}
|
|
17785
18359
|
static getUIData() {
|
|
17786
18360
|
return {
|
|
17787
|
-
infoBoxBody:
|
|
18361
|
+
infoBoxBody: import_ts_dedent55.dedent`
|
|
17788
18362
|
Outputs a number constant, or converts an input value into a number.
|
|
17789
18363
|
|
|
17790
18364
|
Can be configured to round the number to a certain number of decimal places.
|
|
@@ -17812,7 +18386,7 @@ var numberNode = nodeDefinition(NumberNodeImpl, "Number");
|
|
|
17812
18386
|
|
|
17813
18387
|
// src/model/nodes/RandomNumberNode.ts
|
|
17814
18388
|
var import_non_secure58 = require("nanoid/non-secure");
|
|
17815
|
-
var
|
|
18389
|
+
var import_ts_dedent56 = require("ts-dedent");
|
|
17816
18390
|
var randomNumberTypeOptions = [
|
|
17817
18391
|
{ value: false, label: "Float" },
|
|
17818
18392
|
{ value: true, label: "Integer" }
|
|
@@ -17880,7 +18454,7 @@ var RandomNumberNodeImpl = class extends NodeImpl {
|
|
|
17880
18454
|
];
|
|
17881
18455
|
}
|
|
17882
18456
|
getBody() {
|
|
17883
|
-
return
|
|
18457
|
+
return import_ts_dedent56.dedent`
|
|
17884
18458
|
Min: ${this.data.useMinInput ? "(Input)" : this.data.min ?? 0}
|
|
17885
18459
|
Max: ${this.data.useMaxInput ? "(Input)" : this.data.max ?? 1}
|
|
17886
18460
|
${this.data.integers ? "Integers" : "Floats"}
|
|
@@ -17889,7 +18463,7 @@ var RandomNumberNodeImpl = class extends NodeImpl {
|
|
|
17889
18463
|
}
|
|
17890
18464
|
static getUIData() {
|
|
17891
18465
|
return {
|
|
17892
|
-
infoBoxBody:
|
|
18466
|
+
infoBoxBody: import_ts_dedent56.dedent`
|
|
17893
18467
|
Outputs a random number between the configured min and max values.
|
|
17894
18468
|
|
|
17895
18469
|
Can be configured to output only integers, and whether the max value is inclusive or exclusive.
|
|
@@ -17922,7 +18496,7 @@ var randomNumberNode = nodeDefinition(RandomNumberNodeImpl, "Random number");
|
|
|
17922
18496
|
// src/model/nodes/ShuffleNode.ts
|
|
17923
18497
|
var import_non_secure59 = require("nanoid/non-secure");
|
|
17924
18498
|
var import_lodash_es13 = require("lodash");
|
|
17925
|
-
var
|
|
18499
|
+
var import_ts_dedent57 = require("ts-dedent");
|
|
17926
18500
|
var ShuffleNodeImpl = class extends NodeImpl {
|
|
17927
18501
|
static create() {
|
|
17928
18502
|
const chartNode = {
|
|
@@ -17958,7 +18532,7 @@ var ShuffleNodeImpl = class extends NodeImpl {
|
|
|
17958
18532
|
}
|
|
17959
18533
|
static getUIData() {
|
|
17960
18534
|
return {
|
|
17961
|
-
infoBoxBody:
|
|
18535
|
+
infoBoxBody: import_ts_dedent57.dedent`
|
|
17962
18536
|
Shuffles the input array. Outputs the shuffled array.
|
|
17963
18537
|
`,
|
|
17964
18538
|
infoBoxTitle: "Shuffle Node",
|
|
@@ -17983,7 +18557,7 @@ var shuffleNode = nodeDefinition(ShuffleNodeImpl, "Shuffle");
|
|
|
17983
18557
|
|
|
17984
18558
|
// src/model/nodes/CommentNode.ts
|
|
17985
18559
|
var import_non_secure60 = require("nanoid/non-secure");
|
|
17986
|
-
var
|
|
18560
|
+
var import_ts_dedent58 = require("ts-dedent");
|
|
17987
18561
|
var CommentNodeImpl = class extends NodeImpl {
|
|
17988
18562
|
static create() {
|
|
17989
18563
|
const chartNode = {
|
|
@@ -18035,7 +18609,7 @@ var CommentNodeImpl = class extends NodeImpl {
|
|
|
18035
18609
|
}
|
|
18036
18610
|
static getUIData() {
|
|
18037
18611
|
return {
|
|
18038
|
-
infoBoxBody:
|
|
18612
|
+
infoBoxBody: import_ts_dedent58.dedent`
|
|
18039
18613
|
A comment node is a node that does nothing. It is useful for adding notes to a graph.
|
|
18040
18614
|
`,
|
|
18041
18615
|
infoBoxTitle: "Comment Node",
|
|
@@ -18818,7 +19392,7 @@ var httpCallNode = nodeDefinition(HttpCallNodeImpl, "Http Call");
|
|
|
18818
19392
|
|
|
18819
19393
|
// src/model/nodes/DelayNode.ts
|
|
18820
19394
|
var import_non_secure64 = require("nanoid/non-secure");
|
|
18821
|
-
var
|
|
19395
|
+
var import_ts_dedent59 = require("ts-dedent");
|
|
18822
19396
|
var DelayNodeImpl = class extends NodeImpl {
|
|
18823
19397
|
static create() {
|
|
18824
19398
|
const chartNode = {
|
|
@@ -18869,7 +19443,7 @@ var DelayNodeImpl = class extends NodeImpl {
|
|
|
18869
19443
|
}
|
|
18870
19444
|
static getUIData() {
|
|
18871
19445
|
return {
|
|
18872
|
-
infoBoxBody:
|
|
19446
|
+
infoBoxBody: import_ts_dedent59.dedent`
|
|
18873
19447
|
Delays the execution and then passes the input value to the output without any modifications.
|
|
18874
19448
|
`,
|
|
18875
19449
|
infoBoxTitle: "Delay Node",
|
|
@@ -18921,7 +19495,7 @@ var delayNode = nodeDefinition(DelayNodeImpl, "Delay");
|
|
|
18921
19495
|
|
|
18922
19496
|
// src/model/nodes/AppendToDatasetNode.ts
|
|
18923
19497
|
var import_non_secure65 = require("nanoid/non-secure");
|
|
18924
|
-
var
|
|
19498
|
+
var import_ts_dedent60 = require("ts-dedent");
|
|
18925
19499
|
var AppendToDatasetNodeImpl = class extends NodeImpl {
|
|
18926
19500
|
static create() {
|
|
18927
19501
|
return {
|
|
@@ -18981,7 +19555,7 @@ var AppendToDatasetNodeImpl = class extends NodeImpl {
|
|
|
18981
19555
|
}
|
|
18982
19556
|
static getUIData() {
|
|
18983
19557
|
return {
|
|
18984
|
-
infoBoxBody:
|
|
19558
|
+
infoBoxBody: import_ts_dedent60.dedent`
|
|
18985
19559
|
Appends a row of data to the specified dataset.
|
|
18986
19560
|
`,
|
|
18987
19561
|
infoBoxTitle: "Append to Dataset Node",
|
|
@@ -19532,7 +20106,7 @@ var getDatasetRowNode = nodeDefinition(GetDatasetRowNodeImpl, "Get Dataset Row")
|
|
|
19532
20106
|
|
|
19533
20107
|
// src/model/nodes/SliceNode.ts
|
|
19534
20108
|
var import_non_secure66 = require("nanoid/non-secure");
|
|
19535
|
-
var
|
|
20109
|
+
var import_ts_dedent61 = require("ts-dedent");
|
|
19536
20110
|
var SliceNodeImpl = class extends NodeImpl {
|
|
19537
20111
|
static create() {
|
|
19538
20112
|
const chartNode = {
|
|
@@ -19591,14 +20165,14 @@ var SliceNodeImpl = class extends NodeImpl {
|
|
|
19591
20165
|
];
|
|
19592
20166
|
}
|
|
19593
20167
|
getBody() {
|
|
19594
|
-
return
|
|
20168
|
+
return import_ts_dedent61.dedent`
|
|
19595
20169
|
Start: ${this.data.useStartInput ? "(Using Input)" : this.data.start == null ? "0" : this.data.start}
|
|
19596
20170
|
Count: ${this.data.useCountInput ? "(Using Input)" : this.data.count == null ? "All" : this.data.count}
|
|
19597
20171
|
`;
|
|
19598
20172
|
}
|
|
19599
20173
|
static getUIData() {
|
|
19600
20174
|
return {
|
|
19601
|
-
infoBoxBody:
|
|
20175
|
+
infoBoxBody: import_ts_dedent61.dedent`
|
|
19602
20176
|
Slices an array from the start index for the count number of elements.
|
|
19603
20177
|
|
|
19604
20178
|
Useful for extracting a portion of an array.
|
|
@@ -19625,7 +20199,7 @@ var sliceNode = nodeDefinition(SliceNodeImpl, "Slice");
|
|
|
19625
20199
|
|
|
19626
20200
|
// src/model/nodes/ExtractMarkdownCodeBlocksNode.ts
|
|
19627
20201
|
var import_non_secure67 = require("nanoid/non-secure");
|
|
19628
|
-
var
|
|
20202
|
+
var import_ts_dedent62 = require("ts-dedent");
|
|
19629
20203
|
var ExtractMarkdownCodeBlocksNodeImpl = class extends NodeImpl {
|
|
19630
20204
|
static create() {
|
|
19631
20205
|
const chartNode = {
|
|
@@ -19672,7 +20246,7 @@ var ExtractMarkdownCodeBlocksNodeImpl = class extends NodeImpl {
|
|
|
19672
20246
|
}
|
|
19673
20247
|
static getUIData() {
|
|
19674
20248
|
return {
|
|
19675
|
-
infoBoxBody:
|
|
20249
|
+
infoBoxBody: import_ts_dedent62.dedent`
|
|
19676
20250
|
Extracts the code blocks in the input Markdown text.
|
|
19677
20251
|
|
|
19678
20252
|
Outputs the first matched block, all matched blocks, and the languages specified for the blocks.
|
|
@@ -20011,7 +20585,7 @@ var urlReferenceNode = nodeDefinition(UrlReferenceNodeImpl, "URL Reference");
|
|
|
20011
20585
|
// src/model/nodes/DestructureNode.ts
|
|
20012
20586
|
var import_non_secure70 = require("nanoid/non-secure");
|
|
20013
20587
|
var import_jsonpath_plus3 = require("jsonpath-plus");
|
|
20014
|
-
var
|
|
20588
|
+
var import_ts_dedent63 = require("ts-dedent");
|
|
20015
20589
|
var DestructureNodeImpl = class extends NodeImpl {
|
|
20016
20590
|
static create() {
|
|
20017
20591
|
const chartNode = {
|
|
@@ -20079,7 +20653,7 @@ var DestructureNodeImpl = class extends NodeImpl {
|
|
|
20079
20653
|
}
|
|
20080
20654
|
static getUIData() {
|
|
20081
20655
|
return {
|
|
20082
|
-
infoBoxBody:
|
|
20656
|
+
infoBoxBody: import_ts_dedent63.dedent`
|
|
20083
20657
|
Destructures the input value by extracting values at the specified paths. The paths use JSONPath notation to navigate through the value.
|
|
20084
20658
|
`,
|
|
20085
20659
|
infoBoxTitle: "Destructure Node",
|
|
@@ -20114,7 +20688,7 @@ var destructureNode = nodeDefinition(DestructureNodeImpl, "Destructure");
|
|
|
20114
20688
|
|
|
20115
20689
|
// src/model/nodes/ReplaceDatasetNode.ts
|
|
20116
20690
|
var import_non_secure71 = require("nanoid/non-secure");
|
|
20117
|
-
var
|
|
20691
|
+
var import_ts_dedent64 = require("ts-dedent");
|
|
20118
20692
|
var ReplaceDatasetNodeImpl = class extends NodeImpl {
|
|
20119
20693
|
static create() {
|
|
20120
20694
|
return {
|
|
@@ -20157,7 +20731,7 @@ var ReplaceDatasetNodeImpl = class extends NodeImpl {
|
|
|
20157
20731
|
}
|
|
20158
20732
|
static getUIData() {
|
|
20159
20733
|
return {
|
|
20160
|
-
infoBoxBody:
|
|
20734
|
+
infoBoxBody: import_ts_dedent64.dedent`
|
|
20161
20735
|
Replaces the data in a dataset with the given data. If no data is given, the dataset will be cleared instead.
|
|
20162
20736
|
`,
|
|
20163
20737
|
infoBoxTitle: "Replace Dataset Node",
|
|
@@ -20290,7 +20864,7 @@ var listGraphsNode = nodeDefinition(ListGraphsNodeImpl, "List Graphs");
|
|
|
20290
20864
|
|
|
20291
20865
|
// src/model/nodes/GraphReferenceNode.ts
|
|
20292
20866
|
var import_non_secure72 = require("nanoid/non-secure");
|
|
20293
|
-
var
|
|
20867
|
+
var import_ts_dedent65 = require("ts-dedent");
|
|
20294
20868
|
var GraphReferenceNodeImpl = class extends NodeImpl {
|
|
20295
20869
|
static create() {
|
|
20296
20870
|
const chartNode = {
|
|
@@ -20345,7 +20919,7 @@ var GraphReferenceNodeImpl = class extends NodeImpl {
|
|
|
20345
20919
|
}
|
|
20346
20920
|
static getUIData() {
|
|
20347
20921
|
return {
|
|
20348
|
-
infoBoxBody:
|
|
20922
|
+
infoBoxBody: import_ts_dedent65.dedent`
|
|
20349
20923
|
Gets a reference to another graph, that can be used to pass around graphs to call using a Call Graph node.
|
|
20350
20924
|
`,
|
|
20351
20925
|
infoBoxTitle: "Graph Reference Node",
|
|
@@ -20412,7 +20986,7 @@ var graphReferenceNode = nodeDefinition(GraphReferenceNodeImpl, "Graph Reference
|
|
|
20412
20986
|
|
|
20413
20987
|
// src/model/nodes/CallGraphNode.ts
|
|
20414
20988
|
var import_non_secure73 = require("nanoid/non-secure");
|
|
20415
|
-
var
|
|
20989
|
+
var import_ts_dedent66 = require("ts-dedent");
|
|
20416
20990
|
|
|
20417
20991
|
// src/api/looseDataValue.ts
|
|
20418
20992
|
var import_lodash_es15 = require("lodash");
|
|
@@ -20488,7 +21062,7 @@ var CallGraphNodeImpl = class extends NodeImpl {
|
|
|
20488
21062
|
}
|
|
20489
21063
|
static getUIData() {
|
|
20490
21064
|
return {
|
|
20491
|
-
infoBoxBody:
|
|
21065
|
+
infoBoxBody: import_ts_dedent66.dedent`
|
|
20492
21066
|
Calls another graph and passes inputs to it. Use in combination with the Graph Reference node to call dynamic graphs.
|
|
20493
21067
|
`,
|
|
20494
21068
|
infoBoxTitle: "Call Graph Node",
|
|
@@ -20560,7 +21134,7 @@ var callGraphNode = nodeDefinition(CallGraphNodeImpl, "Call Graph");
|
|
|
20560
21134
|
|
|
20561
21135
|
// src/model/nodes/DelegateFunctionCallNode.ts
|
|
20562
21136
|
var import_nanoid = require("nanoid");
|
|
20563
|
-
var
|
|
21137
|
+
var import_ts_dedent67 = require("ts-dedent");
|
|
20564
21138
|
var DelegateFunctionCallNodeImpl = class extends NodeImpl {
|
|
20565
21139
|
static create() {
|
|
20566
21140
|
const chartNode = {
|
|
@@ -20612,7 +21186,7 @@ var DelegateFunctionCallNodeImpl = class extends NodeImpl {
|
|
|
20612
21186
|
}
|
|
20613
21187
|
static getUIData() {
|
|
20614
21188
|
return {
|
|
20615
|
-
infoBoxBody:
|
|
21189
|
+
infoBoxBody: import_ts_dedent67.dedent`
|
|
20616
21190
|
Handles a tool call by delegating it to a different subgraph depending on the tool call.
|
|
20617
21191
|
`,
|
|
20618
21192
|
infoBoxTitle: "Delegate Tool Call Node",
|
|
@@ -20962,7 +21536,7 @@ var documentNode = nodeDefinition(DocumentNodeImpl, "Document");
|
|
|
20962
21536
|
|
|
20963
21537
|
// src/model/nodes/ChatLoopNode.ts
|
|
20964
21538
|
var import_non_secure76 = require("nanoid/non-secure");
|
|
20965
|
-
var
|
|
21539
|
+
var import_ts_dedent68 = require("ts-dedent");
|
|
20966
21540
|
var ChatLoopNodeImpl = class extends NodeImpl {
|
|
20967
21541
|
static create() {
|
|
20968
21542
|
const chartNode = {
|
|
@@ -21001,7 +21575,7 @@ var ChatLoopNodeImpl = class extends NodeImpl {
|
|
|
21001
21575
|
}
|
|
21002
21576
|
static getUIData() {
|
|
21003
21577
|
return {
|
|
21004
|
-
infoBoxBody:
|
|
21578
|
+
infoBoxBody: import_ts_dedent68.dedent`
|
|
21005
21579
|
Creates an interactive chat loop with an AI model. The node will:
|
|
21006
21580
|
1. Send the initial prompt to the AI
|
|
21007
21581
|
2. Show the AI's response and prompt for user input
|
|
@@ -21102,7 +21676,7 @@ var chatLoopNode = nodeDefinition(ChatLoopNodeImpl, "Chat Loop");
|
|
|
21102
21676
|
|
|
21103
21677
|
// src/model/nodes/ReadAllFilesNode.ts
|
|
21104
21678
|
var import_non_secure77 = require("nanoid/non-secure");
|
|
21105
|
-
var
|
|
21679
|
+
var import_ts_dedent69 = require("ts-dedent");
|
|
21106
21680
|
var ReadAllFilesNodeImpl = class extends NodeImpl {
|
|
21107
21681
|
static create() {
|
|
21108
21682
|
return {
|
|
@@ -21217,7 +21791,7 @@ var ReadAllFilesNodeImpl = class extends NodeImpl {
|
|
|
21217
21791
|
];
|
|
21218
21792
|
}
|
|
21219
21793
|
getBody() {
|
|
21220
|
-
return
|
|
21794
|
+
return import_ts_dedent69.dedent`
|
|
21221
21795
|
${this.data.asBinary ? "Read as Binary" : "Read as Text"}
|
|
21222
21796
|
Path: ${this.data.usePathInput ? "(Input)" : this.data.path}
|
|
21223
21797
|
Recursive: ${this.data.useRecursiveInput ? "(Input)" : this.data.recursive}
|
|
@@ -21226,7 +21800,7 @@ var ReadAllFilesNodeImpl = class extends NodeImpl {
|
|
|
21226
21800
|
}
|
|
21227
21801
|
static getUIData() {
|
|
21228
21802
|
return {
|
|
21229
|
-
infoBoxBody:
|
|
21803
|
+
infoBoxBody: import_ts_dedent69.dedent`
|
|
21230
21804
|
Reads all files in the specified directory and outputs an array of objects containing each file's path and contents.
|
|
21231
21805
|
Each object has a 'path' (string) and 'content' (string or binary) property.
|
|
21232
21806
|
`,
|
|
@@ -21300,7 +21874,7 @@ var readAllFilesNode = nodeDefinition(ReadAllFilesNodeImpl, "Read All Files");
|
|
|
21300
21874
|
|
|
21301
21875
|
// src/model/nodes/ToMarkdownTableNode.ts
|
|
21302
21876
|
var import_non_secure78 = require("nanoid/non-secure");
|
|
21303
|
-
var
|
|
21877
|
+
var import_ts_dedent70 = require("ts-dedent");
|
|
21304
21878
|
var ToMarkdownTableNodeImpl = class extends NodeImpl {
|
|
21305
21879
|
static create() {
|
|
21306
21880
|
const chartNode = {
|
|
@@ -21362,7 +21936,7 @@ var ToMarkdownTableNodeImpl = class extends NodeImpl {
|
|
|
21362
21936
|
}
|
|
21363
21937
|
static getUIData() {
|
|
21364
21938
|
return {
|
|
21365
|
-
infoBoxBody:
|
|
21939
|
+
infoBoxBody: import_ts_dedent70.dedent`
|
|
21366
21940
|
Converts an array of objects into a markdown table format.
|
|
21367
21941
|
Input should be an array of objects with consistent keys.
|
|
21368
21942
|
`,
|
|
@@ -21414,7 +21988,7 @@ var toMarkdownTableNode = nodeDefinition(ToMarkdownTableNodeImpl, "To Markdown T
|
|
|
21414
21988
|
|
|
21415
21989
|
// src/model/nodes/CronNode.ts
|
|
21416
21990
|
var import_nanoid2 = require("nanoid");
|
|
21417
|
-
var
|
|
21991
|
+
var import_ts_dedent71 = require("ts-dedent");
|
|
21418
21992
|
var cronParser = __toESM(require("cron-parser"), 1);
|
|
21419
21993
|
var CronNodeImpl = class extends NodeImpl {
|
|
21420
21994
|
static create() {
|
|
@@ -21484,7 +22058,7 @@ var CronNodeImpl = class extends NodeImpl {
|
|
|
21484
22058
|
}
|
|
21485
22059
|
static getUIData() {
|
|
21486
22060
|
return {
|
|
21487
|
-
infoBoxBody:
|
|
22061
|
+
infoBoxBody: import_ts_dedent71.dedent`
|
|
21488
22062
|
Executes a subgraph on a schedule. Supports:
|
|
21489
22063
|
- Natural language (e.g., "every 5 minutes", "daily at 3pm")
|
|
21490
22064
|
- Cron expressions (e.g., "0 * * * *")
|
|
@@ -21524,7 +22098,7 @@ var CronNodeImpl = class extends NodeImpl {
|
|
|
21524
22098
|
type: "string",
|
|
21525
22099
|
dataKey: "schedule",
|
|
21526
22100
|
label: "Schedule",
|
|
21527
|
-
helperMessage:
|
|
22101
|
+
helperMessage: import_ts_dedent71.dedent`
|
|
21528
22102
|
Examples:
|
|
21529
22103
|
Cron: "*/5 * * * *", "0 15 * * *"
|
|
21530
22104
|
Interval: "5 minutes", "1 hour", "7 days"
|
|
@@ -21656,7 +22230,7 @@ var cronNode = nodeDefinition(CronNodeImpl, "Cron");
|
|
|
21656
22230
|
|
|
21657
22231
|
// src/model/nodes/ToTreeNode.ts
|
|
21658
22232
|
var import_non_secure79 = require("nanoid/non-secure");
|
|
21659
|
-
var
|
|
22233
|
+
var import_ts_dedent72 = require("ts-dedent");
|
|
21660
22234
|
var import_lodash_es16 = require("lodash");
|
|
21661
22235
|
var ToTreeNodeImpl = class extends NodeImpl {
|
|
21662
22236
|
static create() {
|
|
@@ -21718,7 +22292,7 @@ var ToTreeNodeImpl = class extends NodeImpl {
|
|
|
21718
22292
|
];
|
|
21719
22293
|
}
|
|
21720
22294
|
getBody() {
|
|
21721
|
-
return
|
|
22295
|
+
return import_ts_dedent72.dedent`
|
|
21722
22296
|
Format: ${this.data.format}
|
|
21723
22297
|
Children: ${this.data.childrenProperty}
|
|
21724
22298
|
Sort: ${this.data.useSortAlphabetically ? "Yes" : "No"}
|
|
@@ -21726,7 +22300,7 @@ var ToTreeNodeImpl = class extends NodeImpl {
|
|
|
21726
22300
|
}
|
|
21727
22301
|
static getUIData() {
|
|
21728
22302
|
return {
|
|
21729
|
-
infoBoxBody:
|
|
22303
|
+
infoBoxBody: import_ts_dedent72.dedent`
|
|
21730
22304
|
Converts an array of objects into a tree structure and renders it as text.
|
|
21731
22305
|
|
|
21732
22306
|
The format field supports interpolation using {{property}} syntax to determine
|
|
@@ -21782,7 +22356,7 @@ var toTreeNode = nodeDefinition(ToTreeNodeImpl, "To Tree");
|
|
|
21782
22356
|
|
|
21783
22357
|
// src/model/nodes/LoopUntilNode.ts
|
|
21784
22358
|
var import_non_secure80 = require("nanoid/non-secure");
|
|
21785
|
-
var
|
|
22359
|
+
var import_ts_dedent73 = require("ts-dedent");
|
|
21786
22360
|
var LoopUntilNodeImpl = class extends NodeImpl {
|
|
21787
22361
|
static create() {
|
|
21788
22362
|
const chartNode = {
|
|
@@ -21801,38 +22375,13 @@ var LoopUntilNodeImpl = class extends NodeImpl {
|
|
|
21801
22375
|
};
|
|
21802
22376
|
return chartNode;
|
|
21803
22377
|
}
|
|
21804
|
-
getInputDefinitions(_connections, _nodes, project) {
|
|
21805
|
-
const
|
|
21806
|
-
|
|
21807
|
-
if (graph) {
|
|
21808
|
-
const inputNodes = graph.nodes.filter((node) => node.type === "graphInput");
|
|
21809
|
-
const inputIds = [...new Set(inputNodes.map((node) => node.data.id))].sort();
|
|
21810
|
-
inputIds.forEach((id) => {
|
|
21811
|
-
const inputNode = inputNodes.find((node) => node.data.id === id);
|
|
21812
|
-
inputs.push({
|
|
21813
|
-
id,
|
|
21814
|
-
title: id,
|
|
21815
|
-
dataType: inputNode.data.dataType
|
|
21816
|
-
});
|
|
21817
|
-
});
|
|
21818
|
-
}
|
|
21819
|
-
return inputs;
|
|
22378
|
+
getInputDefinitions(_connections, _nodes, project, _referencedProjects, definitionContext) {
|
|
22379
|
+
const boundary = this.getBoundary(project, definitionContext);
|
|
22380
|
+
return boundary ? getGraphBoundaryInputDefinitions(boundary) : [];
|
|
21820
22381
|
}
|
|
21821
|
-
getOutputDefinitions(_connections, _nodes, project) {
|
|
21822
|
-
const
|
|
21823
|
-
const
|
|
21824
|
-
if (graph) {
|
|
21825
|
-
const outputNodes = graph.nodes.filter((node) => node.type === "graphOutput");
|
|
21826
|
-
const outputIds = [...new Set(outputNodes.map((node) => node.data.id))].sort();
|
|
21827
|
-
outputIds.forEach((id) => {
|
|
21828
|
-
const outputNode = outputNodes.find((node) => node.data.id === id);
|
|
21829
|
-
outputs.push({
|
|
21830
|
-
id,
|
|
21831
|
-
title: id,
|
|
21832
|
-
dataType: outputNode.data.dataType
|
|
21833
|
-
});
|
|
21834
|
-
});
|
|
21835
|
-
}
|
|
22382
|
+
getOutputDefinitions(_connections, _nodes, project, _referencedProjects, definitionContext) {
|
|
22383
|
+
const boundary = this.getBoundary(project, definitionContext);
|
|
22384
|
+
const outputs = boundary ? getGraphBoundaryOutputDefinitions(boundary) : [];
|
|
21836
22385
|
outputs.push(
|
|
21837
22386
|
{
|
|
21838
22387
|
id: "iteration",
|
|
@@ -21891,19 +22440,16 @@ var LoopUntilNodeImpl = class extends NodeImpl {
|
|
|
21891
22440
|
);
|
|
21892
22441
|
}
|
|
21893
22442
|
if (this.data.targetGraph) {
|
|
21894
|
-
const
|
|
21895
|
-
if (
|
|
21896
|
-
const
|
|
21897
|
-
const inputIds = [...new Set(inputNodes.map((node) => node.data.id))].sort();
|
|
21898
|
-
for (const inputId of inputIds) {
|
|
21899
|
-
const inputNode = inputNodes.find((node) => node.data.id === inputId);
|
|
22443
|
+
const boundary = getGraphBoundary(context.project, this.data.targetGraph);
|
|
22444
|
+
if (boundary) {
|
|
22445
|
+
for (const input of boundary.inputs) {
|
|
21900
22446
|
definitions.push({
|
|
21901
22447
|
type: "dynamic",
|
|
21902
22448
|
dataKey: "inputData",
|
|
21903
|
-
dynamicDataKey:
|
|
21904
|
-
dataType:
|
|
21905
|
-
label:
|
|
21906
|
-
editor:
|
|
22449
|
+
dynamicDataKey: input.id,
|
|
22450
|
+
dataType: input.dataType,
|
|
22451
|
+
label: input.id,
|
|
22452
|
+
editor: input.editor ?? "auto"
|
|
21907
22453
|
});
|
|
21908
22454
|
}
|
|
21909
22455
|
}
|
|
@@ -21912,7 +22458,7 @@ var LoopUntilNodeImpl = class extends NodeImpl {
|
|
|
21912
22458
|
}
|
|
21913
22459
|
static getUIData() {
|
|
21914
22460
|
return {
|
|
21915
|
-
infoBoxBody:
|
|
22461
|
+
infoBoxBody: import_ts_dedent73.dedent`
|
|
21916
22462
|
Executes a subgraph in a loop until a condition is met. Each iteration's outputs become
|
|
21917
22463
|
the inputs for the next iteration. Supports different stopping conditions and optional
|
|
21918
22464
|
maximum iterations.
|
|
@@ -21934,6 +22480,9 @@ Max iterations: ${this.data.maxIterations}` : "";
|
|
|
21934
22480
|
return `Executes ${graphName}
|
|
21935
22481
|
until ${condition}${maxIterations}`;
|
|
21936
22482
|
}
|
|
22483
|
+
getBoundary(project, definitionContext) {
|
|
22484
|
+
return (definitionContext == null ? void 0 : definitionContext.getGraphBoundary(project, this.data.targetGraph)) ?? getGraphBoundary(project, this.data.targetGraph);
|
|
22485
|
+
}
|
|
21937
22486
|
shouldBreak(outputs) {
|
|
21938
22487
|
var _a;
|
|
21939
22488
|
if (this.data.conditionType === "allOutputsSet") {
|
|
@@ -22271,7 +22820,7 @@ var mcpDiscoveryNode = nodeDefinition(MCPDiscoveryNodeImpl, "MCP Discovery");
|
|
|
22271
22820
|
|
|
22272
22821
|
// src/model/nodes/MCPToolCallNode.ts
|
|
22273
22822
|
var import_non_secure81 = require("nanoid/non-secure");
|
|
22274
|
-
var
|
|
22823
|
+
var import_ts_dedent74 = require("ts-dedent");
|
|
22275
22824
|
var MCPToolCallNodeImpl = class extends NodeImpl {
|
|
22276
22825
|
static create() {
|
|
22277
22826
|
const chartNode = {
|
|
@@ -22290,7 +22839,7 @@ var MCPToolCallNodeImpl = class extends NodeImpl {
|
|
|
22290
22839
|
serverUrl: "http://localhost:8080/mcp",
|
|
22291
22840
|
serverId: "",
|
|
22292
22841
|
toolName: "",
|
|
22293
|
-
toolArguments:
|
|
22842
|
+
toolArguments: import_ts_dedent74.dedent`
|
|
22294
22843
|
{
|
|
22295
22844
|
"key": "value"
|
|
22296
22845
|
}`,
|
|
@@ -22430,7 +22979,7 @@ var MCPToolCallNodeImpl = class extends NodeImpl {
|
|
|
22430
22979
|
}
|
|
22431
22980
|
static getUIData() {
|
|
22432
22981
|
return {
|
|
22433
|
-
infoBoxBody:
|
|
22982
|
+
infoBoxBody: import_ts_dedent74.dedent`
|
|
22434
22983
|
Connects to an MCP (Model Context Protocol) server and gets a tool call response.
|
|
22435
22984
|
`,
|
|
22436
22985
|
infoBoxTitle: "MCP Tool Call Node",
|
|
@@ -22742,7 +23291,7 @@ var mcpGetPromptNode = nodeDefinition(MCPGetPromptNodeImpl, "MCP Get Prompt");
|
|
|
22742
23291
|
|
|
22743
23292
|
// src/model/nodes/ReferencedGraphAliasNode.ts
|
|
22744
23293
|
var import_non_secure83 = require("nanoid/non-secure");
|
|
22745
|
-
var
|
|
23294
|
+
var import_ts_dedent75 = require("ts-dedent");
|
|
22746
23295
|
var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
22747
23296
|
static create() {
|
|
22748
23297
|
const chartNode = {
|
|
@@ -22765,48 +23314,25 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
22765
23314
|
};
|
|
22766
23315
|
return chartNode;
|
|
22767
23316
|
}
|
|
22768
|
-
getInputDefinitions(_connections, _nodes, _project, referencedProjects) {
|
|
23317
|
+
getInputDefinitions(_connections, _nodes, _project, referencedProjects, definitionContext) {
|
|
22769
23318
|
const referencedProject = referencedProjects[this.data.projectId];
|
|
22770
23319
|
if (!referencedProject) {
|
|
22771
23320
|
return [];
|
|
22772
23321
|
}
|
|
22773
|
-
const
|
|
22774
|
-
|
|
22775
|
-
return [];
|
|
22776
|
-
}
|
|
22777
|
-
const inputNodes = graph.nodes.filter((node) => node.type === "graphInput");
|
|
22778
|
-
const inputIds = [...new Set(inputNodes.map((node) => node.data.id))].sort();
|
|
22779
|
-
return inputIds.map(
|
|
22780
|
-
(id) => ({
|
|
22781
|
-
id,
|
|
22782
|
-
title: id,
|
|
22783
|
-
dataType: inputNodes.find((node) => node.data.id === id).data.dataType
|
|
22784
|
-
})
|
|
22785
|
-
);
|
|
23322
|
+
const boundary = this.getBoundary(referencedProject, definitionContext);
|
|
23323
|
+
return boundary ? getGraphBoundaryInputDefinitions(boundary) : [];
|
|
22786
23324
|
}
|
|
22787
|
-
getGraphOutputs(referencedProject) {
|
|
22788
|
-
const
|
|
22789
|
-
|
|
22790
|
-
return [];
|
|
22791
|
-
}
|
|
22792
|
-
const outputNodes = graph.nodes.filter((node) => node.type === "graphOutput");
|
|
22793
|
-
const outputIds = [...new Set(outputNodes.map((node) => node.data.id))].sort();
|
|
22794
|
-
const outputs = outputIds.map(
|
|
22795
|
-
(id) => ({
|
|
22796
|
-
id,
|
|
22797
|
-
title: id,
|
|
22798
|
-
dataType: outputNodes.find((node) => node.data.id === id).data.dataType
|
|
22799
|
-
})
|
|
22800
|
-
);
|
|
22801
|
-
return outputs;
|
|
23325
|
+
getGraphOutputs(referencedProject, definitionContext) {
|
|
23326
|
+
const boundary = this.getBoundary(referencedProject, definitionContext);
|
|
23327
|
+
return boundary ? getGraphBoundaryOutputDefinitions(boundary) : [];
|
|
22802
23328
|
}
|
|
22803
|
-
getOutputDefinitions(_connections, _nodes, _project, referencedProjects) {
|
|
23329
|
+
getOutputDefinitions(_connections, _nodes, _project, referencedProjects, definitionContext) {
|
|
22804
23330
|
const outputs = [];
|
|
22805
23331
|
const referencedProject = referencedProjects[this.data.projectId];
|
|
22806
23332
|
if (!referencedProject) {
|
|
22807
23333
|
return outputs;
|
|
22808
23334
|
}
|
|
22809
|
-
outputs.push(...this.getGraphOutputs(referencedProject));
|
|
23335
|
+
outputs.push(...this.getGraphOutputs(referencedProject, definitionContext));
|
|
22810
23336
|
if (this.data.useErrorOutput) {
|
|
22811
23337
|
outputs.push({
|
|
22812
23338
|
id: "error",
|
|
@@ -22816,6 +23342,9 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
22816
23342
|
}
|
|
22817
23343
|
return outputs;
|
|
22818
23344
|
}
|
|
23345
|
+
getBoundary(referencedProject, definitionContext) {
|
|
23346
|
+
return (definitionContext == null ? void 0 : definitionContext.getGraphBoundary(referencedProject, this.data.graphId)) ?? getGraphBoundary(referencedProject, this.data.graphId);
|
|
23347
|
+
}
|
|
22819
23348
|
getEditors(context) {
|
|
22820
23349
|
const definitions = [
|
|
22821
23350
|
{
|
|
@@ -22831,19 +23360,16 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
22831
23360
|
];
|
|
22832
23361
|
const referencedProject = context.referencedProjects[this.data.projectId];
|
|
22833
23362
|
if (referencedProject) {
|
|
22834
|
-
const
|
|
22835
|
-
if (
|
|
22836
|
-
const
|
|
22837
|
-
const inputIds = [...new Set(inputNodes.map((node) => node.data.id))].sort();
|
|
22838
|
-
for (const inputId of inputIds) {
|
|
22839
|
-
const inputNode = inputNodes.find((node) => node.data.id === inputId);
|
|
23363
|
+
const boundary = getGraphBoundary(referencedProject, this.data.graphId);
|
|
23364
|
+
if (boundary) {
|
|
23365
|
+
for (const input of boundary.inputs) {
|
|
22840
23366
|
definitions.push({
|
|
22841
23367
|
type: "dynamic",
|
|
22842
23368
|
dataKey: "inputData",
|
|
22843
|
-
dynamicDataKey:
|
|
22844
|
-
dataType:
|
|
22845
|
-
label:
|
|
22846
|
-
editor:
|
|
23369
|
+
dynamicDataKey: input.id,
|
|
23370
|
+
dataType: input.dataType,
|
|
23371
|
+
label: input.id,
|
|
23372
|
+
editor: input.editor ?? "auto"
|
|
22847
23373
|
});
|
|
22848
23374
|
}
|
|
22849
23375
|
}
|
|
@@ -22856,7 +23382,7 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
22856
23382
|
}
|
|
22857
23383
|
static getUIData() {
|
|
22858
23384
|
return {
|
|
22859
|
-
infoBoxBody:
|
|
23385
|
+
infoBoxBody: import_ts_dedent75.dedent`
|
|
22860
23386
|
References a graph from another project. Inputs and outputs are defined by Graph Input and Graph Output nodes within the referenced graph.
|
|
22861
23387
|
`,
|
|
22862
23388
|
infoBoxTitle: "Referenced Graph Alias Node",
|
|
@@ -22865,6 +23391,7 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
22865
23391
|
};
|
|
22866
23392
|
}
|
|
22867
23393
|
async process(inputs, context) {
|
|
23394
|
+
var _a;
|
|
22868
23395
|
const referencedProject = context.referencedProjects[this.data.projectId];
|
|
22869
23396
|
if (!referencedProject) {
|
|
22870
23397
|
throw new Error(
|
|
@@ -22877,24 +23404,8 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
22877
23404
|
`ReferencedGraphAliasNode requires a graph with id ${this.data.graphId} to be present in the referenced project.`
|
|
22878
23405
|
);
|
|
22879
23406
|
}
|
|
22880
|
-
const
|
|
22881
|
-
const
|
|
22882
|
-
const inputData = inputIds.reduce((obj, id) => {
|
|
22883
|
-
var _a;
|
|
22884
|
-
if (inputs[id] != null) {
|
|
22885
|
-
return {
|
|
22886
|
-
...obj,
|
|
22887
|
-
[id]: inputs[id]
|
|
22888
|
-
};
|
|
22889
|
-
}
|
|
22890
|
-
if (((_a = this.data.inputData) == null ? void 0 : _a[id]) != null) {
|
|
22891
|
-
return {
|
|
22892
|
-
...obj,
|
|
22893
|
-
[id]: this.data.inputData[id]
|
|
22894
|
-
};
|
|
22895
|
-
}
|
|
22896
|
-
return obj;
|
|
22897
|
-
}, {});
|
|
23407
|
+
const boundary = ((_a = context.getGraphBoundary) == null ? void 0 : _a.call(context, referencedProject, this.data.graphId)) ?? getGraphBoundary(referencedProject, this.data.graphId);
|
|
23408
|
+
const inputData = buildGraphBoundaryInputData(boundary, inputs, this.data.inputData);
|
|
22898
23409
|
const subGraphProcessor = context.createSubProcessor(this.data.graphId, {
|
|
22899
23410
|
signal: context.signal,
|
|
22900
23411
|
project: referencedProject
|
|
@@ -22928,16 +23439,7 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
22928
23439
|
if (!this.data.useErrorOutput) {
|
|
22929
23440
|
throw err;
|
|
22930
23441
|
}
|
|
22931
|
-
const outputs =
|
|
22932
|
-
(obj, output) => ({
|
|
22933
|
-
...obj,
|
|
22934
|
-
[output.id]: {
|
|
22935
|
-
type: "control-flow-excluded",
|
|
22936
|
-
value: void 0
|
|
22937
|
-
}
|
|
22938
|
-
}),
|
|
22939
|
-
{}
|
|
22940
|
-
);
|
|
23442
|
+
const outputs = buildExcludedGraphBoundaryOutputs(boundary);
|
|
22941
23443
|
outputs["error"] = {
|
|
22942
23444
|
type: "string",
|
|
22943
23445
|
value: getError(err).message
|
|
@@ -23013,6 +23515,82 @@ var BrowserNativeApi = class {
|
|
|
23013
23515
|
}
|
|
23014
23516
|
};
|
|
23015
23517
|
|
|
23518
|
+
// src/model/DebuggerTransportSentinel.ts
|
|
23519
|
+
var DEBUGGER_TRANSPORT_SENTINEL_KEY = "__rivetDebuggerTransportSentinel";
|
|
23520
|
+
var DEBUGGER_TRANSPORT_SENTINEL_VERSION = 1;
|
|
23521
|
+
function createDebuggerTransportUndefinedSentinel() {
|
|
23522
|
+
return {
|
|
23523
|
+
[DEBUGGER_TRANSPORT_SENTINEL_KEY]: {
|
|
23524
|
+
type: "undefined",
|
|
23525
|
+
version: DEBUGGER_TRANSPORT_SENTINEL_VERSION
|
|
23526
|
+
}
|
|
23527
|
+
};
|
|
23528
|
+
}
|
|
23529
|
+
function createDebuggerTransportEscapedSentinel(value) {
|
|
23530
|
+
return {
|
|
23531
|
+
[DEBUGGER_TRANSPORT_SENTINEL_KEY]: {
|
|
23532
|
+
type: "escaped-sentinel",
|
|
23533
|
+
version: DEBUGGER_TRANSPORT_SENTINEL_VERSION,
|
|
23534
|
+
value
|
|
23535
|
+
}
|
|
23536
|
+
};
|
|
23537
|
+
}
|
|
23538
|
+
function createDebuggerTransportEscapedSentinelEnvelope(value) {
|
|
23539
|
+
return createDebuggerTransportEscapedSentinel(getDebuggerTransportSentinel(value) ?? value);
|
|
23540
|
+
}
|
|
23541
|
+
function isDebuggerTransportSentinelEnvelope(value) {
|
|
23542
|
+
return getDebuggerTransportSentinel(value) != null;
|
|
23543
|
+
}
|
|
23544
|
+
function decodeDebuggerTransportSentinels(value) {
|
|
23545
|
+
return decodeDebuggerTransportSentinelsInner(value);
|
|
23546
|
+
}
|
|
23547
|
+
function decodeDebuggerTransportSentinelsInner(value) {
|
|
23548
|
+
const sentinel = getDebuggerTransportSentinel(value);
|
|
23549
|
+
if (sentinel) {
|
|
23550
|
+
if (sentinel.type === "undefined") {
|
|
23551
|
+
return void 0;
|
|
23552
|
+
}
|
|
23553
|
+
if (sentinel.type === "escaped-sentinel") {
|
|
23554
|
+
return {
|
|
23555
|
+
[DEBUGGER_TRANSPORT_SENTINEL_KEY]: decodeDebuggerTransportSentinelsInner(sentinel.value)
|
|
23556
|
+
};
|
|
23557
|
+
}
|
|
23558
|
+
}
|
|
23559
|
+
if (Array.isArray(value)) {
|
|
23560
|
+
return value.map((item) => decodeDebuggerTransportSentinelsInner(item));
|
|
23561
|
+
}
|
|
23562
|
+
if (typeof value !== "object" || value == null) {
|
|
23563
|
+
return value;
|
|
23564
|
+
}
|
|
23565
|
+
const decoded = {};
|
|
23566
|
+
for (const [key, item] of Object.entries(value)) {
|
|
23567
|
+
decoded[key] = decodeDebuggerTransportSentinelsInner(item);
|
|
23568
|
+
}
|
|
23569
|
+
return decoded;
|
|
23570
|
+
}
|
|
23571
|
+
function getDebuggerTransportSentinel(value) {
|
|
23572
|
+
if (typeof value !== "object" || value == null || Array.isArray(value)) {
|
|
23573
|
+
return void 0;
|
|
23574
|
+
}
|
|
23575
|
+
const valueKeys = Object.keys(value);
|
|
23576
|
+
if (valueKeys.length !== 1 || valueKeys[0] !== DEBUGGER_TRANSPORT_SENTINEL_KEY) {
|
|
23577
|
+
return void 0;
|
|
23578
|
+
}
|
|
23579
|
+
const sentinel = value[DEBUGGER_TRANSPORT_SENTINEL_KEY];
|
|
23580
|
+
if (typeof sentinel !== "object" || sentinel == null || Array.isArray(sentinel)) {
|
|
23581
|
+
return void 0;
|
|
23582
|
+
}
|
|
23583
|
+
const typedSentinel = sentinel;
|
|
23584
|
+
const sentinelKeys = Object.keys(typedSentinel);
|
|
23585
|
+
if (typedSentinel.type === "undefined") {
|
|
23586
|
+
return sentinelKeys.length === 2 && typedSentinel.version === DEBUGGER_TRANSPORT_SENTINEL_VERSION ? typedSentinel : void 0;
|
|
23587
|
+
}
|
|
23588
|
+
if (typedSentinel.type === "escaped-sentinel") {
|
|
23589
|
+
return sentinelKeys.length === 3 && typedSentinel.version === DEBUGGER_TRANSPORT_SENTINEL_VERSION ? typedSentinel : void 0;
|
|
23590
|
+
}
|
|
23591
|
+
return void 0;
|
|
23592
|
+
}
|
|
23593
|
+
|
|
23016
23594
|
// src/integrations/openai/OpenAIEmbeddingGenerator.ts
|
|
23017
23595
|
var import_openai6 = require("openai");
|
|
23018
23596
|
var OpenAIEmbeddingGenerator = class {
|
|
@@ -23107,6 +23685,13 @@ function fnv1a(value, { size = 32, utf8Buffer } = {}) {
|
|
|
23107
23685
|
function withExecution(base, execution) {
|
|
23108
23686
|
return execution == null ? base : { ...base, execution };
|
|
23109
23687
|
}
|
|
23688
|
+
function withDuration(base, durationMs, splitRunDurationMs) {
|
|
23689
|
+
return {
|
|
23690
|
+
...base,
|
|
23691
|
+
...durationMs === void 0 ? {} : { durationMs },
|
|
23692
|
+
...splitRunDurationMs === void 0 ? {} : { splitRunDurationMs }
|
|
23693
|
+
};
|
|
23694
|
+
}
|
|
23110
23695
|
var toRecordedEventMap = {
|
|
23111
23696
|
graphStart: ({ graph, inputs, execution }) => withExecution({ graphId: graph.metadata.id, inputs }, execution),
|
|
23112
23697
|
graphFinish: ({ graph, outputs, execution }) => withExecution({ graphId: graph.metadata.id, outputs }, execution),
|
|
@@ -23119,16 +23704,16 @@ var toRecordedEventMap = {
|
|
|
23119
23704
|
inputs,
|
|
23120
23705
|
processId
|
|
23121
23706
|
}, execution),
|
|
23122
|
-
nodeFinish: ({ node, outputs, processId, execution }) => withExecution({
|
|
23707
|
+
nodeFinish: ({ node, outputs, processId, durationMs, splitRunDurationMs, execution }) => withExecution(withDuration({
|
|
23123
23708
|
nodeId: node.id,
|
|
23124
23709
|
outputs,
|
|
23125
23710
|
processId
|
|
23126
|
-
}, execution),
|
|
23127
|
-
nodeError: ({ node, error, processId, execution }) => withExecution({
|
|
23711
|
+
}, durationMs, splitRunDurationMs), execution),
|
|
23712
|
+
nodeError: ({ node, error, processId, durationMs, splitRunDurationMs, execution }) => withExecution(withDuration({
|
|
23128
23713
|
nodeId: node.id,
|
|
23129
23714
|
error: typeof error === "string" ? error : error.stack,
|
|
23130
23715
|
processId
|
|
23131
|
-
}, execution),
|
|
23716
|
+
}, durationMs, splitRunDurationMs), execution),
|
|
23132
23717
|
abort: ({ successful, error }) => ({ successful, error: typeof error === "string" ? error : error == null ? void 0 : error.stack }),
|
|
23133
23718
|
graphAbort: ({ successful, error, graph, execution }) => withExecution({
|
|
23134
23719
|
successful,
|
|
@@ -23306,7 +23891,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
23306
23891
|
return;
|
|
23307
23892
|
}
|
|
23308
23893
|
this.#events.push(toRecordedEvent(message, data));
|
|
23309
|
-
if (message
|
|
23894
|
+
if (isRecordingTerminalEvent(message, data)) {
|
|
23310
23895
|
emitDetached(this.#emitter, "finish", {
|
|
23311
23896
|
recording: this.getRecording()
|
|
23312
23897
|
});
|
|
@@ -23327,7 +23912,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
23327
23912
|
return;
|
|
23328
23913
|
}
|
|
23329
23914
|
this.#events.push(toRecordedEvent(event, data));
|
|
23330
|
-
if (event
|
|
23915
|
+
if (isRecordingTerminalEvent(event, data)) {
|
|
23331
23916
|
emitDetached(this.#emitter, "finish", {
|
|
23332
23917
|
recording: this.getRecording()
|
|
23333
23918
|
});
|
|
@@ -23372,10 +23957,16 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
23372
23957
|
return (0, import_json_stream_es.stringifyJsonStream)(serializeToObject(this.getRecording()));
|
|
23373
23958
|
}
|
|
23374
23959
|
};
|
|
23960
|
+
function isRecordingTerminalEvent(event, data) {
|
|
23961
|
+
if (event === "done" || event === "error") {
|
|
23962
|
+
return true;
|
|
23963
|
+
}
|
|
23964
|
+
return event === "abort" && data.successful !== true;
|
|
23965
|
+
}
|
|
23375
23966
|
|
|
23376
23967
|
// src/plugins/anthropic/nodes/ChatAnthropicNode.ts
|
|
23377
23968
|
var import_non_secure85 = require("nanoid/non-secure");
|
|
23378
|
-
var
|
|
23969
|
+
var import_ts_dedent76 = require("ts-dedent");
|
|
23379
23970
|
var import_p_retry2 = __toESM(require("p-retry-4"), 1);
|
|
23380
23971
|
|
|
23381
23972
|
// src/utils/assertNever.ts
|
|
@@ -23534,7 +24125,7 @@ var ChatAnthropicNodeImpl = {
|
|
|
23534
24125
|
getBody(data) {
|
|
23535
24126
|
var _a;
|
|
23536
24127
|
const modelName = data.overrideModel ? data.overrideModel : ((_a = anthropicModels[data.model]) == null ? void 0 : _a.displayName) ?? "Unknown Model";
|
|
23537
|
-
return
|
|
24128
|
+
return import_ts_dedent76.dedent`
|
|
23538
24129
|
${modelName}
|
|
23539
24130
|
${data.useTopP ? `Top P: ${data.useTopPInput ? "(Using Input)" : data.top_p}` : `Temperature: ${data.useTemperatureInput ? "(Using Input)" : data.temperature}`}
|
|
23540
24131
|
Max Tokens: ${data.maxTokens}
|
|
@@ -23659,7 +24250,7 @@ var ChatAnthropicNodeImpl = {
|
|
|
23659
24250
|
},
|
|
23660
24251
|
getUIData() {
|
|
23661
24252
|
return {
|
|
23662
|
-
infoBoxBody:
|
|
24253
|
+
infoBoxBody: import_ts_dedent76.dedent`
|
|
23663
24254
|
Legacy Anthropic chat node.
|
|
23664
24255
|
|
|
23665
24256
|
For new work, prefer \`LLM Chat\`, which keeps provider selection inside one shared node.
|
|
@@ -24133,7 +24724,7 @@ var anthropic_default = anthropicPlugin;
|
|
|
24133
24724
|
|
|
24134
24725
|
// src/plugins/autoevals/AutoEvalsNode.ts
|
|
24135
24726
|
var import_non_secure86 = require("nanoid/non-secure");
|
|
24136
|
-
var
|
|
24727
|
+
var import_ts_dedent77 = require("ts-dedent");
|
|
24137
24728
|
var import_autoevals = require("autoevals");
|
|
24138
24729
|
var import_ts_pattern8 = require("ts-pattern");
|
|
24139
24730
|
var options = [
|
|
@@ -24267,7 +24858,7 @@ var AutoEvalsNodeImpl = {
|
|
|
24267
24858
|
},
|
|
24268
24859
|
getUIData() {
|
|
24269
24860
|
return {
|
|
24270
|
-
infoBoxBody:
|
|
24861
|
+
infoBoxBody: import_ts_dedent77.dedent`
|
|
24271
24862
|
Evaluates the validity of a response using the autoevals library.
|
|
24272
24863
|
`,
|
|
24273
24864
|
infoBoxTitle: "Autoevals Node",
|
|
@@ -24348,7 +24939,7 @@ var autoevals_default = autoevalsPlugin;
|
|
|
24348
24939
|
|
|
24349
24940
|
// src/plugins/assemblyAi/LemurQaNode.ts
|
|
24350
24941
|
var import_non_secure87 = require("nanoid/non-secure");
|
|
24351
|
-
var
|
|
24942
|
+
var import_ts_dedent78 = require("ts-dedent");
|
|
24352
24943
|
|
|
24353
24944
|
// src/plugins/assemblyAi/lemurHelpers.ts
|
|
24354
24945
|
var import_assemblyai = require("assemblyai");
|
|
@@ -24534,7 +25125,7 @@ var LemurQaNodeImpl = {
|
|
|
24534
25125
|
},
|
|
24535
25126
|
getUIData() {
|
|
24536
25127
|
return {
|
|
24537
|
-
infoBoxBody:
|
|
25128
|
+
infoBoxBody: import_ts_dedent78.dedent`Use AssemblyAI LeMUR to ask questions about transcripts`,
|
|
24538
25129
|
infoBoxTitle: "Use AssemblyAI LeMUR Question & Answer",
|
|
24539
25130
|
contextMenuTitle: "LeMUR Q&A",
|
|
24540
25131
|
group: ["AI", "AssemblyAI"]
|
|
@@ -24607,7 +25198,7 @@ var lemurQaNode = pluginNodeDefinition(LemurQaNodeImpl, "LeMUR Q&A");
|
|
|
24607
25198
|
|
|
24608
25199
|
// src/plugins/assemblyAi/TranscribeAudioNode.ts
|
|
24609
25200
|
var import_non_secure88 = require("nanoid/non-secure");
|
|
24610
|
-
var
|
|
25201
|
+
var import_ts_dedent79 = require("ts-dedent");
|
|
24611
25202
|
var TranscribeAudioNodeImpl = {
|
|
24612
25203
|
create() {
|
|
24613
25204
|
const chartNode = {
|
|
@@ -24669,7 +25260,7 @@ var TranscribeAudioNodeImpl = {
|
|
|
24669
25260
|
},
|
|
24670
25261
|
getUIData() {
|
|
24671
25262
|
return {
|
|
24672
|
-
infoBoxBody:
|
|
25263
|
+
infoBoxBody: import_ts_dedent79.dedent`Use AssemblyAI to transcribe audio`,
|
|
24673
25264
|
infoBoxTitle: "Transcribe Audio Node",
|
|
24674
25265
|
contextMenuTitle: "Transcribe Audio",
|
|
24675
25266
|
group: ["AI", "AssemblyAI"]
|
|
@@ -24729,7 +25320,7 @@ function getAdditionalParameters(data) {
|
|
|
24729
25320
|
|
|
24730
25321
|
// src/plugins/assemblyAi/LemurSummaryNode.ts
|
|
24731
25322
|
var import_non_secure89 = require("nanoid/non-secure");
|
|
24732
|
-
var
|
|
25323
|
+
var import_ts_dedent80 = require("ts-dedent");
|
|
24733
25324
|
var import_assemblyai3 = require("assemblyai");
|
|
24734
25325
|
var LemurSummaryNodeImpl = {
|
|
24735
25326
|
create() {
|
|
@@ -24782,7 +25373,7 @@ var LemurSummaryNodeImpl = {
|
|
|
24782
25373
|
},
|
|
24783
25374
|
getUIData() {
|
|
24784
25375
|
return {
|
|
24785
|
-
infoBoxBody:
|
|
25376
|
+
infoBoxBody: import_ts_dedent80.dedent`Use AssemblyAI LeMUR Summary to summarize transcripts`,
|
|
24786
25377
|
infoBoxTitle: "Use AssemblyAI LeMUR Summary",
|
|
24787
25378
|
contextMenuTitle: "LeMUR Summary",
|
|
24788
25379
|
group: ["AI", "AssemblyAI"]
|
|
@@ -24807,7 +25398,7 @@ var lemurSummaryNode = pluginNodeDefinition(LemurSummaryNodeImpl, "LeMUR Summary
|
|
|
24807
25398
|
|
|
24808
25399
|
// src/plugins/assemblyAi/LemurTaskNode.ts
|
|
24809
25400
|
var import_non_secure90 = require("nanoid/non-secure");
|
|
24810
|
-
var
|
|
25401
|
+
var import_ts_dedent81 = require("ts-dedent");
|
|
24811
25402
|
var import_assemblyai4 = require("assemblyai");
|
|
24812
25403
|
var LemurTaskNodeImpl = {
|
|
24813
25404
|
create() {
|
|
@@ -24860,7 +25451,7 @@ var LemurTaskNodeImpl = {
|
|
|
24860
25451
|
},
|
|
24861
25452
|
getUIData() {
|
|
24862
25453
|
return {
|
|
24863
|
-
infoBoxBody:
|
|
25454
|
+
infoBoxBody: import_ts_dedent81.dedent`Use AssemblyAI LeMUR Custom Task to ask anything.`,
|
|
24864
25455
|
infoBoxTitle: "Use AssemblyAI LeMUR Custom Task",
|
|
24865
25456
|
contextMenuTitle: "LeMUR Custom Task",
|
|
24866
25457
|
group: ["AI", "AssemblyAI"]
|
|
@@ -24887,7 +25478,7 @@ var lemurTaskNode = pluginNodeDefinition(LemurTaskNodeImpl, "LeMUR Task");
|
|
|
24887
25478
|
|
|
24888
25479
|
// src/plugins/assemblyAi/LemurActionItemsNode.ts
|
|
24889
25480
|
var import_non_secure91 = require("nanoid/non-secure");
|
|
24890
|
-
var
|
|
25481
|
+
var import_ts_dedent82 = require("ts-dedent");
|
|
24891
25482
|
var LemurActionItemsNodeImpl = {
|
|
24892
25483
|
create() {
|
|
24893
25484
|
const chartNode = {
|
|
@@ -24939,7 +25530,7 @@ var LemurActionItemsNodeImpl = {
|
|
|
24939
25530
|
},
|
|
24940
25531
|
getUIData() {
|
|
24941
25532
|
return {
|
|
24942
|
-
infoBoxBody:
|
|
25533
|
+
infoBoxBody: import_ts_dedent82.dedent`Use AssemblyAI LeMUR Action Items to extract action items`,
|
|
24943
25534
|
infoBoxTitle: "Use AssemblyAI LeMUR Action Items",
|
|
24944
25535
|
contextMenuTitle: "LeMUR Action Items",
|
|
24945
25536
|
group: ["AI", "AssemblyAI"]
|
|
@@ -25228,7 +25819,7 @@ var chatHuggingFaceNode = pluginNodeDefinition(ChatHuggingFaceNodeImpl, "Chat (H
|
|
|
25228
25819
|
// src/plugins/huggingface/nodes/TextToImageHuggingFace.ts
|
|
25229
25820
|
var import_non_secure93 = require("nanoid/non-secure");
|
|
25230
25821
|
var import_inference2 = require("@huggingface/inference");
|
|
25231
|
-
var
|
|
25822
|
+
var import_ts_dedent83 = require("ts-dedent");
|
|
25232
25823
|
var TextToImageHuggingFaceNodeImpl = {
|
|
25233
25824
|
create() {
|
|
25234
25825
|
return {
|
|
@@ -25373,7 +25964,7 @@ var TextToImageHuggingFaceNodeImpl = {
|
|
|
25373
25964
|
];
|
|
25374
25965
|
},
|
|
25375
25966
|
getBody(data) {
|
|
25376
|
-
return
|
|
25967
|
+
return import_ts_dedent83.dedent`
|
|
25377
25968
|
Model: ${data.useModelInput ? "(Using Input)" : data.model}
|
|
25378
25969
|
`;
|
|
25379
25970
|
},
|
|
@@ -28549,7 +29140,7 @@ var openAIPlugin = {
|
|
|
28549
29140
|
|
|
28550
29141
|
// src/plugins/google/nodes/ChatGoogleNode.ts
|
|
28551
29142
|
var import_non_secure94 = require("nanoid/non-secure");
|
|
28552
|
-
var
|
|
29143
|
+
var import_ts_dedent84 = require("ts-dedent");
|
|
28553
29144
|
var import_p_retry3 = __toESM(require("p-retry-4"), 1);
|
|
28554
29145
|
var import_ts_pattern9 = require("ts-pattern");
|
|
28555
29146
|
var import_genai2 = require("@google/genai");
|
|
@@ -28712,7 +29303,7 @@ var ChatGoogleNodeImpl = {
|
|
|
28712
29303
|
},
|
|
28713
29304
|
getBody(data) {
|
|
28714
29305
|
var _a;
|
|
28715
|
-
return
|
|
29306
|
+
return import_ts_dedent84.dedent`
|
|
28716
29307
|
${((_a = generativeAiGoogleModels[data.model]) == null ? void 0 : _a.displayName) ?? `Google (${data.model})`}
|
|
28717
29308
|
${data.useTopP ? `Top P: ${data.useTopPInput ? "(Using Input)" : data.top_p}` : `Temperature: ${data.useTemperatureInput ? "(Using Input)" : data.temperature}`}
|
|
28718
29309
|
Max Tokens: ${data.maxTokens}
|
|
@@ -28799,7 +29390,7 @@ var ChatGoogleNodeImpl = {
|
|
|
28799
29390
|
},
|
|
28800
29391
|
getUIData() {
|
|
28801
29392
|
return {
|
|
28802
|
-
infoBoxBody:
|
|
29393
|
+
infoBoxBody: import_ts_dedent84.dedent`
|
|
28803
29394
|
Legacy Google chat node.
|
|
28804
29395
|
|
|
28805
29396
|
For new work, prefer \`LLM Chat\`, which keeps provider selection inside one shared node.
|
|
@@ -29341,7 +29932,8 @@ async function* getProcessorEvents(processor, spec) {
|
|
|
29341
29932
|
type: "nodeFinish",
|
|
29342
29933
|
outputs: event.outputs,
|
|
29343
29934
|
nodeId: event.node.id,
|
|
29344
|
-
nodeTitle: event.node.title
|
|
29935
|
+
nodeTitle: event.node.title,
|
|
29936
|
+
...event.durationMs === void 0 ? {} : { durationMs: event.durationMs }
|
|
29345
29937
|
};
|
|
29346
29938
|
}
|
|
29347
29939
|
}
|
|
@@ -29428,6 +30020,7 @@ function coreCreateProcessor(project, options2, internalOptions = {}) {
|
|
|
29428
30020
|
options2.includeTrace,
|
|
29429
30021
|
{
|
|
29430
30022
|
cacheLoadedProjects: internalOptions.cacheLoadedProjects,
|
|
30023
|
+
captureNodeTimings: options2.captureNodeTimings,
|
|
29431
30024
|
concurrency: options2.concurrency,
|
|
29432
30025
|
executionPlanCacheMode: internalOptions.executionPlanCacheMode,
|
|
29433
30026
|
runtimeCache: internalOptions.runtimeCache,
|
|
@@ -29700,12 +30293,16 @@ var Rivet = void 0;
|
|
|
29700
30293
|
createChatV2Model,
|
|
29701
30294
|
createChatV2ResponseOutput,
|
|
29702
30295
|
createDatasetNode,
|
|
30296
|
+
createDebuggerTransportEscapedSentinel,
|
|
30297
|
+
createDebuggerTransportEscapedSentinelEnvelope,
|
|
30298
|
+
createDebuggerTransportUndefinedSentinel,
|
|
29703
30299
|
createInterpolationInputDefinition,
|
|
29704
30300
|
createsLLMChatV2ToolResponseFormatConflictForEdit,
|
|
29705
30301
|
cronNode,
|
|
29706
30302
|
dataTypeDisplayNames,
|
|
29707
30303
|
dataTypes,
|
|
29708
30304
|
datasetNearestNeighborsNode,
|
|
30305
|
+
decodeDebuggerTransportSentinels,
|
|
29709
30306
|
dedent,
|
|
29710
30307
|
delayNode,
|
|
29711
30308
|
delegateFunctionCallNode,
|
|
@@ -29789,6 +30386,7 @@ var Rivet = void 0;
|
|
|
29789
30386
|
isChatV2StructuredResponseFormat,
|
|
29790
30387
|
isDataTypeAccepted,
|
|
29791
30388
|
isDataTypeCompatible,
|
|
30389
|
+
isDebuggerTransportSentinelEnvelope,
|
|
29792
30390
|
isFunctionDataType,
|
|
29793
30391
|
isFunctionDataValue,
|
|
29794
30392
|
isInterpolationInputDefinition,
|