/** * `aidlc autopilot status --watch` — the run and its items, redrawn in place until * the run ends (autopilot-live-progress/AC-1..AC-9), in cards, a table or lanes * (`watch-view.ts`; colorful-autopilot-watch). * * Reads only. It takes no lock and writes no file, so it can never slow the run or * contend with it, and Ctrl-C ends the view and nothing else. CI state comes from * what the driver recorded: a view polling `gh` every two seconds would spend the * rate limit the driver backs off on. * * @module */ import type { PauseRecord } from './pause.js'; import type { AutopilotItem, AutopilotState, RunRecord } from './state.js'; import { COLUMNS, type FrameModel, type View, type WatchItem } from './watch-view.js'; export declare const WATCH_INTERVAL_MS = 2000; /** Everything a frame reads from an item's worktree. Never writes. */ export interface WatchReader { read(path: string): string | null; title(roadmapItemFile: string): string | null; tasks(worktree: string, name: string): string | null; } export declare const fileReader: WatchReader; /** `<1m`, `14m`, `2h05m`, `3d4h`. */ export declare function span(ms: number): string; /** One item as the watch view shows it (autopilot-live-progress/AC-2, AC-3; colorful-autopilot-watch/AC-11). */ export declare function watchItem(r: WatchReader, item: AutopilotItem, now: number): WatchItem; export { COLUMNS }; /** One item's cells, in `COLUMNS` order (AC-2, AC-3). */ export declare function itemCells(r: WatchReader, item: AutopilotItem, now: number): string[]; export interface FrameInput { run: RunRecord | null; paused: PauseRecord | null; state: AutopilotState; /** Whether the STOP file exists. */ stopped: boolean; } /** Everything a frame shows, read once; every view renders from this (AC-4). */ export declare function frameModel(r: WatchReader, input: FrameInput, now: number): FrameModel; /** Cut each line to the terminal's width, so an item never wraps onto a second line (AC-5). */ export declare function fitWidth(lines: string[], columns: number | undefined): string[]; export interface FrameSize { columns?: number; rows?: number; } export interface WatchDeps { /** The frame for `view`; `keys` says the footer should name them (colorful-autopilot-watch/AC-9). */ frame(view: View, size: FrameSize, keys: boolean): string[]; running(): boolean; /** The view drawn first. */ view: View; write(text: string): void; tty: boolean; columns(): number | undefined; rows(): number | undefined; /** Resolves after `ms`, or as soon as `signal` aborts. */ sleep(ms: number, signal: AbortSignal): Promise; /** Call `handler` on Ctrl-C; returns the function that stops listening. */ onInterrupt(handler: () => void): () => void; /** * Read single keys (`v`, `q`, `escape`, `ctrl-c`) until the returned function is * called, which also gives the terminal its mode back. Null when stdin is not a terminal. */ onKey(handler: (key: string) => void): (() => void) | null; /** Call `handler` when the terminal is resized; returns the function that stops listening. */ onResize(handler: () => void): () => void; } /** This process's terminal, clock, keys and Ctrl-C, for `watch`. */ export declare function processWatchDeps(): Omit; /** * Draw until the run ends, `q` or Ctrl-C. Always exits 0: watching cannot fail the * run, and nothing here signals it or writes its STOP file (autopilot-live-progress/AC-7, * colorful-autopilot-watch/AC-8, colorful-autopilot-watch/AC-15). */ export declare function watch(deps: WatchDeps): Promise; //# sourceMappingURL=watch.d.ts.map