@valerypopoff/rivet2-core 2.22.0 → 2.24.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 +1166 -797
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/webAppRuntime.cjs +4 -1
- package/dist/cjs/webAppRuntime.cjs.map +2 -2
- package/dist/esm/exports.js +0 -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/GraphProcessor.js +32 -54
- package/dist/esm/model/NodeRegistration.js +2 -6
- 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 +14 -13
- package/dist/esm/model/classifier/profileExecution.js +26 -23
- package/dist/esm/model/classifier/providers.js +170 -74
- 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 +32 -61
- package/dist/esm/model/nodes/ClassifierProfileNode.js +9 -9
- package/dist/esm/model/nodes/ClassifierQuestionNode.js +53 -34
- 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/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/profileExecution.d.ts +1 -1
- package/dist/types/model/classifier/providers.d.ts +26 -5
- 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/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PreparedClassifierImage } from './images.js';
|
|
2
|
+
import type { PreparedClassifierEvaluation } from './providers.js';
|
|
3
|
+
/** Experimental image contract, verified 2026-10-24: https://docs.typesafe.ai/images */
|
|
4
|
+
export declare const JEV_IMAGE_MODELS: string[];
|
|
5
|
+
/** https://docs.typesafe.ai/primitives/box — Box requires Jev 1.14, not 1.13. */
|
|
6
|
+
export declare const JEV_BOX_MODELS: string[];
|
|
7
|
+
export declare function assertJevImageLimits(images: readonly PreparedClassifierImage[], check: () => void): void;
|
|
8
|
+
/** Jev substitutes opaque asset references, not Liquid's numbered image placeholders. */
|
|
9
|
+
export declare function createJevDecisionRequest({ model, state, questions, }: PreparedClassifierEvaluation): Record<string, unknown>;
|
|
@@ -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;
|
|
@@ -9,14 +9,16 @@ export declare const LIQUID_SYSTEM_ONE_ENDPOINT = "https://api.liquid.ai/decisio
|
|
|
9
9
|
export declare const OPENAI_DECISIONS_ENDPOINT = "https://api.openai.com/v1/decisions";
|
|
10
10
|
export declare const OPENROUTER_DECISIONS_ENDPOINT = "https://openrouter.ai/api/alpha/decisions";
|
|
11
11
|
export declare const PERPLEXITY_DECISIONS_ENDPOINT = "https://api.perplexity.ai/v1/decisions";
|
|
12
|
-
|
|
12
|
+
export declare const SUBQ_DECISIONS_ENDPOINT = "https://api.subq.ai/v1/systemone";
|
|
13
|
+
export declare const BASETEN_DECISIONS_ENDPOINT = "https://inference.baseten.co/v1/systemone";
|
|
14
|
+
/** Jev 1.13/1.14 USD rates, verified 2026-10-24: https://docs.typesafe.ai/models */
|
|
13
15
|
export declare const JEV_TOKEN_PRICING: {
|
|
14
16
|
readonly inputPerMillionTokens: 0.042;
|
|
15
17
|
readonly outputPerMillionTokens: 0;
|
|
16
18
|
};
|
|
17
|
-
/** Liquid d1
|
|
19
|
+
/** Liquid d1 USD rates, verified 2026-10-26: https://www.liquid.ai/pricing */
|
|
18
20
|
export declare const LIQUID_TOKEN_PRICING: {
|
|
19
|
-
readonly inputPerMillionTokens: 0.
|
|
21
|
+
readonly inputPerMillionTokens: 0.02;
|
|
20
22
|
readonly outputPerMillionTokens: 0;
|
|
21
23
|
};
|
|
22
24
|
export declare const DEFAULT_CLASSIFIER_RETRY_ON_NON_200_REPEAT_TIMES = 1;
|
|
@@ -25,9 +27,18 @@ export type ClassifierProvider = {
|
|
|
25
27
|
id: string;
|
|
26
28
|
label: string;
|
|
27
29
|
defaultModel: string;
|
|
30
|
+
/** Curated UI choices, not a runtime allowlist or a pricing/capability promise. */
|
|
31
|
+
modelOptions?: readonly {
|
|
32
|
+
value: string;
|
|
33
|
+
label: string;
|
|
34
|
+
}[];
|
|
35
|
+
/** Provider-owned model guidance shared by inline and Profile editors. */
|
|
36
|
+
modelHelp?: string;
|
|
28
37
|
credentialNames: ClassifierCredentialNames;
|
|
29
38
|
browserExecutionSupported: boolean;
|
|
30
39
|
supportsImages?: (model: string) => boolean;
|
|
40
|
+
supportsQuestionImages?: (model: string) => boolean;
|
|
41
|
+
supportsBoxQuestions?: (model: string) => boolean;
|
|
31
42
|
/** A stricter provider request limit also bounds preparation before encoding. */
|
|
32
43
|
maxRequestBytes?: number;
|
|
33
44
|
/** Legacy shorthand: pricing for defaultModel only, never arbitrary models. */
|
|
@@ -85,8 +96,9 @@ export type ClassifierProviderEvaluateArgs = {
|
|
|
85
96
|
stateMessages?: ClassifierStateMessage[];
|
|
86
97
|
/** Optional Rivet wrapper for the graph entry; ordinary provider calls use state/stateMessages. */
|
|
87
98
|
stateInput?: DataValue;
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
/** Optional per-profile/request deadline; absent means caller cancellation only. */
|
|
100
|
+
timeoutMs?: number;
|
|
101
|
+
/** Optional absolute deadline for direct programmatic provider calls. */
|
|
90
102
|
deadline?: number;
|
|
91
103
|
/** Opt-in retry policy for non-authentication, non-validation HTTP errors. */
|
|
92
104
|
retryOnNon200?: boolean;
|
|
@@ -102,6 +114,7 @@ export type PreparedClassifierEvaluation = {
|
|
|
102
114
|
type ClassifierProviderSpec = Omit<ClassifierProvider, 'evaluate' | 'evaluateInput'> & {
|
|
103
115
|
endpoint: string;
|
|
104
116
|
buildRequest(args: PreparedClassifierEvaluation): Record<string, unknown>;
|
|
117
|
+
requestHeaders?(args: PreparedClassifierEvaluation): Record<string, string>;
|
|
105
118
|
validateResponse: typeof validateClassifierEvaluationResponse;
|
|
106
119
|
checkState?(state: PreparedClassifierState, check: () => void): void;
|
|
107
120
|
checkRequest?(request: PreparedClassifierEvaluation, check: () => void): void;
|
|
@@ -110,6 +123,8 @@ export type ApiCompatibleClassifierProviderConfig = {
|
|
|
110
123
|
id: string;
|
|
111
124
|
label: string;
|
|
112
125
|
defaultModel: string;
|
|
126
|
+
modelOptions?: ClassifierProvider['modelOptions'];
|
|
127
|
+
modelHelp?: string;
|
|
113
128
|
credentialNames: ClassifierCredentialNames;
|
|
114
129
|
/** Static, provider-owned endpoint. It must never come from graph data. */
|
|
115
130
|
endpoint: string;
|
|
@@ -140,6 +155,12 @@ export declare const openrouterClassifierProvider: ClassifierProvider;
|
|
|
140
155
|
export declare const openaiClassifierProvider: ClassifierProvider;
|
|
141
156
|
/** https://docs.perplexity.ai/docs/decisions/quickstart */
|
|
142
157
|
export declare const perplexityClassifierProvider: ClassifierProvider;
|
|
158
|
+
/** Current model catalog rate, not the older launch article's $0.05/MTok.
|
|
159
|
+
* https://docs.subq.ai/using-the-api/models/ (verified 2026-10-24).
|
|
160
|
+
*/
|
|
161
|
+
export declare const subqClassifierProvider: ClassifierProvider;
|
|
162
|
+
/** Native Baseten API reference uses Bearer authentication (not dedicated-deployment Api-Key). */
|
|
163
|
+
export declare const basetenClassifierProvider: ClassifierProvider;
|
|
143
164
|
/** Ordered so adding compatible providers does not alter authored IDs. */
|
|
144
165
|
export declare const classifierProviders: readonly ClassifierProvider[];
|
|
145
166
|
export declare class ClassifierProviderError extends Error {
|
|
@@ -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
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valerypopoff/rivet2-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.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
|
}
|