import { type Interface } from 'node:readline'; import type { StoreInfo } from '../../models/usage-record.js'; export interface RolloutFile { path: string; /** The Codex home (`$CODEX_HOME`) the file was found under. */ home: string; /** Under `archived_sessions/` rather than `sessions/`. */ archived: boolean; /** `.jsonl.zst` -- see {@link canReadCompressedRollouts}. */ compressed: boolean; sizeBytes: number; mtimeMs: number; } /** * Where Codex CLI keeps its session rollouts. * * Verified layout (Codex CLI 0.114.0 and 0.162.0-alpha.17.2): * /sessions/YYYY/MM/DD/rollout--.jsonl * * `` is `$CODEX_HOME`, else `~/.codex`. Two more places are read without * having been seen populated, because the 0.162 binary names them: * /archived_sessions/... -- where an archived session's file is moved * rollout-*.jsonl.zst -- a rollout Codex has compressed in place * * And, as with OpenCode, a sandboxed launcher splits the history: the Codex snap * keeps its own home at `~/snap/codex//` (one session there on the * development machine, none of them in `~/.codex`). Those are reported as extra * stores rather than silently left out, and read with `--all-stores`. */ export declare function discoverCodexHomes(): StoreInfo[]; /** Every rollout under a Codex home, active and archived, oldest path first. */ export declare function listRollouts(home: string): RolloutFile[]; /** * Whether this Node can read a `.jsonl.zst` rollout. zstd arrived in `node:zlib` * in 22.15; the package supports 22.13, where such a file is skipped and said * to be, never read as empty. */ export declare function canReadCompressedRollouts(): boolean; /** Lines of a rollout, decompressing it first when it is `.jsonl.zst`. */ export declare function readRolloutLines(file: RolloutFile): Interface; /** * The session id in a rollout's file name: `rollout--.jsonl`. * It equalled `session_meta.payload.id` in both rollouts verified; it is used * only when a file has no `session_meta` line. */ export declare function sessionIdFromFileName(path: string): string | undefined; export declare function rolloutLabel(file: RolloutFile): string;