1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! @generated by `cargo run -p satteri-layout-codegen`. Do not edit by hand.
//!
//! JS<->Rust wire-protocol byte values for the command buffer and the
//! op-stream replay. Declared once in `satteri-layout-codegen/src/schema.rs`;
//! the JS twin is `packages/satteri/src/generated/wire-constants.ts`.
// Op-stream op codes (JS `OpWriter` -> Rust `replay_opstream`).
pub const OP_OPEN: u8 = 0x01; // [type: u8]
pub const OP_CLOSE: u8 = 0x02;
pub const OP_REF: u8 = 0x03; // [id: u32 LE] — splice an existing node
pub const OP_KEEP_CHILDREN: u8 = 0x04; // splice the anchor node's original children
pub const OP_STR: u8 = 0x05; // [field: u8][len: u32 LE][utf8]
pub const OP_U8: u8 = 0x06; // [field: u8][value: u8]
pub const OP_U32: u8 = 0x07; // [field: u8][value: u32 LE]
pub const OP_BOOL: u8 = 0x08; // [field: u8][0|1]
pub const OP_DATA: u8 = 0x09; // [len: u32 LE][json utf8]
pub const OP_PROP: u8 = 0x0a; // [name str][kind: u8][value str] — HAST element property
pub const OP_ALIGN: u8 = 0x0b; // [len: u32 LE][ColumnAlign bytes] — table column alignment
// Op-stream field ids (single namespace across OP_STR/OP_U8/OP_U32/OP_BOOL).
pub const OF_VALUE: u8 = 0;
pub const OF_URL: u8 = 1;
pub const OF_TITLE: u8 = 2;
pub const OF_ALT: u8 = 3;
pub const OF_LANG: u8 = 4;
pub const OF_META: u8 = 5;
pub const OF_IDENTIFIER: u8 = 6;
pub const OF_LABEL: u8 = 7;
pub const OF_NAME: u8 = 8; // directive / MDX JSX element name
pub const OF_REFERENCE_TYPE: u8 = 9;
pub const OF_DEPTH: u8 = 10;
pub const OF_CHECKED: u8 = 11;
pub const OF_START: u8 = 12;
pub const OF_ORDERED: u8 = 13;
pub const OF_SPREAD: u8 = 14;
pub const OF_TAGNAME: u8 = 15; // HAST element tag name
pub const OF_EXPLICIT: u8 = 16; // MDX JSX `_mdxExplicitJsx` flag
// One past the highest op-field id; sizes per-node field scratch tables.
pub const OF_FIELD_COUNT: usize = 17;
// Command bytes (0x01–0x0F range). Each is followed by [nodeId: u32 LE];
// structural commands then carry [payloadType: u8][payload…].
pub const CMD_REMOVE: u8 = 0x01;
pub const CMD_INSERT_BEFORE: u8 = 0x05;
pub const CMD_INSERT_AFTER: u8 = 0x06;
pub const CMD_PREPEND_CHILD: u8 = 0x07;
pub const CMD_APPEND_CHILD: u8 = 0x08;
pub const CMD_WRAP: u8 = 0x09;
pub const CMD_REPLACE: u8 = 0x0b;
pub const CMD_SET_PROPERTY: u8 = 0x0c; // [valueType: u8][name str][value str], PROP_* value kinds
pub const CMD_SET_CHILDREN: u8 = 0x0d; // payload is a Root-wrapped child list
// Structural-command payload types (0x10+, a range distinct from commands).
pub const PAYLOAD_RAW: u8 = 0x10; // [flags: u8][len: u32 LE][utf8] — re-parsed as markdown; see RAW_* flags
pub const PAYLOAD_OPSTREAM: u8 = 0x14; // [len: u32 LE][op bytes] — replayed straight into the arena
// Flag bits for the `PAYLOAD_RAW` payload.
pub const RAW_LITERAL_BRACES: u8 = 0x01; // keep MDX `{…}` as literal text (only affects MDX output)