pub struct RpcClient { /* private fields */ }Expand description
Typed RPC client. Cheap to clone.
Implementations§
Source§impl RpcClient
impl RpcClient
Sourcepub fn connect(transport: Transport) -> Result<Self, ClientError>
pub fn connect(transport: Transport) -> Result<Self, ClientError>
Sourcepub fn from_io<R, W>(reader: R, writer: W) -> Self
pub fn from_io<R, W>(reader: R, writer: W) -> Self
A client over an already connected byte stream pair.
Sourcepub fn events(&self) -> BoxStream<'static, JsonValue>
pub fn events(&self) -> BoxStream<'static, JsonValue>
Raw wire events (everything that is not a reply to this client), from now on.
Sourcepub async fn request(
&self,
command: RpcCommand,
) -> Result<RpcResponseData, ClientError>
pub async fn request( &self, command: RpcCommand, ) -> Result<RpcResponseData, ClientError>
Sends any command and waits for its reply.
§Errors
ClientError::Command with the server’s error text, ClientError::Closed when
the server went away.
Sourcepub async fn ui_respond(&self, response: &UiResponse) -> Result<(), ClientError>
pub async fn ui_respond(&self, response: &UiResponse) -> Result<(), ClientError>
Sourcepub async fn close(&self) -> Result<Option<i32>, ClientError>
pub async fn close(&self) -> Result<Option<i32>, ClientError>
Closes stdin (orderly server shutdown) and waits for the child to exit.
§Errors
Waiting for the child failed.
Sourcepub async fn prompt(
&self,
message: impl Into<String>,
images: Vec<ImageContent>,
streaming_behavior: Option<StreamingBehavior>,
) -> Result<PromptDisposition, ClientError>
pub async fn prompt( &self, message: impl Into<String>, images: Vec<ImageContent>, streaming_behavior: Option<StreamingBehavior>, ) -> Result<PromptDisposition, ClientError>
Sourcepub async fn steer(
&self,
message: impl Into<String>,
images: Vec<ImageContent>,
) -> Result<PromptDisposition, ClientError>
pub async fn steer( &self, message: impl Into<String>, images: Vec<ImageContent>, ) -> Result<PromptDisposition, ClientError>
Sourcepub async fn follow_up(
&self,
message: impl Into<String>,
images: Vec<ImageContent>,
) -> Result<PromptDisposition, ClientError>
pub async fn follow_up( &self, message: impl Into<String>, images: Vec<ImageContent>, ) -> Result<PromptDisposition, ClientError>
Sourcepub async fn clear_queue(&self) -> Result<ClearedQueues, ClientError>
pub async fn clear_queue(&self) -> Result<ClearedQueues, ClientError>
Sourcepub async fn new_session(
&self,
parent_session: Option<String>,
) -> Result<bool, ClientError>
pub async fn new_session( &self, parent_session: Option<String>, ) -> Result<bool, ClientError>
Sourcepub async fn get_state(&self) -> Result<RpcSessionState, ClientError>
pub async fn get_state(&self) -> Result<RpcSessionState, ClientError>
Sourcepub async fn set_model(
&self,
provider: impl Into<String>,
model_id: impl Into<String>,
) -> Result<Model, ClientError>
pub async fn set_model( &self, provider: impl Into<String>, model_id: impl Into<String>, ) -> Result<Model, ClientError>
Sourcepub async fn cycle_model(&self) -> Result<Option<CycleModelResult>, ClientError>
pub async fn cycle_model(&self) -> Result<Option<CycleModelResult>, ClientError>
Sourcepub async fn get_available_models(&self) -> Result<Vec<Model>, ClientError>
pub async fn get_available_models(&self) -> Result<Vec<Model>, ClientError>
Sourcepub async fn set_thinking_level(
&self,
level: ThinkingLevel,
) -> Result<(), ClientError>
pub async fn set_thinking_level( &self, level: ThinkingLevel, ) -> Result<(), ClientError>
Sourcepub async fn cycle_thinking_level(
&self,
) -> Result<Option<ThinkingLevel>, ClientError>
pub async fn cycle_thinking_level( &self, ) -> Result<Option<ThinkingLevel>, ClientError>
Sourcepub async fn get_available_thinking_levels(
&self,
) -> Result<Vec<ThinkingLevel>, ClientError>
pub async fn get_available_thinking_levels( &self, ) -> Result<Vec<ThinkingLevel>, ClientError>
Sourcepub async fn set_steering_mode(
&self,
mode: QueueMode,
) -> Result<(), ClientError>
pub async fn set_steering_mode( &self, mode: QueueMode, ) -> Result<(), ClientError>
Sourcepub async fn set_follow_up_mode(
&self,
mode: QueueMode,
) -> Result<(), ClientError>
pub async fn set_follow_up_mode( &self, mode: QueueMode, ) -> Result<(), ClientError>
Sourcepub async fn compact(
&self,
custom_instructions: Option<String>,
) -> Result<CompactionResult, ClientError>
pub async fn compact( &self, custom_instructions: Option<String>, ) -> Result<CompactionResult, ClientError>
Sourcepub async fn set_auto_compaction(
&self,
enabled: bool,
) -> Result<(), ClientError>
pub async fn set_auto_compaction( &self, enabled: bool, ) -> Result<(), ClientError>
Sourcepub async fn set_auto_retry(&self, enabled: bool) -> Result<(), ClientError>
pub async fn set_auto_retry(&self, enabled: bool) -> Result<(), ClientError>
Sourcepub async fn abort_retry(&self) -> Result<(), ClientError>
pub async fn abort_retry(&self) -> Result<(), ClientError>
Sourcepub async fn bash(
&self,
command: impl Into<String>,
exclude_from_context: bool,
) -> Result<BashResult, ClientError>
pub async fn bash( &self, command: impl Into<String>, exclude_from_context: bool, ) -> Result<BashResult, ClientError>
Sourcepub async fn abort_bash(&self) -> Result<(), ClientError>
pub async fn abort_bash(&self) -> Result<(), ClientError>
Sourcepub async fn get_session_stats(&self) -> Result<SessionStats, ClientError>
pub async fn get_session_stats(&self) -> Result<SessionStats, ClientError>
Sourcepub async fn export_html(
&self,
output_path: Option<String>,
) -> Result<String, ClientError>
pub async fn export_html( &self, output_path: Option<String>, ) -> Result<String, ClientError>
Sourcepub async fn switch_session(
&self,
session_path: impl Into<String>,
) -> Result<bool, ClientError>
pub async fn switch_session( &self, session_path: impl Into<String>, ) -> Result<bool, ClientError>
Sourcepub async fn fork(
&self,
entry_id: impl Into<String>,
) -> Result<ForkOutcome, ClientError>
pub async fn fork( &self, entry_id: impl Into<String>, ) -> Result<ForkOutcome, ClientError>
Sourcepub async fn clone_session(&self) -> Result<bool, ClientError>
pub async fn clone_session(&self) -> Result<bool, ClientError>
Sourcepub async fn get_fork_messages(&self) -> Result<Vec<ForkMessage>, ClientError>
pub async fn get_fork_messages(&self) -> Result<Vec<ForkMessage>, ClientError>
Sourcepub async fn get_entries(
&self,
since: Option<String>,
) -> Result<EntriesOutcome, ClientError>
pub async fn get_entries( &self, since: Option<String>, ) -> Result<EntriesOutcome, ClientError>
Sourcepub async fn get_tree(&self) -> Result<EntriesOutcome, ClientError>
pub async fn get_tree(&self) -> Result<EntriesOutcome, ClientError>
Sourcepub async fn get_last_assistant_text(
&self,
) -> Result<Option<String>, ClientError>
pub async fn get_last_assistant_text( &self, ) -> Result<Option<String>, ClientError>
Sourcepub async fn set_session_name(
&self,
name: impl Into<String>,
) -> Result<(), ClientError>
pub async fn set_session_name( &self, name: impl Into<String>, ) -> Result<(), ClientError>
Sourcepub async fn get_messages(&self) -> Result<Vec<AgentMessage>, ClientError>
pub async fn get_messages(&self) -> Result<Vec<AgentMessage>, ClientError>
Sourcepub async fn get_commands(&self) -> Result<Vec<SlashCommandInfo>, ClientError>
pub async fn get_commands(&self) -> Result<Vec<SlashCommandInfo>, ClientError>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RpcClient
impl !UnwindSafe for RpcClient
impl Freeze for RpcClient
impl Send for RpcClient
impl Sync for RpcClient
impl Unpin for RpcClient
impl UnsafeUnpin for RpcClient
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