/** * The project's own autonomy record: one JSON line per `implement` run, * appended to .farketari/run-history.jsonl — COMMITTED state, so the * series rides the repository and survives machines, checkouts and * publishes. The point is the autonomy SLO: how many runs end because * the SPEC needed the user (the stop the tool wants) versus because the * machine did — infrastructure down, a budget that ran dry, a crash. * `farketari stats` reads it back; a falling non-spec stop rate is the * signal that review-only operation is near. */ export type StopCategory = "spec" | "infrastructure" | "budget" | "error"; export interface RunRecord { feature: string; startedAt: string; finishedAt: string; outcome: "completed" | "stopped" | "crashed"; /** Present on stopped/crashed runs. */ category?: StopCategory; /** First line of the stop's situation — enough to recall the run. */ situation?: string; } /** * The recorder a run carries: begin() stamps the start, exactly one of * the terminal calls appends the record. Recording never throws — a * stats write must not take down the run it is describing. */ export interface RunHistory { begin(feature: string): void; completed(): void; stopped(category: StopCategory, situation: string): void; crashed(message: string): void; } export declare function fileRunHistory(repoRoot: string, now?: () => Date): RunHistory; /** The do-nothing recorder for tests and contexts without a repository. */ export declare const noRunHistory: RunHistory; export interface RunHistorySummary { runs: number; completed: number; stopsByCategory: Record; recent: RunRecord[]; } export declare function summarizeRunHistory(repoRoot: string, recentCount?: number): RunHistorySummary;