@valerypopoff/rivet2-core 2.15.0 → 2.19.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.
- package/dist/cjs/bundle.cjs +7906 -3980
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/interpolationRuntime.cjs +62 -7
- package/dist/cjs/interpolationRuntime.cjs.map +3 -3
- package/dist/cjs/interpolationSyntax.cjs +9 -5
- package/dist/cjs/interpolationSyntax.cjs.map +2 -2
- package/dist/cjs/serialization.cjs +1880 -0
- package/dist/cjs/serialization.cjs.map +7 -0
- package/dist/cjs/webAppRuntime.cjs +168 -6
- package/dist/cjs/webAppRuntime.cjs.map +3 -3
- package/dist/esm/api/createProcessor.js +5 -2
- package/dist/esm/api/processSettings.js +1 -0
- package/dist/esm/exports.js +4 -0
- package/dist/esm/model/AgentResponseTrace.js +99 -34
- package/dist/esm/model/AgentResponseTracePresentation.js +130 -0
- package/dist/esm/model/DataValue.js +11 -2
- package/dist/esm/model/GlobalVariables.js +2 -1
- package/dist/esm/model/GraphBoundaryCache.js +2 -1
- package/dist/esm/model/GraphBoundaryEffects.js +38 -1
- package/dist/esm/model/GraphExecutionState.js +81 -0
- package/dist/esm/model/GraphProcessor.js +825 -884
- package/dist/esm/model/GraphSchedulerBoundaryState.js +64 -0
- package/dist/esm/model/Nodes.js +15 -0
- package/dist/esm/model/ProjectBundle.js +248 -0
- package/dist/esm/model/ProjectBundleRuntime.js +54 -0
- package/dist/esm/model/SchedulerBoundaryPlanner.js +233 -0
- package/dist/esm/model/SplitRunProcessor.js +28 -7
- package/dist/esm/model/StreamingWatchTopology.js +118 -8
- package/dist/esm/model/SubgraphProjectTarget.js +7 -0
- package/dist/esm/model/SubprocessorBridge.js +125 -87
- package/dist/esm/model/ToolCallContinuationCoordinator.js +1 -1
- package/dist/esm/model/chat-v2/aiSdkBridge.js +22 -17
- package/dist/esm/model/chat-v2/chatV2CallObserver.js +2 -4
- package/dist/esm/model/chat-v2/chatV2CredentialNames.js +5 -1
- package/dist/esm/model/chat-v2/chatV2Outputs.js +2 -2
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +24 -9
- package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +3 -2
- package/dist/esm/model/chat-v2/chatV2ProviderRegistry.js +46 -6
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +26 -1
- package/dist/esm/model/chat-v2/chatV2Shared.js +2 -1
- package/dist/esm/model/chat-v2/chatV2UsageAccounting.js +10 -0
- package/dist/esm/model/chat-v2/llmChatV2Body.js +13 -10
- package/dist/esm/model/chat-v2/llmChatV2CacheBoundary.js +5 -2
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +3 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +33 -9
- package/dist/esm/model/chat-v2/llmChatV2NodeMigration.js +22 -2
- package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +10 -2
- package/dist/esm/model/chat-v2/llmInvocationResultProjector.js +17 -0
- package/dist/esm/model/chat-v2/llmModelCandidate.js +2 -1
- package/dist/esm/model/chat-v2/llmProfile.js +5 -1
- package/dist/esm/model/chat-v2/llmProfileBody.js +11 -2
- package/dist/esm/model/chat-v2/llmProfileFallback.js +7 -4
- package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +2 -1
- package/dist/esm/model/chat-v2/llmProfileHealthStore.js +16 -3
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +1 -1
- package/dist/esm/model/chat-v2/messageConverter.js +18 -16
- package/dist/esm/model/chat-v2/modelRegistry.js +14 -4
- package/dist/esm/model/chat-v2/openRouterModel.js +73 -0
- package/dist/esm/model/chat-v2/parallelToolCalls.js +2 -0
- package/dist/esm/model/chat-v2/providerOptions.js +30 -25
- package/dist/esm/model/chat-v2/temperature.js +9 -0
- package/dist/esm/model/classifier/credentials.js +42 -6
- package/dist/esm/model/classifier/images.js +176 -0
- package/dist/esm/model/classifier/json.js +57 -0
- package/dist/esm/model/classifier/limits.js +300 -0
- package/dist/esm/model/classifier/openai.js +118 -0
- package/dist/esm/model/classifier/perplexity.js +63 -0
- package/dist/esm/model/classifier/preparation.js +74 -0
- package/dist/esm/model/classifier/profile.js +151 -0
- package/dist/esm/model/classifier/profileExecution.js +294 -0
- package/dist/esm/model/classifier/providers.js +454 -192
- package/dist/esm/model/classifier/questionHelpers.js +29 -45
- package/dist/esm/model/classifier/questions.js +53 -0
- package/dist/esm/model/classifier/response.js +75 -0
- package/dist/esm/model/classifier/state.js +207 -0
- package/dist/esm/model/classifier/types.js +11 -1
- package/dist/esm/model/nodeRunFailure.js +54 -0
- package/dist/esm/model/nodes/CallGraphNode.js +6 -0
- package/dist/esm/model/nodes/CatchStreamingChunksNode.js +42 -0
- package/dist/esm/model/nodes/ClassifierEvaluateNode.js +385 -154
- package/dist/esm/model/nodes/ClassifierProfileNode.js +133 -0
- package/dist/esm/model/nodes/ClassifierQuestionNode.js +59 -15
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +1 -1
- package/dist/esm/model/nodes/GetGlobalNode.js +2 -2
- package/dist/esm/model/nodes/HttpCallNode.js +44 -75
- package/dist/esm/model/nodes/ImageNode.js +44 -3
- package/dist/esm/model/nodes/LLMChatV2Node.js +26 -4
- package/dist/esm/model/nodes/ObjectNode.js +29 -18
- package/dist/esm/model/nodes/PromptNode.js +2 -1
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +4 -1
- package/dist/esm/model/nodes/SetGlobalNode.js +5 -3
- package/dist/esm/model/nodes/StopWatchingStreamingOutputNode.js +8 -8
- package/dist/esm/model/nodes/StreamValueNode.js +38 -0
- package/dist/esm/model/nodes/SubGraphNode.js +199 -35
- package/dist/esm/model/nodes/ToBase64Node.js +106 -0
- package/dist/esm/model/nodes/WatchStreamingOutputNode.js +7 -7
- package/dist/esm/model/nodes/toolCallDelegation.js +5 -1
- package/dist/esm/model/profileSuspensionHints.js +8 -0
- package/dist/esm/recording/ExecutionRecorder.js +26 -0
- package/dist/esm/serialization.js +2 -0
- package/dist/esm/utils/base64.js +18 -15
- package/dist/esm/utils/coerceType.js +11 -1
- package/dist/esm/utils/errors.js +41 -0
- package/dist/esm/utils/interpolation.js +44 -22
- package/dist/esm/utils/interpolationSyntax.js +15 -6
- package/dist/esm/utils/serialization/serialization.js +3 -2
- package/dist/esm/utils/serialization/serializationUtils.js +6 -0
- package/dist/esm/utils/serialization/serialization_v4.js +15 -3
- package/dist/esm/webAppRuntime.js +1 -0
- package/dist/types/api/createProcessor.d.ts +7 -1
- package/dist/types/exports.d.ts +4 -0
- package/dist/types/model/AgentResponseTrace.d.ts +15 -4
- package/dist/types/model/AgentResponseTracePresentation.d.ts +15 -0
- package/dist/types/model/CycleDetector.d.ts +1 -2
- package/dist/types/model/DataValue.d.ts +12 -8
- package/dist/types/model/ExecutorProtocol.d.ts +9 -0
- package/dist/types/model/GraphBoundaryCache.d.ts +2 -0
- package/dist/types/model/GraphBoundaryEffects.d.ts +10 -1
- package/dist/types/model/GraphExecutionState.d.ts +68 -0
- package/dist/types/model/GraphProcessor.d.ts +2 -0
- package/dist/types/model/GraphSchedulerBoundaryState.d.ts +96 -0
- package/dist/types/model/Nodes.d.ts +11 -4
- package/dist/types/model/ProcessContext.d.ts +24 -3
- package/dist/types/model/ProjectBundle.d.ts +59 -0
- package/dist/types/model/ProjectBundleRuntime.d.ts +24 -0
- package/dist/types/model/ProjectReferenceLoader.d.ts +3 -0
- package/dist/types/model/RivetUIContext.d.ts +1 -1
- package/dist/types/model/SchedulerBoundaryPlanner.d.ts +42 -0
- package/dist/types/model/Settings.d.ts +1 -0
- package/dist/types/model/StreamingWatchTopology.d.ts +11 -1
- package/dist/types/model/SubgraphProjectTarget.d.ts +38 -0
- package/dist/types/model/SubprocessorBridge.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2CredentialNames.d.ts +4 -0
- package/dist/types/model/chat-v2/chatV2Outputs.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2ProviderRegistry.d.ts +79 -1
- package/dist/types/model/chat-v2/chatV2ProviderTypes.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2Shared.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2UsageAccounting.d.ts +2 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +4 -1
- package/dist/types/model/chat-v2/llmChatV2NodeMigration.d.ts +3 -1
- package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +2 -0
- package/dist/types/model/chat-v2/llmInvocationResultProjector.d.ts +2 -0
- package/dist/types/model/chat-v2/llmProfileFallback.d.ts +51 -3
- package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +10 -7
- package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +6 -2
- package/dist/types/model/chat-v2/modelRegistry.d.ts +5 -4
- package/dist/types/model/chat-v2/openRouterModel.d.ts +2 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +2 -13
- package/dist/types/model/chat-v2/temperature.d.ts +2 -0
- package/dist/types/model/classifier/credentials.d.ts +7 -1
- package/dist/types/model/classifier/images.d.ts +18 -0
- package/dist/types/model/classifier/json.d.ts +19 -0
- package/dist/types/model/classifier/limits.d.ts +45 -0
- package/dist/types/model/classifier/openai.d.ts +5 -0
- package/dist/types/model/classifier/perplexity.d.ts +7 -0
- package/dist/types/model/classifier/preparation.d.ts +16 -0
- package/dist/types/model/classifier/profile.d.ts +46 -0
- package/dist/types/model/classifier/profileExecution.d.ts +32 -0
- package/dist/types/model/classifier/providers.d.ts +98 -9
- package/dist/types/model/classifier/questionHelpers.d.ts +6 -4
- package/dist/types/model/classifier/questions.d.ts +4 -0
- package/dist/types/model/classifier/response.d.ts +4 -0
- package/dist/types/model/classifier/state.d.ts +37 -0
- package/dist/types/model/classifier/types.d.ts +11 -0
- package/dist/types/model/nodeRunFailure.d.ts +13 -0
- package/dist/types/model/nodes/CatchStreamingChunksNode.d.ts +20 -0
- package/dist/types/model/nodes/ClassifierEvaluateNode.d.ts +17 -12
- package/dist/types/model/nodes/ClassifierProfileNode.d.ts +20 -0
- package/dist/types/model/nodes/GetGlobalNode.d.ts +7 -0
- package/dist/types/model/nodes/ImageNode.d.ts +4 -0
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +1 -0
- package/dist/types/model/nodes/ObjectNode.d.ts +2 -1
- package/dist/types/model/nodes/StreamValueNode.d.ts +14 -0
- package/dist/types/model/nodes/SubGraphNode.d.ts +21 -2
- package/dist/types/model/nodes/ToBase64Node.d.ts +12 -0
- package/dist/types/model/nodes/toolCallDelegation.d.ts +3 -1
- package/dist/types/model/profileSuspensionHints.d.ts +8 -0
- package/dist/types/recording/ExecutionRecorder.d.ts +8 -2
- package/dist/types/serialization.d.ts +2 -0
- package/dist/types/utils/base64.d.ts +1 -1
- package/dist/types/utils/errors.d.ts +4 -0
- package/dist/types/utils/interpolation.d.ts +13 -2
- package/dist/types/utils/interpolationSyntax.d.ts +1 -1
- package/dist/types/utils/serialization/serialization.d.ts +3 -1
- package/dist/types/utils/serialization/serializationUtils.d.ts +1 -0
- package/dist/types/webAppRuntime.d.ts +1 -0
- package/package.json +7 -1
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import type { ClassifierCredentialNames } from './credentials.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DataValue } from '../DataValue.js';
|
|
3
|
+
import { type ClassifierStateMessage, type PreparedClassifierState } from './state.js';
|
|
4
|
+
import { validateClassifierEvaluationResponse } from './response.js';
|
|
5
|
+
import type { ClassifierFailureKind, ClassifierAttemptUsage, ClassifierEvaluationResponse, ClassifierQuestionDefinition, PreparedClassifierQuestion } from './types.js';
|
|
6
|
+
export { validateApiCompatibleClassifierResponse } from './response.js';
|
|
3
7
|
export declare const JEV_SYSTEM_ONE_ENDPOINT = "https://api.typesafe.ai/v1/systemone";
|
|
8
|
+
export declare const LIQUID_SYSTEM_ONE_ENDPOINT = "https://api.liquid.ai/decisions/v1/systemone";
|
|
9
|
+
export declare const OPENAI_DECISIONS_ENDPOINT = "https://api.openai.com/v1/decisions";
|
|
10
|
+
export declare const OPENROUTER_DECISIONS_ENDPOINT = "https://openrouter.ai/api/alpha/decisions";
|
|
11
|
+
export declare const PERPLEXITY_DECISIONS_ENDPOINT = "https://api.perplexity.ai/v1/decisions";
|
|
4
12
|
/** Jev's published USD rates. Keep this Core-owned rather than graph-authored. */
|
|
5
13
|
export declare const JEV_TOKEN_PRICING: {
|
|
6
14
|
readonly inputPerMillionTokens: 0.042;
|
|
7
15
|
readonly outputPerMillionTokens: 0;
|
|
8
16
|
};
|
|
17
|
+
/** Liquid d1's published USD rates: https://www.liquid.ai/blog/d1-decision-model */
|
|
18
|
+
export declare const LIQUID_TOKEN_PRICING: {
|
|
19
|
+
readonly inputPerMillionTokens: 0.04;
|
|
20
|
+
readonly outputPerMillionTokens: 0;
|
|
21
|
+
};
|
|
9
22
|
export declare const DEFAULT_CLASSIFIER_RETRY_ON_NON_200_REPEAT_TIMES = 1;
|
|
10
23
|
export declare const DEFAULT_CLASSIFIER_RETRY_ON_NON_200_COOLDOWN_MS = 0;
|
|
11
24
|
export type ClassifierProvider = {
|
|
@@ -14,18 +27,35 @@ export type ClassifierProvider = {
|
|
|
14
27
|
defaultModel: string;
|
|
15
28
|
credentialNames: ClassifierCredentialNames;
|
|
16
29
|
browserExecutionSupported: boolean;
|
|
17
|
-
|
|
30
|
+
supportsImages?: (model: string) => boolean;
|
|
31
|
+
/** A stricter provider request limit also bounds preparation before encoding. */
|
|
32
|
+
maxRequestBytes?: number;
|
|
33
|
+
/** Legacy shorthand: pricing for defaultModel only, never arbitrary models. */
|
|
18
34
|
pricing?: ClassifierTokenPricing;
|
|
35
|
+
modelPricing?: readonly ClassifierModelPricing[];
|
|
19
36
|
/**
|
|
20
37
|
* The response used by the node plus the exact JSON bodies that crossed the
|
|
21
38
|
* provider boundary. Request headers deliberately do not belong here: they
|
|
22
39
|
* carry the API key and must never become graph outputs.
|
|
23
40
|
*/
|
|
24
41
|
evaluate(args: ClassifierProviderEvaluateArgs): Promise<ClassifierProviderEvaluationResult>;
|
|
42
|
+
/** Graph entry uses the same runner without normalizing/copying State twice. */
|
|
43
|
+
evaluateInput?(args: ClassifierProviderEvaluateArgs): Promise<ClassifierProviderEvaluationResult>;
|
|
25
44
|
};
|
|
26
45
|
export type ClassifierTokenPricing = {
|
|
27
46
|
inputPerMillionTokens: number;
|
|
28
47
|
outputPerMillionTokens: number;
|
|
48
|
+
/** The full request uses these rates above the documented context threshold. */
|
|
49
|
+
longContext?: {
|
|
50
|
+
aboveInputTokens: number;
|
|
51
|
+
inputPerMillionTokens: number;
|
|
52
|
+
outputPerMillionTokens: number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type ClassifierModelPricing = {
|
|
56
|
+
/** Exact verified model IDs/aliases belonging to the same priced model. */
|
|
57
|
+
models: readonly string[];
|
|
58
|
+
pricing: ClassifierTokenPricing;
|
|
29
59
|
};
|
|
30
60
|
export type ClassifierProviderEvaluationResult = {
|
|
31
61
|
requestBody: Record<string, unknown>;
|
|
@@ -33,18 +63,49 @@ export type ClassifierProviderEvaluationResult = {
|
|
|
33
63
|
responseBody: Record<string, unknown>;
|
|
34
64
|
};
|
|
35
65
|
export type ClassifierProviderEvaluateArgs = {
|
|
66
|
+
/** Privacy-bounded physical-attempt observer; never includes bodies or credentials. */
|
|
67
|
+
onAttempt?: (attempt: {
|
|
68
|
+
attemptIndex: number;
|
|
69
|
+
outcome: 'success' | 'failure' | 'aborted';
|
|
70
|
+
status?: number;
|
|
71
|
+
kind?: ClassifierProviderError['kind'];
|
|
72
|
+
error?: string;
|
|
73
|
+
classifierUsage?: ClassifierAttemptUsage;
|
|
74
|
+
/** Physical request through response validation, excluding retry waits. */
|
|
75
|
+
durationMs?: number;
|
|
76
|
+
}) => void;
|
|
77
|
+
/** Opt-in node diagnostics, separate from privacy-bounded attempt events. */
|
|
78
|
+
onRequestBody?: (getBody: () => Record<string, unknown>) => void;
|
|
79
|
+
onResponseBody?: (body: unknown) => void;
|
|
36
80
|
apiKey: string;
|
|
37
81
|
model: string;
|
|
38
82
|
questions: readonly ClassifierQuestionDefinition[];
|
|
39
83
|
signal: AbortSignal;
|
|
40
84
|
state: string | Record<string, unknown> | unknown[];
|
|
85
|
+
stateMessages?: ClassifierStateMessage[];
|
|
86
|
+
/** Optional Rivet wrapper for the graph entry; ordinary provider calls use state/stateMessages. */
|
|
87
|
+
stateInput?: DataValue;
|
|
41
88
|
timeoutMs: number;
|
|
89
|
+
/** An earlier node deadline includes State normalization in the request budget. */
|
|
90
|
+
deadline?: number;
|
|
42
91
|
/** Opt-in retry policy for non-authentication, non-validation HTTP errors. */
|
|
43
92
|
retryOnNon200?: boolean;
|
|
44
93
|
retryOnNon200RepeatTimes?: number;
|
|
45
94
|
retryOnNon200CooldownMs?: number;
|
|
46
95
|
fetchImplementation?: typeof fetch;
|
|
47
96
|
};
|
|
97
|
+
export type PreparedClassifierEvaluation = {
|
|
98
|
+
model: string;
|
|
99
|
+
state: PreparedClassifierState;
|
|
100
|
+
questions: PreparedClassifierQuestion[];
|
|
101
|
+
};
|
|
102
|
+
type ClassifierProviderSpec = Omit<ClassifierProvider, 'evaluate' | 'evaluateInput'> & {
|
|
103
|
+
endpoint: string;
|
|
104
|
+
buildRequest(args: PreparedClassifierEvaluation): Record<string, unknown>;
|
|
105
|
+
validateResponse: typeof validateClassifierEvaluationResponse;
|
|
106
|
+
checkState?(state: PreparedClassifierState, check: () => void): void;
|
|
107
|
+
checkRequest?(request: PreparedClassifierEvaluation, check: () => void): void;
|
|
108
|
+
};
|
|
48
109
|
export type ApiCompatibleClassifierProviderConfig = {
|
|
49
110
|
id: string;
|
|
50
111
|
label: string;
|
|
@@ -53,8 +114,13 @@ export type ApiCompatibleClassifierProviderConfig = {
|
|
|
53
114
|
/** Static, provider-owned endpoint. It must never come from graph data. */
|
|
54
115
|
endpoint: string;
|
|
55
116
|
browserExecutionSupported?: boolean;
|
|
56
|
-
/** Static USD token pricing
|
|
117
|
+
/** Static USD token pricing for Cost and optional Usage accounting. */
|
|
57
118
|
pricing?: ClassifierTokenPricing;
|
|
119
|
+
modelPricing?: readonly ClassifierModelPricing[];
|
|
120
|
+
supportsImages?: (model: string) => boolean;
|
|
121
|
+
maxRequestBytes?: number;
|
|
122
|
+
/** Provider-owned evidence checks, independent of the descriptor's ID. */
|
|
123
|
+
checkState?: ClassifierProviderSpec['checkState'];
|
|
58
124
|
};
|
|
59
125
|
/**
|
|
60
126
|
* Builds a provider for the shared System One-compatible protocol. Provider
|
|
@@ -63,16 +129,39 @@ export type ApiCompatibleClassifierProviderConfig = {
|
|
|
63
129
|
*/
|
|
64
130
|
export declare function createApiCompatibleClassifierProvider(config: ApiCompatibleClassifierProviderConfig): ClassifierProvider;
|
|
65
131
|
export declare const jevClassifierProvider: ClassifierProvider;
|
|
66
|
-
|
|
132
|
+
export declare const liquidClassifierProvider: ClassifierProvider;
|
|
133
|
+
/** Native Decisions API, not chat completions. Microsoft Decision-1 is text-only.
|
|
134
|
+
* https://openrouter.ai/microsoft/microsoft-decision-1
|
|
135
|
+
*/
|
|
136
|
+
export declare const openrouterClassifierProvider: ClassifierProvider;
|
|
137
|
+
/** Decisions-specific rates, not GPT-6 Luna's Chat/Responses cache/output rates.
|
|
138
|
+
* https://developers.openai.com/api/docs/guides/decisions#pricing-and-availability
|
|
139
|
+
*/
|
|
140
|
+
export declare const openaiClassifierProvider: ClassifierProvider;
|
|
141
|
+
/** https://docs.perplexity.ai/docs/decisions/quickstart */
|
|
142
|
+
export declare const perplexityClassifierProvider: ClassifierProvider;
|
|
143
|
+
/** Ordered so adding compatible providers does not alter authored IDs. */
|
|
67
144
|
export declare const classifierProviders: readonly ClassifierProvider[];
|
|
145
|
+
export declare class ClassifierProviderError extends Error {
|
|
146
|
+
readonly kind: 'configuration' | 'capability' | 'timeout' | 'transport' | 'http' | 'response-parsing' | 'response-validation';
|
|
147
|
+
readonly statusCode?: number | undefined;
|
|
148
|
+
constructor(message: string, kind: 'configuration' | 'capability' | 'timeout' | 'transport' | 'http' | 'response-parsing' | 'response-validation', statusCode?: number | undefined, options?: ErrorOptions);
|
|
149
|
+
}
|
|
150
|
+
export declare function classifierFailureKind(kind: ClassifierProviderError['kind'], status?: number): ClassifierFailureKind;
|
|
151
|
+
/** Bounded preparation/provider explanation, without traversing causes or capturing response bodies. */
|
|
152
|
+
export declare function classifierErrorMessage(error: unknown, apiKey?: string): string;
|
|
68
153
|
export declare function getClassifierProvider(id: string | undefined): ClassifierProvider;
|
|
69
154
|
export declare function getClassifierProviderEnvironmentVariableNames(): string[];
|
|
70
155
|
/**
|
|
71
|
-
* Returns a USD cost only
|
|
72
|
-
* the token counts are safe non-negative integers.
|
|
73
|
-
*
|
|
156
|
+
* Returns a USD cost only for a recognized requested/returned model pair and
|
|
157
|
+
* the token counts are safe non-negative integers. Provider input_tokens already
|
|
158
|
+
* includes billed text/image work across questions; never multiply by question
|
|
159
|
+
* count or add image tokens again. Decisions has no separate cache charges.
|
|
160
|
+
* Callers must not treat an unpriced provider as free.
|
|
74
161
|
*/
|
|
75
|
-
export declare function calculateClassifierUsageCost(provider: Pick<ClassifierProvider, 'pricing'
|
|
162
|
+
export declare function calculateClassifierUsageCost(provider: Pick<ClassifierProvider, 'pricing' | 'modelPricing'> & Partial<Pick<ClassifierProvider, 'defaultModel'>>, usage: ClassifierEvaluationResponse['usage'], models?: {
|
|
163
|
+
requestedModel: string;
|
|
164
|
+
responseModel: string;
|
|
165
|
+
}): number | undefined;
|
|
76
166
|
export declare function normalizeClassifierNon200RetryCount(value: number | undefined): number;
|
|
77
167
|
export declare function normalizeClassifierNon200RetryCooldownMs(value: number | undefined): number;
|
|
78
|
-
export declare function validateApiCompatibleClassifierResponse(body: unknown, questions: readonly ClassifierQuestionDefinition[], providerLabel?: string): ClassifierEvaluationResponse;
|
|
@@ -2,6 +2,8 @@ import type { Inputs } from '../GraphProcessor.js';
|
|
|
2
2
|
import type { NodeInputDefinition } from '../NodeBase.js';
|
|
3
3
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
4
4
|
import type { ClassifierEntry, ClassifierEntryEditorType } from './types.js';
|
|
5
|
+
import type { ClassifierQuestionPreparation } from './preparation.js';
|
|
6
|
+
export { assertClassifierEntry, assertClassifierInstructions } from './json.js';
|
|
5
7
|
export type ClassifierQuestionBaseData = {
|
|
6
8
|
questionId: string;
|
|
7
9
|
instructions: string;
|
|
@@ -13,8 +15,8 @@ export type ClassifierQuestionBaseData = {
|
|
|
13
15
|
export declare function getInstructionsInputDefinition(): NodeInputDefinition;
|
|
14
16
|
export declare function getCriteriaInputDefinition(dataTypes: NodeInputDefinition['dataType']): NodeInputDefinition;
|
|
15
17
|
export declare function getInterpolationInputDefinitions(templates: readonly string[], reserved: ReadonlySet<string>): NodeInputDefinition[];
|
|
16
|
-
export declare function interpolateQuestionText(template: string, inputs: Inputs, context: InternalProcessContext): string;
|
|
17
|
-
export declare function resolveAuthoredClassifierEntry({ type, text, lines, objectTemplate, inputs, context, label, }: {
|
|
18
|
+
export declare function interpolateQuestionText(template: string, inputs: Inputs, context: InternalProcessContext, preparation?: ClassifierQuestionPreparation): string;
|
|
19
|
+
export declare function resolveAuthoredClassifierEntry({ type, text, lines, objectTemplate, inputs, context, label, preparation, }: {
|
|
18
20
|
type: ClassifierEntryEditorType | undefined;
|
|
19
21
|
text: string | undefined;
|
|
20
22
|
lines: readonly string[] | undefined;
|
|
@@ -22,10 +24,10 @@ export declare function resolveAuthoredClassifierEntry({ type, text, lines, obje
|
|
|
22
24
|
inputs: Inputs;
|
|
23
25
|
context: InternalProcessContext;
|
|
24
26
|
label: string;
|
|
27
|
+
preparation?: ClassifierQuestionPreparation;
|
|
25
28
|
}): Exclude<ClassifierEntry, null>;
|
|
29
|
+
export declare function getQuestionInputValue(inputs: Inputs, portId: string, label: string): unknown;
|
|
26
30
|
export declare function getStringInput(inputs: Inputs, portId: string, label: string): string;
|
|
27
31
|
export declare function requireQuestionId(questionId: string): string;
|
|
28
32
|
export declare function getStructuredInput(inputs: Inputs, portId: string, label: string): ClassifierEntry;
|
|
29
|
-
export declare function assertClassifierEntry(value: unknown, label: string): asserts value is ClassifierEntry;
|
|
30
|
-
export declare function assertClassifierInstructions(value: unknown, label?: string): asserts value is Exclude<ClassifierEntry, null>;
|
|
31
33
|
export declare function abbreviate(value: string, maximum?: number): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PreparedClassifierQuestion } from './types.js';
|
|
2
|
+
import type { ClassifierValueBudget } from './limits.js';
|
|
3
|
+
/** Shared by node execution and direct provider calls, before taking the request snapshot. */
|
|
4
|
+
export declare function prepareClassifierQuestion(value: unknown, budget: ClassifierValueBudget): PreparedClassifierQuestion;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ClassifierQuestionDefinition, PreparedClassifierQuestion, ClassifierEvaluationResponse } from './types.js';
|
|
2
|
+
export declare function validateApiCompatibleClassifierResponse(body: unknown, questions: readonly ClassifierQuestionDefinition[], providerLabel?: string): ClassifierEvaluationResponse;
|
|
3
|
+
/** Validate the common Rivet result, independently of the provider's wire protocol. */
|
|
4
|
+
export declare function validateClassifierEvaluationResponse(body: unknown, questions: readonly PreparedClassifierQuestion[], providerLabel?: string): ClassifierEvaluationResponse;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DataValue } from '../DataValue.js';
|
|
2
|
+
import { type PreparedClassifierImage } from './images.js';
|
|
3
|
+
import { ClassifierValueBudget, type ClassifierPreparationCheck } from './limits.js';
|
|
4
|
+
export type ClassifierStatePart = {
|
|
5
|
+
type: 'text';
|
|
6
|
+
text: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'image';
|
|
9
|
+
dataUrl: string;
|
|
10
|
+
};
|
|
11
|
+
export type ClassifierStateMessage = {
|
|
12
|
+
parts: ClassifierStatePart[];
|
|
13
|
+
};
|
|
14
|
+
/** Compatibility input/output used by direct provider callers and normalization helpers. */
|
|
15
|
+
export type ClassifierState = {
|
|
16
|
+
state: string | Record<string, unknown> | unknown[];
|
|
17
|
+
stateMessages?: ClassifierStateMessage[];
|
|
18
|
+
};
|
|
19
|
+
export type PreparedClassifierState = {
|
|
20
|
+
kind: 'json';
|
|
21
|
+
value: ClassifierState['state'];
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'messages';
|
|
24
|
+
messages: ClassifierStateMessage[];
|
|
25
|
+
images: PreparedClassifierImage[];
|
|
26
|
+
};
|
|
27
|
+
/** Graph and direct provider calls converge here; no caller can bypass preparation. */
|
|
28
|
+
export declare function prepareClassifierState(input: ClassifierState & {
|
|
29
|
+
stateInput?: DataValue;
|
|
30
|
+
}, budget: ClassifierValueBudget): PreparedClassifierState;
|
|
31
|
+
/** Standalone compatibility helper uses the same preparation, not a separate validator. */
|
|
32
|
+
export declare function normalizeClassifierState(input: DataValue | undefined, check?: ClassifierPreparationCheck, maxBytes?: number): ClassifierState;
|
|
33
|
+
/** System One separates images; numbered placeholders retain caption/image associations. */
|
|
34
|
+
export declare function systemOneState(input: ClassifierState): {
|
|
35
|
+
state: ClassifierState['state'];
|
|
36
|
+
images?: string[];
|
|
37
|
+
};
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
export type ClassifierQuestionType = 'choice' | 'score' | 'noul';
|
|
2
|
+
/** Secret-free classification used by fallback diagnostics and recording traces. */
|
|
3
|
+
export declare const classifierFailureKinds: readonly ["configuration", "capability", "authentication", "transport", "http", "timeout", "response-parsing", "response-validation"];
|
|
4
|
+
export type ClassifierFailureKind = (typeof classifierFailureKinds)[number];
|
|
5
|
+
/** Safe provider-reported receipt accounting; absent usage/cost is unknown, not zero. */
|
|
6
|
+
export type ClassifierAttemptUsage = {
|
|
7
|
+
inputTokens: number;
|
|
8
|
+
outputTokens: number;
|
|
9
|
+
estimatedCostUsd?: number;
|
|
10
|
+
};
|
|
2
11
|
export type ClassifierEntryEditorType = 'text' | 'lines' | 'object';
|
|
3
12
|
export type ClassifierStructuredValue = string | number | boolean | null | {
|
|
4
13
|
[key: string]: ClassifierStructuredValue;
|
|
@@ -48,6 +57,8 @@ export type ClassifierNoulQuestionDefinition = ClassifierQuestionDefinition & {
|
|
|
48
57
|
false: ClassifierEntry;
|
|
49
58
|
};
|
|
50
59
|
};
|
|
60
|
+
/** Internal contract after the untrusted public definition has been validated. */
|
|
61
|
+
export type PreparedClassifierQuestion = ClassifierChoiceQuestionDefinition | ClassifierScoreQuestionDefinition | ClassifierNoulQuestionDefinition;
|
|
51
62
|
export type ClassifierEvaluationResponse = {
|
|
52
63
|
model: string;
|
|
53
64
|
answers: Record<string, unknown>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Outputs } from './GraphProcessor.js';
|
|
2
|
+
import type { NodeOutputDefinition } from './NodeBase.js';
|
|
3
|
+
export type NodeRunFailureSettings = {
|
|
4
|
+
/** Missing on legacy nodes preserves their existing throw behavior. */
|
|
5
|
+
errorOnNon200?: boolean;
|
|
6
|
+
catchRequestFailed?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function hasRunFailureOutputs(data: NodeRunFailureSettings): boolean;
|
|
9
|
+
export declare function getRunFailureOutputDefinitions(data: NodeRunFailureSettings): NodeOutputDefinition[];
|
|
10
|
+
export declare function shouldCatchRunFailure(data: NodeRunFailureSettings, error: unknown, signal: AbortSignal): boolean;
|
|
11
|
+
export declare function withRunSuccessOutputs(data: NodeRunFailureSettings, outputs: Outputs): Outputs;
|
|
12
|
+
/** Never route a partial model answer or fabricated usage through the success branch. */
|
|
13
|
+
export declare function createCaughtRunFailureOutputs(definitions: readonly NodeOutputDefinition[], error: unknown, evidence?: Outputs): Outputs;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
2
|
+
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
3
|
+
import type { ChartNode, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
4
|
+
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
5
|
+
export declare const MAX_CAUGHT_STREAMING_CHUNKS = 1024;
|
|
6
|
+
export type CatchStreamingChunksNodeData = {
|
|
7
|
+
count: number;
|
|
8
|
+
};
|
|
9
|
+
export type CatchStreamingChunksNode = ChartNode<'catchStreamingChunks', CatchStreamingChunksNodeData>;
|
|
10
|
+
/** The processor owns this node's early, once-only output. */
|
|
11
|
+
export declare class CatchStreamingChunksNodeImpl extends NodeImpl<CatchStreamingChunksNode> {
|
|
12
|
+
static create(): CatchStreamingChunksNode;
|
|
13
|
+
getInputDefinitions(): NodeInputDefinition[];
|
|
14
|
+
getOutputDefinitions(): NodeOutputDefinition[];
|
|
15
|
+
static getUIData(): NodeUIData;
|
|
16
|
+
getEditors(): EditorDefinition<CatchStreamingChunksNode>[];
|
|
17
|
+
getBody(): string;
|
|
18
|
+
process(inputs: Inputs): Promise<Outputs>;
|
|
19
|
+
}
|
|
20
|
+
export declare const catchStreamingChunksNode: import("../NodeDefinition.js").NodeDefinition<CatchStreamingChunksNode>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
1
|
+
import type { EditorDefinition, EditorDefinitionGroup } from '../EditorDefinition.js';
|
|
2
2
|
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
3
3
|
import type { NodeBodySpec } from '../NodeBodySpec.js';
|
|
4
4
|
import type { ChartNode, NodeConnection, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
5
|
-
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
5
|
+
import { NodeImpl, type NodeRunActivityDescriptor, type NodeUIData } from '../NodeImpl.js';
|
|
6
6
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
7
|
-
import { type
|
|
8
|
-
export type ClassifierEvaluateNodeData = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import { type ClassifierProfileConfiguration } from '../classifier/profile.js';
|
|
8
|
+
export type ClassifierEvaluateNodeData = ClassifierProfileConfiguration & {
|
|
9
|
+
configurationMode?: 'inline' | 'profile';
|
|
10
|
+
outputClassifierAttempts?: boolean;
|
|
11
|
+
outputClassifierProfileSummary?: boolean;
|
|
12
|
+
profileChainTimeoutMs?: number;
|
|
13
13
|
/** Adds the exact JSON body sent to the provider, excluding its auth header. */
|
|
14
14
|
outputRequestBody?: boolean;
|
|
15
15
|
/** Adds the complete parsed JSON body returned by the provider. */
|
|
@@ -17,13 +17,11 @@ export type ClassifierEvaluateNodeData = {
|
|
|
17
17
|
/** Adds calculated provider cost details to the existing Usage output. */
|
|
18
18
|
outputUsage?: boolean;
|
|
19
19
|
retryOnNon200?: boolean;
|
|
20
|
+
errorOnNon200?: boolean;
|
|
21
|
+
catchRequestFailed?: boolean;
|
|
20
22
|
retryOnNon200RepeatTimes?: number;
|
|
21
23
|
retryOnNon200CooldownMs?: number;
|
|
22
24
|
timeoutMs?: number;
|
|
23
|
-
apiKeySource?: ClassifierApiKeySource;
|
|
24
|
-
apiKeyNamesByProvider?: Record<string, ClassifierCredentialNames | undefined>;
|
|
25
|
-
/** @deprecated Migrated into apiKeyNamesByProvider. */
|
|
26
|
-
apiKeyNames?: ClassifierCredentialNames;
|
|
27
25
|
};
|
|
28
26
|
export type ClassifierEvaluateNode = ChartNode<'classifierEvaluate', ClassifierEvaluateNodeData>;
|
|
29
27
|
export type ClassifierEvaluateBodySection = Readonly<{
|
|
@@ -34,6 +32,7 @@ export type ClassifierEvaluateBodySection = Readonly<{
|
|
|
34
32
|
}>[];
|
|
35
33
|
}>;
|
|
36
34
|
export declare class ClassifierEvaluateNodeImpl extends NodeImpl<ClassifierEvaluateNode> {
|
|
35
|
+
getRunActivityDescriptor(): NodeRunActivityDescriptor;
|
|
37
36
|
static create(): ClassifierEvaluateNode;
|
|
38
37
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
39
38
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
@@ -41,7 +40,13 @@ export declare class ClassifierEvaluateNodeImpl extends NodeImpl<ClassifierEvalu
|
|
|
41
40
|
getBody(): NodeBodySpec;
|
|
42
41
|
static getUIData(): NodeUIData;
|
|
43
42
|
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
43
|
+
private processRun;
|
|
44
|
+
private projectResult;
|
|
45
|
+
private profileEvidence;
|
|
46
|
+
private processProfiles;
|
|
44
47
|
}
|
|
48
|
+
/** Shared settings definition; constructing an unrelated node is unnecessary. */
|
|
49
|
+
export declare function getClassifierModelEditor(data: ClassifierProfileConfiguration): EditorDefinitionGroup<ClassifierEvaluateNode>;
|
|
45
50
|
/** Shared presentation model for the app's Classifier Evaluate card. */
|
|
46
51
|
export declare function getClassifierEvaluateBodySections(data: ClassifierEvaluateNodeData): readonly ClassifierEvaluateBodySection[];
|
|
47
52
|
export declare const classifierEvaluateNode: import("../NodeDefinition.js").NodeDefinition<ClassifierEvaluateNode>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ChartNode, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
2
|
+
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
3
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
4
|
+
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
5
|
+
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
6
|
+
import { type ClassifierProfileConfiguration } from '../classifier/profile.js';
|
|
7
|
+
export type ClassifierProfileNode = ChartNode<'classifierProfile', ClassifierProfileConfiguration>;
|
|
8
|
+
export declare class ClassifierProfileNodeImpl extends NodeImpl<ClassifierProfileNode> {
|
|
9
|
+
static create(): ClassifierProfileNode;
|
|
10
|
+
getInputDefinitions(): NodeInputDefinition[];
|
|
11
|
+
getOutputDefinitions(): NodeOutputDefinition[];
|
|
12
|
+
getEditors(): EditorDefinition<ClassifierProfileNode>[];
|
|
13
|
+
getBody(): {
|
|
14
|
+
type: "markdown";
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
static getUIData(): NodeUIData;
|
|
18
|
+
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
19
|
+
}
|
|
20
|
+
export declare const classifierProfileNode: import("../NodeDefinition.js").NodeDefinition<ClassifierProfileNode>;
|
|
@@ -9,6 +9,13 @@ export type GetGlobalNodeData = {
|
|
|
9
9
|
id: string;
|
|
10
10
|
useIdInput: boolean;
|
|
11
11
|
dataType: ScalarOrArrayDataType;
|
|
12
|
+
/** Editor-only explanation of a type copied from a known variable declaration. */
|
|
13
|
+
typeSuggestion?: {
|
|
14
|
+
id: string;
|
|
15
|
+
type: ScalarOrArrayDataType;
|
|
16
|
+
source: string;
|
|
17
|
+
conflictingTypes: ScalarOrArrayDataType[];
|
|
18
|
+
};
|
|
12
19
|
/**
|
|
13
20
|
* Returns a fn<value> instead of a value, so that the variable is read when nodes need it, rather than when this node executes.
|
|
14
21
|
* The only time you wouldn't want this is to read a global at the start of a subgraph.
|
|
@@ -3,8 +3,12 @@ import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
|
3
3
|
import { type DataRef, type EditorDefinition, type Inputs, type InternalProcessContext, type Outputs } from '../../index.js';
|
|
4
4
|
export type ImageNode = ChartNode<'image', ImageNodeData>;
|
|
5
5
|
type ImageNodeData = {
|
|
6
|
+
/** Missing on older projects; treat it as binary for compatibility. */
|
|
7
|
+
sourceType?: 'binary' | 'base64';
|
|
6
8
|
data?: DataRef;
|
|
7
9
|
useDataInput: boolean;
|
|
10
|
+
base64?: string;
|
|
11
|
+
useBase64Input?: boolean;
|
|
8
12
|
mediaType: 'image/png' | 'image/jpeg' | 'image/gif';
|
|
9
13
|
useMediaTypeInput: boolean;
|
|
10
14
|
};
|
|
@@ -18,5 +18,6 @@ export declare class LLMChatV2NodeImpl extends NodeImpl<LLMChatV2Node> {
|
|
|
18
18
|
getEditors(context: RivetUIContext): Promise<EditorDefinition<LLMChatV2Node>[]>;
|
|
19
19
|
getBody(): NodeBodySpec;
|
|
20
20
|
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
21
|
+
private processRun;
|
|
21
22
|
}
|
|
22
23
|
export declare const llmChatV2Node: import("../NodeDefinition.js").NodeDefinition<LLMChatV2Node>;
|
|
@@ -3,6 +3,7 @@ import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
|
3
3
|
import { type DataValue } from '../DataValue.js';
|
|
4
4
|
import { type EditorDefinition } from '../EditorDefinition.js';
|
|
5
5
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
6
|
+
import { type InterpolationGuard } from '../../utils/interpolation.js';
|
|
6
7
|
export type ObjectNode = ChartNode<'object', ObjectNodeData>;
|
|
7
8
|
export type ObjectNodeData = {
|
|
8
9
|
jsonTemplate: string;
|
|
@@ -11,7 +12,7 @@ export type ObjectNodeData = {
|
|
|
11
12
|
* Interpolates a JSON template without parsing it. Shared by Object and other
|
|
12
13
|
* first-party nodes which author structured EntryType values.
|
|
13
14
|
*/
|
|
14
|
-
export declare function interpolateJsonTemplate(baseString: string, values: Record<string, unknown>, graphInputNodeValues?: Record<string, DataValue>, contextValues?: Record<string, DataValue>, globalValues?: Record<string, unknown
|
|
15
|
+
export declare function interpolateJsonTemplate(baseString: string, values: Record<string, unknown>, graphInputNodeValues?: Record<string, DataValue>, contextValues?: Record<string, DataValue>, globalValues?: Record<string, unknown>, guard?: InterpolationGuard, unwrapVariableDataValues?: boolean): string;
|
|
15
16
|
export declare class ObjectNodeImpl extends NodeImpl<ObjectNode> {
|
|
16
17
|
static create(): ObjectNode;
|
|
17
18
|
getInputDefinitions(): NodeInputDefinition[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
2
|
+
import type { ChartNode, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
3
|
+
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
4
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
5
|
+
export type StreamValueNode = ChartNode<'streamValue', Record<string, never>>;
|
|
6
|
+
/** Emits one partial snapshot without changing the ordinary final value. */
|
|
7
|
+
export declare class StreamValueNodeImpl extends NodeImpl<StreamValueNode> {
|
|
8
|
+
static create(): StreamValueNode;
|
|
9
|
+
getInputDefinitions(): NodeInputDefinition[];
|
|
10
|
+
getOutputDefinitions(): NodeOutputDefinition[];
|
|
11
|
+
static getUIData(): NodeUIData;
|
|
12
|
+
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
13
|
+
}
|
|
14
|
+
export declare const streamValueNode: import("../NodeDefinition.js").NodeDefinition<StreamValueNode>;
|
|
@@ -6,11 +6,20 @@ import { type Project, type ProjectId } from '../Project.js';
|
|
|
6
6
|
import { type DataValue } from '../DataValue.js';
|
|
7
7
|
import { type InternalProcessContext } from '../ProcessContext.js';
|
|
8
8
|
import { type EditorDefinition } from '../../index.js';
|
|
9
|
+
import { type SubgraphProjectVersion } from '../SubgraphProjectTarget.js';
|
|
9
10
|
import type { RivetUIContext } from '../RivetUIContext.js';
|
|
11
|
+
import { type GraphBoundary } from '../GraphBoundaryCache.js';
|
|
10
12
|
export type SubGraphNode = ChartNode & {
|
|
11
13
|
type: 'subGraph';
|
|
12
14
|
data: {
|
|
13
15
|
graphId: GraphId;
|
|
16
|
+
/** Saved project target resolved by a host or portable bundle loader. Absent means the current project. */
|
|
17
|
+
targetProjectId?: ProjectId;
|
|
18
|
+
/** Retains the hosted picker mode before an external project is selected. */
|
|
19
|
+
targetScope?: 'other-projects';
|
|
20
|
+
targetVersion?: SubgraphProjectVersion;
|
|
21
|
+
/** Last selected boundary keeps existing wires visible while a hosted preview reloads. */
|
|
22
|
+
targetBoundary?: GraphBoundary;
|
|
14
23
|
useErrorOutput?: boolean;
|
|
15
24
|
useAsGraphPartialOutput?: boolean;
|
|
16
25
|
/** Only execute child branches needed by actively connected output ports. */
|
|
@@ -21,12 +30,22 @@ export type SubGraphNode = ChartNode & {
|
|
|
21
30
|
outputPortOrder?: string[];
|
|
22
31
|
};
|
|
23
32
|
};
|
|
33
|
+
/** A saved cross-project boundary is the wire contract until the user explicitly selects a new target. */
|
|
34
|
+
export declare function getSubgraphTargetBoundaryChange(expected: GraphBoundary | undefined, actual: GraphBoundary): {
|
|
35
|
+
side: 'input' | 'output';
|
|
36
|
+
id: string;
|
|
37
|
+
} | null;
|
|
38
|
+
/** Keep the caller's saved wire IDs while adopting current target names and metadata. */
|
|
39
|
+
export declare function reconcileSubgraphTargetBoundary(expected: GraphBoundary | undefined, actual: GraphBoundary): GraphBoundary;
|
|
40
|
+
export declare function getSubgraphTargetBoundaryIssue(expected: GraphBoundary | undefined, actual: GraphBoundary): string | null;
|
|
24
41
|
export declare class SubGraphNodeImpl extends NodeImpl<SubGraphNode> {
|
|
25
42
|
static create(): SubGraphNode;
|
|
26
|
-
getInputDefinitions(_connections: NodeConnection[], _nodes: Record<NodeId, ChartNode>, project: Project,
|
|
43
|
+
getInputDefinitions(_connections: NodeConnection[], _nodes: Record<NodeId, ChartNode>, project: Project, referencedProjects: Record<ProjectId, Project>, definitionContext?: NodeDefinitionContext): NodeInputDefinition[];
|
|
27
44
|
getGraphOutputs(project: Project, definitionContext?: NodeDefinitionContext): NodeOutputDefinition[];
|
|
28
|
-
getOutputDefinitions(_connections: NodeConnection[], _nodes: Record<NodeId, ChartNode>, project: Project,
|
|
45
|
+
getOutputDefinitions(_connections: NodeConnection[], _nodes: Record<NodeId, ChartNode>, project: Project, referencedProjects: Record<ProjectId, Project>, definitionContext?: NodeDefinitionContext): NodeOutputDefinition[];
|
|
29
46
|
private getBoundary;
|
|
47
|
+
private getTargetProject;
|
|
48
|
+
private getTargetBoundary;
|
|
30
49
|
getEditors(context: RivetUIContext): EditorDefinition<SubGraphNode>[];
|
|
31
50
|
static getUIData(): NodeUIData;
|
|
32
51
|
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChartNode, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
2
|
+
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
3
|
+
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
4
|
+
export type ToBase64Node = ChartNode<'toBase64', Record<string, never>>;
|
|
5
|
+
export declare class ToBase64NodeImpl extends NodeImpl<ToBase64Node> {
|
|
6
|
+
static create(): ToBase64Node;
|
|
7
|
+
getInputDefinitions(): NodeInputDefinition[];
|
|
8
|
+
getOutputDefinitions(): NodeOutputDefinition[];
|
|
9
|
+
static getUIData(): NodeUIData;
|
|
10
|
+
process(inputs: Inputs): Promise<Outputs>;
|
|
11
|
+
}
|
|
12
|
+
export declare const toBase64Node: import("../NodeDefinition.js").NodeDefinition<ToBase64Node>;
|
|
@@ -2,6 +2,7 @@ import type { ChatMessage } from '../DataValue.js';
|
|
|
2
2
|
import type { GraphId } from '../NodeGraph.js';
|
|
3
3
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
4
4
|
import type { Outputs } from '../GraphProcessor.js';
|
|
5
|
+
import { type GraphCostBreakdown } from '../GraphBoundaryEffects.js';
|
|
5
6
|
import { normalizeToolCall } from '../chat-v2/toolCallCodec.js';
|
|
6
7
|
import { findAutoDelegateGraphCandidate } from '../chat-v2/toolHandlerResolver.js';
|
|
7
8
|
export type ToolCallDelegationConfig = {
|
|
@@ -20,6 +21,7 @@ export type ToolCallDelegationResult = {
|
|
|
20
21
|
record: DelegatedToolCallRecord;
|
|
21
22
|
/** Cost from this live delegation. Kept out of the replay record so replay cannot charge it again. */
|
|
22
23
|
cost?: number;
|
|
24
|
+
costBreakdown?: GraphCostBreakdown;
|
|
23
25
|
/** Internal trace disposition; never exposed through node ports. */
|
|
24
26
|
traceOutcome?: 'success' | 'passthrough-error';
|
|
25
27
|
};
|
|
@@ -43,7 +45,7 @@ export type DelegatedToolCallRecord = {
|
|
|
43
45
|
*/
|
|
44
46
|
export { findAutoDelegateGraphCandidate };
|
|
45
47
|
export declare function isDelegatedToolCallRecord(input: unknown): input is DelegatedToolCallRecord;
|
|
46
|
-
export declare function buildDelegatedToolCallOutputs(records: DelegatedToolCallRecord[], preToolMessage?: string, cost?: number): Outputs;
|
|
48
|
+
export declare function buildDelegatedToolCallOutputs(records: DelegatedToolCallRecord[], preToolMessage?: string, cost?: number, costBreakdown?: GraphCostBreakdown): Outputs;
|
|
47
49
|
/** @deprecated Use normalizeToolCall from the canonical chat-v2 codec. */
|
|
48
50
|
export declare const normalizeFunctionCallInput: typeof normalizeToolCall;
|
|
49
51
|
export declare function delegateToolCall(rawFunctionCall: unknown, context: InternalProcessContext, config: ToolCallDelegationConfig): Promise<ToolCallDelegationResult>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Shared inspector wording for LLM and Classifier profile suspension. */
|
|
2
|
+
export declare const profileSuspensionHints: {
|
|
3
|
+
readonly host: "Requires Studio Server or a host with shared profile health. Not available in standalone Rivet.";
|
|
4
|
+
readonly enable: "Suspend this profile after provider failures or timeouts. After suspension, allow one recovery attempt.";
|
|
5
|
+
readonly threshold: "Failures or timeouts within the failure window needed to suspend this profile.";
|
|
6
|
+
readonly window: "Rolling period for counting failures and timeouts.";
|
|
7
|
+
readonly duration: "Time to suspend this profile before one recovery attempt.";
|
|
8
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type GraphProcessor, type RecordedEvents, type Recording, type RecordingId } from '../index.js';
|
|
1
|
+
import { type GraphProcessor, type ProcessEvents, type RecordedEvents, type Recording, type RecordingId } from '../index.js';
|
|
2
2
|
import Emittery from 'emittery';
|
|
3
3
|
export type ExecutionRecorderEvents = {
|
|
4
4
|
finish: {
|
|
@@ -28,7 +28,13 @@ export declare class ExecutionRecorder {
|
|
|
28
28
|
off: Emittery<ExecutionRecorderEvents>['off'];
|
|
29
29
|
once: Emittery<ExecutionRecorderEvents>['once'];
|
|
30
30
|
recordSocket(channel: WebSocket, options?: SocketRecordingOptions): Promise<void>;
|
|
31
|
-
record(processor: GraphProcessor):
|
|
31
|
+
record(processor: GraphProcessor): (terminal?: {
|
|
32
|
+
type: 'done';
|
|
33
|
+
results: ProcessEvents['done']['results'];
|
|
34
|
+
} | {
|
|
35
|
+
type: 'error';
|
|
36
|
+
error: ProcessEvents['error']['error'];
|
|
37
|
+
}) => void;
|
|
32
38
|
getRecording(): Recording;
|
|
33
39
|
get events(): RecordedEvents[];
|
|
34
40
|
static deserializeFromString(serialized: string): ExecutionRecorder;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Lightweight entry point for file preparation without model/provider runtime initialization. */
|
|
2
|
+
export { deserializeProject, deserializeGraph, deserializeDatasets, serializeProject, serializeGraph, serializeDatasets, type CombinedDataset, } from './utils/serialization/serialization.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function uint8ArrayToBase64(uint8Array: Uint8Array): Promise<string
|
|
1
|
+
export declare function uint8ArrayToBase64(uint8Array: Uint8Array): Promise<string>;
|
|
2
2
|
export declare function uint8ArrayToBase64Sync(uint8Array: Uint8Array): string;
|
|
3
3
|
export declare function base64ToUint8Array(base64: string): Uint8Array<ArrayBuffer>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
/** Gets an Error from an unknown error object (strict unknown errors is enabled, helper util). */
|
|
2
2
|
export declare function getError(error: unknown): Error;
|
|
3
|
+
/** Full failure text for graph error outputs, including nested causes. */
|
|
4
|
+
export declare function formatCaughtRunError(error: unknown, seen?: Set<unknown>): string;
|
|
5
|
+
/** Caller cancellation wins over provider failure, including cross-realm errors. */
|
|
6
|
+
export declare function isAbortError(error: unknown, signal: AbortSignal): boolean;
|