@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
|
@@ -8,6 +8,7 @@ import { UiGraphNormalizationError } from '../../model/UiGraphNormalization.js';
|
|
|
8
8
|
import { datasetV4Deserializer, datasetV4Serializer, graphV4Deserializer, graphV4Serializer, projectV4Deserializer, projectV4Serializer, } from './serialization_v4.js';
|
|
9
9
|
import { graphV2Deserializer, projectV2Deserializer } from './serialization_v2.js';
|
|
10
10
|
import { graphV1Deserializer, projectV1Deserializer } from './serialization_v1.js';
|
|
11
|
+
import { normalizeSerializedLLMChatV2Node } from '../../model/chat-v2/llmChatV2NodeMigration.js';
|
|
11
12
|
export function serializeProject(project, attachedData) {
|
|
12
13
|
return projectV4Serializer(project, attachedData);
|
|
13
14
|
}
|
|
@@ -71,24 +72,6 @@ function hasLegacyDataBusFlag(node) {
|
|
|
71
72
|
const data = node.data;
|
|
72
73
|
return node.type === 'passthrough' && data != null && Object.hasOwn(data, 'renderAsDataBus');
|
|
73
74
|
}
|
|
74
|
-
function migrateLegacyLLMChatV2Diagnostics(node) {
|
|
75
|
-
if (node.type !== 'llmChatV2' || node.data == null || typeof node.data !== 'object') {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const data = node.data;
|
|
79
|
-
if (data.outputRequestStatus !== true) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
// Output request details used to expose all three diagnostics together.
|
|
83
|
-
// Materialize the split settings on load so existing output connections and
|
|
84
|
-
// editor-visible behavior remain unchanged after the setting was separated.
|
|
85
|
-
if (!Object.hasOwn(data, 'outputRequestError')) {
|
|
86
|
-
data.outputRequestError = true;
|
|
87
|
-
}
|
|
88
|
-
if (!Object.hasOwn(data, 'outputRequestBody')) {
|
|
89
|
-
data.outputRequestBody = true;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
75
|
function normalizeDeserializedNode(node) {
|
|
93
76
|
if (node.type === 'code' && node.title === 'Code') {
|
|
94
77
|
node.title = 'Code (legacy)';
|
|
@@ -100,7 +83,7 @@ function normalizeDeserializedNode(node) {
|
|
|
100
83
|
const { renderAsDataBus: _legacyFlag, ...data } = node.data;
|
|
101
84
|
node.data = data;
|
|
102
85
|
}
|
|
103
|
-
|
|
86
|
+
normalizeSerializedLLMChatV2Node(node);
|
|
104
87
|
}
|
|
105
88
|
function deserializeProjectByVersion(serializedProject, version) {
|
|
106
89
|
switch (version) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { isAgentResponseTrace } from './model/AgentResponseTrace.js';
|
|
2
|
+
export { createUiGraphChatHistoryFlushStatePatch, createUiGraphChatMessageRemovalStatePatch, createUiGraphChatPinStatePatch, createUiGraphChatSubmissionStatePatch, getUiGraphActionState, getUiGraphChatDraftStateKey, getUiGraphChatMessagesStateKey, } from './model/UiGraph.js';
|
|
2
3
|
export { applyUiGraphStatePatch, createUiGraphActionExecutionController, createUiGraphInteractionController, getUiGraphComponentRenderModel, getUiGraphJsonOutputFilename, getUiGraphProgressiveJsonOutputChunks, } from './model/UiGraphRuntimeModel.js';
|
|
3
4
|
export { parseRivetWebAppClientMessage, parseRivetWebAppServerMessage, RIVET_WEB_APP_ACTION_PROTOCOL_VERSION, } from './model/UiGraphActionProtocol.js';
|
|
4
|
-
export { copyUiGraphText, applyUiGraphWebAppStorageActionPatch, applyUiGraphWebAppStoragePatch, clearUiGraphChatSearchMatches, downloadUiGraphJsonOutput, enhanceUiGraphChatJsonCodeBlocks, hasUiGraphChatPersistentStateChanged, getUiGraphChatPersistentState, getUiGraphChatMessagePresentations, getUiGraphChatStorageKey, getUiGraphWebAppStorageKey, highlightUiGraphChatSearchMatches, loadUiGraphChatPersistentState, loadUiGraphWebAppStorage, observeUiGraphOutputResizeBounds, revealUiGraphChatElement, revealUiGraphChatSearchMatch, saveUiGraphChatPersistentState, } from './model/UiGraphBrowserRuntime.js';
|
|
5
|
+
export { copyUiGraphText, applyUiGraphWebAppStorageActionPatch, applyUiGraphWebAppStoragePatch, clearUiGraphChatSearchMatches, downloadUiGraphJsonOutput, enhanceUiGraphChatJsonCodeBlocks, hasUiGraphChatPersistentStateChanged, getUiGraphChatPersistentState, getUiGraphChatMessagePresentations, getUiGraphChatStorageKey, getUiGraphWebAppStorageKey, highlightUiGraphChatSearchMatches, loadUiGraphChatPersistentState, loadUiGraphWebAppStorage, observeUiGraphOutputResizeBounds, revealUiGraphChatElement, revealUiGraphChatSearchMatch, saveUiGraphChatPersistentState, saveUiGraphResponseTrace, loadUiGraphResponseTrace, pruneUiGraphResponseTraces, } from './model/UiGraphBrowserRuntime.js';
|
|
@@ -17,6 +17,7 @@ import { type LooseDataValue } from './looseDataValue.js';
|
|
|
17
17
|
import type { ProjectReferenceLoader } from '../model/ProjectReferenceLoader.js';
|
|
18
18
|
import type { RivetStoredValueStore } from '../model/StoredValueStore.js';
|
|
19
19
|
import type { RivetKnowledgeStoreRegistry } from '../integrations/KnowledgeStore.js';
|
|
20
|
+
import type { RivetLLMProfileHealthStore } from '../model/chat-v2/llmProfileHealthStore.js';
|
|
20
21
|
export type RunGraphOptions = {
|
|
21
22
|
graph?: string;
|
|
22
23
|
inputs?: Record<string, LooseDataValue>;
|
|
@@ -38,6 +39,8 @@ export type RunGraphOptions = {
|
|
|
38
39
|
concurrency?: GraphProcessorConcurrency;
|
|
39
40
|
getChatNodeEndpoint?: ProcessContext['getChatNodeEndpoint'];
|
|
40
41
|
onChatV2CallFinished?: ProcessContext['onChatV2CallFinished'];
|
|
42
|
+
llmProfileHealthStore?: RivetLLMProfileHealthStore;
|
|
43
|
+
evaluation?: ProcessContext['evaluation'];
|
|
41
44
|
tokenizer?: Tokenizer;
|
|
42
45
|
codeRunner?: ProcessContext['codeRunner'];
|
|
43
46
|
projectPath?: string;
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from './native/BaseDir.js';
|
|
|
26
26
|
export * from './native/NativeApi.js';
|
|
27
27
|
export * from './native/BrowserNativeApi.js';
|
|
28
28
|
export * from './model/ProcessContext.js';
|
|
29
|
+
export * from './model/AgentResponseTrace.js';
|
|
29
30
|
export * from './model/DebuggerTransportSentinel.js';
|
|
30
31
|
export * from './model/ProjectReferenceLoader.js';
|
|
31
32
|
export * from './model/RivetUIContext.js';
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { Inputs, Outputs } from '../index.js';
|
|
2
2
|
import type { DataValue } from '../model/DataValue.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import type { CodeRunnerOptions } from './CodeRunnerOptions.js';
|
|
4
|
+
export { ALL_CODE_RUNNER_OPTIONS } from './CodeRunnerOptions.js';
|
|
5
|
+
export type { CodeRunnerOptions } from './CodeRunnerOptions.js';
|
|
6
|
+
/**
|
|
7
|
+
* Code and Expression nodes request every API their executor can provide.
|
|
8
|
+
*
|
|
9
|
+
* This is intentionally not a permission system or a sandbox. Node runners
|
|
10
|
+
* provide the Node-specific APIs, while browser runners only supply the APIs
|
|
11
|
+
* they actually implement.
|
|
12
|
+
*/
|
|
10
13
|
/** An object that can run arbitrary code (evals it). */
|
|
11
14
|
export interface CodeRunner {
|
|
12
15
|
runCode: (code: string, inputs: Inputs, options: CodeRunnerOptions, graphInputs?: Record<string, DataValue>, contextValues?: Record<string, DataValue>) => Promise<Outputs>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The complete capability request used by Code, Code (legacy), and Expression.
|
|
3
|
+
*
|
|
4
|
+
* This deliberately lives apart from the runner implementation: built-in node
|
|
5
|
+
* registration reads this constant during package initialization, while the
|
|
6
|
+
* runner exposes the public `Rivet` namespace at execution time.
|
|
7
|
+
*/
|
|
8
|
+
export interface CodeRunnerOptions {
|
|
9
|
+
includeRequire: boolean;
|
|
10
|
+
includeFetch: boolean;
|
|
11
|
+
includeRivet: boolean;
|
|
12
|
+
includeProcess: boolean;
|
|
13
|
+
includeConsole: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const ALL_CODE_RUNNER_OPTIONS: CodeRunnerOptions;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { ChatV2CallTraceEvent, GraphExecutionMetadata, GraphRunId, LLMProfileAttemptTraceEvent, ProcessId, RootRunId, ToolCallFinishedEvent } from './ProcessContext.js';
|
|
2
|
+
import type { GraphId } from './NodeGraph.js';
|
|
3
|
+
import type { NodeId } from './NodeBase.js';
|
|
4
|
+
import type { GraphProcessor } from './GraphProcessor.js';
|
|
5
|
+
export declare const AGENT_RESPONSE_TRACE_SCHEMA_VERSION: 1;
|
|
6
|
+
export declare const AGENT_RESPONSE_TRACE_MAX_MODEL_CALLS = 250;
|
|
7
|
+
export declare const AGENT_RESPONSE_TRACE_MAX_PROFILE_ATTEMPTS = 1000;
|
|
8
|
+
export declare const AGENT_RESPONSE_TRACE_MAX_TOOL_CALLS = 500;
|
|
9
|
+
export type AgentModelCallTrace = {
|
|
10
|
+
callId: string;
|
|
11
|
+
nodeId: NodeId;
|
|
12
|
+
processId: ProcessId;
|
|
13
|
+
provider: string;
|
|
14
|
+
model: string;
|
|
15
|
+
customProviderApi?: ChatV2CallTraceEvent['customProviderApi'];
|
|
16
|
+
outcome: ChatV2CallTraceEvent['outcome'];
|
|
17
|
+
attemptIndex: number;
|
|
18
|
+
profileIndex?: number;
|
|
19
|
+
profileHealthKey?: string;
|
|
20
|
+
profileHealthState?: ChatV2CallTraceEvent['profileHealthState'];
|
|
21
|
+
roundIndex?: number;
|
|
22
|
+
startedAt?: number;
|
|
23
|
+
durationMs?: number;
|
|
24
|
+
finishReason?: string;
|
|
25
|
+
usage?: ChatV2CallTraceEvent['normalizedUsage'];
|
|
26
|
+
pricing: ChatV2CallTraceEvent['pricing'];
|
|
27
|
+
};
|
|
28
|
+
export type AgentToolCallTrace = {
|
|
29
|
+
toolCallId?: string;
|
|
30
|
+
toolName: string;
|
|
31
|
+
sourceNodeId: NodeId;
|
|
32
|
+
sourceProcessId: ProcessId;
|
|
33
|
+
/** Pointer to the pre-existing Delegate Tool Call output, never copied result text. */
|
|
34
|
+
resultOwner?: ToolCallFinishedEvent['resultOwner'];
|
|
35
|
+
handlerKind: ToolCallFinishedEvent['handlerKind'];
|
|
36
|
+
handlerGraphId?: GraphId;
|
|
37
|
+
handlerName?: string;
|
|
38
|
+
outcome: ToolCallFinishedEvent['outcome'];
|
|
39
|
+
startedAt?: number;
|
|
40
|
+
durationMs?: number;
|
|
41
|
+
};
|
|
42
|
+
export type AgentLLMProfileAttemptTrace = Omit<LLMProfileAttemptTraceEvent, 'eventId'> & {
|
|
43
|
+
eventId: string;
|
|
44
|
+
};
|
|
45
|
+
export type AgentResponseTrace = {
|
|
46
|
+
schemaVersion: typeof AGENT_RESPONSE_TRACE_SCHEMA_VERSION;
|
|
47
|
+
traceId: RootRunId;
|
|
48
|
+
scope: 'response' | 'llm-invocation';
|
|
49
|
+
rootRunId: RootRunId;
|
|
50
|
+
graphRunId: GraphRunId;
|
|
51
|
+
graphId: GraphId;
|
|
52
|
+
nodeId?: NodeId;
|
|
53
|
+
processId?: ProcessId;
|
|
54
|
+
startedAt?: number;
|
|
55
|
+
responseReadyAt?: number;
|
|
56
|
+
finishedAt?: number;
|
|
57
|
+
durationMs?: number;
|
|
58
|
+
status: 'running' | 'response-ready' | 'completed' | 'error' | 'aborted' | 'unavailable';
|
|
59
|
+
backgroundWorkPending?: boolean;
|
|
60
|
+
summary: {
|
|
61
|
+
modelCallCount: number;
|
|
62
|
+
toolCallCount: number;
|
|
63
|
+
retryCount: number;
|
|
64
|
+
fallbackCount: number;
|
|
65
|
+
promptTokens?: number;
|
|
66
|
+
completionTokens?: number;
|
|
67
|
+
totalTokens?: number;
|
|
68
|
+
cachedTokens?: number;
|
|
69
|
+
reasoningTokens?: number;
|
|
70
|
+
knownCostUsd: number;
|
|
71
|
+
costStatus: 'known' | 'partial' | 'unknown';
|
|
72
|
+
};
|
|
73
|
+
modelCalls: AgentModelCallTrace[];
|
|
74
|
+
/** Additive in schema v1; absent in traces produced before profile-health observability. */
|
|
75
|
+
profileAttempts?: AgentLLMProfileAttemptTrace[];
|
|
76
|
+
toolCalls: AgentToolCallTrace[];
|
|
77
|
+
omittedModelCallCount: number;
|
|
78
|
+
/** Additive in schema v1; absent in older traces. */
|
|
79
|
+
omittedProfileAttemptCount?: number;
|
|
80
|
+
omittedToolCallCount: number;
|
|
81
|
+
};
|
|
82
|
+
export type AgentTraceEvent = ({
|
|
83
|
+
type: 'llm-call-finished';
|
|
84
|
+
execution: GraphExecutionMetadata;
|
|
85
|
+
} & ChatV2CallTraceEvent) | ({
|
|
86
|
+
type: 'llm-profile-attempt';
|
|
87
|
+
execution: GraphExecutionMetadata;
|
|
88
|
+
} & LLMProfileAttemptTraceEvent) | ({
|
|
89
|
+
type: 'tool-call-finished';
|
|
90
|
+
execution: GraphExecutionMetadata;
|
|
91
|
+
} & ToolCallFinishedEvent);
|
|
92
|
+
export type BuildAgentResponseTraceOptions = {
|
|
93
|
+
scope: AgentResponseTrace['scope'];
|
|
94
|
+
execution: GraphExecutionMetadata;
|
|
95
|
+
events: readonly AgentTraceEvent[];
|
|
96
|
+
nodeId?: NodeId;
|
|
97
|
+
processId?: ProcessId;
|
|
98
|
+
startedAt?: number;
|
|
99
|
+
responseReadyAt?: number;
|
|
100
|
+
finishedAt?: number;
|
|
101
|
+
status: AgentResponseTrace['status'];
|
|
102
|
+
backgroundWorkPending?: boolean;
|
|
103
|
+
};
|
|
104
|
+
export declare function buildAgentResponseTrace(options: BuildAgentResponseTraceOptions): AgentResponseTrace;
|
|
105
|
+
export declare function getAgentTraceEventIdentity(event: AgentTraceEvent): string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Redelivery is allowed to omit newly added optional observability fields. Keep
|
|
108
|
+
* an exact Delegate result pointer once it was observed instead of making a
|
|
109
|
+
* later legacy-shaped copy erase result navigation.
|
|
110
|
+
*/
|
|
111
|
+
export declare function mergeAgentTraceEvent(existing: AgentTraceEvent, incoming: AgentTraceEvent): AgentTraceEvent;
|
|
112
|
+
export declare function isAgentResponseTrace(value: unknown): value is AgentResponseTrace;
|
|
113
|
+
/**
|
|
114
|
+
* Collects privacy-bounded response metadata for one root processor run.
|
|
115
|
+
* Listener failures are isolated by GraphProcessor; callers should dispose the
|
|
116
|
+
* collector after the processor and any asynchronous branches settle.
|
|
117
|
+
*/
|
|
118
|
+
export declare class AgentResponseTraceCollector {
|
|
119
|
+
#private;
|
|
120
|
+
constructor(processor: GraphProcessor);
|
|
121
|
+
build(): AgentResponseTrace | undefined;
|
|
122
|
+
dispose(): void;
|
|
123
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Outputs } from './GraphProcessor.js';
|
|
2
|
+
import type { NodeId } from './NodeBase.js';
|
|
3
|
+
import type { ProcessId } from './ProcessContext.js';
|
|
4
|
+
import type { ToolCallContinuation } from './ToolCallContinuation.js';
|
|
5
|
+
import type { DelegateFunctionCallNode } from './nodes/DelegateFunctionCallNode.js';
|
|
6
|
+
/**
|
|
7
|
+
* Owns connected Delegate invocation lifetime. GraphProcessor supplies narrow
|
|
8
|
+
* scheduling callbacks, while this host owns only continuation-local state.
|
|
9
|
+
*/
|
|
10
|
+
export type ConnectedToolContinuationInvocation = {
|
|
11
|
+
delegateNode: DelegateFunctionCallNode;
|
|
12
|
+
latestOutputs: Map<NodeId, Outputs>;
|
|
13
|
+
llmNodeId: NodeId;
|
|
14
|
+
llmProcessId: ProcessId;
|
|
15
|
+
released: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare class ConnectedToolContinuationHost {
|
|
18
|
+
#private;
|
|
19
|
+
begin(params: {
|
|
20
|
+
key: string;
|
|
21
|
+
delegateNode: DelegateFunctionCallNode;
|
|
22
|
+
llmNodeId: NodeId;
|
|
23
|
+
llmProcessId: ProcessId;
|
|
24
|
+
run: (invocation: ConnectedToolContinuationInvocation, toolCalls: Parameters<ToolCallContinuation['run']>[0], assistantMessage: string) => ReturnType<ToolCallContinuation['run']>;
|
|
25
|
+
}): ToolCallContinuation;
|
|
26
|
+
finalize(params: {
|
|
27
|
+
key: string;
|
|
28
|
+
nodeOutputs: Outputs;
|
|
29
|
+
replay: (invocation: ConnectedToolContinuationInvocation, nodeOutputs: Outputs) => void;
|
|
30
|
+
commit: (invocation: ConnectedToolContinuationInvocation) => void;
|
|
31
|
+
}): void;
|
|
32
|
+
discard(key: string): void;
|
|
33
|
+
reset(): void;
|
|
34
|
+
}
|
|
@@ -84,6 +84,12 @@ export type GraphSelectorEditorDefinition<T extends ChartNode> = SharedEditorDef
|
|
|
84
84
|
export type NumberEditorDefinition<T extends ChartNode> = SharedEditorDefinitionProps<T> & {
|
|
85
85
|
type: 'number';
|
|
86
86
|
defaultValue?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Multiplier applied between the value shown in the editor and the value
|
|
89
|
+
* stored on the node. For example, a millisecond value can be presented as
|
|
90
|
+
* seconds with a multiplier of 1_000 while preserving its serialized shape.
|
|
91
|
+
*/
|
|
92
|
+
storageMultiplier?: number;
|
|
87
93
|
useInputToggleDataKey?: DataOfType<T, boolean>;
|
|
88
94
|
min?: number;
|
|
89
95
|
max?: number;
|
|
@@ -166,6 +172,16 @@ export type StringListPortBinding<T extends ChartNode> = {
|
|
|
166
172
|
identity: 'stored-stable-id';
|
|
167
173
|
idDataKey: DataOfType<T, string[]>;
|
|
168
174
|
legacyPortIdPattern: LegacyOrderedPortIdPattern;
|
|
175
|
+
/**
|
|
176
|
+
* Additional ports whose ids are derived from the stored stable id for
|
|
177
|
+
* the same list row. They are remapped or removed together with the
|
|
178
|
+
* primary bound port when that row is edited.
|
|
179
|
+
*/
|
|
180
|
+
companionBindings?: {
|
|
181
|
+
side: 'input' | 'output';
|
|
182
|
+
prefix?: string;
|
|
183
|
+
suffix?: string;
|
|
184
|
+
}[];
|
|
169
185
|
};
|
|
170
186
|
export type EditorDefinitionGroup<T extends ChartNode> = SharedEditorDefinitionProps<T> & {
|
|
171
187
|
type: 'group';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { DataValue, ScalarOrArrayDataValue, StringArrayDataValue } from './DataValue.js';
|
|
2
2
|
import type { Dataset, DatasetId, DatasetMetadata, DatasetRow } from './Dataset.js';
|
|
3
|
-
import type { ChartNode, NodeId, PortId } from './NodeBase.js';
|
|
3
|
+
import type { ChartNode, NodeConnection, NodeId, PortId } from './NodeBase.js';
|
|
4
4
|
import type { GraphId, NodeGraph } from './NodeGraph.js';
|
|
5
|
-
import type { GraphExecutionMetadata, ProcessId } from './ProcessContext.js';
|
|
5
|
+
import type { ChatV2CallTraceEvent, EvaluationExecutionMetadata, GraphExecutionMetadata, LLMProfileAttemptTraceEvent, ProcessId, ToolCallFinishedEvent } from './ProcessContext.js';
|
|
6
6
|
import type { Project, ProjectId } from './Project.js';
|
|
7
7
|
import type { Settings } from './Settings.js';
|
|
8
|
-
import type { FrozenNodeOutputsByGraph } from './GraphProcessor.js';
|
|
8
|
+
import type { FrozenNodeOutputsByGraph, NodeResultOrigin, ReplayEventTiming } from './GraphProcessor.js';
|
|
9
9
|
import type { GraphProgress } from './GraphProgress.js';
|
|
10
10
|
import type { RivetWebAppStorage } from './UiGraphWebAppStorage.js';
|
|
11
11
|
export type GraphInputs = Record<string, DataValue>;
|
|
@@ -20,7 +20,7 @@ export type CodeConsoleMessage = {
|
|
|
20
20
|
};
|
|
21
21
|
type WithExecution<T extends object> = T & {
|
|
22
22
|
execution: GraphExecutionMetadata;
|
|
23
|
-
};
|
|
23
|
+
} & ReplayEventTiming;
|
|
24
24
|
export type SerializedProcessEventMap = {
|
|
25
25
|
start: WithExecution<{
|
|
26
26
|
project: Project;
|
|
@@ -55,12 +55,15 @@ export type SerializedProcessEventMap = {
|
|
|
55
55
|
nodeStart: WithExecution<{
|
|
56
56
|
node: ChartNode;
|
|
57
57
|
inputs: Inputs;
|
|
58
|
+
inputConnections?: NodeConnection[];
|
|
58
59
|
processId: ProcessId;
|
|
60
|
+
resultOrigin?: NodeResultOrigin;
|
|
59
61
|
}>;
|
|
60
62
|
nodeFinish: WithExecution<{
|
|
61
63
|
node: ChartNode;
|
|
62
64
|
outputs: Outputs;
|
|
63
65
|
processId: ProcessId;
|
|
66
|
+
resultOrigin?: NodeResultOrigin;
|
|
64
67
|
durationMs?: number;
|
|
65
68
|
splitRunDurationMs?: Record<number, number>;
|
|
66
69
|
}>;
|
|
@@ -68,6 +71,7 @@ export type SerializedProcessEventMap = {
|
|
|
68
71
|
node: ChartNode;
|
|
69
72
|
error: Error | string;
|
|
70
73
|
processId: ProcessId;
|
|
74
|
+
resultOrigin?: NodeResultOrigin;
|
|
71
75
|
durationMs?: number;
|
|
72
76
|
splitRunDurationMs?: Record<number, number>;
|
|
73
77
|
}>;
|
|
@@ -77,6 +81,7 @@ export type SerializedProcessEventMap = {
|
|
|
77
81
|
inputs: Inputs;
|
|
78
82
|
outputs: Outputs;
|
|
79
83
|
reason: string;
|
|
84
|
+
resultOrigin?: NodeResultOrigin;
|
|
80
85
|
}>;
|
|
81
86
|
userInput: WithExecution<{
|
|
82
87
|
node: ChartNode;
|
|
@@ -84,36 +89,48 @@ export type SerializedProcessEventMap = {
|
|
|
84
89
|
inputs: Inputs;
|
|
85
90
|
processId: ProcessId;
|
|
86
91
|
renderingType: 'text' | 'markdown';
|
|
92
|
+
/** See ProcessEvents.userInput.isReplay. */
|
|
93
|
+
isReplay?: true;
|
|
87
94
|
}>;
|
|
88
95
|
partialOutput: WithExecution<{
|
|
89
96
|
node: ChartNode;
|
|
90
97
|
outputs: Outputs;
|
|
91
98
|
index: number;
|
|
92
99
|
processId: ProcessId;
|
|
100
|
+
resultOrigin?: NodeResultOrigin;
|
|
93
101
|
}>;
|
|
94
102
|
progress: WithExecution<{
|
|
95
103
|
node: ChartNode;
|
|
96
104
|
processId: ProcessId;
|
|
97
105
|
progress: GraphProgress;
|
|
98
106
|
}>;
|
|
107
|
+
llmCallFinished: WithExecution<ChatV2CallTraceEvent>;
|
|
108
|
+
llmProfileAttempt: WithExecution<LLMProfileAttemptTraceEvent>;
|
|
109
|
+
toolCallFinished: WithExecution<ToolCallFinishedEvent>;
|
|
99
110
|
nodeOutputsCleared: WithExecution<{
|
|
100
111
|
node: ChartNode;
|
|
101
112
|
processId?: ProcessId;
|
|
102
113
|
}>;
|
|
103
114
|
error: {
|
|
104
115
|
error: Error | string;
|
|
105
|
-
};
|
|
116
|
+
} & ReplayEventTiming;
|
|
106
117
|
done: {
|
|
107
118
|
results: GraphOutputs;
|
|
108
|
-
};
|
|
119
|
+
} & ReplayEventTiming;
|
|
109
120
|
abort: {
|
|
110
121
|
successful: boolean;
|
|
111
122
|
error?: string | Error;
|
|
112
|
-
};
|
|
123
|
+
} & ReplayEventTiming;
|
|
113
124
|
finish: void;
|
|
114
125
|
trace: string;
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
/** Present only when RecordingPlayer re-emits a historical lifecycle transition. */
|
|
127
|
+
pause: {
|
|
128
|
+
isReplay?: true;
|
|
129
|
+
} | undefined;
|
|
130
|
+
/** Present only when RecordingPlayer re-emits a historical lifecycle transition. */
|
|
131
|
+
resume: {
|
|
132
|
+
isReplay?: true;
|
|
133
|
+
} | undefined;
|
|
117
134
|
globalSet: WithExecution<{
|
|
118
135
|
id: string;
|
|
119
136
|
value: ScalarOrArrayDataValue;
|
|
@@ -144,12 +161,15 @@ export type ProcessEventMessageMap = {
|
|
|
144
161
|
graphOutputsReady: SerializedProcessEventMap['graphOutputsReady'];
|
|
145
162
|
partialOutput: SerializedProcessEventMap['partialOutput'];
|
|
146
163
|
progress: SerializedProcessEventMap['progress'];
|
|
164
|
+
llmCallFinished: SerializedProcessEventMap['llmCallFinished'];
|
|
165
|
+
llmProfileAttempt: SerializedProcessEventMap['llmProfileAttempt'];
|
|
166
|
+
toolCallFinished: SerializedProcessEventMap['toolCallFinished'];
|
|
147
167
|
nodeOutputsCleared: SerializedProcessEventMap['nodeOutputsCleared'];
|
|
148
168
|
error: SerializedProcessEventMap['error'];
|
|
149
169
|
graphError: SerializedProcessEventMap['graphError'];
|
|
150
170
|
trace: string;
|
|
151
|
-
pause:
|
|
152
|
-
resume:
|
|
171
|
+
pause: SerializedProcessEventMap['pause'];
|
|
172
|
+
resume: SerializedProcessEventMap['resume'];
|
|
153
173
|
};
|
|
154
174
|
export type GraphUploadAllowedMessage = {
|
|
155
175
|
message: 'graph-upload-allowed';
|
|
@@ -220,6 +240,7 @@ export type OutgoingMessageMap = {
|
|
|
220
240
|
projectPath?: string | null;
|
|
221
241
|
useEditorCache?: boolean;
|
|
222
242
|
captureNodeTimings?: boolean;
|
|
243
|
+
evaluation?: EvaluationExecutionMetadata;
|
|
223
244
|
returnWhenGraphOutputsReady?: boolean;
|
|
224
245
|
webAppStorage?: RivetWebAppStorage;
|
|
225
246
|
};
|
|
@@ -4,7 +4,7 @@ import { type ChartNode, type NodeConnection, type NodeId } from './NodeBase.js'
|
|
|
4
4
|
import type { GraphId, NodeGraph } from './NodeGraph.js';
|
|
5
5
|
import Emittery from 'emittery';
|
|
6
6
|
import { type ProjectId, type Project } from './Project.js';
|
|
7
|
-
import type { GraphExecutionMetadata, InternalProcessContext, ProcessContext, ProcessId } from './ProcessContext.js';
|
|
7
|
+
import type { GraphExecutionMetadata, InternalProcessContext, ProcessContext, ProcessId, ChatV2CallTraceEvent, LLMProfileAttemptTraceEvent, ToolCallFinishedEvent } from './ProcessContext.js';
|
|
8
8
|
import type { ExecutionRecorder } from '../recording/ExecutionRecorder.js';
|
|
9
9
|
import type { Tagged } from 'type-fest';
|
|
10
10
|
import type { NodeRegistration } from './NodeRegistration.js';
|
|
@@ -13,11 +13,20 @@ import { type GraphBoundaryCache } from './GraphBoundaryCache.js';
|
|
|
13
13
|
import { type GraphProgress } from './GraphProgress.js';
|
|
14
14
|
import { type RivetStoredValueStore } from './StoredValueStore.js';
|
|
15
15
|
import type { RivetKnowledgeStoreRegistry } from '../integrations/KnowledgeStore.js';
|
|
16
|
+
/**
|
|
17
|
+
* Provenance attached only while RecordingPlayer re-emits a historical event.
|
|
18
|
+
* Consumers retain their fresh receipt clock for live ordering and activity,
|
|
19
|
+
* while presentation can separately use the original recording timestamp.
|
|
20
|
+
*/
|
|
21
|
+
export type ReplayEventTiming = {
|
|
22
|
+
replayRecordedAt?: number;
|
|
23
|
+
};
|
|
16
24
|
type WithExecution<T extends object> = T & {
|
|
17
25
|
execution: GraphExecutionMetadata;
|
|
18
|
-
};
|
|
26
|
+
} & ReplayEventTiming;
|
|
19
27
|
declare const graphProcessorGraphOverride: unique symbol;
|
|
20
28
|
declare const consumedAsyncBranchTriggerOverride: unique symbol;
|
|
29
|
+
export type NodeResultOrigin = 'executed' | 'preloaded' | 'frozen' | 'editor-cache' | 'unknown';
|
|
21
30
|
export type ProcessEvents = {
|
|
22
31
|
/** Called when processing has started. */
|
|
23
32
|
start: WithExecution<{
|
|
@@ -56,13 +65,17 @@ export type ProcessEvents = {
|
|
|
56
65
|
nodeStart: WithExecution<{
|
|
57
66
|
node: ChartNode;
|
|
58
67
|
inputs: Inputs;
|
|
68
|
+
/** Effective, value-free producer edges after Data Bus preprocessing. */
|
|
69
|
+
inputConnections?: NodeConnection[];
|
|
59
70
|
processId: ProcessId;
|
|
71
|
+
resultOrigin?: NodeResultOrigin;
|
|
60
72
|
}>;
|
|
61
73
|
/** Called when a node has finished processing, with the output values for the node. */
|
|
62
74
|
nodeFinish: WithExecution<{
|
|
63
75
|
node: ChartNode;
|
|
64
76
|
outputs: Outputs;
|
|
65
77
|
processId: ProcessId;
|
|
78
|
+
resultOrigin?: NodeResultOrigin;
|
|
66
79
|
durationMs?: number;
|
|
67
80
|
splitRunDurationMs?: Record<number, number>;
|
|
68
81
|
}>;
|
|
@@ -71,6 +84,7 @@ export type ProcessEvents = {
|
|
|
71
84
|
node: ChartNode;
|
|
72
85
|
error: Error | string;
|
|
73
86
|
processId: ProcessId;
|
|
87
|
+
resultOrigin?: NodeResultOrigin;
|
|
74
88
|
durationMs?: number;
|
|
75
89
|
splitRunDurationMs?: Record<number, number>;
|
|
76
90
|
}>;
|
|
@@ -81,6 +95,7 @@ export type ProcessEvents = {
|
|
|
81
95
|
inputs: Inputs;
|
|
82
96
|
outputs: Outputs;
|
|
83
97
|
reason: string;
|
|
98
|
+
resultOrigin?: NodeResultOrigin;
|
|
84
99
|
}>;
|
|
85
100
|
/** Called when a user input node requires user input. Call the callback when finished, or call userInput() on the GraphProcessor with the results. */
|
|
86
101
|
userInput: WithExecution<{
|
|
@@ -91,6 +106,12 @@ export type ProcessEvents = {
|
|
|
91
106
|
callback: (values: StringArrayDataValue) => void;
|
|
92
107
|
processId: ProcessId;
|
|
93
108
|
renderingType: 'text' | 'markdown';
|
|
109
|
+
/**
|
|
110
|
+
* Present only when RecordingPlayer re-emits a historical prompt. It is
|
|
111
|
+
* display-only: hosts must project it to observability without asking the
|
|
112
|
+
* user for input again.
|
|
113
|
+
*/
|
|
114
|
+
isReplay?: true;
|
|
94
115
|
}>;
|
|
95
116
|
/** Called when a node has partially processed, with the current partial output values for the node. */
|
|
96
117
|
partialOutput: WithExecution<{
|
|
@@ -98,6 +119,7 @@ export type ProcessEvents = {
|
|
|
98
119
|
outputs: Outputs;
|
|
99
120
|
index: number;
|
|
100
121
|
processId: ProcessId;
|
|
122
|
+
resultOrigin?: NodeResultOrigin;
|
|
101
123
|
}>;
|
|
102
124
|
/** Called when a node reports host-facing progress. */
|
|
103
125
|
progress: WithExecution<{
|
|
@@ -105,6 +127,12 @@ export type ProcessEvents = {
|
|
|
105
127
|
processId: ProcessId;
|
|
106
128
|
progress: GraphProgress;
|
|
107
129
|
}>;
|
|
130
|
+
/** Privacy-bounded metadata for one physical LLM provider call. */
|
|
131
|
+
llmCallFinished: WithExecution<ChatV2CallTraceEvent>;
|
|
132
|
+
/** Privacy-bounded metadata for one LLM fallback/profile-health decision. */
|
|
133
|
+
llmProfileAttempt: WithExecution<LLMProfileAttemptTraceEvent>;
|
|
134
|
+
/** Privacy-bounded metadata for one delegated tool execution. */
|
|
135
|
+
toolCallFinished: WithExecution<ToolCallFinishedEvent>;
|
|
108
136
|
/** Called when the outputs of a node have been cleared entirely. If processId is present, only the one process() should be cleared. */
|
|
109
137
|
nodeOutputsCleared: WithExecution<{
|
|
110
138
|
node: ChartNode;
|
|
@@ -113,24 +141,28 @@ export type ProcessEvents = {
|
|
|
113
141
|
/** Called when the root graph has errored. The root graph will also throw. */
|
|
114
142
|
error: {
|
|
115
143
|
error: Error | string;
|
|
116
|
-
};
|
|
144
|
+
} & ReplayEventTiming;
|
|
117
145
|
/** Called when processing has completed. */
|
|
118
146
|
done: {
|
|
119
147
|
results: GraphOutputs;
|
|
120
|
-
};
|
|
148
|
+
} & ReplayEventTiming;
|
|
121
149
|
/** Called when processing has been aborted. */
|
|
122
150
|
abort: {
|
|
123
151
|
successful: boolean;
|
|
124
152
|
error?: string | Error;
|
|
125
|
-
};
|
|
153
|
+
} & ReplayEventTiming;
|
|
126
154
|
/** Called when processing has finished either successfully or unsuccessfully. */
|
|
127
155
|
finish: void;
|
|
128
156
|
/** Called for trace level logs. */
|
|
129
157
|
trace: string;
|
|
130
|
-
/** Called when the graph has been paused. */
|
|
131
|
-
pause:
|
|
132
|
-
|
|
133
|
-
|
|
158
|
+
/** Called when the graph has been paused. Historical playback pauses are display-only. */
|
|
159
|
+
pause: {
|
|
160
|
+
isReplay?: true;
|
|
161
|
+
} | undefined;
|
|
162
|
+
/** Called when the graph has been resumed. Historical playback resumes are display-only. */
|
|
163
|
+
resume: {
|
|
164
|
+
isReplay?: true;
|
|
165
|
+
} | undefined;
|
|
134
166
|
/** Called when a global variable has been set in a graph. */
|
|
135
167
|
globalSet: WithExecution<{
|
|
136
168
|
id: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Opaque } from 'type-fest';
|
|
2
2
|
import type { DataType } from './DataValue.js';
|
|
3
|
-
import type { GraphId } from '../index.js';
|
|
4
3
|
/** Unique in a NodeGraph. */
|
|
5
4
|
export type NodeId = Opaque<string, 'NodeId'>;
|
|
6
5
|
/** Unique within the inputs of a single node */
|
|
@@ -40,7 +39,6 @@ export interface NodeBase {
|
|
|
40
39
|
data: unknown;
|
|
41
40
|
/** Alternative sets of data for the node. */
|
|
42
41
|
variants?: ChartNodeVariant<unknown>[];
|
|
43
|
-
tests?: NodeTestGroup[];
|
|
44
42
|
/** If true, the node is disabled and effectively "not ran" */
|
|
45
43
|
disabled?: boolean;
|
|
46
44
|
/** If true, the node exposes an `if` port that lets it run conditionally. */
|
|
@@ -59,14 +57,6 @@ export type ChartNodeVariant<Data = unknown> = {
|
|
|
59
57
|
id: string;
|
|
60
58
|
data: Data;
|
|
61
59
|
};
|
|
62
|
-
export type NodeTestGroup = {
|
|
63
|
-
id: string;
|
|
64
|
-
evaluatorGraphId: GraphId;
|
|
65
|
-
tests: NodeTest[];
|
|
66
|
-
};
|
|
67
|
-
export type NodeTest = {
|
|
68
|
-
conditionText: string;
|
|
69
|
-
};
|
|
70
60
|
/** Represents an input definition of a node. */
|
|
71
61
|
export type NodeInputDefinition = {
|
|
72
62
|
/** The unique identifier of the input. Unique within a single node only. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Inputs, Outputs } from './GraphProcessor.js';
|
|
2
|
-
import { type ChartNode, type NodeConnection, type NodeId, type NodeInputDefinition, type NodeOutputDefinition } from './NodeBase.js';
|
|
2
|
+
import { type ChartNode, type NodeConnection, type NodeId, type NodeInputDefinition, type NodeOutputDefinition, type PortId } from './NodeBase.js';
|
|
3
3
|
import type { Project, ProjectId } from './Project.js';
|
|
4
4
|
import type { InternalProcessContext } from './ProcessContext.js';
|
|
5
5
|
import type { EditorDefinition } from './EditorDefinition.js';
|
|
@@ -18,7 +18,22 @@ export interface PluginNodeImpl<T extends ChartNode> {
|
|
|
18
18
|
getBody(data: T['data'], context: RivetUIContext): NodeBody | Promise<NodeBody>;
|
|
19
19
|
create(): T;
|
|
20
20
|
getUIData(context: RivetUIContext): NodeUIData | Promise<NodeUIData>;
|
|
21
|
+
/** Optional metadata-only presentation hints for the editor Run Activity view. */
|
|
22
|
+
getRunActivityDescriptor?(data: T['data']): NodeRunActivityDescriptor;
|
|
21
23
|
}
|
|
24
|
+
export type NodeRunActivityDescriptor = {
|
|
25
|
+
category?: 'generic' | 'model' | 'tool';
|
|
26
|
+
/** Preferred output to preview without changing execution or serialization. */
|
|
27
|
+
primaryOutputPortId?: PortId;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Run Activity no longer renders input provenance. Retained only
|
|
30
|
+
* so existing plugin descriptors remain source-compatible; new nodes must
|
|
31
|
+
* not use it.
|
|
32
|
+
*/
|
|
33
|
+
contextInputPortIds?: PortId[];
|
|
34
|
+
/** Contextual label for the existing node-owned full-output action. */
|
|
35
|
+
fullOutputActionLabel?: string;
|
|
36
|
+
};
|
|
22
37
|
export declare abstract class NodeImpl<T extends ChartNode, Type extends T['type'] = T['type']> {
|
|
23
38
|
readonly chartNode: T;
|
|
24
39
|
constructor(chartNode: T);
|
|
@@ -36,6 +51,7 @@ export declare abstract class NodeImpl<T extends ChartNode, Type extends T['type
|
|
|
36
51
|
abstract process(inputData: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
37
52
|
getEditors(_context: RivetUIContext): EditorDefinition<T>[] | Promise<EditorDefinition<T>[]>;
|
|
38
53
|
getBody(_context: RivetUIContext): NodeBody | Promise<NodeBody>;
|
|
54
|
+
getRunActivityDescriptor(): NodeRunActivityDescriptor | undefined;
|
|
39
55
|
}
|
|
40
56
|
export type NodeBody = string | NodeBodySpec | NodeBodySpec[] | undefined;
|
|
41
57
|
export declare class PluginNodeImplClass<T extends ChartNode, Type extends T['type'] = T['type']> extends NodeImpl<T, Type> {
|
|
@@ -46,6 +62,7 @@ export declare class PluginNodeImplClass<T extends ChartNode, Type extends T['ty
|
|
|
46
62
|
process(inputData: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
47
63
|
getEditors(context: RivetUIContext): EditorDefinition<T>[] | Promise<EditorDefinition<T>[]>;
|
|
48
64
|
getBody(context: RivetUIContext): NodeBody | Promise<NodeBody>;
|
|
65
|
+
getRunActivityDescriptor(): NodeRunActivityDescriptor | undefined;
|
|
49
66
|
}
|
|
50
67
|
export type NodeUIData = {
|
|
51
68
|
contextMenuTitle?: string;
|