@rezi-ui/core so that backends, tooling, and test harnesses can validate compatibility at startup rather than discovering mismatches at runtime.
Engine ABI Version
The engine ABI version tracks the C engine’s public API surface (function signatures, struct layouts, enum values). It follows semver-style semantics: | Constant | Value | Meaning | |----------|-------|---------|| |ZR_ENGINE_ABI_MAJOR | 1 | Breaking changes to engine API |
| ZR_ENGINE_ABI_MINOR | 2 | Backwards-compatible additions |
| ZR_ENGINE_ABI_PATCH | 0 | Bug fixes with no API change |
Current version: 1.2.0
Compatibility Rules
- Major mismatch — the core and engine are incompatible. The engine must reject the connection.
- Minor mismatch — if
core.minor > engine.minor, the core may use features the engine does not support. The engine should reject unknown opcodes withERR_UNSUPPORTED. Ifcore.minor <= engine.minor, the core is compatible. - Patch mismatch — always compatible.
Drawlist Format Versions
The drawlist format is versioned independently from the engine ABI. The version field is stored at byte offset 4 in every ZRDL header.| Constant | Value | Description |
|---|---|---|
ZR_DRAWLIST_VERSION_V1 | 1 | Base format: CLEAR, FILL_RECT, DRAW_TEXT, PUSH_CLIP, POP_CLIP, DRAW_TEXT_RUN |
ZR_DRAWLIST_VERSION_V2 | 2 | Adds SET_CURSOR (opcode 7) for native cursor control |
ZR_DRAWLIST_VERSION_V3 | 3 | Extends style payloads (underline style/color + hyperlink refs) |
ZR_DRAWLIST_VERSION_V4 | 4 | v3 + DRAW_CANVAS (opcode 8) |
ZR_DRAWLIST_VERSION_V5 | 5 | v4 + DRAW_IMAGE (opcode 9) |
What v2-v5 Add
v2 is a strict superset of v1 and adds:- OP_SET_CURSOR (opcode 7) — 20-byte command that sets cursor position, shape, visibility, and blink state. See Cursor.
scripts/drawlist-spec.ts; CI runs npm run codegen:check to guarantee generated writers stay in sync.
The header layout, string table, and blob table remain compatible across versions.
Event Batch Version
Event batches (ZREV format) are versioned separately.| Constant | Value | Description |
|---|---|---|
ZR_EVENT_BATCH_VERSION_V1 | 1 | Keyboard, mouse, and resize events |
Unicode Version Pin
Rezi pins a specific Unicode version for deterministic text measurement. Character widths, grapheme cluster boundaries, and East Asian width properties all depend on Unicode table data. Pinning a version ensures that the same string produces the same measured width on every platform and every run.| Constant | Value |
|---|---|
ZR_UNICODE_VERSION_MAJOR | 15 |
ZR_UNICODE_VERSION_MINOR | 1 |
ZR_UNICODE_VERSION_PATCH | 0 |
Magic Bytes
Each binary format has a 4-byte magic value at offset 0, stored as a little-endianu32:
| Constant | Hex value | ASCII (LE) | Format |
|---|---|---|---|
ZRDL_MAGIC | 0x4C44525A | ZRDL | Drawlist |
ZREV_MAGIC | 0x5645525A | ZREV | Event batch |
Version Validation Flow
Both the builder and the engine perform version checks:Builder Side (TypeScript)
- The builder writes the correct magic and version into the header at build time.
- The version is determined by the selected builder version.
createApp()validates the backenddrawlistVersionand requires version>= 2.
Engine Side (C)
- Read magic at offset 0. Reject with
ERR_FORMATif it does not matchZRDL_MAGIC. - Read version at offset 4. Reject with
ERR_UNSUPPORTEDif the version is not recognized. - Validate header size at offset 8. Reject if it does not match expected header size.
- Process commands. Reject unknown opcodes with
ERR_UNSUPPORTED.
Import Paths
All version constants are exported from the package root:packages/core/src/abi.ts.
Related Documentation
- ZRDL Drawlists — Format reference for ZRDL
- ZREV Event Batches — Format reference for ZREV
- ABI Pins — Quick-reference constant table
- Safety Rules — Validation and error handling