/** * HangBuster session store — filesystem-backed, simplified from hang_sessions.py. * * Session root: $XC_MCP_HANG_DIR (tests) or ~/.xc-mcp/hang-sessions/ (production). * Each session: // containing meta.json, raw.log, summary.json. * * No events.jsonl, no worker process management — just the store. */ export interface SessionMeta { sessionId: string; udid: string; predicate: string; pid?: number; status: 'running' | 'stopped' | 'crashed'; createdAt: string; stoppedAt?: string; rawLogPath: string; minHangMs: number; } export declare function getSessionsRoot(): string; export declare function getSessionDir(sessionId: string): string; /** * Generates a session ID in the format `hang-YYYYMMDD-HHMMSS-XXXX` * where XXXX is 4 hex chars from crypto.randomBytes. */ export declare function generateSessionId(): string; /** * Create a new session directory with an empty raw.log and initial meta.json * with status 'running'. Returns the persisted SessionMeta. */ export declare function createSession(opts: { udid: string; predicate: string; minHangMs: number; }): SessionMeta; /** Read meta.json for a session. Returns null if missing or corrupt. */ export declare function readMeta(sessionId: string): SessionMeta | null; /** Atomically write meta.json. */ export declare function writeMeta(meta: SessionMeta): void; /** * Patch session status (and optional extra fields) then persist. * Sets stoppedAt when transitioning to 'stopped' or 'crashed'. */ export declare function updateStatus(sessionId: string, status: SessionMeta['status'], extra?: Partial>): SessionMeta; /** List all sessions, newest first (by createdAt). Tolerates missing/corrupt dirs. */ export declare function listSessions(): SessionMeta[]; /** Read the raw.log file for a session. Returns empty string if missing. */ export declare function readRawLog(sessionId: string): string; /** Atomically write summary.json for a session. */ export declare function writeSummary(sessionId: string, summary: unknown): void; /** Read summary.json for a session. Returns null if missing or corrupt. */ export declare function readSummary(sessionId: string): unknown | null; /** * Delete a session directory and all its contents. * Returns true if the directory existed and was removed, false otherwise. */ export declare function deleteSession(sessionId: string): boolean; /** * Delete sessions whose createdAt is older than ttlHours (default 24). * Returns the number of sessions deleted. */ export declare function pruneExpired(ttlHours?: number): number; //# sourceMappingURL=sessions.d.ts.map