Expand description
Layer 1: the wire. Constants, the messages a program sends and receives, the encoder (framing, chunking, blobs) and the decoder of replies and events.
Every message is one APC string, ESC _ tsp;<verb>[;k=v]*;<body> ESC \.
A body over the negotiated apc limit is cut by chunks exactly as
Tern’s own tsp_chunks cuts it, and each piece is sent with c=<id>
(and m=1 on all but the last).
Modules§
- feature
- Feature names of the
helloquery (program) and reply (terminal). - kind
- Node kinds, as the
kof a node and thekindsof thehelloreply.
Structs§
- Ack
ack: the highest frame applied and drawn.- Action
action: a pointer action with a custom name.- Blob
- A
bmessage: binary data named by its SHA-256. - Blobs
Reply - The
blobsreply: which of the asked blobs Tern holds. - Cell
- A cell size in pixels.
- Change
change: anelcontrol flipped, or aprefsrow changed.- Close
- An
xmessage: close a surface. - Edit
edit: native editing replaced UTF-16[from, to)withtext.- Encoder
- Encodes messages under the session’s
apclimit, numbering chunk sequences with a base-36 counter. - Error
Event error: a rejected op, message, stylesheet or element.- Focus
focus: a click asked for the keys in a field.- Frame
- An
fmessage: an atomic batch of ops on one surface. - Gone
gone: nodes or a surface Tern dropped.- Hello
- The
helloreply: what the terminal draws and supports. - Motion
motion: Reduce Motion was toggled.- Open
- An
omessage: open a surface. - Palette
- A
tmessage: the program palette, token →#rrggbbper variant. - Palette
Names - The names of a palette’s two variants.
- Resize
resize: the pane’s width or cell size changed.- Select
selectoractivate: an item was picked or opened.- Send
Text send: submit text through a composer.- Sheet
- An
smessage: install, replace or (withoutcss) remove a stylesheet. - Theme
theme: the appearance switched.- Toggle
toggle: a collapsible node was folded or unfolded.- Undo
undo: undo the last change to a field.- Visible
visible: the pane was hidden or shown.- Wire
Node - A node with its id, as an
addop carries it.
Enums§
- Event
- An
emessage: an event. - Message
- Any program → terminal message.
- Mode
- A surface mode.
- Op
- One frame op.
- Query
- A
qquery. - Reply
- An
rmessage: the reply to a query. - Reveal
At - Where a
revealop scrolls a node. - Scroll
By - How far a
scrollop moves. - Text
Mode - How a
textop changes primary text.
Constants§
- APC_
LIMIT - The largest body sent in one message unless the
helloreply says otherwise. - CREDITS
- How many frames may be unacknowledged unless the
helloreply says otherwise. - MAX_
BLOB - The largest blob Tern takes, in decoded bytes.
- VERSION
- The protocol version this SDK speaks.