/**
 * ADR-095 G2 — FederationTransport: a ConsensusTransport backed by the
 * federation plugin's ADR-104 WS wire (agentic-flow/transport/loader).
 *
 * @claude-flow/swarm has zero runtime dependencies and shouldn't take a
 * hard dep on @claude-flow/plugin-agent-federation (the wiring would also
 * be circular-ish). So this adapter takes its WS primitives by injection:
 * pass an object that satisfies `AgenticFlowTransportLike` (which the
 * federation plugin's `loadQuicTransport` result does) plus a small amount
 * of consensus-level metadata (this node's id, how to address peers, who
 * the peers are).
 *
 * The agentic-flow transport is fire-and-forget message delivery; this
 * adapter layers request-response on top via per-message correlation ids
 * (`corr`) + a pending-replies map + per-call timeout. Stream multiplexing
 * (ADR-104 stream-mux) is used for the `streamId` so consensus traffic
 * doesn't interleave with application traffic on the same connection.
 *
 * Optional Ed25519 signing: when a keypair is supplied, outbound messages
 * are signed and inbound are verified against the sender's published
 * public key (resolved via `resolvePeerPublicKey`) before reaching the
 * handler. Fail-closed — an unverifiable inbound message is dropped.
 */
import type { ConsensusTransport, ConsensusMessage, ConsensusReply, ConsensusMessageHandler, NodeKeyPair } from './transport.js';
/**
 * Minimal shape of the agentic-flow transport (the `loadQuicTransport`
 * result). We only need send + onMessage + (optional) close. Keeping this
 * structural means swarm doesn't import agentic-flow.
 */
export interface AgenticFlowTransportLike {
    send(address: string, message: {
        type?: string;
        payload: unknown;
        streamId?: string;
    }): Promise<void>;
    onMessage(handler: (msg: {
        from?: string;
        address?: string;
        type?: string;
        payload: unknown;
    }) => void | Promise<void>): void;
    close?(): Promise<void> | void;
}
export interface FederationTransportOptions {
    /** This node's consensus id (the `from` on outbound messages). */
    readonly nodeId: string;
    /** Map a consensus nodeId → the WS address agentic-flow uses to reach it. Return undefined for unknown peers. */
    readonly addressOf: (nodeId: string) => string | undefined;
    /** Currently-known peer consensus node ids (excludes self — or includes; we filter). */
    readonly peerIds: () => readonly string[];
    /** Stream id for consensus traffic (ADR-104 stream-mux). Defaults to 'ruflo-consensus'. */
    readonly streamId?: string;
    /** Default per-`send` timeout in ms. Defaults to 5000. */
    readonly defaultTimeoutMs?: number;
    /** Optional Ed25519 keypair — signs outbound, verifies inbound. */
    readonly keyPair?: NodeKeyPair;
    /** Resolve a peer consensus nodeId → its Ed25519 public key PEM. Required if `keyPair` is set and you want verification. */
    readonly resolvePeerPublicKey?: (nodeId: string) => string | undefined;
}
export declare class FederationTransport implements ConsensusTransport {
    readonly nodeId: string;
    private readonly wire;
    private readonly addressOf;
    private readonly peerIdsFn;
    private readonly streamId;
    private readonly defaultTimeoutMs;
    private readonly keyPair?;
    private readonly resolvePeerPublicKey?;
    private handler;
    private closed;
    private seqCounter;
    private readonly pending;
    private readonly lastSeenSeq;
    constructor(wire: AgenticFlowTransportLike, opts: FederationTransportOptions);
    onMessage(handler: ConsensusMessageHandler): void;
    peers(): readonly string[];
    private stamp;
    send(to: string, msg: Omit<ConsensusMessage, 'from'>, timeoutMs?: number): Promise<ConsensusReply>;
    broadcast(msg: Omit<ConsensusMessage, 'from'>): Promise<void>;
    close(): Promise<void>;
}
//# sourceMappingURL=federation-transport.d.ts.map