@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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { compareGraphs } from './projectComparison/graphs.js';
|
|
2
|
+
import { summarizeProjectComparison } from './projectComparison/summaries.js';
|
|
3
|
+
import { compareNodes } from './projectComparison/nodes.js';
|
|
4
|
+
import { areComparisonValuesEqual, unionKeys } from './projectComparison/values.js';
|
|
5
|
+
export { getProjectConnectionComparisonKey } from './projectComparison/connections.js';
|
|
6
|
+
export { getProjectNodeFieldComparisons } from './projectComparison/nodes.js';
|
|
7
|
+
export function compareProjects(before, after) {
|
|
8
|
+
const graphIds = unionKeys(before.graphs, after.graphs);
|
|
9
|
+
const graphs = Object.fromEntries(graphIds.map((graphId) => [graphId, compareGraphs(graphId, before.graphs[graphId], after.graphs[graphId])]));
|
|
10
|
+
const nodePrefabs = compareNodePrefabs(before.nodePrefabs ?? {}, after.nodePrefabs ?? {});
|
|
11
|
+
const uiGraphs = compareUiGraphs(before.uiGraphs ?? {}, after.uiGraphs ?? {});
|
|
12
|
+
return {
|
|
13
|
+
beforeProjectId: before.metadata.id,
|
|
14
|
+
afterProjectId: after.metadata.id,
|
|
15
|
+
metadataChanged: !areComparisonValuesEqual(before.metadata, after.metadata),
|
|
16
|
+
graphs,
|
|
17
|
+
nodePrefabs,
|
|
18
|
+
uiGraphs,
|
|
19
|
+
summary: summarizeProjectComparison(graphs, nodePrefabs, uiGraphs),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function compareNodePrefabs(before, after) {
|
|
23
|
+
const prefabIds = unionKeys(before, after);
|
|
24
|
+
return Object.fromEntries(prefabIds.map((prefabId) => {
|
|
25
|
+
const beforePrefab = before[prefabId];
|
|
26
|
+
const afterPrefab = after[prefabId];
|
|
27
|
+
if (!beforePrefab && afterPrefab) {
|
|
28
|
+
return [prefabId, { id: prefabId, kind: 'added', after: afterPrefab }];
|
|
29
|
+
}
|
|
30
|
+
if (beforePrefab && !afterPrefab) {
|
|
31
|
+
return [prefabId, { id: prefabId, kind: 'removed', before: beforePrefab }];
|
|
32
|
+
}
|
|
33
|
+
if (!beforePrefab || !afterPrefab) {
|
|
34
|
+
throw new Error(`Cannot compare missing library node ${prefabId}`);
|
|
35
|
+
}
|
|
36
|
+
const sourceNodeComparison = Object.values(compareNodes([beforePrefab.sourceNode], [afterPrefab.sourceNode]))[0];
|
|
37
|
+
return [
|
|
38
|
+
prefabId,
|
|
39
|
+
{
|
|
40
|
+
id: prefabId,
|
|
41
|
+
kind: sourceNodeComparison.kind === 'unchanged' ? 'unchanged' : 'changed',
|
|
42
|
+
before: beforePrefab,
|
|
43
|
+
after: afterPrefab,
|
|
44
|
+
sourceNode: sourceNodeComparison,
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
function compareUiGraphs(before, after) {
|
|
50
|
+
const uiGraphIds = unionKeys(before, after);
|
|
51
|
+
return Object.fromEntries(uiGraphIds.map((uiGraphId) => {
|
|
52
|
+
const beforeUiGraph = before[uiGraphId];
|
|
53
|
+
const afterUiGraph = after[uiGraphId];
|
|
54
|
+
if (!beforeUiGraph && afterUiGraph) {
|
|
55
|
+
return [uiGraphId, { id: uiGraphId, kind: 'added', after: afterUiGraph }];
|
|
56
|
+
}
|
|
57
|
+
if (beforeUiGraph && !afterUiGraph) {
|
|
58
|
+
return [uiGraphId, { id: uiGraphId, kind: 'removed', before: beforeUiGraph }];
|
|
59
|
+
}
|
|
60
|
+
if (!beforeUiGraph || !afterUiGraph) {
|
|
61
|
+
throw new Error(`Cannot compare missing UI graph ${uiGraphId}`);
|
|
62
|
+
}
|
|
63
|
+
return [
|
|
64
|
+
uiGraphId,
|
|
65
|
+
{
|
|
66
|
+
id: uiGraphId,
|
|
67
|
+
kind: areComparisonValuesEqual(beforeUiGraph, afterUiGraph) ? 'unchanged' : 'changed',
|
|
68
|
+
before: beforeUiGraph,
|
|
69
|
+
after: afterUiGraph,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
@@ -5,23 +5,44 @@
|
|
|
5
5
|
import stableStringify from 'safe-stable-stringify';
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
import * as yaml from 'yaml';
|
|
8
|
+
const CONNECTION_BEND_MARKER = ' __rivet_bend:';
|
|
9
|
+
const CONNECTION_BEND_MARKER_TITLE_FALLBACK = ' __rivet bend:';
|
|
10
|
+
const FINITE_NUMBER_PATTERN = String.raw `[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?`;
|
|
11
|
+
const CONNECTION_BEND_PATTERN = new RegExp(`${CONNECTION_BEND_MARKER.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(${FINITE_NUMBER_PATTERN}),(${FINITE_NUMBER_PATTERN})$`);
|
|
8
12
|
export function serializeConnection(connection, allNodes) {
|
|
9
|
-
const targetTitle = allNodes.find((node) => node.id === connection.inputNodeId)?.title ?? '';
|
|
10
|
-
|
|
13
|
+
const targetTitle = serializeConnectionTargetTitle(allNodes.find((node) => node.id === connection.inputNodeId)?.title ?? '');
|
|
14
|
+
const bendPoint = connection.bendPoint && Number.isFinite(connection.bendPoint.x) && Number.isFinite(connection.bendPoint.y)
|
|
15
|
+
? `${CONNECTION_BEND_MARKER}${connection.bendPoint.x},${connection.bendPoint.y}`
|
|
16
|
+
: '';
|
|
17
|
+
return `${connection.outputId}->"${targetTitle}${bendPoint}" ${connection.inputNodeId}/${connection.inputId}`;
|
|
11
18
|
}
|
|
12
19
|
export function deserializeConnection(connection, sourceNodeId) {
|
|
13
20
|
const match = connection.match(/(.+)->"(.*)"\s+(.+)\/(.+)/);
|
|
14
21
|
if (!match) {
|
|
15
22
|
throw new Error(`Invalid connection: ${connection}`);
|
|
16
23
|
}
|
|
17
|
-
const [, outputId, , inputNodeId, inputId] = match;
|
|
24
|
+
const [, outputId, targetTitle, inputNodeId, inputId] = match;
|
|
25
|
+
const bendPoint = deserializeConnectionBendPoint(targetTitle);
|
|
18
26
|
return {
|
|
19
27
|
outputId: outputId,
|
|
20
28
|
outputNodeId: sourceNodeId,
|
|
21
29
|
inputId: inputId,
|
|
22
30
|
inputNodeId: inputNodeId,
|
|
31
|
+
...(bendPoint ? { bendPoint } : {}),
|
|
23
32
|
};
|
|
24
33
|
}
|
|
34
|
+
function serializeConnectionTargetTitle(targetTitle) {
|
|
35
|
+
return targetTitle.replaceAll(CONNECTION_BEND_MARKER, CONNECTION_BEND_MARKER_TITLE_FALLBACK);
|
|
36
|
+
}
|
|
37
|
+
function deserializeConnectionBendPoint(targetTitle) {
|
|
38
|
+
const match = targetTitle?.match(CONNECTION_BEND_PATTERN);
|
|
39
|
+
if (!match) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const x = Number.parseFloat(match[1]);
|
|
43
|
+
const y = Number.parseFloat(match[2]);
|
|
44
|
+
return Number.isFinite(x) && Number.isFinite(y) ? { x, y } : undefined;
|
|
45
|
+
}
|
|
25
46
|
function parseOptionalFloat(val) {
|
|
26
47
|
return val === 'null' || val === undefined || val === '' ? undefined : parseFloat(val);
|
|
27
48
|
}
|
|
@@ -27,25 +27,55 @@ export function graphV4Serializer(graph) {
|
|
|
27
27
|
return wrapInYamlEnvelope(4, toSerializedGraph(graph));
|
|
28
28
|
}
|
|
29
29
|
function toSerializedProject(project, attachedData) {
|
|
30
|
+
const nodePrefabs = mapValues(project.nodePrefabs ?? {}, (prefab) => ({
|
|
31
|
+
id: prefab.id,
|
|
32
|
+
sourceNode: toSerializedIsolatedNode(prefab.sourceNode),
|
|
33
|
+
}));
|
|
30
34
|
return {
|
|
31
35
|
metadata: project.metadata,
|
|
32
36
|
graphs: mapValues(project.graphs, (graph) => toSerializedGraph(graph)),
|
|
37
|
+
nodePrefabs: Object.keys(nodePrefabs).length > 0 ? nodePrefabs : undefined,
|
|
38
|
+
uiGraphs: project.uiGraphs && Object.keys(project.uiGraphs).length > 0 ? project.uiGraphs : undefined,
|
|
33
39
|
attachedData,
|
|
34
40
|
plugins: project.plugins ?? [],
|
|
35
41
|
references: project.references ?? [],
|
|
36
42
|
};
|
|
37
43
|
}
|
|
38
44
|
function fromSerializedProject(serializedProject) {
|
|
45
|
+
const nodePrefabs = mapValues(serializedProject.nodePrefabs ?? {}, (prefab) => ({
|
|
46
|
+
id: prefab.id,
|
|
47
|
+
sourceNode: fromSerializedIsolatedNode(prefab.sourceNode),
|
|
48
|
+
}));
|
|
39
49
|
return [
|
|
40
50
|
{
|
|
41
51
|
metadata: serializedProject.metadata,
|
|
42
52
|
graphs: mapValues(serializedProject.graphs, (graph) => fromSerializedGraph(graph)),
|
|
53
|
+
nodePrefabs: Object.keys(nodePrefabs).length > 0 ? nodePrefabs : undefined,
|
|
54
|
+
uiGraphs: serializedProject.uiGraphs && Object.keys(serializedProject.uiGraphs).length > 0
|
|
55
|
+
? serializedProject.uiGraphs
|
|
56
|
+
: undefined,
|
|
43
57
|
plugins: serializedProject.plugins ?? [],
|
|
44
58
|
references: serializedProject.references ?? [],
|
|
45
59
|
},
|
|
46
60
|
serializedProject.attachedData ?? {},
|
|
47
61
|
];
|
|
48
62
|
}
|
|
63
|
+
function toSerializedIsolatedNode(node) {
|
|
64
|
+
const { outgoingConnections: _outgoingConnections, ...serializedNode } = toSerializedNode(node, [node], []);
|
|
65
|
+
return {
|
|
66
|
+
...serializedNode,
|
|
67
|
+
id: node.id,
|
|
68
|
+
type: node.type,
|
|
69
|
+
title: node.title,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function fromSerializedIsolatedNode(serializedNode) {
|
|
73
|
+
const [node] = fromSerializedNode({
|
|
74
|
+
...serializedNode,
|
|
75
|
+
outgoingConnections: undefined,
|
|
76
|
+
}, `[${serializedNode.id}]:${serializedNode.type} "${serializedNode.title}"`);
|
|
77
|
+
return node;
|
|
78
|
+
}
|
|
49
79
|
function toSerializedGraph(graph) {
|
|
50
80
|
const graphMetadata = {
|
|
51
81
|
id: graph.metadata.id,
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ export * from './model/GraphProcessor.js';
|
|
|
3
3
|
export * from './model/DataValue.js';
|
|
4
4
|
export * from './model/NodeBase.js';
|
|
5
5
|
export * from './model/NodeGraph.js';
|
|
6
|
+
export * from './model/NodePrefabResolver.js';
|
|
7
|
+
export { getGraphBoundary } from './model/GraphBoundaryCache.js';
|
|
8
|
+
export type { GraphBoundary } from './model/GraphBoundaryCache.js';
|
|
9
|
+
export * from './model/UiGraph.js';
|
|
10
|
+
export * from './model/UiGraphRendererStyles.js';
|
|
6
11
|
export * from './model/NodeImpl.js';
|
|
7
12
|
export * from './model/NodeDefinition.js';
|
|
8
13
|
export * from './model/Nodes.js';
|
|
@@ -25,6 +25,7 @@ export type StringEditorDefinition<T extends ChartNode> = SharedEditorDefinition
|
|
|
25
25
|
useInputToggleDataKey?: DataOfType<T, boolean>;
|
|
26
26
|
placeholder?: string;
|
|
27
27
|
maxLength?: number;
|
|
28
|
+
commitDebounceMs?: number;
|
|
28
29
|
};
|
|
29
30
|
export type ToggleEditorDefinition<T extends ChartNode> = SharedEditorDefinitionProps<T> & {
|
|
30
31
|
type: 'toggle';
|
|
@@ -5,6 +5,7 @@ import type { GraphId, NodeGraph } from './NodeGraph.js';
|
|
|
5
5
|
import type { GraphExecutionMetadata, ProcessId } from './ProcessContext.js';
|
|
6
6
|
import type { Project, ProjectId } from './Project.js';
|
|
7
7
|
import type { Settings } from './Settings.js';
|
|
8
|
+
import type { FrozenNodeOutputsByGraph } from './GraphProcessor.js';
|
|
8
9
|
export type GraphInputs = Record<string, DataValue>;
|
|
9
10
|
export type GraphOutputs = Record<string, DataValue>;
|
|
10
11
|
export type Inputs = Record<PortId, DataValue | undefined>;
|
|
@@ -185,6 +186,7 @@ export type OutgoingMessageMap = {
|
|
|
185
186
|
'user-input': {
|
|
186
187
|
nodeId: NodeId;
|
|
187
188
|
answers: StringArrayDataValue;
|
|
189
|
+
requestId?: RemoteRunRequestId;
|
|
188
190
|
};
|
|
189
191
|
'set-dynamic-data': {
|
|
190
192
|
project: Project;
|
|
@@ -195,17 +197,25 @@ export type OutgoingMessageMap = {
|
|
|
195
197
|
graphId: GraphId;
|
|
196
198
|
runToNodeIds?: NodeId[];
|
|
197
199
|
preloadData?: Record<NodeId, Outputs>;
|
|
200
|
+
frozenNodeOutputs?: FrozenNodeOutputsByGraph;
|
|
198
201
|
contextValues: Record<string, DataValue>;
|
|
199
202
|
inputs?: GraphInputs;
|
|
200
203
|
projectPath?: string | null;
|
|
201
204
|
useEditorCache?: boolean;
|
|
202
205
|
captureNodeTimings?: boolean;
|
|
203
206
|
};
|
|
204
|
-
abort:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
+
abort: {
|
|
208
|
+
requestId?: RemoteRunRequestId;
|
|
209
|
+
} | undefined;
|
|
210
|
+
pause: {
|
|
211
|
+
requestId?: RemoteRunRequestId;
|
|
212
|
+
} | undefined;
|
|
213
|
+
resume: {
|
|
214
|
+
requestId?: RemoteRunRequestId;
|
|
215
|
+
} | undefined;
|
|
207
216
|
preload: {
|
|
208
217
|
nodeData: Record<NodeId, Outputs>;
|
|
218
|
+
requestId?: RemoteRunRequestId;
|
|
209
219
|
};
|
|
210
220
|
'datasets:response': {
|
|
211
221
|
requestId: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { DataType, DataValue } from './DataValue.js';
|
|
2
2
|
import type { Inputs, Outputs } from './GraphProcessor.js';
|
|
3
|
-
import type { NodeInputDefinition, NodeOutputDefinition, PortId } from './NodeBase.js';
|
|
3
|
+
import type { NodeId, NodeInputDefinition, NodeOutputDefinition, PortId } from './NodeBase.js';
|
|
4
4
|
import type { GraphId, NodeGraph } from './NodeGraph.js';
|
|
5
5
|
import type { Project } from './Project.js';
|
|
6
6
|
import type { DynamicEditorEditor } from './EditorDefinition.js';
|
|
7
|
+
export declare const GRAPH_BOUNDARY_OUTPUT_DEMAND_OPTIMIZATION_ENABLED = false;
|
|
7
8
|
export type GraphBoundaryInput = {
|
|
8
9
|
dataType: DataType;
|
|
9
10
|
editor?: DynamicEditorEditor;
|
|
@@ -13,6 +14,7 @@ export type GraphBoundaryInput = {
|
|
|
13
14
|
export type GraphBoundaryOutput = {
|
|
14
15
|
dataType: DataType;
|
|
15
16
|
id: string;
|
|
17
|
+
nodeId: NodeId;
|
|
16
18
|
portId: PortId;
|
|
17
19
|
};
|
|
18
20
|
export type GraphBoundary = {
|
|
@@ -21,7 +23,11 @@ export type GraphBoundary = {
|
|
|
21
23
|
};
|
|
22
24
|
export type GraphBoundaryCache = WeakMap<NodeGraph, GraphBoundary>;
|
|
23
25
|
export declare function getGraphBoundary(project: Project, graphId: GraphId | undefined, cache?: GraphBoundaryCache): GraphBoundary | undefined;
|
|
24
|
-
export declare function
|
|
25
|
-
|
|
26
|
+
export declare function applyGraphBoundaryPortOrder<T extends {
|
|
27
|
+
id: string;
|
|
28
|
+
}>(boundaryItems: readonly T[], portOrder: readonly string[] | undefined): T[];
|
|
29
|
+
export declare function getGraphBoundaryInputDefinitions(boundary: GraphBoundary, inputPortOrder?: readonly string[]): NodeInputDefinition[];
|
|
30
|
+
export declare function getGraphBoundaryOutputDefinitions(boundary: GraphBoundary, outputPortOrder?: readonly string[]): NodeOutputDefinition[];
|
|
26
31
|
export declare function buildGraphBoundaryInputData(boundary: GraphBoundary, inputs: Inputs, defaults: Record<string, DataValue> | undefined): Inputs;
|
|
27
32
|
export declare function buildExcludedGraphBoundaryOutputs(boundary: GraphBoundary): Outputs;
|
|
33
|
+
export declare function getRequestedGraphOutputNodeIds(boundary: GraphBoundary, requestedOutputPortIds: ReadonlySet<PortId>): NodeId[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ScalarOrArrayDataValue } from './DataValue.js';
|
|
2
|
+
import type { GraphOutputs, Outputs } from './GraphProcessor.js';
|
|
3
|
+
import type { ChartNode } from './NodeBase.js';
|
|
4
|
+
export type FrozenSetGlobalEffect = {
|
|
5
|
+
variableId: string;
|
|
6
|
+
value: ScalarOrArrayDataValue;
|
|
7
|
+
};
|
|
8
|
+
export declare function ensureGraphCostOutput(graphOutputs: GraphOutputs, totalCost: number): void;
|
|
9
|
+
export declare function applyFrozenGraphBoundaryEffects(graphOutputs: GraphOutputs, node: ChartNode, outputValues: Outputs): FrozenSetGlobalEffect | undefined;
|
|
@@ -138,6 +138,19 @@ export type GraphInputs = Record<string, DataValue>;
|
|
|
138
138
|
export type NodeResults = Map<NodeId, Outputs>;
|
|
139
139
|
export type Inputs = Record<PortId, DataValue | undefined>;
|
|
140
140
|
export type Outputs = Record<PortId, DataValue | undefined>;
|
|
141
|
+
export type FrozenNodeOutputsByGraph = Record<GraphId, Record<NodeId, Outputs[] | undefined> | undefined>;
|
|
142
|
+
export type FrozenNodeOutputResolverRequest = {
|
|
143
|
+
execution: GraphExecutionMetadata;
|
|
144
|
+
graphId: GraphId;
|
|
145
|
+
inputs: Inputs;
|
|
146
|
+
node: ChartNode;
|
|
147
|
+
processId: ProcessId;
|
|
148
|
+
};
|
|
149
|
+
export type FrozenNodeOutputResolver = (request: FrozenNodeOutputResolverRequest) => Outputs | undefined;
|
|
150
|
+
export declare function cloneFrozenNodeOutputs(outputs: Outputs): Outputs;
|
|
151
|
+
export declare function cloneFrozenNodeOutputsByGraph(outputsByGraph: FrozenNodeOutputsByGraph): FrozenNodeOutputsByGraph;
|
|
152
|
+
export declare function hasFrozenNodeOutputs(outputsByGraph: FrozenNodeOutputsByGraph | undefined): boolean;
|
|
153
|
+
export declare function createFrozenNodeOutputResolver(outputsByGraph: FrozenNodeOutputsByGraph | undefined): FrozenNodeOutputResolver | undefined;
|
|
141
154
|
export type ExternalFunctionProcessContext = Omit<InternalProcessContext, 'setGlobal'>;
|
|
142
155
|
export type ExternalFunction = (context: ExternalFunctionProcessContext, ...args: unknown[]) => Promise<DataValue & {
|
|
143
156
|
cost?: number;
|
|
@@ -147,6 +160,7 @@ export type GraphProcessorConcurrency = {
|
|
|
147
160
|
splitRunConcurrency?: number;
|
|
148
161
|
};
|
|
149
162
|
export type GraphProcessorRuntimeCache = {
|
|
163
|
+
executionPlanNodePrefabs?: WeakMap<NodeGraph, Project['nodePrefabs']>;
|
|
150
164
|
executionPlans?: WeakMap<NodeGraph, GraphExecutionPlan>;
|
|
151
165
|
graphBoundaries?: GraphBoundaryCache;
|
|
152
166
|
loadedProjects?: Record<ProjectId, Project>;
|
|
@@ -216,6 +230,7 @@ export declare class GraphProcessor {
|
|
|
216
230
|
setSlowMode(slowMode: boolean): void;
|
|
217
231
|
events(): AsyncGenerator<ProcessEvent>;
|
|
218
232
|
preloadNodeData(nodeId: NodeId, data: Outputs): void;
|
|
233
|
+
setFrozenNodeOutputResolver(resolver: FrozenNodeOutputResolver | undefined): void;
|
|
219
234
|
/** Gets all node IDs that a given node ID depends on being complete before the given node ID can start. */
|
|
220
235
|
getDependencyNodesDeep(nodeId: NodeId): NodeId[];
|
|
221
236
|
replayRecording(recorder: ExecutionRecorder): Promise<GraphOutputs>;
|
|
@@ -111,6 +111,11 @@ export type NodeConnection = {
|
|
|
111
111
|
outputId: PortId;
|
|
112
112
|
/** The unique identifier of the input. */
|
|
113
113
|
inputId: PortId;
|
|
114
|
+
/** Optional visual-only bend point for manually routing the connection on the canvas. */
|
|
115
|
+
bendPoint?: {
|
|
116
|
+
x: number;
|
|
117
|
+
y: number;
|
|
118
|
+
};
|
|
114
119
|
};
|
|
115
120
|
export declare const IF_PORT: NodeInputDefinition;
|
|
116
121
|
export declare function isBuiltInInputDefinition(input: NodeInputDefinition): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChartNode } from './NodeBase.js';
|
|
2
|
+
import type { NodePrefabId, Project } from './Project.js';
|
|
3
|
+
export declare const NODE_PREFAB_INSTANCE_TYPE = "nodePrefabInstance";
|
|
4
|
+
export type NodePrefabInstanceNodeData = {
|
|
5
|
+
prefabId?: NodePrefabId;
|
|
6
|
+
};
|
|
7
|
+
export type NodePrefabInstanceNode = ChartNode<typeof NODE_PREFAB_INSTANCE_TYPE, NodePrefabInstanceNodeData>;
|
|
8
|
+
export declare function isNodePrefabInstanceNode(node: ChartNode | undefined): node is NodePrefabInstanceNode;
|
|
9
|
+
export declare function canUseNodeAsPrefabSource(node: ChartNode): boolean;
|
|
10
|
+
export declare function getNodePrefabInstancePrefabId(node: ChartNode | undefined): NodePrefabId | undefined;
|
|
11
|
+
export declare function resolveNodePrefabInstance(project: Project, node: ChartNode): ChartNode;
|
|
12
|
+
export declare function resolveNodePrefabInstances(project: Project, nodes: readonly ChartNode[]): ChartNode[];
|
|
13
|
+
export declare function getNodePrefabDisplayName(project: Project, prefabId: NodePrefabId | undefined): string;
|
|
@@ -89,16 +89,17 @@ export * from './nodes/MCPDiscoveryNode.js';
|
|
|
89
89
|
export * from './nodes/MCPToolCallNode.js';
|
|
90
90
|
export * from './nodes/MCPGetPromptNode.js';
|
|
91
91
|
export * from './nodes/ReferencedGraphAliasNode.js';
|
|
92
|
-
export
|
|
92
|
+
export * from './nodes/NodePrefabInstanceNode.js';
|
|
93
|
+
export declare const registerBuiltInNodes: (registry: NodeRegistration) => NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "code" | "text" | "context" | "array" | "codeNew" | "comment" | "subGraph" | "graphInput" | "graphOutput" | "userInput" | "prompt" | "raiseEvent" | "getGlobal" | "setGlobal" | "abortGraph" | "chat" | "llmChatV2" | "extractRegex" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "coalesce" | "didRun" | "passthrough" | "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/ContextNode.js").ContextNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/DidRunNode.js").DidRunNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | 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 & {
|
|
93
94
|
type: "mcpDiscovery";
|
|
94
95
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
95
96
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
96
|
-
}) | import("./nodes/MCPToolCallNode.js").MCPToolCallNode | import("./nodes/MCPGetPromptNode.js").MCPGetPromptNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode>;
|
|
97
|
-
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "code" | "text" | "context" | "array" | "codeNew" | "graphInput" | "graphOutput" | "userInput" | "prompt" | "raiseEvent" | "getGlobal" | "setGlobal" | "abortGraph" | "chat" | "llmChatV2" | "extractRegex" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "
|
|
97
|
+
}) | import("./nodes/MCPToolCallNode.js").MCPToolCallNode | import("./nodes/MCPGetPromptNode.js").MCPGetPromptNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode | import("./NodePrefabResolver.js").NodePrefabInstanceNode>;
|
|
98
|
+
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "code" | "text" | "context" | "array" | "codeNew" | "comment" | "subGraph" | "graphInput" | "graphOutput" | "userInput" | "prompt" | "raiseEvent" | "getGlobal" | "setGlobal" | "abortGraph" | "chat" | "llmChatV2" | "extractRegex" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "coalesce" | "didRun" | "passthrough" | "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/ContextNode.js").ContextNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/DidRunNode.js").DidRunNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | 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 & {
|
|
98
99
|
type: "mcpDiscovery";
|
|
99
100
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
100
101
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
101
|
-
}) | import("./nodes/MCPToolCallNode.js").MCPToolCallNode | import("./nodes/MCPGetPromptNode.js").MCPGetPromptNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode>;
|
|
102
|
+
}) | import("./nodes/MCPToolCallNode.js").MCPToolCallNode | import("./nodes/MCPGetPromptNode.js").MCPGetPromptNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode | import("./NodePrefabResolver.js").NodePrefabInstanceNode>;
|
|
102
103
|
export { globalRivetNodeRegistry };
|
|
103
104
|
export type BuiltInNodes = typeof globalRivetNodeRegistry.NodesType;
|
|
104
105
|
export type BuiltInNodeType = typeof globalRivetNodeRegistry.NodeTypesType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Opaque } from 'type-fest';
|
|
2
|
-
import { type Settings, type NativeApi, type Project, type DataValue, type ExternalFunction, type Outputs, type GraphId, type GraphProcessor, type ScalarOrArrayDataValue, type DatasetProvider, type ChartNode, type NodeId, type AttachedNodeData, type AudioProvider, type StringArrayDataValue, type ProjectId, type MCPProvider } from '../index.js';
|
|
2
|
+
import { type Settings, type NativeApi, type Project, type DataValue, type ExternalFunction, type Outputs, type GraphId, type GraphProcessor, type ScalarOrArrayDataValue, type DatasetProvider, type ChartNode, type NodeId, type PortId, type AttachedNodeData, type AudioProvider, type StringArrayDataValue, type ProjectId, type MCPProvider } from '../index.js';
|
|
3
3
|
import type { Tokenizer } from '../integrations/Tokenizer.js';
|
|
4
4
|
import type { CodeRunner } from '../integrations/CodeRunner.js';
|
|
5
5
|
import type { ProjectReferenceLoader } from './ProjectReferenceLoader.js';
|
|
@@ -63,6 +63,10 @@ export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessCon
|
|
|
63
63
|
signal: AbortSignal;
|
|
64
64
|
/** A unique ID for this specific execution of the node. */
|
|
65
65
|
processId: ProcessId;
|
|
66
|
+
/** Output ports with at least one active immediate downstream consumer in this graph run. */
|
|
67
|
+
activeOutputPortIds: ReadonlySet<PortId>;
|
|
68
|
+
/** True when this exact node is the direct terminal selected by run-to execution. */
|
|
69
|
+
isDirectRunTarget: boolean;
|
|
66
70
|
/** Stable execution lineage for the current graph invocation. */
|
|
67
71
|
execution: GraphExecutionMetadata;
|
|
68
72
|
/** Context values that are accessible on graphs and all subgraphs. */
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { DataValue, ScalarOrArrayDataValue, StringArrayDataValue } from './DataValue.js';
|
|
2
2
|
import type { GraphExecutionMetadata, InternalProcessContext, ProcessId } from './ProcessContext.js';
|
|
3
|
-
import type { ChartNode } from './NodeBase.js';
|
|
3
|
+
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' | 'createSubProcessor' | 'execution' | 'externalFunctions' | 'getPluginConfig' | 'node' | 'onPartialOutputs' | 'processId' | 'requestUserInput' | 'setGlobal' | 'signal' | 'waitEvent'>;
|
|
7
|
+
export type NodeProcessContextBase = Omit<InternalProcessContext, 'attachedData' | 'activeOutputPortIds' | 'createSubProcessor' | 'execution' | 'externalFunctions' | 'getPluginConfig' | 'node' | 'onPartialOutputs' | 'processId' | 'requestUserInput' | 'isDirectRunTarget' | 'setGlobal' | 'signal' | 'waitEvent'>;
|
|
8
8
|
export declare function buildNodeProcessContext(options: {
|
|
9
|
+
activeOutputPortIds: ReadonlySet<PortId>;
|
|
9
10
|
base: NodeProcessContextBase;
|
|
10
11
|
attachedData: AttachedNodeData;
|
|
11
12
|
createSubProcessor: (subGraphId: GraphId | undefined, options?: {
|
|
@@ -15,6 +16,7 @@ export declare function buildNodeProcessContext(options: {
|
|
|
15
16
|
execution: GraphExecutionMetadata;
|
|
16
17
|
externalFunctions: Record<string, ExternalFunction>;
|
|
17
18
|
getPluginConfig: (name: string) => string | undefined;
|
|
19
|
+
isDirectRunTarget: boolean;
|
|
18
20
|
node: ChartNode;
|
|
19
21
|
nodeAbortController: AbortController;
|
|
20
22
|
onPartialOutputs: (partialOutputs: Outputs) => void;
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import type { Opaque } from 'type-fest';
|
|
2
|
+
import type { ChartNode } from './NodeBase.js';
|
|
2
3
|
import { type GraphId, type NodeGraph } from './NodeGraph.js';
|
|
3
4
|
import { type PluginLoadSpec } from './PluginLoadSpec.js';
|
|
4
5
|
import type { MCP } from '../integrations/mcp/MCPProvider.js';
|
|
6
|
+
import type { UiGraph, UiGraphId } from './UiGraph.js';
|
|
5
7
|
export type ProjectId = Opaque<string, 'ProjectId'>;
|
|
6
8
|
export type DataId = Opaque<string, 'DataId'>;
|
|
9
|
+
export type NodePrefabId = Opaque<string, 'NodePrefabId'>;
|
|
10
|
+
export type NodePrefab = {
|
|
11
|
+
id: NodePrefabId;
|
|
12
|
+
sourceNode: ChartNode;
|
|
13
|
+
};
|
|
7
14
|
export type Project = {
|
|
8
15
|
metadata: ProjectMetadata;
|
|
9
16
|
plugins?: PluginLoadSpec[];
|
|
10
17
|
graphs: Record<GraphId, NodeGraph>;
|
|
18
|
+
nodePrefabs?: Record<NodePrefabId, NodePrefab>;
|
|
19
|
+
uiGraphs?: Record<UiGraphId, UiGraph>;
|
|
11
20
|
data?: Record<DataId, string>;
|
|
12
21
|
/** References to other projects. */
|
|
13
22
|
references?: ProjectReference[];
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Opaque } from 'type-fest';
|
|
2
|
+
import type { GraphId } from './NodeGraph.js';
|
|
3
|
+
import type { DataValue } from './DataValue.js';
|
|
4
|
+
export type UiGraphId = Opaque<string, 'UiGraphId'>;
|
|
5
|
+
export type UiComponentId = Opaque<string, 'UiComponentId'>;
|
|
6
|
+
export type UiGraphOutputs = Record<string, DataValue>;
|
|
7
|
+
export type UiGraphValueBinding = {
|
|
8
|
+
type: 'state';
|
|
9
|
+
key: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'literal';
|
|
12
|
+
value: unknown;
|
|
13
|
+
};
|
|
14
|
+
export type UiGraphRunGraphAction = {
|
|
15
|
+
type: 'runGraph';
|
|
16
|
+
graphId?: GraphId;
|
|
17
|
+
inputMappings?: UiGraphInputBinding[];
|
|
18
|
+
inputs?: Record<string, UiGraphValueBinding>;
|
|
19
|
+
outputs?: UiGraphOutputBinding[];
|
|
20
|
+
outputKey?: string;
|
|
21
|
+
outputStateKey?: string;
|
|
22
|
+
};
|
|
23
|
+
export type UiGraphInputBinding = {
|
|
24
|
+
inputKey: string;
|
|
25
|
+
stateKey: string;
|
|
26
|
+
};
|
|
27
|
+
export type UiGraphOutputBinding = {
|
|
28
|
+
outputKey?: string;
|
|
29
|
+
stateKey: string;
|
|
30
|
+
};
|
|
31
|
+
export type UiGraphAction = UiGraphRunGraphAction;
|
|
32
|
+
export type UiGraphComponent = {
|
|
33
|
+
id: UiComponentId;
|
|
34
|
+
type: 'text';
|
|
35
|
+
text: string;
|
|
36
|
+
} | {
|
|
37
|
+
id: UiComponentId;
|
|
38
|
+
type: 'markdown';
|
|
39
|
+
markdown: string;
|
|
40
|
+
} | {
|
|
41
|
+
id: UiComponentId;
|
|
42
|
+
type: 'input';
|
|
43
|
+
label: string;
|
|
44
|
+
stateKey: string;
|
|
45
|
+
placeholder?: string;
|
|
46
|
+
defaultValue?: string;
|
|
47
|
+
} | {
|
|
48
|
+
id: UiComponentId;
|
|
49
|
+
type: 'textarea';
|
|
50
|
+
label: string;
|
|
51
|
+
stateKey: string;
|
|
52
|
+
placeholder?: string;
|
|
53
|
+
defaultValue?: string;
|
|
54
|
+
} | {
|
|
55
|
+
id: UiComponentId;
|
|
56
|
+
type: 'button';
|
|
57
|
+
label: string;
|
|
58
|
+
action: UiGraphAction;
|
|
59
|
+
} | {
|
|
60
|
+
id: UiComponentId;
|
|
61
|
+
type: 'output';
|
|
62
|
+
label?: string;
|
|
63
|
+
stateKey: string;
|
|
64
|
+
renderAs?: 'text' | 'json' | 'markdown';
|
|
65
|
+
};
|
|
66
|
+
export type UiGraph = {
|
|
67
|
+
id: UiGraphId;
|
|
68
|
+
name: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
components: UiGraphComponent[];
|
|
71
|
+
};
|
|
72
|
+
export declare function createDefaultUiGraph(options?: {
|
|
73
|
+
graphId?: GraphId;
|
|
74
|
+
name?: string;
|
|
75
|
+
}): UiGraph;
|
|
76
|
+
export declare function getUiGraphInitialState(uiGraph: UiGraph): Record<string, unknown>;
|
|
77
|
+
export declare function getUiGraphActionComponent(uiGraph: UiGraph, componentId: UiComponentId): Extract<UiGraphComponent, {
|
|
78
|
+
type: 'button';
|
|
79
|
+
}> | undefined;
|
|
80
|
+
export declare function resolveUiGraphActionInputs(action: UiGraphRunGraphAction, state: Record<string, unknown>): Record<string, unknown>;
|
|
81
|
+
export declare function resolveUiGraphActionOutputStateValue(action: UiGraphRunGraphAction, outputs: UiGraphOutputs): unknown;
|
|
82
|
+
export declare function resolveUiGraphActionOutputStatePatch(action: UiGraphRunGraphAction, outputs: UiGraphOutputs): Record<string, unknown>;
|
|
83
|
+
export declare function getUiGraphActionOutputBindings(action: UiGraphRunGraphAction): UiGraphOutputBinding[];
|
|
84
|
+
export declare function getUiGraphActionInputBindings(action: UiGraphRunGraphAction): UiGraphInputBinding[];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const RIVET_WEB_APP_RENDERER_CSS = "\n.rivet-web-app-root {\n --rivet-web-app-background: var(--grey-dark-colorish, #1c222b);\n --rivet-web-app-foreground: var(--foreground, #ffffff);\n --rivet-web-app-card-background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 88%, var(--foreground, #ffffff) 4%);\n --rivet-web-app-card-border: var(--foldable-section-border, rgba(255, 255, 255, 0.04));\n --rivet-web-app-control-background: var(--form-control-bg, #20252d);\n --rivet-web-app-control-border: var(--form-control-border, rgba(255, 255, 255, 0.14));\n --rivet-web-app-button-radius: var(--rivet-web-app-host-button-radius, 6px);\n --rivet-web-app-button-background: var(--success, #3ba85b);\n --rivet-web-app-button-foreground: var(--grey-lightest, #ffffff);\n --rivet-web-app-output-title: var(--rivet-web-app-foreground, #ffffff);\n --rivet-web-app-error-color: var(--error, #ff6b5f);\n --rivet-web-app-font-size: var(--rivet-web-app-host-font-size, 15px);\n box-sizing: border-box;\n height: 100%;\n background: var(--rivet-web-app-background);\n color: var(--rivet-web-app-foreground);\n overflow: auto;\n font-family: Inter, system-ui, sans-serif;\n font-size: var(--rivet-web-app-font-size);\n line-height: 1.4;\n}\n\n.rivet-web-app-root *,\n.rivet-web-app-root *::before,\n.rivet-web-app-root *::after {\n box-sizing: border-box;\n}\n\n.rivet-web-app-surface {\n display: grid;\n gap: 16px;\n margin: 0 auto;\n max-width: 760px;\n padding: 48px 20px;\n}\n\n.rivet-web-app-card,\n.rivet-web-app-field {\n border: 1px solid var(--rivet-web-app-card-border);\n border-radius: 10px;\n background: var(--rivet-web-app-card-background);\n padding: 16px;\n}\n\n.rivet-web-app-component-frame {\n border-radius: 12px;\n margin: -5px;\n padding: 4px;\n}\n\n.rivet-web-app-component-frame.active {\n background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 75%, var(--primary, #ff9e2c) 16%);\n}\n\n.rivet-web-app-field {\n display: grid;\n gap: 8px;\n color: var(--rivet-web-app-foreground);\n font-size: inherit;\n font-weight: 600;\n}\n\n.rivet-web-app-field input,\n.rivet-web-app-field textarea {\n appearance: none;\n width: 100%;\n box-sizing: border-box;\n border: 1px solid var(--rivet-web-app-control-border);\n border-radius: 8px;\n background: var(--rivet-web-app-control-background);\n color: var(--rivet-web-app-foreground);\n font: inherit;\n font-weight: 400;\n padding: 10px 12px;\n}\n\n.rivet-web-app-field textarea {\n min-height: 110px;\n resize: vertical;\n}\n\n.rivet-web-app-button {\n width: fit-content;\n border: 0;\n border-radius: var(--rivet-web-app-button-radius);\n background: var(--rivet-web-app-button-background);\n color: var(--rivet-web-app-button-foreground);\n cursor: pointer;\n font: inherit;\n font-weight: 700;\n padding: 10px 16px;\n}\n\n.rivet-web-app-button:disabled {\n cursor: wait;\n opacity: 0.72;\n}\n\n.rivet-web-app-output {\n display: grid;\n gap: 8px;\n}\n\n.rivet-web-app-output-title {\n color: var(--rivet-web-app-output-title);\n font-weight: 700;\n}\n\n.rivet-web-app-output pre {\n margin: 0;\n background: transparent;\n border-radius: 0;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n font-size: inherit;\n padding: 0;\n white-space: pre-wrap;\n word-break: break-word;\n}\n\n.rivet-web-app-markdown,\n.rivet-web-app-output-markdown {\n word-break: break-word;\n}\n\n.rivet-web-app-markdown.markdown-body {\n background: var(--rivet-web-app-card-background);\n font-family: inherit;\n min-width: 0;\n}\n\n.rivet-web-app-output-markdown.markdown-body {\n background: transparent;\n font-family: inherit;\n min-width: 0;\n}\n\n.rivet-web-app-markdown h1,\n.rivet-web-app-output-markdown h1 {\n margin: 0 0 12px;\n padding-bottom: 8px;\n border-bottom: 1px solid var(--rivet-web-app-card-border);\n font-size: 24px;\n line-height: 1.22;\n}\n\n.rivet-web-app-markdown h2,\n.rivet-web-app-output-markdown h2 {\n margin: 0 0 10px;\n font-size: 20px;\n line-height: 1.25;\n}\n\n.rivet-web-app-markdown p,\n.rivet-web-app-output-markdown p,\n.rivet-web-app-markdown ul,\n.rivet-web-app-output-markdown ul {\n margin: 0 0 12px;\n}\n\n.rivet-web-app-markdown.markdown-body code,\n.rivet-web-app-output-markdown.markdown-body code {\n border-radius: 4px;\n background: color-mix(in srgb, var(--rivet-web-app-control-background) 70%, var(--rivet-web-app-foreground) 6%);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n padding: 1px 4px;\n}\n\n.rivet-web-app-markdown.markdown-body pre,\n.rivet-web-app-output-markdown.markdown-body pre {\n background: transparent;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n padding: 0;\n white-space: pre-wrap;\n}\n\n.rivet-web-app-markdown > :first-child,\n.rivet-web-app-output-markdown > :first-child {\n margin-top: 0;\n}\n\n.rivet-web-app-markdown > :last-child,\n.rivet-web-app-output-markdown > :last-child {\n margin-bottom: 0;\n}\n\n.rivet-web-app-error {\n color: var(--rivet-web-app-error-color);\n font-weight: 700;\n}\n";
|
|
2
|
+
export declare const RIVET_WEB_APP_DOCUMENT_CSS = "\nhtml,\nbody {\n height: 100%;\n margin: 0;\n}\n\nbody {\n min-height: 100vh;\n background: #1c222b;\n}\n\n#app {\n min-height: 100vh;\n}\n";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { StreamChatV2Options, StreamChatV2Result } from './chatV2Types.js';
|
|
2
2
|
export declare function streamChatV2(options: StreamChatV2Options): Promise<StreamChatV2Result>;
|
|
3
|
+
export declare function generateChatV2(options: StreamChatV2Options): Promise<StreamChatV2Result>;
|