/** * Minimal LSP client for ContextAtlas adapters. * * Implements the LSP wire protocol directly over a subprocess's stdio: * Content-Length-framed JSON-RPC, request/response correlation by id, * notification handlers, server-initiated request stubbing, and a * shutdown/exit lifecycle. * * Per CLAUDE.md, we deliberately do NOT depend on vscode-jsonrpc or * vscode-languageclient — the subset we need is compact and easier to * reason about when we own the framing code. */ type JsonValue = unknown; export declare class LspClient { private child; private nextId; private pending; private notificationHandlers; private requestHandlers; private buffer; private readonly name; /** * Tracks whether {@link stop} was invoked. Distinguishes intentional * shutdown from unexpected subprocess exit per v0.7 Step 2.2.c FO-5 * fix: when subprocess exits with `shuttingDown === false`, the * exit listener emits substantive remediation guidance to stderr * (Travis Lock 1 γ hybrid scope). */ private shuttingDown; /** * Test seam — stderr writer used for unexpected-exit remediation * guidance. Default emits to `process.stderr`. Tests inject a fake * writer to capture output without polluting Vitest stderr. */ private readonly writeStderr; /** * When true, emit substantive LSP message logging at info level * (method name + direction + payload truncated to 200 chars). Per * v0.7 Step 2.2.d FO-6 (β) diagnostic substrate — extends existing * `--verbose` CLI flag to adapter init paths for substantive * cohort self-diagnosis. */ private readonly verbose; /** * Wall-clock timestamp (ms; Date.now()) at `start()` invocation; * null before start. Used by `getInitializeDuration()` for adapter * health diagnostic exposure to doctor checks. */ private startedAtMs; /** * Wall-clock timestamp (ms) of first message received from server; * null if no message received yet. Used by `getFirstResponseLatency()` * for adapter health diagnostic. */ private firstResponseAtMs; constructor(name: string, options?: { writeStderr?: (chunk: string) => void; verbose?: boolean; }); /** * Wall-clock duration (ms) from `start()` to first message received * from server. Null when subprocess hasn't started or no message * received yet. Per v0.7 Step 2.2.d FO-6 (β) diagnostic substrate. */ getFirstResponseLatencyMs(): number | null; /** * Wall-clock duration (ms) since `start()`. Null when subprocess * hasn't started. Per v0.7 Step 2.2.d FO-6 (β) diagnostic substrate. */ getUptimeMs(): number | null; start(command: string, args: string[], cwd: string): void; request(method: string, params?: JsonValue, timeoutMs?: number): Promise; notify(method: string, params?: JsonValue): void; onNotification(method: string, handler: (params: JsonValue) => void): void; onRequest(method: string, handler: (params: JsonValue) => JsonValue | Promise): void; stop(): Promise; private handleData; private dispatch; private sendRaw; } export {}; //# sourceMappingURL=lsp-client.d.ts.map