@valerypopoff/rivet2-core 2.1.10 → 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 (86) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/bundle.cjs +2101 -867
  3. package/dist/cjs/bundle.cjs.map +4 -4
  4. package/dist/cjs/webAppRuntime.cjs +37 -3
  5. package/dist/cjs/webAppRuntime.cjs.map +2 -2
  6. package/dist/esm/api/createProcessor.js +2 -0
  7. package/dist/esm/integrations/CodeRunner.js +2 -7
  8. package/dist/esm/integrations/CodeRunnerOptions.js +7 -0
  9. package/dist/esm/model/AgentResponseTrace.js +121 -11
  10. package/dist/esm/model/GraphProcessor.js +14 -0
  11. package/dist/esm/model/RecordingPlayer.js +50 -5
  12. package/dist/esm/model/SubprocessorBridge.js +1 -0
  13. package/dist/esm/model/UiGraphActionProtocol.js +1 -0
  14. package/dist/esm/model/chat-v2/aiSdkBridge.js +146 -14
  15. package/dist/esm/model/chat-v2/chatV2CallObserver.js +2 -0
  16. package/dist/esm/model/chat-v2/chatV2CredentialNames.js +93 -0
  17. package/dist/esm/model/chat-v2/chatV2EditorCache.js +6 -5
  18. package/dist/esm/model/chat-v2/chatV2Pipeline.js +41 -4
  19. package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +31 -2
  20. package/dist/esm/model/chat-v2/chatV2ResponseBodyCapture.js +10 -2
  21. package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +6 -11
  22. package/dist/esm/model/chat-v2/chatV2Shared.js +1 -1
  23. package/dist/esm/model/chat-v2/chatV2Types.js +16 -0
  24. package/dist/esm/model/chat-v2/customProviderApi.js +0 -2
  25. package/dist/esm/model/chat-v2/index.js +3 -0
  26. package/dist/esm/model/chat-v2/llmChatV2Body.js +9 -1
  27. package/dist/esm/model/chat-v2/llmChatV2CachePolicy.js +5 -0
  28. package/dist/esm/model/chat-v2/llmChatV2NodeData.js +7 -0
  29. package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +95 -14
  30. package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +32 -9
  31. package/dist/esm/model/chat-v2/llmModelCandidate.js +5 -1
  32. package/dist/esm/model/chat-v2/llmProfile.js +42 -0
  33. package/dist/esm/model/chat-v2/llmProfileBody.js +10 -0
  34. package/dist/esm/model/chat-v2/llmProfileFallback.js +390 -4
  35. package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +7 -0
  36. package/dist/esm/model/chat-v2/llmProfileHealthStore.js +326 -0
  37. package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +53 -34
  38. package/dist/esm/model/chat-v2/providerOptions.js +33 -7
  39. package/dist/esm/model/nodes/CodeNewNode.js +5 -47
  40. package/dist/esm/model/nodes/CodeNode.js +4 -46
  41. package/dist/esm/model/nodes/ExpressionNode.js +5 -8
  42. package/dist/esm/model/nodes/LLMChatV2Node.js +10 -1
  43. package/dist/esm/model/nodes/MatchNode.js +86 -41
  44. package/dist/esm/plugins/gentrace/gentraceSdk.js +0 -1
  45. package/dist/esm/plugins/gentrace/index.js +0 -1
  46. package/dist/esm/plugins/gentrace/plugin.js +61 -179
  47. package/dist/esm/plugins.js +1 -2
  48. package/dist/esm/recording/ExecutionRecorder.js +49 -8
  49. package/dist/types/api/createProcessor.d.ts +3 -0
  50. package/dist/types/integrations/CodeRunner.d.ts +10 -7
  51. package/dist/types/integrations/CodeRunnerOptions.d.ts +15 -0
  52. package/dist/types/model/AgentResponseTrace.d.ts +14 -1
  53. package/dist/types/model/EditorDefinition.d.ts +16 -0
  54. package/dist/types/model/ExecutorProtocol.d.ts +9 -6
  55. package/dist/types/model/GraphProcessor.d.ts +15 -5
  56. package/dist/types/model/NodeBase.d.ts +0 -10
  57. package/dist/types/model/Nodes.d.ts +2 -2
  58. package/dist/types/model/ProcessContext.d.ts +52 -0
  59. package/dist/types/model/UiGraphActionProtocol.d.ts +1 -0
  60. package/dist/types/model/chat-v2/chatV2CredentialNames.d.ts +30 -0
  61. package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +1 -0
  62. package/dist/types/model/chat-v2/chatV2ProviderProfile.d.ts +3 -0
  63. package/dist/types/model/chat-v2/chatV2ResponseBodyCapture.d.ts +8 -2
  64. package/dist/types/model/chat-v2/chatV2RuntimeOptions.d.ts +3 -8
  65. package/dist/types/model/chat-v2/chatV2Types.d.ts +24 -0
  66. package/dist/types/model/chat-v2/customProviderApi.d.ts +0 -1
  67. package/dist/types/model/chat-v2/index.d.ts +3 -0
  68. package/dist/types/model/chat-v2/llmChatV2CachePolicy.d.ts +1 -1
  69. package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +10 -1
  70. package/dist/types/model/chat-v2/llmModelCandidate.d.ts +2 -0
  71. package/dist/types/model/chat-v2/llmProfile.d.ts +14 -0
  72. package/dist/types/model/chat-v2/llmProfileBody.d.ts +1 -1
  73. package/dist/types/model/chat-v2/llmProfileFallback.d.ts +21 -2
  74. package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +26 -6
  75. package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +111 -0
  76. package/dist/types/model/chat-v2/llmProfileNodeRuntime.d.ts +1 -1
  77. package/dist/types/model/chat-v2/llmProfileTypes.d.ts +3 -0
  78. package/dist/types/model/chat-v2/providerOptions.d.ts +2 -0
  79. package/dist/types/model/nodes/CodeNewNode.d.ts +0 -5
  80. package/dist/types/model/nodes/CodeNode.d.ts +0 -5
  81. package/dist/types/model/nodes/MatchNode.d.ts +6 -0
  82. package/dist/types/plugins/gentrace/gentraceSdk.d.ts +0 -1
  83. package/dist/types/plugins/gentrace/plugin.d.ts +55 -9
  84. package/dist/types/plugins.d.ts +1 -1
  85. package/dist/types/recording/ExecutionRecorder.d.ts +7 -1
  86. package/package.json +2 -2
