/** * The widgets of one root session's jobs: derives each shown job's view from * its live output, asks the cheap model for a spec once the job has output * worth describing (and for a caption of a command that needs explaining), * and pushes refreshed views to subscribers while jobs run. */ import type { JobWidgetView } from "@oh-my-pi/pi-tui/tools/job-widget"; import type { AsyncJob } from "../async/job-manager.js"; import type { JobWidgetAuthor } from "./author.js"; import { type JobCaptionWriter } from "./caption.js"; import type { JobWidgetRegistry } from "./types.js"; /** Tunables; the defaults are the product behavior, tests shrink the clocks. */ export interface JobWidgetsOptions { /** Writes specs; absent = fallback views only. */ author?: JobWidgetAuthor; /** Writes command captions; absent = no captions. */ captioner?: JobCaptionWriter; /** Whether widgets and captions are on (`async.widgets`); read on every call. */ enabled?: () => boolean; now?: () => number; /** Background refresh period while subscribers watch running widgets. */ refreshMs?: number; /** Minimum time between two reads of one job's sources. */ minIngestMs?: number; /** Job age before a spec or a caption may be requested. */ authorAfterMs?: number; /** Spec and caption requests in flight at once, across jobs. */ maxInFlight?: number; /** Spec requests (each with its one retry) per job. */ maxAttempts?: number; /** Unmatched lines on the rules' sources that suggest the spec stopped fitting. */ driftLines?: number; /** Age of the newest matched data past which drift re-authors. */ driftStaleMs?: number; } /** {@link JobWidgetRegistry} for one root `AsyncJobManager`. */ export declare class JobWidgets implements JobWidgetRegistry { #private; constructor(options?: JobWidgetsOptions); view(job: AsyncJob): JobWidgetView | undefined; requestCaption(job: AsyncJob): void; caption(job: AsyncJob): string | undefined; subscribe(listener: () => void): () => void; forget(jobId: string): void; dispose(): void; }