import type { LaneJob, JobStatus } from "./lane-runner.js"; export declare const JOB_ARCHIVE_VERSION = 1; /** How many finished jobs the archive keeps; the oldest by end time are dropped first. */ export declare const MAX_ARCHIVED_JOBS = 100; /** Per-stream cap on archived output; the tail is kept, because the final report is at the end. */ export declare const MAX_ARCHIVED_OUTPUT_CHARS: number; /** A finished job as the archive stores it — a `LaneJob` whose status is never `running`. */ export type ArchivedJob = LaneJob & { status: Exclude; endedAt: number; }; export interface JobArchiveFile { version: 1; /** Legacy v1 field retained so pre-random-id archives remain readable. */ lastSeq: number; jobs: ArchivedJob[]; } /** * Where the archive lives. Cache-kind (re-derivable in the weak sense that a lost row costs one * lost report, never a credential or an operator's edit), XDG-aware through `state-paths.ts`. * * ⚠ Guarded at the RESOLVER, the `state-paths` rule: under vitest the default is a per-pid file * under the shared vitest root, so a suite never reads the operator's real archive and never leaves * a row a later real start would report. Same namespace shape as `jobJournalPath`. */ export declare function jobArchivePath(env?: NodeJS.ProcessEnv): string; /** The archive seam. Injected so the suite proves the restart path against a temp file. */ export interface JobArchive { /** * Persist a job that has reached a terminal state. Written at once. * * Returns true when the terminal row is durably committed. Callers that also remove a running * journal row use this as the commit point: a failed archive write must leave the journal as the * weaker-but-recoverable fallback instead of making the job disappear from both stores. * Running jobs are a successful no-op. */ record(job: LaneJob): boolean; /** What a previous process left; lastSeq is legacy v1 compatibility only. */ restore(): { jobs: ArchivedJob[]; lastSeq: number; }; /** Run any pending debounced write now — the shutdown seam. */ flush(): void; /** * A finished job read from disk NOW, or undefined. This is how one host's server answers for a * job that another host's server finished after this one started. */ lookup(jobId: string): ArchivedJob | undefined; /** Every finished job on disk now. */ all(): ArchivedJob[]; } /** An archive that keeps nothing. The default for an embedder that declines one. */ export declare const nullJobArchive: JobArchive; /** The sequence number inside a legacy safe-integer `job-NNNN` id, or null for opaque/new ids. */ export declare function jobSeqOf(id: string): number | null; /** * The real archive: one JSON file, read ONCE at construction, rewritten on every terminal * transition. Rows from a previous process are kept (they are what the next reader wants), and * the bound is applied on every write so the file cannot grow past `MAX_ARCHIVED_JOBS`. */ export declare function createJobArchive(path?: string): JobArchive; /** * Field-by-field validation of one archived row. Only the fields a renderer reads are required; * every optional field is checked when present, and any shape mismatch drops the row ALONE. */ export declare function isArchivedJob(value: unknown): value is ArchivedJob;