import { type ArgsOf, type Event, type Op, type ResultOf } from "./protocol.js"; export declare class DaemonError extends Error { code: string | undefined; constructor(message: string, code?: string); } /** Package root: the nearest ancestor of this module holding package.json. */ export declare function packageRoot(): string; export declare const daemonEntry: () => string; export declare const hostEntry: () => string; export declare class DaemonClient { private sock; private reader; private nextId; private pending; /** M22: lines received so far: an event's or a reply's place in the stream. */ private lines; private listeners; private closeListeners; private closed; private constructor(); /** Connect to a running daemon; rejects when none is listening. */ static connect(socketPath?: string): Promise; /** Connect, starting the daemon first when it is not running. */ static connectOrStart(timeoutMs?: number): Promise; request(op: O, args: ArgsOf): Promise>; /** * M22: a request and where its reply was in the stream: events with a higher `position()` * came after it (an event handled before the reply's continuation runs may be newer). */ requestAt(op: O, args: ArgsOf): Promise<{ result: ResultOf; at: number; }>; /** M22: the place in the stream of the line being handled now. */ position(): number; /** Receive pushed job events; call after request("subscribe", {}). */ onEvent(listener: (event: Event) => void): () => void; /** Called once when the connection drops (not after close()). */ onClose(listener: () => void): () => void; close(): void; private onLine; }