@invisiblecities/sidequest-cqo
Version:
Configuration-agnostic TypeScript and ESLint orchestrator with real-time watch mode, SQLite persistence, and intelligent terminal detection
76 lines • 2.12 kB
TypeScript
/**
* Session Manager for Watch Mode Persistence
* Handles session state, recovery, and resumption capabilities
*/
import type { ViolationSummary } from "../shared/types.js";
export interface WatchSession {
id: string;
startTime: number;
lastUpdate: number;
checksCount: number;
baseline: ViolationSummary | undefined;
current: ViolationSummary;
viewMode: "dashboard" | "tidy" | "burndown";
errors: SessionError[];
metadata: {
cwd: string;
nodeVersion: string;
platform: string;
flags: Record<string, unknown>;
};
}
export interface SessionError {
timestamp: number;
error: string;
stack: string | undefined;
checksCount: number;
context: Record<string, unknown> | undefined;
}
export declare class SessionManager {
private sessionFile;
private currentSession;
constructor(dataDirectory?: string);
/**
* Create a new watch session
*/
createSession(flags: Record<string, unknown>): Promise<WatchSession>;
/**
* Load existing session from disk
*/
loadSession(): Promise<WatchSession | undefined>;
/**
* Update current session state
*/
updateSession(updates: Partial<WatchSession>): Promise<void>;
/**
* Log an error to the current session
*/
logError(error: Error, checksCount: number, context?: Record<string, unknown>): Promise<void>;
/**
* Get current session
*/
getCurrentSession(): WatchSession | undefined;
/**
* Clear current session
*/
clearSession(): Promise<void>;
/**
* Get session statistics for display
*/
getSessionStats(): {
duration: number;
checksCount: number;
errorCount: number;
lastError: SessionError | undefined;
progressMade: boolean;
} | undefined;
/**
* Check if session can be resumed safely
*/
canResumeSession(session: WatchSession, currentFlags: Record<string, unknown>): boolean;
/**
* Save session to disk
*/
private saveSession;
}
//# sourceMappingURL=session-manager.d.ts.map