import type { ResolvedConfig, Severity } from "../types.js"; export type EventKind = "run-start" | "phase" | "target" | "shot" | "capture-done" | "judge-start" | "batch" | "finding" | "verdict" | "note" | "error" | "run-end"; export interface LookoutEvent { at: string; runId: string; kind: EventKind; /** One-line human/agent readable summary. */ message: string; /** Kind-specific payload; the UI reads what it recognises and ignores the rest. */ data?: Record; severity?: Severity | "error" | "info"; } export declare function eventsPath(resolved: ResolvedConfig): string; export declare class EventLog { private readonly path; private readonly runId; private enabled; constructor(resolved: ResolvedConfig, runId: string); /** * Begin a board: a run that decides what the clusters are, discarding the * previous board's narration. Only `check` and `capture` do this. */ start(message: string, data?: Record): void; /** * Report against the board a previous run defined, keeping its narration. * A `verify-fix` that truncated here would erase the narration of the run it * is ruling on, and the board's live overlay would lose every issue but the * one in hand. */ join(message: string, data?: Record): void; emit(kind: EventKind, message: string, data?: Record, severity?: LookoutEvent["severity"]): void; } export declare function setCurrentLog(l: EventLog | null): void; /** Narrate, if a run is in flight. A no-op otherwise, so callers need no guard. */ export declare function emit(kind: EventKind, message: string, data?: Record, severity?: LookoutEvent["severity"]): void; /** Read a run's narration back. Tolerates a half-written trailing line. */ export declare function readEvents(resolved: ResolvedConfig): LookoutEvent[]; export interface RunStatus { runId: string | null; phase: string; running: boolean; startedAt: string | null; endedAt: string | null; /** * When the run last said anything. A process that dies without emitting * `run-end` leaves `running` true forever, and lookout cannot see that it * died; callers compare this against the clock to tell live from abandoned. */ lastEventAt: string | null; shots: number; findings: { critical: number; high: number; medium: number; low: number; total: number; }; batches: { done: number; total: number; }; errors: string[]; lastMessage: string; } /** * Fold the log into the answer to "what is lookout doing right now". * * Only that. What issues exist is a question for the backlog, which outlives * any run; this describes the run in flight and nothing else. */ export declare function summarise(events: LookoutEvent[]): RunStatus;