import { ChildProcessWithoutNullStreams } from 'node:child_process'; import { Buffer } from 'node:buffer'; export type ProcessState = 'starting' | 'running' | 'waiting' | 'finished' | 'error'; export interface SessionStatus { id: string; state: ProcessState; isWaitingForInput: boolean; detectedPrompt: string | null; pid?: number; uptime: number; exitCode: number | null; queuedStdinWrites: number; lastAccessed: string; } export interface SessionOutputEntry { timestamp: number; data: string; source: 'stdout' | 'stderr'; } export interface CreateSessionOptions { customPrompts?: RegExp[]; maxOutputLines?: number; maxBufferChars?: number; promptCheckInterval?: number; } export declare class ProcessSession { readonly id: string; process: ChildProcessWithoutNullStreams | null; exitCode: number | null; errorMessage: string | null; processState: ProcessState; detectedPrompt: string | null; isWaitingForInput: boolean; earlyExitDetected: boolean; private readonly output; private outputBuffer; private readonly customPrompts; private readonly stdinQueue; private isProcessingQueue; private readonly config; private readonly createdAt; private lastAccessed; constructor(id: string, options?: CreateSessionOptions); isExpired(timeoutMs?: number): boolean; touch(): void; addOutput(data: string | Buffer, source?: 'stdout' | 'stderr'): void; getRecentOutput(lines?: number): string; getOutputLength(): number; getOutputFrom(index: number): SessionOutputEntry[]; getStatus(): SessionStatus; private stripAnsi; checkForPrompt(): boolean; getPromptType(): string | null; writeInput(input: string, waitForPrompt: boolean, timeout: number): Promise<{ output: SessionOutputEntry[]; state: ProcessState | 'timeout'; }>; private processQueue; waitForResponse(timeout: number): Promise; destroy(): void; clearOutput(): void; } export interface SpawnOptions { command: string; cwd: string; env?: Record; shell: string; pathEnv: string; } export declare function spawnProcess(options: SpawnOptions): ChildProcessWithoutNullStreams; export declare const DEFAULT_SHELL: string; export declare const DEFAULT_PATH = "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"; //# sourceMappingURL=session.d.ts.map