Expand description
IDE-protocol I7: the claude-code modeline status segment.
Shows the IDE server’s state — running/port + live connection count — on the
modeline of every buffer running claude-code-mode (the agent terminal).
Mode-owned per feedback_mode_owns_its_surface: claude-code-mode’s
on_activate registers its buffer here and the returned Guard unregisters it
on deactivate; the descriptor + the off-thread publisher live in this crate
(the host only owns the generic ModelineService + the render path).
Mirrors lattice-lsp::modeline: a producer pushes content keyed
ModelineKey::Buffer(id) over the event bus (ML.3); the host’s §12 wake
forwarder turns each push into an off-keystroke repaint, so nothing runs on
the render path (paramount #1). The publisher only republishes when the
rendered text actually changes, so a quiescent server produces no repaints.
Structs§
- Mention
State - D-fix.6 follow-up: a transient
@sentecho on the modeline after a:claude-sendpushes context to the agent. Unlike the review badge (a lifecycle span), an at-mention is a momentary event, so the echo is time-boxed:ping()stamps a clear-deadline + wakes the publisher, which shows@sentuntil the deadline then clears itself (the publisher waits on the wake OR the deadline, whichever comes first). - Review
Guard - RAII guard: decrements the pending-review count + wakes the publisher on
Drop. Held across
open_diff’sawaitso a cancelled / dropped review can’t leak the count high. - Review
State - D-fix.6 follow-up: shared pending-review counter, mode-owned. claude-code
produces every openDiff and awaits its outcome (
diff::open_diff), so the span from request-sent to outcome-resolved IS a pending review — no host signal needed.begin()(called byopen_diffaround itsawait) bumps the count + wakes the status publisher; the returnedReviewGuarddecrements + wakes on Drop, so the count is correct even if the connection drops or the task is cancelled mid-review.
Constants§
- STATUS_
ELEMENT - Modeline element id — owned by the MCP adapter (
lattice_ai::mcp) (feedback_mode_owns_its_surface; the namespace is the owner key).
Functions§
- project_
name - The project name shown in the status segment — the basename of the first
workspace folder (e.g.
/home/me/src/lattice→lattice). Empty when no workspace folder is configured, in which case the project segment is hidden. - register_
status_ descriptor - Register the
claude-codedescriptor with the host’s modeline registry.Rightzone, low priority so it sits near the LSP / position elements. - spawn_
status_ publisher - Spawn the status publisher task. Wakes on
changed(start/stop, a connection open/close, or a buffer (un)registering), rebuilds the content, and republishes it to each registered buffer only when it differs from what that buffer last showed; a removed buffer is cleared (empty content). - status_
content - Build the status content for the current server state. Empty when the server is stopped (the element hides itself — no stale “off” badge cluttering the modeline when the IDE isn’t running).
Type Aliases§
- IdeBuffers
- The set of buffers (agent terminals) currently showing the status, shared between the mode (registers/unregisters) and the publisher task (reads).
- Mention
Handle - Cheap-clone handle to the shared
MentionState. - Review
Handle - Cheap-clone handle to the shared
ReviewState.