/** * Session Parser for Cursor (the AI editor / `cursor-agent` CLI). * * Cursor stores each agent session as a JSONL transcript at: * * ~/.cursor/projects//agent-transcripts//.jsonl * * is `sanitizePath(cwd)` — the absolute path with the leading * slash dropped and every `/` turned into `-` (e.g. `Users-larsde-src-koru`). * We reverse it back into a real cwd with a filesystem-aware walk so that * hyphenated leaf directories (`6digit-cordial`, `korulang-org`) decode * correctly rather than splitting on the dash. * * Each line is `{ role: 'user' | 'assistant', message: { content: [...] } }`. * Content is an array of blocks; `type: 'text'` blocks hold the visible prose * and `type: 'tool_use'` blocks are the internal trace — we keep the former * and skip the latter, matching every other parser here. * * IMPORTANT: Cursor transcripts carry NO per-message timestamps. The only * temporal signal is the file's mtime. We anchor the LAST message at mtime and * space earlier messages 1s apart going backwards, so ordering is preserved, * `since`/tail slicing works, and the session's content-recency matches its * filesystem-recency (which is what snap/standup key off). These timestamps are * synthetic and approximate by construction — there is no truer source. * * Each session directory may also contain a `subagents/` subdir of nested * transcripts. Those are Cursor's internal sub-agent runs (the analog of Claude * Code's sdk-cli noise); we discover only the top-level transcript per session. */ import type { SessionFile, Conversation } from './session-parser.js'; export declare function getCursorProjectsDir(): string; /** * Reverse Cursor's project-dir encoding back into an absolute cwd by walking * the real filesystem. At each level we list the actual child directories and * pick the one whose `normalizeSep` form matches the longest prefix of the * remaining encoded string at a separator boundary. Longest-match resolves the * `6digit` vs `6digit-cordial` sibling ambiguity. Falls back to the naive * `/`-for-`-` decode for the unresolved remainder (deleted project, or a * non-path encoding like `empty-window` / a `var-folders` temp dir). * * `root` is exposed for testing against a temp tree; production always walks * from the filesystem root. */ export declare function decodeCursorCwd(encoded: string, root?: string): string; /** * Discover all Cursor session transcripts, optionally scoped to a project. */ export declare function discoverCursorSessionFiles(projectPath?: string): SessionFile[]; export declare function parseCursorSessionFile(filePath: string): Conversation; //# sourceMappingURL=cursor-session-parser.d.ts.map