/** * JSON line protocol over Unix socket. * * Wire format: one JSON object per line. * Request : { id: string, method: string, params: object } * Response: { id: string, ok: true, data: any } | { id: string, ok: false, error: {code, message, details?} } */ import { type Interface } from 'node:readline'; import type { Socket } from 'node:net'; import { CloakError } from '../errors.js'; export type RpcRequest = { id: string; method: string; params?: Record; }; export type RpcResponseOk = { id: string; ok: true; data: unknown; }; export type RpcResponseErr = { id: string; ok: false; error: ReturnType; }; export type RpcResponse = RpcResponseOk | RpcResponseErr; export declare function send(sock: Socket, msg: RpcRequest | RpcResponse): boolean; export declare function readLines(sock: Socket): Interface; export declare function nextId(): string; export declare function makeError(id: string, err: unknown): RpcResponseErr; export declare function makeOk(id: string, data: unknown): RpcResponseOk; //# sourceMappingURL=protocol.d.ts.map