$ rezi
Protocol

Protocol

Rezi communicates between its TypeScript core and the Zireael C engine through two binary formats: ZRDL (drawlists) and ZREV (event batches). Both formats cross a strict ABI boundary -- the core bu...

Rezi communicates between its TypeScript core and the Zireael C engine through two binary formats: ZRDL (drawlists) and ZREV (event batches). Both formats cross a strict ABI boundary -- the core builds drawlists and the engine consumes them; the engine produces event batches and the core parses them.

Data flow

The core's rendering pipeline produces a ZRDL binary every frame. The engine parses that binary, executes the draw commands against the terminal, and sends back input events as ZREV batches.

Binary format principles

All Rezi binary formats share the following properties:

  • Little-endian byte order. All multi-byte integers are stored least-significant byte first.
  • 4-byte alignment. All section offsets, section sizes, and the total buffer size are 4-byte aligned. Padding bytes are explicitly zeroed.
  • Versioned. Each format begins with a magic number and version field. The engine rejects unknown versions.
  • Validated strictly. Both the builder (TypeScript side) and the engine (C side) validate the buffer independently. Malformed input is never silently accepted.

Format summary

FormatMagic bytesDescriptionDirection
ZRDL0x4C44525A (ZRDL)Drawlist: rendering commands, strings, blobsCore -> Engine
ZREV0x5645525A (ZREV)Event batch: keyboard/mouse/resize eventsEngine -> Core

Both magic values are encoded as little-endian u32 constants.

Sub-pages

PageTopic
Drawlists (ZRDL)Header layout, command opcodes, string/blob tables, style encoding
Cursor (v2)SET_CURSOR command, cursor state management, v2 enablement
VersioningABI version pins, drawlist/event versions, Unicode pin, compatibility
Safety rulesValidation patterns, cap enforcement, error types, sticky errors
Event batches (ZREV)Event batch format and parsing
ABI pinsExported constants and version numbers

On this page