bodhi-realtime-agent / GeminiCredentialProvider
Type Alias: GeminiCredentialProvider
GeminiCredentialProvider = (
setup,signal) =>Promise<GeminiCredential>
Defined in: src/transport/gemini-live-transport.ts:268
Fetches the credential for one connection. Called inside every connect() (start, reconnect, transfer, recovery redial) with that connection's final setup, which is the object live.connect receives a copy of. signal aborts when the attempt is cancelled: its half of the connect deadline ran out, abortIncumbent() retired it, a newer connect() superseded it, or disconnect() ran while it fetched. A credential that arrives after cancellation is dropped unused.
setup includes the conversation's resumption handle (a bearer secret: it resumes the conversation under any key) and the full system instruction. Send it only to whatever mints the credential, and do not log or persist it.
A rejection fails the connect, and what it carries travels: its message becomes part of the connect's error (which a VoiceSession reports through onError and in session.upstreamLost's detail) and of ConnectFailure.message, and the error itself is ConnectFailure.error on the lifecycle events. Throw errors that are safe to log, with no token, secret-bearing URL or response body. A VoiceSession retries an automatic reconnect whose provider failed through its reconnect budget; reject with an error whose retryable property is false when the failure is permanent (no key for this owner, access revoked) and the session gives up at once (with upstreamRecovery, whose fatal backoff then holds off its redials). upstreamRecovery's close classifier also reads the failure's message, so a transient error should not name an HTTP 401, 403 or 404 or a quota.
Parameters
setup
signal
AbortSignal
Returns
Promise<GeminiCredential>