/** * @name remote/premium-memory * @description Background memory management for the premium subsystem. * * Runs periodic cleanup intervals that prune expired sessions, stale events, * orphaned delivery records, and idle provider connections. Designed for * long-running production servers with large memory budgets (e.g. 312GB RAM). * * The manager is intentionally conservative: every interval is configurable via * env vars and defaults are safe for a single-process Node.js server. * * @env SAP_MCP_PREMIUM_GC_INTERVAL_MS — Prune interval in ms (default: 30_000) * @env SAP_MCP_PREMIUM_MAX_SESSIONS — Max in-memory sessions (default: 10_000) * @env SAP_MCP_PREMIUM_MAX_EVENTS — Max stored events (default: 500_000) * @env SAP_MCP_PREMIUM_MAX_DELIVERIES — Max delivery records (default: 100_000) * * @module remote/premium-memory */ /** * @name PremiumMemoryConfig * @description Configuration for the premium memory manager. * * @property gcIntervalMs — Prune interval in milliseconds. * @property maxSessions — Maximum in-memory session plans. * @property maxEvents — Maximum stored events in the event store. * @property maxDeliveries — Maximum webhook delivery records. */ export interface PremiumMemoryConfig { gcIntervalMs: number; maxSessions: number; maxEvents: number; maxDeliveries: number; } /** * @name resolveMemoryConfig * @description Resolve memory config from env vars with safe defaults. * * @returns `PremiumMemoryConfig` populated from env or defaults. * * @internal */ export declare function resolveMemoryConfig(): PremiumMemoryConfig; /** * @name PremiumMemoryManager * @description Background memory manager for the premium subsystem. * * Runs a periodic GC interval that: * 1. Counts active sessions, events, and deliveries. * 2. Logs a memory snapshot at INFO level. * 3. If any store exceeds its cap, triggers aggressive pruning. * * The manager does NOT own the pruning logic — each store prunes itself * internally (e.g. `pruneExpiredSessions` in session-manager). The manager * ensures they are called periodically even without traffic. * * The class also exposes `shutdown()` for graceful cleanup during server stop. */ export declare class PremiumMemoryManager { private interval?; private readonly config; constructor(config?: PremiumMemoryConfig); /** * @name start * @description Start the background GC interval. * * The first prune runs immediately, then on every `gcIntervalMs`. */ start(): void; /** * @name prune * @description Run one prune cycle. Logs a memory snapshot. * * This calls `listPremiumSessions()` which internally prunes expired * sessions, and checks event/delivery counts against caps. */ private prune; /** * @name shutdown * @description Stop the GC interval and clean up all premium stores. * * Called during server graceful shutdown. This: * 1. Stops the GC interval. * 2. Stops all active SSE streams. * 3. Deactivates all webhook subscriptions. * 4. Disconnects all provider adapters. * 5. Clears the session store and event store. */ shutdown(): Promise; } //# sourceMappingURL=premium-memory.d.ts.map