Wire format as implemented (fuzzball 1.0.0)
The documents in this directory are the v0.1 drafts moved from Mouser
(docs/protocol/). The wire version is still v=0. This file records what Mouser 1.1.x
and the WeirdBrains/crossterm fuzzball feature actually emit and accept, where that is
more specific than, or differs from, the drafts. The fuzzball crate follows this file,
and tests/golden.rs locks it.
Framing
;is always written, even when a message has no params.- Payload separator. A
:starts a payload only when the params before it containlen. Every payload-taking verb requireslen. Values may contain:: the capability reply'sg_fmt=rgba:rgb:pngdoes. (Mouser's terminal-side parser splits app→terminal messages at the first:. That never matters for valid messages, because no app→terminal value contains:.) - Raw payload framing error. When
STdoes not follow anenc=rawpayload oflenbytes, the bytes up to the end of the payload are skipped and parsing resumes there. - Duplicate params: the last one wins. Items without
=are ignored. - Numbers: unsigned decimal, 1–10 digits, no sign. Anything else counts as absent.
- Message limits: Mouser keeps up to
max_chunk + 1024= 66 560 bytes. The crossterm fork drops input messages over 4096 bytes.
Common
- The capability reply has no
ok=:c r ; id=<n>,v=0,sub=gkps,raw=0,.... Mouser always reportsraw=0(the README §4 example showsraw=1) andsub=gkps. - Every error reply carries
msg=:id=<n>,ok=0,err=<CODE>,msg=<text>. Inp rthe text is plain ASCII with spaces (msg=denied by the user). Ins rit is percent-encoded.
Keyboard (differences from the v0 keyboard.md draft)
key=U+XXXXuses uppercase hex and at least 4 digits, with more for non-BMP characters (U+1F600). Decoders accept either case.text=is lowercase hex UTF-8. Decoders accept either case. Odd length or invalid UTF-8 makes the event invalid, so it is dropped.- Text is omitted on releases, and on presses or repeats while Ctrl, Alt or Super is held (shortcuts). The draft only implies this through its Ctrl+c example.
- Named keys are winit
NamedKeynames. These match W3Ckeynames for common keys, with these exceptions:- The Windows/Command key is
key=Super(W3C saysMeta). - Space is a character:
key=U+0020,text=20, not a named key. - The fork also accepts
OSfor Super, andClear.
- The Windows/Command key is
- Modifier bits: Mouser sets bit 8 (SUPER) for both the Super and the Meta key, and never sends bit 32 (META). Bits 16 (HYPER) and 64 (ALTGR) are set only on the Hyper and AltGraph keys' own events.
locksis never sent by Mouser (always 0), and no IME messages are sent (k_ime=0). Both are decoded when present. The crossterm fork consumesstart/update/canceland delivers multi-character commits as paste.k sreplies too. With anid,k sis answeredk r ; id=<n>,ok=1,on=<0|1>, the same shape ask q. A badonvalue getsEINVAL, andv≠ 0 getsEVERSION.- Field order written:
t, code, key, mods, locks, ime, text. IME messages carry nocodeorkey. Parsers must not depend on the order. - Validity rules (the fork's, kept by the crate):
tis required.- A non-IME event needs a non-empty
key. - A bad
t,mods,locks,textorimemakes the whole event invalid. - Unknown params are ignored.
- The enable command is exactly
ESC P = F z k s ; on=1,v=0 ESC \(no id), and disable isESC P = F z k s ; on=0 ESC \.
Graphics
- Chunk
more:- A single-chunk upload sends no
more. - A multi-chunk upload sends
more=1on every chunk but the last, which sendsmore=0. - The first chunk writes params in the order
id,fmt,w,h,size,enc,len[,more]. - Continuation chunks write
id,enc,len,more.
- A single-chunk upload sends no
- Place params are written in the order
id,pid,cols,rows,sx,sy,sw,sh,fit,z,move. Delete params are written aswhat,id,pid,free.
Shell
- Advertise params are written as
v=0,shell=<name>,caps=<a+b>, and withdraw isv=0,caps=. Mouser accepts any order.