/** * conversation-viewer.ts — Live conversation overlay for viewing agent sessions. * * Displays a scrollable, live-updating view of an agent's conversation. * Subscribes to session events for real-time streaming updates. */ import { type AgentSession } from "@earendil-works/pi-coding-agent"; import { type Component, type TUI } from "@earendil-works/pi-tui"; import type { AgentRecord } from "../types.js"; import type { Theme } from "./agent-widget.js"; import { type AgentActivity } from "./agent-widget.js"; export interface ViewerScrollbarState { totalLines: number; viewportRows: number; scrollOffset: number; } export interface ViewerScrollbarThumb { start: number; size: number; } export declare function getViewerScrollbarContentWidth(width: number): number; export declare function calculateViewerScrollbarThumb(state: ViewerScrollbarState): ViewerScrollbarThumb | null; export declare function decorateViewerScrollbar(lines: readonly string[], state: ViewerScrollbarState, width: number): string[]; export declare function renderViewerViewportLines(contentLines: readonly string[], visibleStart: number, viewportHeight: number, width: number): string[]; export type ScrollInputAction = "lineUp" | "lineDown" | "pageUp" | "pageDown" | "home" | "end"; export interface ScrollState { scrollOffset: number; autoScroll: boolean; } export declare function getConversationContentCacheKey(record: AgentRecord, activity: AgentActivity | undefined): string; export declare function getScrollInputAction(data: string): ScrollInputAction | undefined; export declare function updateScrollState(scrollOffset: number, action: ScrollInputAction, viewportHeight: number, maxScroll: number): ScrollState; export declare function renderConversationContentLines(tui: TUI, session: AgentSession, record: AgentRecord, activity: AgentActivity | undefined, theme: Theme, width: number): string[]; export declare class ConversationViewer implements Component { private scrollOffset; private autoScroll; private unsubscribe; private contentCache; private lastInnerW; private closed; private readonly releaseMouseWheelReporting; private readonly tui; private readonly session; private readonly record; private readonly activity; private readonly theme; private readonly done; constructor(tui: TUI, session: AgentSession, record: AgentRecord, activity: AgentActivity | undefined, theme: Theme, done: (result: undefined) => void); handleInput(data: string): void; render(width: number): string[]; invalidate(): void; dispose(): void; private disposeResources; private viewportHeight; private invalidateContentCache; private getContentLines; private buildContentLines; }