Skip to main content

Module stream

Module stream 

Source
Expand description

Broker-proxied streaming call to Code Assist’s v1internal:streamGenerateContent. Composes:

  1. translate_generate_content_request (pure translator)
  2. CredentialBroker::proxy_stream (bearer + pinned host + no redirect)
  3. line-buffered SSE decoding via from_stream_line

The runtime never touches the OAuth access token, the refresh token, or auth.json — those live behind the broker boundary. Cancellation is honored between chunks so long streams terminate promptly.

Structs§

GeminiEventChannelSnapshot

Enums§

StreamError
Runtime-facing outcome of a single streamed model turn.

Constants§

GEMINI_EVENT_CHANNEL_CAPACITY
Bounded producer/consumer handoff for decoded Gemini events. The producer awaits capacity (explicit backpressure); dropping the receiver makes send fail immediately and releases the pump.

Functions§

build_stream_request
Build the exact-byte ProxyRequest for one streamed Code Assist turn. The JSON envelope is serialized once via ProxyRequest::post_json_exact; the returned bytes::Bytes handle is the very buffer LocalBroker sends verbatim, so a caller-side trace digest over it describes the true wire body on the local-broker path.
gemini_event_channel_snapshot
stream_gemini
Start a broker-proxied streaming turn against Code Assist and yield decoded events as they arrive. The returned stream is Send + 'static so it can be forwarded through the runtime’s event bus.
stream_gemini_request
Start one broker stream attempt from a prebuilt request (see build_stream_request). Retry loops reuse the same request value per attempt so every attempt sends identical bytes.