Expand description
IDE-protocol I6: server-initiated notifications (server → agent).
A task subscribes to the generic event bus (SelectionsChanged), coalesces
bursts (cursor moves fire at ~30 Hz under a held key), and broadcasts
selection_changed — plus a didChangeActiveEditor when the active buffer
changes — to every connected agent through the server’s broadcast sender
(crate::mcp::server::ClaudeCodeServerHandle::notify_sender). Each connection’s
forwarder relays the frame to its WS writer; a lagged connection skips
dropped frames (coalescing — latest wins).
Crate-owned per feedback_mode_owns_its_surface: the host only publishes
the generic events. The editor thread pays nothing new — it already
publishes SelectionsChanged; the coalescing + framing run off-thread.
The frame SHAPE is PROVISIONAL until validated against a live claude
CLI — server→agent notification formats are less documented than the tool
replies. In particular selection.start/end.character carries the editor’s
byte offset within the line (lattice’s Position.byte); the VS Code
contract is a UTF-16 character offset. Carrying it verbatim mirrors the I3
selection-encoding caveat; the conversion lands once a live CLI pins it.
Functions§
- at_
mentioned_ frame - Build the
at_mentionednotification frame (PROVISIONAL shape) — the user pushing the current file + selected line range into the agent’s context via:claude-send/@. - did_
change_ active_ editor_ frame - Build the
didChangeActiveEditornotification frame (PROVISIONAL shape). - selection_
changed_ frame - Build the
selection_changednotification frame (PROVISIONAL shape). - spawn_
notifier - Subscribe to
SelectionsChangedand spawn the notification task. The task coalesces bursts and broadcasts notification frames throughnotify_tx.