/** How hard the governor is asking a cache to shrink. */ export type CacheTrimLevel = /** Shrink to a small working floor, keep only what an active request needs. */ 'floor' /** Drop everything reclaimable, the daemon is under real pressure. */ | 'flush'; /** A cache/pool the governor can observe and shrink. */ export interface RegisteredCache { /** Human-readable name for ops output. */ readonly name: string; /** Live number of retained entries. */ entryCount(): number; /** Optional retained-byte estimate (heap accounting is approximate). */ estimateBytes?(): number; /** Shrink the cache to the requested level. Must be safe to call repeatedly. */ trim(level: CacheTrimLevel): void; } /** * Every cache class the daemon retains AND can genuinely observe + shrink. * Extend this when adding one, the membership check fails loudly on an id not * listed here, and a registration whose trim is a no-op is a defect (it makes * the governor's shed tiers theater): every entry here must come with a real * entryCount and a trim that actually reclaims. */ export type MemoryCacheId = 'knowledge-store' | 'session-union' | 'event-replay-ring'; /** The canonical membership set. Adding a cache means adding its id here. */ export declare const KNOWN_MEMORY_CACHES: readonly MemoryCacheId[]; /** True when `id` is a registered cache class. */ export declare function isMemoryCacheRegistered(id: string): boolean; /** * Fail-closed membership check: throw when `id` is not a known cache class. * Mirrors assertAppendOnlyStoreRegistered, an unregistered cache would be * invisible to the governor and could grow unowned, so it fails loudly. */ export declare function assertMemoryCacheRegistered(id: string, context: string): void; /** A point-in-time footprint of one registered cache. */ export interface CacheFootprint { readonly id: MemoryCacheId; readonly name: string; readonly entries: number; readonly estimatedBytes?: number | undefined; } /** * The live registry of caches the governor drives. The daemon composition * registers one entry per known cache at construction; the membership check * refuses any id outside {@link KNOWN_MEMORY_CACHES}. */ export declare class CacheRegistry { private readonly caches; /** * Register a cache. Fails closed on an unknown id. Returns a deregister fn. * Re-registering the same id replaces the prior instance (a re-rooted store). */ register(id: MemoryCacheId, cache: RegisteredCache): () => void; /** Ids currently registered. */ registeredIds(): MemoryCacheId[]; /** Whether an id currently has a live registration. */ has(id: MemoryCacheId): boolean; /** Snapshot every registered cache's footprint (never throws, a bad cache is logged and skipped). */ footprints(): CacheFootprint[]; /** Total retained entries across all registered caches. */ totalEntries(): number; /** Drive `trim(level)` on every registered cache. A throwing cache never blocks the rest. */ trimAll(level: CacheTrimLevel): void; } //# sourceMappingURL=cache-registry.d.ts.map