import type { Readable, Writable } from "node:stream";
export declare class JsonRpcRequestError extends Error {
    readonly code: number;
    constructor(method: string, code: number, message: string);
}
export type NotificationHandler = (params: unknown) => void;
/**
 * JSON-RPC connection speaking Content-Length framed messages.
 *
 * Server→client REQUESTS are auto-replied with safe defaults so language
 * servers never stall waiting on us: `workspace/configuration` gets one null
 * per requested item; everything else (`client/registerCapability`,
 * `window/workDoneProgress/create`, …) gets a plain null result.
 */
export declare class JsonRpcConnection {
    private readonly output;
    private buffer;
    private nextId;
    private readonly pending;
    private readonly notificationHandlers;
    private disposed;
    constructor(input: Readable, output: Writable);
    onNotification(method: string, handler: NotificationHandler): void;
    request(method: string, params: unknown, timeoutMs: number): Promise<unknown>;
    notify(method: string, params?: unknown): void;
    /** Reject all in-flight requests and stop accepting new work. */
    dispose(): void;
    private send;
    private onData;
    private onMessage;
}
//# sourceMappingURL=jsonrpc.d.ts.map