@valerypopoff/rivet2-core 2.1.7 → 2.1.9
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 +4911 -2546
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/esm/api/createProcessor.js +45 -4
- package/dist/esm/exports.js +2 -0
- package/dist/esm/integrations/KnowledgeStoreFieldPolicy.js +216 -0
- package/dist/esm/integrations/KnowledgeStoreProvider.js +14 -90
- package/dist/esm/integrations/ManagedKnowledgeStore.js +0 -8
- package/dist/esm/model/DataBusPorts.js +26 -0
- package/dist/esm/model/DataBusTopology.js +207 -0
- package/dist/esm/model/DataValue.js +22 -7
- package/dist/esm/model/GraphPreprocessor.js +9 -3
- package/dist/esm/model/GraphProcessor.js +164 -366
- package/dist/esm/model/NodeIO.js +1 -0
- package/dist/esm/model/NodePrefabResolver.js +16 -0
- package/dist/esm/model/Nodes.js +7 -0
- package/dist/esm/model/SplitRunProcessor.js +19 -10
- package/dist/esm/model/ToolCallContinuationBranchPlanner.js +165 -0
- package/dist/esm/model/ToolCallContinuationCoordinator.js +206 -0
- package/dist/esm/model/chat/aiSdkMessages.js +8 -0
- package/dist/esm/model/chat-v2/chatV2CallObserver.js +142 -0
- package/dist/esm/model/chat-v2/chatV2EditorCache.js +22 -0
- package/dist/esm/model/chat-v2/chatV2Errors.js +23 -6
- package/dist/esm/model/chat-v2/chatV2Outputs.js +41 -31
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +167 -56
- package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +1 -0
- package/dist/esm/model/chat-v2/chatV2ProviderTypes.js +1 -0
- package/dist/esm/model/chat-v2/chatV2RequestPlan.js +6 -5
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +2 -2
- package/dist/esm/model/chat-v2/chatV2Shared.js +1 -6
- package/dist/esm/model/chat-v2/chatV2Types.js +11 -1
- package/dist/esm/model/chat-v2/developerMessageRoles.js +45 -0
- package/dist/esm/model/chat-v2/index.js +1 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +53 -3
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +53 -19
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +232 -68
- package/dist/esm/model/chat-v2/llmProfile.js +212 -0
- package/dist/esm/model/chat-v2/llmProfileFallback.js +288 -0
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +73 -0
- package/dist/esm/model/chat-v2/llmProfileTypes.js +45 -0
- package/dist/esm/model/chat-v2/messageConverter.js +14 -0
- package/dist/esm/model/chat-v2/providerOptions.js +44 -11
- package/dist/esm/model/chat-v2/toolContinuation.js +0 -4
- package/dist/esm/model/nodes/AssembleMessageNode.js +6 -0
- package/dist/esm/model/nodes/DataBusNode.js +81 -0
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +12 -0
- package/dist/esm/model/nodes/GetGlobalNode.js +7 -11
- package/dist/esm/model/nodes/GetKnowledgeSourceStatusNode.js +1 -1
- package/dist/esm/model/nodes/LLMChatV2Node.js +156 -18
- package/dist/esm/model/nodes/LLMProfileNode.js +132 -0
- package/dist/esm/model/nodes/PassthroughNode.js +1 -11
- package/dist/esm/model/nodes/PromptNode.js +9 -2
- package/dist/esm/model/nodes/SearchKnowledgeNode.js +1 -1
- package/dist/esm/model/nodes/SetGlobalNode.js +6 -6
- package/dist/esm/model/nodes/SyncKnowledgeSourceNode.js +0 -1
- package/dist/esm/model/nodes/toolCallDelegation.js +31 -4
- package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +22 -28
- package/dist/esm/plugins/google/google.js +20 -9
- package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +17 -6
- package/dist/esm/plugins/pinecone/PineconeKnowledgeStore.js +0 -4
- package/dist/esm/plugins/pinecone/plugin.js +1 -1
- package/dist/esm/utils/chatMessageToOpenAIChatCompletionMessage.js +4 -0
- package/dist/esm/utils/coerceType.js +84 -41
- package/dist/esm/utils/expectType.js +45 -8
- package/dist/esm/utils/fetchEventSource.js +18 -0
- package/dist/esm/utils/serialization/serialization.js +37 -7
- package/dist/esm/vendor/fnv1a.js +6 -3
- package/dist/types/api/createProcessor.d.ts +2 -0
- package/dist/types/exports.d.ts +2 -0
- package/dist/types/integrations/KnowledgeStore.d.ts +0 -2
- package/dist/types/integrations/KnowledgeStoreFieldPolicy.d.ts +38 -0
- package/dist/types/integrations/KnowledgeStoreProvider.d.ts +6 -3
- package/dist/types/model/DataBusPorts.d.ts +6 -0
- package/dist/types/model/DataBusTopology.d.ts +16 -0
- package/dist/types/model/DataValue.d.ts +22 -6
- package/dist/types/model/GraphPreprocessor.d.ts +2 -1
- package/dist/types/model/GraphProcessor.d.ts +4 -3
- package/dist/types/model/NodeBase.d.ts +6 -0
- package/dist/types/model/NodeIO.d.ts +5 -0
- package/dist/types/model/NodePrefabResolver.d.ts +9 -0
- package/dist/types/model/Nodes.d.ts +5 -2
- package/dist/types/model/ProcessContext.d.ts +64 -0
- package/dist/types/model/SplitRunProcessor.d.ts +2 -1
- package/dist/types/model/ToolCallContinuationBranchPlanner.d.ts +43 -0
- package/dist/types/model/ToolCallContinuationCoordinator.d.ts +70 -0
- package/dist/types/model/chat-v2/chatV2CallObserver.d.ts +10 -0
- package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +4 -0
- package/dist/types/model/chat-v2/chatV2Outputs.d.ts +5 -5
- package/dist/types/model/chat-v2/chatV2Pipeline.d.ts +33 -0
- package/dist/types/model/chat-v2/chatV2ProviderProfile.d.ts +1 -0
- package/dist/types/model/chat-v2/chatV2ProviderTypes.d.ts +1 -0
- package/dist/types/model/chat-v2/chatV2RequestPlan.d.ts +2 -2
- package/dist/types/model/chat-v2/chatV2RuntimeOptions.d.ts +8 -0
- package/dist/types/model/chat-v2/chatV2Shared.d.ts +0 -1
- package/dist/types/model/chat-v2/chatV2Types.d.ts +27 -3
- package/dist/types/model/chat-v2/developerMessageRoles.d.ts +10 -0
- package/dist/types/model/chat-v2/index.d.ts +1 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +10 -1
- package/dist/types/model/chat-v2/llmChatV2NodeEditors.d.ts +5 -1
- package/dist/types/model/chat-v2/llmChatV2NodeRuntime.d.ts +18 -2
- package/dist/types/model/chat-v2/llmProfile.d.ts +10 -0
- package/dist/types/model/chat-v2/llmProfileFallback.d.ts +79 -0
- package/dist/types/model/chat-v2/llmProfileNodeRuntime.d.ts +9 -0
- package/dist/types/model/chat-v2/llmProfileTypes.d.ts +18 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +1 -0
- package/dist/types/model/nodes/AssembleMessageNode.d.ts +2 -1
- package/dist/types/model/nodes/DataBusNode.d.ts +19 -0
- package/dist/types/model/nodes/LLMProfileNode.d.ts +20 -0
- package/dist/types/model/nodes/PassthroughNode.d.ts +2 -15
- package/dist/types/model/nodes/PromptNode.d.ts +2 -2
- package/dist/types/model/nodes/SetGlobalNode.d.ts +2 -2
- package/dist/types/model/nodes/toolCallDelegation.d.ts +9 -0
- package/dist/types/plugins/google/google.d.ts +12 -1
- package/dist/types/plugins/google/nodes/ChatGoogleNode.d.ts +2 -1
- package/dist/types/vendor/fnv1a.d.ts +5 -5
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { GraphProgress } from '../model/GraphProgress.js';
|
|
2
1
|
export type KnowledgeStoreConnectionId = string;
|
|
3
2
|
export type KnowledgeMetadataScalar = null | boolean | number | string;
|
|
4
3
|
export type KnowledgeMetadataValue = KnowledgeMetadataScalar | boolean[] | number[] | string[];
|
|
@@ -44,7 +43,6 @@ export type RivetKnowledgeStoreCapabilities = {
|
|
|
44
43
|
};
|
|
45
44
|
export type KnowledgeOperationContext = {
|
|
46
45
|
signal: AbortSignal;
|
|
47
|
-
reportProgress?: (progress: GraphProgress) => void;
|
|
48
46
|
getTokenCount?: (text: string) => Promise<number>;
|
|
49
47
|
};
|
|
50
48
|
export type KnowledgeChunkingOptions = {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Settings } from '../model/Settings.js';
|
|
2
|
+
import type { KnowledgeStoreConnectionDefinition } from '../model/Project.js';
|
|
3
|
+
import type { KnowledgeMetadata } from './KnowledgeStore.js';
|
|
4
|
+
import type { KnowledgeStoreProviderConfigField, KnowledgeStoreProviderCredentialField, KnowledgeStoreProviderDefinition } from './KnowledgeStoreProvider.js';
|
|
5
|
+
export type KnowledgeStoreProviderFieldIssueCode = 'required' | 'expected-boolean' | 'expected-finite-number' | 'expected-string' | 'unsupported-select-value';
|
|
6
|
+
export type KnowledgeStoreProviderFieldIssue = Readonly<{
|
|
7
|
+
code: KnowledgeStoreProviderFieldIssueCode;
|
|
8
|
+
fieldKey: string;
|
|
9
|
+
fieldLabel: string;
|
|
10
|
+
}>;
|
|
11
|
+
export type KnowledgeStoreFieldNormalizationResult<T> = Readonly<{
|
|
12
|
+
ok: true;
|
|
13
|
+
value: T;
|
|
14
|
+
}> | Readonly<{
|
|
15
|
+
ok: false;
|
|
16
|
+
issue: KnowledgeStoreProviderFieldIssue;
|
|
17
|
+
}>;
|
|
18
|
+
export type KnowledgeStoreNormalizedProviderFieldValue = Readonly<{
|
|
19
|
+
present: false;
|
|
20
|
+
}> | Readonly<{
|
|
21
|
+
present: true;
|
|
22
|
+
value: string | number | boolean;
|
|
23
|
+
}>;
|
|
24
|
+
type ProviderConnectionPolicy = Pick<KnowledgeStoreProviderDefinition, 'id' | 'pluginId' | 'connectionConfigSpec'>;
|
|
25
|
+
type ProviderCredentialPolicy = Pick<KnowledgeStoreProviderDefinition, 'id' | 'credentialConfigSpec'>;
|
|
26
|
+
export type KnowledgeStoreProviderFieldNormalizationMode = 'connection-draft' | 'connection-runtime' | 'credential-draft' | 'credential-runtime';
|
|
27
|
+
export declare function createKnowledgeStoreFieldDraftDefaults(fields: ReadonlyArray<KnowledgeStoreProviderConfigField>): Record<string, unknown>;
|
|
28
|
+
/** Normalizes one declared provider field at an explicit editor or runtime boundary. */
|
|
29
|
+
export declare function normalizeKnowledgeStoreProviderFieldValue(field: KnowledgeStoreProviderConfigField, value: unknown, mode: KnowledgeStoreProviderFieldNormalizationMode): KnowledgeStoreFieldNormalizationResult<KnowledgeStoreNormalizedProviderFieldValue>;
|
|
30
|
+
export declare function isKnowledgeStoreProviderFieldDefaultValid(field: KnowledgeStoreProviderConfigField, value: unknown): boolean;
|
|
31
|
+
export declare function normalizeKnowledgeStoreConnectionDraftConfig(fields: ReadonlyArray<KnowledgeStoreProviderConfigField>, values: Readonly<Record<string, unknown>>): KnowledgeStoreFieldNormalizationResult<KnowledgeMetadata>;
|
|
32
|
+
export declare function normalizeKnowledgeStoreCredentialFields(fields: ReadonlyArray<KnowledgeStoreProviderCredentialField>, values: Readonly<Record<string, unknown>>): KnowledgeStoreFieldNormalizationResult<Record<string, string>>;
|
|
33
|
+
export declare function normalizeKnowledgeStoreConnectionDefinition(connectionId: string, definition: KnowledgeStoreConnectionDefinition, provider: ProviderConnectionPolicy): KnowledgeStoreConnectionDefinition;
|
|
34
|
+
export declare function readKnowledgeStoreConnectionCredentials(settings: Settings, provider: ProviderCredentialPolicy, connectionId: string): KnowledgeStoreFieldNormalizationResult<Record<string, string>>;
|
|
35
|
+
export declare function readKnowledgeStoreConnectionCredentialsDraft(settings: Settings, provider: ProviderCredentialPolicy, connectionId: string): Record<string, string>;
|
|
36
|
+
export declare function writeKnowledgeStoreConnectionCredentials(settings: Settings, providerId: string, connectionId: string, credentials: Readonly<Record<string, string>>): Settings;
|
|
37
|
+
export declare function removeKnowledgeStoreConnectionCredentials(settings: Settings, providerId: string, connectionId: string): Settings;
|
|
38
|
+
export {};
|
|
@@ -14,15 +14,18 @@ export type KnowledgeStoreProviderConfigField = {
|
|
|
14
14
|
value: string;
|
|
15
15
|
}>;
|
|
16
16
|
};
|
|
17
|
+
export type KnowledgeStoreProviderCredentialField = Omit<KnowledgeStoreProviderConfigField, 'type' | 'default' | 'options'> & {
|
|
18
|
+
type: 'string' | 'secret';
|
|
19
|
+
default?: string;
|
|
20
|
+
options?: never;
|
|
21
|
+
};
|
|
17
22
|
export type KnowledgeStoreProviderDefinition = {
|
|
18
23
|
id: string;
|
|
19
24
|
displayName: string;
|
|
20
25
|
/** Rivet plugin that owns this provider. Defaults to the provider ID. */
|
|
21
26
|
pluginId?: string;
|
|
22
27
|
connectionConfigSpec: KnowledgeStoreProviderConfigField[];
|
|
23
|
-
credentialConfigSpec?:
|
|
24
|
-
type: 'string' | 'secret';
|
|
25
|
-
}>;
|
|
28
|
+
credentialConfigSpec?: KnowledgeStoreProviderCredentialField[];
|
|
26
29
|
supportedExecutors: Array<'browser' | 'nodejs'>;
|
|
27
30
|
createStore(connectionId: KnowledgeStoreConnectionId, definition: KnowledgeStoreConnectionDefinition, context: KnowledgeStoreProviderContext): RivetKnowledgeStore | Promise<RivetKnowledgeStore>;
|
|
28
31
|
testConnection?(definition: KnowledgeStoreConnectionDefinition, credentials: Record<string, string>, signal: AbortSignal, context: KnowledgeStoreProviderTestContext): void | Promise<void>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PortId } from './NodeBase.js';
|
|
2
|
+
/** Shared hard safety limit for the dynamic Data Bus channel port range. */
|
|
3
|
+
export declare const MAX_DATA_BUS_CHANNEL_INDEX = 10000;
|
|
4
|
+
export declare function parseDataBusChannelIndex(portId: string, input: boolean): number | undefined;
|
|
5
|
+
export declare function getDataBusInputPortId(channelIndex: number): PortId;
|
|
6
|
+
export declare function getDataBusOutputPortId(channelIndex: number): PortId;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DataBusNode } from './nodes/DataBusNode.js';
|
|
2
|
+
import type { ChartNode, NodeConnection, NodeId, PortId } from './NodeBase.js';
|
|
3
|
+
export type DataBusTopologyNode = DataBusNode;
|
|
4
|
+
export type CompiledDataBusTopology = {
|
|
5
|
+
connections: NodeConnection[];
|
|
6
|
+
executionNodes: ChartNode[];
|
|
7
|
+
};
|
|
8
|
+
export declare function isDataBusTopologyNode(node: ChartNode | undefined): node is DataBusTopologyNode;
|
|
9
|
+
export declare function canRenderDataBusNode(node: ChartNode | undefined): node is DataBusTopologyNode;
|
|
10
|
+
export declare function getDataBusChannelKey(busNodeId: NodeId, channelIndex: number): string;
|
|
11
|
+
export declare function getDataBusInputChannelIndex(portId: PortId): number | undefined;
|
|
12
|
+
export declare function getDataBusOutputChannelIndex(portId: PortId): number | undefined;
|
|
13
|
+
export declare function compileDataBusTopology(options: {
|
|
14
|
+
connections: readonly NodeConnection[];
|
|
15
|
+
graphNodes: readonly ChartNode[];
|
|
16
|
+
}): CompiledDataBusTopology;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { GraphId } from '../index.js';
|
|
2
2
|
import type { DataId } from './Project.js';
|
|
3
3
|
import type { RivetKnowledgeDocument, RivetKnowledgeEvidence, RivetKnowledgeSourceReference } from '../integrations/KnowledgeStore.js';
|
|
4
|
+
import { type LLMProfileValue } from './chat-v2/llmProfileTypes.js';
|
|
4
5
|
export type DataValueDef<Type extends string, RuntimeType> = {
|
|
5
6
|
type: Type;
|
|
6
7
|
value: RuntimeType;
|
|
@@ -14,6 +15,12 @@ export type SystemChatMessage = {
|
|
|
14
15
|
/** If true, this message marks a breakpoint when used with prompt caching (as of right now, Anthropic-only). */
|
|
15
16
|
isCacheBreakpoint?: boolean;
|
|
16
17
|
};
|
|
18
|
+
export type DeveloperChatMessage = {
|
|
19
|
+
type: 'developer';
|
|
20
|
+
message: ChatMessageMessagePart | ChatMessageMessagePart[];
|
|
21
|
+
/** If true, this message marks a breakpoint when used with prompt caching (as of right now, Anthropic-only). */
|
|
22
|
+
isCacheBreakpoint?: boolean;
|
|
23
|
+
};
|
|
17
24
|
export type UserChatMessage = {
|
|
18
25
|
type: 'user';
|
|
19
26
|
message: ChatMessageMessagePart | ChatMessageMessagePart[];
|
|
@@ -47,7 +54,7 @@ export type FunctionResponseChatMessage = {
|
|
|
47
54
|
/** If true, this message marks a breakpoint when used with prompt caching (as of right now, Anthropic-only). */
|
|
48
55
|
isCacheBreakpoint?: boolean;
|
|
49
56
|
};
|
|
50
|
-
export type ChatMessage = SystemChatMessage | UserChatMessage | AssistantChatMessage | FunctionResponseChatMessage;
|
|
57
|
+
export type ChatMessage = SystemChatMessage | DeveloperChatMessage | UserChatMessage | AssistantChatMessage | FunctionResponseChatMessage;
|
|
51
58
|
export type ChatMessageMessagePart = string | {
|
|
52
59
|
type: 'image';
|
|
53
60
|
mediaType: SupportedImageMediaTypes;
|
|
@@ -88,6 +95,7 @@ export type GraphReferenceValue = DataValueDef<'graph-reference', {
|
|
|
88
95
|
export type KnowledgeSourceDataValue = DataValueDef<'knowledge-source', RivetKnowledgeSourceReference>;
|
|
89
96
|
export type KnowledgeDocumentDataValue = DataValueDef<'knowledge-document', RivetKnowledgeDocument>;
|
|
90
97
|
export type KnowledgeEvidenceDataValue = DataValueDef<'knowledge-evidence', RivetKnowledgeEvidence>;
|
|
98
|
+
export type LLMProfileDataValue = DataValueDef<'llm-config', LLMProfileValue>;
|
|
91
99
|
export type DocumentDataValue = DataValueDef<'document', {
|
|
92
100
|
mediaType: SupportedDocumentMediaTypes;
|
|
93
101
|
data: Uint8Array;
|
|
@@ -108,7 +116,7 @@ export type GptFunction = {
|
|
|
108
116
|
};
|
|
109
117
|
export type GptFunctionDataValue = DataValueDef<'gpt-function', GptFunction>;
|
|
110
118
|
export type ControlFlowExcludedDataValue = DataValueDef<'control-flow-excluded', undefined | 'loop-not-broken'>;
|
|
111
|
-
export type ScalarDataValue = StringDataValue | NumberDataValue | DateDataValue | TimeDataValue | DateTimeDataValue | BoolDataValue | ChatMessageDataValue | ControlFlowExcludedDataValue | AnyDataValue | ObjectDataValue | GptFunctionDataValue | VectorDataValue | ImageDataValue | BinaryDataValue | AudioDataValue | GraphReferenceValue | KnowledgeSourceDataValue | KnowledgeDocumentDataValue | KnowledgeEvidenceDataValue | DocumentDataValue;
|
|
119
|
+
export type ScalarDataValue = StringDataValue | NumberDataValue | DateDataValue | TimeDataValue | DateTimeDataValue | BoolDataValue | ChatMessageDataValue | ControlFlowExcludedDataValue | AnyDataValue | ObjectDataValue | GptFunctionDataValue | VectorDataValue | ImageDataValue | BinaryDataValue | AudioDataValue | GraphReferenceValue | KnowledgeSourceDataValue | KnowledgeDocumentDataValue | KnowledgeEvidenceDataValue | LLMProfileDataValue | DocumentDataValue;
|
|
112
120
|
export type ScalarType = ScalarDataValue['type'];
|
|
113
121
|
export type ArrayDataValue<T extends ScalarDataValue> = DataValueDef<`${T['type']}[]`, T['value'][]>;
|
|
114
122
|
export type FunctionDataValue<T extends ScalarOrArrayDataValue> = DataValueDef<`fn<${T['type']}>`, () => T['value']>;
|
|
@@ -118,6 +126,11 @@ export type ArrayDataValues = {
|
|
|
118
126
|
type: P;
|
|
119
127
|
}>>;
|
|
120
128
|
}[ScalarDataValue['type']];
|
|
129
|
+
export type ArrayLikeDataValue = ArrayDataValues | (AnyDataValue & {
|
|
130
|
+
value: unknown[];
|
|
131
|
+
}) | (ObjectDataValue & {
|
|
132
|
+
value: unknown[];
|
|
133
|
+
});
|
|
121
134
|
export type ScalarOrArrayDataValue = ScalarDataValue | ArrayDataValues;
|
|
122
135
|
export type FunctionDataValues = {
|
|
123
136
|
[P in ScalarOrArrayDataValue['type']]: FunctionDataValue<Extract<ScalarOrArrayDataValue, {
|
|
@@ -137,16 +150,19 @@ export type GetDataValue<Type extends DataType> = Extract<DataValue, {
|
|
|
137
150
|
export type DataRef = {
|
|
138
151
|
refId: DataId;
|
|
139
152
|
};
|
|
140
|
-
export declare const dataTypes: ["any", "any[]", "boolean", "boolean[]", "string", "string[]", "number", "number[]", "date", "date[]", "time", "time[]", "datetime", "datetime[]", "chat-message", "chat-message[]", "control-flow-excluded", "control-flow-excluded[]", "object", "object[]", "fn<string>", "fn<number>", "fn<boolean>", "fn<date>", "fn<time>", "fn<datetime>", "fn<any>", "fn<object>", "fn<chat-message>", "fn<control-flow-excluded>", "fn<string[]>", "fn<number[]>", "fn<boolean[]>", "fn<date[]>", "fn<time[]>", "fn<datetime[]>", "fn<any[]>", "fn<object[]>", "fn<chat-message[]>", "fn<control-flow-excluded[]>", "gpt-function", "gpt-function[]", "fn<gpt-function[]>", "fn<gpt-function>", "vector", "vector[]", "fn<vector>", "fn<vector[]>", "image", "image[]", "fn<image>", "fn<image[]>", "binary", "binary[]", "fn<binary>", "fn<binary[]>", "audio", "audio[]", "fn<audio>", "fn<audio[]>", "graph-reference", "graph-reference[]", "fn<graph-reference>", "fn<graph-reference[]>", "knowledge-source", "knowledge-source[]", "fn<knowledge-source>", "fn<knowledge-source[]>", "knowledge-document", "knowledge-document[]", "fn<knowledge-document>", "fn<knowledge-document[]>", "knowledge-evidence", "knowledge-evidence[]", "fn<knowledge-evidence>", "fn<knowledge-evidence[]>", "document", "document[]", "fn<document>", "fn<document[]>"];
|
|
141
|
-
export declare const scalarTypes: ["any", "boolean", "string", "number", "date", "time", "datetime", "chat-message", "control-flow-excluded", "object", "gpt-function", "vector", "image", "binary", "audio", "graph-reference", "knowledge-source", "knowledge-document", "knowledge-evidence", "document"];
|
|
153
|
+
export declare const dataTypes: ["any", "any[]", "boolean", "boolean[]", "string", "string[]", "number", "number[]", "date", "date[]", "time", "time[]", "datetime", "datetime[]", "chat-message", "chat-message[]", "control-flow-excluded", "control-flow-excluded[]", "object", "object[]", "fn<string>", "fn<number>", "fn<boolean>", "fn<date>", "fn<time>", "fn<datetime>", "fn<any>", "fn<object>", "fn<chat-message>", "fn<control-flow-excluded>", "fn<string[]>", "fn<number[]>", "fn<boolean[]>", "fn<date[]>", "fn<time[]>", "fn<datetime[]>", "fn<any[]>", "fn<object[]>", "fn<chat-message[]>", "fn<control-flow-excluded[]>", "gpt-function", "gpt-function[]", "fn<gpt-function[]>", "fn<gpt-function>", "vector", "vector[]", "fn<vector>", "fn<vector[]>", "image", "image[]", "fn<image>", "fn<image[]>", "binary", "binary[]", "fn<binary>", "fn<binary[]>", "audio", "audio[]", "fn<audio>", "fn<audio[]>", "graph-reference", "graph-reference[]", "fn<graph-reference>", "fn<graph-reference[]>", "knowledge-source", "knowledge-source[]", "fn<knowledge-source>", "fn<knowledge-source[]>", "knowledge-document", "knowledge-document[]", "fn<knowledge-document>", "fn<knowledge-document[]>", "knowledge-evidence", "knowledge-evidence[]", "fn<knowledge-evidence>", "fn<knowledge-evidence[]>", "llm-config", "llm-config[]", "fn<llm-config>", "fn<llm-config[]>", "document", "document[]", "fn<document>", "fn<document[]>"];
|
|
154
|
+
export declare const scalarTypes: ["any", "boolean", "string", "number", "date", "time", "datetime", "chat-message", "control-flow-excluded", "object", "gpt-function", "vector", "image", "binary", "audio", "graph-reference", "knowledge-source", "knowledge-document", "knowledge-evidence", "llm-config", "document"];
|
|
142
155
|
export declare const dataTypeDisplayNames: Record<DataType, string>;
|
|
143
156
|
export declare function isScalarDataValue(value: DataValue | undefined): value is ScalarDataValue;
|
|
144
157
|
export declare function isScalarDataType(type: DataType): type is ScalarDataType;
|
|
145
|
-
export declare function isArrayDataValue(value: DataValue | undefined): value is
|
|
158
|
+
export declare function isArrayDataValue(value: DataValue | undefined): value is ArrayLikeDataValue;
|
|
146
159
|
export declare function isArrayDataType(type: DataType): type is ArrayDataType;
|
|
147
160
|
export declare function isFunctionDataType(type: DataType): type is FunctionDataType;
|
|
148
|
-
export declare function isFunctionDataValue(value: DataValue | undefined): value is FunctionDataValues
|
|
161
|
+
export declare function isFunctionDataValue(value: DataValue | undefined): value is FunctionDataValues | (AnyDataValue & {
|
|
162
|
+
value: () => unknown;
|
|
163
|
+
});
|
|
149
164
|
export declare function isNotFunctionDataValue(value: DataValue | undefined): value is ScalarOrArrayDataValue;
|
|
165
|
+
export declare function functionTypeToReturnType(functionType: FunctionDataType): ScalarOrArrayDataType;
|
|
150
166
|
export declare function functionTypeToScalarType(functionType: FunctionDataType): ScalarDataType;
|
|
151
167
|
export declare function arrayTypeToScalarType(arrayType: ArrayDataType): ScalarDataType;
|
|
152
168
|
export declare function getScalarTypeOf(type: DataType): ScalarDataType;
|
|
@@ -20,6 +20,8 @@ export type GraphOutputNodeResult = {
|
|
|
20
20
|
export type GraphPreprocessorResult = {
|
|
21
21
|
connections: Record<NodeId, NodeConnection[]>;
|
|
22
22
|
definitions: GraphNodeDefinitions;
|
|
23
|
+
/** Nodes participating in execution after topology-only nodes are compiled out. */
|
|
24
|
+
graphNodes: ChartNode[];
|
|
23
25
|
nodeInstances: Record<NodeId, NodeImpl<ChartNode>>;
|
|
24
26
|
nodesById: Record<NodeId, ChartNode>;
|
|
25
27
|
nodesNotInCycle: ChartNode[];
|
|
@@ -27,7 +29,6 @@ export type GraphPreprocessorResult = {
|
|
|
27
29
|
};
|
|
28
30
|
export type GraphExecutionPlan = Omit<GraphPreprocessorResult, 'nodeInstances'> & {
|
|
29
31
|
cycleIndexByNode: Record<NodeId, number>;
|
|
30
|
-
graphNodes: ChartNode[];
|
|
31
32
|
nodeIds: readonly NodeId[];
|
|
32
33
|
inputConnectionByNodeAndPort: GraphPortConnectionMap;
|
|
33
34
|
inputConnectionsByNode: Record<NodeId, NodeConnection[]>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type DataValue, type StringArrayDataValue, type ScalarOrArrayDataValue } from './DataValue.js';
|
|
2
|
-
import
|
|
2
|
+
import type { NodeInputs, NodeOutputs } from './NodeIO.js';
|
|
3
|
+
import { type ChartNode, type NodeConnection, type NodeId } from './NodeBase.js';
|
|
3
4
|
import type { GraphId, NodeGraph } from './NodeGraph.js';
|
|
4
5
|
import Emittery from 'emittery';
|
|
5
6
|
import { type ProjectId, type Project } from './Project.js';
|
|
@@ -152,8 +153,8 @@ export type ProcessEvent = {
|
|
|
152
153
|
export type GraphOutputs = Record<string, DataValue>;
|
|
153
154
|
export type GraphInputs = Record<string, DataValue>;
|
|
154
155
|
export type NodeResults = Map<NodeId, Outputs>;
|
|
155
|
-
export type Inputs =
|
|
156
|
-
export type Outputs =
|
|
156
|
+
export type Inputs = NodeInputs;
|
|
157
|
+
export type Outputs = NodeOutputs;
|
|
157
158
|
export type FrozenNodeOutputsByGraph = Record<GraphId, Record<NodeId, Outputs[] | undefined> | undefined>;
|
|
158
159
|
export type FrozenNodeOutputResolverRequest = {
|
|
159
160
|
execution: GraphExecutionMetadata;
|
|
@@ -85,6 +85,12 @@ export type NodeInputDefinition = {
|
|
|
85
85
|
description?: string;
|
|
86
86
|
/** Will the input value attempt to be coerced into the desired type? */
|
|
87
87
|
coerced?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Whether an array on this port participates in a node's Many-runs fan-out.
|
|
90
|
+
* Most inputs retain the default `split`; configuration collections such as
|
|
91
|
+
* an LLM Profile fallback chain can opt into `preserve-array`.
|
|
92
|
+
*/
|
|
93
|
+
splitRunBehavior?: 'split' | 'preserve-array';
|
|
88
94
|
};
|
|
89
95
|
/** Represents an output definition of a node. */
|
|
90
96
|
export type NodeOutputDefinition = {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DataValue } from './DataValue.js';
|
|
2
|
+
import type { PortId } from './NodeBase.js';
|
|
3
|
+
/** Values accepted by and emitted from a node process invocation. */
|
|
4
|
+
export type NodeInputs = Record<PortId, DataValue | undefined>;
|
|
5
|
+
export type NodeOutputs = Record<PortId, DataValue | undefined>;
|
|
@@ -9,5 +9,14 @@ export declare function isNodePrefabInstanceNode(node: ChartNode | undefined): n
|
|
|
9
9
|
export declare function canUseNodeAsPrefabSource(node: ChartNode): boolean;
|
|
10
10
|
export declare function getNodePrefabInstancePrefabId(node: ChartNode | undefined): NodePrefabId | undefined;
|
|
11
11
|
export declare function resolveNodePrefabInstance(project: Project, node: ChartNode): ChartNode;
|
|
12
|
+
/**
|
|
13
|
+
* Turns a valid graph-local library link into its current effective node.
|
|
14
|
+
*
|
|
15
|
+
* The returned node keeps the link's id and graph-local geometry, so existing
|
|
16
|
+
* connections remain valid. All node behavior and settings are cloned from
|
|
17
|
+
* the library source. Missing or invalid sources cannot be detached because
|
|
18
|
+
* there is no concrete node definition to preserve.
|
|
19
|
+
*/
|
|
20
|
+
export declare function detachNodePrefabInstance(project: Project, node: ChartNode): ChartNode | undefined;
|
|
12
21
|
export declare function resolveNodePrefabInstances(project: Project, nodes: readonly ChartNode[]): ChartNode[];
|
|
13
22
|
export declare function getNodePrefabDisplayName(project: Project, prefabId: NodePrefabId | undefined): string;
|
|
@@ -4,6 +4,7 @@ export * from './nodes/TextNode.js';
|
|
|
4
4
|
export * from './nodes/ChatNode.js';
|
|
5
5
|
export * from './nodes/ChatNodeBase.js';
|
|
6
6
|
export * from './nodes/LLMChatV2Node.js';
|
|
7
|
+
export * from './nodes/LLMProfileNode.js';
|
|
7
8
|
export * from './nodes/PromptNode.js';
|
|
8
9
|
export * from './nodes/ExtractRegexNode.js';
|
|
9
10
|
export * from './nodes/CodeNode.js';
|
|
@@ -32,6 +33,8 @@ export * from './nodes/ContextNode.js';
|
|
|
32
33
|
export * from './nodes/CoalesceNode.js';
|
|
33
34
|
export * from './nodes/DidRunNode.js';
|
|
34
35
|
export * from './nodes/PassthroughNode.js';
|
|
36
|
+
export * from './nodes/DataBusNode.js';
|
|
37
|
+
export * from './DataBusTopology.js';
|
|
35
38
|
export * from './nodes/StartBackgroundBranchNode.js';
|
|
36
39
|
export * from './nodes/PopNode.js';
|
|
37
40
|
export * from './nodes/SetGlobalNode.js';
|
|
@@ -100,12 +103,12 @@ export * from './nodes/MCPToolCallNode.js';
|
|
|
100
103
|
export * from './nodes/MCPGetPromptNode.js';
|
|
101
104
|
export * from './nodes/ReferencedGraphAliasNode.js';
|
|
102
105
|
export * from './nodes/NodePrefabInstanceNode.js';
|
|
103
|
-
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" | "
|
|
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" | "graphOutput" | "setGlobal" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "setStoredValue" | "abortGraph" | "userInput" | "prompt" | "llmChatV2" | "llmProfile" | "extractRegex" | "codeNew" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "coalesce" | "didRun" | "passthrough" | "dataBus" | "startBackgroundBranch" | "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" | "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/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/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 & {
|
|
104
107
|
type: "mcpDiscovery";
|
|
105
108
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
106
109
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
107
110
|
}) | import("./nodes/MCPToolCallNode.js").MCPToolCallNode | import("./nodes/MCPGetPromptNode.js").MCPGetPromptNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode | import("./NodePrefabResolver.js").NodePrefabInstanceNode>;
|
|
108
|
-
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "
|
|
111
|
+
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "graphOutput" | "setGlobal" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "setStoredValue" | "abortGraph" | "userInput" | "prompt" | "llmChatV2" | "llmProfile" | "extractRegex" | "codeNew" | "expression" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "coalesce" | "didRun" | "passthrough" | "dataBus" | "startBackgroundBranch" | "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" | "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/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/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 & {
|
|
109
112
|
type: "mcpDiscovery";
|
|
110
113
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
111
114
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
@@ -8,6 +8,65 @@ import type { GraphProgress } from './GraphProgress.js';
|
|
|
8
8
|
import type { RivetStoredValue, RivetStoredValueCacheResult, RivetStoredValueReadResult, RivetStoredValueSetResult } from './StoredValueStore.js';
|
|
9
9
|
import type { ToolCallContinuation } from './ToolCallContinuation.js';
|
|
10
10
|
import type { KnowledgeStoreConnectionId, RivetKnowledgeStore } from '../integrations/KnowledgeStore.js';
|
|
11
|
+
import type { ChatV2Provider } from './chat-v2/chatV2ProviderTypes.js';
|
|
12
|
+
export type ChatV2CallId = Opaque<string, 'ChatV2CallId'>;
|
|
13
|
+
export type ChatV2CallOutcome = 'success' | 'provider-failure' | 'aborted';
|
|
14
|
+
/**
|
|
15
|
+
* Usage fields reported by the provider SDK for one physical Chat V2 call.
|
|
16
|
+
* The observer deliberately copies only usage data and never forwards provider
|
|
17
|
+
* metadata, request data, or authentication.
|
|
18
|
+
*/
|
|
19
|
+
export type ChatV2CallRawUsage = {
|
|
20
|
+
inputTokens?: number;
|
|
21
|
+
outputTokens?: number;
|
|
22
|
+
totalTokens?: number;
|
|
23
|
+
inputTokenDetails?: {
|
|
24
|
+
cacheReadTokens?: number;
|
|
25
|
+
cacheWriteTokens?: number;
|
|
26
|
+
noCacheTokens?: number;
|
|
27
|
+
};
|
|
28
|
+
outputTokenDetails?: {
|
|
29
|
+
reasoningTokens?: number;
|
|
30
|
+
textTokens?: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Rivet's provider-neutral names for usage reported by one physical call.
|
|
35
|
+
* Missing provider fields remain absent rather than being represented as zero.
|
|
36
|
+
*/
|
|
37
|
+
export type ChatV2CallNormalizedUsage = {
|
|
38
|
+
promptTokens?: number;
|
|
39
|
+
completionTokens?: number;
|
|
40
|
+
totalTokens?: number;
|
|
41
|
+
cachedTokens?: number;
|
|
42
|
+
reasoningTokens?: number;
|
|
43
|
+
};
|
|
44
|
+
export type ChatV2CallPricing = {
|
|
45
|
+
status: 'known' | 'unknown';
|
|
46
|
+
costUsd?: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Privacy-bounded accounting event for a single physical Chat V2 provider call.
|
|
50
|
+
*/
|
|
51
|
+
export type ChatV2CallFinishedEvent = {
|
|
52
|
+
callId: ChatV2CallId;
|
|
53
|
+
/** Zero-based attempt index within this Chat V2 pipeline request. */
|
|
54
|
+
attemptIndex: number;
|
|
55
|
+
/** Zero-based profile index when LLM Chat is using a profile fallback chain. */
|
|
56
|
+
profileIndex?: number;
|
|
57
|
+
/** Zero-based model round within one auto-continued LLM Chat invocation. */
|
|
58
|
+
roundIndex?: number;
|
|
59
|
+
nodeId: NodeId;
|
|
60
|
+
processId: ProcessId;
|
|
61
|
+
provider: ChatV2Provider;
|
|
62
|
+
model: string;
|
|
63
|
+
outcome: ChatV2CallOutcome;
|
|
64
|
+
finishReason?: string;
|
|
65
|
+
rawUsage?: ChatV2CallRawUsage;
|
|
66
|
+
normalizedUsage?: ChatV2CallNormalizedUsage;
|
|
67
|
+
pricing: ChatV2CallPricing;
|
|
68
|
+
};
|
|
69
|
+
export type ChatV2CallFinishedObserver = (event: ChatV2CallFinishedEvent) => void;
|
|
11
70
|
export type ProcessContext = {
|
|
12
71
|
settings: RuntimeSettings;
|
|
13
72
|
nativeApi?: NativeApi;
|
|
@@ -30,6 +89,11 @@ export type ProcessContext = {
|
|
|
30
89
|
* Runtime/library callers normally omit this; editor-only nodes/features can opt into it.
|
|
31
90
|
*/
|
|
32
91
|
editorExecutionCache?: Map<string, unknown>;
|
|
92
|
+
/**
|
|
93
|
+
* Host-only accounting hook invoked once after every physical LLM Chat
|
|
94
|
+
* provider attempt. Observer failures are isolated from graph execution.
|
|
95
|
+
*/
|
|
96
|
+
onChatV2CallFinished?: ChatV2CallFinishedObserver;
|
|
33
97
|
/**
|
|
34
98
|
* If implemented, chat nodes will first call this to resolve their configured endpoint to a final endpoint.
|
|
35
99
|
* You can use this for adding auth headers, or to load balance between multiple endpoints.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { type ChartNode } from './NodeBase.js';
|
|
1
|
+
import { type ChartNode, type NodeInputDefinition } from './NodeBase.js';
|
|
2
2
|
import type { ProcessId } from './ProcessContext.js';
|
|
3
3
|
import type { Inputs, Outputs } from './GraphProcessor.js';
|
|
4
4
|
export type SplitRunDeps = {
|
|
5
5
|
getInputValues(node: ChartNode): Inputs;
|
|
6
|
+
getInputDefinitions(node: ChartNode): NodeInputDefinition[];
|
|
6
7
|
isExcludedDueToControlFlow(node: ChartNode, inputValues: Inputs, processId: ProcessId): boolean;
|
|
7
8
|
processNodeWithInputData(node: ChartNode, inputs: Inputs, index: number, processId: ProcessId, partialOutput?: (node: ChartNode, partialOutputs: Outputs, index: number) => void): Promise<Outputs>;
|
|
8
9
|
splitRunConcurrency: number;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { NodeOutputs } from './NodeIO.js';
|
|
2
|
+
import type { ChartNode, NodeConnection, NodeId, PortId } from './NodeBase.js';
|
|
3
|
+
import type { NodeGraph } from './NodeGraph.js';
|
|
4
|
+
export type ToolCallContinuationAsyncBranchPlan = {
|
|
5
|
+
graph: NodeGraph;
|
|
6
|
+
nodeIds: ReadonlySet<NodeId>;
|
|
7
|
+
};
|
|
8
|
+
export type ToolCallContinuationBranchPlan = {
|
|
9
|
+
graph: NodeGraph;
|
|
10
|
+
preloadedOutputs: ReadonlyMap<NodeId, NodeOutputs>;
|
|
11
|
+
};
|
|
12
|
+
export type ToolCallContinuationBranchPlannerState = {
|
|
13
|
+
erroredNodeIds: ReadonlySet<NodeId>;
|
|
14
|
+
nodeOutputs: ReadonlyMap<NodeId, NodeOutputs>;
|
|
15
|
+
runToRelevantNodeIds: ReadonlySet<NodeId> | undefined;
|
|
16
|
+
visitedNodeIds: ReadonlySet<NodeId>;
|
|
17
|
+
};
|
|
18
|
+
export type ToolCallContinuationBranchPlanRequest = {
|
|
19
|
+
activeOutputPortIds: ReadonlySet<PortId>;
|
|
20
|
+
availableNodeOutputs: ReadonlyMap<NodeId, NodeOutputs>;
|
|
21
|
+
excludedNodeIds: ReadonlySet<NodeId>;
|
|
22
|
+
failOnUnsafeReadyNode?: boolean;
|
|
23
|
+
sourceNode: ChartNode;
|
|
24
|
+
sourceOutputs: NodeOutputs;
|
|
25
|
+
state: ToolCallContinuationBranchPlannerState;
|
|
26
|
+
};
|
|
27
|
+
export type ToolCallContinuationBranchPlanner = {
|
|
28
|
+
readonly unsafeNodeIds: ReadonlySet<NodeId>;
|
|
29
|
+
plan(request: ToolCallContinuationBranchPlanRequest): ToolCallContinuationBranchPlan | undefined;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Pure continuation-branch topology. Runtime state is supplied for each plan
|
|
33
|
+
* so a final branch can see outputs that completed while an early branch ran.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createToolCallContinuationBranchPlanner(options: {
|
|
36
|
+
asyncBranchPlansByTriggerNodeId: ReadonlyMap<NodeId, ToolCallContinuationAsyncBranchPlan>;
|
|
37
|
+
attachedNodeDataByNodeId: ReadonlyMap<NodeId, Readonly<Record<string, unknown>>>;
|
|
38
|
+
effectiveConnections: readonly NodeConnection[];
|
|
39
|
+
graph: NodeGraph;
|
|
40
|
+
isDefinitionValidConnection(connection: NodeConnection): boolean;
|
|
41
|
+
nodesById: Readonly<Record<NodeId, ChartNode | undefined>>;
|
|
42
|
+
stronglyConnectedComponents: readonly (readonly ChartNode[])[];
|
|
43
|
+
}): ToolCallContinuationBranchPlanner;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { DataValue } from './DataValue.js';
|
|
2
|
+
import type { NodeInputs, NodeOutputs } from './NodeIO.js';
|
|
3
|
+
import type { ChartNode, NodeId, PortId } from './NodeBase.js';
|
|
4
|
+
import type { InternalProcessContext, ProcessId } from './ProcessContext.js';
|
|
5
|
+
import type { StreamedFunctionCall } from './chat/streamChatResponse.js';
|
|
6
|
+
import type { DelegateFunctionCallNode } from './nodes/DelegateFunctionCallNode.js';
|
|
7
|
+
import { delegateToolCall } from './nodes/toolCallDelegation.js';
|
|
8
|
+
import type { ToolCallContinuationResult } from './ToolCallContinuation.js';
|
|
9
|
+
export type ToolCallContinuationBranchRunResult = {
|
|
10
|
+
graphOutputWrites: Record<string, DataValue>;
|
|
11
|
+
nodeOutputs: ReadonlyMap<NodeId, NodeOutputs>;
|
|
12
|
+
};
|
|
13
|
+
export type ToolCallContinuationInvocationResult = {
|
|
14
|
+
finalBranch: ToolCallContinuationBranchRunResult;
|
|
15
|
+
outputs: NodeOutputs;
|
|
16
|
+
preToolBranch: ToolCallContinuationBranchRunResult;
|
|
17
|
+
toolResult: Awaited<ReturnType<typeof delegateToolCall>>;
|
|
18
|
+
};
|
|
19
|
+
export type ToolCallContinuationRoundResult = {
|
|
20
|
+
invocations: readonly ToolCallContinuationInvocationResult[];
|
|
21
|
+
results: readonly ToolCallContinuationResult[];
|
|
22
|
+
};
|
|
23
|
+
export type ToolCallContinuationBranchAdapter = {
|
|
24
|
+
canRunContinuationBranches(llmNode: ChartNode, delegateNode: DelegateFunctionCallNode): boolean;
|
|
25
|
+
runOutputBranch(request: {
|
|
26
|
+
activeOutputPortIds: ReadonlySet<PortId>;
|
|
27
|
+
availableNodeOutputs: ReadonlyMap<NodeId, NodeOutputs>;
|
|
28
|
+
deferGraphOutputCommit: boolean;
|
|
29
|
+
excludedNodeIds: ReadonlySet<NodeId>;
|
|
30
|
+
failOnUnsafeReadyNode: boolean;
|
|
31
|
+
signal: AbortSignal;
|
|
32
|
+
sourceNode: ChartNode;
|
|
33
|
+
sourceOutputs: NodeOutputs;
|
|
34
|
+
}): Promise<ToolCallContinuationBranchRunResult>;
|
|
35
|
+
validatePreToolBranch(request: {
|
|
36
|
+
activeOutputPortIds: ReadonlySet<PortId>;
|
|
37
|
+
excludedNodeIds: ReadonlySet<NodeId>;
|
|
38
|
+
sourceNode: DelegateFunctionCallNode;
|
|
39
|
+
sourceOutputs: NodeOutputs;
|
|
40
|
+
}): void;
|
|
41
|
+
};
|
|
42
|
+
export type ToolCallContinuationCoordinatorAdapter = {
|
|
43
|
+
accumulateCost(outputs: NodeOutputs): void;
|
|
44
|
+
createBranchAdapter(): ToolCallContinuationBranchAdapter;
|
|
45
|
+
createDelegateProcessContext(node: DelegateFunctionCallNode, inputs: NodeInputs, processId: ProcessId, nodeAbortController: AbortController): InternalProcessContext;
|
|
46
|
+
createNodeAbortController(): AbortController;
|
|
47
|
+
emitDelegateError(node: DelegateFunctionCallNode, error: unknown, processId: ProcessId, timingStart: number | undefined): Promise<void>;
|
|
48
|
+
emitDelegateFinish(node: DelegateFunctionCallNode, outputs: NodeOutputs, processId: ProcessId, timingStart: number | undefined): Promise<void>;
|
|
49
|
+
emitDelegatePartialOutput(node: DelegateFunctionCallNode, outputs: NodeOutputs, processId: ProcessId): void;
|
|
50
|
+
emitDelegateStart(node: DelegateFunctionCallNode, inputs: NodeInputs, processId: ProcessId): Promise<void>;
|
|
51
|
+
getActiveOutputPortIds(node: ChartNode): ReadonlySet<PortId>;
|
|
52
|
+
getContinuationBranchBoundaryNodeIds(llmNode: ChartNode): ReadonlySet<NodeId>;
|
|
53
|
+
hasPreloadedOrFrozenDelegateOutput(node: DelegateFunctionCallNode, inputs: NodeInputs, processId: ProcessId): boolean;
|
|
54
|
+
registerNodeAbortController(nodeId: NodeId, controller: AbortController): void;
|
|
55
|
+
rootAbortSignal: AbortSignal;
|
|
56
|
+
unregisterNodeAbortController(nodeId: NodeId, controller: AbortController): void;
|
|
57
|
+
startNodeTiming(): number | undefined;
|
|
58
|
+
waitUntilUnpaused(): Promise<void>;
|
|
59
|
+
};
|
|
60
|
+
export declare class ToolCallContinuationCoordinator {
|
|
61
|
+
#private;
|
|
62
|
+
constructor(adapter: ToolCallContinuationCoordinatorAdapter);
|
|
63
|
+
run(options: {
|
|
64
|
+
assistantMessage: string;
|
|
65
|
+
delegateNode: DelegateFunctionCallNode;
|
|
66
|
+
llmNode: ChartNode;
|
|
67
|
+
llmSignal: AbortSignal;
|
|
68
|
+
toolCalls: readonly StreamedFunctionCall[];
|
|
69
|
+
}): Promise<ToolCallContinuationRoundResult>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatV2CallFinishedEvent, ChatV2CallId } from '../ProcessContext.js';
|
|
2
|
+
import type { RunChatV2PipelineOptions, StreamChatV2Result } from './chatV2Types.js';
|
|
3
|
+
export declare function createObservedChatV2CallId(options: RunChatV2PipelineOptions): ChatV2CallId | undefined;
|
|
4
|
+
export declare function notifyChatV2CallFinished(options: RunChatV2PipelineOptions, params: {
|
|
5
|
+
callId: ChatV2CallId | undefined;
|
|
6
|
+
attemptIndex: number;
|
|
7
|
+
outcome: ChatV2CallFinishedEvent['outcome'];
|
|
8
|
+
result?: StreamChatV2Result;
|
|
9
|
+
error?: unknown;
|
|
10
|
+
}): void;
|
|
@@ -2,6 +2,7 @@ import type { Outputs } from '../GraphProcessor.js';
|
|
|
2
2
|
import type { ResolvedChatV2ProviderConfig } from './providerOptions.js';
|
|
3
3
|
import type { ChatV2Provider, ChatV2ProviderOptions, ChatV2ToolChoice } from './chatV2Types.js';
|
|
4
4
|
import type { LLMChatV2EditorCacheKeyParts, LLMChatV2NodeData } from './llmChatV2NodeData.js';
|
|
5
|
+
import type { LLMProfileValue } from './llmProfileTypes.js';
|
|
5
6
|
export declare function buildLLMChatV2EditorCacheKey(parts: LLMChatV2EditorCacheKeyParts): string;
|
|
6
7
|
export declare function cloneLLMChatV2EditorCacheOutputs(outputs: Outputs): Outputs;
|
|
7
8
|
export declare function resolveLLMChatV2EditorCache(params: {
|
|
@@ -19,6 +20,9 @@ export declare function resolveLLMChatV2EditorCache(params: {
|
|
|
19
20
|
responseFormatParameters: unknown;
|
|
20
21
|
systemPrompt: unknown;
|
|
21
22
|
toolChoice: ChatV2ToolChoice | undefined;
|
|
23
|
+
profileChain?: readonly LLMProfileValue[] | undefined;
|
|
24
|
+
/** Keeps scalar profile output shapes distinct from one-item profile arrays. */
|
|
25
|
+
profileChainUsesArray?: boolean | undefined;
|
|
22
26
|
}): {
|
|
23
27
|
cacheKey: string | undefined;
|
|
24
28
|
cachedOutputs: Outputs | undefined;
|