/** * Daemon-side wrapper around the PR2 `createDaemonClient` (PR3 C3). * * Daemons calling Route B (`/__daemon/*`) live in the same host as the * dashboard but use a separate process; they need a `DaemonClient` that: * - signs with `~/.botmux/.dashboard-secret` * - targets the port the dashboard is actually bound to (which may differ * from the configured default when EADDRINUSE forces a probe upward), * read from `~/.botmux/.dashboard-port` * - reports the daemon's own larkAppId in the audit header * * Caching rationale (plan v3 B6): we do NOT cache the resulting client per * larkAppId. `createDaemonClient` is cheap (one secret file read + a closure) * and a cached instance would route to a stale port if the dashboard * process restarts on a different bound port. Per-request `create + sign + * fetch` is the safe default. * * Port parser strictness (plan v4 B4): we use `Number(raw.trim())` plus * `Number.isInteger` and a `1..65535` range check. `parseInt('7891abc', 10)` * silently returns `7891`, which would make a corrupt file indistinguishable * from the default — exactly the case the regression tests pin down. */ import { createDaemonClient as defaultCreateDaemonClient, type DaemonClient } from './dashboard/daemon-internal-client.js'; /** Optional injection seam — tests provide alternate paths / factories. */ export interface ClientWrapperOptions { /** Override `.dashboard-port` location (tests point at tmp files). */ portPath?: string; /** Override the underlying `createDaemonClient` factory (tests assert call count). */ createClient?: typeof defaultCreateDaemonClient; } /** * Read `.dashboard-port` if present and parseable; otherwise return the * default 7891. Pure with respect to its `portPath` argument. */ export declare function resolveDashboardUrl(portPath?: string): string; /** * Build a fresh `DaemonClient` for the given larkAppId. New instance per * call by design — see the caching rationale in the module-level comment. */ export declare function createDaemonClientFor(larkAppId: string, opts?: ClientWrapperOptions): DaemonClient; //# sourceMappingURL=daemon-internal-client-wrapper.d.ts.map