/** * Lock-file lifecycle helpers for HTTP server mode. * * After the stdio-pure + http-multi-user split, lock files are used solely * by `runHttpServer` to prevent two HTTP servers binding the same port for * the same `serverName`. They are no longer used to discover or steer * daemon-bridge processes; per-credState TTLs and PID liveness checks have * been removed along with the daemon model. * * On-disk format (4 lines + trailing newline, padded to 512 bytes): * * ``` * {pid} * {port} * {token} * {spawnedAt_iso8601_utc} * ``` * * `sweepStaleLocks` removes lock files whose `spawnedAt` is older than the * configured TTL. There is no daemon to terminate — the HTTP server owns * its own lifecycle and exits when its parent process exits. * * TypeScript port of core-py's `mcp_core.lifecycle.lock`. Behaviour kept * identical for cross-language parity. */ export declare const DEFAULT_LOCK_TTL_HOURS = 24; /** Parsed lock metadata — shared by sweep and refresh helpers. */ export interface LockMetadata { pid: number; port: number; token: string; spawnedAt: Date; } export declare function locksDir(root?: string): string; /** * No-arg lock-dir resolver — sweep tests `vi.spyOn(lockModule, 'lockDir')` * to redirect into a temp directory without threading a `root` arg. */ export declare function lockDir(): string; /** * Refresh `spawnedAt` of an existing lock file. Silent no-op on legacy / * malformed files so callers don't need try/except. * * Padded to 512 bytes so on-disk size stays stable while a Windows * byte-range lock is held past the metadata region (parity with core-py). */ export declare function refreshLockTimestamp(path: string): void; /** * Remove stale lock files for `serverName`. Returns count removed. * * Called by `runHttpServer` at startup before writing its own lock, * preventing pile-up of dozens of `-.lock` files when HTTP * servers exit abnormally (Windows OOM, taskkill, signal). * * A lock is stale when: * - file is unreadable or has malformed payload (legacy / corrupt) * - `spawnedAt` is older than the TTL */ export declare function sweepStaleLocks(serverName: string, ttlHours?: number, root?: string): number; /** * Write the 4-line lock payload (pid, port, token, ISO timestamp) padded * to 512 bytes. Used by `runHttpServer` after the OS file lock is * acquired. * * Returns the absolute path to the lock file. */ export declare function writeLockFile(serverName: string, port: number, token: string, root?: string): string; //# sourceMappingURL=lock.d.ts.map