import { Buffer } from "node:buffer"; import { type NativePtyLoadResult, type NativePtyUnavailableDiagnostic } from "./native-loader.ts"; import type { TerminalSessionBackend, TerminalSessionDataHandler, TerminalSessionDependencies, TerminalSessionExit, TerminalSessionExitState, TerminalSessionOperationResult, TerminalSessionOptions, TerminalSessionSignal, TerminalSessionTerminateOptions } from "./session-types.ts"; export type { CreateNativeTerminalSession, TerminalSessionBackend, TerminalSessionDataHandler, TerminalSessionDependencies, TerminalSessionExit, TerminalSessionExitError, TerminalSessionExitState, TerminalSessionHandle, TerminalSessionNativeOptions, TerminalSessionOperationResult, TerminalSessionOptions, TerminalSessionSignal, TerminalSessionTerminateOptions, } from "./session-types.ts"; export declare class TerminalSession { readonly options: TerminalSessionOptions; private readonly nativeLoadResult; private readonly createNativeSessionDependency?; private readonly env; private readonly runtimeVersions; private readonly bunRuntime; private readonly rawTailLimit; private readonly dataHandlers; private readonly exitHandlers; private backendHandle; private backendValue; private exitPromise; private settledExit; private rawTailBuffer; private rawByteCount; private lastSignal; private unsubscribeBackendData; constructor(options?: TerminalSessionOptions, dependencies?: TerminalSessionDependencies); get native(): NativePtyLoadResult; get unavailableDiagnostic(): NativePtyUnavailableDiagnostic | null; get backend(): TerminalSessionBackend | null; get command(): string; get status(): "not_started" | "running" | "exited"; get exited(): boolean; get isExited(): boolean; get exitResult(): TerminalSessionExit | null; get rawTail(): Buffer; get rawOutputBytes(): number; get exitState(): TerminalSessionExitState; start(): this; onData(handler: TerminalSessionDataHandler): () => void; onExit(handler: () => void): () => void; write(data: string | Uint8Array): TerminalSessionOperationResult; resize(cols: number, rows: number): TerminalSessionOperationResult; kill(signal?: TerminalSessionSignal): TerminalSessionOperationResult; stop(): TerminalSessionOperationResult; /** * Stop the session for real: signal (SIGTERM by default), wait `graceMs` for * the exit, then escalate to SIGKILL and wait `forcedGraceMs`. Resolves with * the settled exit, or `null` when the process outlived both waits (or was * never started). */ terminate(options?: TerminalSessionTerminateOptions): Promise; waitExit(): Promise; private waitBackendExit; /** Await the settled exit for at most `graceMs`; `null` means it did not settle in time. */ private waitExitWithin; private settleExit; private emitData; private appendRawTail; } export declare function createTerminalSession(options?: TerminalSessionOptions, dependencies?: TerminalSessionDependencies): TerminalSession; //# sourceMappingURL=session.d.ts.map