/** A minimal age reference: a memory id plus its ISO-8601 creation timestamp * (MemoryEntry.created, canonical ISO per the src/memory.ts invariant). */ export interface AgeRef { id: string; created: string; } export interface AvailabilityHint { /** Count of returned top-K entries created within the recency window. */ recentCount: number; /** Total returned top-K size considered (after dropping unparseable rows). */ returnedCount: number; /** recentCount / returnedCount, in [0, 1]. */ recentFraction: number; /** Median age in days of the returned top-K. */ topKMedianAgeDays: number; /** Median age in days of the matched candidate pool it was drawn from. */ poolMedianAgeDays: number; /** Count of pool entries older than the top-K median age that were NOT * returned (older relevant matches passed over). */ olderCandidatesPassedOver: number; /** Human-readable summary surfaced to the agent. */ summary: string; /** Discriminator for hint origin; reserved for future variants. */ source: 'j2-recency'; } export interface DetectAvailabilityBiasOpts { /** The returned matched results (the top-K the agent will see). */ topK: readonly AgeRef[]; /** The full matched candidate pool the top-K was drawn from. */ pool: readonly AgeRef[]; /** Reference "now" in epoch ms. Defaults to Date.now(). */ now?: number; /** Recency window in ms; entries newer than this count as "recent". Default 24h. */ recencyWindowMs?: number; /** Minimum recent fraction (exclusive) required to fire. Default 0.7 (>70%). */ recentFractionThreshold?: number; /** Minimum returned size required to fire. Default 3. */ minReturned?: number; /** Minimum pool size required to fire. Default 10. */ minPool?: number; /** Minimum older-passed-over count required to fire. Default 3. */ minOlderPassedOver?: number; } export declare const DEFAULT_RECENCY_WINDOW_MS: number; export declare const DEFAULT_RECENT_FRACTION_THRESHOLD = 0.7; export declare const DEFAULT_MIN_RETURNED = 3; export declare const DEFAULT_MIN_POOL = 10; export declare const DEFAULT_MIN_OLDER_PASSED_OVER = 3; /** * Detect availability/recency bias in a recall result. * * Returns an AvailabilityHint when ALL of the following hold: * 1. topK.length >= minReturned AND pool.length >= minPool (enough signal); * 2. recentFraction > recentFractionThreshold (returned slice is recency-dominated); * 3. poolMedianAgeDays > topKMedianAgeDays (the pool genuinely skews older, * so recency is not just the corpus being young); * 4. olderCandidatesPassedOver >= minOlderPassedOver (older matched memories * actually existed and were not returned). * Otherwise returns null. * * Entries with an unparseable `created` are dropped defensively so a malformed * row cannot poison the medians with NaN. */ export declare function detectAvailabilityBias(opts: DetectAvailabilityBiasOpts): AvailabilityHint | null; //# sourceMappingURL=availability.d.ts.map