Skip to main content

Module inbound

Module inbound 

Source
Expand description

Boot-composition BC.1: the generic inbound primitive.

Generalizes the I3 ClaudeCodeInboundBus and LSP’s hand-rolled inbound buses into ONE reusable primitive: a channel whose send wakes the editor (async_landed.notify_one) so off-keystroke work reaches the screen WITHOUT a keypress, and whose items are drained per-tick through a handler that maps each to existing [Effect]s.

CRITICAL (paramount goal #4 — async-correct by construction, not by discipline): the wake is baked into InboundBus::send, so it is structurally impossible to forget. This is the bug class boot-composition.md §3 designs out: “forget the wake and a refresh only reaches the screen on the next keypress.”

Pairs with TickCallbackRegistry: make_inbound returns the bus PLUS a TickCallback drain closure the caller registers with the registry. Per feedback_mode_owns_its_surface, the handler (the map from request → Effect) lives in the owning crate; the host only runs the generic drain + applies the returned effects.

The host-facing bundle (lattice_host::BootContext) exposes this as BootContext::inbound::<T>(handler), which calls make_inbound against the editor’s async_landed and registers the drain on the shared tick-callback registry — so a subsystem gets the bus back and never touches the wake or the registry directly.

Structs§

InboundBus
Sender half of the inbound primitive. Held by the off-thread producer (a WS task, an LSP forwarder, …); send hands an item to the editor thread and wakes it.

Functions§

make_inbound
Build an inbound primitive.
make_inbound_raw
Build a host-drained inbound primitive: the wake-baked InboundBus sender PLUS the raw receiver, with NO per-tick handler.