@valerypopoff/rivet2-core 2.1.10 → 2.4.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 (111) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/bundle.cjs +2604 -949
  3. package/dist/cjs/bundle.cjs.map +4 -4
  4. package/dist/cjs/webAppRuntime.cjs +1549 -99
  5. package/dist/cjs/webAppRuntime.cjs.map +4 -4
  6. package/dist/esm/api/createProcessor.js +4 -0
  7. package/dist/esm/exports.js +2 -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 +137 -11
  11. package/dist/esm/model/GraphProcessor.js +28 -0
  12. package/dist/esm/model/NodeExclusionPolicy.js +9 -1
  13. package/dist/esm/model/ProcessContextBuilder.js +2 -1
  14. package/dist/esm/model/RecordingPlayer.js +58 -5
  15. package/dist/esm/model/SubprocessorBridge.js +2 -0
  16. package/dist/esm/model/UiGraphActionProtocol.js +47 -4
  17. package/dist/esm/model/UiGraphBrowserRuntime.js +15 -1
  18. package/dist/esm/model/UiGraphIndexedDbPersistence.js +523 -0
  19. package/dist/esm/model/UiGraphRendererStyles.js +14 -0
  20. package/dist/esm/model/WebAppBrowserStorage.js +653 -0
  21. package/dist/esm/model/WebAppBrowserStorageRpc.js +200 -0
  22. package/dist/esm/model/chat-v2/aiSdkBridge.js +146 -14
  23. package/dist/esm/model/chat-v2/chatV2CallObserver.js +3 -0
  24. package/dist/esm/model/chat-v2/chatV2CredentialNames.js +93 -0
  25. package/dist/esm/model/chat-v2/chatV2EditorCache.js +8 -38
  26. package/dist/esm/model/chat-v2/chatV2Pipeline.js +41 -4
  27. package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +31 -2
  28. package/dist/esm/model/chat-v2/chatV2ResponseBodyCapture.js +10 -2
  29. package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +6 -11
  30. package/dist/esm/model/chat-v2/chatV2Shared.js +1 -1
  31. package/dist/esm/model/chat-v2/chatV2Types.js +16 -0
  32. package/dist/esm/model/chat-v2/customProviderApi.js +0 -2
  33. package/dist/esm/model/chat-v2/index.js +3 -0
  34. package/dist/esm/model/chat-v2/llmChatV2Body.js +9 -1
  35. package/dist/esm/model/chat-v2/llmChatV2CachePolicy.js +5 -0
  36. package/dist/esm/model/chat-v2/llmChatV2NodeData.js +7 -0
  37. package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +95 -14
  38. package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +33 -9
  39. package/dist/esm/model/chat-v2/llmChatV2OutputClone.js +42 -0
  40. package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +31 -2
  41. package/dist/esm/model/chat-v2/llmModelCandidate.js +5 -1
  42. package/dist/esm/model/chat-v2/llmProfile.js +58 -0
  43. package/dist/esm/model/chat-v2/llmProfileBody.js +10 -0
  44. package/dist/esm/model/chat-v2/llmProfileFallback.js +406 -8
  45. package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +7 -0
  46. package/dist/esm/model/chat-v2/llmProfileHealthStore.js +328 -0
  47. package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +57 -34
  48. package/dist/esm/model/chat-v2/providerOptions.js +33 -7
  49. package/dist/esm/model/chat-v2/toolContinuation.js +27 -1
  50. package/dist/esm/model/nodes/CodeNewNode.js +5 -47
  51. package/dist/esm/model/nodes/CodeNode.js +4 -46
  52. package/dist/esm/model/nodes/ExpressionNode.js +5 -8
  53. package/dist/esm/model/nodes/LLMChatV2Node.js +31 -3
  54. package/dist/esm/model/nodes/MatchNode.js +86 -41
  55. package/dist/esm/plugins/gentrace/gentraceSdk.js +0 -1
  56. package/dist/esm/plugins/gentrace/index.js +0 -1
  57. package/dist/esm/plugins/gentrace/plugin.js +61 -179
  58. package/dist/esm/plugins.js +1 -2
  59. package/dist/esm/recording/ExecutionRecorder.js +50 -8
  60. package/dist/esm/webAppRuntime.js +5 -2
  61. package/dist/types/api/createProcessor.d.ts +5 -0
  62. package/dist/types/exports.d.ts +2 -0
  63. package/dist/types/integrations/CodeRunner.d.ts +10 -7
  64. package/dist/types/integrations/CodeRunnerOptions.d.ts +15 -0
  65. package/dist/types/model/AgentResponseTrace.d.ts +15 -1
  66. package/dist/types/model/EditorDefinition.d.ts +16 -0
  67. package/dist/types/model/ExecutorProtocol.d.ts +17 -6
  68. package/dist/types/model/GraphProcessor.d.ts +17 -5
  69. package/dist/types/model/NodeBase.d.ts +0 -10
  70. package/dist/types/model/NodeExclusionPolicy.d.ts +6 -0
  71. package/dist/types/model/Nodes.d.ts +2 -2
  72. package/dist/types/model/ProcessContext.d.ts +85 -0
  73. package/dist/types/model/ProcessContextBuilder.d.ts +2 -1
  74. package/dist/types/model/UiGraphActionProtocol.d.ts +9 -3
  75. package/dist/types/model/UiGraphBrowserRuntime.d.ts +6 -0
  76. package/dist/types/model/UiGraphIndexedDbPersistence.d.ts +50 -0
  77. package/dist/types/model/UiGraphRendererStyles.d.ts +1 -1
  78. package/dist/types/model/WebAppBrowserStorage.d.ts +90 -0
  79. package/dist/types/model/WebAppBrowserStorageRpc.d.ts +85 -0
  80. package/dist/types/model/chat-v2/chatV2CredentialNames.d.ts +30 -0
  81. package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +1 -0
  82. package/dist/types/model/chat-v2/chatV2ProviderProfile.d.ts +3 -0
  83. package/dist/types/model/chat-v2/chatV2ResponseBodyCapture.d.ts +8 -2
  84. package/dist/types/model/chat-v2/chatV2RuntimeOptions.d.ts +3 -8
  85. package/dist/types/model/chat-v2/chatV2Types.d.ts +27 -1
  86. package/dist/types/model/chat-v2/customProviderApi.d.ts +0 -1
  87. package/dist/types/model/chat-v2/index.d.ts +3 -0
  88. package/dist/types/model/chat-v2/llmChatV2CachePolicy.d.ts +1 -1
  89. package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +10 -1
  90. package/dist/types/model/chat-v2/llmChatV2OutputClone.d.ts +3 -0
  91. package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +5 -1
  92. package/dist/types/model/chat-v2/llmModelCandidate.d.ts +2 -0
  93. package/dist/types/model/chat-v2/llmProfile.d.ts +14 -0
  94. package/dist/types/model/chat-v2/llmProfileBody.d.ts +1 -1
  95. package/dist/types/model/chat-v2/llmProfileFallback.d.ts +25 -2
  96. package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +26 -6
  97. package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +121 -0
  98. package/dist/types/model/chat-v2/llmProfileNodeRuntime.d.ts +1 -1
  99. package/dist/types/model/chat-v2/llmProfileTypes.d.ts +9 -0
  100. package/dist/types/model/chat-v2/providerOptions.d.ts +2 -0
  101. package/dist/types/model/chat-v2/toolContinuation.d.ts +14 -0
  102. package/dist/types/model/nodes/CodeNewNode.d.ts +0 -5
  103. package/dist/types/model/nodes/CodeNode.d.ts +0 -5
  104. package/dist/types/model/nodes/MatchNode.d.ts +6 -0
  105. package/dist/types/plugins/gentrace/gentraceSdk.d.ts +0 -1
  106. package/dist/types/plugins/gentrace/plugin.d.ts +55 -9
  107. package/dist/types/plugins.d.ts +1 -1
  108. package/dist/types/recording/ExecutionRecorder.d.ts +7 -1
  109. package/dist/types/recording/RecordedEvents.d.ts +11 -0
  110. package/dist/types/webAppRuntime.d.ts +8 -2
  111. package/package.json +2 -2
