Expand description
Google Gemini (Code Assist) runtime — broker-proxied only.
Experimental. See docs/specs/google-gemini-oauth-spec.md.
Modules§
- runtime
- Runtime dispatch for
WireProtocol::GoogleGeminiCodeAssist. - setup
- Google Gemini Code Assist project setup: bounded
loadCodeAssistandonboardUser/operations polling via the broker proxy. - stream
- Broker-proxied streaming call to Code Assist’s
v1internal:streamGenerateContent. Composes: - translate
- Translation between the runtime’s generic chat/tool shape and the Gemini
Code Assist
streamGenerateContentwire format (Vertex-style contents + function calls). Also decodes the SSE line format used bycloudcode-pa.googleapis.comwhen called with?alt=sse.
Structs§
- Gemini
Function Call - Ineligible
Tier - Load
Code Assist Response - Onboard
User Request - Tier
Metadata - Tool
Spec - User
Data
Enums§
- Chat
Turn - Minimal, generic input shape callers assemble before calling the translator. Kept intentionally small: text / tool-call / tool-response only. Media payloads are unsupported in this experimental slice.
- Gemini
Part - Gemini
Stream Event - A decoded, runtime-facing event from the Gemini stream. Text fragments and tool calls are surfaced separately so the runtime can route them without re-parsing the vendor shape.
- Setup
Error - Stream
Error - Runtime-facing outcome of a single streamed model turn.
Constants§
- MAX_
INBOUND_ LINE_ BYTES - Maximum bytes we will buffer for a single SSE line before failing closed. Google’s Code Assist emits reasonably small JSON chunks; refusing anything bigger prevents a hostile upstream from ballooning memory.
- ONBOARDING_
MAX_ ATTEMPTS - Bounded onboarding polling budget. The reference client polls every 5s indefinitely; we cap the total wait so tests and production never spin.
- ONBOARDING_
POLL_ INTERVAL
Functions§
- from_
stream_ line - Decode one inbound SSE
data:line into runtime events. Empty/comment lines yield an empty vec;data: [DONE]yieldsFinish { reason: None }. Malformed JSON is surfaced as anErrso the caller can decide whether to terminate the stream (spec: fail closed on structurally invalid frames). - setup_
user - Resolve the user’s Code Assist project id and tier through the broker.
- setup_
user_ with_ sleeper - Same as
setup_user, but the caller injects a sleeper (test seam). The polling loop is bounded by ONBOARDING_MAX_ATTEMPTS regardless. - stream_
gemini - Start a broker-proxied streaming turn against Code Assist and yield
decoded events as they arrive. The returned stream is
Send + 'staticso it can be forwarded through the runtime’s event bus. - translate_
generate_ content_ request - Translate a normalized conversation + tool set into a
GeminiGenerateRequestready for/v1internal:streamGenerateContent. - translate_
tool_ schemas - Translate tool schemas (Anthropic-shaped:
{name, description, input_schema}) into GeminiToolSpecs. Internal-only tool names are dropped.