@valerypopoff/rivet2-core 2.0.10 → 2.1.0
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 +1762 -274
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/esm/api/createProcessor.js +1 -0
- package/dist/esm/exports.js +4 -0
- package/dist/esm/model/GraphBoundaryCache.js +36 -4
- package/dist/esm/model/GraphBoundaryEffects.js +32 -0
- package/dist/esm/model/GraphPreprocessor.js +6 -4
- package/dist/esm/model/GraphProcessor.js +344 -118
- package/dist/esm/model/NodeGraph.js +1 -1
- package/dist/esm/model/NodePrefabResolver.js +57 -0
- package/dist/esm/model/Nodes.js +4 -1
- package/dist/esm/model/ProcessContextBuilder.js +3 -1
- package/dist/esm/model/UiGraph.js +113 -0
- package/dist/esm/model/UiGraphRendererStyles.js +208 -0
- package/dist/esm/model/chat/openAIChatRuntime.js +0 -1
- package/dist/esm/model/chat-v2/aiSdkBridge.js +100 -2
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +35 -31
- package/dist/esm/model/chat-v2/chatV2Shared.js +1 -1
- package/dist/esm/model/chat-v2/providerOptions.js +5 -1
- package/dist/esm/model/nodes/CoalesceNode.js +1 -1
- package/dist/esm/model/nodes/CompareNode.js +15 -14
- package/dist/esm/model/nodes/GraphOutputNode.js +1 -0
- package/dist/esm/model/nodes/LLMChatV2Node.js +62 -17
- package/dist/esm/model/nodes/NodePrefabInstanceNode.js +39 -0
- package/dist/esm/model/nodes/PromptNode.js +2 -1
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +49 -7
- package/dist/esm/model/nodes/SubGraphNode.js +42 -5
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/utils/jsonValueToDataValue.js +48 -0
- package/dist/esm/utils/projectComparison/connections.js +57 -0
- package/dist/esm/utils/projectComparison/graphs.js +60 -0
- package/dist/esm/utils/projectComparison/nodes.js +53 -0
- package/dist/esm/utils/projectComparison/summaries.js +60 -0
- package/dist/esm/utils/projectComparison/values.js +40 -0
- package/dist/esm/utils/projectComparison.js +73 -0
- package/dist/esm/utils/serialization/serializationHelpers.js +24 -3
- package/dist/esm/utils/serialization/serialization_v4.js +30 -0
- package/dist/types/api/createProcessor.d.ts +2 -1
- package/dist/types/exports.d.ts +5 -0
- package/dist/types/model/EditorDefinition.d.ts +1 -0
- package/dist/types/model/ExecutorProtocol.d.ts +13 -3
- package/dist/types/model/GraphBoundaryCache.d.ts +9 -3
- package/dist/types/model/GraphBoundaryEffects.d.ts +9 -0
- package/dist/types/model/GraphProcessor.d.ts +20 -0
- package/dist/types/model/NodeBase.d.ts +5 -0
- package/dist/types/model/NodeBodySpec.d.ts +1 -0
- package/dist/types/model/NodePrefabResolver.d.ts +13 -0
- package/dist/types/model/Nodes.d.ts +5 -4
- package/dist/types/model/ProcessContext.d.ts +5 -1
- package/dist/types/model/ProcessContextBuilder.d.ts +4 -2
- package/dist/types/model/Project.d.ts +9 -0
- package/dist/types/model/UiGraph.d.ts +84 -0
- package/dist/types/model/UiGraphRendererStyles.d.ts +2 -0
- package/dist/types/model/chat-v2/aiSdkBridge.d.ts +1 -0
- package/dist/types/model/chat-v2/chatV2Types.d.ts +23 -1
- package/dist/types/model/nodes/CompareNode.d.ts +4 -0
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +2 -1
- package/dist/types/model/nodes/NodePrefabInstanceNode.d.ts +13 -0
- package/dist/types/model/nodes/SubGraphNode.d.ts +2 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/jsonValueToDataValue.d.ts +2 -0
- package/dist/types/utils/projectComparison/connections.d.ts +5 -0
- package/dist/types/utils/projectComparison/graphs.d.ts +3 -0
- package/dist/types/utils/projectComparison/nodes.d.ts +5 -0
- package/dist/types/utils/projectComparison/summaries.d.ts +4 -0
- package/dist/types/utils/projectComparison/values.d.ts +5 -0
- package/dist/types/utils/projectComparison.d.ts +77 -0
- package/package.json +1 -1
package/dist/cjs/bundle.cjs
CHANGED
|
@@ -106,7 +106,9 @@ __export(src_exports, {
|
|
|
106
106
|
MCPGetPromptNodeImpl: () => MCPGetPromptNodeImpl,
|
|
107
107
|
MCPToolCallNodeImpl: () => MCPToolCallNodeImpl,
|
|
108
108
|
MatchNodeImpl: () => MatchNodeImpl,
|
|
109
|
+
NODE_PREFAB_INSTANCE_TYPE: () => NODE_PREFAB_INSTANCE_TYPE,
|
|
109
110
|
NodeImpl: () => NodeImpl,
|
|
111
|
+
NodePrefabInstanceNodeImpl: () => NodePrefabInstanceNodeImpl,
|
|
110
112
|
NodeRegistration: () => NodeRegistration,
|
|
111
113
|
NotAllowedCodeRunner: () => NotAllowedCodeRunner,
|
|
112
114
|
NumberNodeImpl: () => NumberNodeImpl,
|
|
@@ -116,6 +118,8 @@ __export(src_exports, {
|
|
|
116
118
|
PluginNodeImplClass: () => PluginNodeImplClass,
|
|
117
119
|
PopNodeImpl: () => PopNodeImpl,
|
|
118
120
|
PromptNodeImpl: () => PromptNodeImpl,
|
|
121
|
+
RIVET_WEB_APP_DOCUMENT_CSS: () => RIVET_WEB_APP_DOCUMENT_CSS,
|
|
122
|
+
RIVET_WEB_APP_RENDERER_CSS: () => RIVET_WEB_APP_RENDERER_CSS,
|
|
119
123
|
RaceInputsNodeImpl: () => RaceInputsNodeImpl,
|
|
120
124
|
RaiseEventNodeImpl: () => RaiseEventNodeImpl,
|
|
121
125
|
RandomNumberNodeImpl: () => RandomNumberNodeImpl,
|
|
@@ -168,6 +172,7 @@ __export(src_exports, {
|
|
|
168
172
|
callGraphNode: () => callGraphNode,
|
|
169
173
|
canBeCoerced: () => canBeCoerced,
|
|
170
174
|
canBeCoercedAny: () => canBeCoercedAny,
|
|
175
|
+
canUseNodeAsPrefabSource: () => canUseNodeAsPrefabSource,
|
|
171
176
|
chatLoopNode: () => chatLoopNode,
|
|
172
177
|
chatMessagesToModelMessages: () => chatMessagesToModelMessages,
|
|
173
178
|
chatNode: () => chatNode,
|
|
@@ -176,6 +181,8 @@ __export(src_exports, {
|
|
|
176
181
|
chunkNode: () => chunkNode,
|
|
177
182
|
chunkStringByTokenCount: () => chunkStringByTokenCount,
|
|
178
183
|
cleanHeaders: () => cleanHeaders,
|
|
184
|
+
cloneFrozenNodeOutputs: () => cloneFrozenNodeOutputs,
|
|
185
|
+
cloneFrozenNodeOutputsByGraph: () => cloneFrozenNodeOutputsByGraph,
|
|
179
186
|
coalesceNode: () => coalesceNode,
|
|
180
187
|
codeNewNode: () => codeNewNode,
|
|
181
188
|
codeNode: () => codeNode,
|
|
@@ -183,6 +190,8 @@ __export(src_exports, {
|
|
|
183
190
|
coerceTypeOptional: () => coerceTypeOptional,
|
|
184
191
|
commentNode: () => commentNode,
|
|
185
192
|
compareNode: () => compareNode,
|
|
193
|
+
compareNodeComparisonFunctionOptions: () => compareNodeComparisonFunctionOptions,
|
|
194
|
+
compareProjects: () => compareProjects,
|
|
186
195
|
contextNode: () => contextNode,
|
|
187
196
|
coreCreateProcessor: () => coreCreateProcessor,
|
|
188
197
|
coreRunGraph: () => coreRunGraph,
|
|
@@ -194,6 +203,8 @@ __export(src_exports, {
|
|
|
194
203
|
createDebuggerTransportEscapedSentinel: () => createDebuggerTransportEscapedSentinel,
|
|
195
204
|
createDebuggerTransportEscapedSentinelEnvelope: () => createDebuggerTransportEscapedSentinelEnvelope,
|
|
196
205
|
createDebuggerTransportUndefinedSentinel: () => createDebuggerTransportUndefinedSentinel,
|
|
206
|
+
createDefaultUiGraph: () => createDefaultUiGraph,
|
|
207
|
+
createFrozenNodeOutputResolver: () => createFrozenNodeOutputResolver,
|
|
197
208
|
createInterpolationInputDefinition: () => createInterpolationInputDefinition,
|
|
198
209
|
createsLLMChatV2ToolResponseFormatConflictForEdit: () => createsLLMChatV2ToolResponseFormatConflictForEdit,
|
|
199
210
|
cronNode: () => cronNode,
|
|
@@ -227,6 +238,7 @@ __export(src_exports, {
|
|
|
227
238
|
filterNode: () => filterNode,
|
|
228
239
|
findInterpolationTokenSpans: () => findInterpolationTokenSpans,
|
|
229
240
|
functionTypeToScalarType: () => functionTypeToScalarType,
|
|
241
|
+
generateChatV2: () => generateChatV2,
|
|
230
242
|
gentracePlugin: () => gentrace_default,
|
|
231
243
|
getAllDatasetsNode: () => getAllDatasetsNode,
|
|
232
244
|
getChatNodeMessages: () => getChatNodeMessages,
|
|
@@ -245,16 +257,25 @@ __export(src_exports, {
|
|
|
245
257
|
getExtractObjectPathInterpolationInputNames: () => getExtractObjectPathInterpolationInputNames,
|
|
246
258
|
getGentracePipelines: () => getGentracePipelines,
|
|
247
259
|
getGlobalNode: () => getGlobalNode,
|
|
260
|
+
getGraphBoundary: () => getGraphBoundary,
|
|
248
261
|
getHttpCallBodyPreviewSections: () => getHttpCallBodyPreviewSections,
|
|
249
262
|
getInputOrData: () => getInputOrData,
|
|
250
263
|
getIntegration: () => getIntegration,
|
|
251
264
|
getInterpolationInputDefinitionData: () => getInterpolationInputDefinitionData,
|
|
252
265
|
getInterpolationTokenName: () => getInterpolationTokenName,
|
|
266
|
+
getNodePrefabDisplayName: () => getNodePrefabDisplayName,
|
|
267
|
+
getNodePrefabInstancePrefabId: () => getNodePrefabInstancePrefabId,
|
|
253
268
|
getPluginConfig: () => getPluginConfig,
|
|
254
269
|
getProcessorEvents: () => getProcessorEvents,
|
|
255
270
|
getProcessorSSEStream: () => getProcessorSSEStream,
|
|
271
|
+
getProjectConnectionComparisonKey: () => getProjectConnectionComparisonKey,
|
|
272
|
+
getProjectNodeFieldComparisons: () => getProjectNodeFieldComparisons,
|
|
256
273
|
getScalarTypeOf: () => getScalarTypeOf,
|
|
257
274
|
getSingleNodeStream: () => getSingleNodeStream,
|
|
275
|
+
getUiGraphActionComponent: () => getUiGraphActionComponent,
|
|
276
|
+
getUiGraphActionInputBindings: () => getUiGraphActionInputBindings,
|
|
277
|
+
getUiGraphActionOutputBindings: () => getUiGraphActionOutputBindings,
|
|
278
|
+
getUiGraphInitialState: () => getUiGraphInitialState,
|
|
258
279
|
getWarnings: () => getWarnings,
|
|
259
280
|
globalRivetNodeRegistry: () => globalRivetNodeRegistry,
|
|
260
281
|
googlePlugin: () => googlePlugin,
|
|
@@ -264,6 +285,7 @@ __export(src_exports, {
|
|
|
264
285
|
graphOutputNode: () => graphOutputNode,
|
|
265
286
|
graphReferenceNode: () => graphReferenceNode,
|
|
266
287
|
handleEscapeCharacters: () => handleEscapeCharacters,
|
|
288
|
+
hasFrozenNodeOutputs: () => hasFrozenNodeOutputs,
|
|
267
289
|
hasLLMChatV2ToolResponseFormatConflict: () => hasLLMChatV2ToolResponseFormatConflict,
|
|
268
290
|
hasValidStoredOrderedPortIds: () => hasValidStoredOrderedPortIds,
|
|
269
291
|
hashNode: () => hashNode,
|
|
@@ -289,6 +311,7 @@ __export(src_exports, {
|
|
|
289
311
|
isFunctionDataValue: () => isFunctionDataValue,
|
|
290
312
|
isInterpolationInputDefinition: () => isInterpolationInputDefinition,
|
|
291
313
|
isLLMChatV2StructuredResponseFormat: () => isLLMChatV2StructuredResponseFormat,
|
|
314
|
+
isNodePrefabInstanceNode: () => isNodePrefabInstanceNode,
|
|
292
315
|
isNotFunctionDataValue: () => isNotFunctionDataValue,
|
|
293
316
|
isRuntimeDebugLoggingEnabled: () => isRuntimeDebugLoggingEnabled,
|
|
294
317
|
isScalarDataType: () => isScalarDataType,
|
|
@@ -296,6 +319,7 @@ __export(src_exports, {
|
|
|
296
319
|
joinNode: () => joinNode,
|
|
297
320
|
jsFilterNode: () => jsFilterNode,
|
|
298
321
|
jsMapNode: () => jsMapNode,
|
|
322
|
+
jsonValueToDataValue: () => jsonValueToDataValue,
|
|
299
323
|
listGraphsNode: () => listGraphsNode,
|
|
300
324
|
llmChatV2Node: () => llmChatV2Node,
|
|
301
325
|
loadDatasetNode: () => loadDatasetNode,
|
|
@@ -316,6 +340,7 @@ __export(src_exports, {
|
|
|
316
340
|
mergeCustomProviderResponseFormatOptions: () => mergeCustomProviderResponseFormatOptions,
|
|
317
341
|
newId: () => newId,
|
|
318
342
|
nodeDefinition: () => nodeDefinition,
|
|
343
|
+
nodePrefabInstanceNode: () => nodePrefabInstanceNode,
|
|
319
344
|
numberNode: () => numberNode,
|
|
320
345
|
objectNode: () => objectNode,
|
|
321
346
|
openAICompatibleEndpointToBaseURL: () => openAICompatibleEndpointToBaseURL,
|
|
@@ -349,8 +374,13 @@ __export(src_exports, {
|
|
|
349
374
|
resolveChatV2ProviderConfig: () => resolveChatV2ProviderConfig,
|
|
350
375
|
resolveChatV2ResponseFormatParameters: () => resolveChatV2ResponseFormatParameters,
|
|
351
376
|
resolveLLMChatV2RuntimeProviderOptions: () => resolveLLMChatV2RuntimeProviderOptions,
|
|
377
|
+
resolveNodePrefabInstance: () => resolveNodePrefabInstance,
|
|
378
|
+
resolveNodePrefabInstances: () => resolveNodePrefabInstances,
|
|
352
379
|
resolveProcessSettings: () => resolveProcessSettings,
|
|
353
380
|
resolveStoredOrderedPortIds: () => resolveStoredOrderedPortIds,
|
|
381
|
+
resolveUiGraphActionInputs: () => resolveUiGraphActionInputs,
|
|
382
|
+
resolveUiGraphActionOutputStatePatch: () => resolveUiGraphActionOutputStatePatch,
|
|
383
|
+
resolveUiGraphActionOutputStateValue: () => resolveUiGraphActionOutputStateValue,
|
|
354
384
|
resolveUniqueValueDerivedPortIds: () => resolveUniqueValueDerivedPortIds,
|
|
355
385
|
restoreEscapedInterpolationTokens: () => restoreEscapedInterpolationTokens,
|
|
356
386
|
runChatV2Pipeline: () => runChatV2Pipeline,
|
|
@@ -470,7 +500,9 @@ __export(exports_exports, {
|
|
|
470
500
|
MCPGetPromptNodeImpl: () => MCPGetPromptNodeImpl,
|
|
471
501
|
MCPToolCallNodeImpl: () => MCPToolCallNodeImpl,
|
|
472
502
|
MatchNodeImpl: () => MatchNodeImpl,
|
|
503
|
+
NODE_PREFAB_INSTANCE_TYPE: () => NODE_PREFAB_INSTANCE_TYPE,
|
|
473
504
|
NodeImpl: () => NodeImpl,
|
|
505
|
+
NodePrefabInstanceNodeImpl: () => NodePrefabInstanceNodeImpl,
|
|
474
506
|
NodeRegistration: () => NodeRegistration,
|
|
475
507
|
NotAllowedCodeRunner: () => NotAllowedCodeRunner,
|
|
476
508
|
NumberNodeImpl: () => NumberNodeImpl,
|
|
@@ -480,6 +512,8 @@ __export(exports_exports, {
|
|
|
480
512
|
PluginNodeImplClass: () => PluginNodeImplClass,
|
|
481
513
|
PopNodeImpl: () => PopNodeImpl,
|
|
482
514
|
PromptNodeImpl: () => PromptNodeImpl,
|
|
515
|
+
RIVET_WEB_APP_DOCUMENT_CSS: () => RIVET_WEB_APP_DOCUMENT_CSS,
|
|
516
|
+
RIVET_WEB_APP_RENDERER_CSS: () => RIVET_WEB_APP_RENDERER_CSS,
|
|
483
517
|
RaceInputsNodeImpl: () => RaceInputsNodeImpl,
|
|
484
518
|
RaiseEventNodeImpl: () => RaiseEventNodeImpl,
|
|
485
519
|
RandomNumberNodeImpl: () => RandomNumberNodeImpl,
|
|
@@ -531,6 +565,7 @@ __export(exports_exports, {
|
|
|
531
565
|
callGraphNode: () => callGraphNode,
|
|
532
566
|
canBeCoerced: () => canBeCoerced,
|
|
533
567
|
canBeCoercedAny: () => canBeCoercedAny,
|
|
568
|
+
canUseNodeAsPrefabSource: () => canUseNodeAsPrefabSource,
|
|
534
569
|
chatLoopNode: () => chatLoopNode,
|
|
535
570
|
chatMessagesToModelMessages: () => chatMessagesToModelMessages,
|
|
536
571
|
chatNode: () => chatNode,
|
|
@@ -539,6 +574,8 @@ __export(exports_exports, {
|
|
|
539
574
|
chunkNode: () => chunkNode,
|
|
540
575
|
chunkStringByTokenCount: () => chunkStringByTokenCount,
|
|
541
576
|
cleanHeaders: () => cleanHeaders,
|
|
577
|
+
cloneFrozenNodeOutputs: () => cloneFrozenNodeOutputs,
|
|
578
|
+
cloneFrozenNodeOutputsByGraph: () => cloneFrozenNodeOutputsByGraph,
|
|
542
579
|
coalesceNode: () => coalesceNode,
|
|
543
580
|
codeNewNode: () => codeNewNode,
|
|
544
581
|
codeNode: () => codeNode,
|
|
@@ -546,6 +583,8 @@ __export(exports_exports, {
|
|
|
546
583
|
coerceTypeOptional: () => coerceTypeOptional,
|
|
547
584
|
commentNode: () => commentNode,
|
|
548
585
|
compareNode: () => compareNode,
|
|
586
|
+
compareNodeComparisonFunctionOptions: () => compareNodeComparisonFunctionOptions,
|
|
587
|
+
compareProjects: () => compareProjects,
|
|
549
588
|
contextNode: () => contextNode,
|
|
550
589
|
coreCreateProcessor: () => coreCreateProcessor,
|
|
551
590
|
coreRunGraph: () => coreRunGraph,
|
|
@@ -557,6 +596,8 @@ __export(exports_exports, {
|
|
|
557
596
|
createDebuggerTransportEscapedSentinel: () => createDebuggerTransportEscapedSentinel,
|
|
558
597
|
createDebuggerTransportEscapedSentinelEnvelope: () => createDebuggerTransportEscapedSentinelEnvelope,
|
|
559
598
|
createDebuggerTransportUndefinedSentinel: () => createDebuggerTransportUndefinedSentinel,
|
|
599
|
+
createDefaultUiGraph: () => createDefaultUiGraph,
|
|
600
|
+
createFrozenNodeOutputResolver: () => createFrozenNodeOutputResolver,
|
|
560
601
|
createInterpolationInputDefinition: () => createInterpolationInputDefinition,
|
|
561
602
|
createsLLMChatV2ToolResponseFormatConflictForEdit: () => createsLLMChatV2ToolResponseFormatConflictForEdit,
|
|
562
603
|
cronNode: () => cronNode,
|
|
@@ -590,6 +631,7 @@ __export(exports_exports, {
|
|
|
590
631
|
filterNode: () => filterNode,
|
|
591
632
|
findInterpolationTokenSpans: () => findInterpolationTokenSpans,
|
|
592
633
|
functionTypeToScalarType: () => functionTypeToScalarType,
|
|
634
|
+
generateChatV2: () => generateChatV2,
|
|
593
635
|
gentracePlugin: () => gentrace_default,
|
|
594
636
|
getAllDatasetsNode: () => getAllDatasetsNode,
|
|
595
637
|
getChatNodeMessages: () => getChatNodeMessages,
|
|
@@ -608,16 +650,25 @@ __export(exports_exports, {
|
|
|
608
650
|
getExtractObjectPathInterpolationInputNames: () => getExtractObjectPathInterpolationInputNames,
|
|
609
651
|
getGentracePipelines: () => getGentracePipelines,
|
|
610
652
|
getGlobalNode: () => getGlobalNode,
|
|
653
|
+
getGraphBoundary: () => getGraphBoundary,
|
|
611
654
|
getHttpCallBodyPreviewSections: () => getHttpCallBodyPreviewSections,
|
|
612
655
|
getInputOrData: () => getInputOrData,
|
|
613
656
|
getIntegration: () => getIntegration,
|
|
614
657
|
getInterpolationInputDefinitionData: () => getInterpolationInputDefinitionData,
|
|
615
658
|
getInterpolationTokenName: () => getInterpolationTokenName,
|
|
659
|
+
getNodePrefabDisplayName: () => getNodePrefabDisplayName,
|
|
660
|
+
getNodePrefabInstancePrefabId: () => getNodePrefabInstancePrefabId,
|
|
616
661
|
getPluginConfig: () => getPluginConfig,
|
|
617
662
|
getProcessorEvents: () => getProcessorEvents,
|
|
618
663
|
getProcessorSSEStream: () => getProcessorSSEStream,
|
|
664
|
+
getProjectConnectionComparisonKey: () => getProjectConnectionComparisonKey,
|
|
665
|
+
getProjectNodeFieldComparisons: () => getProjectNodeFieldComparisons,
|
|
619
666
|
getScalarTypeOf: () => getScalarTypeOf,
|
|
620
667
|
getSingleNodeStream: () => getSingleNodeStream,
|
|
668
|
+
getUiGraphActionComponent: () => getUiGraphActionComponent,
|
|
669
|
+
getUiGraphActionInputBindings: () => getUiGraphActionInputBindings,
|
|
670
|
+
getUiGraphActionOutputBindings: () => getUiGraphActionOutputBindings,
|
|
671
|
+
getUiGraphInitialState: () => getUiGraphInitialState,
|
|
621
672
|
getWarnings: () => getWarnings,
|
|
622
673
|
globalRivetNodeRegistry: () => globalRivetNodeRegistry,
|
|
623
674
|
googlePlugin: () => googlePlugin,
|
|
@@ -627,6 +678,7 @@ __export(exports_exports, {
|
|
|
627
678
|
graphOutputNode: () => graphOutputNode,
|
|
628
679
|
graphReferenceNode: () => graphReferenceNode,
|
|
629
680
|
handleEscapeCharacters: () => handleEscapeCharacters,
|
|
681
|
+
hasFrozenNodeOutputs: () => hasFrozenNodeOutputs,
|
|
630
682
|
hasLLMChatV2ToolResponseFormatConflict: () => hasLLMChatV2ToolResponseFormatConflict,
|
|
631
683
|
hasValidStoredOrderedPortIds: () => hasValidStoredOrderedPortIds,
|
|
632
684
|
hashNode: () => hashNode,
|
|
@@ -652,6 +704,7 @@ __export(exports_exports, {
|
|
|
652
704
|
isFunctionDataValue: () => isFunctionDataValue,
|
|
653
705
|
isInterpolationInputDefinition: () => isInterpolationInputDefinition,
|
|
654
706
|
isLLMChatV2StructuredResponseFormat: () => isLLMChatV2StructuredResponseFormat,
|
|
707
|
+
isNodePrefabInstanceNode: () => isNodePrefabInstanceNode,
|
|
655
708
|
isNotFunctionDataValue: () => isNotFunctionDataValue,
|
|
656
709
|
isRuntimeDebugLoggingEnabled: () => isRuntimeDebugLoggingEnabled,
|
|
657
710
|
isScalarDataType: () => isScalarDataType,
|
|
@@ -659,6 +712,7 @@ __export(exports_exports, {
|
|
|
659
712
|
joinNode: () => joinNode,
|
|
660
713
|
jsFilterNode: () => jsFilterNode,
|
|
661
714
|
jsMapNode: () => jsMapNode,
|
|
715
|
+
jsonValueToDataValue: () => jsonValueToDataValue,
|
|
662
716
|
listGraphsNode: () => listGraphsNode,
|
|
663
717
|
llmChatV2Node: () => llmChatV2Node,
|
|
664
718
|
loadDatasetNode: () => loadDatasetNode,
|
|
@@ -679,6 +733,7 @@ __export(exports_exports, {
|
|
|
679
733
|
mergeCustomProviderResponseFormatOptions: () => mergeCustomProviderResponseFormatOptions,
|
|
680
734
|
newId: () => newId,
|
|
681
735
|
nodeDefinition: () => nodeDefinition,
|
|
736
|
+
nodePrefabInstanceNode: () => nodePrefabInstanceNode,
|
|
682
737
|
numberNode: () => numberNode,
|
|
683
738
|
objectNode: () => objectNode,
|
|
684
739
|
openAICompatibleEndpointToBaseURL: () => openAICompatibleEndpointToBaseURL,
|
|
@@ -712,8 +767,13 @@ __export(exports_exports, {
|
|
|
712
767
|
resolveChatV2ProviderConfig: () => resolveChatV2ProviderConfig,
|
|
713
768
|
resolveChatV2ResponseFormatParameters: () => resolveChatV2ResponseFormatParameters,
|
|
714
769
|
resolveLLMChatV2RuntimeProviderOptions: () => resolveLLMChatV2RuntimeProviderOptions,
|
|
770
|
+
resolveNodePrefabInstance: () => resolveNodePrefabInstance,
|
|
771
|
+
resolveNodePrefabInstances: () => resolveNodePrefabInstances,
|
|
715
772
|
resolveProcessSettings: () => resolveProcessSettings,
|
|
716
773
|
resolveStoredOrderedPortIds: () => resolveStoredOrderedPortIds,
|
|
774
|
+
resolveUiGraphActionInputs: () => resolveUiGraphActionInputs,
|
|
775
|
+
resolveUiGraphActionOutputStatePatch: () => resolveUiGraphActionOutputStatePatch,
|
|
776
|
+
resolveUiGraphActionOutputStateValue: () => resolveUiGraphActionOutputStateValue,
|
|
717
777
|
resolveUniqueValueDerivedPortIds: () => resolveUniqueValueDerivedPortIds,
|
|
718
778
|
restoreEscapedInterpolationTokens: () => restoreEscapedInterpolationTokens,
|
|
719
779
|
runChatV2Pipeline: () => runChatV2Pipeline,
|
|
@@ -1500,24 +1560,47 @@ function detectSerializationVersion(data) {
|
|
|
1500
1560
|
// src/utils/serialization/serializationHelpers.ts
|
|
1501
1561
|
var import_safe_stable_stringify = __toESM(require("safe-stable-stringify"), 1);
|
|
1502
1562
|
var yaml = __toESM(require("yaml"), 1);
|
|
1563
|
+
var CONNECTION_BEND_MARKER = " __rivet_bend:";
|
|
1564
|
+
var CONNECTION_BEND_MARKER_TITLE_FALLBACK = " __rivet bend:";
|
|
1565
|
+
var FINITE_NUMBER_PATTERN = String.raw`[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?`;
|
|
1566
|
+
var CONNECTION_BEND_PATTERN = new RegExp(
|
|
1567
|
+
`${CONNECTION_BEND_MARKER.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(${FINITE_NUMBER_PATTERN}),(${FINITE_NUMBER_PATTERN})$`
|
|
1568
|
+
);
|
|
1503
1569
|
function serializeConnection(connection, allNodes) {
|
|
1504
1570
|
var _a;
|
|
1505
|
-
const targetTitle = (
|
|
1506
|
-
|
|
1571
|
+
const targetTitle = serializeConnectionTargetTitle(
|
|
1572
|
+
((_a = allNodes.find((node) => node.id === connection.inputNodeId)) == null ? void 0 : _a.title) ?? ""
|
|
1573
|
+
);
|
|
1574
|
+
const bendPoint = connection.bendPoint && Number.isFinite(connection.bendPoint.x) && Number.isFinite(connection.bendPoint.y) ? `${CONNECTION_BEND_MARKER}${connection.bendPoint.x},${connection.bendPoint.y}` : "";
|
|
1575
|
+
return `${connection.outputId}->"${targetTitle}${bendPoint}" ${connection.inputNodeId}/${connection.inputId}`;
|
|
1507
1576
|
}
|
|
1508
1577
|
function deserializeConnection(connection, sourceNodeId) {
|
|
1509
1578
|
const match10 = connection.match(/(.+)->"(.*)"\s+(.+)\/(.+)/);
|
|
1510
1579
|
if (!match10) {
|
|
1511
1580
|
throw new Error(`Invalid connection: ${connection}`);
|
|
1512
1581
|
}
|
|
1513
|
-
const [, outputId, , inputNodeId, inputId] = match10;
|
|
1582
|
+
const [, outputId, targetTitle, inputNodeId, inputId] = match10;
|
|
1583
|
+
const bendPoint = deserializeConnectionBendPoint(targetTitle);
|
|
1514
1584
|
return {
|
|
1515
1585
|
outputId,
|
|
1516
1586
|
outputNodeId: sourceNodeId,
|
|
1517
1587
|
inputId,
|
|
1518
|
-
inputNodeId
|
|
1588
|
+
inputNodeId,
|
|
1589
|
+
...bendPoint ? { bendPoint } : {}
|
|
1519
1590
|
};
|
|
1520
1591
|
}
|
|
1592
|
+
function serializeConnectionTargetTitle(targetTitle) {
|
|
1593
|
+
return targetTitle.replaceAll(CONNECTION_BEND_MARKER, CONNECTION_BEND_MARKER_TITLE_FALLBACK);
|
|
1594
|
+
}
|
|
1595
|
+
function deserializeConnectionBendPoint(targetTitle) {
|
|
1596
|
+
const match10 = targetTitle == null ? void 0 : targetTitle.match(CONNECTION_BEND_PATTERN);
|
|
1597
|
+
if (!match10) {
|
|
1598
|
+
return void 0;
|
|
1599
|
+
}
|
|
1600
|
+
const x = Number.parseFloat(match10[1]);
|
|
1601
|
+
const y = Number.parseFloat(match10[2]);
|
|
1602
|
+
return Number.isFinite(x) && Number.isFinite(y) ? { x, y } : void 0;
|
|
1603
|
+
}
|
|
1521
1604
|
function parseOptionalFloat(val) {
|
|
1522
1605
|
return val === "null" || val === void 0 || val === "" ? void 0 : parseFloat(val);
|
|
1523
1606
|
}
|
|
@@ -1651,7 +1734,7 @@ function emptyNodeGraph() {
|
|
|
1651
1734
|
connections: [],
|
|
1652
1735
|
metadata: {
|
|
1653
1736
|
id: (0, import_non_secure.nanoid)(),
|
|
1654
|
-
name: "Untitled
|
|
1737
|
+
name: "Untitled graph",
|
|
1655
1738
|
description: ""
|
|
1656
1739
|
}
|
|
1657
1740
|
};
|
|
@@ -1682,25 +1765,56 @@ function graphV4Serializer(graph) {
|
|
|
1682
1765
|
return wrapInYamlEnvelope(4, toSerializedGraph(graph));
|
|
1683
1766
|
}
|
|
1684
1767
|
function toSerializedProject(project, attachedData) {
|
|
1768
|
+
const nodePrefabs = (0, import_lodash_es2.mapValues)(project.nodePrefabs ?? {}, (prefab) => ({
|
|
1769
|
+
id: prefab.id,
|
|
1770
|
+
sourceNode: toSerializedIsolatedNode(prefab.sourceNode)
|
|
1771
|
+
}));
|
|
1685
1772
|
return {
|
|
1686
1773
|
metadata: project.metadata,
|
|
1687
1774
|
graphs: (0, import_lodash_es2.mapValues)(project.graphs, (graph) => toSerializedGraph(graph)),
|
|
1775
|
+
nodePrefabs: Object.keys(nodePrefabs).length > 0 ? nodePrefabs : void 0,
|
|
1776
|
+
uiGraphs: project.uiGraphs && Object.keys(project.uiGraphs).length > 0 ? project.uiGraphs : void 0,
|
|
1688
1777
|
attachedData,
|
|
1689
1778
|
plugins: project.plugins ?? [],
|
|
1690
1779
|
references: project.references ?? []
|
|
1691
1780
|
};
|
|
1692
1781
|
}
|
|
1693
1782
|
function fromSerializedProject2(serializedProject) {
|
|
1783
|
+
const nodePrefabs = (0, import_lodash_es2.mapValues)(serializedProject.nodePrefabs ?? {}, (prefab) => ({
|
|
1784
|
+
id: prefab.id,
|
|
1785
|
+
sourceNode: fromSerializedIsolatedNode(prefab.sourceNode)
|
|
1786
|
+
}));
|
|
1694
1787
|
return [
|
|
1695
1788
|
{
|
|
1696
1789
|
metadata: serializedProject.metadata,
|
|
1697
1790
|
graphs: (0, import_lodash_es2.mapValues)(serializedProject.graphs, (graph) => fromSerializedGraph2(graph)),
|
|
1791
|
+
nodePrefabs: Object.keys(nodePrefabs).length > 0 ? nodePrefabs : void 0,
|
|
1792
|
+
uiGraphs: serializedProject.uiGraphs && Object.keys(serializedProject.uiGraphs).length > 0 ? serializedProject.uiGraphs : void 0,
|
|
1698
1793
|
plugins: serializedProject.plugins ?? [],
|
|
1699
1794
|
references: serializedProject.references ?? []
|
|
1700
1795
|
},
|
|
1701
1796
|
serializedProject.attachedData ?? {}
|
|
1702
1797
|
];
|
|
1703
1798
|
}
|
|
1799
|
+
function toSerializedIsolatedNode(node) {
|
|
1800
|
+
const { outgoingConnections: _outgoingConnections, ...serializedNode } = toSerializedNode(node, [node], []);
|
|
1801
|
+
return {
|
|
1802
|
+
...serializedNode,
|
|
1803
|
+
id: node.id,
|
|
1804
|
+
type: node.type,
|
|
1805
|
+
title: node.title
|
|
1806
|
+
};
|
|
1807
|
+
}
|
|
1808
|
+
function fromSerializedIsolatedNode(serializedNode) {
|
|
1809
|
+
const [node] = fromSerializedNode2(
|
|
1810
|
+
{
|
|
1811
|
+
...serializedNode,
|
|
1812
|
+
outgoingConnections: void 0
|
|
1813
|
+
},
|
|
1814
|
+
`[${serializedNode.id}]:${serializedNode.type} "${serializedNode.title}"`
|
|
1815
|
+
);
|
|
1816
|
+
return node;
|
|
1817
|
+
}
|
|
1704
1818
|
function toSerializedGraph(graph) {
|
|
1705
1819
|
const graphMetadata = {
|
|
1706
1820
|
id: graph.metadata.id,
|
|
@@ -2242,6 +2356,412 @@ function parseProviderJsonChunk(provider, chunk) {
|
|
|
2242
2356
|
}
|
|
2243
2357
|
}
|
|
2244
2358
|
|
|
2359
|
+
// src/utils/projectComparison/connections.ts
|
|
2360
|
+
var import_safe_stable_stringify3 = __toESM(require("safe-stable-stringify"), 1);
|
|
2361
|
+
|
|
2362
|
+
// src/utils/projectComparison/values.ts
|
|
2363
|
+
var import_safe_stable_stringify2 = __toESM(require("safe-stable-stringify"), 1);
|
|
2364
|
+
function areComparisonValuesEqual(left, right) {
|
|
2365
|
+
return (0, import_safe_stable_stringify2.default)(left) === (0, import_safe_stable_stringify2.default)(right);
|
|
2366
|
+
}
|
|
2367
|
+
function getChangedValueComparisons(path, before, after) {
|
|
2368
|
+
if (areComparisonValuesEqual(before, after)) {
|
|
2369
|
+
return [];
|
|
2370
|
+
}
|
|
2371
|
+
if (Array.isArray(before) && Array.isArray(after)) {
|
|
2372
|
+
return Array.from({ length: Math.max(before.length, after.length) }).flatMap(
|
|
2373
|
+
(_value, index) => getChangedValueComparisons([...path, String(index)], before[index], after[index])
|
|
2374
|
+
);
|
|
2375
|
+
}
|
|
2376
|
+
if (isComparisonRecord(before) && isComparisonRecord(after)) {
|
|
2377
|
+
return unionKeys(before, after).flatMap(
|
|
2378
|
+
(key) => getChangedValueComparisons([...path, key], before[key], after[key])
|
|
2379
|
+
);
|
|
2380
|
+
}
|
|
2381
|
+
return [
|
|
2382
|
+
{
|
|
2383
|
+
after,
|
|
2384
|
+
before,
|
|
2385
|
+
field: formatComparisonPath(path),
|
|
2386
|
+
path
|
|
2387
|
+
}
|
|
2388
|
+
];
|
|
2389
|
+
}
|
|
2390
|
+
function isComparisonRecord(value) {
|
|
2391
|
+
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
2392
|
+
}
|
|
2393
|
+
function unionKeys(left, right) {
|
|
2394
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])].sort();
|
|
2395
|
+
}
|
|
2396
|
+
function formatComparisonPath(path) {
|
|
2397
|
+
return path.reduce((formatted, segment) => {
|
|
2398
|
+
if (/^\d+$/.test(segment)) {
|
|
2399
|
+
return `${formatted}[${segment}]`;
|
|
2400
|
+
}
|
|
2401
|
+
if (formatted.length === 0) {
|
|
2402
|
+
return segment;
|
|
2403
|
+
}
|
|
2404
|
+
return /^[A-Za-z_$][\w$]*$/.test(segment) ? `${formatted}.${segment}` : `${formatted}[${JSON.stringify(segment)}]`;
|
|
2405
|
+
}, "");
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
// src/utils/projectComparison/connections.ts
|
|
2409
|
+
function getProjectConnectionComparisonKey(connection) {
|
|
2410
|
+
return (0, import_safe_stable_stringify3.default)([
|
|
2411
|
+
connection.outputNodeId,
|
|
2412
|
+
connection.outputId,
|
|
2413
|
+
connection.inputNodeId,
|
|
2414
|
+
connection.inputId
|
|
2415
|
+
]);
|
|
2416
|
+
}
|
|
2417
|
+
function getComparableGraphConnections(connections, nodes) {
|
|
2418
|
+
const commentNodeIds = new Set(nodes.filter((node) => node.type === "comment").map((node) => node.id));
|
|
2419
|
+
return connections.filter(
|
|
2420
|
+
(connection) => !commentNodeIds.has(connection.outputNodeId) && !commentNodeIds.has(connection.inputNodeId)
|
|
2421
|
+
);
|
|
2422
|
+
}
|
|
2423
|
+
function compareConnections(beforeConnections, afterConnections) {
|
|
2424
|
+
const beforeByKey = new Map(beforeConnections.map((connection) => [getProjectConnectionComparisonKey(connection), connection]));
|
|
2425
|
+
const afterByKey = new Map(afterConnections.map((connection) => [getProjectConnectionComparisonKey(connection), connection]));
|
|
2426
|
+
const removedKeys = beforeConnections.map(getProjectConnectionComparisonKey).filter((key) => !afterByKey.has(key));
|
|
2427
|
+
const addedKeys = afterConnections.map(getProjectConnectionComparisonKey).filter((key) => !beforeByKey.has(key));
|
|
2428
|
+
const changedRemovedKeys = /* @__PURE__ */ new Set();
|
|
2429
|
+
const changedAddedKeys = /* @__PURE__ */ new Set();
|
|
2430
|
+
for (const addedKey of addedKeys) {
|
|
2431
|
+
const addedConnection = afterByKey.get(addedKey);
|
|
2432
|
+
const matchingRemovedKey = removedKeys.find((removedKey) => {
|
|
2433
|
+
if (changedRemovedKeys.has(removedKey)) {
|
|
2434
|
+
return false;
|
|
2435
|
+
}
|
|
2436
|
+
const removedConnection = beforeByKey.get(removedKey);
|
|
2437
|
+
return removedConnection.outputNodeId === addedConnection.outputNodeId && removedConnection.inputNodeId === addedConnection.inputNodeId;
|
|
2438
|
+
});
|
|
2439
|
+
if (matchingRemovedKey) {
|
|
2440
|
+
changedRemovedKeys.add(matchingRemovedKey);
|
|
2441
|
+
changedAddedKeys.add(addedKey);
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
return Object.fromEntries(
|
|
2445
|
+
unionKeys(Object.fromEntries(beforeByKey), Object.fromEntries(afterByKey)).map((key) => {
|
|
2446
|
+
const before = beforeByKey.get(key);
|
|
2447
|
+
const after = afterByKey.get(key);
|
|
2448
|
+
const kind = changedAddedKeys.has(key) || changedRemovedKeys.has(key) ? "changed" : !before && after ? "added" : before && !after ? "removed" : "unchanged";
|
|
2449
|
+
return [
|
|
2450
|
+
key,
|
|
2451
|
+
{
|
|
2452
|
+
key,
|
|
2453
|
+
kind,
|
|
2454
|
+
before,
|
|
2455
|
+
after
|
|
2456
|
+
}
|
|
2457
|
+
];
|
|
2458
|
+
})
|
|
2459
|
+
);
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
// src/utils/projectComparison/nodes.ts
|
|
2463
|
+
function getProjectNodeFieldComparisons(comparison) {
|
|
2464
|
+
const before = comparison.before;
|
|
2465
|
+
const after = comparison.after;
|
|
2466
|
+
if (!before || !after) {
|
|
2467
|
+
return [];
|
|
2468
|
+
}
|
|
2469
|
+
return getChangedValueComparisons([], getComparableNodeRecord(before), getComparableNodeRecord(after));
|
|
2470
|
+
}
|
|
2471
|
+
function getComparableGraphNodes(nodes) {
|
|
2472
|
+
return nodes.filter((node) => node.type !== "comment");
|
|
2473
|
+
}
|
|
2474
|
+
function compareNodes(beforeNodes, afterNodes) {
|
|
2475
|
+
const beforeById = new Map(beforeNodes.map((node) => [node.id, node]));
|
|
2476
|
+
const afterById = new Map(afterNodes.map((node) => [node.id, node]));
|
|
2477
|
+
const nodeIds = unionKeys(Object.fromEntries(beforeById), Object.fromEntries(afterById));
|
|
2478
|
+
return Object.fromEntries(
|
|
2479
|
+
nodeIds.map((nodeId) => {
|
|
2480
|
+
const before = beforeById.get(nodeId);
|
|
2481
|
+
const after = afterById.get(nodeId);
|
|
2482
|
+
if (!before && after) {
|
|
2483
|
+
return [nodeId, { id: nodeId, kind: "added", after }];
|
|
2484
|
+
}
|
|
2485
|
+
if (before && !after) {
|
|
2486
|
+
return [nodeId, { id: nodeId, kind: "removed", before }];
|
|
2487
|
+
}
|
|
2488
|
+
return [
|
|
2489
|
+
nodeId,
|
|
2490
|
+
{
|
|
2491
|
+
id: nodeId,
|
|
2492
|
+
kind: areComparisonNodesEqual(before, after) ? "unchanged" : "changed",
|
|
2493
|
+
before,
|
|
2494
|
+
after
|
|
2495
|
+
}
|
|
2496
|
+
];
|
|
2497
|
+
})
|
|
2498
|
+
);
|
|
2499
|
+
}
|
|
2500
|
+
function areComparisonNodesEqual(left, right) {
|
|
2501
|
+
return areComparisonValuesEqual(
|
|
2502
|
+
left ? getComparableNodeRecord(left) : left,
|
|
2503
|
+
right ? getComparableNodeRecord(right) : right
|
|
2504
|
+
);
|
|
2505
|
+
}
|
|
2506
|
+
function getComparableNodeRecord(node) {
|
|
2507
|
+
const { data, visualData: _visualData, ...rest } = node;
|
|
2508
|
+
return {
|
|
2509
|
+
...rest,
|
|
2510
|
+
data: getComparableNodeData(node, data)
|
|
2511
|
+
};
|
|
2512
|
+
}
|
|
2513
|
+
function getComparableNodeData(node, data) {
|
|
2514
|
+
if (node.type !== "subGraph" || !isComparisonRecord(data)) {
|
|
2515
|
+
return data;
|
|
2516
|
+
}
|
|
2517
|
+
const { inputPortOrder: _inputPortOrder, outputPortOrder: _outputPortOrder, ...semanticData } = data;
|
|
2518
|
+
return semanticData;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
// src/utils/projectComparison/summaries.ts
|
|
2522
|
+
function summarizeProjectComparison(graphs, nodePrefabs = {}, uiGraphs = {}) {
|
|
2523
|
+
const summary = Object.values(graphs).reduce((acc, graph) => {
|
|
2524
|
+
if (graph.kind === "added")
|
|
2525
|
+
acc.addedGraphs += 1;
|
|
2526
|
+
if (graph.kind === "removed")
|
|
2527
|
+
acc.removedGraphs += 1;
|
|
2528
|
+
if (graph.kind === "changed")
|
|
2529
|
+
acc.changedGraphs += 1;
|
|
2530
|
+
acc.addedNodes += graph.summary.addedNodes;
|
|
2531
|
+
acc.removedNodes += graph.summary.removedNodes;
|
|
2532
|
+
acc.changedNodes += graph.summary.changedNodes;
|
|
2533
|
+
acc.addedConnections += graph.summary.addedConnections;
|
|
2534
|
+
acc.removedConnections += graph.summary.removedConnections;
|
|
2535
|
+
acc.changedConnections += graph.summary.changedConnections;
|
|
2536
|
+
return acc;
|
|
2537
|
+
}, createEmptyProjectSummary());
|
|
2538
|
+
for (const prefab of Object.values(nodePrefabs)) {
|
|
2539
|
+
if (prefab.kind === "added")
|
|
2540
|
+
summary.addedNodePrefabs = (summary.addedNodePrefabs ?? 0) + 1;
|
|
2541
|
+
if (prefab.kind === "removed")
|
|
2542
|
+
summary.removedNodePrefabs = (summary.removedNodePrefabs ?? 0) + 1;
|
|
2543
|
+
if (prefab.kind === "changed")
|
|
2544
|
+
summary.changedNodePrefabs = (summary.changedNodePrefabs ?? 0) + 1;
|
|
2545
|
+
}
|
|
2546
|
+
for (const uiGraph of Object.values(uiGraphs)) {
|
|
2547
|
+
if (uiGraph.kind === "added")
|
|
2548
|
+
summary.addedUiGraphs = (summary.addedUiGraphs ?? 0) + 1;
|
|
2549
|
+
if (uiGraph.kind === "removed")
|
|
2550
|
+
summary.removedUiGraphs = (summary.removedUiGraphs ?? 0) + 1;
|
|
2551
|
+
if (uiGraph.kind === "changed")
|
|
2552
|
+
summary.changedUiGraphs = (summary.changedUiGraphs ?? 0) + 1;
|
|
2553
|
+
}
|
|
2554
|
+
return summary;
|
|
2555
|
+
}
|
|
2556
|
+
function summarizeGraphComparison(nodes, connections) {
|
|
2557
|
+
const nodeComparisons = Object.values(nodes);
|
|
2558
|
+
const connectionComparisons = Object.values(connections);
|
|
2559
|
+
return {
|
|
2560
|
+
addedNodes: nodeComparisons.filter((node) => node.kind === "added").length,
|
|
2561
|
+
removedNodes: nodeComparisons.filter((node) => node.kind === "removed").length,
|
|
2562
|
+
changedNodes: nodeComparisons.filter((node) => node.kind === "changed").length,
|
|
2563
|
+
addedConnections: connectionComparisons.filter((connection) => connection.kind === "added").length,
|
|
2564
|
+
removedConnections: connectionComparisons.filter((connection) => connection.kind === "removed").length,
|
|
2565
|
+
changedConnections: connectionComparisons.filter((connection) => connection.kind === "changed" && connection.after).length
|
|
2566
|
+
};
|
|
2567
|
+
}
|
|
2568
|
+
function createEmptyProjectSummary() {
|
|
2569
|
+
return {
|
|
2570
|
+
addedGraphs: 0,
|
|
2571
|
+
removedGraphs: 0,
|
|
2572
|
+
changedGraphs: 0,
|
|
2573
|
+
addedNodes: 0,
|
|
2574
|
+
removedNodes: 0,
|
|
2575
|
+
changedNodes: 0,
|
|
2576
|
+
addedConnections: 0,
|
|
2577
|
+
removedConnections: 0,
|
|
2578
|
+
changedConnections: 0
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
// src/utils/projectComparison/graphs.ts
|
|
2583
|
+
function compareGraphs(id, before, after) {
|
|
2584
|
+
if (!before && after) {
|
|
2585
|
+
return createOneSidedGraphComparison(id, after, "added");
|
|
2586
|
+
}
|
|
2587
|
+
if (before && !after) {
|
|
2588
|
+
return createOneSidedGraphComparison(id, before, "removed");
|
|
2589
|
+
}
|
|
2590
|
+
if (!before || !after) {
|
|
2591
|
+
throw new Error(`Cannot compare missing graph ${id}`);
|
|
2592
|
+
}
|
|
2593
|
+
const nodes = compareNodes(getComparableGraphNodes(before.nodes), getComparableGraphNodes(after.nodes));
|
|
2594
|
+
const connections = compareConnections(
|
|
2595
|
+
getComparableGraphConnections(before.connections, before.nodes),
|
|
2596
|
+
getComparableGraphConnections(after.connections, after.nodes)
|
|
2597
|
+
);
|
|
2598
|
+
const summary = summarizeGraphComparison(nodes, connections);
|
|
2599
|
+
const metadataChanged = !areComparisonValuesEqual(before.metadata, after.metadata);
|
|
2600
|
+
return {
|
|
2601
|
+
id,
|
|
2602
|
+
kind: metadataChanged || Object.values(summary).some((count) => count > 0) ? "changed" : "unchanged",
|
|
2603
|
+
before,
|
|
2604
|
+
after,
|
|
2605
|
+
metadataChanged,
|
|
2606
|
+
nodes,
|
|
2607
|
+
connections,
|
|
2608
|
+
summary
|
|
2609
|
+
};
|
|
2610
|
+
}
|
|
2611
|
+
function createOneSidedGraphComparison(id, graph, kind) {
|
|
2612
|
+
const graphNodes = getComparableGraphNodes(graph.nodes);
|
|
2613
|
+
const graphConnections = getComparableGraphConnections(graph.connections, graph.nodes);
|
|
2614
|
+
const nodes = Object.fromEntries(
|
|
2615
|
+
graphNodes.map((node) => [
|
|
2616
|
+
node.id,
|
|
2617
|
+
kind === "added" ? { id: node.id, kind, after: node } : { id: node.id, kind, before: node }
|
|
2618
|
+
])
|
|
2619
|
+
);
|
|
2620
|
+
const connections = createOneSidedConnectionComparisons(graphConnections, kind);
|
|
2621
|
+
return {
|
|
2622
|
+
id,
|
|
2623
|
+
kind,
|
|
2624
|
+
...kind === "added" ? { after: graph } : { before: graph },
|
|
2625
|
+
metadataChanged: true,
|
|
2626
|
+
nodes,
|
|
2627
|
+
connections,
|
|
2628
|
+
summary: summarizeGraphComparison(nodes, connections)
|
|
2629
|
+
};
|
|
2630
|
+
}
|
|
2631
|
+
function createOneSidedConnectionComparisons(connections, kind) {
|
|
2632
|
+
return Object.fromEntries(
|
|
2633
|
+
connections.map((connection) => {
|
|
2634
|
+
const key = getProjectConnectionComparisonKey(connection);
|
|
2635
|
+
return [
|
|
2636
|
+
key,
|
|
2637
|
+
kind === "added" ? { key, kind, after: connection } : { key, kind, before: connection }
|
|
2638
|
+
];
|
|
2639
|
+
})
|
|
2640
|
+
);
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
// src/utils/projectComparison.ts
|
|
2644
|
+
function compareProjects(before, after) {
|
|
2645
|
+
const graphIds = unionKeys(before.graphs, after.graphs);
|
|
2646
|
+
const graphs = Object.fromEntries(
|
|
2647
|
+
graphIds.map((graphId) => [graphId, compareGraphs(graphId, before.graphs[graphId], after.graphs[graphId])])
|
|
2648
|
+
);
|
|
2649
|
+
const nodePrefabs = compareNodePrefabs(before.nodePrefabs ?? {}, after.nodePrefabs ?? {});
|
|
2650
|
+
const uiGraphs = compareUiGraphs(before.uiGraphs ?? {}, after.uiGraphs ?? {});
|
|
2651
|
+
return {
|
|
2652
|
+
beforeProjectId: before.metadata.id,
|
|
2653
|
+
afterProjectId: after.metadata.id,
|
|
2654
|
+
metadataChanged: !areComparisonValuesEqual(before.metadata, after.metadata),
|
|
2655
|
+
graphs,
|
|
2656
|
+
nodePrefabs,
|
|
2657
|
+
uiGraphs,
|
|
2658
|
+
summary: summarizeProjectComparison(graphs, nodePrefabs, uiGraphs)
|
|
2659
|
+
};
|
|
2660
|
+
}
|
|
2661
|
+
function compareNodePrefabs(before, after) {
|
|
2662
|
+
const prefabIds = unionKeys(before, after);
|
|
2663
|
+
return Object.fromEntries(
|
|
2664
|
+
prefabIds.map((prefabId) => {
|
|
2665
|
+
const beforePrefab = before[prefabId];
|
|
2666
|
+
const afterPrefab = after[prefabId];
|
|
2667
|
+
if (!beforePrefab && afterPrefab) {
|
|
2668
|
+
return [prefabId, { id: prefabId, kind: "added", after: afterPrefab }];
|
|
2669
|
+
}
|
|
2670
|
+
if (beforePrefab && !afterPrefab) {
|
|
2671
|
+
return [prefabId, { id: prefabId, kind: "removed", before: beforePrefab }];
|
|
2672
|
+
}
|
|
2673
|
+
if (!beforePrefab || !afterPrefab) {
|
|
2674
|
+
throw new Error(`Cannot compare missing library node ${prefabId}`);
|
|
2675
|
+
}
|
|
2676
|
+
const sourceNodeComparison = Object.values(compareNodes([beforePrefab.sourceNode], [afterPrefab.sourceNode]))[0];
|
|
2677
|
+
return [
|
|
2678
|
+
prefabId,
|
|
2679
|
+
{
|
|
2680
|
+
id: prefabId,
|
|
2681
|
+
kind: sourceNodeComparison.kind === "unchanged" ? "unchanged" : "changed",
|
|
2682
|
+
before: beforePrefab,
|
|
2683
|
+
after: afterPrefab,
|
|
2684
|
+
sourceNode: sourceNodeComparison
|
|
2685
|
+
}
|
|
2686
|
+
];
|
|
2687
|
+
})
|
|
2688
|
+
);
|
|
2689
|
+
}
|
|
2690
|
+
function compareUiGraphs(before, after) {
|
|
2691
|
+
const uiGraphIds = unionKeys(before, after);
|
|
2692
|
+
return Object.fromEntries(
|
|
2693
|
+
uiGraphIds.map((uiGraphId) => {
|
|
2694
|
+
const beforeUiGraph = before[uiGraphId];
|
|
2695
|
+
const afterUiGraph = after[uiGraphId];
|
|
2696
|
+
if (!beforeUiGraph && afterUiGraph) {
|
|
2697
|
+
return [uiGraphId, { id: uiGraphId, kind: "added", after: afterUiGraph }];
|
|
2698
|
+
}
|
|
2699
|
+
if (beforeUiGraph && !afterUiGraph) {
|
|
2700
|
+
return [uiGraphId, { id: uiGraphId, kind: "removed", before: beforeUiGraph }];
|
|
2701
|
+
}
|
|
2702
|
+
if (!beforeUiGraph || !afterUiGraph) {
|
|
2703
|
+
throw new Error(`Cannot compare missing UI graph ${uiGraphId}`);
|
|
2704
|
+
}
|
|
2705
|
+
return [
|
|
2706
|
+
uiGraphId,
|
|
2707
|
+
{
|
|
2708
|
+
id: uiGraphId,
|
|
2709
|
+
kind: areComparisonValuesEqual(beforeUiGraph, afterUiGraph) ? "unchanged" : "changed",
|
|
2710
|
+
before: beforeUiGraph,
|
|
2711
|
+
after: afterUiGraph
|
|
2712
|
+
}
|
|
2713
|
+
];
|
|
2714
|
+
})
|
|
2715
|
+
);
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
// src/utils/jsonValueToDataValue.ts
|
|
2719
|
+
function jsonValueToDataValue(value) {
|
|
2720
|
+
if (isDataValue(value)) {
|
|
2721
|
+
return value;
|
|
2722
|
+
}
|
|
2723
|
+
if (typeof value === "string") {
|
|
2724
|
+
return { type: "string", value };
|
|
2725
|
+
}
|
|
2726
|
+
if (typeof value === "number") {
|
|
2727
|
+
return { type: "number", value };
|
|
2728
|
+
}
|
|
2729
|
+
if (typeof value === "boolean") {
|
|
2730
|
+
return { type: "boolean", value };
|
|
2731
|
+
}
|
|
2732
|
+
if (Array.isArray(value)) {
|
|
2733
|
+
return jsonArrayToDataValue(value);
|
|
2734
|
+
}
|
|
2735
|
+
if (isRecord(value)) {
|
|
2736
|
+
return { type: "object", value };
|
|
2737
|
+
}
|
|
2738
|
+
return { type: "any", value };
|
|
2739
|
+
}
|
|
2740
|
+
function jsonArrayToDataValue(value) {
|
|
2741
|
+
if (value.length === 0) {
|
|
2742
|
+
return { type: "any[]", value: [] };
|
|
2743
|
+
}
|
|
2744
|
+
if (value.every((item) => typeof item === "string")) {
|
|
2745
|
+
return { type: "string[]", value };
|
|
2746
|
+
}
|
|
2747
|
+
if (value.every((item) => typeof item === "number")) {
|
|
2748
|
+
return { type: "number[]", value };
|
|
2749
|
+
}
|
|
2750
|
+
if (value.every((item) => typeof item === "boolean")) {
|
|
2751
|
+
return { type: "boolean[]", value };
|
|
2752
|
+
}
|
|
2753
|
+
if (value.every(isRecord)) {
|
|
2754
|
+
return { type: "object[]", value };
|
|
2755
|
+
}
|
|
2756
|
+
return { type: "any[]", value };
|
|
2757
|
+
}
|
|
2758
|
+
function isDataValue(value) {
|
|
2759
|
+
return value != null && typeof value === "object" && typeof value.type === "string" && "value" in value;
|
|
2760
|
+
}
|
|
2761
|
+
function isRecord(value) {
|
|
2762
|
+
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2245
2765
|
// src/utils/pQueueCompat.ts
|
|
2246
2766
|
var import_p_queue = __toESM(require("p-queue-6"), 1);
|
|
2247
2767
|
var PQueue = typeof import_p_queue.default === "function" ? import_p_queue.default : import_p_queue.default.default;
|
|
@@ -2295,15 +2815,76 @@ function findStronglyConnectedComponents(nodes, getAdjacentNodes) {
|
|
|
2295
2815
|
return stronglyConnectedComponents;
|
|
2296
2816
|
}
|
|
2297
2817
|
|
|
2818
|
+
// src/model/NodePrefabResolver.ts
|
|
2819
|
+
var NODE_PREFAB_INSTANCE_TYPE = "nodePrefabInstance";
|
|
2820
|
+
var BLOCKED_NODE_PREFAB_SOURCE_TYPES = /* @__PURE__ */ new Set([
|
|
2821
|
+
"comment",
|
|
2822
|
+
"graphInput",
|
|
2823
|
+
"graphOutput",
|
|
2824
|
+
"referencedGraphAlias",
|
|
2825
|
+
NODE_PREFAB_INSTANCE_TYPE
|
|
2826
|
+
]);
|
|
2827
|
+
function isNodePrefabInstanceNode(node) {
|
|
2828
|
+
return (node == null ? void 0 : node.type) === NODE_PREFAB_INSTANCE_TYPE;
|
|
2829
|
+
}
|
|
2830
|
+
function canUseNodeAsPrefabSource(node) {
|
|
2831
|
+
return !BLOCKED_NODE_PREFAB_SOURCE_TYPES.has(node.type);
|
|
2832
|
+
}
|
|
2833
|
+
function getNodePrefabInstancePrefabId(node) {
|
|
2834
|
+
var _a;
|
|
2835
|
+
if (!isNodePrefabInstanceNode(node)) {
|
|
2836
|
+
return void 0;
|
|
2837
|
+
}
|
|
2838
|
+
const prefabId = (_a = node.data) == null ? void 0 : _a.prefabId;
|
|
2839
|
+
return typeof prefabId === "string" && prefabId.length > 0 ? prefabId : void 0;
|
|
2840
|
+
}
|
|
2841
|
+
function resolveNodePrefabInstance(project, node) {
|
|
2842
|
+
var _a, _b;
|
|
2843
|
+
const prefabId = getNodePrefabInstancePrefabId(node);
|
|
2844
|
+
if (!prefabId) {
|
|
2845
|
+
return node;
|
|
2846
|
+
}
|
|
2847
|
+
const sourceNode = (_b = (_a = project.nodePrefabs) == null ? void 0 : _a[prefabId]) == null ? void 0 : _b.sourceNode;
|
|
2848
|
+
if (!sourceNode || !canUseNodeAsPrefabSource(sourceNode)) {
|
|
2849
|
+
return {
|
|
2850
|
+
...node,
|
|
2851
|
+
title: `Missing library node (${prefabId})`
|
|
2852
|
+
};
|
|
2853
|
+
}
|
|
2854
|
+
return {
|
|
2855
|
+
...structuredClone(sourceNode),
|
|
2856
|
+
id: node.id,
|
|
2857
|
+
visualData: {
|
|
2858
|
+
...structuredClone(sourceNode.visualData),
|
|
2859
|
+
x: node.visualData.x,
|
|
2860
|
+
y: node.visualData.y,
|
|
2861
|
+
width: node.visualData.width ?? sourceNode.visualData.width,
|
|
2862
|
+
zIndex: node.visualData.zIndex
|
|
2863
|
+
}
|
|
2864
|
+
};
|
|
2865
|
+
}
|
|
2866
|
+
function resolveNodePrefabInstances(project, nodes) {
|
|
2867
|
+
return nodes.map((node) => resolveNodePrefabInstance(project, node));
|
|
2868
|
+
}
|
|
2869
|
+
function getNodePrefabDisplayName(project, prefabId) {
|
|
2870
|
+
var _a, _b;
|
|
2871
|
+
if (!prefabId) {
|
|
2872
|
+
return "Missing library node";
|
|
2873
|
+
}
|
|
2874
|
+
const sourceNode = (_b = (_a = project.nodePrefabs) == null ? void 0 : _a[prefabId]) == null ? void 0 : _b.sourceNode;
|
|
2875
|
+
return sourceNode && canUseNodeAsPrefabSource(sourceNode) ? sourceNode.title || "Untitled library node" : "Missing library node";
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2298
2878
|
// src/model/GraphPreprocessor.ts
|
|
2299
2879
|
function preprocessGraphState(options2) {
|
|
2300
2880
|
var _a, _b;
|
|
2301
2881
|
const { buildExecutionPlan, definitionContext, graph, loadedProjects, project, registry, warnOnInvalidGraph } = options2;
|
|
2302
|
-
const
|
|
2882
|
+
const graphNodes = resolveNodePrefabInstances(project, graph.nodes);
|
|
2883
|
+
const effectiveDefinitionContext = definitionContext && graphNodes.some(usesGraphBoundaryDefinitionContext) ? definitionContext : void 0;
|
|
2303
2884
|
const nodeInstances = {};
|
|
2304
2885
|
const nodesById = {};
|
|
2305
2886
|
const connections = {};
|
|
2306
|
-
for (const node of
|
|
2887
|
+
for (const node of graphNodes) {
|
|
2307
2888
|
nodeInstances[node.id] = registry.createDynamicImpl(node);
|
|
2308
2889
|
nodesById[node.id] = node;
|
|
2309
2890
|
}
|
|
@@ -2336,7 +2917,7 @@ function preprocessGraphState(options2) {
|
|
|
2336
2917
|
definitionContext: effectiveDefinitionContext,
|
|
2337
2918
|
warnOnInvalidGraph
|
|
2338
2919
|
});
|
|
2339
|
-
const stronglyConnectedComponents = findStronglyConnectedComponents(
|
|
2920
|
+
const stronglyConnectedComponents = findStronglyConnectedComponents(graphNodes, (node) => {
|
|
2340
2921
|
const nodeConnections = connections[node.id] ?? [];
|
|
2341
2922
|
return nodeConnections.filter((connection) => connection.outputNodeId === node.id).map((connection) => nodesById[connection.inputNodeId]).filter(Boolean);
|
|
2342
2923
|
});
|
|
@@ -2357,7 +2938,7 @@ function preprocessGraphState(options2) {
|
|
|
2357
2938
|
...buildGraphExecutionPlan({
|
|
2358
2939
|
connections,
|
|
2359
2940
|
definitions,
|
|
2360
|
-
graphNodes
|
|
2941
|
+
graphNodes,
|
|
2361
2942
|
nodesById,
|
|
2362
2943
|
stronglyConnectedComponents
|
|
2363
2944
|
})
|
|
@@ -2621,6 +3202,7 @@ function buildGraphExecutionPlan(options2) {
|
|
|
2621
3202
|
}
|
|
2622
3203
|
|
|
2623
3204
|
// src/model/GraphBoundaryCache.ts
|
|
3205
|
+
var GRAPH_BOUNDARY_OUTPUT_DEMAND_OPTIMIZATION_ENABLED = false;
|
|
2624
3206
|
function getGraphBoundary(project, graphId, cache4) {
|
|
2625
3207
|
if (!graphId) {
|
|
2626
3208
|
return void 0;
|
|
@@ -2640,8 +3222,33 @@ function getGraphBoundary(project, graphId, cache4) {
|
|
|
2640
3222
|
cache4.set(graph, boundary);
|
|
2641
3223
|
return boundary;
|
|
2642
3224
|
}
|
|
2643
|
-
function
|
|
2644
|
-
|
|
3225
|
+
function applyGraphBoundaryPortOrder(boundaryItems, portOrder) {
|
|
3226
|
+
if (!(portOrder == null ? void 0 : portOrder.length)) {
|
|
3227
|
+
return [...boundaryItems];
|
|
3228
|
+
}
|
|
3229
|
+
const itemsById = new Map(boundaryItems.map((item) => [item.id, item]));
|
|
3230
|
+
const usedIds = /* @__PURE__ */ new Set();
|
|
3231
|
+
const orderedItems = [];
|
|
3232
|
+
for (const id of portOrder) {
|
|
3233
|
+
if (usedIds.has(id)) {
|
|
3234
|
+
continue;
|
|
3235
|
+
}
|
|
3236
|
+
const item = itemsById.get(id);
|
|
3237
|
+
if (!item) {
|
|
3238
|
+
continue;
|
|
3239
|
+
}
|
|
3240
|
+
orderedItems.push(item);
|
|
3241
|
+
usedIds.add(id);
|
|
3242
|
+
}
|
|
3243
|
+
for (const item of boundaryItems) {
|
|
3244
|
+
if (!usedIds.has(item.id)) {
|
|
3245
|
+
orderedItems.push(item);
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
return orderedItems;
|
|
3249
|
+
}
|
|
3250
|
+
function getGraphBoundaryInputDefinitions(boundary, inputPortOrder) {
|
|
3251
|
+
return applyGraphBoundaryPortOrder(boundary.inputs, inputPortOrder).map(
|
|
2645
3252
|
(input) => ({
|
|
2646
3253
|
id: input.portId,
|
|
2647
3254
|
title: input.id,
|
|
@@ -2649,8 +3256,8 @@ function getGraphBoundaryInputDefinitions(boundary) {
|
|
|
2649
3256
|
})
|
|
2650
3257
|
);
|
|
2651
3258
|
}
|
|
2652
|
-
function getGraphBoundaryOutputDefinitions(boundary) {
|
|
2653
|
-
return boundary.outputs.map(
|
|
3259
|
+
function getGraphBoundaryOutputDefinitions(boundary, outputPortOrder) {
|
|
3260
|
+
return applyGraphBoundaryPortOrder(boundary.outputs, outputPortOrder).map(
|
|
2654
3261
|
(output) => ({
|
|
2655
3262
|
id: output.portId,
|
|
2656
3263
|
title: output.id,
|
|
@@ -2683,6 +3290,9 @@ function buildExcludedGraphBoundaryOutputs(boundary) {
|
|
|
2683
3290
|
}
|
|
2684
3291
|
return outputs;
|
|
2685
3292
|
}
|
|
3293
|
+
function getRequestedGraphOutputNodeIds(boundary, requestedOutputPortIds) {
|
|
3294
|
+
return boundary.outputs.filter((output) => requestedOutputPortIds.has(output.portId)).map((output) => output.nodeId);
|
|
3295
|
+
}
|
|
2686
3296
|
function deriveGraphBoundary(graph) {
|
|
2687
3297
|
const inputsById = /* @__PURE__ */ new Map();
|
|
2688
3298
|
const outputsById = /* @__PURE__ */ new Map();
|
|
@@ -2700,6 +3310,7 @@ function deriveGraphBoundary(graph) {
|
|
|
2700
3310
|
outputsById.set(outputNode.data.id, {
|
|
2701
3311
|
dataType: outputNode.data.dataType,
|
|
2702
3312
|
id: outputNode.data.id,
|
|
3313
|
+
nodeId: outputNode.id,
|
|
2703
3314
|
portId: outputNode.data.id
|
|
2704
3315
|
});
|
|
2705
3316
|
}
|
|
@@ -2713,6 +3324,41 @@ function getBoundaryNodeId(node) {
|
|
|
2713
3324
|
return node.data.id;
|
|
2714
3325
|
}
|
|
2715
3326
|
|
|
3327
|
+
// src/model/GraphBoundaryEffects.ts
|
|
3328
|
+
function ensureGraphCostOutput(graphOutputs, totalCost) {
|
|
3329
|
+
const costPort = "cost";
|
|
3330
|
+
if (graphOutputs[costPort] == null) {
|
|
3331
|
+
graphOutputs[costPort] = {
|
|
3332
|
+
type: "number",
|
|
3333
|
+
value: totalCost
|
|
3334
|
+
};
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
function applyFrozenGraphBoundaryEffects(graphOutputs, node, outputValues) {
|
|
3338
|
+
var _a;
|
|
3339
|
+
if (node.type === "graphOutput") {
|
|
3340
|
+
const outputId = (_a = node.data) == null ? void 0 : _a.id;
|
|
3341
|
+
const valueOutput = outputValues["valueOutput"];
|
|
3342
|
+
if (outputId && valueOutput) {
|
|
3343
|
+
graphOutputs[outputId] = valueOutput;
|
|
3344
|
+
}
|
|
3345
|
+
return void 0;
|
|
3346
|
+
}
|
|
3347
|
+
if (node.type !== "setGlobal") {
|
|
3348
|
+
return void 0;
|
|
3349
|
+
}
|
|
3350
|
+
const savedValue = outputValues["saved-value"];
|
|
3351
|
+
const variableId = outputValues["variable_id_out"];
|
|
3352
|
+
const variableIdValue = (variableId == null ? void 0 : variableId.type) === "string" ? variableId.value : void 0;
|
|
3353
|
+
if (!variableIdValue || !savedValue) {
|
|
3354
|
+
return void 0;
|
|
3355
|
+
}
|
|
3356
|
+
return {
|
|
3357
|
+
variableId: variableIdValue,
|
|
3358
|
+
value: savedValue
|
|
3359
|
+
};
|
|
3360
|
+
}
|
|
3361
|
+
|
|
2716
3362
|
// src/model/RecordingPlayer.ts
|
|
2717
3363
|
var import_non_secure3 = require("nanoid/non-secure");
|
|
2718
3364
|
|
|
@@ -3049,11 +3695,13 @@ function didLoopControllerBreak(breakValue) {
|
|
|
3049
3695
|
function buildNodeProcessContext(options2) {
|
|
3050
3696
|
const {
|
|
3051
3697
|
attachedData,
|
|
3698
|
+
activeOutputPortIds,
|
|
3052
3699
|
base,
|
|
3053
3700
|
createSubProcessor,
|
|
3054
3701
|
execution,
|
|
3055
3702
|
externalFunctions,
|
|
3056
3703
|
getPluginConfig: getPluginConfig2,
|
|
3704
|
+
isDirectRunTarget,
|
|
3057
3705
|
node,
|
|
3058
3706
|
nodeAbortController,
|
|
3059
3707
|
onPartialOutputs,
|
|
@@ -3066,6 +3714,8 @@ function buildNodeProcessContext(options2) {
|
|
|
3066
3714
|
...base,
|
|
3067
3715
|
node,
|
|
3068
3716
|
attachedData,
|
|
3717
|
+
activeOutputPortIds,
|
|
3718
|
+
isDirectRunTarget,
|
|
3069
3719
|
waitEvent,
|
|
3070
3720
|
externalFunctions: { ...externalFunctions },
|
|
3071
3721
|
onPartialOutputs,
|
|
@@ -3638,6 +4288,50 @@ var NotAllowedCodeRunner = class {
|
|
|
3638
4288
|
};
|
|
3639
4289
|
|
|
3640
4290
|
// src/model/GraphProcessor.ts
|
|
4291
|
+
function cloneFrozenNodeOutputs(outputs) {
|
|
4292
|
+
if (typeof structuredClone !== "function") {
|
|
4293
|
+
throw new Error("Frozen node output cloning requires structuredClone support");
|
|
4294
|
+
}
|
|
4295
|
+
return structuredClone(outputs);
|
|
4296
|
+
}
|
|
4297
|
+
function cloneFrozenNodeOutputsByGraph(outputsByGraph) {
|
|
4298
|
+
return Object.fromEntries(
|
|
4299
|
+
Object.entries(outputsByGraph).map(([graphId, outputsByNode]) => [
|
|
4300
|
+
graphId,
|
|
4301
|
+
outputsByNode ? Object.fromEntries(
|
|
4302
|
+
Object.entries(outputsByNode).map(([nodeId, outputInstances]) => [
|
|
4303
|
+
nodeId,
|
|
4304
|
+
outputInstances == null ? void 0 : outputInstances.map((outputs) => cloneFrozenNodeOutputs(outputs))
|
|
4305
|
+
])
|
|
4306
|
+
) : void 0
|
|
4307
|
+
])
|
|
4308
|
+
);
|
|
4309
|
+
}
|
|
4310
|
+
function hasFrozenNodeOutputs(outputsByGraph) {
|
|
4311
|
+
if (!outputsByGraph) {
|
|
4312
|
+
return false;
|
|
4313
|
+
}
|
|
4314
|
+
return Object.values(outputsByGraph).some(
|
|
4315
|
+
(outputsByNode) => Object.values(outputsByNode ?? {}).some((outputInstances) => ((outputInstances == null ? void 0 : outputInstances.length) ?? 0) > 0)
|
|
4316
|
+
);
|
|
4317
|
+
}
|
|
4318
|
+
function createFrozenNodeOutputResolver(outputsByGraph) {
|
|
4319
|
+
if (!hasFrozenNodeOutputs(outputsByGraph)) {
|
|
4320
|
+
return void 0;
|
|
4321
|
+
}
|
|
4322
|
+
const countersByGraphRunAndNode = /* @__PURE__ */ new Map();
|
|
4323
|
+
return ({ execution, graphId, node }) => {
|
|
4324
|
+
var _a;
|
|
4325
|
+
const outputInstances = (_a = outputsByGraph == null ? void 0 : outputsByGraph[graphId]) == null ? void 0 : _a[node.id];
|
|
4326
|
+
if (!(outputInstances == null ? void 0 : outputInstances.length)) {
|
|
4327
|
+
return void 0;
|
|
4328
|
+
}
|
|
4329
|
+
const counterKey = `${execution.graphRunId}:${graphId}:${node.id}`;
|
|
4330
|
+
const currentIndex = countersByGraphRunAndNode.get(counterKey) ?? 0;
|
|
4331
|
+
countersByGraphRunAndNode.set(counterKey, currentIndex + 1);
|
|
4332
|
+
return cloneFrozenNodeOutputs(outputInstances[Math.min(currentIndex, outputInstances.length - 1)]);
|
|
4333
|
+
};
|
|
4334
|
+
}
|
|
3641
4335
|
var DEFAULT_NODE_CONCURRENCY = 8;
|
|
3642
4336
|
var DEFAULT_SPLIT_RUN_CONCURRENCY = 4;
|
|
3643
4337
|
var DEFAULT_ISOMORPHIC_CODE_RUNNER = new IsomorphicCodeRunner();
|
|
@@ -3703,7 +4397,9 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3703
4397
|
#runtimeCache;
|
|
3704
4398
|
#cacheLoadedProjects;
|
|
3705
4399
|
#scheduler;
|
|
4400
|
+
#runtimeProfiler;
|
|
3706
4401
|
#captureNodeTimings;
|
|
4402
|
+
#frozenNodeOutputResolver;
|
|
3707
4403
|
#useSeededExecutionPlanOnNextRun = false;
|
|
3708
4404
|
id = (0, import_non_secure4.nanoid)();
|
|
3709
4405
|
#includeTrace = true;
|
|
@@ -3751,6 +4447,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3751
4447
|
#scc = void 0;
|
|
3752
4448
|
#graphExecutionPlan;
|
|
3753
4449
|
#nodeProcessContextBase = void 0;
|
|
4450
|
+
#runToRelevantNodeIds;
|
|
3754
4451
|
#nodesNotInCycle = void 0;
|
|
3755
4452
|
#nodeAbortControllers = /* @__PURE__ */ new Map();
|
|
3756
4453
|
#graphInputNodeValues = {};
|
|
@@ -3770,6 +4467,34 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3770
4467
|
}
|
|
3771
4468
|
return Math.max(0, getMonotonicTimeMs() - start);
|
|
3772
4469
|
}
|
|
4470
|
+
#startRuntimeProfile() {
|
|
4471
|
+
return this.#runtimeProfiler ? getMonotonicTimeMs() : void 0;
|
|
4472
|
+
}
|
|
4473
|
+
#finishRuntimeProfile(bucket, start) {
|
|
4474
|
+
if (start == null || !this.#runtimeProfiler) {
|
|
4475
|
+
return;
|
|
4476
|
+
}
|
|
4477
|
+
try {
|
|
4478
|
+
this.#runtimeProfiler.addDuration(bucket, Math.max(0, getMonotonicTimeMs() - start));
|
|
4479
|
+
} catch {
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
4482
|
+
#profileRuntimeSync(bucket, run) {
|
|
4483
|
+
const start = this.#startRuntimeProfile();
|
|
4484
|
+
try {
|
|
4485
|
+
return run();
|
|
4486
|
+
} finally {
|
|
4487
|
+
this.#finishRuntimeProfile(bucket, start);
|
|
4488
|
+
}
|
|
4489
|
+
}
|
|
4490
|
+
async #profileRuntimeAsync(bucket, run) {
|
|
4491
|
+
const start = this.#startRuntimeProfile();
|
|
4492
|
+
try {
|
|
4493
|
+
return await run();
|
|
4494
|
+
} finally {
|
|
4495
|
+
this.#finishRuntimeProfile(bucket, start);
|
|
4496
|
+
}
|
|
4497
|
+
}
|
|
3773
4498
|
constructor(project, graphId, registry, includeTrace, options2) {
|
|
3774
4499
|
this.#project = project;
|
|
3775
4500
|
const graph = resolveProcessorGraph(project, graphId);
|
|
@@ -3787,6 +4512,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3787
4512
|
this.#runtimeCache = options2 == null ? void 0 : options2.runtimeCache;
|
|
3788
4513
|
this.#cacheLoadedProjects = (options2 == null ? void 0 : options2.cacheLoadedProjects) ?? false;
|
|
3789
4514
|
this.#scheduler = (options2 == null ? void 0 : options2.scheduler) ?? "compatible";
|
|
4515
|
+
this.#runtimeProfiler = options2 == null ? void 0 : options2.runtimeProfiler;
|
|
3790
4516
|
this.#captureNodeTimings = (options2 == null ? void 0 : options2.captureNodeTimings) ?? false;
|
|
3791
4517
|
this.#emitter.bindMethods(this, ["on", "off", "once", "onAny", "offAny"]);
|
|
3792
4518
|
this.setExternalFunction("echo", async (value) => ({ type: "any", value }));
|
|
@@ -3799,30 +4525,37 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3799
4525
|
}
|
|
3800
4526
|
}
|
|
3801
4527
|
#preprocessGraph() {
|
|
3802
|
-
var _a;
|
|
3803
|
-
const
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
4528
|
+
var _a, _b;
|
|
4529
|
+
const profileStart = this.#startRuntimeProfile();
|
|
4530
|
+
try {
|
|
4531
|
+
const runtimeCache = this.#canUseRuntimeExecutionPlanCache() ? this.#runtimeCache : void 0;
|
|
4532
|
+
const shouldUseRuntimeCache = runtimeCache != null;
|
|
4533
|
+
const cachedPlan = (_a = runtimeCache == null ? void 0 : runtimeCache.executionPlans) == null ? void 0 : _a.get(this.#graph);
|
|
4534
|
+
if (cachedPlan && ((_b = runtimeCache == null ? void 0 : runtimeCache.executionPlanNodePrefabs) == null ? void 0 : _b.get(this.#graph)) === this.#project.nodePrefabs) {
|
|
4535
|
+
this.#applyPreprocessedGraph(cachedPlan, { recreateNodeInstances: true });
|
|
4536
|
+
return;
|
|
4537
|
+
}
|
|
4538
|
+
const preprocessedGraph = preprocessGraphState({
|
|
4539
|
+
graph: this.#graph,
|
|
4540
|
+
loadedProjects: this.#loadedProjects,
|
|
4541
|
+
project: this.#project,
|
|
4542
|
+
registry: this.#registry,
|
|
4543
|
+
warnOnInvalidGraph: this.warnOnInvalidGraph,
|
|
4544
|
+
buildExecutionPlan: shouldUseRuntimeCache,
|
|
4545
|
+
definitionContext: this.#runtimeCache ? {
|
|
4546
|
+
getGraphBoundary: (project, graphId) => this.#getGraphBoundary(project, graphId)
|
|
4547
|
+
} : void 0
|
|
4548
|
+
});
|
|
4549
|
+
if (shouldUseRuntimeCache && isGraphExecutionPlan(preprocessedGraph)) {
|
|
4550
|
+
runtimeCache.executionPlans ??= /* @__PURE__ */ new WeakMap();
|
|
4551
|
+
runtimeCache.executionPlanNodePrefabs ??= /* @__PURE__ */ new WeakMap();
|
|
4552
|
+
runtimeCache.executionPlans.set(this.#graph, toReusableGraphExecutionPlan(preprocessedGraph));
|
|
4553
|
+
runtimeCache.executionPlanNodePrefabs.set(this.#graph, this.#project.nodePrefabs);
|
|
4554
|
+
}
|
|
4555
|
+
this.#applyPreprocessedGraph(preprocessedGraph);
|
|
4556
|
+
} finally {
|
|
4557
|
+
this.#finishRuntimeProfile("preprocessGraph", profileStart);
|
|
3824
4558
|
}
|
|
3825
|
-
this.#applyPreprocessedGraph(preprocessedGraph);
|
|
3826
4559
|
}
|
|
3827
4560
|
#canUseRuntimeExecutionPlanCache() {
|
|
3828
4561
|
return this.#canUseRuntimeExecutionPlanCacheFor(this.#project, this.#isSubProcessor);
|
|
@@ -3848,7 +4581,9 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3848
4581
|
return getGraphBoundary(project, graphId, this.#runtimeCache.graphBoundaries);
|
|
3849
4582
|
}
|
|
3850
4583
|
#applyPreprocessedGraph(preprocessedGraph, options2 = {}) {
|
|
3851
|
-
const nodeInstances = options2.recreateNodeInstances || !("nodeInstances" in preprocessedGraph) ? this.#createNodeInstances(
|
|
4584
|
+
const nodeInstances = options2.recreateNodeInstances || !("nodeInstances" in preprocessedGraph) ? this.#createNodeInstances(
|
|
4585
|
+
isGraphExecutionPlan(preprocessedGraph) ? preprocessedGraph.graphNodes : Object.values(preprocessedGraph.nodesById)
|
|
4586
|
+
) : preprocessedGraph.nodeInstances;
|
|
3852
4587
|
replaceRecordContents(this.#nodeInstances, nodeInstances);
|
|
3853
4588
|
replaceRecordContents(this.#nodesById, preprocessedGraph.nodesById);
|
|
3854
4589
|
replaceRecordContents(this.#connections, preprocessedGraph.connections);
|
|
@@ -4011,6 +4746,9 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
4011
4746
|
this.#visitedNodes.add(nodeId);
|
|
4012
4747
|
this.#hasPreloadedData = true;
|
|
4013
4748
|
}
|
|
4749
|
+
setFrozenNodeOutputResolver(resolver) {
|
|
4750
|
+
this.#frozenNodeOutputResolver = resolver;
|
|
4751
|
+
}
|
|
4014
4752
|
/** Gets all node IDs that a given node ID depends on being complete before the given node ID can start. */
|
|
4015
4753
|
getDependencyNodesDeep(nodeId) {
|
|
4016
4754
|
this.#ensureGraphPreprocessed();
|
|
@@ -4096,6 +4834,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
4096
4834
|
this.#globals ??= /* @__PURE__ */ new Map();
|
|
4097
4835
|
this.#ignoreNodes = /* @__PURE__ */ new Set();
|
|
4098
4836
|
this.#nodeProcessContextBase = void 0;
|
|
4837
|
+
this.#runToRelevantNodeIds = void 0;
|
|
4099
4838
|
this.#abortController = this.#newAbortController();
|
|
4100
4839
|
this.#abortController.signal.addEventListener("abort", () => {
|
|
4101
4840
|
this.#aborted = true;
|
|
@@ -4119,30 +4858,28 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
4119
4858
|
throw new Error("Cannot process graph while already processing");
|
|
4120
4859
|
}
|
|
4121
4860
|
try {
|
|
4122
|
-
this.#initializeGraphRun(context, inputs, contextValues);
|
|
4123
|
-
await this.#loadProjectReferences();
|
|
4124
|
-
this.#prepareNodeProcessContextBase();
|
|
4861
|
+
this.#profileRuntimeSync("initializeGraphRun", () => this.#initializeGraphRun(context, inputs, contextValues));
|
|
4862
|
+
await this.#profileRuntimeAsync("loadProjectReferences", () => this.#loadProjectReferences());
|
|
4863
|
+
this.#profileRuntimeSync("prepareNodeProcessContextBase", () => this.#prepareNodeProcessContextBase());
|
|
4125
4864
|
const shouldUseSeededExecutionPlan = this.#seededExecutionPlanForNextRun() != null;
|
|
4126
4865
|
this.#useSeededExecutionPlanOnNextRun = false;
|
|
4127
4866
|
if (!shouldUseSeededExecutionPlan) {
|
|
4128
4867
|
this.#preprocessGraph();
|
|
4129
4868
|
}
|
|
4130
|
-
await this.#emitGraphStart();
|
|
4131
|
-
await this.#emitPreloadedNodeResults();
|
|
4132
|
-
await this.#waitUntilUnpaused();
|
|
4869
|
+
await this.#profileRuntimeAsync("emitGraphStart", () => this.#emitGraphStart());
|
|
4870
|
+
await this.#profileRuntimeAsync("emitPreloadedNodeResults", () => this.#emitPreloadedNodeResults());
|
|
4871
|
+
await this.#profileRuntimeAsync("waitUntilUnpaused", () => this.#waitUntilUnpaused());
|
|
4133
4872
|
if (this.#canUseFastAcyclicScheduler()) {
|
|
4134
|
-
await this.#processFastAcyclicGraph();
|
|
4873
|
+
await this.#profileRuntimeAsync("processFastAcyclicGraph", () => this.#processFastAcyclicGraph());
|
|
4135
4874
|
} else {
|
|
4136
|
-
await this.#
|
|
4137
|
-
await this.#processingQueue.onIdle();
|
|
4138
|
-
this.#markUnqueuedNodesIgnored();
|
|
4875
|
+
await this.#profileRuntimeAsync("processCompatibleGraph", () => this.#processCompatibleGraph());
|
|
4139
4876
|
}
|
|
4140
|
-
await this.#throwIfGraphErrored();
|
|
4141
|
-
return await this.#finalizeGraphRun();
|
|
4877
|
+
await this.#profileRuntimeAsync("throwIfGraphErrored", () => this.#throwIfGraphErrored());
|
|
4878
|
+
return await this.#profileRuntimeAsync("finalizeGraphRun", () => this.#finalizeGraphRun());
|
|
4142
4879
|
} finally {
|
|
4143
4880
|
this.#running = false;
|
|
4144
4881
|
this.#cleanupTokenizerErrorListener();
|
|
4145
|
-
await this.#emitFinishIfNeeded();
|
|
4882
|
+
await this.#profileRuntimeAsync("emitFinish", () => this.#emitFinishIfNeeded());
|
|
4146
4883
|
}
|
|
4147
4884
|
}
|
|
4148
4885
|
async #emitFinishIfNeeded() {
|
|
@@ -4256,6 +4993,11 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
4256
4993
|
});
|
|
4257
4994
|
}
|
|
4258
4995
|
}
|
|
4996
|
+
async #processCompatibleGraph() {
|
|
4997
|
+
await this.#queueStartNodes(getStartNodes(this.#executionState, this.#graph.nodes, this.runToNodeIds));
|
|
4998
|
+
await this.#processingQueue.onIdle();
|
|
4999
|
+
this.#markUnqueuedNodesIgnored();
|
|
5000
|
+
}
|
|
4259
5001
|
#canUseFastAcyclicScheduler() {
|
|
4260
5002
|
if (this.#scheduler !== "fast-acyclic") {
|
|
4261
5003
|
return false;
|
|
@@ -4277,14 +5019,29 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
4277
5019
|
});
|
|
4278
5020
|
}
|
|
4279
5021
|
async #processFastAcyclicGraph() {
|
|
5022
|
+
const relevantNodeIds = /* @__PURE__ */ new Set();
|
|
5023
|
+
const nodesToVisit = [...getStartNodes(this.#executionState, this.#graph.nodes)];
|
|
5024
|
+
for (let index = 0; index < nodesToVisit.length; index += 1) {
|
|
5025
|
+
const node = nodesToVisit[index];
|
|
5026
|
+
if (relevantNodeIds.has(node.id)) {
|
|
5027
|
+
continue;
|
|
5028
|
+
}
|
|
5029
|
+
relevantNodeIds.add(node.id);
|
|
5030
|
+
nodesToVisit.push(...getInputNodesTo(this.#executionState, node));
|
|
5031
|
+
}
|
|
5032
|
+
const inputNodeIdsByNode = /* @__PURE__ */ new Map();
|
|
4280
5033
|
const remainingInputsByNode = /* @__PURE__ */ new Map();
|
|
4281
5034
|
const readyNodes = [];
|
|
4282
5035
|
const queuedNodeIds = /* @__PURE__ */ new Set();
|
|
4283
5036
|
for (const node of this.#graph.nodes) {
|
|
5037
|
+
if (!relevantNodeIds.has(node.id)) {
|
|
5038
|
+
continue;
|
|
5039
|
+
}
|
|
4284
5040
|
const inputNodeIds = /* @__PURE__ */ new Set();
|
|
4285
5041
|
for (const inputNode of getInputNodesTo(this.#executionState, node)) {
|
|
4286
5042
|
inputNodeIds.add(inputNode.id);
|
|
4287
5043
|
}
|
|
5044
|
+
inputNodeIdsByNode.set(node.id, inputNodeIds);
|
|
4288
5045
|
const inputCount = inputNodeIds.size;
|
|
4289
5046
|
remainingInputsByNode.set(node.id, inputCount);
|
|
4290
5047
|
if (inputCount === 0) {
|
|
@@ -4295,8 +5052,12 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
4295
5052
|
await new Promise((resolve, reject) => {
|
|
4296
5053
|
let activeCount = 0;
|
|
4297
5054
|
let settled = false;
|
|
4298
|
-
const queueReadyOutputs = (outputNodes) => {
|
|
5055
|
+
const queueReadyOutputs = (node, outputNodes) => {
|
|
5056
|
+
var _a;
|
|
4299
5057
|
for (const outputNode of outputNodes) {
|
|
5058
|
+
if (!relevantNodeIds.has(outputNode.id) || !((_a = inputNodeIdsByNode.get(outputNode.id)) == null ? void 0 : _a.has(node.id))) {
|
|
5059
|
+
continue;
|
|
5060
|
+
}
|
|
4300
5061
|
const remainingInputs = (remainingInputsByNode.get(outputNode.id) ?? 0) - 1;
|
|
4301
5062
|
remainingInputsByNode.set(outputNode.id, remainingInputs);
|
|
4302
5063
|
if (remainingInputs <= 0 && !queuedNodeIds.has(outputNode.id)) {
|
|
@@ -4321,7 +5082,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
4321
5082
|
while (activeCount < this.#concurrency.nodeConcurrency && readyNodes.length > 0) {
|
|
4322
5083
|
const node = readyNodes.shift();
|
|
4323
5084
|
activeCount += 1;
|
|
4324
|
-
void this.#processNodeIfAllInputsAvailable(node, { queueOutputNodes: false }).then(queueReadyOutputs).then(() => {
|
|
5085
|
+
void this.#processNodeIfAllInputsAvailable(node, { queueOutputNodes: false }).then((outputNodes) => queueReadyOutputs(node, outputNodes)).then(() => {
|
|
4325
5086
|
activeCount -= 1;
|
|
4326
5087
|
pump();
|
|
4327
5088
|
settle();
|
|
@@ -4381,12 +5142,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4381
5142
|
throw error;
|
|
4382
5143
|
}
|
|
4383
5144
|
async #finalizeGraphRun() {
|
|
4384
|
-
|
|
4385
|
-
this.#graphOutputs["cost"] = {
|
|
4386
|
-
type: "number",
|
|
4387
|
-
value: this.#totalCost
|
|
4388
|
-
};
|
|
4389
|
-
}
|
|
5145
|
+
ensureGraphCostOutput(this.#graphOutputs, this.#totalCost);
|
|
4390
5146
|
const outputValues = this.#graphOutputs;
|
|
4391
5147
|
this.#running = false;
|
|
4392
5148
|
await this.#emitter.emit("graphFinish", this.#withExecution({ graph: this.#graph, outputs: outputValues }));
|
|
@@ -4450,48 +5206,57 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4450
5206
|
}
|
|
4451
5207
|
async #fetchNodeDataAndProcessNode(node) {
|
|
4452
5208
|
var _a;
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
5209
|
+
const profileStart = this.#startRuntimeProfile();
|
|
5210
|
+
try {
|
|
5211
|
+
if (this.#currentlyProcessing.has(node.id) || this.#queuedNodes.has(node.id)) {
|
|
5212
|
+
return;
|
|
5213
|
+
}
|
|
5214
|
+
if (this.#nodeResults.has(node.id) || this.#erroredNodes.has(node.id)) {
|
|
5215
|
+
return;
|
|
5216
|
+
}
|
|
5217
|
+
const inputNodesProfileStart = this.#startRuntimeProfile();
|
|
5218
|
+
const inputNodes = getInputNodesTo(this.#executionState, node);
|
|
5219
|
+
this.#finishRuntimeProfile("getInputNodesTo", inputNodesProfileStart);
|
|
5220
|
+
if (this.#hasErroredInputNode(node, inputNodes)) {
|
|
5221
|
+
return;
|
|
5222
|
+
}
|
|
5223
|
+
this.#emitTraceEvent(`Node ${node.title} has input nodes: ${inputNodes.map((n) => n.title).join(", ")}`);
|
|
5224
|
+
const attachedData = this.#getAttachedDataTo(node);
|
|
5225
|
+
if (node.type === "raceInputs" || attachedData.races) {
|
|
5226
|
+
for (const inputNode of inputNodes) {
|
|
5227
|
+
const inputNodeAttachedData = this.#getAttachedDataTo(inputNode);
|
|
5228
|
+
const raceIds = /* @__PURE__ */ new Set([...((_a = attachedData.races) == null ? void 0 : _a.raceIds) ?? []]);
|
|
5229
|
+
if (node.type === "raceInputs") {
|
|
5230
|
+
raceIds.add(`race-${node.id}`);
|
|
5231
|
+
}
|
|
5232
|
+
inputNodeAttachedData.races = {
|
|
5233
|
+
propagate: false,
|
|
5234
|
+
raceIds: [...raceIds],
|
|
5235
|
+
completed: false
|
|
5236
|
+
};
|
|
4471
5237
|
}
|
|
4472
|
-
inputNodeAttachedData.races = {
|
|
4473
|
-
propagate: false,
|
|
4474
|
-
raceIds: [...raceIds],
|
|
4475
|
-
completed: false
|
|
4476
|
-
};
|
|
4477
5238
|
}
|
|
5239
|
+
this.#queuedNodes.add(node.id);
|
|
5240
|
+
void this.#processingQueue.addAll(
|
|
5241
|
+
inputNodes.map((inputNode) => {
|
|
5242
|
+
return async () => {
|
|
5243
|
+
this.#emitTraceEvent(`Fetching required data for node ${inputNode.title} (${inputNode.id})`);
|
|
5244
|
+
await this.#fetchNodeDataAndProcessNode(inputNode);
|
|
5245
|
+
};
|
|
5246
|
+
})
|
|
5247
|
+
);
|
|
5248
|
+
await this.#processNodeIfAllInputsAvailable(node);
|
|
5249
|
+
} finally {
|
|
5250
|
+
this.#finishRuntimeProfile("fetchNodeDataAndProcessNode", profileStart);
|
|
4478
5251
|
}
|
|
4479
|
-
this.#queuedNodes.add(node.id);
|
|
4480
|
-
void this.#processingQueue.addAll(
|
|
4481
|
-
inputNodes.map((inputNode) => {
|
|
4482
|
-
return async () => {
|
|
4483
|
-
this.#emitTraceEvent(`Fetching required data for node ${inputNode.title} (${inputNode.id})`);
|
|
4484
|
-
await this.#fetchNodeDataAndProcessNode(inputNode);
|
|
4485
|
-
};
|
|
4486
|
-
})
|
|
4487
|
-
);
|
|
4488
|
-
await this.#processNodeIfAllInputsAvailable(node);
|
|
4489
5252
|
}
|
|
4490
5253
|
/** If all inputs are present, all conditions met, processes the node. */
|
|
4491
5254
|
async #processNodeIfAllInputsAvailable(node, options2 = {}) {
|
|
4492
5255
|
const { queueOutputNodes = true } = options2;
|
|
4493
5256
|
const builtInNode = node;
|
|
5257
|
+
const inputNodesProfileStart = this.#startRuntimeProfile();
|
|
4494
5258
|
const inputNodes = getInputNodesTo(this.#executionState, node);
|
|
5259
|
+
this.#finishRuntimeProfile("getInputNodesTo", inputNodesProfileStart);
|
|
4495
5260
|
if (this.#shouldSkipNodeProcessing(node, inputNodes)) {
|
|
4496
5261
|
return [];
|
|
4497
5262
|
}
|
|
@@ -4499,7 +5264,9 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4499
5264
|
if (this.#shouldSkipCompletedRaceNode(node, attachedData)) {
|
|
4500
5265
|
return [];
|
|
4501
5266
|
}
|
|
5267
|
+
const inputValuesProfileStart = this.#startRuntimeProfile();
|
|
4502
5268
|
const inputValues = this.#getInputValuesForNode(node);
|
|
5269
|
+
this.#finishRuntimeProfile("getInputValuesForNode", inputValuesProfileStart);
|
|
4503
5270
|
const loopExclusion = this.#excludedDueToControlFlow(
|
|
4504
5271
|
node,
|
|
4505
5272
|
inputValues,
|
|
@@ -4530,7 +5297,13 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4530
5297
|
if (this.#beginNodeProcessing(node, attachedData) === false) {
|
|
4531
5298
|
return [];
|
|
4532
5299
|
}
|
|
4533
|
-
const
|
|
5300
|
+
const processProfileStart = this.#startRuntimeProfile();
|
|
5301
|
+
let processResult;
|
|
5302
|
+
try {
|
|
5303
|
+
processResult = await this.#processNode(node, inputValues);
|
|
5304
|
+
} finally {
|
|
5305
|
+
this.#finishRuntimeProfile("nodeDispatch", processProfileStart);
|
|
5306
|
+
}
|
|
4534
5307
|
const { processId } = processResult;
|
|
4535
5308
|
if (this.slowMode) {
|
|
4536
5309
|
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
@@ -4539,7 +5312,9 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4539
5312
|
this.#visitedNodes.add(node.id);
|
|
4540
5313
|
this.#currentlyProcessing.delete(node.id);
|
|
4541
5314
|
this.#remainingNodes.delete(node.id);
|
|
5315
|
+
const outputNodesProfileStart = this.#startRuntimeProfile();
|
|
4542
5316
|
const outputNodes = getOutputNodesFrom(this.#executionState, node);
|
|
5317
|
+
this.#finishRuntimeProfile("getOutputNodesFrom", outputNodesProfileStart);
|
|
4543
5318
|
this.#handleLoopControllerPostProcess(node, attachedData);
|
|
4544
5319
|
this.#handleCompletedRace(node);
|
|
4545
5320
|
const childLoopInfoError = this.#assignChildLoopInfo(node, builtInNode, attachedData);
|
|
@@ -4549,7 +5324,9 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4549
5324
|
}
|
|
4550
5325
|
this.#propagateAttachedDataToOutputNodes(node, attachedData, outputNodes.connectionsToNodes);
|
|
4551
5326
|
if (queueOutputNodes && processResult.shouldQueueOutputNodes) {
|
|
5327
|
+
const queueOutputsProfileStart = this.#startRuntimeProfile();
|
|
4552
5328
|
this.#queueOutputNodes(node, outputNodes.nodes);
|
|
5329
|
+
this.#finishRuntimeProfile("queueOutputNodes", queueOutputsProfileStart);
|
|
4553
5330
|
}
|
|
4554
5331
|
return processResult.shouldQueueOutputNodes ? outputNodes.nodes : [];
|
|
4555
5332
|
}
|
|
@@ -4711,17 +5488,20 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4711
5488
|
}
|
|
4712
5489
|
return nodeData;
|
|
4713
5490
|
}
|
|
4714
|
-
async #processNode(node) {
|
|
5491
|
+
async #processNode(node, inputValues) {
|
|
4715
5492
|
const processId = (0, import_non_secure4.nanoid)();
|
|
4716
5493
|
if (this.#abortController.signal.aborted) {
|
|
4717
5494
|
await this.#nodeErrored(node, createGraphAbortErrorFromSignal(this.#abortController.signal), processId);
|
|
4718
5495
|
this.#successfulAbortTerminalProcessIds.delete(processId);
|
|
4719
5496
|
return { processId, shouldQueueOutputNodes: false };
|
|
4720
5497
|
}
|
|
4721
|
-
|
|
5498
|
+
const frozenOutputs = this.#resolveFrozenNodeOutputs(node, inputValues, processId);
|
|
5499
|
+
if (frozenOutputs) {
|
|
5500
|
+
await this.#processFrozenNode(node, processId, inputValues, frozenOutputs);
|
|
5501
|
+
} else if (node.isSplitRun) {
|
|
4722
5502
|
await this.#processSplitRunNode(node, processId);
|
|
4723
5503
|
} else {
|
|
4724
|
-
await this.#processNormalNode(node, processId);
|
|
5504
|
+
await this.#processNormalNode(node, processId, inputValues);
|
|
4725
5505
|
}
|
|
4726
5506
|
const successfulAbortTerminal = this.#successfulAbortTerminalProcessIds.delete(processId);
|
|
4727
5507
|
return { processId, shouldQueueOutputNodes: !successfulAbortTerminal };
|
|
@@ -4749,11 +5529,50 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4749
5529
|
finishNodeTiming: this.#captureNodeTimings ? (start) => this.#finishNodeTiming(start) : void 0
|
|
4750
5530
|
});
|
|
4751
5531
|
}
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
5532
|
+
#resolveFrozenNodeOutputs(node, inputValues, processId) {
|
|
5533
|
+
var _a;
|
|
5534
|
+
return (_a = this.#frozenNodeOutputResolver) == null ? void 0 : _a.call(this, {
|
|
5535
|
+
execution: this.#buildExecutionMetadata(),
|
|
5536
|
+
graphId: this.#graph.metadata.id,
|
|
5537
|
+
inputs: inputValues,
|
|
5538
|
+
node,
|
|
5539
|
+
processId
|
|
5540
|
+
});
|
|
5541
|
+
}
|
|
5542
|
+
async #processFrozenNode(node, processId, inputValues, outputValues) {
|
|
5543
|
+
await this.#emitter.emit("nodeStart", this.#withExecution({ node, inputs: inputValues, processId }));
|
|
5544
|
+
const timingStart = this.#startNodeTiming();
|
|
5545
|
+
this.#nodeResults.set(node.id, outputValues);
|
|
5546
|
+
this.#visitedNodes.add(node.id);
|
|
5547
|
+
this.#accumulateCost(outputValues);
|
|
5548
|
+
this.#applyFrozenNodeDataflowEffects(node, outputValues, processId);
|
|
5549
|
+
await this.#emitter.emit(
|
|
5550
|
+
"nodeFinish",
|
|
5551
|
+
this.#withExecution(
|
|
5552
|
+
withOptionalDuration3(
|
|
5553
|
+
{
|
|
5554
|
+
node,
|
|
5555
|
+
outputs: outputValues,
|
|
5556
|
+
processId
|
|
5557
|
+
},
|
|
5558
|
+
this.#finishNodeTiming(timingStart)
|
|
5559
|
+
)
|
|
5560
|
+
)
|
|
5561
|
+
);
|
|
5562
|
+
}
|
|
5563
|
+
#applyFrozenNodeDataflowEffects(node, outputValues, processId) {
|
|
5564
|
+
const setGlobalEffect = applyFrozenGraphBoundaryEffects(this.#graphOutputs, node, outputValues);
|
|
5565
|
+
if (!setGlobalEffect) {
|
|
4755
5566
|
return;
|
|
4756
5567
|
}
|
|
5568
|
+
this.#globals.set(setGlobalEffect.variableId, setGlobalEffect.value);
|
|
5569
|
+
emitDetached(
|
|
5570
|
+
this.#emitter,
|
|
5571
|
+
"globalSet",
|
|
5572
|
+
this.#withExecution({ id: setGlobalEffect.variableId, value: setGlobalEffect.value, processId })
|
|
5573
|
+
);
|
|
5574
|
+
}
|
|
5575
|
+
async #processNormalNode(node, processId, inputValues) {
|
|
4757
5576
|
await this.#emitter.emit("nodeStart", this.#withExecution({ node, inputs: inputValues, processId }));
|
|
4758
5577
|
const timingStart = this.#startNodeTiming();
|
|
4759
5578
|
try {
|
|
@@ -4911,6 +5730,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4911
5730
|
if (this.#abortController.signal.aborted) {
|
|
4912
5731
|
nodeAbortController.abort(getAbortSignalReason(this.#abortController.signal));
|
|
4913
5732
|
}
|
|
5733
|
+
const createContextProfileStart = this.#startRuntimeProfile();
|
|
4914
5734
|
const context = this.#createNodeProcessContext(
|
|
4915
5735
|
node,
|
|
4916
5736
|
inputValues,
|
|
@@ -4919,10 +5739,16 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4919
5739
|
nodeAbortController,
|
|
4920
5740
|
partialOutput
|
|
4921
5741
|
);
|
|
5742
|
+
this.#finishRuntimeProfile("createNodeProcessContext", createContextProfileStart);
|
|
4922
5743
|
let results;
|
|
4923
5744
|
try {
|
|
4924
5745
|
await this.#waitUntilUnpaused();
|
|
4925
|
-
|
|
5746
|
+
const implementationProfileStart = this.#startRuntimeProfile();
|
|
5747
|
+
try {
|
|
5748
|
+
results = await instance.process(inputValues, context);
|
|
5749
|
+
} finally {
|
|
5750
|
+
this.#finishRuntimeProfile("nodeImplementation", implementationProfileStart);
|
|
5751
|
+
}
|
|
4926
5752
|
} finally {
|
|
4927
5753
|
this.#unregisterNodeAbortController(node.id, nodeAbortController);
|
|
4928
5754
|
}
|
|
@@ -4940,14 +5766,17 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4940
5766
|
return this.#context.tokenizer;
|
|
4941
5767
|
}
|
|
4942
5768
|
#createNodeProcessContext(node, inputValues, index, processId, nodeAbortController, partialOutput) {
|
|
5769
|
+
var _a;
|
|
4943
5770
|
const plugin = this.#registry.getPluginFor(node.type);
|
|
4944
5771
|
return buildNodeProcessContext({
|
|
5772
|
+
activeOutputPortIds: this.#getActiveOutputPortIds(node),
|
|
4945
5773
|
attachedData: this.#getAttachedDataTo(node),
|
|
4946
5774
|
base: this.#nodeProcessContextBase,
|
|
4947
5775
|
createSubProcessor: (subGraphId, options2 = {}) => this.#createSubProcessor(node, index, processId, subGraphId, options2),
|
|
4948
5776
|
execution: this.#buildExecutionMetadata(),
|
|
4949
5777
|
externalFunctions: this.#externalFunctions,
|
|
4950
5778
|
getPluginConfig: (name) => getPluginConfig(plugin, this.#context.settings, name),
|
|
5779
|
+
isDirectRunTarget: ((_a = this.runToNodeIds) == null ? void 0 : _a.includes(node.id)) ?? false,
|
|
4951
5780
|
node,
|
|
4952
5781
|
nodeAbortController,
|
|
4953
5782
|
onPartialOutputs: (partialOutputs) => {
|
|
@@ -4973,6 +5802,42 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4973
5802
|
}
|
|
4974
5803
|
});
|
|
4975
5804
|
}
|
|
5805
|
+
#getActiveOutputPortIds(node) {
|
|
5806
|
+
const outputConnections = getOutputNodesFrom(this.#executionState, node).connectionsToNodes;
|
|
5807
|
+
if (outputConnections.length === 0) {
|
|
5808
|
+
return /* @__PURE__ */ new Set();
|
|
5809
|
+
}
|
|
5810
|
+
const runToRelevantNodeIds = this.#getRunToRelevantNodeIds();
|
|
5811
|
+
const activeOutputPortIds = /* @__PURE__ */ new Set();
|
|
5812
|
+
for (const { node: outputNode, connections } of outputConnections) {
|
|
5813
|
+
if (outputNode.disabled) {
|
|
5814
|
+
continue;
|
|
5815
|
+
}
|
|
5816
|
+
if (runToRelevantNodeIds && !runToRelevantNodeIds.has(outputNode.id)) {
|
|
5817
|
+
continue;
|
|
5818
|
+
}
|
|
5819
|
+
for (const connection of connections) {
|
|
5820
|
+
activeOutputPortIds.add(connection.outputId);
|
|
5821
|
+
}
|
|
5822
|
+
}
|
|
5823
|
+
return activeOutputPortIds;
|
|
5824
|
+
}
|
|
5825
|
+
#getRunToRelevantNodeIds() {
|
|
5826
|
+
if (!this.runToNodeIds) {
|
|
5827
|
+
return void 0;
|
|
5828
|
+
}
|
|
5829
|
+
if (this.#runToRelevantNodeIds) {
|
|
5830
|
+
return this.#runToRelevantNodeIds;
|
|
5831
|
+
}
|
|
5832
|
+
const relevantNodeIds = /* @__PURE__ */ new Set();
|
|
5833
|
+
for (const runToNodeId of this.runToNodeIds) {
|
|
5834
|
+
for (const dependencyNodeId of this.getDependencyNodesDeep(runToNodeId)) {
|
|
5835
|
+
relevantNodeIds.add(dependencyNodeId);
|
|
5836
|
+
}
|
|
5837
|
+
}
|
|
5838
|
+
this.#runToRelevantNodeIds = relevantNodeIds;
|
|
5839
|
+
return relevantNodeIds;
|
|
5840
|
+
}
|
|
4976
5841
|
#emitGraphPartialOutputIfNeeded(node, partialOutputs) {
|
|
4977
5842
|
const { useAsGraphPartialOutput } = node.data ?? {};
|
|
4978
5843
|
if (!(useAsGraphPartialOutput && this.#executor && this.#parent)) {
|
|
@@ -4996,15 +5861,22 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4996
5861
|
const subprocessorProject = project ?? this.#project;
|
|
4997
5862
|
const subprocessorGraph = resolveProcessorGraph(subprocessorProject, subGraphId);
|
|
4998
5863
|
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
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5864
|
+
const createProfileStart = this.#startRuntimeProfile();
|
|
5865
|
+
let processor;
|
|
5866
|
+
try {
|
|
5867
|
+
processor = new _GraphProcessor(subprocessorProject, subGraphId, this.#registry, this.#includeTrace, {
|
|
5868
|
+
cacheLoadedProjects: this.#cacheLoadedProjects,
|
|
5869
|
+
captureNodeTimings: this.#captureNodeTimings,
|
|
5870
|
+
concurrency: this.#concurrency,
|
|
5871
|
+
executionPlanCacheMode: this.#executionPlanCacheMode,
|
|
5872
|
+
initialExecutionPlan,
|
|
5873
|
+
runtimeCache: this.#runtimeCache,
|
|
5874
|
+
runtimeProfiler: this.#runtimeProfiler,
|
|
5875
|
+
scheduler: this.#scheduler
|
|
5876
|
+
});
|
|
5877
|
+
} finally {
|
|
5878
|
+
this.#finishRuntimeProfile("createSubProcessor", createProfileStart);
|
|
5879
|
+
}
|
|
5008
5880
|
processor.executor = this.executor;
|
|
5009
5881
|
processor.#isSubProcessor = true;
|
|
5010
5882
|
processor.#executionCache = this.#executionCache;
|
|
@@ -5012,38 +5884,49 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
5012
5884
|
processor.#contextValues = this.#contextValues;
|
|
5013
5885
|
processor.#parent = this;
|
|
5014
5886
|
processor.#globals = this.#globals;
|
|
5887
|
+
processor.#frozenNodeOutputResolver = this.#frozenNodeOutputResolver;
|
|
5015
5888
|
processor.#executor = {
|
|
5016
5889
|
nodeId: node.id,
|
|
5017
5890
|
parentGraphId: this.#graph.metadata.id,
|
|
5018
5891
|
index,
|
|
5019
5892
|
processId
|
|
5020
5893
|
};
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5894
|
+
const wireEventsProfileStart = this.#startRuntimeProfile();
|
|
5895
|
+
try {
|
|
5896
|
+
wireSubprocessorEvents(processor, this.#emitter, {
|
|
5897
|
+
isPaused: () => this.#isPaused,
|
|
5898
|
+
pause: () => {
|
|
5899
|
+
void this.pause();
|
|
5900
|
+
},
|
|
5901
|
+
resume: () => {
|
|
5902
|
+
void this.resume();
|
|
5903
|
+
}
|
|
5904
|
+
});
|
|
5905
|
+
} finally {
|
|
5906
|
+
this.#finishRuntimeProfile("wireSubProcessorEvents", wireEventsProfileStart);
|
|
5907
|
+
}
|
|
5030
5908
|
this.#subprocessors.add(processor);
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
this.
|
|
5036
|
-
|
|
5037
|
-
this.
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
this.
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5909
|
+
const wireLifecycleProfileStart = this.#startRuntimeProfile();
|
|
5910
|
+
try {
|
|
5911
|
+
wireSubprocessorLifecycle(processor, {
|
|
5912
|
+
signal,
|
|
5913
|
+
parentAbortSignal: this.#abortController.signal,
|
|
5914
|
+
onParentPause: (listener) => {
|
|
5915
|
+
this.on("pause", listener);
|
|
5916
|
+
return () => {
|
|
5917
|
+
this.off("pause", listener);
|
|
5918
|
+
};
|
|
5919
|
+
},
|
|
5920
|
+
onParentResume: (listener) => {
|
|
5921
|
+
this.on("resume", listener);
|
|
5922
|
+
return () => {
|
|
5923
|
+
this.off("resume", listener);
|
|
5924
|
+
};
|
|
5925
|
+
}
|
|
5926
|
+
});
|
|
5927
|
+
} finally {
|
|
5928
|
+
this.#finishRuntimeProfile("wireSubProcessorLifecycle", wireLifecycleProfileStart);
|
|
5929
|
+
}
|
|
5047
5930
|
return processor;
|
|
5048
5931
|
}
|
|
5049
5932
|
async #requestUserInput(node, inputStrings, inputValues, renderingType, processId) {
|
|
@@ -5118,36 +6001,364 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
5118
6001
|
reason
|
|
5119
6002
|
});
|
|
5120
6003
|
}
|
|
5121
|
-
#getInputValuesForNode(node) {
|
|
5122
|
-
const connections = this.#connections[node.id];
|
|
5123
|
-
return this.#definitions[node.id].inputs.reduce(
|
|
5124
|
-
(values2, input) => {
|
|
5125
|
-
var _a, _b;
|
|
5126
|
-
const connection = ((_b = (_a = this.#graphExecutionPlan) == null ? void 0 : _a.inputConnectionByNodeAndPort[node.id]) == null ? void 0 : _b[input.id]) ?? (connections == null ? void 0 : connections.find((conn) => conn.inputId === input.id && conn.inputNodeId === node.id));
|
|
5127
|
-
if (connection) {
|
|
5128
|
-
const outputNode = this.#nodeInstances[connection.outputNodeId].chartNode;
|
|
5129
|
-
const outputNodeOutputs = this.#nodeResults.get(outputNode.id);
|
|
5130
|
-
const outputResult = outputNodeOutputs == null ? void 0 : outputNodeOutputs[connection.outputId];
|
|
5131
|
-
values2[input.id] = outputResult;
|
|
5132
|
-
}
|
|
5133
|
-
return values2;
|
|
5134
|
-
},
|
|
5135
|
-
{}
|
|
5136
|
-
);
|
|
6004
|
+
#getInputValuesForNode(node) {
|
|
6005
|
+
const connections = this.#connections[node.id];
|
|
6006
|
+
return this.#definitions[node.id].inputs.reduce(
|
|
6007
|
+
(values2, input) => {
|
|
6008
|
+
var _a, _b;
|
|
6009
|
+
const connection = ((_b = (_a = this.#graphExecutionPlan) == null ? void 0 : _a.inputConnectionByNodeAndPort[node.id]) == null ? void 0 : _b[input.id]) ?? (connections == null ? void 0 : connections.find((conn) => conn.inputId === input.id && conn.inputNodeId === node.id));
|
|
6010
|
+
if (connection) {
|
|
6011
|
+
const outputNode = this.#nodeInstances[connection.outputNodeId].chartNode;
|
|
6012
|
+
const outputNodeOutputs = this.#nodeResults.get(outputNode.id);
|
|
6013
|
+
const outputResult = outputNodeOutputs == null ? void 0 : outputNodeOutputs[connection.outputId];
|
|
6014
|
+
values2[input.id] = outputResult;
|
|
6015
|
+
}
|
|
6016
|
+
return values2;
|
|
6017
|
+
},
|
|
6018
|
+
{}
|
|
6019
|
+
);
|
|
6020
|
+
}
|
|
6021
|
+
get #executionState() {
|
|
6022
|
+
return {
|
|
6023
|
+
connections: this.#connections,
|
|
6024
|
+
definitions: this.#definitions,
|
|
6025
|
+
erroredNodes: this.#erroredNodes,
|
|
6026
|
+
executionPlan: this.#graphExecutionPlan,
|
|
6027
|
+
loopControllersSeen: this.#loopControllersSeen,
|
|
6028
|
+
nodesById: this.#nodesById,
|
|
6029
|
+
stronglyConnectedComponents: this.#scc,
|
|
6030
|
+
visitedNodes: this.#visitedNodes
|
|
6031
|
+
};
|
|
6032
|
+
}
|
|
6033
|
+
};
|
|
6034
|
+
|
|
6035
|
+
// src/model/UiGraph.ts
|
|
6036
|
+
function createDefaultUiGraph(options2 = {}) {
|
|
6037
|
+
const promptStateKey = "input";
|
|
6038
|
+
const resultStateKey = "result";
|
|
6039
|
+
return {
|
|
6040
|
+
id: newId(),
|
|
6041
|
+
name: options2.name ?? "Untitled web app",
|
|
6042
|
+
components: [
|
|
6043
|
+
{
|
|
6044
|
+
id: newId(),
|
|
6045
|
+
type: "markdown",
|
|
6046
|
+
markdown: "## New Rivet web app\n\nEnter a value and run a graph."
|
|
6047
|
+
},
|
|
6048
|
+
{
|
|
6049
|
+
id: newId(),
|
|
6050
|
+
type: "textarea",
|
|
6051
|
+
label: "Input",
|
|
6052
|
+
stateKey: promptStateKey,
|
|
6053
|
+
placeholder: "Type something..."
|
|
6054
|
+
},
|
|
6055
|
+
{
|
|
6056
|
+
id: newId(),
|
|
6057
|
+
type: "button",
|
|
6058
|
+
label: "Run graph",
|
|
6059
|
+
action: {
|
|
6060
|
+
type: "runGraph",
|
|
6061
|
+
graphId: options2.graphId,
|
|
6062
|
+
inputMappings: [{ inputKey: "input", stateKey: promptStateKey }],
|
|
6063
|
+
outputs: [{ stateKey: resultStateKey }]
|
|
6064
|
+
}
|
|
6065
|
+
},
|
|
6066
|
+
{
|
|
6067
|
+
id: newId(),
|
|
6068
|
+
type: "output",
|
|
6069
|
+
label: "Result",
|
|
6070
|
+
stateKey: resultStateKey,
|
|
6071
|
+
renderAs: "json"
|
|
6072
|
+
}
|
|
6073
|
+
]
|
|
6074
|
+
};
|
|
6075
|
+
}
|
|
6076
|
+
function getUiGraphInitialState(uiGraph) {
|
|
6077
|
+
const state = {};
|
|
6078
|
+
for (const component of uiGraph.components) {
|
|
6079
|
+
if (component.type === "input" || component.type === "textarea") {
|
|
6080
|
+
state[component.stateKey] = component.defaultValue ?? "";
|
|
6081
|
+
}
|
|
6082
|
+
}
|
|
6083
|
+
return state;
|
|
6084
|
+
}
|
|
6085
|
+
function getUiGraphActionComponent(uiGraph, componentId) {
|
|
6086
|
+
return uiGraph.components.find(
|
|
6087
|
+
(component) => component.id === componentId && component.type === "button"
|
|
6088
|
+
);
|
|
6089
|
+
}
|
|
6090
|
+
function resolveUiGraphActionInputs(action, state) {
|
|
6091
|
+
const inputs = {};
|
|
6092
|
+
if (action.inputMappings) {
|
|
6093
|
+
for (const binding of action.inputMappings) {
|
|
6094
|
+
if (binding.inputKey) {
|
|
6095
|
+
inputs[binding.inputKey] = state[binding.stateKey];
|
|
6096
|
+
}
|
|
6097
|
+
}
|
|
6098
|
+
return inputs;
|
|
6099
|
+
}
|
|
6100
|
+
for (const [inputId, binding] of Object.entries(action.inputs ?? {})) {
|
|
6101
|
+
inputs[inputId] = binding.type === "state" ? state[binding.key] : binding.value;
|
|
6102
|
+
}
|
|
6103
|
+
return inputs;
|
|
6104
|
+
}
|
|
6105
|
+
function resolveUiGraphActionOutputStateValue(action, outputs) {
|
|
6106
|
+
var _a;
|
|
6107
|
+
if (!action.outputKey) {
|
|
6108
|
+
return outputs;
|
|
6109
|
+
}
|
|
6110
|
+
if (!Object.prototype.hasOwnProperty.call(outputs, action.outputKey)) {
|
|
6111
|
+
throw new Error(`Graph output "${action.outputKey}" was not returned by the target graph.`);
|
|
6112
|
+
}
|
|
6113
|
+
return (_a = outputs[action.outputKey]) == null ? void 0 : _a.value;
|
|
6114
|
+
}
|
|
6115
|
+
function resolveUiGraphActionOutputStatePatch(action, outputs) {
|
|
6116
|
+
const bindings = getUiGraphActionOutputBindings(action);
|
|
6117
|
+
const statePatch = {};
|
|
6118
|
+
for (const binding of bindings) {
|
|
6119
|
+
const stateKey = binding.stateKey.trim();
|
|
6120
|
+
if (!stateKey) {
|
|
6121
|
+
continue;
|
|
6122
|
+
}
|
|
6123
|
+
statePatch[stateKey] = resolveUiGraphOutputBindingValue(binding, outputs);
|
|
6124
|
+
}
|
|
6125
|
+
return statePatch;
|
|
6126
|
+
}
|
|
6127
|
+
function getUiGraphActionOutputBindings(action) {
|
|
6128
|
+
if (action.outputs) {
|
|
6129
|
+
return action.outputs;
|
|
5137
6130
|
}
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
executionPlan: this.#graphExecutionPlan,
|
|
5144
|
-
loopControllersSeen: this.#loopControllersSeen,
|
|
5145
|
-
nodesById: this.#nodesById,
|
|
5146
|
-
stronglyConnectedComponents: this.#scc,
|
|
5147
|
-
visitedNodes: this.#visitedNodes
|
|
5148
|
-
};
|
|
6131
|
+
return action.outputStateKey ? [{ outputKey: action.outputKey, stateKey: action.outputStateKey }] : [];
|
|
6132
|
+
}
|
|
6133
|
+
function getUiGraphActionInputBindings(action) {
|
|
6134
|
+
if (action.inputMappings) {
|
|
6135
|
+
return action.inputMappings;
|
|
5149
6136
|
}
|
|
5150
|
-
}
|
|
6137
|
+
return Object.entries(action.inputs ?? {}).map(([inputKey, binding]) => ({
|
|
6138
|
+
inputKey,
|
|
6139
|
+
stateKey: binding.type === "state" ? binding.key : ""
|
|
6140
|
+
}));
|
|
6141
|
+
}
|
|
6142
|
+
function resolveUiGraphOutputBindingValue(binding, outputs) {
|
|
6143
|
+
var _a;
|
|
6144
|
+
if (!binding.outputKey) {
|
|
6145
|
+
return outputs;
|
|
6146
|
+
}
|
|
6147
|
+
if (!Object.prototype.hasOwnProperty.call(outputs, binding.outputKey)) {
|
|
6148
|
+
throw new Error(`Graph output "${binding.outputKey}" was not returned by the target graph.`);
|
|
6149
|
+
}
|
|
6150
|
+
return (_a = outputs[binding.outputKey]) == null ? void 0 : _a.value;
|
|
6151
|
+
}
|
|
6152
|
+
|
|
6153
|
+
// src/model/UiGraphRendererStyles.ts
|
|
6154
|
+
var RIVET_WEB_APP_RENDERER_CSS = `
|
|
6155
|
+
.rivet-web-app-root {
|
|
6156
|
+
--rivet-web-app-background: var(--grey-dark-colorish, #1c222b);
|
|
6157
|
+
--rivet-web-app-foreground: var(--foreground, #ffffff);
|
|
6158
|
+
--rivet-web-app-card-background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 88%, var(--foreground, #ffffff) 4%);
|
|
6159
|
+
--rivet-web-app-card-border: var(--foldable-section-border, rgba(255, 255, 255, 0.04));
|
|
6160
|
+
--rivet-web-app-control-background: var(--form-control-bg, #20252d);
|
|
6161
|
+
--rivet-web-app-control-border: var(--form-control-border, rgba(255, 255, 255, 0.14));
|
|
6162
|
+
--rivet-web-app-button-radius: var(--rivet-web-app-host-button-radius, 6px);
|
|
6163
|
+
--rivet-web-app-button-background: var(--success, #3ba85b);
|
|
6164
|
+
--rivet-web-app-button-foreground: var(--grey-lightest, #ffffff);
|
|
6165
|
+
--rivet-web-app-output-title: var(--rivet-web-app-foreground, #ffffff);
|
|
6166
|
+
--rivet-web-app-error-color: var(--error, #ff6b5f);
|
|
6167
|
+
--rivet-web-app-font-size: var(--rivet-web-app-host-font-size, 15px);
|
|
6168
|
+
box-sizing: border-box;
|
|
6169
|
+
height: 100%;
|
|
6170
|
+
background: var(--rivet-web-app-background);
|
|
6171
|
+
color: var(--rivet-web-app-foreground);
|
|
6172
|
+
overflow: auto;
|
|
6173
|
+
font-family: Inter, system-ui, sans-serif;
|
|
6174
|
+
font-size: var(--rivet-web-app-font-size);
|
|
6175
|
+
line-height: 1.4;
|
|
6176
|
+
}
|
|
6177
|
+
|
|
6178
|
+
.rivet-web-app-root *,
|
|
6179
|
+
.rivet-web-app-root *::before,
|
|
6180
|
+
.rivet-web-app-root *::after {
|
|
6181
|
+
box-sizing: border-box;
|
|
6182
|
+
}
|
|
6183
|
+
|
|
6184
|
+
.rivet-web-app-surface {
|
|
6185
|
+
display: grid;
|
|
6186
|
+
gap: 16px;
|
|
6187
|
+
margin: 0 auto;
|
|
6188
|
+
max-width: 760px;
|
|
6189
|
+
padding: 48px 20px;
|
|
6190
|
+
}
|
|
6191
|
+
|
|
6192
|
+
.rivet-web-app-card,
|
|
6193
|
+
.rivet-web-app-field {
|
|
6194
|
+
border: 1px solid var(--rivet-web-app-card-border);
|
|
6195
|
+
border-radius: 10px;
|
|
6196
|
+
background: var(--rivet-web-app-card-background);
|
|
6197
|
+
padding: 16px;
|
|
6198
|
+
}
|
|
6199
|
+
|
|
6200
|
+
.rivet-web-app-component-frame {
|
|
6201
|
+
border-radius: 12px;
|
|
6202
|
+
margin: -5px;
|
|
6203
|
+
padding: 4px;
|
|
6204
|
+
}
|
|
6205
|
+
|
|
6206
|
+
.rivet-web-app-component-frame.active {
|
|
6207
|
+
background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 75%, var(--primary, #ff9e2c) 16%);
|
|
6208
|
+
}
|
|
6209
|
+
|
|
6210
|
+
.rivet-web-app-field {
|
|
6211
|
+
display: grid;
|
|
6212
|
+
gap: 8px;
|
|
6213
|
+
color: var(--rivet-web-app-foreground);
|
|
6214
|
+
font-size: inherit;
|
|
6215
|
+
font-weight: 600;
|
|
6216
|
+
}
|
|
6217
|
+
|
|
6218
|
+
.rivet-web-app-field input,
|
|
6219
|
+
.rivet-web-app-field textarea {
|
|
6220
|
+
appearance: none;
|
|
6221
|
+
width: 100%;
|
|
6222
|
+
box-sizing: border-box;
|
|
6223
|
+
border: 1px solid var(--rivet-web-app-control-border);
|
|
6224
|
+
border-radius: 8px;
|
|
6225
|
+
background: var(--rivet-web-app-control-background);
|
|
6226
|
+
color: var(--rivet-web-app-foreground);
|
|
6227
|
+
font: inherit;
|
|
6228
|
+
font-weight: 400;
|
|
6229
|
+
padding: 10px 12px;
|
|
6230
|
+
}
|
|
6231
|
+
|
|
6232
|
+
.rivet-web-app-field textarea {
|
|
6233
|
+
min-height: 110px;
|
|
6234
|
+
resize: vertical;
|
|
6235
|
+
}
|
|
6236
|
+
|
|
6237
|
+
.rivet-web-app-button {
|
|
6238
|
+
width: fit-content;
|
|
6239
|
+
border: 0;
|
|
6240
|
+
border-radius: var(--rivet-web-app-button-radius);
|
|
6241
|
+
background: var(--rivet-web-app-button-background);
|
|
6242
|
+
color: var(--rivet-web-app-button-foreground);
|
|
6243
|
+
cursor: pointer;
|
|
6244
|
+
font: inherit;
|
|
6245
|
+
font-weight: 700;
|
|
6246
|
+
padding: 10px 16px;
|
|
6247
|
+
}
|
|
6248
|
+
|
|
6249
|
+
.rivet-web-app-button:disabled {
|
|
6250
|
+
cursor: wait;
|
|
6251
|
+
opacity: 0.72;
|
|
6252
|
+
}
|
|
6253
|
+
|
|
6254
|
+
.rivet-web-app-output {
|
|
6255
|
+
display: grid;
|
|
6256
|
+
gap: 8px;
|
|
6257
|
+
}
|
|
6258
|
+
|
|
6259
|
+
.rivet-web-app-output-title {
|
|
6260
|
+
color: var(--rivet-web-app-output-title);
|
|
6261
|
+
font-weight: 700;
|
|
6262
|
+
}
|
|
6263
|
+
|
|
6264
|
+
.rivet-web-app-output pre {
|
|
6265
|
+
margin: 0;
|
|
6266
|
+
background: transparent;
|
|
6267
|
+
border-radius: 0;
|
|
6268
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
6269
|
+
font-size: inherit;
|
|
6270
|
+
padding: 0;
|
|
6271
|
+
white-space: pre-wrap;
|
|
6272
|
+
word-break: break-word;
|
|
6273
|
+
}
|
|
6274
|
+
|
|
6275
|
+
.rivet-web-app-markdown,
|
|
6276
|
+
.rivet-web-app-output-markdown {
|
|
6277
|
+
word-break: break-word;
|
|
6278
|
+
}
|
|
6279
|
+
|
|
6280
|
+
.rivet-web-app-markdown.markdown-body {
|
|
6281
|
+
background: var(--rivet-web-app-card-background);
|
|
6282
|
+
font-family: inherit;
|
|
6283
|
+
min-width: 0;
|
|
6284
|
+
}
|
|
6285
|
+
|
|
6286
|
+
.rivet-web-app-output-markdown.markdown-body {
|
|
6287
|
+
background: transparent;
|
|
6288
|
+
font-family: inherit;
|
|
6289
|
+
min-width: 0;
|
|
6290
|
+
}
|
|
6291
|
+
|
|
6292
|
+
.rivet-web-app-markdown h1,
|
|
6293
|
+
.rivet-web-app-output-markdown h1 {
|
|
6294
|
+
margin: 0 0 12px;
|
|
6295
|
+
padding-bottom: 8px;
|
|
6296
|
+
border-bottom: 1px solid var(--rivet-web-app-card-border);
|
|
6297
|
+
font-size: 24px;
|
|
6298
|
+
line-height: 1.22;
|
|
6299
|
+
}
|
|
6300
|
+
|
|
6301
|
+
.rivet-web-app-markdown h2,
|
|
6302
|
+
.rivet-web-app-output-markdown h2 {
|
|
6303
|
+
margin: 0 0 10px;
|
|
6304
|
+
font-size: 20px;
|
|
6305
|
+
line-height: 1.25;
|
|
6306
|
+
}
|
|
6307
|
+
|
|
6308
|
+
.rivet-web-app-markdown p,
|
|
6309
|
+
.rivet-web-app-output-markdown p,
|
|
6310
|
+
.rivet-web-app-markdown ul,
|
|
6311
|
+
.rivet-web-app-output-markdown ul {
|
|
6312
|
+
margin: 0 0 12px;
|
|
6313
|
+
}
|
|
6314
|
+
|
|
6315
|
+
.rivet-web-app-markdown.markdown-body code,
|
|
6316
|
+
.rivet-web-app-output-markdown.markdown-body code {
|
|
6317
|
+
border-radius: 4px;
|
|
6318
|
+
background: color-mix(in srgb, var(--rivet-web-app-control-background) 70%, var(--rivet-web-app-foreground) 6%);
|
|
6319
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
6320
|
+
padding: 1px 4px;
|
|
6321
|
+
}
|
|
6322
|
+
|
|
6323
|
+
.rivet-web-app-markdown.markdown-body pre,
|
|
6324
|
+
.rivet-web-app-output-markdown.markdown-body pre {
|
|
6325
|
+
background: transparent;
|
|
6326
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
6327
|
+
padding: 0;
|
|
6328
|
+
white-space: pre-wrap;
|
|
6329
|
+
}
|
|
6330
|
+
|
|
6331
|
+
.rivet-web-app-markdown > :first-child,
|
|
6332
|
+
.rivet-web-app-output-markdown > :first-child {
|
|
6333
|
+
margin-top: 0;
|
|
6334
|
+
}
|
|
6335
|
+
|
|
6336
|
+
.rivet-web-app-markdown > :last-child,
|
|
6337
|
+
.rivet-web-app-output-markdown > :last-child {
|
|
6338
|
+
margin-bottom: 0;
|
|
6339
|
+
}
|
|
6340
|
+
|
|
6341
|
+
.rivet-web-app-error {
|
|
6342
|
+
color: var(--rivet-web-app-error-color);
|
|
6343
|
+
font-weight: 700;
|
|
6344
|
+
}
|
|
6345
|
+
`;
|
|
6346
|
+
var RIVET_WEB_APP_DOCUMENT_CSS = `
|
|
6347
|
+
html,
|
|
6348
|
+
body {
|
|
6349
|
+
height: 100%;
|
|
6350
|
+
margin: 0;
|
|
6351
|
+
}
|
|
6352
|
+
|
|
6353
|
+
body {
|
|
6354
|
+
min-height: 100vh;
|
|
6355
|
+
background: #1c222b;
|
|
6356
|
+
}
|
|
6357
|
+
|
|
6358
|
+
#app {
|
|
6359
|
+
min-height: 100vh;
|
|
6360
|
+
}
|
|
6361
|
+
`;
|
|
5151
6362
|
|
|
5152
6363
|
// src/model/NodeImpl.ts
|
|
5153
6364
|
var NodeImpl = class {
|
|
@@ -6829,7 +8040,6 @@ async function applyOpenAIStreamingResponse(params) {
|
|
|
6829
8040
|
};
|
|
6830
8041
|
}
|
|
6831
8042
|
output["cost"] = { type: "number", value: totalCost };
|
|
6832
|
-
output["__hidden_token_count"] = { type: "number", value: inputTokenCount + outputTokenCount };
|
|
6833
8043
|
}
|
|
6834
8044
|
function handleOpenAIRetryableFailure(params) {
|
|
6835
8045
|
var _a, _b;
|
|
@@ -7994,7 +9204,7 @@ function getCommonChatV2Outputs(data, options2 = {}) {
|
|
|
7994
9204
|
if (includeFunctionCalls) {
|
|
7995
9205
|
outputs.push({
|
|
7996
9206
|
id: functionCallsPortId,
|
|
7997
|
-
title: "
|
|
9207
|
+
title: "Tool Calls",
|
|
7998
9208
|
dataType: "object[]"
|
|
7999
9209
|
});
|
|
8000
9210
|
}
|
|
@@ -8879,7 +10089,9 @@ function createChatV2Model(provider, modelId, context, options2 = {}) {
|
|
|
8879
10089
|
headers: options2.headers,
|
|
8880
10090
|
includeUsage: true
|
|
8881
10091
|
});
|
|
8882
|
-
|
|
10092
|
+
const model = providerInstance.chatModel(modelId);
|
|
10093
|
+
model.supportsStructuredOutputs = true;
|
|
10094
|
+
return model;
|
|
8883
10095
|
}
|
|
8884
10096
|
}
|
|
8885
10097
|
}
|
|
@@ -9572,9 +10784,9 @@ function createsLLMChatV2ToolResponseFormatConflictForEdit(previousData, nextDat
|
|
|
9572
10784
|
}
|
|
9573
10785
|
|
|
9574
10786
|
// src/model/chat-v2/chatV2EditorCache.ts
|
|
9575
|
-
var
|
|
10787
|
+
var import_safe_stable_stringify4 = __toESM(require("safe-stable-stringify"), 1);
|
|
9576
10788
|
function buildLLMChatV2EditorCacheKey(parts) {
|
|
9577
|
-
return (0,
|
|
10789
|
+
return (0, import_safe_stable_stringify4.default)(parts) ?? "";
|
|
9578
10790
|
}
|
|
9579
10791
|
function cloneEditorCacheValue(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
9580
10792
|
if (value == null || typeof value !== "object") {
|
|
@@ -9650,7 +10862,7 @@ function fingerprintProviderOptionsForCache(providerOptions) {
|
|
|
9650
10862
|
if (providerOptions == null) {
|
|
9651
10863
|
return void 0;
|
|
9652
10864
|
}
|
|
9653
|
-
return fingerprintSecret((0,
|
|
10865
|
+
return fingerprintSecret((0, import_safe_stable_stringify4.default)(providerOptions) ?? "");
|
|
9654
10866
|
}
|
|
9655
10867
|
function resolveLLMChatV2EditorCache(params) {
|
|
9656
10868
|
const { editorCache } = params;
|
|
@@ -10083,6 +11295,9 @@ function defaultStreamExecutor(args) {
|
|
|
10083
11295
|
usage: "usage" in result ? keepPromiseHandled(Promise.resolve(result.usage)) : void 0
|
|
10084
11296
|
};
|
|
10085
11297
|
}
|
|
11298
|
+
async function defaultGenerateExecutor(args) {
|
|
11299
|
+
return await (0, import_ai2.generateText)(args);
|
|
11300
|
+
}
|
|
10086
11301
|
async function resolveOptionalValue(value) {
|
|
10087
11302
|
return value == null ? void 0 : await value;
|
|
10088
11303
|
}
|
|
@@ -10096,6 +11311,51 @@ async function resolveOptionalStructuredOutput(value) {
|
|
|
10096
11311
|
return void 0;
|
|
10097
11312
|
}
|
|
10098
11313
|
}
|
|
11314
|
+
async function resolveGenerateStructuredOutput(result, responseOutput, finishReason) {
|
|
11315
|
+
if (responseOutput == null || finishReason != null && finishReason !== "stop") {
|
|
11316
|
+
return void 0;
|
|
11317
|
+
}
|
|
11318
|
+
try {
|
|
11319
|
+
return await resolveOptionalStructuredOutput(result.output);
|
|
11320
|
+
} catch {
|
|
11321
|
+
return void 0;
|
|
11322
|
+
}
|
|
11323
|
+
}
|
|
11324
|
+
function recoverGenerateStructuredOutputError(error, options2, toolCalls) {
|
|
11325
|
+
if (options2.responseOutput == null || !isChatV2StructuredResponseFormat(options2.responseFormat)) {
|
|
11326
|
+
return void 0;
|
|
11327
|
+
}
|
|
11328
|
+
if (!import_ai2.NoObjectGeneratedError.isInstance(error)) {
|
|
11329
|
+
return void 0;
|
|
11330
|
+
}
|
|
11331
|
+
if (typeof error.text !== "string") {
|
|
11332
|
+
return void 0;
|
|
11333
|
+
}
|
|
11334
|
+
const rawText = error.text;
|
|
11335
|
+
const responseText = collapseRepeatedStructuredJsonText(rawText);
|
|
11336
|
+
return {
|
|
11337
|
+
responseText,
|
|
11338
|
+
structuredOutput: void 0,
|
|
11339
|
+
functionCalls: toStreamedFunctionCalls(toolCalls),
|
|
11340
|
+
usage: error.usage,
|
|
11341
|
+
reasoning: "",
|
|
11342
|
+
finishReason: error.finishReason == null ? void 0 : String(error.finishReason),
|
|
11343
|
+
providerMetadata: void 0,
|
|
11344
|
+
requestStatus: void 0
|
|
11345
|
+
};
|
|
11346
|
+
}
|
|
11347
|
+
function attachGenerateStepToolCallCollector(args) {
|
|
11348
|
+
const toolCalls = [];
|
|
11349
|
+
const previousOnStepFinish = args.onStepFinish;
|
|
11350
|
+
args.onStepFinish = async (event) => {
|
|
11351
|
+
const stepToolCalls = event.toolCalls;
|
|
11352
|
+
if (stepToolCalls != null) {
|
|
11353
|
+
toolCalls.push(...stepToolCalls);
|
|
11354
|
+
}
|
|
11355
|
+
await (previousOnStepFinish == null ? void 0 : previousOnStepFinish(event));
|
|
11356
|
+
};
|
|
11357
|
+
return toolCalls;
|
|
11358
|
+
}
|
|
10099
11359
|
function collapseRepeatedStructuredJsonText(responseText) {
|
|
10100
11360
|
if (responseText.length === 0 || responseText.length % 2 !== 0) {
|
|
10101
11361
|
return responseText;
|
|
@@ -10116,10 +11376,11 @@ function collapseRepeatedStructuredJsonText(responseText) {
|
|
|
10116
11376
|
return responseText;
|
|
10117
11377
|
}
|
|
10118
11378
|
}
|
|
10119
|
-
|
|
11379
|
+
function buildTextArgs(options2) {
|
|
10120
11380
|
const args = {
|
|
10121
11381
|
model: options2.model,
|
|
10122
|
-
messages: options2.messages
|
|
11382
|
+
messages: options2.messages,
|
|
11383
|
+
maxRetries: 0
|
|
10123
11384
|
};
|
|
10124
11385
|
if (options2.tools !== void 0)
|
|
10125
11386
|
args.tools = options2.tools;
|
|
@@ -10147,6 +11408,27 @@ async function executeStream(options2, executor) {
|
|
|
10147
11408
|
args.toolChoice = options2.toolChoice;
|
|
10148
11409
|
if (options2.abortSignal !== void 0)
|
|
10149
11410
|
args.abortSignal = options2.abortSignal;
|
|
11411
|
+
return args;
|
|
11412
|
+
}
|
|
11413
|
+
function toStreamedFunctionCalls(toolCalls) {
|
|
11414
|
+
return (toolCalls ?? []).map((toolCall) => ({
|
|
11415
|
+
type: "function",
|
|
11416
|
+
id: toolCall.toolCallId,
|
|
11417
|
+
name: toolCall.toolName,
|
|
11418
|
+
arguments: JSON.stringify(toolCall.input),
|
|
11419
|
+
lastParsedArguments: toolCall.input
|
|
11420
|
+
}));
|
|
11421
|
+
}
|
|
11422
|
+
async function resolveGenerateReasoning(result) {
|
|
11423
|
+
var _a;
|
|
11424
|
+
const reasoningText = await resolveOptionalValue(result.reasoningText);
|
|
11425
|
+
if (reasoningText != null && reasoningText.trim().length > 0) {
|
|
11426
|
+
return reasoningText;
|
|
11427
|
+
}
|
|
11428
|
+
return ((_a = await resolveOptionalValue(result.reasoning)) == null ? void 0 : _a.map((part) => part.text).join("")) ?? "";
|
|
11429
|
+
}
|
|
11430
|
+
async function executeStream(options2, executor) {
|
|
11431
|
+
const args = buildTextArgs(options2);
|
|
10150
11432
|
const handle = await executor(args);
|
|
10151
11433
|
markOptionalPromiseHandled(handle.finishReason);
|
|
10152
11434
|
markOptionalPromiseHandled(handle.output);
|
|
@@ -10182,6 +11464,35 @@ async function executeStream(options2, executor) {
|
|
|
10182
11464
|
async function streamChatV2(options2) {
|
|
10183
11465
|
return executeStream(options2, options2.executeStream ?? defaultStreamExecutor);
|
|
10184
11466
|
}
|
|
11467
|
+
async function generateChatV2(options2) {
|
|
11468
|
+
const args = buildTextArgs(options2);
|
|
11469
|
+
const stepToolCalls = attachGenerateStepToolCallCollector(args);
|
|
11470
|
+
let result;
|
|
11471
|
+
try {
|
|
11472
|
+
result = await (options2.executeGenerate ?? defaultGenerateExecutor)(args);
|
|
11473
|
+
} catch (error) {
|
|
11474
|
+
const recovered = recoverGenerateStructuredOutputError(error, options2, stepToolCalls);
|
|
11475
|
+
if (recovered != null) {
|
|
11476
|
+
return recovered;
|
|
11477
|
+
}
|
|
11478
|
+
throw error;
|
|
11479
|
+
}
|
|
11480
|
+
const isStructuredOutput = isChatV2StructuredResponseFormat(options2.responseFormat);
|
|
11481
|
+
const responseText = isStructuredOutput ? collapseRepeatedStructuredJsonText(result.text) : result.text;
|
|
11482
|
+
const finishReason = await resolveOptionalValue(result.finishReason);
|
|
11483
|
+
return {
|
|
11484
|
+
responseText,
|
|
11485
|
+
structuredOutput: await resolveGenerateStructuredOutput(result, options2.responseOutput, finishReason),
|
|
11486
|
+
functionCalls: toStreamedFunctionCalls(
|
|
11487
|
+
result.toolCalls != null && result.toolCalls.length > 0 ? result.toolCalls : stepToolCalls
|
|
11488
|
+
),
|
|
11489
|
+
usage: await resolveOptionalValue(result.totalUsage) ?? await resolveOptionalValue(result.usage),
|
|
11490
|
+
reasoning: await resolveGenerateReasoning(result),
|
|
11491
|
+
finishReason,
|
|
11492
|
+
providerMetadata: await resolveOptionalValue(result.providerMetadata),
|
|
11493
|
+
requestStatus: await resolveOptionalValue(result.requestStatus)
|
|
11494
|
+
};
|
|
11495
|
+
}
|
|
10185
11496
|
|
|
10186
11497
|
// src/model/chat-v2/messageConverter.ts
|
|
10187
11498
|
function mergeProviderMetadata(base, extra) {
|
|
@@ -10399,7 +11710,7 @@ function compact(value, maxLength = 500) {
|
|
|
10399
11710
|
const normalized = value.replace(/\s+/g, " ").trim();
|
|
10400
11711
|
return normalized.length > maxLength ? `${normalized.slice(0, maxLength - 3)}...` : normalized;
|
|
10401
11712
|
}
|
|
10402
|
-
function
|
|
11713
|
+
function isRecord2(value) {
|
|
10403
11714
|
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
10404
11715
|
}
|
|
10405
11716
|
function stringifyProviderValue(value) {
|
|
@@ -10419,7 +11730,7 @@ function stringifyProviderValue(value) {
|
|
|
10419
11730
|
}
|
|
10420
11731
|
}
|
|
10421
11732
|
function findProviderMessage(value) {
|
|
10422
|
-
if (!
|
|
11733
|
+
if (!isRecord2(value)) {
|
|
10423
11734
|
return stringifyProviderValue(value);
|
|
10424
11735
|
}
|
|
10425
11736
|
const direct = value.message ?? value.error_description ?? value.detail;
|
|
@@ -10507,7 +11818,7 @@ function getRecordStatusCode(record) {
|
|
|
10507
11818
|
return coerceHttpStatusCode(record.statusCode) ?? coerceHttpStatusCode(record.status);
|
|
10508
11819
|
}
|
|
10509
11820
|
function getChatV2ProviderErrorStatusCode(error, seen = /* @__PURE__ */ new Set()) {
|
|
10510
|
-
if (!
|
|
11821
|
+
if (!isRecord2(error)) {
|
|
10511
11822
|
return void 0;
|
|
10512
11823
|
}
|
|
10513
11824
|
if (seen.has(error)) {
|
|
@@ -10519,20 +11830,20 @@ function getChatV2ProviderErrorStatusCode(error, seen = /* @__PURE__ */ new Set(
|
|
|
10519
11830
|
return directStatusCode;
|
|
10520
11831
|
}
|
|
10521
11832
|
const response = error.response;
|
|
10522
|
-
if (
|
|
11833
|
+
if (isRecord2(response)) {
|
|
10523
11834
|
const responseStatusCode = getRecordStatusCode(response);
|
|
10524
11835
|
if (responseStatusCode != null) {
|
|
10525
11836
|
return responseStatusCode;
|
|
10526
11837
|
}
|
|
10527
11838
|
}
|
|
10528
11839
|
const data = error.data;
|
|
10529
|
-
if (
|
|
11840
|
+
if (isRecord2(data)) {
|
|
10530
11841
|
const dataStatusCode = getRecordStatusCode(data);
|
|
10531
11842
|
if (dataStatusCode != null) {
|
|
10532
11843
|
return dataStatusCode;
|
|
10533
11844
|
}
|
|
10534
11845
|
const dataError = data.error;
|
|
10535
|
-
if (
|
|
11846
|
+
if (isRecord2(dataError)) {
|
|
10536
11847
|
const dataErrorStatusCode = getRecordStatusCode(dataError);
|
|
10537
11848
|
if (dataErrorStatusCode != null) {
|
|
10538
11849
|
return dataErrorStatusCode;
|
|
@@ -10819,17 +12130,17 @@ function createChatV2ProviderFailureOutputs({
|
|
|
10819
12130
|
}
|
|
10820
12131
|
|
|
10821
12132
|
// src/model/chat-v2/chatV2Pipeline.ts
|
|
10822
|
-
var
|
|
12133
|
+
var ChatV2RetryFailure = class extends Error {
|
|
10823
12134
|
constructor(error, requestStatuses, requestErrors) {
|
|
10824
12135
|
super("Chat v2 retry attempts failed");
|
|
10825
12136
|
this.error = error;
|
|
10826
12137
|
this.requestStatuses = requestStatuses;
|
|
10827
12138
|
this.requestErrors = requestErrors;
|
|
10828
|
-
this.name = "
|
|
12139
|
+
this.name = "ChatV2RetryFailure";
|
|
10829
12140
|
}
|
|
10830
12141
|
};
|
|
10831
|
-
function
|
|
10832
|
-
return error instanceof
|
|
12142
|
+
function isChatV2RetryFailure(error) {
|
|
12143
|
+
return error instanceof ChatV2RetryFailure;
|
|
10833
12144
|
}
|
|
10834
12145
|
function getProviderFailureMessage(error) {
|
|
10835
12146
|
if (error instanceof Error) {
|
|
@@ -10854,14 +12165,14 @@ function normalizeProviderFailureMessage(error, options2) {
|
|
|
10854
12165
|
function normalizeProviderFailureMessages(errors, options2) {
|
|
10855
12166
|
return errors.map((error) => normalizeProviderFailureMessage(error, options2));
|
|
10856
12167
|
}
|
|
10857
|
-
async function
|
|
12168
|
+
async function runChatV2WithRetry(chatOptions, retryOptions, transportMode) {
|
|
10858
12169
|
const repeatTimes = retryOptions.retryOnNon200 ? normalizeLLMChatV2RetryCount(retryOptions.retryOnNon200RepeatTimes) : 0;
|
|
10859
12170
|
const cooldownMs = normalizeLLMChatV2RetryCooldownMs(retryOptions.retryOnNon200CooldownMs);
|
|
10860
12171
|
const requestStatuses = [];
|
|
10861
12172
|
const requestErrors = [];
|
|
10862
12173
|
for (let attempt = 0; ; attempt++) {
|
|
10863
12174
|
try {
|
|
10864
|
-
const result = await streamChatV2(
|
|
12175
|
+
const result = transportMode === "generate" ? await generateChatV2(chatOptions) : await streamChatV2(chatOptions);
|
|
10865
12176
|
const statusCode = result.requestStatus ?? 200;
|
|
10866
12177
|
if (retryOptions.retryOnNon200) {
|
|
10867
12178
|
requestStatuses.push(statusCode);
|
|
@@ -10883,7 +12194,7 @@ async function streamChatV2WithRetry(streamOptions, retryOptions) {
|
|
|
10883
12194
|
requestStatuses.push(statusCode);
|
|
10884
12195
|
requestErrors.push(error);
|
|
10885
12196
|
if (attempt >= repeatTimes) {
|
|
10886
|
-
throw new
|
|
12197
|
+
throw new ChatV2RetryFailure(error, requestStatuses, requestErrors);
|
|
10887
12198
|
}
|
|
10888
12199
|
await waitForLLMChatV2RetryCooldown(cooldownMs, retryOptions.context.signal);
|
|
10889
12200
|
}
|
|
@@ -10940,7 +12251,9 @@ async function runChatV2Pipeline(options2) {
|
|
|
10940
12251
|
});
|
|
10941
12252
|
const functionTools = options2.functions != null && options2.functions.length > 0 ? chatV2ToolsToAiSdk(options2.functions) : void 0;
|
|
10942
12253
|
const tools = functionTools == null ? options2.additionalTools : options2.additionalTools == null ? functionTools : { ...functionTools, ...options2.additionalTools };
|
|
10943
|
-
const
|
|
12254
|
+
const shouldStreamResponse = options2.emitPartialOutputs !== false;
|
|
12255
|
+
const transportMode = shouldStreamResponse ? "stream" : "generate";
|
|
12256
|
+
const chatResponse = await runChatV2WithRetry(
|
|
10944
12257
|
{
|
|
10945
12258
|
model: options2.model,
|
|
10946
12259
|
messages: modelMessages,
|
|
@@ -10959,7 +12272,8 @@ async function runChatV2Pipeline(options2) {
|
|
|
10959
12272
|
toolChoice: options2.toolChoice,
|
|
10960
12273
|
abortSignal: options2.context.signal,
|
|
10961
12274
|
executeStream: options2.executeStream,
|
|
10962
|
-
|
|
12275
|
+
executeGenerate: options2.executeGenerate,
|
|
12276
|
+
onPartialOutput: !shouldStreamResponse ? void 0 : ({ text, functionCalls }) => {
|
|
10963
12277
|
var _a, _b;
|
|
10964
12278
|
(_b = (_a = options2.context).onPartialOutputs) == null ? void 0 : _b.call(
|
|
10965
12279
|
_a,
|
|
@@ -10985,9 +12299,10 @@ async function runChatV2Pipeline(options2) {
|
|
|
10985
12299
|
);
|
|
10986
12300
|
}
|
|
10987
12301
|
},
|
|
10988
|
-
options2
|
|
12302
|
+
options2,
|
|
12303
|
+
transportMode
|
|
10989
12304
|
).catch((caughtError) => {
|
|
10990
|
-
const retryFailure =
|
|
12305
|
+
const retryFailure = isChatV2RetryFailure(caughtError) ? caughtError : void 0;
|
|
10991
12306
|
const rawError = (retryFailure == null ? void 0 : retryFailure.error) ?? caughtError;
|
|
10992
12307
|
const normalizedError = normalizeChatV2ProviderError(rawError, {
|
|
10993
12308
|
provider: options2.provider,
|
|
@@ -11008,21 +12323,22 @@ async function runChatV2Pipeline(options2) {
|
|
|
11008
12323
|
}
|
|
11009
12324
|
throw normalizedError;
|
|
11010
12325
|
});
|
|
11011
|
-
if ("commonOutputs" in
|
|
11012
|
-
return
|
|
11013
|
-
}
|
|
11014
|
-
const usage = normalizeChatV2Usage(
|
|
11015
|
-
const requestStatuses =
|
|
11016
|
-
const
|
|
11017
|
-
const
|
|
12326
|
+
if ("commonOutputs" in chatResponse) {
|
|
12327
|
+
return chatResponse;
|
|
12328
|
+
}
|
|
12329
|
+
const usage = normalizeChatV2Usage(chatResponse.result.usage, options2);
|
|
12330
|
+
const requestStatuses = chatResponse.requestStatuses;
|
|
12331
|
+
const requestStatus = chatResponse.result.requestStatus ?? 200;
|
|
12332
|
+
const requestErrors = normalizeProviderFailureMessages(chatResponse.requestErrors, options2);
|
|
12333
|
+
const responseError = chatResponse.responseError ? normalizeProviderFailureMessage(chatResponse.responseError, options2) : void 0;
|
|
11018
12334
|
const commonOutputs = createChatV2CommonOutputs({
|
|
11019
12335
|
requestMessages,
|
|
11020
|
-
response:
|
|
11021
|
-
structuredOutput:
|
|
11022
|
-
functionCalls:
|
|
12336
|
+
response: chatResponse.result.responseText,
|
|
12337
|
+
structuredOutput: chatResponse.result.structuredOutput,
|
|
12338
|
+
functionCalls: chatResponse.result.functionCalls,
|
|
11023
12339
|
usage,
|
|
11024
|
-
reasoning:
|
|
11025
|
-
requestStatus
|
|
12340
|
+
reasoning: chatResponse.result.reasoning,
|
|
12341
|
+
requestStatus,
|
|
11026
12342
|
responseError,
|
|
11027
12343
|
requestStatuses,
|
|
11028
12344
|
requestErrors,
|
|
@@ -11042,14 +12358,14 @@ async function runChatV2Pipeline(options2) {
|
|
|
11042
12358
|
commonOutputs,
|
|
11043
12359
|
requestMessages,
|
|
11044
12360
|
allMessages: allMessagesOutput.value,
|
|
11045
|
-
response:
|
|
11046
|
-
functionCalls:
|
|
11047
|
-
reasoning:
|
|
12361
|
+
response: chatResponse.result.responseText,
|
|
12362
|
+
functionCalls: chatResponse.result.functionCalls,
|
|
12363
|
+
reasoning: chatResponse.result.reasoning,
|
|
11048
12364
|
usage,
|
|
11049
|
-
rawUsage:
|
|
11050
|
-
finishReason:
|
|
11051
|
-
providerMetadata:
|
|
11052
|
-
requestStatus
|
|
12365
|
+
rawUsage: chatResponse.result.usage,
|
|
12366
|
+
finishReason: chatResponse.result.finishReason,
|
|
12367
|
+
providerMetadata: chatResponse.result.providerMetadata,
|
|
12368
|
+
requestStatus
|
|
11053
12369
|
};
|
|
11054
12370
|
}
|
|
11055
12371
|
|
|
@@ -11314,32 +12630,54 @@ async function delegateToolCall(rawFunctionCall, context, config) {
|
|
|
11314
12630
|
function usesBaseURLInput(data) {
|
|
11315
12631
|
return data.provider === "custom" ? data.useCustomProviderBaseURLInput : data.useBaseURLInput;
|
|
11316
12632
|
}
|
|
11317
|
-
function
|
|
12633
|
+
function getCustomProviderBaseURLBodyValue(data) {
|
|
11318
12634
|
if (data.provider !== "custom") {
|
|
11319
12635
|
return void 0;
|
|
11320
12636
|
}
|
|
11321
12637
|
if (data.useCustomProviderBaseURLInput) {
|
|
11322
|
-
return "
|
|
12638
|
+
return "(Using Input)";
|
|
11323
12639
|
}
|
|
11324
12640
|
const baseURL = data.customProviderBaseURL.trim();
|
|
11325
|
-
return baseURL
|
|
12641
|
+
return baseURL || void 0;
|
|
11326
12642
|
}
|
|
11327
12643
|
function getOptionLabel(options2, value) {
|
|
11328
12644
|
var _a;
|
|
11329
12645
|
return ((_a = options2.find((option) => option.value === (value ?? ""))) == null ? void 0 : _a.label) ?? value ?? "Default";
|
|
11330
12646
|
}
|
|
11331
|
-
function
|
|
12647
|
+
function getProviderBodyLabel(data) {
|
|
12648
|
+
return data.provider === "custom" ? "Custom" : getChatV2ProviderLabel(data.provider);
|
|
12649
|
+
}
|
|
12650
|
+
function getReasoningEffortBodyValue(data) {
|
|
11332
12651
|
switch (data.provider) {
|
|
11333
12652
|
case "openai":
|
|
11334
|
-
return
|
|
12653
|
+
return getOptionLabel(openAIReasoningEffortOptions, data.openAIReasoningEffort);
|
|
11335
12654
|
case "anthropic":
|
|
11336
|
-
return
|
|
12655
|
+
return getOptionLabel(anthropicEffortOptions, data.anthropicEffort);
|
|
11337
12656
|
case "google":
|
|
11338
|
-
return
|
|
12657
|
+
return getOptionLabel(googleThinkingLevelOptions, data.googleThinkingLevel);
|
|
11339
12658
|
case "custom":
|
|
11340
12659
|
return void 0;
|
|
11341
12660
|
}
|
|
11342
12661
|
}
|
|
12662
|
+
function escapeMarkdownInline(value) {
|
|
12663
|
+
return value.replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/([\\`*_[\]{}()#+\-.!|])/g, "\\$1");
|
|
12664
|
+
}
|
|
12665
|
+
function getBodyLine(label, value) {
|
|
12666
|
+
return `<span style="opacity: 0.55">${label}:</span> ${escapeMarkdownInline(value)}`;
|
|
12667
|
+
}
|
|
12668
|
+
function getOptionalNumberBodyLine(label, value, usesInput) {
|
|
12669
|
+
if (usesInput) {
|
|
12670
|
+
return getBodyLine(label, "(Using Input)");
|
|
12671
|
+
}
|
|
12672
|
+
return value === void 0 ? void 0 : getBodyLine(label, `${value}`);
|
|
12673
|
+
}
|
|
12674
|
+
function getStopSequencesBodyLine(data) {
|
|
12675
|
+
if (data.useStopSequencesInput) {
|
|
12676
|
+
return getBodyLine("Stop sequences", "(Using Input)");
|
|
12677
|
+
}
|
|
12678
|
+
const stopSequences = (data.stopSequences ?? []).filter((sequence) => sequence.length > 0);
|
|
12679
|
+
return stopSequences.length === 0 ? void 0 : getBodyLine("Stop sequences", stopSequences.map((sequence) => JSON.stringify(sequence)).join(", "));
|
|
12680
|
+
}
|
|
11343
12681
|
var LLMChatV2NodeImpl = class extends NodeImpl {
|
|
11344
12682
|
static create() {
|
|
11345
12683
|
return {
|
|
@@ -11497,17 +12835,31 @@ var LLMChatV2NodeImpl = class extends NodeImpl {
|
|
|
11497
12835
|
}
|
|
11498
12836
|
getBody() {
|
|
11499
12837
|
const modelInfo = getChatV2ModelInfo(this.data.provider, this.data.model);
|
|
11500
|
-
const providerLabel =
|
|
11501
|
-
const
|
|
12838
|
+
const providerLabel = getProviderBodyLabel(this.data);
|
|
12839
|
+
const baseURLValue = getCustomProviderBaseURLBodyValue(this.data);
|
|
11502
12840
|
const modelLine = (modelInfo == null ? void 0 : modelInfo.displayName) ?? this.data.model;
|
|
11503
|
-
const providerDetails =
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
12841
|
+
const providerDetails = [
|
|
12842
|
+
getBodyLine("Provider", providerLabel),
|
|
12843
|
+
...baseURLValue ? [getBodyLine("Base URL", baseURLValue)] : [],
|
|
12844
|
+
getBodyLine("Model", modelLine)
|
|
12845
|
+
];
|
|
12846
|
+
const reasoningEffortValue = getReasoningEffortBodyValue(this.data);
|
|
12847
|
+
return {
|
|
12848
|
+
type: "markdown",
|
|
12849
|
+
disableLinks: true,
|
|
12850
|
+
text: [
|
|
12851
|
+
...providerDetails,
|
|
12852
|
+
...reasoningEffortValue ? [getBodyLine("Reasoning effort", reasoningEffortValue)] : [],
|
|
12853
|
+
getBodyLine("Temperature", this.data.useTemperatureInput ? "(Using Input)" : `${this.data.temperature}`),
|
|
12854
|
+
getBodyLine("Max output tokens", this.data.useMaxTokensInput ? "(Using Input)" : `${this.data.maxTokens}`),
|
|
12855
|
+
getOptionalNumberBodyLine("Top P", this.data.topP, this.data.useTopPInput),
|
|
12856
|
+
getOptionalNumberBodyLine("Top K", this.data.topK, this.data.useTopKInput),
|
|
12857
|
+
getOptionalNumberBodyLine("Presence penalty", this.data.presencePenalty, this.data.usePresencePenaltyInput),
|
|
12858
|
+
getOptionalNumberBodyLine("Frequency penalty", this.data.frequencyPenalty, this.data.useFrequencyPenaltyInput),
|
|
12859
|
+
getStopSequencesBodyLine(this.data),
|
|
12860
|
+
getOptionalNumberBodyLine("Seed", this.data.seed, this.data.useSeedInput)
|
|
12861
|
+
].filter((line) => line !== void 0).join("\n")
|
|
12862
|
+
};
|
|
11511
12863
|
}
|
|
11512
12864
|
async process(inputs, context) {
|
|
11513
12865
|
const runtime = await resolveLLMChatV2RuntimeConfig({
|
|
@@ -11722,12 +13074,13 @@ var PromptNodeImpl = class extends NodeImpl {
|
|
|
11722
13074
|
},
|
|
11723
13075
|
{}
|
|
11724
13076
|
);
|
|
11725
|
-
|
|
13077
|
+
let outputValue = interpolate(
|
|
11726
13078
|
this.chartNode.data.promptText,
|
|
11727
13079
|
inputMap,
|
|
11728
13080
|
context.graphInputNodeValues,
|
|
11729
13081
|
context.contextValues
|
|
11730
13082
|
);
|
|
13083
|
+
outputValue = outputValue.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
11731
13084
|
const type = getInputOrData(this.data, inputs, "type", "string");
|
|
11732
13085
|
const isCacheBreakpoint = getInputOrData(this.data, inputs, "isCacheBreakpoint", "boolean");
|
|
11733
13086
|
if (["assistant", "system", "user", "function"].includes(type) === false) {
|
|
@@ -13991,7 +15344,8 @@ var GraphOutputNodeImpl = class extends NodeImpl {
|
|
|
13991
15344
|
{
|
|
13992
15345
|
type: "string",
|
|
13993
15346
|
label: "ID",
|
|
13994
|
-
dataKey: "id"
|
|
15347
|
+
dataKey: "id",
|
|
15348
|
+
commitDebounceMs: 300
|
|
13995
15349
|
},
|
|
13996
15350
|
{
|
|
13997
15351
|
type: "dataTypeSelector",
|
|
@@ -14068,11 +15422,11 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
14068
15422
|
}
|
|
14069
15423
|
getInputDefinitions(_connections, _nodes, project, _referencedProjects, definitionContext) {
|
|
14070
15424
|
const boundary = this.getBoundary(project, definitionContext);
|
|
14071
|
-
return boundary ? getGraphBoundaryInputDefinitions(boundary) : [];
|
|
15425
|
+
return boundary ? getGraphBoundaryInputDefinitions(boundary, this.data.inputPortOrder) : [];
|
|
14072
15426
|
}
|
|
14073
15427
|
getGraphOutputs(project, definitionContext) {
|
|
14074
15428
|
const boundary = this.getBoundary(project, definitionContext);
|
|
14075
|
-
return boundary ? getGraphBoundaryOutputDefinitions(boundary) : [];
|
|
15429
|
+
return boundary ? getGraphBoundaryOutputDefinitions(boundary, this.data.outputPortOrder) : [];
|
|
14076
15430
|
}
|
|
14077
15431
|
getOutputDefinitions(_connections, _nodes, project, _referencedProjects, definitionContext) {
|
|
14078
15432
|
const outputs = [];
|
|
@@ -14105,7 +15459,7 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
14105
15459
|
if (this.data.graphId) {
|
|
14106
15460
|
const boundary = getGraphBoundary(context.project, this.data.graphId);
|
|
14107
15461
|
if (boundary) {
|
|
14108
|
-
for (const input of boundary.inputs) {
|
|
15462
|
+
for (const input of applyGraphBoundaryPortOrder(boundary.inputs, this.data.inputPortOrder)) {
|
|
14109
15463
|
definitions.push({
|
|
14110
15464
|
type: "dynamic",
|
|
14111
15465
|
dataKey: "inputData",
|
|
@@ -14141,14 +15495,26 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
14141
15495
|
}
|
|
14142
15496
|
const boundary = ((_a = context.getGraphBoundary) == null ? void 0 : _a.call(context, project, this.data.graphId)) ?? getGraphBoundary(project, this.data.graphId);
|
|
14143
15497
|
const inputData = buildGraphBoundaryInputData(boundary, inputs, this.data.inputData);
|
|
15498
|
+
const shouldRunWholeGraph = !GRAPH_BOUNDARY_OUTPUT_DEMAND_OPTIMIZATION_ENABLED || context.isDirectRunTarget || this.data.useAsGraphPartialOutput === true || this.data.useErrorOutput === true && context.activeOutputPortIds.has("error");
|
|
15499
|
+
const requestedGraphOutputNodeIds = shouldRunWholeGraph ? [] : getRequestedGraphOutputNodeIds(boundary, context.activeOutputPortIds);
|
|
15500
|
+
if (!shouldRunWholeGraph && requestedGraphOutputNodeIds.length === 0) {
|
|
15501
|
+
return buildSkippedSubgraphOutputs(boundary, this.data.useErrorOutput);
|
|
15502
|
+
}
|
|
14144
15503
|
const subGraphProcessor = context.createSubProcessor(this.data.graphId, { signal: context.signal });
|
|
15504
|
+
if (!shouldRunWholeGraph) {
|
|
15505
|
+
subGraphProcessor.runToNodeIds = requestedGraphOutputNodeIds;
|
|
15506
|
+
}
|
|
14145
15507
|
try {
|
|
14146
15508
|
const startTime = Date.now();
|
|
14147
|
-
const
|
|
15509
|
+
const graphOutputs = await subGraphProcessor.processGraph(
|
|
14148
15510
|
context,
|
|
14149
15511
|
inputData,
|
|
14150
15512
|
context.contextValues
|
|
14151
15513
|
);
|
|
15514
|
+
const outputs = shouldRunWholeGraph ? graphOutputs : {
|
|
15515
|
+
...buildExcludedGraphBoundaryOutputs(boundary),
|
|
15516
|
+
...graphOutputs
|
|
15517
|
+
};
|
|
14152
15518
|
const duration = Date.now() - startTime;
|
|
14153
15519
|
if (this.data.useErrorOutput) {
|
|
14154
15520
|
outputs["error"] = {
|
|
@@ -14177,6 +15543,24 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
14177
15543
|
}
|
|
14178
15544
|
};
|
|
14179
15545
|
var subGraphNode = nodeDefinition(SubGraphNodeImpl, "Subgraph");
|
|
15546
|
+
function buildSkippedSubgraphOutputs(boundary, useErrorOutput) {
|
|
15547
|
+
const outputs = buildExcludedGraphBoundaryOutputs(boundary);
|
|
15548
|
+
if (useErrorOutput) {
|
|
15549
|
+
outputs["error"] = {
|
|
15550
|
+
type: "control-flow-excluded",
|
|
15551
|
+
value: void 0
|
|
15552
|
+
};
|
|
15553
|
+
}
|
|
15554
|
+
outputs["cost"] = {
|
|
15555
|
+
type: "number",
|
|
15556
|
+
value: 0
|
|
15557
|
+
};
|
|
15558
|
+
outputs["duration"] = {
|
|
15559
|
+
type: "number",
|
|
15560
|
+
value: 0
|
|
15561
|
+
};
|
|
15562
|
+
return outputs;
|
|
15563
|
+
}
|
|
14180
15564
|
|
|
14181
15565
|
// src/model/nodes/ArrayNode.ts
|
|
14182
15566
|
var import_non_secure23 = require("nanoid/non-secure");
|
|
@@ -15601,7 +16985,7 @@ var CoalesceNodeImpl = class extends NodeImpl {
|
|
|
15601
16985
|
visualData: {
|
|
15602
16986
|
x: 0,
|
|
15603
16987
|
y: 0,
|
|
15604
|
-
width:
|
|
16988
|
+
width: 190
|
|
15605
16989
|
}
|
|
15606
16990
|
};
|
|
15607
16991
|
return chartNode;
|
|
@@ -18065,6 +19449,20 @@ var import_non_secure55 = require("nanoid/non-secure");
|
|
|
18065
19449
|
var import_lodash_es12 = require("lodash");
|
|
18066
19450
|
var import_ts_pattern5 = require("ts-pattern");
|
|
18067
19451
|
var import_ts_dedent53 = require("ts-dedent");
|
|
19452
|
+
var compareNodeComparisonFunctionOptions = [
|
|
19453
|
+
{ label: "==", value: "==" },
|
|
19454
|
+
{ label: "!=", value: "!=" },
|
|
19455
|
+
{ label: "<", value: "<" },
|
|
19456
|
+
{ label: "<=", value: "<=" },
|
|
19457
|
+
{ label: ">", value: ">" },
|
|
19458
|
+
{ label: ">=", value: ">=" },
|
|
19459
|
+
{ label: "and", value: "and" },
|
|
19460
|
+
{ label: "or", value: "or" },
|
|
19461
|
+
{ label: "xor", value: "xor" },
|
|
19462
|
+
{ label: "nand", value: "nand" },
|
|
19463
|
+
{ label: "nor", value: "nor" },
|
|
19464
|
+
{ label: "xnor", value: "xnor" }
|
|
19465
|
+
];
|
|
18068
19466
|
var CompareNodeImpl = class extends NodeImpl {
|
|
18069
19467
|
static create() {
|
|
18070
19468
|
const chartNode = {
|
|
@@ -18119,20 +19517,7 @@ var CompareNodeImpl = class extends NodeImpl {
|
|
|
18119
19517
|
type: "dropdown",
|
|
18120
19518
|
label: "Comparison Function",
|
|
18121
19519
|
dataKey: "comparisonFunction",
|
|
18122
|
-
options:
|
|
18123
|
-
{ label: "==", value: "==" },
|
|
18124
|
-
{ label: "!=", value: "!=" },
|
|
18125
|
-
{ label: "<", value: "<" },
|
|
18126
|
-
{ label: "<=", value: "<=" },
|
|
18127
|
-
{ label: ">", value: ">" },
|
|
18128
|
-
{ label: ">=", value: ">=" },
|
|
18129
|
-
{ label: "and", value: "and" },
|
|
18130
|
-
{ label: "or", value: "or" },
|
|
18131
|
-
{ label: "xor", value: "xor" },
|
|
18132
|
-
{ label: "nand", value: "nand" },
|
|
18133
|
-
{ label: "nor", value: "nor" },
|
|
18134
|
-
{ label: "xnor", value: "xnor" }
|
|
18135
|
-
],
|
|
19520
|
+
options: compareNodeComparisonFunctionOptions,
|
|
18136
19521
|
useInputToggleDataKey: "useComparisonFunctionInput"
|
|
18137
19522
|
}
|
|
18138
19523
|
];
|
|
@@ -23406,17 +24791,29 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
23406
24791
|
}
|
|
23407
24792
|
const boundary = ((_a = context.getGraphBoundary) == null ? void 0 : _a.call(context, referencedProject, this.data.graphId)) ?? getGraphBoundary(referencedProject, this.data.graphId);
|
|
23408
24793
|
const inputData = buildGraphBoundaryInputData(boundary, inputs, this.data.inputData);
|
|
24794
|
+
const shouldRunWholeGraph = !GRAPH_BOUNDARY_OUTPUT_DEMAND_OPTIMIZATION_ENABLED || context.isDirectRunTarget || this.data.useErrorOutput === true && context.activeOutputPortIds.has("error");
|
|
24795
|
+
const requestedGraphOutputNodeIds = shouldRunWholeGraph ? [] : getRequestedGraphOutputNodeIds(boundary, context.activeOutputPortIds);
|
|
24796
|
+
if (!shouldRunWholeGraph && requestedGraphOutputNodeIds.length === 0) {
|
|
24797
|
+
return buildSkippedReferencedGraphOutputs(boundary, this.data.useErrorOutput, this.data.outputCostDuration);
|
|
24798
|
+
}
|
|
23409
24799
|
const subGraphProcessor = context.createSubProcessor(this.data.graphId, {
|
|
23410
24800
|
signal: context.signal,
|
|
23411
24801
|
project: referencedProject
|
|
23412
24802
|
});
|
|
24803
|
+
if (!shouldRunWholeGraph) {
|
|
24804
|
+
subGraphProcessor.runToNodeIds = requestedGraphOutputNodeIds;
|
|
24805
|
+
}
|
|
23413
24806
|
try {
|
|
23414
24807
|
const startTime = Date.now();
|
|
23415
|
-
const
|
|
24808
|
+
const graphOutputs = await subGraphProcessor.processGraph(
|
|
23416
24809
|
context,
|
|
23417
24810
|
inputData,
|
|
23418
24811
|
context.contextValues
|
|
23419
24812
|
);
|
|
24813
|
+
const outputs = shouldRunWholeGraph ? graphOutputs : {
|
|
24814
|
+
...buildExcludedGraphBoundaryOutputs(boundary),
|
|
24815
|
+
...graphOutputs
|
|
24816
|
+
};
|
|
23420
24817
|
const duration = Date.now() - startTime;
|
|
23421
24818
|
if (this.data.useErrorOutput) {
|
|
23422
24819
|
outputs["error"] = {
|
|
@@ -23430,11 +24827,7 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
23430
24827
|
value: duration
|
|
23431
24828
|
};
|
|
23432
24829
|
}
|
|
23433
|
-
|
|
23434
|
-
delete outputs["cost"];
|
|
23435
|
-
delete outputs["duration"];
|
|
23436
|
-
}
|
|
23437
|
-
return outputs;
|
|
24830
|
+
return applyMetricOutputSetting(outputs, this.data.outputCostDuration);
|
|
23438
24831
|
} catch (err) {
|
|
23439
24832
|
if (!this.data.useErrorOutput) {
|
|
23440
24833
|
throw err;
|
|
@@ -23449,10 +24842,74 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
23449
24842
|
}
|
|
23450
24843
|
};
|
|
23451
24844
|
var referencedGraphAliasNode = nodeDefinition(ReferencedGraphAliasNodeImpl, "Referenced Graph Alias");
|
|
24845
|
+
function buildSkippedReferencedGraphOutputs(boundary, useErrorOutput, outputCostDuration) {
|
|
24846
|
+
const outputs = buildExcludedGraphBoundaryOutputs(boundary);
|
|
24847
|
+
if (useErrorOutput) {
|
|
24848
|
+
outputs["error"] = {
|
|
24849
|
+
type: "control-flow-excluded",
|
|
24850
|
+
value: void 0
|
|
24851
|
+
};
|
|
24852
|
+
}
|
|
24853
|
+
if (outputCostDuration) {
|
|
24854
|
+
outputs["cost"] = {
|
|
24855
|
+
type: "number",
|
|
24856
|
+
value: 0
|
|
24857
|
+
};
|
|
24858
|
+
outputs["duration"] = {
|
|
24859
|
+
type: "number",
|
|
24860
|
+
value: 0
|
|
24861
|
+
};
|
|
24862
|
+
}
|
|
24863
|
+
return applyMetricOutputSetting(outputs, outputCostDuration);
|
|
24864
|
+
}
|
|
24865
|
+
function applyMetricOutputSetting(outputs, outputCostDuration) {
|
|
24866
|
+
if (outputCostDuration) {
|
|
24867
|
+
return outputs;
|
|
24868
|
+
}
|
|
24869
|
+
delete outputs["cost"];
|
|
24870
|
+
delete outputs["duration"];
|
|
24871
|
+
return outputs;
|
|
24872
|
+
}
|
|
24873
|
+
|
|
24874
|
+
// src/model/nodes/NodePrefabInstanceNode.ts
|
|
24875
|
+
var import_non_secure84 = require("nanoid/non-secure");
|
|
24876
|
+
var NodePrefabInstanceNodeImpl = class extends NodeImpl {
|
|
24877
|
+
static create() {
|
|
24878
|
+
return {
|
|
24879
|
+
type: NODE_PREFAB_INSTANCE_TYPE,
|
|
24880
|
+
title: "Linked node",
|
|
24881
|
+
id: (0, import_non_secure84.nanoid)(),
|
|
24882
|
+
visualData: {
|
|
24883
|
+
x: 0,
|
|
24884
|
+
y: 0,
|
|
24885
|
+
width: 240
|
|
24886
|
+
},
|
|
24887
|
+
data: {}
|
|
24888
|
+
};
|
|
24889
|
+
}
|
|
24890
|
+
getInputDefinitions() {
|
|
24891
|
+
return [];
|
|
24892
|
+
}
|
|
24893
|
+
getOutputDefinitions() {
|
|
24894
|
+
return [];
|
|
24895
|
+
}
|
|
24896
|
+
async process(_inputData) {
|
|
24897
|
+
throw new Error("Library node is missing. Open the Node Library and reconnect this linked node.");
|
|
24898
|
+
}
|
|
24899
|
+
static getUIData() {
|
|
24900
|
+
return {
|
|
24901
|
+
contextMenuTitle: "Linked node",
|
|
24902
|
+
infoBoxTitle: "Linked node",
|
|
24903
|
+
infoBoxBody: "Runs a node from the project Node Library.",
|
|
24904
|
+
group: "Advanced"
|
|
24905
|
+
};
|
|
24906
|
+
}
|
|
24907
|
+
};
|
|
24908
|
+
var nodePrefabInstanceNode = nodeDefinition(NodePrefabInstanceNodeImpl, "Linked node");
|
|
23452
24909
|
|
|
23453
24910
|
// src/model/Nodes.ts
|
|
23454
24911
|
var registerBuiltInNodes = (registry) => {
|
|
23455
|
-
return registry.register(toYamlNode).register(userInputNode).register(textNode).register(llmChatV2Node).register(chatNode).register(promptNode).register(extractRegexNode).register(codeNode).register(codeNewNode).register(expressionNode).register(matchNode).register(ifNode).register(readDirectoryNode).register(readFileNode).register(ifElseNode).register(chunkNode).register(graphInputNode).register(graphOutputNode).register(subGraphNode).register(arrayNode).register(extractJsonNode).register(assemblePromptNode).register(loopControllerNode).register(trimChatMessagesNode).register(extractYamlNode).register(externalCallNode).register(extractObjectPathNode).register(raiseEventNode).register(contextNode).register(coalesceNode).register(didRunNode).register(passthroughNode).register(popNode).register(setGlobalNode).register(getGlobalNode).register(waitForEventNode).register(gptFunctionNode).register(getEmbeddingNode).register(vectorStoreNode).register(vectorNearestNeighborsNode).register(hashNode).register(abortGraphNode).register(raceInputsNode).register(toJsonNode).register(joinNode).register(filterNode).register(jsFilterNode).register(jsMapNode).register(objectNode).register(booleanNode).register(compareNode).register(evaluateNode).register(numberNode).register(randomNumberNode).register(shuffleNode).register(commentNode).register(imageNode).register(audioNode).register(httpCallNode).register(delayNode).register(appendToDatasetNode).register(createDatasetNode).register(loadDatasetNode).register(getAllDatasetsNode).register(splitNode).register(datasetNearestNeighborsNode).register(getDatasetRowNode).register(sliceNode).register(extractMarkdownCodeBlocksNode).register(assembleMessageNode).register(urlReferenceNode).register(destructureNode).register(replaceDatasetNode).register(listGraphsNode).register(graphReferenceNode).register(callGraphNode).register(delegateFunctionCallNode).register(playAudioNode).register(documentNode).register(chatLoopNode).register(readAllFilesNode).register(toMarkdownTableNode).register(cronNode).register(toTreeNode).register(loopUntilNode).register(mcpDiscoveryNode).register(mcpToolCallNode).register(mcpGetPromptNode).register(referencedGraphAliasNode);
|
|
24912
|
+
return registry.register(toYamlNode).register(userInputNode).register(textNode).register(llmChatV2Node).register(chatNode).register(promptNode).register(extractRegexNode).register(codeNode).register(codeNewNode).register(expressionNode).register(matchNode).register(ifNode).register(readDirectoryNode).register(readFileNode).register(ifElseNode).register(chunkNode).register(graphInputNode).register(graphOutputNode).register(subGraphNode).register(arrayNode).register(extractJsonNode).register(assemblePromptNode).register(loopControllerNode).register(trimChatMessagesNode).register(extractYamlNode).register(externalCallNode).register(extractObjectPathNode).register(raiseEventNode).register(contextNode).register(coalesceNode).register(didRunNode).register(passthroughNode).register(popNode).register(setGlobalNode).register(getGlobalNode).register(waitForEventNode).register(gptFunctionNode).register(getEmbeddingNode).register(vectorStoreNode).register(vectorNearestNeighborsNode).register(hashNode).register(abortGraphNode).register(raceInputsNode).register(toJsonNode).register(joinNode).register(filterNode).register(jsFilterNode).register(jsMapNode).register(objectNode).register(booleanNode).register(compareNode).register(evaluateNode).register(numberNode).register(randomNumberNode).register(shuffleNode).register(commentNode).register(imageNode).register(audioNode).register(httpCallNode).register(delayNode).register(appendToDatasetNode).register(createDatasetNode).register(loadDatasetNode).register(getAllDatasetsNode).register(splitNode).register(datasetNearestNeighborsNode).register(getDatasetRowNode).register(sliceNode).register(extractMarkdownCodeBlocksNode).register(assembleMessageNode).register(urlReferenceNode).register(destructureNode).register(replaceDatasetNode).register(listGraphsNode).register(graphReferenceNode).register(callGraphNode).register(delegateFunctionCallNode).register(playAudioNode).register(documentNode).register(chatLoopNode).register(readAllFilesNode).register(toMarkdownTableNode).register(cronNode).register(toTreeNode).register(loopUntilNode).register(mcpDiscoveryNode).register(mcpToolCallNode).register(mcpGetPromptNode).register(referencedGraphAliasNode).register(nodePrefabInstanceNode);
|
|
23456
24913
|
};
|
|
23457
24914
|
var globalRivetNodeRegistry = registerBuiltInNodes(new NodeRegistration());
|
|
23458
24915
|
function resetGlobalRivetNodeRegistry() {
|
|
@@ -23619,7 +25076,7 @@ var OpenAIEmbeddingGenerator = class {
|
|
|
23619
25076
|
registerIntegration("embeddingGenerator", "openai", (context) => new OpenAIEmbeddingGenerator(context.settings));
|
|
23620
25077
|
|
|
23621
25078
|
// src/recording/ExecutionRecorder.ts
|
|
23622
|
-
var
|
|
25079
|
+
var import_non_secure85 = require("nanoid/non-secure");
|
|
23623
25080
|
var import_emittery2 = __toESM(require("emittery-0-13"), 1);
|
|
23624
25081
|
var import_lodash_es17 = require("lodash");
|
|
23625
25082
|
var import_json_stream_es = require("json-stream-es");
|
|
@@ -23819,7 +25276,7 @@ function serializeToObject(recording) {
|
|
|
23819
25276
|
const asString = uint8ArrayToBase64Sync(val);
|
|
23820
25277
|
const existingAsset = Object.entries(serialized.assets).find(([, asset]) => asset === asString);
|
|
23821
25278
|
if (!existingAsset) {
|
|
23822
|
-
const id = (0,
|
|
25279
|
+
const id = (0, import_non_secure85.nanoid)();
|
|
23823
25280
|
serialized.assets[id] = asString;
|
|
23824
25281
|
return `$ASSET:${id}`;
|
|
23825
25282
|
} else {
|
|
@@ -23878,7 +25335,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
23878
25335
|
once = void 0;
|
|
23879
25336
|
recordSocket(channel) {
|
|
23880
25337
|
return new Promise((resolve) => {
|
|
23881
|
-
this.recordingId = (0,
|
|
25338
|
+
this.recordingId = (0, import_non_secure85.nanoid)();
|
|
23882
25339
|
const listener = (event) => {
|
|
23883
25340
|
const { message, data } = JSON.parse(event.data);
|
|
23884
25341
|
if (this.#includePartialOutputs === false && message === "partialOutput") {
|
|
@@ -23903,7 +25360,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
23903
25360
|
});
|
|
23904
25361
|
}
|
|
23905
25362
|
record(processor) {
|
|
23906
|
-
this.recordingId = (0,
|
|
25363
|
+
this.recordingId = (0, import_non_secure85.nanoid)();
|
|
23907
25364
|
processor.onAny((event, data) => {
|
|
23908
25365
|
if (this.#includePartialOutputs === false && event === "partialOutput") {
|
|
23909
25366
|
return;
|
|
@@ -23965,7 +25422,7 @@ function isRecordingTerminalEvent(event, data) {
|
|
|
23965
25422
|
}
|
|
23966
25423
|
|
|
23967
25424
|
// src/plugins/anthropic/nodes/ChatAnthropicNode.ts
|
|
23968
|
-
var
|
|
25425
|
+
var import_non_secure86 = require("nanoid/non-secure");
|
|
23969
25426
|
var import_ts_dedent76 = require("ts-dedent");
|
|
23970
25427
|
var import_p_retry2 = __toESM(require("p-retry-4"), 1);
|
|
23971
25428
|
|
|
@@ -23981,7 +25438,7 @@ var ChatAnthropicNodeImpl = {
|
|
|
23981
25438
|
const chartNode = {
|
|
23982
25439
|
type: "chatAnthropic",
|
|
23983
25440
|
title: "Chat (Anthropic, Legacy)",
|
|
23984
|
-
id: (0,
|
|
25441
|
+
id: (0, import_non_secure86.nanoid)(),
|
|
23985
25442
|
visualData: {
|
|
23986
25443
|
x: 0,
|
|
23987
25444
|
y: 0,
|
|
@@ -24723,7 +26180,7 @@ var anthropicPlugin = {
|
|
|
24723
26180
|
var anthropic_default = anthropicPlugin;
|
|
24724
26181
|
|
|
24725
26182
|
// src/plugins/autoevals/AutoEvalsNode.ts
|
|
24726
|
-
var
|
|
26183
|
+
var import_non_secure87 = require("nanoid/non-secure");
|
|
24727
26184
|
var import_ts_dedent77 = require("ts-dedent");
|
|
24728
26185
|
var import_autoevals = require("autoevals");
|
|
24729
26186
|
var import_ts_pattern8 = require("ts-pattern");
|
|
@@ -24743,7 +26200,7 @@ var AutoEvalsNodeImpl = {
|
|
|
24743
26200
|
const chartNode = {
|
|
24744
26201
|
type: "autoevals",
|
|
24745
26202
|
title: "Autoevals",
|
|
24746
|
-
id: (0,
|
|
26203
|
+
id: (0, import_non_secure87.nanoid)(),
|
|
24747
26204
|
visualData: {
|
|
24748
26205
|
x: 0,
|
|
24749
26206
|
y: 0,
|
|
@@ -24938,7 +26395,7 @@ var autoevalsPlugin = {
|
|
|
24938
26395
|
var autoevals_default = autoevalsPlugin;
|
|
24939
26396
|
|
|
24940
26397
|
// src/plugins/assemblyAi/LemurQaNode.ts
|
|
24941
|
-
var
|
|
26398
|
+
var import_non_secure88 = require("nanoid/non-secure");
|
|
24942
26399
|
var import_ts_dedent78 = require("ts-dedent");
|
|
24943
26400
|
|
|
24944
26401
|
// src/plugins/assemblyAi/lemurHelpers.ts
|
|
@@ -25059,7 +26516,7 @@ var LemurQaNodeImpl = {
|
|
|
25059
26516
|
const chartNode = {
|
|
25060
26517
|
type: "assemblyAiLemurQa",
|
|
25061
26518
|
title: "LeMUR Question & Answers",
|
|
25062
|
-
id: (0,
|
|
26519
|
+
id: (0, import_non_secure88.nanoid)(),
|
|
25063
26520
|
visualData: {
|
|
25064
26521
|
x: 0,
|
|
25065
26522
|
y: 0,
|
|
@@ -25197,14 +26654,14 @@ function applyQuestionEditors(data, question) {
|
|
|
25197
26654
|
var lemurQaNode = pluginNodeDefinition(LemurQaNodeImpl, "LeMUR Q&A");
|
|
25198
26655
|
|
|
25199
26656
|
// src/plugins/assemblyAi/TranscribeAudioNode.ts
|
|
25200
|
-
var
|
|
26657
|
+
var import_non_secure89 = require("nanoid/non-secure");
|
|
25201
26658
|
var import_ts_dedent79 = require("ts-dedent");
|
|
25202
26659
|
var TranscribeAudioNodeImpl = {
|
|
25203
26660
|
create() {
|
|
25204
26661
|
const chartNode = {
|
|
25205
26662
|
type: "assemblyAiTranscribeAudio",
|
|
25206
26663
|
title: "Transcribe Audio",
|
|
25207
|
-
id: (0,
|
|
26664
|
+
id: (0, import_non_secure89.nanoid)(),
|
|
25208
26665
|
visualData: {
|
|
25209
26666
|
x: 0,
|
|
25210
26667
|
y: 0,
|
|
@@ -25319,7 +26776,7 @@ function getAdditionalParameters(data) {
|
|
|
25319
26776
|
}
|
|
25320
26777
|
|
|
25321
26778
|
// src/plugins/assemblyAi/LemurSummaryNode.ts
|
|
25322
|
-
var
|
|
26779
|
+
var import_non_secure90 = require("nanoid/non-secure");
|
|
25323
26780
|
var import_ts_dedent80 = require("ts-dedent");
|
|
25324
26781
|
var import_assemblyai3 = require("assemblyai");
|
|
25325
26782
|
var LemurSummaryNodeImpl = {
|
|
@@ -25327,7 +26784,7 @@ var LemurSummaryNodeImpl = {
|
|
|
25327
26784
|
const chartNode = {
|
|
25328
26785
|
type: "assemblyAiLemurSummary",
|
|
25329
26786
|
title: "LeMUR Summary",
|
|
25330
|
-
id: (0,
|
|
26787
|
+
id: (0, import_non_secure90.nanoid)(),
|
|
25331
26788
|
visualData: {
|
|
25332
26789
|
x: 0,
|
|
25333
26790
|
y: 0,
|
|
@@ -25397,7 +26854,7 @@ var LemurSummaryNodeImpl = {
|
|
|
25397
26854
|
var lemurSummaryNode = pluginNodeDefinition(LemurSummaryNodeImpl, "LeMUR Summary");
|
|
25398
26855
|
|
|
25399
26856
|
// src/plugins/assemblyAi/LemurTaskNode.ts
|
|
25400
|
-
var
|
|
26857
|
+
var import_non_secure91 = require("nanoid/non-secure");
|
|
25401
26858
|
var import_ts_dedent81 = require("ts-dedent");
|
|
25402
26859
|
var import_assemblyai4 = require("assemblyai");
|
|
25403
26860
|
var LemurTaskNodeImpl = {
|
|
@@ -25405,7 +26862,7 @@ var LemurTaskNodeImpl = {
|
|
|
25405
26862
|
const chartNode = {
|
|
25406
26863
|
type: "assemblyAiLemurTask",
|
|
25407
26864
|
title: "LeMUR Task",
|
|
25408
|
-
id: (0,
|
|
26865
|
+
id: (0, import_non_secure91.nanoid)(),
|
|
25409
26866
|
visualData: {
|
|
25410
26867
|
x: 0,
|
|
25411
26868
|
y: 0,
|
|
@@ -25477,14 +26934,14 @@ var LemurTaskNodeImpl = {
|
|
|
25477
26934
|
var lemurTaskNode = pluginNodeDefinition(LemurTaskNodeImpl, "LeMUR Task");
|
|
25478
26935
|
|
|
25479
26936
|
// src/plugins/assemblyAi/LemurActionItemsNode.ts
|
|
25480
|
-
var
|
|
26937
|
+
var import_non_secure92 = require("nanoid/non-secure");
|
|
25481
26938
|
var import_ts_dedent82 = require("ts-dedent");
|
|
25482
26939
|
var LemurActionItemsNodeImpl = {
|
|
25483
26940
|
create() {
|
|
25484
26941
|
const chartNode = {
|
|
25485
26942
|
type: "assemblyAiLemurActionItems",
|
|
25486
26943
|
title: "LeMUR Action Items",
|
|
25487
|
-
id: (0,
|
|
26944
|
+
id: (0, import_non_secure92.nanoid)(),
|
|
25488
26945
|
visualData: {
|
|
25489
26946
|
x: 0,
|
|
25490
26947
|
y: 0,
|
|
@@ -25582,12 +27039,12 @@ var assemblyAiPlugin = {
|
|
|
25582
27039
|
var assemblyAi_default = assemblyAiPlugin;
|
|
25583
27040
|
|
|
25584
27041
|
// src/plugins/huggingface/nodes/ChatHuggingFace.ts
|
|
25585
|
-
var
|
|
27042
|
+
var import_non_secure93 = require("nanoid/non-secure");
|
|
25586
27043
|
var import_inference = require("@huggingface/inference");
|
|
25587
27044
|
var ChatHuggingFaceNodeImpl = {
|
|
25588
27045
|
create() {
|
|
25589
27046
|
return {
|
|
25590
|
-
id: (0,
|
|
27047
|
+
id: (0, import_non_secure93.nanoid)(),
|
|
25591
27048
|
type: "chatHuggingFace",
|
|
25592
27049
|
data: {
|
|
25593
27050
|
model: "",
|
|
@@ -25817,13 +27274,13 @@ var ChatHuggingFaceNodeImpl = {
|
|
|
25817
27274
|
var chatHuggingFaceNode = pluginNodeDefinition(ChatHuggingFaceNodeImpl, "Chat (Hugging Face, Legacy)");
|
|
25818
27275
|
|
|
25819
27276
|
// src/plugins/huggingface/nodes/TextToImageHuggingFace.ts
|
|
25820
|
-
var
|
|
27277
|
+
var import_non_secure94 = require("nanoid/non-secure");
|
|
25821
27278
|
var import_inference2 = require("@huggingface/inference");
|
|
25822
27279
|
var import_ts_dedent83 = require("ts-dedent");
|
|
25823
27280
|
var TextToImageHuggingFaceNodeImpl = {
|
|
25824
27281
|
create() {
|
|
25825
27282
|
return {
|
|
25826
|
-
id: (0,
|
|
27283
|
+
id: (0, import_non_secure94.nanoid)(),
|
|
25827
27284
|
type: "textToImageHuggingFace",
|
|
25828
27285
|
data: {
|
|
25829
27286
|
model: "",
|
|
@@ -29139,7 +30596,7 @@ var openAIPlugin = {
|
|
|
29139
30596
|
};
|
|
29140
30597
|
|
|
29141
30598
|
// src/plugins/google/nodes/ChatGoogleNode.ts
|
|
29142
|
-
var
|
|
30599
|
+
var import_non_secure95 = require("nanoid/non-secure");
|
|
29143
30600
|
var import_ts_dedent84 = require("ts-dedent");
|
|
29144
30601
|
var import_p_retry3 = __toESM(require("p-retry-4"), 1);
|
|
29145
30602
|
var import_ts_pattern9 = require("ts-pattern");
|
|
@@ -29168,7 +30625,7 @@ var ChatGoogleNodeImpl = {
|
|
|
29168
30625
|
const chartNode = {
|
|
29169
30626
|
type: "chatGoogle",
|
|
29170
30627
|
title: "Chat (Google, Legacy)",
|
|
29171
|
-
id: (0,
|
|
30628
|
+
id: (0, import_non_secure95.nanoid)(),
|
|
29172
30629
|
visualData: {
|
|
29173
30630
|
x: 0,
|
|
29174
30631
|
y: 0,
|
|
@@ -30024,6 +31481,7 @@ function coreCreateProcessor(project, options2, internalOptions = {}) {
|
|
|
30024
31481
|
concurrency: options2.concurrency,
|
|
30025
31482
|
executionPlanCacheMode: internalOptions.executionPlanCacheMode,
|
|
30026
31483
|
runtimeCache: internalOptions.runtimeCache,
|
|
31484
|
+
runtimeProfiler: internalOptions.runtimeProfiler,
|
|
30027
31485
|
scheduler: internalOptions.scheduler
|
|
30028
31486
|
}
|
|
30029
31487
|
);
|
|
@@ -30208,7 +31666,9 @@ var Rivet = void 0;
|
|
|
30208
31666
|
MCPGetPromptNodeImpl,
|
|
30209
31667
|
MCPToolCallNodeImpl,
|
|
30210
31668
|
MatchNodeImpl,
|
|
31669
|
+
NODE_PREFAB_INSTANCE_TYPE,
|
|
30211
31670
|
NodeImpl,
|
|
31671
|
+
NodePrefabInstanceNodeImpl,
|
|
30212
31672
|
NodeRegistration,
|
|
30213
31673
|
NotAllowedCodeRunner,
|
|
30214
31674
|
NumberNodeImpl,
|
|
@@ -30218,6 +31678,8 @@ var Rivet = void 0;
|
|
|
30218
31678
|
PluginNodeImplClass,
|
|
30219
31679
|
PopNodeImpl,
|
|
30220
31680
|
PromptNodeImpl,
|
|
31681
|
+
RIVET_WEB_APP_DOCUMENT_CSS,
|
|
31682
|
+
RIVET_WEB_APP_RENDERER_CSS,
|
|
30221
31683
|
RaceInputsNodeImpl,
|
|
30222
31684
|
RaiseEventNodeImpl,
|
|
30223
31685
|
RandomNumberNodeImpl,
|
|
@@ -30270,6 +31732,7 @@ var Rivet = void 0;
|
|
|
30270
31732
|
callGraphNode,
|
|
30271
31733
|
canBeCoerced,
|
|
30272
31734
|
canBeCoercedAny,
|
|
31735
|
+
canUseNodeAsPrefabSource,
|
|
30273
31736
|
chatLoopNode,
|
|
30274
31737
|
chatMessagesToModelMessages,
|
|
30275
31738
|
chatNode,
|
|
@@ -30278,6 +31741,8 @@ var Rivet = void 0;
|
|
|
30278
31741
|
chunkNode,
|
|
30279
31742
|
chunkStringByTokenCount,
|
|
30280
31743
|
cleanHeaders,
|
|
31744
|
+
cloneFrozenNodeOutputs,
|
|
31745
|
+
cloneFrozenNodeOutputsByGraph,
|
|
30281
31746
|
coalesceNode,
|
|
30282
31747
|
codeNewNode,
|
|
30283
31748
|
codeNode,
|
|
@@ -30285,6 +31750,8 @@ var Rivet = void 0;
|
|
|
30285
31750
|
coerceTypeOptional,
|
|
30286
31751
|
commentNode,
|
|
30287
31752
|
compareNode,
|
|
31753
|
+
compareNodeComparisonFunctionOptions,
|
|
31754
|
+
compareProjects,
|
|
30288
31755
|
contextNode,
|
|
30289
31756
|
coreCreateProcessor,
|
|
30290
31757
|
coreRunGraph,
|
|
@@ -30296,6 +31763,8 @@ var Rivet = void 0;
|
|
|
30296
31763
|
createDebuggerTransportEscapedSentinel,
|
|
30297
31764
|
createDebuggerTransportEscapedSentinelEnvelope,
|
|
30298
31765
|
createDebuggerTransportUndefinedSentinel,
|
|
31766
|
+
createDefaultUiGraph,
|
|
31767
|
+
createFrozenNodeOutputResolver,
|
|
30299
31768
|
createInterpolationInputDefinition,
|
|
30300
31769
|
createsLLMChatV2ToolResponseFormatConflictForEdit,
|
|
30301
31770
|
cronNode,
|
|
@@ -30329,6 +31798,7 @@ var Rivet = void 0;
|
|
|
30329
31798
|
filterNode,
|
|
30330
31799
|
findInterpolationTokenSpans,
|
|
30331
31800
|
functionTypeToScalarType,
|
|
31801
|
+
generateChatV2,
|
|
30332
31802
|
gentracePlugin,
|
|
30333
31803
|
getAllDatasetsNode,
|
|
30334
31804
|
getChatNodeMessages,
|
|
@@ -30347,16 +31817,25 @@ var Rivet = void 0;
|
|
|
30347
31817
|
getExtractObjectPathInterpolationInputNames,
|
|
30348
31818
|
getGentracePipelines,
|
|
30349
31819
|
getGlobalNode,
|
|
31820
|
+
getGraphBoundary,
|
|
30350
31821
|
getHttpCallBodyPreviewSections,
|
|
30351
31822
|
getInputOrData,
|
|
30352
31823
|
getIntegration,
|
|
30353
31824
|
getInterpolationInputDefinitionData,
|
|
30354
31825
|
getInterpolationTokenName,
|
|
31826
|
+
getNodePrefabDisplayName,
|
|
31827
|
+
getNodePrefabInstancePrefabId,
|
|
30355
31828
|
getPluginConfig,
|
|
30356
31829
|
getProcessorEvents,
|
|
30357
31830
|
getProcessorSSEStream,
|
|
31831
|
+
getProjectConnectionComparisonKey,
|
|
31832
|
+
getProjectNodeFieldComparisons,
|
|
30358
31833
|
getScalarTypeOf,
|
|
30359
31834
|
getSingleNodeStream,
|
|
31835
|
+
getUiGraphActionComponent,
|
|
31836
|
+
getUiGraphActionInputBindings,
|
|
31837
|
+
getUiGraphActionOutputBindings,
|
|
31838
|
+
getUiGraphInitialState,
|
|
30360
31839
|
getWarnings,
|
|
30361
31840
|
globalRivetNodeRegistry,
|
|
30362
31841
|
googlePlugin,
|
|
@@ -30366,6 +31845,7 @@ var Rivet = void 0;
|
|
|
30366
31845
|
graphOutputNode,
|
|
30367
31846
|
graphReferenceNode,
|
|
30368
31847
|
handleEscapeCharacters,
|
|
31848
|
+
hasFrozenNodeOutputs,
|
|
30369
31849
|
hasLLMChatV2ToolResponseFormatConflict,
|
|
30370
31850
|
hasValidStoredOrderedPortIds,
|
|
30371
31851
|
hashNode,
|
|
@@ -30391,6 +31871,7 @@ var Rivet = void 0;
|
|
|
30391
31871
|
isFunctionDataValue,
|
|
30392
31872
|
isInterpolationInputDefinition,
|
|
30393
31873
|
isLLMChatV2StructuredResponseFormat,
|
|
31874
|
+
isNodePrefabInstanceNode,
|
|
30394
31875
|
isNotFunctionDataValue,
|
|
30395
31876
|
isRuntimeDebugLoggingEnabled,
|
|
30396
31877
|
isScalarDataType,
|
|
@@ -30398,6 +31879,7 @@ var Rivet = void 0;
|
|
|
30398
31879
|
joinNode,
|
|
30399
31880
|
jsFilterNode,
|
|
30400
31881
|
jsMapNode,
|
|
31882
|
+
jsonValueToDataValue,
|
|
30401
31883
|
listGraphsNode,
|
|
30402
31884
|
llmChatV2Node,
|
|
30403
31885
|
loadDatasetNode,
|
|
@@ -30418,6 +31900,7 @@ var Rivet = void 0;
|
|
|
30418
31900
|
mergeCustomProviderResponseFormatOptions,
|
|
30419
31901
|
newId,
|
|
30420
31902
|
nodeDefinition,
|
|
31903
|
+
nodePrefabInstanceNode,
|
|
30421
31904
|
numberNode,
|
|
30422
31905
|
objectNode,
|
|
30423
31906
|
openAICompatibleEndpointToBaseURL,
|
|
@@ -30451,8 +31934,13 @@ var Rivet = void 0;
|
|
|
30451
31934
|
resolveChatV2ProviderConfig,
|
|
30452
31935
|
resolveChatV2ResponseFormatParameters,
|
|
30453
31936
|
resolveLLMChatV2RuntimeProviderOptions,
|
|
31937
|
+
resolveNodePrefabInstance,
|
|
31938
|
+
resolveNodePrefabInstances,
|
|
30454
31939
|
resolveProcessSettings,
|
|
30455
31940
|
resolveStoredOrderedPortIds,
|
|
31941
|
+
resolveUiGraphActionInputs,
|
|
31942
|
+
resolveUiGraphActionOutputStatePatch,
|
|
31943
|
+
resolveUiGraphActionOutputStateValue,
|
|
30456
31944
|
resolveUniqueValueDerivedPortIds,
|
|
30457
31945
|
restoreEscapedInterpolationTokens,
|
|
30458
31946
|
runChatV2Pipeline,
|