/** * Activity monitor overlay (F2). * * Renders a flat, live list of the session's running/queued/finished * activities — model calls, tools, foreground subagents — with elapsed time * and stalled detection. The blocking leaf (the row that is actually holding * up the reply) is marked so the user can see *why* a turn is slow. * * This package is LOW-level and must not import from `coding-agent`. The * overlay therefore defines its OWN structural snapshot + registry interfaces. * The real `ActivityRegistry` (in coding-agent) returns objects that are * structurally compatible with {@link ActivitySnapshot}; interactive-mode * adapts them. */ import { formatElapsed } from "../format-elapsed.js"; import type { Component } from "../tui.js"; export { formatElapsed }; export type ActivityKind = "model" | "tool" | "subagent" | "process" | "mcp"; export type ActivityStatus = "running" | "queued" | "done" | "error"; /** * Structural snapshot of a single activity. Mirrors the shape returned by the * coding-agent `ActivityRegistry.list()` so the two never share a type import. */ export interface ActivitySnapshot { id: string; kind: ActivityKind; label: string; detail?: string; status: ActivityStatus; startedAt: number; /** now - startedAt (or endedAt - startedAt once finished). */ elapsedMs: number; /** now - lastProgressAt; 0 when never progress-tracked or just progressed. */ stalledMs: number; /** Nesting depth for subagent/tool trees. */ depth: number; } /** Structural registry interface the overlay reads from. */ export interface ActivityOverlayRegistry { /** Current snapshot of every tracked activity, pre-sorted by the registry. */ list(): ActivitySnapshot[]; /** Subscribe to changes. Returns an unsubscribe function. */ subscribe(listener: () => void): () => void; } /** Empty registry used before the session wires a real one. */ export declare const NULL_ACTIVITY_REGISTRY: ActivityOverlayRegistry; export interface ActivityOverlayTheme { border: (text: string) => string; header: (text: string) => string; row: (text: string) => string; muted: (text: string) => string; accent: (text: string) => string; error: (text: string) => string; } export interface ActivityOverlayOptions { registry?: ActivityOverlayRegistry; theme?: ActivityOverlayTheme; maxRows?: number; /** Stalled rows past this many ms render the `· stalled Ns` marker. */ stallThresholdMs?: number; } export declare class ActivityOverlay implements Component { private registry; private theme; private maxRows; private stallThresholdMs; private unsubscribe?; private redraw?; constructor(options?: ActivityOverlayOptions); /** Wire a new registry (e.g. when the session registers the real one). */ setRegistry(registry: ActivityOverlayRegistry): void; /** Bind a redraw callback so registry events trigger a TUI re-render. */ bindRedraw(redraw: () => void): void; dispose(): void; invalidate(): void; render(width: number): string[]; private headerText; /** * Blocker = the first running non-`model` row in the (already-sorted) list, * else the first running `model` row. Mirrors registry `blockingLeaf()`. */ private blockerId; private formatRow; private rightColumn; private glyph; private layoutRow; private truncateVisible; private padRight; } //# sourceMappingURL=ActivityOverlay.d.ts.map