pub struct AgentClient { /* private fields */ }Expand description
Adapter that bridges TUI’s AppCommand/AppEvent interface with gRPC streaming
Implementations§
Source§impl AgentClient
impl AgentClient
Sourcepub async fn from_channel(channel: Channel) -> Result<Self, GrpcError>
pub async fn from_channel(channel: Channel) -> Result<Self, GrpcError>
Create client from an existing channel (for in-memory connections)
Sourcepub async fn local(default_model: ModelId) -> Result<Self, GrpcError>
pub async fn local(default_model: ModelId) -> Result<Self, GrpcError>
Convenience constructor: spin up a localhost gRPC server and return a ready client.
Sourcepub async fn create_session(
&self,
config: SessionConfig,
) -> Result<String, GrpcError>
pub async fn create_session( &self, config: SessionConfig, ) -> Result<String, GrpcError>
Create a new session on the server
Sourcepub async fn activate_session(
&self,
session_id: String,
) -> Result<(Vec<Message>, Vec<String>), GrpcError>
pub async fn activate_session( &self, session_id: String, ) -> Result<(Vec<Message>, Vec<String>), GrpcError>
Activate (load) an existing dormant session and get its state
Sourcepub async fn start_streaming(&self) -> Result<(), GrpcError>
pub async fn start_streaming(&self) -> Result<(), GrpcError>
Start bidirectional streaming with the server
Sourcepub async fn send_command(&self, command: AppCommand) -> Result<(), GrpcError>
pub async fn send_command(&self, command: AppCommand) -> Result<(), GrpcError>
Send a command to the server
Sourcepub async fn session_id(&self) -> Option<String>
pub async fn session_id(&self) -> Option<String>
Get the current session ID
Sourcepub async fn list_sessions(&self) -> Result<Vec<SessionInfo>, GrpcError>
pub async fn list_sessions(&self) -> Result<Vec<SessionInfo>, GrpcError>
List sessions on the remote server
Sourcepub async fn get_session(
&self,
session_id: &str,
) -> Result<Option<SessionState>, GrpcError>
pub async fn get_session( &self, session_id: &str, ) -> Result<Option<SessionState>, GrpcError>
Get session details from the remote server
Sourcepub async fn delete_session(&self, session_id: &str) -> Result<bool, GrpcError>
pub async fn delete_session(&self, session_id: &str) -> Result<bool, GrpcError>
Delete a session on the remote server
Sourcepub async fn get_conversation(
&self,
session_id: &str,
) -> Result<(Vec<Message>, Vec<String>), GrpcError>
pub async fn get_conversation( &self, session_id: &str, ) -> Result<(Vec<Message>, Vec<String>), GrpcError>
Get the current conversation for a session
pub async fn get_mcp_servers(&self) -> Result<Vec<McpServerInfo>, GrpcError>
Sourcepub async fn resolve_model(&self, input: &str) -> Result<ModelId, GrpcError>
pub async fn resolve_model(&self, input: &str) -> Result<ModelId, GrpcError>
Resolve a model string (alias or provider/model) to a ModelId
Sourcepub async fn list_providers(&self) -> Result<Vec<ProviderInfo>, GrpcError>
pub async fn list_providers(&self) -> Result<Vec<ProviderInfo>, GrpcError>
List providers from server
Sourcepub async fn get_provider_auth_status(
&self,
provider_id: Option<String>,
) -> Result<Vec<ProviderAuthStatus>, GrpcError>
pub async fn get_provider_auth_status( &self, provider_id: Option<String>, ) -> Result<Vec<ProviderAuthStatus>, GrpcError>
Get provider auth status from server
Sourcepub async fn list_models(
&self,
provider_id: Option<String>,
) -> Result<Vec<ProviderModel>, GrpcError>
pub async fn list_models( &self, provider_id: Option<String>, ) -> Result<Vec<ProviderModel>, GrpcError>
List available models (only recommended ones)
Trait Implementations§
Source§impl AppCommandSink for AgentClient
impl AppCommandSink for AgentClient
Source§fn send_command<'life0, 'async_trait>(
&'life0 self,
command: AppCommand,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_command<'life0, 'async_trait>(
&'life0 self,
command: AppCommand,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a command to the application core.
Source§impl AppEventSource for AgentClient
impl AppEventSource for AgentClient
Source§fn subscribe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Receiver<AppEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn subscribe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Receiver<AppEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Obtain a receiver that yields application events. A fresh receiver
should be returned on every call so multiple consumers can coexist.
Auto Trait Implementations§
impl !Freeze for AgentClient
impl !RefUnwindSafe for AgentClient
impl Send for AgentClient
impl Sync for AgentClient
impl Unpin for AgentClient
impl !UnwindSafe for AgentClient
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request