/** * Decay computation — pure function. * * Applied by retrieval stages to compute an entry's effective relevance at * read time. Never mutates the entry; only returns a scaling factor in * `[0, +∞)` that stages apply to their existing score. * * Model: * factor = exp(-ln2 · Δt / halfLife) · min(accessBoost^accessCount, MAX_BOOST) * * The time term is exponential decay (half after one half-life). The access * term is multiplicative — each read of an entry boosts its future * relevance. `MAX_BOOST_MULTIPLIER` caps runaway boosting so a frequently- * read but old entry doesn't crowd out newer relevant entries indefinitely. */ import type { DecayPolicy, MemoryEntry } from './types.js'; /** * Compute the decay factor for an entry at a given moment. * * @param entry The memory entry to score. Must have `lastAccessedAt` and * `accessCount` set (storage adapters populate these). * @param now The reference time (unix ms). Defaults to `Date.now()`. * @param policy Optional override — when omitted, uses `entry.decayPolicy`. * Stages can pass a stage-wide default so entries without a * per-entry policy still decay consistently. If neither is * set, returns 1.0 (no decay applied). * * @returns Scaling factor in `[0, MAX_BOOST_MULTIPLIER]` — stages multiply * this against their existing relevance score. */ export declare function computeDecayFactor(entry: Pick, now?: number, policy?: DecayPolicy): number; /** * Compute decay for multiple entries in one call. Order-preserving; returns * one factor per entry. Convenience for stages that rank whole batches. */ export declare function computeDecayFactors(entries: readonly Pick[], now?: number, policy?: DecayPolicy): number[]; //# sourceMappingURL=decay.d.ts.map