import type { ManagedSession, PTYManagerOptions, SessionRunner, StartForkSessionOptions, StartFreshSessionOptions, StartSessionOptions, UserMessage } from "./types"; export declare class CodexPtyRunner implements SessionRunner { private sessions; private onOutput; private onStatusChange; private onPhaseChange; private onReady; private onPermissionChange; private onUserMessage; private log; private pendingReady; private queuedInputs; private openGate; private gateActioned; private quietCheckers; private readyFallbackTimers; private submitWatchTimers; private lastChunkAt; private turnBusy; private openBlockingPrompt; private openCommandApproval; private openPicker; private lastScreenLog; private startPromises; constructor(options?: PTYManagerOptions); start(sessionId: string, options: StartSessionOptions): Promise; private doStart; private launch; startFresh(options: StartFreshSessionOptions): Promise; /** * Fork an existing Codex conversation into a new, independently-owned one * (`codex fork `). * * This is the recovery path for a rollout Codex will not let us resume: fork * starts a *new* rollout seeded from the source's history and never touches * the source's writer, so the terminal / VS Code / desktop client that owns * it keeps running untouched. Like a fresh start, Codex assigns the new * rollout id itself — the returned session is keyed by a local placeholder * until watchForCodexRollout binds the real id. */ startFork(options: StartForkSessionOptions): Promise; private armReadyFallback; private tryReadyFallback; sendKeys(sessionId: string, keys: string): void; sendRawKeys(sessionId: string, keys: string): void; private resolveGateAnswer; sendInput(sessionId: string, input: string): number; private writeSubmit; private armSubmitWatch; private trySubmitStaleRecovery; private flushQueuedInputs; /** * Resize a live PTY. Silent when the session is unknown or has no process: * a terminal emitting SIGWINCH races session exit by nature, and throwing * would turn an ordinary window drag into an error the caller must catch. */ resize(sessionId: string, cols: number, rows: number): void; cancel(sessionId: string): void; killPid(pid: number): void; putOnHold(sessionId: string, signal?: NodeJS.Signals): void; private clearSessionDetectors; getOutput(sessionId: string): string; getOutputLines(sessionId: string, maxLines: number): Promise; getInputHistory(sessionId: string): UserMessage[]; getPid(sessionId: string): number | null; private recordUserMessage; getSession(sessionId: string): ManagedSession | null; hasSession(sessionId: string): boolean; listSessions(): ManagedSession[]; dispose(): void; private handleOutput; private detectScreenState; private handleBlockingPrompt; private handleCommandApproval; private handlePicker; private handleGate; /** * Record the agent's phase and notify only on a real change. The guard is * load-bearing, not an optimisation: detectScreenState runs on every chunk, * so an unguarded setter would fire the WS frame behind this several times a * second for a whole turn while reporting the same value. Same contract as * PTYManager.setPhase — the two runners deliberately stay separate classes. */ private setPhase; private markReady; /** * Tear down a session that failed before it ever became usable, and report * the reason in machine-readable form. * * Deliberately NOT markReady + exit: the caller must be able to tell a * never-started session from a live one, `onReady` must not fire (no * `session_ready` for a failed start), and every piece of per-session state — * queue, timers, quiet-checker, gate cards, screen — has to go, since the * session is removed from the map and nothing will collect it later. */ private failStartup; private handleExit; } //# sourceMappingURL=codex-pty-runner.d.ts.map