@@ -6,6 +6,7 @@ import type { AssistantMessageFunctionCallMode, StreamedFunctionCall } from '../
6
6
  import type { ChatV2Provider } from './chatV2ProviderTypes.js';
7
7
  import type { ChatV2ResponseBodyCapture } from './chatV2ResponseBodyCapture.js';
8
8
  import type { CustomProviderApi } from './customProviderApi.js';
9
+ import type { RivetLLMProfileHealthState } from './llmProfileHealthStore.js';
9
10
  export type { ChatV2Provider };
10
11
  type StreamTextArgs = Parameters<typeof streamText>[0];
11
12
  type GenerateTextArgs = Parameters<typeof generateText>[0];
@@ -80,7 +81,24 @@ export type StreamChatV2Options = {
80
81
  text: string;
81
82
  functionCalls: StreamedFunctionCall[];
82
83
  }) => void) | undefined;
84
+ /** Deadline to the first semantic stream event, or the complete generate response. */
85
+ firstOutputTimeoutMs?: number | undefined;
86
+ /** Maximum gap between events after the first semantic stream event. */
87
+ streamInactivityTimeoutMs?: number | undefined;
88
+ /** Internal hook used to abort the physical provider request on a deadline. */
89
+ onTimeout?: ((error: ChatV2ProviderTimeoutError) => void) | undefined;
90
+ /** Internal activity hook used to renew a half-open circuit probe lease. */
91
+ onStreamActivity?: (() => void) | undefined;
92
+ /** Internal hook used to keep one half-open probe exclusive across a retry cooldown. */
93
+ onBeforeProviderRetry?: ((cooldownMs: number) => void | Promise<void>) | undefined;
83
94
  };
