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 fn set_stream_degraded_callback( &self, cb: Option<Arc<dyn Fn(u64, String) + Send + Sync>>, )

Register a hook invoked on the first inbound overflow drop.

Source

pub fn enable_heartbeat_tracking(&self) -> Arc<HeartbeatTracker>

Enable heartbeat tracking with the default 15s alive threshold.

Source

pub fn enable_heartbeat_tracking_with_threshold( &self, threshold: Duration, ) -> Arc<HeartbeatTracker>

Enable heartbeat tracking with a custom alive threshold.

Source

pub fn disable_heartbeat_tracking(&self)

Disable heartbeat tracking.

Source

pub fn heartbeat_tracker(&self) -> Option<Arc<HeartbeatTracker>>

Current heartbeat tracker, if enabled.

Source

pub fn is_daemon_alive(&self) -> bool

Whether the tracked daemon is considered alive (true if tracking disabled).

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 reconnect(&self) -> Result<()>

Re-dial and re-handshake after a connection drop.

Does not re-establish loop subscriptions; follow with Self::reattach_and_probe to resume a loop session.

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 loop_state_update( &self, loop_id: &str, state: Map<String, Value>, ) -> Result<Map<String, Value>>

loop_state_update.

Source

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

loop_tree.

Source

pub async fn loop_prune( &self, loop_id: &str, retention_days: Option<i32>, dry_run: bool, ) -> Result<Map<String, Value>>

loop_prune.

Source

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

loop_delete.

Source

pub async fn loop_detach(&self, subscription_id: &str) -> Result<()>

Detach from a loop by unsubscribing (subscription_id from loop_subscribe).

Source

pub async fn authenticate( &self, access_key: &str, secret_key: &str, ) -> Result<Map<String, Value>>

Authenticate with access/secret keys.

Source

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

Refresh auth token.

Source

pub async fn job_create( &self, goal: &str, workspace: Option<&str>, ) -> Result<Map<String, Value>>

job_create on this long-lived connection.

Source

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

job_status.

Source

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

job_pause.

Source

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

job_resume.

Source

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

job_cancel.

Source

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

job_dag.

Source

pub async fn job_guidance( &self, job_id: &str, content: &str, goal_id: Option<&str>, ) -> Result<Map<String, Value>>

job_guidance.

Source

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

autopilot_status.

Source

pub async fn autopilot_submit( &self, description: &str, priority: i32, workspace: Option<&str>, ) -> Result<Map<String, Value>>

autopilot_submit.

Source

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

autopilot_list_goals.

Source

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

autopilot_get_goal.

Source

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

autopilot_cancel_goal.

Source

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

autopilot_cancel_all.

Source

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

autopilot_wake.

Source

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

autopilot_dream.

Source

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

autopilot_resume.

Source

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

autopilot_list_jobs.

Source

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

autopilot_get_job.

Source

pub async fn autopilot_subscribe(&self) -> Result<String>

Subscribe to autopilot_events (long-lived worker stream).

Source

pub async fn autopilot_unsubscribe(&self, subscription_id: &str) -> Result<()>

Unsubscribe from an autopilot events subscription.

Source

pub async fn cron_add( &self, text: &str, priority: Option<i32>, ) -> Result<Map<String, Value>>

cron_add.

Source

pub async fn cron_list( &self, status: Option<&str>, ) -> Result<Map<String, Value>>

cron_list.

Source

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

cron_show.

Source

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

cron_cancel.

Source

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

memory_stats.

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