Skip to main content

Module transport

Module transport 

Source
Expand description

Getting events from somewhere.

Everything else in this crate is synchronous. This is the one layer that talks to the outside world, and the only place async appears — which is what lets the rest of the crate run under any executor, or none.

Transport is deliberately small: one method that takes a RunAgentInput and hands back the run’s stream as the transport has it, a TransportStream. That is wire JSON for anything that reads bytes, and typed events for a source that never had a wire. The client reads either through the same compatibility boundary. Implementations shipped here:

  • sse — the text/event-stream decoder every HTTP transport needs.
  • http (feature http) — HttpTransport, backed by reqwest.
  • replay — ReplayTransport, which serves a scripted list of events and records what was sent to it. Tests use it; so does the doc example.

A wasm frontend, an in-process agent, a websocket, a recorded fixture: each is an impl Transport, and nothing above this module changes.

Re-exports§

pub use replay::ReplayTransport;
pub use sse::SseDecoder;
pub use sse::SseFrame;
pub use sse::decode_events;
pub use sse::decode_raw_events;
pub use http::HttpTransport;
pub use http::HttpTransportBuilder;

Modules§

http
The reqwest-backed HTTP transport.
replay
A transport that replays a scripted list of events.
sse
Decoding text/event-stream.

Structs§

TransportStream
One run’s events as a transport has them, before the client reads them.

Traits§

Transport
Somewhere an agent’s events come from.

Functions§

enforce_events
Runs raw wire events through the compatibility and enforcement boundary every transport shares, handing each of its warnings to on_warning.

Type Aliases§

EventStream
A boxed stream of typed events, after the compatibility boundary.
RawEventStream
A boxed stream of wire JSON, before the compatibility boundary.
TransportFuture
The future Transport::run returns: connecting, before any event arrives.