pub struct Client(/* private fields */);Expand description
Display-only protocol client. Raw output is retained by the runtime, not the TUI.
Implementations§
Source§impl Client
impl Client
pub fn connect_stream<T: Transport + 'static>(transport: T) -> Self
pub fn connect_in_process(server: Arc<Server>) -> Self
pub async fn connect_websocket_with_token( url: &str, token: &str, ) -> Result<Self, ClientError>
Methods from Deref<Target = 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>
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.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> ClientProtocol for T
impl<T> ClientProtocol for T
fn handshake<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ServerHello, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn create_session<'life0, 'async_trait>(
&'life0 self,
params: SessionCreateParams,
) -> Pin<Box<dyn Future<Output = Result<SessionCreateResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn list_sessions<'life0, 'async_trait>(
&'life0 self,
params: SessionListParams,
) -> Pin<Box<dyn Future<Output = Result<SessionListResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn get_session<'life0, 'async_trait>(
&'life0 self,
params: SessionGetParams,
) -> Pin<Box<dyn Future<Output = Result<SessionGetResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn get_session_goal<'life0, 'async_trait>(
&'life0 self,
params: SessionGoalGetParams,
) -> Pin<Box<dyn Future<Output = Result<SessionGoalGetResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn set_session_goal<'life0, 'async_trait>(
&'life0 self,
params: SessionGoalSetParams,
) -> Pin<Box<dyn Future<Output = Result<SessionGoalSetResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn change_session_goal_lifecycle<'life0, 'async_trait>(
&'life0 self,
params: SessionGoalLifecycleParams,
) -> Pin<Box<dyn Future<Output = Result<SessionGoalLifecycleResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn session_producers<'life0, 'async_trait>(
&'life0 self,
params: SessionProducersParams,
) -> Pin<Box<dyn Future<Output = Result<SessionProducersResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn session_usage<'life0, 'async_trait>(
&'life0 self,
params: SessionUsageParams,
) -> Pin<Box<dyn Future<Output = Result<SessionUsageResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn session_tree_usage<'life0, 'async_trait>(
&'life0 self,
params: SessionUsageParams,
) -> Pin<Box<dyn Future<Output = Result<SessionTreeUsageResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn agent_usage<'life0, 'async_trait>(
&'life0 self,
params: AgentUsageParams,
) -> Pin<Box<dyn Future<Output = Result<AgentUsageResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn global_usage<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GlobalUsageResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn session_children<'life0, 'async_trait>(
&'life0 self,
params: SessionChildrenParams,
) -> Pin<Box<dyn Future<Output = Result<SessionChildrenResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn session_tree<'life0, 'async_trait>(
&'life0 self,
params: SessionTreeParams,
) -> Pin<Box<dyn Future<Output = Result<SessionTreeResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn resume_session<'life0, 'async_trait>(
&'life0 self,
params: SessionResumeParams,
) -> Pin<Box<dyn Future<Output = Result<SessionResumeResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn rename_session<'life0, 'async_trait>(
&'life0 self,
params: SessionRenameParams,
) -> Pin<Box<dyn Future<Output = Result<SessionRenameResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn set_permission_mode<'life0, 'async_trait>(
&'life0 self,
params: SessionSetPermissionModeParams,
) -> Pin<Box<dyn Future<Output = Result<SessionSetPermissionModeResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn get_session_permissions<'life0, 'async_trait>(
&'life0 self,
params: SessionPermissionGetParams,
) -> Pin<Box<dyn Future<Output = Result<SessionPermissionGetResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn set_session_permission<'life0, 'async_trait>(
&'life0 self,
params: SessionPermissionSetParams,
) -> Pin<Box<dyn Future<Output = Result<SessionPermissionMutationResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn clear_session_permission<'life0, 'async_trait>(
&'life0 self,
params: SessionPermissionClearParams,
) -> Pin<Box<dyn Future<Output = Result<SessionPermissionMutationResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn list_skills<'life0, 'async_trait>(
&'life0 self,
params: SkillsListParams,
) -> Pin<Box<dyn Future<Output = Result<SkillsListResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn get_skill<'life0, 'async_trait>(
&'life0 self,
params: SkillsGetParams,
) -> Pin<Box<dyn Future<Output = Result<SkillsGetResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn compact_session<'life0, 'async_trait>(
&'life0 self,
params: SessionCompactParams,
) -> Pin<Box<dyn Future<Output = Result<SessionCompactResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn revert_session<'life0, 'async_trait>(
&'life0 self,
params: SessionRevertParams,
) -> Pin<Box<dyn Future<Output = Result<SessionRevertResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn fork_session<'life0, 'async_trait>(
&'life0 self,
params: SessionForkParams,
) -> Pin<Box<dyn Future<Output = Result<SessionForkResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn start_run<'life0, 'async_trait>(
&'life0 self,
params: RunStartParams,
) -> Pin<Box<dyn Future<Output = Result<RunStartResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn steer_run<'life0, 'async_trait>(
&'life0 self,
params: RunSteerParams,
) -> Pin<Box<dyn Future<Output = Result<RunSteerResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn recall_steer<'life0, 'async_trait>(
&'life0 self,
params: RunRecallSteerParams,
) -> Pin<Box<dyn Future<Output = Result<RunRecallSteerResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn cancel_run<'life0, 'async_trait>(
&'life0 self,
params: RunCancelParams,
) -> Pin<Box<dyn Future<Output = Result<RunCancelResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn tool_stdin<'life0, 'async_trait>(
&'life0 self,
params: RunToolStdinParams,
) -> Pin<Box<dyn Future<Output = Result<RunToolStdinResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn respond_approval<'life0, 'async_trait>(
&'life0 self,
params: ApprovalRespondParams,
) -> Pin<Box<dyn Future<Output = Result<ApprovalRespondResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn list_approvals<'life0, 'async_trait>(
&'life0 self,
params: ApprovalListParams,
) -> Pin<Box<dyn Future<Output = Result<ApprovalListResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn begin_mcp_auth<'life0, 'async_trait>(
&'life0 self,
params: McpAuthBeginParams,
) -> Pin<Box<dyn Future<Output = Result<McpAuthBeginResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn cancel_mcp_auth<'life0, 'async_trait>(
&'life0 self,
params: McpAuthCancelParams,
) -> Pin<Box<dyn Future<Output = Result<McpAuthCancelResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn list_mcp_servers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<McpServerListResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn add_mcp_server<'life0, 'async_trait>(
&'life0 self,
params: McpServerAddParams,
) -> Pin<Box<dyn Future<Output = Result<McpServerMutationResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn edit_mcp_server<'life0, 'async_trait>(
&'life0 self,
params: McpServerEditParams,
) -> Pin<Box<dyn Future<Output = Result<McpServerMutationResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn remove_mcp_server<'life0, 'async_trait>(
&'life0 self,
params: McpServerNameParams,
) -> Pin<Box<dyn Future<Output = Result<McpServerMutationResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn set_mcp_server_enabled<'life0, 'async_trait>(
&'life0 self,
params: McpServerSetEnabledParams,
) -> Pin<Box<dyn Future<Output = Result<McpServerMutationResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn reconnect_mcp_server<'life0, 'async_trait>(
&'life0 self,
params: McpServerNameParams,
) -> Pin<Box<dyn Future<Output = Result<McpServerMutationResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn persist_mcp_server<'life0, 'async_trait>(
&'life0 self,
params: McpServerPersistParams,
) -> Pin<Box<dyn Future<Output = Result<McpServerMutationResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn subscribe_events<'life0, 'async_trait>(
&'life0 self,
session_id: SessionId,
cursor: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn runtime_snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RuntimeSnapshotResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn connect_provider<'life0, 'async_trait>(
&'life0 self,
params: ProviderConnectParams,
) -> Pin<Box<dyn Future<Output = Result<ProviderConnectResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn disconnect_provider<'life0, 'async_trait>(
&'life0 self,
params: ProviderDisconnectParams,
) -> Pin<Box<dyn Future<Output = Result<ProviderDisconnectResult, ClientError>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn recover_session(&self, session_id: SessionId, full_replay: bool)
fn shutdown(&self)
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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