@rulvar/core 1.208.0 → 1.209.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/index.d.ts +18 -0
- package/dist/index.js +25 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13131,6 +13131,24 @@ interface PreflightSpawnReport {
|
|
|
13131
13131
|
* turn grows with the prompt, so this is a floor, never a cap.
|
|
13132
13132
|
*/
|
|
13133
13133
|
turnFloorUsd?: number;
|
|
13134
|
+
/**
|
|
13135
|
+
* The loop's input floor over its projected turns, UNCACHED
|
|
13136
|
+
* (RV2007): the declared prompt floor (`estInputTokens`) re-billed
|
|
13137
|
+
* at the full input rate on every projected provider turn. A floor
|
|
13138
|
+
* over the static prefix: real prompts grow. Present when the shape
|
|
13139
|
+
* prices and projects more than one turn.
|
|
13140
|
+
*/
|
|
13141
|
+
uncachedLoopInputFloorUsd?: number;
|
|
13142
|
+
/**
|
|
13143
|
+
* The same loop under the RV2006 cache policy: one cache write of
|
|
13144
|
+
* the prompt floor plus a cache read on every later turn, priced by
|
|
13145
|
+
* the row's cache rates. Present beside the uncached figure when
|
|
13146
|
+
* the row carries cache rates. The parity worker shape (36k-token
|
|
13147
|
+
* prompt floor, a long cycle) prices the difference at roughly
|
|
13148
|
+
* three to four times, the gap between four seats fitting a $6
|
|
13149
|
+
* envelope and three seats dying against it.
|
|
13150
|
+
*/
|
|
13151
|
+
cachedLoopInputFloorUsd?: number;
|
|
13134
13152
|
/** Executed-call ceiling across any tool mix; null = unlimited. */
|
|
13135
13153
|
executedToolCallCeiling: number | null;
|
|
13136
13154
|
/**
|
package/dist/index.js
CHANGED
|
@@ -24474,6 +24474,29 @@ function preflightEstimate(input) {
|
|
|
24474
24474
|
const toolCeilings = toolCeilingsOf(limits);
|
|
24475
24475
|
const executedToolCallCeiling = overallExecutedCeiling(limits, toolCeilings);
|
|
24476
24476
|
const projectedProviderTurns = projectedProviderTurnsOf(limits, executedToolCallCeiling);
|
|
24477
|
+
let uncachedLoopInputFloorUsd;
|
|
24478
|
+
let cachedLoopInputFloorUsd;
|
|
24479
|
+
if (pricing !== void 0 && (spec.estInputTokens ?? 0) > 0 && Number.isFinite(projectedProviderTurns) && projectedProviderTurns > 1) {
|
|
24480
|
+
const loopInputTokens = spec.estInputTokens ?? 0;
|
|
24481
|
+
uncachedLoopInputFloorUsd = projectedProviderTurns * priceUsdOf(pricing, {
|
|
24482
|
+
inputTokens: loopInputTokens,
|
|
24483
|
+
outputTokens: 0,
|
|
24484
|
+
cacheReadTokens: 0,
|
|
24485
|
+
cacheWriteTokens: 0
|
|
24486
|
+
});
|
|
24487
|
+
if (pricing.cacheReadUsdPerMTok !== void 0 && pricing.cacheWriteUsdPerMTok !== void 0) cachedLoopInputFloorUsd = priceUsdOf(pricing, {
|
|
24488
|
+
inputTokens: projectedProviderTurns * loopInputTokens,
|
|
24489
|
+
outputTokens: 0,
|
|
24490
|
+
cacheReadTokens: (projectedProviderTurns - 1) * loopInputTokens,
|
|
24491
|
+
cacheWriteTokens: loopInputTokens
|
|
24492
|
+
});
|
|
24493
|
+
}
|
|
24494
|
+
if (caps?.promptCaching === "explicit" && engine.defaults?.cache?.mode === "off" && uncachedLoopInputFloorUsd !== void 0 && cachedLoopInputFloorUsd !== void 0 && projectedProviderTurns >= 4) say({
|
|
24495
|
+
severity: "warning",
|
|
24496
|
+
code: "uncached-long-loop",
|
|
24497
|
+
message: `spawn '${label}' projects ${String(projectedProviderTurns)} provider turns on the explicit-caching '${servedBy ?? ""}' with the cache policy OFF: the loop's input floor re-bills every turn (${uncachedLoopInputFloorUsd.toFixed(4)} USD uncached against ${cachedLoopInputFloorUsd.toFixed(4)} USD under the default policy); drop defaults.cache { mode: 'off' } or scope the opt-out to the profiles that need it`,
|
|
24498
|
+
spawn: label
|
|
24499
|
+
});
|
|
24477
24500
|
for (const row of toolCeilings) {
|
|
24478
24501
|
if (row.tool === ANY_TOOL) continue;
|
|
24479
24502
|
const cost = limits.toolUnits?.costs?.[row.tool];
|
|
@@ -24610,6 +24633,8 @@ function preflightEstimate(input) {
|
|
|
24610
24633
|
reserveSource,
|
|
24611
24634
|
...outputBound === void 0 ? {} : { maxOutputTokensPerTurn: outputBound },
|
|
24612
24635
|
...turnFloorUsd === void 0 ? {} : { turnFloorUsd },
|
|
24636
|
+
...uncachedLoopInputFloorUsd === void 0 ? {} : { uncachedLoopInputFloorUsd },
|
|
24637
|
+
...cachedLoopInputFloorUsd === void 0 ? {} : { cachedLoopInputFloorUsd },
|
|
24613
24638
|
executedToolCallCeiling,
|
|
24614
24639
|
projectedProviderTurns,
|
|
24615
24640
|
toolCeilings
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.209.0",
|
|
4
4
|
"description": "Rulvar core: L0 contracts, journal kernel, ctx primitives, agent runtime, model router, tool system, dynamic orchestrator, InMemory and JSONL stores, event stream.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|