import type { BufferedObservationChunk } from '@mastra/core/storage'; import type { ThresholdRange } from './types.js'; /** * Get the maximum value from a threshold (simple number or range). */ export declare function getMaxThreshold(threshold: number | ThresholdRange): number; /** * Calculate dynamic threshold based on observation space. * When shareTokenBudget is enabled, the message threshold can expand * into unused observation space, up to the total context budget. * * Total budget = messageTokens + observationTokens * Effective threshold = totalBudget - currentObservationTokens * * Example with 30k:40k thresholds (70k total): * - 0 observations → messages can use ~70k * - 10k observations → messages can use ~60k * - 40k observations → messages back to ~30k */ export declare function calculateDynamicThreshold(threshold: number | ThresholdRange, currentObservationTokens: number): number; /** * Resolve bufferTokens config value. * Values in (0, 1) are treated as ratios of the message threshold. * e.g. bufferTokens: 0.25 with messageTokens: 20_000 → 5_000 */ export declare function resolveBufferTokens(bufferTokens: number | false | undefined, messageTokens: number | ThresholdRange): number | undefined; /** * Resolve blockAfter config value. * Values in [1, 100) are treated as multipliers of the threshold. * e.g. blockAfter: 1.5 with messageTokens: 20_000 → 30_000 * Values >= 100 are treated as absolute token counts. * Defaults to 1.2 (120% of threshold) when async buffering is enabled but blockAfter is omitted. */ export declare function resolveBlockAfter(blockAfter: number | undefined, messageTokens: number | ThresholdRange): number | undefined; /** * Convert bufferActivation to an absolute retention floor (tokens to keep after activation). * When bufferActivation >= 1000, it's an absolute retention target. * Otherwise it's a ratio: retentionFloor = threshold * (1 - ratio). */ export declare function resolveRetentionFloor(bufferActivation: number, messageTokensThreshold: number): number; /** * Convert bufferActivation to the equivalent ratio (0-1) for the storage layer. * When bufferActivation >= 1000, it's an absolute retention target, so we compute * the equivalent ratio: 1 - (bufferActivation / threshold). */ export declare function resolveActivationRatio(bufferActivation: number, messageTokensThreshold: number): number; /** * Calculate the projected message tokens that would be removed if activation happened now. * This replicates the chunk boundary logic in swapBufferedToActive without actually activating. */ export declare function calculateProjectedMessageRemoval(chunks: BufferedObservationChunk[], bufferActivation: number, messageTokensThreshold: number, currentPendingTokens: number): number; //# sourceMappingURL=thresholds.d.ts.map