@valerypopoff/rivet2-core 2.15.0 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bundle.cjs +7906 -3980
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/interpolationRuntime.cjs +62 -7
- package/dist/cjs/interpolationRuntime.cjs.map +3 -3
- package/dist/cjs/interpolationSyntax.cjs +9 -5
- package/dist/cjs/interpolationSyntax.cjs.map +2 -2
- package/dist/cjs/serialization.cjs +1880 -0
- package/dist/cjs/serialization.cjs.map +7 -0
- package/dist/cjs/webAppRuntime.cjs +168 -6
- package/dist/cjs/webAppRuntime.cjs.map +3 -3
- package/dist/esm/api/createProcessor.js +5 -2
- package/dist/esm/api/processSettings.js +1 -0
- package/dist/esm/exports.js +4 -0
- package/dist/esm/model/AgentResponseTrace.js +99 -34
- package/dist/esm/model/AgentResponseTracePresentation.js +130 -0
- package/dist/esm/model/DataValue.js +11 -2
- package/dist/esm/model/GlobalVariables.js +2 -1
- package/dist/esm/model/GraphBoundaryCache.js +2 -1
- package/dist/esm/model/GraphBoundaryEffects.js +38 -1
- package/dist/esm/model/GraphExecutionState.js +81 -0
- package/dist/esm/model/GraphProcessor.js +825 -884
- package/dist/esm/model/GraphSchedulerBoundaryState.js +64 -0
- package/dist/esm/model/Nodes.js +15 -0
- package/dist/esm/model/ProjectBundle.js +248 -0
- package/dist/esm/model/ProjectBundleRuntime.js +54 -0
- package/dist/esm/model/SchedulerBoundaryPlanner.js +233 -0
- package/dist/esm/model/SplitRunProcessor.js +28 -7
- package/dist/esm/model/StreamingWatchTopology.js +118 -8
- package/dist/esm/model/SubgraphProjectTarget.js +7 -0
- package/dist/esm/model/SubprocessorBridge.js +125 -87
- package/dist/esm/model/ToolCallContinuationCoordinator.js +1 -1
- package/dist/esm/model/chat-v2/aiSdkBridge.js +22 -17
- package/dist/esm/model/chat-v2/chatV2CallObserver.js +2 -4
- package/dist/esm/model/chat-v2/chatV2CredentialNames.js +5 -1
- package/dist/esm/model/chat-v2/chatV2Outputs.js +2 -2
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +24 -9
- package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +3 -2
- package/dist/esm/model/chat-v2/chatV2ProviderRegistry.js +46 -6
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +26 -1
- package/dist/esm/model/chat-v2/chatV2Shared.js +2 -1
- package/dist/esm/model/chat-v2/chatV2UsageAccounting.js +10 -0
- package/dist/esm/model/chat-v2/llmChatV2Body.js +13 -10
- package/dist/esm/model/chat-v2/llmChatV2CacheBoundary.js +5 -2
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +3 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +33 -9
- package/dist/esm/model/chat-v2/llmChatV2NodeMigration.js +22 -2
- package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +10 -2
- package/dist/esm/model/chat-v2/llmInvocationResultProjector.js +17 -0
- package/dist/esm/model/chat-v2/llmModelCandidate.js +2 -1
- package/dist/esm/model/chat-v2/llmProfile.js +5 -1
- package/dist/esm/model/chat-v2/llmProfileBody.js +11 -2
- package/dist/esm/model/chat-v2/llmProfileFallback.js +7 -4
- package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +2 -1
- package/dist/esm/model/chat-v2/llmProfileHealthStore.js +16 -3
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +1 -1
- package/dist/esm/model/chat-v2/messageConverter.js +18 -16
- package/dist/esm/model/chat-v2/modelRegistry.js +14 -4
- package/dist/esm/model/chat-v2/openRouterModel.js +73 -0
- package/dist/esm/model/chat-v2/parallelToolCalls.js +2 -0
- package/dist/esm/model/chat-v2/providerOptions.js +30 -25
- package/dist/esm/model/chat-v2/temperature.js +9 -0
- package/dist/esm/model/classifier/credentials.js +42 -6
- package/dist/esm/model/classifier/images.js +176 -0
- package/dist/esm/model/classifier/json.js +57 -0
- package/dist/esm/model/classifier/limits.js +300 -0
- package/dist/esm/model/classifier/openai.js +118 -0
- package/dist/esm/model/classifier/perplexity.js +63 -0
- package/dist/esm/model/classifier/preparation.js +74 -0
- package/dist/esm/model/classifier/profile.js +151 -0
- package/dist/esm/model/classifier/profileExecution.js +294 -0
- package/dist/esm/model/classifier/providers.js +454 -192
- package/dist/esm/model/classifier/questionHelpers.js +29 -45
- package/dist/esm/model/classifier/questions.js +53 -0
- package/dist/esm/model/classifier/response.js +75 -0
- package/dist/esm/model/classifier/state.js +207 -0
- package/dist/esm/model/classifier/types.js +11 -1
- package/dist/esm/model/nodeRunFailure.js +54 -0
- package/dist/esm/model/nodes/CallGraphNode.js +6 -0
- package/dist/esm/model/nodes/CatchStreamingChunksNode.js +42 -0
- package/dist/esm/model/nodes/ClassifierEvaluateNode.js +385 -154
- package/dist/esm/model/nodes/ClassifierProfileNode.js +133 -0
- package/dist/esm/model/nodes/ClassifierQuestionNode.js +59 -15
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +1 -1
- package/dist/esm/model/nodes/GetGlobalNode.js +2 -2
- package/dist/esm/model/nodes/HttpCallNode.js +44 -75
- package/dist/esm/model/nodes/ImageNode.js +44 -3
- package/dist/esm/model/nodes/LLMChatV2Node.js +26 -4
- package/dist/esm/model/nodes/ObjectNode.js +29 -18
- package/dist/esm/model/nodes/PromptNode.js +2 -1
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +4 -1
- package/dist/esm/model/nodes/SetGlobalNode.js +5 -3
- package/dist/esm/model/nodes/StopWatchingStreamingOutputNode.js +8 -8
- package/dist/esm/model/nodes/StreamValueNode.js +38 -0
- package/dist/esm/model/nodes/SubGraphNode.js +199 -35
- package/dist/esm/model/nodes/ToBase64Node.js +106 -0
- package/dist/esm/model/nodes/WatchStreamingOutputNode.js +7 -7
- package/dist/esm/model/nodes/toolCallDelegation.js +5 -1
- package/dist/esm/model/profileSuspensionHints.js +8 -0
- package/dist/esm/recording/ExecutionRecorder.js +26 -0
- package/dist/esm/serialization.js +2 -0
- package/dist/esm/utils/base64.js +18 -15
- package/dist/esm/utils/coerceType.js +11 -1
- package/dist/esm/utils/errors.js +41 -0
- package/dist/esm/utils/interpolation.js +44 -22
- package/dist/esm/utils/interpolationSyntax.js +15 -6
- package/dist/esm/utils/serialization/serialization.js +3 -2
- package/dist/esm/utils/serialization/serializationUtils.js +6 -0
- package/dist/esm/utils/serialization/serialization_v4.js +15 -3
- package/dist/esm/webAppRuntime.js +1 -0
- package/dist/types/api/createProcessor.d.ts +7 -1
- package/dist/types/exports.d.ts +4 -0
- package/dist/types/model/AgentResponseTrace.d.ts +15 -4
- package/dist/types/model/AgentResponseTracePresentation.d.ts +15 -0
- package/dist/types/model/CycleDetector.d.ts +1 -2
- package/dist/types/model/DataValue.d.ts +12 -8
- package/dist/types/model/ExecutorProtocol.d.ts +9 -0
- package/dist/types/model/GraphBoundaryCache.d.ts +2 -0
- package/dist/types/model/GraphBoundaryEffects.d.ts +10 -1
- package/dist/types/model/GraphExecutionState.d.ts +68 -0
- package/dist/types/model/GraphProcessor.d.ts +2 -0
- package/dist/types/model/GraphSchedulerBoundaryState.d.ts +96 -0
- package/dist/types/model/Nodes.d.ts +11 -4
- package/dist/types/model/ProcessContext.d.ts +24 -3
- package/dist/types/model/ProjectBundle.d.ts +59 -0
- package/dist/types/model/ProjectBundleRuntime.d.ts +24 -0
- package/dist/types/model/ProjectReferenceLoader.d.ts +3 -0
- package/dist/types/model/RivetUIContext.d.ts +1 -1
- package/dist/types/model/SchedulerBoundaryPlanner.d.ts +42 -0
- package/dist/types/model/Settings.d.ts +1 -0
- package/dist/types/model/StreamingWatchTopology.d.ts +11 -1
- package/dist/types/model/SubgraphProjectTarget.d.ts +38 -0
- package/dist/types/model/SubprocessorBridge.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2CredentialNames.d.ts +4 -0
- package/dist/types/model/chat-v2/chatV2Outputs.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2ProviderRegistry.d.ts +79 -1
- package/dist/types/model/chat-v2/chatV2ProviderTypes.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2Shared.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2UsageAccounting.d.ts +2 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +4 -1
- package/dist/types/model/chat-v2/llmChatV2NodeMigration.d.ts +3 -1
- package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +2 -0
- package/dist/types/model/chat-v2/llmInvocationResultProjector.d.ts +2 -0
- package/dist/types/model/chat-v2/llmProfileFallback.d.ts +51 -3
- package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +10 -7
- package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +6 -2
- package/dist/types/model/chat-v2/modelRegistry.d.ts +5 -4
- package/dist/types/model/chat-v2/openRouterModel.d.ts +2 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +2 -13
- package/dist/types/model/chat-v2/temperature.d.ts +2 -0
- package/dist/types/model/classifier/credentials.d.ts +7 -1
- package/dist/types/model/classifier/images.d.ts +18 -0
- package/dist/types/model/classifier/json.d.ts +19 -0
- package/dist/types/model/classifier/limits.d.ts +45 -0
- package/dist/types/model/classifier/openai.d.ts +5 -0
- package/dist/types/model/classifier/perplexity.d.ts +7 -0
- package/dist/types/model/classifier/preparation.d.ts +16 -0
- package/dist/types/model/classifier/profile.d.ts +46 -0
- package/dist/types/model/classifier/profileExecution.d.ts +32 -0
- package/dist/types/model/classifier/providers.d.ts +98 -9
- package/dist/types/model/classifier/questionHelpers.d.ts +6 -4
- package/dist/types/model/classifier/questions.d.ts +4 -0
- package/dist/types/model/classifier/response.d.ts +4 -0
- package/dist/types/model/classifier/state.d.ts +37 -0
- package/dist/types/model/classifier/types.d.ts +11 -0
- package/dist/types/model/nodeRunFailure.d.ts +13 -0
- package/dist/types/model/nodes/CatchStreamingChunksNode.d.ts +20 -0
- package/dist/types/model/nodes/ClassifierEvaluateNode.d.ts +17 -12
- package/dist/types/model/nodes/ClassifierProfileNode.d.ts +20 -0
- package/dist/types/model/nodes/GetGlobalNode.d.ts +7 -0
- package/dist/types/model/nodes/ImageNode.d.ts +4 -0
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +1 -0
- package/dist/types/model/nodes/ObjectNode.d.ts +2 -1
- package/dist/types/model/nodes/StreamValueNode.d.ts +14 -0
- package/dist/types/model/nodes/SubGraphNode.d.ts +21 -2
- package/dist/types/model/nodes/ToBase64Node.d.ts +12 -0
- package/dist/types/model/nodes/toolCallDelegation.d.ts +3 -1
- package/dist/types/model/profileSuspensionHints.d.ts +8 -0
- package/dist/types/recording/ExecutionRecorder.d.ts +8 -2
- package/dist/types/serialization.d.ts +2 -0
- package/dist/types/utils/base64.d.ts +1 -1
- package/dist/types/utils/errors.d.ts +4 -0
- package/dist/types/utils/interpolation.d.ts +13 -2
- package/dist/types/utils/interpolationSyntax.d.ts +1 -1
- package/dist/types/utils/serialization/serialization.d.ts +3 -1
- package/dist/types/utils/serialization/serializationUtils.d.ts +1 -0
- package/dist/types/webAppRuntime.d.ts +1 -0
- package/package.json +7 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mapValues } from 'lodash-es';
|
|
2
|
-
import {
|
|
2
|
+
import { normalizeSerializedLLMTemperatureData } from '../../model/chat-v2/llmChatV2NodeMigration.js';
|
|
3
|
+
import { doubleCheckProject, isValidProjectStaticData } from './serializationUtils.js';
|
|
3
4
|
import { entries } from '../typeSafety.js';
|
|
4
5
|
import {} from '../../model/Project.js';
|
|
5
6
|
import { normalizeUiGraphRecord } from '../../model/UiGraphNormalization.js';
|
|
@@ -16,6 +17,9 @@ export function graphV4Deserializer(data) {
|
|
|
16
17
|
return fromSerializedGraph(serializedGraph);
|
|
17
18
|
}
|
|
18
19
|
export function projectV4Serializer(project, attachedData) {
|
|
20
|
+
if (!isValidProjectStaticData(project.data)) {
|
|
21
|
+
throw new Error('Project data must be a record of static-data strings');
|
|
22
|
+
}
|
|
19
23
|
// Project Settings canonicalizes these values, but integrations and callers
|
|
20
24
|
// can author Project objects directly. Never write a project file that will
|
|
21
25
|
// later fail its own project-global validation at load or execution time.
|
|
@@ -48,6 +52,7 @@ function toSerializedProject(project, attachedData) {
|
|
|
48
52
|
attachedData,
|
|
49
53
|
plugins: project.plugins ?? [],
|
|
50
54
|
references: project.references ?? [],
|
|
55
|
+
data: project.data,
|
|
51
56
|
};
|
|
52
57
|
}
|
|
53
58
|
function fromSerializedProject(serializedProject) {
|
|
@@ -64,6 +69,7 @@ function fromSerializedProject(serializedProject) {
|
|
|
64
69
|
uiGraphs: Object.keys(uiGraphs).length > 0 ? uiGraphs : undefined,
|
|
65
70
|
plugins: serializedProject.plugins ?? [],
|
|
66
71
|
references: serializedProject.references ?? [],
|
|
72
|
+
...(serializedProject.data !== undefined ? { data: serializedProject.data } : {}),
|
|
67
73
|
},
|
|
68
74
|
serializedProject.attachedData ?? {},
|
|
69
75
|
];
|
|
@@ -134,6 +140,7 @@ function fromSerializedGraph(serializedGraph) {
|
|
|
134
140
|
};
|
|
135
141
|
}
|
|
136
142
|
function toSerializedNode(node, allNodes, allConnections) {
|
|
143
|
+
const data = normalizeSerializedLLMTemperatureData(node.type, node.data);
|
|
137
144
|
const outgoingConnections = allConnections
|
|
138
145
|
.filter((connection) => connection.outputNodeId === node.id)
|
|
139
146
|
.map((connection) => serializeConnection(connection, allNodes))
|
|
@@ -145,9 +152,14 @@ function toSerializedNode(node, allNodes, allConnections) {
|
|
|
145
152
|
splitRunMax: node.isSplitRun ? node.splitRunMax : undefined,
|
|
146
153
|
splitRunConcurrency: node.isSplitRun ? node.splitRunConcurrency : undefined,
|
|
147
154
|
isSplitSequential: node.isSplitSequential ? true : undefined,
|
|
148
|
-
data: Object.keys(
|
|
155
|
+
data: Object.keys(data ?? {}).length > 0 ? data : undefined,
|
|
149
156
|
outgoingConnections: outgoingConnections.length > 0 ? outgoingConnections : undefined,
|
|
150
|
-
variants: (node.variants?.length ?? 0) > 0
|
|
157
|
+
variants: (node.variants?.length ?? 0) > 0
|
|
158
|
+
? node.variants.map((variant) => ({
|
|
159
|
+
...variant,
|
|
160
|
+
data: normalizeSerializedLLMTemperatureData(node.type, variant.data),
|
|
161
|
+
}))
|
|
162
|
+
: undefined,
|
|
151
163
|
disabled: node.disabled ? true : undefined,
|
|
152
164
|
isConditional: node.isConditional,
|
|
153
165
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { isAgentResponseTrace } from './model/AgentResponseTrace.js';
|
|
2
|
+
export { buildAgentProfileAttemptInspectorRows, getClassifierRequestCount, formatClassifierRequestCount, getProfileAttemptOmissionNotice, isClassifierRequest, } from './model/AgentResponseTracePresentation.js';
|
|
2
3
|
export { IndexedDbWebAppBrowserStorage, RIVET_WEB_APP_BROWSER_STORAGE_CHUNK_BYTES, RIVET_WEB_APP_BROWSER_STORAGE_DATABASE, RIVET_WEB_APP_BROWSER_STORAGE_SCHEMA_VERSION, RIVET_WEB_APP_LEGACY_RETENTION_MS, WebAppBrowserStoragePersistenceError, } from './model/WebAppBrowserStorage.js';
|
|
3
4
|
export { decodeRivetWebAppStorageBinaryFrame, deserializeRivetWebAppStoredValue, deserializeRivetWebAppStoredValuePatch, encodeRivetWebAppStorageBinaryFrame, parseRivetWebAppBrowserStorageClientMessage, parseRivetWebAppBrowserStorageServerMessage, RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES, RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTION_BYTES, RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTIVE_BYTES, RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_VALUE_BYTES, RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_TRANSFER_TIMEOUT_MS, RIVET_WEB_APP_BROWSER_STORAGE_RPC_CAPABILITY, RIVET_WEB_APP_BROWSER_STORAGE_RPC_VERSION, RIVET_WEB_APP_BROWSER_STORAGE_SAFE_FALLBACK_BYTES, RIVET_WEB_APP_BROWSER_STORAGE_TRANSFER_CHUNK_BYTES, serializeRivetWebAppStoredValue, serializeRivetWebAppStoredValuePatch, splitRivetWebAppStorageTransfer, } from './model/WebAppBrowserStorageRpc.js';
|
|
4
5
|
export { UiGraphBrowserPersistence } from './model/UiGraphIndexedDbPersistence.js';
|
|
@@ -15,6 +15,7 @@ import { GraphProcessor } from '../model/GraphProcessor.js';
|
|
|
15
15
|
import type { Tokenizer } from '../integrations/Tokenizer.js';
|
|
16
16
|
import { type LooseDataValue } from './looseDataValue.js';
|
|
17
17
|
import type { ProjectReferenceLoader } from '../model/ProjectReferenceLoader.js';
|
|
18
|
+
import type { SubgraphProjectLoader } from '../model/SubgraphProjectTarget.js';
|
|
18
19
|
import type { RivetStoredValueStore } from '../model/StoredValueStore.js';
|
|
19
20
|
import type { RivetKnowledgeStoreRegistry } from '../integrations/KnowledgeStore.js';
|
|
20
21
|
import type { RivetLLMProfileHealthStore } from '../model/chat-v2/llmProfileHealthStore.js';
|
|
@@ -47,6 +48,9 @@ export type RunGraphOptions = {
|
|
|
47
48
|
codeRunner?: ProcessContext['codeRunner'];
|
|
48
49
|
projectPath?: string;
|
|
49
50
|
projectReferenceLoader?: ProjectReferenceLoader;
|
|
51
|
+
subgraphProjectLoader?: SubgraphProjectLoader;
|
|
52
|
+
onSubgraphProjectRun?: ProcessContext['onSubgraphProjectRun'];
|
|
53
|
+
subgraphRecordingOptions?: ProcessContext['subgraphRecordingOptions'];
|
|
50
54
|
editorExecutionCache?: ProcessContext['editorExecutionCache'];
|
|
51
55
|
storedValueStore?: RivetStoredValueStore;
|
|
52
56
|
knowledgeStores?: RivetKnowledgeStoreRegistry;
|
|
@@ -73,5 +77,7 @@ export declare function coreCreateProcessor(project: Project, options: RunGraphO
|
|
|
73
77
|
run(): Promise<import("../model/GraphProcessor.js").GraphOutputs>;
|
|
74
78
|
};
|
|
75
79
|
export declare function coreRunGraph(project: Project, options: RunGraphOptions): Promise<Record<string, DataValue>>;
|
|
76
|
-
export declare function loadProjectFromString(content: string
|
|
80
|
+
export declare function loadProjectFromString(content: string, options?: {
|
|
81
|
+
logErrors?: boolean;
|
|
82
|
+
}): Project;
|
|
77
83
|
export declare function loadProjectAndAttachedDataFromString(content: string): [Project, AttachedData];
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -32,8 +32,12 @@ export * from './native/NativeApi.js';
|
|
|
32
32
|
export * from './native/BrowserNativeApi.js';
|
|
33
33
|
export * from './model/ProcessContext.js';
|
|
34
34
|
export * from './model/AgentResponseTrace.js';
|
|
35
|
+
export * from './model/AgentResponseTracePresentation.js';
|
|
35
36
|
export * from './model/DebuggerTransportSentinel.js';
|
|
36
37
|
export * from './model/ProjectReferenceLoader.js';
|
|
38
|
+
export * from './model/SubgraphProjectTarget.js';
|
|
39
|
+
export * from './model/ProjectBundle.js';
|
|
40
|
+
export * from './model/ProjectBundleRuntime.js';
|
|
37
41
|
export * from './model/RivetUIContext.js';
|
|
38
42
|
export * from './model/chat-v2/index.js';
|
|
39
43
|
export * from './integrations/integrations.js';
|
|
@@ -46,7 +46,7 @@ export type AgentLLMProfileAttemptTrace = Omit<LLMProfileAttemptTraceEvent, 'eve
|
|
|
46
46
|
export type AgentResponseTrace = {
|
|
47
47
|
schemaVersion: typeof AGENT_RESPONSE_TRACE_SCHEMA_VERSION;
|
|
48
48
|
traceId: RootRunId;
|
|
49
|
-
scope: 'response' | 'llm-invocation';
|
|
49
|
+
scope: 'response' | 'llm-invocation' | 'classifier-invocation';
|
|
50
50
|
rootRunId: RootRunId;
|
|
51
51
|
graphRunId: GraphRunId;
|
|
52
52
|
graphId: GraphId;
|
|
@@ -60,6 +60,8 @@ export type AgentResponseTrace = {
|
|
|
60
60
|
backgroundWorkPending?: boolean;
|
|
61
61
|
summary: {
|
|
62
62
|
modelCallCount: number;
|
|
63
|
+
/** Physical classifier requests, including retries; absent in older traces. */
|
|
64
|
+
classifierRequestCount?: number;
|
|
63
65
|
toolCallCount: number;
|
|
64
66
|
retryCount: number;
|
|
65
67
|
fallbackCount: number;
|
|
@@ -96,7 +98,7 @@ export type BuildAgentResponseTraceOptions = {
|
|
|
96
98
|
events: readonly AgentTraceEvent[];
|
|
97
99
|
nodeId?: NodeId;
|
|
98
100
|
processId?: ProcessId;
|
|
99
|
-
/** Recorded whole-node duration for
|
|
101
|
+
/** Recorded whole-node duration for a model invocation; response traces retain their output-ready duration. */
|
|
100
102
|
invocationDurationMs?: number;
|
|
101
103
|
startedAt?: number;
|
|
102
104
|
responseReadyAt?: number;
|
|
@@ -108,10 +110,19 @@ export declare function buildAgentResponseTrace(options: BuildAgentResponseTrace
|
|
|
108
110
|
export declare function getAgentTraceEventIdentity(event: AgentTraceEvent): string | undefined;
|
|
109
111
|
/**
|
|
110
112
|
* Redelivery is allowed to omit newly added optional observability fields. Keep
|
|
111
|
-
*
|
|
112
|
-
* later legacy-shaped copy erase result navigation.
|
|
113
|
+
* observed profile metadata and exact Delegate result pointers instead of
|
|
114
|
+
* making a later legacy-shaped copy erase diagnostics or result navigation.
|
|
113
115
|
*/
|
|
114
116
|
export declare function mergeAgentTraceEvent(existing: AgentTraceEvent, incoming: AgentTraceEvent): AgentTraceEvent;
|
|
117
|
+
/** Redelivery may omit optional receipts, but supplied pricing remains authoritative. */
|
|
118
|
+
export declare function mergeAgentModelCall<T extends ChatV2CallTraceEvent>(existing: Omit<ChatV2CallTraceEvent, 'callId' | 'provider'> & {
|
|
119
|
+
callId: string;
|
|
120
|
+
provider: string;
|
|
121
|
+
}, incoming: T): T;
|
|
122
|
+
/** Merge one identified attempt, retaining additive metadata omitted by older transports. */
|
|
123
|
+
export declare function mergeAgentProfileAttempt<T extends LLMProfileAttemptTraceEvent>(existing: LLMProfileAttemptTraceEvent, incoming: T): T;
|
|
124
|
+
/** Shared metadata accounting for response inspectors and the bounded activity journal. */
|
|
125
|
+
export declare function summarizeAgentResponseCalls(modelCalls: readonly AgentModelCallTrace[], profileAttempts: readonly AgentLLMProfileAttemptTrace[], toolCalls: readonly AgentToolCallTrace[]): AgentResponseTrace['summary'];
|
|
115
126
|
export declare function isAgentResponseTrace(value: unknown): value is AgentResponseTrace;
|
|
116
127
|
/**
|
|
117
128
|
* Collects privacy-bounded response metadata for one root processor run.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AgentLLMProfileAttemptTrace, AgentResponseTrace } from './AgentResponseTrace.js';
|
|
2
|
+
export type AgentProfileAttemptInspectorRow = Readonly<{
|
|
3
|
+
context: string;
|
|
4
|
+
error?: string;
|
|
5
|
+
eventId: string;
|
|
6
|
+
providerAndModel: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function buildAgentProfileAttemptInspectorRows(attempts: readonly AgentLLMProfileAttemptTrace[]): AgentProfileAttemptInspectorRow[];
|
|
9
|
+
/** Physical classifier requests share profile evidence, not LLM chat-round semantics. */
|
|
10
|
+
export declare function isClassifierRequest(attempt: AgentLLMProfileAttemptTrace): boolean;
|
|
11
|
+
export declare function getClassifierRequestCount(trace: AgentResponseTrace): number | undefined;
|
|
12
|
+
/** Older trace counters inferred from capped rows are lower bounds, not exact totals. */
|
|
13
|
+
export declare function formatClassifierRequestCount(trace: AgentResponseTrace): string | undefined;
|
|
14
|
+
/** One shared cap covers both physical classifier requests and profile decisions. */
|
|
15
|
+
export declare function getProfileAttemptOmissionNotice(trace: AgentResponseTrace): string | undefined;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function findStronglyConnectedComponents(nodes: ChartNode[], getAdjacentNodes: (node: ChartNode) => ChartNode[]): ChartNode[][];
|
|
1
|
+
export declare function findStronglyConnectedComponents<T extends object>(nodes: T[], getAdjacentNodes: (node: T) => T[]): T[][];
|
|
@@ -2,6 +2,7 @@ import type { GraphId } from '../index.js';
|
|
|
2
2
|
import type { DataId } from './Project.js';
|
|
3
3
|
import type { RivetKnowledgeDocument, RivetKnowledgeEvidence, RivetKnowledgeSourceReference } from '../integrations/KnowledgeStore.js';
|
|
4
4
|
import { type LLMProfileValue } from './chat-v2/llmProfileTypes.js';
|
|
5
|
+
import type { ClassifierProfileValue } from './classifier/profile.js';
|
|
5
6
|
export type DataValueDef<Type extends string, RuntimeType> = {
|
|
6
7
|
type: Type;
|
|
7
8
|
value: RuntimeType;
|
|
@@ -12,19 +13,19 @@ export type BoolDataValue = DataValueDef<'boolean', boolean>;
|
|
|
12
13
|
export type SystemChatMessage = {
|
|
13
14
|
type: 'system';
|
|
14
15
|
message: ChatMessageMessagePart | ChatMessageMessagePart[];
|
|
15
|
-
/**
|
|
16
|
+
/** Prompt-cache breakpoint for Anthropic or supported OpenRouter endpoints. */
|
|
16
17
|
isCacheBreakpoint?: boolean;
|
|
17
18
|
};
|
|
18
19
|
export type DeveloperChatMessage = {
|
|
19
20
|
type: 'developer';
|
|
20
21
|
message: ChatMessageMessagePart | ChatMessageMessagePart[];
|
|
21
|
-
/**
|
|
22
|
+
/** Prompt-cache breakpoint for Anthropic or supported OpenRouter endpoints. */
|
|
22
23
|
isCacheBreakpoint?: boolean;
|
|
23
24
|
};
|
|
24
25
|
export type UserChatMessage = {
|
|
25
26
|
type: 'user';
|
|
26
27
|
message: ChatMessageMessagePart | ChatMessageMessagePart[];
|
|
27
|
-
/**
|
|
28
|
+
/** Prompt-cache breakpoint for Anthropic or supported OpenRouter endpoints. */
|
|
28
29
|
isCacheBreakpoint?: boolean;
|
|
29
30
|
};
|
|
30
31
|
export type AssistantChatMessageFunctionCall = {
|
|
@@ -40,10 +41,12 @@ export type ParsedAssistantChatMessageFunctionCall = {
|
|
|
40
41
|
export type AssistantChatMessage = {
|
|
41
42
|
type: 'assistant';
|
|
42
43
|
message: ChatMessageMessagePart | ChatMessageMessagePart[];
|
|
44
|
+
/** Provider-returned reasoning continuity, including opaque encrypted blocks; not an API credential. */
|
|
45
|
+
openRouterReasoningDetails?: Record<string, unknown>[];
|
|
43
46
|
/** @deprecated use function_calls instead */
|
|
44
47
|
function_call: AssistantChatMessageFunctionCall | undefined;
|
|
45
48
|
function_calls: AssistantChatMessageFunctionCall[] | undefined;
|
|
46
|
-
/**
|
|
49
|
+
/** Prompt-cache breakpoint for Anthropic or supported OpenRouter endpoints. */
|
|
47
50
|
isCacheBreakpoint?: boolean;
|
|
48
51
|
};
|
|
49
52
|
export type FunctionResponseChatMessage = {
|
|
@@ -51,7 +54,7 @@ export type FunctionResponseChatMessage = {
|
|
|
51
54
|
message: ChatMessageMessagePart | ChatMessageMessagePart[];
|
|
52
55
|
name: string;
|
|
53
56
|
toolName?: string;
|
|
54
|
-
/**
|
|
57
|
+
/** Prompt-cache breakpoint for Anthropic or supported OpenRouter endpoints. */
|
|
55
58
|
isCacheBreakpoint?: boolean;
|
|
56
59
|
};
|
|
57
60
|
export type ChatMessage = SystemChatMessage | DeveloperChatMessage | UserChatMessage | AssistantChatMessage | FunctionResponseChatMessage;
|
|
@@ -96,6 +99,7 @@ export type KnowledgeSourceDataValue = DataValueDef<'knowledge-source', RivetKno
|
|
|
96
99
|
export type KnowledgeDocumentDataValue = DataValueDef<'knowledge-document', RivetKnowledgeDocument>;
|
|
97
100
|
export type KnowledgeEvidenceDataValue = DataValueDef<'knowledge-evidence', RivetKnowledgeEvidence>;
|
|
98
101
|
export type LLMProfileDataValue = DataValueDef<'llm-config', LLMProfileValue>;
|
|
102
|
+
export type ClassifierProfileDataValue = DataValueDef<'classifier-config', ClassifierProfileValue>;
|
|
99
103
|
export type DocumentDataValue = DataValueDef<'document', {
|
|
100
104
|
mediaType: SupportedDocumentMediaTypes;
|
|
101
105
|
data: Uint8Array;
|
|
@@ -116,7 +120,7 @@ export type GptFunction = {
|
|
|
116
120
|
};
|
|
117
121
|
export type GptFunctionDataValue = DataValueDef<'gpt-function', GptFunction>;
|
|
118
122
|
export type ControlFlowExcludedDataValue = DataValueDef<'control-flow-excluded', undefined | 'loop-not-broken'>;
|
|
119
|
-
export type ScalarDataValue = StringDataValue | NumberDataValue | DateDataValue | TimeDataValue | DateTimeDataValue | BoolDataValue | ChatMessageDataValue | ControlFlowExcludedDataValue | AnyDataValue | ObjectDataValue | GptFunctionDataValue | VectorDataValue | ImageDataValue | BinaryDataValue | AudioDataValue | GraphReferenceValue | KnowledgeSourceDataValue | KnowledgeDocumentDataValue | KnowledgeEvidenceDataValue | LLMProfileDataValue | DocumentDataValue;
|
|
123
|
+
export type ScalarDataValue = StringDataValue | NumberDataValue | DateDataValue | TimeDataValue | DateTimeDataValue | BoolDataValue | ChatMessageDataValue | ControlFlowExcludedDataValue | AnyDataValue | ObjectDataValue | GptFunctionDataValue | VectorDataValue | ImageDataValue | BinaryDataValue | AudioDataValue | GraphReferenceValue | KnowledgeSourceDataValue | KnowledgeDocumentDataValue | KnowledgeEvidenceDataValue | LLMProfileDataValue | ClassifierProfileDataValue | DocumentDataValue;
|
|
120
124
|
export type ScalarType = ScalarDataValue['type'];
|
|
121
125
|
export type ArrayDataValue<T extends ScalarDataValue> = DataValueDef<`${T['type']}[]`, T['value'][]>;
|
|
122
126
|
export type FunctionDataValue<T extends ScalarOrArrayDataValue> = DataValueDef<`fn<${T['type']}>`, () => T['value']>;
|
|
@@ -150,8 +154,8 @@ export type GetDataValue<Type extends DataType> = Extract<DataValue, {
|
|
|
150
154
|
export type DataRef = {
|
|
151
155
|
refId: DataId;
|
|
152
156
|
};
|
|
153
|
-
export declare const dataTypes: ["any", "any[]", "boolean", "boolean[]", "string", "string[]", "number", "number[]", "date", "date[]", "time", "time[]", "datetime", "datetime[]", "chat-message", "chat-message[]", "control-flow-excluded", "control-flow-excluded[]", "object", "object[]", "fn<string>", "fn<number>", "fn<boolean>", "fn<date>", "fn<time>", "fn<datetime>", "fn<any>", "fn<object>", "fn<chat-message>", "fn<control-flow-excluded>", "fn<string[]>", "fn<number[]>", "fn<boolean[]>", "fn<date[]>", "fn<time[]>", "fn<datetime[]>", "fn<any[]>", "fn<object[]>", "fn<chat-message[]>", "fn<control-flow-excluded[]>", "gpt-function", "gpt-function[]", "fn<gpt-function[]>", "fn<gpt-function>", "vector", "vector[]", "fn<vector>", "fn<vector[]>", "image", "image[]", "fn<image>", "fn<image[]>", "binary", "binary[]", "fn<binary>", "fn<binary[]>", "audio", "audio[]", "fn<audio>", "fn<audio[]>", "graph-reference", "graph-reference[]", "fn<graph-reference>", "fn<graph-reference[]>", "knowledge-source", "knowledge-source[]", "fn<knowledge-source>", "fn<knowledge-source[]>", "knowledge-document", "knowledge-document[]", "fn<knowledge-document>", "fn<knowledge-document[]>", "knowledge-evidence", "knowledge-evidence[]", "fn<knowledge-evidence>", "fn<knowledge-evidence[]>", "llm-config", "llm-config[]", "fn<llm-config>", "fn<llm-config[]>", "document", "document[]", "fn<document>", "fn<document[]>"];
|
|
154
|
-
export declare const scalarTypes: ["any", "boolean", "string", "number", "date", "time", "datetime", "chat-message", "control-flow-excluded", "object", "gpt-function", "vector", "image", "binary", "audio", "graph-reference", "knowledge-source", "knowledge-document", "knowledge-evidence", "llm-config", "document"];
|
|
157
|
+
export declare const dataTypes: ["any", "any[]", "boolean", "boolean[]", "string", "string[]", "number", "number[]", "date", "date[]", "time", "time[]", "datetime", "datetime[]", "chat-message", "chat-message[]", "control-flow-excluded", "control-flow-excluded[]", "object", "object[]", "fn<string>", "fn<number>", "fn<boolean>", "fn<date>", "fn<time>", "fn<datetime>", "fn<any>", "fn<object>", "fn<chat-message>", "fn<control-flow-excluded>", "fn<string[]>", "fn<number[]>", "fn<boolean[]>", "fn<date[]>", "fn<time[]>", "fn<datetime[]>", "fn<any[]>", "fn<object[]>", "fn<chat-message[]>", "fn<control-flow-excluded[]>", "gpt-function", "gpt-function[]", "fn<gpt-function[]>", "fn<gpt-function>", "vector", "vector[]", "fn<vector>", "fn<vector[]>", "image", "image[]", "fn<image>", "fn<image[]>", "binary", "binary[]", "fn<binary>", "fn<binary[]>", "audio", "audio[]", "fn<audio>", "fn<audio[]>", "graph-reference", "graph-reference[]", "fn<graph-reference>", "fn<graph-reference[]>", "knowledge-source", "knowledge-source[]", "fn<knowledge-source>", "fn<knowledge-source[]>", "knowledge-document", "knowledge-document[]", "fn<knowledge-document>", "fn<knowledge-document[]>", "knowledge-evidence", "knowledge-evidence[]", "fn<knowledge-evidence>", "fn<knowledge-evidence[]>", "llm-config", "llm-config[]", "fn<llm-config>", "fn<llm-config[]>", "classifier-config", "classifier-config[]", "fn<classifier-config>", "fn<classifier-config[]>", "document", "document[]", "fn<document>", "fn<document[]>"];
|
|
158
|
+
export declare const scalarTypes: ["any", "boolean", "string", "number", "date", "time", "datetime", "chat-message", "control-flow-excluded", "object", "gpt-function", "vector", "image", "binary", "audio", "graph-reference", "knowledge-source", "knowledge-document", "knowledge-evidence", "llm-config", "classifier-config", "document"];
|
|
155
159
|
export declare const dataTypeDisplayNames: Record<DataType, string>;
|
|
156
160
|
export declare function isScalarDataValue(value: DataValue | undefined): value is ScalarDataValue;
|
|
157
161
|
export declare function isScalarDataType(type: DataType): type is ScalarDataType;
|
|
@@ -9,6 +9,7 @@ import type { EventOccurrenceTiming, FrozenNodeOutputsByGraph, NodeResultOrigin,
|
|
|
9
9
|
import type { GraphProgress } from './GraphProgress.js';
|
|
10
10
|
import type { StreamingOutputWatchHistorySummary } from './StreamingOutputWatchHistory.js';
|
|
11
11
|
import type { RivetWebAppStorage } from './UiGraphWebAppStorage.js';
|
|
12
|
+
import type { CombinedDataset } from '../utils/index.js';
|
|
12
13
|
export type GraphInputs = Record<string, DataValue>;
|
|
13
14
|
export type GraphOutputs = Record<string, DataValue>;
|
|
14
15
|
export type Inputs = Record<PortId, DataValue | undefined>;
|
|
@@ -251,8 +252,16 @@ export type OutgoingMessageMap = {
|
|
|
251
252
|
contextValues: Record<string, DataValue>;
|
|
252
253
|
inputs?: GraphInputs;
|
|
253
254
|
projectPath?: string | null;
|
|
255
|
+
/** Local desktop executor only. Hosted executors reject client filesystem bundle paths. */
|
|
256
|
+
projectBundle?: {
|
|
257
|
+
manifestPath: string;
|
|
258
|
+
artifactId: string;
|
|
259
|
+
entryDatasets: CombinedDataset[];
|
|
260
|
+
};
|
|
254
261
|
useEditorCache?: boolean;
|
|
255
262
|
captureNodeTimings?: boolean;
|
|
263
|
+
/** Hosted editor setting; only the authenticated Node executor uses it. */
|
|
264
|
+
recordSubgraphProjectRuns?: boolean;
|
|
256
265
|
evaluation?: EvaluationExecutionMetadata;
|
|
257
266
|
/**
|
|
258
267
|
* An opaque, host-owned ID that lets a trusted executor join an unhealthy
|
|
@@ -8,6 +8,8 @@ export type GraphBoundaryInput = {
|
|
|
8
8
|
dataType: DataType;
|
|
9
9
|
editor?: DynamicEditorEditor;
|
|
10
10
|
id: string;
|
|
11
|
+
/** Stable Graph Input node identity; older saved boundaries may omit it. */
|
|
12
|
+
nodeId?: NodeId;
|
|
11
13
|
portId: PortId;
|
|
12
14
|
};
|
|
13
15
|
export type GraphBoundaryOutput = {
|
|
@@ -19,5 +19,14 @@ export type FrozenGraphBoundaryEffect = FrozenSetGlobalEffect | FrozenSetStoredV
|
|
|
19
19
|
* single boundary rule.
|
|
20
20
|
*/
|
|
21
21
|
export declare function commitGraphOutputValue(graphOutputs: GraphOutputs, outputId: string, value: DataValue): void;
|
|
22
|
-
export
|
|
22
|
+
export type GraphCostBreakdown = {
|
|
23
|
+
llm: number;
|
|
24
|
+
classifier: number;
|
|
25
|
+
other: number;
|
|
26
|
+
};
|
|
27
|
+
/** Safe family totals carried across graph and tool boundaries, separate from node diagnostics. */
|
|
28
|
+
export declare function readGraphCostBreakdown(outputs: Outputs): GraphCostBreakdown | undefined;
|
|
29
|
+
export declare function graphCostBreakdownMatchesCost(breakdown: GraphCostBreakdown, cost: number): boolean;
|
|
30
|
+
export declare function addGraphCostBreakdown(current: GraphCostBreakdown | undefined, addition: GraphCostBreakdown): GraphCostBreakdown;
|
|
31
|
+
export declare function ensureGraphCostOutput(graphOutputs: GraphOutputs, totalCost: number, breakdown?: GraphCostBreakdown): void;
|
|
23
32
|
export declare function applyFrozenGraphBoundaryEffects(graphOutputs: GraphOutputs, node: ChartNode, outputValues: Outputs): FrozenGraphBoundaryEffect | undefined;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { DataValue, StringArrayDataValue, ScalarOrArrayDataValue } from './DataValue.js';
|
|
2
|
+
import type { NodeId } from './NodeBase.js';
|
|
3
|
+
import type { Project, ProjectId } from './Project.js';
|
|
4
|
+
import type { ProcessContext, ProcessId, RootRunId, GraphRunId } from './ProcessContext.js';
|
|
5
|
+
import type { AttachedNodeData, GraphProcessor, GraphInputs, GraphOutputs, NodeResults, Outputs, NodeAbortControllerEntry } from './GraphProcessor.js';
|
|
6
|
+
import type PQueue from '../utils/pQueueCompat.js';
|
|
7
|
+
import type { NodeProcessContextBase } from './ProcessContextBuilder.js';
|
|
8
|
+
import type { GraphOutputSelection } from './GraphOutputSelection.js';
|
|
9
|
+
import type { RivetStoredValueController } from './StoredValueStore.js';
|
|
10
|
+
import type { KnowledgeStoreController } from '../integrations/KnowledgeStoreProvider.js';
|
|
11
|
+
import type { ResolvedSubgraphProject } from './SubgraphProjectTarget.js';
|
|
12
|
+
import type { GraphCostBreakdown } from './GraphBoundaryEffects.js';
|
|
13
|
+
/** Invocation-owned fields; GraphProcessor resets them at the established initialization boundaries. */
|
|
14
|
+
export declare class GraphInvocationState {
|
|
15
|
+
rootRunId: RootRunId;
|
|
16
|
+
graphRunId: GraphRunId;
|
|
17
|
+
parentGraphRunId: GraphRunId | undefined;
|
|
18
|
+
erroredNodes: Map<NodeId, Error | string>;
|
|
19
|
+
failureOutputsByProcessId: Map<ProcessId, Map<number, Outputs>>;
|
|
20
|
+
remainingNodes: Set<NodeId>;
|
|
21
|
+
visitedNodes: Set<NodeId>;
|
|
22
|
+
currentlyProcessing: Set<NodeId>;
|
|
23
|
+
context: ProcessContext;
|
|
24
|
+
nodeResults: NodeResults;
|
|
25
|
+
abortController: AbortController;
|
|
26
|
+
processingQueue: InstanceType<typeof PQueue>;
|
|
27
|
+
graphInputs: GraphInputs;
|
|
28
|
+
graphOutputs: GraphOutputs;
|
|
29
|
+
queuedNodes: Set<NodeId>;
|
|
30
|
+
/** Run To quiescence may defer nodes that a later streaming Stop resumes. */
|
|
31
|
+
deferredRunToIgnoredNodes: Set<NodeId>;
|
|
32
|
+
loopControllersSeen: Set<NodeId>;
|
|
33
|
+
subprocessors: Set<GraphProcessor>;
|
|
34
|
+
attachedNodeData: Map<NodeId, AttachedNodeData>;
|
|
35
|
+
successfulAbortTerminalProcessIds: Set<ProcessId>;
|
|
36
|
+
totalCost: number;
|
|
37
|
+
costBreakdown: GraphCostBreakdown | undefined;
|
|
38
|
+
ignoreNodes: Set<NodeId>;
|
|
39
|
+
hasPreloadedData: boolean;
|
|
40
|
+
loadedProjects: Record<ProjectId, Project>;
|
|
41
|
+
nodeProcessContextBase: NodeProcessContextBase;
|
|
42
|
+
runToRelevantNodeIds: Set<NodeId> | undefined;
|
|
43
|
+
graphOutputSelection: GraphOutputSelection | undefined;
|
|
44
|
+
nodeAbortControllers: Map<NodeId, NodeAbortControllerEntry>;
|
|
45
|
+
graphInputNodeValues: Record<string, DataValue>;
|
|
46
|
+
/** User input nodes awaiting interactive input for this invocation. */
|
|
47
|
+
pendingUserInputs: Record<NodeId, {
|
|
48
|
+
resolve: (values: StringArrayDataValue) => void;
|
|
49
|
+
}>;
|
|
50
|
+
/** Mutate the owner in place: late child cost/events still address this invocation. */
|
|
51
|
+
initialize(options: {
|
|
52
|
+
preloadedNodeResults: NodeResults;
|
|
53
|
+
remainingNodeIds: Iterable<NodeId>;
|
|
54
|
+
processingQueue: InstanceType<typeof PQueue>;
|
|
55
|
+
createAbortController: () => AbortController;
|
|
56
|
+
loadedProjects: Record<ProjectId, Project>;
|
|
57
|
+
sharedOverride?: Pick<GraphInvocationState, 'graphOutputs' | 'attachedNodeData' | 'graphInputNodeValues'>;
|
|
58
|
+
}): void;
|
|
59
|
+
}
|
|
60
|
+
/** Shared by every child kind; retained caches/globals deliberately keep existing reuse semantics. */
|
|
61
|
+
export declare class GraphSharedExecutionState {
|
|
62
|
+
globals: Map<string, ScalarOrArrayDataValue>;
|
|
63
|
+
executionCache: Map<string, unknown>;
|
|
64
|
+
storedValueController: RivetStoredValueController;
|
|
65
|
+
knowledgeStoreController: KnowledgeStoreController;
|
|
66
|
+
subgraphTargetCache: Map<ProjectId, ResolvedSubgraphProject>;
|
|
67
|
+
nextRootRun(): GraphSharedExecutionState;
|
|
68
|
+
}
|
|
@@ -34,6 +34,7 @@ export type EventOccurrenceTiming = {
|
|
|
34
34
|
type WithExecution<T extends object> = T & {
|
|
35
35
|
execution: GraphExecutionMetadata;
|
|
36
36
|
} & ReplayEventTiming & EventOccurrenceTiming;
|
|
37
|
+
export type NodeAbortControllerEntry = AbortController | Set<AbortController>;
|
|
37
38
|
declare const graphProcessorGraphOverride: unique symbol;
|
|
38
39
|
declare const consumedAsyncBranchTriggerOverride: unique symbol;
|
|
39
40
|
declare const asyncBranchInputAnchorsOverride: unique symbol;
|
|
@@ -320,6 +321,7 @@ export declare class GraphProcessor {
|
|
|
320
321
|
[asyncBranchInputAnchorsOverride]?: GraphNodeDefinitions;
|
|
321
322
|
[consumedStreamingWatchNodeOverride]?: NodeId;
|
|
322
323
|
});
|
|
324
|
+
get recordingProjectScope(): string | undefined;
|
|
323
325
|
on: Emittery<ProcessEvents>["on"];
|
|
324
326
|
off: Emittery<ProcessEvents>["off"];
|
|
325
327
|
once: Emittery<ProcessEvents>["once"];
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { DataType, DataValue } from './DataValue.js';
|
|
2
|
+
import type { ChartNode, NodeId, PortId } from './NodeBase.js';
|
|
3
|
+
import type { NodeGraph } from './NodeGraph.js';
|
|
4
|
+
import type { CatchStreamingChunksNode } from './nodes/CatchStreamingChunksNode.js';
|
|
5
|
+
import type { StreamingOutputWatch } from './StreamingOutputWatch.js';
|
|
6
|
+
import type { StreamingOutputWatchHistory, StreamingOutputWatchHistoryIteration } from './StreamingOutputWatchHistory.js';
|
|
7
|
+
import type { GraphInputStream, GraphInputStreamRelay } from './GraphInputStream.js';
|
|
8
|
+
export type SchedulerBoundaryFailure = {
|
|
9
|
+
error: Error;
|
|
10
|
+
triggerNode: ChartNode;
|
|
11
|
+
nodeErrors: Array<{
|
|
12
|
+
error: Error | string;
|
|
13
|
+
node: ChartNode;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
export type StreamingOutputWatchPlan = {
|
|
17
|
+
graph: NodeGraph;
|
|
18
|
+
/** Only retain and snapshot the cumulative history when a branch consumes it. */
|
|
19
|
+
includeAllStreamedOutput: boolean;
|
|
20
|
+
sourceOutputId: PortId;
|
|
21
|
+
/**
|
|
22
|
+
* A Stop boundary is optional. Without one, every snapshot runs the entire
|
|
23
|
+
* contained branch and the watch completes normally with its producer.
|
|
24
|
+
*/
|
|
25
|
+
stopNodeId?: NodeId;
|
|
26
|
+
/**
|
|
27
|
+
* Immutable stream increments observed for this run. Cumulative string
|
|
28
|
+
* snapshots contribute only their new suffix so an LLM response does not
|
|
29
|
+
* retain N copies of its whole prefix.
|
|
30
|
+
*/
|
|
31
|
+
streamedOutput: unknown[];
|
|
32
|
+
previousStreamedValue: unknown;
|
|
33
|
+
watchNode: ChartNode;
|
|
34
|
+
nextUpdateIndex: number;
|
|
35
|
+
history: StreamingOutputWatchHistory;
|
|
36
|
+
historySummaryEmitted: boolean;
|
|
37
|
+
/** True once normal stream exhaustion has excluded the parent Stop boundary. */
|
|
38
|
+
unmatchedStopResolved: boolean;
|
|
39
|
+
};
|
|
40
|
+
export type StreamingOutputCatchPlan = {
|
|
41
|
+
node: CatchStreamingChunksNode;
|
|
42
|
+
sourceOutputId: PortId;
|
|
43
|
+
count: number;
|
|
44
|
+
chunks: DataValue[];
|
|
45
|
+
settled: boolean;
|
|
46
|
+
};
|
|
47
|
+
export type StreamingOutputWatchInvocation = {
|
|
48
|
+
plan: StreamingOutputWatchPlan;
|
|
49
|
+
historyIteration: StreamingOutputWatchHistoryIteration;
|
|
50
|
+
/**
|
|
51
|
+
* Atomically claims the parent Watch's one accepted Stop value. The claim is
|
|
52
|
+
* made before the child's nodeFinish is emitted so that event can identify
|
|
53
|
+
* the actual terminal branch, but its parent-dataflow effects are committed
|
|
54
|
+
* only after that lifecycle event has been published.
|
|
55
|
+
*/
|
|
56
|
+
claimStop: (value: DataValue) => StreamingOutputWatchStopClaim | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Set only by the live Stop node implementation. The output that re-enters
|
|
59
|
+
* the parent is deliberately taken from the completed node result instead:
|
|
60
|
+
* split nodes aggregate their per-item outputs only at that boundary.
|
|
61
|
+
*/
|
|
62
|
+
stopReached: boolean;
|
|
63
|
+
};
|
|
64
|
+
export type StreamingOutputWatchStopClaim = {
|
|
65
|
+
commit: () => void;
|
|
66
|
+
};
|
|
67
|
+
export type GraphOutputPartialBinding = {
|
|
68
|
+
dataType: DataType;
|
|
69
|
+
graphOutputId: string;
|
|
70
|
+
sourceOutputId: PortId;
|
|
71
|
+
};
|
|
72
|
+
/** Invocation-owned boundary resources; no scheduling or event-emission policy. */
|
|
73
|
+
export declare class GraphSchedulerBoundaryState {
|
|
74
|
+
streamingWatchPlansBySourceNodeId: Map<NodeId, StreamingOutputWatchPlan[]>;
|
|
75
|
+
streamingWatchPlansByWatchNodeId: Map<NodeId, StreamingOutputWatchPlan>;
|
|
76
|
+
streamingOutputWatches: Map<NodeId, StreamingOutputWatch>;
|
|
77
|
+
streamingCatchPlansBySourceNodeId: Map<NodeId, StreamingOutputCatchPlan[]>;
|
|
78
|
+
streamingCatchTasks: Set<Promise<void>>;
|
|
79
|
+
graphOutputPartialBindingsBySourceNodeId: Map<NodeId, GraphOutputPartialBinding[]>;
|
|
80
|
+
graphInputStreams: Readonly<Record<string, GraphInputStream>>;
|
|
81
|
+
callerInputStreams: Map<NodeId, Record<string, GraphInputStreamRelay>>;
|
|
82
|
+
inputStreamRoutes: Map<NodeId, {
|
|
83
|
+
port: PortId;
|
|
84
|
+
relay: GraphInputStreamRelay;
|
|
85
|
+
}[]>;
|
|
86
|
+
streamCallerTasks: Set<Promise<unknown>>;
|
|
87
|
+
inputStreamDisposers: Array<() => void>;
|
|
88
|
+
pendingGraphInputFinals: Map<NodeId, import("./NodeIO.js").NodeOutputs>;
|
|
89
|
+
streamingWatchFailures: SchedulerBoundaryFailure[];
|
|
90
|
+
resetTopology(): void;
|
|
91
|
+
/** Called after invocation initialization, before subscriptions can be admitted. */
|
|
92
|
+
initializeInputStreams(streams?: Readonly<Record<string, GraphInputStream>>): void;
|
|
93
|
+
/** Release every subscription/relay, even if one host-provided disposer fails. */
|
|
94
|
+
releaseInputStreams(): void;
|
|
95
|
+
drainCatchTasks(waitForQueue: () => Promise<unknown>): Promise<void>;
|
|
96
|
+
}
|