@valerypopoff/rivet2-core 2.22.1 → 2.25.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 +1438 -824
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/interpolationRuntime.cjs +23 -0
- package/dist/cjs/interpolationRuntime.cjs.map +3 -3
- package/dist/cjs/serialization.cjs +1 -0
- package/dist/cjs/serialization.cjs.map +2 -2
- package/dist/cjs/webAppRuntime.cjs +4 -1
- package/dist/cjs/webAppRuntime.cjs.map +2 -2
- package/dist/esm/exports.js +3 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/integrations/CodeRunner.js +6 -3
- package/dist/esm/integrations/CodeRunnerNamespace.js +10 -0
- package/dist/esm/model/AgentResponseTracePresentation.js +5 -1
- package/dist/esm/model/ChildInvocationOwnership.js +51 -0
- package/dist/esm/model/DatasetOwnership.js +9 -0
- package/dist/esm/model/GraphExecutionState.js +3 -0
- package/dist/esm/model/GraphProcessor.js +94 -55
- package/dist/esm/model/NodeRegistration.js +2 -6
- package/dist/esm/model/RunCostLedger.js +58 -0
- package/dist/esm/model/chat-v2/chatV2CallObserver.js +2 -2
- package/dist/esm/model/chat-v2/chatV2Outputs.js +1 -1
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +5 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +3 -0
- package/dist/esm/model/chat-v2/llmModelCandidate.js +3 -0
- package/dist/esm/model/chat-v2/llmProfile.js +2 -0
- package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +1 -0
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +2 -1
- package/dist/esm/model/chat-v2/modelRegistry.js +12 -3
- package/dist/esm/model/classifier/baseten.js +78 -0
- package/dist/esm/model/classifier/credentials.js +17 -9
- package/dist/esm/model/classifier/images.js +4 -4
- package/dist/esm/model/classifier/jev.js +45 -0
- package/dist/esm/model/classifier/json.js +1 -1
- package/dist/esm/model/classifier/limits.js +13 -13
- package/dist/esm/model/classifier/openai.js +20 -2
- package/dist/esm/model/classifier/preparation.js +5 -5
- package/dist/esm/model/classifier/profile.js +24 -15
- package/dist/esm/model/classifier/profileExecution.js +28 -24
- package/dist/esm/model/classifier/providers.js +194 -87
- package/dist/esm/model/classifier/questionHelpers.js +21 -2
- package/dist/esm/model/classifier/questions.js +37 -7
- package/dist/esm/model/classifier/response.js +8 -2
- package/dist/esm/model/classifier/state.js +2 -2
- package/dist/esm/model/classifier/subq.js +51 -0
- package/dist/esm/model/nodes/ClassifierEvaluateNode.js +48 -66
- package/dist/esm/model/nodes/ClassifierProfileNode.js +11 -9
- package/dist/esm/model/nodes/ClassifierQuestionNode.js +53 -34
- package/dist/esm/model/tokenPricing.js +52 -0
- package/dist/esm/model/tokenPricingEditor.js +9 -0
- package/dist/types/exports.d.ts +3 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/integrations/CodeRunner.d.ts +4 -1
- package/dist/types/integrations/CodeRunnerNamespace.d.ts +5 -0
- package/dist/types/model/AgentResponseTracePresentation.d.ts +2 -0
- package/dist/types/model/ChildInvocationOwnership.d.ts +36 -0
- package/dist/types/model/DatasetOwnership.d.ts +5 -0
- package/dist/types/model/GraphExecutionState.d.ts +2 -0
- package/dist/types/model/GraphProcessor.d.ts +3 -0
- package/dist/types/model/RunCostLedger.d.ts +19 -0
- package/dist/types/model/chat-v2/chatV2Outputs.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2Types.d.ts +2 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +3 -1
- package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +7 -5
- package/dist/types/model/chat-v2/modelRegistry.d.ts +7 -1
- package/dist/types/model/classifier/baseten.d.ts +8 -0
- package/dist/types/model/classifier/credentials.d.ts +2 -0
- package/dist/types/model/classifier/jev.d.ts +9 -0
- package/dist/types/model/classifier/profile.d.ts +3 -1
- package/dist/types/model/classifier/profileExecution.d.ts +2 -1
- package/dist/types/model/classifier/providers.d.ts +30 -6
- package/dist/types/model/classifier/questionHelpers.d.ts +3 -1
- package/dist/types/model/classifier/questions.d.ts +2 -1
- package/dist/types/model/classifier/state.d.ts +1 -0
- package/dist/types/model/classifier/subq.d.ts +8 -0
- package/dist/types/model/classifier/types.d.ts +9 -2
- package/dist/types/model/nodes/ClassifierEvaluateNode.d.ts +2 -4
- package/dist/types/model/nodes/ClassifierQuestionNode.d.ts +2 -2
- package/dist/types/model/tokenPricing.d.ts +18 -0
- package/dist/types/model/tokenPricingEditor.d.ts +4 -0
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ export declare function runClassifierProfiles(input: {
|
|
|
18
18
|
questions: ClassifierQuestionDefinition[];
|
|
19
19
|
context: InternalProcessContext;
|
|
20
20
|
nodeId: NodeId;
|
|
21
|
-
deadline
|
|
21
|
+
deadline?: number;
|
|
22
22
|
retryOnNon200?: boolean;
|
|
23
23
|
retryOnNon200RepeatTimes?: number;
|
|
24
24
|
retryOnNon200CooldownMs?: number;
|
|
@@ -29,4 +29,5 @@ export declare function runClassifierProfiles(input: {
|
|
|
29
29
|
result: ClassifierProviderEvaluationResult;
|
|
30
30
|
provider: ReturnType<typeof getClassifierProvider>;
|
|
31
31
|
model: string;
|
|
32
|
+
tokenPricing?: ClassifierProviderEvaluateArgs['tokenPricing'];
|
|
32
33
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ClassifierCredentialNames } from './credentials.js';
|
|
2
|
+
import { type TokenPricing } from '../tokenPricing.js';
|
|
2
3
|
import type { DataValue } from '../DataValue.js';
|
|
3
4
|
import { type ClassifierStateMessage, type PreparedClassifierState } from './state.js';
|
|
4
5
|
import { validateClassifierEvaluationResponse } from './response.js';
|
|
@@ -9,14 +10,16 @@ export declare const LIQUID_SYSTEM_ONE_ENDPOINT = "https://api.liquid.ai/decisio
|
|
|
9
10
|
export declare const OPENAI_DECISIONS_ENDPOINT = "https://api.openai.com/v1/decisions";
|
|
10
11
|
export declare const OPENROUTER_DECISIONS_ENDPOINT = "https://openrouter.ai/api/alpha/decisions";
|
|
11
12
|
export declare const PERPLEXITY_DECISIONS_ENDPOINT = "https://api.perplexity.ai/v1/decisions";
|
|
12
|
-
|
|
13
|
+
export declare const SUBQ_DECISIONS_ENDPOINT = "https://api.subq.ai/v1/systemone";
|
|
14
|
+
export declare const BASETEN_DECISIONS_ENDPOINT = "https://inference.baseten.co/v1/systemone";
|
|
15
|
+
/** Jev 1.13/1.14 USD rates, verified 2026-10-24: https://docs.typesafe.ai/models */
|
|
13
16
|
export declare const JEV_TOKEN_PRICING: {
|
|
14
17
|
readonly inputPerMillionTokens: 0.042;
|
|
15
18
|
readonly outputPerMillionTokens: 0;
|
|
16
19
|
};
|
|
17
|
-
/** Liquid d1
|
|
20
|
+
/** Liquid d1 USD rates, verified 2026-10-26: https://www.liquid.ai/pricing */
|
|
18
21
|
export declare const LIQUID_TOKEN_PRICING: {
|
|
19
|
-
readonly inputPerMillionTokens: 0.
|
|
22
|
+
readonly inputPerMillionTokens: 0.02;
|
|
20
23
|
readonly outputPerMillionTokens: 0;
|
|
21
24
|
};
|
|
22
25
|
export declare const DEFAULT_CLASSIFIER_RETRY_ON_NON_200_REPEAT_TIMES = 1;
|
|
@@ -25,9 +28,18 @@ export type ClassifierProvider = {
|
|
|
25
28
|
id: string;
|
|
26
29
|
label: string;
|
|
27
30
|
defaultModel: string;
|
|
31
|
+
/** Curated UI choices, not a runtime allowlist or a pricing/capability promise. */
|
|
32
|
+
modelOptions?: readonly {
|
|
33
|
+
value: string;
|
|
34
|
+
label: string;
|
|
35
|
+
}[];
|
|
36
|
+
/** Provider-owned model guidance shared by inline and Profile editors. */
|
|
37
|
+
modelHelp?: string;
|
|
28
38
|
credentialNames: ClassifierCredentialNames;
|
|
29
39
|
browserExecutionSupported: boolean;
|
|
30
40
|
supportsImages?: (model: string) => boolean;
|
|
41
|
+
supportsQuestionImages?: (model: string) => boolean;
|
|
42
|
+
supportsBoxQuestions?: (model: string) => boolean;
|
|
31
43
|
/** A stricter provider request limit also bounds preparation before encoding. */
|
|
32
44
|
maxRequestBytes?: number;
|
|
33
45
|
/** Legacy shorthand: pricing for defaultModel only, never arbitrary models. */
|
|
@@ -63,6 +75,7 @@ export type ClassifierProviderEvaluationResult = {
|
|
|
63
75
|
responseBody: Record<string, unknown>;
|
|
64
76
|
};
|
|
65
77
|
export type ClassifierProviderEvaluateArgs = {
|
|
78
|
+
tokenPricing?: TokenPricing;
|
|
66
79
|
/** Privacy-bounded physical-attempt observer; never includes bodies or credentials. */
|
|
67
80
|
onAttempt?: (attempt: {
|
|
68
81
|
attemptIndex: number;
|
|
@@ -85,8 +98,9 @@ export type ClassifierProviderEvaluateArgs = {
|
|
|
85
98
|
stateMessages?: ClassifierStateMessage[];
|
|
86
99
|
/** Optional Rivet wrapper for the graph entry; ordinary provider calls use state/stateMessages. */
|
|
87
100
|
stateInput?: DataValue;
|
|
88
|
-
|
|
89
|
-
|
|
101
|
+
/** Optional per-profile/request deadline; absent means caller cancellation only. */
|
|
102
|
+
timeoutMs?: number;
|
|
103
|
+
/** Optional absolute deadline for direct programmatic provider calls. */
|
|
90
104
|
deadline?: number;
|
|
91
105
|
/** Opt-in retry policy for non-authentication, non-validation HTTP errors. */
|
|
92
106
|
retryOnNon200?: boolean;
|
|
@@ -102,6 +116,7 @@ export type PreparedClassifierEvaluation = {
|
|
|
102
116
|
type ClassifierProviderSpec = Omit<ClassifierProvider, 'evaluate' | 'evaluateInput'> & {
|
|
103
117
|
endpoint: string;
|
|
104
118
|
buildRequest(args: PreparedClassifierEvaluation): Record<string, unknown>;
|
|
119
|
+
requestHeaders?(args: PreparedClassifierEvaluation): Record<string, string>;
|
|
105
120
|
validateResponse: typeof validateClassifierEvaluationResponse;
|
|
106
121
|
checkState?(state: PreparedClassifierState, check: () => void): void;
|
|
107
122
|
checkRequest?(request: PreparedClassifierEvaluation, check: () => void): void;
|
|
@@ -110,6 +125,8 @@ export type ApiCompatibleClassifierProviderConfig = {
|
|
|
110
125
|
id: string;
|
|
111
126
|
label: string;
|
|
112
127
|
defaultModel: string;
|
|
128
|
+
modelOptions?: ClassifierProvider['modelOptions'];
|
|
129
|
+
modelHelp?: string;
|
|
113
130
|
credentialNames: ClassifierCredentialNames;
|
|
114
131
|
/** Static, provider-owned endpoint. It must never come from graph data. */
|
|
115
132
|
endpoint: string;
|
|
@@ -140,6 +157,12 @@ export declare const openrouterClassifierProvider: ClassifierProvider;
|
|
|
140
157
|
export declare const openaiClassifierProvider: ClassifierProvider;
|
|
141
158
|
/** https://docs.perplexity.ai/docs/decisions/quickstart */
|
|
142
159
|
export declare const perplexityClassifierProvider: ClassifierProvider;
|
|
160
|
+
/** Current model catalog rate, not the older launch article's $0.05/MTok.
|
|
161
|
+
* https://docs.subq.ai/using-the-api/models/ (verified 2026-10-24).
|
|
162
|
+
*/
|
|
163
|
+
export declare const subqClassifierProvider: ClassifierProvider;
|
|
164
|
+
/** Native Baseten API reference uses Bearer authentication (not dedicated-deployment Api-Key). */
|
|
165
|
+
export declare const basetenClassifierProvider: ClassifierProvider;
|
|
143
166
|
/** Ordered so adding compatible providers does not alter authored IDs. */
|
|
144
167
|
export declare const classifierProviders: readonly ClassifierProvider[];
|
|
145
168
|
export declare class ClassifierProviderError extends Error {
|
|
@@ -150,6 +173,7 @@ export declare class ClassifierProviderError extends Error {
|
|
|
150
173
|
export declare function classifierFailureKind(kind: ClassifierProviderError['kind'], status?: number): ClassifierFailureKind;
|
|
151
174
|
/** Bounded preparation/provider explanation, without traversing causes or capturing response bodies. */
|
|
152
175
|
export declare function classifierErrorMessage(error: unknown, apiKey?: string): string;
|
|
176
|
+
export declare function getClassifierSystemTokenPricing(providerId: string | undefined, model?: string): ClassifierTokenPricing | undefined;
|
|
153
177
|
export declare function getClassifierProvider(id: string | undefined): ClassifierProvider;
|
|
154
178
|
export declare function getClassifierProviderEnvironmentVariableNames(): string[];
|
|
155
179
|
/**
|
|
@@ -162,6 +186,6 @@ export declare function getClassifierProviderEnvironmentVariableNames(): string[
|
|
|
162
186
|
export declare function calculateClassifierUsageCost(provider: Pick<ClassifierProvider, 'pricing' | 'modelPricing'> & Partial<Pick<ClassifierProvider, 'defaultModel'>>, usage: ClassifierEvaluationResponse['usage'], models?: {
|
|
163
187
|
requestedModel: string;
|
|
164
188
|
responseModel: string;
|
|
165
|
-
}): number | undefined;
|
|
189
|
+
}, tokenPricing?: TokenPricing): number | undefined;
|
|
166
190
|
export declare function normalizeClassifierNon200RetryCount(value: number | undefined): number;
|
|
167
191
|
export declare function normalizeClassifierNon200RetryCooldownMs(value: number | undefined): number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Inputs } from '../GraphProcessor.js';
|
|
2
2
|
import type { NodeInputDefinition } from '../NodeBase.js';
|
|
3
3
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
4
|
-
import type { ClassifierEntry, ClassifierEntryEditorType } from './types.js';
|
|
4
|
+
import type { ClassifierEntry, ClassifierEntryEditorType, ClassifierQuestionDefinition } from './types.js';
|
|
5
5
|
import type { ClassifierQuestionPreparation } from './preparation.js';
|
|
6
6
|
export { assertClassifierEntry, assertClassifierInstructions } from './json.js';
|
|
7
7
|
export type ClassifierQuestionBaseData = {
|
|
@@ -13,6 +13,8 @@ export type ClassifierQuestionBaseData = {
|
|
|
13
13
|
useInstructionsInput?: boolean;
|
|
14
14
|
};
|
|
15
15
|
export declare function getInstructionsInputDefinition(): NodeInputDefinition;
|
|
16
|
+
/** Reuse State's bounded native-image/message normalization, without promoting content to shared State. */
|
|
17
|
+
export declare function getQuestionInstructionsInput(inputs: Inputs, preparation: ClassifierQuestionPreparation): Pick<ClassifierQuestionDefinition, 'instructions' | 'instructionsMessages'>;
|
|
16
18
|
export declare function getCriteriaInputDefinition(dataTypes: NodeInputDefinition['dataType']): NodeInputDefinition;
|
|
17
19
|
export declare function getInterpolationInputDefinitions(templates: readonly string[], reserved: ReadonlySet<string>): NodeInputDefinition[];
|
|
18
20
|
export declare function interpolateQuestionText(template: string, inputs: Inputs, context: InternalProcessContext, preparation?: ClassifierQuestionPreparation): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { PreparedClassifierQuestion } from './types.js';
|
|
1
|
+
import type { ClassifierQuestionDefinition, ClassifierEntry, PreparedClassifierQuestion } from './types.js';
|
|
2
2
|
import type { ClassifierValueBudget } from './limits.js';
|
|
3
|
+
export declare function createQuestionMap(questions: readonly PreparedClassifierQuestion[], instructionsFor?: (question: PreparedClassifierQuestion) => ClassifierEntry): Record<string, Omit<ClassifierQuestionDefinition, 'questionId'>>;
|
|
3
4
|
/** Shared by node execution and direct provider calls, before taking the request snapshot. */
|
|
4
5
|
export declare function prepareClassifierQuestion(value: unknown, budget: ClassifierValueBudget): PreparedClassifierQuestion;
|
|
@@ -30,6 +30,7 @@ export declare function prepareClassifierState(input: ClassifierState & {
|
|
|
30
30
|
}, budget: ClassifierValueBudget): PreparedClassifierState;
|
|
31
31
|
/** Standalone compatibility helper uses the same preparation, not a separate validator. */
|
|
32
32
|
export declare function normalizeClassifierState(input: DataValue | undefined, check?: ClassifierPreparationCheck, maxBytes?: number): ClassifierState;
|
|
33
|
+
export declare function inspectStateMessages(messages: unknown, check: ClassifierPreparationCheck): PreparedClassifierImage[];
|
|
33
34
|
/** System One separates images; numbered placeholders retain caption/image associations. */
|
|
34
35
|
export declare function systemOneState(input: ClassifierState): {
|
|
35
36
|
state: ClassifierState['state'];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PreparedClassifierEvaluation } from './providers.js';
|
|
2
|
+
import { type PreparedClassifierState } from './state.js';
|
|
3
|
+
/** https://docs.subq.ai/using-the-api/models/ (verified 2026-10-24). */
|
|
4
|
+
export declare const SUBQ_DECISION_MODELS: string[];
|
|
5
|
+
/** SubQ separates images from State and requires typed, bare-base64 objects. */
|
|
6
|
+
export declare function subqDecisionState(state: PreparedClassifierState): Record<string, unknown>;
|
|
7
|
+
/** Capability failures allow profile fallback without silently dropping/splitting evidence. */
|
|
8
|
+
export declare function assertSubQDecisionLimits({ state, questions }: PreparedClassifierEvaluation, check: () => void): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ClassifierStateMessage } from './state.js';
|
|
2
|
+
export type ClassifierQuestionType = 'choice' | 'score' | 'noul' | 'box';
|
|
2
3
|
/** Secret-free classification used by fallback diagnostics and recording traces. */
|
|
3
4
|
export declare const classifierFailureKinds: readonly ["configuration", "capability", "authentication", "transport", "http", "timeout", "response-parsing", "response-validation"];
|
|
4
5
|
export type ClassifierFailureKind = (typeof classifierFailureKinds)[number];
|
|
@@ -40,6 +41,8 @@ export type ClassifierQuestionDefinition = {
|
|
|
40
41
|
questionId: string;
|
|
41
42
|
type: ClassifierQuestionType;
|
|
42
43
|
instructions: ClassifierEntry;
|
|
44
|
+
/** Explicit ordered question content; instructions must be empty when supplied. Not shared State. */
|
|
45
|
+
instructionsMessages?: ClassifierStateMessage[];
|
|
43
46
|
criteria?: unknown;
|
|
44
47
|
};
|
|
45
48
|
export type ClassifierChoiceQuestionDefinition = ClassifierQuestionDefinition & {
|
|
@@ -57,8 +60,12 @@ export type ClassifierNoulQuestionDefinition = ClassifierQuestionDefinition & {
|
|
|
57
60
|
false: ClassifierEntry;
|
|
58
61
|
};
|
|
59
62
|
};
|
|
63
|
+
export type ClassifierBoxQuestionDefinition = ClassifierQuestionDefinition & {
|
|
64
|
+
type: 'box';
|
|
65
|
+
criteria?: never;
|
|
66
|
+
};
|
|
60
67
|
/** Internal contract after the untrusted public definition has been validated. */
|
|
61
|
-
export type PreparedClassifierQuestion = ClassifierChoiceQuestionDefinition | ClassifierScoreQuestionDefinition | ClassifierNoulQuestionDefinition;
|
|
68
|
+
export type PreparedClassifierQuestion = ClassifierChoiceQuestionDefinition | ClassifierScoreQuestionDefinition | ClassifierNoulQuestionDefinition | ClassifierBoxQuestionDefinition;
|
|
62
69
|
export type ClassifierEvaluationResponse = {
|
|
63
70
|
model: string;
|
|
64
71
|
answers: Record<string, unknown>;
|
|
@@ -9,7 +9,6 @@ export type ClassifierEvaluateNodeData = ClassifierProfileConfiguration & {
|
|
|
9
9
|
configurationMode?: 'inline' | 'profile';
|
|
10
10
|
outputClassifierAttempts?: boolean;
|
|
11
11
|
outputClassifierProfileSummary?: boolean;
|
|
12
|
-
profileChainTimeoutMs?: number;
|
|
13
12
|
/** Adds the exact JSON body sent to the provider, excluding its auth header. */
|
|
14
13
|
outputRequestBody?: boolean;
|
|
15
14
|
/** Adds the complete parsed JSON body returned by the provider. */
|
|
@@ -21,7 +20,6 @@ export type ClassifierEvaluateNodeData = ClassifierProfileConfiguration & {
|
|
|
21
20
|
catchRequestFailed?: boolean;
|
|
22
21
|
retryOnNon200RepeatTimes?: number;
|
|
23
22
|
retryOnNon200CooldownMs?: number;
|
|
24
|
-
timeoutMs?: number;
|
|
25
23
|
};
|
|
26
24
|
export type ClassifierEvaluateNode = ChartNode<'classifierEvaluate', ClassifierEvaluateNodeData>;
|
|
27
25
|
export type ClassifierEvaluateBodySection = Readonly<{
|
|
@@ -46,7 +44,7 @@ export declare class ClassifierEvaluateNodeImpl extends NodeImpl<ClassifierEvalu
|
|
|
46
44
|
private processProfiles;
|
|
47
45
|
}
|
|
48
46
|
/** Shared settings definition; constructing an unrelated node is unnecessary. */
|
|
49
|
-
export declare function getClassifierModelEditor(
|
|
50
|
-
/** Shared presentation model for the app's
|
|
47
|
+
export declare function getClassifierModelEditor(): EditorDefinitionGroup<ClassifierEvaluateNode>;
|
|
48
|
+
/** Shared presentation model for the app's Decision AI run card. */
|
|
51
49
|
export declare function getClassifierEvaluateBodySections(data: ClassifierEvaluateNodeData): readonly ClassifierEvaluateBodySection[];
|
|
52
50
|
export declare const classifierEvaluateNode: import("../NodeDefinition.js").NodeDefinition<ClassifierEvaluateNode>;
|
|
@@ -35,7 +35,7 @@ export type ClassifierQuestionNodeData = ClassifierQuestionBaseData & {
|
|
|
35
35
|
};
|
|
36
36
|
export type ClassifierQuestionNode = ChartNode<'classifierQuestion', ClassifierQuestionNodeData>;
|
|
37
37
|
export type ClassifierQuestionBodySection = Readonly<{
|
|
38
|
-
id: 'identity' | 'instructions' | 'criteria';
|
|
38
|
+
id: 'identity' | 'instructions' | 'criteria' | 'capability';
|
|
39
39
|
fields: readonly Readonly<{
|
|
40
40
|
label: string;
|
|
41
41
|
value: string;
|
|
@@ -52,7 +52,7 @@ export declare class ClassifierQuestionNodeImpl extends NodeImpl<ClassifierQuest
|
|
|
52
52
|
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* Shared presentation model for the app's
|
|
55
|
+
* Shared presentation model for the app's Decision AI card. Keep this data-only
|
|
56
56
|
* so the Core Markdown fallback and the app's LLM-style React body cannot
|
|
57
57
|
* disagree about what a saved question represents.
|
|
58
58
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** All rates are USD per one million tokens. Cache counts are subsets of inputTokens. */
|
|
2
|
+
export type TokenPricing = {
|
|
3
|
+
inputPerMillionTokens: number;
|
|
4
|
+
outputPerMillionTokens: number;
|
|
5
|
+
cacheReadPerMillionTokens?: number;
|
|
6
|
+
cacheWritePerMillionTokens?: number;
|
|
7
|
+
};
|
|
8
|
+
/** Provider token counts must be exact, nonnegative integers before applying rates. */
|
|
9
|
+
export declare function isReportedTokenCount(value: unknown): value is number;
|
|
10
|
+
export declare function validateTokenPricing(value: unknown): TokenPricing | undefined;
|
|
11
|
+
export declare function calculateTokenUsageCost(pricing: TokenPricing, usage: {
|
|
12
|
+
inputTokens?: number;
|
|
13
|
+
outputTokens?: number;
|
|
14
|
+
inputTokenDetails?: {
|
|
15
|
+
cacheReadTokens?: number;
|
|
16
|
+
cacheWriteTokens?: number;
|
|
17
|
+
};
|
|
18
|
+
} | undefined): number | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditorDefinitionGroup } from './EditorDefinition.js';
|
|
2
|
+
import type { ChartNode } from './NodeBase.js';
|
|
3
|
+
/** Shared settings section for inline configurations and separate profile nodes. */
|
|
4
|
+
export declare function getTokenPricingEditor<T extends ChartNode>(): EditorDefinitionGroup<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valerypopoff/rivet2-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/cjs/bundle.cjs",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -94,6 +94,6 @@
|
|
|
94
94
|
"ts-pattern": "^5.6.2",
|
|
95
95
|
"type-fest": "^4.34.1",
|
|
96
96
|
"yaml": "^2.9.0",
|
|
97
|
-
"zod": "^4.
|
|
97
|
+
"zod": "^4.6.7"
|
|
98
98
|
}
|
|
99
99
|
}
|