import { type ChildProcessWithoutNullStreams } from 'node:child_process'; import type { ExitRecord } from './types.js'; type JsonObject = Record; type RequestId = string | number; export interface CodexAppServerTransportOptions { name: string; argv: string[]; cwd: string; env: Record; log(line: string): void; requestTimeoutMs?: number; onNotification?(method: string, params: JsonObject): void; onRequest?(method: string, id: RequestId, params: JsonObject): void; onExit?(exit: ExitRecord): void; } export interface CodexAppServerConnection { readonly pid: number; readonly child: Pick; isAlive(): boolean; exitResult(): ExitRecord | null; request(method: string, params?: JsonObject, timeoutMs?: number): Promise; notify(method: string, params?: JsonObject): void; respond(id: RequestId, result: unknown): void; respondError(id: RequestId, code: number, message: string): void; close(): Promise; } export type CodexAppServerTransportFactory = (options: CodexAppServerTransportOptions) => Promise; /** Minimal, version-tolerant JSONL client for Codex app-server's stdio transport. */ export declare class CodexAppServerTransport implements CodexAppServerConnection { private readonly options; readonly child: ChildProcessWithoutNullStreams; readonly pid: number; private nextId; private readonly pending; private readonly requestTimeoutMs; private readonly exited; private resolveExited; private closed; private exit; private constructor(); static start(options: CodexAppServerTransportOptions): Promise; isAlive(): boolean; exitResult(): ExitRecord | null; request(method: string, params?: JsonObject, timeoutMs?: number): Promise; notify(method: string, params?: JsonObject): void; respond(id: RequestId, result: unknown): void; respondError(id: RequestId, code: number, message: string): void; close(): Promise; private waitForExit; private write; private receive; } export {};