agentd through a sandbox relay.
Constants
FLAG_TERMINAL
FLAG_SESSION_START
FLAG_SHUTDOWN
AgentClient
Low-level client for raw agent frames.AgentClient.connectSandbox()
Example
Example
core.ready handshake. Sandbox names are limited to 128 UTF-8 bytes.
Parameters
namestringSandbox name, up to 128 UTF-8 bytes.
Optional connect settings, e.g. handshake timeout.
Returns
Connected client.
AgentClient.connect()
Example
Example
agentd relay socket by path. Use this when you already have the socket path, for example one returned by socketPath().
Parameters
pathstringFilesystem path of the relay socket.
Optional connect settings, e.g. handshake timeout.
Returns
Connected client.
AgentClient.socketPath()
Example
Example
agentd relay socket path without connecting. Returns the same path connectSandbox() would dial, so you can talk 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. Sandbox names are limited to 128 UTF-8 bytes.
Parameters
namestringSandbox name, up to 128 UTF-8 bytes.
Returns
string
Relay socket path.
Instance methods
client.request()
Example
Example
FsRequest to FsResponse).
Parameters
flagsnumberFrame flag byte, e.g.
FLAG_SESSION_START.bodyBufferCBOR-encoded protocol message body.
Returns
The single response frame.
client.stream()
Example
Example
AgentStream carries the protocol correlation id (pass it to send() for follow-up frames) and is also an async iterator of raw frames.
Parameters
flagsnumberFrame flag byte for the opening frame, e.g.
FLAG_SESSION_START.bodyBufferCBOR-encoded protocol message body.
Returns
Open stream of raw frames.
client.send()
Example
Example
id of the AgentStream returned by stream().
Parameters
idnumberCorrelation id of an open session.
flagsnumberFrame flag byte.
bodyBufferCBOR-encoded protocol message body.
client.readyBytes()
Example
Example
core.ready frame body as CBOR bytes. Captured during connect, so this is a synchronous accessor with no protocol traffic.
Returns
Buffer
CBOR-encoded
core.ready frame body.client.close()
Example
Example
AgentStream
Returned by stream()
An open raw agent stream. ImplementsAsyncIterableIterator<RawFrame>, so it can be driven with for await. The iterator ends after a frame carrying FLAG_TERMINAL or when the underlying stream is exhausted.
stream.id
number
Protocol correlation id; pass to send() for follow-up frames
stream.next()
done once terminal or exhausted
Returns
Promise<IteratorResult<RawFrame>>
stream.close()
Returns
Promise<void>
stream.return()
Returns
Promise<IteratorResult<RawFrame>>
stream.Symbol.asyncIterator
Returns
AgentStream
Types
RawFrame
Returned by request() · iterated from AgentStream
A raw protocol frame. Thebody is the CBOR-encoded Message body (v, t, p) as it appeared on the wire; decode it with a CBOR library such as cbor-x.
AgentConnectOptions
Used by connectSandbox() · connect()
Options for connecting to an agent relay.