pub struct ClawCoreClient { /* private fields */ }Expand description
Async client for the claw_core daemon.
Communicates over a Unix socket using line-delimited JSON (one request per line, one response per line).
§Example
use claw_core_protocol::{ClawCoreClient, CreateSessionParams, ExecRunParams};
let mut client = ClawCoreClient::connect("/tmp/trl.sock").await?;
let session = client.create_session(CreateSessionParams::default()).await?;
let result = client.exec_run(ExecRunParams {
session_id: session.session_id.clone(),
command: "echo hello".into(),
timeout_s: Some(30),
stdin: None,
env: None,
}).await?;
println!("stdout: {}", result.stdout);Implementations§
Source§impl ClawCoreClient
impl ClawCoreClient
Sourcepub async fn connect(socket_path: &str) -> Result<Self>
pub async fn connect(socket_path: &str) -> Result<Self>
Connect to the claw_core daemon at the given Unix socket path.
Sourcepub async fn send_request(
&mut self,
method: &str,
params: Value,
) -> Result<RpcResponse>
pub async fn send_request( &mut self, method: &str, params: Value, ) -> Result<RpcResponse>
Send a raw RPC request and return the parsed response.
Sourcepub async fn ping(&mut self) -> Result<PingResult>
pub async fn ping(&mut self) -> Result<PingResult>
system.ping — health check.
Sourcepub async fn stats(&mut self) -> Result<SystemStats>
pub async fn stats(&mut self) -> Result<SystemStats>
system.stats — runtime statistics.
Sourcepub async fn create_session(
&mut self,
params: CreateSessionParams,
) -> Result<CreateSessionResult>
pub async fn create_session( &mut self, params: CreateSessionParams, ) -> Result<CreateSessionResult>
session.create — create a new terminal session.
Sourcepub async fn list_sessions(&mut self) -> Result<SessionListResult>
pub async fn list_sessions(&mut self) -> Result<SessionListResult>
session.list — list active sessions.
Sourcepub async fn session_info(&mut self, session_id: &str) -> Result<SessionInfo>
pub async fn session_info(&mut self, session_id: &str) -> Result<SessionInfo>
session.info — get details about a session.
Sourcepub async fn destroy_session(
&mut self,
params: DestroySessionParams,
) -> Result<DestroySessionResult>
pub async fn destroy_session( &mut self, params: DestroySessionParams, ) -> Result<DestroySessionResult>
session.destroy — terminate and clean up a session.
Sourcepub async fn exec_run(&mut self, params: ExecRunParams) -> Result<ExecRunResult>
pub async fn exec_run(&mut self, params: ExecRunParams) -> Result<ExecRunResult>
exec.run — execute a command in a session (buffered, waits for completion).
Auto Trait Implementations§
impl Freeze for ClawCoreClient
impl RefUnwindSafe for ClawCoreClient
impl Send for ClawCoreClient
impl Sync for ClawCoreClient
impl Unpin for ClawCoreClient
impl UnsafeUnpin for ClawCoreClient
impl UnwindSafe for ClawCoreClient
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