Skip to main content

microsandbox_agent_client/
lib.rs

1//! Transport-agnostic client for the microsandbox agent protocol.
2//!
3//! This crate owns the low-level client layer: handshakes, correlation IDs,
4//! request/stream routing, message encoding, and transport adapters. High-level
5//! SDK crates remain responsible for sandbox lifecycle and name resolution.
6//!
7//! No transport is enabled by default. Enable `uds` for local microsandbox relay
8//! sockets on Unix, `named-pipe` for local relay pipes on Windows, or `stream`
9//! to drive the client over any `AsyncRead + AsyncWrite` byte stream (e.g. a
10//! caller-owned, pre-authenticated transport adapted to bytes).
11
12#![warn(missing_docs)]
13#![doc = include_str!("../README.md")]
14
15pub mod client;
16pub mod error;
17/// Internal Unix-local shared-memory transport used by the UDS adapter and runtime relay.
18///
19/// The SDK connects through [`OptimizedAgentClient`] for automatic arena negotiation.
20#[cfg(all(feature = "uds", unix))]
21#[doc(hidden)]
22pub mod local_shm;
23pub mod message;
24#[doc(hidden)]
25pub mod optimized;
26pub mod protocol;
27pub mod stream;
28pub mod transport;
29
30/// Transport adapters that can be enabled with crate features.
31pub mod transports;
32
33//--------------------------------------------------------------------------------------------------
34// Re-Exports
35//--------------------------------------------------------------------------------------------------
36
37pub use client::AgentClient;
38pub use error::{AgentClientError, AgentClientResult};
39pub use message::{EncodedMessage, IntoOutboundMessage, OutboundMessage, TypedMessage};
40pub use microsandbox_protocol_client::{
41    Client, ClientError, ClientResult, ConnectOptions, Connector, Delivery, ErrorKind, Request,
42    RequestOptions,
43};
44#[doc(hidden)]
45pub use optimized::{AgentClient as OptimizedAgentClient, AgentFrame};
46pub use protocol::{AgentProtocol, AgentReady, AgentWireFormat};
47pub use stream::{AgentStream, RawAgentStream};
48pub use transport::{AgentTransport, TransportPacket};