@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,209 @@
1
+ import type { LLMChatV2NodeData } from './llmChatV2NodeData.js';
2
+ /**
3
+ * Static ownership metadata for fields supplied by an LLM Profile.
4
+ *
5
+ * This deliberately does not attempt to describe editor layout or provider
6
+ * request construction. It provides the one fact those surfaces must share:
7
+ * which persisted LLM Chat fields are profile-owned, and which dynamic input
8
+ * ports a resolved profile consumes before it is passed to LLM Chat.
9
+ */
10
+ export type LLMProfileFieldSpec = {
11
+ key: keyof LLMChatV2NodeData;
12
+ inputId?: string;
13
+ /** Runtime validation for scalar fields; enum and collection fields keep named validators. */
14
+ valueKind?: 'string' | 'boolean' | 'required-number' | 'optional-number';
15
+ /** A resolved profile must never retain an active dynamic-input toggle. */
16
+ resolvedInputToggle?: boolean;
17
+ };
18
+ export declare const llmProfileFieldSpecs: readonly [{
19
+ readonly key: "model";
20
+ readonly inputId: "model";
21
+ readonly valueKind: "string";
22
+ }, {
23
+ readonly key: "useModelInput";
24
+ readonly valueKind: "boolean";
25
+ readonly resolvedInputToggle: true;
26
+ }, {
27
+ readonly key: "temperature";
28
+ readonly inputId: "temperature";
29
+ readonly valueKind: "required-number";
30
+ }, {
31
+ readonly key: "useTemperatureInput";
32
+ readonly valueKind: "boolean";
33
+ readonly resolvedInputToggle: true;
34
+ }, {
35
+ readonly key: "topP";
36
+ readonly inputId: "topP";
37
+ readonly valueKind: "optional-number";
38
+ }, {
39
+ readonly key: "useTopPInput";
40
+ readonly valueKind: "boolean";
41
+ readonly resolvedInputToggle: true;
42
+ }, {
43
+ readonly key: "topK";
44
+ readonly inputId: "topK";
45
+ readonly valueKind: "optional-number";
46
+ }, {
47
+ readonly key: "useTopKInput";
48
+ readonly valueKind: "boolean";
49
+ readonly resolvedInputToggle: true;
50
+ }, {
51
+ readonly key: "presencePenalty";
52
+ readonly inputId: "presencePenalty";
53
+ readonly valueKind: "optional-number";
54
+ }, {
55
+ readonly key: "usePresencePenaltyInput";
56
+ readonly valueKind: "boolean";
57
+ readonly resolvedInputToggle: true;
58
+ }, {
59
+ readonly key: "frequencyPenalty";
60
+ readonly inputId: "frequencyPenalty";
61
+ readonly valueKind: "optional-number";
62
+ }, {
63
+ readonly key: "useFrequencyPenaltyInput";
64
+ readonly valueKind: "boolean";
65
+ readonly resolvedInputToggle: true;
66
+ }, {
67
+ readonly key: "stopSequences";
68
+ readonly inputId: "stopSequences";
69
+ }, {
70
+ readonly key: "useStopSequencesInput";
71
+ readonly valueKind: "boolean";
72
+ readonly resolvedInputToggle: true;
73
+ }, {
74
+ readonly key: "seed";
75
+ readonly inputId: "seed";
76
+ readonly valueKind: "optional-number";
77
+ }, {
78
+ readonly key: "useSeedInput";
79
+ readonly valueKind: "boolean";
80
+ readonly resolvedInputToggle: true;
81
+ }, {
82
+ readonly key: "maxTokens";
83
+ readonly inputId: "maxTokens";
84
+ readonly valueKind: "required-number";
85
+ }, {
86
+ readonly key: "useMaxTokensInput";
87
+ readonly valueKind: "boolean";
88
+ readonly resolvedInputToggle: true;
89
+ }, {
90
+ readonly key: "provider";
91
+ }, {
92
+ readonly key: "apiKeySource";
93
+ readonly inputId: "apiKey";
94
+ }, {
95
+ readonly key: "providerApiKeyNames";
96
+ }, {
97
+ readonly key: "customProviderApiKeyProgrammaticName";
98
+ readonly valueKind: "string";
99
+ }, {
100
+ readonly key: "customProviderApiKeyEnvVarName";
101
+ readonly valueKind: "string";
102
+ }, {
103
+ readonly key: "customProviderBaseURL";
104
+ readonly inputId: "customProviderBaseURL";
105
+ readonly valueKind: "string";
106
+ }, {
107
+ readonly key: "useCustomProviderBaseURLInput";
108
+ readonly valueKind: "boolean";
109
+ readonly resolvedInputToggle: true;
110
+ }, {
111
+ readonly key: "customProviderApi";
112
+ }, {
113
+ readonly key: "headers";
114
+ readonly inputId: "headers";
115
+ }, {
116
+ readonly key: "useHeadersInput";
117
+ readonly valueKind: "boolean";
118
+ readonly resolvedInputToggle: true;
119
+ }, {
120
+ readonly key: "extraProviderOptions";
121
+ readonly inputId: "extraProviderOptions";
122
+ readonly valueKind: "string";
123
+ }, {
124
+ readonly key: "useExtraProviderOptionsInput";
125
+ readonly valueKind: "boolean";
126
+ readonly resolvedInputToggle: true;
127
+ }, {
128
+ readonly key: "openAIReasoningEffort";
129
+ readonly valueKind: "string";
130
+ }, {
131
+ readonly key: "openAIReasoningSummary";
132
+ readonly valueKind: "string";
133
+ }, {
134
+ readonly key: "openAIPreviousResponseId";
135
+ readonly inputId: "previousResponseId";
136
+ readonly valueKind: "string";
137
+ }, {
138
+ readonly key: "useOpenAIPreviousResponseIdInput";
139
+ readonly valueKind: "boolean";
140
+ readonly resolvedInputToggle: true;
141
+ }, {
142
+ readonly key: "enableOpenAIWebSearch";
143
+ readonly valueKind: "boolean";
144
+ }, {
145
+ readonly key: "openAIWebSearchContextSize";
146
+ }, {
147
+ readonly key: "enableOpenAICodeInterpreter";
148
+ readonly valueKind: "boolean";
149
+ }, {
150
+ readonly key: "anthropicThinkingMode";
151
+ }, {
152
+ readonly key: "anthropicThinkingBudget";
153
+ readonly inputId: "anthropicThinkingBudget";
154
+ readonly valueKind: "optional-number";
155
+ }, {
156
+ readonly key: "useAnthropicThinkingBudgetInput";
157
+ readonly valueKind: "boolean";
158
+ readonly resolvedInputToggle: true;
159
+ }, {
160
+ readonly key: "anthropicEffort";
161
+ }, {
162
+ readonly key: "anthropicCacheControlTtl";
163
+ }, {
164
+ readonly key: "googleThinkingBudget";
165
+ readonly inputId: "googleThinkingBudget";
166
+ readonly valueKind: "optional-number";
167
+ }, {
168
+ readonly key: "useGoogleThinkingBudgetInput";
169
+ readonly valueKind: "boolean";
170
+ readonly resolvedInputToggle: true;
171
+ }, {
172
+ readonly key: "googleThinkingLevel";
173
+ }, {
174
+ readonly key: "googleIncludeThoughts";
175
+ readonly valueKind: "boolean";
176
+ }, {
177
+ readonly key: "enableGoogleSearchGrounding";
178
+ readonly valueKind: "boolean";
179
+ }, {
180
+ readonly key: "enableGoogleUrlContext";
181
+ readonly valueKind: "boolean";
182
+ }, {
183
+ readonly key: "enableCircuitBreaker";
184
+ readonly valueKind: "boolean";
185
+ }, {
186
+ readonly key: "firstOutputTimeoutMs";
187
+ readonly valueKind: "required-number";
188
+ }, {
189
+ readonly key: "streamInactivityTimeoutMs";
190
+ readonly valueKind: "required-number";
191
+ }, {
192
+ readonly key: "circuitBreakerFailureThreshold";
193
+ readonly valueKind: "required-number";
194
+ }, {
195
+ readonly key: "circuitBreakerFailureWindowMs";
196
+ readonly valueKind: "required-number";
197
+ }, {
198
+ readonly key: "circuitBreakerOpenDurationMs";
199
+ readonly valueKind: "required-number";
200
+ }];
201
+ export declare const llmProfileDataKeys: ("provider" | "model" | "maxTokens" | "temperature" | "topP" | "topK" | "presencePenalty" | "frequencyPenalty" | "stopSequences" | "seed" | "anthropicCacheControlTtl" | "customProviderApi" | "firstOutputTimeoutMs" | "streamInactivityTimeoutMs" | "useModelInput" | "useTemperatureInput" | "useTopPInput" | "useTopKInput" | "usePresencePenaltyInput" | "useFrequencyPenaltyInput" | "useStopSequencesInput" | "useSeedInput" | "useMaxTokensInput" | "apiKeySource" | "providerApiKeyNames" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "headers" | "useHeadersInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "enableCircuitBreaker" | "circuitBreakerFailureThreshold" | "circuitBreakerFailureWindowMs" | "circuitBreakerOpenDurationMs")[];
202
+ export declare const llmProfileInputIds: ("model" | "maxTokens" | "temperature" | "topP" | "topK" | "presencePenalty" | "frequencyPenalty" | "stopSequences" | "seed" | "customProviderBaseURL" | "headers" | "extraProviderOptions" | "anthropicThinkingBudget" | "googleThinkingBudget" | "apiKey" | "previousResponseId")[];
203
+ /** Runtime validation categories for resolved LLM Profile values. */
204
+ export declare const llmProfileStringDataKeys: ("provider" | "parallelToolCalls" | "responseFormat" | "toolChoice" | "anthropicCacheControlTtl" | "outputRequestBody" | "outputResponseBody" | "retryOnNon200" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "customProviderApi" | "firstOutputTimeoutMs" | "streamInactivityTimeoutMs" | "responseSchemaName" | "useResponseSchemaNameInput" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "configurationMode" | "apiKeySource" | "providerApiKeyNames" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "baseURL" | "useBaseURLInput" | "headers" | "useHeadersInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "enableCircuitBreaker" | "circuitBreakerFailureThreshold" | "circuitBreakerFailureWindowMs" | "circuitBreakerOpenDurationMs" | "toolChoiceFunction" | "autoContinueToolCalls" | "maxToolRounds" | "outputLLMAttempts")[];
205
+ export declare const llmProfileBooleanDataKeys: ("provider" | "parallelToolCalls" | "responseFormat" | "toolChoice" | "anthropicCacheControlTtl" | "outputRequestBody" | "outputResponseBody" | "retryOnNon200" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "customProviderApi" | "firstOutputTimeoutMs" | "streamInactivityTimeoutMs" | "responseSchemaName" | "useResponseSchemaNameInput" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "configurationMode" | "apiKeySource" | "providerApiKeyNames" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "baseURL" | "useBaseURLInput" | "headers" | "useHeadersInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "enableCircuitBreaker" | "circuitBreakerFailureThreshold" | "circuitBreakerFailureWindowMs" | "circuitBreakerOpenDurationMs" | "toolChoiceFunction" | "autoContinueToolCalls" | "maxToolRounds" | "outputLLMAttempts")[];
206
+ export declare const llmProfileRequiredNumberDataKeys: ("provider" | "parallelToolCalls" | "responseFormat" | "toolChoice" | "anthropicCacheControlTtl" | "outputRequestBody" | "outputResponseBody" | "retryOnNon200" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "customProviderApi" | "firstOutputTimeoutMs" | "streamInactivityTimeoutMs" | "responseSchemaName" | "useResponseSchemaNameInput" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "configurationMode" | "apiKeySource" | "providerApiKeyNames" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "baseURL" | "useBaseURLInput" | "headers" | "useHeadersInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "enableCircuitBreaker" | "circuitBreakerFailureThreshold" | "circuitBreakerFailureWindowMs" | "circuitBreakerOpenDurationMs" | "toolChoiceFunction" | "autoContinueToolCalls" | "maxToolRounds" | "outputLLMAttempts")[];
207
+ export declare const llmProfileOptionalNumberDataKeys: ("provider" | "parallelToolCalls" | "responseFormat" | "toolChoice" | "anthropicCacheControlTtl" | "outputRequestBody" | "outputResponseBody" | "retryOnNon200" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "customProviderApi" | "firstOutputTimeoutMs" | "streamInactivityTimeoutMs" | "responseSchemaName" | "useResponseSchemaNameInput" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "configurationMode" | "apiKeySource" | "providerApiKeyNames" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "baseURL" | "useBaseURLInput" | "headers" | "useHeadersInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "enableCircuitBreaker" | "circuitBreakerFailureThreshold" | "circuitBreakerFailureWindowMs" | "circuitBreakerOpenDurationMs" | "toolChoiceFunction" | "autoContinueToolCalls" | "maxToolRounds" | "outputLLMAttempts")[];
208
+ /** A serialized profile must be self-contained, not driven by hidden ports. */
209
+ export declare const llmProfileResolvedInputToggleDataKeys: Array<keyof LLMChatV2NodeData>;
@@ -0,0 +1,111 @@
1
+ import type { NodeId } from '../NodeBase.js';
2
+ import type { ProjectId } from '../Project.js';
3
+ import type { ChatV2CredentialResult } from './chatV2ProviderProfile.js';
4
+ import type { LLMChatV2ProfileData } from './llmChatV2NodeData.js';
5
+ import type { ChatV2Provider } from './chatV2ProviderTypes.js';
6
+ import type { CustomProviderApi } from './customProviderApi.js';
7
+ export declare const DEFAULT_LLM_PROFILE_FIRST_OUTPUT_TIMEOUT_MS = 30000;
8
+ export declare const DEFAULT_LLM_PROFILE_STREAM_INACTIVITY_TIMEOUT_MS = 30000;
9
+ export declare const DEFAULT_LLM_PROFILE_CIRCUIT_FAILURE_THRESHOLD = 3;
10
+ export declare const DEFAULT_LLM_PROFILE_CIRCUIT_FAILURE_WINDOW_MS = 300000;
11
+ export declare const DEFAULT_LLM_PROFILE_CIRCUIT_OPEN_DURATION_MS = 300000;
12
+ export declare class RivetLLMProfileHealthPolicyError extends Error {
13
+ constructor(message: string);
14
+ }
15
+ export type RivetLLMProfileCircuitBreakerPolicy = {
16
+ failureThreshold: number;
17
+ failureWindowMs: number;
18
+ openDurationMs: number;
19
+ halfOpenLeaseMs: number;
20
+ };
21
+ export declare function resolveRivetLLMProfileCircuitBreakerPolicy(configuration: LLMChatV2ProfileData): RivetLLMProfileCircuitBreakerPolicy | undefined;
22
+ /**
23
+ * Stable, privacy-bounded identity for one resolved LLM Profile configuration.
24
+ * `key` and `configurationFingerprint` are SHA-256 routing/auth digests;
25
+ * credentials and provider configuration are never exposed through this
26
+ * contract.
27
+ */
28
+ export type RivetLLMProfileHealthIdentity = {
29
+ key: string;
30
+ projectId?: ProjectId;
31
+ profileNodeId?: NodeId;
32
+ provider: ChatV2Provider;
33
+ model: string;
34
+ customProviderApi?: CustomProviderApi;
35
+ configurationFingerprint: string;
36
+ };
37
+ export declare function createRivetLLMProfileHealthIdentity(params: {
38
+ configuration: LLMChatV2ProfileData;
39
+ credential: ChatV2CredentialResult;
40
+ /** Project-wide Chat headers merged into every physical provider request. */
41
+ chatNodeHeaders?: Record<string, string> | undefined;
42
+ projectId?: ProjectId;
43
+ profileNodeId?: NodeId;
44
+ }): RivetLLMProfileHealthIdentity;
45
+ export type RivetLLMProfileHealthState = 'closed' | 'open' | 'half-open';
46
+ export type RivetLLMProfileHealthSnapshot = {
47
+ identity: RivetLLMProfileHealthIdentity;
48
+ state: RivetLLMProfileHealthState;
49
+ failureCount: number;
50
+ openUntil?: number;
51
+ halfOpenLeaseUntil?: number;
52
+ updatedAt: number;
53
+ };
54
+ export type RivetLLMProfileHealthBeginRequest = {
55
+ identity: RivetLLMProfileHealthIdentity;
56
+ policy: RivetLLMProfileCircuitBreakerPolicy;
57
+ };
58
+ export type RivetLLMProfileHealthBeginResult = {
59
+ disposition: 'allow' | 'deny';
60
+ state: RivetLLMProfileHealthState;
61
+ /** Opaque permit returned to `finish`; present only when execution is allowed. */
62
+ permitId?: string;
63
+ retryAt?: number;
64
+ snapshot: RivetLLMProfileHealthSnapshot;
65
+ };
66
+ export type RivetLLMProfileHealthOutcome = 'healthy' | 'unhealthy' | 'ignored';
67
+ export type RivetLLMProfileHealthFinishRequest = {
68
+ identity: RivetLLMProfileHealthIdentity;
69
+ policy: RivetLLMProfileCircuitBreakerPolicy;
70
+ permitId: string;
71
+ outcome: RivetLLMProfileHealthOutcome;
72
+ };
73
+ export type RivetLLMProfileHealthRenewRequest = {
74
+ identity: RivetLLMProfileHealthIdentity;
75
+ permitId: string;
76
+ leaseDurationMs: number;
77
+ };
78
+ export type RivetLLMProfileHealthResetRequest = {
79
+ key: string;
80
+ projectId?: never;
81
+ } | {
82
+ key?: never;
83
+ projectId: ProjectId;
84
+ };
85
+ export type RivetLLMProfileHealthListRequest = {
86
+ projectId?: ProjectId;
87
+ };
88
+ /**
89
+ * Host persistence seam for LLM Profile health. Implementations must make
90
+ * each method atomic. In particular, `begin` must allow at most one probe
91
+ * while an open circuit is half-open across all processes using the store.
92
+ */
93
+ export interface RivetLLMProfileHealthStore {
94
+ begin(request: RivetLLMProfileHealthBeginRequest): RivetLLMProfileHealthBeginResult | Promise<RivetLLMProfileHealthBeginResult>;
95
+ finish(request: RivetLLMProfileHealthFinishRequest): RivetLLMProfileHealthSnapshot | Promise<RivetLLMProfileHealthSnapshot>;
96
+ renew(request: RivetLLMProfileHealthRenewRequest): RivetLLMProfileHealthSnapshot | Promise<RivetLLMProfileHealthSnapshot>;
97
+ reset(request: RivetLLMProfileHealthResetRequest): void | Promise<void>;
98
+ list(request?: RivetLLMProfileHealthListRequest): RivetLLMProfileHealthSnapshot[] | Promise<RivetLLMProfileHealthSnapshot[]>;
99
+ }
100
+ /** Process-local reference implementation used when a host does not supply durable shared storage. */
101
+ export declare class InMemoryRivetLLMProfileHealthStore implements RivetLLMProfileHealthStore {
102
+ #private;
103
+ constructor(options?: {
104
+ now?: () => number;
105
+ });
106
+ begin(request: RivetLLMProfileHealthBeginRequest): RivetLLMProfileHealthBeginResult;
107
+ finish(request: RivetLLMProfileHealthFinishRequest): RivetLLMProfileHealthSnapshot;
108
+ renew(request: RivetLLMProfileHealthRenewRequest): RivetLLMProfileHealthSnapshot;
109
+ reset(request: RivetLLMProfileHealthResetRequest): void;
110
+ list(request?: RivetLLMProfileHealthListRequest): RivetLLMProfileHealthSnapshot[];
111
+ }
@@ -5,5 +5,5 @@ import { type LLMProfileValue } from './llmProfileTypes.js';
5
5
  export declare function resolveLLMProfileNodeValue(params: {
6
6
  data: LLMChatV2ProfileData;
7
7
  inputs: Inputs;
8
- context: Pick<InternalProcessContext, 'getPluginConfig' | 'settings'>;
8
+ context: Pick<InternalProcessContext, 'getPluginConfig' | 'settings' | 'node' | 'project'>;
9
9
  }): LLMProfileValue;
@@ -1,16 +1,19 @@
1
1
  import type { ChatV2CredentialResult } from './chatV2ProviderProfile.js';
2
2
  import { type LLMChatV2NodeData, type LLMChatV2ProfileData } from './llmChatV2NodeData.js';
3
+ import type { RivetLLMProfileHealthIdentity } from './llmProfileHealthStore.js';
3
4
  export declare const LLM_PROFILE_VALUE_VERSION: 1;
4
5
  /**
5
6
  * Every input port owned by an LLM Profile, including ports that are hidden
6
7
  * until their matching provider or input toggle is enabled. This lets editor
7
8
  * operations preserve recoverable connections across configuration changes.
8
9
  */
9
- export declare const llmProfileInputIds: readonly ["model", "apiKey", "customProviderBaseURL", "previousResponseId", "temperature", "maxTokens", "topP", "topK", "presencePenalty", "frequencyPenalty", "stopSequences", "seed", "headers", "extraProviderOptions", "anthropicThinkingBudget", "googleThinkingBudget"];
10
+ export { llmProfileInputIds } from './llmProfileFieldRegistry.js';
10
11
  export type LLMProfileValue = {
11
12
  version: typeof LLM_PROFILE_VALUE_VERSION;
12
13
  configuration: LLMChatV2ProfileData;
13
14
  credential: ChatV2CredentialResult;
15
+ /** Stable privacy-bounded identity used by optional cross-run health policy. */
16
+ healthIdentity?: RivetLLMProfileHealthIdentity;
14
17
  };
15
18
  export declare function createLLMProfileNodeData(): LLMChatV2ProfileData;
16
19
  export declare function createDefaultLLMProfileValue(): LLMProfileValue;
@@ -0,0 +1,20 @@
1
+ import type { DataValue } from '../DataValue.js';
2
+ import type { ChatV2ResponseFormatMode } from './chatV2Types.js';
3
+ /**
4
+ * The one place where a provider response becomes Rivet's Response value.
5
+ *
6
+ * Providers may return a structured SDK value, JSON text, or ordinary text.
7
+ * Keeping this decision separate from port projection ensures validation sees
8
+ * exactly the same DataValue that a downstream node receives.
9
+ */
10
+ export type MaterializedLLMResponse = {
11
+ rawText: string;
12
+ value: DataValue;
13
+ source: 'sdk-structured' | 'text-json' | 'plain-text';
14
+ validation: 'not-requested' | 'valid' | 'invalid';
15
+ };
16
+ export declare function materializeLLMResponse(params: {
17
+ rawText: string;
18
+ structuredOutput: unknown | undefined;
19
+ responseFormat: ChatV2ResponseFormatMode | undefined;
20
+ }): MaterializedLLMResponse;
@@ -2,139 +2,19 @@ import type { ChatV2Provider } from './chatV2Types.js';
2
2
  export type ChatV2ModelInfo = {
3
3
  maxTokens: number;
4
4
  displayName: string;
5
- cost: {
5
+ /** USD per token, not per thousand tokens. Omitted when Rivet cannot estimate this model safely. */
6
+ cost?: {
6
7
  prompt: number;
7
8
  completion: number;
8
9
  };
9
10
  };
11
+ type TokenUsageForCost = {
12
+ inputTokens?: number | undefined;
13
+ outputTokens?: number | undefined;
14
+ };
10
15
  export declare function getChatV2ModelRegistry(): {
11
- readonly openai: {
12
- 'gpt-5': {
13
- maxTokens: number;
14
- cost: {
15
- prompt: number;
16
- completion: number;
17
- };
18
- displayName: string;
19
- supported: {
20
- parallelFunctionCalls: true;
21
- };
22
- };
23
- 'gpt-5-mini': {
24
- maxTokens: number;
25
- cost: {
26
- prompt: number;
27
- completion: number;
28
- };
29
- displayName: string;
30
- supported: {
31
- parallelFunctionCalls: true;
32
- };
33
- };
34
- 'gpt-5-nano': {
35
- maxTokens: number;
36
- cost: {
37
- prompt: number;
38
- completion: number;
39
- };
40
- displayName: string;
41
- supported: {
42
- parallelFunctionCalls: true;
43
- };
44
- };
45
- 'gpt-4o': {
46
- maxTokens: number;
47
- cost: {
48
- prompt: number;
49
- completion: number;
50
- };
51
- displayName: string;
52
- };
53
- 'gpt-4o-mini': {
54
- maxTokens: number;
55
- cost: {
56
- prompt: number;
57
- completion: number;
58
- };
59
- displayName: string;
60
- };
61
- o1: {
62
- maxTokens: number;
63
- cost: {
64
- prompt: number;
65
- completion: number;
66
- };
67
- displayName: string;
68
- supported: {
69
- parallelFunctionCalls: false;
70
- };
71
- };
72
- 'o1-mini': {
73
- maxTokens: number;
74
- cost: {
75
- prompt: number;
76
- completion: number;
77
- };
78
- displayName: string;
79
- supported: {
80
- parallelFunctionCalls: false;
81
- };
82
- };
83
- 'o3-mini': {
84
- maxTokens: number;
85
- cost: {
86
- prompt: number;
87
- completion: number;
88
- };
89
- displayName: string;
90
- supported: {
91
- parallelFunctionCalls: false;
92
- };
93
- };
94
- 'gpt-4o-audio-preview': {
95
- maxTokens: number;
96
- cost: {
97
- prompt: number;
98
- completion: number;
99
- audioPrompt: number;
100
- audioCompletion: number;
101
- };
102
- displayName: string;
103
- };
104
- 'gpt-4.1': {
105
- maxTokens: number;
106
- cost: {
107
- prompt: number;
108
- completion: number;
109
- };
110
- displayName: string;
111
- };
112
- o3: {
113
- maxTokens: number;
114
- cost: {
115
- prompt: number;
116
- completion: number;
117
- };
118
- displayName: string;
119
- };
120
- 'o4-mini': {
121
- maxTokens: number;
122
- cost: {
123
- prompt: number;
124
- completion: number;
125
- };
126
- displayName: string;
127
- };
128
- 'local-model': {
129
- maxTokens: number;
130
- cost: {
131
- prompt: number;
132
- completion: number;
133
- };
134
- displayName: string;
135
- };
136
- };
137
- readonly anthropic: {
16
+ openai: Record<string, ChatV2ModelInfo>;
17
+ anthropic: {
138
18
  'claude-instant-1': {
139
19
  maxTokens: number;
140
20
  cost: {
@@ -232,65 +112,15 @@ export declare function getChatV2ModelRegistry(): {
232
112
  displayName: string;
233
113
  };
234
114
  };
235
- readonly google: {
236
- 'gemini-2.5-pro': {
237
- maxTokens: number;
238
- cost: {
239
- prompt: number;
240
- completion: number;
241
- };
242
- displayName: string;
243
- };
244
- 'gemini-2.5-flash': {
245
- maxTokens: number;
246
- cost: {
247
- prompt: number;
248
- completion: number;
249
- };
250
- displayName: string;
251
- };
252
- 'gemini-2.5-flash-lite-preview-06-17': {
253
- maxTokens: number;
254
- cost: {
255
- prompt: number;
256
- completion: number;
257
- };
258
- displayName: string;
259
- };
260
- 'gemini-2.0-flash': {
261
- maxTokens: number;
262
- cost: {
263
- prompt: number;
264
- completion: number;
265
- };
266
- displayName: string;
267
- };
268
- 'gemini-2.0-flash-lite': {
269
- maxTokens: number;
270
- cost: {
271
- prompt: number;
272
- completion: number;
273
- };
274
- displayName: string;
275
- };
276
- 'gemini-1.5-pro': {
277
- maxTokens: number;
278
- cost: {
279
- prompt: number;
280
- completion: number;
281
- };
282
- displayName: string;
283
- };
284
- 'gemini-1.5-flash': {
285
- maxTokens: number;
286
- cost: {
287
- prompt: number;
288
- completion: number;
289
- };
290
- displayName: string;
291
- };
292
- };
293
- readonly custom: {};
115
+ google: Record<string, ChatV2ModelInfo>;
116
+ custom: {};
294
117
  };
295
118
  export declare function getChatV2ModelInfo(provider: ChatV2Provider, modelId: string): ChatV2ModelInfo | undefined;
296
119
  export declare function calculateChatV2Cost(provider: ChatV2Provider, modelId: string, promptTokens: number, completionTokens: number): number | undefined;
120
+ /**
121
+ * Estimates a call only when the provider reported both billable text-token
122
+ * counts. Cache discounts, long-context premiums, and provider tool fees stay
123
+ * outside this baseline estimate until their billing inputs are modeled.
124
+ */
125
+ export declare function calculateChatV2UsageCost(provider: ChatV2Provider, modelId: string, usage: TokenUsageForCost | undefined): number | undefined;
126
+ export {};
@@ -1,9 +1,11 @@
1
1
  import type { ChatV2Provider, ChatV2ProviderOptions } from './chatV2Types.js';
2
- export declare const LLM_CHAT_V2_PARALLEL_TOOL_CALLS_HELPER_MESSAGE = "Supported by OpenAI, Anthropic, and compatible Custom providers. Custom providers receive parallel_tool_calls only when enabled; otherwise their default applies unless Extra provider options supplies the field.";
2
+ import { type CustomProviderApi } from './customProviderApi.js';
3
+ export declare const LLM_CHAT_V2_PARALLEL_TOOL_CALLS_HELPER_MESSAGE = "Allows the model to request multiple tool calls in one round.";
3
4
  export declare function supportsLLMChatV2ParallelToolCalls(provider: ChatV2Provider): boolean;
4
5
  export declare function applyLLMChatV2ParallelToolCallProviderOptions(params: {
5
6
  provider: ChatV2Provider;
6
7
  useToolCalling: boolean | undefined;
7
8
  parallelToolCalls: boolean | undefined;
9
+ customProviderApi?: CustomProviderApi | undefined;
8
10
  providerOptions: ChatV2ProviderOptions | undefined;
9
11
  }): ChatV2ProviderOptions | undefined;
@@ -1,5 +1,7 @@
1
1
  import type { InternalProcessContext } from '../ProcessContext.js';
2
+ import { type CustomProviderApi } from './customProviderApi.js';
2
3
  import type { ChatV2Model, ChatV2Provider } from './chatV2Types.js';
4
+ export { customProviderApiOptions, getCustomProviderApiContract, parseCustomProviderApi, type CustomProviderApi, type CustomProviderApiContract, } from './customProviderApi.js';
3
5
  export declare const chatV2ProviderOptions: readonly [{
4
6
  readonly value: "openai";
5
7
  readonly label: "OpenAI";
@@ -49,13 +51,23 @@ export type CreateChatV2ModelOptions = {
49
51
  baseURL?: string | undefined;
50
52
  headers?: Record<string, string> | undefined;
51
53
  onRequestBody?: ((body: unknown) => void) | undefined;
54
+ onResponseBody?: ((response: Response) => void) | undefined;
52
55
  transformRequestBody?: ((body: unknown) => unknown) | undefined;
56
+ requestBodyOverlay?: Readonly<Record<string, unknown>> | undefined;
57
+ customProviderApi?: CustomProviderApi | undefined;
58
+ endpointQuery?: ReadonlyArray<readonly [string, string]> | undefined;
53
59
  };
54
60
  export type ResolveChatV2ProviderConfigContext = Pick<InternalProcessContext, 'getPluginConfig' | 'settings'>;
55
61
  export type ResolvedChatV2ProviderConfig = {
56
62
  baseURL?: string | undefined;
57
63
  headers?: Record<string, string> | undefined;
64
+ endpointQuery?: Array<[string, string]> | undefined;
65
+ };
66
+ export declare function normalizeOpenAICompatibleEndpoint(endpoint: string): {
67
+ baseURL: string;
68
+ endpointQuery: Array<[string, string]>;
58
69
  };
59
70
  export declare function openAICompatibleEndpointToBaseURL(endpoint: string): string;
71
+ export declare function applyChatV2RequestBodyOverlay(body: unknown, overlay: Readonly<Record<string, unknown>> | undefined): unknown;
60
72
  export declare function resolveChatV2ProviderConfig(provider: ChatV2Provider, _modelId: string, context: ResolveChatV2ProviderConfigContext, options?: CreateChatV2ModelOptions): Promise<ResolvedChatV2ProviderConfig>;
61
73
  export declare function createChatV2Model(provider: ChatV2Provider, modelId: string, context: Pick<InternalProcessContext, 'settings' | 'getPluginConfig'>, options?: CreateChatV2ModelOptions): ChatV2Model;
@@ -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;