Skip to main content

Module messages

Module messages 

Source
Expand description

*messages* transcript types – one historical record per editor echo, a bounded ring of them, and a typed MessagePushed event published whenever a new record lands.

Lives in lattice-runtime so any host-side crate that cares about message stream events (TUI, GPU renderer, plugin host, telemetry) can subscribe without taking a dependency on the renderer crate. The wire-typed lattice_grammar::EchoLevel rides through unchanged so grammar / runtime / plugin code all read the same severity enum without round-tripping through a display-typed clone.

Plugins via the WASM Component Model subscribe through the plugin host’s WIT bridge – the host wires event_bus.subscribe_typed::<MessagePushed>(...) and marshals each record into the plugin’s WIT struct. The Rust type’s location here is purely for in-process Rust consumers; plugins never import this module directly.

Structs§

MessagePushed
Typed event published on the editor’s event bus whenever set_message runs. Carries the appended record (cloned from the ring). Subscribers see every echo in arrival order; the renderer’s *messages* buffer live tail, the plugin host’s WIT bridge, future telemetry hooks, etc. are all peer subscribers with no privileged path.
MessageRecord
One historical minibuffer echo. The renderer’s *messages* buffer renders these in chronological order; each set_message call appends one record. Cheap to clone (bounded text) – producers fan the same record out to every subscriber on the typed event bus.
MessagesRing
Bounded chronological ring of every echo the editor has emitted. Push on every set_message; snapshot on demand for :messages open and live refresh. Capacity is fixed at construction; once full, the oldest entry drops to make room for the newest.