@valerypopoff/rivet2-core 2.26.0 → 2.27.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 +71 -25
- package/dist/cjs/bundle.cjs.map +2 -2
- package/dist/cjs/webAppRuntime.cjs.map +1 -1
- package/dist/esm/model/LatestDebuggerProtocol.js +28 -5
- package/dist/esm/model/classifier/baseten.js +2 -1
- package/dist/esm/model/classifier/providers.js +55 -30
- package/dist/types/model/LatestDebuggerProtocol.d.ts +10 -2
- package/dist/types/model/classifier/baseten.d.ts +2 -2
- package/dist/types/model/classifier/providers.d.ts +11 -11
- package/dist/types/model/classifier/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/cjs/bundle.cjs
CHANGED
|
@@ -722,6 +722,7 @@ __export(src_exports, {
|
|
|
722
722
|
readKnowledgeStoreConnectionCredentialsDraft: () => readKnowledgeStoreConnectionCredentialsDraft,
|
|
723
723
|
readLatestDebuggerControl: () => readLatestDebuggerControl,
|
|
724
724
|
readLatestDebuggerEventId: () => readLatestDebuggerEventId,
|
|
725
|
+
readLatestDebuggerEventPosition: () => readLatestDebuggerEventPosition,
|
|
725
726
|
readLatestDebuggerExecution: () => readLatestDebuggerExecution,
|
|
726
727
|
reconcileProjectUiGraphBindings: () => reconcileProjectUiGraphBindings,
|
|
727
728
|
reconcileProjectUiGraphButtonBindings: () => reconcileProjectUiGraphButtonBindings,
|
|
@@ -1533,6 +1534,7 @@ __export(exports_exports, {
|
|
|
1533
1534
|
readKnowledgeStoreConnectionCredentialsDraft: () => readKnowledgeStoreConnectionCredentialsDraft,
|
|
1534
1535
|
readLatestDebuggerControl: () => readLatestDebuggerControl,
|
|
1535
1536
|
readLatestDebuggerEventId: () => readLatestDebuggerEventId,
|
|
1537
|
+
readLatestDebuggerEventPosition: () => readLatestDebuggerEventPosition,
|
|
1536
1538
|
readLatestDebuggerExecution: () => readLatestDebuggerExecution,
|
|
1537
1539
|
reconcileProjectUiGraphBindings: () => reconcileProjectUiGraphBindings,
|
|
1538
1540
|
reconcileProjectUiGraphButtonBindings: () => reconcileProjectUiGraphButtonBindings,
|
|
@@ -46173,7 +46175,8 @@ function assertSubQDecisionLimits({ state, questions }, check) {
|
|
|
46173
46175
|
// src/model/classifier/baseten.ts
|
|
46174
46176
|
var BASETEN_DECISION_MODELS = [
|
|
46175
46177
|
"decision-models/baseten-elephant-9b-latest",
|
|
46176
|
-
"decision-models/baseten-mammoth-27b-latest"
|
|
46178
|
+
"decision-models/baseten-mammoth-27b-latest",
|
|
46179
|
+
"decision-models/baseten-joey-2b-latest"
|
|
46177
46180
|
];
|
|
46178
46181
|
function basetenDecisionState(state) {
|
|
46179
46182
|
if (state.kind === "json") return state.value;
|
|
@@ -46253,7 +46256,6 @@ var LIQUID_TOKEN_PRICING = {
|
|
|
46253
46256
|
inputPerMillionTokens: 0.02,
|
|
46254
46257
|
outputPerMillionTokens: 0
|
|
46255
46258
|
};
|
|
46256
|
-
var TOKENS_PER_MILLION = 1e6;
|
|
46257
46259
|
var MAX_AUTOMATIC_ATTEMPTS = 3;
|
|
46258
46260
|
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
46259
46261
|
var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([429, 529]);
|
|
@@ -46275,7 +46277,11 @@ var jevClassifierProvider = createClassifierProvider({
|
|
|
46275
46277
|
id: "jev",
|
|
46276
46278
|
label: "Jev",
|
|
46277
46279
|
defaultModel: "jev-latest",
|
|
46278
|
-
modelOptions: ["jev-latest", "jev-preview", "jev-1.14.0", "jev-1.13.0"].map((value) => ({
|
|
46280
|
+
modelOptions: ["jev-latest", "jev-preview", "jev-1.14.0", "jev-1.13.0"].map((value) => ({
|
|
46281
|
+
value,
|
|
46282
|
+
label: value,
|
|
46283
|
+
aggregateTokenUsageOnly: true
|
|
46284
|
+
})),
|
|
46279
46285
|
modelHelp: "Jev images are experimental: use still PNG/JPEG, 280\u20131568 pixels per side. Image requests enable TypeSafe\u2019s experimental image API.",
|
|
46280
46286
|
credentialNames: JEV_DEFAULT_CREDENTIAL_NAMES,
|
|
46281
46287
|
endpoint: JEV_SYSTEM_ONE_ENDPOINT,
|
|
@@ -46305,7 +46311,7 @@ var liquidClassifierProvider = createApiCompatibleClassifierProvider({
|
|
|
46305
46311
|
id: "liquid",
|
|
46306
46312
|
label: "Liquid AI",
|
|
46307
46313
|
defaultModel: "d1",
|
|
46308
|
-
modelOptions: ["d1", "d1.1"].map((value) => ({ value, label: value })),
|
|
46314
|
+
modelOptions: ["d1", "d1.1"].map((value) => ({ value, label: value, aggregateTokenUsageOnly: true })),
|
|
46309
46315
|
modelHelp: "Images belong in shared State, not Question Instructions.",
|
|
46310
46316
|
credentialNames: LIQUID_DEFAULT_CREDENTIAL_NAMES,
|
|
46311
46317
|
endpoint: LIQUID_SYSTEM_ONE_ENDPOINT,
|
|
@@ -46320,7 +46326,9 @@ var openrouterClassifierProvider = createApiCompatibleClassifierProvider({
|
|
|
46320
46326
|
id: "openrouter",
|
|
46321
46327
|
label: "OpenRouter",
|
|
46322
46328
|
defaultModel: "microsoft/microsoft-decision-1",
|
|
46323
|
-
modelOptions: [
|
|
46329
|
+
modelOptions: [
|
|
46330
|
+
{ value: "microsoft/microsoft-decision-1", label: "Microsoft Decision-1 (9b)", aggregateTokenUsageOnly: true }
|
|
46331
|
+
],
|
|
46324
46332
|
credentialNames: OPENROUTER_DEFAULT_CREDENTIAL_NAMES,
|
|
46325
46333
|
endpoint: OPENROUTER_DECISIONS_ENDPOINT,
|
|
46326
46334
|
modelPricing: [
|
|
@@ -46337,6 +46345,7 @@ var openaiClassifierProvider = createClassifierProvider({
|
|
|
46337
46345
|
modelOptions: [{ value: "gpt-6-luna", label: "gpt-6-luna" }],
|
|
46338
46346
|
credentialNames: OPENAI_DEFAULT_CREDENTIAL_NAMES,
|
|
46339
46347
|
browserExecutionSupported: false,
|
|
46348
|
+
cacheTokenUsageSupported: true,
|
|
46340
46349
|
endpoint: OPENAI_DECISIONS_ENDPOINT,
|
|
46341
46350
|
supportsImages: (model) => model === "gpt-6-luna",
|
|
46342
46351
|
supportsQuestionImages: (model) => model === "gpt-6-luna",
|
|
@@ -46346,7 +46355,15 @@ var openaiClassifierProvider = createClassifierProvider({
|
|
|
46346
46355
|
pricing: {
|
|
46347
46356
|
inputPerMillionTokens: 0.1,
|
|
46348
46357
|
outputPerMillionTokens: 0,
|
|
46349
|
-
|
|
46358
|
+
cacheReadPerMillionTokens: 0.01,
|
|
46359
|
+
cacheWritePerMillionTokens: 0.125,
|
|
46360
|
+
longContext: {
|
|
46361
|
+
aboveInputTokens: 272e3,
|
|
46362
|
+
inputPerMillionTokens: 0.2,
|
|
46363
|
+
outputPerMillionTokens: 0,
|
|
46364
|
+
cacheReadPerMillionTokens: 0.02,
|
|
46365
|
+
cacheWritePerMillionTokens: 0.25
|
|
46366
|
+
}
|
|
46350
46367
|
}
|
|
46351
46368
|
}
|
|
46352
46369
|
],
|
|
@@ -46357,7 +46374,11 @@ var perplexityClassifierProvider = createClassifierProvider({
|
|
|
46357
46374
|
id: "perplexity",
|
|
46358
46375
|
label: "Perplexity",
|
|
46359
46376
|
defaultModel: "pplx-decider-v1.1-27b",
|
|
46360
|
-
modelOptions: PERPLEXITY_DECISION_MODELS.map((value) => ({
|
|
46377
|
+
modelOptions: PERPLEXITY_DECISION_MODELS.map((value) => ({
|
|
46378
|
+
value,
|
|
46379
|
+
label: value.replace(/-27b$/, " (27b)"),
|
|
46380
|
+
aggregateTokenUsageOnly: true
|
|
46381
|
+
})),
|
|
46361
46382
|
credentialNames: PERPLEXITY_DEFAULT_CREDENTIAL_NAMES,
|
|
46362
46383
|
browserExecutionSupported: false,
|
|
46363
46384
|
endpoint: PERPLEXITY_DECISIONS_ENDPOINT,
|
|
@@ -46380,7 +46401,7 @@ var subqClassifierProvider = createClassifierProvider({
|
|
|
46380
46401
|
id: "subq",
|
|
46381
46402
|
label: "SubQ",
|
|
46382
46403
|
defaultModel: "subq-snap-1.1",
|
|
46383
|
-
modelOptions: SUBQ_DECISION_MODELS.map((value) => ({ value, label: value })),
|
|
46404
|
+
modelOptions: SUBQ_DECISION_MODELS.map((value) => ({ value, label: value, aggregateTokenUsageOnly: true })),
|
|
46384
46405
|
credentialNames: SUBQ_DEFAULT_CREDENTIAL_NAMES,
|
|
46385
46406
|
browserExecutionSupported: false,
|
|
46386
46407
|
endpoint: SUBQ_DECISIONS_ENDPOINT,
|
|
@@ -46400,8 +46421,9 @@ var basetenClassifierProvider = createClassifierProvider({
|
|
|
46400
46421
|
label: "Baseten",
|
|
46401
46422
|
defaultModel: BASETEN_DECISION_MODELS[0],
|
|
46402
46423
|
modelOptions: [
|
|
46403
|
-
{ value: BASETEN_DECISION_MODELS[0], label: "Elephant-1" },
|
|
46404
|
-
{ value: BASETEN_DECISION_MODELS[1], label: "Mammoth-1" }
|
|
46424
|
+
{ value: BASETEN_DECISION_MODELS[0], label: "Elephant-1 (9b)", aggregateTokenUsageOnly: true },
|
|
46425
|
+
{ value: BASETEN_DECISION_MODELS[1], label: "Mammoth-1 (27b)", aggregateTokenUsageOnly: true },
|
|
46426
|
+
{ value: BASETEN_DECISION_MODELS[2], label: "Joey-1 (2b)", aggregateTokenUsageOnly: true }
|
|
46405
46427
|
],
|
|
46406
46428
|
modelHelp: "Images belong in shared State, not Question Instructions.",
|
|
46407
46429
|
credentialNames: BASETEN_DEFAULT_CREDENTIAL_NAMES,
|
|
@@ -46566,11 +46588,15 @@ function getClassifierProviderEnvironmentVariableNames() {
|
|
|
46566
46588
|
return [...new Set(classifierProviders.map((provider) => provider.credentialNames.environmentVariableName))];
|
|
46567
46589
|
}
|
|
46568
46590
|
function calculateClassifierUsageCost(provider, usage, models, tokenPricing) {
|
|
46569
|
-
|
|
46570
|
-
|
|
46571
|
-
|
|
46572
|
-
|
|
46573
|
-
|
|
46591
|
+
let inputTokenDetails;
|
|
46592
|
+
if (provider.cacheTokenUsageSupported && usage.input_tokens_details !== void 0) {
|
|
46593
|
+
const details = usage.input_tokens_details;
|
|
46594
|
+
if (details === null || typeof details !== "object" || Array.isArray(details) || !isReportedTokenCount(details.cached_tokens) || !isReportedTokenCount(details.cache_write_tokens))
|
|
46595
|
+
return void 0;
|
|
46596
|
+
inputTokenDetails = { cacheReadTokens: details.cached_tokens, cacheWriteTokens: details.cache_write_tokens };
|
|
46597
|
+
}
|
|
46598
|
+
const reportedUsage = { inputTokens: usage.input_tokens, outputTokens: usage.output_tokens, inputTokenDetails };
|
|
46599
|
+
if (tokenPricing !== void 0) return calculateTokenUsageCost(tokenPricing, reportedUsage);
|
|
46574
46600
|
if (!models) return void 0;
|
|
46575
46601
|
const entries2 = normalizeModelPricing(provider);
|
|
46576
46602
|
const entry = entries2.find(
|
|
@@ -46578,13 +46604,15 @@ function calculateClassifierUsageCost(provider, usage, models, tokenPricing) {
|
|
|
46578
46604
|
);
|
|
46579
46605
|
const base = entry == null ? void 0 : entry.pricing;
|
|
46580
46606
|
const tier = base == null ? void 0 : base.longContext;
|
|
46581
|
-
|
|
46582
|
-
|
|
46607
|
+
if (base == null || tier != null && !isReportedTokenCount(tier.aboveInputTokens)) return void 0;
|
|
46608
|
+
try {
|
|
46609
|
+
validateTokenPricing(base);
|
|
46610
|
+
if (tier != null) validateTokenPricing(tier);
|
|
46611
|
+
} catch {
|
|
46583
46612
|
return void 0;
|
|
46584
46613
|
}
|
|
46585
46614
|
const pricing = tier && usage.input_tokens > tier.aboveInputTokens ? tier : base;
|
|
46586
|
-
|
|
46587
|
-
return Number.isFinite(totalCost) && totalCost >= 0 ? totalCost : void 0;
|
|
46615
|
+
return calculateTokenUsageCost(pricing, reportedUsage);
|
|
46588
46616
|
}
|
|
46589
46617
|
async function callClassifierHttp(args, spec, prepared, buildRequest, operation) {
|
|
46590
46618
|
var _a;
|
|
@@ -55864,21 +55892,31 @@ var managedProcessMessages = {
|
|
|
55864
55892
|
function isLatestDebuggerExecutionMessage(message2) {
|
|
55865
55893
|
return Object.hasOwn(managedProcessMessages, message2) || message2 === "latest-settled" || message2 === "latest-prompt-closed";
|
|
55866
55894
|
}
|
|
55867
|
-
function encodeLatestDebuggerEnvelope(serialized, scope, eventId) {
|
|
55868
|
-
if (!scope && !eventId) return serialized;
|
|
55895
|
+
function encodeLatestDebuggerEnvelope(serialized, scope, eventId, history = false) {
|
|
55896
|
+
if (!scope && !eventId && !history) return serialized;
|
|
55869
55897
|
const metadata = JSON.stringify({
|
|
55870
55898
|
...eventId ? { rivetEventId: eventId } : {},
|
|
55871
|
-
...scope ? { rivetScope: scope } : {}
|
|
55899
|
+
...scope ? { rivetScope: scope } : {},
|
|
55900
|
+
...history ? { rivetHistory: history } : {}
|
|
55872
55901
|
});
|
|
55873
55902
|
return `${metadata.slice(0, -1)},${serialized.slice(1)}`;
|
|
55874
55903
|
}
|
|
55875
|
-
function createLatestDebuggerSession(channel) {
|
|
55876
|
-
return {
|
|
55904
|
+
function createLatestDebuggerSession(channel, historyThrough) {
|
|
55905
|
+
return {
|
|
55906
|
+
message: "latest-session",
|
|
55907
|
+
data: {
|
|
55908
|
+
protocol: 2,
|
|
55909
|
+
channel,
|
|
55910
|
+
channelIsolation: true,
|
|
55911
|
+
runScopedControls: true,
|
|
55912
|
+
...historyThrough ? { historyThrough } : {}
|
|
55913
|
+
}
|
|
55914
|
+
};
|
|
55877
55915
|
}
|
|
55878
55916
|
function isLatestDebuggerSession(value) {
|
|
55879
55917
|
var _a;
|
|
55880
55918
|
const frame = value;
|
|
55881
|
-
return (frame == null ? void 0 : frame.message) === "latest-session" && ((_a = frame.data) == null ? void 0 : _a.protocol) === 2 && (frame.data.channel === null || typeof frame.data.channel === "string" && /^[A-Za-z0-9_-]{1,32}$/.test(frame.data.channel)) && frame.data.channelIsolation === true && frame.data.runScopedControls === true;
|
|
55919
|
+
return (frame == null ? void 0 : frame.message) === "latest-session" && ((_a = frame.data) == null ? void 0 : _a.protocol) === 2 && (frame.data.channel === null || typeof frame.data.channel === "string" && /^[A-Za-z0-9_-]{1,32}$/.test(frame.data.channel)) && frame.data.channelIsolation === true && frame.data.runScopedControls === true && (frame.data.historyThrough === void 0 || Array.isArray(frame.data.historyThrough) && frame.data.historyThrough.length <= 8192 && frame.data.historyThrough.every((id) => readLatestDebuggerEventPosition(id) !== void 0));
|
|
55882
55920
|
}
|
|
55883
55921
|
function readLatestDebuggerExecution(value) {
|
|
55884
55922
|
var _a, _b, _c;
|
|
@@ -55922,6 +55960,13 @@ function readLatestDebuggerEventId(value) {
|
|
|
55922
55960
|
const id = value.rivetEventId;
|
|
55923
55961
|
return typeof id === "string" && /^[a-z0-9:-]{1,200}$/.test(id) ? id : void 0;
|
|
55924
55962
|
}
|
|
55963
|
+
function readLatestDebuggerEventPosition(value) {
|
|
55964
|
+
if (typeof value !== "string" || value.length > 200 || !/^[a-z0-9:-]+:[1-9]\d{0,15}$/.test(value)) return;
|
|
55965
|
+
const split = value.lastIndexOf(":");
|
|
55966
|
+
const sequence = Number(value.slice(split + 1));
|
|
55967
|
+
if (!Number.isSafeInteger(sequence)) return;
|
|
55968
|
+
return { origin: value.slice(0, split), sequence };
|
|
55969
|
+
}
|
|
55925
55970
|
function isLatestDebuggerControlResult(value) {
|
|
55926
55971
|
var _a;
|
|
55927
55972
|
const message2 = value;
|
|
@@ -56646,6 +56691,7 @@ var Rivet = void 0;
|
|
|
56646
56691
|
readKnowledgeStoreConnectionCredentialsDraft,
|
|
56647
56692
|
readLatestDebuggerControl,
|
|
56648
56693
|
readLatestDebuggerEventId,
|
|
56694
|
+
readLatestDebuggerEventPosition,
|
|
56649
56695
|
readLatestDebuggerExecution,
|
|
56650
56696
|
reconcileProjectUiGraphBindings,
|
|
56651
56697
|
reconcileProjectUiGraphButtonBindings,
|