import type { Terminal as XtermTerminalType } from "@xterm/headless"; import * as pty from "node-pty"; declare class WriteQueue { private queue; enqueue(writeFn: () => Promise | void): void; drain(): Promise; } export interface ManagedTerminal { id: string; command: string; cwd: string; process: pty.IPty; terminal: XtermTerminalType; startedAt: Date; rawOutput: string; lastStreamReadPosition: number; terminalWriteQueue: WriteQueue; ptyWriteQueue: WriteQueue; running: boolean; exitCode?: number; } export declare class TerminalManager { private processes; private outputHandlers; /** * Start a new process with virtual terminal */ start(command: string, options?: { cwd?: string; name?: string; }): Promise; /** * Stop a process */ stop(id: string): Promise; /** * Stop all processes */ stopAll(): Promise; /** * Send input to a process */ sendInput(id: string, data: string): Promise; /** * Get terminal output (rendered) */ getOutput(id: string, options?: { lines?: number; }): Promise; /** * Get raw output stream */ getStream(id: string, options?: { since_last?: boolean; strip_ansi?: boolean; }): Promise; /** * Get terminal size */ getTerminalSize(id: string): { rows: number; cols: number; scrollback_lines: number; }; /** * Resize terminal */ resizeTerminal(id: string, cols: number, rows: number): void; /** * List all processes */ listProcesses(): Array<{ id: string; command: string; cwd: string; startedAt: string; running: boolean; pid?: number; }>; /** * Get a specific process */ getProcess(id: string): ManagedTerminal | undefined; /** * Register an output handler */ onOutput(sessionId: string, handler: (sessionId: string, data: string) => void): void; /** * Unregister an output handler */ offOutput(sessionId: string): void; } export {}; //# sourceMappingURL=terminal-manager.d.ts.map