@valerypopoff/rivet2-core 2.0.11 → 2.1.1
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 +1657 -158
- package/dist/cjs/bundle.cjs.map +4 -4
- 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 +129 -17
- 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 +241 -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/chatV2FeatureCompatibility.js +1 -1
- package/dist/esm/model/chat-v2/chatV2Outputs.js +11 -2
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +38 -31
- package/dist/esm/model/chat-v2/chatV2ResponseFormat.js +4 -1
- package/dist/esm/model/chat-v2/chatV2Shared.js +2 -2
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +5 -5
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +8 -2
- package/dist/esm/model/chat-v2/providerOptions.js +65 -2
- 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 +66 -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/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 +15 -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/chatV2FeatureCompatibility.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2Outputs.d.ts +4 -2
- package/dist/types/model/chat-v2/chatV2ResponseFormat.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2Types.d.ts +24 -1
- package/dist/types/model/chat-v2/providerOptions.d.ts +1 -0
- 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();
|
|
@@ -3705,6 +4399,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3705
4399
|
#scheduler;
|
|
3706
4400
|
#runtimeProfiler;
|
|
3707
4401
|
#captureNodeTimings;
|
|
4402
|
+
#frozenNodeOutputResolver;
|
|
3708
4403
|
#useSeededExecutionPlanOnNextRun = false;
|
|
3709
4404
|
id = (0, import_non_secure4.nanoid)();
|
|
3710
4405
|
#includeTrace = true;
|
|
@@ -3752,6 +4447,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3752
4447
|
#scc = void 0;
|
|
3753
4448
|
#graphExecutionPlan;
|
|
3754
4449
|
#nodeProcessContextBase = void 0;
|
|
4450
|
+
#runToRelevantNodeIds;
|
|
3755
4451
|
#nodesNotInCycle = void 0;
|
|
3756
4452
|
#nodeAbortControllers = /* @__PURE__ */ new Map();
|
|
3757
4453
|
#graphInputNodeValues = {};
|
|
@@ -3829,13 +4525,13 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3829
4525
|
}
|
|
3830
4526
|
}
|
|
3831
4527
|
#preprocessGraph() {
|
|
3832
|
-
var _a;
|
|
4528
|
+
var _a, _b;
|
|
3833
4529
|
const profileStart = this.#startRuntimeProfile();
|
|
3834
4530
|
try {
|
|
3835
4531
|
const runtimeCache = this.#canUseRuntimeExecutionPlanCache() ? this.#runtimeCache : void 0;
|
|
3836
4532
|
const shouldUseRuntimeCache = runtimeCache != null;
|
|
3837
4533
|
const cachedPlan = (_a = runtimeCache == null ? void 0 : runtimeCache.executionPlans) == null ? void 0 : _a.get(this.#graph);
|
|
3838
|
-
if (cachedPlan) {
|
|
4534
|
+
if (cachedPlan && ((_b = runtimeCache == null ? void 0 : runtimeCache.executionPlanNodePrefabs) == null ? void 0 : _b.get(this.#graph)) === this.#project.nodePrefabs) {
|
|
3839
4535
|
this.#applyPreprocessedGraph(cachedPlan, { recreateNodeInstances: true });
|
|
3840
4536
|
return;
|
|
3841
4537
|
}
|
|
@@ -3852,7 +4548,9 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3852
4548
|
});
|
|
3853
4549
|
if (shouldUseRuntimeCache && isGraphExecutionPlan(preprocessedGraph)) {
|
|
3854
4550
|
runtimeCache.executionPlans ??= /* @__PURE__ */ new WeakMap();
|
|
4551
|
+
runtimeCache.executionPlanNodePrefabs ??= /* @__PURE__ */ new WeakMap();
|
|
3855
4552
|
runtimeCache.executionPlans.set(this.#graph, toReusableGraphExecutionPlan(preprocessedGraph));
|
|
4553
|
+
runtimeCache.executionPlanNodePrefabs.set(this.#graph, this.#project.nodePrefabs);
|
|
3856
4554
|
}
|
|
3857
4555
|
this.#applyPreprocessedGraph(preprocessedGraph);
|
|
3858
4556
|
} finally {
|
|
@@ -3883,7 +4581,9 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
3883
4581
|
return getGraphBoundary(project, graphId, this.#runtimeCache.graphBoundaries);
|
|
3884
4582
|
}
|
|
3885
4583
|
#applyPreprocessedGraph(preprocessedGraph, options2 = {}) {
|
|
3886
|
-
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;
|
|
3887
4587
|
replaceRecordContents(this.#nodeInstances, nodeInstances);
|
|
3888
4588
|
replaceRecordContents(this.#nodesById, preprocessedGraph.nodesById);
|
|
3889
4589
|
replaceRecordContents(this.#connections, preprocessedGraph.connections);
|
|
@@ -4046,6 +4746,9 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
4046
4746
|
this.#visitedNodes.add(nodeId);
|
|
4047
4747
|
this.#hasPreloadedData = true;
|
|
4048
4748
|
}
|
|
4749
|
+
setFrozenNodeOutputResolver(resolver) {
|
|
4750
|
+
this.#frozenNodeOutputResolver = resolver;
|
|
4751
|
+
}
|
|
4049
4752
|
/** Gets all node IDs that a given node ID depends on being complete before the given node ID can start. */
|
|
4050
4753
|
getDependencyNodesDeep(nodeId) {
|
|
4051
4754
|
this.#ensureGraphPreprocessed();
|
|
@@ -4131,6 +4834,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
4131
4834
|
this.#globals ??= /* @__PURE__ */ new Map();
|
|
4132
4835
|
this.#ignoreNodes = /* @__PURE__ */ new Set();
|
|
4133
4836
|
this.#nodeProcessContextBase = void 0;
|
|
4837
|
+
this.#runToRelevantNodeIds = void 0;
|
|
4134
4838
|
this.#abortController = this.#newAbortController();
|
|
4135
4839
|
this.#abortController.signal.addEventListener("abort", () => {
|
|
4136
4840
|
this.#aborted = true;
|
|
@@ -4438,12 +5142,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4438
5142
|
throw error;
|
|
4439
5143
|
}
|
|
4440
5144
|
async #finalizeGraphRun() {
|
|
4441
|
-
|
|
4442
|
-
this.#graphOutputs["cost"] = {
|
|
4443
|
-
type: "number",
|
|
4444
|
-
value: this.#totalCost
|
|
4445
|
-
};
|
|
4446
|
-
}
|
|
5145
|
+
ensureGraphCostOutput(this.#graphOutputs, this.#totalCost);
|
|
4447
5146
|
const outputValues = this.#graphOutputs;
|
|
4448
5147
|
this.#running = false;
|
|
4449
5148
|
await this.#emitter.emit("graphFinish", this.#withExecution({ graph: this.#graph, outputs: outputValues }));
|
|
@@ -4601,7 +5300,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4601
5300
|
const processProfileStart = this.#startRuntimeProfile();
|
|
4602
5301
|
let processResult;
|
|
4603
5302
|
try {
|
|
4604
|
-
processResult = await this.#processNode(node);
|
|
5303
|
+
processResult = await this.#processNode(node, inputValues);
|
|
4605
5304
|
} finally {
|
|
4606
5305
|
this.#finishRuntimeProfile("nodeDispatch", processProfileStart);
|
|
4607
5306
|
}
|
|
@@ -4789,17 +5488,20 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4789
5488
|
}
|
|
4790
5489
|
return nodeData;
|
|
4791
5490
|
}
|
|
4792
|
-
async #processNode(node) {
|
|
5491
|
+
async #processNode(node, inputValues) {
|
|
4793
5492
|
const processId = (0, import_non_secure4.nanoid)();
|
|
4794
5493
|
if (this.#abortController.signal.aborted) {
|
|
4795
5494
|
await this.#nodeErrored(node, createGraphAbortErrorFromSignal(this.#abortController.signal), processId);
|
|
4796
5495
|
this.#successfulAbortTerminalProcessIds.delete(processId);
|
|
4797
5496
|
return { processId, shouldQueueOutputNodes: false };
|
|
4798
5497
|
}
|
|
4799
|
-
|
|
5498
|
+
const frozenOutputs = this.#resolveFrozenNodeOutputs(node, inputValues, processId);
|
|
5499
|
+
if (frozenOutputs) {
|
|
5500
|
+
await this.#processFrozenNode(node, processId, inputValues, frozenOutputs);
|
|
5501
|
+
} else if (node.isSplitRun) {
|
|
4800
5502
|
await this.#processSplitRunNode(node, processId);
|
|
4801
5503
|
} else {
|
|
4802
|
-
await this.#processNormalNode(node, processId);
|
|
5504
|
+
await this.#processNormalNode(node, processId, inputValues);
|
|
4803
5505
|
}
|
|
4804
5506
|
const successfulAbortTerminal = this.#successfulAbortTerminalProcessIds.delete(processId);
|
|
4805
5507
|
return { processId, shouldQueueOutputNodes: !successfulAbortTerminal };
|
|
@@ -4827,13 +5529,50 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
4827
5529
|
finishNodeTiming: this.#captureNodeTimings ? (start) => this.#finishNodeTiming(start) : void 0
|
|
4828
5530
|
});
|
|
4829
5531
|
}
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
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) {
|
|
4835
5566
|
return;
|
|
4836
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) {
|
|
4837
5576
|
await this.#emitter.emit("nodeStart", this.#withExecution({ node, inputs: inputValues, processId }));
|
|
4838
5577
|
const timingStart = this.#startNodeTiming();
|
|
4839
5578
|
try {
|
|
@@ -5027,14 +5766,17 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
5027
5766
|
return this.#context.tokenizer;
|
|
5028
5767
|
}
|
|
5029
5768
|
#createNodeProcessContext(node, inputValues, index, processId, nodeAbortController, partialOutput) {
|
|
5769
|
+
var _a;
|
|
5030
5770
|
const plugin = this.#registry.getPluginFor(node.type);
|
|
5031
5771
|
return buildNodeProcessContext({
|
|
5772
|
+
activeOutputPortIds: this.#getActiveOutputPortIds(node),
|
|
5032
5773
|
attachedData: this.#getAttachedDataTo(node),
|
|
5033
5774
|
base: this.#nodeProcessContextBase,
|
|
5034
5775
|
createSubProcessor: (subGraphId, options2 = {}) => this.#createSubProcessor(node, index, processId, subGraphId, options2),
|
|
5035
5776
|
execution: this.#buildExecutionMetadata(),
|
|
5036
5777
|
externalFunctions: this.#externalFunctions,
|
|
5037
5778
|
getPluginConfig: (name) => getPluginConfig(plugin, this.#context.settings, name),
|
|
5779
|
+
isDirectRunTarget: ((_a = this.runToNodeIds) == null ? void 0 : _a.includes(node.id)) ?? false,
|
|
5038
5780
|
node,
|
|
5039
5781
|
nodeAbortController,
|
|
5040
5782
|
onPartialOutputs: (partialOutputs) => {
|
|
@@ -5060,6 +5802,42 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
5060
5802
|
}
|
|
5061
5803
|
});
|
|
5062
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
|
+
}
|
|
5063
5841
|
#emitGraphPartialOutputIfNeeded(node, partialOutputs) {
|
|
5064
5842
|
const { useAsGraphPartialOutput } = node.data ?? {};
|
|
5065
5843
|
if (!(useAsGraphPartialOutput && this.#executor && this.#parent)) {
|
|
@@ -5106,6 +5884,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
5106
5884
|
processor.#contextValues = this.#contextValues;
|
|
5107
5885
|
processor.#parent = this;
|
|
5108
5886
|
processor.#globals = this.#globals;
|
|
5887
|
+
processor.#frozenNodeOutputResolver = this.#frozenNodeOutputResolver;
|
|
5109
5888
|
processor.#executor = {
|
|
5110
5889
|
nodeId: node.id,
|
|
5111
5890
|
parentGraphId: this.#graph.metadata.id,
|
|
@@ -5253,6 +6032,367 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
5253
6032
|
}
|
|
5254
6033
|
};
|
|
5255
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;
|
|
6130
|
+
}
|
|
6131
|
+
return action.outputStateKey ? [{ outputKey: action.outputKey, stateKey: action.outputStateKey }] : [];
|
|
6132
|
+
}
|
|
6133
|
+
function getUiGraphActionInputBindings(action) {
|
|
6134
|
+
if (action.inputMappings) {
|
|
6135
|
+
return action.inputMappings;
|
|
6136
|
+
}
|
|
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
|
+
.rivet-web-app-modal-backdrop {
|
|
6347
|
+
position: fixed;
|
|
6348
|
+
inset: 0;
|
|
6349
|
+
z-index: 1000;
|
|
6350
|
+
display: grid;
|
|
6351
|
+
place-items: center;
|
|
6352
|
+
background: rgba(0, 0, 0, 0.46);
|
|
6353
|
+
background: color-mix(in srgb, var(--rivet-web-app-background) 78%, transparent);
|
|
6354
|
+
padding: 20px;
|
|
6355
|
+
}
|
|
6356
|
+
|
|
6357
|
+
.rivet-web-app-modal {
|
|
6358
|
+
display: grid;
|
|
6359
|
+
gap: 18px;
|
|
6360
|
+
width: min(420px, 100%);
|
|
6361
|
+
border: 1px solid var(--rivet-web-app-card-border);
|
|
6362
|
+
border-radius: 12px;
|
|
6363
|
+
background: var(--rivet-web-app-card-background);
|
|
6364
|
+
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
|
|
6365
|
+
color: var(--rivet-web-app-foreground);
|
|
6366
|
+
padding: 22px;
|
|
6367
|
+
}
|
|
6368
|
+
|
|
6369
|
+
.rivet-web-app-modal-message {
|
|
6370
|
+
font-size: 18px;
|
|
6371
|
+
font-weight: 700;
|
|
6372
|
+
line-height: 1.3;
|
|
6373
|
+
}
|
|
6374
|
+
|
|
6375
|
+
.rivet-web-app-modal-button {
|
|
6376
|
+
justify-self: start;
|
|
6377
|
+
}
|
|
6378
|
+
`;
|
|
6379
|
+
var RIVET_WEB_APP_DOCUMENT_CSS = `
|
|
6380
|
+
html,
|
|
6381
|
+
body {
|
|
6382
|
+
height: 100%;
|
|
6383
|
+
margin: 0;
|
|
6384
|
+
}
|
|
6385
|
+
|
|
6386
|
+
body {
|
|
6387
|
+
min-height: 100vh;
|
|
6388
|
+
background: #1c222b;
|
|
6389
|
+
}
|
|
6390
|
+
|
|
6391
|
+
#app {
|
|
6392
|
+
min-height: 100vh;
|
|
6393
|
+
}
|
|
6394
|
+
`;
|
|
6395
|
+
|
|
5256
6396
|
// src/model/NodeImpl.ts
|
|
5257
6397
|
var NodeImpl = class {
|
|
5258
6398
|
chartNode;
|
|
@@ -6933,7 +8073,6 @@ async function applyOpenAIStreamingResponse(params) {
|
|
|
6933
8073
|
};
|
|
6934
8074
|
}
|
|
6935
8075
|
output["cost"] = { type: "number", value: totalCost };
|
|
6936
|
-
output["__hidden_token_count"] = { type: "number", value: inputTokenCount + outputTokenCount };
|
|
6937
8076
|
}
|
|
6938
8077
|
function handleOpenAIRetryableFailure(params) {
|
|
6939
8078
|
var _a, _b;
|
|
@@ -7937,7 +9076,7 @@ function createChatV2CommonNodeData(overrides = {}) {
|
|
|
7937
9076
|
useModelInput: false,
|
|
7938
9077
|
temperature: 0.5,
|
|
7939
9078
|
useTemperatureInput: false,
|
|
7940
|
-
topP:
|
|
9079
|
+
topP: void 0,
|
|
7941
9080
|
useTopPInput: false,
|
|
7942
9081
|
topK: void 0,
|
|
7943
9082
|
useTopKInput: false,
|
|
@@ -8098,7 +9237,7 @@ function getCommonChatV2Outputs(data, options2 = {}) {
|
|
|
8098
9237
|
if (includeFunctionCalls) {
|
|
8099
9238
|
outputs.push({
|
|
8100
9239
|
id: functionCallsPortId,
|
|
8101
|
-
title: "
|
|
9240
|
+
title: "Tool Calls",
|
|
8102
9241
|
dataType: "object[]"
|
|
8103
9242
|
});
|
|
8104
9243
|
}
|
|
@@ -8899,6 +10038,57 @@ function openAIBaseURLToEndpoint(baseURL) {
|
|
|
8899
10038
|
return `${normalizedBaseURL}/chat/completions`;
|
|
8900
10039
|
}
|
|
8901
10040
|
}
|
|
10041
|
+
function parseBodyText(text) {
|
|
10042
|
+
try {
|
|
10043
|
+
return JSON.parse(text);
|
|
10044
|
+
} catch {
|
|
10045
|
+
return text;
|
|
10046
|
+
}
|
|
10047
|
+
}
|
|
10048
|
+
function parseFetchBody(body) {
|
|
10049
|
+
if (body == null) {
|
|
10050
|
+
return void 0;
|
|
10051
|
+
}
|
|
10052
|
+
if (typeof body === "string") {
|
|
10053
|
+
return parseBodyText(body);
|
|
10054
|
+
}
|
|
10055
|
+
if (body instanceof URLSearchParams) {
|
|
10056
|
+
return Object.fromEntries(body.entries());
|
|
10057
|
+
}
|
|
10058
|
+
if (body instanceof ArrayBuffer) {
|
|
10059
|
+
return parseBodyText(new TextDecoder().decode(body));
|
|
10060
|
+
}
|
|
10061
|
+
if (ArrayBuffer.isView(body)) {
|
|
10062
|
+
return parseBodyText(new TextDecoder().decode(body));
|
|
10063
|
+
}
|
|
10064
|
+
return void 0;
|
|
10065
|
+
}
|
|
10066
|
+
function cloneCapturedRequestBody(body) {
|
|
10067
|
+
if (typeof structuredClone === "function") {
|
|
10068
|
+
try {
|
|
10069
|
+
return structuredClone(body);
|
|
10070
|
+
} catch {
|
|
10071
|
+
}
|
|
10072
|
+
}
|
|
10073
|
+
try {
|
|
10074
|
+
return JSON.parse(JSON.stringify(body));
|
|
10075
|
+
} catch {
|
|
10076
|
+
return body;
|
|
10077
|
+
}
|
|
10078
|
+
}
|
|
10079
|
+
function createRequestBodyCapturingFetch(onRequestBody) {
|
|
10080
|
+
return async (input, init2) => {
|
|
10081
|
+
const body = parseFetchBody(init2 == null ? void 0 : init2.body);
|
|
10082
|
+
if (body !== void 0) {
|
|
10083
|
+
onRequestBody(cloneCapturedRequestBody(body));
|
|
10084
|
+
}
|
|
10085
|
+
const nativeFetch = globalThis.fetch;
|
|
10086
|
+
return nativeFetch(input, init2);
|
|
10087
|
+
};
|
|
10088
|
+
}
|
|
10089
|
+
function maybeCreateRequestBodyCapturingFetch(options2) {
|
|
10090
|
+
return options2.onRequestBody == null ? void 0 : createRequestBodyCapturingFetch(options2.onRequestBody);
|
|
10091
|
+
}
|
|
8902
10092
|
async function resolveChatV2ProviderConfig(provider, modelId, context, options2 = {}) {
|
|
8903
10093
|
var _a;
|
|
8904
10094
|
const headers = cleanHeaders({
|
|
@@ -8952,7 +10142,8 @@ function createChatV2Model(provider, modelId, context, options2 = {}) {
|
|
|
8952
10142
|
apiKey: options2.apiKey || context.settings.openAiKey || void 0,
|
|
8953
10143
|
organization: context.settings.openAiOrganization || void 0,
|
|
8954
10144
|
baseURL: options2.baseURL || void 0,
|
|
8955
|
-
headers: options2.headers
|
|
10145
|
+
headers: options2.headers,
|
|
10146
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options2)
|
|
8956
10147
|
});
|
|
8957
10148
|
return providerInstance.responses(modelId);
|
|
8958
10149
|
}
|
|
@@ -8960,7 +10151,8 @@ function createChatV2Model(provider, modelId, context, options2 = {}) {
|
|
|
8960
10151
|
const providerInstance = (0, import_anthropic2.createAnthropic)({
|
|
8961
10152
|
apiKey: options2.apiKey || context.getPluginConfig("anthropicApiKey") || void 0,
|
|
8962
10153
|
baseURL: options2.baseURL || context.getPluginConfig("anthropicApiEndpoint") || void 0,
|
|
8963
|
-
headers: options2.headers
|
|
10154
|
+
headers: options2.headers,
|
|
10155
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options2)
|
|
8964
10156
|
});
|
|
8965
10157
|
return providerInstance.messages(modelId);
|
|
8966
10158
|
}
|
|
@@ -8968,7 +10160,8 @@ function createChatV2Model(provider, modelId, context, options2 = {}) {
|
|
|
8968
10160
|
const providerInstance = (0, import_google2.createGoogleGenerativeAI)({
|
|
8969
10161
|
apiKey: options2.apiKey || context.getPluginConfig("googleApiKey") || void 0,
|
|
8970
10162
|
baseURL: options2.baseURL || void 0,
|
|
8971
|
-
headers: options2.headers
|
|
10163
|
+
headers: options2.headers,
|
|
10164
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options2)
|
|
8972
10165
|
});
|
|
8973
10166
|
return providerInstance.chat(modelId);
|
|
8974
10167
|
}
|
|
@@ -8981,9 +10174,12 @@ function createChatV2Model(provider, modelId, context, options2 = {}) {
|
|
|
8981
10174
|
apiKey: options2.apiKey,
|
|
8982
10175
|
baseURL: options2.baseURL,
|
|
8983
10176
|
headers: options2.headers,
|
|
8984
|
-
includeUsage:
|
|
10177
|
+
includeUsage: false,
|
|
10178
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options2)
|
|
8985
10179
|
});
|
|
8986
|
-
|
|
10180
|
+
const model = providerInstance.chatModel(modelId);
|
|
10181
|
+
model.supportsStructuredOutputs = true;
|
|
10182
|
+
return model;
|
|
8987
10183
|
}
|
|
8988
10184
|
}
|
|
8989
10185
|
}
|
|
@@ -9291,7 +10487,7 @@ function getResponseFormatEditors() {
|
|
|
9291
10487
|
options: [
|
|
9292
10488
|
{ value: "", label: "Default" },
|
|
9293
10489
|
{ value: "text", label: "Text" },
|
|
9294
|
-
{ value: "json", label: "JSON" },
|
|
10490
|
+
{ value: "json", label: "JSON object" },
|
|
9295
10491
|
{ value: "json_schema", label: "JSON schema" }
|
|
9296
10492
|
],
|
|
9297
10493
|
defaultValue: "",
|
|
@@ -9303,7 +10499,7 @@ function getResponseFormatEditors() {
|
|
|
9303
10499
|
dataKey: "responseSchemaName",
|
|
9304
10500
|
useInputToggleDataKey: "useResponseSchemaNameInput",
|
|
9305
10501
|
placeholder: "response_schema",
|
|
9306
|
-
helperMessage: "Optional name passed to the provider for JSON or JSON schema responses.",
|
|
10502
|
+
helperMessage: "Optional name passed to the provider for JSON object or JSON schema responses.",
|
|
9307
10503
|
hideIf: (data) => data.responseFormat !== "json" && data.responseFormat !== "json_schema"
|
|
9308
10504
|
},
|
|
9309
10505
|
{
|
|
@@ -9311,7 +10507,7 @@ function getResponseFormatEditors() {
|
|
|
9311
10507
|
label: "Schema description",
|
|
9312
10508
|
dataKey: "responseSchemaDescription",
|
|
9313
10509
|
useInputToggleDataKey: "useResponseSchemaDescriptionInput",
|
|
9314
|
-
helperMessage: "Optional description passed to the provider for JSON or JSON schema responses.",
|
|
10510
|
+
helperMessage: "Optional description passed to the provider for JSON object or JSON schema responses.",
|
|
9315
10511
|
hideIf: (data) => data.responseFormat !== "json" && data.responseFormat !== "json_schema"
|
|
9316
10512
|
}
|
|
9317
10513
|
]);
|
|
@@ -9450,9 +10646,9 @@ function getTechnicalDetailsEditors() {
|
|
|
9450
10646
|
},
|
|
9451
10647
|
{
|
|
9452
10648
|
type: "toggle",
|
|
9453
|
-
label: "Output request
|
|
10649
|
+
label: "Output request details",
|
|
9454
10650
|
dataKey: "outputRequestStatus",
|
|
9455
|
-
helperMessage: "Adds Response Status
|
|
10651
|
+
helperMessage: "Adds Response Status, Response Error, and LLM request body outputs. Retry mode changes status/error to per-attempt arrays, and LLM request body becomes an array when multiple provider calls are made."
|
|
9456
10652
|
}
|
|
9457
10653
|
]);
|
|
9458
10654
|
}
|
|
@@ -9601,7 +10797,7 @@ function resolveChatV2ResponseFormatParameters(data, inputs) {
|
|
|
9601
10797
|
schemaDescription
|
|
9602
10798
|
};
|
|
9603
10799
|
}
|
|
9604
|
-
function createChatV2ResponseOutput(parameters) {
|
|
10800
|
+
function createChatV2ResponseOutput(parameters, provider) {
|
|
9605
10801
|
if (parameters == null) {
|
|
9606
10802
|
return void 0;
|
|
9607
10803
|
}
|
|
@@ -9609,6 +10805,9 @@ function createChatV2ResponseOutput(parameters) {
|
|
|
9609
10805
|
return import_ai.Output.text();
|
|
9610
10806
|
}
|
|
9611
10807
|
if (parameters.responseFormat === "json") {
|
|
10808
|
+
if (provider === "custom") {
|
|
10809
|
+
return void 0;
|
|
10810
|
+
}
|
|
9612
10811
|
return import_ai.Output.json({
|
|
9613
10812
|
name: parameters.schemaName,
|
|
9614
10813
|
description: parameters.schemaDescription
|
|
@@ -9662,7 +10861,7 @@ var LLM_CHAT_V2_TOOL_RESPONSE_FORMAT_CONFLICT_COPY = {
|
|
|
9662
10861
|
title: '"Tool use" conflicts with "Structured outputs"',
|
|
9663
10862
|
paragraphs: [
|
|
9664
10863
|
'"Tool use" and "Structured outputs" cannot be used at the same time.',
|
|
9665
|
-
'Use "Tool use" with Default/Text response format, or turn "Tool use" off before choosing JSON/JSON schema.'
|
|
10864
|
+
'Use "Tool use" with Default/Text response format, or turn "Tool use" off before choosing JSON object/JSON schema.'
|
|
9666
10865
|
]
|
|
9667
10866
|
};
|
|
9668
10867
|
function isLLMChatV2StructuredResponseFormat(responseFormat) {
|
|
@@ -9676,9 +10875,9 @@ function createsLLMChatV2ToolResponseFormatConflictForEdit(previousData, nextDat
|
|
|
9676
10875
|
}
|
|
9677
10876
|
|
|
9678
10877
|
// src/model/chat-v2/chatV2EditorCache.ts
|
|
9679
|
-
var
|
|
10878
|
+
var import_safe_stable_stringify4 = __toESM(require("safe-stable-stringify"), 1);
|
|
9680
10879
|
function buildLLMChatV2EditorCacheKey(parts) {
|
|
9681
|
-
return (0,
|
|
10880
|
+
return (0, import_safe_stable_stringify4.default)(parts) ?? "";
|
|
9682
10881
|
}
|
|
9683
10882
|
function cloneEditorCacheValue(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
9684
10883
|
if (value == null || typeof value !== "object") {
|
|
@@ -9754,7 +10953,7 @@ function fingerprintProviderOptionsForCache(providerOptions) {
|
|
|
9754
10953
|
if (providerOptions == null) {
|
|
9755
10954
|
return void 0;
|
|
9756
10955
|
}
|
|
9757
|
-
return fingerprintSecret((0,
|
|
10956
|
+
return fingerprintSecret((0, import_safe_stable_stringify4.default)(providerOptions) ?? "");
|
|
9758
10957
|
}
|
|
9759
10958
|
function resolveLLMChatV2EditorCache(params) {
|
|
9760
10959
|
const { editorCache } = params;
|
|
@@ -10026,11 +11225,16 @@ async function resolveLLMChatV2RuntimeConfig(params) {
|
|
|
10026
11225
|
const baseURL = resolveLLMChatV2BaseURL(data, inputs);
|
|
10027
11226
|
const nodeHeaders = resolveLLMChatV2Headers(data, inputs);
|
|
10028
11227
|
const apiKey = resolveLLMChatV2ApiKey(data, inputs, context);
|
|
11228
|
+
const requestBodies = data.outputRequestStatus ? [] : void 0;
|
|
10029
11229
|
const providerConfig = await resolveChatV2ProviderConfig(provider, modelId, context, {
|
|
10030
11230
|
baseURL,
|
|
10031
11231
|
headers: nodeHeaders
|
|
10032
11232
|
});
|
|
10033
|
-
const model = createChatV2Model(provider, modelId, context, {
|
|
11233
|
+
const model = createChatV2Model(provider, modelId, context, {
|
|
11234
|
+
...providerConfig,
|
|
11235
|
+
apiKey,
|
|
11236
|
+
onRequestBody: requestBodies == null ? void 0 : (body) => requestBodies.push(body)
|
|
11237
|
+
});
|
|
10034
11238
|
const prompt = inputs["prompt"];
|
|
10035
11239
|
const systemPrompt = inputs["systemPrompt"];
|
|
10036
11240
|
const functions = data.useToolCalling && inputs["functions"] != null ? coerceTypeOptional(inputs["functions"], "gpt-function[]") : void 0;
|
|
@@ -10051,7 +11255,7 @@ async function resolveLLMChatV2RuntimeConfig(params) {
|
|
|
10051
11255
|
functions,
|
|
10052
11256
|
additionalTools: resolveLLMChatV2BuiltInTools(data, context, providerConfig, apiKey),
|
|
10053
11257
|
...generationParameters,
|
|
10054
|
-
responseOutput: createChatV2ResponseOutput(responseFormatParameters),
|
|
11258
|
+
responseOutput: createChatV2ResponseOutput(responseFormatParameters, provider),
|
|
10055
11259
|
responseFormat: responseFormatParameters == null ? void 0 : responseFormatParameters.responseFormat,
|
|
10056
11260
|
outputUsage: data.outputUsage,
|
|
10057
11261
|
outputReasoning: data.outputReasoning,
|
|
@@ -10061,6 +11265,7 @@ async function resolveLLMChatV2RuntimeConfig(params) {
|
|
|
10061
11265
|
providerOptions,
|
|
10062
11266
|
toolChoice,
|
|
10063
11267
|
anthropicCacheControlTtl: provider === "anthropic" ? data.anthropicCacheControlTtl || void 0 : void 0,
|
|
11268
|
+
requestBodies,
|
|
10064
11269
|
retryOnNon200: data.retryOnNon200,
|
|
10065
11270
|
retryOnNon200RepeatTimes: data.retryOnNon200RepeatTimes,
|
|
10066
11271
|
retryOnNon200CooldownMs: data.retryOnNon200CooldownMs,
|
|
@@ -10187,6 +11392,9 @@ function defaultStreamExecutor(args) {
|
|
|
10187
11392
|
usage: "usage" in result ? keepPromiseHandled(Promise.resolve(result.usage)) : void 0
|
|
10188
11393
|
};
|
|
10189
11394
|
}
|
|
11395
|
+
async function defaultGenerateExecutor(args) {
|
|
11396
|
+
return await (0, import_ai2.generateText)(args);
|
|
11397
|
+
}
|
|
10190
11398
|
async function resolveOptionalValue(value) {
|
|
10191
11399
|
return value == null ? void 0 : await value;
|
|
10192
11400
|
}
|
|
@@ -10200,6 +11408,51 @@ async function resolveOptionalStructuredOutput(value) {
|
|
|
10200
11408
|
return void 0;
|
|
10201
11409
|
}
|
|
10202
11410
|
}
|
|
11411
|
+
async function resolveGenerateStructuredOutput(result, responseOutput, finishReason) {
|
|
11412
|
+
if (responseOutput == null || finishReason != null && finishReason !== "stop") {
|
|
11413
|
+
return void 0;
|
|
11414
|
+
}
|
|
11415
|
+
try {
|
|
11416
|
+
return await resolveOptionalStructuredOutput(result.output);
|
|
11417
|
+
} catch {
|
|
11418
|
+
return void 0;
|
|
11419
|
+
}
|
|
11420
|
+
}
|
|
11421
|
+
function recoverGenerateStructuredOutputError(error, options2, toolCalls) {
|
|
11422
|
+
if (options2.responseOutput == null || !isChatV2StructuredResponseFormat(options2.responseFormat)) {
|
|
11423
|
+
return void 0;
|
|
11424
|
+
}
|
|
11425
|
+
if (!import_ai2.NoObjectGeneratedError.isInstance(error)) {
|
|
11426
|
+
return void 0;
|
|
11427
|
+
}
|
|
11428
|
+
if (typeof error.text !== "string") {
|
|
11429
|
+
return void 0;
|
|
11430
|
+
}
|
|
11431
|
+
const rawText = error.text;
|
|
11432
|
+
const responseText = collapseRepeatedStructuredJsonText(rawText);
|
|
11433
|
+
return {
|
|
11434
|
+
responseText,
|
|
11435
|
+
structuredOutput: void 0,
|
|
11436
|
+
functionCalls: toStreamedFunctionCalls(toolCalls),
|
|
11437
|
+
usage: error.usage,
|
|
11438
|
+
reasoning: "",
|
|
11439
|
+
finishReason: error.finishReason == null ? void 0 : String(error.finishReason),
|
|
11440
|
+
providerMetadata: void 0,
|
|
11441
|
+
requestStatus: void 0
|
|
11442
|
+
};
|
|
11443
|
+
}
|
|
11444
|
+
function attachGenerateStepToolCallCollector(args) {
|
|
11445
|
+
const toolCalls = [];
|
|
11446
|
+
const previousOnStepFinish = args.onStepFinish;
|
|
11447
|
+
args.onStepFinish = async (event) => {
|
|
11448
|
+
const stepToolCalls = event.toolCalls;
|
|
11449
|
+
if (stepToolCalls != null) {
|
|
11450
|
+
toolCalls.push(...stepToolCalls);
|
|
11451
|
+
}
|
|
11452
|
+
await (previousOnStepFinish == null ? void 0 : previousOnStepFinish(event));
|
|
11453
|
+
};
|
|
11454
|
+
return toolCalls;
|
|
11455
|
+
}
|
|
10203
11456
|
function collapseRepeatedStructuredJsonText(responseText) {
|
|
10204
11457
|
if (responseText.length === 0 || responseText.length % 2 !== 0) {
|
|
10205
11458
|
return responseText;
|
|
@@ -10220,10 +11473,11 @@ function collapseRepeatedStructuredJsonText(responseText) {
|
|
|
10220
11473
|
return responseText;
|
|
10221
11474
|
}
|
|
10222
11475
|
}
|
|
10223
|
-
|
|
11476
|
+
function buildTextArgs(options2) {
|
|
10224
11477
|
const args = {
|
|
10225
11478
|
model: options2.model,
|
|
10226
|
-
messages: options2.messages
|
|
11479
|
+
messages: options2.messages,
|
|
11480
|
+
maxRetries: 0
|
|
10227
11481
|
};
|
|
10228
11482
|
if (options2.tools !== void 0)
|
|
10229
11483
|
args.tools = options2.tools;
|
|
@@ -10251,6 +11505,27 @@ async function executeStream(options2, executor) {
|
|
|
10251
11505
|
args.toolChoice = options2.toolChoice;
|
|
10252
11506
|
if (options2.abortSignal !== void 0)
|
|
10253
11507
|
args.abortSignal = options2.abortSignal;
|
|
11508
|
+
return args;
|
|
11509
|
+
}
|
|
11510
|
+
function toStreamedFunctionCalls(toolCalls) {
|
|
11511
|
+
return (toolCalls ?? []).map((toolCall) => ({
|
|
11512
|
+
type: "function",
|
|
11513
|
+
id: toolCall.toolCallId,
|
|
11514
|
+
name: toolCall.toolName,
|
|
11515
|
+
arguments: JSON.stringify(toolCall.input),
|
|
11516
|
+
lastParsedArguments: toolCall.input
|
|
11517
|
+
}));
|
|
11518
|
+
}
|
|
11519
|
+
async function resolveGenerateReasoning(result) {
|
|
11520
|
+
var _a;
|
|
11521
|
+
const reasoningText = await resolveOptionalValue(result.reasoningText);
|
|
11522
|
+
if (reasoningText != null && reasoningText.trim().length > 0) {
|
|
11523
|
+
return reasoningText;
|
|
11524
|
+
}
|
|
11525
|
+
return ((_a = await resolveOptionalValue(result.reasoning)) == null ? void 0 : _a.map((part) => part.text).join("")) ?? "";
|
|
11526
|
+
}
|
|
11527
|
+
async function executeStream(options2, executor) {
|
|
11528
|
+
const args = buildTextArgs(options2);
|
|
10254
11529
|
const handle = await executor(args);
|
|
10255
11530
|
markOptionalPromiseHandled(handle.finishReason);
|
|
10256
11531
|
markOptionalPromiseHandled(handle.output);
|
|
@@ -10286,6 +11561,35 @@ async function executeStream(options2, executor) {
|
|
|
10286
11561
|
async function streamChatV2(options2) {
|
|
10287
11562
|
return executeStream(options2, options2.executeStream ?? defaultStreamExecutor);
|
|
10288
11563
|
}
|
|
11564
|
+
async function generateChatV2(options2) {
|
|
11565
|
+
const args = buildTextArgs(options2);
|
|
11566
|
+
const stepToolCalls = attachGenerateStepToolCallCollector(args);
|
|
11567
|
+
let result;
|
|
11568
|
+
try {
|
|
11569
|
+
result = await (options2.executeGenerate ?? defaultGenerateExecutor)(args);
|
|
11570
|
+
} catch (error) {
|
|
11571
|
+
const recovered = recoverGenerateStructuredOutputError(error, options2, stepToolCalls);
|
|
11572
|
+
if (recovered != null) {
|
|
11573
|
+
return recovered;
|
|
11574
|
+
}
|
|
11575
|
+
throw error;
|
|
11576
|
+
}
|
|
11577
|
+
const isStructuredOutput = isChatV2StructuredResponseFormat(options2.responseFormat);
|
|
11578
|
+
const responseText = isStructuredOutput ? collapseRepeatedStructuredJsonText(result.text) : result.text;
|
|
11579
|
+
const finishReason = await resolveOptionalValue(result.finishReason);
|
|
11580
|
+
return {
|
|
11581
|
+
responseText,
|
|
11582
|
+
structuredOutput: await resolveGenerateStructuredOutput(result, options2.responseOutput, finishReason),
|
|
11583
|
+
functionCalls: toStreamedFunctionCalls(
|
|
11584
|
+
result.toolCalls != null && result.toolCalls.length > 0 ? result.toolCalls : stepToolCalls
|
|
11585
|
+
),
|
|
11586
|
+
usage: await resolveOptionalValue(result.totalUsage) ?? await resolveOptionalValue(result.usage),
|
|
11587
|
+
reasoning: await resolveGenerateReasoning(result),
|
|
11588
|
+
finishReason,
|
|
11589
|
+
providerMetadata: await resolveOptionalValue(result.providerMetadata),
|
|
11590
|
+
requestStatus: await resolveOptionalValue(result.requestStatus)
|
|
11591
|
+
};
|
|
11592
|
+
}
|
|
10289
11593
|
|
|
10290
11594
|
// src/model/chat-v2/messageConverter.ts
|
|
10291
11595
|
function mergeProviderMetadata(base, extra) {
|
|
@@ -10503,7 +11807,7 @@ function compact(value, maxLength = 500) {
|
|
|
10503
11807
|
const normalized = value.replace(/\s+/g, " ").trim();
|
|
10504
11808
|
return normalized.length > maxLength ? `${normalized.slice(0, maxLength - 3)}...` : normalized;
|
|
10505
11809
|
}
|
|
10506
|
-
function
|
|
11810
|
+
function isRecord2(value) {
|
|
10507
11811
|
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
10508
11812
|
}
|
|
10509
11813
|
function stringifyProviderValue(value) {
|
|
@@ -10523,7 +11827,7 @@ function stringifyProviderValue(value) {
|
|
|
10523
11827
|
}
|
|
10524
11828
|
}
|
|
10525
11829
|
function findProviderMessage(value) {
|
|
10526
|
-
if (!
|
|
11830
|
+
if (!isRecord2(value)) {
|
|
10527
11831
|
return stringifyProviderValue(value);
|
|
10528
11832
|
}
|
|
10529
11833
|
const direct = value.message ?? value.error_description ?? value.detail;
|
|
@@ -10611,7 +11915,7 @@ function getRecordStatusCode(record) {
|
|
|
10611
11915
|
return coerceHttpStatusCode(record.statusCode) ?? coerceHttpStatusCode(record.status);
|
|
10612
11916
|
}
|
|
10613
11917
|
function getChatV2ProviderErrorStatusCode(error, seen = /* @__PURE__ */ new Set()) {
|
|
10614
|
-
if (!
|
|
11918
|
+
if (!isRecord2(error)) {
|
|
10615
11919
|
return void 0;
|
|
10616
11920
|
}
|
|
10617
11921
|
if (seen.has(error)) {
|
|
@@ -10623,20 +11927,20 @@ function getChatV2ProviderErrorStatusCode(error, seen = /* @__PURE__ */ new Set(
|
|
|
10623
11927
|
return directStatusCode;
|
|
10624
11928
|
}
|
|
10625
11929
|
const response = error.response;
|
|
10626
|
-
if (
|
|
11930
|
+
if (isRecord2(response)) {
|
|
10627
11931
|
const responseStatusCode = getRecordStatusCode(response);
|
|
10628
11932
|
if (responseStatusCode != null) {
|
|
10629
11933
|
return responseStatusCode;
|
|
10630
11934
|
}
|
|
10631
11935
|
}
|
|
10632
11936
|
const data = error.data;
|
|
10633
|
-
if (
|
|
11937
|
+
if (isRecord2(data)) {
|
|
10634
11938
|
const dataStatusCode = getRecordStatusCode(data);
|
|
10635
11939
|
if (dataStatusCode != null) {
|
|
10636
11940
|
return dataStatusCode;
|
|
10637
11941
|
}
|
|
10638
11942
|
const dataError = data.error;
|
|
10639
|
-
if (
|
|
11943
|
+
if (isRecord2(dataError)) {
|
|
10640
11944
|
const dataErrorStatusCode = getRecordStatusCode(dataError);
|
|
10641
11945
|
if (dataErrorStatusCode != null) {
|
|
10642
11946
|
return dataErrorStatusCode;
|
|
@@ -10731,6 +12035,7 @@ function normalizeChatV2ProviderError(error, context) {
|
|
|
10731
12035
|
// src/model/chat-v2/chatV2Outputs.ts
|
|
10732
12036
|
var CHAT_V2_REQUEST_STATUS_PORT_ID = "requestStatus";
|
|
10733
12037
|
var CHAT_V2_REQUEST_ERROR_PORT_ID = "requestError";
|
|
12038
|
+
var CHAT_V2_REQUEST_BODY_PORT_ID = "requestBody";
|
|
10734
12039
|
function toFunctionCallOutputValue(functionCall) {
|
|
10735
12040
|
let argumentsValue = functionCall.lastParsedArguments;
|
|
10736
12041
|
if (argumentsValue == null) {
|
|
@@ -10799,6 +12104,12 @@ function createChatV2ReasoningOutput(reasoning) {
|
|
|
10799
12104
|
value: reasoningText
|
|
10800
12105
|
} : createControlFlowExcludedOutput();
|
|
10801
12106
|
}
|
|
12107
|
+
function createChatV2RequestBodyOutput(requestBodies) {
|
|
12108
|
+
if (requestBodies == null || requestBodies.length === 0) {
|
|
12109
|
+
return createControlFlowExcludedOutput();
|
|
12110
|
+
}
|
|
12111
|
+
return inferType(requestBodies.length === 1 ? requestBodies[0] : requestBodies);
|
|
12112
|
+
}
|
|
10802
12113
|
function createChatV2RetryAttemptOutput(type, values2) {
|
|
10803
12114
|
return values2.length > 0 ? {
|
|
10804
12115
|
type,
|
|
@@ -10816,6 +12127,7 @@ function createChatV2CommonOutputs({
|
|
|
10816
12127
|
responseError,
|
|
10817
12128
|
requestStatuses,
|
|
10818
12129
|
requestErrors,
|
|
12130
|
+
requestBodies,
|
|
10819
12131
|
outputUsage,
|
|
10820
12132
|
outputReasoning,
|
|
10821
12133
|
outputRequestStatus,
|
|
@@ -10873,6 +12185,7 @@ function createChatV2CommonOutputs({
|
|
|
10873
12185
|
value: responseError
|
|
10874
12186
|
} : createControlFlowExcludedOutput();
|
|
10875
12187
|
}
|
|
12188
|
+
outputs[CHAT_V2_REQUEST_BODY_PORT_ID] = createChatV2RequestBodyOutput(requestBodies);
|
|
10876
12189
|
}
|
|
10877
12190
|
return outputs;
|
|
10878
12191
|
}
|
|
@@ -10882,6 +12195,7 @@ function createChatV2ProviderFailureOutputs({
|
|
|
10882
12195
|
responseError,
|
|
10883
12196
|
requestStatuses,
|
|
10884
12197
|
requestErrors,
|
|
12198
|
+
requestBodies,
|
|
10885
12199
|
outputUsage,
|
|
10886
12200
|
outputReasoning,
|
|
10887
12201
|
includeFunctionCalls,
|
|
@@ -10910,6 +12224,7 @@ function createChatV2ProviderFailureOutputs({
|
|
|
10910
12224
|
},
|
|
10911
12225
|
["responseTokens"]: createControlFlowExcludedOutput()
|
|
10912
12226
|
};
|
|
12227
|
+
outputs[CHAT_V2_REQUEST_BODY_PORT_ID] = createChatV2RequestBodyOutput(requestBodies);
|
|
10913
12228
|
if (includeFunctionCalls) {
|
|
10914
12229
|
outputs["function-calls"] = createControlFlowExcludedOutput();
|
|
10915
12230
|
}
|
|
@@ -10923,17 +12238,17 @@ function createChatV2ProviderFailureOutputs({
|
|
|
10923
12238
|
}
|
|
10924
12239
|
|
|
10925
12240
|
// src/model/chat-v2/chatV2Pipeline.ts
|
|
10926
|
-
var
|
|
12241
|
+
var ChatV2RetryFailure = class extends Error {
|
|
10927
12242
|
constructor(error, requestStatuses, requestErrors) {
|
|
10928
12243
|
super("Chat v2 retry attempts failed");
|
|
10929
12244
|
this.error = error;
|
|
10930
12245
|
this.requestStatuses = requestStatuses;
|
|
10931
12246
|
this.requestErrors = requestErrors;
|
|
10932
|
-
this.name = "
|
|
12247
|
+
this.name = "ChatV2RetryFailure";
|
|
10933
12248
|
}
|
|
10934
12249
|
};
|
|
10935
|
-
function
|
|
10936
|
-
return error instanceof
|
|
12250
|
+
function isChatV2RetryFailure(error) {
|
|
12251
|
+
return error instanceof ChatV2RetryFailure;
|
|
10937
12252
|
}
|
|
10938
12253
|
function getProviderFailureMessage(error) {
|
|
10939
12254
|
if (error instanceof Error) {
|
|
@@ -10958,14 +12273,14 @@ function normalizeProviderFailureMessage(error, options2) {
|
|
|
10958
12273
|
function normalizeProviderFailureMessages(errors, options2) {
|
|
10959
12274
|
return errors.map((error) => normalizeProviderFailureMessage(error, options2));
|
|
10960
12275
|
}
|
|
10961
|
-
async function
|
|
12276
|
+
async function runChatV2WithRetry(chatOptions, retryOptions, transportMode) {
|
|
10962
12277
|
const repeatTimes = retryOptions.retryOnNon200 ? normalizeLLMChatV2RetryCount(retryOptions.retryOnNon200RepeatTimes) : 0;
|
|
10963
12278
|
const cooldownMs = normalizeLLMChatV2RetryCooldownMs(retryOptions.retryOnNon200CooldownMs);
|
|
10964
12279
|
const requestStatuses = [];
|
|
10965
12280
|
const requestErrors = [];
|
|
10966
12281
|
for (let attempt = 0; ; attempt++) {
|
|
10967
12282
|
try {
|
|
10968
|
-
const result = await streamChatV2(
|
|
12283
|
+
const result = transportMode === "generate" ? await generateChatV2(chatOptions) : await streamChatV2(chatOptions);
|
|
10969
12284
|
const statusCode = result.requestStatus ?? 200;
|
|
10970
12285
|
if (retryOptions.retryOnNon200) {
|
|
10971
12286
|
requestStatuses.push(statusCode);
|
|
@@ -10987,7 +12302,7 @@ async function streamChatV2WithRetry(streamOptions, retryOptions) {
|
|
|
10987
12302
|
requestStatuses.push(statusCode);
|
|
10988
12303
|
requestErrors.push(error);
|
|
10989
12304
|
if (attempt >= repeatTimes) {
|
|
10990
|
-
throw new
|
|
12305
|
+
throw new ChatV2RetryFailure(error, requestStatuses, requestErrors);
|
|
10991
12306
|
}
|
|
10992
12307
|
await waitForLLMChatV2RetryCooldown(cooldownMs, retryOptions.context.signal);
|
|
10993
12308
|
}
|
|
@@ -11010,6 +12325,7 @@ function buildProviderFailureResult(requestMessages, options2, normalizedError,
|
|
|
11010
12325
|
responseError,
|
|
11011
12326
|
requestStatuses: retryRequestStatuses,
|
|
11012
12327
|
requestErrors: retryRequestErrors,
|
|
12328
|
+
requestBodies: options2.requestBodies,
|
|
11013
12329
|
outputUsage: options2.outputUsage,
|
|
11014
12330
|
outputReasoning: options2.outputReasoning,
|
|
11015
12331
|
includeFunctionCalls: options2.includeFunctionCalls,
|
|
@@ -11044,7 +12360,9 @@ async function runChatV2Pipeline(options2) {
|
|
|
11044
12360
|
});
|
|
11045
12361
|
const functionTools = options2.functions != null && options2.functions.length > 0 ? chatV2ToolsToAiSdk(options2.functions) : void 0;
|
|
11046
12362
|
const tools = functionTools == null ? options2.additionalTools : options2.additionalTools == null ? functionTools : { ...functionTools, ...options2.additionalTools };
|
|
11047
|
-
const
|
|
12363
|
+
const shouldStreamResponse = options2.emitPartialOutputs !== false;
|
|
12364
|
+
const transportMode = shouldStreamResponse ? "stream" : "generate";
|
|
12365
|
+
const chatResponse = await runChatV2WithRetry(
|
|
11048
12366
|
{
|
|
11049
12367
|
model: options2.model,
|
|
11050
12368
|
messages: modelMessages,
|
|
@@ -11063,7 +12381,8 @@ async function runChatV2Pipeline(options2) {
|
|
|
11063
12381
|
toolChoice: options2.toolChoice,
|
|
11064
12382
|
abortSignal: options2.context.signal,
|
|
11065
12383
|
executeStream: options2.executeStream,
|
|
11066
|
-
|
|
12384
|
+
executeGenerate: options2.executeGenerate,
|
|
12385
|
+
onPartialOutput: !shouldStreamResponse ? void 0 : ({ text, functionCalls }) => {
|
|
11067
12386
|
var _a, _b;
|
|
11068
12387
|
(_b = (_a = options2.context).onPartialOutputs) == null ? void 0 : _b.call(
|
|
11069
12388
|
_a,
|
|
@@ -11078,6 +12397,7 @@ async function runChatV2Pipeline(options2) {
|
|
|
11078
12397
|
responseError: void 0,
|
|
11079
12398
|
requestStatuses: [],
|
|
11080
12399
|
requestErrors: [],
|
|
12400
|
+
requestBodies: void 0,
|
|
11081
12401
|
outputUsage: false,
|
|
11082
12402
|
outputReasoning: false,
|
|
11083
12403
|
outputRequestStatus: false,
|
|
@@ -11089,9 +12409,10 @@ async function runChatV2Pipeline(options2) {
|
|
|
11089
12409
|
);
|
|
11090
12410
|
}
|
|
11091
12411
|
},
|
|
11092
|
-
options2
|
|
12412
|
+
options2,
|
|
12413
|
+
transportMode
|
|
11093
12414
|
).catch((caughtError) => {
|
|
11094
|
-
const retryFailure =
|
|
12415
|
+
const retryFailure = isChatV2RetryFailure(caughtError) ? caughtError : void 0;
|
|
11095
12416
|
const rawError = (retryFailure == null ? void 0 : retryFailure.error) ?? caughtError;
|
|
11096
12417
|
const normalizedError = normalizeChatV2ProviderError(rawError, {
|
|
11097
12418
|
provider: options2.provider,
|
|
@@ -11112,24 +12433,26 @@ async function runChatV2Pipeline(options2) {
|
|
|
11112
12433
|
}
|
|
11113
12434
|
throw normalizedError;
|
|
11114
12435
|
});
|
|
11115
|
-
if ("commonOutputs" in
|
|
11116
|
-
return
|
|
11117
|
-
}
|
|
11118
|
-
const usage = normalizeChatV2Usage(
|
|
11119
|
-
const requestStatuses =
|
|
11120
|
-
const
|
|
11121
|
-
const
|
|
12436
|
+
if ("commonOutputs" in chatResponse) {
|
|
12437
|
+
return chatResponse;
|
|
12438
|
+
}
|
|
12439
|
+
const usage = normalizeChatV2Usage(chatResponse.result.usage, options2);
|
|
12440
|
+
const requestStatuses = chatResponse.requestStatuses;
|
|
12441
|
+
const requestStatus = chatResponse.result.requestStatus ?? 200;
|
|
12442
|
+
const requestErrors = normalizeProviderFailureMessages(chatResponse.requestErrors, options2);
|
|
12443
|
+
const responseError = chatResponse.responseError ? normalizeProviderFailureMessage(chatResponse.responseError, options2) : void 0;
|
|
11122
12444
|
const commonOutputs = createChatV2CommonOutputs({
|
|
11123
12445
|
requestMessages,
|
|
11124
|
-
response:
|
|
11125
|
-
structuredOutput:
|
|
11126
|
-
functionCalls:
|
|
12446
|
+
response: chatResponse.result.responseText,
|
|
12447
|
+
structuredOutput: chatResponse.result.structuredOutput,
|
|
12448
|
+
functionCalls: chatResponse.result.functionCalls,
|
|
11127
12449
|
usage,
|
|
11128
|
-
reasoning:
|
|
11129
|
-
requestStatus
|
|
12450
|
+
reasoning: chatResponse.result.reasoning,
|
|
12451
|
+
requestStatus,
|
|
11130
12452
|
responseError,
|
|
11131
12453
|
requestStatuses,
|
|
11132
12454
|
requestErrors,
|
|
12455
|
+
requestBodies: options2.requestBodies,
|
|
11133
12456
|
outputUsage: options2.outputUsage,
|
|
11134
12457
|
outputReasoning: options2.outputReasoning,
|
|
11135
12458
|
outputRequestStatus: options2.outputRequestStatus,
|
|
@@ -11146,14 +12469,14 @@ async function runChatV2Pipeline(options2) {
|
|
|
11146
12469
|
commonOutputs,
|
|
11147
12470
|
requestMessages,
|
|
11148
12471
|
allMessages: allMessagesOutput.value,
|
|
11149
|
-
response:
|
|
11150
|
-
functionCalls:
|
|
11151
|
-
reasoning:
|
|
12472
|
+
response: chatResponse.result.responseText,
|
|
12473
|
+
functionCalls: chatResponse.result.functionCalls,
|
|
12474
|
+
reasoning: chatResponse.result.reasoning,
|
|
11152
12475
|
usage,
|
|
11153
|
-
rawUsage:
|
|
11154
|
-
finishReason:
|
|
11155
|
-
providerMetadata:
|
|
11156
|
-
requestStatus
|
|
12476
|
+
rawUsage: chatResponse.result.usage,
|
|
12477
|
+
finishReason: chatResponse.result.finishReason,
|
|
12478
|
+
providerMetadata: chatResponse.result.providerMetadata,
|
|
12479
|
+
requestStatus
|
|
11157
12480
|
};
|
|
11158
12481
|
}
|
|
11159
12482
|
|
|
@@ -11418,32 +12741,54 @@ async function delegateToolCall(rawFunctionCall, context, config) {
|
|
|
11418
12741
|
function usesBaseURLInput(data) {
|
|
11419
12742
|
return data.provider === "custom" ? data.useCustomProviderBaseURLInput : data.useBaseURLInput;
|
|
11420
12743
|
}
|
|
11421
|
-
function
|
|
12744
|
+
function getCustomProviderBaseURLBodyValue(data) {
|
|
11422
12745
|
if (data.provider !== "custom") {
|
|
11423
12746
|
return void 0;
|
|
11424
12747
|
}
|
|
11425
12748
|
if (data.useCustomProviderBaseURLInput) {
|
|
11426
|
-
return "
|
|
12749
|
+
return "(Using Input)";
|
|
11427
12750
|
}
|
|
11428
12751
|
const baseURL = data.customProviderBaseURL.trim();
|
|
11429
|
-
return baseURL
|
|
12752
|
+
return baseURL || void 0;
|
|
11430
12753
|
}
|
|
11431
12754
|
function getOptionLabel(options2, value) {
|
|
11432
12755
|
var _a;
|
|
11433
12756
|
return ((_a = options2.find((option) => option.value === (value ?? ""))) == null ? void 0 : _a.label) ?? value ?? "Default";
|
|
11434
12757
|
}
|
|
11435
|
-
function
|
|
12758
|
+
function getProviderBodyLabel(data) {
|
|
12759
|
+
return data.provider === "custom" ? "Custom" : getChatV2ProviderLabel(data.provider);
|
|
12760
|
+
}
|
|
12761
|
+
function getReasoningEffortBodyValue(data) {
|
|
11436
12762
|
switch (data.provider) {
|
|
11437
12763
|
case "openai":
|
|
11438
|
-
return
|
|
12764
|
+
return getOptionLabel(openAIReasoningEffortOptions, data.openAIReasoningEffort);
|
|
11439
12765
|
case "anthropic":
|
|
11440
|
-
return
|
|
12766
|
+
return getOptionLabel(anthropicEffortOptions, data.anthropicEffort);
|
|
11441
12767
|
case "google":
|
|
11442
|
-
return
|
|
12768
|
+
return getOptionLabel(googleThinkingLevelOptions, data.googleThinkingLevel);
|
|
11443
12769
|
case "custom":
|
|
11444
12770
|
return void 0;
|
|
11445
12771
|
}
|
|
11446
12772
|
}
|
|
12773
|
+
function escapeMarkdownInline(value) {
|
|
12774
|
+
return value.replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/([\\`*_[\]{}()#+\-.!|])/g, "\\$1");
|
|
12775
|
+
}
|
|
12776
|
+
function getBodyLine(label, value) {
|
|
12777
|
+
return `<span style="opacity: 0.55">${label}:</span> ${escapeMarkdownInline(value)}`;
|
|
12778
|
+
}
|
|
12779
|
+
function getOptionalNumberBodyLine(label, value, usesInput) {
|
|
12780
|
+
if (usesInput) {
|
|
12781
|
+
return getBodyLine(label, "(Using Input)");
|
|
12782
|
+
}
|
|
12783
|
+
return value === void 0 ? void 0 : getBodyLine(label, `${value}`);
|
|
12784
|
+
}
|
|
12785
|
+
function getStopSequencesBodyLine(data) {
|
|
12786
|
+
if (data.useStopSequencesInput) {
|
|
12787
|
+
return getBodyLine("Stop sequences", "(Using Input)");
|
|
12788
|
+
}
|
|
12789
|
+
const stopSequences = (data.stopSequences ?? []).filter((sequence) => sequence.length > 0);
|
|
12790
|
+
return stopSequences.length === 0 ? void 0 : getBodyLine("Stop sequences", stopSequences.map((sequence) => JSON.stringify(sequence)).join(", "));
|
|
12791
|
+
}
|
|
11447
12792
|
var LLMChatV2NodeImpl = class extends NodeImpl {
|
|
11448
12793
|
static create() {
|
|
11449
12794
|
return {
|
|
@@ -11578,6 +12923,11 @@ var LLMChatV2NodeImpl = class extends NodeImpl {
|
|
|
11578
12923
|
id: "requestError",
|
|
11579
12924
|
title: "Response Error",
|
|
11580
12925
|
dataType: this.data.retryOnNon200 ? "string[]" : "string"
|
|
12926
|
+
},
|
|
12927
|
+
{
|
|
12928
|
+
id: "requestBody",
|
|
12929
|
+
title: "LLM request body",
|
|
12930
|
+
dataType: ["object", "object[]", "string", "string[]", "any", "any[]"]
|
|
11581
12931
|
}
|
|
11582
12932
|
);
|
|
11583
12933
|
}
|
|
@@ -11601,17 +12951,31 @@ var LLMChatV2NodeImpl = class extends NodeImpl {
|
|
|
11601
12951
|
}
|
|
11602
12952
|
getBody() {
|
|
11603
12953
|
const modelInfo = getChatV2ModelInfo(this.data.provider, this.data.model);
|
|
11604
|
-
const providerLabel =
|
|
11605
|
-
const
|
|
12954
|
+
const providerLabel = getProviderBodyLabel(this.data);
|
|
12955
|
+
const baseURLValue = getCustomProviderBaseURLBodyValue(this.data);
|
|
11606
12956
|
const modelLine = (modelInfo == null ? void 0 : modelInfo.displayName) ?? this.data.model;
|
|
11607
|
-
const providerDetails =
|
|
11608
|
-
|
|
11609
|
-
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
|
|
11614
|
-
|
|
12957
|
+
const providerDetails = [
|
|
12958
|
+
getBodyLine("Provider", providerLabel),
|
|
12959
|
+
...baseURLValue ? [getBodyLine("Base URL", baseURLValue)] : [],
|
|
12960
|
+
getBodyLine("Model", modelLine)
|
|
12961
|
+
];
|
|
12962
|
+
const reasoningEffortValue = getReasoningEffortBodyValue(this.data);
|
|
12963
|
+
return {
|
|
12964
|
+
type: "markdown",
|
|
12965
|
+
disableLinks: true,
|
|
12966
|
+
text: [
|
|
12967
|
+
...providerDetails,
|
|
12968
|
+
...reasoningEffortValue ? [getBodyLine("Reasoning effort", reasoningEffortValue)] : [],
|
|
12969
|
+
getBodyLine("Temperature", this.data.useTemperatureInput ? "(Using Input)" : `${this.data.temperature}`),
|
|
12970
|
+
getBodyLine("Max output tokens", this.data.useMaxTokensInput ? "(Using Input)" : `${this.data.maxTokens}`),
|
|
12971
|
+
getOptionalNumberBodyLine("Top P", this.data.topP, this.data.useTopPInput),
|
|
12972
|
+
getOptionalNumberBodyLine("Top K", this.data.topK, this.data.useTopKInput),
|
|
12973
|
+
getOptionalNumberBodyLine("Presence penalty", this.data.presencePenalty, this.data.usePresencePenaltyInput),
|
|
12974
|
+
getOptionalNumberBodyLine("Frequency penalty", this.data.frequencyPenalty, this.data.useFrequencyPenaltyInput),
|
|
12975
|
+
getStopSequencesBodyLine(this.data),
|
|
12976
|
+
getOptionalNumberBodyLine("Seed", this.data.seed, this.data.useSeedInput)
|
|
12977
|
+
].filter((line) => line !== void 0).join("\n")
|
|
12978
|
+
};
|
|
11615
12979
|
}
|
|
11616
12980
|
async process(inputs, context) {
|
|
11617
12981
|
const runtime = await resolveLLMChatV2RuntimeConfig({
|
|
@@ -11826,12 +13190,13 @@ var PromptNodeImpl = class extends NodeImpl {
|
|
|
11826
13190
|
},
|
|
11827
13191
|
{}
|
|
11828
13192
|
);
|
|
11829
|
-
|
|
13193
|
+
let outputValue = interpolate(
|
|
11830
13194
|
this.chartNode.data.promptText,
|
|
11831
13195
|
inputMap,
|
|
11832
13196
|
context.graphInputNodeValues,
|
|
11833
13197
|
context.contextValues
|
|
11834
13198
|
);
|
|
13199
|
+
outputValue = outputValue.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
11835
13200
|
const type = getInputOrData(this.data, inputs, "type", "string");
|
|
11836
13201
|
const isCacheBreakpoint = getInputOrData(this.data, inputs, "isCacheBreakpoint", "boolean");
|
|
11837
13202
|
if (["assistant", "system", "user", "function"].includes(type) === false) {
|
|
@@ -14095,7 +15460,8 @@ var GraphOutputNodeImpl = class extends NodeImpl {
|
|
|
14095
15460
|
{
|
|
14096
15461
|
type: "string",
|
|
14097
15462
|
label: "ID",
|
|
14098
|
-
dataKey: "id"
|
|
15463
|
+
dataKey: "id",
|
|
15464
|
+
commitDebounceMs: 300
|
|
14099
15465
|
},
|
|
14100
15466
|
{
|
|
14101
15467
|
type: "dataTypeSelector",
|
|
@@ -14172,11 +15538,11 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
14172
15538
|
}
|
|
14173
15539
|
getInputDefinitions(_connections, _nodes, project, _referencedProjects, definitionContext) {
|
|
14174
15540
|
const boundary = this.getBoundary(project, definitionContext);
|
|
14175
|
-
return boundary ? getGraphBoundaryInputDefinitions(boundary) : [];
|
|
15541
|
+
return boundary ? getGraphBoundaryInputDefinitions(boundary, this.data.inputPortOrder) : [];
|
|
14176
15542
|
}
|
|
14177
15543
|
getGraphOutputs(project, definitionContext) {
|
|
14178
15544
|
const boundary = this.getBoundary(project, definitionContext);
|
|
14179
|
-
return boundary ? getGraphBoundaryOutputDefinitions(boundary) : [];
|
|
15545
|
+
return boundary ? getGraphBoundaryOutputDefinitions(boundary, this.data.outputPortOrder) : [];
|
|
14180
15546
|
}
|
|
14181
15547
|
getOutputDefinitions(_connections, _nodes, project, _referencedProjects, definitionContext) {
|
|
14182
15548
|
const outputs = [];
|
|
@@ -14209,7 +15575,7 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
14209
15575
|
if (this.data.graphId) {
|
|
14210
15576
|
const boundary = getGraphBoundary(context.project, this.data.graphId);
|
|
14211
15577
|
if (boundary) {
|
|
14212
|
-
for (const input of boundary.inputs) {
|
|
15578
|
+
for (const input of applyGraphBoundaryPortOrder(boundary.inputs, this.data.inputPortOrder)) {
|
|
14213
15579
|
definitions.push({
|
|
14214
15580
|
type: "dynamic",
|
|
14215
15581
|
dataKey: "inputData",
|
|
@@ -14245,14 +15611,26 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
14245
15611
|
}
|
|
14246
15612
|
const boundary = ((_a = context.getGraphBoundary) == null ? void 0 : _a.call(context, project, this.data.graphId)) ?? getGraphBoundary(project, this.data.graphId);
|
|
14247
15613
|
const inputData = buildGraphBoundaryInputData(boundary, inputs, this.data.inputData);
|
|
15614
|
+
const shouldRunWholeGraph = !GRAPH_BOUNDARY_OUTPUT_DEMAND_OPTIMIZATION_ENABLED || context.isDirectRunTarget || this.data.useAsGraphPartialOutput === true || this.data.useErrorOutput === true && context.activeOutputPortIds.has("error");
|
|
15615
|
+
const requestedGraphOutputNodeIds = shouldRunWholeGraph ? [] : getRequestedGraphOutputNodeIds(boundary, context.activeOutputPortIds);
|
|
15616
|
+
if (!shouldRunWholeGraph && requestedGraphOutputNodeIds.length === 0) {
|
|
15617
|
+
return buildSkippedSubgraphOutputs(boundary, this.data.useErrorOutput);
|
|
15618
|
+
}
|
|
14248
15619
|
const subGraphProcessor = context.createSubProcessor(this.data.graphId, { signal: context.signal });
|
|
15620
|
+
if (!shouldRunWholeGraph) {
|
|
15621
|
+
subGraphProcessor.runToNodeIds = requestedGraphOutputNodeIds;
|
|
15622
|
+
}
|
|
14249
15623
|
try {
|
|
14250
15624
|
const startTime = Date.now();
|
|
14251
|
-
const
|
|
15625
|
+
const graphOutputs = await subGraphProcessor.processGraph(
|
|
14252
15626
|
context,
|
|
14253
15627
|
inputData,
|
|
14254
15628
|
context.contextValues
|
|
14255
15629
|
);
|
|
15630
|
+
const outputs = shouldRunWholeGraph ? graphOutputs : {
|
|
15631
|
+
...buildExcludedGraphBoundaryOutputs(boundary),
|
|
15632
|
+
...graphOutputs
|
|
15633
|
+
};
|
|
14256
15634
|
const duration = Date.now() - startTime;
|
|
14257
15635
|
if (this.data.useErrorOutput) {
|
|
14258
15636
|
outputs["error"] = {
|
|
@@ -14281,6 +15659,24 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
14281
15659
|
}
|
|
14282
15660
|
};
|
|
14283
15661
|
var subGraphNode = nodeDefinition(SubGraphNodeImpl, "Subgraph");
|
|
15662
|
+
function buildSkippedSubgraphOutputs(boundary, useErrorOutput) {
|
|
15663
|
+
const outputs = buildExcludedGraphBoundaryOutputs(boundary);
|
|
15664
|
+
if (useErrorOutput) {
|
|
15665
|
+
outputs["error"] = {
|
|
15666
|
+
type: "control-flow-excluded",
|
|
15667
|
+
value: void 0
|
|
15668
|
+
};
|
|
15669
|
+
}
|
|
15670
|
+
outputs["cost"] = {
|
|
15671
|
+
type: "number",
|
|
15672
|
+
value: 0
|
|
15673
|
+
};
|
|
15674
|
+
outputs["duration"] = {
|
|
15675
|
+
type: "number",
|
|
15676
|
+
value: 0
|
|
15677
|
+
};
|
|
15678
|
+
return outputs;
|
|
15679
|
+
}
|
|
14284
15680
|
|
|
14285
15681
|
// src/model/nodes/ArrayNode.ts
|
|
14286
15682
|
var import_non_secure23 = require("nanoid/non-secure");
|
|
@@ -15705,7 +17101,7 @@ var CoalesceNodeImpl = class extends NodeImpl {
|
|
|
15705
17101
|
visualData: {
|
|
15706
17102
|
x: 0,
|
|
15707
17103
|
y: 0,
|
|
15708
|
-
width:
|
|
17104
|
+
width: 190
|
|
15709
17105
|
}
|
|
15710
17106
|
};
|
|
15711
17107
|
return chartNode;
|
|
@@ -18169,6 +19565,20 @@ var import_non_secure55 = require("nanoid/non-secure");
|
|
|
18169
19565
|
var import_lodash_es12 = require("lodash");
|
|
18170
19566
|
var import_ts_pattern5 = require("ts-pattern");
|
|
18171
19567
|
var import_ts_dedent53 = require("ts-dedent");
|
|
19568
|
+
var compareNodeComparisonFunctionOptions = [
|
|
19569
|
+
{ label: "==", value: "==" },
|
|
19570
|
+
{ label: "!=", value: "!=" },
|
|
19571
|
+
{ label: "<", value: "<" },
|
|
19572
|
+
{ label: "<=", value: "<=" },
|
|
19573
|
+
{ label: ">", value: ">" },
|
|
19574
|
+
{ label: ">=", value: ">=" },
|
|
19575
|
+
{ label: "and", value: "and" },
|
|
19576
|
+
{ label: "or", value: "or" },
|
|
19577
|
+
{ label: "xor", value: "xor" },
|
|
19578
|
+
{ label: "nand", value: "nand" },
|
|
19579
|
+
{ label: "nor", value: "nor" },
|
|
19580
|
+
{ label: "xnor", value: "xnor" }
|
|
19581
|
+
];
|
|
18172
19582
|
var CompareNodeImpl = class extends NodeImpl {
|
|
18173
19583
|
static create() {
|
|
18174
19584
|
const chartNode = {
|
|
@@ -18223,20 +19633,7 @@ var CompareNodeImpl = class extends NodeImpl {
|
|
|
18223
19633
|
type: "dropdown",
|
|
18224
19634
|
label: "Comparison Function",
|
|
18225
19635
|
dataKey: "comparisonFunction",
|
|
18226
|
-
options:
|
|
18227
|
-
{ label: "==", value: "==" },
|
|
18228
|
-
{ label: "!=", value: "!=" },
|
|
18229
|
-
{ label: "<", value: "<" },
|
|
18230
|
-
{ label: "<=", value: "<=" },
|
|
18231
|
-
{ label: ">", value: ">" },
|
|
18232
|
-
{ label: ">=", value: ">=" },
|
|
18233
|
-
{ label: "and", value: "and" },
|
|
18234
|
-
{ label: "or", value: "or" },
|
|
18235
|
-
{ label: "xor", value: "xor" },
|
|
18236
|
-
{ label: "nand", value: "nand" },
|
|
18237
|
-
{ label: "nor", value: "nor" },
|
|
18238
|
-
{ label: "xnor", value: "xnor" }
|
|
18239
|
-
],
|
|
19636
|
+
options: compareNodeComparisonFunctionOptions,
|
|
18240
19637
|
useInputToggleDataKey: "useComparisonFunctionInput"
|
|
18241
19638
|
}
|
|
18242
19639
|
];
|
|
@@ -23510,17 +24907,29 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
23510
24907
|
}
|
|
23511
24908
|
const boundary = ((_a = context.getGraphBoundary) == null ? void 0 : _a.call(context, referencedProject, this.data.graphId)) ?? getGraphBoundary(referencedProject, this.data.graphId);
|
|
23512
24909
|
const inputData = buildGraphBoundaryInputData(boundary, inputs, this.data.inputData);
|
|
24910
|
+
const shouldRunWholeGraph = !GRAPH_BOUNDARY_OUTPUT_DEMAND_OPTIMIZATION_ENABLED || context.isDirectRunTarget || this.data.useErrorOutput === true && context.activeOutputPortIds.has("error");
|
|
24911
|
+
const requestedGraphOutputNodeIds = shouldRunWholeGraph ? [] : getRequestedGraphOutputNodeIds(boundary, context.activeOutputPortIds);
|
|
24912
|
+
if (!shouldRunWholeGraph && requestedGraphOutputNodeIds.length === 0) {
|
|
24913
|
+
return buildSkippedReferencedGraphOutputs(boundary, this.data.useErrorOutput, this.data.outputCostDuration);
|
|
24914
|
+
}
|
|
23513
24915
|
const subGraphProcessor = context.createSubProcessor(this.data.graphId, {
|
|
23514
24916
|
signal: context.signal,
|
|
23515
24917
|
project: referencedProject
|
|
23516
24918
|
});
|
|
24919
|
+
if (!shouldRunWholeGraph) {
|
|
24920
|
+
subGraphProcessor.runToNodeIds = requestedGraphOutputNodeIds;
|
|
24921
|
+
}
|
|
23517
24922
|
try {
|
|
23518
24923
|
const startTime = Date.now();
|
|
23519
|
-
const
|
|
24924
|
+
const graphOutputs = await subGraphProcessor.processGraph(
|
|
23520
24925
|
context,
|
|
23521
24926
|
inputData,
|
|
23522
24927
|
context.contextValues
|
|
23523
24928
|
);
|
|
24929
|
+
const outputs = shouldRunWholeGraph ? graphOutputs : {
|
|
24930
|
+
...buildExcludedGraphBoundaryOutputs(boundary),
|
|
24931
|
+
...graphOutputs
|
|
24932
|
+
};
|
|
23524
24933
|
const duration = Date.now() - startTime;
|
|
23525
24934
|
if (this.data.useErrorOutput) {
|
|
23526
24935
|
outputs["error"] = {
|
|
@@ -23534,11 +24943,7 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
23534
24943
|
value: duration
|
|
23535
24944
|
};
|
|
23536
24945
|
}
|
|
23537
|
-
|
|
23538
|
-
delete outputs["cost"];
|
|
23539
|
-
delete outputs["duration"];
|
|
23540
|
-
}
|
|
23541
|
-
return outputs;
|
|
24946
|
+
return applyMetricOutputSetting(outputs, this.data.outputCostDuration);
|
|
23542
24947
|
} catch (err) {
|
|
23543
24948
|
if (!this.data.useErrorOutput) {
|
|
23544
24949
|
throw err;
|
|
@@ -23553,10 +24958,74 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
23553
24958
|
}
|
|
23554
24959
|
};
|
|
23555
24960
|
var referencedGraphAliasNode = nodeDefinition(ReferencedGraphAliasNodeImpl, "Referenced Graph Alias");
|
|
24961
|
+
function buildSkippedReferencedGraphOutputs(boundary, useErrorOutput, outputCostDuration) {
|
|
24962
|
+
const outputs = buildExcludedGraphBoundaryOutputs(boundary);
|
|
24963
|
+
if (useErrorOutput) {
|
|
24964
|
+
outputs["error"] = {
|
|
24965
|
+
type: "control-flow-excluded",
|
|
24966
|
+
value: void 0
|
|
24967
|
+
};
|
|
24968
|
+
}
|
|
24969
|
+
if (outputCostDuration) {
|
|
24970
|
+
outputs["cost"] = {
|
|
24971
|
+
type: "number",
|
|
24972
|
+
value: 0
|
|
24973
|
+
};
|
|
24974
|
+
outputs["duration"] = {
|
|
24975
|
+
type: "number",
|
|
24976
|
+
value: 0
|
|
24977
|
+
};
|
|
24978
|
+
}
|
|
24979
|
+
return applyMetricOutputSetting(outputs, outputCostDuration);
|
|
24980
|
+
}
|
|
24981
|
+
function applyMetricOutputSetting(outputs, outputCostDuration) {
|
|
24982
|
+
if (outputCostDuration) {
|
|
24983
|
+
return outputs;
|
|
24984
|
+
}
|
|
24985
|
+
delete outputs["cost"];
|
|
24986
|
+
delete outputs["duration"];
|
|
24987
|
+
return outputs;
|
|
24988
|
+
}
|
|
24989
|
+
|
|
24990
|
+
// src/model/nodes/NodePrefabInstanceNode.ts
|
|
24991
|
+
var import_non_secure84 = require("nanoid/non-secure");
|
|
24992
|
+
var NodePrefabInstanceNodeImpl = class extends NodeImpl {
|
|
24993
|
+
static create() {
|
|
24994
|
+
return {
|
|
24995
|
+
type: NODE_PREFAB_INSTANCE_TYPE,
|
|
24996
|
+
title: "Linked node",
|
|
24997
|
+
id: (0, import_non_secure84.nanoid)(),
|
|
24998
|
+
visualData: {
|
|
24999
|
+
x: 0,
|
|
25000
|
+
y: 0,
|
|
25001
|
+
width: 240
|
|
25002
|
+
},
|
|
25003
|
+
data: {}
|
|
25004
|
+
};
|
|
25005
|
+
}
|
|
25006
|
+
getInputDefinitions() {
|
|
25007
|
+
return [];
|
|
25008
|
+
}
|
|
25009
|
+
getOutputDefinitions() {
|
|
25010
|
+
return [];
|
|
25011
|
+
}
|
|
25012
|
+
async process(_inputData) {
|
|
25013
|
+
throw new Error("Library node is missing. Open the Node library and reconnect this linked node.");
|
|
25014
|
+
}
|
|
25015
|
+
static getUIData() {
|
|
25016
|
+
return {
|
|
25017
|
+
contextMenuTitle: "Linked node",
|
|
25018
|
+
infoBoxTitle: "Linked node",
|
|
25019
|
+
infoBoxBody: "Runs a node from the project Node library.",
|
|
25020
|
+
group: "Advanced"
|
|
25021
|
+
};
|
|
25022
|
+
}
|
|
25023
|
+
};
|
|
25024
|
+
var nodePrefabInstanceNode = nodeDefinition(NodePrefabInstanceNodeImpl, "Linked node");
|
|
23556
25025
|
|
|
23557
25026
|
// src/model/Nodes.ts
|
|
23558
25027
|
var registerBuiltInNodes = (registry) => {
|
|
23559
|
-
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);
|
|
25028
|
+
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);
|
|
23560
25029
|
};
|
|
23561
25030
|
var globalRivetNodeRegistry = registerBuiltInNodes(new NodeRegistration());
|
|
23562
25031
|
function resetGlobalRivetNodeRegistry() {
|
|
@@ -23723,7 +25192,7 @@ var OpenAIEmbeddingGenerator = class {
|
|
|
23723
25192
|
registerIntegration("embeddingGenerator", "openai", (context) => new OpenAIEmbeddingGenerator(context.settings));
|
|
23724
25193
|
|
|
23725
25194
|
// src/recording/ExecutionRecorder.ts
|
|
23726
|
-
var
|
|
25195
|
+
var import_non_secure85 = require("nanoid/non-secure");
|
|
23727
25196
|
var import_emittery2 = __toESM(require("emittery-0-13"), 1);
|
|
23728
25197
|
var import_lodash_es17 = require("lodash");
|
|
23729
25198
|
var import_json_stream_es = require("json-stream-es");
|
|
@@ -23923,7 +25392,7 @@ function serializeToObject(recording) {
|
|
|
23923
25392
|
const asString = uint8ArrayToBase64Sync(val);
|
|
23924
25393
|
const existingAsset = Object.entries(serialized.assets).find(([, asset]) => asset === asString);
|
|
23925
25394
|
if (!existingAsset) {
|
|
23926
|
-
const id = (0,
|
|
25395
|
+
const id = (0, import_non_secure85.nanoid)();
|
|
23927
25396
|
serialized.assets[id] = asString;
|
|
23928
25397
|
return `$ASSET:${id}`;
|
|
23929
25398
|
} else {
|
|
@@ -23982,7 +25451,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
23982
25451
|
once = void 0;
|
|
23983
25452
|
recordSocket(channel) {
|
|
23984
25453
|
return new Promise((resolve) => {
|
|
23985
|
-
this.recordingId = (0,
|
|
25454
|
+
this.recordingId = (0, import_non_secure85.nanoid)();
|
|
23986
25455
|
const listener = (event) => {
|
|
23987
25456
|
const { message, data } = JSON.parse(event.data);
|
|
23988
25457
|
if (this.#includePartialOutputs === false && message === "partialOutput") {
|
|
@@ -24007,7 +25476,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
24007
25476
|
});
|
|
24008
25477
|
}
|
|
24009
25478
|
record(processor) {
|
|
24010
|
-
this.recordingId = (0,
|
|
25479
|
+
this.recordingId = (0, import_non_secure85.nanoid)();
|
|
24011
25480
|
processor.onAny((event, data) => {
|
|
24012
25481
|
if (this.#includePartialOutputs === false && event === "partialOutput") {
|
|
24013
25482
|
return;
|
|
@@ -24069,7 +25538,7 @@ function isRecordingTerminalEvent(event, data) {
|
|
|
24069
25538
|
}
|
|
24070
25539
|
|
|
24071
25540
|
// src/plugins/anthropic/nodes/ChatAnthropicNode.ts
|
|
24072
|
-
var
|
|
25541
|
+
var import_non_secure86 = require("nanoid/non-secure");
|
|
24073
25542
|
var import_ts_dedent76 = require("ts-dedent");
|
|
24074
25543
|
var import_p_retry2 = __toESM(require("p-retry-4"), 1);
|
|
24075
25544
|
|
|
@@ -24085,7 +25554,7 @@ var ChatAnthropicNodeImpl = {
|
|
|
24085
25554
|
const chartNode = {
|
|
24086
25555
|
type: "chatAnthropic",
|
|
24087
25556
|
title: "Chat (Anthropic, Legacy)",
|
|
24088
|
-
id: (0,
|
|
25557
|
+
id: (0, import_non_secure86.nanoid)(),
|
|
24089
25558
|
visualData: {
|
|
24090
25559
|
x: 0,
|
|
24091
25560
|
y: 0,
|
|
@@ -24827,7 +26296,7 @@ var anthropicPlugin = {
|
|
|
24827
26296
|
var anthropic_default = anthropicPlugin;
|
|
24828
26297
|
|
|
24829
26298
|
// src/plugins/autoevals/AutoEvalsNode.ts
|
|
24830
|
-
var
|
|
26299
|
+
var import_non_secure87 = require("nanoid/non-secure");
|
|
24831
26300
|
var import_ts_dedent77 = require("ts-dedent");
|
|
24832
26301
|
var import_autoevals = require("autoevals");
|
|
24833
26302
|
var import_ts_pattern8 = require("ts-pattern");
|
|
@@ -24847,7 +26316,7 @@ var AutoEvalsNodeImpl = {
|
|
|
24847
26316
|
const chartNode = {
|
|
24848
26317
|
type: "autoevals",
|
|
24849
26318
|
title: "Autoevals",
|
|
24850
|
-
id: (0,
|
|
26319
|
+
id: (0, import_non_secure87.nanoid)(),
|
|
24851
26320
|
visualData: {
|
|
24852
26321
|
x: 0,
|
|
24853
26322
|
y: 0,
|
|
@@ -25042,7 +26511,7 @@ var autoevalsPlugin = {
|
|
|
25042
26511
|
var autoevals_default = autoevalsPlugin;
|
|
25043
26512
|
|
|
25044
26513
|
// src/plugins/assemblyAi/LemurQaNode.ts
|
|
25045
|
-
var
|
|
26514
|
+
var import_non_secure88 = require("nanoid/non-secure");
|
|
25046
26515
|
var import_ts_dedent78 = require("ts-dedent");
|
|
25047
26516
|
|
|
25048
26517
|
// src/plugins/assemblyAi/lemurHelpers.ts
|
|
@@ -25163,7 +26632,7 @@ var LemurQaNodeImpl = {
|
|
|
25163
26632
|
const chartNode = {
|
|
25164
26633
|
type: "assemblyAiLemurQa",
|
|
25165
26634
|
title: "LeMUR Question & Answers",
|
|
25166
|
-
id: (0,
|
|
26635
|
+
id: (0, import_non_secure88.nanoid)(),
|
|
25167
26636
|
visualData: {
|
|
25168
26637
|
x: 0,
|
|
25169
26638
|
y: 0,
|
|
@@ -25301,14 +26770,14 @@ function applyQuestionEditors(data, question) {
|
|
|
25301
26770
|
var lemurQaNode = pluginNodeDefinition(LemurQaNodeImpl, "LeMUR Q&A");
|
|
25302
26771
|
|
|
25303
26772
|
// src/plugins/assemblyAi/TranscribeAudioNode.ts
|
|
25304
|
-
var
|
|
26773
|
+
var import_non_secure89 = require("nanoid/non-secure");
|
|
25305
26774
|
var import_ts_dedent79 = require("ts-dedent");
|
|
25306
26775
|
var TranscribeAudioNodeImpl = {
|
|
25307
26776
|
create() {
|
|
25308
26777
|
const chartNode = {
|
|
25309
26778
|
type: "assemblyAiTranscribeAudio",
|
|
25310
26779
|
title: "Transcribe Audio",
|
|
25311
|
-
id: (0,
|
|
26780
|
+
id: (0, import_non_secure89.nanoid)(),
|
|
25312
26781
|
visualData: {
|
|
25313
26782
|
x: 0,
|
|
25314
26783
|
y: 0,
|
|
@@ -25423,7 +26892,7 @@ function getAdditionalParameters(data) {
|
|
|
25423
26892
|
}
|
|
25424
26893
|
|
|
25425
26894
|
// src/plugins/assemblyAi/LemurSummaryNode.ts
|
|
25426
|
-
var
|
|
26895
|
+
var import_non_secure90 = require("nanoid/non-secure");
|
|
25427
26896
|
var import_ts_dedent80 = require("ts-dedent");
|
|
25428
26897
|
var import_assemblyai3 = require("assemblyai");
|
|
25429
26898
|
var LemurSummaryNodeImpl = {
|
|
@@ -25431,7 +26900,7 @@ var LemurSummaryNodeImpl = {
|
|
|
25431
26900
|
const chartNode = {
|
|
25432
26901
|
type: "assemblyAiLemurSummary",
|
|
25433
26902
|
title: "LeMUR Summary",
|
|
25434
|
-
id: (0,
|
|
26903
|
+
id: (0, import_non_secure90.nanoid)(),
|
|
25435
26904
|
visualData: {
|
|
25436
26905
|
x: 0,
|
|
25437
26906
|
y: 0,
|
|
@@ -25501,7 +26970,7 @@ var LemurSummaryNodeImpl = {
|
|
|
25501
26970
|
var lemurSummaryNode = pluginNodeDefinition(LemurSummaryNodeImpl, "LeMUR Summary");
|
|
25502
26971
|
|
|
25503
26972
|
// src/plugins/assemblyAi/LemurTaskNode.ts
|
|
25504
|
-
var
|
|
26973
|
+
var import_non_secure91 = require("nanoid/non-secure");
|
|
25505
26974
|
var import_ts_dedent81 = require("ts-dedent");
|
|
25506
26975
|
var import_assemblyai4 = require("assemblyai");
|
|
25507
26976
|
var LemurTaskNodeImpl = {
|
|
@@ -25509,7 +26978,7 @@ var LemurTaskNodeImpl = {
|
|
|
25509
26978
|
const chartNode = {
|
|
25510
26979
|
type: "assemblyAiLemurTask",
|
|
25511
26980
|
title: "LeMUR Task",
|
|
25512
|
-
id: (0,
|
|
26981
|
+
id: (0, import_non_secure91.nanoid)(),
|
|
25513
26982
|
visualData: {
|
|
25514
26983
|
x: 0,
|
|
25515
26984
|
y: 0,
|
|
@@ -25581,14 +27050,14 @@ var LemurTaskNodeImpl = {
|
|
|
25581
27050
|
var lemurTaskNode = pluginNodeDefinition(LemurTaskNodeImpl, "LeMUR Task");
|
|
25582
27051
|
|
|
25583
27052
|
// src/plugins/assemblyAi/LemurActionItemsNode.ts
|
|
25584
|
-
var
|
|
27053
|
+
var import_non_secure92 = require("nanoid/non-secure");
|
|
25585
27054
|
var import_ts_dedent82 = require("ts-dedent");
|
|
25586
27055
|
var LemurActionItemsNodeImpl = {
|
|
25587
27056
|
create() {
|
|
25588
27057
|
const chartNode = {
|
|
25589
27058
|
type: "assemblyAiLemurActionItems",
|
|
25590
27059
|
title: "LeMUR Action Items",
|
|
25591
|
-
id: (0,
|
|
27060
|
+
id: (0, import_non_secure92.nanoid)(),
|
|
25592
27061
|
visualData: {
|
|
25593
27062
|
x: 0,
|
|
25594
27063
|
y: 0,
|
|
@@ -25686,12 +27155,12 @@ var assemblyAiPlugin = {
|
|
|
25686
27155
|
var assemblyAi_default = assemblyAiPlugin;
|
|
25687
27156
|
|
|
25688
27157
|
// src/plugins/huggingface/nodes/ChatHuggingFace.ts
|
|
25689
|
-
var
|
|
27158
|
+
var import_non_secure93 = require("nanoid/non-secure");
|
|
25690
27159
|
var import_inference = require("@huggingface/inference");
|
|
25691
27160
|
var ChatHuggingFaceNodeImpl = {
|
|
25692
27161
|
create() {
|
|
25693
27162
|
return {
|
|
25694
|
-
id: (0,
|
|
27163
|
+
id: (0, import_non_secure93.nanoid)(),
|
|
25695
27164
|
type: "chatHuggingFace",
|
|
25696
27165
|
data: {
|
|
25697
27166
|
model: "",
|
|
@@ -25921,13 +27390,13 @@ var ChatHuggingFaceNodeImpl = {
|
|
|
25921
27390
|
var chatHuggingFaceNode = pluginNodeDefinition(ChatHuggingFaceNodeImpl, "Chat (Hugging Face, Legacy)");
|
|
25922
27391
|
|
|
25923
27392
|
// src/plugins/huggingface/nodes/TextToImageHuggingFace.ts
|
|
25924
|
-
var
|
|
27393
|
+
var import_non_secure94 = require("nanoid/non-secure");
|
|
25925
27394
|
var import_inference2 = require("@huggingface/inference");
|
|
25926
27395
|
var import_ts_dedent83 = require("ts-dedent");
|
|
25927
27396
|
var TextToImageHuggingFaceNodeImpl = {
|
|
25928
27397
|
create() {
|
|
25929
27398
|
return {
|
|
25930
|
-
id: (0,
|
|
27399
|
+
id: (0, import_non_secure94.nanoid)(),
|
|
25931
27400
|
type: "textToImageHuggingFace",
|
|
25932
27401
|
data: {
|
|
25933
27402
|
model: "",
|
|
@@ -29243,7 +30712,7 @@ var openAIPlugin = {
|
|
|
29243
30712
|
};
|
|
29244
30713
|
|
|
29245
30714
|
// src/plugins/google/nodes/ChatGoogleNode.ts
|
|
29246
|
-
var
|
|
30715
|
+
var import_non_secure95 = require("nanoid/non-secure");
|
|
29247
30716
|
var import_ts_dedent84 = require("ts-dedent");
|
|
29248
30717
|
var import_p_retry3 = __toESM(require("p-retry-4"), 1);
|
|
29249
30718
|
var import_ts_pattern9 = require("ts-pattern");
|
|
@@ -29272,7 +30741,7 @@ var ChatGoogleNodeImpl = {
|
|
|
29272
30741
|
const chartNode = {
|
|
29273
30742
|
type: "chatGoogle",
|
|
29274
30743
|
title: "Chat (Google, Legacy)",
|
|
29275
|
-
id: (0,
|
|
30744
|
+
id: (0, import_non_secure95.nanoid)(),
|
|
29276
30745
|
visualData: {
|
|
29277
30746
|
x: 0,
|
|
29278
30747
|
y: 0,
|
|
@@ -30313,7 +31782,9 @@ var Rivet = void 0;
|
|
|
30313
31782
|
MCPGetPromptNodeImpl,
|
|
30314
31783
|
MCPToolCallNodeImpl,
|
|
30315
31784
|
MatchNodeImpl,
|
|
31785
|
+
NODE_PREFAB_INSTANCE_TYPE,
|
|
30316
31786
|
NodeImpl,
|
|
31787
|
+
NodePrefabInstanceNodeImpl,
|
|
30317
31788
|
NodeRegistration,
|
|
30318
31789
|
NotAllowedCodeRunner,
|
|
30319
31790
|
NumberNodeImpl,
|
|
@@ -30323,6 +31794,8 @@ var Rivet = void 0;
|
|
|
30323
31794
|
PluginNodeImplClass,
|
|
30324
31795
|
PopNodeImpl,
|
|
30325
31796
|
PromptNodeImpl,
|
|
31797
|
+
RIVET_WEB_APP_DOCUMENT_CSS,
|
|
31798
|
+
RIVET_WEB_APP_RENDERER_CSS,
|
|
30326
31799
|
RaceInputsNodeImpl,
|
|
30327
31800
|
RaiseEventNodeImpl,
|
|
30328
31801
|
RandomNumberNodeImpl,
|
|
@@ -30375,6 +31848,7 @@ var Rivet = void 0;
|
|
|
30375
31848
|
callGraphNode,
|
|
30376
31849
|
canBeCoerced,
|
|
30377
31850
|
canBeCoercedAny,
|
|
31851
|
+
canUseNodeAsPrefabSource,
|
|
30378
31852
|
chatLoopNode,
|
|
30379
31853
|
chatMessagesToModelMessages,
|
|
30380
31854
|
chatNode,
|
|
@@ -30383,6 +31857,8 @@ var Rivet = void 0;
|
|
|
30383
31857
|
chunkNode,
|
|
30384
31858
|
chunkStringByTokenCount,
|
|
30385
31859
|
cleanHeaders,
|
|
31860
|
+
cloneFrozenNodeOutputs,
|
|
31861
|
+
cloneFrozenNodeOutputsByGraph,
|
|
30386
31862
|
coalesceNode,
|
|
30387
31863
|
codeNewNode,
|
|
30388
31864
|
codeNode,
|
|
@@ -30390,6 +31866,8 @@ var Rivet = void 0;
|
|
|
30390
31866
|
coerceTypeOptional,
|
|
30391
31867
|
commentNode,
|
|
30392
31868
|
compareNode,
|
|
31869
|
+
compareNodeComparisonFunctionOptions,
|
|
31870
|
+
compareProjects,
|
|
30393
31871
|
contextNode,
|
|
30394
31872
|
coreCreateProcessor,
|
|
30395
31873
|
coreRunGraph,
|
|
@@ -30401,6 +31879,8 @@ var Rivet = void 0;
|
|
|
30401
31879
|
createDebuggerTransportEscapedSentinel,
|
|
30402
31880
|
createDebuggerTransportEscapedSentinelEnvelope,
|
|
30403
31881
|
createDebuggerTransportUndefinedSentinel,
|
|
31882
|
+
createDefaultUiGraph,
|
|
31883
|
+
createFrozenNodeOutputResolver,
|
|
30404
31884
|
createInterpolationInputDefinition,
|
|
30405
31885
|
createsLLMChatV2ToolResponseFormatConflictForEdit,
|
|
30406
31886
|
cronNode,
|
|
@@ -30434,6 +31914,7 @@ var Rivet = void 0;
|
|
|
30434
31914
|
filterNode,
|
|
30435
31915
|
findInterpolationTokenSpans,
|
|
30436
31916
|
functionTypeToScalarType,
|
|
31917
|
+
generateChatV2,
|
|
30437
31918
|
gentracePlugin,
|
|
30438
31919
|
getAllDatasetsNode,
|
|
30439
31920
|
getChatNodeMessages,
|
|
@@ -30452,16 +31933,25 @@ var Rivet = void 0;
|
|
|
30452
31933
|
getExtractObjectPathInterpolationInputNames,
|
|
30453
31934
|
getGentracePipelines,
|
|
30454
31935
|
getGlobalNode,
|
|
31936
|
+
getGraphBoundary,
|
|
30455
31937
|
getHttpCallBodyPreviewSections,
|
|
30456
31938
|
getInputOrData,
|
|
30457
31939
|
getIntegration,
|
|
30458
31940
|
getInterpolationInputDefinitionData,
|
|
30459
31941
|
getInterpolationTokenName,
|
|
31942
|
+
getNodePrefabDisplayName,
|
|
31943
|
+
getNodePrefabInstancePrefabId,
|
|
30460
31944
|
getPluginConfig,
|
|
30461
31945
|
getProcessorEvents,
|
|
30462
31946
|
getProcessorSSEStream,
|
|
31947
|
+
getProjectConnectionComparisonKey,
|
|
31948
|
+
getProjectNodeFieldComparisons,
|
|
30463
31949
|
getScalarTypeOf,
|
|
30464
31950
|
getSingleNodeStream,
|
|
31951
|
+
getUiGraphActionComponent,
|
|
31952
|
+
getUiGraphActionInputBindings,
|
|
31953
|
+
getUiGraphActionOutputBindings,
|
|
31954
|
+
getUiGraphInitialState,
|
|
30465
31955
|
getWarnings,
|
|
30466
31956
|
globalRivetNodeRegistry,
|
|
30467
31957
|
googlePlugin,
|
|
@@ -30471,6 +31961,7 @@ var Rivet = void 0;
|
|
|
30471
31961
|
graphOutputNode,
|
|
30472
31962
|
graphReferenceNode,
|
|
30473
31963
|
handleEscapeCharacters,
|
|
31964
|
+
hasFrozenNodeOutputs,
|
|
30474
31965
|
hasLLMChatV2ToolResponseFormatConflict,
|
|
30475
31966
|
hasValidStoredOrderedPortIds,
|
|
30476
31967
|
hashNode,
|
|
@@ -30496,6 +31987,7 @@ var Rivet = void 0;
|
|
|
30496
31987
|
isFunctionDataValue,
|
|
30497
31988
|
isInterpolationInputDefinition,
|
|
30498
31989
|
isLLMChatV2StructuredResponseFormat,
|
|
31990
|
+
isNodePrefabInstanceNode,
|
|
30499
31991
|
isNotFunctionDataValue,
|
|
30500
31992
|
isRuntimeDebugLoggingEnabled,
|
|
30501
31993
|
isScalarDataType,
|
|
@@ -30503,6 +31995,7 @@ var Rivet = void 0;
|
|
|
30503
31995
|
joinNode,
|
|
30504
31996
|
jsFilterNode,
|
|
30505
31997
|
jsMapNode,
|
|
31998
|
+
jsonValueToDataValue,
|
|
30506
31999
|
listGraphsNode,
|
|
30507
32000
|
llmChatV2Node,
|
|
30508
32001
|
loadDatasetNode,
|
|
@@ -30523,6 +32016,7 @@ var Rivet = void 0;
|
|
|
30523
32016
|
mergeCustomProviderResponseFormatOptions,
|
|
30524
32017
|
newId,
|
|
30525
32018
|
nodeDefinition,
|
|
32019
|
+
nodePrefabInstanceNode,
|
|
30526
32020
|
numberNode,
|
|
30527
32021
|
objectNode,
|
|
30528
32022
|
openAICompatibleEndpointToBaseURL,
|
|
@@ -30556,8 +32050,13 @@ var Rivet = void 0;
|
|
|
30556
32050
|
resolveChatV2ProviderConfig,
|
|
30557
32051
|
resolveChatV2ResponseFormatParameters,
|
|
30558
32052
|
resolveLLMChatV2RuntimeProviderOptions,
|
|
32053
|
+
resolveNodePrefabInstance,
|
|
32054
|
+
resolveNodePrefabInstances,
|
|
30559
32055
|
resolveProcessSettings,
|
|
30560
32056
|
resolveStoredOrderedPortIds,
|
|
32057
|
+
resolveUiGraphActionInputs,
|
|
32058
|
+
resolveUiGraphActionOutputStatePatch,
|
|
32059
|
+
resolveUiGraphActionOutputStateValue,
|
|
30561
32060
|
resolveUniqueValueDerivedPortIds,
|
|
30562
32061
|
restoreEscapedInterpolationTokens,
|
|
30563
32062
|
runChatV2Pipeline,
|