@valerypopoff/rivet2-core 2.0.11 → 2.1.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 +1555 -172
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/esm/exports.js +4 -0
- package/dist/esm/model/GraphBoundaryCache.js +36 -4
- package/dist/esm/model/GraphBoundaryEffects.js +32 -0
- package/dist/esm/model/GraphPreprocessor.js +6 -4
- package/dist/esm/model/GraphProcessor.js +129 -17
- package/dist/esm/model/NodeGraph.js +1 -1
- package/dist/esm/model/NodePrefabResolver.js +57 -0
- package/dist/esm/model/Nodes.js +4 -1
- package/dist/esm/model/ProcessContextBuilder.js +3 -1
- package/dist/esm/model/UiGraph.js +113 -0
- package/dist/esm/model/UiGraphRendererStyles.js +208 -0
- package/dist/esm/model/chat/openAIChatRuntime.js +0 -1
- package/dist/esm/model/chat-v2/aiSdkBridge.js +100 -2
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +35 -31
- package/dist/esm/model/chat-v2/chatV2Shared.js +1 -1
- package/dist/esm/model/chat-v2/providerOptions.js +5 -1
- package/dist/esm/model/nodes/CoalesceNode.js +1 -1
- package/dist/esm/model/nodes/CompareNode.js +15 -14
- package/dist/esm/model/nodes/GraphOutputNode.js +1 -0
- package/dist/esm/model/nodes/LLMChatV2Node.js +62 -17
- package/dist/esm/model/nodes/NodePrefabInstanceNode.js +39 -0
- package/dist/esm/model/nodes/PromptNode.js +2 -1
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +49 -7
- package/dist/esm/model/nodes/SubGraphNode.js +42 -5
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/utils/jsonValueToDataValue.js +48 -0
- package/dist/esm/utils/projectComparison/connections.js +57 -0
- package/dist/esm/utils/projectComparison/graphs.js +60 -0
- package/dist/esm/utils/projectComparison/nodes.js +53 -0
- package/dist/esm/utils/projectComparison/summaries.js +60 -0
- package/dist/esm/utils/projectComparison/values.js +40 -0
- package/dist/esm/utils/projectComparison.js +73 -0
- package/dist/esm/utils/serialization/serializationHelpers.js +24 -3
- package/dist/esm/utils/serialization/serialization_v4.js +30 -0
- package/dist/types/exports.d.ts +5 -0
- package/dist/types/model/EditorDefinition.d.ts +1 -0
- package/dist/types/model/ExecutorProtocol.d.ts +13 -3
- package/dist/types/model/GraphBoundaryCache.d.ts +9 -3
- package/dist/types/model/GraphBoundaryEffects.d.ts +9 -0
- package/dist/types/model/GraphProcessor.d.ts +15 -0
- package/dist/types/model/NodeBase.d.ts +5 -0
- package/dist/types/model/NodeBodySpec.d.ts +1 -0
- package/dist/types/model/NodePrefabResolver.d.ts +13 -0
- package/dist/types/model/Nodes.d.ts +5 -4
- package/dist/types/model/ProcessContext.d.ts +5 -1
- package/dist/types/model/ProcessContextBuilder.d.ts +4 -2
- package/dist/types/model/Project.d.ts +9 -0
- package/dist/types/model/UiGraph.d.ts +84 -0
- package/dist/types/model/UiGraphRendererStyles.d.ts +2 -0
- package/dist/types/model/chat-v2/aiSdkBridge.d.ts +1 -0
- package/dist/types/model/chat-v2/chatV2Types.d.ts +23 -1
- package/dist/types/model/nodes/CompareNode.d.ts +4 -0
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +2 -1
- package/dist/types/model/nodes/NodePrefabInstanceNode.d.ts +13 -0
- package/dist/types/model/nodes/SubGraphNode.d.ts +2 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/jsonValueToDataValue.d.ts +2 -0
- package/dist/types/utils/projectComparison/connections.d.ts +5 -0
- package/dist/types/utils/projectComparison/graphs.d.ts +3 -0
- package/dist/types/utils/projectComparison/nodes.d.ts +5 -0
- package/dist/types/utils/projectComparison/summaries.d.ts +4 -0
- package/dist/types/utils/projectComparison/values.d.ts +5 -0
- package/dist/types/utils/projectComparison.d.ts +77 -0
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { streamText, LanguageModelUsage, ModelMessage, TextStreamPart, ToolSet } from 'ai';
|
|
1
|
+
import type { generateText, streamText, LanguageModelUsage, ModelMessage, TextStreamPart, ToolSet } from 'ai';
|
|
2
2
|
import type { ChatMessage, GptFunction } from '../DataValue.js';
|
|
3
3
|
import type { Outputs } from '../GraphProcessor.js';
|
|
4
4
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
5
5
|
import type { AssistantMessageFunctionCallMode, StreamedFunctionCall } from '../chat/streamChatResponse.js';
|
|
6
6
|
type StreamTextArgs = Parameters<typeof streamText>[0];
|
|
7
|
+
type GenerateTextArgs = Parameters<typeof generateText>[0];
|
|
7
8
|
type MaybePromiseLike<T> = T | PromiseLike<T>;
|
|
8
9
|
export type ChatV2Provider = 'openai' | 'anthropic' | 'google' | 'custom';
|
|
9
10
|
export type ChatV2Model = StreamTextArgs['model'];
|
|
@@ -33,6 +34,25 @@ export type ChatV2StreamHandle = {
|
|
|
33
34
|
usage?: MaybePromiseLike<LanguageModelUsage | undefined> | undefined;
|
|
34
35
|
};
|
|
35
36
|
export type ChatV2StreamExecutor = (args: StreamTextArgs) => ChatV2StreamHandle | Promise<ChatV2StreamHandle>;
|
|
37
|
+
export type ChatV2GenerateHandle = {
|
|
38
|
+
text: string;
|
|
39
|
+
output?: unknown;
|
|
40
|
+
toolCalls?: Array<{
|
|
41
|
+
toolCallId: string;
|
|
42
|
+
toolName: string;
|
|
43
|
+
input: unknown;
|
|
44
|
+
}>;
|
|
45
|
+
finishReason?: MaybePromiseLike<string | undefined> | undefined;
|
|
46
|
+
reasoningText?: MaybePromiseLike<string | undefined> | undefined;
|
|
47
|
+
reasoning?: MaybePromiseLike<Array<{
|
|
48
|
+
text: string;
|
|
49
|
+
}> | undefined> | undefined;
|
|
50
|
+
providerMetadata?: MaybePromiseLike<ChatV2ProviderMetadata | undefined> | undefined;
|
|
51
|
+
requestStatus?: MaybePromiseLike<number | undefined> | undefined;
|
|
52
|
+
totalUsage?: MaybePromiseLike<LanguageModelUsage | undefined> | undefined;
|
|
53
|
+
usage?: MaybePromiseLike<LanguageModelUsage | undefined> | undefined;
|
|
54
|
+
};
|
|
55
|
+
export type ChatV2GenerateExecutor = (args: GenerateTextArgs) => ChatV2GenerateHandle | Promise<ChatV2GenerateHandle>;
|
|
36
56
|
export type StreamChatV2Options = {
|
|
37
57
|
model: ChatV2Model;
|
|
38
58
|
messages: ChatV2MessageList;
|
|
@@ -51,6 +71,7 @@ export type StreamChatV2Options = {
|
|
|
51
71
|
toolChoice?: ChatV2ToolChoice | undefined;
|
|
52
72
|
abortSignal?: AbortSignal | undefined;
|
|
53
73
|
executeStream?: ChatV2StreamExecutor | undefined;
|
|
74
|
+
executeGenerate?: ChatV2GenerateExecutor | undefined;
|
|
54
75
|
onPartialOutput?: ((partial: {
|
|
55
76
|
text: string;
|
|
56
77
|
functionCalls: StreamedFunctionCall[];
|
|
@@ -98,6 +119,7 @@ export type RunChatV2PipelineOptions = {
|
|
|
98
119
|
retryOnNon200CooldownMs?: number | undefined;
|
|
99
120
|
context: Pick<InternalProcessContext, 'signal' | 'onPartialOutputs'>;
|
|
100
121
|
executeStream?: ChatV2StreamExecutor | undefined;
|
|
122
|
+
executeGenerate?: ChatV2GenerateExecutor | undefined;
|
|
101
123
|
};
|
|
102
124
|
export type ChatV2PipelineResult = {
|
|
103
125
|
commonOutputs: Outputs;
|
|
@@ -7,6 +7,10 @@ export type CompareNodeData = {
|
|
|
7
7
|
comparisonFunction: '==' | '<' | '>' | '<=' | '>=' | '!=' | 'and' | 'or' | 'xor' | 'nand' | 'nor' | 'xnor';
|
|
8
8
|
useComparisonFunctionInput?: boolean;
|
|
9
9
|
};
|
|
10
|
+
export declare const compareNodeComparisonFunctionOptions: Array<{
|
|
11
|
+
label: string;
|
|
12
|
+
value: CompareNodeData['comparisonFunction'];
|
|
13
|
+
}>;
|
|
10
14
|
export declare class CompareNodeImpl extends NodeImpl<CompareNode> {
|
|
11
15
|
static create(): CompareNode;
|
|
12
16
|
getInputDefinitions(): NodeInputDefinition[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
2
2
|
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
3
3
|
import type { NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
4
|
+
import type { NodeBodySpec } from '../NodeBodySpec.js';
|
|
4
5
|
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
5
6
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
6
7
|
import type { RivetUIContext } from '../RivetUIContext.js';
|
|
@@ -14,7 +15,7 @@ export declare class LLMChatV2NodeImpl extends NodeImpl<LLMChatV2Node> {
|
|
|
14
15
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
15
16
|
static getUIData(): NodeUIData;
|
|
16
17
|
getEditors(context: RivetUIContext): Promise<EditorDefinition<LLMChatV2Node>[]>;
|
|
17
|
-
getBody():
|
|
18
|
+
getBody(): NodeBodySpec;
|
|
18
19
|
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
19
20
|
}
|
|
20
21
|
export declare const llmChatV2Node: import("../NodeDefinition.js").NodeDefinition<LLMChatV2Node>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Inputs, type Outputs } from '../GraphProcessor.js';
|
|
2
|
+
import { type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
|
|
3
|
+
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
4
|
+
import { type NodePrefabInstanceNode, type NodePrefabInstanceNodeData } from '../NodePrefabResolver.js';
|
|
5
|
+
export type { NodePrefabInstanceNode, NodePrefabInstanceNodeData };
|
|
6
|
+
export declare class NodePrefabInstanceNodeImpl extends NodeImpl<NodePrefabInstanceNode> {
|
|
7
|
+
static create(): NodePrefabInstanceNode;
|
|
8
|
+
getInputDefinitions(): NodeInputDefinition[];
|
|
9
|
+
getOutputDefinitions(): NodeOutputDefinition[];
|
|
10
|
+
process(_inputData: Inputs): Promise<Outputs>;
|
|
11
|
+
static getUIData(): NodeUIData;
|
|
12
|
+
}
|
|
13
|
+
export declare const nodePrefabInstanceNode: import("../NodeDefinition.js").NodeDefinition<NodePrefabInstanceNode>;
|
|
@@ -15,6 +15,8 @@ export type SubGraphNode = ChartNode & {
|
|
|
15
15
|
useAsGraphPartialOutput?: boolean;
|
|
16
16
|
/** Data for each of the inputs of the subgraph */
|
|
17
17
|
inputData?: Record<string, DataValue>;
|
|
18
|
+
inputPortOrder?: string[];
|
|
19
|
+
outputPortOrder?: string[];
|
|
18
20
|
};
|
|
19
21
|
};
|
|
20
22
|
export declare class SubGraphNodeImpl extends NodeImpl<SubGraphNode> {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ChartNode, NodeConnection } from '../../model/NodeBase.js';
|
|
2
|
+
import type { ProjectConnectionComparison } from '../projectComparison.js';
|
|
3
|
+
export declare function getProjectConnectionComparisonKey(connection: NodeConnection): string;
|
|
4
|
+
export declare function getComparableGraphConnections(connections: NodeConnection[], nodes: ChartNode[]): NodeConnection[];
|
|
5
|
+
export declare function compareConnections(beforeConnections: NodeConnection[], afterConnections: NodeConnection[]): Record<string, ProjectConnectionComparison>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GraphId, NodeGraph } from '../../model/NodeGraph.js';
|
|
2
|
+
import type { ProjectGraphComparison } from '../projectComparison.js';
|
|
3
|
+
export declare function compareGraphs(id: GraphId, before: NodeGraph | undefined, after: NodeGraph | undefined): ProjectGraphComparison;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ChartNode, NodeId } from '../../model/NodeBase.js';
|
|
2
|
+
import type { ProjectNodeComparison, ProjectNodeFieldComparison } from '../projectComparison.js';
|
|
3
|
+
export declare function getProjectNodeFieldComparisons(comparison: ProjectNodeComparison): ProjectNodeFieldComparison[];
|
|
4
|
+
export declare function getComparableGraphNodes(nodes: ChartNode[]): ChartNode[];
|
|
5
|
+
export declare function compareNodes(beforeNodes: ChartNode[], afterNodes: ChartNode[]): Record<NodeId, ProjectNodeComparison>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeId } from '../../model/NodeBase.js';
|
|
2
|
+
import type { ProjectConnectionComparison, ProjectComparison, ProjectGraphComparison, ProjectNodePrefabComparison, ProjectNodeComparison, ProjectUiGraphComparison } from '../projectComparison.js';
|
|
3
|
+
export declare function summarizeProjectComparison(graphs: Record<ProjectGraphComparison['id'], ProjectGraphComparison>, nodePrefabs?: Record<string, ProjectNodePrefabComparison>, uiGraphs?: Record<string, ProjectUiGraphComparison>): ProjectComparison['summary'];
|
|
4
|
+
export declare function summarizeGraphComparison(nodes: Record<NodeId, ProjectNodeComparison>, connections: Record<string, ProjectConnectionComparison>): ProjectGraphComparison['summary'];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProjectNodeFieldComparison } from '../projectComparison.js';
|
|
2
|
+
export declare function areComparisonValuesEqual(left: unknown, right: unknown): boolean;
|
|
3
|
+
export declare function getChangedValueComparisons(path: string[], before: unknown, after: unknown): ProjectNodeFieldComparison[];
|
|
4
|
+
export declare function isComparisonRecord(value: unknown): value is Record<string, unknown>;
|
|
5
|
+
export declare function unionKeys(left: Record<string, unknown>, right: Record<string, unknown>): string[];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ChartNode, NodeConnection, NodeId } from '../model/NodeBase.js';
|
|
2
|
+
import type { GraphId, NodeGraph } from '../model/NodeGraph.js';
|
|
3
|
+
import type { NodePrefab, NodePrefabId, Project } from '../model/Project.js';
|
|
4
|
+
import type { UiGraph, UiGraphId } from '../model/UiGraph.js';
|
|
5
|
+
export { getProjectConnectionComparisonKey } from './projectComparison/connections.js';
|
|
6
|
+
export { getProjectNodeFieldComparisons } from './projectComparison/nodes.js';
|
|
7
|
+
export type ProjectComparisonChangeKind = 'added' | 'removed' | 'changed' | 'unchanged';
|
|
8
|
+
export type ProjectNodeComparison = {
|
|
9
|
+
id: NodeId;
|
|
10
|
+
kind: ProjectComparisonChangeKind;
|
|
11
|
+
before?: ChartNode;
|
|
12
|
+
after?: ChartNode;
|
|
13
|
+
};
|
|
14
|
+
export type ProjectNodeFieldComparison = {
|
|
15
|
+
field: string;
|
|
16
|
+
path: string[];
|
|
17
|
+
before?: unknown;
|
|
18
|
+
after?: unknown;
|
|
19
|
+
};
|
|
20
|
+
export type ProjectConnectionComparison = {
|
|
21
|
+
key: string;
|
|
22
|
+
kind: ProjectComparisonChangeKind;
|
|
23
|
+
before?: NodeConnection;
|
|
24
|
+
after?: NodeConnection;
|
|
25
|
+
};
|
|
26
|
+
type ProjectGraphComparisonSummary = {
|
|
27
|
+
addedNodes: number;
|
|
28
|
+
removedNodes: number;
|
|
29
|
+
changedNodes: number;
|
|
30
|
+
addedConnections: number;
|
|
31
|
+
removedConnections: number;
|
|
32
|
+
changedConnections: number;
|
|
33
|
+
};
|
|
34
|
+
type ProjectComparisonSummary = {
|
|
35
|
+
addedGraphs: number;
|
|
36
|
+
removedGraphs: number;
|
|
37
|
+
changedGraphs: number;
|
|
38
|
+
addedNodePrefabs?: number;
|
|
39
|
+
removedNodePrefabs?: number;
|
|
40
|
+
changedNodePrefabs?: number;
|
|
41
|
+
addedUiGraphs?: number;
|
|
42
|
+
removedUiGraphs?: number;
|
|
43
|
+
changedUiGraphs?: number;
|
|
44
|
+
} & ProjectGraphComparisonSummary;
|
|
45
|
+
export type ProjectNodePrefabComparison = {
|
|
46
|
+
id: NodePrefabId;
|
|
47
|
+
kind: ProjectComparisonChangeKind;
|
|
48
|
+
before?: NodePrefab;
|
|
49
|
+
after?: NodePrefab;
|
|
50
|
+
sourceNode?: ProjectNodeComparison;
|
|
51
|
+
};
|
|
52
|
+
export type ProjectGraphComparison = {
|
|
53
|
+
id: GraphId;
|
|
54
|
+
kind: ProjectComparisonChangeKind;
|
|
55
|
+
before?: NodeGraph;
|
|
56
|
+
after?: NodeGraph;
|
|
57
|
+
metadataChanged: boolean;
|
|
58
|
+
nodes: Record<NodeId, ProjectNodeComparison>;
|
|
59
|
+
connections: Record<string, ProjectConnectionComparison>;
|
|
60
|
+
summary: ProjectGraphComparisonSummary;
|
|
61
|
+
};
|
|
62
|
+
export type ProjectUiGraphComparison = {
|
|
63
|
+
id: UiGraphId;
|
|
64
|
+
kind: ProjectComparisonChangeKind;
|
|
65
|
+
before?: UiGraph;
|
|
66
|
+
after?: UiGraph;
|
|
67
|
+
};
|
|
68
|
+
export type ProjectComparison = {
|
|
69
|
+
beforeProjectId: Project['metadata']['id'];
|
|
70
|
+
afterProjectId: Project['metadata']['id'];
|
|
71
|
+
metadataChanged: boolean;
|
|
72
|
+
graphs: Record<GraphId, ProjectGraphComparison>;
|
|
73
|
+
nodePrefabs?: Record<NodePrefabId, ProjectNodePrefabComparison>;
|
|
74
|
+
uiGraphs?: Record<UiGraphId, ProjectUiGraphComparison>;
|
|
75
|
+
summary: ProjectComparisonSummary;
|
|
76
|
+
};
|
|
77
|
+
export declare function compareProjects(before: Project, after: Project): ProjectComparison;
|