CollabMessage
type CollabMessage = | { head: number; peer: Peer; type: "hello";} | { head: number; peers: Peer[]; type: "welcome";} | { base: number; from: PeerId; records: LedgerRecord[]; type: "submit";} | { order: number; records: LedgerRecord[]; type: "confirm";} | { ids: string[]; type: "reject";} | { from: PeerId; have: number; type: "sync";} | { clock: number; peer: Peer; state: PresenceState; type: "presence";} | { peerId: PeerId; type: "bye";};Defined in: collab-transport.ts:91
The collaboration wire protocol — a small JSON-safe discriminated union. Carry it over any duplex channel. Field meanings:
hello/welcome: handshake.headis the authority’s canonical length.submit: a client offers records authored against versionbase.confirm: the authority’s canonical records starting atorder(contiguous).reject: ids the authority refused (a rebase bailed) — drop them locally.sync: a late/re-joining client asks for everything sincehave.presence: ephemeral awareness relay (never touches the ledger).bye: a peer is leaving.