pub struct Client { /* private fields */ }Expand description
A cloneable client handle. Calls and the single ordered delivery stream share one serialized message stream, regardless of transport.
Implementations§
Source§impl Client
impl Client
pub async fn runtime_snapshot( &self, ) -> Result<RuntimeSnapshotResult, ClientError>
pub fn connect_provider( &self, params: ProviderConnectParams, ) -> impl Future<Output = Result<ProviderConnectResult, ClientError>> + '_
pub async fn disconnect_provider( &self, params: ProviderDisconnectParams, ) -> Result<ProviderDisconnectResult, ClientError>
Source§impl Client
impl Client
Sourcepub fn connect_stream<T>(transport: T) -> Selfwhere
T: Transport + 'static,
pub fn connect_stream<T>(transport: T) -> Selfwhere
T: Transport + 'static,
Connect an already-created message stream and start its routing task.
Sourcepub fn connect_display_stream<T>(transport: T) -> Selfwhere
T: Transport + 'static,
pub fn connect_display_stream<T>(transport: T) -> Selfwhere
T: Transport + 'static,
Connect a display-only consumer without queuing raw tool snapshots, deltas, or gaps. Durable events (including display and terminal results) and replay barriers are unchanged. Runtime output retention is unaffected.
Sourcepub fn connect_with_event_sink<T, E>(transport: T, sink: E) -> Selfwhere
T: Transport + 'static,
E: ClientEventSink,
pub fn connect_with_event_sink<T, E>(transport: T, sink: E) -> Selfwhere
T: Transport + 'static,
E: ClientEventSink,
Connect a transport and forward ordered protocol deliveries to a consumer-defined sink.
Sourcepub async fn handshake(&self) -> Result<ServerHello, ClientError>
pub async fn handshake(&self) -> Result<ServerHello, ClientError>
Complete the versioned protocol handshake.
Sourcepub fn subscribe_deliveries(&self) -> Option<UnboundedReceiver<ClientDelivery>>
pub fn subscribe_deliveries(&self) -> Option<UnboundedReceiver<ClientDelivery>>
Take the sole live, replay, and output delivery receiver. It never backpressures the connection task.
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
End the connection and fail outstanding calls with ClientError::Closed.
pub async fn create_session( &self, params: SessionCreateParams, ) -> Result<SessionCreateResult, ClientError>
pub async fn list_sessions( &self, params: SessionListParams, ) -> Result<SessionListResult, ClientError>
pub async fn get_session( &self, params: SessionGetParams, ) -> Result<SessionGetResult, ClientError>
pub async fn get_session_goal( &self, params: SessionGoalGetParams, ) -> Result<SessionGoalGetResult, ClientError>
pub async fn set_session_goal( &self, params: SessionGoalSetParams, ) -> Result<SessionGoalSetResult, ClientError>
pub async fn change_session_goal_lifecycle( &self, params: SessionGoalLifecycleParams, ) -> Result<SessionGoalLifecycleResult, ClientError>
pub async fn session_producers( &self, params: SessionProducersParams, ) -> Result<SessionProducersResult, ClientError>
pub async fn session_usage( &self, params: SessionUsageParams, ) -> Result<SessionUsageResult, ClientError>
pub async fn session_tree_usage( &self, params: SessionUsageParams, ) -> Result<SessionTreeUsageResult, ClientError>
pub async fn agent_usage( &self, params: AgentUsageParams, ) -> Result<AgentUsageResult, ClientError>
pub async fn global_usage(&self) -> Result<GlobalUsageResult, ClientError>
pub async fn session_children( &self, params: SessionChildrenParams, ) -> Result<SessionChildrenResult, ClientError>
pub async fn session_tree( &self, params: SessionTreeParams, ) -> Result<SessionTreeResult, ClientError>
pub async fn resume_session( &self, params: SessionResumeParams, ) -> Result<SessionResumeResult, ClientError>
pub async fn rename_session( &self, params: SessionRenameParams, ) -> Result<SessionRenameResult, ClientError>
pub async fn set_permission_mode( &self, params: SessionSetPermissionModeParams, ) -> Result<SessionSetPermissionModeResult, ClientError>
pub async fn get_session_permissions( &self, params: SessionPermissionGetParams, ) -> Result<SessionPermissionGetResult, ClientError>
pub async fn set_session_permission( &self, params: SessionPermissionSetParams, ) -> Result<SessionPermissionMutationResult, ClientError>
pub async fn clear_session_permission( &self, params: SessionPermissionClearParams, ) -> Result<SessionPermissionMutationResult, ClientError>
pub async fn list_skills( &self, params: SkillsListParams, ) -> Result<SkillsListResult, ClientError>
pub async fn get_skill( &self, params: SkillsGetParams, ) -> Result<SkillsGetResult, ClientError>
pub async fn compact_session( &self, params: SessionCompactParams, ) -> Result<SessionCompactResult, ClientError>
pub async fn revert_session( &self, params: SessionRevertParams, ) -> Result<SessionRevertResult, ClientError>
pub async fn fork_session( &self, params: SessionForkParams, ) -> Result<SessionForkResult, ClientError>
pub async fn start_run( &self, params: RunStartParams, ) -> Result<RunStartResult, ClientError>
pub async fn steer_run( &self, params: RunSteerParams, ) -> Result<RunSteerResult, ClientError>
pub async fn recall_steer( &self, params: RunRecallSteerParams, ) -> Result<RunRecallSteerResult, ClientError>
pub async fn cancel_run( &self, params: RunCancelParams, ) -> Result<RunCancelResult, ClientError>
pub async fn tool_stdin( &self, params: RunToolStdinParams, ) -> Result<RunToolStdinResult, ClientError>
pub async fn respond_approval( &self, params: ApprovalRespondParams, ) -> Result<ApprovalRespondResult, ClientError>
pub async fn list_approvals( &self, params: ApprovalListParams, ) -> Result<ApprovalListResult, ClientError>
pub async fn begin_mcp_auth( &self, params: McpAuthBeginParams, ) -> Result<McpAuthBeginResult, ClientError>
pub async fn cancel_mcp_auth( &self, params: McpAuthCancelParams, ) -> Result<McpAuthCancelResult, ClientError>
pub async fn list_mcp_servers(&self) -> Result<McpServerListResult, ClientError>
pub async fn add_mcp_server( &self, params: McpServerAddParams, ) -> Result<McpServerMutationResult, ClientError>
pub async fn edit_mcp_server( &self, params: McpServerEditParams, ) -> Result<McpServerMutationResult, ClientError>
pub async fn remove_mcp_server( &self, params: McpServerNameParams, ) -> Result<McpServerMutationResult, ClientError>
pub async fn set_mcp_server_enabled( &self, params: McpServerSetEnabledParams, ) -> Result<McpServerMutationResult, ClientError>
pub async fn reconnect_mcp_server( &self, params: McpServerNameParams, ) -> Result<McpServerMutationResult, ClientError>
pub async fn persist_mcp_server( &self, params: McpServerPersistParams, ) -> Result<McpServerMutationResult, ClientError>
Sourcepub async fn subscribe_events(
&self,
session_id: SessionId,
cursor: Option<u64>,
) -> Result<(), ClientError>
pub async fn subscribe_events( &self, session_id: SessionId, cursor: Option<u64>, ) -> Result<(), ClientError>
Start an initial cursor replay. Its contents are delivered only through
Client::subscribe_deliveries.
Sourcepub fn recover_session(&self, session_id: SessionId, full_replay: bool)
pub fn recover_session(&self, session_id: SessionId, full_replay: bool)
Recover one session. full_replay is used when its local projection is
no longer trustworthy.
pub async fn call<P, R>( &self, method: &str, params: &P, ) -> Result<R, ClientError>
Sourcepub async fn call_sensitive<P, R>(
&self,
method: &str,
params: P,
) -> Result<R, ClientError>where
P: Serialize,
R: DeserializeOwned,
pub async fn call_sensitive<P, R>(
&self,
method: &str,
params: P,
) -> Result<R, ClientError>where
P: Serialize,
R: DeserializeOwned,
Send a secret-bearing request from wiping process-owned buffers.
The owned params are dropped immediately after serialization. The serialized JSON is wiped when dispatch completes or is cancelled.