/** * Memory Pressure Management * * Progressive throttling to prevent OOM conditions: * - WARNING: Reduce cache TTL to slow memory growth * - HIGH: Aggressive eviction to reclaim memory * - CRITICAL: Reject requests to prevent OOM * * Thresholds are configurable via environment variables: * - MEMORY_WARNING_THRESHOLD (default: 65) * - MEMORY_HIGH_THRESHOLD (default: 75) * - MEMORY_CRITICAL_THRESHOLD (default: 80) * * @module server/shared/renderer/memory/pressure */ type MemoryPressureLevel = "normal" | "warning" | "high" | "critical"; /** Parses a percentage threshold from the environment, falling back on missing or invalid values. */ export declare function parseEnvThreshold(name: string, fallback: number, read?: (name: string) => string | undefined): number; /** * Thresholds resolved from the environment at module load. Exported so tests can * assert boundaries against the values this process actually uses rather than * hard-coding the defaults, which a configured MEMORY_* variable would invalidate. * @internal */ export declare const THRESHOLDS: { WARNING: number; HIGH: number; CRITICAL: number; }; /** Classifies a heap usage percentage against the configured thresholds. */ export declare function classifyMemoryPressure(heapUsedPercent: number, thresholds?: typeof THRESHOLDS): MemoryPressureLevel; type PressureDeps = { getHeapStats: () => { heapUsedPercent: number; }; thresholds?: typeof THRESHOLDS; }; /** Test-only seam for substituting heap statistics. */ export declare function __injectDepsForTests(deps: PressureDeps | null): void; export declare function shouldRejectDueToMemory(): boolean; /** * Get current memory pressure level for use by the worker pool * to decide whether to evict idle workers. */ export declare function getMemoryPressureLevel(): MemoryPressureLevel; export {}; //# sourceMappingURL=pressure.d.ts.map