@@ -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;
@@ -0,0 +1,3 @@
1
+ import type { Outputs } from '../GraphProcessor.js';
2
+ /** Cycle-safe clone shared by the editor cache and LLM logical-round snapshots. */
3
+ export declare function cloneLLMChatV2Outputs(outputs: Outputs): Outputs;
@@ -2,6 +2,7 @@ import type { ChatV2PipelineResult } from './chatV2Types.js';
2
2
  import type { LLMChatV2RuntimeConfig } from './llmChatV2NodeRuntime.js';
3
3
  import type { InternalProcessContext } from '../ProcessContext.js';
4
4
  import type { ToolCallContinuation } from '../ToolCallContinuation.js';
5
+ import { type LLMChatOutputSnapshotDescriptor } from './toolContinuation.js';
5
6
  import type { LLMInvocationJournal } from './llmInvocationJournal.js';
6
7
  /**
7
8
  * Owns the LLM-level recovery and continuation decision boundary. The node
@@ -13,4 +14,7 @@ export declare function executeLLMInvocation(params: {
13
14
  journal: LLMInvocationJournal;
14
15
  runtime: LLMChatV2RuntimeConfig;
15
16
  toolCallContinuation: ToolCallContinuation | undefined;
16
- }): Promise<ChatV2PipelineResult>;
17
+ }): Promise<{
18
+ result: ChatV2PipelineResult;
19
+ terminalSnapshot?: LLMChatOutputSnapshotDescriptor;
20
+ }>;
@@ -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,22 +1,40 @@
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. */
6
7
  profileIndex?: number;
