import type { Readable, Writable } from 'node:stream'; export declare class Connection { private readonly stdin; private readonly stdout; private nextId; private readonly pending; private readonly events; /** * Receive state is a two-phase machine instead of one growing buffer. * * The old shape — `buffer = Buffer.concat([buffer, chunk])` per 'data' * event until the full message arrived — is quadratic in the message size: * a 16 MiB response (workspace symbols on a large repository) delivered in * 64 KiB reads re-copies the accumulated buffer every read, ~2 GiB of * copying for that one message, on the hot path of every LSP round trip. * * Headers still accumulate by concat, because the `\r\n\r\n` terminator can * straddle a chunk boundary — but a header block is bounded by * `MAX_HEADER_BYTES`, so that concat is trivially cheap. The body's length * is known from Content-Length before its first byte arrives, so body * chunks are held in an array and joined exactly once, at the boundary. */ private headerBuffer; private bodyParts; private bodyReceived; /** Expected body byte count; -1 while parsing headers. */ private bodyExpected; private closed; private readonly onStdoutData; private readonly onStdoutClose; private readonly onStdoutError; private readonly onStdinError; constructor(stdin: Writable, stdout: Readable); sendRequest(method: string, params: unknown, timeoutMs: number, signal: AbortSignal): Promise; sendNotification(method: string, params: unknown): void; onNotification(method: string, handler: (params: unknown) => void): () => void; onClose(handler: () => void): () => void; close(): void; private closeWithError; private onData; private dispatchBody; private handleMessage; private write; private assertOpen; private failAll; } //# sourceMappingURL=connection.d.ts.map