/**
 * TelegramRelay — the tokenless-standby outbound relay (bug #7), extracted as a
 * pure, testable unit.
 *
 * A multi-machine pool standby serving a moved session holds NO Telegram bot
 * token (single-owner invariant — avoids the 409 poller conflict). When such a
 * standby needs to reply, `TelegramAdapter.sendToTopic` invokes this relay,
 * which POSTs the reply to the Telegram-OWNING lease holder's
 * `/telegram/reply/:topicId` so the message reaches the user without the standby
 * ever sending on the shared bot.
 *
 * THE BUGS THIS FIXES (found driving the live multi-machine proof, 2026-06-01):
 *  1. NO TIMEOUT — the original `fetch` had no AbortSignal, so when the holder's
 *     tunnel was momentarily unreachable (e.g. mid-restart) the relay HUNG until
 *     the calling client gave up (observed >70s with no result). A moved
 *     session's reply must fail FAST and surface, not hang.
 *  2. SILENT FAILURE — every failure path returned null with no log line, so a
 *     dropped reply was invisible (no peer URL, non-2xx, network error, timeout
 *     all looked identical: nothing). Driving it live was the only way to see it.
 *
 * This module makes the relay bounded + observable. The transport (fetch) and
 * clock are injected so the timeout/branch behavior is deterministically
 * unit-testable without real network or wall-clock.
 */
export interface RelayResult {
    messageId: number;
    topicId: number;
}
export interface RelayDeps {
    /** Resolve the lease holder's machine id, or null if we hold it / none known. */
    leaseHolder: () => string | null;
    /** This machine's own mesh id (so we never relay to ourselves). */
    selfMachineId: string;
    /** Resolve a peer machine id to its reachable base URL, or null. */
    peerUrl: (machineId: string) => string | null;
    /** Bearer token for the holder's authenticated /telegram/reply. */
    authToken: string | undefined;
    /** Max ms to wait for the holder before failing fast. */
    timeoutMs: number;
    /** Injected fetch (defaults to global fetch). */
    fetchImpl?: typeof fetch;
    /** Injected logger for the (previously silent) failure paths. */
    log?: (line: string) => void;
}
/**
 * Relay one outbound reply through the lease holder. Returns the sent message's
 * RelayResult, or null when it could not be delivered (logged, never silent).
 */
export declare function relayOutbound(topicId: number, text: string, opts: {
    silent?: boolean;
    kindMetadata?: Record<string, unknown>;
} | undefined, deps: RelayDeps): Promise<RelayResult | null>;
//# sourceMappingURL=TelegramRelay.d.ts.map