Skip to main content

ClaudeCodeServerHandle

Struct ClaudeCodeServerHandle 

Source
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

Source

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.

Source

pub fn stop(&self)

Request the server stop (unbind + unlink lockfile + drop conns). Idempotent, non-blocking.

Source

pub fn snapshot(&self) -> Arc<ServerState> ⓘ

Current state snapshot (wait-free Arc load).

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> ClaudeCodeServerHandle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> IntoMaybeUndefined<T> for T

§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
§

impl<T> IntoOption<T> for T

§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more