/** Pure: the lineage-ROOT id from a chunk of transcript JSONL — Claude Code's * snake_case `session_id`. Returns the first match, or null. */ export declare function rootIdFromChunk(chunk: string): string | null; /** Pure: the session (own) id from a transcript FILENAME, or null. */ export declare function idFromTranscriptName(name: string): string | null; /** Pure: among transcript candidates `{id, mtime, root}`, the one to FOLLOW — * the newest whose lineage `root` matches `myRoot` and whose own `id` differs * from the id we currently tail — or null when none qualifies. * * Same-lineage only (root match) so a sibling agent sharing the cwd is never * adopted. Newest so a multi-step fork chain (A→B→C, all rooted at A) jumps * straight to the live tip rather than to an intermediate frozen file. */ export declare function forkTarget(candidates: { id: string; mtime: number; root: string | null; }[], tailId: string, myRoot: string): string | null; /** Read the lineage-root of a transcript file (bounded head read — the snake * `session_id` appears on the early carried/user records). null on any error. * Head-only because a live transcript can be many MB and we only need one id. */ export declare function rootIdOfFile(file: string, maxBytes?: number): string | null; /** * Scan the directory of `myFile` for a live fork of the session rooted at * `myRoot` that we currently tail as `tailId`. Returns the new id, or null. * * Only files strictly NEWER than `myFile` are parsed for their root: the fork * post-dates the freeze of the file we read, and while the agent works normally * ITS file is the newest, so the common no-fork case costs one readdir + a stat * per sibling and never opens a transcript. `[]`/no match → null. */ export declare function detectFork(myFile: string, tailId: string, myRoot: string, /** Ids we have already tailed and left. A dead transcript's mtime should never * advance, but if it ever did (an external touch, a manual resume) we must not * oscillate back onto it — so a followed id is excluded from then on. */ seen?: ReadonlySet): string | null;