import { type SqliteDatabase, type SqliteExecutor, type SqliteRow } from "@bastani/atomic/storage"; import { JOURNAL_COLUMNS as c } from "./types.js"; type LegacyRunRow = SqliteRow & { [c.runId]: string; [c.headerJson]: string; [c.status]: string; }; type LegacyEventRow = SqliteRow & { [c.runId]: string; [c.seq]: number; [c.epoch]: number; [c.key]: string | null; [c.type]: string; [c.payload]: string; [c.at]: number; }; export type RunVersionRow = SqliteRow & { [c.runId]: string; [c.seq]: number; [c.at]: number; }; /** `seq` and `at` of the latest event of `${runs}.run_id`, through the `(run_id, seq)` primary key. */ export declare function latestEventColumns(events: string, runs: string): string; /** * Runs recorded before #3682, kept in the unprefixed `meta`/`runs`/`events`/`leases` tables. * * #3682 renamed the journal tables to `wf_*` without reading the old ones, so * `/workflow resume` lost every run recorded before 0.9.38-alpha.6. Those runs are * listed from the old tables as they are, and a run is converted into `wf_*` only * when it is resumed (its lease is claimed), following pi's migrate-on-load pattern. * Until then its events are read from the old tables as they are. The schema version and * columns are unchanged, so its rows copy verbatim. The old tables are never * modified; deleting a legacy run records its ID so it is not listed again. */ export declare class LegacyJournalRuns { /** Present only for the unprefixed journal in a database that still has version-1 legacy tables. */ static open(database: SqliteDatabase): Promise; pending(executor: SqliteExecutor, filter?: { cwd?: string; }): Promise; find(executor: SqliteExecutor, runId: string): Promise; /** Latest event of each pending legacy run; the legacy tables are never modified. */ versions(executor: SqliteExecutor): Promise; /** Events of an unconverted legacy run, read in place. */ events(executor: SqliteExecutor, runId: string, fromSeq: number, limit: number): Promise; eventByKey(executor: SqliteExecutor, runId: string, key: string): Promise; /** Convert one legacy run into `wf_*` inside the caller's transaction; returns whether it did. */ convert(tx: SqliteExecutor, runId: string): Promise; markDeleted(tx: SqliteExecutor, runId: string): Promise; } export {};