/** * BunTerminal - A wrapper around Bun's built-in Terminal API * that provides an interface compatible with the IPty interface. * * This replaces @skitee3000/bun-pty to avoid native library issues * when running compiled Bun binaries. */ /** * Interface for disposable resources. */ export interface IDisposable { dispose(): void; } /** * Exit event data for PTY process. */ export interface IExitEvent { exitCode: number; signal?: number | string; } /** * Options for spawning a new PTY process. */ export interface IPtyForkOptions { name: string; cols?: number; rows?: number; cwd?: string; env?: Record; rawMode?: boolean; } /** * Interface for interacting with a pseudo-terminal (PTY) instance. */ export interface IPty { readonly pid: number; readonly cols: number; readonly rows: number; readonly process: string; readonly onData: (listener: (data: string) => void) => IDisposable; readonly onExit: (listener: (event: IExitEvent) => void) => IDisposable; write(data: string): void; resize(columns: number, rows: number): void; kill(signal?: string): void; } /** * Spawn a new PTY process using Bun's built-in Terminal API. * * @param file - The command to execute * @param args - Arguments to pass to the command * @param options - PTY fork options * @returns An IPty instance */ export declare function spawn(file: string, args: string[], options: IPtyForkOptions): IPty;