/** * File storage utilities — saving binary files to disk, * directory cleanup, and maintenance flag management. * * Extracted from config.ts during modular decomposition (phase 1). */ export declare const FILES_DIR: string; /** * Save a buffer to disk under FILES_DIR with a unique timestamped name. * Returns the absolute file path. Caps directory at 500 files by deleting oldest. */ export declare function saveFileToDisk(buffer: Buffer, filename: string): string; /** * Write the current epoch timestamp to a heartbeat file. * The update watcher checks this before force-killing the server — * if a tool call happened recently, the kill is deferred. */ export declare function writeActivityHeartbeat(): void; /** Write epoch timestamp for a specific thread. Called on every MCP tool call. * Uses atomic write (tmp + rename) to prevent keeper from reading a truncated * file, with retry + direct-write fallback so a transient Windows lock can't * silently drop the heartbeat (a dropped heartbeat risks a false "stuck"). */ export declare function writeThreadHeartbeat(threadId: number): void; /** Synchronous heartbeat write — guarantees the file is flushed before returning. * Used at spawn time and in the poll loop to prevent false zombie detection. */ export declare function writeThreadHeartbeatSync(threadId: number): void; /** Read the last heartbeat epoch for a thread. Returns null if no heartbeat. */ export declare function readThreadHeartbeat(threadId: number): number | null; /** Delete a thread's heartbeat file. Called when a tracked process exits so a * stale (spawn-time or last-activity) heartbeat can't make a dead thread look * alive — which would otherwise block the keeper's restart. A live worker that * is still serving the thread simply rewrites the heartbeat within ~2s. */ export declare function clearThreadHeartbeat(threadId: number): void; /** * Check if a maintenance/update is pending. * The update watcher writes this file before restarting the server. * Returns the flag file content (version info) or null if no maintenance pending. * * If the flag is older than 5 minutes it is assumed stale (the update watcher * failed to clean it up) and is automatically deleted. */ export declare function checkMaintenanceFlag(): string | null; //# sourceMappingURL=file-storage.d.ts.map