8
+ /** User-facing title captured from the source LLM Profile node. */
9
+ profileName?: string;
7
10
  provider: ChatV2Provider;
8
11
  model: string;
9
12
  customProviderApi?: CustomProviderApi;
10
- stage: 'configuration' | 'request' | 'response-validation';
11
- outcome: 'success' | 'failure' | 'aborted';
13
+ stage: 'configuration' | 'request' | 'response-validation' | 'health-gate' | 'health-update';
14
+ outcome: 'success' | 'failure' | 'aborted' | 'skipped';
12
15
  attemptIndex?: number;
13
16
  status?: number;
14
17
  error?: string;
18
+ profileHealthKey?: string;
19
+ healthState?: RivetLLMProfileHealthState;
20
+ healthDisposition?: 'allow' | 'deny' | 'fail-open';
21
+ healthOutcome?: RivetLLMProfileHealthOutcome;
22
+ retryAt?: number;
23
+ timeoutKind?: 'first-output' | 'stream-inactivity';
24
+ };
25
+ export type LLMProfileFallbackHealth = {
26
+ identity: RivetLLMProfileHealthIdentity;
27
+ policy: RivetLLMProfileCircuitBreakerPolicy;
28
+ firstOutputTimeoutMs: number;
29
+ streamInactivityTimeoutMs: number;
15
30
  };
16
31
  export type LLMProfileFallbackCandidate = {
17
32
  provider: ChatV2Provider;
18
33
  model: string;
34
+ /** User-facing title captured from the source LLM Profile node. */
35
+ profileName?: string;
19
36
  customProviderApi?: CustomProviderApi;
37
+ health?: LLMProfileFallbackHealth;
20
38
  };
