/** * conversation-viewer.ts — Live and historical conversation overlay. * * The viewer deliberately keeps rendering state separate from the transcript: * blocks are formatted data, while Markdown/ANSI lines are a bounded cache. */ import type { AgentSession, ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent"; import { type Component, type TUI, type TuiMouseEvent } 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"; import { type ViewerKeybindings } from "./viewer-keys.js"; export declare const VIEWPORT_HEIGHT_PCT = 70; /** The live fields needed by the viewer; historical viewers use a static source. */ export type ConversationSource = Pick; export declare function createStaticConversationSource(messages: AgentSession["messages"]): ConversationSource; /** Optional operations are appended so all existing constructor call sites stay valid. */ export interface ConversationViewerOperations { pi: ExtensionAPI; ctx: ExtensionContext; readOnly?: boolean; } export declare class ConversationViewer implements Component { private tui; private session; private record; private activity; private theme; private done; /** Abort the agent shown here. Omitted means read-only history. */ private onStop?; /** Send a steering message to the agent. */ private onSteer?; /** Optional clipboard/nvim operation context, appended for compatibility. */ private operations?; private blocks; private showTools; private selectedMessageIdx; private hasFocusedBlock; private cachedWidth; private cachedLines; private cachedMessageStarts; private cachedMessageBlocks; private cacheVersion; private cachedVersion; private sessionRefreshQueued; private selectedBlockId; private scrollOffset; private autoScroll; private unsubscribe; private lastInnerW; private closed; private stopArmed; private hoveredPreview; private hoveredClose; private keys; private composer; private searchMode; private searchQuery; private searchMatches; private currentMatchIdx; /** Follow-up drafts, newest first, matching pi editor history semantics. */ private steerHistory; private steerHistoryIndex; private steerHistoryDraft; private timeline; constructor(tui: TUI, session: ConversationSource, record: AgentRecord, activity: AgentActivity | undefined, theme: Theme, done: (result: undefined) => void, /** Abort the agent shown here. Omitted means read-only history. */ onStop?: (() => void) | undefined, /** User keybindings from ctx.ui.custom(). */ keybindings?: ViewerKeybindings, /** Send a steering message to the agent. */ onSteer?: ((message: string) => void) | undefined, /** Optional clipboard/nvim operation context, appended for compatibility. */ operations?: ConversationViewerOperations | undefined); handleInput(data: string): void; handleMouse(event: TuiMouseEvent): { handled?: boolean; capture?: boolean; render?: boolean; } | undefined; private headerActionGeometry; private isPreviewButtonHit; private isCloseButtonHit; render(width: number): string[]; invalidate(): void; private scheduleSessionRefresh; private handleTimelineChange; dispose(): void; private viewportHeight; private chromeLines; private invocationLine; private buildContentLines; private currentMessageIndex; /** Keep the selected transcript block and the tool focus as one target. */ private setFocusFromMessageIndex; private currentBlockGlobalIndex; private activeHeaderLine; private currentBlock; private messageIndexForOffset; private jumpToMessage; private moveToolFocus; private focusNearbyTool; private scrollTargetIntoView; private focusedToolBlock; private openFocusedToolPreview; private scrollBy; private scrollToTop; private scrollToBottom; private enterSearch; private handleSearchInput; private recomputeMatches; private gotoMatch; private scrollToMatch; private copyCurrentMessage; private viewCurrentInNvim; private editCurrentInNvim; private isReadOnly; private isLive; private isStoppable; private canSteer; private openComposer; /** Recall the newest prior steer, preserving the draft for future editing. */ private recallSteerDraft; } //# sourceMappingURL=conversation-viewer.d.ts.map