export interface CreateApiServerOptions { /** Opt-in TCP listener as `host:port` (or `:port` for all interfaces). * Falls back to `CRTRD_TCP` when unset. Absent → unix socket only. */ tcp?: string; } export interface ApiServer { /** Tear down both listeners and unlink the socket file. Double-close safe. */ close(): Promise; } /** Create and start the crtrd API server (A-9). Returns immediately with a * `close()` handle; the listeners bind asynchronously (a unix socket's file is * created on `listen`, so its 0600 chmod happens in the listen callback). A * bind failure or a post-listen accept error is emitted and swallowed — it must * NEVER become an unhandled 'error' that crashes the daemon. * * NOTE (correction to the plan's "one http.Server bound twice"): a Node * `net.Server`/`http.Server` binds exactly ONE handle — a second `.listen()` * on the same instance throws `ERR_SERVER_ALREADY_LISTEN`. So the two listeners * are two `http.Server` instances SHARING the same request + upgrade handler * functions (the standard way to bind one logical API to two transports). The * Router and attach bridge are process-wide singletons, so both servers route * into identical state. */ export declare function createApiServer(opts?: CreateApiServerOptions): ApiServer;