@valerypopoff/rivet2-core 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bundle.cjs +3104 -850
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/interpolationRuntime.cjs +7 -3
- package/dist/cjs/interpolationRuntime.cjs.map +2 -2
- package/dist/cjs/webAppRuntime.cjs.map +2 -2
- package/dist/esm/api/createProcessor.js +3 -0
- package/dist/esm/exports.js +2 -1
- package/dist/esm/integrations/CodeRunner.js +6 -2
- package/dist/esm/integrations/mcp/MCPBase.js +2 -1
- package/dist/esm/model/AgentResponseTrace.js +8 -3
- package/dist/esm/model/ExecutionOutputClone.js +46 -0
- package/dist/esm/model/GlobalVariables.js +452 -0
- package/dist/esm/model/GraphBoundaryEffects.js +12 -4
- package/dist/esm/model/GraphProcessor.js +865 -46
- package/dist/esm/model/Nodes.js +6 -0
- package/dist/esm/model/ProcessContextBuilder.js +4 -1
- package/dist/esm/model/ProjectReferenceLoader.js +36 -1
- package/dist/esm/model/RecordingPlayer.js +58 -14
- package/dist/esm/model/SplitRunProcessor.js +37 -16
- package/dist/esm/model/StreamingOutputWatch.js +262 -0
- package/dist/esm/model/StreamingOutputWatchHistory.js +161 -0
- package/dist/esm/model/SubprocessorBridge.js +29 -19
- package/dist/esm/model/UiGraphRendererStyles.js +20 -0
- package/dist/esm/model/chat/aiSdkStreaming.js +3 -2
- package/dist/esm/model/chat-v2/aiSdkBridge.js +63 -5
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +66 -3
- package/dist/esm/model/chat-v2/llmChatV2OutputClone.js +3 -42
- package/dist/esm/model/chat-v2/llmInvocationResultProjector.js +20 -7
- package/dist/esm/model/chat-v2/llmProfileFallback.js +12 -4
- package/dist/esm/model/nodes/CodeNewNode.js +4 -1
- package/dist/esm/model/nodes/ExpressionNode.js +4 -1
- package/dist/esm/model/nodes/ExtractObjectPathNode.js +4 -4
- package/dist/esm/model/nodes/GraphOutputNode.js +13 -8
- package/dist/esm/model/nodes/LLMChatV2Node.js +30 -4
- package/dist/esm/model/nodes/MCPGetPromptNode.js +2 -1
- package/dist/esm/model/nodes/MCPToolCallNode.js +2 -1
- package/dist/esm/model/nodes/ObjectNode.js +5 -3
- package/dist/esm/model/nodes/PromptNode.js +5 -2
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +9 -1
- package/dist/esm/model/nodes/StopWatchingStreamingOutputNode.js +48 -0
- package/dist/esm/model/nodes/SubGraphNode.js +11 -1
- package/dist/esm/model/nodes/TextNode.js +5 -2
- package/dist/esm/model/nodes/ToTreeNode.js +10 -3
- package/dist/esm/model/nodes/ToolNode.js +5 -2
- package/dist/esm/model/nodes/WatchStreamingOutputNode.js +126 -0
- package/dist/esm/model/nodes/jsListCallbackHelpers.js +7 -1
- package/dist/esm/model/nodes/jsValueInterpolation.js +21 -4
- package/dist/esm/plugins/openai/nodes/ThreadMessageNode.js +2 -1
- package/dist/esm/recording/ExecutionRecorder.js +71 -30
- package/dist/esm/utils/interpolation.js +35 -2
- package/dist/esm/utils/serialization/serializationUtils.js +9 -0
- package/dist/esm/utils/serialization/serialization_v4.js +7 -0
- package/dist/types/exports.d.ts +2 -1
- package/dist/types/integrations/CodeRunner.d.ts +3 -3
- package/dist/types/integrations/CodeRunnerOptions.d.ts +5 -0
- package/dist/types/integrations/mcp/MCPBase.d.ts +1 -1
- package/dist/types/model/AgentResponseTrace.d.ts +2 -0
- package/dist/types/model/ExecutionOutputClone.d.ts +11 -0
- package/dist/types/model/ExecutorProtocol.d.ts +12 -2
- package/dist/types/model/GlobalVariables.d.ts +29 -0
- package/dist/types/model/GraphBoundaryEffects.d.ts +7 -1
- package/dist/types/model/GraphProcessor.d.ts +55 -3
- package/dist/types/model/Nodes.d.ts +4 -2
- package/dist/types/model/ProcessContext.d.ts +20 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +4 -1
- package/dist/types/model/Project.d.ts +7 -1
- package/dist/types/model/ProjectReferenceLoader.d.ts +15 -1
- package/dist/types/model/SplitRunProcessor.d.ts +2 -1
- package/dist/types/model/StreamingOutputWatch.d.ts +74 -0
- package/dist/types/model/StreamingOutputWatchHistory.d.ts +58 -0
- package/dist/types/model/SubprocessorBridge.d.ts +2 -0
- package/dist/types/model/UiGraphRendererStyles.d.ts +1 -1
- package/dist/types/model/chat/aiSdkStreaming.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2RequestPlan.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2Types.d.ts +29 -0
- package/dist/types/model/chat-v2/llmChatV2OutputClone.d.ts +3 -3
- package/dist/types/model/chat-v2/llmInvocationResultProjector.d.ts +5 -1
- package/dist/types/model/nodes/ExtractObjectPathNode.d.ts +1 -1
- package/dist/types/model/nodes/GraphOutputNode.d.ts +8 -1
- package/dist/types/model/nodes/ObjectNode.d.ts +1 -1
- package/dist/types/model/nodes/StopWatchingStreamingOutputNode.d.ts +14 -0
- package/dist/types/model/nodes/ToTreeNode.d.ts +5 -1
- package/dist/types/model/nodes/WatchStreamingOutputNode.d.ts +17 -0
- package/dist/types/model/nodes/jsValueInterpolation.d.ts +10 -1
- package/dist/types/recording/ExecutionRecorder.d.ts +6 -1
- package/dist/types/recording/RecordedEvents.d.ts +9 -0
- package/dist/types/utils/interpolation.d.ts +14 -5
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ import { type GraphExecutionPlan } from './GraphPreprocessor.js';
|
|
|
12
12
|
import { type GraphBoundaryCache } from './GraphBoundaryCache.js';
|
|
13
13
|
import { type GraphProgress } from './GraphProgress.js';
|
|
14
14
|
import { type RivetStoredValueStore } from './StoredValueStore.js';
|
|
15
|
+
import { type StreamingOutputWatchHistorySummary } from './StreamingOutputWatchHistory.js';
|
|
15
16
|
import type { RivetKnowledgeStoreRegistry } from '../integrations/KnowledgeStore.js';
|
|
16
17
|
/**
|
|
17
18
|
* Provenance attached only while RecordingPlayer re-emits a historical event.
|
|
@@ -21,11 +22,20 @@ import type { RivetKnowledgeStoreRegistry } from '../integrations/KnowledgeStore
|
|
|
21
22
|
export type ReplayEventTiming = {
|
|
22
23
|
replayRecordedAt?: number;
|
|
23
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Timestamp carried by a delayed-but-retained execution event. Delivery may
|
|
27
|
+
* happen after a Watch settles; observability must still use this original
|
|
28
|
+
* occurrence time rather than the later emitter receipt time.
|
|
29
|
+
*/
|
|
30
|
+
export type EventOccurrenceTiming = {
|
|
31
|
+
eventOccurredAt?: number;
|
|
32
|
+
};
|
|
24
33
|
type WithExecution<T extends object> = T & {
|
|
25
34
|
execution: GraphExecutionMetadata;
|
|
26
|
-
} & ReplayEventTiming;
|
|
35
|
+
} & ReplayEventTiming & EventOccurrenceTiming;
|
|
27
36
|
declare const graphProcessorGraphOverride: unique symbol;
|
|
28
37
|
declare const consumedAsyncBranchTriggerOverride: unique symbol;
|
|
38
|
+
declare const consumedStreamingWatchNodeOverride: unique symbol;
|
|
29
39
|
export type NodeResultOrigin = 'executed' | 'preloaded' | 'frozen' | 'editor-cache' | 'unknown';
|
|
30
40
|
export type ProcessEvents = {
|
|
31
41
|
/** Called when processing has started. */
|
|
@@ -84,6 +94,14 @@ export type ProcessEvents = {
|
|
|
84
94
|
node: ChartNode;
|
|
85
95
|
error: Error | string;
|
|
86
96
|
processId: ProcessId;
|
|
97
|
+
/** Display-only outputs retained by a failed non-split invocation. */
|
|
98
|
+
outputs?: Outputs;
|
|
99
|
+
/**
|
|
100
|
+
* Display-only evidence retained by split items that actually ran. It can
|
|
101
|
+
* contain completed sibling outputs and failed-item checkpoints, but is
|
|
102
|
+
* never a successful aggregate result or downstream input.
|
|
103
|
+
*/
|
|
104
|
+
splitOutputs?: Record<number, Outputs>;
|
|
87
105
|
resultOrigin?: NodeResultOrigin;
|
|
88
106
|
durationMs?: number;
|
|
89
107
|
splitRunDurationMs?: Record<number, number>;
|
|
@@ -140,6 +158,11 @@ export type ProcessEvents = {
|
|
|
140
158
|
node: ChartNode;
|
|
141
159
|
processId?: ProcessId;
|
|
142
160
|
}>;
|
|
161
|
+
/** Compact accounting for a completed Watch Streaming Output boundary. */
|
|
162
|
+
streamingOutputWatchSummary: WithExecution<{
|
|
163
|
+
watchNode: ChartNode;
|
|
164
|
+
summary: StreamingOutputWatchHistorySummary;
|
|
165
|
+
}>;
|
|
143
166
|
/** Called when the root graph has errored. The root graph will also throw. */
|
|
144
167
|
error: {
|
|
145
168
|
error: Error | string;
|
|
@@ -186,6 +209,13 @@ export type ProcessEvent = {
|
|
|
186
209
|
}[keyof ProcessEvents];
|
|
187
210
|
export type GraphOutputs = Record<string, DataValue>;
|
|
188
211
|
export type GraphInputs = Record<string, DataValue>;
|
|
212
|
+
/**
|
|
213
|
+
* Ephemeral named Graph Output updates. This is deliberately an in-process
|
|
214
|
+
* callback rather than a ProcessEvent: it bridges a named graph-boundary
|
|
215
|
+
* caller's execution boundary for a parent Watch without adding a second
|
|
216
|
+
* recorded/node-history stream for every token.
|
|
217
|
+
*/
|
|
218
|
+
type GraphOutputPartialListener = (outputs: GraphOutputs) => void;
|
|
189
219
|
export type NodeResults = Map<NodeId, Outputs>;
|
|
190
220
|
export type Inputs = NodeInputs;
|
|
191
221
|
export type Outputs = NodeOutputs;
|
|
@@ -197,7 +227,21 @@ export type FrozenNodeOutputResolverRequest = {
|
|
|
197
227
|
node: ChartNode;
|
|
198
228
|
processId: ProcessId;
|
|
199
229
|
};
|
|
200
|
-
export type
|
|
230
|
+
export type FrozenNodeOutputEligibilityRequest = Pick<FrozenNodeOutputResolverRequest, 'graphId' | 'node'>;
|
|
231
|
+
/**
|
|
232
|
+
* A resolver may expose this non-consuming predicate when it can determine
|
|
233
|
+
* whether a node has frozen output without advancing its replay cursor.
|
|
234
|
+
* Streaming topology preparation uses it to keep a frozen named boundary
|
|
235
|
+
* final-only; custom resolvers without the predicate are conservatively
|
|
236
|
+
* treated as unknown rather than invoked speculatively. Return `false` only
|
|
237
|
+
* when this resolver cannot produce frozen output for the node in this run;
|
|
238
|
+
* returning `true` is allowed to be conservative and merely makes the
|
|
239
|
+
* boundary final-only.
|
|
240
|
+
*/
|
|
241
|
+
export type FrozenNodeOutputResolver = {
|
|
242
|
+
(request: FrozenNodeOutputResolverRequest): Outputs | undefined;
|
|
243
|
+
hasFrozenNodeOutput?: (request: FrozenNodeOutputEligibilityRequest) => boolean;
|
|
244
|
+
};
|
|
201
245
|
export declare function cloneFrozenNodeOutputs(outputs: Outputs): Outputs;
|
|
202
246
|
export declare function cloneFrozenNodeOutputsByGraph(outputsByGraph: FrozenNodeOutputsByGraph): FrozenNodeOutputsByGraph;
|
|
203
247
|
export declare function hasFrozenNodeOutputs(outputsByGraph: FrozenNodeOutputsByGraph | undefined): boolean;
|
|
@@ -218,7 +262,7 @@ export type GraphProcessorRuntimeCache = {
|
|
|
218
262
|
};
|
|
219
263
|
export type GraphProcessorExecutionPlanCacheMode = 'all' | 'subprocessors';
|
|
220
264
|
export type GraphProcessorScheduler = 'compatible' | 'fast-acyclic';
|
|
221
|
-
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';
|
|
265
|
+
export type GraphProcessorRuntimeProfileBucket = 'initializeGraphRun' | 'loadProjectReferences' | 'initializeProjectGlobalVariables' | 'prepareNodeProcessContextBase' | 'preprocessGraph' | 'emitGraphStart' | 'emitInitialProjectGlobalVariables' | 'emitPreloadedNodeResults' | 'waitUntilUnpaused' | 'processFastAcyclicGraph' | 'processCompatibleGraph' | 'drainManagedAsyncBranches' | 'drainStreamingOutputWatches' | 'throwIfGraphErrored' | 'finalizeGraphRun' | 'emitFinish' | 'fetchNodeDataAndProcessNode' | 'getInputNodesTo' | 'getInputValuesForNode' | 'nodeDispatch' | 'nodeImplementation' | 'createNodeProcessContext' | 'getOutputNodesFrom' | 'queueOutputNodes' | 'createSubProcessor' | 'wireSubProcessorEvents' | 'wireSubProcessorLifecycle';
|
|
222
266
|
export type GraphProcessorRuntimeProfiler = {
|
|
223
267
|
addDuration: (bucket: GraphProcessorRuntimeProfileBucket, durationMs: number) => void;
|
|
224
268
|
};
|
|
@@ -269,6 +313,7 @@ export declare class GraphProcessor {
|
|
|
269
313
|
scheduler?: GraphProcessorScheduler;
|
|
270
314
|
[graphProcessorGraphOverride]?: NodeGraph;
|
|
271
315
|
[consumedAsyncBranchTriggerOverride]?: NodeId;
|
|
316
|
+
[consumedStreamingWatchNodeOverride]?: NodeId;
|
|
272
317
|
});
|
|
273
318
|
on: Emittery<ProcessEvents>["on"];
|
|
274
319
|
off: Emittery<ProcessEvents>["off"];
|
|
@@ -303,6 +348,13 @@ export declare class GraphProcessor {
|
|
|
303
348
|
returnWhenGraphOutputsReady?: boolean;
|
|
304
349
|
/** Restrict this invocation to named graph outputs and their prerequisites. Cannot be combined with runToNodeIds. */
|
|
305
350
|
requestedGraphOutputIds?: readonly string[];
|
|
351
|
+
/**
|
|
352
|
+
* Receives partial values only when a producer directly feeds a named
|
|
353
|
+
* Graph Output. Used internally to stream a named graph-boundary caller
|
|
354
|
+
* output to its parent without changing the persisted graph or public
|
|
355
|
+
* event protocol.
|
|
356
|
+
*/
|
|
357
|
+
onGraphOutputPartial?: GraphOutputPartialListener;
|
|
306
358
|
}): Promise<GraphOutputs>;
|
|
307
359
|
getRootProcessor(): GraphProcessor;
|
|
308
360
|
/** Raise a user event on the processor, all subprocessors, and their children. */
|
|
@@ -36,6 +36,8 @@ export * from './nodes/PassthroughNode.js';
|
|
|
36
36
|
export * from './nodes/DataBusNode.js';
|
|
37
37
|
export * from './DataBusTopology.js';
|
|
38
38
|
export * from './nodes/StartBackgroundBranchNode.js';
|
|
39
|
+
export * from './nodes/WatchStreamingOutputNode.js';
|
|
40
|
+
export * from './nodes/StopWatchingStreamingOutputNode.js';
|
|
39
41
|
export * from './nodes/PopNode.js';
|
|
40
42
|
export * from './nodes/SetGlobalNode.js';
|
|
41
43
|
export * from './nodes/GetGlobalNode.js';
|
|
@@ -103,12 +105,12 @@ export * from './nodes/MCPToolCallNode.js';
|
|
|
103
105
|
export * from './nodes/MCPGetPromptNode.js';
|
|
104
106
|
export * from './nodes/ReferencedGraphAliasNode.js';
|
|
105
107
|
export * from './nodes/NodePrefabInstanceNode.js';
|
|
106
|
-
export declare const registerBuiltInNodes: (registry: NodeRegistration) => NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "
|
|
108
|
+
export declare const registerBuiltInNodes: (registry: NodeRegistration) => NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "setGlobal" | "setStoredValue" | "graphOutput" | "delegateFunctionCall" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "abortGraph" | "prompt" | "llmChatV2" | "userInput" | "llmProfile" | "extractRegex" | "codeNew" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "coalesce" | "didRun" | "passthrough" | "dataBus" | "startBackgroundBranch" | "watchStreamingOutput" | "stopWatchingStreamingOutput" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "knowledgeSource" | "knowledgeDocument" | "syncKnowledgeSource" | "getKnowledgeSourceStatus" | "searchKnowledge" | "buildKnowledgeContext" | "hash" | "raceInputs" | "toJson" | "jsFilter" | "jsMap" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "comment" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "playAudio" | "chatLoop" | "readAllFiles" | "toMarkdownTable" | "cron" | "toTree" | "loopUntil" | "mcpDiscovery" | "mcpToolCall" | "mcpGetPrompt" | "referencedGraphAlias" | "nodePrefabInstance", import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./chat-v2/llmChatV2NodeData.js").LLMChatV2Node | import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./nodes/LLMProfileNode.js").LLMProfileNode | import("./nodes/PromptNode.js").PromptNode | import("./nodes/ExtractRegexNode.js").ExtractRegexNode | import("./nodes/CodeNode.js").CodeNode | import("./nodes/CodeNewNode.js").CodeNewNode | import("./nodes/ExpressionNode.js").ExpressionNode | import("./nodes/MatchNode.js").MatchNode | import("./nodes/IfNode.js").IfNode | import("./nodes/ReadDirectoryNode.js").ReadDirectoryNode | import("./nodes/ReadFileNode.js").ReadFileNode | import("./nodes/IfElseNode.js").IfElseNode | import("./nodes/ChunkNode.js").ChunkNode | import("./nodes/SubGraphNode.js").SubGraphNode | import("./nodes/ArrayNode.js").ArrayNode | import("./nodes/ExtractJsonNode.js").ExtractJsonNode | import("./nodes/AssemblePromptNode.js").AssemblePromptNode | import("./nodes/ExtractYamlNode.js").ExtractYamlNode | import("./nodes/LoopControllerNode.js").LoopControllerNode | import("./nodes/TrimChatMessagesNode.js").TrimChatMessagesNode | import("./nodes/ExternalCallNode.js").ExternalCallNode | import("./nodes/ExtractObjectPathNode.js").ExtractObjectPathNode | import("./nodes/RaiseEventNode.js").RaiseEventNode | import("./nodes/ReportProgressNode.js").ReportProgressNode | import("./nodes/ContextNode.js").ContextNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/DidRunNode.js").DidRunNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/DataBusNode.js").DataBusNode | import("./nodes/StartBackgroundBranchNode.js").StartBackgroundBranchNode | import("./nodes/WatchStreamingOutputNode.js").WatchStreamingOutputNode | import("./nodes/StopWatchingStreamingOutputNode.js").StopWatchingStreamingOutputNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | import("./nodes/SetStoredValueNode.js").SetStoredValueNode | import("./nodes/GetStoredValueNode.js").GetStoredValueNode | import("./nodes/WaitForEventNode.js").WaitForEventNode | import("./nodes/ToolNode.js").GptFunctionNode | import("./nodes/ToYamlNode.js").ToYamlNode | import("./nodes/GetEmbeddingNode.js").GetEmbeddingNode | import("./nodes/VectorStoreNode.js").VectorStoreNode | import("./nodes/VectorNearestNeighborsNode.js").VectorNearestNeighborsNode | import("./nodes/KnowledgeSourceNode.js").KnowledgeSourceNode | import("./nodes/KnowledgeDocumentNode.js").KnowledgeDocumentNode | import("./nodes/SyncKnowledgeSourceNode.js").SyncKnowledgeSourceNode | import("./nodes/GetKnowledgeSourceStatusNode.js").GetKnowledgeSourceStatusNode | import("./nodes/SearchKnowledgeNode.js").SearchKnowledgeNode | import("./nodes/BuildKnowledgeContextNode.js").BuildKnowledgeContextNode | import("./nodes/HashNode.js").HashNode | import("./nodes/AbortGraphNode.js").AbortGraphNode | import("./nodes/RaceInputsNode.js").RaceInputsNode | import("./nodes/ToJsonNode.js").ToJsonNode | import("./nodes/JoinNode.js").JoinNode | import("./nodes/FilterNode.js").FilterNode | import("./nodes/JSFilterNode.js").JSFilterNode | import("./nodes/JSMapNode.js").JSMapNode | import("./nodes/ObjectNode.js").ObjectNode | import("./nodes/BooleanNode.js").BooleanNode | import("./nodes/CompareNode.js").CompareNode | import("./nodes/EvaluateNode.js").EvaluateNode | import("./nodes/NumberNode.js").NumberNode | import("./nodes/RandomNumberNode.js").RandomNumberNode | import("./nodes/ShuffleNode.js").ShuffleNode | import("./nodes/CommentNode.js").CommentNode | import("./nodes/ImageNode.js").ImageNode | import("./nodes/AudioNode.js").AudioNode | import("./nodes/HttpCallNode.js").HttpCallNode | import("./nodes/DelayNode.js").DelayNode | import("./nodes/AppendToDatasetNode.js").AppendToDatasetNode | import("./nodes/CreateDatasetNode.js").CreateDatasetNode | import("./nodes/LoadDatasetNode.js").LoadDatasetNode | import("./nodes/GetAllDatasetsNode.js").GetAllDatasetsNode | import("./nodes/SplitNode.js").SplitNode | import("./nodes/DatasetNearestNeigborsNode.js").DatasetNearestNeighborsNode | import("./nodes/GetDatasetRowNode.js").GetDatasetRowNode | import("./nodes/SliceNode.js").SliceNode | import("./nodes/ExtractMarkdownCodeBlocksNode.js").ExtractMarkdownCodeBlocksNode | import("./nodes/AssembleMessageNode.js").AssembleMessageNode | import("./nodes/URLReferenceNode.js").UrlReferenceNode | import("./nodes/DestructureNode.js").DestructureNode | import("./nodes/ReplaceDatasetNode.js").ReplaceDatasetNode | import("./nodes/ListGraphsNode.js").ListGraphsNode | import("./nodes/GraphReferenceNode.js").GraphReferenceNode | import("./nodes/CallGraphNode.js").CallGraphNode | import("./nodes/DelegateFunctionCallNode.js").DelegateFunctionCallNode | import("./nodes/PlayAudioNode.js").PlayAudioNode | import("./nodes/DocumentNode.js").DocumentNode | import("./nodes/ChatLoopNode.js").ChatLoopNode | import("./nodes/ReadAllFilesNode.js").ReadAllFilesNode | import("./nodes/ToMarkdownTableNode.js").ToMarkdownTableNode | import("./nodes/CronNode.js").CronNode | import("./nodes/ToTreeNode.js").ToTreeNode | import("./nodes/LoopUntilNode.js").LoopUntilNode | (import("./NodeBase.js").NodeBase & {
|
|
107
109
|
type: "mcpDiscovery";
|
|
108
110
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
109
111
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
110
112
|
}) | import("./nodes/MCPToolCallNode.js").MCPToolCallNode | import("./nodes/MCPGetPromptNode.js").MCPGetPromptNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode | import("./NodePrefabResolver.js").NodePrefabInstanceNode>;
|
|
111
|
-
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "
|
|
113
|
+
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "setGlobal" | "setStoredValue" | "graphOutput" | "delegateFunctionCall" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "abortGraph" | "prompt" | "llmChatV2" | "userInput" | "llmProfile" | "extractRegex" | "codeNew" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "coalesce" | "didRun" | "passthrough" | "dataBus" | "startBackgroundBranch" | "watchStreamingOutput" | "stopWatchingStreamingOutput" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "knowledgeSource" | "knowledgeDocument" | "syncKnowledgeSource" | "getKnowledgeSourceStatus" | "searchKnowledge" | "buildKnowledgeContext" | "hash" | "raceInputs" | "toJson" | "jsFilter" | "jsMap" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "comment" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "playAudio" | "chatLoop" | "readAllFiles" | "toMarkdownTable" | "cron" | "toTree" | "loopUntil" | "mcpDiscovery" | "mcpToolCall" | "mcpGetPrompt" | "referencedGraphAlias" | "nodePrefabInstance", import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./chat-v2/llmChatV2NodeData.js").LLMChatV2Node | import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./nodes/LLMProfileNode.js").LLMProfileNode | import("./nodes/PromptNode.js").PromptNode | import("./nodes/ExtractRegexNode.js").ExtractRegexNode | import("./nodes/CodeNode.js").CodeNode | import("./nodes/CodeNewNode.js").CodeNewNode | import("./nodes/ExpressionNode.js").ExpressionNode | import("./nodes/MatchNode.js").MatchNode | import("./nodes/IfNode.js").IfNode | import("./nodes/ReadDirectoryNode.js").ReadDirectoryNode | import("./nodes/ReadFileNode.js").ReadFileNode | import("./nodes/IfElseNode.js").IfElseNode | import("./nodes/ChunkNode.js").ChunkNode | import("./nodes/SubGraphNode.js").SubGraphNode | import("./nodes/ArrayNode.js").ArrayNode | import("./nodes/ExtractJsonNode.js").ExtractJsonNode | import("./nodes/AssemblePromptNode.js").AssemblePromptNode | import("./nodes/ExtractYamlNode.js").ExtractYamlNode | import("./nodes/LoopControllerNode.js").LoopControllerNode | import("./nodes/TrimChatMessagesNode.js").TrimChatMessagesNode | import("./nodes/ExternalCallNode.js").ExternalCallNode | import("./nodes/ExtractObjectPathNode.js").ExtractObjectPathNode | import("./nodes/RaiseEventNode.js").RaiseEventNode | import("./nodes/ReportProgressNode.js").ReportProgressNode | import("./nodes/ContextNode.js").ContextNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/DidRunNode.js").DidRunNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/DataBusNode.js").DataBusNode | import("./nodes/StartBackgroundBranchNode.js").StartBackgroundBranchNode | import("./nodes/WatchStreamingOutputNode.js").WatchStreamingOutputNode | import("./nodes/StopWatchingStreamingOutputNode.js").StopWatchingStreamingOutputNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | import("./nodes/SetStoredValueNode.js").SetStoredValueNode | import("./nodes/GetStoredValueNode.js").GetStoredValueNode | import("./nodes/WaitForEventNode.js").WaitForEventNode | import("./nodes/ToolNode.js").GptFunctionNode | import("./nodes/ToYamlNode.js").ToYamlNode | import("./nodes/GetEmbeddingNode.js").GetEmbeddingNode | import("./nodes/VectorStoreNode.js").VectorStoreNode | import("./nodes/VectorNearestNeighborsNode.js").VectorNearestNeighborsNode | import("./nodes/KnowledgeSourceNode.js").KnowledgeSourceNode | import("./nodes/KnowledgeDocumentNode.js").KnowledgeDocumentNode | import("./nodes/SyncKnowledgeSourceNode.js").SyncKnowledgeSourceNode | import("./nodes/GetKnowledgeSourceStatusNode.js").GetKnowledgeSourceStatusNode | import("./nodes/SearchKnowledgeNode.js").SearchKnowledgeNode | import("./nodes/BuildKnowledgeContextNode.js").BuildKnowledgeContextNode | import("./nodes/HashNode.js").HashNode | import("./nodes/AbortGraphNode.js").AbortGraphNode | import("./nodes/RaceInputsNode.js").RaceInputsNode | import("./nodes/ToJsonNode.js").ToJsonNode | import("./nodes/JoinNode.js").JoinNode | import("./nodes/FilterNode.js").FilterNode | import("./nodes/JSFilterNode.js").JSFilterNode | import("./nodes/JSMapNode.js").JSMapNode | import("./nodes/ObjectNode.js").ObjectNode | import("./nodes/BooleanNode.js").BooleanNode | import("./nodes/CompareNode.js").CompareNode | import("./nodes/EvaluateNode.js").EvaluateNode | import("./nodes/NumberNode.js").NumberNode | import("./nodes/RandomNumberNode.js").RandomNumberNode | import("./nodes/ShuffleNode.js").ShuffleNode | import("./nodes/CommentNode.js").CommentNode | import("./nodes/ImageNode.js").ImageNode | import("./nodes/AudioNode.js").AudioNode | import("./nodes/HttpCallNode.js").HttpCallNode | import("./nodes/DelayNode.js").DelayNode | import("./nodes/AppendToDatasetNode.js").AppendToDatasetNode | import("./nodes/CreateDatasetNode.js").CreateDatasetNode | import("./nodes/LoadDatasetNode.js").LoadDatasetNode | import("./nodes/GetAllDatasetsNode.js").GetAllDatasetsNode | import("./nodes/SplitNode.js").SplitNode | import("./nodes/DatasetNearestNeigborsNode.js").DatasetNearestNeighborsNode | import("./nodes/GetDatasetRowNode.js").GetDatasetRowNode | import("./nodes/SliceNode.js").SliceNode | import("./nodes/ExtractMarkdownCodeBlocksNode.js").ExtractMarkdownCodeBlocksNode | import("./nodes/AssembleMessageNode.js").AssembleMessageNode | import("./nodes/URLReferenceNode.js").UrlReferenceNode | import("./nodes/DestructureNode.js").DestructureNode | import("./nodes/ReplaceDatasetNode.js").ReplaceDatasetNode | import("./nodes/ListGraphsNode.js").ListGraphsNode | import("./nodes/GraphReferenceNode.js").GraphReferenceNode | import("./nodes/CallGraphNode.js").CallGraphNode | import("./nodes/DelegateFunctionCallNode.js").DelegateFunctionCallNode | import("./nodes/PlayAudioNode.js").PlayAudioNode | import("./nodes/DocumentNode.js").DocumentNode | import("./nodes/ChatLoopNode.js").ChatLoopNode | import("./nodes/ReadAllFilesNode.js").ReadAllFilesNode | import("./nodes/ToMarkdownTableNode.js").ToMarkdownTableNode | import("./nodes/CronNode.js").CronNode | import("./nodes/ToTreeNode.js").ToTreeNode | import("./nodes/LoopUntilNode.js").LoopUntilNode | (import("./NodeBase.js").NodeBase & {
|
|
112
114
|
type: "mcpDiscovery";
|
|
113
115
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
114
116
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
@@ -301,6 +301,26 @@ export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessCon
|
|
|
301
301
|
getGraphBoundary?: (project: Project, graphId: GraphId | undefined) => GraphBoundary | undefined;
|
|
302
302
|
/** Call when the node has partial data but has not finished execution yet. */
|
|
303
303
|
onPartialOutputs?: (outputs: Outputs) => void;
|
|
304
|
+
/**
|
|
305
|
+
* Internal named graph-boundary channel for Graph Output partials. Unlike
|
|
306
|
+
* onPartialOutputs, this does not create a node-history/recording event;
|
|
307
|
+
* GraphProcessor uses it only to deliver a child boundary value to a parent
|
|
308
|
+
* Watch or another enclosing named Graph Output.
|
|
309
|
+
*/
|
|
310
|
+
onGraphOutputPartial?: (outputs: Outputs) => void;
|
|
311
|
+
/**
|
|
312
|
+
* Internal boundary used only by Stop Watching Streaming Output. The owning
|
|
313
|
+
* GraphProcessor uses this only to verify the live Stop node was reached.
|
|
314
|
+
* It publishes the completed Stop output after its finish event, so split
|
|
315
|
+
* aggregation and ordinary downstream execution use the exact same value.
|
|
316
|
+
*/
|
|
317
|
+
acceptStreamingWatchStop?: () => void;
|
|
318
|
+
/**
|
|
319
|
+
* Preserves display-only outputs for this invocation if it subsequently
|
|
320
|
+
* fails. These values are reported with nodeError, never used as graph
|
|
321
|
+
* results, and must not change the original failure.
|
|
322
|
+
*/
|
|
323
|
+
setFailureOutputs?: (outputs: Outputs) => void;
|
|
304
324
|
/** Creates a subprocessor, for executing subgraphs. */
|
|
305
325
|
createSubProcessor: (subGraphId: GraphId | undefined, options?: {
|
|
306
326
|
signal?: AbortSignal;
|
|
@@ -4,9 +4,10 @@ import type { ChartNode, PortId } from './NodeBase.js';
|
|
|
4
4
|
import type { GraphId } from './NodeGraph.js';
|
|
5
5
|
import type { Project } from './Project.js';
|
|
6
6
|
import type { AttachedNodeData, ExternalFunction, Outputs } from './GraphProcessor.js';
|
|
7
|
-
export type NodeProcessContextBase = Omit<InternalProcessContext, 'attachedData' | 'activeOutputPortIds' | 'createSubProcessor' | 'execution' | 'externalFunctions' | 'getPluginConfig' | 'node' | 'onPartialOutputs' | 'processId' | 'requestUserInput' | 'reportProgress' | 'isDirectRunTarget' | 'markResultAsEditorCacheHit' | 'setGlobal' | 'signal' | 'splitIndex' | 'toolCallContinuation' | 'toolCallTraceSource' | 'waitEvent'>;
|
|
7
|
+
export type NodeProcessContextBase = Omit<InternalProcessContext, 'attachedData' | 'activeOutputPortIds' | 'acceptStreamingWatchStop' | 'createSubProcessor' | 'execution' | 'externalFunctions' | 'getPluginConfig' | 'node' | 'onGraphOutputPartial' | 'onPartialOutputs' | 'setFailureOutputs' | 'processId' | 'requestUserInput' | 'reportProgress' | 'isDirectRunTarget' | 'markResultAsEditorCacheHit' | 'setGlobal' | 'signal' | 'splitIndex' | 'toolCallContinuation' | 'toolCallTraceSource' | 'waitEvent'>;
|
|
8
8
|
export declare function buildNodeProcessContext(options: {
|
|
9
9
|
activeOutputPortIds: ReadonlySet<PortId>;
|
|
10
|
+
acceptStreamingWatchStop?: InternalProcessContext['acceptStreamingWatchStop'];
|
|
10
11
|
base: NodeProcessContextBase;
|
|
11
12
|
attachedData: AttachedNodeData;
|
|
12
13
|
createSubProcessor: (subGraphId: GraphId | undefined, options?: {
|
|
@@ -20,7 +21,9 @@ export declare function buildNodeProcessContext(options: {
|
|
|
20
21
|
markResultAsEditorCacheHit?: InternalProcessContext['markResultAsEditorCacheHit'];
|
|
21
22
|
node: ChartNode;
|
|
22
23
|
nodeAbortController: AbortController;
|
|
24
|
+
onGraphOutputPartial?: (partialOutputs: Outputs) => void;
|
|
23
25
|
onPartialOutputs: (partialOutputs: Outputs) => void;
|
|
26
|
+
setFailureOutputs?: InternalProcessContext['setFailureOutputs'];
|
|
24
27
|
processId: ProcessId;
|
|
25
28
|
requestUserInput: (inputStrings: string[], renderingType: 'text' | 'markdown') => Promise<StringArrayDataValue>;
|
|
26
29
|
reportProgress: InternalProcessContext['reportProgress'];
|
|
@@ -5,6 +5,7 @@ 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
7
|
import type { KnowledgeMetadata, KnowledgeStoreConnectionId } from '../integrations/KnowledgeStore.js';
|
|
8
|
+
import type { ProjectGlobalVariables } from './GlobalVariables.js';
|
|
8
9
|
export type ProjectId = Opaque<string, 'ProjectId'>;
|
|
9
10
|
export type DataId = Opaque<string, 'DataId'>;
|
|
10
11
|
export type NodePrefabId = Opaque<string, 'NodePrefabId'>;
|
|
@@ -28,6 +29,8 @@ export type ProjectMetadata = {
|
|
|
28
29
|
description: string;
|
|
29
30
|
mainGraphId?: GraphId;
|
|
30
31
|
path?: string;
|
|
32
|
+
/** Portable global variables assigned at the beginning of every root project run. */
|
|
33
|
+
globalVariables?: ProjectGlobalVariables;
|
|
31
34
|
mcpServer?: MCP.Config;
|
|
32
35
|
/** Named, non-secret knowledge-store connections available to graphs in this project. */
|
|
33
36
|
knowledgeStores?: Record<KnowledgeStoreConnectionId, KnowledgeStoreConnectionDefinition>;
|
|
@@ -40,7 +43,10 @@ export type KnowledgeStoreConnectionDefinition = {
|
|
|
40
43
|
/** Provider-specific, portable, non-secret configuration. */
|
|
41
44
|
config: KnowledgeMetadata;
|
|
42
45
|
};
|
|
43
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* A reference to another project file. New authored references should remain
|
|
48
|
+
* acyclic, while loaders tolerate legacy back-edges by keeping the first visit.
|
|
49
|
+
*/
|
|
44
50
|
export type ProjectReference = {
|
|
45
51
|
/** The ID of the project being referenced. */
|
|
46
52
|
id: ProjectId;
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import type { Project, ProjectReference } from './Project.js';
|
|
1
|
+
import type { Project, ProjectId, ProjectReference } from './Project.js';
|
|
2
2
|
export type ProjectReferenceLoader = {
|
|
3
3
|
/** Loads a project based on the given reference. */
|
|
4
4
|
loadProject: (currentProjectPath: string | undefined, reference: ProjectReference) => Promise<Project>;
|
|
5
5
|
};
|
|
6
|
+
/** The root information needed to load its complete referenced-project closure. */
|
|
7
|
+
export type ProjectReferenceRoot = {
|
|
8
|
+
metadata: Pick<Project['metadata'], 'id'>;
|
|
9
|
+
references?: ProjectReference[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Loads referenced projects depth-first in declared order.
|
|
13
|
+
*
|
|
14
|
+
* The active root is already in memory, so it is visited before traversing
|
|
15
|
+
* references. This keeps legacy cycles compatible without asking a loader to
|
|
16
|
+
* resolve the active project again. The returned record intentionally omits
|
|
17
|
+
* that root; callers already own the authoritative root snapshot.
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadProjectReferenceTree(rootProject: ProjectReferenceRoot, rootProjectPath: string | undefined, loader: ProjectReferenceLoader): Promise<Record<ProjectId, Project>>;
|
|
@@ -12,7 +12,8 @@ export type SplitRunDeps = {
|
|
|
12
12
|
accumulateCost(output: Outputs): void;
|
|
13
13
|
setNodeResults(nodeId: ChartNode['id'], outputs: Outputs): void;
|
|
14
14
|
markNodeVisited(nodeId: ChartNode['id']): void;
|
|
15
|
-
nodeErrored(node: ChartNode, error: unknown, processId: ProcessId, durationMs?: number, splitRunDurationMs?: Record<number, number>, resultOrigin?: SplitRunResultOrigin): Promise<void>;
|
|
15
|
+
nodeErrored(node: ChartNode, error: unknown, processId: ProcessId, durationMs?: number, splitRunDurationMs?: Record<number, number>, resultOrigin?: SplitRunResultOrigin, splitOutputs?: Record<number, Outputs>): Promise<void>;
|
|
16
|
+
takeFailureOutputs(processId: ProcessId, index: number): Outputs | undefined;
|
|
16
17
|
isAborted(): boolean;
|
|
17
18
|
getAbortError(): Error;
|
|
18
19
|
emit(event: 'nodeStart', data: {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Outputs } from './GraphProcessor.js';
|
|
2
|
+
export type StreamingOutputWatchSnapshot = {
|
|
3
|
+
outputs: Outputs;
|
|
4
|
+
/**
|
|
5
|
+
* Immutable increment storage shared by snapshots. The owning GraphProcessor
|
|
6
|
+
* materializes this cumulative output only for a branch that actually starts.
|
|
7
|
+
*/
|
|
8
|
+
streamedOutput?: readonly unknown[];
|
|
9
|
+
streamedOutputLength?: number;
|
|
10
|
+
updateIndex: number;
|
|
11
|
+
isFinal: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type StreamingOutputWatchRuntimeSummary = {
|
|
14
|
+
receivedUpdates: number;
|
|
15
|
+
coalescedUpdates: number;
|
|
16
|
+
droppedUpdates: number;
|
|
17
|
+
maximumQueuedUpdates: number;
|
|
18
|
+
/** A coordinator failure that is not necessarily a failed child iteration. */
|
|
19
|
+
failureKind?: StreamingOutputWatchFailureKind;
|
|
20
|
+
};
|
|
21
|
+
export type StreamingOutputWatchFailureKind = 'branch-failure' | 'missing-stop' | 'queue-overflow';
|
|
22
|
+
export type StreamingOutputWatchOptions = {
|
|
23
|
+
triggerMode: 'every-update' | 'interval';
|
|
24
|
+
intervalMs: number;
|
|
25
|
+
executionMode: 'sequential' | 'parallel';
|
|
26
|
+
maxParallelRuns: number;
|
|
27
|
+
maxQueuedUpdates: number;
|
|
28
|
+
queueOverflowBehavior: 'drop' | 'fail';
|
|
29
|
+
};
|
|
30
|
+
/** Defaults shared by the persisted node definition and the runtime boundary. */
|
|
31
|
+
export declare const streamingOutputWatchDefaults: {
|
|
32
|
+
readonly intervalMs: 1000;
|
|
33
|
+
readonly maxParallelRuns: 4;
|
|
34
|
+
readonly maxQueuedUpdates: 32;
|
|
35
|
+
readonly queueOverflowBehavior: "fail";
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Hard safety bounds for persisted settings. The node editor exposes the same
|
|
39
|
+
* limits, but the runtime must also defend against manually edited project data.
|
|
40
|
+
*/
|
|
41
|
+
export declare const streamingOutputWatchLimits: {
|
|
42
|
+
readonly intervalMs: 3600000;
|
|
43
|
+
readonly maxParallelRuns: 32;
|
|
44
|
+
readonly maxQueuedUpdates: 1024;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Owns bounded, cancellable delivery of a streaming node's immutable output
|
|
48
|
+
* snapshots. It deliberately knows nothing about graph topology: the owning
|
|
49
|
+
* GraphProcessor decides how a snapshot runs and whether accepting Stop is
|
|
50
|
+
* required to complete the watch.
|
|
51
|
+
*/
|
|
52
|
+
export declare class StreamingOutputWatch {
|
|
53
|
+
#private;
|
|
54
|
+
constructor(options: Partial<StreamingOutputWatchOptions>, run: (snapshot: StreamingOutputWatchSnapshot, registerCancel: (cancel: () => void) => void) => Promise<void>, onFailure: (error: Error) => void, { requiresAcceptedStop }?: {
|
|
55
|
+
requiresAcceptedStop?: boolean;
|
|
56
|
+
});
|
|
57
|
+
get hasPending(): boolean;
|
|
58
|
+
get isAwaitingProducer(): boolean;
|
|
59
|
+
get stopped(): boolean;
|
|
60
|
+
/** True only after this Watch can no longer receive or run a snapshot. */
|
|
61
|
+
get isSettled(): boolean;
|
|
62
|
+
get runtimeSummary(): StreamingOutputWatchRuntimeSummary;
|
|
63
|
+
/**
|
|
64
|
+
* A Stop boundary can enqueue ordinary parent-graph work when its node
|
|
65
|
+
* completes. Until it settles, its result is not safe to expose
|
|
66
|
+
* through the foreground-output boundary.
|
|
67
|
+
*/
|
|
68
|
+
get canAffectForegroundOutputs(): boolean;
|
|
69
|
+
publish(snapshot: StreamingOutputWatchSnapshot): void;
|
|
70
|
+
finish(finalSnapshot: StreamingOutputWatchSnapshot): void;
|
|
71
|
+
/** Preserve the winning invocation's siblings; later owner cancellation cancels all. */
|
|
72
|
+
stop(acceptedUpdateIndex?: number): void;
|
|
73
|
+
drain(): Promise<void>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ProcessEvents } from './GraphProcessor.js';
|
|
2
|
+
import type { GraphRunId } from './ProcessContext.js';
|
|
3
|
+
import type { StreamingOutputWatchRuntimeSummary } from './StreamingOutputWatch.js';
|
|
4
|
+
/** The number of early Watch iterations retained as representative evidence. */
|
|
5
|
+
export declare const streamingOutputWatchRetainedInitialIterations = 3;
|
|
6
|
+
export type StreamingOutputWatchHistorySummary = StreamingOutputWatchRuntimeSummary & {
|
|
7
|
+
completedIterations: number;
|
|
8
|
+
failedIterations: number;
|
|
9
|
+
cancelledIterations: number;
|
|
10
|
+
omittedIterations: number;
|
|
11
|
+
retainedIterationUpdateIndexes: number[];
|
|
12
|
+
selectedIteration?: {
|
|
13
|
+
updateIndex: number;
|
|
14
|
+
reason: 'failure' | 'stop' | 'latest';
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type ForwardedEvent = {
|
|
18
|
+
[K in keyof ProcessEvents]: {
|
|
19
|
+
event: K;
|
|
20
|
+
data: ProcessEvents[K];
|
|
21
|
+
occurredAt: number;
|
|
22
|
+
};
|
|
23
|
+
}[keyof ProcessEvents];
|
|
24
|
+
type Iteration = {
|
|
25
|
+
graphRunId: GraphRunId;
|
|
26
|
+
ordinal: number;
|
|
27
|
+
updateIndex: number;
|
|
28
|
+
events: ForwardedEvent[];
|
|
29
|
+
completed: boolean;
|
|
30
|
+
failed: boolean;
|
|
31
|
+
cancelled: boolean;
|
|
32
|
+
retainedImmediately: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type StreamingOutputWatchHistoryIteration = Readonly<Pick<Iteration, 'graphRunId' | 'ordinal' | 'updateIndex'>>;
|
|
35
|
+
export type StreamingOutputWatchHistoryOptions = {
|
|
36
|
+
/** Internal clock injection keeps deferred-event timestamp tests deterministic. */
|
|
37
|
+
now?: () => number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Retains only useful Watch branch evidence before it reaches the outer event
|
|
41
|
+
* emitter. The first three started iterations are delivered live. Later
|
|
42
|
+
* iterations are held only while they can still become the first failure, a
|
|
43
|
+
* Stop winner, or the final/latest iteration. This bounds editor history and
|
|
44
|
+
* recordings without changing the branch's actual execution.
|
|
45
|
+
*/
|
|
46
|
+
export declare class StreamingOutputWatchHistory {
|
|
47
|
+
#private;
|
|
48
|
+
constructor({ now }?: StreamingOutputWatchHistoryOptions);
|
|
49
|
+
start(graphRunId: GraphRunId, updateIndex: number): StreamingOutputWatchHistoryIteration;
|
|
50
|
+
forward<K extends keyof ProcessEvents>(iteration: StreamingOutputWatchHistoryIteration, event: K, data: ProcessEvents[K], forward: (event: K, data: ProcessEvents[K]) => Promise<void>): Promise<void> | undefined;
|
|
51
|
+
complete(iteration: StreamingOutputWatchHistoryIteration): void;
|
|
52
|
+
fail(iteration: StreamingOutputWatchHistoryIteration): void;
|
|
53
|
+
cancel(iteration: StreamingOutputWatchHistoryIteration): void;
|
|
54
|
+
acceptStop(iteration: StreamingOutputWatchHistoryIteration): void;
|
|
55
|
+
get hasAcceptedStop(): boolean;
|
|
56
|
+
finalize(runtime: StreamingOutputWatchRuntimeSummary, forward: <K extends keyof ProcessEvents>(event: K, data: ProcessEvents[K]) => Promise<void>): Promise<StreamingOutputWatchHistorySummary>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -5,6 +5,8 @@ export declare function wireSubprocessorEvents(processor: GraphProcessor, parent
|
|
|
5
5
|
isPaused: () => boolean;
|
|
6
6
|
pause: () => void;
|
|
7
7
|
resume: () => void;
|
|
8
|
+
/** Intercepts forwarded child evidence before it reaches outer observers. */
|
|
9
|
+
forwardEvent?: <K extends keyof ProcessEvents>(event: K, data: ProcessEvents[K]) => Promise<void> | undefined;
|
|
8
10
|
}): () => void;
|
|
9
11
|
export declare function wireSubprocessorLifecycle(processor: GraphProcessor, options: {
|
|
10
12
|
autoCleanup?: boolean;
|