@bivelio/savings-layer 0.4.32 → 0.4.34
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/LICENSE +22 -12
- package/README.md +150 -39
- package/dist/adapters/anthropic-sdk.js +72 -71
- package/dist/gateway/bin.js +902 -864
- package/dist/index.d.ts +611 -105
- package/dist/index.js +1604 -1493
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -48,11 +48,11 @@ interface CostModel {
|
|
|
48
48
|
cachedInputPer1k?: number;
|
|
49
49
|
}
|
|
50
50
|
/** Oldest provider counter a repeat can be valued against: one billing period. */
|
|
51
|
-
declare const REFERENCE_MAX_AGE_MS: number;
|
|
51
|
+
declare const REFERENCE_MAX_AGE_MS$1: number;
|
|
52
52
|
/** Share of the counted output credited to a repeat: only under deterministic sampling, on a catalog model that does not reason and honors it, when the call that ran carried no hidden reasoning. */
|
|
53
|
-
declare const REFERENCE_OUTPUT_SHARE = 0.95;
|
|
53
|
+
declare const REFERENCE_OUTPUT_SHARE$1 = 0.95;
|
|
54
54
|
/** Input tokens deducted per piece the layer inserted in the call that ran: a message, the wrapper around a native output schema, or half of the empty parameters given to a tool that had none. */
|
|
55
|
-
declare const REFERENCE_MESSAGE_ALLOWANCE = 8;
|
|
55
|
+
declare const REFERENCE_MESSAGE_ALLOWANCE$1 = 8;
|
|
56
56
|
/**
|
|
57
57
|
* Why an avoided call (a cache or coalesced hit) could not be valued by
|
|
58
58
|
* reference, and so stays `estimated`.
|
|
@@ -102,7 +102,7 @@ interface ReferenceCredit {
|
|
|
102
102
|
/** Fraction of the standard price applied: 1, or the discounted tier the call ran on or this request declared. */
|
|
103
103
|
tierFactor: number;
|
|
104
104
|
}
|
|
105
|
-
declare class SavingsLedger {
|
|
105
|
+
declare class SavingsLedger$1 {
|
|
106
106
|
avoidedLlm: number;
|
|
107
107
|
baselineLlm: number;
|
|
108
108
|
actualLlm: number;
|
|
@@ -125,6 +125,12 @@ declare class SavingsLedger {
|
|
|
125
125
|
cacheWritePremiumUsd: number;
|
|
126
126
|
/** Provider-initiated cache-write premium, priced in USD. Adds to baseline and `actual` alike. */
|
|
127
127
|
providerCacheWritePremiumUsd: number;
|
|
128
|
+
/** Cache-write tokens of the served call, every TTL. Read only for `report.nativeSavings`. */
|
|
129
|
+
nativeCacheWriteInput: number;
|
|
130
|
+
/** The one-hour part of `nativeCacheWriteInput`. */
|
|
131
|
+
nativeCacheWrite1hInput: number;
|
|
132
|
+
/** Whether the layer placed the cache breakpoint on the served call; `null` when unknown. */
|
|
133
|
+
nativeCacheMarkedByLayer: boolean | null;
|
|
128
134
|
/** Cuenta LOCAL del prompt que de verdad se envió al proveedor. */
|
|
129
135
|
sentInputLocal: number;
|
|
130
136
|
/** Tokens que la capa quitó de ese prompt, en cuenta LOCAL. */
|
|
@@ -230,6 +236,8 @@ declare class SavingsLedger {
|
|
|
230
236
|
compress(originalTokens: number, compressedTokens: number): void;
|
|
231
237
|
/** Ledger 4: tokens still present but billed/processed as provider-cached. */
|
|
232
238
|
providerCached(tokens: number): void;
|
|
239
|
+
/** Record the served call's cache writes for `report.nativeSavings`. Never priced into `estimateCost`. */
|
|
240
|
+
nativeCacheWrite(tokens: number, tokens1h: number): void;
|
|
233
241
|
/** Record the premium for `tokens` of cache write the provider bills at `multiplier`x on its own. */
|
|
234
242
|
providerCacheWritePremium(tokens: number, multiplier: number, price: CostModel): void;
|
|
235
243
|
/** Input tokens of calls the provider documents as not billed; already included in `actualInput`. */
|
|
@@ -268,6 +276,8 @@ declare class SavingsLedger {
|
|
|
268
276
|
baselineEstimate: number;
|
|
269
277
|
actual: number;
|
|
270
278
|
netSavings: number;
|
|
279
|
+
netSavingsRatio: number;
|
|
280
|
+
netSavingsUsd: number;
|
|
271
281
|
basis: CostBasis;
|
|
272
282
|
};
|
|
273
283
|
}
|
|
@@ -293,8 +303,12 @@ declare class SavingsLedger {
|
|
|
293
303
|
* discounts, negotiated rates or a different region sets their own and this
|
|
294
304
|
* catalogue stays out of the way.
|
|
295
305
|
*/
|
|
296
|
-
/**
|
|
297
|
-
|
|
306
|
+
/**
|
|
307
|
+
* Version of this price catalogue: the UTC day its content last changed (rows,
|
|
308
|
+
* announced price steps, cache-write premiums, tier rates). Two computations
|
|
309
|
+
* citing the same version were priced with the same content.
|
|
310
|
+
*/
|
|
311
|
+
declare const PRECIOS_AL_DIA$1 = "2026-09-29";
|
|
298
312
|
/**
|
|
299
313
|
* Key = the model id as the provider publishes it, without a vendor prefix.
|
|
300
314
|
* Lookup tries the exact id, then the id without its provider prefix, then the
|
|
@@ -305,7 +319,7 @@ declare const PRECIOS_AL_DIA = "2026-09-27";
|
|
|
305
319
|
* provider has already announced is applied by {@link precioDeLista} from its
|
|
306
320
|
* effective date, so a request is always priced at the rate of its own day.
|
|
307
321
|
*/
|
|
308
|
-
declare const CATALOGO: Readonly<Record<string, CostModel>>;
|
|
322
|
+
declare const CATALOGO$1: Readonly<Record<string, CostModel>>;
|
|
309
323
|
/**
|
|
310
324
|
* The list price for a model on the day of the request, or `undefined` when
|
|
311
325
|
* the catalogue has no price for it in force that day.
|
|
@@ -315,7 +329,7 @@ declare const CATALOGO: Readonly<Record<string, CostModel>>;
|
|
|
315
329
|
* Prices resolve per UTC day, so a price change the provider has announced
|
|
316
330
|
* applies from its effective date.
|
|
317
331
|
*/
|
|
318
|
-
declare function precioDeLista(model: string, at?: Date | number): CostModel | undefined;
|
|
332
|
+
declare function precioDeLista$1(model: string, at?: Date | number): CostModel | undefined;
|
|
319
333
|
|
|
320
334
|
/**
|
|
321
335
|
* The version the SDK reports for itself.
|
|
@@ -325,7 +339,7 @@ declare function precioDeLista(model: string, at?: Date | number): CostModel | u
|
|
|
325
339
|
* on the customer's machine. `test/version-declarada.test.ts` ties this
|
|
326
340
|
* constant to package.json so the two can never drift.
|
|
327
341
|
*/
|
|
328
|
-
declare const BV_SALA_VERSION = "0.4.
|
|
342
|
+
declare const BV_SALA_VERSION = "0.4.34";
|
|
329
343
|
|
|
330
344
|
/**
|
|
331
345
|
* Environment-agnostic UUID generation.
|
|
@@ -335,7 +349,7 @@ declare const BV_SALA_VERSION = "0.4.32";
|
|
|
335
349
|
* Deno and edge runtimes) and fall back to a v4-shaped id when it is absent, so
|
|
336
350
|
* BV-SALA runs everywhere without a `node:crypto` import that breaks bundlers.
|
|
337
351
|
*/
|
|
338
|
-
declare function randomId(): string;
|
|
352
|
+
declare function randomId$1(): string;
|
|
339
353
|
|
|
340
354
|
/** How the layer served a request that is eligible for a verification check. */
|
|
341
355
|
type VerificationStratum =
|
|
@@ -781,8 +795,12 @@ interface SavingsToggles {
|
|
|
781
795
|
* When your catalogue declares `risk`, write and destructive tools are still withheld
|
|
782
796
|
* from requests the router does not classify as actions, as with the selector. Each
|
|
783
797
|
* search is a short extra step inside the same call, and the definitions it loads are
|
|
784
|
-
* billed as normal input.
|
|
785
|
-
*
|
|
798
|
+
* billed as normal input. Across turns, append the assistant turn with its
|
|
799
|
+
* `toolCalls` (ids as returned) before the tool results: the adapter then sends that
|
|
800
|
+
* turn's search results back with it, so the model calls the tools it already found
|
|
801
|
+
* without searching again. It remembers them in memory, per adapter instance and
|
|
802
|
+
* bounded; a turn it no longer remembers (another process, say) goes out without them
|
|
803
|
+
* and the model searches again.
|
|
786
804
|
*/
|
|
787
805
|
toolSearch?: ToolSearchMode | ToolSearchOptions;
|
|
788
806
|
/**
|
|
@@ -1183,8 +1201,30 @@ interface SavingsResult<T = unknown> {
|
|
|
1183
1201
|
* Por qué paró de generar el modelo (`"stop"`, `"length"`, `"tool_calls"`, …).
|
|
1184
1202
|
* Presente cuando la respuesta viene del proveedor; ausente en los atajos
|
|
1185
1203
|
* (caché/resolver), que solo sirven respuestas finales completas.
|
|
1204
|
+
*
|
|
1205
|
+
* In 0.5 this becomes a CLOSED set — `"stop"`, `"length"`, `"tool_calls"`,
|
|
1206
|
+
* `"content_filter"` or `"other"` — and the provider's own value (for example
|
|
1207
|
+
* `"stop_sequence"`, `"pause_turn"` or `"content_filter: OTHER"`) moves to
|
|
1208
|
+
* `finishReasonDetail`. Compare against those five values only; see the 0.5
|
|
1209
|
+
* migration guide.
|
|
1186
1210
|
*/
|
|
1187
1211
|
finishReason?: string;
|
|
1212
|
+
/**
|
|
1213
|
+
* The provider's own reason behind `finishReason`, when it gave one. Present
|
|
1214
|
+
* only on answers the provider returned, and only with a non-empty reason:
|
|
1215
|
+
*
|
|
1216
|
+
* - Gemini (OpenAI-compatible endpoint): a filtered answer stops with
|
|
1217
|
+
* `finish_reason: "content_filter: OTHER"` (or `PROHIBITED_CONTENT`,
|
|
1218
|
+
* `SAFETY`…); it arrives as `finishReason: "content_filter"` and
|
|
1219
|
+
* `finishReasonDetail: "OTHER"`.
|
|
1220
|
+
* - Anthropic: a refusal (`stop_reason: "refusal"`) arrives as `finishReason:
|
|
1221
|
+
* "content_filter"` and `finishReasonDetail` set to `stop_details.category`
|
|
1222
|
+
* (for example `"cyber"` or `"bio"`).
|
|
1223
|
+
*
|
|
1224
|
+
* OpenAI's Structured Outputs refusal message travels in `refusal` instead.
|
|
1225
|
+
* Informational: it changes neither what is billed nor what is credited.
|
|
1226
|
+
*/
|
|
1227
|
+
finishReasonDetail?: string;
|
|
1188
1228
|
/**
|
|
1189
1229
|
* The refusal message the model returned instead of an answer (OpenAI
|
|
1190
1230
|
* Structured Outputs: `message.refusal`, with `finish_reason: "stop"` and no
|
|
@@ -1378,8 +1418,21 @@ interface QualityRepairCheck {
|
|
|
1378
1418
|
interface QualityTruncationCheck {
|
|
1379
1419
|
/** True when the provider reported `finishReason: "length"`. A truncated answer is never cached. */
|
|
1380
1420
|
truncated: boolean;
|
|
1381
|
-
/**
|
|
1421
|
+
/**
|
|
1422
|
+
* Why the provider stopped, as `SavingsResult.finishReason` reports it;
|
|
1423
|
+
* absent when it reported none.
|
|
1424
|
+
*
|
|
1425
|
+
* In 0.5 this becomes the same CLOSED set as `SavingsResult.finishReason` —
|
|
1426
|
+
* `"stop"`, `"length"`, `"tool_calls"`, `"content_filter"` or `"other"` — and
|
|
1427
|
+
* the provider's own value moves to {@link finishReasonDetail}. Compare
|
|
1428
|
+
* against those five values only; see the 0.5 migration guide.
|
|
1429
|
+
*/
|
|
1382
1430
|
finishReason?: string;
|
|
1431
|
+
/**
|
|
1432
|
+
* The provider's own reason behind `finishReason`, when it gave one: the same
|
|
1433
|
+
* value as `SavingsResult.finishReasonDetail` for the answer that was served.
|
|
1434
|
+
*/
|
|
1435
|
+
finishReasonDetail?: string;
|
|
1383
1436
|
/**
|
|
1384
1437
|
* Whether you set the limit (`maxOutputTokens` on the request or on
|
|
1385
1438
|
* `response`). When false, any
|
|
@@ -1491,6 +1544,64 @@ interface QualityLedger {
|
|
|
1491
1544
|
/** Present when `savings.modelCascade` is not `"off"`. */
|
|
1492
1545
|
cascade?: QualityCascadeCheck;
|
|
1493
1546
|
}
|
|
1547
|
+
/**
|
|
1548
|
+
* The provider's native prompt-cache saving on the call that produced the
|
|
1549
|
+
* answer: what the provider's own cache took off the invoice, net of the
|
|
1550
|
+
* cache-write premium the provider billed on that same call.
|
|
1551
|
+
*
|
|
1552
|
+
* `netUsd = readDiscountUsd − writePremiumUsd`, where
|
|
1553
|
+
* `readDiscountUsd = cacheReadTokens / 1000 × (inputPer1k − cachedInputPer1k)` and
|
|
1554
|
+
* `writePremiumUsd` is the write tokens at `inputPer1k × (multiplier − 1)`
|
|
1555
|
+
* (Anthropic 1.25× for 5 minutes and 2× for one hour; OpenAI 1.25× from
|
|
1556
|
+
* gpt-5.6 on, 1× before; Gemini 1×). Every input is in this block, so it can be
|
|
1557
|
+
* recomputed without trusting the layer. `netUsd` can be negative: a cold
|
|
1558
|
+
* write pays the premium before any read.
|
|
1559
|
+
*
|
|
1560
|
+
* It is SEPARATE on purpose. The layer can place the breakpoint (Anthropic
|
|
1561
|
+
* `cache_control`), route (OpenAI `prompt_cache_key`) or keep the prefix
|
|
1562
|
+
* stable, but the discount is billed by the provider and much of it would be
|
|
1563
|
+
* there without the layer, so it is never credited as the layer's saving:
|
|
1564
|
+
* it is not in `cost.netSavings`, not in `cost.baselineEstimate`, and not in
|
|
1565
|
+
* any commission base.
|
|
1566
|
+
*/
|
|
1567
|
+
interface NativeSavingsReport {
|
|
1568
|
+
/** Who billed the cache, inferred from the model id. */
|
|
1569
|
+
provider: "anthropic" | "openai" | "google" | "unknown";
|
|
1570
|
+
/**
|
|
1571
|
+
* How that provider caches: `explicit` (Anthropic, `cache_control`
|
|
1572
|
+
* breakpoints), `automatic` (OpenAI, prefix cache with no marking) or
|
|
1573
|
+
* `implicit` (Gemini implicit caching).
|
|
1574
|
+
*/
|
|
1575
|
+
mechanism: "explicit" | "automatic" | "implicit" | "unknown";
|
|
1576
|
+
/** True when the layer placed the cache breakpoint on the call that ran. Absent where the layer does not know. */
|
|
1577
|
+
layerMarked?: boolean;
|
|
1578
|
+
/** Input tokens the provider served from its cache on this call (its own counter). */
|
|
1579
|
+
cacheReadTokens: number;
|
|
1580
|
+
/** Input tokens the provider billed as cache writes on this call (its own counter, every TTL). */
|
|
1581
|
+
cacheWriteTokens: number;
|
|
1582
|
+
/** The part of `cacheWriteTokens` written with a one-hour TTL. */
|
|
1583
|
+
cacheWrite1hTokens: number;
|
|
1584
|
+
/** Input rate applied, per 1K tokens. */
|
|
1585
|
+
inputPer1k: number;
|
|
1586
|
+
/** Cache-read rate applied, per 1K tokens. */
|
|
1587
|
+
cachedInputPer1k: number;
|
|
1588
|
+
/** Write multiplier applied to five-minute (or untyped) writes. */
|
|
1589
|
+
writeMultiplier: number;
|
|
1590
|
+
/** Write multiplier applied to one-hour writes. */
|
|
1591
|
+
write1hMultiplier: number;
|
|
1592
|
+
/** What the cache reads saved against the input rate, USD. */
|
|
1593
|
+
readDiscountUsd: number;
|
|
1594
|
+
/** The premium the provider billed for the cache writes, USD. */
|
|
1595
|
+
writePremiumUsd: number;
|
|
1596
|
+
/** `readDiscountUsd − writePremiumUsd`, USD. Can be negative. */
|
|
1597
|
+
netUsd: number;
|
|
1598
|
+
/**
|
|
1599
|
+
* `measured`: the provider's own counter at list price. `unmeasured`: the
|
|
1600
|
+
* counter was incomplete or there is no cache-read price for the model, and
|
|
1601
|
+
* every USD figure is 0.
|
|
1602
|
+
*/
|
|
1603
|
+
basis: "measured" | "unmeasured";
|
|
1604
|
+
}
|
|
1494
1605
|
interface SavingsReport {
|
|
1495
1606
|
requestId: string;
|
|
1496
1607
|
/**
|
|
@@ -1613,6 +1724,17 @@ interface SavingsReport {
|
|
|
1613
1724
|
* `cacheBreakpoints: "auto"` switched this request to explicit mode.
|
|
1614
1725
|
*/
|
|
1615
1726
|
cacheWrites?: CacheWriteReport;
|
|
1727
|
+
/**
|
|
1728
|
+
* The provider's OWN prompt-cache discount on this call, shown apart. Present
|
|
1729
|
+
* only when a call ran and the provider reported cache reads or writes.
|
|
1730
|
+
*
|
|
1731
|
+
* It is not the layer's saving and it is never part of `cost.netSavings`,
|
|
1732
|
+
* `cost.baselineEstimate`, `basis: "reference"` or the commission base: the
|
|
1733
|
+
* discount is the provider's, and `cost` prices cached tokens at the cached
|
|
1734
|
+
* rate on both sides for exactly that reason. It exists so the report adds up
|
|
1735
|
+
* to your invoice. See {@link NativeSavingsReport}.
|
|
1736
|
+
*/
|
|
1737
|
+
nativeSavings?: NativeSavingsReport;
|
|
1616
1738
|
/** How a streamed request was delivered. Present only on results of `generateStream`. */
|
|
1617
1739
|
streaming?: StreamingReport;
|
|
1618
1740
|
/**
|
|
@@ -1636,7 +1758,29 @@ interface SavingsReport {
|
|
|
1636
1758
|
cost: {
|
|
1637
1759
|
baselineEstimate: number;
|
|
1638
1760
|
actual: number;
|
|
1761
|
+
/**
|
|
1762
|
+
* A RATIO, not money: `1 - actual / baselineEstimate`, rounded to six
|
|
1763
|
+
* decimals (0 when nothing was saved, negative when the request cost more).
|
|
1764
|
+
* Do not sum it across requests: it is a ratio, not dollars.
|
|
1765
|
+
*
|
|
1766
|
+
* @deprecated Since 0.4.33, read {@link netSavingsRatio} (the same value) or
|
|
1767
|
+
* {@link netSavingsUsd} (the saving in USD). Removed in 0.5: see the 0.5
|
|
1768
|
+
* migration guide.
|
|
1769
|
+
*/
|
|
1639
1770
|
netSavings: number;
|
|
1771
|
+
/**
|
|
1772
|
+
* The saving as a RATIO of the baseline: `1 - actual / baselineEstimate`,
|
|
1773
|
+
* rounded to six decimals (0 when nothing was saved or there is no baseline,
|
|
1774
|
+
* negative when the request cost more). Do not sum it across requests: sum
|
|
1775
|
+
* {@link netSavingsUsd}.
|
|
1776
|
+
*/
|
|
1777
|
+
netSavingsRatio: number;
|
|
1778
|
+
/**
|
|
1779
|
+
* The saving in USD: `baselineEstimate - actual` (negative when the request
|
|
1780
|
+
* cost more). Sum it only within one `basis`: measured and estimated money
|
|
1781
|
+
* are never added together.
|
|
1782
|
+
*/
|
|
1783
|
+
netSavingsUsd: number;
|
|
1640
1784
|
/**
|
|
1641
1785
|
* Where the baseline comes from. It is what separates measured money from
|
|
1642
1786
|
* estimated money.
|
|
@@ -1694,6 +1838,12 @@ interface SavingsReport {
|
|
|
1694
1838
|
preprocessing: number;
|
|
1695
1839
|
provider: number;
|
|
1696
1840
|
};
|
|
1841
|
+
/**
|
|
1842
|
+
* Present only when the layer runs on the free «Measure» license (shadow
|
|
1843
|
+
* mode): what the levers would have saved on this request. Nothing was
|
|
1844
|
+
* applied — `cost` is this call's measured spend with no saving claimed.
|
|
1845
|
+
*/
|
|
1846
|
+
measure?: MeasureReport;
|
|
1697
1847
|
/** Ordered pipeline decision breadcrumbs, for debugging and audit. */
|
|
1698
1848
|
traces: TraceEvent[];
|
|
1699
1849
|
}
|
|
@@ -1744,6 +1894,50 @@ interface LicenseGate {
|
|
|
1744
1894
|
* caller; without it, the generic message for that status.
|
|
1745
1895
|
*/
|
|
1746
1896
|
reason?(): string | undefined;
|
|
1897
|
+
/**
|
|
1898
|
+
* The plan of the license in force, when there is one. `"measure"` (the free
|
|
1899
|
+
* «Measure» license) puts the layer in SHADOW MODE: the request goes to the
|
|
1900
|
+
* provider exactly as you built it, nothing is served from any cache, and
|
|
1901
|
+
* `report.measure` says what the levers would have saved. Optional because a
|
|
1902
|
+
* gate is implemented by the caller; without it, the layer is not in shadow.
|
|
1903
|
+
*/
|
|
1904
|
+
plan?(): string | undefined;
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* What a layer running on the free «Measure» license would have saved on this
|
|
1908
|
+
* request. Present ONLY in shadow mode. Nothing here was applied: the request
|
|
1909
|
+
* went to your provider untouched and nothing was served from a cache.
|
|
1910
|
+
*
|
|
1911
|
+
* Every figure is HYPOTHETICAL (`basis: "shadow"`): it is never part of
|
|
1912
|
+
* `cost.baselineEstimate`, `cost.actual` or `cost.netSavings`, never in any
|
|
1913
|
+
* commission base, and never added to measured money.
|
|
1914
|
+
*/
|
|
1915
|
+
interface MeasureReport {
|
|
1916
|
+
mode: "shadow";
|
|
1917
|
+
/** Always false: in shadow mode no lever changes the request or avoids a call. */
|
|
1918
|
+
applied: false;
|
|
1919
|
+
wouldHaveSaved: {
|
|
1920
|
+
/** USD this request would not have cost with the simulated levers on. */
|
|
1921
|
+
usd: number;
|
|
1922
|
+
basis: "shadow";
|
|
1923
|
+
/**
|
|
1924
|
+
* Which lever would have avoided the call entirely, valued with THIS call's
|
|
1925
|
+
* provider counter (`cost.actual`):
|
|
1926
|
+
* · `exact-repeat` — a byte-identical, cacheable request already ran
|
|
1927
|
+
* in this process within the exact-cache TTL;
|
|
1928
|
+
* · `in-flight-duplicate`— an identical request was in flight at the same
|
|
1929
|
+
* time and would have been coalesced.
|
|
1930
|
+
* `null` when no simulated lever would have avoided it.
|
|
1931
|
+
*/
|
|
1932
|
+
avoidedCall: "exact-repeat" | "in-flight-duplicate" | null;
|
|
1933
|
+
};
|
|
1934
|
+
/**
|
|
1935
|
+
* Levers this shadow does NOT simulate, so `wouldHaveSaved` is a LOWER bound:
|
|
1936
|
+
* they need a model call, an embedding, or a paid entitlement to estimate.
|
|
1937
|
+
*/
|
|
1938
|
+
notSimulated: string[];
|
|
1939
|
+
/** Where to turn the levers on. */
|
|
1940
|
+
upgradeUrl: string;
|
|
1747
1941
|
}
|
|
1748
1942
|
interface TraceEvent {
|
|
1749
1943
|
stage: string;
|
|
@@ -1911,7 +2105,7 @@ declare class InMemoryExactCache implements ExactCache {
|
|
|
1911
2105
|
* requests that mean the same thing must canonicalize identically, and two
|
|
1912
2106
|
* requests that differ in any way that could change the answer must not.
|
|
1913
2107
|
*/
|
|
1914
|
-
interface CanonicalRequest {
|
|
2108
|
+
interface CanonicalRequest$1 {
|
|
1915
2109
|
model: string;
|
|
1916
2110
|
modelFamily: string;
|
|
1917
2111
|
messages: ChatMessage[];
|
|
@@ -1976,10 +2170,10 @@ interface CanonicalRequest {
|
|
|
1976
2170
|
* thousands separators, times, dates, units, negations, math operators and any
|
|
1977
2171
|
* combining mark outside the Latin alphabet.
|
|
1978
2172
|
*/
|
|
1979
|
-
declare function normalizeText(text: string): string;
|
|
1980
|
-
declare function sha256(input: string): string;
|
|
2173
|
+
declare function normalizeText$1(text: string): string;
|
|
2174
|
+
declare function sha256$1(input: string): string;
|
|
1981
2175
|
/** Stable JSON stringify with sorted keys so hashes are order-independent. */
|
|
1982
|
-
declare function stableStringify(value: unknown): string;
|
|
2176
|
+
declare function stableStringify$1(value: unknown): string;
|
|
1983
2177
|
/**
|
|
1984
2178
|
* The version-and-size-independent family of a model id.
|
|
1985
2179
|
*
|
|
@@ -1987,8 +2181,8 @@ declare function stableStringify(value: unknown): string;
|
|
|
1987
2181
|
* ANSWER, which is not always the one the caller named. Deriving the family a
|
|
1988
2182
|
* second time somewhere else is how two rulers start to disagree.
|
|
1989
2183
|
*/
|
|
1990
|
-
declare function modelFamilyOf(model: string): string;
|
|
1991
|
-
declare function canonicalize(request: SavingsRequest): CanonicalRequest;
|
|
2184
|
+
declare function modelFamilyOf$1(model: string): string;
|
|
2185
|
+
declare function canonicalize$1(request: SavingsRequest): CanonicalRequest$1;
|
|
1992
2186
|
|
|
1993
2187
|
/**
|
|
1994
2188
|
* Thrown by `importCalibration` / `exportCalibration` when a calibration state
|
|
@@ -2142,7 +2336,7 @@ interface SemanticCalibrationStatus {
|
|
|
2142
2336
|
nextTestAt?: number;
|
|
2143
2337
|
}
|
|
2144
2338
|
/** Default {@link AnswerJudge}: the stored answer counts as right only if it is the same answer. */
|
|
2145
|
-
declare function sameAnswer(stored: CachedAnswer, fresh: CachedAnswer): boolean;
|
|
2339
|
+
declare function sameAnswer$1(stored: CachedAnswer, fresh: CachedAnswer): boolean;
|
|
2146
2340
|
/**
|
|
2147
2341
|
* Certifies an acceptance floor from labels you already have (your own traffic,
|
|
2148
2342
|
* or a labeled set scored with your embedder), with the same test the cache
|
|
@@ -2323,13 +2517,13 @@ interface SemanticCacheOptions {
|
|
|
2323
2517
|
*/
|
|
2324
2518
|
calibration?: SemanticCalibrationOptions;
|
|
2325
2519
|
}
|
|
2326
|
-
declare function cosine(a: number[], b: number[]): number;
|
|
2327
|
-
declare function numericTokens(s: string): string[];
|
|
2328
|
-
declare function multisetEqual(a: string[], b: string[]): boolean;
|
|
2329
|
-
declare function words(s: string): string[];
|
|
2330
|
-
declare function negationCount(tokens: string[]): number;
|
|
2520
|
+
declare function cosine$1(a: number[], b: number[]): number;
|
|
2521
|
+
declare function numericTokens$1(s: string): string[];
|
|
2522
|
+
declare function multisetEqual$1(a: string[], b: string[]): boolean;
|
|
2523
|
+
declare function words$1(s: string): string[];
|
|
2524
|
+
declare function negationCount$1(tokens: string[]): number;
|
|
2331
2525
|
/** True when two normalized queries agree on the facts an embedding tends to blur. */
|
|
2332
|
-
declare function keyTokensMatch(a: string, b: string): boolean;
|
|
2526
|
+
declare function keyTokensMatch$1(a: string, b: string): boolean;
|
|
2333
2527
|
/**
|
|
2334
2528
|
* In-memory reference implementation. A production build would back this with a
|
|
2335
2529
|
* real vector store and metadata filters pushed down
|
|
@@ -2363,7 +2557,7 @@ declare class InMemorySemanticCache {
|
|
|
2363
2557
|
* and labels nothing: without {@link lookup} and {@link observe} (the layer
|
|
2364
2558
|
* calls both) the calibration never gets a label and never certifies.
|
|
2365
2559
|
*/
|
|
2366
|
-
find(c: CanonicalRequest): Promise<SemanticHit | null>;
|
|
2560
|
+
find(c: CanonicalRequest$1): Promise<SemanticHit | null>;
|
|
2367
2561
|
/**
|
|
2368
2562
|
* The best candidate that passes every hard filter, the similarity floor and
|
|
2369
2563
|
* the fact guard. With `conAceptacion`, also the confidence floor (the path
|
|
@@ -2378,7 +2572,7 @@ declare class InMemorySemanticCache {
|
|
|
2378
2572
|
* `agentic` picks the traffic segment: calibrations are kept apart for
|
|
2379
2573
|
* single-shot and agentic requests.
|
|
2380
2574
|
*/
|
|
2381
|
-
lookup(c: CanonicalRequest, opts?: {
|
|
2575
|
+
lookup(c: CanonicalRequest$1, opts?: {
|
|
2382
2576
|
agentic?: boolean;
|
|
2383
2577
|
}): Promise<SemanticLookup>;
|
|
2384
2578
|
/**
|
|
@@ -2426,7 +2620,7 @@ declare class InMemorySemanticCache {
|
|
|
2426
2620
|
importCalibration(state: SemanticCalibrationState | string | unknown): void;
|
|
2427
2621
|
private identidad;
|
|
2428
2622
|
private estadoDe;
|
|
2429
|
-
store(c: CanonicalRequest, answer: CachedAnswer): Promise<void>;
|
|
2623
|
+
store(c: CanonicalRequest$1, answer: CachedAnswer): Promise<void>;
|
|
2430
2624
|
/** Drop every record for a knowledge epoch (invalidation on re-index). */
|
|
2431
2625
|
invalidateEpoch(knowledgeEpoch: string): number;
|
|
2432
2626
|
get size(): number;
|
|
@@ -2529,12 +2723,12 @@ interface ResolverResult {
|
|
|
2529
2723
|
}
|
|
2530
2724
|
interface DeterministicResolver {
|
|
2531
2725
|
readonly name: string;
|
|
2532
|
-
try(c: CanonicalRequest): ResolverResult | null;
|
|
2726
|
+
try(c: CanonicalRequest$1): ResolverResult | null;
|
|
2533
2727
|
}
|
|
2534
2728
|
declare class ResolverRegistry {
|
|
2535
2729
|
private readonly resolvers;
|
|
2536
2730
|
register(resolver: DeterministicResolver): this;
|
|
2537
|
-
try(c: CanonicalRequest): ResolverResult | null;
|
|
2731
|
+
try(c: CanonicalRequest$1): ResolverResult | null;
|
|
2538
2732
|
get size(): number;
|
|
2539
2733
|
}
|
|
2540
2734
|
/**
|
|
@@ -2544,7 +2738,7 @@ declare class ResolverRegistry {
|
|
|
2544
2738
|
*/
|
|
2545
2739
|
declare const arithmeticResolver: DeterministicResolver;
|
|
2546
2740
|
/** Shunting-yard evaluation of a numeric expression. Returns null on any parse issue. */
|
|
2547
|
-
declare function evalArithmetic(expr: string): number | null;
|
|
2741
|
+
declare function evalArithmetic$1(expr: string): number | null;
|
|
2548
2742
|
/** A registry seeded with the built-in safe resolvers. */
|
|
2549
2743
|
declare function createDefaultResolvers(): ResolverRegistry;
|
|
2550
2744
|
|
|
@@ -2585,7 +2779,7 @@ declare class ExecutionRouter {
|
|
|
2585
2779
|
classifier?: LocalClassifier;
|
|
2586
2780
|
maxRounds?: number;
|
|
2587
2781
|
});
|
|
2588
|
-
classify(c: CanonicalRequest): RouteDecision;
|
|
2782
|
+
classify(c: CanonicalRequest$1): RouteDecision;
|
|
2589
2783
|
}
|
|
2590
2784
|
|
|
2591
2785
|
/**
|
|
@@ -2614,17 +2808,22 @@ interface ToolSelection {
|
|
|
2614
2808
|
}
|
|
2615
2809
|
interface ToolSelectorOptions {
|
|
2616
2810
|
/**
|
|
2617
|
-
*
|
|
2618
|
-
*
|
|
2619
|
-
*
|
|
2620
|
-
*
|
|
2621
|
-
* `intents` and
|
|
2622
|
-
*
|
|
2623
|
-
*
|
|
2624
|
-
*
|
|
2625
|
-
*
|
|
2626
|
-
*
|
|
2627
|
-
*
|
|
2811
|
+
* Cap on the tools the selector keeps by relevance. Unset (the default since
|
|
2812
|
+
* 0.4.33), there is NO cap and NO relevance pruning: every tool the request
|
|
2813
|
+
* may use reaches the provider, and the layer credits nothing for the tool
|
|
2814
|
+
* block. Set it to opt in to pruning a TYPED catalogue (tools that declare
|
|
2815
|
+
* `intents` and/or `risk`, with the router on) down to the `maxTools` most
|
|
2816
|
+
* relevant ones — up to 0.4.32 that was the default, with 8.
|
|
2817
|
+
*
|
|
2818
|
+
* What is never affected by this option: write and destructive tools are
|
|
2819
|
+
* still withheld from a request the router does not classify as an action
|
|
2820
|
+
* (that gate is about safety, not size), and a catalogue that declares no
|
|
2821
|
+
* `intents` and no `risk` (the usual case: MCP and OpenAI tool lists), or any
|
|
2822
|
+
* request with `savings: { router: false }`, goes to the provider WHOLE,
|
|
2823
|
+
* exactly as the caller sent it. Cutting blind left the model unable to call
|
|
2824
|
+
* the rest (on BFCL multi-turn, gpt-4o-mini hit the reference call 8/10 times
|
|
2825
|
+
* directly and 1/10 through the layer). Whenever the selector does leave a
|
|
2826
|
+
* tool out, the report's `tool-selector` trace lists it and the SDK warns
|
|
2628
2827
|
* (once per process, silenced by `silenceWarnings`).
|
|
2629
2828
|
*/
|
|
2630
2829
|
maxTools?: number;
|
|
@@ -2813,7 +3012,7 @@ interface ConstraintPlan {
|
|
|
2813
3012
|
* backend which *claims* support actually enforces every constraint — declared
|
|
2814
3013
|
* support and empirical coverage are not the same thing.
|
|
2815
3014
|
*/
|
|
2816
|
-
declare function resolveConstraintBackend(model: string, schema: JsonSchema, backends: ConstraintBackend[]): ConstraintPlan;
|
|
3015
|
+
declare function resolveConstraintBackend$1(model: string, schema: JsonSchema, backends: ConstraintBackend[]): ConstraintPlan;
|
|
2817
3016
|
/** A permissive backend used when the provider validates structured output natively. */
|
|
2818
3017
|
declare function providerNativeBackend(isSupported?: (model: string, schema: JsonSchema) => boolean): ConstraintBackend;
|
|
2819
3018
|
|
|
@@ -2875,7 +3074,7 @@ interface CompressionPolicyInput {
|
|
|
2875
3074
|
* Here we model the token side; latency/quality penalties are folded into
|
|
2876
3075
|
* `compressorCostTokens` and `minimumNetTokens` by the caller.
|
|
2877
3076
|
*/
|
|
2878
|
-
declare function shouldCompress(input: CompressionPolicyInput): {
|
|
3077
|
+
declare function shouldCompress$1(input: CompressionPolicyInput): {
|
|
2879
3078
|
compress: boolean;
|
|
2880
3079
|
reason: string;
|
|
2881
3080
|
};
|
|
@@ -2886,12 +3085,14 @@ declare function shouldCompress(input: CompressionPolicyInput): {
|
|
|
2886
3085
|
* back to the ORIGINAL text — a compressor that drops a negation or a number is
|
|
2887
3086
|
* worse than no compressor at all.
|
|
2888
3087
|
*/
|
|
2889
|
-
declare function withProtectedSpans(inner: Compressor): Compressor;
|
|
3088
|
+
declare function withProtectedSpans$1(inner: Compressor): Compressor;
|
|
2890
3089
|
/** No-op compressor: the safe default until a real compressor sidecar is wired in. */
|
|
2891
3090
|
declare const noopCompressor: Compressor;
|
|
2892
3091
|
/**
|
|
2893
3092
|
* Did the compression keep the facts that must not change? Verifies the RESULT —
|
|
2894
3093
|
* number/date multiset and negation parity — not the compressor's own claim.
|
|
3094
|
+
*
|
|
3095
|
+
* @deprecated Internal check of the compression stage; leaves the public API in 0.5.
|
|
2895
3096
|
*/
|
|
2896
3097
|
declare function compresionFiel(original: string, comprimido: string): boolean;
|
|
2897
3098
|
|
|
@@ -3045,13 +3246,13 @@ interface RetrievalOutcome {
|
|
|
3045
3246
|
keptCount: number;
|
|
3046
3247
|
}
|
|
3047
3248
|
/** Remove exact and near-duplicate docs by normalized text / hash. */
|
|
3048
|
-
declare function dedupe(docs: EvidenceDoc[]): EvidenceDoc[];
|
|
3249
|
+
declare function dedupe$1(docs: EvidenceDoc[]): EvidenceDoc[];
|
|
3049
3250
|
/**
|
|
3050
3251
|
* Adaptive-k: choose how many documents to keep based on the score distribution
|
|
3051
3252
|
* rather than a fixed cutoff. When the top document dominates, keep fewer; when
|
|
3052
3253
|
* scores are flat, keep up to the cap. This directly trims input tokens.
|
|
3053
3254
|
*/
|
|
3054
|
-
declare function adaptiveK(docs: EvidenceDoc[], opts?: {
|
|
3255
|
+
declare function adaptiveK$1(docs: EvidenceDoc[], opts?: {
|
|
3055
3256
|
maxDocuments: number;
|
|
3056
3257
|
minDocuments?: number;
|
|
3057
3258
|
}): EvidenceDoc[];
|
|
@@ -3059,7 +3260,7 @@ declare function adaptiveK(docs: EvidenceDoc[], opts?: {
|
|
|
3059
3260
|
* Execute a retrieval plan. NO_RETRIEVAL / TOOL_ACTION classes retrieve nothing.
|
|
3060
3261
|
* Otherwise: retrieve -> dedupe -> rerank -> adaptive-k, bounded by maxRounds.
|
|
3061
3262
|
*/
|
|
3062
|
-
declare function executeRetrievalPlan(plan: RetrievalPlan, deps: {
|
|
3263
|
+
declare function executeRetrievalPlan$1(plan: RetrievalPlan, deps: {
|
|
3063
3264
|
retriever?: Retriever;
|
|
3064
3265
|
reranker?: Reranker;
|
|
3065
3266
|
}): Promise<RetrievalOutcome>;
|
|
@@ -3271,8 +3472,10 @@ interface ProviderResponse {
|
|
|
3271
3472
|
* OpenAI-compatible endpoint stops a filtered answer with
|
|
3272
3473
|
* `finish_reason: "content_filter: OTHER"` (or `PROHIBITED_CONTENT`,
|
|
3273
3474
|
* `SAFETY`…), which the built-in adapter reports as `finishReason:
|
|
3274
|
-
* "content_filter"` and `finishReasonDetail: "OTHER"`.
|
|
3275
|
-
*
|
|
3475
|
+
* "content_filter"` and `finishReasonDetail: "OTHER"`. Anthropic's refusal
|
|
3476
|
+
* (`stop_reason: "refusal"`) carries its `stop_details.category` here.
|
|
3477
|
+
* Informational: the layer decides on `finishReason` alone, and passes this
|
|
3478
|
+
* on to the caller as `SavingsResult.finishReasonDetail`.
|
|
3276
3479
|
*/
|
|
3277
3480
|
finishReasonDetail?: string;
|
|
3278
3481
|
/**
|
|
@@ -3427,10 +3630,10 @@ interface Provider {
|
|
|
3427
3630
|
* `licenseKey: " "` (an empty environment variable, a blank secret file) used
|
|
3428
3631
|
* to tell the customer their key "does not verify" — there was no key.
|
|
3429
3632
|
*/
|
|
3430
|
-
type LicenseStatus = "active" | "grace" | "expired" | "invalid" | "revoked" | "stale" | "none";
|
|
3633
|
+
type LicenseStatus$1 = "active" | "grace" | "expired" | "invalid" | "revoked" | "stale" | "none";
|
|
3431
3634
|
/** Decoded license token body (mirror of `@bivelio/protocol`'s LicensePayload,
|
|
3432
3635
|
* declared locally so the SDK stays free of a control-plane dependency). */
|
|
3433
|
-
interface LicenseTokenPayload {
|
|
3636
|
+
interface LicenseTokenPayload$1 {
|
|
3434
3637
|
jti: string;
|
|
3435
3638
|
org_id: string;
|
|
3436
3639
|
plan: string;
|
|
@@ -3440,15 +3643,18 @@ interface LicenseTokenPayload {
|
|
|
3440
3643
|
expires_at: number;
|
|
3441
3644
|
grace_days: number;
|
|
3442
3645
|
iss?: string;
|
|
3646
|
+
/** Measure licenses only: the REAL term (see `vigenciaEfectiva` in ./vigencia.ts). */
|
|
3647
|
+
measure_expires_at?: number;
|
|
3648
|
+
measure_grace_days?: number;
|
|
3443
3649
|
}
|
|
3444
|
-
interface ResolvedLicense {
|
|
3445
|
-
status: LicenseStatus;
|
|
3446
|
-
payload?: LicenseTokenPayload;
|
|
3650
|
+
interface ResolvedLicense$1 {
|
|
3651
|
+
status: LicenseStatus$1;
|
|
3652
|
+
payload?: LicenseTokenPayload$1;
|
|
3447
3653
|
reason?: string;
|
|
3448
3654
|
}
|
|
3449
|
-
declare const EMBEDDED_PUBLIC_KEY: string;
|
|
3655
|
+
declare const EMBEDDED_PUBLIC_KEY$1: string;
|
|
3450
3656
|
/** Result of verifying a compact `head.body.sig` token's signature. */
|
|
3451
|
-
interface CompactVerification {
|
|
3657
|
+
interface CompactVerification$1 {
|
|
3452
3658
|
/** True only if the signature is valid for the given public key. */
|
|
3453
3659
|
ok: boolean;
|
|
3454
3660
|
/** Decoded header (present when `ok`), e.g. `{ alg, typ, v }`. */
|
|
@@ -3471,7 +3677,7 @@ interface LicenseKeyset {
|
|
|
3471
3677
|
defaultKid: string;
|
|
3472
3678
|
}
|
|
3473
3679
|
/** Narrow a verification key to a {@link LicenseKeyset} (vs a bare SPKI PEM string). */
|
|
3474
|
-
declare function isKeyset(k: string | LicenseKeyset): k is LicenseKeyset;
|
|
3680
|
+
declare function isKeyset$1(k: string | LicenseKeyset): k is LicenseKeyset;
|
|
3475
3681
|
/**
|
|
3476
3682
|
* Normalize a license key the way it arrives from the real world — ONCE, at the
|
|
3477
3683
|
* entry point, never inside the verifier.
|
|
@@ -3496,7 +3702,7 @@ declare function isKeyset(k: string | LicenseKeyset): k is LicenseKeyset;
|
|
|
3496
3702
|
* Anything INSIDE the key is left alone: an interior space is not wrapping, it
|
|
3497
3703
|
* is a broken key, and {@link licenseKeyShape} reports it as `malformed`.
|
|
3498
3704
|
*/
|
|
3499
|
-
declare function normalizeLicenseKey(raw: string): string;
|
|
3705
|
+
declare function normalizeLicenseKey$1(raw: string): string;
|
|
3500
3706
|
/**
|
|
3501
3707
|
* The SHAPE of an already-normalized key, so the error message can tell apart
|
|
3502
3708
|
* three problems that used to get the same text:
|
|
@@ -3511,9 +3717,9 @@ declare function normalizeLicenseKey(raw: string): string;
|
|
|
3511
3717
|
* It is the SAME shape rule {@link verifyCompactSignature} enforces, so that "has
|
|
3512
3718
|
* the shape" and "verification was attempted" mean the same thing.
|
|
3513
3719
|
*/
|
|
3514
|
-
type LicenseKeyShape = "empty" | "malformed" | "token";
|
|
3720
|
+
type LicenseKeyShape$1 = "empty" | "malformed" | "token";
|
|
3515
3721
|
/** Classify a normalized key. See {@link LicenseKeyShape}. */
|
|
3516
|
-
declare function licenseKeyShape(normalizedKey: string): LicenseKeyShape;
|
|
3722
|
+
declare function licenseKeyShape$1(normalizedKey: string): LicenseKeyShape$1;
|
|
3517
3723
|
/**
|
|
3518
3724
|
* Verify the Ed25519 signature of any BV-SALA compact token
|
|
3519
3725
|
* (`base64url(header).base64url(body).base64url(sig)`, sig over `${head}.${body}`)
|
|
@@ -3530,11 +3736,11 @@ declare function licenseKeyShape(normalizedKey: string): LicenseKeyShape;
|
|
|
3530
3736
|
* the same answer to the same input, always; a caller that wants to tolerate
|
|
3531
3737
|
* wrapping normalizes BEFORE calling.
|
|
3532
3738
|
*/
|
|
3533
|
-
declare function verifyCompactSignature(token: string, publicKey: string | LicenseKeyset): CompactVerification;
|
|
3739
|
+
declare function verifyCompactSignature$1(token: string, publicKey: string | LicenseKeyset): CompactVerification$1;
|
|
3534
3740
|
/** Verify a token's signature and decode its payload. Does not check expiry. */
|
|
3535
|
-
declare function verifyLicenseToken(token: string, publicKey: string | LicenseKeyset): {
|
|
3741
|
+
declare function verifyLicenseToken$1(token: string, publicKey: string | LicenseKeyset): {
|
|
3536
3742
|
signatureValid: boolean;
|
|
3537
|
-
payload?: LicenseTokenPayload;
|
|
3743
|
+
payload?: LicenseTokenPayload$1;
|
|
3538
3744
|
reason?: string;
|
|
3539
3745
|
};
|
|
3540
3746
|
/**
|
|
@@ -3547,11 +3753,11 @@ declare function verifyLicenseToken(token: string, publicKey: string | LicenseKe
|
|
|
3547
3753
|
* expires_at < now <= +grace_days → grace (still entitled)
|
|
3548
3754
|
* now > expires_at + grace_days → expired
|
|
3549
3755
|
*/
|
|
3550
|
-
declare function deriveStatus(payload: {
|
|
3756
|
+
declare function deriveStatus$1(payload: {
|
|
3551
3757
|
jti: string;
|
|
3552
3758
|
expires_at: number;
|
|
3553
3759
|
grace_days: number;
|
|
3554
|
-
}, nowSeconds: number, revoked?: ReadonlySet<string>): LicenseStatus;
|
|
3760
|
+
}, nowSeconds: number, revoked?: ReadonlySet<string>): LicenseStatus$1;
|
|
3555
3761
|
/**
|
|
3556
3762
|
* Verify + apply the grace policy → a resolved status. Mirrors what the issuing
|
|
3557
3763
|
* control plane resolves for the same token. Bad signature / malformed
|
|
@@ -3560,10 +3766,10 @@ declare function deriveStatus(payload: {
|
|
|
3560
3766
|
* A public entry point, so it normalizes like the others (gate and refresher):
|
|
3561
3767
|
* the same key must resolve the same whichever way it comes in.
|
|
3562
3768
|
*/
|
|
3563
|
-
declare function resolveLicense(token: string, publicKey: string | LicenseKeyset, opts?: {
|
|
3769
|
+
declare function resolveLicense$1(token: string, publicKey: string | LicenseKeyset, opts?: {
|
|
3564
3770
|
nowSeconds?: number;
|
|
3565
3771
|
revoked?: ReadonlySet<string>;
|
|
3566
|
-
}): ResolvedLicense;
|
|
3772
|
+
}): ResolvedLicense$1;
|
|
3567
3773
|
|
|
3568
3774
|
/**
|
|
3569
3775
|
* Everything the pipeline depends on. All fields except `provider` and
|
|
@@ -3594,6 +3800,19 @@ interface SavingsLayerConfig {
|
|
|
3594
3800
|
* it on every request. A layer that has a cache and a request that neither
|
|
3595
3801
|
* asks for it nor turns it off gets a one-time console warning (silenced by
|
|
3596
3802
|
* `silenceWarnings`, or by setting `semanticCacheDefault`, `false` included).
|
|
3803
|
+
*
|
|
3804
|
+
* Called `semanticCache` until 0.4.33, so that the store and the per-request
|
|
3805
|
+
* switch (`savings.semanticCache`) no longer share a name. See the 0.5
|
|
3806
|
+
* migration guide.
|
|
3807
|
+
*/
|
|
3808
|
+
semanticCacheStore?: InMemorySemanticCache;
|
|
3809
|
+
/**
|
|
3810
|
+
* @deprecated Renamed {@link semanticCacheStore} in 0.4.33, so that the store
|
|
3811
|
+
* and the per-request switch (`savings.semanticCache`) no longer share a name.
|
|
3812
|
+
* It still works, with a one-time warning (silenced by `silenceWarnings` or
|
|
3813
|
+
* `BVSALA_SILENCE_DEPRECATIONS=1`);
|
|
3814
|
+
* when both are given, `semanticCacheStore` wins. Removed in 0.5: see the 0.5
|
|
3815
|
+
* migration guide.
|
|
3597
3816
|
*/
|
|
3598
3817
|
semanticCache?: InMemorySemanticCache;
|
|
3599
3818
|
/**
|
|
@@ -3601,7 +3820,7 @@ interface SavingsLayerConfig {
|
|
|
3601
3820
|
* request's own value always wins, `false` included. Unset, the semantic cache
|
|
3602
3821
|
* is used only by requests that ask for it.
|
|
3603
3822
|
*
|
|
3604
|
-
* OPT-IN, and deliberately a separate field from {@link
|
|
3823
|
+
* OPT-IN, and deliberately a separate field from {@link semanticCacheStore}: the
|
|
3605
3824
|
* cache is the backend, this is the decision to serve answers to reworded
|
|
3606
3825
|
* questions, which can serve a wrong answer. Prefer it with a cache built with
|
|
3607
3826
|
* `calibration`, which serves nothing until your own traffic certifies a
|
|
@@ -3723,6 +3942,11 @@ interface SavingsLayerConfig {
|
|
|
3723
3942
|
* to support signing-key rotation — legacy no-kid tokens use `defaultKid`, and
|
|
3724
3943
|
* an unknown kid fails closed. For self-hosting/self-testing; defaults to the
|
|
3725
3944
|
* build-embedded BiVelio key.
|
|
3945
|
+
*
|
|
3946
|
+
* @deprecated Has no effect in the published package, which always verifies
|
|
3947
|
+
* against the embedded BiVelio key; passing it there logs a one-time warning
|
|
3948
|
+
* (silenced by `silenceWarnings` or `BVSALA_SILENCE_DEPRECATIONS=1`). Removed
|
|
3949
|
+
* from the public type in 0.5: delete it from your config.
|
|
3726
3950
|
*/
|
|
3727
3951
|
licensePublicKey?: string | LicenseKeyset;
|
|
3728
3952
|
/**
|
|
@@ -3731,6 +3955,9 @@ interface SavingsLayerConfig {
|
|
|
3731
3955
|
* only accepted license — passing a gate there logs a warning and changes
|
|
3732
3956
|
* nothing. It exists for builds from source (this repo's own tests and
|
|
3733
3957
|
* benchmarks), where it takes precedence over {@link licenseKey}.
|
|
3958
|
+
*
|
|
3959
|
+
* @deprecated Ignored in the published package. Removed from the public type
|
|
3960
|
+
* in 0.5; license the layer with {@link licenseKey} or `serviceAccountKey`.
|
|
3734
3961
|
*/
|
|
3735
3962
|
licenseGate?: LicenseGate;
|
|
3736
3963
|
/**
|
|
@@ -3849,6 +4076,9 @@ interface SavingsLayerConfig {
|
|
|
3849
4076
|
* distributed build hard-codes the licensing check on, so setting
|
|
3850
4077
|
* `devUnlicensed` (or `BVSALA_DEV_OPEN`) there has NO effect — the layer still
|
|
3851
4078
|
* requires a valid `licenseKey`. It is not a way to run the product for free.
|
|
4079
|
+
*
|
|
4080
|
+
* @deprecated No effect in the published package. Removed from the public type
|
|
4081
|
+
* in 0.5: delete it from your config.
|
|
3852
4082
|
*/
|
|
3853
4083
|
devUnlicensed?: boolean;
|
|
3854
4084
|
/** Per-model cost models; falls back to `defaultCostModel`. */
|
|
@@ -4313,7 +4543,7 @@ declare const registrarTokenizadorExacto: typeof registerExactTokenizer;
|
|
|
4313
4543
|
* `modelFamily` is derived from whichever id is used, for the same reason: it is
|
|
4314
4544
|
* part of the identity of whoever answers.
|
|
4315
4545
|
*/
|
|
4316
|
-
declare function buildExactKey(c: CanonicalRequest, opciones?: {
|
|
4546
|
+
declare function buildExactKey$1(c: CanonicalRequest$1, opciones?: {
|
|
4317
4547
|
servedModel?: string;
|
|
4318
4548
|
}): string;
|
|
4319
4549
|
/**
|
|
@@ -4353,7 +4583,7 @@ declare function buildExactKey(c: CanonicalRequest, opciones?: {
|
|
|
4353
4583
|
* A caller who never set `savings.deferrable` must not be made to wait for one
|
|
4354
4584
|
* who did.
|
|
4355
4585
|
*/
|
|
4356
|
-
declare function buildInflightKey(c: CanonicalRequest, opciones?: {
|
|
4586
|
+
declare function buildInflightKey$1(c: CanonicalRequest$1, opciones?: {
|
|
4357
4587
|
servedModel?: string;
|
|
4358
4588
|
deferrable?: boolean;
|
|
4359
4589
|
toolDiscovery?: boolean;
|
|
@@ -4420,7 +4650,7 @@ interface Policy {
|
|
|
4420
4650
|
sensitiveTopic: "self-harm" | "mental-health-crisis" | "medical-emergency" | null;
|
|
4421
4651
|
reasons: string[];
|
|
4422
4652
|
}
|
|
4423
|
-
declare function evaluatePolicy(c: CanonicalRequest): Policy;
|
|
4653
|
+
declare function evaluatePolicy$1(c: CanonicalRequest$1): Policy;
|
|
4424
4654
|
|
|
4425
4655
|
/**
|
|
4426
4656
|
* A LOCAL EMBEDDING FUNCTION — no network, no API key, no per-call cost.
|
|
@@ -4459,6 +4689,9 @@ declare function evaluatePolicy(c: CanonicalRequest): Policy;
|
|
|
4459
4689
|
* Term weight is sublinear (`1 + log tf`) so a word repeated forty times does not
|
|
4460
4690
|
* dominate the direction of the vector, and the result is L2-normalised so cosine
|
|
4461
4691
|
* similarity is a plain dot product.
|
|
4692
|
+
*
|
|
4693
|
+
* @deprecated Internal detail of {@link localEmbedding}; leaves the public API in 0.5.
|
|
4694
|
+
* Use {@link localEmbedding}, which returns the same vector.
|
|
4462
4695
|
*/
|
|
4463
4696
|
declare function vectorLocal(texto: string): number[];
|
|
4464
4697
|
/**
|
|
@@ -4467,6 +4700,8 @@ declare function vectorLocal(texto: string): number[];
|
|
|
4467
4700
|
* Synchronous by design — it returns the array, not a promise — so a cache lookup
|
|
4468
4701
|
* adds no await and no latency to the request path.
|
|
4469
4702
|
*/
|
|
4703
|
+
declare function localEmbedding(text: string): number[];
|
|
4704
|
+
/** @deprecated Spanish name, removed in 0.5. Use {@link localEmbedding}. */
|
|
4470
4705
|
declare function embebedorLocal(texto: string): number[];
|
|
4471
4706
|
/**
|
|
4472
4707
|
* The similarity floor this embedder is calibrated for.
|
|
@@ -4477,6 +4712,8 @@ declare function embebedorLocal(texto: string): number[];
|
|
|
4477
4712
|
* guessed — see `test/embebedor-local.test.ts`, which fails if the two
|
|
4478
4713
|
* populations stop being separable.
|
|
4479
4714
|
*/
|
|
4715
|
+
declare const LOCAL_EMBEDDING_THRESHOLD = 0.72;
|
|
4716
|
+
/** @deprecated Spanish name, removed in 0.5. Use {@link LOCAL_EMBEDDING_THRESHOLD}. */
|
|
4480
4717
|
declare const UMBRAL_LOCAL = 0.72;
|
|
4481
4718
|
|
|
4482
4719
|
/**
|
|
@@ -4513,7 +4750,7 @@ declare function mergeDelta(state: ConversationState, delta: MemoryDelta): Conve
|
|
|
4513
4750
|
* relevant, non-empty state is serialized, then the last `rawTurns` messages,
|
|
4514
4751
|
* then the current message.
|
|
4515
4752
|
*/
|
|
4516
|
-
declare function projectContext(opts: {
|
|
4753
|
+
declare function projectContext$1(opts: {
|
|
4517
4754
|
state: ConversationState;
|
|
4518
4755
|
history: ChatMessage[];
|
|
4519
4756
|
current: ChatMessage;
|
|
@@ -4551,7 +4788,7 @@ interface CompactRowsOptions {
|
|
|
4551
4788
|
}
|
|
4552
4789
|
declare function encodeCompactRows(value: unknown, options?: CompactRowsOptions): string;
|
|
4553
4790
|
/** Return shared column names iff every element is a flat, scalar-valued object with identical keys. */
|
|
4554
|
-
declare function uniformColumns(arr: unknown[]): string[] | null;
|
|
4791
|
+
declare function uniformColumns$1(arr: unknown[]): string[] | null;
|
|
4555
4792
|
/**
|
|
4556
4793
|
* The instruction a model needs to read the compact encoder. Kept short on purpose — this text
|
|
4557
4794
|
* is the per-request overhead the selector must amortize before it wins.
|
|
@@ -4763,12 +5000,15 @@ interface OpenAICompatibleOptions {
|
|
|
4763
5000
|
* incumple la segunda y el proveedor responde 400. No es un fallo del cliente:
|
|
4764
5001
|
* es una restricción de OpenAI que JSON Schema no tiene.
|
|
4765
5002
|
*/
|
|
4766
|
-
declare function isStrictCompatible(schema: unknown): boolean;
|
|
5003
|
+
declare function isStrictCompatible$1(schema: unknown): boolean;
|
|
4767
5004
|
/**
|
|
4768
5005
|
* Decides the id that travels on the wire. Explicit option wins; otherwise the
|
|
4769
5006
|
* endpoint decides: OpenAI/Azure and Google's own Gemini API get the bare id,
|
|
4770
5007
|
* everything else keeps what the caller wrote. Exported for the pipeline-level test that pins the README
|
|
4771
5008
|
* snippet; not part of the public API.
|
|
5009
|
+
*
|
|
5010
|
+
* @deprecated Not part of the public API; leaves it in 0.5. Use the adapter option
|
|
5011
|
+
* `stripProviderPrefix`.
|
|
4772
5012
|
*/
|
|
4773
5013
|
declare function quitarPrefijoDeProveedor(model: string, explicito: boolean | undefined, baseUrl: string): string;
|
|
4774
5014
|
declare class OpenAICompatibleProvider implements Provider {
|
|
@@ -4928,12 +5168,101 @@ declare class AnthropicProvider implements Provider {
|
|
|
4928
5168
|
private leerMensaje;
|
|
4929
5169
|
}
|
|
4930
5170
|
|
|
5171
|
+
/** Gemini's `ThinkingConfig`, as its API reference defines it. */
|
|
5172
|
+
interface GoogleThinkingConfig {
|
|
5173
|
+
thinkingLevel?: "MINIMAL" | "LOW" | "MEDIUM" | "HIGH" | (string & {});
|
|
5174
|
+
thinkingBudget?: number;
|
|
5175
|
+
includeThoughts?: boolean;
|
|
5176
|
+
}
|
|
5177
|
+
|
|
5178
|
+
/**
|
|
5179
|
+
* Options for {@link GoogleProvider}, the adapter for Gemini's native API
|
|
5180
|
+
* (`generateContent` / `streamGenerateContent`, v1beta).
|
|
5181
|
+
*/
|
|
5182
|
+
interface GoogleOptions {
|
|
5183
|
+
/** Gemini API key, sent in the `x-goog-api-key` header. */
|
|
5184
|
+
apiKey?: string;
|
|
5185
|
+
/**
|
|
5186
|
+
* Defaults to `https://generativelanguage.googleapis.com/v1beta`, Google's
|
|
5187
|
+
* own API. Override for a gateway or a proxy that speaks the same shape;
|
|
5188
|
+
* repeats of calls that went anywhere else are never valued by reference.
|
|
5189
|
+
*/
|
|
5190
|
+
baseUrl?: string;
|
|
5191
|
+
/** Extra headers (e.g. for a gateway). */
|
|
5192
|
+
headers?: Record<string, string>;
|
|
5193
|
+
/** Injectable fetch for testing. */
|
|
5194
|
+
fetchImpl?: typeof fetch;
|
|
5195
|
+
/**
|
|
5196
|
+
* When true (recommended for measurement), a response without the prompt
|
|
5197
|
+
* and output counters in `usageMetadata` is a hard error instead of being
|
|
5198
|
+
* counted as 0 tokens, which would otherwise fabricate a saving.
|
|
5199
|
+
*/
|
|
5200
|
+
requireUsage?: boolean;
|
|
5201
|
+
/**
|
|
5202
|
+
* Default `generationConfig.thinkingConfig` for every request, sent as
|
|
5203
|
+
* written (`{ thinkingLevel: "LOW" }`, `{ thinkingBudget: 0 }`,
|
|
5204
|
+
* `{ includeThoughts: true }`). A request's `reasoningEffort` replaces its
|
|
5205
|
+
* level or budget. Thought summaries (`includeThoughts`) are billed output
|
|
5206
|
+
* and never part of `text`.
|
|
5207
|
+
*/
|
|
5208
|
+
thinkingConfig?: GoogleThinkingConfig;
|
|
5209
|
+
/** `safetySettings`, sent as written with every request. */
|
|
5210
|
+
safetySettings?: unknown[];
|
|
5211
|
+
}
|
|
5212
|
+
/**
|
|
5213
|
+
* Adapter for Gemini's NATIVE API (`models/{model}:generateContent` and
|
|
5214
|
+
* `:streamGenerateContent?alt=sse`, v1beta). Recommended for Gemini; use
|
|
5215
|
+
* {@link OpenAICompatibleProvider} for every other provider.
|
|
5216
|
+
*
|
|
5217
|
+
* Unlike Gemini's OpenAI-compatible endpoint, the native API documents what the
|
|
5218
|
+
* layer measures: the system prompt travels in `systemInstruction`; tools are
|
|
5219
|
+
* `functionDeclarations` and calls come back as `functionCall` parts whose
|
|
5220
|
+
* `thoughtSignature` is returned in `ToolCallRequest.extraContent` (the same
|
|
5221
|
+
* shape as the compatible endpoint's) and sent back untouched; `usageMetadata`
|
|
5222
|
+
* separates prompt, cached prompt (implicit caching), visible output and
|
|
5223
|
+
* thinking (`thoughtsTokenCount`, billed as output); and a blocked prompt
|
|
5224
|
+
* (`promptFeedback.blockReason`) or a filtered answer (`finishReason` `SAFETY`,
|
|
5225
|
+
* `PROHIBITED_CONTENT`, `BLOCKLIST`…) is reported as
|
|
5226
|
+
* `finishReason: "content_filter"` with the native reason in
|
|
5227
|
+
* `finishReasonDetail`, so it is measured, never cached and never credited.
|
|
5228
|
+
*
|
|
5229
|
+
* The output contract travels in `responseJsonSchema` with
|
|
5230
|
+
* `responseMimeType: "application/json"`; `maxOutputTokens`, `temperature` and
|
|
5231
|
+
* `seed` in `generationConfig`; `reasoningEffort` becomes `thinkingLevel`
|
|
5232
|
+
* (Gemini 3) or `thinkingBudget` (Gemini 2.5); a deferrable request asks for
|
|
5233
|
+
* `serviceTier: "flex"`. Explicit context caching (`cachedContents`) is not
|
|
5234
|
+
* used.
|
|
5235
|
+
*
|
|
5236
|
+
* Network calls use global `fetch` (Node >= 18) so there is no SDK dependency.
|
|
5237
|
+
*/
|
|
5238
|
+
declare class GoogleProvider implements Provider {
|
|
5239
|
+
readonly id: string;
|
|
5240
|
+
private readonly opts;
|
|
5241
|
+
private readonly fetchImpl;
|
|
5242
|
+
private readonly base;
|
|
5243
|
+
private readonly oficial;
|
|
5244
|
+
private readonly nivelAprendido;
|
|
5245
|
+
constructor(opts?: GoogleOptions);
|
|
5246
|
+
generate(req: ProviderRequest, options?: ProviderStreamOptions): Promise<ProviderResponse>;
|
|
5247
|
+
/**
|
|
5248
|
+
* Streaming variant of generate() over `streamGenerateContent?alt=sse`.
|
|
5249
|
+
* Requests with an output contract or a deferrable tier are served by
|
|
5250
|
+
* generate() and yielded as one text event.
|
|
5251
|
+
*/
|
|
5252
|
+
generateStream(req: ProviderRequest, options?: ProviderStreamOptions): AsyncGenerator<ProviderStreamEvent, void, undefined>;
|
|
5253
|
+
private enviarConCorrecciones;
|
|
5254
|
+
private enviar;
|
|
5255
|
+
private cuerpo;
|
|
5256
|
+
private pensamiento;
|
|
5257
|
+
private cerrar;
|
|
5258
|
+
}
|
|
5259
|
+
|
|
4931
5260
|
/**
|
|
4932
5261
|
* Trace collector: an ordered log of pipeline decisions with elapsed timings.
|
|
4933
5262
|
* Every stage records why it did what it did, so a SavingsReport can be audited
|
|
4934
5263
|
* and so ablations can attribute savings to a specific module.
|
|
4935
5264
|
*/
|
|
4936
|
-
declare class TraceCollector {
|
|
5265
|
+
declare class TraceCollector$1 {
|
|
4937
5266
|
private readonly events;
|
|
4938
5267
|
private readonly start;
|
|
4939
5268
|
private readonly now;
|
|
@@ -4967,14 +5296,14 @@ declare class LicenseError extends Error {
|
|
|
4967
5296
|
}
|
|
4968
5297
|
|
|
4969
5298
|
/** Decoded revocation-list body (mirror of @bivelio/protocol's RevocationListPayload). */
|
|
4970
|
-
interface RevocationListBody {
|
|
5299
|
+
interface RevocationListBody$1 {
|
|
4971
5300
|
v: number;
|
|
4972
5301
|
asOf: number;
|
|
4973
5302
|
seq: number;
|
|
4974
5303
|
revoked: string[];
|
|
4975
5304
|
iss?: string;
|
|
4976
5305
|
}
|
|
4977
|
-
interface RevocationListVerification {
|
|
5306
|
+
interface RevocationListVerification$1 {
|
|
4978
5307
|
/** True only if signature + typ + monotonic-seq + skew all pass. */
|
|
4979
5308
|
ok: boolean;
|
|
4980
5309
|
/** List revision (monotonic). -1 when not ok. */
|
|
@@ -4993,11 +5322,11 @@ interface RevocationListVerification {
|
|
|
4993
5322
|
* ANY failure returns `ok:false` with an empty set; the poller then keeps its
|
|
4994
5323
|
* sticky last-known-good (fail-open), never dropping known revocations.
|
|
4995
5324
|
*/
|
|
4996
|
-
declare function verifyRevocationList(token: string, publicKey: string | LicenseKeyset, opts?: {
|
|
5325
|
+
declare function verifyRevocationList$1(token: string, publicKey: string | LicenseKeyset, opts?: {
|
|
4997
5326
|
minSeq?: number;
|
|
4998
5327
|
nowSeconds?: number;
|
|
4999
5328
|
maxSkewSeconds?: number;
|
|
5000
|
-
}): RevocationListVerification;
|
|
5329
|
+
}): RevocationListVerification$1;
|
|
5001
5330
|
/**
|
|
5002
5331
|
* The SDK's live, sticky, monotonic view of the revocation set. It only ever
|
|
5003
5332
|
* GROWS (a jti, once seen revoked, stays revoked for the process lifetime) and
|
|
@@ -5005,7 +5334,7 @@ declare function verifyRevocationList(token: string, publicKey: string | License
|
|
|
5005
5334
|
* list can never un-revoke a license. The live gate reads {@link snapshot} on
|
|
5006
5335
|
* every request; the poller feeds it via {@link apply}.
|
|
5007
5336
|
*/
|
|
5008
|
-
declare class RevocationSnapshot {
|
|
5337
|
+
declare class RevocationSnapshot$1 {
|
|
5009
5338
|
private _seq;
|
|
5010
5339
|
private _asOf;
|
|
5011
5340
|
private _lastContactAt;
|
|
@@ -5033,9 +5362,9 @@ declare class RevocationSnapshot {
|
|
|
5033
5362
|
}
|
|
5034
5363
|
|
|
5035
5364
|
/** A resolved gate that also exposes overall status + a refresh horizon. */
|
|
5036
|
-
interface ResolvedGate extends LicenseGate {
|
|
5365
|
+
interface ResolvedGate$1 extends LicenseGate {
|
|
5037
5366
|
isActive(): boolean;
|
|
5038
|
-
status(): LicenseStatus;
|
|
5367
|
+
status(): LicenseStatus$1;
|
|
5039
5368
|
/**
|
|
5040
5369
|
* Why the key does not open, when it does not; `undefined` when it verified.
|
|
5041
5370
|
* Under `status() === "invalid"` it tells a key that does NOT EVEN HAVE THE
|
|
@@ -5045,6 +5374,8 @@ interface ResolvedGate extends LicenseGate {
|
|
|
5045
5374
|
* branching does not change — but the advice given to the customer differs.
|
|
5046
5375
|
*/
|
|
5047
5376
|
reason(): string | undefined;
|
|
5377
|
+
/** The signed plan while the license grants (`"measure"` = shadow mode). */
|
|
5378
|
+
plan?(): string | undefined;
|
|
5048
5379
|
/** Unix seconds after which the online status should be re-checked (poller anchor). */
|
|
5049
5380
|
refreshAfter?(): number | undefined;
|
|
5050
5381
|
}
|
|
@@ -5060,8 +5391,8 @@ interface ResolvedGate extends LicenseGate {
|
|
|
5060
5391
|
* The offline path passes a fresh, never-updated snapshot (live clock, zero
|
|
5061
5392
|
* network); the online path passes a snapshot a {@link RevocationPoller} feeds.
|
|
5062
5393
|
*/
|
|
5063
|
-
declare function liveGateFromKey(licenseKey: string, publicKey: string | LicenseKeyset, opts: {
|
|
5064
|
-
revocation: RevocationSnapshot;
|
|
5394
|
+
declare function liveGateFromKey$1(licenseKey: string, publicKey: string | LicenseKeyset, opts: {
|
|
5395
|
+
revocation: RevocationSnapshot$1;
|
|
5065
5396
|
now?: () => number;
|
|
5066
5397
|
/** Online staleness ceiling, seconds. If the gate goes this long without a
|
|
5067
5398
|
* confirmed authorized heartbeat, it stops granting (closes the block-egress
|
|
@@ -5069,7 +5400,7 @@ declare function liveGateFromKey(licenseKey: string, publicKey: string | License
|
|
|
5069
5400
|
maxStalenessSeconds?: number;
|
|
5070
5401
|
/** Freshness anchor (unix seconds); defaults to construction time (boot). */
|
|
5071
5402
|
startedAt?: number;
|
|
5072
|
-
}): ResolvedGate;
|
|
5403
|
+
}): ResolvedGate$1;
|
|
5073
5404
|
|
|
5074
5405
|
/**
|
|
5075
5406
|
* Build the SDK's structural {@link import("../contracts/types.js").LicenseGate}
|
|
@@ -5084,9 +5415,9 @@ declare function liveGateFromKey(licenseKey: string, publicKey: string | License
|
|
|
5084
5415
|
* Online revocation is added by pairing {@link liveGateFromKey} with a
|
|
5085
5416
|
* poller-fed snapshot, which `createSavingsLayer` wires up for you.
|
|
5086
5417
|
*/
|
|
5087
|
-
declare function gateFromKey(licenseKey: string, publicKey: string | LicenseKeyset, now?: () => number): ResolvedGate;
|
|
5418
|
+
declare function gateFromKey$1(licenseKey: string, publicKey: string | LicenseKeyset, now?: () => number): ResolvedGate$1;
|
|
5088
5419
|
|
|
5089
|
-
type RevocationPollEvent = {
|
|
5420
|
+
type RevocationPollEvent$1 = {
|
|
5090
5421
|
type: "applied";
|
|
5091
5422
|
seq: number;
|
|
5092
5423
|
size: number;
|
|
@@ -5102,14 +5433,14 @@ type RevocationPollEvent = {
|
|
|
5102
5433
|
} | {
|
|
5103
5434
|
type: "no-fetch";
|
|
5104
5435
|
};
|
|
5105
|
-
interface RevocationPollerOptions {
|
|
5436
|
+
interface RevocationPollerOptions$1 {
|
|
5106
5437
|
/** Absolute URL of GET /licenses/revocations. */
|
|
5107
5438
|
url: string;
|
|
5108
5439
|
/** SPKI PEM (or a kid-addressed {@link LicenseKeyset}) used to verify the signed
|
|
5109
5440
|
* list — the same key/keyset that verifies license tokens. */
|
|
5110
5441
|
publicKeyPem: string | LicenseKeyset;
|
|
5111
5442
|
/** The sticky snapshot to feed. */
|
|
5112
|
-
snapshot: RevocationSnapshot;
|
|
5443
|
+
snapshot: RevocationSnapshot$1;
|
|
5113
5444
|
/** Anchor cadence to the license refresh horizon (unix seconds). */
|
|
5114
5445
|
getRefreshAfter?: () => number | undefined;
|
|
5115
5446
|
/** Injectable clock (unix seconds). */
|
|
@@ -5125,7 +5456,7 @@ interface RevocationPollerOptions {
|
|
|
5125
5456
|
/** Injectable RNG in [0,1) for jitter. Default Math.random. */
|
|
5126
5457
|
random?: () => number;
|
|
5127
5458
|
/** Optional observer (telemetry/tests). */
|
|
5128
|
-
onEvent?: (e: RevocationPollEvent) => void;
|
|
5459
|
+
onEvent?: (e: RevocationPollEvent$1) => void;
|
|
5129
5460
|
/**
|
|
5130
5461
|
* Silencia los avisos por consola. Por defecto están ENCENDIDOS, y ese defecto
|
|
5131
5462
|
* es la corrección: el sondeo es fail-open, así que un call-home roto no rompe
|
|
@@ -5147,7 +5478,7 @@ interface RevocationPollerOptions {
|
|
|
5147
5478
|
* failure it backs off exponentially (a revocation can't land during an outage
|
|
5148
5479
|
* anyway), capped, still jittered, never below the floor.
|
|
5149
5480
|
*/
|
|
5150
|
-
declare function computeNextDelay(opts: {
|
|
5481
|
+
declare function computeNextDelay$1(opts: {
|
|
5151
5482
|
refreshAfter?: number;
|
|
5152
5483
|
nowSeconds: number;
|
|
5153
5484
|
consecutiveFailures: number;
|
|
@@ -5157,7 +5488,7 @@ declare function computeNextDelay(opts: {
|
|
|
5157
5488
|
jitterRatio: number;
|
|
5158
5489
|
random?: () => number;
|
|
5159
5490
|
}): number;
|
|
5160
|
-
declare class RevocationPoller {
|
|
5491
|
+
declare class RevocationPoller$1 {
|
|
5161
5492
|
private readonly opts;
|
|
5162
5493
|
private timer;
|
|
5163
5494
|
private controller;
|
|
@@ -5168,7 +5499,7 @@ declare class RevocationPoller {
|
|
|
5168
5499
|
private lastEtag;
|
|
5169
5500
|
/** 304 seguidos; al llegar al tope se fuerza una descarga firmada. */
|
|
5170
5501
|
private consecutive304;
|
|
5171
|
-
constructor(opts: RevocationPollerOptions);
|
|
5502
|
+
constructor(opts: RevocationPollerOptions$1);
|
|
5172
5503
|
private now;
|
|
5173
5504
|
private resolveFetch;
|
|
5174
5505
|
/**
|
|
@@ -5202,7 +5533,7 @@ declare class RevocationPoller {
|
|
|
5202
5533
|
stop(): void;
|
|
5203
5534
|
}
|
|
5204
5535
|
|
|
5205
|
-
interface UsageEmitterOptions {
|
|
5536
|
+
interface UsageEmitterOptions$1 {
|
|
5206
5537
|
/** Full ingest URL, e.g. `https://savings.bivelio.com/api/metering/usage`. */
|
|
5207
5538
|
url: string;
|
|
5208
5539
|
/** Service-account key (`bvk_…`) sent as a Bearer token; the server derives the org from it. */
|
|
@@ -5253,7 +5584,7 @@ interface UsageEmitterOptions {
|
|
|
5253
5584
|
* neither block nor crash the customer's request path. The buffer is hard-capped
|
|
5254
5585
|
* so a sustained outage can never grow memory without bound.
|
|
5255
5586
|
*/
|
|
5256
|
-
declare class UsageEmitter {
|
|
5587
|
+
declare class UsageEmitter$1 {
|
|
5257
5588
|
private readonly options;
|
|
5258
5589
|
private readonly now;
|
|
5259
5590
|
private readonly flushIntervalMs;
|
|
@@ -5271,7 +5602,7 @@ declare class UsageEmitter {
|
|
|
5271
5602
|
* only confuse whoever reads the logs.
|
|
5272
5603
|
*/
|
|
5273
5604
|
private fallosSeguidos;
|
|
5274
|
-
constructor(options: UsageEmitterOptions);
|
|
5605
|
+
constructor(options: UsageEmitterOptions$1);
|
|
5275
5606
|
/** Set the resolved seat identity (derivation is async; records emitted before
|
|
5276
5607
|
* it resolves are stamped at flush time, so none are lost). */
|
|
5277
5608
|
setSeat(seatId: string | undefined, ci: boolean): void;
|
|
@@ -5312,17 +5643,17 @@ declare class UsageEmitter {
|
|
|
5312
5643
|
}
|
|
5313
5644
|
|
|
5314
5645
|
/** True when running in a CI / ephemeral environment. */
|
|
5315
|
-
declare function detectCi(): boolean;
|
|
5646
|
+
declare function detectCi$1(): boolean;
|
|
5316
5647
|
/**
|
|
5317
5648
|
* Derive the machine seat id for a service-account key. Resolves to `undefined`
|
|
5318
5649
|
* when no machine fingerprint is available (e.g. a browser) — the caller then
|
|
5319
5650
|
* reports no seatId and the server counts the request under an "unknown" seat.
|
|
5320
5651
|
* The id (`m-<32 hex>`) matches the control plane's identity charset.
|
|
5321
5652
|
*/
|
|
5322
|
-
declare function deriveSeatId(serviceAccountKey: string): Promise<string | undefined>;
|
|
5653
|
+
declare function deriveSeatId$1(serviceAccountKey: string): Promise<string | undefined>;
|
|
5323
5654
|
|
|
5324
5655
|
/** Fully-resolved, non-optional dependency set the pipeline runs against. */
|
|
5325
|
-
interface ResolvedDeps {
|
|
5656
|
+
interface ResolvedDeps$1 {
|
|
5326
5657
|
exactCache: ExactCache;
|
|
5327
5658
|
semanticCache: InMemorySemanticCache | undefined;
|
|
5328
5659
|
singleflight: Singleflight;
|
|
@@ -5338,9 +5669,9 @@ interface ResolvedDeps {
|
|
|
5338
5669
|
* in-memory, dependency-free implementation, so `createSavingsLayer({ provider,
|
|
5339
5670
|
* tokenizer })` is a working layer, and each piece can be replaced à la carte.
|
|
5340
5671
|
*/
|
|
5341
|
-
declare function resolveDependencies(config: SavingsLayerConfig): ResolvedDeps;
|
|
5672
|
+
declare function resolveDependencies$1(config: SavingsLayerConfig): ResolvedDeps$1;
|
|
5342
5673
|
|
|
5343
|
-
declare const DEFAULT_MAX_STALENESS_SECONDS: number;
|
|
5674
|
+
declare const DEFAULT_MAX_STALENESS_SECONDS$1: number;
|
|
5344
5675
|
/** The public handle returned by {@link createSavingsLayer}. */
|
|
5345
5676
|
interface SavingsLayer {
|
|
5346
5677
|
generate<T = unknown>(request: SavingsRequest): Promise<SavingsResult<T>>;
|
|
@@ -5801,4 +6132,179 @@ declare function toCsv(rows: readonly Readonly<Record<string, CsvValue>>[], opti
|
|
|
5801
6132
|
columns?: readonly string[];
|
|
5802
6133
|
}): string;
|
|
5803
6134
|
|
|
5804
|
-
|
|
6135
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6136
|
+
type CanonicalRequest = CanonicalRequest$1;
|
|
6137
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6138
|
+
declare const canonicalize: typeof canonicalize$1;
|
|
6139
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6140
|
+
declare const modelFamilyOf: typeof modelFamilyOf$1;
|
|
6141
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6142
|
+
declare const normalizeText: typeof normalizeText$1;
|
|
6143
|
+
/** @deprecated Internal helper, removed from the public API in 0.5. Use `createHash("sha256").update(text).digest("hex")` from `node:crypto`. */
|
|
6144
|
+
declare const sha256: typeof sha256$1;
|
|
6145
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6146
|
+
declare const stableStringify: typeof stableStringify$1;
|
|
6147
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6148
|
+
declare const buildExactKey: typeof buildExactKey$1;
|
|
6149
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6150
|
+
declare const buildInflightKey: typeof buildInflightKey$1;
|
|
6151
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6152
|
+
type CompactVerification = CompactVerification$1;
|
|
6153
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6154
|
+
declare const EMBEDDED_PUBLIC_KEY: typeof EMBEDDED_PUBLIC_KEY$1;
|
|
6155
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6156
|
+
type LicenseKeyShape = LicenseKeyShape$1;
|
|
6157
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6158
|
+
type LicenseStatus = LicenseStatus$1;
|
|
6159
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6160
|
+
type LicenseTokenPayload = LicenseTokenPayload$1;
|
|
6161
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6162
|
+
type ResolvedGate = ResolvedGate$1;
|
|
6163
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6164
|
+
type ResolvedLicense = ResolvedLicense$1;
|
|
6165
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6166
|
+
type RevocationListBody = RevocationListBody$1;
|
|
6167
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6168
|
+
type RevocationListVerification = RevocationListVerification$1;
|
|
6169
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6170
|
+
type RevocationPollEvent = RevocationPollEvent$1;
|
|
6171
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6172
|
+
declare const RevocationPoller: typeof RevocationPoller$1;
|
|
6173
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6174
|
+
type RevocationPoller = RevocationPoller$1;
|
|
6175
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6176
|
+
type RevocationPollerOptions = RevocationPollerOptions$1;
|
|
6177
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6178
|
+
declare const RevocationSnapshot: typeof RevocationSnapshot$1;
|
|
6179
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6180
|
+
type RevocationSnapshot = RevocationSnapshot$1;
|
|
6181
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6182
|
+
declare const computeNextDelay: typeof computeNextDelay$1;
|
|
6183
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6184
|
+
declare const deriveStatus: typeof deriveStatus$1;
|
|
6185
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6186
|
+
declare const gateFromKey: typeof gateFromKey$1;
|
|
6187
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6188
|
+
declare const isKeyset: typeof isKeyset$1;
|
|
6189
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6190
|
+
declare const licenseKeyShape: typeof licenseKeyShape$1;
|
|
6191
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6192
|
+
declare const liveGateFromKey: typeof liveGateFromKey$1;
|
|
6193
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6194
|
+
declare const normalizeLicenseKey: typeof normalizeLicenseKey$1;
|
|
6195
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6196
|
+
declare const resolveLicense: typeof resolveLicense$1;
|
|
6197
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6198
|
+
declare const verifyCompactSignature: typeof verifyCompactSignature$1;
|
|
6199
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6200
|
+
declare const verifyLicenseToken: typeof verifyLicenseToken$1;
|
|
6201
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6202
|
+
declare const verifyRevocationList: typeof verifyRevocationList$1;
|
|
6203
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6204
|
+
declare const UsageEmitter: typeof UsageEmitter$1;
|
|
6205
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6206
|
+
type UsageEmitter = UsageEmitter$1;
|
|
6207
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6208
|
+
type UsageEmitterOptions = UsageEmitterOptions$1;
|
|
6209
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6210
|
+
declare const deriveSeatId: typeof deriveSeatId$1;
|
|
6211
|
+
/** @deprecated Internal license machinery, removed from the public API in 0.5: no replacement. In the published package a license enters only through `licenseKey` / `serviceAccountKey`. */
|
|
6212
|
+
declare const detectCi: typeof detectCi$1;
|
|
6213
|
+
/** @deprecated Internal constant, removed from the public API in 0.5. The default is documented on `licenseRevocation.maxStalenessSeconds`; set that option to change it. */
|
|
6214
|
+
declare const DEFAULT_MAX_STALENESS_SECONDS: typeof DEFAULT_MAX_STALENESS_SECONDS$1;
|
|
6215
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6216
|
+
type ResolvedDeps = ResolvedDeps$1;
|
|
6217
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6218
|
+
declare const resolveDependencies: typeof resolveDependencies$1;
|
|
6219
|
+
/** @deprecated Internal constant of the reference-commission rule, removed from the public API in 0.5: no replacement (the rule is described in the documentation, not frozen as API). */
|
|
6220
|
+
declare const REFERENCE_MAX_AGE_MS: typeof REFERENCE_MAX_AGE_MS$1;
|
|
6221
|
+
/** @deprecated Internal constant of the reference-commission rule, removed from the public API in 0.5: no replacement (the rule is described in the documentation, not frozen as API). */
|
|
6222
|
+
declare const REFERENCE_MESSAGE_ALLOWANCE: typeof REFERENCE_MESSAGE_ALLOWANCE$1;
|
|
6223
|
+
/** @deprecated Internal constant of the reference-commission rule, removed from the public API in 0.5: no replacement (the rule is described in the documentation, not frozen as API). */
|
|
6224
|
+
declare const REFERENCE_OUTPUT_SHARE: typeof REFERENCE_OUTPUT_SHARE$1;
|
|
6225
|
+
/** @deprecated Internal ledger of the pipeline, removed from the public API in 0.5. Read the four ledgers from the `SavingsReport` each call returns. */
|
|
6226
|
+
declare const SavingsLedger: typeof SavingsLedger$1;
|
|
6227
|
+
/** @deprecated Internal ledger of the pipeline, removed from the public API in 0.5. Read the four ledgers from the `SavingsReport` each call returns. */
|
|
6228
|
+
type SavingsLedger = SavingsLedger$1;
|
|
6229
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5. Read the stage traces from `report.traces`. */
|
|
6230
|
+
declare const TraceCollector: typeof TraceCollector$1;
|
|
6231
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5. Read the stage traces from `report.traces`. */
|
|
6232
|
+
type TraceCollector = TraceCollector$1;
|
|
6233
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6234
|
+
declare const adaptiveK: typeof adaptiveK$1;
|
|
6235
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6236
|
+
declare const dedupe: typeof dedupe$1;
|
|
6237
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6238
|
+
declare const executeRetrievalPlan: typeof executeRetrievalPlan$1;
|
|
6239
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6240
|
+
declare const cosine: typeof cosine$1;
|
|
6241
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6242
|
+
declare const keyTokensMatch: typeof keyTokensMatch$1;
|
|
6243
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6244
|
+
declare const multisetEqual: typeof multisetEqual$1;
|
|
6245
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6246
|
+
declare const negationCount: typeof negationCount$1;
|
|
6247
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6248
|
+
declare const numericTokens: typeof numericTokens$1;
|
|
6249
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6250
|
+
declare const words: typeof words$1;
|
|
6251
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6252
|
+
declare const sameAnswer: typeof sameAnswer$1;
|
|
6253
|
+
/** @deprecated Internal helper, removed from the public API in 0.5. Arithmetic questions are still answered locally by `arithmeticResolver` / `createDefaultResolvers()`. */
|
|
6254
|
+
declare const evalArithmetic: typeof evalArithmetic$1;
|
|
6255
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6256
|
+
declare const evaluatePolicy: typeof evaluatePolicy$1;
|
|
6257
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6258
|
+
declare const isStrictCompatible: typeof isStrictCompatible$1;
|
|
6259
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6260
|
+
declare const projectContext: typeof projectContext$1;
|
|
6261
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6262
|
+
declare const resolveConstraintBackend: typeof resolveConstraintBackend$1;
|
|
6263
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6264
|
+
declare const shouldCompress: typeof shouldCompress$1;
|
|
6265
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6266
|
+
declare const withProtectedSpans: typeof withProtectedSpans$1;
|
|
6267
|
+
/** @deprecated Internal pipeline helper, removed from the public API in 0.5: no replacement. */
|
|
6268
|
+
declare const uniformColumns: typeof uniformColumns$1;
|
|
6269
|
+
/** @deprecated Internal helper, removed from the public API in 0.5. Use `crypto.randomUUID()`. */
|
|
6270
|
+
declare const randomId: typeof randomId$1;
|
|
6271
|
+
|
|
6272
|
+
/**
|
|
6273
|
+
* bivelio-savings-layer (BV-SALA)
|
|
6274
|
+
* ---------------------------------------------------------------------------
|
|
6275
|
+
* PROPRIETARY AND CONFIDENTIAL. Copyright (c) 2026 BiVelio Inc.
|
|
6276
|
+
* All Rights Reserved. Unauthorized copying, distribution, or use of this
|
|
6277
|
+
* software, in whole or in part, is strictly prohibited. See LICENSE.
|
|
6278
|
+
* ---------------------------------------------------------------------------
|
|
6279
|
+
*
|
|
6280
|
+
* A provider-neutral LLM execution optimizer. For every request it answers, in
|
|
6281
|
+
* order: Can I avoid this call? Can I avoid retrieval? Can I send fewer tools?
|
|
6282
|
+
* What context is actually needed? Should I compress it? Which format costs
|
|
6283
|
+
* least for this tokenizer? What is the minimal output contract? Is the saving
|
|
6284
|
+
* still positive after all infrastructure is counted?
|
|
6285
|
+
*
|
|
6286
|
+
* It keeps FOUR separate ledgers — avoided_calls, eliminated_tokens,
|
|
6287
|
+
* compressed_tokens, provider_cached_tokens — because mixing them produces
|
|
6288
|
+
* misleading metrics.
|
|
6289
|
+
*/
|
|
6290
|
+
|
|
6291
|
+
/**
|
|
6292
|
+
* The list-price catalogue: model id (without vendor prefix) → USD per 1K
|
|
6293
|
+
* tokens. `costModels` on the layer config always wins over it.
|
|
6294
|
+
*/
|
|
6295
|
+
declare const PRICE_CATALOG: typeof CATALOGO$1;
|
|
6296
|
+
/**
|
|
6297
|
+
* The list price for a model on the day of the request, or `undefined` when the
|
|
6298
|
+
* catalogue has no price for it in force that day.
|
|
6299
|
+
*/
|
|
6300
|
+
declare const listPrice: typeof precioDeLista$1;
|
|
6301
|
+
/** When the catalogue prices were last checked against the providers' public rates (YYYY-MM-DD). */
|
|
6302
|
+
declare const PRICES_AS_OF: typeof PRECIOS_AL_DIA$1;
|
|
6303
|
+
/** @deprecated Spanish name, removed in 0.5. Use {@link PRICE_CATALOG}. */
|
|
6304
|
+
declare const CATALOGO: typeof CATALOGO$1;
|
|
6305
|
+
/** @deprecated Spanish name, removed in 0.5. Use {@link listPrice}. */
|
|
6306
|
+
declare const precioDeLista: typeof precioDeLista$1;
|
|
6307
|
+
/** @deprecated Spanish name, removed in 0.5. Use {@link PRICES_AS_OF}. */
|
|
6308
|
+
declare const PRECIOS_AL_DIA: typeof PRECIOS_AL_DIA$1;
|
|
6309
|
+
|
|
6310
|
+
export { type AnswerJudge, type AnswerSource, type AnthropicOptions, AnthropicProvider, BV_SALA_VERSION, type BatchCounts, type BatchItemResult, type BatchJob, type BatchJobStatus, type BatchRequest, type BatchResults, BatchSubmitError, type BatchSubmitOptions, type BatchSummary, type BivelioHandoff, CATALOGO, COMPACTION_TRANSFORMS, COMPACT_ROWS_INSTRUCTION, type CacheBreakpointStore, type CacheOutcome, type CachePlacement, type CacheTier, type CacheWriteReport, type CachedAnswer, type CalibrationObservation, CalibrationStateError, type CanonicalRequest, type ChatMessage, type CompactRowsDecodeOptions, type CompactRowsOptions, type CompactVerification, type CompactionTransform, type CompressionEconomics, type CompressionPolicyInput, type CompressionRequest, type CompressionResult, type Compressor, type ConstraintBackend, type ConstraintBackendId, type ConstraintPlan, type ConversationState, type CostBasis, type CostModel, type CsvValue, DEFAULT_COST_MODEL, DEFAULT_MAX_STALENESS_SECONDS, DEFAULT_MIN_SAVED_CHARS, type DeferredExecutionReport, type DeterministicResolver, EMBEDDED_PUBLIC_KEY, type EmbeddingFn, type EvidenceDoc, type ExactCache, ExactTokenizer, type ExecutionClass, ExecutionRouter, type FocusExportOptions, type FocusRow, type FormatChoice, FormatSelector, type FormatSelectorOptions, type GoogleOptions, GoogleProvider, type GoogleThinkingConfig, type HandoffFact, HeuristicEstimator, InMemoryCacheBreakpointStore, InMemoryExactCache, InMemorySemanticCache, InMemoryToolSetFreezer, type JsonSchema, LOCAL_EMBEDDING_THRESHOLD, type LangfuseGenerationUpdate, LicenseError, type LicenseGate, type LicenseKeyShape, type LicenseKeyset, type LicenseStatus, type LicenseTokenPayload, type LocalClassifier, MODELOS_POR_CODIFICACION, MODELS_BY_ENCODING, type MeasureReport, type MemoryDelta, type MessageRole, MockProvider, type MockProviderOptions, type ModelCascadeMode, type ModelCascadeReport, type ModelCascadeSettings, type NativeSavingsReport, type OpenAICompatibleOptions, OpenAICompatibleProvider, type OutputContract, PRECIOS_AL_DIA, PRICES_AS_OF, PRICE_CATALOG, type Policy, type PriceLeverSaving, type PriceLeverSettings, type ProtectedSpan, type Provider, type ProviderRequest, type ProviderResponse, type ProviderStreamEvent, type ProviderStreamOptions, type ProviderToolSearch, type ProviderToolSearchUsage, type ProviderUsage, QUALITY_STATUSES, type QualityCacheMatch, type QualityCascadeCheck, type QualityLedger, type QualityRepairCheck, type QualitySchemaCheck, type QualityStatus, type QualityTruncationCheck, REFERENCE_MAX_AGE_MS, REFERENCE_MESSAGE_ALLOWANCE, REFERENCE_OUTPUT_SHARE, type ReasoningEffort, type ReferenceCredit, type ReferenceRejection, type RequestContext, type Reranker, type ResolvedDeps, type ResolvedGate, type ResolvedLicense, ResolverRegistry, type ResolverResult, type RetrievalOptions, type RetrievalOutcome, type RetrievalPlan, type Retriever, type RevocationListBody, type RevocationListVerification, type RevocationPollEvent, RevocationPoller, type RevocationPollerOptions, RevocationSnapshot, type RouteDecision, type SavingsAdapterLevers, type SavingsAdapterOptions, type SavingsAttributeOptions, type SavingsBatches, type SavingsCallOptions, type SavingsLayer, type SavingsLayerConfig, SavingsLedger, type SavingsRecord, type SavingsReport, type SavingsReportForExport, type SavingsRequest, type SavingsResult, type SavingsSeriesOptions, type SavingsSeriesRow, type SavingsSpanAttributes, type SavingsSpanOptions, type SavingsStream, type SavingsStreamEvent, type SavingsStreamOptions, type SavingsToggles, type SavingsTracingOptions, SchemaRegistry, type SemanticCacheOptions, type SemanticCalibrationBound, type SemanticCalibrationOptions, type SemanticCalibrationSegmentState, type SemanticCalibrationState, type SemanticCalibrationStatus, type SemanticHit, type SemanticLookup, type SemanticProbe, type SemanticRecord, type SemanticVerifier, type SerializationFormat, type Serializer, Singleflight, type SpanAttributeValue, type SpanLike, type SpanStartOptionsLike, StreamAbortedError, type StreamingReport, type TokenEstimator, TokenizerRegistry, type ToolCallRequest, type ToolDescriptor, type ToolOutputCompaction, type ToolOutputCompactionSettings, type ToolRisk, type ToolSearchMode, type ToolSearchOptions, type ToolSelection, ToolSelector, type ToolSelectorOptions, type ToolSetFreezer, TraceCollector, type TraceEvent, type TracerLike, type TracerProviderLike, UMBRAL_LOCAL, UsageEmitter, type UsageEmitterOptions, type ValidationError, type ValidationResult, type VerificationCheck, type VerificationExclusion, type VerificationOutcome, type VerificationReport, type VerificationSettings, type VerificationSide, type VerificationStratum, adaptiveK, arithmeticResolver, buildExactKey, buildInflightKey, calibrateSemanticFloor, canonicalize, compactRowsSerializer, compactToolOutput, compresionFiel, computeNextDelay, cosine, createCompactRowsSerializer, createDefaultResolvers, createHandoff, createMockProvider, createSavingsLayer, csvSerializer, decodeCompactRows, dedupe, defaultTokenizerRegistry, deriveSeatId, deriveStatus, detectCi, embebedorLocal, emptyState, encodeCompactRows, evalArithmetic, evaluatePolicy, executeRetrievalPlan, gateFromKey, heuristicEstimator, instrumentSavingsLayer, isKeyset, isStrictCompatible, jsonCompactSerializer, keyTokensMatch, licenseKeyShape, listPrice, liveGateFromKey, localEmbedding, mergeDelta, modelFamilyOf, multisetEqual, negationCount, noopCompressor, normalizeLicenseKey, normalizeText, numericTokens, precioDeLista, projectContext, providerNativeBackend, quitarPrefijoDeProveedor, randomId, recordSavingsOnSpan, registerExactTokenizer, registrarTokenizadorExacto, renderState, resolveConstraintBackend, resolveDependencies, resolveLicense, sameAnswer, savingsSpanAttributes, sha256, shouldCompress, stableStringify, toCsv, toFocusRows, toLangfuseGeneration, toSavingsSeries, uniformColumns, validateAgainstSchema, vectorLocal, verifyCompactSignature, verifyLicenseToken, verifyRevocationList, withProtectedSpans, words };
|