/** * Daemon discovery + HTTP client for CLI commands. * Auto-starts daemon if needed, then calls HTTP endpoints. */ import { type DaemonRecord } from "./registry.js"; /** * Connection info the rest of the CLI consumes. The per-serial registry record * is a superset of the old DaemonInfo (it carries `pid` + `port`), so we reuse * it directly as the daemon handle. */ export type DaemonInfo = DaemonRecord; /** * Look up a live daemon for the given serial. Returns the record if its PID is * alive, otherwise cleans up the stale record and returns null. */ export declare function discoverDaemon(serial: string): DaemonRecord | null; /** * Mark the daemon active by sending it SIGUSR1, which its handler routes * to resetIdleTimer(). Long-running sessions call this (via `quest-dev * ping`) so the daemon survives a run it would otherwise idle out of. * Throws if the PID is no longer alive. */ export declare function sendDaemonPing(info: DaemonInfo): void; /** * Resolve the device referenced by `cliDevice` to its serial and return a live * daemon record for it, or null if the device can't be resolved or no live * daemon exists. Never throws — intended for best-effort paths (stop, --off, * config warnings) that must not fail when no device is connected. */ export declare function discoverDaemonForDevice(cliDevice?: string): Promise; export interface SpawnDaemonOptions { serial: string; address: string; /** Only forwarded when the user explicitly set a port (so default binds :0). */ port?: number; host?: string; idleTimeout?: number; lowBattery?: number; unpluggedTimeout?: number; } /** Resolve host from CLI flag → config → default */ export declare function resolveHost(cliHost?: string): string; export interface EnsureDaemonOptions { port?: number; device?: string; host?: string; idleTimeout?: number; lowBattery?: number; unpluggedTimeout?: number; } /** * Ensure a daemon is running for the requested device, starting it if needed. * Resolves the device's stable serial first, then looks up (or spawns) the * per-serial daemon. Returns the registry record. */ export declare function ensureDaemon(opts?: EnsureDaemonOptions): Promise; /** Make an HTTP request to the daemon */ export declare function daemonFetch(info: DaemonInfo, path: string, options?: { method?: string; body?: unknown; }): Promise; /** Convenience: ensure daemon + fetch */ export declare function daemonRequest(path: string, options?: { method?: string; body?: unknown; }): Promise; /** * Stream an NDJSON response from the daemon as an async generator. * Each yielded value is one parsed JSON object from the stream. * * If the daemon returns plain JSON (e.g. a validation 400), the entire * response body is parsed and yielded as a single value, then the * generator returns. This means consumers always see a sequence of * "events" regardless of which response shape they got. */ export declare function daemonFetchNdjson(info: DaemonInfo, path: string, body: unknown): AsyncGenerator; //# sourceMappingURL=client.d.ts.map