/** * The mirror's wire: one JSON object per line, both ways. * * `mirror.ts` decides who can be attached to and what a client's word does; * this file only carries lines between a socket and that decision. Nothing * here may throw into the process: a client sending garbage has its connection * closed, and the run never hears of it. */ import type { Socket } from "node:net"; import type { MirrorIn, MirrorOut, Mirrored } from "./mirror.ts"; /** What the wire asks of the mirror, so this file holds no registry of its own. */ export type Mirrors = { /** The subagent registered under `id`, if any. */ find(id: string): Mirrored | undefined; /** What an attached client asked for. */ act(mirrored: Mirrored, input: MirrorIn, reply: (out: MirrorOut) => void): Promise; /** The first line a client receives once attached. */ hello(mirrored: Mirrored): MirrorOut; }; /** Sends one line to every client attached to `id`. */ export declare function broadcast(id: string, out: MirrorOut): void; /** Ends every connection to `id`. What the subagent's close does to its panes. */ export declare function hangUp(id: string): void; /** One client, from its first line to its last. */ export declare function serve(socket: Socket, mirrors: Mirrors): void; //# sourceMappingURL=mirror-wire.d.ts.map