Expand description
§mnml-bridge — Mount protocol for mnml sibling tools
Bridge / Mount is the integration layer that lets sibling tools
(mnml-tattle-tests, mnml-db-postgres, …) render their UI as a
first-class pane inside mnml — owning the activity-bar icon, the
rail content, and the editor body — instead of running as a
plain Pty pane.
§The four tiers
- Env vars — every Pty mnml spawns sees
MNML_WORKSPACE,MNML_THEME, andMNML_IPC_DIR. Zero protocol; just read on startup. (Available today for any sibling.) - JSONL sibling → host — sibling writes JSONL commands to
$MNML_IPC_DIR/command; mnml ingests them.toast,open-pty,open(file), more coming. One-way. - mnml-bridge SDK — this crate. Typed Rust API around tiers 1 + 2, plus the Mount protocol below.
- Mount — sibling connects to a Unix-socket-per-mount, streams cell+style frames back, receives input events. Owns rail + body areas of an activity-bar section.
§Wire shape
Length-prefixed JSON. Every message is a Frame or Input. The
4-byte little-endian length precedes the JSON body so framing is
trivial (no streaming JSON parser needed).
Host → Sibling:
MountHello { cols, rows }firstResize { cols, rows }on terminal resizeInput { event }on every routed key / mouse event
Sibling → Host:
Frame { cells: Vec<Vec<Cell>> }whenever the sibling has a new screen state. Cell-perfect; the host stamps these into its own ratatui frame.
V1 keeps it simple: full frames, no diffing. A ~24x80 panel is ~2 KB of JSON; serialization cost is negligible vs ratatui’s own draw cycle.
Modules§
- modifier
- Bitflags for
Cell::modifiers. Mirrors ratatui’sModifierconstants so a sibling can reuse its existing styling.
Structs§
- Cell
- A single terminal cell — one grapheme + style. Mirrors
ratatui’s
buffer::Cellshape but with serde derived. - Geometry
- Sent by the host once on connection, then on every terminal resize.
Enums§
- Host
Message - Host → sibling messages.
- Input
Event - Routed input event from the host. Key / mouse events that happened inside the mount’s area are forwarded as-is.
- RgbOr
Index - Either a true-color RGB triple or a 256-color palette index.
- Sibling
Message - Sibling → host messages.
Functions§
- read_
message - Read a length-prefixed JSON message from a stream.
- write_
message - Write a length-prefixed JSON message to a stream.