/**
 * The local carrier a hand serves on (senpi#5840): one stream socket (an owner-only Unix socket, a named pipe on
 * Windows) carrying the reference transport's packets, one JSON object per LF-terminated line with the data payload in
 * base64. The carrier only moves packets; per-lane order, exactly-once delivery and resume after a re-attach are the
 * reference transport's (`createReliableTransport`). A local client (a device service, a test harness) speaks the same
 * lines with {@link attachSocketCarrier} on its end.
 */
import type { Server, Socket } from "node:net";
import type { TransportSide } from "@earendil-works/pi-agent-core";
/** What a carrier drives on the transport endpoint it serves. */
export type CarrierSide = Pick<TransportSide, "attached" | "message" | "writable" | "detached">;
/**
 * Makes `socket` the current connection of `side` until it closes. Returns `detach`, which ends this connection's
 * hold on the side (the socket's own close does the same) without signalling it twice.
 */
export declare function attachSocketCarrier(socket: Socket, side: CarrierSide, report: (message: string) => void): () => void;
/**
 * Serves `side` on `server`: the newest connection is the carrier, and an older one is dropped when a new one arrives.
 * With a `secret` (the Windows named pipe; the same handshake the shared RPC host uses), a connection becomes the
 * carrier only after it sent the secret's bytes first (`authenticateSocket`), so a connection without it never
 * displaces the current carrier.
 */
export declare function serveSocketCarrier(server: Server, side: CarrierSide, secret: Uint8Array | undefined, report: (message: string) => void): void;
//# sourceMappingURL=socket-carrier.d.ts.map