/** * Pure helper functions for bounded in-memory data structures. * Extracted from server.ts so they can be unit-tested in isolation. * * @module */ interface RateLimitEntry { count: number; resetAt: number; } /** * Evict expired entries from a rate-limit map when it exceeds `threshold`. * Safe to call during iteration (Map spec permits deletion during for-of). */ export declare function sweepExpiredEntries(map: Map, now: number, threshold: number): void; interface ConversationLike { updatedAt: string; } /** * Evict the oldest conversation (by `updatedAt`) when the map exceeds `cap`. * Returns the evicted key, or null if no eviction was needed. */ export declare function evictOldestConversation(map: Map, cap: number): string | null; /** * Push an entry to a bounded buffer and batch-evict when the high-water * mark is reached. Returns the current buffer length. * * @param buffer - The array to push into. * @param entry - The item to append. * @param highWater - Trigger eviction when `buffer.length` exceeds this. * @param evictCount - Number of oldest entries to remove on eviction. */ export declare function pushWithBatchEvict(buffer: T[], entry: T, highWater: number, evictCount: number): number; interface CachedFile { body: Buffer; mtimeMs: number; } /** * Retrieve a file from a bounded cache, reading from disk on miss. * Files larger than `fileSizeLimit` are never cached. * * @param cache - The Map serving as the LRU-ish cache. * @param filePath - Absolute path to the file. * @param mtimeMs - File's last-modified time (for invalidation). * @param readFile - Callback that reads the file (injected for testing). * @param maxEntries - Maximum number of cached files. * @param fileSizeLimit - Maximum file size (bytes) eligible for caching. */ export declare function getOrReadCachedFile(cache: Map, filePath: string, mtimeMs: number, readFile: (p: string) => Buffer, maxEntries: number, fileSizeLimit: number): Buffer; export {}; //# sourceMappingURL=memory-bounds.d.ts.map