/**
 * @license
 * Copyright 2026 HopCode Team
 * SPDX-License-Identifier: Apache-2.0
 */
import { type Server } from 'node:http';
import { type HttpAcpBridge } from './httpAcpBridge.js';
import type { ServeOptions } from './types.js';
export interface RunHandle {
    server: Server;
    url: string;
    bridge: HttpAcpBridge;
    /** Resolves when the listener has fully closed and the bridge is drained. */
    close(): Promise<void>;
}
export interface RunHopCodeServeDeps {
    /** Bridge instance; tests inject a fake. Defaults to a fresh real one. */
    bridge?: HttpAcpBridge;
}
/**
 * Validate options + start the listener. Resolves once the server is ready
 * to accept connections.
 *
 * Token resolution order:
 *   1. explicit `opts.token`
 *   2. `HOPCODE_SERVER_TOKEN` env var
 *
 * Boot refuses to start when bound beyond loopback without a token; this is a
 * hard rule, not a warning, per the threat model in the design issue.
 */
export declare function runHopCodeServe(optsIn: Omit<ServeOptions, 'token'> & {
    token?: string;
}, deps?: RunHopCodeServeDeps): Promise<RunHandle>;
