/**
 * Codex JSON-RPC Client
 *
 * JSON-RPC 2.0 over JSONL stdio protocol layer for communicating
 * with the Codex app-server. Handles request/response multiplexing,
 * server-initiated requests, and notification dispatch.
 *
 * Note: Codex app-server omits the "jsonrpc":"2.0" header —
 * we do not require or emit it.
 *
 * @module
 */
import type { Writable, Readable } from 'node:stream';
/** Handler for server-initiated notifications (no id, has method) */
export type NotificationHandler = (method: string, params: unknown) => void;
/** Handler for server-initiated requests (has both id and method) */
export type ServerRequestHandler = (id: number, method: string, params: unknown) => void;
/**
 * JSON-RPC 2.0 client over JSONL stdio.
 *
 * Multiplexes incoming messages by inspecting `id` and `method` fields:
 * - Has `id` + no `method` → response → resolve/reject pending promise
 * - Has `method` + no `id` → notification → dispatch to notification handler
 * - Has both `method` + `id` → server-initiated request → dispatch to request handler
 */
export declare class CodexJsonRpcClient {
    private stdin;
    private nextId;
    private pending;
    private notificationHandler;
    private serverRequestHandler;
    private lineBuffer;
    private closed;
    constructor(stdin: Writable, stdout: Readable);
    /** Send a request and await the response */
    request(method: string, params?: unknown): Promise<unknown>;
    /** Send a notification (no response expected) */
    notify(method: string, params?: unknown): void;
    /** Reply to a server-initiated request */
    respond(id: number, result: unknown): void;
    /** Register a handler for server notifications */
    onNotification(handler: NotificationHandler): void;
    /** Register a handler for server-initiated requests */
    onServerRequest(handler: ServerRequestHandler): void;
    /** Close the client, rejecting all pending requests */
    close(): void;
    /** Feed stdout data for JSONL line-buffered parsing */
    private onData;
    private dispatch;
    private writeLine;
}
//# sourceMappingURL=jsonrpc-client.d.ts.map