@valerypopoff/rivet2-core 2.1.9 → 2.3.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.
Files changed (188) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/bundle.cjs +5618 -2533
  3. package/dist/cjs/bundle.cjs.map +4 -4
  4. package/dist/cjs/webAppRuntime.cjs +333 -22
  5. package/dist/cjs/webAppRuntime.cjs.map +4 -4
  6. package/dist/esm/api/createProcessor.js +2 -0
  7. package/dist/esm/exports.js +1 -0
  8. package/dist/esm/integrations/CodeRunner.js +2 -7
  9. package/dist/esm/integrations/CodeRunnerOptions.js +7 -0
  10. package/dist/esm/model/AgentResponseTrace.js +558 -0
  11. package/dist/esm/model/ConnectedToolContinuationHost.js +33 -0
  12. package/dist/esm/model/GraphProcessor.js +165 -74
  13. package/dist/esm/model/NodeImpl.js +6 -0
  14. package/dist/esm/model/ProcessContextBuilder.js +3 -1
  15. package/dist/esm/model/RecordingPlayer.js +212 -25
  16. package/dist/esm/model/SplitRunProcessor.js +49 -8
  17. package/dist/esm/model/SubprocessorBridge.js +3 -0
  18. package/dist/esm/model/ToolCallContinuationCoordinator.js +7 -3
  19. package/dist/esm/model/UiGraph.js +21 -0
  20. package/dist/esm/model/UiGraphActionProtocol.js +3 -0
  21. package/dist/esm/model/UiGraphBrowserRuntime.js +133 -4
  22. package/dist/esm/model/UiGraphRendererStyles.js +221 -0
  23. package/dist/esm/model/UiGraphRuntimeModel.js +9 -3
  24. package/dist/esm/model/UiGraphSchema.js +7 -1
  25. package/dist/esm/model/chat/aiSdkTools.js +3 -2
  26. package/dist/esm/model/chat-v2/aiSdkBridge.js +146 -14
  27. package/dist/esm/model/chat-v2/chatV2CallObserver.js +11 -5
  28. package/dist/esm/model/chat-v2/chatV2CredentialNames.js +93 -0
  29. package/dist/esm/model/chat-v2/chatV2EditorCache.js +47 -20
  30. package/dist/esm/model/chat-v2/chatV2Errors.js +7 -19
  31. package/dist/esm/model/chat-v2/chatV2FeatureCompatibility.js +1 -1
  32. package/dist/esm/model/chat-v2/chatV2Outputs.js +48 -108
  33. package/dist/esm/model/chat-v2/chatV2Pipeline.js +101 -149
  34. package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +39 -4
  35. package/dist/esm/model/chat-v2/chatV2ProviderRegistry.js +9 -0
  36. package/dist/esm/model/chat-v2/chatV2RequestPlan.js +2 -3
  37. package/dist/esm/model/chat-v2/chatV2ResponseBodyCapture.js +63 -0
  38. package/dist/esm/model/chat-v2/chatV2ResponseFormat.js +8 -4
  39. package/dist/esm/model/chat-v2/chatV2Retry.js +4 -3
  40. package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +7 -7
  41. package/dist/esm/model/chat-v2/chatV2Shared.js +1 -1
  42. package/dist/esm/model/chat-v2/chatV2Types.js +20 -8
  43. package/dist/esm/model/chat-v2/chatV2UsageAccounting.js +78 -0
  44. package/dist/esm/model/chat-v2/customProviderApi.js +40 -0
  45. package/dist/esm/model/chat-v2/index.js +15 -0
  46. package/dist/esm/model/chat-v2/llmChatV2Body.js +289 -0
  47. package/dist/esm/model/chat-v2/llmChatV2CacheBoundary.js +32 -0
  48. package/dist/esm/model/chat-v2/llmChatV2CachePolicy.js +25 -0
  49. package/dist/esm/model/chat-v2/llmChatV2NodeData.js +13 -50
  50. package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +117 -24
  51. package/dist/esm/model/chat-v2/llmChatV2NodeMigration.js +24 -0
  52. package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +150 -199
  53. package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +60 -0
  54. package/dist/esm/model/chat-v2/llmInvocationDecision.js +11 -0
  55. package/dist/esm/model/chat-v2/llmInvocationJournal.js +43 -0
  56. package/dist/esm/model/chat-v2/llmInvocationPlan.js +68 -0
  57. package/dist/esm/model/chat-v2/llmInvocationProjections.js +5 -0
  58. package/dist/esm/model/chat-v2/llmInvocationResultProjector.js +48 -0
  59. package/dist/esm/model/chat-v2/llmModelCandidate.js +79 -0
  60. package/dist/esm/model/chat-v2/llmProfile.js +52 -65
  61. package/dist/esm/model/chat-v2/llmProfileBody.js +193 -0
  62. package/dist/esm/model/chat-v2/llmProfileFallback.js +442 -100
  63. package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +74 -0
  64. package/dist/esm/model/chat-v2/llmProfileHealthStore.js +326 -0
  65. package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +55 -33
  66. package/dist/esm/model/chat-v2/llmProfileTypes.js +1 -18
  67. package/dist/esm/model/chat-v2/llmResponseMaterializer.js +42 -0
  68. package/dist/esm/model/chat-v2/modelRegistry.js +54 -4
  69. package/dist/esm/model/chat-v2/parallelToolCalls.js +9 -2
  70. package/dist/esm/model/chat-v2/providerOptions.js +116 -24
  71. package/dist/esm/model/chat-v2/rivetToolRegistry.js +9 -0
  72. package/dist/esm/model/chat-v2/toolCallCodec.js +52 -0
  73. package/dist/esm/model/chat-v2/toolContinuation.js +72 -35
  74. package/dist/esm/model/chat-v2/toolHandlerResolver.js +23 -0
  75. package/dist/esm/model/chat-v2/toolRoundExecutor.js +12 -0
  76. package/dist/esm/model/nodes/ChatNode.js +6 -0
  77. package/dist/esm/model/nodes/ChatNodeBase.js +1 -0
  78. package/dist/esm/model/nodes/CodeNewNode.js +5 -47
  79. package/dist/esm/model/nodes/CodeNode.js +4 -46
  80. package/dist/esm/model/nodes/DelegateFunctionCallNode.js +19 -6
  81. package/dist/esm/model/nodes/ExpressionNode.js +5 -8
  82. package/dist/esm/model/nodes/LLMChatV2Node.js +121 -229
  83. package/dist/esm/model/nodes/LLMProfileNode.js +27 -8
  84. package/dist/esm/model/nodes/MatchNode.js +86 -41
  85. package/dist/esm/model/nodes/PromptNode.js +7 -0
  86. package/dist/esm/model/nodes/ToolNode.js +7 -0
  87. package/dist/esm/model/nodes/toolCallDelegation.js +177 -110
  88. package/dist/esm/plugins/anthropic/anthropic.js +4 -4
  89. package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +7 -0
  90. package/dist/esm/plugins/gentrace/gentraceSdk.js +0 -1
  91. package/dist/esm/plugins/gentrace/index.js +0 -1
  92. package/dist/esm/plugins/gentrace/plugin.js +61 -179
  93. package/dist/esm/plugins/google/google.js +5 -9
  94. package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +4 -1
  95. package/dist/esm/plugins.js +1 -2
  96. package/dist/esm/recording/ExecutionRecorder.js +62 -13
  97. package/dist/esm/utils/emitDetached.js +6 -3
  98. package/dist/esm/utils/openai.js +60 -16
  99. package/dist/esm/utils/serialization/serialization.js +2 -19
  100. package/dist/esm/webAppRuntime.js +3 -2
  101. package/dist/types/api/createProcessor.d.ts +3 -0
  102. package/dist/types/exports.d.ts +1 -0
  103. package/dist/types/integrations/CodeRunner.d.ts +10 -7
  104. package/dist/types/integrations/CodeRunnerOptions.d.ts +15 -0
  105. package/dist/types/model/AgentResponseTrace.d.ts +123 -0
  106. package/dist/types/model/ConnectedToolContinuationHost.d.ts +34 -0
  107. package/dist/types/model/EditorDefinition.d.ts +16 -0
  108. package/dist/types/model/ExecutorProtocol.d.ts +32 -11
  109. package/dist/types/model/GraphProcessor.d.ts +41 -9
  110. package/dist/types/model/NodeBase.d.ts +0 -10
  111. package/dist/types/model/NodeImpl.d.ts +18 -1
  112. package/dist/types/model/Nodes.d.ts +2 -2
  113. package/dist/types/model/ProcessContext.d.ts +99 -0
  114. package/dist/types/model/ProcessContextBuilder.d.ts +3 -1
  115. package/dist/types/model/RecordingPlayer.d.ts +6 -0
  116. package/dist/types/model/SplitRunProcessor.d.ts +10 -3
  117. package/dist/types/model/UiGraph.d.ts +8 -0
  118. package/dist/types/model/UiGraphActionProtocol.d.ts +3 -0
  119. package/dist/types/model/UiGraphBrowserRuntime.d.ts +11 -2
  120. package/dist/types/model/UiGraphRendererStyles.d.ts +1 -1
  121. package/dist/types/model/UiGraphRuntimeModel.d.ts +2 -0
  122. package/dist/types/model/UiGraphSchema.d.ts +1 -0
  123. package/dist/types/model/chat-v2/chatV2CallObserver.d.ts +2 -0
  124. package/dist/types/model/chat-v2/chatV2CredentialNames.d.ts +30 -0
  125. package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +2 -3
  126. package/dist/types/model/chat-v2/chatV2Outputs.d.ts +6 -16
  127. package/dist/types/model/chat-v2/chatV2Pipeline.d.ts +13 -17
  128. package/dist/types/model/chat-v2/chatV2ProviderProfile.d.ts +7 -0
  129. package/dist/types/model/chat-v2/chatV2ProviderRegistry.d.ts +8 -0
  130. package/dist/types/model/chat-v2/chatV2RequestPlan.d.ts +2 -2
  131. package/dist/types/model/chat-v2/chatV2ResponseBodyCapture.d.ts +25 -0
  132. package/dist/types/model/chat-v2/chatV2ResponseFormat.d.ts +3 -2
  133. package/dist/types/model/chat-v2/chatV2Retry.d.ts +2 -0
  134. package/dist/types/model/chat-v2/chatV2RuntimeOptions.d.ts +3 -8
  135. package/dist/types/model/chat-v2/chatV2Types.d.ts +44 -10
  136. package/dist/types/model/chat-v2/chatV2UsageAccounting.d.ts +14 -0
  137. package/dist/types/model/chat-v2/customProviderApi.d.ts +22 -0
  138. package/dist/types/model/chat-v2/index.d.ts +15 -0
  139. package/dist/types/model/chat-v2/llmChatV2Body.d.ts +24 -0
  140. package/dist/types/model/chat-v2/llmChatV2CacheBoundary.d.ts +10 -0
  141. package/dist/types/model/chat-v2/llmChatV2CachePolicy.d.ts +13 -0
  142. package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +19 -3
  143. package/dist/types/model/chat-v2/llmChatV2NodeMigration.d.ts +8 -0
  144. package/dist/types/model/chat-v2/llmChatV2NodeRuntime.d.ts +14 -16
  145. package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +16 -0
  146. package/dist/types/model/chat-v2/llmInvocationDecision.d.ts +21 -0
  147. package/dist/types/model/chat-v2/llmInvocationJournal.d.ts +38 -0
  148. package/dist/types/model/chat-v2/llmInvocationPlan.d.ts +41 -0
  149. package/dist/types/model/chat-v2/llmInvocationProjections.d.ts +3 -0
  150. package/dist/types/model/chat-v2/llmInvocationResultProjector.d.ts +26 -0
  151. package/dist/types/model/chat-v2/llmModelCandidate.d.ts +20 -0
  152. package/dist/types/model/chat-v2/llmProfile.d.ts +14 -0
  153. package/dist/types/model/chat-v2/llmProfileBody.d.ts +20 -0
  154. package/dist/types/model/chat-v2/llmProfileFallback.d.ts +36 -49
  155. package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +209 -0
  156. package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +111 -0
  157. package/dist/types/model/chat-v2/llmProfileNodeRuntime.d.ts +1 -1
  158. package/dist/types/model/chat-v2/llmProfileTypes.d.ts +4 -1
  159. package/dist/types/model/chat-v2/llmResponseMaterializer.d.ts +20 -0
  160. package/dist/types/model/chat-v2/modelRegistry.d.ts +17 -187
  161. package/dist/types/model/chat-v2/parallelToolCalls.d.ts +3 -1
  162. package/dist/types/model/chat-v2/providerOptions.d.ts +12 -0
  163. package/dist/types/model/chat-v2/rivetToolRegistry.d.ts +11 -0
  164. package/dist/types/model/chat-v2/toolCallCodec.d.ts +7 -0
  165. package/dist/types/model/chat-v2/toolContinuation.d.ts +3 -3
  166. package/dist/types/model/chat-v2/toolHandlerResolver.d.ts +25 -0
  167. package/dist/types/model/chat-v2/toolRoundExecutor.d.ts +18 -0
  168. package/dist/types/model/nodes/ChatNode.d.ts +2 -1
  169. package/dist/types/model/nodes/CodeNewNode.d.ts +0 -5
  170. package/dist/types/model/nodes/CodeNode.d.ts +0 -5
  171. package/dist/types/model/nodes/DelegateFunctionCallNode.d.ts +2 -1
  172. package/dist/types/model/nodes/LLMChatV2Node.d.ts +2 -1
  173. package/dist/types/model/nodes/LLMProfileNode.d.ts +2 -1
  174. package/dist/types/model/nodes/MatchNode.d.ts +6 -0
  175. package/dist/types/model/nodes/PromptNode.d.ts +4 -1
  176. package/dist/types/model/nodes/ToolNode.d.ts +2 -1
  177. package/dist/types/model/nodes/toolCallDelegation.d.ts +10 -3
  178. package/dist/types/plugins/anthropic/anthropic.d.ts +1 -0
  179. package/dist/types/plugins/gentrace/gentraceSdk.d.ts +0 -1
  180. package/dist/types/plugins/gentrace/plugin.d.ts +55 -9
  181. package/dist/types/plugins/google/google.d.ts +2 -8
  182. package/dist/types/plugins.d.ts +1 -1
  183. package/dist/types/recording/ExecutionRecorder.d.ts +7 -1
  184. package/dist/types/recording/RecordedEvents.d.ts +6 -0
  185. package/dist/types/utils/emitDetached.d.ts +3 -2
  186. package/dist/types/utils/openai.d.ts +49 -0
  187. package/dist/types/webAppRuntime.d.ts +4 -2
  188. package/package.json +2 -2
