import type { Component, TuiMouseEvent, TuiMouseEventResult } from "@earendil-works/pi-tui"; import type { WardenConfig } from "./config.js"; import type { Trace } from "./trace.js"; import type { ThemeLike } from "./widget.js"; export interface PanelActions { /** Remove the sidebar. */ close(): void; /** Keep the sidebar visible but give keyboard input back to the editor. */ unfocus(): void; } /** * Sidebar listing the trace newest-first, live-updating while open. It opens without taking keyboard input: the editor * keeps working while it is visible. A click inside it (fullscreen mode) focuses it; then ↑/↓/j/k scroll a line, * PgUp/PgDn a page, Home/End jump, c clears the trace, Esc returns input to the editor, and q closes. Wheel scrolling * works without focus. */ export declare class TracePanel implements Component { private readonly trace; private readonly theme; private readonly actions; private readonly requestRender; private readonly title; /** Set by the TUI when keyboard focus changes. */ focused: boolean; private scroll; private viewport; /** Compact mode: show 1-3 lines per entry. Toggle with `d` while focused. */ compact: boolean; private readonly unsubscribe; constructor(trace: Trace, theme: ThemeLike, actions: PanelActions, requestRender: () => void, title?: string); dispose(): void; /** Rendering is cheap and derived from the trace each time; nothing is cached. */ invalidate(): void; private lines; /** A left border makes the overlay read as a pane; the content column is two cells narrower. */ render(width: number): string[]; /** The overlay tells us how tall we may be through the layout; fall back to a fixed viewport otherwise. */ setViewport(rows: number): void; handleInput(data: string): void; handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined; } export interface PanelUi { custom(factory: (tui: { requestRender(): void; terminal?: { rows: number; }; }, theme: ThemeLike, keybindings: unknown, done: (result: T) => void) => Component & { dispose?(): void; }, options?: Record): Promise; } export interface PanelController { /** Resolves when the sidebar has been removed, by the user or by close(). */ closed: Promise; close(): void; } /** * Open the trace as a right-hand sidebar. Pi's public UI API offers floating overlays but no side dock that narrows the * transcript, so the sidebar covers the right part of the screen; `nonCapturing` keeps the editor focused. */ export declare function openTracePanel(ui: PanelUi, trace: Trace, options?: { width?: string | number; }): PanelController; export declare class ConfigPanel implements Component { private readonly config; private readonly theme; private readonly actions; private readonly requestRender; focused: boolean; private cursor; private scroll; private viewport; private editing; private editBuffer; private readonly edits; private readonly entries; constructor(config: WardenConfig, theme: ThemeLike, actions: PanelActions, requestRender: () => void); invalidate(): void; private lines; render(width: number): string[]; setViewport(rows: number): void; handleInput(data: string): void; handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined; private parseValue; save(): void; } export declare function openConfigPanel(ui: PanelUi, config: WardenConfig, options?: { width?: string | number; }): PanelController;