@valerypopoff/rivet2-core 2.1.4 → 2.1.5
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 +3733 -969
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/webAppRuntime.cjs +605 -16
- package/dist/cjs/webAppRuntime.cjs.map +3 -3
- package/dist/esm/api/createProcessor.js +5 -1
- package/dist/esm/exports.js +3 -0
- package/dist/esm/model/GraphBoundaryEffects.js +13 -0
- package/dist/esm/model/GraphProcessor.js +1127 -82
- package/dist/esm/model/ManagedAsyncBranches.js +28 -0
- package/dist/esm/model/Nodes.js +9 -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 +50 -0
- package/dist/esm/model/UiGraphActionProtocol.js +10 -1
- package/dist/esm/model/UiGraphBrowserRuntime.js +333 -0
- package/dist/esm/model/UiGraphNormalization.js +35 -185
- package/dist/esm/model/UiGraphRendererStyles.js +772 -74
- package/dist/esm/model/UiGraphRuntimeModel.js +230 -14
- 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-v2/chatV2Errors.js +36 -3
- package/dist/esm/model/chat-v2/index.js +1 -0
- package/dist/esm/model/chat-v2/toolContinuation.js +6 -8
- package/dist/esm/model/chat-v2/toolContinuationConnection.js +68 -0
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +12 -40
- package/dist/esm/model/nodes/GetStoredValueNode.js +109 -0
- package/dist/esm/model/nodes/LLMChatV2Node.js +17 -1
- package/dist/esm/model/nodes/MatchNode.js +7 -7
- 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 +47 -0
- package/dist/esm/model/nodes/toolCallDelegation.js +44 -1
- package/dist/esm/recording/ExecutionRecorder.js +1 -0
- package/dist/esm/utils/coerceType.js +3 -0
- package/dist/esm/webAppRuntime.js +3 -3
- package/dist/types/api/createProcessor.d.ts +4 -0
- package/dist/types/exports.d.ts +3 -0
- package/dist/types/model/EditorDefinition.d.ts +2 -1
- 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 +19 -2
- package/dist/types/model/ManagedAsyncBranches.d.ts +6 -0
- package/dist/types/model/Nodes.d.ts +5 -2
- package/dist/types/model/ProcessContext.d.ts +15 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +2 -1
- 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 +21 -0
- package/dist/types/model/UiGraphActionProtocol.d.ts +2 -0
- package/dist/types/model/UiGraphBrowserRuntime.d.ts +51 -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/toolContinuation.d.ts +1 -0
- package/dist/types/model/chat-v2/toolContinuationConnection.d.ts +28 -0
- package/dist/types/model/nodes/GetStoredValueNode.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/toolCallDelegation.d.ts +4 -0
- package/dist/types/recording/RecordedEvents.d.ts +5 -0
- package/dist/types/webAppRuntime.d.ts +4 -4
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ import { GraphProcessor } from '../model/GraphProcessor.js';
|
|
|
15
15
|
import type { Tokenizer } from '../integrations/Tokenizer.js';
|
|
16
16
|
import { type LooseDataValue } from './looseDataValue.js';
|
|
17
17
|
import type { ProjectReferenceLoader } from '../model/ProjectReferenceLoader.js';
|
|
18
|
+
import type { RivetStoredValueStore } from '../model/StoredValueStore.js';
|
|
18
19
|
export type RunGraphOptions = {
|
|
19
20
|
graph?: string;
|
|
20
21
|
inputs?: Record<string, LooseDataValue>;
|
|
@@ -40,6 +41,9 @@ export type RunGraphOptions = {
|
|
|
40
41
|
projectPath?: string;
|
|
41
42
|
projectReferenceLoader?: ProjectReferenceLoader;
|
|
42
43
|
editorExecutionCache?: ProcessContext['editorExecutionCache'];
|
|
44
|
+
storedValueStore?: RivetStoredValueStore;
|
|
45
|
+
/** Return root graph outputs before managed async branches settle. */
|
|
46
|
+
returnWhenGraphOutputsReady?: boolean;
|
|
43
47
|
} & {
|
|
44
48
|
[P in keyof ProcessEvents as `on${PascalCase<P>}`]?: (params: ProcessEvents[P]) => void;
|
|
45
49
|
} & Settings & Record<string, unknown>;
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export * from './model/UiGraphNormalization.js';
|
|
|
11
11
|
export * from './model/UiGraphBindings.js';
|
|
12
12
|
export * from './model/UiGraphRuntimeModel.js';
|
|
13
13
|
export * from './model/UiGraphWebAppStatus.js';
|
|
14
|
+
export * from './model/UiGraphWebAppStorage.js';
|
|
15
|
+
export * from './model/StoredValueStore.js';
|
|
16
|
+
export * from './model/ToolCallContinuation.js';
|
|
14
17
|
export * from './model/UiGraphActionProtocol.js';
|
|
15
18
|
export * from './model/GraphProgress.js';
|
|
16
19
|
export * from './model/UiGraphRendererStyles.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChartNode, type DataRef, type DataType, type DataValue, type DatasetId } from '../index.js';
|
|
1
|
+
import { type ChartNode, type DataRef, type DataType, type DataValue, type DatasetId, type ScalarDataType } from '../index.js';
|
|
2
2
|
import type { LegacyOrderedPortIdPattern } from '../utils/orderedStringPortIds.js';
|
|
3
3
|
type ExcludeNeverValues<T> = Pick<T, {
|
|
4
4
|
[K in keyof T]: T[K] extends never ? never : K;
|
|
@@ -36,6 +36,7 @@ export type ToggleEditorDefinition<T extends ChartNode> = SharedEditorDefinition
|
|
|
36
36
|
export type DataTypeSelectorEditorDefinition<T extends ChartNode> = SharedEditorDefinitionProps<T> & {
|
|
37
37
|
type: 'dataTypeSelector';
|
|
38
38
|
dataKey: DataOfType<T, DataType>;
|
|
39
|
+
allowedDataTypes?: ScalarDataType[];
|
|
39
40
|
useInputToggleDataKey?: DataOfType<T, boolean>;
|
|
40
41
|
};
|
|
41
42
|
export type DatasetSelectorEditorDefinition<T extends ChartNode> = SharedEditorDefinitionProps<T> & {
|
|
@@ -7,6 +7,7 @@ import type { Project, ProjectId } from './Project.js';
|
|
|
7
7
|
import type { Settings } from './Settings.js';
|
|
8
8
|
import type { FrozenNodeOutputsByGraph } from './GraphProcessor.js';
|
|
9
9
|
import type { GraphProgress } from './GraphProgress.js';
|
|
10
|
+
import type { RivetWebAppStorage } from './UiGraphWebAppStorage.js';
|
|
10
11
|
export type GraphInputs = Record<string, DataValue>;
|
|
11
12
|
export type GraphOutputs = Record<string, DataValue>;
|
|
12
13
|
export type Inputs = Record<PortId, DataValue | undefined>;
|
|
@@ -35,10 +36,17 @@ export type SerializedProcessEventMap = {
|
|
|
35
36
|
graph: NodeGraph;
|
|
36
37
|
error: Error | string;
|
|
37
38
|
}>;
|
|
39
|
+
webAppStoragePatch: {
|
|
40
|
+
storagePatch: RivetWebAppStorage;
|
|
41
|
+
};
|
|
38
42
|
graphFinish: WithExecution<{
|
|
39
43
|
graph: NodeGraph;
|
|
40
44
|
outputs: GraphOutputs;
|
|
41
45
|
}>;
|
|
46
|
+
graphOutputsReady: WithExecution<{
|
|
47
|
+
graph: NodeGraph;
|
|
48
|
+
outputs: GraphOutputs;
|
|
49
|
+
}>;
|
|
42
50
|
graphAbort: WithExecution<{
|
|
43
51
|
successful: boolean;
|
|
44
52
|
graph: NodeGraph;
|
|
@@ -131,7 +139,9 @@ export type ProcessEventMessageMap = {
|
|
|
131
139
|
abort: SerializedProcessEventMap['abort'];
|
|
132
140
|
graphAbort: SerializedProcessEventMap['graphAbort'];
|
|
133
141
|
graphStart: SerializedProcessEventMap['graphStart'];
|
|
142
|
+
webAppStoragePatch: SerializedProcessEventMap['webAppStoragePatch'];
|
|
134
143
|
graphFinish: SerializedProcessEventMap['graphFinish'];
|
|
144
|
+
graphOutputsReady: SerializedProcessEventMap['graphOutputsReady'];
|
|
135
145
|
partialOutput: SerializedProcessEventMap['partialOutput'];
|
|
136
146
|
progress: SerializedProcessEventMap['progress'];
|
|
137
147
|
nodeOutputsCleared: SerializedProcessEventMap['nodeOutputsCleared'];
|
|
@@ -210,6 +220,8 @@ export type OutgoingMessageMap = {
|
|
|
210
220
|
projectPath?: string | null;
|
|
211
221
|
useEditorCache?: boolean;
|
|
212
222
|
captureNodeTimings?: boolean;
|
|
223
|
+
returnWhenGraphOutputsReady?: boolean;
|
|
224
|
+
webAppStorage?: RivetWebAppStorage;
|
|
213
225
|
};
|
|
214
226
|
abort: {
|
|
215
227
|
requestId?: RemoteRunRequestId;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { ScalarOrArrayDataValue } from './DataValue.js';
|
|
2
2
|
import type { GraphOutputs, Outputs } from './GraphProcessor.js';
|
|
3
3
|
import type { ChartNode } from './NodeBase.js';
|
|
4
|
+
import type { RivetStoredValue } from './StoredValueStore.js';
|
|
4
5
|
export type FrozenSetGlobalEffect = {
|
|
6
|
+
type: 'setGlobal';
|
|
5
7
|
variableId: string;
|
|
6
8
|
value: ScalarOrArrayDataValue;
|
|
7
9
|
};
|
|
10
|
+
export type FrozenSetStoredValueEffect = {
|
|
11
|
+
type: 'setStoredValue';
|
|
12
|
+
key: string;
|
|
13
|
+
value: RivetStoredValue;
|
|
14
|
+
};
|
|
15
|
+
export type FrozenGraphBoundaryEffect = FrozenSetGlobalEffect | FrozenSetStoredValueEffect;
|
|
8
16
|
export declare function ensureGraphCostOutput(graphOutputs: GraphOutputs, totalCost: number): void;
|
|
9
|
-
export declare function applyFrozenGraphBoundaryEffects(graphOutputs: GraphOutputs, node: ChartNode, outputValues: Outputs):
|
|
17
|
+
export declare function applyFrozenGraphBoundaryEffects(graphOutputs: GraphOutputs, node: ChartNode, outputValues: Outputs): FrozenGraphBoundaryEffect | undefined;
|
|
@@ -10,9 +10,12 @@ 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';
|
|
13
14
|
type WithExecution<T extends object> = T & {
|
|
14
15
|
execution: GraphExecutionMetadata;
|
|
15
16
|
};
|
|
17
|
+
declare const graphProcessorGraphOverride: unique symbol;
|
|
18
|
+
declare const consumedAsyncBranchTriggerOverride: unique symbol;
|
|
16
19
|
export type ProcessEvents = {
|
|
17
20
|
/** Called when processing has started. */
|
|
18
21
|
start: WithExecution<{
|
|
@@ -36,6 +39,11 @@ export type ProcessEvents = {
|
|
|
36
39
|
graph: NodeGraph;
|
|
37
40
|
outputs: GraphOutputs;
|
|
38
41
|
}>;
|
|
42
|
+
/** Called when root graph outputs are ready while managed async branches are still settling. */
|
|
43
|
+
graphOutputsReady: WithExecution<{
|
|
44
|
+
graph: NodeGraph;
|
|
45
|
+
outputs: GraphOutputs;
|
|
46
|
+
}>;
|
|
39
47
|
/** Called when a graph has been aborted. */
|
|
40
48
|
graphAbort: WithExecution<{
|
|
41
49
|
successful: boolean;
|
|
@@ -174,7 +182,7 @@ export type GraphProcessorRuntimeCache = {
|
|
|
174
182
|
};
|
|
175
183
|
export type GraphProcessorExecutionPlanCacheMode = 'all' | 'subprocessors';
|
|
176
184
|
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';
|
|
185
|
+
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
186
|
export type GraphProcessorRuntimeProfiler = {
|
|
179
187
|
addDuration: (bucket: GraphProcessorRuntimeProfileBucket, durationMs: number) => void;
|
|
180
188
|
};
|
|
@@ -212,6 +220,8 @@ export declare class GraphProcessor {
|
|
|
212
220
|
recordingPlaybackChatLatency: number;
|
|
213
221
|
warnOnInvalidGraph: boolean;
|
|
214
222
|
get isRunning(): boolean;
|
|
223
|
+
/** Waits for the current run's full lifecycle, including managed async branches. */
|
|
224
|
+
waitForRunCompletion(): Promise<GraphOutputs>;
|
|
215
225
|
constructor(project: Project, graphId: GraphId | undefined, registry: NodeRegistration<any, any>, includeTrace?: boolean, options?: {
|
|
216
226
|
cacheLoadedProjects?: boolean;
|
|
217
227
|
captureNodeTimings?: boolean;
|
|
@@ -221,6 +231,8 @@ export declare class GraphProcessor {
|
|
|
221
231
|
runtimeCache?: GraphProcessorRuntimeCache;
|
|
222
232
|
runtimeProfiler?: GraphProcessorRuntimeProfiler;
|
|
223
233
|
scheduler?: GraphProcessorScheduler;
|
|
234
|
+
[graphProcessorGraphOverride]?: NodeGraph;
|
|
235
|
+
[consumedAsyncBranchTriggerOverride]?: NodeId;
|
|
224
236
|
});
|
|
225
237
|
on: Emittery<ProcessEvents>["on"];
|
|
226
238
|
off: Emittery<ProcessEvents>["off"];
|
|
@@ -231,6 +243,7 @@ export declare class GraphProcessor {
|
|
|
231
243
|
offUserEvent(listener: (data: DataValue | undefined) => void): void;
|
|
232
244
|
userInput(nodeId: NodeId, values: StringArrayDataValue): void;
|
|
233
245
|
setExternalFunction(name: string, fn: ExternalFunction): void;
|
|
246
|
+
setStoredValueStore(store: RivetStoredValueStore | undefined): void;
|
|
234
247
|
abort(successful?: boolean, error?: Error | string): Promise<void>;
|
|
235
248
|
pause(): void;
|
|
236
249
|
resume(): void;
|
|
@@ -248,7 +261,11 @@ export declare class GraphProcessor {
|
|
|
248
261
|
/** Inputs to the main graph. You should pass all inputs required by the GraphInputNodes of the graph. */
|
|
249
262
|
inputs?: Record<string, DataValue>,
|
|
250
263
|
/** 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
|
|
264
|
+
contextValues?: Record<string, DataValue>,
|
|
265
|
+
/** Allows callers such as web apps to receive root outputs while managed async branches continue settling. */
|
|
266
|
+
options?: {
|
|
267
|
+
returnWhenGraphOutputsReady?: boolean;
|
|
268
|
+
}): Promise<GraphOutputs>;
|
|
252
269
|
getRootProcessor(): GraphProcessor;
|
|
253
270
|
/** Raise a user event on the processor, all subprocessors, and their children. */
|
|
254
271
|
raiseEvent(event: string, data: DataValue): void;
|
|
@@ -32,9 +32,12 @@ 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';
|
|
@@ -91,12 +94,12 @@ export * from './nodes/MCPToolCallNode.js';
|
|
|
91
94
|
export * from './nodes/MCPGetPromptNode.js';
|
|
92
95
|
export * from './nodes/ReferencedGraphAliasNode.js';
|
|
93
96
|
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" | "
|
|
97
|
+
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" | "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/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
98
|
type: "mcpDiscovery";
|
|
96
99
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
97
100
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
98
101
|
}) | 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" | "
|
|
102
|
+
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" | "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/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
103
|
type: "mcpDiscovery";
|
|
101
104
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
102
105
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
@@ -5,6 +5,8 @@ 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';
|
|
8
10
|
export type ProcessContext = {
|
|
9
11
|
settings: RuntimeSettings;
|
|
10
12
|
nativeApi?: NativeApi;
|
|
@@ -66,6 +68,11 @@ export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessCon
|
|
|
66
68
|
processId: ProcessId;
|
|
67
69
|
/** Output ports with at least one active immediate downstream consumer in this graph run. */
|
|
68
70
|
activeOutputPortIds: ReadonlySet<PortId>;
|
|
71
|
+
/**
|
|
72
|
+
* Executes the uniquely connected Delegate Tool Call node for one LLM tool round.
|
|
73
|
+
* Present only for an auto-continuing LLM Chat node with one eligible continuation connection.
|
|
74
|
+
*/
|
|
75
|
+
toolCallContinuation?: ToolCallContinuation;
|
|
69
76
|
/** True when this exact node is the direct terminal selected by run-to execution. */
|
|
70
77
|
isDirectRunTarget: boolean;
|
|
71
78
|
/** Stable execution lineage for the current graph invocation. */
|
|
@@ -107,6 +114,14 @@ export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessCon
|
|
|
107
114
|
/** 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
115
|
setGlobal: (id: string, value: ScalarOrArrayDataValue) => void;
|
|
109
116
|
waitForGlobal: (id: string) => Promise<ScalarOrArrayDataValue>;
|
|
117
|
+
/** Reads through the root run's stored-value cache and optional persistence store. */
|
|
118
|
+
getStoredValue: (key: string) => Promise<RivetStoredValueReadResult>;
|
|
119
|
+
/** Returns only the current root run's synchronous stored-value cache state. */
|
|
120
|
+
getCachedStoredValue: (key: string) => RivetStoredValueCacheResult;
|
|
121
|
+
/** Writes through the root run's cache and optional persistence store. */
|
|
122
|
+
setStoredValue: (key: string, value: RivetStoredValue) => Promise<RivetStoredValueSetResult>;
|
|
123
|
+
/** Waits only for a successful Set Stored Value in this root run. */
|
|
124
|
+
waitForStoredValue: (key: string, signal?: AbortSignal) => Promise<RivetStoredValue>;
|
|
110
125
|
/** Logs to GraphProcessor's trace event. */
|
|
111
126
|
trace: (message: string) => void;
|
|
112
127
|
/** 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;
|
|
@@ -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;
|
|
@@ -36,6 +40,12 @@ export type UiGraphChatMessage = {
|
|
|
36
40
|
role: 'assistant' | 'user';
|
|
37
41
|
content: string;
|
|
38
42
|
};
|
|
43
|
+
export type UiGraphChatPin = {
|
|
44
|
+
messageIndex: number;
|
|
45
|
+
promptMessageIndex?: number;
|
|
46
|
+
prompt?: UiGraphChatMessage;
|
|
47
|
+
response: UiGraphChatMessage;
|
|
48
|
+
};
|
|
39
49
|
export type UiGraphInputBinding = {
|
|
40
50
|
inputKey: string;
|
|
41
51
|
stateKey: string;
|
|
@@ -71,6 +81,12 @@ export type UiGraphComponent = {
|
|
|
71
81
|
stateKey: string;
|
|
72
82
|
placeholder?: string;
|
|
73
83
|
defaultValue?: string;
|
|
84
|
+
} | {
|
|
85
|
+
id: UiComponentId;
|
|
86
|
+
type: 'dropdown';
|
|
87
|
+
label: string;
|
|
88
|
+
stateKey: string;
|
|
89
|
+
items: UiGraphDropdownItem[];
|
|
74
90
|
} | {
|
|
75
91
|
id: UiComponentId;
|
|
76
92
|
type: 'button';
|
|
@@ -111,7 +127,12 @@ export declare function getUiGraphInitialState(uiGraph: UiGraph): Record<string,
|
|
|
111
127
|
export declare function getUiGraphActionComponent(uiGraph: UiGraph, componentId: UiComponentId): UiGraphActionComponent | undefined;
|
|
112
128
|
export declare function getUiGraphChatDraftStateKey(componentId: UiComponentId): string;
|
|
113
129
|
export declare function getUiGraphChatMessagesStateKey(componentId: UiComponentId): string;
|
|
130
|
+
export declare function getUiGraphChatPinsStateKey(componentId: UiComponentId): string;
|
|
114
131
|
export declare function getUiGraphChatMessages(componentId: UiComponentId, state: Readonly<Record<string, unknown>>): UiGraphChatMessage[];
|
|
132
|
+
export declare function getUiGraphChatPins(componentId: UiComponentId, state: Readonly<Record<string, unknown>>): UiGraphChatPin[];
|
|
133
|
+
export declare function createUiGraphChatPinStatePatch(componentId: UiComponentId, state: Readonly<Record<string, unknown>>, messageIndex: number): Record<string, unknown> | undefined;
|
|
134
|
+
/** Clears a Chat's conversation and pins without discarding an unsent draft. */
|
|
135
|
+
export declare function createUiGraphChatHistoryFlushStatePatch(componentId: UiComponentId): Record<string, unknown>;
|
|
115
136
|
export declare function createUiGraphChatSubmissionStatePatch(componentId: UiComponentId, state: Readonly<Record<string, unknown>>): Record<string, unknown> | undefined;
|
|
116
137
|
export declare function getUiGraphComponentActionState(component: UiGraphActionComponent, state: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
117
138
|
export declare function resolveUiGraphComponentActionInputs(component: UiGraphActionComponent, 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,55 @@
|
|
|
1
|
+
import { type UiGraph } from './UiGraph.js';
|
|
2
|
+
type UiGraphBrowserStorage = Pick<Storage, 'getItem' | 'removeItem' | 'setItem'>;
|
|
3
|
+
type UiGraphStorageLocation = Pick<Location, 'origin' | 'pathname'>;
|
|
4
|
+
/** Returns the browser-local key for one app URL and one persisted UI graph. */
|
|
5
|
+
export declare function getUiGraphChatStorageKey(uiGraph: UiGraph, location?: UiGraphStorageLocation | undefined): string | undefined;
|
|
6
|
+
/** Returns the browser-local key for graph-managed storage owned by one web app. */
|
|
7
|
+
export declare function getUiGraphWebAppStorageKey(uiGraph: UiGraph, location?: UiGraphStorageLocation | undefined): string | undefined;
|
|
8
|
+
/** Loads the browser snapshot used by Stored Value nodes for this one web app. */
|
|
9
|
+
export declare function loadUiGraphWebAppStorage(uiGraph: UiGraph, storage?: UiGraphBrowserStorage | undefined, location?: UiGraphStorageLocation): Record<string, unknown>;
|
|
10
|
+
/** Merges a successful action's changed keys and persists the complete app-local record. */
|
|
11
|
+
export declare function applyUiGraphWebAppStoragePatch(uiGraph: UiGraph, currentStorage: Readonly<Record<string, unknown>>, patch: Readonly<Record<string, unknown>>, storage?: UiGraphBrowserStorage | undefined, location?: UiGraphStorageLocation): Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* Applies the keys from one completed action that have not already been superseded.
|
|
14
|
+
* Ordering metadata is committed only after persistence succeeds, so a failed newer
|
|
15
|
+
* write cannot suppress an older successful action that completes later.
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyUiGraphWebAppStorageActionPatch(patch: Readonly<Record<string, unknown>>, actionNumber: number, appliedActionByKey: Map<string, number>, persist: (applicablePatch: Record<string, unknown>) => void): Record<string, unknown>;
|
|
18
|
+
/** Selects and validates the private browser-persisted state of Chat components only. */
|
|
19
|
+
export declare function getUiGraphChatPersistentState(uiGraph: UiGraph, state: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* Reports whether a state transition changed the browser-persisted portion of
|
|
22
|
+
* any Chat. Runtime state updates are immutable, so reference comparison keeps
|
|
23
|
+
* action progress and unrelated form edits from serializing a large history.
|
|
24
|
+
*/
|
|
25
|
+
export declare function hasUiGraphChatPersistentStateChanged(uiGraph: UiGraph, previousState: Readonly<Record<string, unknown>>, nextState: Readonly<Record<string, unknown>>): boolean;
|
|
26
|
+
/** Loads valid Chat-only state without allowing malformed local storage to affect rendering. */
|
|
27
|
+
export declare function loadUiGraphChatPersistentState(uiGraph: UiGraph, storage?: UiGraphBrowserStorage | undefined, location?: UiGraphStorageLocation): Record<string, unknown>;
|
|
28
|
+
/** Persists only Chat draft, conversation, and pins for the current browser app URL. */
|
|
29
|
+
export declare function saveUiGraphChatPersistentState(uiGraph: UiGraph, state: Readonly<Record<string, unknown>>, storage?: UiGraphBrowserStorage | undefined, location?: UiGraphStorageLocation): void;
|
|
30
|
+
/**
|
|
31
|
+
* Limits an expanded Output card's native resize range to one visible content
|
|
32
|
+
* line through its rendered value. Short, naturally-sized outputs have no resize
|
|
33
|
+
* handle because resizing them would only add blank space.
|
|
34
|
+
*/
|
|
35
|
+
export declare function observeUiGraphOutputResizeBounds(output: HTMLElement): () => void;
|
|
1
36
|
/** Copies rendered web-app output without requiring the modern Clipboard API. */
|
|
2
37
|
export declare function copyUiGraphText(value: string): Promise<boolean>;
|
|
3
38
|
/** Downloads the exact JSON string rendered by a web-app output component. */
|
|
4
39
|
export declare function downloadUiGraphJsonOutput(value: string, appName: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Replaces visible chat-message text matches with safe `<mark>` elements. This
|
|
42
|
+
* operates on rendered Markdown DOM rather than source Markdown, so search
|
|
43
|
+
* follows what the user can actually read.
|
|
44
|
+
*/
|
|
45
|
+
export declare function highlightUiGraphChatSearchMatches(messagesElement: HTMLElement, query: string, requestedActiveIndex?: number): {
|
|
46
|
+
activeIndex: number;
|
|
47
|
+
matches: HTMLElement[];
|
|
48
|
+
};
|
|
49
|
+
/** Removes transient chat-search markup without changing the rendered message text. */
|
|
50
|
+
export declare function clearUiGraphChatSearchMatches(messagesElement: HTMLElement): void;
|
|
51
|
+
/** Reveals a rendered message or search match inside the chat's own scroll region. */
|
|
52
|
+
export declare function revealUiGraphChatElement(messagesElement: HTMLElement, element: HTMLElement | undefined, alignment?: 'center' | 'start'): void;
|
|
53
|
+
/** Centers the active chat-search match inside the chat's own scroll region. */
|
|
54
|
+
export declare const revealUiGraphChatSearchMatch: typeof revealUiGraphChatElement;
|
|
55
|
+
export {};
|