export type CodexRecord = Record; /** Explicit JSON-RPC error returned by Codex App Server (request was rejected, not lost in transit). */ export declare class CodexRpcError extends Error { readonly code?: number; constructor(message: string, code?: number); } export type CodexAppServerOptions = { binaryPath?: string; homePath?: string; onRequest?: (method: string, params: CodexRecord) => Promise | CodexRecord; }; export declare function record(value: unknown): CodexRecord | undefined; export declare function deferred(): { promise: Promise; resolve: (value: T) => void; reject: (reason: unknown) => void; }; /** One stdio connection for a single xopc run. Codex persists the thread on disk. */ export declare class CodexAppServer { private readonly child; private readonly pending; private readonly closed; private failure; private closing; private exitTimer?; private closingProcess?; private buffer; private stderrTail; private nextId; private onNotification?; private onFailure?; private onRequest?; constructor(cwd: string, onNotification: (method: string, params: CodexRecord) => void, onFailure: (error: Error) => void, options?: CodexAppServerOptions); request(method: string, params: CodexRecord, signal?: AbortSignal): Promise; notify(method: string): void; private send; isAlive(): boolean; setHandlers(handlers: { onNotification?: (method: string, params: CodexRecord) => void; onFailure?: (error: Error) => void; onRequest?: (method: string, params: CodexRecord) => Promise | CodexRecord; }): void; private receive; close(force?: boolean): Promise; }