/** * LocalPTYSession - Direct node-pty control * * Manages a locally spawned PTY process using node-pty. * * Note: node-pty must be provided by the consuming package as a peer dependency. * This allows the package to remain environment-agnostic. */ import { BasePTYSession } from '#types'; /** * Minimal interface for node-pty IPty * Allows dependency injection without requiring node-pty in this package directly */ export interface IPty { readonly pid: number; readonly cols: number; readonly rows: number; write(data: string | Buffer): void; resize(cols: number, rows: number): void; kill(signal?: string): void; onData: (callback: (data: string | Buffer) => void) => { dispose: () => void; }; onExit: (callback: (exit: { exitCode: number; signal?: number; }) => void) => { dispose: () => void; }; } /** * Options for spawning a PTY process */ export interface PTYSpawnConfig { command: string; args?: string[]; cwd?: string; env?: Record; cols?: number; rows?: number; name?: string; } /** * Function type for spawning PTY processes */ export type PTYSpawnFunction = (config: PTYSpawnConfig) => IPty; export declare function buildInteractivePtyEnv(base?: NodeJS.ProcessEnv | Record, overrides?: Record): Record; /** * Local PTY session with direct node-pty control */ export declare class LocalPTYSession extends BasePTYSession { private pty; private dataDisposable; private exitDisposable; private viewers; /** * Create a LocalPTYSession from an existing IPty instance */ constructor(pty: IPty, options: LocalPTYSessionOptions); /** * Create and spawn a new local PTY session * @param spawn Function to spawn PTY (from node-pty) * @param config Spawn configuration * @param options Additional session options */ static spawn(spawn: PTYSpawnFunction, config: PTYSpawnConfig, options?: Partial): LocalPTYSession; private setupListeners; write(data: string | Buffer): void; resize(cols: number, rows: number): void; kill(signal?: string): void; setFocused(focused: boolean): void; hasViewers(): boolean; getViewerCount(): number; notifyViewerAttached(viewerId: string): void; notifyViewerDetached(viewerId: string): void; dispose(): void; } export interface LocalPTYSessionOptions { /** Session ID (auto-generated if not provided) */ id?: string; /** Command being executed */ command: string; /** Working directory */ cwd?: string; /** Initial focus state */ isFocused?: boolean; /** Output buffer size (default: 1MB) */ outputBufferSize?: number; } //# sourceMappingURL=local-pty-session.d.ts.map