/** * src/extension/hud.ts — minimal optional footer widget (stub fonctionnel): * a live summary of delegation runs. Safe string[] widget form only (Pi wraps * each line in a Text component and truncates itself). Transient — nothing is * persisted. * * Cycle-4 fixes: reconciled summary (every run lands in exactly one bucket — * active/complete/failed/preflight[/aborted/escalated] — so the counts add * up), the runtime `uptime` line replaced by ACTIVE-RUN durations (`N active * · longest 14s`, hidden when idle — no ever-growing idle counter), the * repaint diffed via WidgetPainter (idle = 0 repaints) and the periodic * refresh riding the SINGLE shared widget ticker instead of a private timer. */ import { type DelegationSummary } from "../engine/monitor.js"; import { type DelegationMonitorState } from "../engine/runs.js"; import type { GetRuntime } from "./tools.js"; import { type WidgetTicker } from "./widget-refresh.js"; import type { SessionContext } from "./pi-types.js"; export declare const HUD_WIDGET_ID = "pi-subagents-hud"; export declare const HUD_STATUS_ID = "subagents"; /** Active run count (queued + running + steered). */ export declare function activeRunCount(summary: DelegationSummary): number; /** * Reconciled one-line summary: every run is counted in EXACTLY one bucket so * the numbers add up to the total — `N runs · N active · N complete · * N failed · N preflight` (+ `N aborted` / `N escalated` only when nonzero). */ export declare function reconcileSummaryLine(summary: DelegationSummary): string; /** * Active-run durations line (`N active · longest 14s`), replacing the old * runtime uptime. Undefined when no run is active (line hidden in idle). */ export declare function activeRunsDurationLine(state: DelegationMonitorState, now?: number): string | undefined; /** Pure renderer — returns the widget lines for a runtime (injectable now). */ export declare function renderHudLines(getRuntime: GetRuntime, now?: number): string[] | undefined; /** Small HUD owner: diffed widget refresh on the shared ticker (anti-flicker). */ export declare class SubagentsHud { private readonly getRuntime; private readonly ticker; private unsubscribe?; private readonly ctx; private readonly painter; constructor(ctx: SessionContext, getRuntime: GetRuntime, ticker?: WidgetTicker); attach(): void; detach(): void; /** Immediate refresh (event hook — called on pi.events lifecycle changes). */ onLocalChange(): void; private refresh; }