@bivelio/savings-layer 0.4.19 → 0.4.20
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/README.md +20 -9
- package/dist/gateway/bin.js +266 -243
- package/dist/index.d.ts +45 -3
- package/dist/index.js +466 -459
- package/docs/terminales/README.md +4 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -205,7 +205,7 @@ declare function precioDeLista(model: string): CostModel | undefined;
|
|
|
205
205
|
* on the customer's machine. `test/version-declarada.test.ts` ties this
|
|
206
206
|
* constant to package.json so the two can never drift.
|
|
207
207
|
*/
|
|
208
|
-
declare const BV_SALA_VERSION = "0.4.
|
|
208
|
+
declare const BV_SALA_VERSION = "0.4.20";
|
|
209
209
|
|
|
210
210
|
/**
|
|
211
211
|
* Environment-agnostic UUID generation.
|
|
@@ -1686,10 +1686,46 @@ interface ToolSelectorOptions {
|
|
|
1686
1686
|
maxTools?: number;
|
|
1687
1687
|
/** Tokenizer-aware scorer for tie-breaking (optional). */
|
|
1688
1688
|
scoreIntentMatch?: (text: string, tool: ToolDescriptor) => number;
|
|
1689
|
+
/**
|
|
1690
|
+
* How many requests are selected by relevance before the set is FROZEN for a
|
|
1691
|
+
* given key. Below this count the selector learns; past it, it always emits
|
|
1692
|
+
* the same set and `setIsStable` is true again.
|
|
1693
|
+
*
|
|
1694
|
+
* The default of 16 is measured, not round: across 214 sessions of real
|
|
1695
|
+
* traffic, a set frozen from the first 16 invoked tools came up short in
|
|
1696
|
+
* 0.0% of sessions (8 fell short in 2.3%, 12 in 0.5%).
|
|
1697
|
+
*/
|
|
1698
|
+
learningTurns?: number;
|
|
1699
|
+
/** Where frozen sets are remembered. Defaults to an in-process map. */
|
|
1700
|
+
freezer?: ToolSetFreezer;
|
|
1701
|
+
}
|
|
1702
|
+
/**
|
|
1703
|
+
* Memory for the frozen tool set. The caller owns the key: the pipeline passes
|
|
1704
|
+
* the caller's toolset hash, which in practice is one key per session.
|
|
1705
|
+
*/
|
|
1706
|
+
interface ToolSetFreezer {
|
|
1707
|
+
read(key: string): {
|
|
1708
|
+
ids: string[];
|
|
1709
|
+
turns: number;
|
|
1710
|
+
} | undefined;
|
|
1711
|
+
record(key: string, ids: string[], turns: number): void;
|
|
1712
|
+
}
|
|
1713
|
+
/** In-process freezer with a key cap (clears wholesale when full). */
|
|
1714
|
+
declare class InMemoryToolSetFreezer implements ToolSetFreezer {
|
|
1715
|
+
private readonly cap;
|
|
1716
|
+
private map;
|
|
1717
|
+
constructor(cap?: number);
|
|
1718
|
+
read(key: string): {
|
|
1719
|
+
ids: string[];
|
|
1720
|
+
turns: number;
|
|
1721
|
+
} | undefined;
|
|
1722
|
+
record(key: string, ids: string[], turns: number): void;
|
|
1689
1723
|
}
|
|
1690
1724
|
declare class ToolSelector {
|
|
1691
1725
|
private readonly maxTools;
|
|
1692
1726
|
private readonly scoreIntentMatch;
|
|
1727
|
+
private readonly learningTurns;
|
|
1728
|
+
private readonly freezer;
|
|
1693
1729
|
constructor(opts?: ToolSelectorOptions);
|
|
1694
1730
|
/**
|
|
1695
1731
|
* Todas las herramientas que pasó el llamante, acotadas SOLO por el
|
|
@@ -1704,7 +1740,13 @@ declare class ToolSelector {
|
|
|
1704
1740
|
* pasaría a fallar en duro.
|
|
1705
1741
|
*/
|
|
1706
1742
|
passthrough(tools: ToolDescriptor[] | undefined): ToolSelection;
|
|
1707
|
-
select(text: string, tools: ToolDescriptor[] | undefined, execution: ExecutionClass
|
|
1743
|
+
select(text: string, tools: ToolDescriptor[] | undefined, execution: ExecutionClass,
|
|
1744
|
+
/**
|
|
1745
|
+
* Freeze key. The pipeline passes the caller's toolset hash, which in
|
|
1746
|
+
* practice is one key per session. Without a key nothing is frozen and the
|
|
1747
|
+
* selector behaves exactly as before.
|
|
1748
|
+
*/
|
|
1749
|
+
freezeKey?: string): ToolSelection;
|
|
1708
1750
|
}
|
|
1709
1751
|
|
|
1710
1752
|
/**
|
|
@@ -3324,4 +3366,4 @@ interface SavingsLayer {
|
|
|
3324
3366
|
*/
|
|
3325
3367
|
declare function createSavingsLayer(config: Omit<SavingsLayerConfig, "tokenizer"> & Partial<Pick<SavingsLayerConfig, "tokenizer">>): SavingsLayer;
|
|
3326
3368
|
|
|
3327
|
-
export { type AnthropicOptions, AnthropicProvider, BV_SALA_VERSION, type BivelioHandoff, CATALOGO, COMPACT_ROWS_INSTRUCTION, type CacheOutcome, type CacheTier, type CachedAnswer, type CanonicalRequest, type ChatMessage, type CompactRowsDecodeOptions, type CompactRowsOptions, type CompactVerification, type CompressionEconomics, type CompressionPolicyInput, type CompressionRequest, type CompressionResult, type Compressor, type ConstraintBackend, type ConstraintBackendId, type ConstraintPlan, type ConversationState, type CostBasis, type CostModel, DEFAULT_COST_MODEL, DEFAULT_MAX_STALENESS_SECONDS, type DeferredExecutionReport, type DeterministicResolver, EMBEDDED_PUBLIC_KEY, type EmbeddingFn, type EvidenceDoc, type ExactCache, ExactTokenizer, type ExecutionClass, ExecutionRouter, type FormatChoice, FormatSelector, type FormatSelectorOptions, type HandoffFact, HeuristicEstimator, InMemoryExactCache, InMemorySemanticCache, type JsonSchema, LicenseError, type LicenseGate, type LicenseKeyset, type LicenseStatus, type LicenseTokenPayload, type LocalClassifier, MODELOS_POR_CODIFICACION, MODELS_BY_ENCODING, type MemoryDelta, type MessageRole, MockProvider, type MockProviderOptions, type ModelCascadeMode, type ModelCascadeReport, type ModelCascadeSettings, type OpenAICompatibleOptions, OpenAICompatibleProvider, type OutputContract, PRECIOS_AL_DIA, type Policy, type ProtectedSpan, type Provider, type ProviderRequest, type ProviderResponse, type ProviderUsage, QUALITY_STATUSES, type QualityStatus, 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 SavingsLayer, type SavingsLayerConfig, SavingsLedger, type SavingsReport, type SavingsRequest, type SavingsResult, type SavingsToggles, SchemaRegistry, type SemanticCacheOptions, type SemanticHit, type SemanticRecord, type SemanticVerifier, type SerializationFormat, type Serializer, Singleflight, type TokenEstimator, TokenizerRegistry, type ToolCallRequest, type ToolDescriptor, type ToolRisk, type ToolSelection, ToolSelector, type ToolSelectorOptions, TraceCollector, type TraceEvent, UMBRAL_LOCAL, UsageEmitter, type UsageEmitterOptions, type ValidationError, type ValidationResult, adaptiveK, arithmeticResolver, buildExactKey, buildInflightKey, canonicalize, compactRowsSerializer, compresionFiel, computeNextDelay, cosine, createCompactRowsSerializer, createDefaultResolvers, createHandoff, createMockProvider, createSavingsLayer, csvSerializer, decodeCompactRows, dedupe, defaultTokenizerRegistry, deriveSeatId, deriveStatus, detectCi, embebedorLocal, emptyState, encodeCompactRows, evalArithmetic, evaluatePolicy, executeRetrievalPlan, gateFromKey, heuristicEstimator, isKeyset, isStrictCompatible, jsonCompactSerializer, keyTokensMatch, liveGateFromKey, mergeDelta, modelFamilyOf, multisetEqual, negationCount, noopCompressor, normalizeText, numericTokens, precioDeLista, projectContext, providerNativeBackend, randomId, registerExactTokenizer, registrarTokenizadorExacto, renderState, resolveConstraintBackend, resolveDependencies, resolveLicense, sha256, shouldCompress, stableStringify, uniformColumns, validateAgainstSchema, vectorLocal, verifyCompactSignature, verifyLicenseToken, verifyRevocationList, withProtectedSpans, words };
|
|
3369
|
+
export { type AnthropicOptions, AnthropicProvider, BV_SALA_VERSION, type BivelioHandoff, CATALOGO, COMPACT_ROWS_INSTRUCTION, type CacheOutcome, type CacheTier, type CachedAnswer, type CanonicalRequest, type ChatMessage, type CompactRowsDecodeOptions, type CompactRowsOptions, type CompactVerification, type CompressionEconomics, type CompressionPolicyInput, type CompressionRequest, type CompressionResult, type Compressor, type ConstraintBackend, type ConstraintBackendId, type ConstraintPlan, type ConversationState, type CostBasis, type CostModel, DEFAULT_COST_MODEL, DEFAULT_MAX_STALENESS_SECONDS, type DeferredExecutionReport, type DeterministicResolver, EMBEDDED_PUBLIC_KEY, type EmbeddingFn, type EvidenceDoc, type ExactCache, ExactTokenizer, type ExecutionClass, ExecutionRouter, type FormatChoice, FormatSelector, type FormatSelectorOptions, type HandoffFact, HeuristicEstimator, InMemoryExactCache, InMemorySemanticCache, InMemoryToolSetFreezer, type JsonSchema, LicenseError, type LicenseGate, type LicenseKeyset, type LicenseStatus, type LicenseTokenPayload, type LocalClassifier, MODELOS_POR_CODIFICACION, MODELS_BY_ENCODING, type MemoryDelta, type MessageRole, MockProvider, type MockProviderOptions, type ModelCascadeMode, type ModelCascadeReport, type ModelCascadeSettings, type OpenAICompatibleOptions, OpenAICompatibleProvider, type OutputContract, PRECIOS_AL_DIA, type Policy, type ProtectedSpan, type Provider, type ProviderRequest, type ProviderResponse, type ProviderUsage, QUALITY_STATUSES, type QualityStatus, 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 SavingsLayer, type SavingsLayerConfig, SavingsLedger, type SavingsReport, type SavingsRequest, type SavingsResult, type SavingsToggles, SchemaRegistry, type SemanticCacheOptions, type SemanticHit, type SemanticRecord, type SemanticVerifier, type SerializationFormat, type Serializer, Singleflight, type TokenEstimator, TokenizerRegistry, type ToolCallRequest, type ToolDescriptor, type ToolRisk, type ToolSelection, ToolSelector, type ToolSelectorOptions, type ToolSetFreezer, TraceCollector, type TraceEvent, UMBRAL_LOCAL, UsageEmitter, type UsageEmitterOptions, type ValidationError, type ValidationResult, adaptiveK, arithmeticResolver, buildExactKey, buildInflightKey, canonicalize, compactRowsSerializer, compresionFiel, computeNextDelay, cosine, createCompactRowsSerializer, createDefaultResolvers, createHandoff, createMockProvider, createSavingsLayer, csvSerializer, decodeCompactRows, dedupe, defaultTokenizerRegistry, deriveSeatId, deriveStatus, detectCi, embebedorLocal, emptyState, encodeCompactRows, evalArithmetic, evaluatePolicy, executeRetrievalPlan, gateFromKey, heuristicEstimator, isKeyset, isStrictCompatible, jsonCompactSerializer, keyTokensMatch, liveGateFromKey, mergeDelta, modelFamilyOf, multisetEqual, negationCount, noopCompressor, normalizeText, numericTokens, precioDeLista, projectContext, providerNativeBackend, randomId, registerExactTokenizer, registrarTokenizadorExacto, renderState, resolveConstraintBackend, resolveDependencies, resolveLicense, sha256, shouldCompress, stableStringify, uniformColumns, validateAgainstSchema, vectorLocal, verifyCompactSignature, verifyLicenseToken, verifyRevocationList, withProtectedSpans, words };
|