@valerypopoff/rivet2-core 2.1.9 → 2.1.10
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 +3596 -1745
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/webAppRuntime.cjs +298 -21
- package/dist/cjs/webAppRuntime.cjs.map +4 -4
- package/dist/esm/exports.js +1 -0
- package/dist/esm/model/AgentResponseTrace.js +448 -0
- package/dist/esm/model/ConnectedToolContinuationHost.js +33 -0
- package/dist/esm/model/GraphProcessor.js +151 -74
- package/dist/esm/model/NodeImpl.js +6 -0
- package/dist/esm/model/ProcessContextBuilder.js +3 -1
- package/dist/esm/model/RecordingPlayer.js +164 -22
- package/dist/esm/model/SplitRunProcessor.js +49 -8
- package/dist/esm/model/SubprocessorBridge.js +2 -0
- package/dist/esm/model/ToolCallContinuationCoordinator.js +7 -3
- package/dist/esm/model/UiGraph.js +21 -0
- package/dist/esm/model/UiGraphActionProtocol.js +2 -0
- package/dist/esm/model/UiGraphBrowserRuntime.js +133 -4
- package/dist/esm/model/UiGraphRendererStyles.js +221 -0
- package/dist/esm/model/UiGraphRuntimeModel.js +9 -3
- package/dist/esm/model/UiGraphSchema.js +7 -1
- package/dist/esm/model/chat/aiSdkTools.js +3 -2
- package/dist/esm/model/chat-v2/chatV2CallObserver.js +9 -5
- package/dist/esm/model/chat-v2/chatV2EditorCache.js +42 -16
- package/dist/esm/model/chat-v2/chatV2Errors.js +7 -19
- package/dist/esm/model/chat-v2/chatV2FeatureCompatibility.js +1 -1
- package/dist/esm/model/chat-v2/chatV2Outputs.js +48 -108
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +61 -146
- package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +8 -2
- package/dist/esm/model/chat-v2/chatV2ProviderRegistry.js +9 -0
- package/dist/esm/model/chat-v2/chatV2RequestPlan.js +2 -3
- package/dist/esm/model/chat-v2/chatV2ResponseBodyCapture.js +55 -0
- package/dist/esm/model/chat-v2/chatV2ResponseFormat.js +8 -4
- package/dist/esm/model/chat-v2/chatV2Retry.js +4 -3
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +6 -1
- package/dist/esm/model/chat-v2/chatV2Types.js +5 -9
- package/dist/esm/model/chat-v2/chatV2UsageAccounting.js +78 -0
- package/dist/esm/model/chat-v2/customProviderApi.js +42 -0
- package/dist/esm/model/chat-v2/index.js +12 -0
- package/dist/esm/model/chat-v2/llmChatV2Body.js +281 -0
- package/dist/esm/model/chat-v2/llmChatV2CacheBoundary.js +32 -0
- package/dist/esm/model/chat-v2/llmChatV2CachePolicy.js +20 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +6 -50
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +25 -13
- package/dist/esm/model/chat-v2/llmChatV2NodeMigration.js +24 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +121 -193
- package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +60 -0
- package/dist/esm/model/chat-v2/llmInvocationDecision.js +11 -0
- package/dist/esm/model/chat-v2/llmInvocationJournal.js +43 -0
- package/dist/esm/model/chat-v2/llmInvocationPlan.js +68 -0
- package/dist/esm/model/chat-v2/llmInvocationProjections.js +5 -0
- package/dist/esm/model/chat-v2/llmInvocationResultProjector.js +48 -0
- package/dist/esm/model/chat-v2/llmModelCandidate.js +75 -0
- package/dist/esm/model/chat-v2/llmProfile.js +10 -65
- package/dist/esm/model/chat-v2/llmProfileBody.js +183 -0
- package/dist/esm/model/chat-v2/llmProfileFallback.js +55 -99
- package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +67 -0
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +3 -0
- package/dist/esm/model/chat-v2/llmProfileTypes.js +1 -18
- package/dist/esm/model/chat-v2/llmResponseMaterializer.js +42 -0
- package/dist/esm/model/chat-v2/modelRegistry.js +54 -4
- package/dist/esm/model/chat-v2/parallelToolCalls.js +9 -2
- package/dist/esm/model/chat-v2/providerOptions.js +86 -20
- package/dist/esm/model/chat-v2/rivetToolRegistry.js +9 -0
- package/dist/esm/model/chat-v2/toolCallCodec.js +52 -0
- package/dist/esm/model/chat-v2/toolContinuation.js +72 -35
- package/dist/esm/model/chat-v2/toolHandlerResolver.js +23 -0
- package/dist/esm/model/chat-v2/toolRoundExecutor.js +12 -0
- package/dist/esm/model/nodes/ChatNode.js +6 -0
- package/dist/esm/model/nodes/ChatNodeBase.js +1 -0
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +19 -6
- package/dist/esm/model/nodes/LLMChatV2Node.js +112 -229
- package/dist/esm/model/nodes/LLMProfileNode.js +27 -8
- package/dist/esm/model/nodes/PromptNode.js +7 -0
- package/dist/esm/model/nodes/ToolNode.js +7 -0
- package/dist/esm/model/nodes/toolCallDelegation.js +177 -110
- package/dist/esm/plugins/anthropic/anthropic.js +4 -4
- package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +7 -0
- package/dist/esm/plugins/google/google.js +5 -9
- package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +4 -1
- package/dist/esm/recording/ExecutionRecorder.js +13 -5
- package/dist/esm/utils/emitDetached.js +6 -3
- package/dist/esm/utils/openai.js +60 -16
- package/dist/esm/utils/serialization/serialization.js +2 -19
- package/dist/esm/webAppRuntime.js +3 -2
- package/dist/types/exports.d.ts +1 -0
- package/dist/types/model/AgentResponseTrace.d.ts +110 -0
- package/dist/types/model/ConnectedToolContinuationHost.d.ts +34 -0
- package/dist/types/model/ExecutorProtocol.d.ts +25 -7
- package/dist/types/model/GraphProcessor.d.ts +27 -5
- package/dist/types/model/NodeImpl.d.ts +18 -1
- package/dist/types/model/Nodes.d.ts +2 -2
- package/dist/types/model/ProcessContext.d.ts +47 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +3 -1
- package/dist/types/model/RecordingPlayer.d.ts +6 -0
- package/dist/types/model/SplitRunProcessor.d.ts +10 -3
- package/dist/types/model/UiGraph.d.ts +8 -0
- package/dist/types/model/UiGraphActionProtocol.d.ts +2 -0
- package/dist/types/model/UiGraphBrowserRuntime.d.ts +11 -2
- package/dist/types/model/UiGraphRendererStyles.d.ts +1 -1
- package/dist/types/model/UiGraphRuntimeModel.d.ts +2 -0
- package/dist/types/model/UiGraphSchema.d.ts +1 -0
- package/dist/types/model/chat-v2/chatV2CallObserver.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +1 -3
- package/dist/types/model/chat-v2/chatV2Outputs.d.ts +6 -16
- package/dist/types/model/chat-v2/chatV2Pipeline.d.ts +13 -17
- package/dist/types/model/chat-v2/chatV2ProviderProfile.d.ts +4 -0
- package/dist/types/model/chat-v2/chatV2ProviderRegistry.d.ts +8 -0
- package/dist/types/model/chat-v2/chatV2RequestPlan.d.ts +2 -2
- package/dist/types/model/chat-v2/chatV2ResponseBodyCapture.d.ts +19 -0
- package/dist/types/model/chat-v2/chatV2ResponseFormat.d.ts +3 -2
- package/dist/types/model/chat-v2/chatV2Retry.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2Types.d.ts +20 -10
- package/dist/types/model/chat-v2/chatV2UsageAccounting.d.ts +14 -0
- package/dist/types/model/chat-v2/customProviderApi.d.ts +23 -0
- package/dist/types/model/chat-v2/index.d.ts +12 -0
- package/dist/types/model/chat-v2/llmChatV2Body.d.ts +24 -0
- package/dist/types/model/chat-v2/llmChatV2CacheBoundary.d.ts +10 -0
- package/dist/types/model/chat-v2/llmChatV2CachePolicy.d.ts +13 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +10 -3
- package/dist/types/model/chat-v2/llmChatV2NodeMigration.d.ts +8 -0
- package/dist/types/model/chat-v2/llmChatV2NodeRuntime.d.ts +14 -16
- package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +16 -0
- package/dist/types/model/chat-v2/llmInvocationDecision.d.ts +21 -0
- package/dist/types/model/chat-v2/llmInvocationJournal.d.ts +38 -0
- package/dist/types/model/chat-v2/llmInvocationPlan.d.ts +41 -0
- package/dist/types/model/chat-v2/llmInvocationProjections.d.ts +3 -0
- package/dist/types/model/chat-v2/llmInvocationResultProjector.d.ts +26 -0
- package/dist/types/model/chat-v2/llmModelCandidate.d.ts +18 -0
- package/dist/types/model/chat-v2/llmProfileBody.d.ts +20 -0
- package/dist/types/model/chat-v2/llmProfileFallback.d.ts +17 -49
- package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +189 -0
- package/dist/types/model/chat-v2/llmProfileTypes.d.ts +1 -1
- package/dist/types/model/chat-v2/llmResponseMaterializer.d.ts +20 -0
- package/dist/types/model/chat-v2/modelRegistry.d.ts +17 -187
- package/dist/types/model/chat-v2/parallelToolCalls.d.ts +3 -1
- package/dist/types/model/chat-v2/providerOptions.d.ts +10 -0
- package/dist/types/model/chat-v2/rivetToolRegistry.d.ts +11 -0
- package/dist/types/model/chat-v2/toolCallCodec.d.ts +7 -0
- package/dist/types/model/chat-v2/toolContinuation.d.ts +3 -3
- package/dist/types/model/chat-v2/toolHandlerResolver.d.ts +25 -0
- package/dist/types/model/chat-v2/toolRoundExecutor.d.ts +18 -0
- package/dist/types/model/nodes/ChatNode.d.ts +2 -1
- package/dist/types/model/nodes/DelegateFunctionCallNode.d.ts +2 -1
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +2 -1
- package/dist/types/model/nodes/LLMProfileNode.d.ts +2 -1
- package/dist/types/model/nodes/PromptNode.d.ts +4 -1
- package/dist/types/model/nodes/ToolNode.d.ts +2 -1
- package/dist/types/model/nodes/toolCallDelegation.d.ts +10 -3
- package/dist/types/plugins/anthropic/anthropic.d.ts +1 -0
- package/dist/types/plugins/google/google.d.ts +2 -8
- package/dist/types/recording/RecordedEvents.d.ts +6 -0
- package/dist/types/utils/emitDetached.d.ts +3 -2
- package/dist/types/utils/openai.d.ts +49 -0
- package/dist/types/webAppRuntime.d.ts +4 -2
- package/package.json +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GptFunction } from '../DataValue.js';
|
|
2
|
+
/**
|
|
3
|
+
* Canonical Rivet tool declaration lookup. Provider projections historically
|
|
4
|
+
* use last declaration wins for duplicate names; retain that compatibility in
|
|
5
|
+
* one explicit place.
|
|
6
|
+
*/
|
|
7
|
+
export type RivetToolRegistry = {
|
|
8
|
+
byName: ReadonlyMap<string, GptFunction>;
|
|
9
|
+
names: ReadonlySet<string>;
|
|
10
|
+
};
|
|
11
|
+
export declare function createRivetToolRegistry(functions: readonly GptFunction[] | undefined): RivetToolRegistry;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ChatMessage, ParsedAssistantChatMessageFunctionCall } from '../DataValue.js';
|
|
2
|
+
import type { DelegatedToolCallRecord } from '../nodes/toolCallDelegation.js';
|
|
3
|
+
/** Provider/tool boundary codec shared by internal and connected delegation. */
|
|
4
|
+
export declare function normalizeToolCall(input: unknown): ParsedAssistantChatMessageFunctionCall;
|
|
5
|
+
export declare function createToolResultMessage(toolCall: ParsedAssistantChatMessageFunctionCall, output: string): ChatMessage;
|
|
6
|
+
export declare function createDelegatedToolCallRecord(toolCall: ParsedAssistantChatMessageFunctionCall, output: string, executionTimeMs?: number): DelegatedToolCallRecord;
|
|
7
|
+
export declare function stringifyToolResult(output: unknown): string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { ChatMessageDataValue, GptFunction } from '../DataValue.js';
|
|
2
|
-
import type { ChatV2PipelineResult,
|
|
2
|
+
import type { ChatV2PipelineResult, ChatV2PipelineRoundOptions } from './chatV2Types.js';
|
|
3
3
|
import type { StreamedFunctionCall } from '../chat/streamChatResponse.js';
|
|
4
4
|
import type { DelegatedToolCallRecord } from '../nodes/toolCallDelegation.js';
|
|
5
|
-
export type ToolContinuationOptions =
|
|
5
|
+
export type ToolContinuationOptions = ChatV2PipelineRoundOptions & {
|
|
6
6
|
autoContinue: boolean;
|
|
7
7
|
maxToolRounds: number;
|
|
8
8
|
functions: GptFunction[] | undefined;
|
|
9
9
|
delegateToolCall: (toolCall: StreamedFunctionCall) => Promise<ToolContinuationToolResult>;
|
|
10
10
|
delegateToolCallRound?: (toolCalls: StreamedFunctionCall[], preToolMessage: string) => Promise<ToolContinuationToolResult[]>;
|
|
11
|
-
runPipeline
|
|
11
|
+
runPipeline: (options: ChatV2PipelineRoundOptions) => Promise<ChatV2PipelineResult>;
|
|
12
12
|
};
|
|
13
13
|
export type ToolContinuationToolResult = ChatMessageDataValue & {
|
|
14
14
|
delegatedToolCall?: DelegatedToolCallRecord;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { GraphId } from '../NodeGraph.js';
|
|
2
|
+
import type { Project } from '../Project.js';
|
|
3
|
+
import type { ToolCallDelegationConfig } from '../nodes/toolCallDelegation.js';
|
|
4
|
+
export type ResolvedToolHandler = {
|
|
5
|
+
kind: 'graph';
|
|
6
|
+
graphId: GraphId;
|
|
7
|
+
graphName?: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'external';
|
|
10
|
+
name: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'unknown';
|
|
13
|
+
graphId: GraphId;
|
|
14
|
+
};
|
|
15
|
+
export declare function findAutoDelegateGraphCandidate<T>(candidates: readonly T[], toolName: string, getGraphName: (candidate: T) => string | undefined): T | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Preserves legacy exact-name then first fuzzy auto-delegation matching in a
|
|
18
|
+
* single resolver, making all runtime paths use identical routing.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveToolHandler(params: {
|
|
21
|
+
project: Project;
|
|
22
|
+
toolName: string;
|
|
23
|
+
config: ToolCallDelegationConfig;
|
|
24
|
+
hasExternalFunction: boolean;
|
|
25
|
+
}): ResolvedToolHandler | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StreamedFunctionCall } from '../chat/streamChatResponse.js';
|
|
2
|
+
import type { ToolContinuationToolResult } from './toolContinuation.js';
|
|
3
|
+
/** Provider-neutral contract for one complete model tool-call round. */
|
|
4
|
+
export type ToolRoundExecutor = {
|
|
5
|
+
executeRound(params: {
|
|
6
|
+
calls: readonly StreamedFunctionCall[];
|
|
7
|
+
assistantMessage: string;
|
|
8
|
+
}): Promise<readonly ToolContinuationToolResult[]>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Adapts the legacy individual/round callbacks without changing their
|
|
12
|
+
* concurrency semantics: a connected host owns a full round; internal
|
|
13
|
+
* delegation starts independent calls in parallel.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createCallbackToolRoundExecutor(params: {
|
|
16
|
+
delegateOne: (call: StreamedFunctionCall) => Promise<ToolContinuationToolResult>;
|
|
17
|
+
delegateRound?: ((calls: StreamedFunctionCall[], assistantMessage: string) => Promise<ToolContinuationToolResult[]>) | undefined;
|
|
18
|
+
}): ToolRoundExecutor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ChartNode, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
|
|
2
|
-
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
2
|
+
import { NodeImpl, type NodeRunActivityDescriptor, type NodeUIData } from '../NodeImpl.js';
|
|
3
3
|
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
4
4
|
import { type InternalProcessContext } from '../ProcessContext.js';
|
|
5
5
|
import { type EditorDefinition } from '../../index.js';
|
|
@@ -9,6 +9,7 @@ export declare class ChatNodeImpl extends NodeImpl<ChatNode> {
|
|
|
9
9
|
static create(): ChatNode;
|
|
10
10
|
getInputDefinitions(): NodeInputDefinition[];
|
|
11
11
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
12
|
+
getRunActivityDescriptor(): NodeRunActivityDescriptor;
|
|
12
13
|
static getUIData(): NodeUIData;
|
|
13
14
|
getEditors(): EditorDefinition<ChatNode>[];
|
|
14
15
|
getBody(): string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChartNode, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
2
2
|
import type { GraphId } from '../NodeGraph.js';
|
|
3
|
-
import { NodeImpl, type NodeBody, type NodeUIData } from '../NodeImpl.js';
|
|
3
|
+
import { NodeImpl, type NodeBody, type NodeRunActivityDescriptor, type NodeUIData } from '../NodeImpl.js';
|
|
4
4
|
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
5
5
|
import type { RivetUIContext } from '../RivetUIContext.js';
|
|
6
6
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
@@ -20,6 +20,7 @@ export declare class DelegateFunctionCallNodeImpl extends NodeImpl<DelegateFunct
|
|
|
20
20
|
static create(): DelegateFunctionCallNode;
|
|
21
21
|
getInputDefinitions(): NodeInputDefinition[];
|
|
22
22
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
23
|
+
getRunActivityDescriptor(): NodeRunActivityDescriptor;
|
|
23
24
|
static getUIData(): NodeUIData;
|
|
24
25
|
getEditors(): EditorDefinition<DelegateFunctionCallNode>[];
|
|
25
26
|
getBody(context: RivetUIContext): NodeBody;
|
|
@@ -2,7 +2,7 @@ import type { EditorDefinition } from '../EditorDefinition.js';
|
|
|
2
2
|
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
3
3
|
import type { NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
4
4
|
import type { NodeBodySpec } from '../NodeBodySpec.js';
|
|
5
|
-
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
5
|
+
import { NodeImpl, type NodeRunActivityDescriptor, type NodeUIData } from '../NodeImpl.js';
|
|
6
6
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
7
7
|
import type { RivetUIContext } from '../RivetUIContext.js';
|
|
8
8
|
import { type LLMChatV2Node } from '../chat-v2/llmChatV2NodeData.js';
|
|
@@ -11,6 +11,7 @@ export type { LLMChatV2ApiKeySource, LLMChatV2EditorCacheKeyParts, LLMChatV2Node
|
|
|
11
11
|
export { buildLLMChatV2EditorCacheKey, resolveLLMChatV2RuntimeProviderOptions };
|
|
12
12
|
export declare class LLMChatV2NodeImpl extends NodeImpl<LLMChatV2Node> {
|
|
13
13
|
static create(): LLMChatV2Node;
|
|
14
|
+
getRunActivityDescriptor(): NodeRunActivityDescriptor;
|
|
14
15
|
getInputDefinitions(): NodeInputDefinition[];
|
|
15
16
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
16
17
|
static getUIData(): NodeUIData;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
2
2
|
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
3
3
|
import type { ChartNode, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
4
|
+
import type { NodeBodySpec } from '../NodeBodySpec.js';
|
|
4
5
|
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
5
6
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
6
7
|
import type { RivetUIContext } from '../RivetUIContext.js';
|
|
@@ -13,7 +14,7 @@ export declare class LLMProfileNodeImpl extends NodeImpl<LLMProfileNode> {
|
|
|
13
14
|
getInputDefinitions(): NodeInputDefinition[];
|
|
14
15
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
15
16
|
getEditors(context: RivetUIContext): Promise<EditorDefinition<LLMProfileNode>[]>;
|
|
16
|
-
getBody():
|
|
17
|
+
getBody(): NodeBodySpec;
|
|
17
18
|
static getUIData(): NodeUIData;
|
|
18
19
|
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
19
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChartNode, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
|
|
1
|
+
import { type ChartNode, type NodeInputDefinition, type PortId, type NodeOutputDefinition } from '../NodeBase.js';
|
|
2
2
|
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
3
3
|
import { type ChatMessage, type EditorDefinition, type Inputs, type InternalProcessContext, type NodeBodySpec, type Outputs } from '../../index.js';
|
|
4
4
|
export type PromptNode = ChartNode<'prompt', PromptNodeData>;
|
|
@@ -17,6 +17,9 @@ export declare class PromptNodeImpl extends NodeImpl<PromptNode> {
|
|
|
17
17
|
static create(): PromptNode;
|
|
18
18
|
getInputDefinitions(): NodeInputDefinition[];
|
|
19
19
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
20
|
+
getRunActivityDescriptor(): {
|
|
21
|
+
primaryOutputPortId: PortId;
|
|
22
|
+
};
|
|
20
23
|
getEditors(): EditorDefinition<PromptNode>[];
|
|
21
24
|
getBody(): string | NodeBodySpec | NodeBodySpec[] | undefined;
|
|
22
25
|
static getUIData(): NodeUIData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ChartNode, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
|
|
2
|
-
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
2
|
+
import { NodeImpl, type NodeRunActivityDescriptor, type NodeUIData } from '../NodeImpl.js';
|
|
3
3
|
import { type EditorDefinition } from '../EditorDefinition.js';
|
|
4
4
|
import { type NodeBodySpec } from '../NodeBodySpec.js';
|
|
5
5
|
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
@@ -19,6 +19,7 @@ export declare class GptFunctionNodeImpl extends NodeImpl<GptFunctionNode> {
|
|
|
19
19
|
static create(): GptFunctionNode;
|
|
20
20
|
getInputDefinitions(): NodeInputDefinition[];
|
|
21
21
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
22
|
+
getRunActivityDescriptor(): NodeRunActivityDescriptor;
|
|
22
23
|
getEditors(): EditorDefinition<GptFunctionNode>[];
|
|
23
24
|
getBody(): string | NodeBodySpec | undefined;
|
|
24
25
|
static getUIData(): NodeUIData;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatMessage } from '../DataValue.js';
|
|
2
2
|
import type { GraphId } from '../NodeGraph.js';
|
|
3
3
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
4
4
|
import type { Outputs } from '../GraphProcessor.js';
|
|
5
|
+
import { normalizeToolCall } from '../chat-v2/toolCallCodec.js';
|
|
6
|
+
import { findAutoDelegateGraphCandidate } from '../chat-v2/toolHandlerResolver.js';
|
|
5
7
|
export type ToolCallDelegationConfig = {
|
|
6
8
|
handlers: {
|
|
7
9
|
key: string | undefined;
|
|
@@ -18,6 +20,8 @@ export type ToolCallDelegationResult = {
|
|
|
18
20
|
record: DelegatedToolCallRecord;
|
|
19
21
|
/** Cost from this live delegation. Kept out of the replay record so replay cannot charge it again. */
|
|
20
22
|
cost?: number;
|
|
23
|
+
/** Internal trace disposition; never exposed through node ports. */
|
|
24
|
+
traceOutcome?: 'success' | 'passthrough-error';
|
|
21
25
|
};
|
|
22
26
|
export type DelegatedToolCallRecord = {
|
|
23
27
|
delegatedToolCall: true;
|
|
@@ -25,6 +29,8 @@ export type DelegatedToolCallRecord = {
|
|
|
25
29
|
arguments: Record<string, unknown>;
|
|
26
30
|
id?: string;
|
|
27
31
|
output: string;
|
|
32
|
+
/** Milliseconds spent running the handler graph or external function. Absent on legacy records. */
|
|
33
|
+
executionTimeMs?: number;
|
|
28
34
|
message: ChatMessage;
|
|
29
35
|
};
|
|
30
36
|
/**
|
|
@@ -35,8 +41,9 @@ export type DelegatedToolCallRecord = {
|
|
|
35
41
|
* entries and uses their map keys. Keeping that distinction here preserves the
|
|
36
42
|
* existing behavior for malformed projects where those identities disagree.
|
|
37
43
|
*/
|
|
38
|
-
export
|
|
44
|
+
export { findAutoDelegateGraphCandidate };
|
|
39
45
|
export declare function isDelegatedToolCallRecord(input: unknown): input is DelegatedToolCallRecord;
|
|
40
46
|
export declare function buildDelegatedToolCallOutputs(records: DelegatedToolCallRecord[], preToolMessage?: string, cost?: number): Outputs;
|
|
41
|
-
|
|
47
|
+
/** @deprecated Use normalizeToolCall from the canonical chat-v2 codec. */
|
|
48
|
+
export declare const normalizeFunctionCallInput: typeof normalizeToolCall;
|
|
42
49
|
export declare function delegateToolCall(rawFunctionCall: unknown, context: InternalProcessContext, config: ToolCallDelegationConfig): Promise<ToolCallDelegationResult>;
|
|
@@ -69,19 +69,13 @@ export declare const generativeAiGoogleModels: {
|
|
|
69
69
|
};
|
|
70
70
|
'gemini-1.5-pro': {
|
|
71
71
|
maxTokens: number;
|
|
72
|
-
cost: {
|
|
73
|
-
prompt: number;
|
|
74
|
-
completion: number;
|
|
75
|
-
};
|
|
76
72
|
displayName: string;
|
|
73
|
+
pricing: "unpriced";
|
|
77
74
|
};
|
|
78
75
|
'gemini-1.5-flash': {
|
|
79
76
|
maxTokens: number;
|
|
80
|
-
cost: {
|
|
81
|
-
prompt: number;
|
|
82
|
-
completion: number;
|
|
83
|
-
};
|
|
84
77
|
displayName: string;
|
|
78
|
+
pricing: "unpriced";
|
|
85
79
|
};
|
|
86
80
|
};
|
|
87
81
|
export type GenerativeAiGoogleModel = keyof typeof generativeAiGoogleModels;
|
|
@@ -42,13 +42,16 @@ export type RecordedEventsMap = OverrideProperties<ProcessEvents, {
|
|
|
42
42
|
nodeStart: WithOptionalExecution<{
|
|
43
43
|
nodeId: NodeId;
|
|
44
44
|
inputs: Inputs;
|
|
45
|
+
inputConnections?: ProcessEvents['nodeStart']['inputConnections'];
|
|
45
46
|
processId: ProcessId;
|
|
47
|
+
resultOrigin?: ProcessEvents['nodeStart']['resultOrigin'];
|
|
46
48
|
}>;
|
|
47
49
|
/** Called when a node has finished processing, with the output values for the node. */
|
|
48
50
|
nodeFinish: WithOptionalExecution<{
|
|
49
51
|
nodeId: NodeId;
|
|
50
52
|
outputs: Outputs;
|
|
51
53
|
processId: ProcessId;
|
|
54
|
+
resultOrigin?: ProcessEvents['nodeFinish']['resultOrigin'];
|
|
52
55
|
durationMs?: number;
|
|
53
56
|
splitRunDurationMs?: Record<number, number>;
|
|
54
57
|
}>;
|
|
@@ -57,6 +60,7 @@ export type RecordedEventsMap = OverrideProperties<ProcessEvents, {
|
|
|
57
60
|
nodeId: NodeId;
|
|
58
61
|
error: string;
|
|
59
62
|
processId: ProcessId;
|
|
63
|
+
resultOrigin?: ProcessEvents['nodeError']['resultOrigin'];
|
|
60
64
|
durationMs?: number;
|
|
61
65
|
splitRunDurationMs?: Record<number, number>;
|
|
62
66
|
}>;
|
|
@@ -67,6 +71,7 @@ export type RecordedEventsMap = OverrideProperties<ProcessEvents, {
|
|
|
67
71
|
inputs: Inputs;
|
|
68
72
|
outputs: Outputs;
|
|
69
73
|
reason: string;
|
|
74
|
+
resultOrigin?: ProcessEvents['nodeExcluded']['resultOrigin'];
|
|
70
75
|
}>;
|
|
71
76
|
/** Called when a user input node requires user input. Call the callback when finished, or call userInput() on the GraphProcessor with the results. */
|
|
72
77
|
userInput: WithOptionalExecution<{
|
|
@@ -83,6 +88,7 @@ export type RecordedEventsMap = OverrideProperties<ProcessEvents, {
|
|
|
83
88
|
outputs: Outputs;
|
|
84
89
|
index: number;
|
|
85
90
|
processId: ProcessId;
|
|
91
|
+
resultOrigin?: ProcessEvents['partialOutput']['resultOrigin'];
|
|
86
92
|
}>;
|
|
87
93
|
progress: WithOptionalExecution<{
|
|
88
94
|
nodeId: NodeId;
|
|
@@ -5,7 +5,8 @@ import type Emittery from 'emittery';
|
|
|
5
5
|
* Use this instead of inline `// eslint-disable-next-line @typescript-eslint/no-floating-promises`
|
|
6
6
|
* to make the "detached async" intent explicit and auditable.
|
|
7
7
|
*
|
|
8
|
-
* The returned promise is intentionally
|
|
9
|
-
*
|
|
8
|
+
* The returned promise is intentionally detached and listener failures are
|
|
9
|
+
* contained. Call this only for observer events where listener completion or
|
|
10
|
+
* failure must not affect processor ordering.
|
|
10
11
|
*/
|
|
11
12
|
export declare function emitDetached<T extends Record<string, unknown>>(emitter: Emittery<T>, event: keyof T & string, data: T[keyof T & string]): void;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export type OpenAIModel = {
|
|
2
2
|
maxTokens: number;
|
|
3
|
+
/**
|
|
4
|
+
* USD per 1,000 tokens. This is the legacy Chat-node unit consumed by
|
|
5
|
+
* `chatCost.getCostForTokens`; LLM Chat V2 normalizes it at its own registry
|
|
6
|
+
* boundary before multiplying by raw token counts.
|
|
7
|
+
*/
|
|
3
8
|
cost: {
|
|
4
9
|
prompt: number;
|
|
5
10
|
completion: number;
|
|
@@ -13,6 +18,50 @@ export type OpenAIModel = {
|
|
|
13
18
|
};
|
|
14
19
|
export declare const defaultOpenaiSupported: NonNullable<OpenAIModel['supported']>;
|
|
15
20
|
export declare const openaiModels: {
|
|
21
|
+
'gpt-5.6': {
|
|
22
|
+
maxTokens: number;
|
|
23
|
+
cost: {
|
|
24
|
+
prompt: number;
|
|
25
|
+
completion: number;
|
|
26
|
+
};
|
|
27
|
+
displayName: string;
|
|
28
|
+
supported: {
|
|
29
|
+
parallelFunctionCalls: true;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
'gpt-5.6-sol': {
|
|
33
|
+
maxTokens: number;
|
|
34
|
+
cost: {
|
|
35
|
+
prompt: number;
|
|
36
|
+
completion: number;
|
|
37
|
+
};
|
|
38
|
+
displayName: string;
|
|
39
|
+
supported: {
|
|
40
|
+
parallelFunctionCalls: true;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
'gpt-5.6-terra': {
|
|
44
|
+
maxTokens: number;
|
|
45
|
+
cost: {
|
|
46
|
+
prompt: number;
|
|
47
|
+
completion: number;
|
|
48
|
+
};
|
|
49
|
+
displayName: string;
|
|
50
|
+
supported: {
|
|
51
|
+
parallelFunctionCalls: true;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
'gpt-5.6-luna': {
|
|
55
|
+
maxTokens: number;
|
|
56
|
+
cost: {
|
|
57
|
+
prompt: number;
|
|
58
|
+
completion: number;
|
|
59
|
+
};
|
|
60
|
+
displayName: string;
|
|
61
|
+
supported: {
|
|
62
|
+
parallelFunctionCalls: true;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
16
65
|
'gpt-5': {
|
|
17
66
|
maxTokens: number;
|
|
18
67
|
cost: {
|
|
@@ -2,9 +2,11 @@ export type { UiComponentId, UiGraph, UiGraphActionComponent, UiGraphChatMessage
|
|
|
2
2
|
export type { UiGraphInteractionSnapshot } from './model/UiGraphRuntimeModel.js';
|
|
3
3
|
export type { RivetWebAppClientMessage, RivetWebAppRunEvent, RivetWebAppServerMessage, } from './model/UiGraphActionProtocol.js';
|
|
4
4
|
export type { GraphProgress } from './model/GraphProgress.js';
|
|
5
|
+
export type { AgentResponseTrace } from './model/AgentResponseTrace.js';
|
|
6
|
+
export { isAgentResponseTrace } from './model/AgentResponseTrace.js';
|
|
5
7
|
export type { RivetMarkdownSanitizerPolicy } from './model/MarkdownSanitizationPolicy.js';
|
|
6
8
|
export type { UiGraphChatMessagePresentation, UiGraphChatMessagePresentationOptions, UiGraphChatMessageTimestampPresentation, } from './model/UiGraphBrowserRuntime.js';
|
|
7
|
-
export { createUiGraphChatHistoryFlushStatePatch, createUiGraphChatPinStatePatch, createUiGraphChatSubmissionStatePatch, getUiGraphActionState, getUiGraphChatDraftStateKey, getUiGraphChatMessagesStateKey, } from './model/UiGraph.js';
|
|
9
|
+
export { createUiGraphChatHistoryFlushStatePatch, createUiGraphChatMessageRemovalStatePatch, createUiGraphChatPinStatePatch, createUiGraphChatSubmissionStatePatch, getUiGraphActionState, getUiGraphChatDraftStateKey, getUiGraphChatMessagesStateKey, } from './model/UiGraph.js';
|
|
8
10
|
export { applyUiGraphStatePatch, createUiGraphActionExecutionController, createUiGraphInteractionController, getUiGraphComponentRenderModel, getUiGraphJsonOutputFilename, getUiGraphProgressiveJsonOutputChunks, } from './model/UiGraphRuntimeModel.js';
|
|
9
11
|
export { parseRivetWebAppClientMessage, parseRivetWebAppServerMessage, RIVET_WEB_APP_ACTION_PROTOCOL_VERSION, } from './model/UiGraphActionProtocol.js';
|
|
10
|
-
export { copyUiGraphText, applyUiGraphWebAppStorageActionPatch, applyUiGraphWebAppStoragePatch, clearUiGraphChatSearchMatches, downloadUiGraphJsonOutput, enhanceUiGraphChatJsonCodeBlocks, hasUiGraphChatPersistentStateChanged, getUiGraphChatPersistentState, getUiGraphChatMessagePresentations, getUiGraphChatStorageKey, getUiGraphWebAppStorageKey, highlightUiGraphChatSearchMatches, loadUiGraphChatPersistentState, loadUiGraphWebAppStorage, observeUiGraphOutputResizeBounds, revealUiGraphChatElement, revealUiGraphChatSearchMatch, saveUiGraphChatPersistentState, } from './model/UiGraphBrowserRuntime.js';
|
|
12
|
+
export { copyUiGraphText, applyUiGraphWebAppStorageActionPatch, applyUiGraphWebAppStoragePatch, clearUiGraphChatSearchMatches, downloadUiGraphJsonOutput, enhanceUiGraphChatJsonCodeBlocks, hasUiGraphChatPersistentStateChanged, getUiGraphChatPersistentState, getUiGraphChatMessagePresentations, getUiGraphChatStorageKey, getUiGraphWebAppStorageKey, highlightUiGraphChatSearchMatches, loadUiGraphChatPersistentState, loadUiGraphWebAppStorage, observeUiGraphOutputResizeBounds, revealUiGraphChatElement, revealUiGraphChatSearchMatch, saveUiGraphChatPersistentState, saveUiGraphResponseTrace, loadUiGraphResponseTrace, pruneUiGraphResponseTraces, } from './model/UiGraphBrowserRuntime.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valerypopoff/rivet2-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/cjs/bundle.cjs",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"mdast-util-to-markdown": "^2.1.2",
|
|
68
68
|
"minimatch": "^10.2.5",
|
|
69
69
|
"mustache": "^4.2.0",
|
|
70
|
-
"nanoid": "^3.3.
|
|
70
|
+
"nanoid": "^3.3.16",
|
|
71
71
|
"openai": "^4.28.4",
|
|
72
72
|
"p-queue": "^7.4.1",
|
|
73
73
|
"p-queue-6": "npm:p-queue@^6.0.0",
|