pub struct Client { /* private fields */ }Expand description
Long-lived protocol-1 WebSocket client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn with_config(cfg: ClientConfig) -> Self
pub fn with_config(cfg: ClientConfig) -> Self
Create with explicit config.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether the socket is connected.
Sourcepub fn is_connection_alive(&self) -> bool
pub fn is_connection_alive(&self) -> bool
Whether the reader task is alive.
Sourcepub fn inbound_dropped(&self) -> u64
pub fn inbound_dropped(&self) -> u64
Count of dropped inbound frames under backpressure.
Sourcepub fn set_stream_degraded_callback(
&self,
cb: Option<Arc<dyn Fn(u64, String) + Send + Sync>>,
)
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.
Sourcepub fn enable_heartbeat_tracking(&self) -> Arc<HeartbeatTracker> ⓘ
pub fn enable_heartbeat_tracking(&self) -> Arc<HeartbeatTracker> ⓘ
Enable heartbeat tracking with the default 15s alive threshold.
Sourcepub fn enable_heartbeat_tracking_with_threshold(
&self,
threshold: Duration,
) -> Arc<HeartbeatTracker> ⓘ
pub fn enable_heartbeat_tracking_with_threshold( &self, threshold: Duration, ) -> Arc<HeartbeatTracker> ⓘ
Enable heartbeat tracking with a custom alive threshold.
Sourcepub fn disable_heartbeat_tracking(&self)
pub fn disable_heartbeat_tracking(&self)
Disable heartbeat tracking.
Sourcepub fn heartbeat_tracker(&self) -> Option<Arc<HeartbeatTracker>>
pub fn heartbeat_tracker(&self) -> Option<Arc<HeartbeatTracker>>
Current heartbeat tracker, if enabled.
Sourcepub fn is_daemon_alive(&self) -> bool
pub fn is_daemon_alive(&self) -> bool
Whether the tracked daemon is considered alive (true if tracking disabled).
Sourcepub async fn disconnect_cause(&self) -> Option<DisconnectCause>
pub async fn disconnect_cause(&self) -> Option<DisconnectCause>
Disconnect cause if disconnected.
Sourcepub async fn wait_disconnected(&self) -> DisconnectCause
pub async fn wait_disconnected(&self) -> DisconnectCause
Wait until disconnected.
Sourcepub async fn connect(&self) -> Result<()>
pub async fn connect(&self) -> Result<()>
Dial + handshake (connection_init / connection_ack ready).
Sourcepub async fn reconnect(&self) -> Result<()>
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.
Sourcepub async fn send_envelope(&self, env: Envelope) -> Result<()>
pub async fn send_envelope(&self, env: Envelope) -> Result<()>
Send a raw envelope.
Sourcepub async fn notify(
&self,
method: &str,
params: Map<String, Value>,
) -> Result<()>
pub async fn notify( &self, method: &str, params: Map<String, Value>, ) -> Result<()>
Fire-and-forget notification.
Sourcepub async fn request(
&self,
method: &str,
params: Map<String, Value>,
req_timeout: Duration,
) -> Result<Map<String, Value>>
pub async fn request( &self, method: &str, params: Map<String, Value>, req_timeout: Duration, ) -> Result<Map<String, Value>>
RPC request correlated by id.
Sourcepub async fn request_response(
&self,
payload: Map<String, Value>,
fallback_method: &str,
req_timeout: Duration,
) -> Result<Map<String, Value>>
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.
Sourcepub async fn subscribe(
&self,
method: &str,
params: Map<String, Value>,
req_timeout: Duration,
) -> Result<String>
pub async fn subscribe( &self, method: &str, params: Map<String, Value>, req_timeout: Duration, ) -> Result<String>
Subscribe; returns subscription id.
Sourcepub async fn unsubscribe(&self, id: &str) -> Result<()>
pub async fn unsubscribe(&self, id: &str) -> Result<()>
Unsubscribe by id.
Sourcepub async fn read_event(&self) -> Result<Option<Value>>
pub async fn read_event(&self) -> Result<Option<Value>>
Read next inbound app event (blocks).
Sourcepub async fn read_event_with_timeout(
&self,
dur: Duration,
) -> Result<Option<Value>>
pub async fn read_event_with_timeout( &self, dur: Duration, ) -> Result<Option<Value>>
Read with timeout; None on timeout.
Sourcepub async fn clear_pending_events(&self)
pub async fn clear_pending_events(&self)
Clear pending inbound events.
Sourcepub async fn peel_stale_pending_control_events(&self) -> Vec<String>
pub async fn peel_stale_pending_control_events(&self) -> Vec<String>
Peel stale pending control frames at turn start.
Sourcepub async fn send_input(&self, text: &str, opts: SendInputOptions) -> Result<()>
pub async fn send_input(&self, text: &str, opts: SendInputOptions) -> Result<()>
Notify loop_input.
Sourcepub async fn loop_new(
&self,
params: Map<String, Value>,
) -> Result<Map<String, Value>>
pub async fn loop_new( &self, params: Map<String, Value>, ) -> Result<Map<String, Value>>
loop_new RPC.
Sourcepub async fn loop_subscribe(
&self,
loop_id: &str,
stream_delivery: &str,
) -> Result<String>
pub async fn loop_subscribe( &self, loop_id: &str, stream_delivery: &str, ) -> Result<String>
Subscribe to loop_events.
Sourcepub async fn loop_cards_fetch(
&self,
loop_id: &str,
) -> Result<Map<String, Value>>
pub async fn loop_cards_fetch( &self, loop_id: &str, ) -> Result<Map<String, Value>>
loop_cards_fetch.
Sourcepub async fn loop_history_fetch(
&self,
loop_id: &str,
) -> Result<Map<String, Value>>
pub async fn loop_history_fetch( &self, loop_id: &str, ) -> Result<Map<String, Value>>
loop_history_fetch.
Sourcepub async fn loop_messages(
&self,
loop_id: &str,
limit: u32,
offset: u32,
) -> Result<Map<String, Value>>
pub async fn loop_messages( &self, loop_id: &str, limit: u32, offset: u32, ) -> Result<Map<String, Value>>
loop_messages.
Sourcepub async fn loop_state_get(&self, loop_id: &str) -> Result<Map<String, Value>>
pub async fn loop_state_get(&self, loop_id: &str) -> Result<Map<String, Value>>
loop_state_get.
Sourcepub async fn loop_state_update(
&self,
loop_id: &str,
state: Map<String, Value>,
) -> Result<Map<String, Value>>
pub async fn loop_state_update( &self, loop_id: &str, state: Map<String, Value>, ) -> Result<Map<String, Value>>
loop_state_update.
Sourcepub async fn loop_tree(
&self,
loop_id: &str,
format: Option<&str>,
) -> Result<Map<String, Value>>
pub async fn loop_tree( &self, loop_id: &str, format: Option<&str>, ) -> Result<Map<String, Value>>
loop_tree.
Sourcepub async fn loop_prune(
&self,
loop_id: &str,
retention_days: Option<i32>,
dry_run: bool,
) -> Result<Map<String, Value>>
pub async fn loop_prune( &self, loop_id: &str, retention_days: Option<i32>, dry_run: bool, ) -> Result<Map<String, Value>>
loop_prune.
Sourcepub async fn loop_detach(&self, subscription_id: &str) -> Result<()>
pub async fn loop_detach(&self, subscription_id: &str) -> Result<()>
Detach from a loop by unsubscribing (subscription_id from loop_subscribe).
Sourcepub async fn authenticate(
&self,
access_key: &str,
secret_key: &str,
) -> Result<Map<String, Value>>
pub async fn authenticate( &self, access_key: &str, secret_key: &str, ) -> Result<Map<String, Value>>
Authenticate with access/secret keys.
Sourcepub async fn refresh_auth_token(
&self,
refresh_token: &str,
) -> Result<Map<String, Value>>
pub async fn refresh_auth_token( &self, refresh_token: &str, ) -> Result<Map<String, Value>>
Refresh auth token.
Sourcepub async fn job_create(
&self,
goal: &str,
workspace: Option<&str>,
) -> Result<Map<String, Value>>
pub async fn job_create( &self, goal: &str, workspace: Option<&str>, ) -> Result<Map<String, Value>>
job_create on this long-lived connection.
Sourcepub async fn job_guidance(
&self,
job_id: &str,
content: &str,
goal_id: Option<&str>,
) -> Result<Map<String, Value>>
pub async fn job_guidance( &self, job_id: &str, content: &str, goal_id: Option<&str>, ) -> Result<Map<String, Value>>
job_guidance.
Sourcepub async fn autopilot_submit(
&self,
description: &str,
priority: i32,
workspace: Option<&str>,
) -> Result<Map<String, Value>>
pub async fn autopilot_submit( &self, description: &str, priority: i32, workspace: Option<&str>, ) -> Result<Map<String, Value>>
autopilot_submit.
Sourcepub async fn autopilot_get_goal(
&self,
goal_id: &str,
) -> Result<Map<String, Value>>
pub async fn autopilot_get_goal( &self, goal_id: &str, ) -> Result<Map<String, Value>>
autopilot_get_goal.
Sourcepub async fn autopilot_cancel_goal(
&self,
goal_id: &str,
) -> Result<Map<String, Value>>
pub async fn autopilot_cancel_goal( &self, goal_id: &str, ) -> Result<Map<String, Value>>
autopilot_cancel_goal.
Sourcepub async fn autopilot_resume(
&self,
goal_id: &str,
) -> Result<Map<String, Value>>
pub async fn autopilot_resume( &self, goal_id: &str, ) -> Result<Map<String, Value>>
autopilot_resume.
Sourcepub async fn autopilot_get_job(
&self,
job_id: &str,
) -> Result<Map<String, Value>>
pub async fn autopilot_get_job( &self, job_id: &str, ) -> Result<Map<String, Value>>
autopilot_get_job.
Sourcepub async fn autopilot_subscribe(&self) -> Result<String>
pub async fn autopilot_subscribe(&self) -> Result<String>
Subscribe to autopilot_events (long-lived worker stream).
Sourcepub async fn autopilot_unsubscribe(&self, subscription_id: &str) -> Result<()>
pub async fn autopilot_unsubscribe(&self, subscription_id: &str) -> Result<()>
Unsubscribe from an autopilot events subscription.
Sourcepub async fn cron_add(
&self,
text: &str,
priority: Option<i32>,
) -> Result<Map<String, Value>>
pub async fn cron_add( &self, text: &str, priority: Option<i32>, ) -> Result<Map<String, Value>>
cron_add.
Sourcepub async fn cron_list(
&self,
status: Option<&str>,
) -> Result<Map<String, Value>>
pub async fn cron_list( &self, status: Option<&str>, ) -> Result<Map<String, Value>>
cron_list.
Sourcepub async fn invoke_skill(
&self,
skill: &str,
args: &str,
) -> Result<Map<String, Value>>
pub async fn invoke_skill( &self, skill: &str, args: &str, ) -> Result<Map<String, Value>>
invoke_skill on this connection (stream socket for turn enqueue).
Sourcepub async fn reattach_and_probe(&self, loop_id: &str) -> Result<()>
pub async fn reattach_and_probe(&self, loop_id: &str) -> Result<()>
Reattach + subscribe + loop_get probe.