/** * Represents a parsed tool call operation from session logs */ export interface Operation { timestamp: string; toolName: string; tokens: number; metadata: string; } /** * Result of parsing a session log file */ export interface SessionLogData { operations: Operation[]; toolTokens: number; systemReminderTokens: number; } /** * Locates a session's log, in whichever format it exists. * * TWO NAMES FOR THE SAME THING, AND ONLY ONE WAS EVER LOOKED FOR. * * Callers built `session-log-.jsonl` by hand and reported "JSONL log not * found" when it was absent -- which is always, because nothing in this package * writes that file. The installed PowerShell hooks log every tool call to * `operations-.csv` (hooks/handlers/token-optimizer-orchestrator.ps1), and * that is what actually accumulates on a working machine. * * Resolving the name in one place means the next caller cannot get it wrong, * and cannot drift. * * @returns the path to read, or null when this session genuinely has no log. */ export declare function resolveSessionLogPath(hooksDataPath: string, sessionId: string): string | null; /** * Parse a session log and extract operations and token statistics. * * Accepts both formats: the JSONL the web server writes for live sessions, and * the `operations-.csv` the PowerShell hooks append to. The format is * chosen by extension, so a caller that resolved its path with * resolveSessionLogPath never has to know which it got. * * Uses streaming with readline to avoid blocking the event loop on large files. * * @param logFilePath - Path to a session-log-*.jsonl or operations-*.csv file * @returns Parsed operations and token counts * * @remarks * - Skips malformed lines silently * - Normalizes object metadata to JSON strings * - Returns empty arrays/zeros if file is empty * - CSV logs carry no system-reminder rows, so that total is 0 for them */ export declare function parseSessionLog(logFilePath: string): Promise; //# sourceMappingURL=session-log-parser.d.ts.map