Skip to main content

Module marker

Module marker 

Source
Expand description

Render-commit marker.

The adapter writes this OSC sequence to stdout after the last byte of the render belonging to revision N. It commits a frame; it never carries data.

OSC 8487 ; twm;<revision>;<mac> BEL

OSC rather than DCS because ConPTY rewrites the stream it forwards: a passthrough probe showed it dropping DCS, APC and OSC 8 while passing private OSC with either terminator, so a DCS marker could not reach the driver on Windows at all.

with mac = base64url(HMAC-SHA256(token, "{session_id}:{revision}"))[..16], unpadded. The token is an opaque UTF-8 string end to end: whatever arrives in TERMWRIGHT_TOKEN is used as key bytes, never decoded first.

Structs§

RenderMarker
A verified marker: the revision it commits, and the MAC that proved it.

Constants§

MARKER_MAC_BYTES
How much of the HMAC-SHA256 output the marker retains.
MARKER_OSC_CODE
The private OSC number carrying render-commit markers. Chosen clear of everything in use (xterm’s allocations, OSC 8, 9, 99, 133, 633, 697, 777+): 84 and 87 are the ASCII codes of T and W, for termwright.
MARKER_OSC_PREFIX
The tag opening a marker payload, immediately after OSC 8487;. A self-identifying guard: if anything ever claims 8487, a marker still says what it is rather than being mistaken for that feature’s payload.
MAX_SAFE_INTEGER
Largest revision that survives a round trip through the JavaScript reference implementation unchanged.

Functions§

compute_mac
Compute the marker MAC for a session and revision.
encode_marker
Build the full escape sequence committing revision.
verify_marker_payload
Parse and verify an OSC payload — everything after OSC 8487;.