/** Local PTY handles are scoped to their creating window and conversation. */ export interface TerminalReplayChunk { data: string; cols: number; rows: number } export interface TerminalHostView { id: string sessionId?: string cwd: string title: string shell: string cols: number rows: number /** Bounded ANSI output replay; credentials are never added to the shell environment. */ buffer: string replay: TerminalReplayChunk[] sequence: number exited: boolean exitCode?: number } export type TerminalHostEvent = { id: string sessionId?: string sequence: number } & ({ type: 'data'; data: string } | { type: 'exit'; exitCode: number }) export interface TerminalHostApi { create(sessionId?: string, cols?: number, rows?: number): Promise get(id: string, sessionId?: string): Promise write(id: string, data: string, sessionId?: string): Promise resize(id: string, cols: number, rows: number, sessionId?: string): Promise clear(id: string, sessionId?: string): Promise rebind(id: string, previousSessionId: string | undefined, nextSessionId: string): Promise close(id: string, sessionId?: string): Promise onEvent(listener: (event: TerminalHostEvent) => void): () => void }