Protocol

Contract version 3.

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.

Framing

Each frame is a 4-byte big-endian payload length followed by a serialized protocol message.

Attach and replay

AttachSession.last_seen_seq requests warm replay from the PTY byte ring. Stale clients receive a daemon-rendered ANSI snapshot.

Pairing

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.

Mobile capabilities

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.