21
39
  export type LLMProfileFallbackRunner = {
22
40
  run: (roundOptions: ChatV2PipelineRoundOptions) => Promise<ChatV2PipelineResult>;
@@ -35,6 +53,8 @@ export declare function getLLMAttemptErrorMessage(error: unknown): string;
35
53
  * primary profile does not make the configured fallback order invisible.
36
54
  */
37
55
  export declare function buildLLMProfileFallbackSummary(candidates: readonly LLMProfileFallbackCandidate[], attempts: readonly LLMAttempt[]): string;
56
+ /** Classifies only provider availability failures, never local/configuration errors. */
57
+ export declare function isUnhealthyLLMProfileProviderFailure(error: unknown): boolean;
38
58
  /**
39
59
  * Creates one forward-only fallback chain for a whole LLM Chat invocation.
40
60
  * A model which succeeds in an earlier tool round stays active for subsequent
@@ -44,4 +64,7 @@ export declare function createLLMProfileFallbackRunner(params: {
44
64
  candidates: readonly LLMProfileFallbackCandidate[];
45
65
  resolveCandidate: (profileIndex: number, roundOptions: ChatV2PipelineRoundOptions) => Promise<RunChatV2PipelineOptions>;
46
66
  onAttempt?: ((attempt: LLMAttempt) => void) | undefined;
67
+ healthStore?: RivetLLMProfileHealthStore | undefined;
68
+ /** Internal test/host hardening seam; ordinary runs use the bounded default. */
69
+ healthOperationTimeoutMs?: number | undefined;
47
70
  }): 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,121 @@
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
+ /** Current source-node title used only for operator-facing identification. */
33
+ profileName?: string;
34
+ provider: ChatV2Provider;
35
+ model: string;
36
+ customProviderApi?: CustomProviderApi;
37
+ configurationFingerprint: string;
38
+ };
39
+ export declare function createRivetLLMProfileHealthIdentity(params: {
40
+ configuration: LLMChatV2ProfileData;
41
+ credential: ChatV2CredentialResult;
42
+ /** Project-wide Chat headers merged into every physical provider request. */
43
+ chatNodeHeaders?: Record<string, string> | undefined;
44
+ projectId?: ProjectId;
45
+ profileNodeId?: NodeId;
46
+ /** Current source-node title. It is intentionally excluded from the key. */
47
+ profileName?: string;
48
+ }): RivetLLMProfileHealthIdentity;
49
+ export type RivetLLMProfileHealthState = 'closed' | 'open' | 'half-open';
50
+ export type RivetLLMProfileHealthSnapshot = {
51
+ identity: RivetLLMProfileHealthIdentity;
52
+ state: RivetLLMProfileHealthState;
53
+ failureCount: number;
54
+ openUntil?: number;
55
+ halfOpenLeaseUntil?: number;
56
+ updatedAt: number;
57
+ };
58
+ export type RivetLLMProfileHealthBeginRequest = {
59
+ identity: RivetLLMProfileHealthIdentity;
60
+ policy: RivetLLMProfileCircuitBreakerPolicy;
61
+ };
62
+ export type RivetLLMProfileHealthBeginResult = {
63
+ disposition: 'allow' | 'deny';
64
+ state: RivetLLMProfileHealthState;
65
+ /** Opaque permit returned to `finish`; present only when execution is allowed. */
66
+ permitId?: string;
67
+ retryAt?: number;
68
+ snapshot: RivetLLMProfileHealthSnapshot;
69
+ };
70
+ export type RivetLLMProfileHealthOutcome = 'healthy' | 'unhealthy' | 'ignored';
71
+ export type RivetLLMProfileHealthFinishRequest = {
72
+ identity: RivetLLMProfileHealthIdentity;
73
+ policy: RivetLLMProfileCircuitBreakerPolicy;
74
+ permitId: string;
75
+ outcome: RivetLLMProfileHealthOutcome;
76
+ /**
77
+ * Host-owned, privacy-bounded execution correlation. Studio Server uses this
78
+ * only to join an unhealthy profile result to its normal run recording after
79
+ * that recording has finished persisting.
80
+ */
81
+ executionCorrelationId?: string;
82
+ };
83
+ export type RivetLLMProfileHealthRenewRequest = {
84
+ identity: RivetLLMProfileHealthIdentity;
85
+ permitId: string;
86
+ leaseDurationMs: number;
87
+ };
88
+ export type RivetLLMProfileHealthResetRequest = {
89
+ key: string;
90
+ projectId?: never;
91
+ } | {
92
+ key?: never;
93
+ projectId: ProjectId;
94
+ };
95
+ export type RivetLLMProfileHealthListRequest = {
96
+ projectId?: ProjectId;
97
+ };
98
+ /**
99
+ * Host persistence seam for LLM Profile health. Implementations must make
100
+ * each method atomic. In particular, `begin` must allow at most one probe
101
+ * while an open circuit is half-open across all processes using the store.
102
+ */
103
+ export interface RivetLLMProfileHealthStore {
104
+ begin(request: RivetLLMProfileHealthBeginRequest): RivetLLMProfileHealthBeginResult | Promise<RivetLLMProfileHealthBeginResult>;
105
+ finish(request: RivetLLMProfileHealthFinishRequest): RivetLLMProfileHealthSnapshot | Promise<RivetLLMProfileHealthSnapshot>;
106
+ renew(request: RivetLLMProfileHealthRenewRequest): RivetLLMProfileHealthSnapshot | Promise<RivetLLMProfileHealthSnapshot>;
107
+ reset(request: RivetLLMProfileHealthResetRequest): void | Promise<void>;
108
+ list(request?: RivetLLMProfileHealthListRequest): RivetLLMProfileHealthSnapshot[] | Promise<RivetLLMProfileHealthSnapshot[]>;
109
+ }
110
+ /** Process-local reference implementation used when a host does not supply durable shared storage. */
111
+ export declare class InMemoryRivetLLMProfileHealthStore implements RivetLLMProfileHealthStore {
112
+ #private;
113
+ constructor(options?: {
114
+ now?: () => number;
115
+ });
116
+ begin(request: RivetLLMProfileHealthBeginRequest): RivetLLMProfileHealthBeginResult;
117
+ finish(request: RivetLLMProfileHealthFinishRequest): RivetLLMProfileHealthSnapshot;
118
+ renew(request: RivetLLMProfileHealthRenewRequest): RivetLLMProfileHealthSnapshot;
119
+ reset(request: RivetLLMProfileHealthResetRequest): void;
120
+ list(request?: RivetLLMProfileHealthListRequest): RivetLLMProfileHealthSnapshot[];
121
+ }
@@ -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,14 @@ export type LLMProfileValue = {
11
12
  version: typeof LLM_PROFILE_VALUE_VERSION;
12
13
  configuration: LLMChatV2ProfileData;
13
14
  credential: ChatV2CredentialResult;
15
+ /**
16
+ * User-facing title captured from the source LLM Profile node. It is
17
+ * diagnostic metadata only: changing a node title must not change provider
18
+ * resolution, caching, or circuit-breaker identity.
19
+ */
20
+ profileName?: string;
21
+ /** Stable privacy-bounded identity used by optional cross-run health policy. */
22
+ healthIdentity?: RivetLLMProfileHealthIdentity;
14
23
  };
