/**
 * HandoffWireTransport — the point-to-point ack/yield channel for the planned
 * handoff protocol (spec §8 G3d/G3e). Symmetric: both machines run it, using the
 * half that matches their role in a given handoff.
 *
 *   OUTGOING machine (HandoffSentinel.initiate):
 *     - awaitAck(timeoutMs): resolves when the incoming POSTs its verified-ack to
 *       /api/handoff/ack (recordAck fires the pending promise); null on timeout.
 *     - sendYield(): POSTs the explicit yield signal to the incoming's
 *       /api/handoff/yield — the ONLY trigger for the incoming's lease CAS. Sent
 *       ONLY after a verified ack + passing validation (HandoffSentinel enforces).
 *
 *   INCOMING machine:
 *     - sendAck(ack): POSTs its "caught up" echo (tailSeq + ingressPosition +
 *       threadHistoryHash) to the outgoing's /api/handoff/ack.
 *     - onYield(cb): the /api/handoff/yield route invokes the registered handler,
 *       which triggers the incoming's lease-CAS acquisition.
 *
 * All POSTs ride the authenticated machine channel (signRequest +
 * machineAuthMiddleware on the receiver). Injected fetch/clock for testability.
 * A handoff is strictly 1:1 with the single peer, resolved by the caller.
 */
import type { HandoffAck } from './HandoffSentinel.js';
export interface HandoffWirePeer {
    machineId: string;
    url: string;
}
export interface HandoffWireTransportDeps {
    selfMachineId: string;
    signingKeyPem: string;
    /** Resolve the single counterpart machine for a handoff (excludes self). */
    peer: () => HandoffWirePeer | null;
    nextSequence: () => number;
    fetchImpl?: typeof fetch;
    now?: () => number;
    logger?: (msg: string) => void;
}
export declare class HandoffWireTransport {
    private readonly d;
    private pendingAck;
    private yieldHandler;
    constructor(deps: HandoffWireTransportDeps);
    private log;
    private fetchImpl;
    private post;
    /** Wait for the incoming machine's ack (resolved by recordAck), or null on timeout. */
    awaitAck(timeoutMs: number): Promise<HandoffAck | null>;
    /** Called by POST /api/handoff/ack — delivers the incoming machine's ack. */
    recordAck(ack: HandoffAck): void;
    /** Send the yield signal to the incoming machine. */
    sendYield(): Promise<boolean>;
    /** Open a planned handoff: POST the flush manifest to the incoming's begin route. */
    sendBegin(manifest: unknown): Promise<boolean>;
    /** Send this machine's "caught up" ack to the outgoing machine. */
    sendAck(ack: HandoffAck): Promise<boolean>;
    /** Register the handler the /api/handoff/yield route invokes (incoming side). */
    onYield(cb: () => void): void;
    /** Called by POST /api/handoff/yield — triggers the incoming's lease CAS. */
    recordYield(): void;
}
//# sourceMappingURL=HandoffWireTransport.d.ts.map