@valerypopoff/rivet2-core 2.1.10 → 2.4.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 +2604 -949
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/webAppRuntime.cjs +1549 -99
- package/dist/cjs/webAppRuntime.cjs.map +4 -4
- package/dist/esm/api/createProcessor.js +4 -0
- package/dist/esm/exports.js +2 -0
- package/dist/esm/integrations/CodeRunner.js +2 -7
- package/dist/esm/integrations/CodeRunnerOptions.js +7 -0
- package/dist/esm/model/AgentResponseTrace.js +137 -11
- package/dist/esm/model/GraphProcessor.js +28 -0
- package/dist/esm/model/NodeExclusionPolicy.js +9 -1
- package/dist/esm/model/ProcessContextBuilder.js +2 -1
- package/dist/esm/model/RecordingPlayer.js +58 -5
- package/dist/esm/model/SubprocessorBridge.js +2 -0
- package/dist/esm/model/UiGraphActionProtocol.js +47 -4
- package/dist/esm/model/UiGraphBrowserRuntime.js +15 -1
- package/dist/esm/model/UiGraphIndexedDbPersistence.js +523 -0
- package/dist/esm/model/UiGraphRendererStyles.js +14 -0
- package/dist/esm/model/WebAppBrowserStorage.js +653 -0
- package/dist/esm/model/WebAppBrowserStorageRpc.js +200 -0
- package/dist/esm/model/chat-v2/aiSdkBridge.js +146 -14
- package/dist/esm/model/chat-v2/chatV2CallObserver.js +3 -0
- package/dist/esm/model/chat-v2/chatV2CredentialNames.js +93 -0
- package/dist/esm/model/chat-v2/chatV2EditorCache.js +8 -38
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +41 -4
- package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +31 -2
- package/dist/esm/model/chat-v2/chatV2ResponseBodyCapture.js +10 -2
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +6 -11
- package/dist/esm/model/chat-v2/chatV2Shared.js +1 -1
- package/dist/esm/model/chat-v2/chatV2Types.js +16 -0
- package/dist/esm/model/chat-v2/customProviderApi.js +0 -2
- package/dist/esm/model/chat-v2/index.js +3 -0
- package/dist/esm/model/chat-v2/llmChatV2Body.js +9 -1
- package/dist/esm/model/chat-v2/llmChatV2CachePolicy.js +5 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +7 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +95 -14
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +33 -9
- package/dist/esm/model/chat-v2/llmChatV2OutputClone.js +42 -0
- package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +31 -2
- package/dist/esm/model/chat-v2/llmModelCandidate.js +5 -1
- package/dist/esm/model/chat-v2/llmProfile.js +58 -0
- package/dist/esm/model/chat-v2/llmProfileBody.js +10 -0
- package/dist/esm/model/chat-v2/llmProfileFallback.js +406 -8
- package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +7 -0
- package/dist/esm/model/chat-v2/llmProfileHealthStore.js +328 -0
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +57 -34
- package/dist/esm/model/chat-v2/providerOptions.js +33 -7
- package/dist/esm/model/chat-v2/toolContinuation.js +27 -1
- package/dist/esm/model/nodes/CodeNewNode.js +5 -47
- package/dist/esm/model/nodes/CodeNode.js +4 -46
- package/dist/esm/model/nodes/ExpressionNode.js +5 -8
- package/dist/esm/model/nodes/LLMChatV2Node.js +31 -3
- package/dist/esm/model/nodes/MatchNode.js +86 -41
- 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.js +1 -2
- package/dist/esm/recording/ExecutionRecorder.js +50 -8
- package/dist/esm/webAppRuntime.js +5 -2
- package/dist/types/api/createProcessor.d.ts +5 -0
- package/dist/types/exports.d.ts +2 -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 +15 -1
- package/dist/types/model/EditorDefinition.d.ts +16 -0
- package/dist/types/model/ExecutorProtocol.d.ts +17 -6
- package/dist/types/model/GraphProcessor.d.ts +17 -5
- package/dist/types/model/NodeBase.d.ts +0 -10
- package/dist/types/model/NodeExclusionPolicy.d.ts +6 -0
- package/dist/types/model/Nodes.d.ts +2 -2
- package/dist/types/model/ProcessContext.d.ts +85 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +2 -1
- package/dist/types/model/UiGraphActionProtocol.d.ts +9 -3
- package/dist/types/model/UiGraphBrowserRuntime.d.ts +6 -0
- package/dist/types/model/UiGraphIndexedDbPersistence.d.ts +50 -0
- package/dist/types/model/UiGraphRendererStyles.d.ts +1 -1
- package/dist/types/model/WebAppBrowserStorage.d.ts +90 -0
- package/dist/types/model/WebAppBrowserStorageRpc.d.ts +85 -0
- package/dist/types/model/chat-v2/chatV2CredentialNames.d.ts +30 -0
- package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +1 -0
- package/dist/types/model/chat-v2/chatV2ProviderProfile.d.ts +3 -0
- package/dist/types/model/chat-v2/chatV2ResponseBodyCapture.d.ts +8 -2
- package/dist/types/model/chat-v2/chatV2RuntimeOptions.d.ts +3 -8
- package/dist/types/model/chat-v2/chatV2Types.d.ts +27 -1
- package/dist/types/model/chat-v2/customProviderApi.d.ts +0 -1
- package/dist/types/model/chat-v2/index.d.ts +3 -0
- package/dist/types/model/chat-v2/llmChatV2CachePolicy.d.ts +1 -1
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +10 -1
- package/dist/types/model/chat-v2/llmChatV2OutputClone.d.ts +3 -0
- package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +5 -1
- package/dist/types/model/chat-v2/llmModelCandidate.d.ts +2 -0
- package/dist/types/model/chat-v2/llmProfile.d.ts +14 -0
- package/dist/types/model/chat-v2/llmProfileBody.d.ts +1 -1
- package/dist/types/model/chat-v2/llmProfileFallback.d.ts +25 -2
- package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +26 -6
- package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +121 -0
- package/dist/types/model/chat-v2/llmProfileNodeRuntime.d.ts +1 -1
- package/dist/types/model/chat-v2/llmProfileTypes.d.ts +9 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +2 -0
- package/dist/types/model/chat-v2/toolContinuation.d.ts +14 -0
- 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/MatchNode.d.ts +6 -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.d.ts +1 -1
- package/dist/types/recording/ExecutionRecorder.d.ts +7 -1
- package/dist/types/recording/RecordedEvents.d.ts +11 -0
- package/dist/types/webAppRuntime.d.ts +8 -2
- package/package.json +2 -2
|
@@ -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, ChatV2CallTraceEvent, ToolCallFinishedEvent } from './ProcessContext.js';
|
|
7
|
+
import type { GraphExecutionMetadata, InternalProcessContext, ProcessContext, ProcessId, ChatV2CallTraceEvent, LLMChatOutputSnapshotEvent, 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,9 +13,17 @@ 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;
|
|
21
29
|
export type NodeResultOrigin = 'executed' | 'preloaded' | 'frozen' | 'editor-cache' | 'unknown';
|
|
@@ -121,6 +129,10 @@ export type ProcessEvents = {
|
|
|
121
129
|
}>;
|
|
122
130
|
/** Privacy-bounded metadata for one physical LLM provider call. */
|
|
123
131
|
llmCallFinished: WithExecution<ChatV2CallTraceEvent>;
|
|
132
|
+
/** Display-only output page for one completed logical LLM Chat round. */
|
|
133
|
+
llmChatOutputSnapshot: WithExecution<LLMChatOutputSnapshotEvent>;
|
|
134
|
+
/** Privacy-bounded metadata for one LLM fallback/profile-health decision. */
|
|
135
|
+
llmProfileAttempt: WithExecution<LLMProfileAttemptTraceEvent>;
|
|
124
136
|
/** Privacy-bounded metadata for one delegated tool execution. */
|
|
125
137
|
toolCallFinished: WithExecution<ToolCallFinishedEvent>;
|
|
126
138
|
/** Called when the outputs of a node have been cleared entirely. If processId is present, only the one process() should be cleared. */
|
|
@@ -131,16 +143,16 @@ export type ProcessEvents = {
|
|
|
131
143
|
/** Called when the root graph has errored. The root graph will also throw. */
|
|
132
144
|
error: {
|
|
133
145
|
error: Error | string;
|
|
134
|
-
};
|
|
146
|
+
} & ReplayEventTiming;
|
|
135
147
|
/** Called when processing has completed. */
|
|
136
148
|
done: {
|
|
137
149
|
results: GraphOutputs;
|
|
138
|
-
};
|
|
150
|
+
} & ReplayEventTiming;
|
|
139
151
|
/** Called when processing has been aborted. */
|
|
140
152
|
abort: {
|
|
141
153
|
successful: boolean;
|
|
142
154
|
error?: string | Error;
|
|
143
|
-
};
|
|
155
|
+
} & ReplayEventTiming;
|
|
144
156
|
/** Called when processing has finished either successfully or unsuccessfully. */
|
|
145
157
|
finish: void;
|
|
146
158
|
/** Called for trace level logs. */
|
|
@@ -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. */
|
|
@@ -9,6 +9,12 @@ export type NodeExclusionDecision = {
|
|
|
9
9
|
reason: NodeExclusionReason;
|
|
10
10
|
traceMessage: string;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Whether a node intentionally handles an input that was excluded by control
|
|
14
|
+
* flow. Most nodes are excluded themselves in that situation; these nodes
|
|
15
|
+
* implement their own fallback, branching, or aggregation behavior instead.
|
|
16
|
+
*/
|
|
17
|
+
export declare function canConsumeControlFlowExcludedInput(node: ChartNode): boolean;
|
|
12
18
|
export declare function getControlFlowExclusionDecision({ inputValues, node, typeOfExclusion, }: {
|
|
13
19
|
inputValues: NodePortValues;
|
|
14
20
|
node: ChartNode;
|
|
@@ -103,12 +103,12 @@ export * from './nodes/MCPToolCallNode.js';
|
|
|
103
103
|
export * from './nodes/MCPGetPromptNode.js';
|
|
104
104
|
export * from './nodes/ReferencedGraphAliasNode.js';
|
|
105
105
|
export * from './nodes/NodePrefabInstanceNode.js';
|
|
106
|
-
export declare const registerBuiltInNodes: (registry: NodeRegistration) => NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "graphOutput" | "delegateFunctionCall" | "setGlobal" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "setStoredValue" | "abortGraph" | "
|
|
106
|
+
export declare const registerBuiltInNodes: (registry: NodeRegistration) => NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "graphOutput" | "delegateFunctionCall" | "setGlobal" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "setStoredValue" | "abortGraph" | "prompt" | "llmChatV2" | "userInput" | "llmProfile" | "extractRegex" | "codeNew" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "coalesce" | "didRun" | "passthrough" | "dataBus" | "startBackgroundBranch" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "knowledgeSource" | "knowledgeDocument" | "syncKnowledgeSource" | "getKnowledgeSourceStatus" | "searchKnowledge" | "buildKnowledgeContext" | "hash" | "raceInputs" | "toJson" | "jsFilter" | "jsMap" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "comment" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "playAudio" | "chatLoop" | "readAllFiles" | "toMarkdownTable" | "cron" | "toTree" | "loopUntil" | "mcpDiscovery" | "mcpToolCall" | "mcpGetPrompt" | "referencedGraphAlias" | "nodePrefabInstance", import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./chat-v2/llmChatV2NodeData.js").LLMChatV2Node | import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./nodes/LLMProfileNode.js").LLMProfileNode | import("./nodes/PromptNode.js").PromptNode | import("./nodes/ExtractRegexNode.js").ExtractRegexNode | import("./nodes/CodeNode.js").CodeNode | import("./nodes/CodeNewNode.js").CodeNewNode | import("./nodes/ExpressionNode.js").ExpressionNode | import("./nodes/MatchNode.js").MatchNode | import("./nodes/IfNode.js").IfNode | import("./nodes/ReadDirectoryNode.js").ReadDirectoryNode | import("./nodes/ReadFileNode.js").ReadFileNode | import("./nodes/IfElseNode.js").IfElseNode | import("./nodes/ChunkNode.js").ChunkNode | import("./nodes/SubGraphNode.js").SubGraphNode | import("./nodes/ArrayNode.js").ArrayNode | import("./nodes/ExtractJsonNode.js").ExtractJsonNode | import("./nodes/AssemblePromptNode.js").AssemblePromptNode | import("./nodes/ExtractYamlNode.js").ExtractYamlNode | import("./nodes/LoopControllerNode.js").LoopControllerNode | import("./nodes/TrimChatMessagesNode.js").TrimChatMessagesNode | import("./nodes/ExternalCallNode.js").ExternalCallNode | import("./nodes/ExtractObjectPathNode.js").ExtractObjectPathNode | import("./nodes/RaiseEventNode.js").RaiseEventNode | import("./nodes/ReportProgressNode.js").ReportProgressNode | import("./nodes/ContextNode.js").ContextNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/DidRunNode.js").DidRunNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/DataBusNode.js").DataBusNode | import("./nodes/StartBackgroundBranchNode.js").StartBackgroundBranchNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | import("./nodes/SetStoredValueNode.js").SetStoredValueNode | import("./nodes/GetStoredValueNode.js").GetStoredValueNode | import("./nodes/WaitForEventNode.js").WaitForEventNode | import("./nodes/ToolNode.js").GptFunctionNode | import("./nodes/ToYamlNode.js").ToYamlNode | import("./nodes/GetEmbeddingNode.js").GetEmbeddingNode | import("./nodes/VectorStoreNode.js").VectorStoreNode | import("./nodes/VectorNearestNeighborsNode.js").VectorNearestNeighborsNode | import("./nodes/KnowledgeSourceNode.js").KnowledgeSourceNode | import("./nodes/KnowledgeDocumentNode.js").KnowledgeDocumentNode | import("./nodes/SyncKnowledgeSourceNode.js").SyncKnowledgeSourceNode | import("./nodes/GetKnowledgeSourceStatusNode.js").GetKnowledgeSourceStatusNode | import("./nodes/SearchKnowledgeNode.js").SearchKnowledgeNode | import("./nodes/BuildKnowledgeContextNode.js").BuildKnowledgeContextNode | import("./nodes/HashNode.js").HashNode | import("./nodes/AbortGraphNode.js").AbortGraphNode | import("./nodes/RaceInputsNode.js").RaceInputsNode | import("./nodes/ToJsonNode.js").ToJsonNode | import("./nodes/JoinNode.js").JoinNode | import("./nodes/FilterNode.js").FilterNode | import("./nodes/JSFilterNode.js").JSFilterNode | import("./nodes/JSMapNode.js").JSMapNode | import("./nodes/ObjectNode.js").ObjectNode | import("./nodes/BooleanNode.js").BooleanNode | import("./nodes/CompareNode.js").CompareNode | import("./nodes/EvaluateNode.js").EvaluateNode | import("./nodes/NumberNode.js").NumberNode | import("./nodes/RandomNumberNode.js").RandomNumberNode | import("./nodes/ShuffleNode.js").ShuffleNode | import("./nodes/CommentNode.js").CommentNode | import("./nodes/ImageNode.js").ImageNode | import("./nodes/AudioNode.js").AudioNode | import("./nodes/HttpCallNode.js").HttpCallNode | import("./nodes/DelayNode.js").DelayNode | import("./nodes/AppendToDatasetNode.js").AppendToDatasetNode | import("./nodes/CreateDatasetNode.js").CreateDatasetNode | import("./nodes/LoadDatasetNode.js").LoadDatasetNode | import("./nodes/GetAllDatasetsNode.js").GetAllDatasetsNode | import("./nodes/SplitNode.js").SplitNode | import("./nodes/DatasetNearestNeigborsNode.js").DatasetNearestNeighborsNode | import("./nodes/GetDatasetRowNode.js").GetDatasetRowNode | import("./nodes/SliceNode.js").SliceNode | import("./nodes/ExtractMarkdownCodeBlocksNode.js").ExtractMarkdownCodeBlocksNode | import("./nodes/AssembleMessageNode.js").AssembleMessageNode | import("./nodes/URLReferenceNode.js").UrlReferenceNode | import("./nodes/DestructureNode.js").DestructureNode | import("./nodes/ReplaceDatasetNode.js").ReplaceDatasetNode | import("./nodes/ListGraphsNode.js").ListGraphsNode | import("./nodes/GraphReferenceNode.js").GraphReferenceNode | import("./nodes/CallGraphNode.js").CallGraphNode | import("./nodes/DelegateFunctionCallNode.js").DelegateFunctionCallNode | import("./nodes/PlayAudioNode.js").PlayAudioNode | import("./nodes/DocumentNode.js").DocumentNode | import("./nodes/ChatLoopNode.js").ChatLoopNode | import("./nodes/ReadAllFilesNode.js").ReadAllFilesNode | import("./nodes/ToMarkdownTableNode.js").ToMarkdownTableNode | import("./nodes/CronNode.js").CronNode | import("./nodes/ToTreeNode.js").ToTreeNode | import("./nodes/LoopUntilNode.js").LoopUntilNode | (import("./NodeBase.js").NodeBase & {
|
|
107
107
|
type: "mcpDiscovery";
|
|
108
108
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
109
109
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
110
110
|
}) | import("./nodes/MCPToolCallNode.js").MCPToolCallNode | import("./nodes/MCPGetPromptNode.js").MCPGetPromptNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode | import("./NodePrefabResolver.js").NodePrefabInstanceNode>;
|
|
111
|
-
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "graphOutput" | "delegateFunctionCall" | "setGlobal" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "setStoredValue" | "abortGraph" | "
|
|
111
|
+
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "graphOutput" | "delegateFunctionCall" | "setGlobal" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "setStoredValue" | "abortGraph" | "prompt" | "llmChatV2" | "userInput" | "llmProfile" | "extractRegex" | "codeNew" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "coalesce" | "didRun" | "passthrough" | "dataBus" | "startBackgroundBranch" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "knowledgeSource" | "knowledgeDocument" | "syncKnowledgeSource" | "getKnowledgeSourceStatus" | "searchKnowledge" | "buildKnowledgeContext" | "hash" | "raceInputs" | "toJson" | "jsFilter" | "jsMap" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "comment" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "playAudio" | "chatLoop" | "readAllFiles" | "toMarkdownTable" | "cron" | "toTree" | "loopUntil" | "mcpDiscovery" | "mcpToolCall" | "mcpGetPrompt" | "referencedGraphAlias" | "nodePrefabInstance", import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./chat-v2/llmChatV2NodeData.js").LLMChatV2Node | import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./nodes/LLMProfileNode.js").LLMProfileNode | import("./nodes/PromptNode.js").PromptNode | import("./nodes/ExtractRegexNode.js").ExtractRegexNode | import("./nodes/CodeNode.js").CodeNode | import("./nodes/CodeNewNode.js").CodeNewNode | import("./nodes/ExpressionNode.js").ExpressionNode | import("./nodes/MatchNode.js").MatchNode | import("./nodes/IfNode.js").IfNode | import("./nodes/ReadDirectoryNode.js").ReadDirectoryNode | import("./nodes/ReadFileNode.js").ReadFileNode | import("./nodes/IfElseNode.js").IfElseNode | import("./nodes/ChunkNode.js").ChunkNode | import("./nodes/SubGraphNode.js").SubGraphNode | import("./nodes/ArrayNode.js").ArrayNode | import("./nodes/ExtractJsonNode.js").ExtractJsonNode | import("./nodes/AssemblePromptNode.js").AssemblePromptNode | import("./nodes/ExtractYamlNode.js").ExtractYamlNode | import("./nodes/LoopControllerNode.js").LoopControllerNode | import("./nodes/TrimChatMessagesNode.js").TrimChatMessagesNode | import("./nodes/ExternalCallNode.js").ExternalCallNode | import("./nodes/ExtractObjectPathNode.js").ExtractObjectPathNode | import("./nodes/RaiseEventNode.js").RaiseEventNode | import("./nodes/ReportProgressNode.js").ReportProgressNode | import("./nodes/ContextNode.js").ContextNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/DidRunNode.js").DidRunNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/DataBusNode.js").DataBusNode | import("./nodes/StartBackgroundBranchNode.js").StartBackgroundBranchNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | import("./nodes/SetStoredValueNode.js").SetStoredValueNode | import("./nodes/GetStoredValueNode.js").GetStoredValueNode | import("./nodes/WaitForEventNode.js").WaitForEventNode | import("./nodes/ToolNode.js").GptFunctionNode | import("./nodes/ToYamlNode.js").ToYamlNode | import("./nodes/GetEmbeddingNode.js").GetEmbeddingNode | import("./nodes/VectorStoreNode.js").VectorStoreNode | import("./nodes/VectorNearestNeighborsNode.js").VectorNearestNeighborsNode | import("./nodes/KnowledgeSourceNode.js").KnowledgeSourceNode | import("./nodes/KnowledgeDocumentNode.js").KnowledgeDocumentNode | import("./nodes/SyncKnowledgeSourceNode.js").SyncKnowledgeSourceNode | import("./nodes/GetKnowledgeSourceStatusNode.js").GetKnowledgeSourceStatusNode | import("./nodes/SearchKnowledgeNode.js").SearchKnowledgeNode | import("./nodes/BuildKnowledgeContextNode.js").BuildKnowledgeContextNode | import("./nodes/HashNode.js").HashNode | import("./nodes/AbortGraphNode.js").AbortGraphNode | import("./nodes/RaceInputsNode.js").RaceInputsNode | import("./nodes/ToJsonNode.js").ToJsonNode | import("./nodes/JoinNode.js").JoinNode | import("./nodes/FilterNode.js").FilterNode | import("./nodes/JSFilterNode.js").JSFilterNode | import("./nodes/JSMapNode.js").JSMapNode | import("./nodes/ObjectNode.js").ObjectNode | import("./nodes/BooleanNode.js").BooleanNode | import("./nodes/CompareNode.js").CompareNode | import("./nodes/EvaluateNode.js").EvaluateNode | import("./nodes/NumberNode.js").NumberNode | import("./nodes/RandomNumberNode.js").RandomNumberNode | import("./nodes/ShuffleNode.js").ShuffleNode | import("./nodes/CommentNode.js").CommentNode | import("./nodes/ImageNode.js").ImageNode | import("./nodes/AudioNode.js").AudioNode | import("./nodes/HttpCallNode.js").HttpCallNode | import("./nodes/DelayNode.js").DelayNode | import("./nodes/AppendToDatasetNode.js").AppendToDatasetNode | import("./nodes/CreateDatasetNode.js").CreateDatasetNode | import("./nodes/LoadDatasetNode.js").LoadDatasetNode | import("./nodes/GetAllDatasetsNode.js").GetAllDatasetsNode | import("./nodes/SplitNode.js").SplitNode | import("./nodes/DatasetNearestNeigborsNode.js").DatasetNearestNeighborsNode | import("./nodes/GetDatasetRowNode.js").GetDatasetRowNode | import("./nodes/SliceNode.js").SliceNode | import("./nodes/ExtractMarkdownCodeBlocksNode.js").ExtractMarkdownCodeBlocksNode | import("./nodes/AssembleMessageNode.js").AssembleMessageNode | import("./nodes/URLReferenceNode.js").UrlReferenceNode | import("./nodes/DestructureNode.js").DestructureNode | import("./nodes/ReplaceDatasetNode.js").ReplaceDatasetNode | import("./nodes/ListGraphsNode.js").ListGraphsNode | import("./nodes/GraphReferenceNode.js").GraphReferenceNode | import("./nodes/CallGraphNode.js").CallGraphNode | import("./nodes/DelegateFunctionCallNode.js").DelegateFunctionCallNode | import("./nodes/PlayAudioNode.js").PlayAudioNode | import("./nodes/DocumentNode.js").DocumentNode | import("./nodes/ChatLoopNode.js").ChatLoopNode | import("./nodes/ReadAllFilesNode.js").ReadAllFilesNode | import("./nodes/ToMarkdownTableNode.js").ToMarkdownTableNode | import("./nodes/CronNode.js").CronNode | import("./nodes/ToTreeNode.js").ToTreeNode | import("./nodes/LoopUntilNode.js").LoopUntilNode | (import("./NodeBase.js").NodeBase & {
|
|
112
112
|
type: "mcpDiscovery";
|
|
113
113
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
114
114
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
@@ -10,6 +10,7 @@ import type { RivetStoredValue, RivetStoredValueCacheResult, RivetStoredValueRea
|
|
|
10
10
|
import type { ToolCallContinuation } from './ToolCallContinuation.js';
|
|
11
11
|
import type { KnowledgeStoreConnectionId, RivetKnowledgeStore } from '../integrations/KnowledgeStore.js';
|
|
12
12
|
import type { ChatV2Provider } from './chat-v2/chatV2ProviderTypes.js';
|
|
13
|
+
import type { RivetLLMProfileHealthOutcome, RivetLLMProfileHealthState, RivetLLMProfileHealthStore } from './chat-v2/llmProfileHealthStore.js';
|
|
13
14
|
export type ChatV2CallId = Opaque<string, 'ChatV2CallId'>;
|
|
14
15
|
export type ChatV2CallOutcome = 'success' | 'provider-failure' | 'aborted';
|
|
15
16
|
/**
|
|
@@ -55,6 +56,12 @@ export type ChatV2CallFinishedEvent = {
|
|
|
55
56
|
attemptIndex: number;
|
|
56
57
|
/** Zero-based profile index when LLM Chat is using a profile fallback chain. */
|
|
57
58
|
profileIndex?: number;
|
|
59
|
+
/** User-facing title captured from the source LLM Profile node. */
|
|
60
|
+
profileName?: string;
|
|
61
|
+
/** Privacy-bounded stable profile health key when circuit breaking is enabled. */
|
|
62
|
+
profileHealthKey?: string;
|
|
63
|
+
/** Circuit state observed when this physical call was admitted. */
|
|
64
|
+
profileHealthState?: 'closed' | 'open' | 'half-open';
|
|
58
65
|
/** Zero-based model round within one auto-continued LLM Chat invocation. */
|
|
59
66
|
roundIndex?: number;
|
|
60
67
|
nodeId: NodeId;
|
|
@@ -74,12 +81,61 @@ export type ChatV2CallFinishedEvent = {
|
|
|
74
81
|
durationMs?: number;
|
|
75
82
|
};
|
|
76
83
|
export type ChatV2CallFinishedObserver = (event: ChatV2CallFinishedEvent) => void;
|
|
84
|
+
/** A completed logical LLM Chat round, as opposed to one physical provider attempt. */
|
|
85
|
+
export type LLMChatOutputSnapshotKind = 'model-round' | 'direct-tool-result';
|
|
86
|
+
/** The user-visible terminal state represented by one completed logical round. */
|
|
87
|
+
export type LLMChatOutputSnapshotOutcome = 'tool-calls' | 'final-answer' | 'provider-failure' | 'unresolved-tool-calls' | 'max-rounds' | 'direct-tool-result';
|
|
88
|
+
/**
|
|
89
|
+
* Observational output page emitted by LLM Chat after a logical model round.
|
|
90
|
+
* It never changes the node's single graph-semantic terminal output.
|
|
91
|
+
*/
|
|
92
|
+
export type LLMChatOutputSnapshotEvent = {
|
|
93
|
+
entryId: string;
|
|
94
|
+
roundIndex: number;
|
|
95
|
+
splitIndex: number;
|
|
96
|
+
kind: LLMChatOutputSnapshotKind;
|
|
97
|
+
outcome: LLMChatOutputSnapshotOutcome;
|
|
98
|
+
nodeId: NodeId;
|
|
99
|
+
processId: ProcessId;
|
|
100
|
+
outputs: Outputs;
|
|
101
|
+
};
|
|
102
|
+
export type LLMChatOutputSnapshotObserver = (event: LLMChatOutputSnapshotEvent) => void | Promise<void>;
|
|
77
103
|
/**
|
|
78
104
|
* Portable, privacy-bounded subset of a completed physical Chat V2 call.
|
|
79
105
|
* Provider-shaped raw usage is intentionally retained only by the host observer
|
|
80
106
|
* and cannot enter processor events, recordings, or remote transport.
|
|
81
107
|
*/
|
|
82
108
|
export type ChatV2CallTraceEvent = Omit<ChatV2CallFinishedEvent, 'rawUsage'>;
|
|
109
|
+
/**
|
|
110
|
+
* Privacy-bounded lifecycle event for one profile decision inside an LLM Chat
|
|
111
|
+
* fallback round. Unlike physical-call events, this also records candidates
|
|
112
|
+
* skipped by an open circuit and health-store fail-open decisions.
|
|
113
|
+
*/
|
|
114
|
+
export type LLMProfileAttemptTraceEvent = {
|
|
115
|
+
eventId: string;
|
|
116
|
+
roundIndex: number;
|
|
117
|
+
/** Present when this attempt belongs to a From profile fallback candidate. */
|
|
118
|
+
profileIndex?: number;
|
|
119
|
+
/** User-facing title captured from the source LLM Profile node. */
|
|
120
|
+
profileName?: string;
|
|
121
|
+
nodeId: NodeId;
|
|
122
|
+
processId: ProcessId;
|
|
123
|
+
provider: ChatV2Provider;
|
|
124
|
+
model: string;
|
|
125
|
+
customProviderApi?: CustomProviderApi;
|
|
126
|
+
stage: 'configuration' | 'request' | 'response-validation' | 'health-gate' | 'health-update';
|
|
127
|
+
outcome: 'success' | 'failure' | 'aborted' | 'skipped';
|
|
128
|
+
attemptIndex?: number;
|
|
129
|
+
status?: number;
|
|
130
|
+
error?: string;
|
|
131
|
+
profileHealthKey?: string;
|
|
132
|
+
healthState?: RivetLLMProfileHealthState;
|
|
133
|
+
healthDisposition?: 'allow' | 'deny' | 'fail-open';
|
|
134
|
+
healthOutcome?: RivetLLMProfileHealthOutcome;
|
|
135
|
+
retryAt?: number;
|
|
136
|
+
timeoutKind?: 'first-output' | 'stream-inactivity';
|
|
137
|
+
};
|
|
138
|
+
export type LLMProfileAttemptObserver = (event: LLMProfileAttemptTraceEvent) => void;
|
|
83
139
|
export type ToolCallFinishedEvent = {
|
|
84
140
|
toolCallId?: string;
|
|
85
141
|
toolName: string;
|
|
@@ -129,6 +185,20 @@ export type ProcessContext = {
|
|
|
129
185
|
* provider attempt. Observer failures are isolated from graph execution.
|
|
130
186
|
*/
|
|
131
187
|
onChatV2CallFinished?: ChatV2CallFinishedObserver;
|
|
188
|
+
/** Host-only observer for completed, display-only LLM Chat output pages. */
|
|
189
|
+
onLLMChatOutputSnapshot?: LLMChatOutputSnapshotObserver;
|
|
190
|
+
/** Host-only observer for profile fallback and circuit-health decisions. */
|
|
191
|
+
onLLMProfileAttempt?: LLMProfileAttemptObserver;
|
|
192
|
+
/** Optional shared persistence for cross-run LLM Profile circuit state. */
|
|
193
|
+
llmProfileHealthStore?: RivetLLMProfileHealthStore;
|
|
194
|
+
/**
|
|
195
|
+
* Host-owned correlation for a runnable execution. It is not a graph input,
|
|
196
|
+
* is never sent to a provider, and lets hosts connect profile suspension
|
|
197
|
+
* evidence to a durable run recording after the run has completed.
|
|
198
|
+
*/
|
|
199
|
+
llmProfileHealthExecutionCorrelationId?: string;
|
|
200
|
+
/** Optional host-owned Evaluation identity propagated into execution events and recordings. */
|
|
201
|
+
evaluation?: EvaluationExecutionMetadata;
|
|
132
202
|
/**
|
|
133
203
|
* If implemented, chat nodes will first call this to resolve their configured endpoint to a final endpoint.
|
|
134
204
|
* You can use this for adding auth headers, or to load balance between multiple endpoints.
|
|
@@ -148,12 +218,25 @@ export type SubgraphExecutorMetadata = {
|
|
|
148
218
|
processId: ProcessId;
|
|
149
219
|
splitIndex?: number;
|
|
150
220
|
};
|
|
221
|
+
/**
|
|
222
|
+
* Optional identity attached to graph runs started by an Evaluation suite.
|
|
223
|
+
* It stays outside graph inputs so a graph never depends on an evaluation
|
|
224
|
+
* workspace being available.
|
|
225
|
+
*/
|
|
226
|
+
export type EvaluationExecutionMetadata = {
|
|
227
|
+
evaluationRunId: string;
|
|
228
|
+
suiteId: string;
|
|
229
|
+
caseId: string;
|
|
230
|
+
trialIndex: number;
|
|
231
|
+
phase: 'target' | 'evaluator';
|
|
232
|
+
};
|
|
151
233
|
export type GraphExecutionMetadata = {
|
|
152
234
|
rootRunId: RootRunId;
|
|
153
235
|
graphRunId: GraphRunId;
|
|
154
236
|
graphId: GraphId;
|
|
155
237
|
parentGraphRunId?: GraphRunId;
|
|
156
238
|
executor?: SubgraphExecutorMetadata;
|
|
239
|
+
evaluation?: EvaluationExecutionMetadata;
|
|
157
240
|
};
|
|
158
241
|
export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessContext & {
|
|
159
242
|
/** The executor that is running the current processor. */
|
|
@@ -166,6 +249,8 @@ export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessCon
|
|
|
166
249
|
signal: AbortSignal;
|
|
167
250
|
/** A unique ID for this specific execution of the node. */
|
|
168
251
|
processId: ProcessId;
|
|
252
|
+
/** Zero-based split item index. GraphProcessor supplies zero for non-split runs. */
|
|
253
|
+
splitIndex?: number;
|
|
169
254
|
/** Output ports with at least one active immediate downstream consumer in this graph run. */
|
|
170
255
|
activeOutputPortIds: ReadonlySet<PortId>;
|
|
171
256
|
/**
|
|
@@ -4,7 +4,7 @@ import type { ChartNode, PortId } from './NodeBase.js';
|
|
|
4
4
|
import type { GraphId } from './NodeGraph.js';
|
|
5
5
|
import type { Project } from './Project.js';
|
|
6
6
|
import type { AttachedNodeData, ExternalFunction, Outputs } from './GraphProcessor.js';
|
|
7
|
-
export type NodeProcessContextBase = Omit<InternalProcessContext, 'attachedData' | 'activeOutputPortIds' | 'createSubProcessor' | 'execution' | 'externalFunctions' | 'getPluginConfig' | 'node' | 'onPartialOutputs' | 'processId' | 'requestUserInput' | 'reportProgress' | 'isDirectRunTarget' | 'markResultAsEditorCacheHit' | 'setGlobal' | 'signal' | 'toolCallContinuation' | 'toolCallTraceSource' | 'waitEvent'>;
|
|
7
|
+
export type NodeProcessContextBase = Omit<InternalProcessContext, 'attachedData' | 'activeOutputPortIds' | 'createSubProcessor' | 'execution' | 'externalFunctions' | 'getPluginConfig' | 'node' | 'onPartialOutputs' | 'processId' | 'requestUserInput' | 'reportProgress' | 'isDirectRunTarget' | 'markResultAsEditorCacheHit' | 'setGlobal' | 'signal' | 'splitIndex' | 'toolCallContinuation' | 'toolCallTraceSource' | 'waitEvent'>;
|
|
8
8
|
export declare function buildNodeProcessContext(options: {
|
|
9
9
|
activeOutputPortIds: ReadonlySet<PortId>;
|
|
10
10
|
base: NodeProcessContextBase;
|
|
@@ -25,6 +25,7 @@ export declare function buildNodeProcessContext(options: {
|
|
|
25
25
|
requestUserInput: (inputStrings: string[], renderingType: 'text' | 'markdown') => Promise<StringArrayDataValue>;
|
|
26
26
|
reportProgress: InternalProcessContext['reportProgress'];
|
|
27
27
|
setGlobal: (id: string, value: ScalarOrArrayDataValue) => void;
|
|
28
|
+
splitIndex: number;
|
|
28
29
|
toolCallContinuation?: InternalProcessContext['toolCallContinuation'];
|
|
29
30
|
toolCallTraceSource?: InternalProcessContext['toolCallTraceSource'];
|
|
30
31
|
waitEvent: (event: string) => Promise<DataValue | undefined>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { UiComponentId } from './UiGraph.js';
|
|
2
2
|
import { type GraphProgress } from './GraphProgress.js';
|
|
3
3
|
import { type AgentResponseTrace } from './AgentResponseTrace.js';
|
|
4
|
+
import { type RivetWebAppBrowserStorageClientMessage, type RivetWebAppBrowserStorageServerMessage, type RivetWebAppBrowserStorageRpcAdvertisedLimits } from './WebAppBrowserStorageRpc.js';
|
|
4
5
|
export declare const RIVET_WEB_APP_ACTION_PROTOCOL_VERSION: 1;
|
|
5
6
|
export type RivetWebAppActionStartMessage = {
|
|
6
7
|
type: 'action.start';
|
|
@@ -9,6 +10,7 @@ export type RivetWebAppActionStartMessage = {
|
|
|
9
10
|
revisionKey?: string;
|
|
10
11
|
state: Record<string, unknown>;
|
|
11
12
|
storage?: Record<string, unknown>;
|
|
13
|
+
storageRpcVersion?: 2;
|
|
12
14
|
};
|
|
13
15
|
export type RivetWebAppActionCancelMessage = {
|
|
14
16
|
type: 'action.cancel';
|
|
@@ -22,8 +24,9 @@ export type RivetWebAppRunResumeMessage = {
|
|
|
22
24
|
export type RivetWebAppClientHelloMessage = {
|
|
23
25
|
type: 'client.hello';
|
|
24
26
|
protocolVersion: typeof RIVET_WEB_APP_ACTION_PROTOCOL_VERSION;
|
|
27
|
+
capabilities?: readonly string[];
|
|
25
28
|
};
|
|
26
|
-
export type RivetWebAppClientMessage = RivetWebAppClientHelloMessage | RivetWebAppActionStartMessage | RivetWebAppActionCancelMessage | RivetWebAppRunResumeMessage;
|
|
29
|
+
export type RivetWebAppClientMessage = RivetWebAppClientHelloMessage | RivetWebAppActionStartMessage | RivetWebAppActionCancelMessage | RivetWebAppRunResumeMessage | RivetWebAppBrowserStorageClientMessage;
|
|
27
30
|
type RunEventBase = {
|
|
28
31
|
requestId: string;
|
|
29
32
|
runId: string;
|
|
@@ -32,6 +35,8 @@ type RunEventBase = {
|
|
|
32
35
|
export type RivetWebAppServerMessage = {
|
|
33
36
|
type: 'server.ready';
|
|
34
37
|
protocolVersion: typeof RIVET_WEB_APP_ACTION_PROTOCOL_VERSION;
|
|
38
|
+
capabilities?: readonly string[];
|
|
39
|
+
browserStorageRpcLimits?: RivetWebAppBrowserStorageRpcAdvertisedLimits;
|
|
35
40
|
} | ({
|
|
36
41
|
type: 'action.accepted';
|
|
37
42
|
} & RunEventBase) | ({
|
|
@@ -46,6 +51,7 @@ export type RivetWebAppServerMessage = {
|
|
|
46
51
|
type: 'action.failed';
|
|
47
52
|
error: string;
|
|
48
53
|
code?: string;
|
|
54
|
+
responseTrace?: AgentResponseTrace;
|
|
49
55
|
} & RunEventBase) | ({
|
|
50
56
|
type: 'action.cancelled';
|
|
51
57
|
} & RunEventBase) | ({
|
|
@@ -63,10 +69,10 @@ export type RivetWebAppServerMessage = {
|
|
|
63
69
|
code?: string;
|
|
64
70
|
} | {
|
|
65
71
|
type: 'server.draining';
|
|
66
|
-
};
|
|
72
|
+
} | RivetWebAppBrowserStorageServerMessage;
|
|
67
73
|
export type RivetWebAppRunEvent = Exclude<RivetWebAppServerMessage, {
|
|
68
74
|
type: 'server.ready' | 'action.rejected' | 'run.rejected' | 'server.draining';
|
|
69
|
-
}>;
|
|
75
|
+
} | RivetWebAppBrowserStorageServerMessage>;
|
|
70
76
|
export declare function parseRivetWebAppClientMessage(value: unknown): RivetWebAppClientMessage | undefined;
|
|
71
77
|
export declare function parseRivetWebAppServerMessage(value: unknown): RivetWebAppServerMessage | undefined;
|
|
72
78
|
export declare function isRivetWebAppRunTerminalEvent(event: RivetWebAppRunEvent): boolean;
|
|
@@ -26,6 +26,7 @@ export declare function getUiGraphChatMessagePresentations(messages: readonly Ui
|
|
|
26
26
|
export declare function getUiGraphChatStorageKey(uiGraph: UiGraph, location?: UiGraphStorageLocation | undefined): string | undefined;
|
|
27
27
|
/** Returns the browser-local key for graph-managed storage owned by one web app. */
|
|
28
28
|
export declare function getUiGraphWebAppStorageKey(uiGraph: UiGraph, location?: UiGraphStorageLocation | undefined): string | undefined;
|
|
29
|
+
export declare function getUiGraphResponseTraceStorageKey(uiGraph: UiGraph, componentId: string, location?: UiGraphStorageLocation | undefined): string | undefined;
|
|
29
30
|
/** Persists a validated trace outside Chat history so it never enters model context. */
|
|
30
31
|
export declare function saveUiGraphResponseTrace(uiGraph: UiGraph, componentId: string, trace: AgentResponseTrace, storage?: UiGraphBrowserStorage | undefined, location?: UiGraphStorageLocation): void;
|
|
31
32
|
/** Loads one validated response trace from the app/UI-graph-scoped store. */
|
|
@@ -42,6 +43,11 @@ export declare function applyUiGraphWebAppStoragePatch(uiGraph: UiGraph, current
|
|
|
42
43
|
* write cannot suppress an older successful action that completes later.
|
|
43
44
|
*/
|
|
44
45
|
export declare function applyUiGraphWebAppStorageActionPatch(patch: Readonly<Record<string, unknown>>, actionNumber: number, appliedActionByKey: Map<string, number>, persist: (applicablePatch: Record<string, unknown>) => void): Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Async equivalent used by IndexedDB-backed clients. Ordering metadata is
|
|
48
|
+
* advanced only after the durable commit succeeds.
|
|
49
|
+
*/
|
|
50
|
+
export declare function applyUiGraphWebAppStorageActionPatchAsync(patch: Readonly<Record<string, unknown>>, actionNumber: number, appliedActionByKey: Map<string, number>, persist: (applicablePatch: Record<string, unknown>) => Promise<void>): Promise<Record<string, unknown>>;
|
|
45
51
|
/** Selects and validates the private browser-persisted state of Chat components only. */
|
|
46
52
|
export declare function getUiGraphChatPersistentState(uiGraph: UiGraph, state: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
47
53
|
/**
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type AgentResponseTrace } from './AgentResponseTrace.js';
|
|
2
|
+
import { type UiGraph } from './UiGraph.js';
|
|
3
|
+
import { type IndexedDbWebAppBrowserStorageOptions, type WebAppBrowserStorageChange, type WebAppBrowserStorageStatus } from './WebAppBrowserStorage.js';
|
|
4
|
+
import { type RivetStoredValue, type RivetStoredValueRecord } from './StoredValueStore.js';
|
|
5
|
+
type BrowserStorageLocation = Pick<Location, 'origin' | 'pathname'>;
|
|
6
|
+
type LegacyStorage = Pick<Storage, 'getItem' | 'removeItem' | 'setItem'>;
|
|
7
|
+
export type UiGraphBrowserPersistenceWarning = Readonly<{
|
|
8
|
+
code: 'indexeddb-unavailable' | 'migration-failed' | 'persistence-failed' | 'quota-exhausted' | 'transport-incompatible';
|
|
9
|
+
message: string;
|
|
10
|
+
}>;
|
|
11
|
+
export type UiGraphBrowserPersistenceDiagnostic = Readonly<{
|
|
12
|
+
operation: 'open' | 'migration' | 'cleanup' | 'write' | 'transport';
|
|
13
|
+
outcome: 'success' | 'failure' | 'fallback';
|
|
14
|
+
}>;
|
|
15
|
+
export type UiGraphBrowserPersistenceOptions = IndexedDbWebAppBrowserStorageOptions & Readonly<{
|
|
16
|
+
legacyStorage?: LegacyStorage;
|
|
17
|
+
location?: BrowserStorageLocation;
|
|
18
|
+
onDiagnostic?(diagnostic: UiGraphBrowserPersistenceDiagnostic): void;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* UI-graph-specific adapter over the generic IndexedDB store. It owns exact
|
|
22
|
+
* legacy-key migration and keeps localStorage out of the new runtime path.
|
|
23
|
+
*/
|
|
24
|
+
export declare class UiGraphBrowserPersistence {
|
|
25
|
+
#private;
|
|
26
|
+
constructor(uiGraph: UiGraph, options?: UiGraphBrowserPersistenceOptions);
|
|
27
|
+
initialize(): Promise<WebAppBrowserStorageStatus>;
|
|
28
|
+
get status(): WebAppBrowserStorageStatus;
|
|
29
|
+
get warning(): UiGraphBrowserPersistenceWarning | undefined;
|
|
30
|
+
subscribe(listener: (change: WebAppBrowserStorageChange) => void): () => void;
|
|
31
|
+
subscribeWarning(listener: (warning: UiGraphBrowserPersistenceWarning | undefined) => void): () => void;
|
|
32
|
+
loadChatState(): Promise<Record<string, unknown>>;
|
|
33
|
+
saveChatState(state: Readonly<Record<string, unknown>>): Promise<void>;
|
|
34
|
+
loadStoredValues(): Promise<RivetStoredValueRecord>;
|
|
35
|
+
loadStoredValue(key: string): Promise<RivetStoredValue | undefined>;
|
|
36
|
+
applyStoredValuePatch(patch: Readonly<Record<string, unknown>>, options?: Readonly<{
|
|
37
|
+
requireDurable?: boolean;
|
|
38
|
+
}>): Promise<void>;
|
|
39
|
+
loadResponseTrace(componentId: string, traceId: string): Promise<AgentResponseTrace | undefined>;
|
|
40
|
+
saveResponseTrace(componentId: string, trace: AgentResponseTrace): Promise<void>;
|
|
41
|
+
pruneResponseTraces(state: Readonly<Record<string, unknown>>): Promise<void>;
|
|
42
|
+
reportTransportIncompatibility(message: string): void;
|
|
43
|
+
clearTransportIncompatibility(): void;
|
|
44
|
+
estimateUsage(): Promise<{
|
|
45
|
+
quota?: number;
|
|
46
|
+
usage?: number;
|
|
47
|
+
}>;
|
|
48
|
+
dispose(): void;
|
|
49
|
+
}
|
|
50
|
+
export {};
|