/** Writes one JSON line back to the connection a request arrived on. */ export interface JsonLineReply { send(message: Res): void; } export interface JsonLineServerOptions { /** Log scope. */ name: string; /** `postmortem` cleanup label. */ cleanupLabel: string; /** Idle window (nothing {@link JsonLineServer.busy}, no request received) after which the process exits. */ idleMs: number; /** Stdout line announcing the bound endpoint. */ banner(endpoint: string): string; /** Handle one parsed request line; `reply` reaches only the requesting connection. */ onRequest(request: Req, reply: JsonLineReply): void; /** Runs synchronously as stop begins, before connections and the listener close. */ beforeStop?(): void; /** Runs once during stop, after the listener closes. */ onStop?(): Promise; } /** * Newline-JSON request loop over a native {@link IpcServer}: the server half of * the machine-shared workers (`shared-worker.ts` is the client half; * `mlx-server.py` mirrors it in Python) and of the text-prediction daemon. * Owns one endpoint — binding, owner-only permissions, and taking over a * crashed predecessor's socket are native; a live owner makes {@link serve} * reject with `EADDRINUSE` — feeds every connection's request lines to * `onRequest`, and exits the process once idle. */ export declare class JsonLineServer { #private; constructor(options: JsonLineServerOptions); /** Bind `endpoint` and serve until idle exit or {@link exit}; resolves once the endpoint is released. */ serve(endpoint: string): Promise; /** Count `work` as in flight, holding off idle exit until it settles. */ busy(work: () => Promise): Promise; /** Release the endpoint, then exit the process. */ exit(reason: string): void; }