/**
 * Loopback HMAC client for the dashboard process's `/__cli/*` endpoints, used by
 * `botmux dashboard` (rotate) and the post-start/restart hint (current).
 *
 * Two subtleties this module exists to handle correctly:
 *
 * 1. **404 is ambiguous.** Only the dashboard's `/__cli/current` returns 404 to
 *    mean "no token minted yet" (`{ error: 'no_active_token' }`). Any *other*
 *    404 means the request hit a server that doesn't speak the `/__cli`
 *    protocol — most commonly the daemon IPC server, whose unknown-route 404 is
 *    `{ error: 'not_found', path }`. Conflating the two surfaces the infamous
 *    misleading `Rotation failed: no-active-token` when the real problem is that
 *    `.dashboard-port` points at the wrong service.
 *
 * 2. **`.dashboard-port` can go stale.** The dashboard and the daemon IPC server
 *    both `listenWithProbe` upward from adjacent base ports (7891 vs 7892) with
 *    heavily overlapping probe ranges, so across restarts the recorded dashboard
 *    port can end up owned by an IPC server. When the recorded port answers as
 *    the *wrong service*, we rediscover the real dashboard by HMAC-probing the
 *    probe range (only the genuine dashboard can validate the signature) and
 *    self-heal `.dashboard-port`.
 */
export type DashboardEndpoint = '/__cli/rotate' | '/__cli/current';
export type DashboardFailReason = 'no-secret' | 'unreachable' | 'http-error' | 'no-active-token' | 'wrong-service';
export type DashboardResult = {
    ok: true;
    url: string;
} | {
    ok: false;
    reason: DashboardFailReason;
    detail?: string;
};
type FetchImpl = typeof fetch;
/**
 * Classify a 404 from a `/__cli/*` request. A genuine "no token yet" only comes
 * from `/__cli/current` carrying `{ error: 'no_active_token' }`; everything else
 * means the port is answering for some other service (daemon IPC, a stray HTTP
 * server, …), not the dashboard rotate/current routes.
 */
export declare function classifyDashboard404(path: DashboardEndpoint, bodyText: string): DashboardResult;
/** Issue a single HMAC-authed request to one candidate port. */
export declare function requestDashboardAt(opts: {
    host: string;
    port: number;
    path: DashboardEndpoint;
    secret: string;
    fetchImpl?: FetchImpl;
}): Promise<DashboardResult>;
/**
 * Resolve the dashboard URL for `path`, trying the recorded port first and
 * self-healing the port file when it points at the wrong service.
 */
export declare function callDashboard(opts: {
    configDir: string;
    defaultPort: number;
    host?: string;
    envPort?: string;
    probeSpan?: number;
    persistPort?: boolean;
    path: DashboardEndpoint;
    fetchImpl?: FetchImpl;
}): Promise<DashboardResult>;
export {};
//# sourceMappingURL=dashboard-endpoint.d.ts.map