Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

Long-lived protocol-1 WebSocket client.

Implementations§

Source§

impl Client

Source

pub fn new(url: impl Into<String>) -> Self

Create a client for url.

Source

pub fn with_config(cfg: ClientConfig) -> Self

Create with explicit config.

Source

pub fn url(&self) -> &str

Daemon URL.

Source

pub fn is_connected(&self) -> bool

Whether the socket is connected.

Source

pub fn is_connection_alive(&self) -> bool

Whether the reader task is alive.

Source

pub fn inbound_dropped(&self) -> u64

Count of dropped inbound frames under backpressure.

Source

pub async fn disconnect_cause(&self) -> Option<DisconnectCause>

Disconnect cause if disconnected.

Source

pub async fn wait_disconnected(&self) -> DisconnectCause

Wait until disconnected.

Source

pub async fn connect(&self) -> Result<()>

Dial + handshake (connection_init / connection_ack ready).

Source

pub async fn close(&self) -> Result<()>

Close the connection.

Source

pub async fn send_envelope(&self, env: Envelope) -> Result<()>

Send a raw envelope.

Source

pub async fn notify( &self, method: &str, params: Map<String, Value>, ) -> Result<()>

Fire-and-forget notification.

Source

pub async fn request( &self, method: &str, params: Map<String, Value>, req_timeout: Duration, ) -> Result<Map<String, Value>>

RPC request correlated by id.

Source

pub async fn request_response( &self, payload: Map<String, Value>, fallback_method: &str, req_timeout: Duration, ) -> Result<Map<String, Value>>

Legacy-shaped request map (type → method) like Go RequestResponse.

Source

pub async fn subscribe( &self, method: &str, params: Map<String, Value>, req_timeout: Duration, ) -> Result<String>

Subscribe; returns subscription id.

Source

pub async fn unsubscribe(&self, id: &str) -> Result<()>

Unsubscribe by id.

Source

pub async fn read_event(&self) -> Result<Option<Value>>

Read next inbound app event (blocks).

Source

pub async fn read_event_with_timeout( &self, dur: Duration, ) -> Result<Option<Value>>

Read with timeout; None on timeout.

Source

pub async fn clear_pending_events(&self)

Clear pending inbound events.

Source

pub async fn peel_stale_pending_control_events(&self) -> Vec<String>

Peel stale pending control frames at turn start.

Source

pub async fn send_input(&self, text: &str, opts: SendInputOptions) -> Result<()>

Notify loop_input.

Source

pub async fn loop_new( &self, params: Map<String, Value>, ) -> Result<Map<String, Value>>

loop_new RPC.

Source

pub async fn loop_list(&self, limit: u32) -> Result<Map<String, Value>>

loop_list.

Source

pub async fn loop_get(&self, loop_id: &str) -> Result<Map<String, Value>>

loop_get.

Source

pub async fn loop_reattach(&self, loop_id: &str) -> Result<Map<String, Value>>

loop_reattach.

Source

pub async fn loop_subscribe( &self, loop_id: &str, stream_delivery: &str, ) -> Result<String>

Subscribe to loop_events.

Source

pub async fn loop_cards_fetch( &self, loop_id: &str, ) -> Result<Map<String, Value>>

loop_cards_fetch.

Source

pub async fn loop_history_fetch( &self, loop_id: &str, ) -> Result<Map<String, Value>>

loop_history_fetch.

Source

pub async fn loop_messages( &self, loop_id: &str, limit: u32, offset: u32, ) -> Result<Map<String, Value>>

loop_messages.

Source

pub async fn loop_state_get(&self, loop_id: &str) -> Result<Map<String, Value>>

loop_state_get.

Source

pub async fn list_skills(&self) -> Result<Map<String, Value>>

skills_list.

Source

pub async fn list_models(&self) -> Result<Map<String, Value>>

models_list.

Source

pub async fn mcp_status(&self) -> Result<Map<String, Value>>

mcp_status.

Source

pub async fn fetch_daemon_status(&self) -> Result<Map<String, Value>>

daemon_status.

Source

pub async fn invoke_skill( &self, skill: &str, args: &str, ) -> Result<Map<String, Value>>

invoke_skill on this connection (stream socket for turn enqueue).

Source

pub async fn reattach_and_probe(&self, loop_id: &str) -> Result<()>

Reattach + subscribe + loop_get probe.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

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

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

Source§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.
Source§

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

Source§

fn vzip(self) -> V