agentd through a sandbox relay.
Module functions
agent::connect_sandbox()
Example
Example
Parameters
name&strReturns
agent::connect_sandbox_with_timeout()
Example
Example
connect_sandbox, but with an explicit handshake timeout instead of the ten-second default.
Parameters
name&strtimeoutDurationReturns
AgentClient
Returned by agent::connect_sandbox(), AgentClient::connect() · wrapped by AgentBridge
Low-level client for raw agent frames.AgentClient::connect()
Example
Example
core.ready frame, and starts one background reader task.
Parameters
sock_pathimpl AsRef<Path>Returns
AgentClient::connect_with_timeout()
Parameters
sock_pathimpl AsRef<Path>timeoutDurationReturns
AgentClient::connect_with_deadline()
Parameters
sock_pathimpl AsRef<Path>deadlineInstantReturns
AgentClient::connect_sandbox()
agent::connect_sandbox.
Parameters
name&strReturns
AgentClient::connect_sandbox_with_timeout()
agent::connect_sandbox_with_timeout.
Parameters
name&strtimeoutDurationReturns
AgentClient::socket_path()
Example
Example
connect_sandbox would dial: the hashed path under the runtime directory when it fits the platform’s Unix-socket length limit, and the legacy name-derived path otherwise. Useful for talking to agentd over a raw byte transport (for example a transparent relay that splices bytes to and from the socket) instead of this frame client. The sandbox need not be running.
Parameters
name&strReturns
AgentClient::ensure_version_compat_for()
Example
Example
AgentClientError::UnsupportedOperation if the type was introduced after the given generation.
Parameters
tMessageTypenegotiatedu8Instance methods
client.request()
Example
Example
AgentClientError::UnsupportedOperation if the connected sandbox is too old for the message type.
Parameters
tMessageTypepayload&T: SerializeReturns
client.stream()
Example
Example
send() for follow-up messages such as stdin, resize, signal, or file data chunks. The receiver yields messages until a terminal frame is delivered or the connection closes.
Parameters
tMessageTypepayload&T: SerializeReturns
client.send()
Example
Example
stream()).
Parameters
idu32tMessageTypepayload&T: Serializeclient.request_raw()
Example
Example
(flags, body), and wait for one raw response frame with the matching id. CBOR encoding and decoding are left to the caller.
Parameters
flagsu8bodyVec<u8>Returns
client.stream_raw()
send_raw() with the returned id to send follow-up frames.
Parameters
flagsu8bodyVec<u8>Returns
client.send_raw()
stream_raw()).
Parameters
idu32flagsu8body&[u8]client.ready()
Example
Example
core.ready payload captured during the handshake (boot timings and the runtime’s self-reported version).
Returns
client.ready_bytes()
core.ready frame body as CBOR bytes. Useful for bindings that want to deserialize the ready payload with their own CBOR tooling. For typed access, use ready().
Returns
client.protocol()
Returns
Current or LegacyV1.client.is_legacy_protocol()
Returns
true if the relay speaks the pre-0.5 protocol.client.negotiated_version()
supports() and the typed send path, and it is distinct from protocol(), which selects the wire codec.
Returns
client.agent_version()
core.ready frame. Empty when the runtime predates this field (an older agent), in which case fall back to the generation for diagnostics.
Returns
client.supports()
Example
Example
Parameters
tMessageTypeReturns
true if the runtime can handle the type.client.ensure_version_compat()
Example
Example
request(), stream(), and send() methods call this internally.
Parameters
tMessageTypeclient.close()
Example
Example
AgentClientError::Closed. Dropping the client has the same effect.
AgentBridge
FFI-friendly bytes-in/bytes-out wrapper aroundAgentClient.
AgentBridge::connect_sandbox()
Parameters
name&strReturns
AgentBridge::connect_sandbox_with_timeout()
Parameters
name&strtimeoutDurationReturns
AgentBridge::connect_path()
Parameters
path&strReturns
AgentBridge::connect_path_with_timeout()
Parameters
path&strtimeoutDurationReturns
bridge.request()
(flags, body) and wait for one response frame.
Parameters
flagsu8bodyVec<u8>Returns
bridge.send()
Parameters
idu32flagsu8bodyVec<u8>bridge.stream_open()
send()) and an opaque stream handle (for stream_next() and stream_close()).
Parameters
flagsu8bodyVec<u8>Returns
bridge.stream_next()
Example
Example
None when the stream has ended (the terminal frame was already delivered, or the stream was closed or dropped).
Parameters
handleStreamHandlestream_open().Returns
None at end of stream.bridge.stream_close()
Parameters
handleStreamHandlestream_open().bridge.ready_bytes()
core.ready frame body bytes (CBOR). Errors with AgentClientError::Closed if the bridge has been closed.
Returns
bridge.close()
Example
Example
AgentClientError::Closed.
Types
BridgeFrame
Returned by bridge.request(), bridge.stream_next()
FFI-friendly view of aRawFrame: id, flags, body bytes.
StreamHandle
Returned by bridge.stream_open() · used by bridge.stream_next(), bridge.stream_close()
AgentBridge. Foreign-language wrappers reference streams by this u64 instead of owning a tokio receiver.
AgentProtocol
Returned by client.protocol()
Agent protocol generation (wire codec) spoken by a connected sandbox relay.RawFrame
Returned by client.request_raw(), client.stream_raw()
A framed protocol message at the byte level.id is the protocol correlation id, flags is the frame flag byte, and body is the CBOR-encoded protocol message body. Re-exported from microsandbox::protocol::codec.
AgentClientError
Error variant of AgentClientResult
Errors raised byAgentClient and AgentBridge.
AgentClientResult
Returned by most AgentClient and AgentBridge methods
AgentClientError.