pub struct ClaudeCodeServerHandle { /* private fields */ }Expand description
Handle to the supervisor. Clone-able + Send + Sync: the ex-command
apply closures and claude-code-mode’s on_activate hold one and
drive start / stop. Mirrors lattice_lsp::LspSupervisorHandle.
Implementations§
Source§impl ClaudeCodeServerHandle
impl ClaudeCodeServerHandle
Sourcepub fn start(&self) -> Option<u16>
pub fn start(&self) -> Option<u16>
Start the server and return the bound loopback port, or None on
failure. Idempotent: a second call while already running returns the
existing port without re-binding.
I5.1: the listener is pre-bound synchronously here (not async on the
supervisor) so :claude learns the port immediately and can inject
CLAUDE_CODE_SSE_PORT into the agent’s environment before spawning it.
The bind + the supervisor’s subsequent lockfile write are one-shot (a
user command, never the render loop), so the brief sync work is fine.
Sourcepub fn stop(&self)
pub fn stop(&self)
Request the server stop (unbind + unlink lockfile + drop conns). Idempotent, non-blocking.
Sourcepub fn snapshot(&self) -> Arc<ServerState> ⓘ
pub fn snapshot(&self) -> Arc<ServerState> ⓘ
Current state snapshot (wait-free Arc load).
Sourcepub fn notify(&self, frame: String)
pub fn notify(&self, frame: String)
I6: broadcast a server-initiated notification frame to every connected
agent. A no-op (the frame is dropped) when no connections are
subscribed. Used by :claude-send; the notification task uses its own
Self::notify_sender clone.
Sourcepub fn ping_mention(&self)
pub fn ping_mention(&self)
D-fix.6 follow-up: flash the transient @sent echo on the modeline —
called by :claude-send after it broadcasts an at-mention. The echo
clears itself after a few seconds (the status publisher’s timed wake).
Sourcepub fn notify_sender(&self) -> Sender<String>
pub fn notify_sender(&self) -> Sender<String>
I6.1: a clone of the broadcast sender for the notification task to
publish selection_changed / didChangeActiveEditor frames through.
Sourcepub fn connection_count(&self) -> usize
pub fn connection_count(&self) -> usize
I7: number of currently-connected agents. Surfaced in the
claude-code-mode status. Counted explicitly (a ConnGuard per
connection) so it is exact the instant a connection ends, rather than
lagging the broadcast receiver drop.
Sourcepub fn register_status_buffer(&self, buf: BufferId)
pub fn register_status_buffer(&self, buf: BufferId)
I7: register buf (an agent terminal) to show the claude-code status
segment, and wake the publisher to paint it immediately. Called from
claude-code-mode’s on_activate.
Sourcepub fn unregister_status_buffer(&self, buf: BufferId)
pub fn unregister_status_buffer(&self, buf: BufferId)
I7: stop showing the status on buf (the mode’s Guard Drop on
deactivate). The publisher clears the element on its next wake.
Sourcepub fn read_cache(&self) -> EditorStateHandle
pub fn read_cache(&self) -> EditorStateHandle
BC.3b: the crate-owned read cache. install() clones it to build the
inbound handler ([lattice_agent::make_handler]) — the per-item closure
the generic boot.inbound bus drains, which maps write requests against
the same cache the read tools snapshot.
Sourcepub fn install_services(
&self,
buffer_store: Option<BufferStoreHandle>,
diagnostics: Option<DiagnosticsQueryHandle>,
writes: InboundBus<EditorWriteRequest>,
diff: Option<ProgrammaticDiffBus>,
)
pub fn install_services( &self, buffer_store: Option<BufferStoreHandle>, diagnostics: Option<DiagnosticsQueryHandle>, writes: InboundBus<EditorWriteRequest>, diff: Option<ProgrammaticDiffBus>, )
I2.2 + I3.2 / BC.3b: seat the generic read handles + the write bus into
the live dispatch context (connections read it wait-free). writes is
the generic [InboundBus] built by install() via boot.inbound (which
owns the channel, the per-tick drain, and the off-keystroke wake — the
drain’s registration token rides boot.into_registrations() into the
Editor). AG-2b: the bus now rides inside the EditorAccess the write
tools call through, not a separate DispatchContext field. The server
handle is spawned before boot wires these handles, so this upgrade runs
once, from the subsystem’s install(boot).
Trait Implementations§
Source§impl Clone for ClaudeCodeServerHandle
impl Clone for ClaudeCodeServerHandle
Source§fn clone(&self) -> ClaudeCodeServerHandle
fn clone(&self) -> ClaudeCodeServerHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ClaudeCodeServerHandle
impl !UnwindSafe for ClaudeCodeServerHandle
impl Freeze for ClaudeCodeServerHandle
impl Send for ClaudeCodeServerHandle
impl Sync for ClaudeCodeServerHandle
impl Unpin for ClaudeCodeServerHandle
impl UnsafeUnpin for ClaudeCodeServerHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more