/** * task-widget.ts — Persistent widget showing task list with status icons and progress. * * Display style matches Claude Code's task list: * ✔ completed tasks * ◼ in_progress tasks * ◻ pending tasks * ✳ actively executing task (with activeForm text) * * The widget renders as plain text lines (string[]) — no TUI component * factory — so it behaves identically in TUI and RPC modes. Lines are capped * at a fixed width (MAX_LINE_WIDTH) since there is no terminal width to read. */ import type { TaskStore } from "../task-store.js"; import type { TasksConfig } from "../tasks-config.js"; export type UICtx = { setStatus(key: string, text: string | undefined): void; setWidget(key: string, content: string[] | undefined, options?: { placement?: "aboveEditor" | "belowEditor"; }): void; }; /** Per-task runtime metrics (elapsed time, token usage). */ export interface TaskMetrics { startedAt: number; inputTokens: number; outputTokens: number; } export declare class TaskWidget { private store; private config; private uiCtx; private widgetInterval; /** IDs of tasks currently being actively executed (show ✳). */ private activeTaskIds; /** Per-task runtime metrics keyed by task ID. */ private metrics; constructor(store: TaskStore, config?: TasksConfig); setStore(store: TaskStore): void; setConfig(config: TasksConfig): void; setUICtx(ctx: UICtx): void; /** Add or remove a task from the active set. */ setActiveTask(taskId: string | undefined, active?: boolean): void; /** Record token usage for the currently active task(s). */ addTokenUsage(inputTokens: number, outputTokens: number): void; /** Ensure the widget refresh timer is running. */ ensureTimer(): void; /** Build widget lines from current live state. Guarded so a render error can * never escape — worst case the widget is empty for one update. */ private buildWidgetLines; /** Push the current task list to the UI. Called on state changes, and by the * refresh timer while a task is actively executing (elapsed time ticks). */ update(): void; dispose(): void; }