import { type LookoutEvent, type RunStatus } from "../report/events.js"; import { severityTally, tally, type BoardEntry } from "../report/board.js"; import { learningBadge, type Learning } from "../report/learning.js"; import type { QueueItem } from "./queue.js"; import type { ResolvedConfig } from "../types.js"; /** Throw the board away: the project changed under it. */ export declare function forgetBoard(): void; export declare function learningNow(resolved: ResolvedConfig): Promise; /** Read a JSON request body, capped so a stray POST cannot fill memory. */ /** * What one poll of `/api/status` answers. * * Written down as a type because the page is checked against it: the client * modules import this, so a field that changes shape here fails the build * rather than quietly rendering "undefined" in somebody's browser. The counts * borrow their shapes from the functions that produce them, so there is one * definition of each and not two that can disagree. */ export interface StatusPayload { project: string; projectDir: string; configured: boolean; /** Why the last run this page started ended badly, if it did. */ lastFailure: { code: number | null; message: string; } | null; status: RunStatus & { board: BoardEntry[]; issues: ReturnType; checkRunning: boolean; /** Whether that run has been told to stop and is still on its way down. */ checkStopping: boolean; /** * Which verb is in the run slot, so the page says what stop would stop. * * `runKind` and not `running`: `RunStatus` already carries a boolean by * that name, meaning "the event log says a run is open", which is a * different question from "this server is holding a child". */ runKind: "check" | "verify-fix" | null; /** * The issues waiting to be handed over, head first. * * Carried as the queue's own record and nothing more: the board is in this * same payload with every issue's title and status, so the page joins the * two by id rather than the server sending each issue twice. */ queue: QueueItem[]; /** * How many rulings an issue gets before it is blocked. * * Sent because the card needs it: an issue at its cap is one `verify-fix` * answers exit 3 for without looking, so offering to queue it is offering a * press the server refuses. Better not to draw the button than to draw one * that answers 409. */ attemptCap: number; findings: ReturnType; /** One line about lookout working on lookout, for the rail. */ learning: ReturnType; }; events: LookoutEvent[]; } /** * The board payload, from cache when nothing has moved. * * Returns the serialised body rather than an object because that is what the * cache holds: re-stringifying a board of forty issues on every poll was the * cost this cache exists to avoid. */ export declare function statusBody(resolved: ResolvedConfig): Promise; /** * The board the last payload was built from, building one if none is current. * * The queue's pump needs to know where the head stands, and that answer is * already in memory: assembling a second board would re-read the event log and * every issue's state file, which during a check is a hundred kilobytes at * whatever rate the log is being appended to. */ export declare function boardNow(resolved: ResolvedConfig): Promise;