@valerypopoff/rivet2-core 2.1.9 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/bundle.cjs +5618 -2533
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/webAppRuntime.cjs +333 -22
- package/dist/cjs/webAppRuntime.cjs.map +4 -4
- package/dist/esm/api/createProcessor.js +2 -0
- package/dist/esm/exports.js +1 -0
- package/dist/esm/integrations/CodeRunner.js +2 -7
- package/dist/esm/integrations/CodeRunnerOptions.js +7 -0
- package/dist/esm/model/AgentResponseTrace.js +558 -0
- package/dist/esm/model/ConnectedToolContinuationHost.js +33 -0
- package/dist/esm/model/GraphProcessor.js +165 -74
- package/dist/esm/model/NodeImpl.js +6 -0
- package/dist/esm/model/ProcessContextBuilder.js +3 -1
- package/dist/esm/model/RecordingPlayer.js +212 -25
- package/dist/esm/model/SplitRunProcessor.js +49 -8
- package/dist/esm/model/SubprocessorBridge.js +3 -0
- package/dist/esm/model/ToolCallContinuationCoordinator.js +7 -3
- package/dist/esm/model/UiGraph.js +21 -0
- package/dist/esm/model/UiGraphActionProtocol.js +3 -0
- package/dist/esm/model/UiGraphBrowserRuntime.js +133 -4
- package/dist/esm/model/UiGraphRendererStyles.js +221 -0
- package/dist/esm/model/UiGraphRuntimeModel.js +9 -3
- package/dist/esm/model/UiGraphSchema.js +7 -1
- package/dist/esm/model/chat/aiSdkTools.js +3 -2
- package/dist/esm/model/chat-v2/aiSdkBridge.js +146 -14
- package/dist/esm/model/chat-v2/chatV2CallObserver.js +11 -5
- package/dist/esm/model/chat-v2/chatV2CredentialNames.js +93 -0
- package/dist/esm/model/chat-v2/chatV2EditorCache.js +47 -20
- package/dist/esm/model/chat-v2/chatV2Errors.js +7 -19
- package/dist/esm/model/chat-v2/chatV2FeatureCompatibility.js +1 -1
- package/dist/esm/model/chat-v2/chatV2Outputs.js +48 -108
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +101 -149
- package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +39 -4
- package/dist/esm/model/chat-v2/chatV2ProviderRegistry.js +9 -0
- package/dist/esm/model/chat-v2/chatV2RequestPlan.js +2 -3
- package/dist/esm/model/chat-v2/chatV2ResponseBodyCapture.js +63 -0
- package/dist/esm/model/chat-v2/chatV2ResponseFormat.js +8 -4
- package/dist/esm/model/chat-v2/chatV2Retry.js +4 -3
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +7 -7
- package/dist/esm/model/chat-v2/chatV2Shared.js +1 -1
- package/dist/esm/model/chat-v2/chatV2Types.js +20 -8
- package/dist/esm/model/chat-v2/chatV2UsageAccounting.js +78 -0
- package/dist/esm/model/chat-v2/customProviderApi.js +40 -0
- package/dist/esm/model/chat-v2/index.js +15 -0
- package/dist/esm/model/chat-v2/llmChatV2Body.js +289 -0
- package/dist/esm/model/chat-v2/llmChatV2CacheBoundary.js +32 -0
- package/dist/esm/model/chat-v2/llmChatV2CachePolicy.js +25 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +13 -50
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +117 -24
- package/dist/esm/model/chat-v2/llmChatV2NodeMigration.js +24 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +150 -199
- package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +60 -0
- package/dist/esm/model/chat-v2/llmInvocationDecision.js +11 -0
- package/dist/esm/model/chat-v2/llmInvocationJournal.js +43 -0
- package/dist/esm/model/chat-v2/llmInvocationPlan.js +68 -0
- package/dist/esm/model/chat-v2/llmInvocationProjections.js +5 -0
- package/dist/esm/model/chat-v2/llmInvocationResultProjector.js +48 -0
- package/dist/esm/model/chat-v2/llmModelCandidate.js +79 -0
- package/dist/esm/model/chat-v2/llmProfile.js +52 -65
- package/dist/esm/model/chat-v2/llmProfileBody.js +193 -0
- package/dist/esm/model/chat-v2/llmProfileFallback.js +442 -100
- package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +74 -0
- package/dist/esm/model/chat-v2/llmProfileHealthStore.js +326 -0
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +55 -33
- package/dist/esm/model/chat-v2/llmProfileTypes.js +1 -18
- package/dist/esm/model/chat-v2/llmResponseMaterializer.js +42 -0
- package/dist/esm/model/chat-v2/modelRegistry.js +54 -4
- package/dist/esm/model/chat-v2/parallelToolCalls.js +9 -2
- package/dist/esm/model/chat-v2/providerOptions.js +116 -24
- package/dist/esm/model/chat-v2/rivetToolRegistry.js +9 -0
- package/dist/esm/model/chat-v2/toolCallCodec.js +52 -0
- package/dist/esm/model/chat-v2/toolContinuation.js +72 -35
- package/dist/esm/model/chat-v2/toolHandlerResolver.js +23 -0
- package/dist/esm/model/chat-v2/toolRoundExecutor.js +12 -0
- package/dist/esm/model/nodes/ChatNode.js +6 -0
- package/dist/esm/model/nodes/ChatNodeBase.js +1 -0
- package/dist/esm/model/nodes/CodeNewNode.js +5 -47
- package/dist/esm/model/nodes/CodeNode.js +4 -46
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +19 -6
- package/dist/esm/model/nodes/ExpressionNode.js +5 -8
- package/dist/esm/model/nodes/LLMChatV2Node.js +121 -229
- package/dist/esm/model/nodes/LLMProfileNode.js +27 -8
- package/dist/esm/model/nodes/MatchNode.js +86 -41
- package/dist/esm/model/nodes/PromptNode.js +7 -0
- package/dist/esm/model/nodes/ToolNode.js +7 -0
- package/dist/esm/model/nodes/toolCallDelegation.js +177 -110
- package/dist/esm/plugins/anthropic/anthropic.js +4 -4
- package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +7 -0
- package/dist/esm/plugins/gentrace/gentraceSdk.js +0 -1
- package/dist/esm/plugins/gentrace/index.js +0 -1
- package/dist/esm/plugins/gentrace/plugin.js +61 -179
- package/dist/esm/plugins/google/google.js +5 -9
- package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +4 -1
- package/dist/esm/plugins.js +1 -2
- package/dist/esm/recording/ExecutionRecorder.js +62 -13
- package/dist/esm/utils/emitDetached.js +6 -3
- package/dist/esm/utils/openai.js +60 -16
- package/dist/esm/utils/serialization/serialization.js +2 -19
- package/dist/esm/webAppRuntime.js +3 -2
- package/dist/types/api/createProcessor.d.ts +3 -0
- package/dist/types/exports.d.ts +1 -0
- package/dist/types/integrations/CodeRunner.d.ts +10 -7
- package/dist/types/integrations/CodeRunnerOptions.d.ts +15 -0
- package/dist/types/model/AgentResponseTrace.d.ts +123 -0
- package/dist/types/model/ConnectedToolContinuationHost.d.ts +34 -0
- package/dist/types/model/EditorDefinition.d.ts +16 -0
- package/dist/types/model/ExecutorProtocol.d.ts +32 -11
- package/dist/types/model/GraphProcessor.d.ts +41 -9
- package/dist/types/model/NodeBase.d.ts +0 -10
- package/dist/types/model/NodeImpl.d.ts +18 -1
- package/dist/types/model/Nodes.d.ts +2 -2
- package/dist/types/model/ProcessContext.d.ts +99 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +3 -1
- package/dist/types/model/RecordingPlayer.d.ts +6 -0
- package/dist/types/model/SplitRunProcessor.d.ts +10 -3
- package/dist/types/model/UiGraph.d.ts +8 -0
- package/dist/types/model/UiGraphActionProtocol.d.ts +3 -0
- package/dist/types/model/UiGraphBrowserRuntime.d.ts +11 -2
- package/dist/types/model/UiGraphRendererStyles.d.ts +1 -1
- package/dist/types/model/UiGraphRuntimeModel.d.ts +2 -0
- package/dist/types/model/UiGraphSchema.d.ts +1 -0
- package/dist/types/model/chat-v2/chatV2CallObserver.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2CredentialNames.d.ts +30 -0
- package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +2 -3
- package/dist/types/model/chat-v2/chatV2Outputs.d.ts +6 -16
- package/dist/types/model/chat-v2/chatV2Pipeline.d.ts +13 -17
- package/dist/types/model/chat-v2/chatV2ProviderProfile.d.ts +7 -0
- package/dist/types/model/chat-v2/chatV2ProviderRegistry.d.ts +8 -0
- package/dist/types/model/chat-v2/chatV2RequestPlan.d.ts +2 -2
- package/dist/types/model/chat-v2/chatV2ResponseBodyCapture.d.ts +25 -0
- package/dist/types/model/chat-v2/chatV2ResponseFormat.d.ts +3 -2
- package/dist/types/model/chat-v2/chatV2Retry.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2RuntimeOptions.d.ts +3 -8
- package/dist/types/model/chat-v2/chatV2Types.d.ts +44 -10
- package/dist/types/model/chat-v2/chatV2UsageAccounting.d.ts +14 -0
- package/dist/types/model/chat-v2/customProviderApi.d.ts +22 -0
- package/dist/types/model/chat-v2/index.d.ts +15 -0
- package/dist/types/model/chat-v2/llmChatV2Body.d.ts +24 -0
- package/dist/types/model/chat-v2/llmChatV2CacheBoundary.d.ts +10 -0
- package/dist/types/model/chat-v2/llmChatV2CachePolicy.d.ts +13 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +19 -3
- package/dist/types/model/chat-v2/llmChatV2NodeMigration.d.ts +8 -0
- package/dist/types/model/chat-v2/llmChatV2NodeRuntime.d.ts +14 -16
- package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +16 -0
- package/dist/types/model/chat-v2/llmInvocationDecision.d.ts +21 -0
- package/dist/types/model/chat-v2/llmInvocationJournal.d.ts +38 -0
- package/dist/types/model/chat-v2/llmInvocationPlan.d.ts +41 -0
- package/dist/types/model/chat-v2/llmInvocationProjections.d.ts +3 -0
- package/dist/types/model/chat-v2/llmInvocationResultProjector.d.ts +26 -0
- package/dist/types/model/chat-v2/llmModelCandidate.d.ts +20 -0
- package/dist/types/model/chat-v2/llmProfile.d.ts +14 -0
- package/dist/types/model/chat-v2/llmProfileBody.d.ts +20 -0
- package/dist/types/model/chat-v2/llmProfileFallback.d.ts +36 -49
- package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +209 -0
- package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +111 -0
- package/dist/types/model/chat-v2/llmProfileNodeRuntime.d.ts +1 -1
- package/dist/types/model/chat-v2/llmProfileTypes.d.ts +4 -1
- package/dist/types/model/chat-v2/llmResponseMaterializer.d.ts +20 -0
- package/dist/types/model/chat-v2/modelRegistry.d.ts +17 -187
- package/dist/types/model/chat-v2/parallelToolCalls.d.ts +3 -1
- package/dist/types/model/chat-v2/providerOptions.d.ts +12 -0
- package/dist/types/model/chat-v2/rivetToolRegistry.d.ts +11 -0
- package/dist/types/model/chat-v2/toolCallCodec.d.ts +7 -0
- package/dist/types/model/chat-v2/toolContinuation.d.ts +3 -3
- package/dist/types/model/chat-v2/toolHandlerResolver.d.ts +25 -0
- package/dist/types/model/chat-v2/toolRoundExecutor.d.ts +18 -0
- package/dist/types/model/nodes/ChatNode.d.ts +2 -1
- package/dist/types/model/nodes/CodeNewNode.d.ts +0 -5
- package/dist/types/model/nodes/CodeNode.d.ts +0 -5
- package/dist/types/model/nodes/DelegateFunctionCallNode.d.ts +2 -1
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +2 -1
- package/dist/types/model/nodes/LLMProfileNode.d.ts +2 -1
- package/dist/types/model/nodes/MatchNode.d.ts +6 -0
- package/dist/types/model/nodes/PromptNode.d.ts +4 -1
- package/dist/types/model/nodes/ToolNode.d.ts +2 -1
- package/dist/types/model/nodes/toolCallDelegation.d.ts +10 -3
- package/dist/types/plugins/anthropic/anthropic.d.ts +1 -0
- package/dist/types/plugins/gentrace/gentraceSdk.d.ts +0 -1
- package/dist/types/plugins/gentrace/plugin.d.ts +55 -9
- package/dist/types/plugins/google/google.d.ts +2 -8
- package/dist/types/plugins.d.ts +1 -1
- package/dist/types/recording/ExecutionRecorder.d.ts +7 -1
- package/dist/types/recording/RecordedEvents.d.ts +6 -0
- package/dist/types/utils/emitDetached.d.ts +3 -2
- package/dist/types/utils/openai.d.ts +49 -0
- package/dist/types/webAppRuntime.d.ts +4 -2
- package/package.json +2 -2
|
@@ -31,6 +31,7 @@ import { ManagedAsyncBranches } from './ManagedAsyncBranches.js';
|
|
|
31
31
|
import { KnowledgeStoreController } from '../integrations/KnowledgeStoreProvider.js';
|
|
32
32
|
import { isDataBusTopologyNode } from './DataBusTopology.js';
|
|
33
33
|
import { resolveNodePrefabInstance } from './NodePrefabResolver.js';
|
|
34
|
+
import { ConnectedToolContinuationHost, } from './ConnectedToolContinuationHost.js';
|
|
34
35
|
// eslint-disable-next-line import/no-cycle -- There has to be a cycle because CodeRunner needs to import the entirety of Rivet
|
|
35
36
|
import { IsomorphicCodeRunner } from '../integrations/CodeRunner.js';
|
|
36
37
|
const graphProcessorGraphOverride = Symbol('graphProcessorGraphOverride');
|
|
@@ -150,7 +151,7 @@ export class GraphProcessor {
|
|
|
150
151
|
#sharedRunStateOverride;
|
|
151
152
|
#suppressedPreloadedNodeIds = new Set();
|
|
152
153
|
#preloadedNodeResults = new Map();
|
|
153
|
-
#
|
|
154
|
+
#connectedToolContinuationHost = new ConnectedToolContinuationHost();
|
|
154
155
|
#continuationCompletionOwnerByNodeId = new Map();
|
|
155
156
|
#effectiveConnectionsForRun;
|
|
156
157
|
#asyncBranchPlansByTriggerNodeId = new Map();
|
|
@@ -409,6 +410,7 @@ export class GraphProcessor {
|
|
|
409
410
|
splitIndex: this.#executor.index,
|
|
410
411
|
}
|
|
411
412
|
: undefined,
|
|
413
|
+
...(this.#context?.evaluation === undefined ? {} : { evaluation: this.#context.evaluation }),
|
|
412
414
|
};
|
|
413
415
|
}
|
|
414
416
|
#withExecution(data, execution = this.#buildExecutionMetadata()) {
|
|
@@ -595,12 +597,19 @@ export class GraphProcessor {
|
|
|
595
597
|
}
|
|
596
598
|
}
|
|
597
599
|
async replayRecording(recorder) {
|
|
600
|
+
// Playback is a new root run, even though its node/graph events originate
|
|
601
|
+
// from a historic recording. Giving the processor a real identity here is
|
|
602
|
+
// essential if the user aborts while playback is in progress: abort()
|
|
603
|
+
// emits its own graph terminal outside RecordingPlayer's event adapter.
|
|
604
|
+
this.#initializeExecutionIdentity();
|
|
598
605
|
this.#initProcessState();
|
|
599
606
|
this.#graphOutputs = await replayExecutionRecording({
|
|
600
607
|
emitter: this.#emitter,
|
|
601
608
|
erroredNodes: this.#erroredNodes,
|
|
602
609
|
graphInputs: this.#graphInputs,
|
|
603
610
|
graphOutputs: this.#graphOutputs,
|
|
611
|
+
fallbackGraphId: this.#graph.metadata.id,
|
|
612
|
+
initialReplayExecution: this.#buildExecutionMetadata(),
|
|
604
613
|
isAborted: () => this.#lifecycle.isAborted,
|
|
605
614
|
nodeResults: this.#nodeResults,
|
|
606
615
|
project: this.#project,
|
|
@@ -641,7 +650,7 @@ export class GraphProcessor {
|
|
|
641
650
|
this.#graphOutputs = this.#sharedRunStateOverride?.graphOutputs ?? {};
|
|
642
651
|
this.#executionCache ??= new Map();
|
|
643
652
|
this.#queuedNodes = new Set();
|
|
644
|
-
this.#
|
|
653
|
+
this.#connectedToolContinuationHost.reset();
|
|
645
654
|
this.#continuationCompletionOwnerByNodeId = new Map();
|
|
646
655
|
this.#effectiveConnectionsForRun = undefined;
|
|
647
656
|
this.#asyncBranchPlansByTriggerNodeId = new Map();
|
|
@@ -698,12 +707,12 @@ export class GraphProcessor {
|
|
|
698
707
|
let outputsWerePublishedEarly = false;
|
|
699
708
|
const completionPromise = (async () => {
|
|
700
709
|
try {
|
|
701
|
-
this.#profileRuntimeSync('initializeGraphRun', () => this.#initializeGraphRun(context, inputs, contextValues));
|
|
702
|
-
await this.#profileRuntimeAsync('loadProjectReferences', () => this.#loadProjectReferences());
|
|
703
|
-
this.#profileRuntimeSync('prepareNodeProcessContextBase', () => this.#prepareNodeProcessContextBase());
|
|
704
|
-
const shouldUseSeededExecutionPlan = this.#seededExecutionPlanForNextRun() != null;
|
|
705
|
-
this.#useSeededExecutionPlanOnNextRun = false;
|
|
706
710
|
try {
|
|
711
|
+
this.#profileRuntimeSync('initializeGraphRun', () => this.#initializeGraphRun(context, inputs, contextValues));
|
|
712
|
+
await this.#profileRuntimeAsync('loadProjectReferences', () => this.#loadProjectReferences());
|
|
713
|
+
this.#profileRuntimeSync('prepareNodeProcessContextBase', () => this.#prepareNodeProcessContextBase());
|
|
714
|
+
const shouldUseSeededExecutionPlan = this.#seededExecutionPlanForNextRun() != null;
|
|
715
|
+
this.#useSeededExecutionPlanOnNextRun = false;
|
|
707
716
|
if (!shouldUseSeededExecutionPlan) {
|
|
708
717
|
this.#preprocessGraph();
|
|
709
718
|
}
|
|
@@ -712,13 +721,7 @@ export class GraphProcessor {
|
|
|
712
721
|
}
|
|
713
722
|
catch (error) {
|
|
714
723
|
const normalizedError = getError(error);
|
|
715
|
-
|
|
716
|
-
// ordinary root error event so every executor can present an
|
|
717
|
-
// actionable configuration failure instead of only rejecting the
|
|
718
|
-
// processGraph promise.
|
|
719
|
-
if (!this.#isSubProcessor && !this.#suppressGraphLifecycleEvents) {
|
|
720
|
-
await this.#emitter.emit('error', { error: normalizedError });
|
|
721
|
-
}
|
|
724
|
+
await this.#emitRootStartupError(normalizedError);
|
|
722
725
|
throw normalizedError;
|
|
723
726
|
}
|
|
724
727
|
await this.#profileRuntimeAsync('emitGraphStart', () => this.#emitGraphStart());
|
|
@@ -781,10 +784,19 @@ export class GraphProcessor {
|
|
|
781
784
|
await this.#emitter.emit('finish', undefined);
|
|
782
785
|
}
|
|
783
786
|
#initializeGraphRun(context, inputs, contextValues) {
|
|
787
|
+
this.#initializeExecutionIdentity();
|
|
784
788
|
this.#initProcessState();
|
|
785
789
|
this.#context = context;
|
|
786
790
|
this.#graphInputs = inputs;
|
|
787
791
|
this.#contextValues = contextValues;
|
|
792
|
+
this.#cleanupTokenizerErrorListener();
|
|
793
|
+
const unsubscribeTokenizerError = this.#context.tokenizer.on('error', (error) => {
|
|
794
|
+
emitDetached(this.#emitter, 'error', { error });
|
|
795
|
+
});
|
|
796
|
+
this.#unsubscribeTokenizerError =
|
|
797
|
+
typeof unsubscribeTokenizerError === 'function' ? unsubscribeTokenizerError : undefined;
|
|
798
|
+
}
|
|
799
|
+
#initializeExecutionIdentity() {
|
|
788
800
|
if (this.#executionIdentityOverride) {
|
|
789
801
|
this.#rootRunId = this.#executionIdentityOverride.rootRunId;
|
|
790
802
|
this.#graphRunId = this.#executionIdentityOverride.graphRunId;
|
|
@@ -795,14 +807,25 @@ export class GraphProcessor {
|
|
|
795
807
|
this.#graphRunId = nanoid();
|
|
796
808
|
this.#parentGraphRunId = this.#parent ? this.#parent.#graphRunId : undefined;
|
|
797
809
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
810
|
+
}
|
|
811
|
+
async #emitRootStartupError(error) {
|
|
812
|
+
// Startup can fail before graphStart/nodeStart: initialization, reference
|
|
813
|
+
// loading, process-context construction, or graph preflight. Emit the
|
|
814
|
+
// same scoped graph terminal plus unscoped root confirmation as ordinary
|
|
815
|
+
// runtime failures so observers can establish a truthful root lifecycle.
|
|
816
|
+
if (this.#isSubProcessor || this.#suppressGraphLifecycleEvents) {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
await this.#emitter.emit('graphError', this.#withExecution({ graph: this.#graph, error }));
|
|
820
|
+
await this.#emitter.emit('error', { error });
|
|
804
821
|
}
|
|
805
822
|
#prepareNodeProcessContextBase() {
|
|
823
|
+
// Subgraphs receive their caller's InternalProcessContext, whose observer
|
|
824
|
+
// is already a GraphProcessor wrapper. Always resolve the original host
|
|
825
|
+
// observer from the root run so nested LLM calls are not emitted once by
|
|
826
|
+
// every ancestor before their own event is bridged to the root emitter.
|
|
827
|
+
const hostChatV2Observer = this.getRootProcessor().#context.onChatV2CallFinished;
|
|
828
|
+
const hostLLMProfileAttemptObserver = this.getRootProcessor().#context.onLLMProfileAttempt;
|
|
806
829
|
this.#nodeProcessContextBase = {
|
|
807
830
|
...this.#context,
|
|
808
831
|
abortGraph: (error) => {
|
|
@@ -820,6 +843,38 @@ export class GraphProcessor {
|
|
|
820
843
|
graphInputNodeValues: this.#graphInputNodeValues,
|
|
821
844
|
graphInputs: this.#graphInputs,
|
|
822
845
|
graphOutputs: this.#graphOutputs,
|
|
846
|
+
onChatV2CallFinished: (event) => {
|
|
847
|
+
try {
|
|
848
|
+
const observerResult = hostChatV2Observer?.(event);
|
|
849
|
+
if (observerResult != null && typeof observerResult.then === 'function') {
|
|
850
|
+
void Promise.resolve(observerResult).catch(() => undefined);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
catch {
|
|
854
|
+
// Host observers must never change graph execution.
|
|
855
|
+
}
|
|
856
|
+
// Runtime traces carry only the normalized, provider-neutral usage
|
|
857
|
+
// contract. The host observer above retains its existing raw accounting
|
|
858
|
+
// callback, but provider-shaped usage never enters recordings or remote
|
|
859
|
+
// trace transport.
|
|
860
|
+
const { rawUsage: _rawUsage, ...traceEvent } = event;
|
|
861
|
+
emitDetached(this.#emitter, 'llmCallFinished', this.#withExecution(traceEvent));
|
|
862
|
+
},
|
|
863
|
+
onLLMProfileAttempt: (event) => {
|
|
864
|
+
try {
|
|
865
|
+
const observerResult = hostLLMProfileAttemptObserver?.(event);
|
|
866
|
+
if (observerResult != null && typeof observerResult.then === 'function') {
|
|
867
|
+
void Promise.resolve(observerResult).catch(() => undefined);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
catch {
|
|
871
|
+
// Host observers must never change graph execution.
|
|
872
|
+
}
|
|
873
|
+
emitDetached(this.#emitter, 'llmProfileAttempt', this.#withExecution(event));
|
|
874
|
+
},
|
|
875
|
+
onToolCallFinished: (event) => {
|
|
876
|
+
emitDetached(this.#emitter, 'toolCallFinished', this.#withExecution(event));
|
|
877
|
+
},
|
|
823
878
|
project: this.#project,
|
|
824
879
|
raiseEvent: (event, data) => {
|
|
825
880
|
this.getRootProcessor().raiseEvent(event, data);
|
|
@@ -880,11 +935,13 @@ export class GraphProcessor {
|
|
|
880
935
|
node,
|
|
881
936
|
inputs: {},
|
|
882
937
|
processId: 'preload',
|
|
938
|
+
resultOrigin: 'preloaded',
|
|
883
939
|
}));
|
|
884
940
|
await this.#emitter.emit('nodeFinish', this.#withExecution({
|
|
885
941
|
node,
|
|
886
942
|
outputs: this.#nodeResults.get(node.id),
|
|
887
943
|
processId: 'preload',
|
|
944
|
+
resultOrigin: 'preloaded',
|
|
888
945
|
}));
|
|
889
946
|
}
|
|
890
947
|
}
|
|
@@ -1559,7 +1616,7 @@ export class GraphProcessor {
|
|
|
1559
1616
|
}
|
|
1560
1617
|
const frozenOutputs = this.#resolveFrozenNodeOutputs(node, inputValues, processId);
|
|
1561
1618
|
if (frozenOutputs && node.type === 'startBackgroundBranch') {
|
|
1562
|
-
await this.#nodeErrored(node, new Error('Start Async Branch cannot use frozen outputs because replaying it could repeat async side effects.'), processId);
|
|
1619
|
+
await this.#nodeErrored(node, new Error('Start Async Branch cannot use frozen outputs because replaying it could repeat async side effects.'), processId, undefined, undefined, 'frozen');
|
|
1563
1620
|
}
|
|
1564
1621
|
else if (frozenOutputs) {
|
|
1565
1622
|
await this.#processFrozenNode(node, processId, inputValues, frozenOutputs);
|
|
@@ -1576,14 +1633,15 @@ export class GraphProcessor {
|
|
|
1576
1633
|
async #processSplitRunNode(node, processId) {
|
|
1577
1634
|
return processSplitRunNode(node, processId, {
|
|
1578
1635
|
getInputValues: (n) => this.#getInputValuesForNode(n),
|
|
1636
|
+
getInputConnections: (n) => this.#getInputConnectionsForNode(n),
|
|
1579
1637
|
getInputDefinitions: (n) => this.#definitions[n.id]?.inputs ?? [],
|
|
1580
1638
|
isExcludedDueToControlFlow: (n, inputs, pid) => this.#excludedDueToControlFlow(n, inputs, pid) !== false,
|
|
1581
|
-
processNodeWithInputData: (n, inputs, idx, pid, partial) => this.#processNodeWithInputData(n, inputs, idx, pid, partial),
|
|
1639
|
+
processNodeWithInputData: (n, inputs, idx, pid, partial, markResultAsEditorCacheHit) => this.#processNodeWithInputData(n, inputs, idx, pid, partial, markResultAsEditorCacheHit),
|
|
1582
1640
|
splitRunConcurrency: this.#concurrency.splitRunConcurrency,
|
|
1583
1641
|
accumulateCost: (output) => this.#accumulateCost(output),
|
|
1584
1642
|
setNodeResults: (nodeId, outputs) => this.#nodeResults.set(nodeId, outputs),
|
|
1585
1643
|
markNodeVisited: (nodeId) => this.#visitedNodes.add(nodeId),
|
|
1586
|
-
nodeErrored: (n, err, pid, durationMs, splitRunDurationMs) => this.#nodeErrored(n, err, pid, durationMs, splitRunDurationMs),
|
|
1644
|
+
nodeErrored: (n, err, pid, durationMs, splitRunDurationMs, resultOrigin) => this.#nodeErrored(n, err, pid, durationMs, splitRunDurationMs, resultOrigin),
|
|
1587
1645
|
isAborted: () => this.#lifecycle.isAborted,
|
|
1588
1646
|
getAbortError: () => createGraphAbortErrorFromSignal(this.#abortController.signal),
|
|
1589
1647
|
emit: (event, data) => {
|
|
@@ -1607,7 +1665,13 @@ export class GraphProcessor {
|
|
|
1607
1665
|
});
|
|
1608
1666
|
}
|
|
1609
1667
|
async #processFrozenNode(node, processId, inputValues, outputValues) {
|
|
1610
|
-
await this.#emitter.emit('nodeStart', this.#withExecution({
|
|
1668
|
+
await this.#emitter.emit('nodeStart', this.#withExecution({
|
|
1669
|
+
node,
|
|
1670
|
+
inputs: inputValues,
|
|
1671
|
+
inputConnections: this.#getInputConnectionsForNode(node),
|
|
1672
|
+
processId,
|
|
1673
|
+
resultOrigin: 'frozen',
|
|
1674
|
+
}));
|
|
1611
1675
|
const timingStart = this.#startNodeTiming();
|
|
1612
1676
|
this.#nodeResults.set(node.id, outputValues);
|
|
1613
1677
|
this.#visitedNodes.add(node.id);
|
|
@@ -1617,6 +1681,7 @@ export class GraphProcessor {
|
|
|
1617
1681
|
node,
|
|
1618
1682
|
outputs: outputValues,
|
|
1619
1683
|
processId,
|
|
1684
|
+
resultOrigin: 'frozen',
|
|
1620
1685
|
}, this.#finishNodeTiming(timingStart))));
|
|
1621
1686
|
}
|
|
1622
1687
|
async #applyFrozenNodeDataflowEffects(node, outputValues, processId) {
|
|
@@ -1634,10 +1699,19 @@ export class GraphProcessor {
|
|
|
1634
1699
|
async #processNormalNode(node, processId, inputValues) {
|
|
1635
1700
|
// Use awaited emit (not emitDetached) so that listeners can yield to the
|
|
1636
1701
|
// macrotask queue, giving the browser a chance to repaint during execution.
|
|
1637
|
-
await this.#emitter.emit('nodeStart', this.#withExecution({
|
|
1702
|
+
await this.#emitter.emit('nodeStart', this.#withExecution({
|
|
1703
|
+
node,
|
|
1704
|
+
inputs: inputValues,
|
|
1705
|
+
inputConnections: this.#getInputConnectionsForNode(node),
|
|
1706
|
+
processId,
|
|
1707
|
+
resultOrigin: 'executed',
|
|
1708
|
+
}));
|
|
1638
1709
|
const timingStart = this.#startNodeTiming();
|
|
1710
|
+
let resultOrigin = 'executed';
|
|
1639
1711
|
try {
|
|
1640
|
-
const outputValues = await this.#processNodeWithInputData(node, inputValues, 0, processId, (node, partialOutputs, index) => this.#emitNodePartialOutput(node, partialOutputs, index, processId))
|
|
1712
|
+
const outputValues = await this.#processNodeWithInputData(node, inputValues, 0, processId, (node, partialOutputs, index) => this.#emitNodePartialOutput(node, partialOutputs, index, processId), () => {
|
|
1713
|
+
resultOrigin = 'editor-cache';
|
|
1714
|
+
});
|
|
1641
1715
|
this.#nodeResults.set(node.id, outputValues);
|
|
1642
1716
|
this.#visitedNodes.add(node.id);
|
|
1643
1717
|
this.#accumulateCost(outputValues);
|
|
@@ -1645,26 +1719,27 @@ export class GraphProcessor {
|
|
|
1645
1719
|
node,
|
|
1646
1720
|
outputs: outputValues,
|
|
1647
1721
|
processId,
|
|
1722
|
+
resultOrigin,
|
|
1648
1723
|
}, this.#finishNodeTiming(timingStart))));
|
|
1649
1724
|
}
|
|
1650
1725
|
catch (error) {
|
|
1651
|
-
await this.#nodeErrored(node, error, processId, this.#finishNodeTiming(timingStart));
|
|
1726
|
+
await this.#nodeErrored(node, error, processId, this.#finishNodeTiming(timingStart), undefined, resultOrigin);
|
|
1652
1727
|
}
|
|
1653
1728
|
}
|
|
1654
|
-
async #nodeErrored(node, e, processId, durationMs, splitRunDurationMs) {
|
|
1729
|
+
async #nodeErrored(node, e, processId, durationMs, splitRunDurationMs, resultOrigin = 'executed') {
|
|
1655
1730
|
const error = getError(e);
|
|
1656
1731
|
const exclusionReason = this.#getErrorExclusionReason(node, error, processId);
|
|
1657
1732
|
if (exclusionReason) {
|
|
1658
|
-
await this.#emitNodeExcluded(node, processId, this.#getInputValuesForNode(node), exclusionReason);
|
|
1733
|
+
await this.#emitNodeExcluded(node, processId, this.#getInputValuesForNode(node), exclusionReason, resultOrigin);
|
|
1659
1734
|
this.#emitTraceEvent(`Node ${node.title} (${node.id}-${processId}) was excluded: ${exclusionReason}`);
|
|
1660
1735
|
return;
|
|
1661
1736
|
}
|
|
1662
1737
|
this.#erroredNodes.set(node.id, error);
|
|
1663
|
-
await this.#emitter.emit('nodeError', this.#withExecution(withOptionalDuration({ node, error, processId }, durationMs, splitRunDurationMs)));
|
|
1738
|
+
await this.#emitter.emit('nodeError', this.#withExecution(withOptionalDuration({ node, error, processId, resultOrigin }, durationMs, splitRunDurationMs)));
|
|
1664
1739
|
this.#emitTraceEvent(`Node ${node.title} (${node.id}-${processId}) errored: ${error.stack}`);
|
|
1665
1740
|
}
|
|
1666
1741
|
#emitNodePartialOutput(node, outputs, index, processId) {
|
|
1667
|
-
emitDetached(this.#emitter, 'partialOutput', this.#withExecution({ node, outputs, index, processId }));
|
|
1742
|
+
emitDetached(this.#emitter, 'partialOutput', this.#withExecution({ node, outputs, index, processId, resultOrigin: 'executed' }));
|
|
1668
1743
|
}
|
|
1669
1744
|
#getErrorExclusionReason(node, error, processId) {
|
|
1670
1745
|
if (this.#getAttachedDataTo(node).races?.completed) {
|
|
@@ -1767,7 +1842,7 @@ export class GraphProcessor {
|
|
|
1767
1842
|
this.#abortNodeControllersForNode(nodeId, undefined, reason);
|
|
1768
1843
|
}
|
|
1769
1844
|
}
|
|
1770
|
-
async #processNodeWithInputData(node, inputValues, index, processId, partialOutput) {
|
|
1845
|
+
async #processNodeWithInputData(node, inputValues, index, processId, partialOutput, markResultAsEditorCacheHit) {
|
|
1771
1846
|
const instance = this.#nodeInstances[node.id];
|
|
1772
1847
|
const nodeAbortController = this.#newAbortController();
|
|
1773
1848
|
this.#registerNodeAbortController(node.id, nodeAbortController);
|
|
@@ -1779,7 +1854,7 @@ export class GraphProcessor {
|
|
|
1779
1854
|
const createContextProfileStart = this.#startRuntimeProfile();
|
|
1780
1855
|
let context;
|
|
1781
1856
|
try {
|
|
1782
|
-
context = this.#createNodeProcessContext(node, inputValues, index, processId, nodeAbortController, partialOutput);
|
|
1857
|
+
context = this.#createNodeProcessContext(node, inputValues, index, processId, nodeAbortController, partialOutput, undefined, markResultAsEditorCacheHit);
|
|
1783
1858
|
}
|
|
1784
1859
|
finally {
|
|
1785
1860
|
this.#finishRuntimeProfile('createNodeProcessContext', createContextProfileStart);
|
|
@@ -1817,7 +1892,7 @@ export class GraphProcessor {
|
|
|
1817
1892
|
#getTokenizer() {
|
|
1818
1893
|
return this.#context.tokenizer;
|
|
1819
1894
|
}
|
|
1820
|
-
#createNodeProcessContext(node, inputValues, index, processId, nodeAbortController, partialOutput) {
|
|
1895
|
+
#createNodeProcessContext(node, inputValues, index, processId, nodeAbortController, partialOutput, toolCallTraceSource, markResultAsEditorCacheHit) {
|
|
1821
1896
|
const plugin = this.#registry.getPluginFor(node.type);
|
|
1822
1897
|
const toolCallContinuation = this.#getToolCallContinuationContext(node, nodeAbortController.signal, processId, index);
|
|
1823
1898
|
return buildNodeProcessContext({
|
|
@@ -1829,6 +1904,7 @@ export class GraphProcessor {
|
|
|
1829
1904
|
externalFunctions: this.#externalFunctions,
|
|
1830
1905
|
getPluginConfig: (name) => getPluginConfig(plugin, this.#context.settings, name),
|
|
1831
1906
|
isDirectRunTarget: this.runToNodeIds?.includes(node.id) ?? false,
|
|
1907
|
+
markResultAsEditorCacheHit,
|
|
1832
1908
|
node,
|
|
1833
1909
|
nodeAbortController,
|
|
1834
1910
|
onPartialOutputs: (partialOutputs) => {
|
|
@@ -1848,6 +1924,7 @@ export class GraphProcessor {
|
|
|
1848
1924
|
emitDetached(this.#emitter, 'globalSet', this.#withExecution({ id, value, processId }));
|
|
1849
1925
|
},
|
|
1850
1926
|
toolCallContinuation,
|
|
1927
|
+
toolCallTraceSource,
|
|
1851
1928
|
waitEvent: async (event) => {
|
|
1852
1929
|
return new Promise((resolve, reject) => {
|
|
1853
1930
|
const abortListener = () => {
|
|
@@ -1881,51 +1958,46 @@ export class GraphProcessor {
|
|
|
1881
1958
|
throw new Error(`LLM Chat "${node.title}" has ${resolution.candidates.length} connected Delegate Tool Call nodes. Auto-continue requires exactly one Delegate Tool Call connection.`);
|
|
1882
1959
|
}
|
|
1883
1960
|
const delegateNode = resolution.delegateNode;
|
|
1884
|
-
|
|
1885
|
-
|
|
1961
|
+
return this.#connectedToolContinuationHost.begin({
|
|
1962
|
+
key: this.#getToolCallContinuationInvocationKey(processId, index),
|
|
1886
1963
|
delegateNode,
|
|
1887
|
-
latestOutputs: new Map(),
|
|
1888
1964
|
llmNodeId: node.id,
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
return {
|
|
1893
|
-
run: (toolCalls, assistantMessage) => this.#runToolCallContinuationRound(node, invocation, toolCalls, assistantMessage, llmSignal),
|
|
1894
|
-
release: () => {
|
|
1895
|
-
invocation.released = true;
|
|
1896
|
-
},
|
|
1897
|
-
};
|
|
1965
|
+
llmProcessId: processId,
|
|
1966
|
+
run: (invocation, toolCalls, assistantMessage) => this.#runToolCallContinuationRound(node, invocation, toolCalls, assistantMessage, llmSignal),
|
|
1967
|
+
});
|
|
1898
1968
|
}
|
|
1899
1969
|
#getToolCallContinuationInvocationKey(processId, index) {
|
|
1900
1970
|
return `${processId}:${index}`;
|
|
1901
1971
|
}
|
|
1902
1972
|
#finalizeToolCallContinuation(processId, index, nodeOutputs) {
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1973
|
+
this.#connectedToolContinuationHost.finalize({
|
|
1974
|
+
key: this.#getToolCallContinuationInvocationKey(processId, index),
|
|
1975
|
+
nodeOutputs,
|
|
1976
|
+
replay: (invocation, outputs) => {
|
|
1977
|
+
if (invocation.latestOutputs.size !== 0)
|
|
1978
|
+
return;
|
|
1979
|
+
const replayedCalls = outputs['function-calls'];
|
|
1980
|
+
if (replayedCalls?.type === 'object[]' &&
|
|
1981
|
+
replayedCalls.value.length > 0 &&
|
|
1982
|
+
replayedCalls.value.every(isDelegatedToolCallRecord)) {
|
|
1983
|
+
invocation.latestOutputs.set(invocation.delegateNode.id, buildDelegatedToolCallOutputs(replayedCalls.value));
|
|
1984
|
+
}
|
|
1985
|
+
},
|
|
1986
|
+
commit: (invocation) => {
|
|
1987
|
+
for (const [nodeId, outputs] of invocation.latestOutputs) {
|
|
1988
|
+
this.#nodeResults.set(nodeId, outputs);
|
|
1989
|
+
this.#visitedNodes.add(nodeId);
|
|
1990
|
+
this.#remainingNodes.delete(nodeId);
|
|
1991
|
+
this.#continuationCompletionOwnerByNodeId.set(nodeId, invocation.llmNodeId);
|
|
1992
|
+
}
|
|
1993
|
+
},
|
|
1994
|
+
});
|
|
1923
1995
|
}
|
|
1924
1996
|
#discardToolCallContinuation(processId, index) {
|
|
1925
|
-
this.#
|
|
1997
|
+
this.#connectedToolContinuationHost.discard(this.#getToolCallContinuationInvocationKey(processId, index));
|
|
1926
1998
|
}
|
|
1927
1999
|
async #runToolCallContinuationRound(llmNode, invocation, toolCalls, assistantMessage, llmSignal) {
|
|
1928
|
-
const round = await new ToolCallContinuationCoordinator(this.#createToolCallContinuationCoordinatorAdapter()).run({
|
|
2000
|
+
const round = await new ToolCallContinuationCoordinator(this.#createToolCallContinuationCoordinatorAdapter(llmNode.id, invocation.llmProcessId)).run({
|
|
1929
2001
|
assistantMessage,
|
|
1930
2002
|
delegateNode: invocation.delegateNode,
|
|
1931
2003
|
llmNode,
|
|
@@ -1943,7 +2015,7 @@ export class GraphProcessor {
|
|
|
1943
2015
|
}
|
|
1944
2016
|
return [...round.results];
|
|
1945
2017
|
}
|
|
1946
|
-
#createToolCallContinuationCoordinatorAdapter() {
|
|
2018
|
+
#createToolCallContinuationCoordinatorAdapter(sourceNodeId, sourceProcessId) {
|
|
1947
2019
|
return {
|
|
1948
2020
|
accumulateCost: (outputs) => this.#accumulateCost(outputs),
|
|
1949
2021
|
createBranchAdapter: () => {
|
|
@@ -1956,7 +2028,7 @@ export class GraphProcessor {
|
|
|
1956
2028
|
},
|
|
1957
2029
|
};
|
|
1958
2030
|
},
|
|
1959
|
-
createDelegateProcessContext: (node, inputs, processId, nodeAbortController) => this.#createNodeProcessContext(node, inputs, 0, processId, nodeAbortController, (partialNode, partialOutputs, index) => this.#emitNodePartialOutput(partialNode, partialOutputs, index, processId)),
|
|
2031
|
+
createDelegateProcessContext: (node, inputs, processId, nodeAbortController) => this.#createNodeProcessContext(node, inputs, 0, processId, nodeAbortController, (partialNode, partialOutputs, index) => this.#emitNodePartialOutput(partialNode, partialOutputs, index, processId), { nodeId: sourceNodeId, processId: sourceProcessId }),
|
|
1960
2032
|
createNodeAbortController: () => this.#newAbortController(),
|
|
1961
2033
|
emitDelegateError: (node, error, processId, timingStart) => this.#nodeErrored(node, error, processId, this.#finishNodeTiming(timingStart)),
|
|
1962
2034
|
emitDelegateFinish: async (node, outputs, processId, timingStart) => {
|
|
@@ -1964,10 +2036,17 @@ export class GraphProcessor {
|
|
|
1964
2036
|
node,
|
|
1965
2037
|
outputs,
|
|
1966
2038
|
processId,
|
|
2039
|
+
resultOrigin: 'executed',
|
|
1967
2040
|
}, this.#finishNodeTiming(timingStart))));
|
|
1968
2041
|
},
|
|
1969
2042
|
emitDelegatePartialOutput: (node, outputs, processId) => this.#emitNodePartialOutput(node, outputs, 0, processId),
|
|
1970
|
-
emitDelegateStart: (node, inputs, processId) => this.#emitter.emit('nodeStart', this.#withExecution({
|
|
2043
|
+
emitDelegateStart: (node, inputs, processId) => this.#emitter.emit('nodeStart', this.#withExecution({
|
|
2044
|
+
node,
|
|
2045
|
+
inputs,
|
|
2046
|
+
inputConnections: this.#getInputConnectionsForNode(node),
|
|
2047
|
+
processId,
|
|
2048
|
+
resultOrigin: 'executed',
|
|
2049
|
+
})),
|
|
1971
2050
|
getActiveOutputPortIds: (node) => this.#getActiveOutputPortIds(node),
|
|
1972
2051
|
getContinuationBranchBoundaryNodeIds: (llmNode) => new Set([llmNode.id, ...this.#currentlyProcessing]),
|
|
1973
2052
|
hasPreloadedOrFrozenDelegateOutput: (node, inputs, processId) => this.#nodeResults.has(node.id) || this.#resolveFrozenNodeOutputs(node, inputs, processId) != null,
|
|
@@ -2375,6 +2454,7 @@ export class GraphProcessor {
|
|
|
2375
2454
|
node: executorNode,
|
|
2376
2455
|
outputs: partialOutputs,
|
|
2377
2456
|
processId: this.#executor.processId,
|
|
2457
|
+
resultOrigin: 'executed',
|
|
2378
2458
|
execution: parentExecution,
|
|
2379
2459
|
});
|
|
2380
2460
|
}
|
|
@@ -2511,10 +2591,10 @@ export class GraphProcessor {
|
|
|
2511
2591
|
#markAsExcluded(node, processId, inputValues, reason) {
|
|
2512
2592
|
emitDetached(this.#emitter, 'nodeExcluded', this.#createNodeExcludedEvent(node, processId, inputValues, reason));
|
|
2513
2593
|
}
|
|
2514
|
-
async #emitNodeExcluded(node, processId, inputValues, reason) {
|
|
2515
|
-
await this.#emitter.emit('nodeExcluded', this.#createNodeExcludedEvent(node, processId, inputValues, reason));
|
|
2594
|
+
async #emitNodeExcluded(node, processId, inputValues, reason, resultOrigin = 'executed') {
|
|
2595
|
+
await this.#emitter.emit('nodeExcluded', this.#createNodeExcludedEvent(node, processId, inputValues, reason, resultOrigin));
|
|
2516
2596
|
}
|
|
2517
|
-
#createNodeExcludedEvent(node, processId, inputValues, reason) {
|
|
2597
|
+
#createNodeExcludedEvent(node, processId, inputValues, reason, resultOrigin = 'executed') {
|
|
2518
2598
|
const outputs = createExcludedNodeOutputs(node, this.#definitions[node.id].outputs);
|
|
2519
2599
|
this.#nodeResults.set(node.id, outputs);
|
|
2520
2600
|
return this.#withExecution({
|
|
@@ -2523,6 +2603,7 @@ export class GraphProcessor {
|
|
|
2523
2603
|
inputs: inputValues,
|
|
2524
2604
|
outputs,
|
|
2525
2605
|
reason,
|
|
2606
|
+
resultOrigin,
|
|
2526
2607
|
});
|
|
2527
2608
|
}
|
|
2528
2609
|
#getInputValuesForNode(node) {
|
|
@@ -2539,6 +2620,16 @@ export class GraphProcessor {
|
|
|
2539
2620
|
return values;
|
|
2540
2621
|
}, {});
|
|
2541
2622
|
}
|
|
2623
|
+
#getInputConnectionsForNode(node) {
|
|
2624
|
+
return this.#getEffectiveConnections()
|
|
2625
|
+
.filter((connection) => connection.inputNodeId === node.id)
|
|
2626
|
+
.map(({ outputNodeId, outputId, inputNodeId, inputId }) => ({
|
|
2627
|
+
outputNodeId,
|
|
2628
|
+
outputId,
|
|
2629
|
+
inputNodeId,
|
|
2630
|
+
inputId,
|
|
2631
|
+
}));
|
|
2632
|
+
}
|
|
2542
2633
|
get #executionState() {
|
|
2543
2634
|
return {
|
|
2544
2635
|
connections: this.#connections,
|
|
@@ -34,6 +34,9 @@ export class NodeImpl {
|
|
|
34
34
|
getBody(_context) {
|
|
35
35
|
return undefined;
|
|
36
36
|
}
|
|
37
|
+
getRunActivityDescriptor() {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
37
40
|
}
|
|
38
41
|
export class PluginNodeImplClass extends NodeImpl {
|
|
39
42
|
impl;
|
|
@@ -56,4 +59,7 @@ export class PluginNodeImplClass extends NodeImpl {
|
|
|
56
59
|
getBody(context) {
|
|
57
60
|
return this.impl.getBody(this.data, context);
|
|
58
61
|
}
|
|
62
|
+
getRunActivityDescriptor() {
|
|
63
|
+
return this.impl.getRunActivityDescriptor?.(this.data);
|
|
64
|
+
}
|
|
59
65
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export function buildNodeProcessContext(options) {
|
|
2
|
-
const { attachedData, activeOutputPortIds, base, createSubProcessor, execution, externalFunctions, getPluginConfig, isDirectRunTarget, node, nodeAbortController, onPartialOutputs, processId, requestUserInput, reportProgress, setGlobal, toolCallContinuation, waitEvent, } = options;
|
|
2
|
+
const { attachedData, activeOutputPortIds, base, createSubProcessor, execution, externalFunctions, getPluginConfig, isDirectRunTarget, markResultAsEditorCacheHit, node, nodeAbortController, onPartialOutputs, processId, requestUserInput, reportProgress, setGlobal, toolCallContinuation, toolCallTraceSource, waitEvent, } = options;
|
|
3
3
|
return {
|
|
4
4
|
...base,
|
|
5
5
|
node,
|
|
6
6
|
attachedData,
|
|
7
7
|
activeOutputPortIds,
|
|
8
8
|
isDirectRunTarget,
|
|
9
|
+
markResultAsEditorCacheHit,
|
|
9
10
|
waitEvent,
|
|
10
11
|
externalFunctions: { ...externalFunctions },
|
|
11
12
|
onPartialOutputs,
|
|
@@ -17,6 +18,7 @@ export function buildNodeProcessContext(options) {
|
|
|
17
18
|
requestUserInput,
|
|
18
19
|
reportProgress,
|
|
19
20
|
toolCallContinuation,
|
|
21
|
+
toolCallTraceSource,
|
|
20
22
|
execution,
|
|
21
23
|
};
|
|
22
24
|
}
|