Skip to main content

WireClient

Trait WireClient 

Source
pub trait WireClient: Send {
Show 16 methods // Required methods fn next_id(&mut self) -> String; fn send_request<Params: Serialize + Sync>( &mut self, req: &JsonRpcRequest<Params>, ) -> impl Future<Output = Result<(), WireError>> + Send; fn read_raw_message( &mut self, ) -> impl Future<Output = Result<RawWireMessage, WireError>> + Send; fn read_raw_message_timeout( &mut self, timeout: Duration, ) -> impl Future<Output = Result<RawWireMessage, WireError>> + Send; fn send_response<T: Serialize + Send>( &mut self, id: &str, result: T, ) -> impl Future<Output = Result<(), WireError>> + Send; fn send_error( &mut self, id: &str, code: i32, message: &str, ) -> impl Future<Output = Result<(), WireError>> + Send; fn initialize( &mut self, params: InitializeParams, ) -> impl Future<Output = Result<InitializeResult, WireError>> + Send; fn is_handshake_done(&self) -> bool; fn shutdown(self) -> impl Future<Output = Result<(), WireError>> + Send; fn read_response<T: DeserializeOwned + Send>( &mut self, expected_id: &str, ) -> impl Future<Output = Result<T, WireError>> + Send; // Provided methods fn prompt( &mut self, user_input: impl Into<UserInput> + Send, ) -> impl Future<Output = Result<PromptResult, WireError>> + Send { ... } fn start_prompt( &mut self, user_input: impl Into<UserInput> + Send, ) -> impl Future<Output = Result<String, WireError>> + Send { ... } fn replay( &mut self, ) -> impl Future<Output = Result<ReplayResult, WireError>> + Send { ... } fn steer( &mut self, user_input: impl Into<UserInput> + Send, ) -> impl Future<Output = Result<SteerResult, WireError>> + Send { ... } fn set_plan_mode( &mut self, enabled: bool, ) -> impl Future<Output = Result<SetPlanModeResult, WireError>> + Send { ... } fn cancel(&mut self) -> impl Future<Output = Result<(), WireError>> + Send { ... }
}
Expand description

Trait for a Kimi Wire Protocol client.

Implementations may communicate over a child process, an in-memory channel, or any other transport.

Required Methods§

Source

fn next_id(&mut self) -> String

Generate the next request id.

Source

fn send_request<Params: Serialize + Sync>( &mut self, req: &JsonRpcRequest<Params>, ) -> impl Future<Output = Result<(), WireError>> + Send

Send a JSON-RPC request.

Source

fn read_raw_message( &mut self, ) -> impl Future<Output = Result<RawWireMessage, WireError>> + Send

Read the next incoming raw wire message.

Source

fn read_raw_message_timeout( &mut self, timeout: Duration, ) -> impl Future<Output = Result<RawWireMessage, WireError>> + Send

Read the next incoming raw wire message with a timeout.

Source

fn send_response<T: Serialize + Send>( &mut self, id: &str, result: T, ) -> impl Future<Output = Result<(), WireError>> + Send

Send a JSON-RPC success response.

Source

fn send_error( &mut self, id: &str, code: i32, message: &str, ) -> impl Future<Output = Result<(), WireError>> + Send

Send a JSON-RPC error response.

Source

fn initialize( &mut self, params: InitializeParams, ) -> impl Future<Output = Result<InitializeResult, WireError>> + Send

Perform the initialize handshake.

Source

fn is_handshake_done(&self) -> bool

Returns true if the initialize handshake has completed.

Source

fn shutdown(self) -> impl Future<Output = Result<(), WireError>> + Send

Gracefully shut down the client.

Source

fn read_response<T: DeserializeOwned + Send>( &mut self, expected_id: &str, ) -> impl Future<Output = Result<T, WireError>> + Send

Wait for a response matching expected_id, buffering out-of-order messages internally.

Provided Methods§

Source

fn prompt( &mut self, user_input: impl Into<UserInput> + Send, ) -> impl Future<Output = Result<PromptResult, WireError>> + Send

Send a prompt and wait for the result.

Source

fn start_prompt( &mut self, user_input: impl Into<UserInput> + Send, ) -> impl Future<Output = Result<String, WireError>> + Send

Send a prompt without waiting for the result.

Source

fn replay( &mut self, ) -> impl Future<Output = Result<ReplayResult, WireError>> + Send

Replay events and requests from the current session.

Source

fn steer( &mut self, user_input: impl Into<UserInput> + Send, ) -> impl Future<Output = Result<SteerResult, WireError>> + Send

Steer the current turn with additional user input.

Source

fn set_plan_mode( &mut self, enabled: bool, ) -> impl Future<Output = Result<SetPlanModeResult, WireError>> + Send

Enable or disable plan mode.

Source

fn cancel(&mut self) -> impl Future<Output = Result<(), WireError>> + Send

Cancel the current turn.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§