{"$comment": "The terminal's wire, written down ONCE and held by BOTH halves. The Rust half (`cotton-ffi`, phone::terminal tests) feeds every `request` to the core and asserts none is a `bad_request`, feeds every `refused` and asserts each one IS, and emits every `event` through the real `EventSink`. The Swift half (`TerminalWireTests`) builds each `request` from its `given` through `CottonKit`'s boundary types and asserts byte-equality, and reads every `event` through `TerminalBus`. Change a field name on either side and one of the two goes red. Hand-edited; every value is synthetic.","calls": [ {"case": "attach, before the emulator has been laid out","method": "terminal.attach","given": { "session": "s-1", "measuredCols": 0, "measuredRows": 0 },"request": { "session": "s-1", "cols": 80, "rows": 24 } }, {"case": "attach, with the grid the view reported","method": "terminal.attach","given": { "session": "s-1", "measuredCols": 52, "measuredRows": 19 },"request": { "session": "s-1", "cols": 52, "rows": 19 } }, {"case": "write, a typed line","method": "terminal.write","given": { "session": "s-1", "keyBytes": [108, 115, 32, 45, 108, 97, 10] },"request": { "session": "s-1", "bytes": "bHMgLWxhCg==" } }, {"case": "write, a cursor key — three bytes that are not a character","method": "terminal.write","given": { "session": "s-1", "keyBytes": [27, 91, 65] },"request": { "session": "s-1", "bytes": "G1tB" } }, {"case": "resize, the grid a rotation produced","method": "terminal.resize","given": { "session": "s-1", "measuredCols": 120, "measuredRows": 40 },"request": { "session": "s-1", "cols": 120, "rows": 40 } }, {"case": "resize, clamped to the core's own ceiling","method": "terminal.resize","given": { "session": "s-1", "measuredCols": 5000, "measuredRows": 4000 },"request": { "session": "s-1", "cols": 1000, "rows": 1000 } }, {"case": "detach, one session named and nothing else","method": "terminal.detach","given": { "session": "s-1" },"request": { "session": "s-1" } } ],"refused": [ {"case": "the shape the pane sent for a year — camel-cased id, no size","method": "terminal.attach","request": { "sessionId": "s-1" } }, {"case": "an attach that names the session and forgets the grid","method": "terminal.attach","request": { "session": "s-1" } }, {"case": "a write whose bytes are called `data`","method": "terminal.write","request": { "sessionId": "s-1", "data": "bHMgLWxhCg==" } }, {"case": "a write that names the session and calls the bytes `data`","method": "terminal.write","request": { "session": "s-1", "data": "bHMgLWxhCg==" } }, {"case": "a resize on a camel-cased id","method": "terminal.resize","request": { "sessionId": "s-1", "cols": 80, "rows": 24 } }, {"case": "a resize of a view that measured nothing","method": "terminal.resize","request": { "session": "s-1", "cols": 0, "rows": 0 } }, {"case": "a detach on a camel-cased id","method": "terminal.detach","request": { "sessionId": "s-1" } } ],"events": [ {"case": "PTY output, base64","kind": "terminal.data","given": { "session": "s-1", "bytes": [104, 101, 108, 108, 111] },"payload": { "session": "s-1", "bytes": "aGVsbG8=" } }, {"case": "live","kind": "terminal.state","given": { "session": "s-1", "state": "attached" },"payload": { "session": "s-1", "state": "attached" } }, {"case": "behind, and dropping frames","kind": "terminal.state","given": { "session": "s-1", "state": "catchingUp" },"payload": { "session": "s-1", "state": "catchingUp" } }, {"case": "gone","kind": "terminal.state","given": { "session": "s-1", "state": "closed" },"payload": { "session": "s-1", "state": "closed" } } ]}