Expand description
§The L0 contract — frames on a wire
This module is the engineered surface of the wire layer: the closed set
of primitives L0 exposes upward, curated and named. Everything a higher
layer may rely on is here; everything absent is an implementation detail
that can change without notice. (prelude remains the convenience glob;
this module is the contract.)
L0 promises: a duplex, authenticated, resumable frame stream to the Live API — connect, write frames (audio/text/video/tool responses), read events — plus the audio machinery a realtime client needs at the edge (lock-free buffers, jitter absorption, VAD, barge-in detection).
L0 never: interprets a conversation, holds session state, dispatches a tool, or decides when to speak. It moves frames and tells the truth about time.
The primitives, by concern:
| Concern | Primitives |
|---|---|
| Connect | SessionConfig, ConnectBuilder, ApiEndpoint, ResumeInfo |
| Speak / listen | SessionHandle, SessionWriter, SessionReader, SessionEvent, SessionPhase |
| Say things | Content, Part, Role, ModelId, Voice, Modality |
| Tools on the wire | Tool, FunctionDeclaration, FunctionCall, FunctionResponse, FunctionCallingBehavior, FunctionResponseScheduling |
| Real time | SpscRing, AudioJitterBuffer, bytes_to_i16, i16_to_bytes, BargeInDetector, TurnDetector |
| Access | AuthProvider, GoogleAIAuth, VertexAIAuth, Transport, TungsteniteTransport, Codec, JsonCodec |
| Truth | UsageMetadata, SessionError |
Re-exports§
pub use crate::protocol::types::ApiEndpoint;pub use crate::protocol::types::Content;pub use crate::protocol::types::FunctionCall;pub use crate::protocol::types::FunctionCallingBehavior;pub use crate::protocol::types::FunctionDeclaration;pub use crate::protocol::types::FunctionResponse;pub use crate::protocol::types::FunctionResponseScheduling;pub use crate::protocol::types::Modality;pub use crate::protocol::types::ModelId;pub use crate::protocol::types::Part;pub use crate::protocol::types::Role;pub use crate::protocol::types::SessionConfig;pub use crate::protocol::types::Tool;pub use crate::protocol::types::UsageMetadata;pub use crate::protocol::types::Voice;pub use crate::session::ResumeInfo;pub use crate::session::SessionError;pub use crate::session::SessionEvent;pub use crate::session::SessionHandle;pub use crate::session::SessionPhase;pub use crate::session::SessionReader;pub use crate::session::SessionWriter;pub use crate::transport::auth::AuthProvider;pub use crate::transport::auth::GoogleAIAuth;pub use crate::transport::auth::VertexAIAuth;pub use crate::transport::ws::Transport;pub use crate::transport::ws::TungsteniteTransport;pub use crate::transport::Codec;pub use crate::transport::ConnectBuilder;pub use crate::transport::JsonCodec;pub use crate::buffer::AudioJitterBuffer;pub use crate::buffer::SpscConsumer;pub use crate::buffer::SpscProducer;pub use crate::buffer::SpscRing;pub use crate::buffer::bytes_to_i16;pub use crate::buffer::i16_to_bytes;pub use crate::turn::BargeInDetector;pub use crate::turn::TurnDetector;