Skip to main content

Module write_bus

Module write_bus 

Source
Expand description

IDE-protocol I3: the write-request payload + per-item handler.

Writes mutate the editor, which must happen on the editor (actor) thread. The WS task hands an EditorWriteRequest to the editor thread over the generic inbound bus ([lattice_mode::inbound], via SubsystemBoot::inbound) and awaits a oneshot reply.

BC.3b: the bespoke ClaudeCodeInboundBus + per-tick make_drain were replaced by the generic InboundBus<EditorWriteRequest> primitive, whose send wakes the actor off-keystroke (the wake is baked into the sender — structurally impossible to forget, paramount #4) and whose per-tick drain runs each request through make_handler. This module now owns only the write payload + mapping logic; the channel + drain + wake are the shared primitive.

make_handler validates + maps each request to an EXISTING Effect and resolves its oneshot — optimistic-ack: ok=true on a valid map, ok=false on an unknown / non-active target (option C, design §2: per-buffer save/close targeting lands with the diff/tab work).

Structs§

EditorWriteRequest
One write request: payload + the oneshot the drain resolves. Mirrors LSP’s InboundShowDocument.
InboundReply
The drain’s reply to the WS task. Optimistic-ack: ok reflects whether the request mapped to a valid Effect, not the eventual apply result.

Enums§

InboundKind
A write request’s payload.

Functions§

make_handler
Build the per-item handler for the generic inbound primitive (SubsystemBoot::inbound). Maps one request to its Effect (or none, on ok=false), resolves the oneshot, and returns the effect(s) for the host to apply. The generic bus owns the channel, the per-tick try_recv loop, and the off-keystroke wake.