/** Discover transcripts → parse → analyse → postmortem → store. */ import type { Store } from "./store.js"; /** * What one source contributed to a scan, and how fresh it looks. * * Added because the OpenCode importer went silent for six months without * anything being wrong: the source was available, discovery succeeded, and it * returned the same frozen files every time. A scan that reports only * "0 new run(s)" cannot distinguish "you have been idle" from "this importer * stopped working in February". */ export interface SourceReport { source: string; itemsSeen: number; /** ISO date of the newest item discovered, not of the newest item stored. */ newestItem: string | null; /** Days between the newest discovered item and now. */ staleDays: number | null; notes: string[]; } export interface IngestResult { filesSeen: number; filesParsed: number; filesSkipped: number; runsStored: number; /** * Files re-read only because the analyzer changed, not because they changed. * * Reported so an upgrade's first `ingest` cannot rewrite a whole archive in * silence. It is the intended behaviour, but "scan for new transcripts" and * "re-grade everything I have ever stored" deserve different sentences. */ filesRegraded: number; errors: string[]; elapsedS: number; sourcesUsed: string[]; sourceReports: SourceReport[]; } export interface IngestOptions { sourceNames?: string[]; sinceDays?: number | null; force?: boolean; limit?: number | null; onProgress?: (line: string) => void; } export declare function ingest(store: Store, opts?: IngestOptions): IngestResult; /** * Sources that look like they have stopped producing data. * * Deliberately generic rather than a check for the 2026-02 OpenCode migration: * the failure is "a source went quiet and nothing said so", and the next one * will have a different cause. Only reported for sources the store already has * runs from, so a machine that simply does not use an agent stays silent. */ export declare function staleSources(res: IngestResult, hasStoredRuns: (source: string) => boolean): SourceReport[];