@valerypopoff/rivet2-core 2.12.0 → 2.13.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 +781 -245
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/esm/exports.js +1 -0
- package/dist/esm/model/GraphInputStream.js +70 -0
- package/dist/esm/model/GraphProcessor.js +257 -16
- package/dist/esm/model/NodeExecutionPlanner.js +4 -4
- package/dist/esm/model/Nodes.js +3 -0
- package/dist/esm/model/ProcessContextBuilder.js +2 -1
- package/dist/esm/model/StreamingOutputWatch.js +5 -0
- package/dist/esm/model/StreamingWatchTopology.js +191 -0
- package/dist/esm/model/nodes/AssembleMessageNode.js +2 -2
- package/dist/esm/model/nodes/AssemblePromptNode.js +46 -17
- package/dist/esm/model/nodes/GraphInputNode.js +15 -19
- package/dist/esm/model/nodes/MatchCaseNode.js +2 -2
- package/dist/esm/model/nodes/ProjectNameNode.js +37 -0
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +1 -0
- package/dist/esm/model/nodes/SubGraphNode.js +1 -0
- package/dist/esm/model/nodes/variadicPortIndex.js +1 -1
- package/dist/types/exports.d.ts +2 -0
- package/dist/types/model/GraphInputStream.d.ts +23 -0
- package/dist/types/model/GraphProcessor.d.ts +3 -0
- package/dist/types/model/NodeExecutionPlanner.d.ts +1 -1
- package/dist/types/model/Nodes.d.ts +3 -2
- package/dist/types/model/ProcessContext.d.ts +3 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +2 -1
- package/dist/types/model/StreamingOutputWatch.d.ts +2 -0
- package/dist/types/model/StreamingWatchTopology.d.ts +20 -0
- package/dist/types/model/nodes/AssemblePromptNode.d.ts +4 -3
- package/dist/types/model/nodes/GraphInputNode.d.ts +2 -0
- package/dist/types/model/nodes/MatchCaseNode.d.ts +1 -1
- package/dist/types/model/nodes/ProjectNameNode.d.ts +12 -0
- package/dist/types/model/nodes/variadicPortIndex.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import type { Tokenizer } from '../integrations/Tokenizer.js';
|
|
|
4
4
|
import type { CodeRunner } from '../integrations/CodeRunner.js';
|
|
5
5
|
import type { ProjectReferenceLoader } from './ProjectReferenceLoader.js';
|
|
6
6
|
import type { GraphBoundary } from './GraphBoundaryCache.js';
|
|
7
|
+
import type { GraphInputStream } from './GraphInputStream.js';
|
|
7
8
|
import type { GraphProgress } from './GraphProgress.js';
|
|
8
9
|
import type { CustomProviderApi } from './chat-v2/customProviderApi.js';
|
|
9
10
|
import type { RivetStoredValue, RivetStoredValueCacheResult, RivetStoredValueReadResult, RivetStoredValueSetResult } from './StoredValueStore.js';
|
|
@@ -239,6 +240,8 @@ export type GraphExecutionMetadata = {
|
|
|
239
240
|
evaluation?: EvaluationExecutionMetadata;
|
|
240
241
|
};
|
|
241
242
|
export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessContext & {
|
|
243
|
+
/** Invocation-scoped live inputs for a named graph caller. Never serialized. */
|
|
244
|
+
graphInputStreams?: Readonly<Record<string, GraphInputStream>>;
|
|
242
245
|
/** The executor that is running the current processor. */
|
|
243
246
|
executor: 'nodejs' | 'browser';
|
|
244
247
|
/** The project being executed. */
|
|
@@ -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' | 'acceptStreamingWatchStop' | 'createSubProcessor' | 'execution' | 'externalFunctions' | 'getPluginConfig' | 'node' | 'onGraphOutputPartial' | 'onPartialOutputs' | 'setFailureOutputs' | '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' | 'graphInputStreams' | '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
10
|
acceptStreamingWatchStop?: InternalProcessContext['acceptStreamingWatchStop'];
|
|
@@ -22,6 +22,7 @@ export declare function buildNodeProcessContext(options: {
|
|
|
22
22
|
node: ChartNode;
|
|
23
23
|
nodeAbortController: AbortController;
|
|
24
24
|
onGraphOutputPartial?: (partialOutputs: Outputs) => void;
|
|
25
|
+
graphInputStreams?: InternalProcessContext['graphInputStreams'];
|
|
25
26
|
onPartialOutputs: (partialOutputs: Outputs) => void;
|
|
26
27
|
setFailureOutputs?: InternalProcessContext['setFailureOutputs'];
|
|
27
28
|
processId: ProcessId;
|
|
@@ -55,6 +55,8 @@ export declare const streamingOutputWatchLimits: {
|
|
|
55
55
|
export declare class StreamingOutputWatch {
|
|
56
56
|
#private;
|
|
57
57
|
constructor(options: Partial<StreamingOutputWatchOptions>, run: (snapshot: StreamingOutputWatchSnapshot, registerCancel: (cancel: () => void) => void) => Promise<void>, onFailure: (error: Error) => void);
|
|
58
|
+
/** Updates superseded before the receiving graph could start. */
|
|
59
|
+
accountCoalescedUpdates(count: number): void;
|
|
58
60
|
get hasPending(): boolean;
|
|
59
61
|
get isAwaitingProducer(): boolean;
|
|
60
62
|
get stopped(): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ChartNode, NodeConnection, NodeId } from './NodeBase.js';
|
|
2
|
+
import type { FrozenNodeOutputsByGraph } from './GraphProcessor.js';
|
|
3
|
+
import type { GraphInputNode } from './nodes/GraphInputNode.js';
|
|
4
|
+
import type { NodeGraph } from './NodeGraph.js';
|
|
5
|
+
import type { NodeRegistration } from './NodeRegistration.js';
|
|
6
|
+
import type { Project, ProjectId } from './Project.js';
|
|
7
|
+
import type { ReferencedGraphAliasNode } from './nodes/ReferencedGraphAliasNode.js';
|
|
8
|
+
import type { SubGraphNode } from './nodes/SubGraphNode.js';
|
|
9
|
+
export declare function canStreamThroughGraphCaller(node: ChartNode): node is SubGraphNode | ReferencedGraphAliasNode;
|
|
10
|
+
export declare function canStreamThroughGraphInput(node: ChartNode): node is GraphInputNode;
|
|
11
|
+
/** Trace Watch demand through named boundaries without making ordinary nodes repeatable. */
|
|
12
|
+
export declare function getProjectStreamingOutputWatchConnections({ project, graph, referencedProjects, registry, frozenNodeOutputs, isNodeFrozen, fullGraphCallers, }: {
|
|
13
|
+
project: Project;
|
|
14
|
+
graph: NodeGraph;
|
|
15
|
+
referencedProjects: Record<ProjectId, Project>;
|
|
16
|
+
registry: NodeRegistration<any, any>;
|
|
17
|
+
frozenNodeOutputs?: FrozenNodeOutputsByGraph;
|
|
18
|
+
isNodeFrozen?: (owner: Project, candidate: NodeGraph, node: ChartNode) => boolean;
|
|
19
|
+
fullGraphCallers?: ReadonlySet<NodeId>;
|
|
20
|
+
}): ReadonlySet<NodeConnection>;
|
|
@@ -2,11 +2,12 @@ import { type ChartNode, type NodeConnection, type NodeInputDefinition, type Nod
|
|
|
2
2
|
import { NodeImpl, type NodeBody, type NodeUIData } from '../NodeImpl.js';
|
|
3
3
|
import { type Inputs, type Outputs } from '../GraphProcessor.js';
|
|
4
4
|
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
5
|
-
import type { RivetUIContext } from '../RivetUIContext.js';
|
|
6
5
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
7
6
|
export type AssemblePromptNode = ChartNode<'assemblePrompt', AssemblePromptNodeData>;
|
|
8
7
|
export type AssemblePromptNodeData = {
|
|
9
8
|
computeTokenCount?: boolean;
|
|
9
|
+
/** Remove messages that contain no meaningful text or rich content. */
|
|
10
|
+
filterEmptyPrompts?: boolean;
|
|
10
11
|
isLastMessageCacheBreakpoint?: boolean;
|
|
11
12
|
useIsLastMessageCacheBreakpointInput?: boolean;
|
|
12
13
|
};
|
|
@@ -15,8 +16,8 @@ export declare class AssemblePromptNodeImpl extends NodeImpl<AssemblePromptNode>
|
|
|
15
16
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
16
17
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
17
18
|
static getUIData(): NodeUIData;
|
|
18
|
-
getEditors(
|
|
19
|
-
getBody(
|
|
19
|
+
getEditors(): EditorDefinition<AssemblePromptNode>[];
|
|
20
|
+
getBody(): NodeBody | Promise<NodeBody>;
|
|
20
21
|
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
21
22
|
}
|
|
22
23
|
export declare const assemblePromptNode: import("../NodeDefinition.js").NodeDefinition<AssemblePromptNode>;
|
|
@@ -21,4 +21,6 @@ export declare class GraphInputNodeImpl extends NodeImpl<GraphInputNode> {
|
|
|
21
21
|
static getUIData(): NodeUIData;
|
|
22
22
|
process(inputs: Inputs, context: InternalProcessContext): Promise<Record<string, DataValue>>;
|
|
23
23
|
}
|
|
24
|
+
/** One coercion/default policy for ordinary and live graph inputs. */
|
|
25
|
+
export declare function resolveGraphInputValue(data: GraphInputNodeData, input: DataValue | undefined, inputs?: Inputs): DataValue;
|
|
24
26
|
export declare const graphInputNode: import("../NodeDefinition.js").NodeDefinition<GraphInputNode>;
|
|
@@ -26,7 +26,7 @@ export declare class MatchCaseNodeImpl extends MatchCaseNodeBase<MatchCaseNode>
|
|
|
26
26
|
value: boolean;
|
|
27
27
|
label: string;
|
|
28
28
|
}[];
|
|
29
|
-
protected readonly sharedCustomValueInputTitle = "
|
|
29
|
+
protected readonly sharedCustomValueInputTitle = "Output value";
|
|
30
30
|
protected readonly triggerEditorLabel = "Trigger";
|
|
31
31
|
static create(): MatchCaseNode;
|
|
32
32
|
protected matchesCase(input: string, caseValue: string): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChartNode, EditorDefinition, Inputs, InternalProcessContext, NodeInputDefinition, NodeOutputDefinition, NodeUIData, Outputs } from '../../index.js';
|
|
2
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
3
|
+
export type ProjectNameNode = ChartNode<'projectName', Record<string, never>>;
|
|
4
|
+
export declare class ProjectNameNodeImpl extends NodeImpl<ProjectNameNode> {
|
|
5
|
+
static create(): ProjectNameNode;
|
|
6
|
+
getInputDefinitions(): NodeInputDefinition[];
|
|
7
|
+
getOutputDefinitions(): NodeOutputDefinition[];
|
|
8
|
+
getEditors(): EditorDefinition<ProjectNameNode>[];
|
|
9
|
+
static getUIData(): NodeUIData;
|
|
10
|
+
process(_inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
11
|
+
}
|
|
12
|
+
export declare const projectNameNode: import("../NodeDefinition.js").NodeDefinition<ProjectNameNode>;
|
|
@@ -2,3 +2,4 @@ import type { NodeConnection, NodeId } from '../NodeBase.js';
|
|
|
2
2
|
export type VariadicPortIndexPolicy = 'legacy' | 'decimal' | 'strict-positive';
|
|
3
3
|
export declare function getHighestVariadicPortIndex(connections: readonly NodeConnection[], inputNodeId: NodeId, prefix: string, policy: VariadicPortIndexPolicy): number;
|
|
4
4
|
export declare function getNextVariadicPortIndex(connections: readonly NodeConnection[], inputNodeId: NodeId, prefix: string, policy: VariadicPortIndexPolicy): number;
|
|
5
|
+
export declare function parseVariadicPortIndex(portId: string, prefix: string, policy: VariadicPortIndexPolicy): number | undefined;
|