/** * Snap — verbatim readout of recent activity in the current cwd. * * Reads Claude Code session JSONL for the current cwd, returns the tail of * the most-recent N sessions (excluding any actively-being-written session) * up to a byte budget. Output is verbatim turn-pairs, chronological within * each session, sessions ordered newest-first. */ import { type Baton } from './baton.js'; export interface SnapOptions { cwd?: string; /** Total byte budget for the assembled text (default 4000). */ bytes?: number; /** Last N messages per session (default 4 → ~2 turn-pairs). */ turnsPerSession?: number; /** Cap on how many sessions to include (default 5). */ maxSessions?: number; /** * Per-message byte cap. Long messages (e.g. a 7500-line diff pasted into a * commit-message subagent) are truncated to this size with an `[N bytes * elided]` suffix so a single huge turn cannot exhaust the global budget. * Default 1500. Pass 0 to disable. */ maxMessageBytes?: number; /** * Live-session filter: skip sessions whose file mtime is within this many * ms. mtime updates on every JSONL append (text messages, tool_use, * tool_result), so it's a reliable signal that Claude Code is actively in * this session — even between user-visible turns. Default 10_000 (10s) is * tight enough that a just-`/clear`'d session (whose mtime is frozen the * moment the session closed) still surfaces, and wide enough to cover the * gap between an assistant's tool_result write and the next tool_use. * * (file-growth during the parse loop is checked as a secondary signal too.) */ liveSessionWindowMs?: number; /** Include the actively-written session (default false). */ includeCurrent?: boolean; /** * Prepend the cwd's latest batons ("you are here" markers) as a compact * header. Default true — orientation should carry the last sign-off for * free. Pass false to suppress (e.g. when composing snap output elsewhere). */ includeBatons?: boolean; /** * Include `entrypoint: 'sdk-cli'` Claude Code sessions. These are one-shot * SDK invocations Claude Code makes for its own automation (commit-message * generation, summaries, subagent dispatch). Default false — they are noise * for orientation. */ includeSdkCli?: boolean; } export interface SnapSessionMeta { sessionId: string; /** ISO timestamp of the last message inside the session (content-based recency). */ lastMessageTime: string; /** ISO timestamp of the file's last modification (filesystem recency, can be touched by indexers). */ modifiedTime: string; ageMs: number; messageCount: number; } export interface SnapResult { cwd: string; text: string; bytes: number; sessionsIncluded: number; turnsIncluded: number; truncated: boolean; sessions: SnapSessionMeta[]; /** Latest batons for this cwd (latest per type), newest-first. */ batons: Baton[]; } export declare function snap(opts?: SnapOptions): SnapResult; //# sourceMappingURL=snap.d.ts.map