@valerypopoff/rivet2-core 2.1.4 → 2.1.6
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 +6651 -1022
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/webAppRuntime.cjs +733 -19
- package/dist/cjs/webAppRuntime.cjs.map +3 -3
- package/dist/esm/api/createProcessor.js +6 -1
- package/dist/esm/exports.js +7 -0
- package/dist/esm/integrations/KnowledgeStore.js +1 -0
- package/dist/esm/integrations/KnowledgeStoreProvider.js +292 -0
- package/dist/esm/integrations/KnowledgeStoreValidation.js +428 -0
- package/dist/esm/integrations/ManagedKnowledgeStore.js +539 -0
- package/dist/esm/model/DataValue.js +22 -2
- package/dist/esm/model/GraphBoundaryEffects.js +13 -0
- package/dist/esm/model/GraphProcessor.js +1141 -82
- package/dist/esm/model/ManagedAsyncBranches.js +28 -0
- package/dist/esm/model/Nodes.js +27 -0
- package/dist/esm/model/ProcessContextBuilder.js +2 -1
- package/dist/esm/model/RecordingPlayer.js +9 -0
- package/dist/esm/model/StoredValueStore.js +226 -0
- package/dist/esm/model/SubprocessorBridge.js +50 -19
- package/dist/esm/model/ToolCallContinuation.js +1 -0
- package/dist/esm/model/UiGraph.js +52 -2
- package/dist/esm/model/UiGraphActionProtocol.js +10 -1
- package/dist/esm/model/UiGraphBrowserRuntime.js +444 -0
- package/dist/esm/model/UiGraphNormalization.js +35 -185
- package/dist/esm/model/UiGraphRendererStyles.js +878 -78
- package/dist/esm/model/UiGraphRuntimeModel.js +255 -15
- package/dist/esm/model/UiGraphSchema.js +91 -0
- package/dist/esm/model/UiGraphWebAppStorage.js +1 -0
- package/dist/esm/model/chat/chatMessages.js +5 -9
- package/dist/esm/model/chat/openAIChatRequest.js +8 -2
- package/dist/esm/model/chat-v2/chatV2Errors.js +36 -3
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +8 -8
- package/dist/esm/model/chat-v2/index.js +1 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +3 -1
- package/dist/esm/model/chat-v2/parallelToolCalls.js +38 -0
- package/dist/esm/model/chat-v2/toolContinuation.js +45 -8
- package/dist/esm/model/chat-v2/toolContinuationConnection.js +68 -0
- package/dist/esm/model/nodes/BuildKnowledgeContextNode.js +157 -0
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +12 -40
- package/dist/esm/model/nodes/GetKnowledgeSourceStatusNode.js +79 -0
- package/dist/esm/model/nodes/GetStoredValueNode.js +109 -0
- package/dist/esm/model/nodes/KnowledgeDocumentNode.js +88 -0
- package/dist/esm/model/nodes/KnowledgeSourceNode.js +94 -0
- package/dist/esm/model/nodes/LLMChatV2Node.js +17 -1
- package/dist/esm/model/nodes/MatchNode.js +7 -7
- package/dist/esm/model/nodes/SearchKnowledgeNode.js +127 -0
- package/dist/esm/model/nodes/SetStoredValueNode.js +84 -0
- package/dist/esm/model/nodes/StartBackgroundBranchNode.js +59 -0
- package/dist/esm/model/nodes/StoredValueNodeUtils.js +57 -0
- package/dist/esm/model/nodes/SyncKnowledgeSourceNode.js +149 -0
- package/dist/esm/model/nodes/ToolNode.js +14 -0
- package/dist/esm/model/nodes/toolCallDelegation.js +44 -1
- package/dist/esm/plugins/pinecone/PineconeKnowledgeStore.js +553 -0
- package/dist/esm/plugins/pinecone/plugin.js +32 -0
- package/dist/esm/recording/ExecutionRecorder.js +1 -0
- package/dist/esm/utils/coerceType.js +27 -2
- package/dist/esm/utils/getPluginConfig.js +12 -6
- package/dist/esm/utils/serialization/serialization.js +4 -1
- package/dist/esm/utils/serialization/serializationUtils.js +59 -1
- package/dist/esm/webAppRuntime.js +3 -3
- package/dist/types/api/createProcessor.d.ts +6 -0
- package/dist/types/exports.d.ts +7 -0
- package/dist/types/integrations/KnowledgeStore.d.ts +131 -0
- package/dist/types/integrations/KnowledgeStoreProvider.d.ts +46 -0
- package/dist/types/integrations/KnowledgeStoreValidation.d.ts +16 -0
- package/dist/types/integrations/ManagedKnowledgeStore.d.ts +57 -0
- package/dist/types/model/DataValue.d.ts +10 -3
- package/dist/types/model/EditorDefinition.d.ts +9 -2
- package/dist/types/model/ExecutorProtocol.d.ts +12 -0
- package/dist/types/model/GraphBoundaryEffects.d.ts +9 -1
- package/dist/types/model/GraphProcessor.d.ts +21 -2
- package/dist/types/model/ManagedAsyncBranches.d.ts +6 -0
- package/dist/types/model/Nodes.d.ts +11 -2
- package/dist/types/model/ProcessContext.d.ts +18 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +2 -1
- package/dist/types/model/Project.d.ts +11 -0
- package/dist/types/model/StoredValueStore.d.ts +55 -0
- package/dist/types/model/SubprocessorBridge.d.ts +4 -2
- package/dist/types/model/ToolCallContinuation.d.ts +13 -0
- package/dist/types/model/UiGraph.d.ts +24 -1
- package/dist/types/model/UiGraphActionProtocol.d.ts +2 -0
- package/dist/types/model/UiGraphBrowserRuntime.d.ts +75 -0
- package/dist/types/model/UiGraphRendererStyles.d.ts +2 -2
- package/dist/types/model/UiGraphRuntimeModel.d.ts +22 -3
- package/dist/types/model/UiGraphSchema.d.ts +113 -0
- package/dist/types/model/UiGraphWebAppStorage.d.ts +3 -0
- package/dist/types/model/chat-v2/index.d.ts +1 -0
- package/dist/types/model/chat-v2/parallelToolCalls.d.ts +9 -0
- package/dist/types/model/chat-v2/toolContinuation.d.ts +1 -0
- package/dist/types/model/chat-v2/toolContinuationConnection.d.ts +28 -0
- package/dist/types/model/nodes/BuildKnowledgeContextNode.d.ts +23 -0
- package/dist/types/model/nodes/GetKnowledgeSourceStatusNode.d.ts +19 -0
- package/dist/types/model/nodes/GetStoredValueNode.d.ts +25 -0
- package/dist/types/model/nodes/KnowledgeDocumentNode.d.ts +26 -0
- package/dist/types/model/nodes/KnowledgeSourceNode.d.ts +25 -0
- package/dist/types/model/nodes/SearchKnowledgeNode.d.ts +25 -0
- package/dist/types/model/nodes/SetStoredValueNode.d.ts +23 -0
- package/dist/types/model/nodes/StartBackgroundBranchNode.d.ts +14 -0
- package/dist/types/model/nodes/StoredValueNodeUtils.d.ts +5 -0
- package/dist/types/model/nodes/SyncKnowledgeSourceNode.d.ts +27 -0
- package/dist/types/model/nodes/ToolNode.d.ts +2 -0
- package/dist/types/model/nodes/toolCallDelegation.d.ts +4 -0
- package/dist/types/plugins/pinecone/PineconeKnowledgeStore.d.ts +11 -0
- package/dist/types/recording/RecordedEvents.d.ts +5 -0
- package/dist/types/utils/serialization/serializationUtils.d.ts +4 -0
- package/dist/types/webAppRuntime.d.ts +5 -4
- package/package.json +1 -1
|
@@ -10,9 +10,13 @@ import type { NodeRegistration } from './NodeRegistration.js';
|
|
|
10
10
|
import { type GraphExecutionPlan } from './GraphPreprocessor.js';
|
|
11
11
|
import { type GraphBoundaryCache } from './GraphBoundaryCache.js';
|
|
12
12
|
import { type GraphProgress } from './GraphProgress.js';
|
|
13
|
+
import { type RivetStoredValueStore } from './StoredValueStore.js';
|
|
14
|
+
import type { RivetKnowledgeStoreRegistry } from '../integrations/KnowledgeStore.js';
|
|
13
15
|
type WithExecution<T extends object> = T & {
|
|
14
16
|
execution: GraphExecutionMetadata;
|
|
15
17
|
};
|
|
18
|
+
declare const graphProcessorGraphOverride: unique symbol;
|
|
19
|
+
declare const consumedAsyncBranchTriggerOverride: unique symbol;
|
|
16
20
|
export type ProcessEvents = {
|
|
17
21
|
/** Called when processing has started. */
|
|
18
22
|
start: WithExecution<{
|
|
@@ -36,6 +40,11 @@ export type ProcessEvents = {
|
|
|
36
40
|
graph: NodeGraph;
|
|
37
41
|
outputs: GraphOutputs;
|
|
38
42
|
}>;
|
|
43
|
+
/** Called when root graph outputs are ready while managed async branches are still settling. */
|
|
44
|
+
graphOutputsReady: WithExecution<{
|
|
45
|
+
graph: NodeGraph;
|
|
46
|
+
outputs: GraphOutputs;
|
|
47
|
+
}>;
|
|
39
48
|
/** Called when a graph has been aborted. */
|
|
40
49
|
graphAbort: WithExecution<{
|
|
41
50
|
successful: boolean;
|
|
@@ -174,7 +183,7 @@ export type GraphProcessorRuntimeCache = {
|
|
|
174
183
|
};
|
|
175
184
|
export type GraphProcessorExecutionPlanCacheMode = 'all' | 'subprocessors';
|
|
176
185
|
export type GraphProcessorScheduler = 'compatible' | 'fast-acyclic';
|
|
177
|
-
export type GraphProcessorRuntimeProfileBucket = 'initializeGraphRun' | 'loadProjectReferences' | 'prepareNodeProcessContextBase' | 'preprocessGraph' | 'emitGraphStart' | 'emitPreloadedNodeResults' | 'waitUntilUnpaused' | 'processFastAcyclicGraph' | 'processCompatibleGraph' | 'throwIfGraphErrored' | 'finalizeGraphRun' | 'emitFinish' | 'fetchNodeDataAndProcessNode' | 'getInputNodesTo' | 'getInputValuesForNode' | 'nodeDispatch' | 'nodeImplementation' | 'createNodeProcessContext' | 'getOutputNodesFrom' | 'queueOutputNodes' | 'createSubProcessor' | 'wireSubProcessorEvents' | 'wireSubProcessorLifecycle';
|
|
186
|
+
export type GraphProcessorRuntimeProfileBucket = 'initializeGraphRun' | 'loadProjectReferences' | 'prepareNodeProcessContextBase' | 'preprocessGraph' | 'emitGraphStart' | 'emitPreloadedNodeResults' | 'waitUntilUnpaused' | 'processFastAcyclicGraph' | 'processCompatibleGraph' | 'drainManagedAsyncBranches' | 'throwIfGraphErrored' | 'finalizeGraphRun' | 'emitFinish' | 'fetchNodeDataAndProcessNode' | 'getInputNodesTo' | 'getInputValuesForNode' | 'nodeDispatch' | 'nodeImplementation' | 'createNodeProcessContext' | 'getOutputNodesFrom' | 'queueOutputNodes' | 'createSubProcessor' | 'wireSubProcessorEvents' | 'wireSubProcessorLifecycle';
|
|
178
187
|
export type GraphProcessorRuntimeProfiler = {
|
|
179
188
|
addDuration: (bucket: GraphProcessorRuntimeProfileBucket, durationMs: number) => void;
|
|
180
189
|
};
|
|
@@ -212,6 +221,8 @@ export declare class GraphProcessor {
|
|
|
212
221
|
recordingPlaybackChatLatency: number;
|
|
213
222
|
warnOnInvalidGraph: boolean;
|
|
214
223
|
get isRunning(): boolean;
|
|
224
|
+
/** Waits for the current run's full lifecycle, including managed async branches. */
|
|
225
|
+
waitForRunCompletion(): Promise<GraphOutputs>;
|
|
215
226
|
constructor(project: Project, graphId: GraphId | undefined, registry: NodeRegistration<any, any>, includeTrace?: boolean, options?: {
|
|
216
227
|
cacheLoadedProjects?: boolean;
|
|
217
228
|
captureNodeTimings?: boolean;
|
|
@@ -221,6 +232,8 @@ export declare class GraphProcessor {
|
|
|
221
232
|
runtimeCache?: GraphProcessorRuntimeCache;
|
|
222
233
|
runtimeProfiler?: GraphProcessorRuntimeProfiler;
|
|
223
234
|
scheduler?: GraphProcessorScheduler;
|
|
235
|
+
[graphProcessorGraphOverride]?: NodeGraph;
|
|
236
|
+
[consumedAsyncBranchTriggerOverride]?: NodeId;
|
|
224
237
|
});
|
|
225
238
|
on: Emittery<ProcessEvents>["on"];
|
|
226
239
|
off: Emittery<ProcessEvents>["off"];
|
|
@@ -231,6 +244,8 @@ export declare class GraphProcessor {
|
|
|
231
244
|
offUserEvent(listener: (data: DataValue | undefined) => void): void;
|
|
232
245
|
userInput(nodeId: NodeId, values: StringArrayDataValue): void;
|
|
233
246
|
setExternalFunction(name: string, fn: ExternalFunction): void;
|
|
247
|
+
setStoredValueStore(store: RivetStoredValueStore | undefined): void;
|
|
248
|
+
setKnowledgeStores(stores: RivetKnowledgeStoreRegistry | undefined): void;
|
|
234
249
|
abort(successful?: boolean, error?: Error | string): Promise<void>;
|
|
235
250
|
pause(): void;
|
|
236
251
|
resume(): void;
|
|
@@ -248,7 +263,11 @@ export declare class GraphProcessor {
|
|
|
248
263
|
/** Inputs to the main graph. You should pass all inputs required by the GraphInputNodes of the graph. */
|
|
249
264
|
inputs?: Record<string, DataValue>,
|
|
250
265
|
/** Contextual data available to all graphs and subgraphs. Kind of like react context, avoids drilling down data into subgraphs. Be careful when using it. */
|
|
251
|
-
contextValues?: Record<string, DataValue
|
|
266
|
+
contextValues?: Record<string, DataValue>,
|
|
267
|
+
/** Allows callers such as web apps to receive root outputs while managed async branches continue settling. */
|
|
268
|
+
options?: {
|
|
269
|
+
returnWhenGraphOutputsReady?: boolean;
|
|
270
|
+
}): Promise<GraphOutputs>;
|
|
252
271
|
getRootProcessor(): GraphProcessor;
|
|
253
272
|
/** Raise a user event on the processor, all subprocessors, and their children. */
|
|
254
273
|
raiseEvent(event: string, data: DataValue): void;
|
|
@@ -32,15 +32,24 @@ export * from './nodes/ContextNode.js';
|
|
|
32
32
|
export * from './nodes/CoalesceNode.js';
|
|
33
33
|
export * from './nodes/DidRunNode.js';
|
|
34
34
|
export * from './nodes/PassthroughNode.js';
|
|
35
|
+
export * from './nodes/StartBackgroundBranchNode.js';
|
|
35
36
|
export * from './nodes/PopNode.js';
|
|
36
37
|
export * from './nodes/SetGlobalNode.js';
|
|
37
38
|
export * from './nodes/GetGlobalNode.js';
|
|
39
|
+
export * from './nodes/SetStoredValueNode.js';
|
|
40
|
+
export * from './nodes/GetStoredValueNode.js';
|
|
38
41
|
export * from './nodes/WaitForEventNode.js';
|
|
39
42
|
export * from './nodes/ToolNode.js';
|
|
40
43
|
export * from './nodes/ToYamlNode.js';
|
|
41
44
|
export * from './nodes/GetEmbeddingNode.js';
|
|
42
45
|
export * from './nodes/VectorStoreNode.js';
|
|
43
46
|
export * from './nodes/VectorNearestNeighborsNode.js';
|
|
47
|
+
export * from './nodes/KnowledgeSourceNode.js';
|
|
48
|
+
export * from './nodes/KnowledgeDocumentNode.js';
|
|
49
|
+
export * from './nodes/SyncKnowledgeSourceNode.js';
|
|
50
|
+
export * from './nodes/GetKnowledgeSourceStatusNode.js';
|
|
51
|
+
export * from './nodes/SearchKnowledgeNode.js';
|
|
52
|
+
export * from './nodes/BuildKnowledgeContextNode.js';
|
|
44
53
|
export * from './nodes/HashNode.js';
|
|
45
54
|
export * from './nodes/AbortGraphNode.js';
|
|
46
55
|
export * from './nodes/RaceInputsNode.js';
|
|
@@ -91,12 +100,12 @@ export * from './nodes/MCPToolCallNode.js';
|
|
|
91
100
|
export * from './nodes/MCPGetPromptNode.js';
|
|
92
101
|
export * from './nodes/ReferencedGraphAliasNode.js';
|
|
93
102
|
export * from './nodes/NodePrefabInstanceNode.js';
|
|
94
|
-
export declare const registerBuiltInNodes: (registry: NodeRegistration) => NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "
|
|
103
|
+
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" | "codeNew" | "comment" | "subGraph" | "graphInput" | "graphOutput" | "setGlobal" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "setStoredValue" | "abortGraph" | "userInput" | "prompt" | "llmChatV2" | "extractRegex" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "coalesce" | "didRun" | "passthrough" | "startBackgroundBranch" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "knowledgeSource" | "knowledgeDocument" | "syncKnowledgeSource" | "getKnowledgeSourceStatus" | "searchKnowledge" | "buildKnowledgeContext" | "hash" | "raceInputs" | "toJson" | "jsFilter" | "jsMap" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "delegateFunctionCall" | "playAudio" | "chatLoop" | "readAllFiles" | "toMarkdownTable" | "cron" | "toTree" | "loopUntil" | "mcpDiscovery" | "mcpToolCall" | "mcpGetPrompt" | "referencedGraphAlias" | "nodePrefabInstance", import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./chat-v2/llmChatV2NodeData.js").LLMChatV2Node | 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/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 & {
|
|
95
104
|
type: "mcpDiscovery";
|
|
96
105
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
97
106
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
98
107
|
}) | import("./nodes/MCPToolCallNode.js").MCPToolCallNode | import("./nodes/MCPGetPromptNode.js").MCPGetPromptNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode | import("./NodePrefabResolver.js").NodePrefabInstanceNode>;
|
|
99
|
-
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "
|
|
108
|
+
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "codeNew" | "comment" | "subGraph" | "graphInput" | "graphOutput" | "setGlobal" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "setStoredValue" | "abortGraph" | "userInput" | "prompt" | "llmChatV2" | "extractRegex" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "coalesce" | "didRun" | "passthrough" | "startBackgroundBranch" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "knowledgeSource" | "knowledgeDocument" | "syncKnowledgeSource" | "getKnowledgeSourceStatus" | "searchKnowledge" | "buildKnowledgeContext" | "hash" | "raceInputs" | "toJson" | "jsFilter" | "jsMap" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "delegateFunctionCall" | "playAudio" | "chatLoop" | "readAllFiles" | "toMarkdownTable" | "cron" | "toTree" | "loopUntil" | "mcpDiscovery" | "mcpToolCall" | "mcpGetPrompt" | "referencedGraphAlias" | "nodePrefabInstance", import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./chat-v2/llmChatV2NodeData.js").LLMChatV2Node | 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/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 & {
|
|
100
109
|
type: "mcpDiscovery";
|
|
101
110
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
102
111
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
@@ -5,6 +5,9 @@ import type { CodeRunner } from '../integrations/CodeRunner.js';
|
|
|
5
5
|
import type { ProjectReferenceLoader } from './ProjectReferenceLoader.js';
|
|
6
6
|
import type { GraphBoundary } from './GraphBoundaryCache.js';
|
|
7
7
|
import type { GraphProgress } from './GraphProgress.js';
|
|
8
|
+
import type { RivetStoredValue, RivetStoredValueCacheResult, RivetStoredValueReadResult, RivetStoredValueSetResult } from './StoredValueStore.js';
|
|
9
|
+
import type { ToolCallContinuation } from './ToolCallContinuation.js';
|
|
10
|
+
import type { KnowledgeStoreConnectionId, RivetKnowledgeStore } from '../integrations/KnowledgeStore.js';
|
|
8
11
|
export type ProcessContext = {
|
|
9
12
|
settings: RuntimeSettings;
|
|
10
13
|
nativeApi?: NativeApi;
|
|
@@ -66,6 +69,11 @@ export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessCon
|
|
|
66
69
|
processId: ProcessId;
|
|
67
70
|
/** Output ports with at least one active immediate downstream consumer in this graph run. */
|
|
68
71
|
activeOutputPortIds: ReadonlySet<PortId>;
|
|
72
|
+
/**
|
|
73
|
+
* Executes the uniquely connected Delegate Tool Call node for one LLM tool round.
|
|
74
|
+
* Present only for an auto-continuing LLM Chat node with one eligible continuation connection.
|
|
75
|
+
*/
|
|
76
|
+
toolCallContinuation?: ToolCallContinuation;
|
|
69
77
|
/** True when this exact node is the direct terminal selected by run-to execution. */
|
|
70
78
|
isDirectRunTarget: boolean;
|
|
71
79
|
/** Stable execution lineage for the current graph invocation. */
|
|
@@ -107,6 +115,16 @@ export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessCon
|
|
|
107
115
|
/** Like context, but variables that are set during the run of the graph and can be read during the graph. Shared among all graphs and subgraphs. */
|
|
108
116
|
setGlobal: (id: string, value: ScalarOrArrayDataValue) => void;
|
|
109
117
|
waitForGlobal: (id: string) => Promise<ScalarOrArrayDataValue>;
|
|
118
|
+
/** Reads through the root run's stored-value cache and optional persistence store. */
|
|
119
|
+
getStoredValue: (key: string) => Promise<RivetStoredValueReadResult>;
|
|
120
|
+
/** Returns only the current root run's synchronous stored-value cache state. */
|
|
121
|
+
getCachedStoredValue: (key: string) => RivetStoredValueCacheResult;
|
|
122
|
+
/** Writes through the root run's cache and optional persistence store. */
|
|
123
|
+
setStoredValue: (key: string, value: RivetStoredValue) => Promise<RivetStoredValueSetResult>;
|
|
124
|
+
/** Waits only for a successful Set Stored Value in this root run. */
|
|
125
|
+
waitForStoredValue: (key: string, signal?: AbortSignal) => Promise<RivetStoredValue>;
|
|
126
|
+
/** Resolves a named project or host-provided knowledge store for this execution. */
|
|
127
|
+
getKnowledgeStore: (connectionId: KnowledgeStoreConnectionId) => Promise<RivetKnowledgeStore>;
|
|
110
128
|
/** Logs to GraphProcessor's trace event. */
|
|
111
129
|
trace: (message: string) => void;
|
|
112
130
|
/** Aborts the current graph, if there is an error, the graph is error aborted, and if undefined, then it is simply early-exited. */
|
|
@@ -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' | 'setGlobal' | 'signal' | 'waitEvent'>;
|
|
7
|
+
export type NodeProcessContextBase = Omit<InternalProcessContext, 'attachedData' | 'activeOutputPortIds' | 'createSubProcessor' | 'execution' | 'externalFunctions' | 'getPluginConfig' | 'node' | 'onPartialOutputs' | 'processId' | 'requestUserInput' | 'reportProgress' | 'isDirectRunTarget' | 'setGlobal' | 'signal' | 'toolCallContinuation' | 'waitEvent'>;
|
|
8
8
|
export declare function buildNodeProcessContext(options: {
|
|
9
9
|
activeOutputPortIds: ReadonlySet<PortId>;
|
|
10
10
|
base: NodeProcessContextBase;
|
|
@@ -24,5 +24,6 @@ export declare function buildNodeProcessContext(options: {
|
|
|
24
24
|
requestUserInput: (inputStrings: string[], renderingType: 'text' | 'markdown') => Promise<StringArrayDataValue>;
|
|
25
25
|
reportProgress: InternalProcessContext['reportProgress'];
|
|
26
26
|
setGlobal: (id: string, value: ScalarOrArrayDataValue) => void;
|
|
27
|
+
toolCallContinuation?: InternalProcessContext['toolCallContinuation'];
|
|
27
28
|
waitEvent: (event: string) => Promise<DataValue | undefined>;
|
|
28
29
|
}): InternalProcessContext;
|
|
@@ -4,6 +4,7 @@ import { type GraphId, type NodeGraph } from './NodeGraph.js';
|
|
|
4
4
|
import { type PluginLoadSpec } from './PluginLoadSpec.js';
|
|
5
5
|
import type { MCP } from '../integrations/mcp/MCPProvider.js';
|
|
6
6
|
import type { UiGraph, UiGraphId } from './UiGraph.js';
|
|
7
|
+
import type { KnowledgeMetadata, KnowledgeStoreConnectionId } from '../integrations/KnowledgeStore.js';
|
|
7
8
|
export type ProjectId = Opaque<string, 'ProjectId'>;
|
|
8
9
|
export type DataId = Opaque<string, 'DataId'>;
|
|
9
10
|
export type NodePrefabId = Opaque<string, 'NodePrefabId'>;
|
|
@@ -28,6 +29,16 @@ export type ProjectMetadata = {
|
|
|
28
29
|
mainGraphId?: GraphId;
|
|
29
30
|
path?: string;
|
|
30
31
|
mcpServer?: MCP.Config;
|
|
32
|
+
/** Named, non-secret knowledge-store connections available to graphs in this project. */
|
|
33
|
+
knowledgeStores?: Record<KnowledgeStoreConnectionId, KnowledgeStoreConnectionDefinition>;
|
|
34
|
+
};
|
|
35
|
+
export type KnowledgeStoreConnectionDefinition = {
|
|
36
|
+
displayName: string;
|
|
37
|
+
provider: string;
|
|
38
|
+
/** Plugin that registers the provider. Falls back to provider for older project files. */
|
|
39
|
+
pluginId?: string;
|
|
40
|
+
/** Provider-specific, portable, non-secret configuration. */
|
|
41
|
+
config: KnowledgeMetadata;
|
|
31
42
|
};
|
|
32
43
|
/** A reference to another project file. Project references cannot be cyclic. */
|
|
33
44
|
export type ProjectReference = {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type RivetStoredValue = null | boolean | number | string | RivetStoredValue[] | {
|
|
2
|
+
[key: string]: RivetStoredValue;
|
|
3
|
+
};
|
|
4
|
+
export interface RivetStoredValueStore {
|
|
5
|
+
get(key: string): RivetStoredValue | undefined | Promise<RivetStoredValue | undefined>;
|
|
6
|
+
set(key: string, value: RivetStoredValue): void | Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export type RivetStoredValueRecord = Record<string, RivetStoredValue>;
|
|
9
|
+
export type RivetStoredValueReadResult = {
|
|
10
|
+
found: false;
|
|
11
|
+
value?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
found: true;
|
|
14
|
+
value: RivetStoredValue;
|
|
15
|
+
};
|
|
16
|
+
export type RivetStoredValueSetResult = {
|
|
17
|
+
hadPreviousValue: boolean;
|
|
18
|
+
previousValue: RivetStoredValue | undefined;
|
|
19
|
+
savedValue: RivetStoredValue;
|
|
20
|
+
};
|
|
21
|
+
export type RivetStoredValueCacheResult = {
|
|
22
|
+
loaded: false;
|
|
23
|
+
found: false;
|
|
24
|
+
value?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
loaded: true;
|
|
27
|
+
found: false;
|
|
28
|
+
value?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
loaded: true;
|
|
31
|
+
found: true;
|
|
32
|
+
value: RivetStoredValue;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Run-scoped read-through/write-through cache used by Stored Value nodes.
|
|
36
|
+
* A GraphProcessor creates one controller per root run and shares it with every subprocessor.
|
|
37
|
+
*/
|
|
38
|
+
export declare class RivetStoredValueController {
|
|
39
|
+
#private;
|
|
40
|
+
readonly store?: RivetStoredValueStore | undefined;
|
|
41
|
+
constructor(store?: RivetStoredValueStore | undefined);
|
|
42
|
+
get(key: string): Promise<RivetStoredValueReadResult>;
|
|
43
|
+
getCached(key: string): RivetStoredValueCacheResult;
|
|
44
|
+
set(key: string, value: RivetStoredValue): Promise<RivetStoredValueSetResult>;
|
|
45
|
+
/** Seeds the run cache without writing to the backing store, used for frozen Set-node replay. */
|
|
46
|
+
seed(key: string, value: RivetStoredValue): Promise<void>;
|
|
47
|
+
waitForSet(key: string, signal?: AbortSignal): Promise<RivetStoredValue>;
|
|
48
|
+
}
|
|
49
|
+
export declare function createRivetStoredValueSnapshotStore(initialValues?: Readonly<Record<string, unknown>>): {
|
|
50
|
+
getPatch(): RivetStoredValueRecord;
|
|
51
|
+
store: RivetStoredValueStore;
|
|
52
|
+
};
|
|
53
|
+
export declare function normalizeRivetStoredValueKey(value: unknown): string;
|
|
54
|
+
export declare function cloneRivetStoredValue(value: unknown, label?: string): RivetStoredValue;
|
|
55
|
+
export declare function cloneRivetStoredValueRecord(value: Readonly<Record<string, unknown>>, label?: string): RivetStoredValueRecord;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type Emittery from 'emittery';
|
|
2
2
|
import type { GraphProcessor, ProcessEvents } from './GraphProcessor.js';
|
|
3
3
|
export declare function wireSubprocessorEvents(processor: GraphProcessor, parentEmitter: Emittery<ProcessEvents>, parentState: {
|
|
4
|
+
autoCleanup?: boolean;
|
|
4
5
|
isPaused: () => boolean;
|
|
5
6
|
pause: () => void;
|
|
6
7
|
resume: () => void;
|
|
7
|
-
}): void;
|
|
8
|
+
}): () => void;
|
|
8
9
|
export declare function wireSubprocessorLifecycle(processor: GraphProcessor, options: {
|
|
10
|
+
autoCleanup?: boolean;
|
|
9
11
|
signal?: AbortSignal;
|
|
10
12
|
parentAbortSignal: AbortSignal;
|
|
11
13
|
onParentPause: (listener: () => void) => () => void;
|
|
12
14
|
onParentResume: (listener: () => void) => () => void;
|
|
13
|
-
}): void;
|
|
15
|
+
}): () => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChatMessage } from './DataValue.js';
|
|
2
|
+
import type { StreamedFunctionCall } from './chat/streamChatResponse.js';
|
|
3
|
+
import type { DelegatedToolCallRecord } from './nodes/toolCallDelegation.js';
|
|
4
|
+
export type ToolCallContinuationResult = {
|
|
5
|
+
message: ChatMessage;
|
|
6
|
+
record: DelegatedToolCallRecord;
|
|
7
|
+
};
|
|
8
|
+
export type ToolCallContinuationRunner = (toolCalls: StreamedFunctionCall[], preToolMessage: string) => Promise<ToolCallContinuationResult[]>;
|
|
9
|
+
export type ToolCallContinuation = {
|
|
10
|
+
run: ToolCallContinuationRunner;
|
|
11
|
+
/** Restores ordinary downstream delegation when continuation stops on unresolved raw calls. */
|
|
12
|
+
release: () => void;
|
|
13
|
+
};
|
|
@@ -8,6 +8,10 @@ export declare const UI_GRAPH_GAP_SIZES: readonly ["small", "medium", "large"];
|
|
|
8
8
|
export type UiGraphGapSize = (typeof UI_GRAPH_GAP_SIZES)[number];
|
|
9
9
|
export declare const UI_GRAPH_OUTPUT_RENDER_MODES: readonly ["text", "json", "markdown", "image"];
|
|
10
10
|
export type UiGraphOutputRenderMode = (typeof UI_GRAPH_OUTPUT_RENDER_MODES)[number];
|
|
11
|
+
export type UiGraphDropdownItem = {
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
};
|
|
11
15
|
export type UiGraphValueBinding = {
|
|
12
16
|
type: 'state';
|
|
13
17
|
key: string;
|
|
@@ -35,6 +39,14 @@ export type UiGraphChatRunGraphAction = {
|
|
|
35
39
|
export type UiGraphChatMessage = {
|
|
36
40
|
role: 'assistant' | 'user';
|
|
37
41
|
content: string;
|
|
42
|
+
/** UTC ISO-8601 timestamp captured by the browser when the message is shown. */
|
|
43
|
+
timestamp?: string;
|
|
44
|
+
};
|
|
45
|
+
export type UiGraphChatPin = {
|
|
46
|
+
messageIndex: number;
|
|
47
|
+
promptMessageIndex?: number;
|
|
48
|
+
prompt?: UiGraphChatMessage;
|
|
49
|
+
response: UiGraphChatMessage;
|
|
38
50
|
};
|
|
39
51
|
export type UiGraphInputBinding = {
|
|
40
52
|
inputKey: string;
|
|
@@ -71,6 +83,12 @@ export type UiGraphComponent = {
|
|
|
71
83
|
stateKey: string;
|
|
72
84
|
placeholder?: string;
|
|
73
85
|
defaultValue?: string;
|
|
86
|
+
} | {
|
|
87
|
+
id: UiComponentId;
|
|
88
|
+
type: 'dropdown';
|
|
89
|
+
label: string;
|
|
90
|
+
stateKey: string;
|
|
91
|
+
items: UiGraphDropdownItem[];
|
|
74
92
|
} | {
|
|
75
93
|
id: UiComponentId;
|
|
76
94
|
type: 'button';
|
|
@@ -111,8 +129,13 @@ export declare function getUiGraphInitialState(uiGraph: UiGraph): Record<string,
|
|
|
111
129
|
export declare function getUiGraphActionComponent(uiGraph: UiGraph, componentId: UiComponentId): UiGraphActionComponent | undefined;
|
|
112
130
|
export declare function getUiGraphChatDraftStateKey(componentId: UiComponentId): string;
|
|
113
131
|
export declare function getUiGraphChatMessagesStateKey(componentId: UiComponentId): string;
|
|
132
|
+
export declare function getUiGraphChatPinsStateKey(componentId: UiComponentId): string;
|
|
114
133
|
export declare function getUiGraphChatMessages(componentId: UiComponentId, state: Readonly<Record<string, unknown>>): UiGraphChatMessage[];
|
|
115
|
-
export declare function
|
|
134
|
+
export declare function getUiGraphChatPins(componentId: UiComponentId, state: Readonly<Record<string, unknown>>): UiGraphChatPin[];
|
|
135
|
+
export declare function createUiGraphChatPinStatePatch(componentId: UiComponentId, state: Readonly<Record<string, unknown>>, messageIndex: number): Record<string, unknown> | undefined;
|
|
136
|
+
/** Clears a Chat's conversation and pins without discarding an unsent draft. */
|
|
137
|
+
export declare function createUiGraphChatHistoryFlushStatePatch(componentId: UiComponentId): Record<string, unknown>;
|
|
138
|
+
export declare function createUiGraphChatSubmissionStatePatch(componentId: UiComponentId, state: Readonly<Record<string, unknown>>, timestamp?: string): Record<string, unknown> | undefined;
|
|
116
139
|
export declare function getUiGraphComponentActionState(component: UiGraphActionComponent, state: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
117
140
|
export declare function resolveUiGraphComponentActionInputs(component: UiGraphActionComponent, state: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
118
141
|
export declare function resolveUiGraphComponentActionOutputStatePatch(component: UiGraphActionComponent, outputs: UiGraphOutputs, state: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
@@ -7,6 +7,7 @@ export type RivetWebAppActionStartMessage = {
|
|
|
7
7
|
componentId: UiComponentId;
|
|
8
8
|
revisionKey?: string;
|
|
9
9
|
state: Record<string, unknown>;
|
|
10
|
+
storage?: Record<string, unknown>;
|
|
10
11
|
};
|
|
11
12
|
export type RivetWebAppActionCancelMessage = {
|
|
12
13
|
type: 'action.cancel';
|
|
@@ -38,6 +39,7 @@ export type RivetWebAppServerMessage = {
|
|
|
38
39
|
} & RunEventBase) | ({
|
|
39
40
|
type: 'action.completed';
|
|
40
41
|
statePatch: Record<string, unknown>;
|
|
42
|
+
storagePatch?: Record<string, unknown>;
|
|
41
43
|
} & RunEventBase) | ({
|
|
42
44
|
type: 'action.failed';
|
|
43
45
|
error: string;
|
|
@@ -1,4 +1,79 @@
|
|
|
1
|
+
import { type UiGraph, type UiGraphChatMessage } from './UiGraph.js';
|
|
2
|
+
export type UiGraphChatMessageTimestampPresentation = Readonly<{
|
|
3
|
+
dateTime: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}>;
|
|
6
|
+
export type UiGraphChatMessagePresentation = Readonly<{
|
|
7
|
+
dateSeparator?: UiGraphChatMessageTimestampPresentation;
|
|
8
|
+
timestamp?: UiGraphChatMessageTimestampPresentation;
|
|
9
|
+
}>;
|
|
10
|
+
export type UiGraphChatMessagePresentationOptions = Readonly<{
|
|
11
|
+
locales?: Intl.LocalesArgument;
|
|
12
|
+
timeZone?: string;
|
|
13
|
+
}>;
|
|
14
|
+
type UiGraphBrowserStorage = Pick<Storage, 'getItem' | 'removeItem' | 'setItem'>;
|
|
15
|
+
type UiGraphStorageLocation = Pick<Location, 'origin' | 'pathname'>;
|
|
16
|
+
/**
|
|
17
|
+
* Formats persisted Chat timestamps in the current browser locale and timezone.
|
|
18
|
+
* Undated or malformed legacy messages deliberately remain present without time
|
|
19
|
+
* metadata rather than being assigned a fabricated date.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getUiGraphChatMessagePresentations(messages: readonly UiGraphChatMessage[], options?: UiGraphChatMessagePresentationOptions): UiGraphChatMessagePresentation[];
|
|
22
|
+
/** Returns the browser-local key for one app URL and one persisted UI graph. */
|
|
23
|
+
export declare function getUiGraphChatStorageKey(uiGraph: UiGraph, location?: UiGraphStorageLocation | undefined): string | undefined;
|
|
24
|
+
/** Returns the browser-local key for graph-managed storage owned by one web app. */
|
|
25
|
+
export declare function getUiGraphWebAppStorageKey(uiGraph: UiGraph, location?: UiGraphStorageLocation | undefined): string | undefined;
|
|
26
|
+
/** Loads the browser snapshot used by Stored Value nodes for this one web app. */
|
|
27
|
+
export declare function loadUiGraphWebAppStorage(uiGraph: UiGraph, storage?: UiGraphBrowserStorage | undefined, location?: UiGraphStorageLocation): Record<string, unknown>;
|
|
28
|
+
/** Merges a successful action's changed keys and persists the complete app-local record. */
|
|
29
|
+
export declare function applyUiGraphWebAppStoragePatch(uiGraph: UiGraph, currentStorage: Readonly<Record<string, unknown>>, patch: Readonly<Record<string, unknown>>, storage?: UiGraphBrowserStorage | undefined, location?: UiGraphStorageLocation): Record<string, unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* Applies the keys from one completed action that have not already been superseded.
|
|
32
|
+
* Ordering metadata is committed only after persistence succeeds, so a failed newer
|
|
33
|
+
* write cannot suppress an older successful action that completes later.
|
|
34
|
+
*/
|
|
35
|
+
export declare function applyUiGraphWebAppStorageActionPatch(patch: Readonly<Record<string, unknown>>, actionNumber: number, appliedActionByKey: Map<string, number>, persist: (applicablePatch: Record<string, unknown>) => void): Record<string, unknown>;
|
|
36
|
+
/** Selects and validates the private browser-persisted state of Chat components only. */
|
|
37
|
+
export declare function getUiGraphChatPersistentState(uiGraph: UiGraph, state: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Reports whether a state transition changed the browser-persisted portion of
|
|
40
|
+
* any Chat. Runtime state updates are immutable, so reference comparison keeps
|
|
41
|
+
* action progress and unrelated form edits from serializing a large history.
|
|
42
|
+
*/
|
|
43
|
+
export declare function hasUiGraphChatPersistentStateChanged(uiGraph: UiGraph, previousState: Readonly<Record<string, unknown>>, nextState: Readonly<Record<string, unknown>>): boolean;
|
|
44
|
+
/** Loads valid Chat-only state without allowing malformed local storage to affect rendering. */
|
|
45
|
+
export declare function loadUiGraphChatPersistentState(uiGraph: UiGraph, storage?: UiGraphBrowserStorage | undefined, location?: UiGraphStorageLocation): Record<string, unknown>;
|
|
46
|
+
/** Persists only Chat draft, conversation, and pins for the current browser app URL. */
|
|
47
|
+
export declare function saveUiGraphChatPersistentState(uiGraph: UiGraph, state: Readonly<Record<string, unknown>>, storage?: UiGraphBrowserStorage | undefined, location?: UiGraphStorageLocation): void;
|
|
48
|
+
/**
|
|
49
|
+
* Limits an expanded Output card's native resize range to one visible content
|
|
50
|
+
* line through its rendered value. Short, naturally-sized outputs have no resize
|
|
51
|
+
* handle because resizing them would only add blank space.
|
|
52
|
+
*/
|
|
53
|
+
export declare function observeUiGraphOutputResizeBounds(output: HTMLElement): () => void;
|
|
1
54
|
/** Copies rendered web-app output without requiring the modern Clipboard API. */
|
|
2
55
|
export declare function copyUiGraphText(value: string): Promise<boolean>;
|
|
3
56
|
/** Downloads the exact JSON string rendered by a web-app output component. */
|
|
4
57
|
export declare function downloadUiGraphJsonOutput(value: string, appName: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* Adds Rivet-owned Copy and Download controls to sanitized fenced JSON blocks.
|
|
60
|
+
* The Markdown renderer must run first: this helper never accepts or inserts
|
|
61
|
+
* author-provided interactive markup.
|
|
62
|
+
*/
|
|
63
|
+
export declare function enhanceUiGraphChatJsonCodeBlocks(root: HTMLElement, appName: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Replaces visible chat-message text matches with safe `<mark>` elements. This
|
|
66
|
+
* operates on rendered Markdown DOM rather than source Markdown, so search
|
|
67
|
+
* follows what the user can actually read.
|
|
68
|
+
*/
|
|
69
|
+
export declare function highlightUiGraphChatSearchMatches(messagesElement: HTMLElement, query: string, requestedActiveIndex?: number): {
|
|
70
|
+
activeIndex: number;
|
|
71
|
+
matches: HTMLElement[];
|
|
72
|
+
};
|
|
73
|
+
/** Removes transient chat-search markup without changing the rendered message text. */
|
|
74
|
+
export declare function clearUiGraphChatSearchMatches(messagesElement: HTMLElement): void;
|
|
75
|
+
/** Reveals a rendered message or search match inside the chat's own scroll region. */
|
|
76
|
+
export declare function revealUiGraphChatElement(messagesElement: HTMLElement, element: HTMLElement | undefined, alignment?: 'center' | 'start'): void;
|
|
77
|
+
/** Centers the active chat-search match inside the chat's own scroll region. */
|
|
78
|
+
export declare const revealUiGraphChatSearchMatch: typeof revealUiGraphChatElement;
|
|
79
|
+
export {};
|