Framing
Each frame is a 4-byte big-endian payload length followed by a serialized protocol message.
Protocol
Every client starts with Hello and rejects contract mismatches. Version 3 carries compact pairing tickets while preserving the raw PTY byte contract: local IPC uses bincode, mobile transport uses MessagePack, and iroh accepts only paired mobile client kinds.
Each frame is a 4-byte big-endian payload length followed by a serialized protocol message.
AttachSession.last_seen_seq requests warm replay from the PTY byte ring. Stale clients receive a daemon-rendered ANSI snapshot.
Pairing uses a 5-character Crockford code plus a compact sh1 PairingTicket. A single active code expires after 5 minutes, wrong attempts are capped, and the desktop must approve the request.
Paired mobile clients can list, create shell-only sessions, kill, attach, input, resize, detach, ping, and register push tokens. Agent-state events remain desktop-CLI-only, and desktop CLI clients use the local Unix socket instead of iroh.