/**
 * Builds the public URL for a session's web terminal. When the per-daemon
 * reverse proxy (terminal-proxy.ts) is up, URLs go through it under
 * `/s/{sessionId}` so users only forward one port. If the proxy failed to bind,
 * we fall back to the worker's own port so links never go dead — the proxy is
 * an enhancement, not a hard dependency. externalHost is read live (not
 * snapshotted) so cards stay correct across network changes.
 *
 * When WEB_EXTERNAL_PORT is configured the proxy-mode link advertises that port
 * (set via setTerminalExternalPort) instead of the local proxy port, so a relay
 * host can front the terminal on a different port number. It only applies in
 * proxy mode — the single fronting port maps cleanly to one external port; the
 * direct fallback uses per-session worker ports that one external port can't
 * represent, so the override is ignored there.
 */
interface TerminalUrlSession {
    session: {
        sessionId: string;
        webPort?: number | null;
    };
    workerPort: number | null;
    workerToken: string | null;
}
/** Marks the proxy live on `port`. Called only after a successful bind. */
export declare function setTerminalProxyPort(port: number): void;
/** Override the port shown in proxy-mode links (WEB_EXTERNAL_PORT + botIndex).
 *  0 reverts to advertising the local proxy port. */
export declare function setTerminalExternalPort(port: number): void;
/** Bound proxy port, or 0 when the proxy is not available. */
export declare function getTerminalProxyPort(): number;
/** Port clients should use to reach the proxy: the configured external port
 *  (WEB_EXTERNAL_PORT + botIndex) when set, else the bound proxy port; 0 when
 *  the proxy isn't up. Single source of truth for the proxy-mode port that both
 *  buildTerminalUrl (card links) and the dashboard rows advertise, so they agree
 *  on the same external port instead of diverging. */
export declare function getTerminalAdvertisedPort(): number;
/** Test/edge helper: revert to the no-proxy (direct-port) state. */
export declare function resetTerminalProxy(): void;
export declare function buildTerminalUrl(ds: TerminalUrlSession, opts?: {
    write?: boolean;
}): string;
export {};
//# sourceMappingURL=terminal-url.d.ts.map