15
24
  export declare function createLLMProfileNodeData(): LLMChatV2ProfileData;
16
25
  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;
@@ -1,7 +1,15 @@
1
1
  import type { ChatMessageDataValue, GptFunction } from '../DataValue.js';
2
+ import type { Outputs } from '../GraphProcessor.js';
2
3
  import type { ChatV2PipelineResult, ChatV2PipelineRoundOptions } from './chatV2Types.js';
3
4
  import type { StreamedFunctionCall } from '../chat/streamChatResponse.js';
4
5
  import type { DelegatedToolCallRecord } from '../nodes/toolCallDelegation.js';
6
+ import type { LLMChatOutputSnapshotKind, LLMChatOutputSnapshotOutcome } from '../ProcessContext.js';
7
+ export type LLMChatOutputSnapshotDescriptor = {
8
+ entryId: string;
9
+ roundIndex: number;
10
+ kind: LLMChatOutputSnapshotKind;
11
+ outcome: LLMChatOutputSnapshotOutcome;
12
+ };
5
13
  export type ToolContinuationOptions = ChatV2PipelineRoundOptions & {
6
14
  autoContinue: boolean;
7
15
  maxToolRounds: number;
@@ -9,6 +17,12 @@ export type ToolContinuationOptions = ChatV2PipelineRoundOptions & {
9
17
  delegateToolCall: (toolCall: StreamedFunctionCall) => Promise<ToolContinuationToolResult>;
10
18
  delegateToolCallRound?: (toolCalls: StreamedFunctionCall[], preToolMessage: string) => Promise<ToolContinuationToolResult[]>;
11
19
  runPipeline: (options: ChatV2PipelineRoundOptions) => Promise<ChatV2PipelineResult>;
20
+ /** Emits an immutable completed model page before its delegated tools run. */
21
+ onCompletedModelRound?: (snapshot: LLMChatOutputSnapshotDescriptor & {
22
+ outputs: Outputs;
23
+ }) => void;
24
+ /** Describes the terminal page; the node emits it after terminal projection. */
25
+ onTerminalRound?: (snapshot: LLMChatOutputSnapshotDescriptor) => void;
12
26
  };
13
27
  export type ToolContinuationToolResult = ChatMessageDataValue & {
14
28
  delegatedToolCall?: DelegatedToolCallRecord;
@@ -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, };
@@ -9,6 +9,12 @@ export type ExecutionRecorderOptions = {
9
9
  includePartialOutputs?: boolean;
10
10
  includeTrace?: boolean;
11
11
  };
12
+ export type SocketRecordingOptions = {
13
+ /** Record only the protocol messages belonging to one remote graph run. */
14
+ requestId?: string;
15
+ /** Stop listening when the owning remote operation finishes or is aborted. */
16
+ signal?: AbortSignal;
17
+ };
12
18
  export declare class ExecutionRecorder {
13
19
  #private;
14
20
  recordingId: RecordingId | undefined;
@@ -16,7 +22,7 @@ export declare class ExecutionRecorder {
16
22
  on: Emittery<ExecutionRecorderEvents>['on'];
17
23
  off: Emittery<ExecutionRecorderEvents>['off'];
18
24
  once: Emittery<ExecutionRecorderEvents>['once'];
19
- recordSocket(channel: WebSocket): Promise<void>;
25
+ recordSocket(channel: WebSocket, options?: SocketRecordingOptions): Promise<void>;
20
26
  record(processor: GraphProcessor): void;
21
27
  getRecording(): Recording;
22
28
  get events(): RecordedEvents[];