95
+ export declare class ChatV2ProviderTimeoutError extends Error {
96
+ readonly timeoutKind: 'first-output' | 'stream-inactivity';
97
+ readonly timeoutMs: number;
98
+ readonly code = "RIVET_LLM_PROVIDER_TIMEOUT";
99
+ constructor(timeoutKind: 'first-output' | 'stream-inactivity', timeoutMs: number);
100
+ }
101
+ export declare function isChatV2ProviderTimeoutError(error: unknown): error is ChatV2ProviderTimeoutError;
84
102
  export type StreamChatV2Result = {
85
103
  responseText: string;
86
104
  structuredOutput: unknown | undefined;
@@ -131,11 +149,17 @@ export type RunChatV2PipelineOptions = {
131
149
  * provider.
132
150
  */
133
151
  profileIndex?: number | undefined;
152
+ profileHealthKey?: string | undefined;
153
+ profileHealthState?: RivetLLMProfileHealthState | undefined;
134
154
  roundIndex?: number | undefined;
135
155
  /** Selected wire contract for Custom-provider calls. Never sent to the provider. */
136
156
  customProviderApi?: CustomProviderApi | undefined;
137
157
  /** Internal physical-call trace used by the LLM Profile fallback coordinator. */
138
158
  onProviderAttempt?: ((attempt: ChatV2ProviderAttempt) => void) | undefined;
159
+ firstOutputTimeoutMs?: number | undefined;
160
+ streamInactivityTimeoutMs?: number | undefined;
161
+ onStreamActivity?: (() => void) | undefined;
162
+ onBeforeProviderRetry?: ((cooldownMs: number) => void | Promise<void>) | undefined;
139
163
  context: Pick<InternalProcessContext, 'signal' | 'onPartialOutputs'> & Partial<Pick<InternalProcessContext, 'node' | 'onChatV2CallFinished' | 'processId'>>;
140
164
  executeStream?: ChatV2StreamExecutor | undefined;
141
165
  executeGenerate?: ChatV2GenerateExecutor | undefined;
@@ -2,7 +2,6 @@ export type CustomProviderApi = 'completions' | 'responses';
2
2
  export type CustomProviderApiContract = Readonly<{
3
3
  api: CustomProviderApi;
4
4
  adapter: 'openai-compatible' | 'openai-responses';
5
- providerOptionsKey: 'custom' | 'openai';
6
5
  endpointPath: '/chat/completions' | '/responses';
7
6
  label: 'Custom Completions' | 'Custom Responses';
8
7
  structuredOutput: 'raw-response-format' | 'sdk-output';
@@ -2,11 +2,13 @@ export * from './aiSdkBridge.js';
2
2
  export * from './chatV2FeatureCompatibility.js';
3
3
  export * from './chatV2Pipeline.js';
4
4
  export * from './chatV2ProviderProfile.js';
5
+ export * from './chatV2CredentialNames.js';
5
6
  export * from './chatV2RequestPlan.js';
6
7
  export * from './chatV2ResponseFormat.js';
7
8
  export * from './chatV2Shared.js';
8
9
  export * from './chatV2Types.js';
9
10
  export * from './llmProfileTypes.js';
11
+ export * from './llmProfileHealthStore.js';
10
12
  export * from './llmProfileBody.js';
11
13
  export * from './llmChatV2Body.js';
12
14
  export * from './messageConverter.js';
@@ -16,6 +18,7 @@ export * from './toolConverter.js';
16
18
  export * from './toolContinuationConnection.js';
17
19
  export * from './chatV2ProviderRegistry.js';
18
20
  export * from './llmChatV2NodeMigration.js';
21
+ export * from './llmChatV2NodeData.js';
19
22
  export * from './llmInvocationCoordinator.js';
20
23
  export * from './llmInvocationProjections.js';
21
24
  export * from './llmInvocationDecision.js';
@@ -3,7 +3,7 @@ export type LLMChatV2EditorCacheEligibility = {
3
3
  eligible: true;
4
4
  } | {
5
5
  eligible: false;
6
- reason: 'disabled' | 'rivet-tools' | 'provider-native-tools';
6
+ reason: 'disabled' | 'rivet-tools' | 'provider-native-tools' | 'circuit-breaker';
7
7
  };
8
8
  /**
9
9
  * Editor-cache replay is safe only for ordinary deterministic model calls.
@@ -3,6 +3,7 @@ import { type ChatV2CommonNodeData } from './chatV2Shared.js';
3
3
  import type { ChatV2Provider } from './chatV2Types.js';
4
4
  import type { ChartNode, NodeId } from '../NodeBase.js';
5
5
  import type { CustomProviderApi } from './customProviderApi.js';
6
+ import type { ChatV2CredentialNamesByProvider } from './chatV2CredentialNames.js';
6
7
  export type { CustomProviderApi } from './customProviderApi.js';
7
8
  export type LLMChatV2ToolChoiceMode = '' | 'auto' | 'function' | 'required';
8
9
  export type LLMChatV2ApiKeySource = 'environment' | 'input';
@@ -11,6 +12,7 @@ export type LLMChatV2NodeConfigData = ChatV2CommonNodeData & {
11
12
  configurationMode?: LLMChatV2ConfigurationMode;
12
13
  provider: ChatV2Provider;
13
14
  apiKeySource?: LLMChatV2ApiKeySource;
15
+ providerApiKeyNames?: ChatV2CredentialNamesByProvider;
14
16
  customProviderApiKeyProgrammaticName?: string;
15
17
  customProviderApiKeyEnvVarName?: string;
16
18
  customProviderBaseURL: string;
@@ -44,6 +46,12 @@ export type LLMChatV2NodeConfigData = ChatV2CommonNodeData & {
44
46
  googleIncludeThoughts?: boolean;
45
47
  enableGoogleSearchGrounding: boolean;
46
48
  enableGoogleUrlContext: boolean;
49
+ enableCircuitBreaker?: boolean;
50
+ firstOutputTimeoutMs?: number;
51
+ streamInactivityTimeoutMs?: number;
52
+ circuitBreakerFailureThreshold?: number;
53
+ circuitBreakerFailureWindowMs?: number;
54
+ circuitBreakerOpenDurationMs?: number;
47
55
  responseFormat?: ChatV2ResponseFormat;
48
56
  responseSchemaName?: string;
49
57
  useResponseSchemaNameInput?: boolean;
@@ -64,7 +72,7 @@ export type LLMChatV2NodeConfigData = ChatV2CommonNodeData & {
64
72
  export type LLMChatV2NodeData = LLMChatV2NodeConfigData;
65
73
  export type LLMChatV2Node = ChartNode<'llmChatV2', LLMChatV2NodeData>;
66
74
  /** @deprecated Use llmProfileDataKeys from llmProfileFieldRegistry instead. */
67
- export declare const llmChatV2ProfileDataKeys: ("provider" | "model" | "customProviderApi" | "headers" | "temperature" | "seed" | "maxTokens" | "presencePenalty" | "frequencyPenalty" | "useModelInput" | "useTemperatureInput" | "useTopPInput" | "useMaxTokensInput" | "usePresencePenaltyInput" | "useFrequencyPenaltyInput" | "useHeadersInput" | "useSeedInput" | "topP" | "topK" | "useTopKInput" | "stopSequences" | "useStopSequencesInput" | "anthropicCacheControlTtl" | "apiKeySource" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext")[];
75
+ export declare const llmChatV2ProfileDataKeys: ("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")[];
68
76
  export type LLMChatV2ProfileDataKey = (typeof llmChatV2ProfileDataKeys)[number];
69
77
  export type LLMChatV2ProfileData = Pick<LLMChatV2NodeData, LLMChatV2ProfileDataKey>;
70
78
  export type LLMChatV2EditorCacheKeyParts = {
@@ -82,6 +90,7 @@ export type LLMChatV2EditorCacheKeyParts = {
82
90
  generationParameters: unknown;
83
91
  responseFormatParameters: unknown;
84
92
  providerOptions: unknown;
93
+ requestBodyOverlay?: unknown;
85
94
  toolChoice: unknown;
86
95
  /** Ordered, credential-fingerprinted fallback profile configuration. */
87
96
  profileChain?: unknown;
@@ -2,6 +2,7 @@ import type { LLMInvocationPlan } from './llmInvocationPlan.js';
2
2
  import { applyLLMProfileToNodeData } from './llmProfile.js';
3
3
  import type { LLMProfileValue } from './llmProfileTypes.js';
4
4
  import { type ChatV2CredentialResult } from './chatV2ProviderProfile.js';
5
+ import { type LLMChatV2RequestBodyOverlay } from './chatV2RuntimeOptions.js';
5
6
  import type { ChatV2PipelineRoundOptions, RunChatV2PipelineOptions } from './chatV2Types.js';
6
7
  import { type ResolvedChatV2ProviderConfig } from './providerOptions.js';
7
8
  /** A fully executable model/profile selection plus safe configuration facts. */
@@ -9,6 +10,7 @@ export type ResolvedLLMModelCandidate = {
9
10
  effectiveData: ReturnType<typeof applyLLMProfileToNodeData>;
10
11
  credential: ChatV2CredentialResult;
11
12
  providerConfig: ResolvedChatV2ProviderConfig;
13
+ requestBodyOverlay: LLMChatV2RequestBodyOverlay | undefined;
12
14
  runOptions: RunChatV2PipelineOptions;
13
15
  };
14
16
  export declare function resolveLLMModelCandidate(params: {
@@ -1,4 +1,6 @@
1
1
  import { type LLMProfileValue } from './llmProfileTypes.js';
2
+ import type { NodeId } from '../NodeBase.js';
3
+ import type { ProjectId } from '../Project.js';
2
4
  export { applyLLMProfileToNodeData, createDefaultLLMProfileValue, createLLMProfileNodeData, LLM_PROFILE_VALUE_VERSION, pickLLMChatV2ProfileData, type LLMProfileValue, } from './llmProfileTypes.js';
3
5
  export declare function normalizeLLMProfileValue(value: unknown): LLMProfileValue;
4
6
  /**
@@ -8,3 +10,15 @@ export declare function normalizeLLMProfileValue(value: unknown): LLMProfileValu
8
10
  * malformed values without re-entering scalar coercion.
9
11
  */
10
12
  export declare function normalizeLLMProfileChainInput(value: unknown): LLMProfileValue[];
13
+ /**
14
+ * Programmatic or serialized llm-config values may originate outside the
15
+ * currently executing project. Always bind health to that project before
16
+ * shared storage is consulted so copied values cannot share a circuit across
17
+ * projects. Preserve an originating profile-node identity when one exists;
18
+ * otherwise the consuming Chat node owns the identity.
19
+ */
20
+ export declare function scopeLLMProfileHealthIdentity(profile: LLMProfileValue, fallback: {
21
+ projectId: ProjectId;
22
+ profileNodeId: NodeId;
23
+ chatNodeHeaders?: Record<string, string> | undefined;
24
+ }): LLMProfileValue;
@@ -8,7 +8,7 @@ export type LLMProfileBodySnippet = Readonly<{
8
8
  text: string;
9
9
  }>;
10
10
  export type LLMProfileBodySection = Readonly<{
11
- id: 'model' | 'parameters' | 'provider' | 'advanced';
11
+ id: 'model' | 'parameters' | 'provider' | 'reliability' | 'advanced';
12
12
  fields: readonly LLMProfileBodyField[];
13
13
  snippet?: LLMProfileBodySnippet | undefined;
14
14
  }>;
@@ -1,5 +1,6 @@
1
1
  import { type ChatV2Provider, type ChatV2PipelineRoundOptions, type ChatV2PipelineResult, type RunChatV2PipelineOptions } from './chatV2Types.js';
2
2
  import { type CustomProviderApi } from './customProviderApi.js';
3
+ import { type RivetLLMProfileCircuitBreakerPolicy, type RivetLLMProfileHealthIdentity, type RivetLLMProfileHealthOutcome, type RivetLLMProfileHealthState, type RivetLLMProfileHealthStore } from './llmProfileHealthStore.js';
3
4
  export type LLMAttempt = {
4
5
  roundIndex: number;
5
6
  /** Present when a From profile candidate produced this attempt. */
@@ -7,16 +8,29 @@ export type LLMAttempt = {
7
8
  provider: ChatV2Provider;
8
9
  model: string;
9
10
  customProviderApi?: CustomProviderApi;
10
- stage: 'configuration' | 'request' | 'response-validation';
11
- outcome: 'success' | 'failure' | 'aborted';
11
+ stage: 'configuration' | 'request' | 'response-validation' | 'health-gate' | 'health-update';
12
+ outcome: 'success' | 'failure' | 'aborted' | 'skipped';
12
13
  attemptIndex?: number;
13
14
  status?: number;
14
15
  error?: string;
16
+ profileHealthKey?: string;
17
+ healthState?: RivetLLMProfileHealthState;
18
+ healthDisposition?: 'allow' | 'deny' | 'fail-open';
19
+ healthOutcome?: RivetLLMProfileHealthOutcome;
20
+ retryAt?: number;
21
+ timeoutKind?: 'first-output' | 'stream-inactivity';
22
+ };
23
+ export type LLMProfileFallbackHealth = {
24
+ identity: RivetLLMProfileHealthIdentity;
25
+ policy: RivetLLMProfileCircuitBreakerPolicy;
26
+ firstOutputTimeoutMs: number;
27
+ streamInactivityTimeoutMs: number;
15
28
  };
16
29
  export type LLMProfileFallbackCandidate = {
17
30
  provider: ChatV2Provider;
18
31
  model: string;
19
32
  customProviderApi?: CustomProviderApi;
33
+ health?: LLMProfileFallbackHealth;
20
34
  };
21
35
  export type LLMProfileFallbackRunner = {
22
36
  run: (roundOptions: ChatV2PipelineRoundOptions) => Promise<ChatV2PipelineResult>;
@@ -35,6 +49,8 @@ export declare function getLLMAttemptErrorMessage(error: unknown): string;
35
49
  * primary profile does not make the configured fallback order invisible.
36
50
  */
37
51
  export declare function buildLLMProfileFallbackSummary(candidates: readonly LLMProfileFallbackCandidate[], attempts: readonly LLMAttempt[]): string;
52
+ /** Classifies only provider availability failures, never local/configuration errors. */
53
+ export declare function isUnhealthyLLMProfileProviderFailure(error: unknown): boolean;
38
54
  /**
39
55
  * Creates one forward-only fallback chain for a whole LLM Chat invocation.
40
56
  * A model which succeeds in an earlier tool round stays active for subsequent
@@ -44,4 +60,7 @@ export declare function createLLMProfileFallbackRunner(params: {
44
60
  candidates: readonly LLMProfileFallbackCandidate[];
45
61
  resolveCandidate: (profileIndex: number, roundOptions: ChatV2PipelineRoundOptions) => Promise<RunChatV2PipelineOptions>;
46
62
  onAttempt?: ((attempt: LLMAttempt) => void) | undefined;
63
+ healthStore?: RivetLLMProfileHealthStore | undefined;
64
+ /** Internal test/host hardening seam; ordinary runs use the bounded default. */
65
+ healthOperationTimeoutMs?: number | undefined;
47
66
  }): LLMProfileFallbackRunner;
@@ -91,6 +91,8 @@ export declare const llmProfileFieldSpecs: readonly [{
91
91
  }, {
92
92
  readonly key: "apiKeySource";
93
93
  readonly inputId: "apiKey";
94
+ }, {
95
+ readonly key: "providerApiKeyNames";
94
96
  }, {
95
97
  readonly key: "customProviderApiKeyProgrammaticName";
96
98
  readonly valueKind: "string";
@@ -177,13 +179,31 @@ export declare const llmProfileFieldSpecs: readonly [{
177
179
  }, {
178
180
  readonly key: "enableGoogleUrlContext";
179
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";
180
200
  }];
181
- export declare const llmProfileDataKeys: ("provider" | "model" | "customProviderApi" | "headers" | "temperature" | "seed" | "maxTokens" | "presencePenalty" | "frequencyPenalty" | "useModelInput" | "useTemperatureInput" | "useTopPInput" | "useMaxTokensInput" | "usePresencePenaltyInput" | "useFrequencyPenaltyInput" | "useHeadersInput" | "useSeedInput" | "topP" | "topK" | "useTopKInput" | "stopSequences" | "useStopSequencesInput" | "anthropicCacheControlTtl" | "apiKeySource" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext")[];
182
- export declare const llmProfileInputIds: ("model" | "headers" | "temperature" | "seed" | "maxTokens" | "presencePenalty" | "frequencyPenalty" | "topP" | "topK" | "stopSequences" | "apiKey" | "customProviderBaseURL" | "extraProviderOptions" | "anthropicThinkingBudget" | "googleThinkingBudget" | "previousResponseId")[];
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")[];
183
203
  /** Runtime validation categories for resolved LLM Profile values. */
184
- export declare const llmProfileStringDataKeys: ("provider" | "parallelToolCalls" | "customProviderApi" | "headers" | "toolChoice" | "toolChoiceFunction" | "responseFormat" | "responseSchemaName" | "useHeadersInput" | "useResponseSchemaNameInput" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "anthropicCacheControlTtl" | "outputRequestBody" | "outputResponseBody" | "retryOnNon200" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "baseURL" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | "configurationMode" | "apiKeySource" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "useBaseURLInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "autoContinueToolCalls" | "maxToolRounds" | "outputLLMAttempts")[];
185
- export declare const llmProfileBooleanDataKeys: ("provider" | "parallelToolCalls" | "customProviderApi" | "headers" | "toolChoice" | "toolChoiceFunction" | "responseFormat" | "responseSchemaName" | "useHeadersInput" | "useResponseSchemaNameInput" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "anthropicCacheControlTtl" | "outputRequestBody" | "outputResponseBody" | "retryOnNon200" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "baseURL" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | "configurationMode" | "apiKeySource" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "useBaseURLInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "autoContinueToolCalls" | "maxToolRounds" | "outputLLMAttempts")[];
186
- export declare const llmProfileRequiredNumberDataKeys: ("provider" | "parallelToolCalls" | "customProviderApi" | "headers" | "toolChoice" | "toolChoiceFunction" | "responseFormat" | "responseSchemaName" | "useHeadersInput" | "useResponseSchemaNameInput" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "anthropicCacheControlTtl" | "outputRequestBody" | "outputResponseBody" | "retryOnNon200" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "baseURL" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | "configurationMode" | "apiKeySource" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "useBaseURLInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "autoContinueToolCalls" | "maxToolRounds" | "outputLLMAttempts")[];
187
- export declare const llmProfileOptionalNumberDataKeys: ("provider" | "parallelToolCalls" | "customProviderApi" | "headers" | "toolChoice" | "toolChoiceFunction" | "responseFormat" | "responseSchemaName" | "useHeadersInput" | "useResponseSchemaNameInput" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "anthropicCacheControlTtl" | "outputRequestBody" | "outputResponseBody" | "retryOnNon200" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "baseURL" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | "configurationMode" | "apiKeySource" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "useBaseURLInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "autoContinueToolCalls" | "maxToolRounds" | "outputLLMAttempts")[];
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")[];
188
208
  /** A serialized profile must be self-contained, not driven by hidden ports. */
189
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,5 +1,6 @@
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
@@ -11,6 +12,8 @@ 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;
@@ -53,6 +53,7 @@ export type CreateChatV2ModelOptions = {
53
53
  onRequestBody?: ((body: unknown) => void) | undefined;
54
54
  onResponseBody?: ((response: Response) => void) | undefined;
55
55
  transformRequestBody?: ((body: unknown) => unknown) | undefined;
56
+ requestBodyOverlay?: Readonly<Record<string, unknown>> | undefined;
56
57
  customProviderApi?: CustomProviderApi | undefined;
57
58
  endpointQuery?: ReadonlyArray<readonly [string, string]> | undefined;
58
59
  };
@@ -67,5 +68,6 @@ export declare function normalizeOpenAICompatibleEndpoint(endpoint: string): {
67
68
  endpointQuery: Array<[string, string]>;
68
69
  };
69
70
  export declare function openAICompatibleEndpointToBaseURL(endpoint: string): string;
71
+ export declare function applyChatV2RequestBodyOverlay(body: unknown, overlay: Readonly<Record<string, unknown>> | undefined): unknown;
70
72
  export declare function resolveChatV2ProviderConfig(provider: ChatV2Provider, _modelId: string, context: ResolveChatV2ProviderConfigContext, options?: CreateChatV2ModelOptions): Promise<ResolvedChatV2ProviderConfig>;
71
73
  export declare function createChatV2Model(provider: ChatV2Provider, modelId: string, context: Pick<InternalProcessContext, 'settings' | 'getPluginConfig'>, options?: CreateChatV2ModelOptions): ChatV2Model;
@@ -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;
@@ -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,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;
@@ -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, };