@@ -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, RunChatV2PipelineOptions } from './chatV2Types.js';
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 = RunChatV2PipelineOptions & {
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?: (options: RunChatV2PipelineOptions) => Promise<ChatV2PipelineResult>;
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;
@@ -7,11 +7,6 @@ import type { InternalProcessContext } from '../ProcessContext.js';
7
7
  export type CodeNewNode = ChartNode<'codeNew', CodeNewNodeData>;
8
8
  export type CodeNewNodeData = {
9
9
  code: string;
10
- allowFetch?: boolean;
11
- allowRequire?: boolean;
12
- allowRivet?: boolean;
13
- allowProcess?: boolean;
14
- allowConsole?: boolean;
15
10
  };
16
11
  export declare const CODE_NEW_OUTPUT_PORT_ID: PortId;
17
12
  export declare function interpolateCodeNewSource(code: string, inputs: Inputs): string;
@@ -9,11 +9,6 @@ export type CodeNodeData = {
9
9
  code: string;
10
10
  inputNames: string | string[];
11
11
  outputNames: string | string[];
12
- allowFetch?: boolean;
13
- allowRequire?: boolean;
14
- allowRivet?: boolean;
15
- allowProcess?: boolean;
16
- allowConsole?: boolean;
17
12
  };
18
13
  export declare class CodeNodeImpl extends NodeImpl<CodeNode> {
19
14
  static create(): CodeNode;
@@ -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(): string;
17
+ getBody(): NodeBodySpec;
17
18
  static getUIData(): NodeUIData;
18
19
  process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
19
20
  }
@@ -5,6 +5,8 @@ export type MatchNode = ChartNode<'match', MatchNodeData>;
5
5
  export type MatchNodeData = {
6
6
  cases: string[];
7
7
  casePortIds?: string[];
8
+ /** Missing values are legacy Shared mode. */
9
+ valueInputMode?: 'shared' | 'per-output';
8
10
  /** If true, only the first matching branch will be ran. */
9
11
  exclusive?: boolean;
10
12
  };
@@ -16,5 +18,9 @@ export declare class MatchNodeImpl extends NodeImpl<MatchNode> {
16
18
  getEditors(): EditorDefinition<MatchNode>[];
17
19
  static getUIData(): NodeUIData;
18
20
  process(inputs: Inputs): Promise<Outputs>;
21
+ private getValueInputMode;
22
+ private getCasePortIds;
23
+ private getCaseTitle;
24
+ private getCaseValueInputId;
19
25
  }
20
26
  export declare const matchNode: import("../NodeDefinition.js").NodeDefinition<MatchNode>;
@@ -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 { ParsedAssistantChatMessageFunctionCall, ChatMessage } from '../DataValue.js';
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 declare function findAutoDelegateGraphCandidate<T>(candidates: readonly T[], toolName: string, getGraphName: (candidate: T) => string | undefined): T | undefined;
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
- export declare function normalizeFunctionCallInput(input: unknown): ParsedAssistantChatMessageFunctionCall;
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>;
@@ -1,5 +1,6 @@
1
1
  export type AnthropicModel = {
2
2
  maxTokens: number;
3
+ /** USD per token. Anthropic Chat consumers multiply this directly by token counts. */
3
4
  cost: {
4
5
  prompt: number;
5
6
  completion: number;
@@ -1,5 +1,4 @@
1
1
  export { init } from '@gentrace/core/dist/providers/init.mjs';
2
2
  export { getPipelines } from '@gentrace/core/dist/providers/pipeline-methods.mjs';
3
3
  export { Pipeline } from '@gentrace/core/dist/providers/pipeline.mjs';
4
- export { runTest } from '@gentrace/core/dist/providers/run-test.mjs';
5
4
  export { StepRun } from '@gentrace/core/dist/providers/step-run.mjs';
@@ -1,11 +1,57 @@
1
- import type { Project } from '../../model/Project.js';
2
- import type { NodeGraph } from '../../model/NodeGraph.js';
3
- import type { NativeApi } from '../../native/NativeApi.js';
4
- import type { Recording } from '../../recording/RecordedEvents.js';
5
1
  import type { RivetPlugin } from '../../model/RivetPlugin.js';
6
- import type { Settings } from '../../model/Settings.js';
7
- import type { DataValue } from '../../model/DataValue.js';
8
- export declare const runGentraceTests: (gentracePipelineSlug: string, settings: Settings, project: Omit<Project, "data">, graph: NodeGraph, nativeApi: NativeApi, contextValues?: Record<string, DataValue>) => Promise<import("@gentrace/core").TestResultPost200Response>;
9
- export declare const runRemoteGentraceTests: (gentracePipelineSlug: string, settings: Settings, project: Omit<Project, "data">, graph: NodeGraph, runAndRecord: (testCase: Record<string, any>) => Promise<Recording>) => Promise<import("@gentrace/core").TestResultPost200Response>;
10
- export declare const getGentracePipelines: (gentraceApiKey: string) => Promise<import("@gentrace/core/dist/models/v1-pipelines-get200-response-pipelines-inner.js").V1PipelinesGet200ResponsePipelinesInner[]>;
2
+ /**
3
+ * The core package deliberately does not import the Evaluations package: that
4
+ * package depends on core to execute graphs. This narrow structural view keeps
5
+ * Gentrace an optional reporter rather than creating another evaluator runner
6
+ * or a package dependency cycle.
7
+ */
8
+ export type GentraceEvaluationRun = {
9
+ id: string;
10
+ suiteName: string;
11
+ startedAt: string;
12
+ completedAt?: string;
13
+ purpose: string;
14
+ executionStatus: string;
15
+ qualityStatus: string;
16
+ qualityReason: {
17
+ code: string;
18
+ message: string;
19
+ };
20
+ accountingStatus: string;
21
+ aggregate?: unknown;
22
+ trials: Array<{
23
+ id: string;
24
+ caseId: string;
25
+ caseName: string;
26
+ trialIndex: number;
27
+ executionStatus: string;
28
+ qualityStatus: string;
29
+ qualityReason: {
30
+ code: string;
31
+ message: string;
32
+ };
33
+ inputs: object;
34
+ expected: object;
35
+ outputs: object;
36
+ observations: unknown[];
37
+ totalMetrics: {
38
+ durationMs: number;
39
+ };
40
+ error?: string;
41
+ }>;
42
+ };
43
+ /**
44
+ * Exports an already completed Rivet Evaluation as one Gentrace pipeline run.
45
+ * It never fetches Gentrace test cases and never executes a Rivet graph: the
46
+ * generic Evaluations runner remains the sole execution engine.
47
+ */
48
+ export declare function exportGentraceEvaluationRun(input: {
49
+ gentraceApiKey: string;
50
+ pipelineSlug: string;
51
+ run: GentraceEvaluationRun;
52
+ }): Promise<{
53
+ resultId?: string;
54
+ pipelineRunId?: string;
55
+ }>;
56
+ export declare function getGentracePipelines(gentraceApiKey: string): Promise<import("@gentrace/core/dist/models/v1-pipelines-get200-response-pipelines-inner.js").V1PipelinesGet200ResponsePipelinesInner[]>;
11
57
  export declare const gentracePlugin: RivetPlugin;
@@ -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;
@@ -4,7 +4,7 @@ import assemblyAiPlugin from './plugins/assemblyAi/index.js';
4
4
  import { huggingFacePlugin } from './plugins/huggingface/plugin.js';
5
5
  import pineconePlugin from './plugins/pinecone/index.js';
6
6
  import gentracePlugin from './plugins/gentrace/index.js';
7
- export { getGentracePipelines, runGentraceTests, runRemoteGentraceTests } from './plugins/gentrace/plugin.js';
7
+ export { exportGentraceEvaluationRun, getGentracePipelines } from './plugins/gentrace/plugin.js';
8
8
  import { googlePlugin } from './plugins/google/plugin.js';
9
9
  import type { RivetPlugin } from './model/RivetPlugin.js';
10
10
  export { anthropicPlugin, autoevalsPlugin, assemblyAiPlugin, pineconePlugin, huggingFacePlugin, gentracePlugin, googlePlugin, };
@@ -9,6 +9,12 @@ export type ExecutionRecorderOptions = {
9
9
  includePartialOutputs?: boolean;
10
10
  includeTrace?: boolean;
11
11
  };
12
+ export type SocketRecordingOptions = {
13
+ /** Record only the protocol messages belonging to one remote graph run. */
14
+ requestId?: string;
15
+ /** Stop listening when the owning remote operation finishes or is aborted. */
16
+ signal?: AbortSignal;
17
+ };
12
18
  export declare class ExecutionRecorder {
13
19
  #private;
14
20
  recordingId: RecordingId | undefined;
@@ -16,7 +22,7 @@ export declare class ExecutionRecorder {
16
22
  on: Emittery<ExecutionRecorderEvents>['on'];
17
23
  off: Emittery<ExecutionRecorderEvents>['off'];
18
24
  once: Emittery<ExecutionRecorderEvents>['once'];
19
- recordSocket(channel: WebSocket): Promise<void>;
25
+ recordSocket(channel: WebSocket, options?: SocketRecordingOptions): Promise<void>;
20
26
  record(processor: GraphProcessor): void;
21
27
  getRecording(): Recording;
22
28
  get events(): RecordedEvents[];
@@ -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 discarded. Call this only for events
9
- * where listener completion does not affect processor ordering.
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.9",
3
+ "version": "2.3.0",
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.6",
70
+ "nanoid": "^3.3.18",
71
71
  "openai": "^4.28.4",
72
72
  "p-queue": "^7.4.1",
73
73
  "p-queue-6": "npm:p-queue@^6.0.0",