@gullabs/google 0.13.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +6 -0
- package/README.md +446 -31
- package/dist/index.cjs +2248 -632
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +680 -278
- package/dist/index.d.ts +680 -278
- package/dist/index.js +2246 -634
- package/dist/index.js.map +1 -1
- package/package.json +18 -10
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts","../src/reasoning-budget.ts","../src/grounding.ts","../src/tool-call-id.ts","../src/flex-fallback.ts","../src/errors.ts","../src/adapter.ts","../src/pricing.ts","../src/cost.ts","../src/model-config/gemini-2.5-pro.ts","../src/model-config/gemini-2.5-flash.ts","../src/model-config/gemini-2.5-flash-lite.ts","../src/model-config/gemini-3.1-flash-lite.ts","../src/model-config/gemini-3.1-pro-preview.ts","../src/model-config/gemini-3.5-flash-lite.ts","../src/model-config/gemini-3.6-flash.ts","../src/model-config/gemini-3.7-flash.ts","../src/model-config/gemini-3.8-flash.ts","../src/model-config/gemma-4-31b-it.ts","../src/model-config/gemma-4-26b-a4b-it.ts","../src/models.ts","../src/provider.ts","../src/file-store.ts","../src/cache-store.ts","../src/content-to-messages.ts"],"names":["LlmError","classifyError","assertNever","computeCost","z","toConfigJsonSchema","zodToStandardSchema","createModelRegistry","redactSecrets"],"mappings":";;;;;;AAyBO,SAAS,cAAc,IAAA,EAA4B;AACxD,EAAA,IACE,EAAE,QAAA,IAAY,IAAA,CAAA,IACd,OAAO,IAAA,CAAK,MAAA,KAAW,QAAA,IACvB,IAAA,CAAK,MAAA,CAAO,IAAA,EAAK,KAAM,EAAA,EACvB;AACA,IAAA,MAAM,IAAIA,cAAS,sCAAA,EAAwC;AAAA,MACzD,IAAA,EAAM,cAAA;AAAA,MACN,SAAA,EAAW,KAAA;AAAA,MACX,QAAA,EAAU;AAAA,KACX,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,GAAI,EAAC,EAAI,QAAA,EAAS;AACjE","file":"index.cjs","sourcesContent":["/**\n * Structural GeminiClientLike interface + buildGoogleClient factory.\n *\n * This module defines the structural interface the adapter depends on.\n * The real @google/genai SDK is imported ONLY in buildGoogleClient so tests\n * can inject a fake without pulling in the real SDK.\n *\n * @module\n */\n\nimport { LlmError } from '@gullabs/core'\nimport type { AuthMaterial } from '@gullabs/core'\n\n// ---------------------------------------------------------------------------\n// Auth narrowing — Google only accepts ApiKeyAuth\n// ---------------------------------------------------------------------------\n\n/**\n * Narrows {@link AuthMaterial} to its `apiKey` string, rejecting the\n * dev-only `CliSessionAuth` variant.\n *\n * Google is a production API provider and only ever accepts API-key\n * credentials; `{ cliSession: true }` is reserved for the dev-only CLI\n * provider packages (`@gullabs/claude-cli`, `@gullabs/codex-cli`).\n */\nexport function requireApiKey(auth: AuthMaterial): string {\n if (\n !('apiKey' in auth) ||\n typeof auth.apiKey !== 'string' ||\n auth.apiKey.trim() === ''\n ) {\n throw new LlmError('@gullabs/google requires auth.apiKey', {\n kind: 'invalid_auth',\n retryable: false,\n provider: 'google',\n })\n }\n return auth.apiKey\n}\n\n// ---------------------------------------------------------------------------\n// Transport timeout defaults\n// ---------------------------------------------------------------------------\n\n/**\n * Default HTTP transport timeout for Gemini Flex service-tier calls (ms).\n *\n * The default per-attempt transport (httpOptions) timeout applied ONLY when a\n * flex call provides no explicit `timeoutMs`. Set to 25 minutes (1_500_000 ms)\n * to cover the ~20-minute flex workload ceiling with margin. The @google/genai\n * SDK defaults to 1 minute, which would terminate a long flex call prematurely.\n * Callers SHOULD still set `timeoutMs` for a precise per-attempt ceiling; this\n * value is only the backstop for callers that do not.\n */\nexport const FLEX_DEFAULT_TIMEOUT_MS = 1_500_000\n\n/**\n * Default HTTP transport timeout for Gemini standard-tier calls (ms).\n *\n * Used when a standard-tier request has no explicit `timeoutMs`. The adapter\n * also backs this with an AbortController so the limit is a real client-side\n * ceiling, not only an SDK transport hint.\n */\nexport const STANDARD_DEFAULT_TIMEOUT_MS = 300_000\n\n/**\n * Buffer added above `timeoutMs` when setting the SDK transport timeout.\n *\n * When `timeoutMs` is set, the engine arms an AbortSignal at exactly\n * `timeoutMs`. If the SDK transport timer fired at the same instant it\n * could preempt the signal and produce a raw SDK error instead of the\n * engine's clean `kind:'timeout'`. By setting the transport timeout to\n * `timeoutMs + TRANSPORT_TIMEOUT_BUFFER_MS` we ensure the engine's\n * AbortSignal always fires first.\n */\nexport const TRANSPORT_TIMEOUT_BUFFER_MS = 5_000\n\n// ---------------------------------------------------------------------------\n// Response shape — mirrors the @google/genai surface we actually consume\n// ---------------------------------------------------------------------------\n\n/** A single text/thought part in a Gemini candidate content. */\nexport interface GeminiPartShape {\n text?: string\n /**\n * Present and `true` on thought-summary parts.\n * Real field name in @google/genai Candidate.content.parts: `thought`.\n */\n thought?: boolean\n functionCall?: { id?: string; name?: string; args?: unknown }\n}\n\n/** A candidate returned by Gemini generateContent. */\nexport interface GeminiCandidateShape {\n content?: {\n parts?: GeminiPartShape[]\n }\n /**\n * Why the model stopped.\n * Real SDK enum (FinishReason): \"STOP\", \"MAX_TOKENS\", \"SAFETY\",\n * \"RECITATION\", \"BLOCKLIST\", \"PROHIBITED_CONTENT\", etc.\n */\n finishReason?: string\n /**\n * Grounding metadata returned when Google Search grounding is active.\n * Real SDK type: GroundingMetadata. Kept as `unknown` to avoid a hard\n * coupling to @google/genai types; cast to JsonValue at the adapter boundary.\n */\n groundingMetadata?: unknown\n}\n\n/**\n * Token usage metadata returned alongside a Gemini response.\n *\n * Real type: GenerateContentResponseUsageMetadata.\n * NOTE: thoughtsTokenCount is SEPARATE from candidatesTokenCount.\n * The adapter must add them to get GROSS outputTokens.\n */\nexport interface GeminiUsageMetadataShape {\n promptTokenCount?: number\n candidatesTokenCount?: number\n cachedContentTokenCount?: number\n thoughtsTokenCount?: number\n totalTokenCount?: number\n /** Provider-echoed actual tier; can differ from the requested tier. */\n serviceTier?: string\n}\n\n/**\n * Structural equivalent of @google/genai's GenerateContentResponse.\n * Only the fields the adapter reads are represented here.\n */\nexport interface GeminiResponseShape {\n candidates?: GeminiCandidateShape[]\n usageMetadata?: GeminiUsageMetadataShape\n /** Real field: GenerateContentResponse.modelVersion */\n modelVersion?: string\n /** Real field: GenerateContentResponse.responseId */\n responseId?: string\n /**\n * Safety-block metadata.\n * Real type: GenerateContentResponsePromptFeedback.\n * Present when the prompt (not output) was blocked by safety filters.\n */\n promptFeedback?: {\n /** Real type: BlockedReason (string enum). e.g. \"SAFETY\", \"OTHER\". */\n blockReason?: string\n blockReasonMessage?: string\n safetyRatings?: unknown[]\n }\n}\n\n// ---------------------------------------------------------------------------\n// Request / config shape — what the adapter sends to generateContent\n// ---------------------------------------------------------------------------\n\n/**\n * Per-part media-resolution hint emitted on inline/file parts.\n * Real type: @google/genai `PartMediaResolution`; `level` values come from\n * the `PartMediaResolutionLevel` string enum (we only emit the LOW/MEDIUM/HIGH\n * subset our normalized `mediaResolution` maps to).\n */\nexport interface GeminiPartMediaResolution {\n level?: 'MEDIA_RESOLUTION_LOW' | 'MEDIA_RESOLUTION_MEDIUM' | 'MEDIA_RESOLUTION_HIGH'\n}\n\n/** A text part in a content object we construct. */\nexport interface GeminiTextContentPart {\n text: string\n}\n\n/**\n * An inline binary media part in a content object we construct.\n * `data` must be raw base64 — no `data:…;base64,` prefix.\n */\nexport interface GeminiInlineDataContentPart {\n inlineData: {\n /** IANA media type, e.g. `\"image/png\"`. */\n mimeType: string\n /** Raw base64-encoded bytes (no data-URL prefix). */\n data: string\n }\n /** Optional per-part media-resolution hint (real field: `Part.mediaResolution`). */\n mediaResolution?: GeminiPartMediaResolution\n}\n\n/**\n * A provider-hosted file reference part in a content object we construct.\n * The Gemini service dereferences `fileUri` server-side.\n */\nexport interface GeminiFileDataContentPart {\n fileData: {\n /** IANA media type of the referenced file. */\n mimeType: string\n /** Provider-assigned file URI, e.g. from the Gemini File API. */\n fileUri: string\n }\n /** Optional per-part media-resolution hint (real field: `Part.mediaResolution`). */\n mediaResolution?: GeminiPartMediaResolution\n}\n\n/**\n * Union of all part shapes the adapter may produce for `GeminiContent.parts`.\n * Each member (including the optional per-part `mediaResolution`) is a\n * structural subset of the real `@google/genai` `Part` type for the fields we use.\n */\nexport interface GeminiFunctionCallPart {\n functionCall: { id?: string; name: string; args?: unknown }\n}\n\nexport interface GeminiFunctionResponsePart {\n functionResponse: { id?: string; name: string; response: unknown }\n}\n\nexport type GeminiContentPart =\n | GeminiTextContentPart\n | GeminiInlineDataContentPart\n | GeminiFileDataContentPart\n | GeminiFunctionCallPart\n | GeminiFunctionResponsePart\n\n/** A content object (message) we construct. */\nexport interface GeminiContent {\n role: string\n parts: GeminiContentPart[]\n}\n\n/**\n * Schema shape we pass as responseSchema.\n * Structurally compatible with @google/genai Schema.\n */\nexport interface GeminiSchema {\n type?: string\n description?: string\n properties?: Record<string, GeminiSchema>\n required?: string[]\n items?: GeminiSchema\n enum?: string[]\n nullable?: boolean\n format?: string\n}\n\n/**\n * Thinking configuration.\n * Real type: ThinkingConfig in @google/genai.\n * - thinkingBudget: 0 = DISABLED, -1 = AUTOMATIC\n * - thinkingLevel: ThinkingLevel enum (\"LOW\", \"MEDIUM\", \"HIGH\", \"MINIMAL\")\n */\nexport interface GeminiThinkingConfig {\n includeThoughts?: boolean\n thinkingBudget?: number\n /**\n * Real type: ThinkingLevel enum.\n * Values: \"LOW\" | \"MEDIUM\" | \"HIGH\" | \"MINIMAL\" | \"THINKING_LEVEL_UNSPECIFIED\"\n */\n thinkingLevel?: string\n}\n\n/**\n * Config object passed in GenerateContentParameters.config.\n * Real type: GenerateContentConfig.\n * abortSignal is inside config, NOT in the top-level params.\n */\nexport interface GeminiGenerateConfig {\n systemInstruction?: { parts: GeminiContentPart[] }\n temperature?: number\n topP?: number\n topK?: number\n maxOutputTokens?: number\n stopSequences?: string[]\n responseMimeType?: string\n responseSchema?: GeminiSchema\n thinkingConfig?: GeminiThinkingConfig\n /** Real type: ServiceTier enum. Values: \"flex\" | \"standard\". */\n serviceTier?: string\n /** Real field: GenerateContentConfig.abortSignal (NOT in top-level params). */\n abortSignal?: AbortSignal\n /**\n * Per-request HTTP options forwarded to the @google/genai transport.\n * We use this to set a transport-level timeout that is >= the AbortSignal\n * deadline so the SDK fetch does not preempt the abort.\n *\n * Real field: GenerateContentConfig.httpOptions.timeout (milliseconds).\n * Real field: GenerateContentConfig.httpOptions.headers (Record<string,string>).\n * (No current use of custom headers here: Vertex AI auth — and the\n * Vertex flex-routing header injection this field once supported — was\n * removed from this library; see ADR-019 in DECISIONS.md. Only\n * API-key auth is supported below.)\n */\n httpOptions?: { timeout?: number; headers?: Record<string, string> }\n tools?: Array<{\n functionDeclarations?: Array<{\n name: string\n description: string\n parameters?: unknown\n }>\n googleSearch?: Record<string, never>\n }>\n toolConfig?: {\n functionCallingConfig?: {\n mode?: 'AUTO' | 'ANY' | 'NONE'\n allowedFunctionNames?: string[]\n }\n }\n}\n\n/**\n * Parameters for models.generateContent.\n * Real type: GenerateContentParameters.\n */\nexport interface GeminiGenerateParams {\n model: string\n contents: GeminiContent[]\n config?: GeminiGenerateConfig\n}\n\n/**\n * Parameters for models.countTokens.\n * Real type: CountTokensParameters.\n */\nexport interface GeminiCountTokensParams {\n model: string\n contents: GeminiContent[]\n config?: {\n systemInstruction?: { parts: GeminiContentPart[] }\n /**\n * Real field: CountTokensConfig.abortSignal. countTokens has no\n * tier-timeout dance (no flex/standard default ceilings) — `ctx.signal`\n * is forwarded here directly, unlike `run()`'s combined timer signal.\n */\n abortSignal?: AbortSignal\n tools?: GeminiGenerateConfig['tools']\n }\n}\n\n/**\n * Response shape for models.countTokens.\n * Real type: CountTokensResponse.\n */\nexport interface GeminiCountTokensResponseShape {\n totalTokens?: number\n cachedContentTokenCount?: number\n}\n\n// ---------------------------------------------------------------------------\n// GeminiClientLike — structural interface (no @google/genai dependency)\n// ---------------------------------------------------------------------------\n\n/**\n * Structural interface for the @google/genai client surface the adapter uses.\n *\n * Satisfied by:\n * - The real GoogleGenAI client (via buildGoogleClient wrapper).\n * - FakeGeminiClient from @gullabs/testing (its generateContent/countTokens\n * accept unknown).\n */\nexport interface GeminiClientLike {\n models: {\n generateContent(params: GeminiGenerateParams): Promise<GeminiResponseShape>\n countTokens(params: GeminiCountTokensParams): Promise<GeminiCountTokensResponseShape>\n }\n}\n\n// ---------------------------------------------------------------------------\n// buildGoogleClient — imports the real @google/genai SDK\n// ---------------------------------------------------------------------------\n\n/**\n * Build a real @google/genai client from AuthMaterial.\n *\n * Returns a GeminiClientLike wrapper around the real GoogleGenAI client.\n * Only API-key authentication is supported; Vertex AI is not.\n *\n * @param auth - API key credentials ({ apiKey }).\n */\nexport async function buildGoogleClient(auth: AuthMaterial): Promise<GeminiClientLike> {\n // Import the real SDK — only called at runtime when no client is injected.\n // The cast is safe: GeminiGenerateParams is a structural subset of\n // GenerateContentParameters; GeminiResponseShape is a subset of\n // GenerateContentResponse.\n const { GoogleGenAI } = await import('@google/genai')\n\n const ai = new GoogleGenAI({ apiKey: requireApiKey(auth) })\n\n return {\n models: {\n async generateContent(params: GeminiGenerateParams): Promise<GeminiResponseShape> {\n // Cast needed: our structural types are subsets of the real SDK types.\n const result = await (\n ai.models.generateContent as (params: unknown) => Promise<GeminiResponseShape>\n )(params)\n return result\n },\n async countTokens(\n params: GeminiCountTokensParams,\n ): Promise<GeminiCountTokensResponseShape> {\n // Cast needed: our structural types are subsets of the real SDK types.\n const result = await (\n ai.models.countTokens as (\n params: unknown,\n ) => Promise<GeminiCountTokensResponseShape>\n )(params)\n return result\n },\n },\n }\n}\n","import type { ReasoningEffort } from '@gullabs/core'\n\nexport const GOOGLE_REASONING_EFFORT_BUDGET: Record<\n Exclude<ReasoningEffort, 'xhigh' | 'max'>,\n number\n> = {\n none: 0,\n low: 1024,\n medium: 8192,\n high: 24576,\n}\n","/**\n * normalizeGroundingCitations — shape Gemini's raw groundingMetadata.groundingChunks\n * into a clean, deduplicated citation list.\n *\n * This is a caller-owned, optional post-processing convenience helper — NOT\n * request validation. It NEVER throws: any missing/malformed input yields `[]`.\n *\n * @module\n */\n\nimport type { Citation } from '@gullabs/core'\n\n/**\n * Derive a human-readable source name for a hostname, stripping a leading\n * `www.` label (e.g. `www.example.com` → `example.com`).\n */\nfunction hostnameFrom(url: URL): string {\n return url.hostname.startsWith('www.') ? url.hostname.slice(4) : url.hostname\n}\n\n/**\n * Shape a single grounding chunk into a `Citation`, or `undefined` if the\n * chunk is malformed (missing/invalid `web.uri`, or a `web.uri` that isn't\n * a well-formed http(s) URL with a hostname).\n *\n * Real SDK shape (`@google/genai` `GroundingChunk.web`): `{ uri, title, domain }`,\n * which in practice is always an http(s) URL. This helper only ever produces\n * http(s) citations — any other scheme (`javascript:`, `mailto:`, `data:`,\n * `file:`, etc.) is treated as a malformed chunk and skipped, since callers\n * may render `Citation.url` as a clickable link.\n *\n * `title`, when present, is the human-readable page title and is preferred\n * over the hostname as `sourceName`; the hostname (parsed from `uri`) is the\n * robust fallback when `title` is absent.\n */\nfunction toCitation(chunk: unknown): Citation | undefined {\n if (chunk === null || typeof chunk !== 'object') return undefined\n\n const web = (chunk as Record<string, unknown>)['web']\n if (web === null || typeof web !== 'object') return undefined\n\n const uri = (web as Record<string, unknown>)['uri']\n if (typeof uri !== 'string' || uri.length === 0) return undefined\n\n let parsed: URL\n try {\n parsed = new URL(uri)\n } catch {\n return undefined\n }\n\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return undefined\n if (parsed.hostname === '') return undefined\n\n const title = (web as Record<string, unknown>)['title']\n const hasTitle = typeof title === 'string' && title.length > 0\n const sourceName = hasTitle ? title : hostnameFrom(parsed)\n\n return {\n url: uri,\n ...(hasTitle ? { title } : {}),\n sourceName,\n }\n}\n\n/**\n * Shape Gemini's raw `groundingMetadata.groundingChunks` into a clean,\n * deduplicated citation list (deduplicated by URL, first-seen order).\n *\n * Accepts `unknown` since `groundingMetadata` arrives as raw JSON on\n * `providerMetadata` (see `docs/grounded-structured.md`). Never throws —\n * any missing/malformed top-level shape returns `[]`; a malformed individual\n * chunk is skipped rather than failing the whole array.\n */\nexport function normalizeGroundingCitations(groundingMetadata: unknown): Citation[] {\n if (groundingMetadata === null || typeof groundingMetadata !== 'object') return []\n\n const chunks = (groundingMetadata as Record<string, unknown>)['groundingChunks']\n if (!Array.isArray(chunks)) return []\n\n const seen = new Set<string>()\n const citations: Citation[] = []\n\n for (const chunk of chunks) {\n const citation = toCitation(chunk)\n if (citation === undefined) continue\n if (seen.has(citation.url)) continue\n seen.add(citation.url)\n citations.push(citation)\n }\n\n return citations\n}\n","/**\n * Unique Gemini toolCallId allocation.\n *\n * Provider-supplied functionCall / functionResponse ids are reserved first so\n * fallbacks of the form `call_${name}_${n}` never collide with them — even\n * when the provider id appears after an id-less sibling.\n */\n\n/** Collects non-empty provider-supplied ids so fallbacks skip them. */\nexport function reserveProviderToolCallIds(\n ids: Iterable<string | undefined>,\n): Set<string> {\n const reserved = new Set<string>()\n for (const id of ids) {\n if (typeof id === 'string' && id.length > 0) reserved.add(id)\n }\n return reserved\n}\n\n/**\n * Next `call_${toolName}_${n}` that is not in `reserved`.\n *\n * `counterKey` lets functionCall vs functionResponse keep independent\n * sequences so two id-less pairs of the same name still line up.\n */\nexport function nextFallbackToolCallId(\n toolName: string,\n counters: Map<string, number>,\n reserved: Set<string>,\n counterKey: string = toolName,\n): string {\n let n = counters.get(counterKey) ?? 0\n let id: string\n do {\n n += 1\n id = `call_${toolName}_${n}`\n } while (reserved.has(id))\n counters.set(counterKey, n)\n return id\n}\n\nexport function resolveToolCallId(\n providerId: string | undefined,\n toolName: string,\n counters: Map<string, number>,\n reserved: Set<string>,\n counterKey?: string,\n): string {\n if (typeof providerId === 'string' && providerId.length > 0) {\n return providerId\n }\n return nextFallbackToolCallId(toolName, counters, reserved, counterKey ?? toolName)\n}\n","import type { LlmError } from '@gullabs/core'\n\nconst CAPACITY_PATTERNS = [\n /capacity/i,\n /overload/i,\n /overloaded/i,\n /unavailable/i,\n /no\\s+capacity/i,\n /temporar(?:y|ily)/i,\n /try\\s+again/i,\n]\n\nconst QUOTA_PATTERNS = [\n /quota/i,\n /billing/i,\n /billable/i,\n /payment/i,\n /rate\\s+limit/i,\n /exceeded/i,\n /insufficient/i,\n]\n\nexport function isGeminiCapacityError(err: LlmError): boolean {\n if (err.kind === 'server') return err.httpStatus === 503\n if (err.kind !== 'rate_limited') return false\n\n const message = err.message\n if (QUOTA_PATTERNS.some((pattern) => pattern.test(message))) {\n return false\n }\n return CAPACITY_PATTERNS.some((pattern) => pattern.test(message))\n}\n","/**\n * classifyGoogleError — reclassify a raw thrown value into a typed\n * {@link LlmError} for @gullabs/google.\n *\n * Thin wrapper around `@gullabs/core`'s `classifyError`: applies the shared\n * HTTP-status/timeout/abort classification, tags `provider: 'google'`, and\n * widens the retryable bucket to cover connection-level transport failures\n * that never produced an HTTP response for `classifyError` to route by\n * status.\n *\n * `@google/genai`'s underlying `fetch` (undici, in Node) throws a plain\n * `TypeError: fetch failed` for DNS failures, connection refusals, and\n * severed sockets — wrapping the underlying errno error as `.cause`.\n * `classifyError` has no HTTP status to classify these by, so they\n * previously fell through to `kind: 'unknown', retryable: false`, which\n * Temporal treats as non-retryable and uses to kill the host run outright\n * instead of retrying a transient network blip (live-observed 2026-07-10).\n *\n * These are reclassified `kind: 'server', retryable: true` — the same\n * \"provider fault, not caller fault, safe to retry\" bucket already used\n * elsewhere in this adapter for provider-side failures with no HTTP status\n * (see the malformed-`countTokens`-response case in `adapter.ts`).\n *\n * @module\n */\n\nimport { LlmError, classifyError } from '@gullabs/core'\n\n/**\n * Message/errno signatures of a transport-level failure: the request never\n * reached Google's servers (or the connection was severed mid-flight), so\n * there is no HTTP response for `classifyHttpStatus` to route by status.\n * Covers undici's own default message (`\"fetch failed\"`) plus the\n * Node/undici errno codes that surface when the underlying socket fails\n * before a response arrives.\n */\nconst GOOGLE_TRANSPORT_ERROR_PATTERN =\n /fetch failed|connection error|econnreset|econnrefused|etimedout|eai_again|epipe|socket hang up/i\n\n/** True iff `err.message` or `err.code` matches a known transport-failure signature. */\nfunction matchesGoogleTransportSignature(err: unknown): boolean {\n if (!(err instanceof Error)) return false\n if (GOOGLE_TRANSPORT_ERROR_PATTERN.test(err.message)) return true\n const code = (err as { code?: unknown }).code\n return typeof code === 'string' && GOOGLE_TRANSPORT_ERROR_PATTERN.test(code)\n}\n\n/**\n * True iff `rawErr` is (or wraps) a transport-level connection failure.\n *\n * Detection order:\n * 1. `rawErr.message` / `rawErr.code` matches a known transport-failure\n * signature.\n * 2. A wrapped `rawErr.cause` matches the same — undici's `fetch failed`\n * `TypeError` attaches the underlying socket/DNS errno error as\n * `.cause`.\n */\nfunction isGoogleTransportError(rawErr: unknown): boolean {\n if (matchesGoogleTransportSignature(rawErr)) return true\n if (rawErr instanceof Error) {\n const cause = (rawErr as { cause?: unknown }).cause\n if (matchesGoogleTransportSignature(cause)) return true\n }\n return false\n}\n\n/** The SDK serializes structured Gemini API errors into ApiError.message. */\nfunction isGoogleModelNotFound(rawErr: unknown): boolean {\n if (!(rawErr instanceof Error)) return false\n if ((rawErr as Error & { status?: unknown }).status !== 404) return false\n try {\n const parsed = JSON.parse(rawErr.message) as {\n error?: { code?: unknown; status?: unknown }\n }\n return parsed.error?.code === 404 && parsed.error.status === 'NOT_FOUND'\n } catch {\n return false\n }\n}\n\n/** Optional extra fields threaded onto the returned {@link LlmError}. */\nexport interface ClassifyGoogleErrorExtra {\n /** Service tier actually attempted by the provider when known. */\n servedServiceTier?: string\n}\n\n/**\n * Classify a raw error thrown from a `@google/genai` client call into a\n * typed {@link LlmError} always tagged `provider: 'google'`.\n *\n * Delegates to `@gullabs/core`'s `classifyError` for HTTP-status/timeout/\n * abort classification (an already-classified `LlmError` passes through\n * `classifyError` unchanged, per its own contract), then rebuilds the\n * result with `provider: 'google'` forced on — every error surfaced by this\n * adapter is tagged, even one injected pre-classified (e.g. by a test\n * double) without a provider of its own. It also reclassifies the\n * `kind: 'unknown'` fallback as `kind: 'server', retryable: true` when the\n * raw error matches a known transport-failure signature (see\n * {@link isGoogleTransportError}). A connection that never reached Google is\n * not the caller's fault and is safe to retry; it must never be surfaced as\n * the non-retryable `unknown` kind.\n */\nexport function classifyGoogleError(\n rawErr: unknown,\n extra?: ClassifyGoogleErrorExtra,\n): LlmError {\n const base = classifyError(rawErr)\n const reclassifyAsTransport = base.kind === 'unknown' && isGoogleTransportError(rawErr)\n const reclassifyAsBadRequest = base.kind === 'unknown' && isGoogleModelNotFound(rawErr)\n\n return new LlmError(base.message, {\n kind: reclassifyAsTransport\n ? 'server'\n : reclassifyAsBadRequest\n ? 'bad_request'\n : base.kind,\n retryable: reclassifyAsTransport ? true : base.retryable,\n ...(base.httpStatus !== undefined ? { httpStatus: base.httpStatus } : {}),\n ...(base.retryAfterMs !== undefined ? { retryAfterMs: base.retryAfterMs } : {}),\n provider: 'google',\n cause: base.cause ?? rawErr,\n ...(extra?.servedServiceTier !== undefined\n ? { servedServiceTier: extra.servedServiceTier }\n : {}),\n })\n}\n","/**\n * geminiAdapter — @gullabs/google Gemini provider adapter.\n *\n * Pure request⇄response mapping over @google/genai (via GeminiClientLike).\n * Never persists, never computes cost, never loops.\n *\n * @module\n */\n\nimport { LlmError, assertNever } from '@gullabs/core'\nimport type {\n ProviderAdapter,\n ResolvedRequest,\n AdapterCtx,\n AdapterResult,\n Usage,\n Warning,\n FinishReason,\n JsonValue,\n AuthMaterial,\n Part,\n Message,\n TokenCountRequest,\n TokenCount,\n ToolChoice,\n} from '@gullabs/core'\nimport {\n buildGoogleClient,\n FLEX_DEFAULT_TIMEOUT_MS,\n STANDARD_DEFAULT_TIMEOUT_MS,\n TRANSPORT_TIMEOUT_BUFFER_MS,\n} from './client.js'\nimport { GOOGLE_REASONING_EFFORT_BUDGET } from './reasoning-budget.js'\nimport { normalizeGroundingCitations } from './grounding.js'\nimport { reserveProviderToolCallIds, resolveToolCallId } from './tool-call-id.js'\nimport type {\n GeminiClientLike,\n GeminiGenerateConfig,\n GeminiContent,\n GeminiContentPart,\n GeminiResponseShape,\n GeminiUsageMetadataShape,\n GeminiCountTokensParams,\n} from './client.js'\nimport { isGeminiCapacityError } from './flex-fallback.js'\nimport { classifyGoogleError } from './errors.js'\n\ntype GeminiGoogleSearchTool = { googleSearch: Record<string, never> }\n\ntype GeminiAllowedTool = GeminiGoogleSearchTool\n\ntype GeminiSafetySetting = {\n category: string\n threshold: string\n}\n\ntype GeminiDispatchConfig = GeminiGenerateConfig & {\n cachedContent?: string\n httpOptions?: { timeout?: number }\n safetySettings?: GeminiSafetySetting[]\n tools?: GeminiGenerateConfig['tools']\n}\n\nconst ALLOWED_GOOGLE_PROVIDER_OPTION_KEYS = new Set([\n 'cachedContent',\n 'flexFallback',\n 'httpOptions',\n 'safetySettings',\n 'tools',\n])\n\nconst ALLOWED_GOOGLE_HTTP_OPTION_KEYS = new Set(['timeout'])\n\nconst RESERVED_GOOGLE_PROVIDER_OPTION_KEYS = new Set([\n 'abortSignal',\n 'imageConfig',\n 'maxOutputTokens',\n 'mediaResolution',\n 'responseFormat',\n 'responseMimeType',\n 'responseModalities',\n 'responseSchema',\n 'responseJsonSchema',\n 'serviceTier',\n 'speechConfig',\n 'stopSequences',\n 'temperature',\n 'thinkingConfig',\n 'topK',\n 'topP',\n '_responseJsonSchema',\n])\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction isEmptyPlainObject(value: unknown): value is Record<string, never> {\n return isPlainRecord(value) && Object.keys(value).length === 0\n}\n\nfunction badGoogleProviderOptions(message: string): LlmError {\n return new LlmError(message, { kind: 'bad_request', retryable: false })\n}\n\nfunction parseGoogleTool(tool: unknown, model: string): GeminiAllowedTool {\n if (!isPlainRecord(tool)) {\n throw badGoogleProviderOptions(\n `providerOptions.google.tools entries must be objects for model \"${model}\".`,\n )\n }\n\n const keys = Object.keys(tool)\n if (keys.length !== 1) {\n throw badGoogleProviderOptions(\n `providerOptions.google.tools entries must have exactly one supported tool key for model \"${model}\".`,\n )\n }\n\n const key = keys[0]\n switch (key) {\n case 'googleSearch': {\n if (!isEmptyPlainObject(tool['googleSearch'])) {\n throw badGoogleProviderOptions(\n `providerOptions.google.tools[].googleSearch must be an empty object for model \"${model}\".`,\n )\n }\n return { googleSearch: {} }\n }\n\n default:\n throw badGoogleProviderOptions(\n `providerOptions.google.tools[].${key} is not supported for model \"${model}\".`,\n )\n }\n}\n\nfunction parseGoogleSafetySetting(\n setting: unknown,\n index: number,\n model: string,\n): GeminiSafetySetting {\n if (!isPlainRecord(setting)) {\n throw badGoogleProviderOptions(\n `providerOptions.google.safetySettings[${index}] must be an object for model \"${model}\".`,\n )\n }\n\n const keys = Object.keys(setting)\n const unknownKeys = keys.filter((key) => key !== 'category' && key !== 'threshold')\n if (unknownKeys.length > 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google.safetySettings[${index}] contains unsupported keys [${unknownKeys.join(\n ', ',\n )}] for model \"${model}\". Allowed keys: category, threshold.`,\n )\n }\n\n if (typeof setting['category'] !== 'string' || setting['category'].length === 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google.safetySettings[${index}].category must be a non-empty string for model \"${model}\".`,\n )\n }\n\n if (typeof setting['threshold'] !== 'string' || setting['threshold'].length === 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google.safetySettings[${index}].threshold must be a non-empty string for model \"${model}\".`,\n )\n }\n\n return {\n category: setting['category'],\n threshold: setting['threshold'],\n }\n}\n\nfunction mapGoogleProviderOptions({\n googleOpts,\n model,\n structuredOutputRequested,\n descriptorGrounding,\n structuredOutputWithTools,\n}: {\n googleOpts: unknown\n model: string\n structuredOutputRequested: boolean\n descriptorGrounding: boolean | undefined\n structuredOutputWithTools: boolean | undefined\n}): Partial<GeminiDispatchConfig> & { flexFallback?: boolean } {\n if (googleOpts === undefined) {\n return {}\n }\n\n if (!isPlainRecord(googleOpts)) {\n throw badGoogleProviderOptions(\n `providerOptions.google must be an object for model \"${model}\".`,\n )\n }\n\n const reservedKeys = Object.keys(googleOpts).filter((key) =>\n RESERVED_GOOGLE_PROVIDER_OPTION_KEYS.has(key),\n )\n if (reservedKeys.length > 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google reserves keys [${reservedKeys.join(\n ', ',\n )}] for typed model config on \"${model}\".`,\n )\n }\n\n const unknownKeys = Object.keys(googleOpts).filter(\n (key) =>\n !ALLOWED_GOOGLE_PROVIDER_OPTION_KEYS.has(key) &&\n !RESERVED_GOOGLE_PROVIDER_OPTION_KEYS.has(key),\n )\n if (unknownKeys.length > 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google contains unsupported keys [${unknownKeys.join(\n ', ',\n )}] for model \"${model}\". Allowed keys: cachedContent, flexFallback, httpOptions, safetySettings, tools.`,\n )\n }\n\n const mapped: Partial<GeminiDispatchConfig> & { flexFallback?: boolean } = {}\n\n if (googleOpts['cachedContent'] !== undefined) {\n if (\n typeof googleOpts['cachedContent'] !== 'string' ||\n googleOpts['cachedContent'].length === 0\n ) {\n throw badGoogleProviderOptions(\n `providerOptions.google.cachedContent must be a non-empty string for model \"${model}\".`,\n )\n }\n mapped.cachedContent = googleOpts['cachedContent']\n }\n\n if (googleOpts['flexFallback'] !== undefined) {\n if (typeof googleOpts['flexFallback'] !== 'boolean') {\n throw badGoogleProviderOptions(\n `providerOptions.google.flexFallback must be a boolean for model \"${model}\".`,\n )\n }\n mapped.flexFallback = googleOpts['flexFallback']\n }\n\n if (googleOpts['httpOptions'] !== undefined) {\n if (!isPlainRecord(googleOpts['httpOptions'])) {\n throw badGoogleProviderOptions(\n `providerOptions.google.httpOptions must be an object for model \"${model}\".`,\n )\n }\n\n const unknownHttpOptionKeys = Object.keys(googleOpts['httpOptions']).filter(\n (key) => !ALLOWED_GOOGLE_HTTP_OPTION_KEYS.has(key),\n )\n if (unknownHttpOptionKeys.length > 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google.httpOptions contains unsupported keys [${unknownHttpOptionKeys.join(\n ', ',\n )}] for model \"${model}\". Allowed keys: timeout.`,\n )\n }\n\n const timeout = googleOpts['httpOptions']['timeout']\n if (timeout !== undefined) {\n if (typeof timeout !== 'number' || !Number.isInteger(timeout) || timeout <= 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google.httpOptions.timeout must be a positive integer for model \"${model}\".`,\n )\n }\n mapped.httpOptions = { timeout }\n } else {\n mapped.httpOptions = {}\n }\n }\n\n if (googleOpts['safetySettings'] !== undefined) {\n if (!Array.isArray(googleOpts['safetySettings'])) {\n throw badGoogleProviderOptions(\n `providerOptions.google.safetySettings must be an array for model \"${model}\".`,\n )\n }\n\n mapped.safetySettings = googleOpts['safetySettings'].map((setting, index) =>\n parseGoogleSafetySetting(setting, index, model),\n )\n }\n\n if (googleOpts['tools'] !== undefined) {\n if (!Array.isArray(googleOpts['tools'])) {\n throw badGoogleProviderOptions(\n `providerOptions.google.tools must be an array for model \"${model}\".`,\n )\n }\n\n const tools = googleOpts['tools'].map((tool) => parseGoogleTool(tool, model))\n if (descriptorGrounding !== true) {\n throw badGoogleProviderOptions(\n `providerOptions.google.tools is not supported for model \"${model}\".`,\n )\n }\n\n if (structuredOutputRequested && structuredOutputWithTools !== true) {\n throw badGoogleProviderOptions(\n `Structured output with googleSearch is not supported for model \"${model}\".`,\n )\n }\n\n mapped.tools = tools\n }\n\n return mapped\n}\n\nfunction assertSamplingAllowed(\n config: GeminiDispatchConfig,\n model: string,\n sampling: string | undefined,\n): void {\n if (sampling !== 'fixed') {\n return\n }\n\n const offendingSampling: string[] = []\n if ('temperature' in config) {\n offendingSampling.push('temperature')\n }\n if ('topP' in config) {\n offendingSampling.push('topP')\n }\n if ('topK' in config) {\n offendingSampling.push('topK')\n }\n\n if (offendingSampling.length > 0) {\n throw new LlmError(\n `Sampling parameters [${offendingSampling.join(', ')}] are not supported for model \"${model}\" (fixed sampling).`,\n { kind: 'bad_request', retryable: false },\n )\n }\n}\n\n// ---------------------------------------------------------------------------\n// Exported types for consumers that inject a custom client\n// ---------------------------------------------------------------------------\nexport type { GeminiClientLike }\n\n// ---------------------------------------------------------------------------\n// FinishReason mapping (Gemini SDK enum → our FinishReason)\n// ---------------------------------------------------------------------------\n\nfunction mapFinishReason(raw: string | undefined): FinishReason | undefined {\n if (raw === undefined) return undefined\n switch (raw) {\n case 'STOP':\n return 'stop'\n case 'MAX_TOKENS':\n return 'length'\n case 'SAFETY':\n case 'RECITATION':\n case 'BLOCKLIST':\n case 'PROHIBITED_CONTENT':\n case 'IMAGE_SAFETY':\n return 'content_filter'\n default:\n return 'other'\n }\n}\n\n// ---------------------------------------------------------------------------\n// mediaResolution mapping (normalized hint → Gemini PartMediaResolutionLevel)\n// ---------------------------------------------------------------------------\n\n/**\n * Map our normalized cross-provider `mediaResolution` hint to the Gemini\n * `PartMediaResolutionLevel` string-enum value emitted on `Part.mediaResolution`.\n */\nfunction mapMediaResolution(\n res: 'low' | 'medium' | 'high',\n): 'MEDIA_RESOLUTION_LOW' | 'MEDIA_RESOLUTION_MEDIUM' | 'MEDIA_RESOLUTION_HIGH' {\n switch (res) {\n case 'low':\n return 'MEDIA_RESOLUTION_LOW'\n case 'medium':\n return 'MEDIA_RESOLUTION_MEDIUM'\n case 'high':\n return 'MEDIA_RESOLUTION_HIGH'\n default:\n return assertNever(res)\n }\n}\n\n// ---------------------------------------------------------------------------\n// Usage mapping — #1 correctness rule\n// ---------------------------------------------------------------------------\n\n/**\n * Map Gemini usageMetadata to our Usage type.\n *\n * **GROSS convention enforced here:**\n * - outputTokens = candidatesTokenCount + (thoughtsTokenCount ?? 0)\n * → thinkingTokens ⊆ outputTokens so cost math doesn't double-count.\n * - inputTokens = promptTokenCount (cachedContentTokenCount is already a\n * subset of promptTokenCount → cachedInputTokens = cachedContentTokenCount).\n */\nfunction mapUsage(meta: GeminiUsageMetadataShape | undefined): Usage {\n const promptTokenCount = meta?.promptTokenCount ?? 0\n const candidatesTokenCount = meta?.candidatesTokenCount ?? 0\n const cachedContentTokenCount = meta?.cachedContentTokenCount\n const thoughtsTokenCount = meta?.thoughtsTokenCount\n\n // #1 RULE: outputTokens = candidates + thoughts (GROSS; thinking ⊆ output)\n const outputTokens = candidatesTokenCount + (thoughtsTokenCount ?? 0)\n const inputTokens = promptTokenCount\n const totalTokens = meta?.totalTokenCount\n\n // Canonical details keys: input, cached, output.\n const details: Record<string, number> = {\n input: inputTokens,\n output: outputTokens,\n ...(cachedContentTokenCount !== undefined ? { cached: cachedContentTokenCount } : {}),\n ...(thoughtsTokenCount !== undefined ? { thinking: thoughtsTokenCount } : {}),\n }\n\n // Raw: the full usageMetadata object verbatim (as JsonValue).\n const raw: JsonValue =\n meta !== undefined ? (meta as unknown as { [k: string]: JsonValue }) : null\n\n const usage: Usage = {\n inputTokens,\n outputTokens,\n details,\n raw,\n ...(cachedContentTokenCount !== undefined\n ? { cachedInputTokens: cachedContentTokenCount }\n : {}),\n ...(thoughtsTokenCount !== undefined ? { thinkingTokens: thoughtsTokenCount } : {}),\n ...(totalTokens !== undefined ? { totalTokens } : {}),\n }\n\n return usage\n}\n\n// ---------------------------------------------------------------------------\n// Message → Gemini contents mapping (shared by run() and countTokens())\n// ---------------------------------------------------------------------------\n\n/**\n * Map a single {@link Part} to its Gemini SDK equivalent.\n *\n * - `text` → `{ text }`\n * - `inline-media` → `{ inlineData: { mimeType, data } }` + optional `mediaResolution`\n * - `file-uri` → `{ fileData: { mimeType, fileUri } }` + optional `mediaResolution`\n * - `file-ref` → rejected (`bad_request`) — Gemini Files uses URIs, not bare ids\n *\n * `mediaResolution` IS supported as a per-part field by the Gemini SDK\n * (`Part.mediaResolution`). The normalised value is mapped to the\n * `PartMediaResolutionLevel` string enum before emission.\n */\nfunction mapGoogleToolChoice(choice: ToolChoice): {\n mode: 'AUTO' | 'ANY' | 'NONE'\n allowedFunctionNames?: string[]\n} {\n if (choice === 'auto') return { mode: 'AUTO' }\n if (choice === 'required') return { mode: 'ANY' }\n if (choice === 'none') return { mode: 'NONE' }\n return { mode: 'ANY', allowedFunctionNames: [choice.name] }\n}\n\nfunction mapPart(p: Part): GeminiContentPart {\n switch (p.kind) {\n case 'text':\n return { text: p.text }\n\n case 'inline-media': {\n return {\n inlineData: {\n mimeType: p.mimeType,\n data: p.data,\n },\n ...(p.mediaResolution !== undefined\n ? { mediaResolution: { level: mapMediaResolution(p.mediaResolution) } }\n : {}),\n }\n }\n\n case 'file-uri': {\n return {\n fileData: {\n mimeType: p.mimeType,\n fileUri: p.uri,\n },\n ...(p.mediaResolution !== undefined\n ? { mediaResolution: { level: mapMediaResolution(p.mediaResolution) } }\n : {}),\n }\n }\n\n case 'file-ref':\n throw new LlmError(\n 'Google Gemini expects FileUriPart with a Files API uri; got file-ref (provider file id). Upload via GoogleFileStore and pass the returned uri.',\n { kind: 'bad_request', retryable: false, provider: 'google' },\n )\n\n case 'tool-call':\n return {\n functionCall: {\n id: p.toolCallId,\n name: p.toolName,\n args: p.args,\n },\n }\n\n case 'tool-result':\n return {\n functionResponse: {\n id: p.toolCallId,\n name: p.toolName,\n response: p.isError === true ? { error: p.result } : p.result,\n },\n }\n\n default:\n return assertNever(p)\n }\n}\n\n/**\n * Map engine {@link Message}s to Gemini SDK `contents`.\n *\n * Shared by `run()` (generation) and `countTokens()` (token counting) so both\n * code paths map messages identically — a divergence here would make token\n * counts unrepresentative of the actual generation call.\n */\nexport function mapMessagesToGeminiContents(messages: Message[]): GeminiContent[] {\n return messages.map((msg) => ({\n role: msg.role === 'assistant' ? 'model' : 'user',\n parts: msg.parts.map(mapPart),\n }))\n}\n\n// ---------------------------------------------------------------------------\n// Adapter options\n// ---------------------------------------------------------------------------\n\nexport interface GeminiAdapterOptions {\n /**\n * Inject a pre-built client (real or fake).\n * When omitted, `buildGoogleClient` is called with `ctx.auth` at call time,\n * inside the classified try/catch so any construction failure is wrapped\n * as a typed `LlmError`.\n */\n client?: GeminiClientLike\n /**\n * @internal Testing-only.\n *\n * Override the default `buildGoogleClient` factory. Allows unit tests to\n * simulate construction failures (e.g. bad credentials) without importing\n * the real `@google/genai` SDK. Never set this in production code.\n */\n _clientFactory?: (auth: AuthMaterial) => GeminiClientLike | Promise<GeminiClientLike>\n}\n\n// ---------------------------------------------------------------------------\n// geminiAdapter factory\n// ---------------------------------------------------------------------------\n\n/**\n * Create a Gemini provider adapter.\n *\n * @param opts.client - Optional pre-built client (e.g. for testing).\n */\nexport function geminiAdapter(opts?: GeminiAdapterOptions): ProviderAdapter {\n return {\n id: 'google',\n\n async run(req: ResolvedRequest, ctx: AdapterCtx): Promise<AdapterResult> {\n if (req.provider !== 'google') {\n throw new LlmError(\n `geminiAdapter received a request for provider \"${req.provider}\", expected \"google\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n\n const warnings: Warning[] = []\n const model = req.model\n const descriptor = req.modelDescriptor\n if (descriptor?.model !== model || descriptor.provider !== 'google') {\n throw new LlmError(`No matching Google model descriptor for \"${model}\".`, {\n kind: 'bad_request',\n retryable: false,\n })\n }\n if (req.transientProviderState !== undefined) {\n throw new LlmError(`Model \"${model}\" does not admit transientProviderState.`, {\n kind: 'bad_request',\n retryable: false,\n })\n }\n\n // ------------------------------------------------------------------\n // 1. Map messages → contents\n // ------------------------------------------------------------------\n\n const contents: GeminiContent[] = mapMessagesToGeminiContents(req.messages)\n\n // ------------------------------------------------------------------\n // 2. Build GenerateContentConfig\n // ------------------------------------------------------------------\n const genConfig = req.config\n const config: GeminiDispatchConfig = {}\n\n // System instruction\n if (req.system !== undefined) {\n config.systemInstruction = { parts: [{ text: req.system }] }\n }\n\n // Basic generation parameters (only include when defined)\n if (genConfig.temperature !== undefined) {\n config.temperature = genConfig.temperature\n }\n if (genConfig.topP !== undefined) {\n config.topP = genConfig.topP\n }\n if (genConfig.topK !== undefined) {\n config.topK = genConfig.topK\n }\n if (genConfig.maxOutputTokens !== undefined) {\n config.maxOutputTokens = genConfig.maxOutputTokens\n }\n if (genConfig.stopSequences !== undefined) {\n config.stopSequences = genConfig.stopSequences\n }\n\n // Service tier (FLEX or STANDARD)\n // Real SDK: GenerateContentConfig.serviceTier = ServiceTier enum (\"flex\"|\"standard\")\n const explicit = (genConfig as { serviceTier?: 'flex' | 'standard' }).serviceTier\n const supported = descriptor.capabilities?.serviceTiers\n if (explicit !== undefined) {\n // caller explicitly chose a tier — reject if the model can't honour it\n if (supported === undefined || !supported.includes(explicit)) {\n throw new LlmError(\n `serviceTier \"${explicit}\" is not supported for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n config.serviceTier = explicit\n }\n\n // ------------------------------------------------------------------\n // 3. Reasoning → thinkingConfig\n // ------------------------------------------------------------------\n const reasoning = genConfig.reasoning\n if (reasoning !== undefined) {\n const reasoningApi = descriptor.capabilities?.reasoningApi\n\n if (reasoning.effort === 'max') {\n throw new LlmError(\n `reasoning.effort \"max\" is not supported for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n\n if (reasoning.effort !== undefined && reasoning.budgetTokens !== undefined) {\n throw new LlmError(\n `Provide either reasoning.effort or reasoning.budgetTokens, not both, for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n\n if (reasoningApi === 'budget') {\n // gemini-2.5* → thinkingBudget. `xhigh` is not a Gemini thinking\n // budget — reject rather than invent a token count.\n if (\n reasoning.effort === 'none' &&\n descriptor.capabilities?.admittedReasoningEfforts?.includes('none') !== true\n ) {\n throw new LlmError(\n `reasoning.effort \"none\" is not supported for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n if (reasoning.effort === 'xhigh') {\n throw new LlmError(\n `reasoning.effort \"xhigh\" is not supported for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n const budget =\n reasoning.budgetTokens !== undefined\n ? reasoning.budgetTokens\n : reasoning.effort !== undefined\n ? GOOGLE_REASONING_EFFORT_BUDGET[reasoning.effort]\n : undefined\n\n config.thinkingConfig = {\n ...(budget !== undefined ? { thinkingBudget: budget } : {}),\n ...(reasoning.includeThoughts === true ? { includeThoughts: true } : {}),\n }\n } else if (reasoningApi === 'level') {\n // gemini-3.* → thinkingLevel\n if (reasoning.budgetTokens !== undefined) {\n throw new LlmError(\n `reasoning.budgetTokens is not supported for model \"${model}\" (it uses thinkingLevel, not thinkingBudget); use reasoning.effort instead.`,\n { kind: 'bad_request', retryable: false },\n )\n }\n\n // Real SDK ThinkingLevel enum: \"LOW\" | \"MEDIUM\" | \"HIGH\" | \"MINIMAL\".\n // `none` maps to MINIMAL only when the descriptor admits it.\n const admitted = descriptor.capabilities?.admittedReasoningEfforts\n const admitsNone = admitted?.includes('none') === true\n let thinkingLevel: string | undefined\n if (reasoning.effort !== undefined) {\n switch (reasoning.effort) {\n case 'none':\n if (!admitsNone) {\n throw new LlmError(\n `reasoning.effort \"none\" is not supported for model \"${model}\"; thinkingLevel MINIMAL is not emitted.`,\n { kind: 'bad_request', retryable: false },\n )\n }\n thinkingLevel = 'MINIMAL'\n break\n case 'low':\n thinkingLevel = 'LOW'\n break\n case 'medium':\n thinkingLevel = 'MEDIUM'\n break\n case 'high':\n thinkingLevel = 'HIGH'\n break\n case 'xhigh':\n throw new LlmError(\n `reasoning.effort \"${reasoning.effort}\" is not supported for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n default:\n assertNever(reasoning.effort)\n }\n }\n\n config.thinkingConfig = {\n ...(thinkingLevel !== undefined ? { thinkingLevel } : {}),\n ...(reasoning.includeThoughts === true ? { includeThoughts: true } : {}),\n }\n } else {\n throw new LlmError(\n `Model \"${model}\" does not support reasoning/thinkingConfig.`,\n { kind: 'bad_request', retryable: false },\n )\n }\n }\n\n // ------------------------------------------------------------------\n // 4. Structured output → responseMimeType + responseSchema\n // ------------------------------------------------------------------\n const structuredOutputRequested = req.outputJsonSchema !== undefined\n if (structuredOutputRequested) {\n const nativeStructuredOutput =\n descriptor.capabilities?.nativeStructuredOutput !== false\n\n if (nativeStructuredOutput) {\n config.responseMimeType = 'application/json'\n config.responseSchema = req.outputJsonSchema as NonNullable<\n GeminiGenerateConfig['responseSchema']\n >\n }\n }\n\n // ------------------------------------------------------------------\n // 5. providerOptions.google → explicit allowlisted mapping\n // ------------------------------------------------------------------\n const googleProviderConfig = mapGoogleProviderOptions({\n googleOpts: genConfig.providerOptions?.['google'],\n model,\n structuredOutputRequested,\n descriptorGrounding: descriptor.capabilities?.grounding,\n structuredOutputWithTools: descriptor.capabilities?.structuredOutputWithTools,\n })\n if (googleProviderConfig.cachedContent !== undefined) {\n config.cachedContent = googleProviderConfig.cachedContent\n }\n if (googleProviderConfig.httpOptions !== undefined) {\n config.httpOptions = googleProviderConfig.httpOptions\n }\n if (googleProviderConfig.safetySettings !== undefined) {\n config.safetySettings = googleProviderConfig.safetySettings\n }\n if (googleProviderConfig.tools !== undefined) {\n config.tools = googleProviderConfig.tools\n }\n\n if (req.tools !== undefined && req.tools.length > 0) {\n if (req.modelDescriptor?.capabilities?.functionCalling !== true) {\n throw new LlmError(\n `tools is not supported for google model \"${model}\" (capabilities.functionCalling is not true).`,\n { kind: 'bad_request', retryable: false, provider: 'google' },\n )\n }\n if (googleProviderConfig.tools !== undefined) {\n throw new LlmError(\n 'tools cannot be combined with providerOptions.google.tools (googleSearch) in this iteration.',\n { kind: 'bad_request', retryable: false, provider: 'google' },\n )\n }\n config.tools = [\n {\n functionDeclarations: req.tools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n parameters: tool.inputJsonSchema,\n })),\n },\n ]\n if (req.toolChoice !== undefined) {\n config.toolConfig = {\n functionCallingConfig: mapGoogleToolChoice(req.toolChoice),\n }\n }\n }\n\n // ------------------------------------------------------------------\n // 5a. Fixed-sampling models reject sampling params even when a custom\n // descriptor or direct adapter test bypasses core parsing.\n // ------------------------------------------------------------------\n assertSamplingAllowed(config, model, req.modelDescriptor?.capabilities?.sampling)\n\n // ------------------------------------------------------------------\n // 6. AbortSignal passthrough + FIX A-2: client-side flex ceiling\n //\n // FIX A-2 belt-and-suspenders: @google/genai issue #1277 — on SDK\n // versions before 2.0.0, httpOptions.timeout is a no-op for\n // generateContent. Upstream landed a related Undici dispatcher fix in\n // 2.0.0 (commit 850f680), but we keep this mitigation as\n // belt-and-suspenders since it is now merely double-covered, not made\n // incorrect. On explicit flex calls without timeoutMs, the engine arms\n // NO AbortSignal; relying solely on\n // httpOptions.timeout risks a silent hang. We arm our own\n // AbortController here and combine it with any incoming signal so WE\n // enforce the ceiling regardless of the SDK bug.\n //\n // Flex and standard default paths need this extra timer when timeoutMs is\n // absent. When timeoutMs IS set the engine already arms a hard AbortSignal\n // at exactly timeoutMs.\n //\n // Abort reason uses DOMException with name 'TimeoutError' so classifyError\n // maps the resulting LlmError to kind:'timeout' (retryable:true), matching\n // how the rest of the codebase surfaces timeout errors.\n //\n // AbortSignal.any requires Node ≥ 20.3; our engine floor is Node ≥ 20,\n // so this is always available in supported environments.\n //\n // Real SDK: GenerateContentConfig.abortSignal (in config, NOT in params)\n // ------------------------------------------------------------------\n let tierTimeoutHandle: ReturnType<typeof setTimeout> | undefined\n\n const clearTierTimeout = (): void => {\n if (tierTimeoutHandle !== undefined) {\n clearTimeout(tierTimeoutHandle)\n tierTimeoutHandle = undefined\n }\n }\n\n const applyTierTimeout = (tier: string | undefined): void => {\n clearTierTimeout()\n delete config.abortSignal\n\n const defaultTimeoutMs =\n genConfig.timeoutMs === undefined\n ? tier === 'flex'\n ? FLEX_DEFAULT_TIMEOUT_MS\n : tier === 'standard'\n ? STANDARD_DEFAULT_TIMEOUT_MS\n : undefined\n : undefined\n\n if (defaultTimeoutMs !== undefined) {\n const tierController = new AbortController()\n const tierLabel = tier === 'standard' ? 'Standard' : 'Flex'\n const timeoutReason = new DOMException(\n `${tierLabel} timeout: call exceeded ${defaultTimeoutMs}ms client-side ceiling` +\n ' (@google/genai #1277 belt-and-suspenders)',\n 'TimeoutError',\n )\n tierTimeoutHandle = setTimeout(() => {\n tierController.abort(timeoutReason)\n }, defaultTimeoutMs)\n config.abortSignal =\n ctx.signal !== undefined\n ? AbortSignal.any([tierController.signal, ctx.signal])\n : tierController.signal\n } else if (ctx.signal !== undefined) {\n config.abortSignal = ctx.signal\n }\n }\n\n applyTierTimeout(config.serviceTier)\n\n // ------------------------------------------------------------------\n // 7. Transport timeout — set httpOptions.timeout so the @google/genai\n // HTTP transport does NOT preempt the AbortSignal hard ceiling.\n //\n // Policy (precedence, highest first):\n // 1. Caller-supplied providerOptions.google.httpOptions.timeout wins.\n // 2. timeoutMs is set → computed transport timeout = timeoutMs +\n // TRANSPORT_TIMEOUT_BUFFER_MS so the engine's AbortSignal (hard\n // ceiling at timeoutMs) always fires before the SDK transport timer.\n // 3. serviceTier 'flex', no timeoutMs → FLEX_DEFAULT_TIMEOUT_MS (no\n // buffer; there is no engine AbortSignal deadline in this case).\n // 4. serviceTier 'standard', no timeoutMs → STANDARD_DEFAULT_TIMEOUT_MS.\n //\n // Only assign config.httpOptions when the merged object is non-empty\n // (exactOptionalPropertyTypes-safe).\n // ------------------------------------------------------------------\n\n // Capture caller-supplied httpOptions BEFORE we overwrite.\n // These arrived via the allowlisted provider-options mapper above.\n const callerHttpOptions = config.httpOptions\n\n const computedTimeoutMs: number | undefined =\n genConfig.timeoutMs !== undefined\n ? genConfig.timeoutMs + TRANSPORT_TIMEOUT_BUFFER_MS\n : config.serviceTier === 'flex'\n ? FLEX_DEFAULT_TIMEOUT_MS\n : config.serviceTier === 'standard'\n ? STANDARD_DEFAULT_TIMEOUT_MS\n : undefined\n\n const mergedHttpOptions: { timeout?: number } = {\n ...(computedTimeoutMs !== undefined ? { timeout: computedTimeoutMs } : {}),\n ...callerHttpOptions,\n }\n\n if (Object.keys(mergedHttpOptions).length > 0) {\n config.httpOptions = mergedHttpOptions\n }\n\n // ------------------------------------------------------------------\n // 8b. Client construction + SDK call — both inside the classifier\n // so that ANY failure in run() (including a bad auth constructor)\n // is rethrown as a typed LlmError(provider:'google').\n // ------------------------------------------------------------------\n let response: GeminiResponseShape\n let servedServiceTier = config.serviceTier\n const dispatch = async (): Promise<GeminiResponseShape> => {\n const dispatchConfig: GeminiGenerateConfig = {\n ...config,\n ...(config.httpOptions !== undefined\n ? { httpOptions: { ...config.httpOptions } }\n : {}),\n }\n const params = {\n model,\n contents,\n config: dispatchConfig,\n }\n const buildClient = opts?._clientFactory ?? buildGoogleClient\n const client: GeminiClientLike =\n opts?.client !== undefined ? opts.client : await buildClient(ctx.auth)\n ctx.logger.debug(\n {\n model,\n configKeys: Object.keys(dispatchConfig),\n serviceTier: dispatchConfig.serviceTier,\n },\n 'llm.adapter.dispatch',\n )\n return client.models.generateContent(params)\n }\n try {\n response = await dispatch()\n } catch (rawErr) {\n // Classify SDK errors → LlmError\n const typed = classifyGoogleError(\n rawErr,\n servedServiceTier !== undefined ? { servedServiceTier } : undefined,\n )\n\n if (\n config.serviceTier === 'flex' &&\n googleProviderConfig.flexFallback !== false &&\n isGeminiCapacityError(typed)\n ) {\n config.serviceTier = 'standard'\n servedServiceTier = 'standard'\n const fallbackTimeout =\n genConfig.timeoutMs !== undefined\n ? genConfig.timeoutMs + TRANSPORT_TIMEOUT_BUFFER_MS\n : STANDARD_DEFAULT_TIMEOUT_MS\n config.httpOptions = {\n timeout: fallbackTimeout,\n ...callerHttpOptions,\n }\n applyTierTimeout('standard')\n try {\n response = await dispatch()\n } catch (fallbackRawErr) {\n throw classifyGoogleError(fallbackRawErr, { servedServiceTier: 'standard' })\n }\n } else {\n throw typed\n }\n } finally {\n // FIX A-2: always clear the tier timeout timer so it never leaks,\n // regardless of whether the call succeeded, threw, or was aborted.\n clearTierTimeout()\n }\n\n // The Gemini Developer API echoes the tier actually served in usage\n // metadata. Prefer that over the requested tier, including on success\n // after a provider-side tier change, so pricing uses the correct lane.\n const echoedTier = response.usageMetadata?.serviceTier\n if (typeof echoedTier === 'string' && echoedTier.length > 0) {\n if (config.serviceTier !== undefined && echoedTier !== config.serviceTier) {\n warnings.push({\n type: 'other',\n message: `google: requested serviceTier \"${config.serviceTier}\" but provider served \"${echoedTier}\"; billing uses the served tier.`,\n })\n }\n servedServiceTier = echoedTier\n }\n\n // ------------------------------------------------------------------\n // 8. Blocked response check. A candidate-less HTTP 200 without a\n // blockReason is a provider failure, not evidence of a safety block.\n // ------------------------------------------------------------------\n const hasBlockReason = response.promptFeedback?.blockReason !== undefined\n const hasCandidates =\n response.candidates !== undefined && response.candidates.length > 0\n\n if (hasBlockReason || !hasCandidates) {\n const reason = response.promptFeedback?.blockReason ?? 'NO_CANDIDATES'\n throw new LlmError(`Gemini response has no usable candidate: ${reason}`, {\n kind: hasBlockReason ? 'content_filter' : 'server',\n retryable: !hasBlockReason,\n provider: 'google',\n ...(response.usageMetadata !== undefined\n ? { usage: mapUsage(response.usageMetadata) }\n : {}),\n ...(servedServiceTier !== undefined ? { servedServiceTier } : {}),\n })\n }\n\n // ------------------------------------------------------------------\n // 9. Map response\n // ------------------------------------------------------------------\n const candidates = response.candidates\n if (candidates === undefined || candidates.length === 0) {\n throw new LlmError('Gemini response has no usable candidate: NO_CANDIDATES', {\n kind: 'server',\n retryable: true,\n provider: 'google',\n ...(response.usageMetadata !== undefined\n ? { usage: mapUsage(response.usageMetadata) }\n : {}),\n ...(servedServiceTier !== undefined ? { servedServiceTier } : {}),\n })\n }\n const candidate = candidates[0]\n if (candidate === undefined) {\n throw new LlmError('Gemini response has no usable candidate: NO_CANDIDATES', {\n kind: 'server',\n retryable: true,\n provider: 'google',\n ...(response.usageMetadata !== undefined\n ? { usage: mapUsage(response.usageMetadata) }\n : {}),\n ...(servedServiceTier !== undefined ? { servedServiceTier } : {}),\n })\n }\n const parts = candidate.content?.parts ?? []\n\n // Separate thought parts from text parts.\n const textParts: string[] = []\n const thoughtParts: string[] = []\n const toolCalls: NonNullable<AdapterResult['toolCalls']> = []\n\n const nameCounts = new Map<string, number>()\n const reservedIds = reserveProviderToolCallIds(\n parts.map((part) => part.functionCall?.id),\n )\n for (const part of parts) {\n if (\n part.functionCall !== undefined &&\n typeof part.functionCall.name === 'string'\n ) {\n const toolName = part.functionCall.name\n toolCalls.push({\n toolCallId: resolveToolCallId(\n part.functionCall.id,\n toolName,\n nameCounts,\n reservedIds,\n ),\n toolName,\n args: (part.functionCall.args ?? {}) as JsonValue,\n })\n }\n if (part.text !== undefined) {\n if (part.thought === true) {\n thoughtParts.push(part.text)\n } else {\n textParts.push(part.text)\n }\n }\n }\n\n const text = textParts.join('')\n const reasoningText = thoughtParts.length > 0 ? thoughtParts.join('') : undefined\n\n // Parse structured output (JSON text → rawStructured).\n let rawStructured: unknown\n if (structuredOutputRequested && text.length > 0) {\n try {\n rawStructured = JSON.parse(text)\n } catch {\n // Core reports outputParsed:false; callers own validation/retry policy.\n }\n }\n\n // ------------------------------------------------------------------\n // 10. Build AdapterResult\n // ------------------------------------------------------------------\n const usage = mapUsage(response.usageMetadata)\n const finishReason = mapFinishReason(candidate.finishReason)\n\n const result: AdapterResult = {\n model,\n usage,\n warnings,\n ...(servedServiceTier !== undefined ? { servedServiceTier } : {}),\n ...(text.length > 0 ? { text } : {}),\n ...(reasoningText !== undefined ? { reasoningText } : {}),\n ...(rawStructured !== undefined ? { rawStructured } : {}),\n ...(toolCalls.length > 0\n ? { toolCalls, finishReason: 'tool_calls' }\n : finishReason !== undefined\n ? { finishReason }\n : {}),\n ...(response.modelVersion !== undefined\n ? { modelVersion: response.modelVersion }\n : {}),\n ...(response.responseId !== undefined ? { responseId: response.responseId } : {}),\n // Build providerMetadata — merge promptFeedback + groundingMetadata when present.\n ...((): { providerMetadata: JsonValue } | Record<string, never> => {\n const pf = response.promptFeedback\n const gm = candidate.groundingMetadata\n if (pf === undefined && gm === undefined) return {}\n const meta: { [k: string]: JsonValue } = {}\n if (pf !== undefined) {\n meta['promptFeedback'] = pf as unknown as JsonValue\n }\n if (gm !== undefined) {\n meta['groundingMetadata'] = gm as unknown as JsonValue\n }\n return { providerMetadata: meta as JsonValue }\n })(),\n ...(() => {\n const gm = candidate.groundingMetadata\n if (gm === undefined) return {}\n const citations = normalizeGroundingCitations(gm)\n return citations.length > 0 ? { citations } : {}\n })(),\n }\n\n return result\n },\n\n async countTokens(req: TokenCountRequest, ctx: AdapterCtx): Promise<TokenCount> {\n if (req.provider !== 'google') {\n throw new LlmError(\n `geminiAdapter received a request for provider \"${req.provider}\", expected \"google\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n\n const contents = mapMessagesToGeminiContents(req.messages)\n const countTools =\n req.tools !== undefined && req.tools.length > 0\n ? [\n {\n functionDeclarations: req.tools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n parameters: tool.inputJsonSchema,\n })),\n },\n ]\n : undefined\n const params: GeminiCountTokensParams = {\n model: req.model,\n contents,\n ...(req.system !== undefined ||\n ctx.signal !== undefined ||\n countTools !== undefined\n ? {\n config: {\n ...(req.system !== undefined\n ? { systemInstruction: { parts: [{ text: req.system }] } }\n : {}),\n ...(ctx.signal !== undefined ? { abortSignal: ctx.signal } : {}),\n ...(countTools !== undefined ? { tools: countTools } : {}),\n },\n }\n : {}),\n }\n\n try {\n const buildClient = opts?._clientFactory ?? buildGoogleClient\n const client: GeminiClientLike =\n opts?.client !== undefined ? opts.client : await buildClient(ctx.auth)\n const response = await client.models.countTokens(params)\n\n if (response.totalTokens === undefined) {\n // Provider fault, not caller fault: the SDK call succeeded but the\n // payload is malformed — classify as a (retryable) server error.\n throw new LlmError(\n 'Gemini countTokens response is malformed: missing required field: totalTokens',\n { kind: 'server', retryable: true, provider: 'google' },\n )\n }\n\n const details: Record<string, number> | undefined =\n response.cachedContentTokenCount !== undefined\n ? { cached: response.cachedContentTokenCount }\n : undefined\n\n return {\n totalTokens: response.totalTokens,\n accuracy: 'exact',\n ...(details !== undefined ? { details } : {}),\n raw: response as unknown as JsonValue,\n }\n } catch (rawErr) {\n throw classifyGoogleError(rawErr)\n }\n },\n }\n}\n","/**\n * Gemini pricing snapshot for @gullabs/google.\n *\n * All rates are in **micro-USD per million tokens** (µUSD/M).\n * To get the cost for N tokens: `cost_µUSD = N * ratePerM / 1_000_000`.\n *\n * **Service tiers.** Each model stores concrete `standard`, `flex`, and\n * `batch` rates transcribed from Google's pricing page. Flex and batch are\n * not a flat 50% of standard: on several models the cached lane stays at the\n * standard cached rate (or a published rate that is not half). A tier that\n * is not one of those three is unpriced (reject-don't-map). `priority` is\n * intentionally absent — it needs downgrade accounting and is a backlog item.\n *\n * **Long-context tier.** Gemini Pro models charge a premium when the GROSS\n * input token count exceeds 200,000. Selected by `inputTokens` (incl. cached),\n * not by billable input. Core's selector uses `> 200_000`.\n *\n * **Thinking tokens.** Already inside `outputTokens` (GROSS convention) and\n * billed at the output rate — no separate thinking lane.\n *\n * **Modality caveat (v1 = text).** Gemini 2.5 Flash / Flash-Lite / 3.1\n * Flash-Lite charge a higher INPUT rate for audio tokens\n * than for text/image/video. v1 is text-only and uses the text/img/vid input\n * rate. Per-modality input pricing is a deferred seam (see DESIGN.md).\n *\n * Re-verified against https://ai.google.dev/gemini-api/docs/pricing on\n * 2026-09-25. Standard token rates for already-registered models were\n * unchanged from the 2026-08-12 snapshot; flex/batch cached rates were not.\n *\n * @module\n */\n\nimport type { ModelRates } from '@gullabs/core'\n\n/**\n * Identifies this pricing snapshot — bump the date when rates change.\n *\n * This is a snapshot date tied to Gemini's own pricing page, not a generic\n * core concept — it lives here (not `@gullabs/core`) alongside the rates it\n * dates.\n */\nexport const pricingVersion = 'gemini-2026-09-25' as const\n\n/** Tiers this snapshot prices. Anything else is unpriced. */\nexport const GEMINI_PRICED_TIERS = ['standard', 'flex', 'batch'] as const\n\nexport type GeminiPricedTier = (typeof GEMINI_PRICED_TIERS)[number]\n\n/** Concrete per-tier rates for one model. */\nexport interface GeminiTierRates {\n standard: ModelRates\n flex: ModelRates\n batch: ModelRates\n}\n\nfunction tiers(\n standard: ModelRates,\n flex: ModelRates,\n batch: ModelRates,\n): GeminiTierRates {\n return Object.freeze({ standard, flex, batch })\n}\n\n/**\n * Frozen Gemini pricing snapshot (per-1M in µUSD), keyed by model id, then\n * by priced tier. Every number is transcribed from the pricing page.\n *\n * Keys are exact priced model identifiers. Unlisted variants are unpriced.\n *\n * Source: https://ai.google.dev/gemini-api/docs/pricing (re-verified 2026-09-25).\n */\nexport const GEMINI_PRICING: Readonly<Record<string, GeminiTierRates>> = Object.freeze({\n // Gemini 2.5 Pro. Flex/batch cached equals standard on both context bands.\n 'gemini-2.5-pro': tiers(\n {\n inputPerM: 1_250_000,\n cachedPerM: 125_000,\n outputPerM: 10_000_000,\n gt200k: { inputPerM: 2_500_000, cachedPerM: 250_000, outputPerM: 15_000_000 },\n },\n {\n inputPerM: 625_000,\n cachedPerM: 125_000,\n outputPerM: 5_000_000,\n gt200k: { inputPerM: 1_250_000, cachedPerM: 250_000, outputPerM: 7_500_000 },\n },\n {\n inputPerM: 625_000,\n cachedPerM: 125_000,\n outputPerM: 5_000_000,\n gt200k: { inputPerM: 1_250_000, cachedPerM: 250_000, outputPerM: 7_500_000 },\n },\n ),\n\n // Gemini 2.5 Flash. Flex/batch cached stays $0.03.\n 'gemini-2.5-flash': tiers(\n { inputPerM: 300_000, cachedPerM: 30_000, outputPerM: 2_500_000 },\n { inputPerM: 150_000, cachedPerM: 30_000, outputPerM: 1_250_000 },\n { inputPerM: 150_000, cachedPerM: 30_000, outputPerM: 1_250_000 },\n ),\n\n // Gemini 2.5 Flash-Lite. Flex/batch cached stays $0.01.\n 'gemini-2.5-flash-lite': tiers(\n { inputPerM: 100_000, cachedPerM: 10_000, outputPerM: 400_000 },\n { inputPerM: 50_000, cachedPerM: 10_000, outputPerM: 200_000 },\n { inputPerM: 50_000, cachedPerM: 10_000, outputPerM: 200_000 },\n ),\n\n // Gemini 3.1 Flash-Lite. Flex/batch cached is the published $0.0125.\n 'gemini-3.1-flash-lite': tiers(\n { inputPerM: 250_000, cachedPerM: 25_000, outputPerM: 1_500_000 },\n { inputPerM: 125_000, cachedPerM: 12_500, outputPerM: 750_000 },\n { inputPerM: 125_000, cachedPerM: 12_500, outputPerM: 750_000 },\n ),\n\n // Gemini 3.8 / 3.7 / 3.6 Flash intro rates (2026-09-25). Flex/batch cached\n // is half of the intro cached rate. Re-snapshot on 2027-01-01.\n 'gemini-3.8-flash': tiers(\n { inputPerM: 750_000, cachedPerM: 75_000, outputPerM: 3_750_000 },\n { inputPerM: 375_000, cachedPerM: 37_500, outputPerM: 1_875_000 },\n { inputPerM: 375_000, cachedPerM: 37_500, outputPerM: 1_875_000 },\n ),\n 'gemini-3.7-flash': tiers(\n { inputPerM: 750_000, cachedPerM: 75_000, outputPerM: 3_750_000 },\n { inputPerM: 375_000, cachedPerM: 37_500, outputPerM: 1_875_000 },\n { inputPerM: 375_000, cachedPerM: 37_500, outputPerM: 1_875_000 },\n ),\n 'gemini-3.6-flash': tiers(\n { inputPerM: 750_000, cachedPerM: 75_000, outputPerM: 3_750_000 },\n { inputPerM: 375_000, cachedPerM: 37_500, outputPerM: 1_875_000 },\n { inputPerM: 375_000, cachedPerM: 37_500, outputPerM: 1_875_000 },\n ),\n\n // Gemini 3.5 Flash-Lite. Flex/batch cached is the published $0.02, not half of $0.03.\n 'gemini-3.5-flash-lite': tiers(\n { inputPerM: 300_000, cachedPerM: 30_000, outputPerM: 2_500_000 },\n { inputPerM: 150_000, cachedPerM: 20_000, outputPerM: 1_250_000 },\n { inputPerM: 150_000, cachedPerM: 20_000, outputPerM: 1_250_000 },\n ),\n\n // Gemini 3.1 Pro Preview. Flex/batch cached equals standard on both bands.\n 'gemini-3.1-pro-preview': tiers(\n {\n inputPerM: 2_000_000,\n cachedPerM: 200_000,\n outputPerM: 12_000_000,\n gt200k: { inputPerM: 4_000_000, cachedPerM: 400_000, outputPerM: 18_000_000 },\n },\n {\n inputPerM: 1_000_000,\n cachedPerM: 200_000,\n outputPerM: 6_000_000,\n gt200k: { inputPerM: 2_000_000, cachedPerM: 400_000, outputPerM: 9_000_000 },\n },\n {\n inputPerM: 1_000_000,\n cachedPerM: 200_000,\n outputPerM: 6_000_000,\n gt200k: { inputPerM: 2_000_000, cachedPerM: 400_000, outputPerM: 9_000_000 },\n },\n ),\n})\n\n/**\n * Concrete rates for `(model, tier)`. `undefined` tier is standard. A defined\n * tier this snapshot does not price returns `undefined`.\n */\nfunction isPricedGeminiTier(tier: string): tier is GeminiPricedTier {\n return (GEMINI_PRICED_TIERS as readonly string[]).includes(tier)\n}\n\nfunction lookupGeminiTierRates(\n model: string,\n tier?: string,\n): GeminiTierRates | undefined {\n const entry = Object.hasOwn(GEMINI_PRICING, model) ? GEMINI_PRICING[model] : undefined\n if (entry === undefined) return undefined\n // Only the three published tiers are priced. Inherited names such as\n // `constructor` and `toString` must not pass this check.\n if (tier !== undefined && !isPricedGeminiTier(tier)) return undefined\n return entry\n}\n\n/** Resolve the concrete {@link ModelRates} `computeCost` should apply. */\nexport function resolveGeminiRates(\n model: string,\n tier: string | undefined,\n): ModelRates | undefined {\n const entry = lookupGeminiTierRates(model, tier)\n if (entry === undefined) return undefined\n const key = tier ?? 'standard'\n return entry[key as GeminiPricedTier]\n}\n","/**\n * Gemini pricing source for @gullabs/google.\n *\n * Provides `geminiPricingSource` — a factory returning a `PricingSource` port\n * implementation backed by the frozen Gemini pricing snapshot ({@link\n * GEMINI_PRICING}). Uses exact priced model identifiers,\n * resolves the concrete per-tier rates, and delegates the arithmetic to\n * `@gullabs/core`'s `computeCost`. Core itself carries zero Gemini pricing\n * knowledge and applies no tier multiplier.\n *\n * @module\n */\n\nimport { computeCost } from '@gullabs/core'\nimport type { Cost, PricingSource, Usage } from '@gullabs/core'\n\nimport { GEMINI_PRICING, pricingVersion, resolveGeminiRates } from './pricing.js'\n\n/**\n * Factory that returns the **google-scoped** {@link PricingSource} port\n * implementation backed by the built-in Gemini pricing snapshot.\n *\n * `PricingSource` is provider-scoped by contract — this source only knows\n * bare Gemini/Gemma model keys. Compose it into `ClientConfig.pricingSources`\n * under the `'google'` key (or bundle it via {@link googleProvider}); do not\n * use it for other providers.\n *\n * The returned object is stateless and can be shared across calls.\n *\n * @example\n * ```ts\n * import { geminiPricingSource } from '@gullabs/google'\n *\n * const pricing = geminiPricingSource()\n * const cost = pricing.price('gemini-2.5-pro', usage, 'flex')\n * ```\n */\nexport function geminiPricingSource(): PricingSource {\n return {\n version: pricingVersion,\n price(model: string, usage: Usage, tier?: string): Cost {\n return computeCost(model, usage, tier, resolveGeminiRates, pricingVersion)\n },\n hasModel(model: string): boolean {\n return resolveGeminiRates(model, undefined) !== undefined\n },\n listModels(): readonly string[] {\n return Object.keys(GEMINI_PRICING)\n },\n }\n}\n","import { z } from 'zod'\n\nexport const Gemini25ProConfigSchema = z\n .union([\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-pro.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-pro.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-pro.',\n }),\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-pro.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-pro.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-2.5-pro.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-2.5-pro. Thinking off is not supported.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z.number().int().min(128).max(32768).meta({\n title: 'Reasoning Budget Tokens',\n description: 'thinkingBudget token range for gemini-2.5-pro.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Pro thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-pro.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-2.5-pro.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-pro.',\n }),\n }),\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-pro.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-pro.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-pro.',\n }),\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-pro.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-pro.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-2.5-pro.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-2.5-pro. Thinking off is not supported.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z.number().int().min(128).max(32768).meta({\n title: 'Reasoning Budget Tokens',\n description: 'thinkingBudget token range for gemini-2.5-pro.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Pro thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-pro.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-2.5-pro.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-pro.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini25ProConfig',\n description:\n 'Strict generateContent config for model gemini-2.5-pro. Budget reasoning, tunable sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', temperature: 0.7, reasoning: { effort: 'high' } }],\n })\n","import { z } from 'zod'\n\nexport const Gemini25FlashConfigSchema = z\n .union([\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-flash.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-flash.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-flash.',\n }),\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-flash.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-2.5-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemini-2.5-flash.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z.number().int().min(0).max(24576).meta({\n title: 'Reasoning Budget Tokens',\n description: 'thinkingBudget token range for gemini-2.5-flash.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Flash thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-2.5-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-flash.',\n }),\n }),\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-flash.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-flash.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-flash.',\n }),\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-flash.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-2.5-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemini-2.5-flash.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z.number().int().min(0).max(24576).meta({\n title: 'Reasoning Budget Tokens',\n description: 'thinkingBudget token range for gemini-2.5-flash.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Flash thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-2.5-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-flash.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini25FlashConfig',\n description:\n 'Strict generateContent config for model gemini-2.5-flash. Budget reasoning, tunable sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', temperature: 0.7, reasoning: { effort: 'none' } }],\n })\n","import { z } from 'zod'\n\nexport const Gemini25FlashLiteConfigSchema = z\n .union([\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-flash-lite.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-flash-lite.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-flash-lite.',\n }),\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-flash-lite.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-2.5-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemini-2.5-flash-lite.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z\n .union([z.literal(0), z.number().int().min(512).max(24576)])\n .meta({\n title: 'Reasoning Budget Tokens',\n description:\n 'thinkingBudget token range for gemini-2.5-flash-lite. Zero disables thinking; non-zero values must be 512..24576.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Flash-Lite thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-2.5-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-flash-lite.',\n }),\n }),\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-flash-lite.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-flash-lite.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-flash-lite.',\n }),\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-flash-lite.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-2.5-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemini-2.5-flash-lite.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z\n .union([z.literal(0), z.number().int().min(512).max(24576)])\n .meta({\n title: 'Reasoning Budget Tokens',\n description:\n 'thinkingBudget token range for gemini-2.5-flash-lite. Zero disables thinking; non-zero values must be 512..24576.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Flash-Lite thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-2.5-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-flash-lite.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini25FlashLiteConfig',\n description:\n 'Strict generateContent config for model gemini-2.5-flash-lite. Budget reasoning, tunable sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', temperature: 0.7, reasoning: { budgetTokens: 0 } }],\n })\n","import { z } from 'zod'\n\nexport const Gemini31FlashLiteConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.1-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.1-flash-lite.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.1-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.1-flash-lite; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.1 Flash-Lite thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.1-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.1-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.1-flash-lite.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.1-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.1-flash-lite.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.1-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.1-flash-lite; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.1 Flash-Lite thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.1-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.1-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.1-flash-lite.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini31FlashLiteConfig',\n description:\n 'Strict generateContent config for model gemini-3.1-flash-lite. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'medium' } }],\n })\n","import { z } from 'zod'\n\nexport const Gemini31ProPreviewConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.1-pro-preview.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.1-pro-preview.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.1-pro-preview.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.1-pro-preview. Thinking off is not supported.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.1 Pro Preview thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.1-pro-preview.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.1-pro-preview.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.1-pro-preview.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.1-pro-preview.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.1-pro-preview.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.1-pro-preview.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.1-pro-preview. Thinking off is not supported.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.1 Pro Preview thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.1-pro-preview.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.1-pro-preview.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.1-pro-preview.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini31ProPreviewConfig',\n description:\n 'Strict generateContent config for model gemini-3.1-pro-preview. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'high' } }],\n })\n","import { z } from 'zod'\n\nexport const Gemini35FlashLiteConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.5-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.5-flash-lite.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.5-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.5-flash-lite; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.5 Flash-Lite thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.5-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.5-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.5-flash-lite.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.5-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.5-flash-lite.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.5-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.5-flash-lite; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.5 Flash-Lite thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.5-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.5-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.5-flash-lite.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini35FlashLiteConfig',\n description:\n 'Strict generateContent config for model gemini-3.5-flash-lite. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'medium' } }],\n })\n","import { z } from 'zod'\n\nexport const Gemini36FlashConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.6-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.6-flash.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.6-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.6-flash; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.6 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.6-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.6-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.6-flash.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.6-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.6-flash.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.6-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.6-flash; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.6 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.6-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.6-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.6-flash.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini36FlashConfig',\n description:\n 'Strict generateContent config for model gemini-3.6-flash. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'medium' } }],\n })\n","import { z } from 'zod'\n\nexport const Gemini37FlashConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.7-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.7-flash.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.7-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.7-flash. none is not admitted; thinkingLevel MINIMAL is never emitted.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.7 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.7-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.7-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.7-flash.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.7-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.7-flash.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.7-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.7-flash. none is not admitted; thinkingLevel MINIMAL is never emitted.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.7 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.7-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.7-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.7-flash.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini37FlashConfig',\n description:\n 'Strict generateContent config for model gemini-3.7-flash. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'medium' } }],\n })\n","import { z } from 'zod'\n\nexport const Gemini38FlashConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.8-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.8-flash.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.8-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.8-flash. none is not admitted; thinkingLevel MINIMAL is never emitted.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.8 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.8-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.8-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.8-flash.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.8-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.8-flash.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.8-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.8-flash. none is not admitted; thinkingLevel MINIMAL is never emitted.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.8 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.8-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.8-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.8-flash.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini38FlashConfig',\n description:\n 'Strict generateContent config for model gemini-3.8-flash. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'medium' } }],\n })\n","import { z } from 'zod'\n\nexport const Gemma431bItConfigSchema = z\n .strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemma-4-31b-it.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemma-4-31b-it.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemma-4-31b-it.',\n }),\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemma-4-31b-it.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemma-4-31b-it.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemma-4-31b-it.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemma 4 31B IT thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemma-4-31b-it.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemma-4-31b-it.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemma-4-31b-it.',\n }),\n })\n .meta({\n title: 'Gemma431bItConfig',\n description:\n 'Strict generateContent config for model gemma-4-31b-it. Level reasoning, tunable sampling, no service tier, structured output, grounding, intentionally unpriced.',\n examples: [{ temperature: 0.7, reasoning: { effort: 'high' } }],\n })\n","import { z } from 'zod'\n\nexport const Gemma426bA4bItConfigSchema = z\n .strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemma-4-26b-a4b-it.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemma-4-26b-a4b-it.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemma-4-26b-a4b-it.',\n }),\n maxOutputTokens: z.number().int().positive().optional().meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemma-4-26b-a4b-it.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemma-4-26b-a4b-it.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemma-4-26b-a4b-it.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemma 4 26B A4B IT thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n cachedContent: z.string().min(1).optional().meta({\n title: 'Cached Content',\n description: 'Google cached content resource name.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.string().min(1).meta({\n title: 'Safety Category',\n description: 'Google safety category identifier.',\n }),\n threshold: z.string().min(1).meta({\n title: 'Safety Threshold',\n description: 'Google safety threshold identifier.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemma-4-26b-a4b-it.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().optional().meta({\n title: 'HTTP Timeout',\n description: 'Per-request Google transport timeout in milliseconds.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemma-4-26b-a4b-it.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemma-4-26b-a4b-it.',\n }),\n })\n .meta({\n title: 'Gemma426bA4bItConfig',\n description:\n 'Strict generateContent config for model gemma-4-26b-a4b-it. Level reasoning, tunable sampling, no service tier, structured output, grounding, intentionally unpriced.',\n examples: [{ temperature: 0.7, reasoning: { effort: 'none' } }],\n })\n","/**\n * Model descriptor registry for @gullabs/google.\n *\n * Centralises Gemini/Gemma model knowledge: reasoning-effort vocabularies,\n * capability flags, and the built-in descriptor arrays. `@gullabs/core` owns\n * only the generic registry machinery (`ModelDescriptor`, `ModelRegistry`,\n * `createModelRegistry`) — this module supplies the Gemini-specific data.\n *\n * @module\n */\n\nimport type { ModelDescriptor, ModelRegistry, ReasoningEffort } from '@gullabs/core'\nimport { createModelRegistry } from '@gullabs/core'\n\nimport {\n Gemma426bA4bItConfigSchema,\n Gemma431bItConfigSchema,\n Gemini25FlashConfigSchema,\n Gemini25FlashLiteConfigSchema,\n Gemini25ProConfigSchema,\n Gemini31FlashLiteConfigSchema,\n Gemini31ProPreviewConfigSchema,\n Gemini35FlashLiteConfigSchema,\n Gemini36FlashConfigSchema,\n Gemini37FlashConfigSchema,\n Gemini38FlashConfigSchema,\n} from './model-config/index.js'\nimport { toConfigJsonSchema, zodToStandardSchema } from '@gullabs/core'\n\nconst GEMINI_STANDARD_REASONING_EFFORTS = [\n 'low',\n 'medium',\n 'high',\n] as const satisfies ReadonlyArray<ReasoningEffort>\nconst GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS = [\n 'none',\n 'low',\n 'medium',\n 'high',\n] as const satisfies ReadonlyArray<ReasoningEffort>\nconst GEMMA_REASONING_EFFORTS = [\n 'none',\n 'high',\n] as const satisfies ReadonlyArray<ReasoningEffort>\n\nexport const geminiModelDescriptors: ModelDescriptor[] = [\n {\n model: 'gemini-2.5-pro',\n provider: 'google',\n pricingFamily: 'gemini-2.5-pro',\n capabilities: {\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n vision: true,\n reasoningApi: 'budget',\n admittedReasoningEfforts: GEMINI_STANDARD_REASONING_EFFORTS,\n sampling: 'tunable',\n caching: { explicit: true, minTokens: 2048 },\n grounding: true,\n functionCalling: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini25ProConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemini25ProConfigSchema),\n validateConfig: zodToStandardSchema(Gemini25ProConfigSchema),\n },\n {\n model: 'gemini-2.5-flash',\n provider: 'google',\n pricingFamily: 'gemini-2.5-flash',\n capabilities: {\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n vision: true,\n reasoningApi: 'budget',\n admittedReasoningEfforts: GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS,\n sampling: 'tunable',\n caching: { explicit: true, minTokens: 2048 },\n grounding: true,\n functionCalling: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini25FlashConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemini25FlashConfigSchema),\n validateConfig: zodToStandardSchema(Gemini25FlashConfigSchema),\n },\n {\n model: 'gemini-2.5-flash-lite',\n provider: 'google',\n pricingFamily: 'gemini-2.5-flash-lite',\n capabilities: {\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n vision: true,\n reasoningApi: 'budget',\n admittedReasoningEfforts: GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS,\n sampling: 'tunable',\n caching: { explicit: true, minTokens: 2048 },\n grounding: true,\n functionCalling: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini25FlashLiteConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemini25FlashLiteConfigSchema),\n validateConfig: zodToStandardSchema(Gemini25FlashLiteConfigSchema),\n },\n {\n model: 'gemini-3.1-flash-lite',\n provider: 'google',\n pricingFamily: 'gemini-3.1-flash-lite',\n capabilities: {\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n vision: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini31FlashLiteConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemini31FlashLiteConfigSchema),\n validateConfig: zodToStandardSchema(Gemini31FlashLiteConfigSchema),\n },\n {\n model: 'gemini-3.1-pro-preview',\n provider: 'google',\n pricingFamily: 'gemini-3.1-pro-preview',\n capabilities: {\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n vision: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_STANDARD_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini31ProPreviewConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemini31ProPreviewConfigSchema),\n validateConfig: zodToStandardSchema(Gemini31ProPreviewConfigSchema),\n },\n {\n model: 'gemini-3.8-flash',\n provider: 'google',\n pricingFamily: 'gemini-3.8-flash',\n capabilities: {\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n vision: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_STANDARD_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini38FlashConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemini38FlashConfigSchema),\n validateConfig: zodToStandardSchema(Gemini38FlashConfigSchema),\n },\n {\n model: 'gemini-3.7-flash',\n provider: 'google',\n pricingFamily: 'gemini-3.7-flash',\n capabilities: {\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n vision: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_STANDARD_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini37FlashConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemini37FlashConfigSchema),\n validateConfig: zodToStandardSchema(Gemini37FlashConfigSchema),\n },\n {\n model: 'gemini-3.6-flash',\n provider: 'google',\n pricingFamily: 'gemini-3.6-flash',\n capabilities: {\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n vision: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini36FlashConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemini36FlashConfigSchema),\n validateConfig: zodToStandardSchema(Gemini36FlashConfigSchema),\n },\n {\n model: 'gemini-3.5-flash-lite',\n provider: 'google',\n pricingFamily: 'gemini-3.5-flash-lite',\n capabilities: {\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n vision: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini35FlashLiteConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemini35FlashLiteConfigSchema),\n validateConfig: zodToStandardSchema(Gemini35FlashLiteConfigSchema),\n },\n]\n\nexport const gemmaModelDescriptors: ModelDescriptor[] = [\n {\n model: 'gemma-4-31b-it',\n provider: 'google',\n capabilities: {\n reasoning: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMMA_REASONING_EFFORTS,\n structuredOutput: true,\n nativeStructuredOutput: true,\n grounding: true,\n vision: true,\n sampling: 'tunable',\n },\n configSchema: Gemma431bItConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemma431bItConfigSchema),\n validateConfig: zodToStandardSchema(Gemma431bItConfigSchema),\n },\n {\n model: 'gemma-4-26b-a4b-it',\n provider: 'google',\n capabilities: {\n reasoning: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMMA_REASONING_EFFORTS,\n structuredOutput: true,\n nativeStructuredOutput: true,\n grounding: true,\n vision: true,\n sampling: 'tunable',\n },\n configSchema: Gemma426bA4bItConfigSchema,\n configJsonSchema: toConfigJsonSchema(Gemma426bA4bItConfigSchema),\n validateConfig: zodToStandardSchema(Gemma426bA4bItConfigSchema),\n },\n]\n\n/**\n * Pre-built registry of all built-in Gemini + Gemma descriptors.\n *\n * Most callers should prefer {@link googleProvider} (which bundles this same\n * descriptor set via `composeProviders`); this export remains for callers\n * that need a bare `ModelRegistry` without going through the plugin seam.\n */\nexport const defaultGeminiRegistry: ModelRegistry = createModelRegistry([\n ...geminiModelDescriptors,\n ...gemmaModelDescriptors,\n])\n","/**\n * `googleProvider` — {@link ProviderPlugin} factory for @gullabs/google.\n *\n * Bundles the Gemini adapter, the built-in Gemini + Gemma model descriptors,\n * and the Gemini pricing source into a single plugin for\n * {@link composeProviders}.\n *\n * @module\n */\n\nimport type { ProviderPlugin } from '@gullabs/core'\n\nimport { geminiAdapter } from './adapter.js'\nimport type { GeminiAdapterOptions } from './adapter.js'\nimport { geminiPricingSource } from './cost.js'\nimport { geminiModelDescriptors, gemmaModelDescriptors } from './models.js'\n\n/**\n * Create a {@link ProviderPlugin} for the Gemini provider.\n *\n * @param opts - Forwarded to {@link geminiAdapter}.\n * @returns A plugin bundling the Gemini adapter, Gemini + Gemma model\n * descriptors, and the built-in Gemini pricing source.\n *\n * @example\n * ```ts\n * import { createClient, composeProviders } from '@gullabs/core'\n * import { googleProvider } from '@gullabs/google'\n *\n * const client = createClient({\n * ...composeProviders([googleProvider()]),\n * })\n * ```\n */\nexport function googleProvider(opts?: GeminiAdapterOptions): ProviderPlugin {\n return {\n adapter: geminiAdapter(opts),\n modelDescriptors: [...geminiModelDescriptors, ...gemmaModelDescriptors],\n pricingSource: geminiPricingSource(),\n }\n}\n","/**\n * GoogleFileStore — thin wrapper over the Gemini File API.\n *\n * Handles upload + polling until ACTIVE, and tracked deletion.\n * Injectable sleep and client for tests (no network required).\n *\n * @module\n */\n\nimport type { AuthMaterial, Logger } from '@gullabs/core'\nimport { LlmError, classifyError, redactSecrets } from '@gullabs/core'\n\nimport { requireApiKey } from './client.js'\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/** A handle to a file stored in the Gemini File API. */\nexport interface GoogleFileHandle {\n /** Resource name, e.g. \"files/abc123\". */\n name: string\n /** URI to pass as FileUriPart.uri in an LlmRequest. */\n uri: string\n mimeType: string\n /** Provider auto-deletes ~48 h after upload. Absent when not returned. */\n expiresAt?: Date\n}\n\n/**\n * Minimal structural interface for the Gemini Files client surface we use.\n * Satisfied by the real ai.files object or a test fake.\n */\nexport interface GeminiFilesClientLike {\n upload(params: {\n file: Uint8Array | Blob\n config?: { mimeType?: string; displayName?: string }\n }): Promise<{\n name?: string\n uri?: string\n mimeType?: string\n state?: string\n expirationTime?: string\n }>\n get(params: { name: string }): Promise<{\n name?: string\n uri?: string\n mimeType?: string\n state?: string\n expirationTime?: string\n }>\n delete(params: { name: string }): Promise<void>\n}\n\n/**\n * Options for {@link GoogleFileStore.delete} / {@link GoogleFileStore.deleteAll}.\n *\n * Default is fail-open (P5 side-effect style). Pass `failClosed: true` when\n * the host gates durable state on known delete success. Shape matches\n * `@gullabs/xai` `FileDeleteOptions` by convention.\n */\nexport interface FileDeleteOptions {\n signal?: AbortSignal\n /**\n * When true, non-not-found failures throw typed `LlmError`.\n * When false/omitted, failures invoke `onDeleteError` and resolve.\n * Not-found is success in both modes (idempotent).\n */\n failClosed?: boolean\n}\n\nexport interface GoogleFileStoreOptions {\n auth: AuthMaterial\n /** Injectable client for tests; skips SDK import when provided. */\n client?: GeminiFilesClientLike\n /** Called on delete failures instead of rethrowing. Default: console.error. */\n onDeleteError?: (name: string, err: unknown) => void\n /** Optional structured logger. When provided, routes delete failures to logger.error. */\n logger?: Logger\n poll?: {\n /** Delay between state polls. Default: 3000 ms. */\n intervalMs?: number\n /** Max time to wait for ACTIVE. Default: 300 000 ms (5 min). */\n timeoutMs?: number\n }\n /** Injectable sleep for tests. Default: real setTimeout. */\n sleep?: (ms: number) => Promise<void>\n /** Injectable clock for deterministic tests. Default: `Date.now`. */\n now?: () => number\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_INTERVAL_MS = 3_000\nconst DEFAULT_TIMEOUT_MS = 300_000\n\nconst realSleep = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms))\n\nasync function buildFilesClient(auth: AuthMaterial): Promise<GeminiFilesClientLike> {\n const { GoogleGenAI } = await import('@google/genai')\n\n const ai = new GoogleGenAI({ apiKey: requireApiKey(auth) })\n\n return {\n async upload(params) {\n // Real SDK accepts string | Blob; convert Uint8Array → Blob.\n // Uint8Array.from() copies into a fresh, plain ArrayBuffer-backed\n // array — BlobPart requires Uint8Array<ArrayBuffer>, which excludes\n // the SharedArrayBuffer-backed views that Uint8Array<ArrayBufferLike>\n // (the type of params.file) may structurally include.\n const fileArg: Blob =\n params.file instanceof Uint8Array\n ? new Blob(\n [Uint8Array.from(params.file)],\n params.config?.mimeType !== undefined && params.config.mimeType.length > 0\n ? { type: params.config.mimeType }\n : {},\n )\n : params.file\n\n const result = await (\n ai.files.upload as (p: unknown) => Promise<{\n name?: string\n uri?: string\n mimeType?: string\n state?: string\n expirationTime?: string\n }>\n )({\n file: fileArg,\n ...(params.config !== undefined ? { config: params.config } : {}),\n })\n return result\n },\n\n async get(params) {\n const result = await (\n ai.files.get as (p: unknown) => Promise<{\n name?: string\n uri?: string\n mimeType?: string\n state?: string\n expirationTime?: string\n }>\n )(params)\n return result\n },\n\n async delete(params) {\n await (ai.files.delete as (p: unknown) => Promise<unknown>)(params)\n },\n }\n}\n\ntype FileResp = {\n name?: string\n uri?: string\n mimeType?: string\n state?: string\n expirationTime?: string\n}\n\nfunction makeHandle(\n resp: FileResp,\n fallback: { name: string; uri: string; mimeType: string },\n): GoogleFileHandle {\n const et = resp.expirationTime\n return {\n name: resp.name ?? fallback.name,\n uri: resp.uri ?? fallback.uri,\n mimeType: resp.mimeType ?? fallback.mimeType,\n ...(et !== undefined && et.length > 0 ? { expiresAt: new Date(et) } : {}),\n }\n}\n\n// ---------------------------------------------------------------------------\n// GoogleFileStore\n// ---------------------------------------------------------------------------\n\n/**\n * **Auth snapshot note:** this store captures the `AuthMaterial` at construction\n * time and memoizes a single SDK client from it (`clientPromise`). This is\n * correct and sufficient for static API keys. If refreshable credentials\n * (short-lived OAuth/STS tokens) are added in the future, this memoization is\n * the seam that will need rework: the cached client would hold stale credentials\n * for the lifetime of a long-lived store instance. At that point, the store\n * will need to either rebuild the client on each operation or accept a\n * credential-resolver callback rather than a plain `AuthMaterial` value.\n * See ADR-020 in DECISIONS.md.\n */\nexport class GoogleFileStore {\n private readonly auth: AuthMaterial\n private readonly clientOverride: GeminiFilesClientLike | undefined\n private readonly onDeleteError: (name: string, err: unknown) => void\n private readonly logger: Logger | undefined\n private readonly intervalMs: number\n private readonly timeoutMs: number\n private readonly sleep: (ms: number) => Promise<void>\n private readonly now: () => number\n /** Memoised client promise — built at most once per store instance. */\n private clientPromise: Promise<GeminiFilesClientLike> | undefined\n\n constructor(opts: GoogleFileStoreOptions) {\n this.auth = opts.auth\n this.clientOverride = opts.client\n this.logger = opts.logger\n this.onDeleteError =\n opts.onDeleteError ??\n ((name, err) => {\n if (this.logger !== undefined) {\n this.logger.error(\n { name, error: redactSecrets(classifyError(err).message) },\n 'gemini.file.delete.failed',\n )\n } else {\n console.error(\n `[GoogleFileStore] delete failed for \"${name}\":`,\n redactSecrets(classifyError(err).message),\n )\n }\n })\n this.intervalMs = opts.poll?.intervalMs ?? DEFAULT_INTERVAL_MS\n this.timeoutMs = opts.poll?.timeoutMs ?? DEFAULT_TIMEOUT_MS\n this.sleep = opts.sleep ?? realSleep\n this.now = opts.now ?? (() => Date.now())\n }\n\n private getClient(): Promise<GeminiFilesClientLike> {\n if (this.clientOverride !== undefined) return Promise.resolve(this.clientOverride)\n if (this.clientPromise === undefined) {\n this.clientPromise = buildFilesClient(this.auth)\n }\n return this.clientPromise\n }\n\n /**\n * Upload bytes to the Gemini File API and wait until the file is ACTIVE.\n *\n * @param source - Raw bytes or Blob.\n * @param mimeType - IANA media type, e.g. `\"image/png\"`.\n * @param opts - Optional display name.\n */\n async upload(\n source: Uint8Array | Blob,\n mimeType: string,\n opts?: { displayName?: string; signal?: AbortSignal },\n ): Promise<GoogleFileHandle> {\n const signal = opts?.signal\n const client = await this.getClient()\n\n let uploadResp: {\n name?: string\n uri?: string\n mimeType?: string\n state?: string\n expirationTime?: string\n }\n try {\n uploadResp = await client.upload({\n file: source,\n config: {\n mimeType,\n ...(opts?.displayName !== undefined ? { displayName: opts.displayName } : {}),\n },\n })\n } catch (e) {\n throw classifyError(e)\n }\n\n const { name, uri } = uploadResp\n\n if (\n name === undefined ||\n name.length === 0 ||\n uri === undefined ||\n uri.length === 0\n ) {\n // Provider fault, not caller fault: the SDK call succeeded but the\n // payload is malformed — classify as a server error. NOT retryable:\n // upload() is side-effecting and not idempotent — the provider may have\n // already stored the file even though the payload carries no name/uri,\n // so there is no handle to clean up and an automatic retry could\n // orphan/duplicate provider-side resources.\n throw new LlmError('File upload response missing required fields (name or uri)', {\n kind: 'server',\n retryable: false,\n provider: 'google',\n })\n }\n\n const fallback = { name, uri, mimeType }\n\n if (uploadResp.state === 'ACTIVE') {\n return makeHandle(uploadResp, fallback)\n }\n\n if (uploadResp.state === 'FAILED') {\n throw new LlmError('File processing failed immediately after upload', {\n kind: 'bad_request',\n retryable: false,\n })\n }\n\n // PROCESSING (or unknown) — poll until ACTIVE or timeout.\n const deadline = this.now() + this.timeoutMs\n\n // Pre-flight: if the signal is already aborted, throw before creating any\n // promise so we never produce an unhandled rejection.\n if (signal?.aborted === true) {\n throw new LlmError('File upload polling aborted', {\n kind: 'aborted',\n retryable: false,\n })\n }\n\n // Build an abort-race promise so future aborts wake up the sleep race\n // immediately rather than waiting the full interval. Created only when\n // the signal is NOT already aborted (guard above handles that case).\n const abortRacePromise: Promise<never> | undefined =\n signal !== undefined\n ? new Promise<never>((_, reject) => {\n signal.addEventListener(\n 'abort',\n () => {\n reject(\n new LlmError('File upload polling aborted', {\n kind: 'aborted',\n retryable: false,\n }),\n )\n },\n { once: true },\n )\n })\n : undefined\n\n for (;;) {\n if (this.now() >= deadline) {\n throw new LlmError('Timed out waiting for uploaded file to become ACTIVE', {\n kind: 'timeout',\n retryable: true,\n })\n }\n\n // Sleep — race against the abort promise so we wake up immediately\n // when the signal fires rather than waiting the full interval.\n const sleepCall = this.sleep(this.intervalMs)\n await (abortRacePromise !== undefined\n ? Promise.race([sleepCall, abortRacePromise])\n : sleepCall)\n\n let pollResp: {\n name?: string\n uri?: string\n mimeType?: string\n state?: string\n expirationTime?: string\n }\n try {\n pollResp = await client.get({ name })\n } catch (e) {\n throw classifyError(e)\n }\n\n // Also guard here: the signal may have fired during client.get()\n // before we looped back to the sleep race.\n // Cast needed: TS 5.6 persists readonly-property narrowing across awaits,\n // making it think `aborted` is still `false | undefined` after the preflight.\n if ((signal?.aborted as boolean | undefined) === true) {\n throw new LlmError('File upload polling aborted', {\n kind: 'aborted',\n retryable: false,\n })\n }\n\n if (pollResp.state === 'ACTIVE') {\n return makeHandle(pollResp, fallback)\n }\n\n if (pollResp.state === 'FAILED') {\n throw new LlmError('File processing failed during polling', {\n kind: 'bad_request',\n retryable: false,\n })\n }\n // PROCESSING — continue loop\n }\n }\n\n /**\n * Delete a single uploaded file. Idempotent: not-found → success.\n *\n * Default (`failClosed` omitted/false): errors go to `onDeleteError` and\n * resolve (P5 fail-open). With `failClosed: true`, non-not-found errors\n * throw typed `LlmError` and `onDeleteError` is not called.\n *\n * Empty/blank `handle.name` always throws `bad_request`.\n */\n async delete(handle: GoogleFileHandle, opts?: FileDeleteOptions): Promise<void> {\n const name = handle.name\n if (typeof name !== 'string' || name.trim() === '') {\n throw new LlmError('GoogleFileHandle.name must be a non-empty string.', {\n kind: 'bad_request',\n retryable: false,\n provider: 'google',\n })\n }\n\n const failClosed = opts?.failClosed === true\n\n try {\n if (opts?.signal?.aborted === true) {\n throw new LlmError('Google file delete aborted', {\n kind: 'aborted',\n retryable: false,\n provider: 'google',\n })\n }\n const client = await this.getClient()\n await client.delete({ name })\n } catch (err) {\n if (isGoogleNotFoundError(err)) {\n return\n }\n const classified = err instanceof LlmError ? err : classifyError(err)\n const withProvider =\n classified.provider === undefined\n ? new LlmError(classified.message, {\n kind: classified.kind,\n retryable: classified.retryable,\n ...(classified.httpStatus !== undefined\n ? { httpStatus: classified.httpStatus }\n : {}),\n ...(classified.retryAfterMs !== undefined\n ? { retryAfterMs: classified.retryAfterMs }\n : {}),\n provider: 'google',\n cause: classified.cause ?? err,\n })\n : classified\n\n if (failClosed) {\n throw withProvider\n }\n this.onDeleteError(name, withProvider)\n }\n }\n\n /**\n * Delete multiple files.\n *\n * Fail-open (default): `Promise.allSettled` per handle.\n * Fail-closed: `Promise.all` — first throw rejects; in-flight siblings are\n * not cancelled. Prefer per-handle delete when gating durable release state.\n */\n async deleteAll(handles: GoogleFileHandle[], opts?: FileDeleteOptions): Promise<void> {\n if (opts?.failClosed === true) {\n await Promise.all(handles.map((h) => this.delete(h, opts)))\n return\n }\n await Promise.allSettled(handles.map((h) => this.delete(h, opts)))\n }\n}\n\n/** Detect Gemini/SDK not-found shapes so delete stays idempotent. */\nfunction isGoogleNotFoundError(err: unknown): boolean {\n if (err instanceof LlmError && err.httpStatus === 404) {\n return true\n }\n if (typeof err !== 'object' || err === null) {\n return false\n }\n const obj = err as Record<string, unknown>\n if (obj['status'] === 404 || obj['httpStatus'] === 404 || obj['code'] === 404) {\n return true\n }\n if (obj['status'] === 'NOT_FOUND' || obj['code'] === 'NOT_FOUND') {\n return true\n }\n const msg = typeof obj['message'] === 'string' ? obj['message'] : ''\n if (/not\\s*found|404/i.test(msg) && /file/i.test(msg)) {\n return true\n }\n return false\n}\n","/**\n * GoogleCacheStore — thin wrapper over the Gemini Context Cache API.\n *\n * Manages create / get-or-create / refresh / delete lifecycle for cached\n * contents. In-memory cache entries are PROCESS-SCOPED; they are not shared\n * across processes, workers, or restarts.\n *\n * Injectable client and `now` function keep tests free of network and clock.\n *\n * @module\n */\n\nimport type { AuthMaterial, Logger } from '@gullabs/core'\nimport type { Content } from '@google/genai'\n\nimport { requireApiKey } from './client.js'\nimport { LlmError, classifyError, redactSecrets } from '@gullabs/core'\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/**\n * A handle to a cached content resource in the Gemini Context Cache API.\n *\n * Pass `cacheName` as `providerOptions.google.cachedContent` in LlmRequest.\n */\nexport interface GoogleCacheHandle {\n /** Resource name, e.g. \"cachedContents/xyz\". */\n cacheName: string\n /**\n * Local view of when the cache expires (server-authoritative; computed from\n * ttl or parsed from the server response `expireTime`).\n */\n expiresAt: Date\n /** Caches are model-bound; never use a handle with a different model. */\n model: string\n}\n\n/** Key used to look up or create an entry in the in-process cache map. */\nexport interface CacheKey {\n model: string\n /** Caller-chosen stable identifier, e.g. a hash of the cached content. */\n stableKey: string\n}\n\n/**\n * Minimal structural interface for the Gemini Caches client surface we use.\n * Satisfied by the real `ai.caches` object or a test fake.\n */\nexport interface GeminiCachesClientLike {\n create(params: {\n model: string\n config: {\n contents?: Content[]\n systemInstruction?: Content | string\n ttl?: string\n displayName?: string\n }\n }): Promise<{ name?: string; model?: string; expireTime?: string }>\n\n update(params: {\n name: string\n config: { ttl?: string; expireTime?: string }\n }): Promise<{ name?: string; expireTime?: string }>\n\n delete(params: { name: string }): Promise<unknown>\n}\n\nexport interface GoogleCacheStoreOptions {\n auth: AuthMaterial\n /** Injectable client for tests; skips SDK import when provided. */\n client?: GeminiCachesClientLike\n /**\n * When true, concurrent `getOrCreate` calls for the same key share one\n * in-flight create. Default false.\n */\n coalesce?: boolean\n /**\n * Subtracted from the local expiry so we stop using a cache slightly before\n * the server evicts it. Default 30 s.\n */\n expirySkewSeconds?: number\n /** Called on delete failures instead of rethrowing. */\n onDeleteError?: (cacheName: string, err: unknown) => void\n /** Optional structured logger. When provided, routes delete failures to logger.error. */\n logger?: Logger\n /** Injectable clock for deterministic tests. Default: `Date.now`. */\n now?: () => number\n /**\n * Opt-in pre-flight token-count gate applied before every cache create\n * (both `create()` directly and the `getOrCreate()` path it delegates to,\n * including the coalesced path — enforced once, inside `create()`, so\n * there is no separate \"in-flight\" gap to close).\n */\n preflight?: {\n /** Minimum token count required before a cache create is allowed to proceed. */\n minTokens: number\n /**\n * Counts tokens for the exact token-bearing payload of the impending\n * create — `model` + `contents` + `systemInstruction` only. `ttl` and\n * `displayName` are excluded: they carry no tokens and are irrelevant to\n * the pre-flight check.\n *\n * This callback receives genai-native `Content[]`/`Content|string` — it\n * does NOT receive the library's `Message[]` shape and there is no\n * automatic conversion between the two (explicit seam, by design). Hosts\n * using genai-native content directly can wire this to a raw\n * `client.models.countTokens` call; hosts building from the library's\n * `Message[]` should call `@gullabs/core`'s `client.countTokens` rather\n * than expecting this callback to convert for them.\n */\n countTokens: (payload: {\n model: string\n contents?: Content[]\n systemInstruction?: Content | string\n }) => Promise<number>\n }\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_SKEW_SECONDS = 30\nconst DEFAULT_EXTENSION_SECONDS = 3600\n\nasync function buildCachesClient(auth: AuthMaterial): Promise<GeminiCachesClientLike> {\n const { GoogleGenAI } = await import('@google/genai')\n\n const ai = new GoogleGenAI({ apiKey: requireApiKey(auth) })\n\n return {\n async create(params) {\n const result = await (\n ai.caches.create as (p: unknown) => Promise<{\n name?: string\n model?: string\n expireTime?: string\n }>\n )(params)\n return result\n },\n\n async update(params) {\n const result = await (\n ai.caches.update as (p: unknown) => Promise<{\n name?: string\n expireTime?: string\n }>\n )(params)\n return result\n },\n\n async delete(params) {\n await (ai.caches.delete as (p: unknown) => Promise<unknown>)(params)\n },\n }\n}\n\n// ---------------------------------------------------------------------------\n// GoogleCacheStore\n// ---------------------------------------------------------------------------\n\ninterface EntryRecord {\n handle: GoogleCacheHandle\n /** Original ttlSeconds used to create this entry; used as extension default. */\n ttlSeconds: number\n}\n\n/**\n * Process-scoped helper for the Gemini Context Cache API.\n *\n * NOTE: `getOrCreate` reuse is PROCESS-SCOPED only. Entries survive only for\n * the lifetime of this `GoogleCacheStore` instance. Across restarts, new\n * caches will be created (and old ones will be server-evicted after their TTL).\n *\n * **Auth snapshot note:** this store captures the `AuthMaterial` at construction\n * time and memoizes a single SDK client from it (`clientPromise`). This is\n * correct and sufficient for static API keys. If refreshable credentials\n * (short-lived OAuth/STS tokens) are added in the future, this memoization is\n * the seam that will need rework: the cached client would hold stale credentials\n * for the lifetime of a long-lived store instance. At that point, the store\n * will need to either rebuild the client on each operation or accept a\n * credential-resolver callback rather than a plain `AuthMaterial` value.\n * See ADR-020 in DECISIONS.md.\n */\nexport class GoogleCacheStore {\n private readonly auth: AuthMaterial\n private readonly clientOverride: GeminiCachesClientLike | undefined\n private readonly coalesce: boolean\n private readonly skewMs: number\n private readonly onDeleteError: (cacheName: string, err: unknown) => void\n private readonly logger: Logger | undefined\n private readonly now: () => number\n private readonly preflight: GoogleCacheStoreOptions['preflight']\n\n /** Memoised client promise — built at most once per store instance. */\n private clientPromise: Promise<GeminiCachesClientLike> | undefined\n\n /** In-process cache of live handles, keyed by `${model}:${stableKey}`. */\n private readonly entries: Map<string, EntryRecord> = new Map()\n\n /** In-flight create promises when coalescing is enabled. */\n private readonly inflight: Map<string, Promise<GoogleCacheHandle>> = new Map()\n\n constructor(opts: GoogleCacheStoreOptions) {\n this.auth = opts.auth\n this.clientOverride = opts.client\n this.coalesce = opts.coalesce ?? false\n this.skewMs = (opts.expirySkewSeconds ?? DEFAULT_SKEW_SECONDS) * 1000\n this.logger = opts.logger\n this.onDeleteError =\n opts.onDeleteError ??\n ((cacheName, err) => {\n if (this.logger !== undefined) {\n this.logger.error(\n { name: cacheName, error: redactSecrets(classifyError(err).message) },\n 'gemini.cache.delete.failed',\n )\n } else {\n console.error(\n `[GoogleCacheStore] delete failed for \"${cacheName}\":`,\n redactSecrets(classifyError(err).message),\n )\n }\n })\n this.now = opts.now ?? (() => Date.now())\n this.preflight = opts.preflight\n }\n\n private getClient(): Promise<GeminiCachesClientLike> {\n if (this.clientOverride !== undefined) return Promise.resolve(this.clientOverride)\n if (this.clientPromise === undefined) {\n this.clientPromise = buildCachesClient(this.auth)\n }\n return this.clientPromise\n }\n\n private isLive(handle: GoogleCacheHandle): boolean {\n return handle.expiresAt.getTime() - this.skewMs > this.now()\n }\n\n /**\n * Create a new cached content resource.\n *\n * The `expiresAt` on the returned handle is computed from the server's\n * `expireTime` when available, with a local-clock fallback of\n * `now + ttlSeconds * 1000`.\n */\n async create(input: {\n model: string\n ttlSeconds: number\n contents?: Content[]\n systemInstruction?: Content | string\n displayName?: string\n }): Promise<GoogleCacheHandle> {\n if (this.preflight !== undefined) {\n const counted = await this.preflight.countTokens({\n model: input.model,\n ...(input.contents !== undefined ? { contents: input.contents } : {}),\n ...(input.systemInstruction !== undefined\n ? { systemInstruction: input.systemInstruction }\n : {}),\n })\n if (counted < this.preflight.minTokens) {\n throw new LlmError(\n `GoogleCacheStore preflight: counted ${counted} token(s), below the configured ` +\n `minimum of ${this.preflight.minTokens} for model \"${input.model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n }\n\n const client = await this.getClient()\n\n const config: {\n ttl: string\n contents?: Content[]\n systemInstruction?: Content | string\n displayName?: string\n } = { ttl: `${input.ttlSeconds}s` }\n\n if (input.contents !== undefined) config.contents = input.contents\n if (input.systemInstruction !== undefined)\n config.systemInstruction = input.systemInstruction\n if (input.displayName !== undefined) config.displayName = input.displayName\n\n let resp: { name?: string; model?: string; expireTime?: string }\n try {\n resp = await client.create({ model: input.model, config })\n } catch (e) {\n throw classifyError(e)\n }\n\n if (resp.name === undefined || resp.name.length === 0) {\n // Provider fault, not caller fault: the SDK call succeeded but the\n // payload is malformed — classify as a server error. NOT retryable:\n // create() is side-effecting and not idempotent — the provider may have\n // already created the cached content even though the payload carries no\n // name, so there is no handle to clean up and an automatic retry could\n // orphan/duplicate provider-side resources.\n throw new LlmError('Cache create response missing required field: name', {\n kind: 'server',\n retryable: false,\n provider: 'google',\n })\n }\n\n const fallbackExpiry = new Date(this.now() + input.ttlSeconds * 1000)\n const expiresAt =\n resp.expireTime !== undefined && resp.expireTime.length > 0\n ? new Date(resp.expireTime)\n : fallbackExpiry\n\n return {\n cacheName: resp.name,\n model: resp.model ?? input.model,\n expiresAt,\n }\n }\n\n /**\n * Return a live cached-content handle, creating one if none exists or the\n * cached entry has expired (accounting for skew).\n *\n * Reuse is PROCESS-SCOPED only — this store instance's in-memory map.\n *\n * When `coalesce` is enabled, concurrent calls for the same key share one\n * in-flight create.\n */\n async getOrCreate(\n key: CacheKey,\n factory: () => Promise<{\n ttlSeconds: number\n contents?: Content[]\n systemInstruction?: Content | string\n }>,\n ): Promise<GoogleCacheHandle> {\n const mapKey = `${key.model}:${key.stableKey}`\n\n // Return existing live entry if available.\n const existing = this.entries.get(mapKey)\n if (existing !== undefined && this.isLive(existing.handle)) {\n return existing.handle\n }\n\n // If coalescing, piggyback on an in-flight create for this key.\n if (this.coalesce) {\n const inFlight = this.inflight.get(mapKey)\n if (inFlight !== undefined) {\n return inFlight\n }\n }\n\n const doCreate = async (): Promise<GoogleCacheHandle> => {\n const factoryResult = await factory()\n const handle = await this.create({\n model: key.model,\n ttlSeconds: factoryResult.ttlSeconds,\n ...(factoryResult.contents !== undefined\n ? { contents: factoryResult.contents }\n : {}),\n ...(factoryResult.systemInstruction !== undefined\n ? { systemInstruction: factoryResult.systemInstruction }\n : {}),\n })\n this.entries.set(mapKey, { handle, ttlSeconds: factoryResult.ttlSeconds })\n return handle\n }\n\n if (this.coalesce) {\n const promise = doCreate().finally(() => {\n this.inflight.delete(mapKey)\n })\n this.inflight.set(mapKey, promise)\n return promise\n }\n\n return doCreate()\n }\n\n /**\n * Extend the cache TTL if it will expire within `thresholdSeconds`.\n *\n * Fail-open: if the update call throws, the original handle is returned\n * unchanged. This method NEVER throws.\n *\n * @param handle - Handle to potentially refresh.\n * @param opts.thresholdSeconds - Extend if expiry is within this many seconds.\n * Default 300.\n * @param opts.extensionSeconds - New TTL to set. Default: original TTL from\n * entries map, or 3600 s when the handle was not created via `getOrCreate`.\n */\n async refreshIfExpiringSoon(\n handle: GoogleCacheHandle,\n opts?: { thresholdSeconds?: number; extensionSeconds?: number },\n ): Promise<GoogleCacheHandle> {\n const thresholdMs = (opts?.thresholdSeconds ?? 300) * 1000\n\n if (handle.expiresAt.getTime() - this.now() > thresholdMs) {\n // Not near expiry — return unchanged.\n return handle\n }\n\n // Find the original ttl from the entries map for this handle.\n let extensionSeconds = opts?.extensionSeconds\n if (extensionSeconds === undefined) {\n for (const entry of this.entries.values()) {\n if (entry.handle.cacheName === handle.cacheName) {\n extensionSeconds = entry.ttlSeconds\n break\n }\n }\n extensionSeconds = extensionSeconds ?? DEFAULT_EXTENSION_SECONDS\n }\n\n try {\n const client = await this.getClient()\n const resp = await client.update({\n name: handle.cacheName,\n config: { ttl: `${extensionSeconds}s` },\n })\n\n const fallbackExpiry = new Date(this.now() + extensionSeconds * 1000)\n const newExpiresAt =\n resp.expireTime !== undefined && resp.expireTime.length > 0\n ? new Date(resp.expireTime)\n : fallbackExpiry\n\n const newHandle: GoogleCacheHandle = {\n cacheName: handle.cacheName,\n model: handle.model,\n expiresAt: newExpiresAt,\n }\n\n // Update the entries map entry if this handle is tracked.\n for (const [k, entry] of this.entries.entries()) {\n if (entry.handle.cacheName === handle.cacheName) {\n this.entries.set(k, { handle: newHandle, ttlSeconds: extensionSeconds })\n break\n }\n }\n\n return newHandle\n } catch {\n // Fail-open: return original handle unchanged.\n return handle\n }\n }\n\n /**\n * Delete a cached content resource.\n *\n * Errors are forwarded to `onDeleteError` and NOT rethrown.\n * The handle is removed from the in-process entries map regardless.\n */\n async delete(handle: GoogleCacheHandle): Promise<void> {\n // Always remove from local map, even if delete fails.\n for (const [k, entry] of this.entries.entries()) {\n if (entry.handle.cacheName === handle.cacheName) {\n this.entries.delete(k)\n break\n }\n }\n\n try {\n const client = await this.getClient()\n await client.delete({ name: handle.cacheName })\n } catch (err) {\n this.onDeleteError(handle.cacheName, err)\n }\n }\n}\n","/**\n * geminiContentToMessages — migration utility: `@google/genai` `Content[]` →\n * any-llm's normalized `Message[]`.\n *\n * For consumers moving hand-authored `@google/genai` prompts onto this\n * library. Uses `@google/genai` TYPES ONLY (no runtime SDK dependency — the\n * package is a peer dep, imported here with `import type`).\n *\n * Reject-don't-map: every genai `Content`/`Part` shape this utility cannot\n * losslessly represent in any-llm's normalized types throws a typed\n * `LlmError('bad_request')` naming the offending field or kind. Nothing is\n * ever silently dropped — that silent-loss failure mode is exactly what this\n * utility exists to eliminate for migrating callers.\n *\n * Validation is an exhaustive own-key scan: the set of defined keys on each\n * `Part` must be EXACTLY one of the recognized combinations (`['text']`,\n * `['inlineData']`, `['inlineData', 'mediaResolution']`, `['fileData']`,\n * `['fileData', 'mediaResolution']`). Any other key — including unknown\n * future SDK fields — or any combination outside that set throws. Keys whose\n * value is `undefined` are treated as absent (genai types are all-optional;\n * only defined values count).\n *\n * @module\n */\n\nimport { LlmError } from '@gullabs/core'\nimport type { JsonValue, Message, Part } from '@gullabs/core'\nimport type { Content, Part as GenaiPart } from '@google/genai'\nimport { reserveProviderToolCallIds, resolveToolCallId } from './tool-call-id.js'\n\n/**\n * Input accepted by {@link geminiContentToMessages}.\n */\nexport interface GeminiContentToMessagesInput {\n /** Raw `@google/genai` conversation history to convert. */\n contents: Content[]\n /**\n * Raw `@google/genai` system instruction — either the SDK's shorthand\n * plain string, or a full `Content` (only text parts supported; any\n * non-text part throws).\n */\n systemInstruction?: Content | string\n}\n\n/**\n * Output produced by {@link geminiContentToMessages}.\n */\nexport interface GeminiContentToMessagesResult {\n /** Concatenated system text, present only when `systemInstruction` was given. */\n system?: string\n /** Normalized any-llm messages, one per input `Content`. */\n messages: Message[]\n}\n\nfunction badRequest(message: string): LlmError {\n return new LlmError(message, { kind: 'bad_request', retryable: false })\n}\n\n/**\n * Own keys of `obj` whose value is defined. genai types are all-optional;\n * a key explicitly set to `undefined` is treated as absent.\n */\nfunction definedKeys(obj: object): string[] {\n return Object.keys(obj).filter(\n (key) => (obj as Record<string, unknown>)[key] !== undefined,\n )\n}\n\n// ---------------------------------------------------------------------------\n// mediaResolution mapping (Gemini PartMediaResolutionLevel → our normalized hint)\n// ---------------------------------------------------------------------------\n\nfunction mapMediaResolutionLevel(\n level: string,\n location: string,\n): 'low' | 'medium' | 'high' {\n switch (level) {\n case 'MEDIA_RESOLUTION_LOW':\n return 'low'\n case 'MEDIA_RESOLUTION_MEDIUM':\n return 'medium'\n case 'MEDIA_RESOLUTION_HIGH':\n return 'high'\n default:\n throw badRequest(\n `${location}: unsupported Part.mediaResolution.level \"${level}\" — any-llm only ` +\n 'supports MEDIA_RESOLUTION_LOW, MEDIA_RESOLUTION_MEDIUM, MEDIA_RESOLUTION_HIGH.',\n )\n }\n}\n\n/**\n * Convert a defined `Part.mediaResolution` object to the normalized hint.\n *\n * Exhaustive own-key scan: the only representable key is `level`, and it must\n * carry a usable value. An explicit-but-empty `mediaResolution` (empty object,\n * or `level: undefined`) is ambiguous — the caller wrote something any-llm\n * cannot interpret — so it throws rather than being silently ignored.\n */\nfunction convertMediaResolution(\n mediaResolution: NonNullable<GenaiPart['mediaResolution']>,\n location: string,\n): 'low' | 'medium' | 'high' {\n const extraKeys = definedKeys(mediaResolution).filter((key) => key !== 'level')\n if (extraKeys.length > 0) {\n throw badRequest(\n `${location}: Part.mediaResolution keys [${extraKeys.join(', ')}] are not ` +\n 'representable in any-llm — only mediaResolution.level is supported.',\n )\n }\n\n if (mediaResolution.level === undefined) {\n throw badRequest(\n `${location}: Part.mediaResolution is present but carries no level — an ` +\n 'explicit-but-empty mediaResolution is ambiguous; set level or omit the field.',\n )\n }\n\n return mapMediaResolutionLevel(mediaResolution.level, location)\n}\n\n// ---------------------------------------------------------------------------\n// Part mapping (exhaustive own-key scan, reject-don't-map)\n// ---------------------------------------------------------------------------\n\n/**\n * Convert a single `@google/genai` `Part` to its any-llm equivalent.\n *\n * The defined-key set of the part must be exactly one of: `['text']`,\n * `['inlineData']`, `['inlineData', 'mediaResolution']`, `['fileData']`,\n * `['fileData', 'mediaResolution']`. Anything else — function calling,\n * executable code, tool results, thought-flagged parts, `thoughtSignature`,\n * `videoMetadata`, `partMetadata`, unknown future SDK fields, `text`\n * combined with any other key, or a part with zero recognized fields —\n * throws `LlmError('bad_request')` naming the offending key(s).\n */\nfunction convertPart(\n part: GenaiPart,\n location: string,\n nameCounts: Map<string, number>,\n reservedIds: Set<string>,\n): Part {\n const keys = definedKeys(part)\n const baseKeys = keys.filter(\n (key) => key === 'text' || key === 'inlineData' || key === 'fileData',\n )\n\n if (baseKeys.length === 0) {\n if (keys.includes('functionCall') && keys.every((k) => k === 'functionCall')) {\n const fc = (\n part as { functionCall?: { id?: string; name?: string; args?: unknown } }\n ).functionCall\n if (fc === undefined || typeof fc.name !== 'string' || fc.name.length === 0) {\n throw badRequest(`${location}: functionCall.name is required.`)\n }\n return {\n kind: 'tool-call',\n toolCallId: resolveToolCallId(fc.id, fc.name, nameCounts, reservedIds),\n toolName: fc.name,\n args: (fc.args ?? {}) as JsonValue,\n }\n }\n if (\n keys.includes('functionResponse') &&\n keys.every((k) => k === 'functionResponse')\n ) {\n const fr = (\n part as { functionResponse?: { id?: string; name?: string; response?: unknown } }\n ).functionResponse\n if (fr === undefined || typeof fr.name !== 'string' || fr.name.length === 0) {\n throw badRequest(`${location}: functionResponse.name is required.`)\n }\n return {\n kind: 'tool-result',\n toolCallId: resolveToolCallId(\n fr.id,\n fr.name,\n nameCounts,\n reservedIds,\n `result:${fr.name}`,\n ),\n toolName: fr.name,\n result: (fr.response ?? null) as JsonValue,\n }\n }\n if (keys.length === 0) {\n throw badRequest(\n `${location}: Part has no recognized fields set (expected exactly one of ` +\n 'text, inlineData, fileData).',\n )\n }\n throw badRequest(\n `${location}: Part keys [${keys.join(', ')}] are not supported by ` +\n 'geminiContentToMessages — only text, inlineData, fileData, functionCall, ' +\n 'and functionResponse parts can be represented in any-llm.',\n )\n }\n\n if (baseKeys.length > 1) {\n throw badRequest(\n `${location}: Part has more than one of text/inlineData/fileData set ` +\n `([${baseKeys.join(', ')}]) — geminiContentToMessages requires exactly one.`,\n )\n }\n\n const base = baseKeys[0] as 'text' | 'inlineData' | 'fileData'\n const extraKeys = keys.filter(\n (key) => key !== base && !(base !== 'text' && key === 'mediaResolution'),\n )\n if (extraKeys.length > 0) {\n throw badRequest(\n `${location}: Part keys [${extraKeys.join(', ')}] cannot be represented in ` +\n `any-llm alongside ${base} — nothing is silently dropped.`,\n )\n }\n\n if (part.text !== undefined) {\n return { kind: 'text', text: part.text }\n }\n\n if (part.inlineData !== undefined) {\n const inlineData = part.inlineData\n const inlineExtraKeys = definedKeys(inlineData).filter(\n (key) => key !== 'mimeType' && key !== 'data',\n )\n if (inlineExtraKeys.length > 0) {\n throw badRequest(\n `${location}: Part.inlineData keys [${inlineExtraKeys.join(', ')}] are not ` +\n 'representable in any-llm.',\n )\n }\n if (inlineData.mimeType === undefined) {\n throw badRequest(`${location}: Part.inlineData.mimeType is required.`)\n }\n if (inlineData.data === undefined) {\n throw badRequest(`${location}: Part.inlineData.data is required.`)\n }\n return {\n kind: 'inline-media',\n mimeType: inlineData.mimeType,\n data: inlineData.data,\n ...(part.mediaResolution !== undefined\n ? { mediaResolution: convertMediaResolution(part.mediaResolution, location) }\n : {}),\n }\n }\n\n if (part.fileData !== undefined) {\n const fileData = part.fileData\n const fileExtraKeys = definedKeys(fileData).filter(\n (key) => key !== 'fileUri' && key !== 'mimeType',\n )\n if (fileExtraKeys.length > 0) {\n throw badRequest(\n `${location}: Part.fileData keys [${fileExtraKeys.join(', ')}] are not ` +\n 'representable in any-llm.',\n )\n }\n if (fileData.fileUri === undefined) {\n throw badRequest(`${location}: Part.fileData.fileUri is required.`)\n }\n if (fileData.mimeType === undefined) {\n throw badRequest(`${location}: Part.fileData.mimeType is required.`)\n }\n return {\n kind: 'file-uri',\n uri: fileData.fileUri,\n mimeType: fileData.mimeType,\n ...(part.mediaResolution !== undefined\n ? { mediaResolution: convertMediaResolution(part.mediaResolution, location) }\n : {}),\n }\n }\n\n // Unreachable: baseKeys.length === 1 guarantees one of the branches above.\n throw badRequest(`${location}: Part has no recognized fields set.`)\n}\n\n// ---------------------------------------------------------------------------\n// Role mapping (no inference)\n// ---------------------------------------------------------------------------\n\nfunction convertRole(role: string | undefined, location: string): 'user' | 'assistant' {\n if (role === 'user') return 'user'\n if (role === 'model') return 'assistant'\n throw badRequest(\n `${location}: Content.role \"${String(role)}\" is not supported — only \"user\" and ` +\n '\"model\" are recognized. any-llm never infers a missing role.',\n )\n}\n\n// ---------------------------------------------------------------------------\n// systemInstruction mapping (NEVER inferred from contents)\n// ---------------------------------------------------------------------------\n\n/**\n * Concatenate the text parts of a `systemInstruction`.\n *\n * A string is used as-is. For a `Content`, the envelope's defined-key set\n * must be exactly `['parts']` (or empty) — `role`, or any unknown future\n * Content field, throws naming the key(s). Every part's defined-key set must\n * be exactly `['text']` — any other key (media, tool shapes, thought flags,\n * `mediaResolution`, unknown future fields) throws naming the offending\n * key(s). A `Content` with zero parts yields `''` (the caller explicitly\n * supplied a system instruction; the derivation is just empty).\n */\nfunction convertSystemInstruction(systemInstruction: Content | string): string {\n if (typeof systemInstruction === 'string') {\n return systemInstruction\n }\n\n const envelopeExtraKeys = definedKeys(systemInstruction).filter(\n (key) => key !== 'parts',\n )\n if (envelopeExtraKeys.length > 0) {\n throw badRequest(\n `systemInstruction: Content keys [${envelopeExtraKeys.join(', ')}] are not ` +\n 'supported on a system instruction — only parts is allowed.',\n )\n }\n\n const parts = systemInstruction.parts ?? []\n const textFragments: string[] = []\n\n parts.forEach((part, index) => {\n const keys = definedKeys(part)\n if (keys.length !== 1 || keys[0] !== 'text' || part.text === undefined) {\n const offending = keys.filter((key) => key !== 'text')\n const named = offending.length > 0 ? offending : keys\n throw badRequest(\n `systemInstruction.parts[${index}]: only text parts are allowed in a system ` +\n `instruction — part keys [${named.length > 0 ? named.join(', ') : 'none'}] ` +\n 'are not supported.',\n )\n }\n textFragments.push(part.text)\n })\n\n return textFragments.join('')\n}\n\n// ---------------------------------------------------------------------------\n// geminiContentToMessages\n// ---------------------------------------------------------------------------\n\n/**\n * Convert `@google/genai` `Content[]` / `Part[]` into any-llm's normalized\n * `{ system?, messages }` shape.\n *\n * A migration utility for callers moving hand-authored `@google/genai`\n * prompts onto any-llm. Exhaustive and reject-don't-map: any genai shape\n * that cannot be losslessly represented in any-llm's normalized types\n * throws `LlmError('bad_request')` naming the offending kind/field instead\n * of silently dropping it.\n *\n * `system` is derived ONLY from the explicit `systemInstruction` input —\n * never inferred from `contents`.\n *\n * @example\n * ```ts\n * // Before: hand-rolled @google/genai prompt\n * const contents: Content[] = [\n * { role: 'user', parts: [{ text: 'Describe this image.' }, { inlineData: { mimeType: 'image/png', data } }] },\n * { role: 'model', parts: [{ text: 'A red bicycle leaning against a brick wall.' }] },\n * ]\n *\n * // After: migrate onto any-llm's normalized shape in one call\n * import { geminiContentToMessages } from '@gullabs/google'\n *\n * const { system, messages } = geminiContentToMessages({\n * contents,\n * systemInstruction: 'You are a concise visual describer.',\n * })\n *\n * const result = await client.generate({ provider: 'google', model: 'gemini-2.5-pro', system, messages }, { auth })\n * ```\n */\nexport function geminiContentToMessages(\n input: GeminiContentToMessagesInput,\n): GeminiContentToMessagesResult {\n const system =\n input.systemInstruction !== undefined\n ? convertSystemInstruction(input.systemInstruction)\n : undefined\n\n const nameCounts = new Map<string, number>()\n const reservedIds = reserveProviderToolCallIds(\n input.contents.flatMap((content) =>\n (content.parts ?? []).flatMap((part) => {\n const p = part as {\n functionCall?: { id?: string }\n functionResponse?: { id?: string }\n }\n return [p.functionCall?.id, p.functionResponse?.id]\n }),\n ),\n )\n const messages: Message[] = input.contents.map((content, contentIndex) => {\n const location = `contents[${contentIndex}]`\n const envelopeExtraKeys = definedKeys(content).filter(\n (key) => key !== 'role' && key !== 'parts',\n )\n if (envelopeExtraKeys.length > 0) {\n throw badRequest(\n `${location}: Content keys [${envelopeExtraKeys.join(', ')}] are not ` +\n 'supported — only role and parts are allowed.',\n )\n }\n const role = convertRole(content.role, location)\n const parts = (content.parts ?? []).map((part, partIndex) =>\n convertPart(part, `${location}.parts[${partIndex}]`, nameCounts, reservedIds),\n )\n return { role, parts }\n })\n\n return { ...(system !== undefined ? { system } : {}), messages }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts","../src/reasoning-budget.ts","../src/json-schema.ts","../src/safety-settings.ts","../src/grounding.ts","../src/tool-call-id.ts","../src/flex-fallback.ts","../src/errors.ts","../src/platform-scheduler.ts","../src/pricing.ts","../src/cost.ts","../src/utf8.ts","../src/thought-signatures.ts","../src/adapter.ts","../src/model-config/cached-content.ts","../src/model-limits.ts","../src/model-config/gemini-2.5-pro.ts","../src/model-config/gemini-2.5-flash.ts","../src/model-config/gemini-2.5-flash-lite.ts","../src/model-config/gemini-3.1-flash-lite.ts","../src/model-config/gemini-3.1-pro-preview.ts","../src/model-config/gemini-3.5-flash-lite.ts","../src/model-config/gemini-3.6-flash.ts","../src/model-config/gemini-3.7-flash.ts","../src/model-config/gemini-3.8-flash.ts","../src/model-config/gemma-4-31b-it.ts","../src/model-config/gemma-4-26b-a4b-it.ts","../src/models.ts","../src/provider.ts","../src/file-store.ts","../src/cache-store.ts","../src/content-to-messages.ts"],"names":["LlmError","parseRetryAfter","classifyError","computeCost","microUsd","isRecord","sha256Hex","canonicalJson","isMediaTypeAdmitted","assertNever","assertModelMatchesDescriptor","assertInputMimeTypesAdmitted","assertJsonSchemaProfile","groundingMetadata","warnings","finishReason","z","maxOutputTokensSchema","toConfigKeys","toConfigJsonSchema","zodToStandardSchema","createModelRegistry","redactSecrets","assertMediaTypeAdmitted"],"mappings":";;;;;;AA0BO,SAAS,cAAc,IAAA,EAA4B;AACxD,EAAA,IACE,EAAE,QAAA,IAAY,IAAA,CAAA,IACd,OAAO,IAAA,CAAK,MAAA,KAAW,QAAA,IACvB,IAAA,CAAK,MAAA,CAAO,IAAA,EAAK,KAAM,E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ACA,GAAI,UAAA,CAAW,MAAA,GAAS,CAAA,GACpB,EAAE,sBAAA,EAAwB,EAAE,MAAA,EAAQ,EAAE,UAAA,EAAW,EAAE,KACnD;AAAC,GACP;AACF","file":"index.cjs","sourcesContent":["/**\n * Structural GeminiClientLike interface + buildGoogleClient factory.\n *\n * This module defines the structural interface the adapter depends on.\n * The real @google/genai SDK is imported ONLY in buildGoogleClient so tests\n * can inject a fake without pulling in the real SDK.\n *\n * @module\n */\n\nimport { LlmError } from '@gullabs/core'\nimport type { AuthMaterial } from '@gullabs/core'\nimport type { GoogleGenAI } from '@google/genai'\n\n// ---------------------------------------------------------------------------\n// Auth narrowing — Google only accepts ApiKeyAuth\n// ---------------------------------------------------------------------------\n\n/**\n * Narrows {@link AuthMaterial} to its `apiKey` string, rejecting the\n * dev-only `CliSessionAuth` variant.\n *\n * Google is a production API provider and only ever accepts API-key\n * credentials; `{ cliSession: true }` is reserved for the dev-only CLI\n * provider packages (`@gullabs/claude-cli`, `@gullabs/codex-cli`).\n */\nexport function requireApiKey(auth: AuthMaterial): string {\n if (\n !('apiKey' in auth) ||\n typeof auth.apiKey !== 'string' ||\n auth.apiKey.trim() === ''\n ) {\n throw new LlmError('@gullabs/google requires auth.apiKey', {\n kind: 'invalid_auth',\n retryable: false,\n provider: 'google',\n })\n }\n return auth.apiKey\n}\n\n// ---------------------------------------------------------------------------\n// Transport timeout defaults\n// ---------------------------------------------------------------------------\n\n/**\n * Default HTTP transport timeout for Gemini Flex service-tier calls (ms).\n *\n * The default per-attempt transport (httpOptions) timeout applied ONLY when a\n * flex call provides no explicit `timeoutMs`. Set to 25 minutes (1_500_000 ms)\n * to cover the ~20-minute flex workload ceiling with margin. The @google/genai\n * SDK defaults to 1 minute, which would terminate a long flex call prematurely.\n * Callers SHOULD still set `timeoutMs` for a precise per-attempt ceiling; this\n * value is only the backstop for callers that do not.\n */\nexport const FLEX_DEFAULT_TIMEOUT_MS = 1_500_000\n\n/**\n * Default HTTP transport timeout for Gemini standard-tier calls (ms).\n *\n * Used when a standard-tier request has no explicit `timeoutMs`. The adapter\n * also backs this with an AbortController so the limit is a real client-side\n * ceiling, not only an SDK transport hint.\n */\nexport const STANDARD_DEFAULT_TIMEOUT_MS = 300_000\n\n/**\n * Buffer added above `timeoutMs` when setting the SDK transport timeout.\n *\n * When `timeoutMs` is set, the engine arms an AbortSignal at exactly\n * `timeoutMs`. If the SDK transport timer fired at the same instant it\n * could preempt the signal and produce a raw SDK error instead of the\n * engine's clean `kind:'timeout'`. By setting the transport timeout to\n * `timeoutMs + TRANSPORT_TIMEOUT_BUFFER_MS` we ensure the engine's\n * AbortSignal always fires first.\n */\nexport const TRANSPORT_TIMEOUT_BUFFER_MS = 5_000\n\n/**\n * Largest delay a Node timer holds: above 2^31 - 1 ms a timer fires after 1 ms\n * (with a warning). The SDK arms one for every `httpOptions.timeout`, so a\n * larger transport timeout is rejected, not clamped.\n */\nexport const MAX_TIMER_MS = 2_147_483_647\n\n/**\n * Largest `timeoutMs` the gemini config schemas accept. The SDK deadline is\n * `timeoutMs` plus {@link TRANSPORT_TIMEOUT_BUFFER_MS} and must itself fit a\n * timer ({@link MAX_TIMER_MS}); a larger value is rejected, not clamped.\n */\nexport const GOOGLE_MAX_TIMEOUT_MS = MAX_TIMER_MS - TRANSPORT_TIMEOUT_BUFFER_MS\n\n// ---------------------------------------------------------------------------\n// Response shape — mirrors the @google/genai surface we actually consume\n// ---------------------------------------------------------------------------\n\n/** A single text/thought part in a Gemini candidate content. */\ninterface GeminiPartShape {\n text?: string\n /**\n * Present and `true` on thought-summary parts.\n * Real field name in @google/genai Candidate.content.parts: `thought`.\n */\n thought?: boolean\n functionCall?: { id?: string; name?: string; args?: unknown }\n /**\n * Opaque signature Gemini 3.x attaches to the first function call of a turn\n * (and sometimes to text parts). Real field: `Part.thoughtSignature`.\n */\n thoughtSignature?: string\n}\n\n/** A candidate returned by Gemini generateContent. */\ninterface GeminiCandidateShape {\n content?: {\n parts?: GeminiPartShape[]\n }\n /**\n * Why the model stopped.\n * Real SDK enum (FinishReason): \"STOP\", \"MAX_TOKENS\", \"SAFETY\",\n * \"RECITATION\", \"BLOCKLIST\", \"PROHIBITED_CONTENT\", etc.\n */\n finishReason?: string\n /** Human-readable detail Google sends with some finish reasons. */\n finishMessage?: string\n /** Per-category safety ratings of the candidate. */\n safetyRatings?: unknown[]\n /** Source-attribution metadata for recited content. */\n citationMetadata?: unknown\n /** Retrieval status of each URL the model was asked to read. */\n urlContextMetadata?: unknown\n /**\n * Grounding metadata returned when Google Search grounding is active.\n * Real SDK type: GroundingMetadata. Kept as `unknown` to avoid a hard\n * coupling to @google/genai types; cast to JsonValue at the adapter boundary.\n */\n groundingMetadata?: unknown\n}\n\n/**\n * Token usage metadata returned alongside a Gemini response.\n *\n * Real type: GenerateContentResponseUsageMetadata.\n * NOTE: thoughtsTokenCount is SEPARATE from candidatesTokenCount.\n * The adapter must add them to get GROSS outputTokens.\n */\nexport interface GeminiUsageMetadataShape {\n promptTokenCount?: number\n candidatesTokenCount?: number\n cachedContentTokenCount?: number\n thoughtsTokenCount?: number\n /** Tokens of tool results fed back to the model (Search results on Gemini 2.5). */\n toolUsePromptTokenCount?: number\n totalTokenCount?: number\n /** Provider-echoed actual tier; can differ from the requested tier. */\n serviceTier?: string\n /**\n * Prompt tokens per modality (`TEXT`, `IMAGE`, `VIDEO`, `AUDIO`, `DOCUMENT`);\n * the counts sum to `promptTokenCount` and include the cached part.\n */\n promptTokensDetails?: GeminiModalityTokenCount[]\n /** The cached part of the prompt per modality, when a cache was used. */\n cacheTokensDetails?: GeminiModalityTokenCount[]\n}\n\n/** One entry of `usageMetadata.promptTokensDetails` / `cacheTokensDetails`. */\ninterface GeminiModalityTokenCount {\n modality?: string\n tokenCount?: number\n}\n\n/**\n * Structural equivalent of @google/genai's GenerateContentResponse.\n * Only the fields the adapter reads are represented here.\n */\nexport interface GeminiResponseShape {\n candidates?: GeminiCandidateShape[]\n usageMetadata?: GeminiUsageMetadataShape\n /** Real field: GenerateContentResponse.modelVersion */\n modelVersion?: string\n /** Real field: GenerateContentResponse.responseId */\n responseId?: string\n /**\n * Safety-block metadata.\n * Real type: GenerateContentResponsePromptFeedback.\n * Present when the prompt (not output) was blocked by safety filters.\n */\n promptFeedback?: {\n /** Real type: BlockedReason (string enum). e.g. \"SAFETY\", \"OTHER\". */\n blockReason?: string\n blockReasonMessage?: string\n safetyRatings?: unknown[]\n }\n}\n\n// ---------------------------------------------------------------------------\n// Request / config shape — what the adapter sends to generateContent\n// ---------------------------------------------------------------------------\n\n/**\n * Per-part media-resolution hint emitted on inline/file parts.\n * Real type: @google/genai `PartMediaResolution`; `level` values come from\n * the `PartMediaResolutionLevel` string enum (we only emit the LOW/MEDIUM/HIGH\n * subset our normalized `mediaResolution` maps to).\n */\ninterface GeminiPartMediaResolution {\n level?: 'MEDIA_RESOLUTION_LOW' | 'MEDIA_RESOLUTION_MEDIUM' | 'MEDIA_RESOLUTION_HIGH'\n}\n\n/** A text part in a content object we construct. */\ninterface GeminiTextContentPart {\n text: string\n /** Replayed signature for this part (real field: `Part.thoughtSignature`). */\n thoughtSignature?: string\n}\n\n/**\n * An inline binary media part in a content object we construct.\n * `data` must be raw base64 — no `data:…;base64,` prefix.\n */\ninterface GeminiInlineDataContentPart {\n inlineData: {\n /** IANA media type, e.g. `\"image/png\"`. */\n mimeType: string\n /** Raw base64-encoded bytes (no data-URL prefix). */\n data: string\n }\n /** Optional per-part media-resolution hint (real field: `Part.mediaResolution`). */\n mediaResolution?: GeminiPartMediaResolution\n}\n\n/**\n * A provider-hosted file reference part in a content object we construct.\n * The Gemini service dereferences `fileUri` server-side.\n */\ninterface GeminiFileDataContentPart {\n fileData: {\n /** IANA media type of the referenced file. */\n mimeType: string\n /** Provider-assigned file URI, e.g. from the Gemini File API. */\n fileUri: string\n }\n /** Optional per-part media-resolution hint (real field: `Part.mediaResolution`). */\n mediaResolution?: GeminiPartMediaResolution\n}\n\n/**\n * Union of all part shapes the adapter may produce for `GeminiContent.parts`.\n * Each member (including the optional per-part `mediaResolution`) is a\n * structural subset of the real `@google/genai` `Part` type for the fields we use.\n */\ninterface GeminiFunctionCallPart {\n functionCall: { id?: string; name: string; args?: unknown }\n /** Replayed signature for this call (real field: `Part.thoughtSignature`). */\n thoughtSignature?: string\n}\n\ninterface GeminiFunctionResponsePart {\n functionResponse: { id?: string; name: string; response: unknown }\n}\n\nexport type GeminiContentPart =\n | GeminiTextContentPart\n | GeminiInlineDataContentPart\n | GeminiFileDataContentPart\n | GeminiFunctionCallPart\n | GeminiFunctionResponsePart\n\n/** A content object (message) we construct. */\nexport interface GeminiContent {\n role: string\n parts: GeminiContentPart[]\n}\n\n/**\n * Thinking configuration.\n * Real type: ThinkingConfig in @google/genai.\n * - thinkingBudget: 0 = DISABLED, -1 = AUTOMATIC\n * - thinkingLevel: ThinkingLevel enum (\"LOW\", \"MEDIUM\", \"HIGH\", \"MINIMAL\")\n */\ninterface GeminiThinkingConfig {\n includeThoughts?: boolean\n thinkingBudget?: number\n /**\n * Real type: ThinkingLevel enum.\n * Values: \"LOW\" | \"MEDIUM\" | \"HIGH\" | \"MINIMAL\" | \"THINKING_LEVEL_UNSPECIFIED\"\n */\n thinkingLevel?: string\n}\n\n/**\n * Config object passed in GenerateContentParameters.config.\n * Real type: GenerateContentConfig.\n * abortSignal is inside config, NOT in the top-level params.\n */\nexport interface GeminiGenerateConfig {\n systemInstruction?: { parts: GeminiContentPart[] }\n temperature?: number\n topP?: number\n topK?: number\n maxOutputTokens?: number\n stopSequences?: string[]\n responseMimeType?: string\n /**\n * Standard JSON Schema for the response, sent verbatim (real field:\n * `GenerateContentConfig.responseJsonSchema`). Never `responseSchema`, the\n * OpenAPI-dialect field (ADR-034).\n */\n responseJsonSchema?: unknown\n thinkingConfig?: GeminiThinkingConfig\n /** Real type: ServiceTier enum. Values: \"flex\" | \"standard\". */\n serviceTier?: string\n /** Real field: GenerateContentConfig.abortSignal (NOT in top-level params). */\n abortSignal?: AbortSignal\n /**\n * Per-request HTTP options forwarded to the @google/genai transport.\n * We use this to set a transport-level timeout that is >= the AbortSignal\n * deadline so the SDK fetch does not preempt the abort.\n *\n * Real field: GenerateContentConfig.httpOptions.timeout (milliseconds). No\n * other `httpOptions` field is admitted.\n */\n httpOptions?: { timeout?: number }\n tools?: Array<{\n functionDeclarations?: Array<{\n name: string\n description: string\n /** Standard JSON Schema, verbatim (real field: `parametersJsonSchema`). */\n parametersJsonSchema?: unknown\n }>\n googleSearch?: Record<string, never>\n }>\n toolConfig?: {\n functionCallingConfig?: {\n mode?: 'AUTO' | 'ANY' | 'NONE'\n allowedFunctionNames?: string[]\n }\n }\n}\n\n/**\n * Parameters for models.generateContent.\n * Real type: GenerateContentParameters.\n */\nexport interface GeminiGenerateParams {\n model: string\n contents: GeminiContent[]\n config?: GeminiGenerateConfig\n}\n\n/**\n * Parameters for counting tokens.\n *\n * With only `model` and `contents` the call is the SDK's `models.countTokens`.\n * With `systemInstruction` or `tools` the Developer API's SDK method cannot\n * carry them (it throws), so `buildGoogleClient` sends the REST `countTokens`\n * with a full `generateContentRequest` instead; the two forms are mutually\n * exclusive on the wire, so `contents` then travels inside the request.\n */\nexport interface GeminiCountTokensParams {\n model: string\n contents: GeminiContent[]\n systemInstruction?: { parts: GeminiContentPart[] }\n tools?: NonNullable<GeminiGenerateConfig['tools']>\n config?: {\n /**\n * Real field: CountTokensConfig.abortSignal. countTokens has no\n * tier-timeout dance (no flex/standard default ceilings): `ctx.signal`\n * is forwarded here directly, unlike `run()`'s combined timer signal.\n */\n abortSignal?: AbortSignal\n }\n}\n\n/**\n * Response shape for models.countTokens.\n * Real type: CountTokensResponse.\n */\nexport interface GeminiCountTokensResponseShape {\n totalTokens?: number\n cachedContentTokenCount?: number\n}\n\n// ---------------------------------------------------------------------------\n// GeminiClientLike — structural interface (no @google/genai dependency)\n// ---------------------------------------------------------------------------\n\n/**\n * Structural interface for the @google/genai client surface the adapter uses.\n *\n * Satisfied by:\n * - The real GoogleGenAI client (via buildGoogleClient wrapper).\n * - FakeGeminiClient from @gullabs/testing (its generateContent/countTokens\n * accept unknown).\n */\nexport interface GeminiClientLike {\n models: {\n generateContent(params: GeminiGenerateParams): Promise<GeminiResponseShape>\n countTokens(params: GeminiCountTokensParams): Promise<GeminiCountTokensResponseShape>\n }\n}\n\n// ---------------------------------------------------------------------------\n// buildGoogleClient — imports the real @google/genai SDK\n// ---------------------------------------------------------------------------\n\n/**\n * Root of the Gemini Developer API. The SDK client is built with it as its\n * explicit `baseUrl` and the REST `countTokens` below builds its URL from it,\n * so one endpoint serves every call. Pinning it also keeps the SDK from taking\n * a base URL out of the process environment (`GOOGLE_GEMINI_BASE_URL`), which\n * would send the call's API key to a host the caller never named.\n */\nconst GEMINI_API_ROOT = 'https://generativelanguage.googleapis.com'\n\n/**\n * A real `GoogleGenAI` client for `auth`, pinned to {@link GEMINI_API_ROOT}.\n * Shared by the generation client and both stores.\n *\n * @internal\n */\nexport async function newGoogleGenAI(auth: AuthMaterial): Promise<GoogleGenAI> {\n const { GoogleGenAI: Sdk } = await import('@google/genai')\n return new Sdk({\n apiKey: requireApiKey(auth),\n httpOptions: { baseUrl: `${GEMINI_API_ROOT}/` },\n })\n}\n\n/**\n * Build a real @google/genai client from AuthMaterial.\n *\n * Returns a GeminiClientLike wrapper around the real GoogleGenAI client.\n * Only API-key authentication is supported; Vertex AI is not.\n *\n * @param auth - API key credentials ({ apiKey }).\n */\nexport async function buildGoogleClient(auth: AuthMaterial): Promise<GeminiClientLike> {\n // Import the real SDK — only called at runtime when no client is injected.\n // The cast is safe: GeminiGenerateParams is a structural subset of\n // GenerateContentParameters; GeminiResponseShape is a subset of\n // GenerateContentResponse.\n const ai = await newGoogleGenAI(auth)\n\n return {\n models: {\n async generateContent(params: GeminiGenerateParams): Promise<GeminiResponseShape> {\n // Cast needed: our structural types are subsets of the real SDK types.\n const result = await (\n ai.models.generateContent as (params: unknown) => Promise<GeminiResponseShape>\n )(params)\n return result\n },\n async countTokens(\n params: GeminiCountTokensParams,\n ): Promise<GeminiCountTokensResponseShape> {\n if (params.systemInstruction !== undefined || params.tools !== undefined) {\n return countTokensWithRequest(requireApiKey(auth), params)\n }\n // Cast needed: our structural types are subsets of the real SDK types.\n const result = await (\n ai.models.countTokens as (\n params: unknown,\n ) => Promise<GeminiCountTokensResponseShape>\n )(params)\n return result\n },\n },\n }\n}\n\n// ---------------------------------------------------------------------------\n// REST countTokens with a full generateContentRequest\n// ---------------------------------------------------------------------------\n\n/**\n * Base of the Gemini Developer API (`v1beta`), the version the SDK's Developer\n * API client uses. Only the REST `countTokens` below builds a URL itself.\n */\nconst GEMINI_API_BASE = `${GEMINI_API_ROOT}/v1beta`\n\n/** Longest non-structured error body kept in an error message (characters). */\nconst MAX_ERROR_BODY_CHARS = 500\n\n/**\n * `models.countTokens` with `systemInstruction` and `tools`.\n *\n * The SDK's Developer API `countTokens` throws on both fields, but the REST\n * method accepts a `generateContentRequest` (a `GenerateContentRequest` with a\n * `models/<id>` name), which counts the whole request. `model` and `contents`\n * are mutually exclusive with it (ai.google.dev/api/tokens, dated 2026-08-17,\n * read 2026-10-03), so `contents` goes inside it.\n *\n * A non-2xx response is thrown as the SDK's own `ApiError` (status plus the\n * JSON body as the message), so `classifyGoogleError` reads it exactly like a\n * `generateContent` failure. `fetch` is the global, resolved per call.\n */\nasync function countTokensWithRequest(\n apiKey: string,\n params: GeminiCountTokensParams,\n): Promise<GeminiCountTokensResponseShape> {\n const { ApiError } = await import('@google/genai')\n const model = params.model.startsWith('models/')\n ? params.model\n : `models/${params.model}`\n const response = await fetch(`${GEMINI_API_BASE}/${model}:countTokens`, {\n method: 'POST',\n headers: { 'content-type': 'application/json', 'x-goog-api-key': apiKey },\n body: JSON.stringify({\n generateContentRequest: {\n model,\n contents: params.contents,\n ...(params.systemInstruction !== undefined\n ? { systemInstruction: params.systemInstruction }\n : {}),\n ...(params.tools !== undefined ? { tools: params.tools } : {}),\n },\n }),\n ...(params.config?.abortSignal !== undefined\n ? { signal: params.config.abortSignal }\n : {}),\n })\n const raw = await response.text()\n let parsed: unknown\n try {\n parsed = JSON.parse(raw)\n } catch {\n parsed = undefined\n }\n if (!response.ok) {\n // A structured `{ error: {...} }` body is passed on as sent. Anything else\n // (an HTML proxy page, a JSON body of another shape, an unparseable one) is\n // wrapped with its text cut short, so a page cannot flood the message.\n const body =\n typeof parsed === 'object' &&\n parsed !== null &&\n typeof (parsed as { error?: unknown }).error === 'object'\n ? parsed\n : {\n error: {\n message:\n raw.length > MAX_ERROR_BODY_CHARS\n ? `${raw.slice(0, MAX_ERROR_BODY_CHARS)}…`\n : raw,\n code: response.status,\n status: response.statusText,\n },\n }\n throw new ApiError({ message: JSON.stringify(body), status: response.status })\n }\n if (typeof parsed !== 'object' || parsed === null) {\n throw new LlmError('Gemini countTokens response is not a JSON object', {\n kind: 'server',\n retryable: true,\n provider: 'google',\n })\n }\n return parsed\n}\n","import type { ReasoningEffort } from '@gullabs/core'\n\nexport const GOOGLE_REASONING_EFFORT_BUDGET: Record<\n Exclude<ReasoningEffort, 'xhigh' | 'max'>,\n number\n> = {\n none: 0,\n low: 1024,\n medium: 8192,\n high: 24576,\n}\n\n/**\n * The `maxOutputTokens` below which a `high`-effort call on a level-reasoning\n * (Gemini 3.x) model draws a warning. The models have no thinking budget to\n * compare with the cap, so the figure comes from the measurement in\n * `docs/thinking-token-distribution.md` (2026-10-03, 3.x models at `high`:\n * thinking reached 4,000 tokens in 7 of 72 calls, about 10%, with a maximum\n * of 8,859): under 4,096 the cap can be used up before an answer appears. Lower\n * efforts have no such rule: at `medium` no call reached 4,000, and a rule\n * for them would rest on prompt-dependent tails the sample cannot pin.\n */\nexport const GOOGLE_HIGH_EFFORT_MIN_OUTPUT_TOKENS = 4096\n","/**\n * json-schema.ts — the JSON Schema keywords Google enforces (ADR-034).\n *\n * The adapter sends `output.jsonSchema` as `responseJsonSchema` and a tool's\n * `inputJsonSchema` as `parametersJsonSchema`, verbatim and in the host's key\n * order. Google accepts every keyword and silently ignores the ones it does\n * not support, so the adapter declares the keywords that are enforced and\n * rejects everything else (`bad_request`, with the path) before dispatch.\n *\n * Sources:\n * - Google's structured-output guide, read 2026-10-03\n * (https://ai.google.dev/gemini-api/docs/structured-output): types incl.\n * `[\"T\", \"null\"]`, `properties`, `required`, `additionalProperties` (boolean\n * or schema), `enum`, `format`, `minimum`/`maximum`, `items`, `prefixItems`,\n * `minItems`/`maxItems`. Its API reference treats `oneOf` as `anyOf`.\n * - Live probe P3, 2026-10-03, every available Gemini and Gemma model\n * (`__fixtures__/response-json-schema-2026-10-03.json`). Enforced and kept in\n * the set: `anyOf`, `$ref` / `$defs` (recursive too), `items: false`.\n * Ignored on every model and therefore rejected: `const`, `allOf`,\n * `exclusiveMinimum`, `multipleOf`, `uniqueItems`; `oneOf` with overlapping\n * branches returned a value a true `oneOf` forbids (read as `anyOf`).\n * - The rule for \"ignored\": a keyword is outside a model family's set when P3\n * saw it violated in at least 6 of 7 samples on every model of that family.\n * A keyword that was violated less often is supported but soft (obeyed\n * probabilistically; the worst Gemini cell was 4 of 7) and stays in the set:\n * `pattern`, `minLength` and `maxLength`. Hosts must still validate `output`.\n * - Gemma 4 violated `format` on 7 of 7 samples on both models and\n * `minLength`/`maxLength` on 7 of 7 and 6 of 7, so those three are outside\n * the Gemma set (`pattern` was violated on 0 of 7 and 4 of 7: soft, kept).\n * - `format` values: P3 exercised `date-time`, `date` and `email`. `time` is\n * named in Google's guide but no capture exercised it, so it is not enforced\n * here; it is rejected until a capture shows it.\n * - `pattern` is held to the regex subset (`patternSubset`): P3 probed one\n * simple pattern (`^[A-Z]{3}-[0-9]{4}$`) and nothing shows lookaround, `\\b`,\n * backreferences or property escapes are accepted and enforced.\n * - Tool schemas (`parametersJsonSchema`) use the same profile. Live evidence\n * for tools beyond trivial schemas rests on the output-schema probe (P3 ran\n * `responseJsonSchema` only); see the package README.\n *\n * @module\n */\n\nimport type { JsonSchemaProfile } from '@gullabs/core'\n\nconst GEMINI_KEYWORDS = [\n 'type',\n 'properties',\n 'required',\n 'additionalProperties',\n 'enum',\n 'anyOf',\n '$ref',\n '$defs',\n 'items',\n 'prefixItems',\n 'minItems',\n 'maxItems',\n 'minimum',\n 'maximum',\n 'format',\n 'pattern',\n 'minLength',\n 'maxLength',\n] as const\n\n/** Keywords Gemma 4 ignored in P3, so the adapter does not accept them there. */\nconst GEMMA_IGNORED_KEYWORDS: ReadonlySet<string> = new Set([\n 'format',\n 'minLength',\n 'maxLength',\n])\n\n/** Enforced `format` values: the ones P3 exercised and saw enforced. */\nconst GOOGLE_FORMATS = ['date-time', 'date', 'email'] as const\n\nconst GEMINI_PROFILE: JsonSchemaProfile = {\n provider: 'google',\n keywords: GEMINI_KEYWORDS,\n formats: GOOGLE_FORMATS,\n limits: {},\n circularRefs: true,\n booleanItems: true,\n patternSubset: true,\n}\n\nconst GEMMA_PROFILE: JsonSchemaProfile = {\n ...GEMINI_PROFILE,\n keywords: GEMINI_KEYWORDS.filter((keyword) => !GEMMA_IGNORED_KEYWORDS.has(keyword)),\n}\n\n/**\n * The keyword profile the adapter enforces for a model.\n *\n * @param canonicalModel The resolved descriptor's canonical `model`, never the\n * request string (which may be a declared alias).\n */\nexport function googleJsonSchemaProfile(canonicalModel: string): JsonSchemaProfile {\n return canonicalModel.startsWith('gemma-') ? GEMMA_PROFILE : GEMINI_PROFILE\n}\n","/**\n * The `safetySettings` categories and thresholds Gemini documents.\n *\n * Sources, read 2026-10-03:\n *\n * - Categories: ai.google.dev/api/generate-content (`HarmCategory`: hate speech,\n * sexually explicit, dangerous content, harassment, civic integrity,\n * jailbreak) and ai.google.dev/gemini-api/docs/safety-settings (page dated\n * 2026-09-17, the adjustable filters). The SDK's `HARM_CATEGORY_IMAGE_*`\n * values are marked \"not supported in Gemini API\" and are not admitted.\n * - Thresholds: ai.google.dev/gemini-api/docs/safety-settings (page dated\n * 2026-09-17), cross-checked against the SDK's `HarmBlockThreshold` enum.\n *\n * The adapter and every model's config schema read these lists, so a typo is\n * rejected before dispatch instead of costing a round trip.\n *\n * @module\n */\n\nexport const GOOGLE_SAFETY_CATEGORIES = [\n 'HARM_CATEGORY_HARASSMENT',\n 'HARM_CATEGORY_HATE_SPEECH',\n 'HARM_CATEGORY_SEXUALLY_EXPLICIT',\n 'HARM_CATEGORY_DANGEROUS_CONTENT',\n 'HARM_CATEGORY_CIVIC_INTEGRITY',\n 'HARM_CATEGORY_JAILBREAK',\n] as const\n\nexport const GOOGLE_SAFETY_THRESHOLDS = [\n 'HARM_BLOCK_THRESHOLD_UNSPECIFIED',\n 'BLOCK_LOW_AND_ABOVE',\n 'BLOCK_MEDIUM_AND_ABOVE',\n 'BLOCK_ONLY_HIGH',\n 'BLOCK_NONE',\n 'OFF',\n] as const\n\nexport type GoogleSafetyCategory = (typeof GOOGLE_SAFETY_CATEGORIES)[number]\nexport type GoogleSafetyThreshold = (typeof GOOGLE_SAFETY_THRESHOLDS)[number]\n","/**\n * normalizeGroundingCitations — shape Gemini's raw groundingMetadata\n * (`groundingChunks`, `groundingSupports`, `webSearchQueries`) into a clean,\n * deduplicated citation list and a search-query count.\n *\n * These are pure shaping helpers, NOT request validation. They NEVER throw:\n * any missing/malformed input yields an empty or absent result.\n *\n * @module\n */\n\nimport type { Citation, JsonValue } from '@gullabs/core'\n\n/**\n * Derive a human-readable source name for a hostname, stripping a leading\n * `www.` label (e.g. `www.example.com` → `example.com`).\n */\nfunction hostnameFrom(url: URL): string {\n return url.hostname.startsWith('www.') ? url.hostname.slice(4) : url.hostname\n}\n\n/**\n * Shape a single grounding chunk into a `Citation`, or `undefined` if the\n * chunk is malformed (missing/invalid `web.uri`, or a `web.uri` that isn't\n * a well-formed http(s) URL with a hostname).\n *\n * Real SDK shape (`@google/genai` `GroundingChunk.web`): `{ uri, title, domain }`,\n * which in practice is always an http(s) URL. This helper only ever produces\n * http(s) citations — any other scheme (`javascript:`, `mailto:`, `data:`,\n * `file:`, etc.) is treated as a malformed chunk and skipped, since callers\n * may render `Citation.url` as a clickable link.\n *\n * `title`, when present, is the human-readable page title and is preferred\n * over the hostname as `sourceName`; the hostname (parsed from `uri`) is the\n * robust fallback when `title` is absent.\n */\nfunction toCitation(chunk: unknown): Citation | undefined {\n if (chunk === null || typeof chunk !== 'object') return undefined\n\n const web = (chunk as Record<string, unknown>)['web']\n if (web === null || typeof web !== 'object') return undefined\n\n const uri = (web as Record<string, unknown>)['uri']\n if (typeof uri !== 'string' || uri.length === 0) return undefined\n\n let parsed: URL\n try {\n parsed = new URL(uri)\n } catch {\n return undefined\n }\n\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return undefined\n if (parsed.hostname === '') return undefined\n\n const title = (web as Record<string, unknown>)['title']\n const hasTitle = typeof title === 'string' && title.length > 0\n const sourceName = hasTitle ? title : hostnameFrom(parsed)\n\n return {\n url: uri,\n ...(hasTitle ? { title } : {}),\n sourceName,\n }\n}\n\n/**\n * The answer text one `Segment.partIndex` refers to, and where it sits in `LlmResult.text`.\n *\n * `partIndex` counts the candidate's parts WITHOUT thought parts: a live\n * capture (`__fixtures__/grounding-supports-2026-10-03.json`) put the answer at\n * `candidate.content.parts` index 2 after two thought parts, and its segments\n * named it with an omitted `partIndex` (zero). Whether a non-thought function\n * call part is counted is not captured; `segment.text` guards that guess.\n */\nexport interface AnswerTextPart {\n text: string\n /** UTF-16 offset of this part's text within the joined answer text. */\n offset: number\n}\n\n/**\n * The number of UTF-16 code units of `text` that precede UTF-8 byte offset\n * `byte`, or `undefined` when `byte` is out of range or splits a character.\n */\nfunction utf16IndexAtByte(text: string, byte: number): number | undefined {\n if (!Number.isInteger(byte) || byte < 0) return undefined\n let bytes = 0\n let units = 0\n if (byte === 0) return 0\n for (const char of text) {\n const code = char.codePointAt(0) as number\n bytes += code < 0x80 ? 1 : code < 0x800 ? 2 : code < 0x10000 ? 3 : 4\n units += char.length\n if (bytes === byte) return units\n if (bytes > byte) return undefined\n }\n return undefined\n}\n\n/**\n * Convert a Gemini grounding `Segment` into a range of the joined answer text.\n *\n * Gemini measures `startIndex` and `endIndex` in UTF-8 bytes from the start of\n * the answer part named by `partIndex` (confirmed on a live capture with\n * Japanese text and emoji: not UTF-16, not code points); an omitted field is\n * zero (proto3 JSON drops zeros). The result is in UTF-16 code units of the\n * joined text, as `Citation.textRange` promises.\n *\n * `segment.text` is Gemini's own copy of the span. When it is a string it must\n * equal the slice of the answer at the converted range; a mismatch means this\n * conversion disagrees with the provider (different part counting, a path not\n * captured), so the range is dropped and `onDropped` says why, rather than\n * emitting a range that points at the wrong span. A segment that names no\n * answer part, or whose offsets do not land on character boundaries, has no\n * range.\n */\nfunction segmentRange(\n segment: unknown,\n answerParts: ReadonlyArray<AnswerTextPart | undefined>,\n joined: string,\n onDropped: (message: string) => void,\n): { start: number; end: number } | undefined {\n if (segment === null || typeof segment !== 'object') return undefined\n const raw = segment as Record<string, unknown>\n const partIndex = raw['partIndex'] ?? 0\n const startByte = raw['startIndex'] ?? 0\n const endByte = raw['endIndex']\n if (\n typeof partIndex !== 'number' ||\n typeof startByte !== 'number' ||\n typeof endByte !== 'number'\n ) {\n return undefined\n }\n const part = answerParts[partIndex]\n if (part === undefined) return undefined\n const start = utf16IndexAtByte(part.text, startByte)\n const end = utf16IndexAtByte(part.text, endByte)\n if (start === undefined || end === undefined || end <= start) return undefined\n const range = { start: part.offset + start, end: part.offset + end }\n const expected = raw['text']\n if (typeof expected === 'string' && joined.slice(range.start, range.end) !== expected) {\n onDropped(\n `google: dropped a textRange for a grounding segment (partIndex ${partIndex}, bytes ${startByte}-${endByte}): the answer at that range does not equal segment.text. The source stays cited without a range.`,\n )\n return undefined\n }\n return range\n}\n\n/**\n * Which chunk indices `groundingSupports` points at, and the first range each\n * one supports. `undefined` when the metadata has no `groundingSupports`\n * array, because the provider then says nothing about what the text cites.\n */\nfunction readSupports(\n groundingMetadata: Record<string, unknown>,\n answerParts: ReadonlyArray<AnswerTextPart | undefined>,\n onDropped: (message: string) => void,\n): Map<number, { start: number; end: number } | undefined> | undefined {\n const supports = groundingMetadata['groundingSupports']\n if (!Array.isArray(supports)) return undefined\n const joined = answerParts.map((part) => part?.text ?? '').join('')\n const byChunk = new Map<number, { start: number; end: number } | undefined>()\n for (const support of supports) {\n if (support === null || typeof support !== 'object') continue\n const record = support as Record<string, unknown>\n const indices = record['groundingChunkIndices']\n if (!Array.isArray(indices)) continue\n const range = segmentRange(record['segment'], answerParts, joined, onDropped)\n for (const index of indices) {\n if (typeof index !== 'number') continue\n // The first usable range wins; any support keeps the chunk cited.\n if (!byChunk.has(index) || (byChunk.get(index) === undefined && range)) {\n byChunk.set(index, range)\n }\n }\n }\n return byChunk\n}\n\n/**\n * Shape Gemini's raw `groundingMetadata.groundingChunks` into a clean,\n * deduplicated citation list (deduplicated by URL, first-seen order).\n *\n * `groundingSupports`, when present, sets `cited` (a support points at the\n * chunk) and `textRange` (the first segment that does). Chunks that share a URL\n * merge: cited if any is, first range wins. `answerParts` maps a segment's\n * `partIndex` to the answer text it indexes; without it no `textRange` is set.\n * `onDropped` receives a message for each range dropped because it disagrees\n * with the segment's own text.\n *\n * Accepts `unknown` since `groundingMetadata` arrives as raw JSON on\n * `providerMetadata` (see `docs/grounded-structured.md`). Never throws —\n * any missing/malformed top-level shape returns `[]`; a malformed individual\n * chunk is skipped rather than failing the whole array.\n */\nexport function normalizeGroundingCitations(\n groundingMetadata: unknown,\n answerParts: ReadonlyArray<AnswerTextPart | undefined> = [],\n onDropped: (message: string) => void = () => {},\n): Citation[] {\n if (groundingMetadata === null || typeof groundingMetadata !== 'object') return []\n\n const metadata = groundingMetadata as Record<string, unknown>\n const chunks = metadata['groundingChunks']\n if (!Array.isArray(chunks)) return []\n\n const supports = readSupports(metadata, answerParts, onDropped)\n const byUrl = new Map<string, Citation>()\n\n chunks.forEach((chunk, chunkIndex) => {\n const citation = toCitation(chunk)\n if (citation === undefined) return\n const existing = byUrl.get(citation.url)\n const target = existing ?? citation\n if (existing === undefined) byUrl.set(citation.url, citation)\n if (supports === undefined) return\n if (supports.has(chunkIndex)) {\n target.cited = true\n const range = supports.get(chunkIndex)\n if (range !== undefined && target.textRange === undefined) {\n target.textRange = { ...range }\n }\n } else if (target.cited === undefined) {\n target.cited = false\n }\n })\n\n return [...byUrl.values()]\n}\n\n/**\n * The number of search queries Gemini reports in `webSearchQueries`, counted as\n * occurrences (a repeated query counts each time) of non-empty strings: an\n * empty string or a non-string entry is not a query, and neither is billed nor\n * proves Search ran. `undefined` when the metadata is absent, has no\n * `webSearchQueries` array, or has a non-empty array that names no query: the\n * count is unknown, which is different from a reported zero (an empty array).\n */\nexport function countWebSearchQueries(groundingMetadata: unknown): number | undefined {\n if (groundingMetadata === null || typeof groundingMetadata !== 'object') {\n return undefined\n }\n const queries = (groundingMetadata as Record<string, unknown>)['webSearchQueries']\n if (!Array.isArray(queries)) return undefined\n const named = queries.filter((q) => typeof q === 'string' && q.length > 0).length\n return named === 0 && queries.length > 0 ? undefined : named\n}\n\n/**\n * `groundingMetadata.searchEntryPoint`, the Search Suggestions widget Google\n * requires a grounded answer to display, when it is a non-empty object.\n */\nexport function readSearchEntryPoint(\n groundingMetadata: unknown,\n): { [key: string]: JsonValue } | undefined {\n if (groundingMetadata === null || typeof groundingMetadata !== 'object') {\n return undefined\n }\n const entry = (groundingMetadata as Record<string, unknown>)['searchEntryPoint']\n if (entry === null || typeof entry !== 'object' || Array.isArray(entry)) {\n return undefined\n }\n return Object.keys(entry).length > 0\n ? (entry as { [key: string]: JsonValue })\n : undefined\n}\n","/**\n * Unique Gemini toolCallId allocation.\n *\n * Gemini does not always return a `functionCall.id` (the live capture shows the\n * Developer API doing so, `call_<number>`, but a response may omit it). When it\n * does not, the library synthesizes `anyllm_call_<name>_<n>`. A synthesized id\n * is library bookkeeping: it is never sent to Gemini (pairing of a response to\n * its call is by name and order, which is what Gemini documents), so it cannot\n * confuse the API, and it is allocated so it is unique among every id already\n * in the request's history. Provider-supplied ids are reserved first so a\n * fallback never collides with them, even when the provider id appears after an\n * id-less sibling.\n */\n\nconst SYNTHESIZED_PREFIX = 'anyllm_call_'\n\n/** Whether `id` was synthesized by the library (and so must not be sent to Gemini). */\nexport function isSynthesizedToolCallId(id: string): boolean {\n return id.startsWith(SYNTHESIZED_PREFIX)\n}\n\n/** Collects non-empty provider-supplied ids so fallbacks skip them. */\nexport function reserveProviderToolCallIds(\n ids: Iterable<string | undefined>,\n): Set<string> {\n const reserved = new Set<string>()\n for (const id of ids) {\n if (typeof id === 'string' && id.length > 0) reserved.add(id)\n }\n return reserved\n}\n\n/**\n * Next `anyllm_call_${toolName}_${n}` that is not in `reserved`.\n *\n * `counterKey` lets functionCall vs functionResponse keep independent\n * sequences so two id-less pairs of the same name still line up.\n */\nfunction nextFallbackToolCallId(\n toolName: string,\n counters: Map<string, number>,\n reserved: Set<string>,\n counterKey: string = toolName,\n): string {\n let n = counters.get(counterKey) ?? 0\n let id: string\n do {\n n += 1\n id = `${SYNTHESIZED_PREFIX}${toolName}_${n}`\n } while (reserved.has(id))\n counters.set(counterKey, n)\n return id\n}\n\nexport function resolveToolCallId(\n providerId: string | undefined,\n toolName: string,\n counters: Map<string, number>,\n reserved: Set<string>,\n counterKey?: string,\n): string {\n if (typeof providerId === 'string' && providerId.length > 0) {\n return providerId\n }\n return nextFallbackToolCallId(toolName, counters, reserved, counterKey ?? toolName)\n}\n","import type { LlmError } from '@gullabs/core'\n\n/**\n * True when a failed Flex call may be retried once on the Standard tier\n * because Flex capacity, not the caller's quota, ran out.\n *\n * Only HTTP 503 counts. Google's Flex page (ai.google.dev/gemini-api/docs/\n * flex-inference, read 2026-10-03, page dated 2026-09-23) lists two failures\n * when capacity is unavailable, 503 \"The system is currently at capacity\" and\n * 429 \"Rate limits or resource exhaustion\", but documents no field that tells\n * a capacity 429 from a quota 429, and no capture of either 429 exists. A 429\n * is therefore the ordinary rate-limit path (the provider's `RetryInfo` delay\n * is honoured, no Standard dispatch, no tier pin): dispatching Standard at once\n * would undercut the delay, add a call to a rate-limited project and bill the\n * logical call at the Standard rate. Nothing in the message text is read.\n *\n * `err` is the classified error.\n */\nexport function isGeminiCapacityError(err: LlmError): boolean {\n return err.httpStatus === 503\n}\n","/**\n * classifyGoogleError — reclassify a raw thrown value into a typed\n * {@link LlmError} for @gullabs/google.\n *\n * Thin wrapper around `@gullabs/core`'s `classifyError`, which already routes\n * by HTTP status first, treats a transport failure (`fetch failed`, an errno on\n * the cause chain) as a retryable `server` error and maps 404/413 to\n * `bad_request`. This module adds the overlays Gemini's structured error body\n * supports (ADR-028 style: only the parsed body, never free text):\n *\n * - `RetryInfo.retryDelay` becomes `retryAfterMs` (the SDK's `ApiError` keeps no\n * headers, so the body is the only place Google puts the delay).\n * - A `QuotaFailure` whose quota id contains `PerDay` is a daily quota: it\n * cannot recover before the next day, so it is `rate_limited` with\n * `retryable: false` and `reason: 'daily_quota'`.\n * - `ErrorInfo.reason` `API_KEY_INVALID` / `API_KEY_EXPIRED` is `invalid_auth`.\n * Google sends the invalid-key case as HTTP 400, which would otherwise read\n * as a caller bug (live capture, probe P6, 2026-10-03). `API_KEY_EXPIRED` is\n * mapped from Google's documented reason set; an expired key could not be\n * produced to capture it.\n * - A 403 whose body message is `CachedContent not found (or permission\n * denied)` is a stale `cachedContent` reference: `bad_request` with\n * `reason: 'cache_not_found'` (probe P6). Google sends no structured reason\n * for it, so the body's `message` field is the only signal, and a genuine\n * permission failure cannot be told apart.\n *\n * @module\n */\n\nimport { LlmError, classifyError, parseRetryAfter } from '@gullabs/core'\n\n/** The structured body the SDK serializes into `ApiError.message`. */\ninterface GoogleErrorBody {\n /** `error.status`, the gRPC status name (`RESOURCE_EXHAUSTED`, `UNAVAILABLE`, ...). */\n status?: string\n /** `error.message`. */\n message?: string\n /** `error.details`, as sent. */\n details: readonly Record<string, unknown>[]\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Reads the structured Gemini error body from a raw thrown `ApiError`, or from\n * an `LlmError` whose `cause` is one. `undefined` when the value carries no\n * parseable `{ error: {...} }` body (a transport failure, a plain `Error`).\n */\nfunction parseGoogleErrorBody(rawErr: unknown): GoogleErrorBody | undefined {\n const source = rawErr instanceof LlmError ? rawErr.cause : rawErr\n if (!(source instanceof Error)) return undefined\n let parsed: unknown\n try {\n parsed = JSON.parse(source.message)\n } catch {\n return undefined\n }\n if (!isRecord(parsed) || !isRecord(parsed['error'])) return undefined\n const error = parsed['error']\n const details = Array.isArray(error['details']) ? error['details'].filter(isRecord) : []\n return {\n ...(typeof error['status'] === 'string' ? { status: error['status'] } : {}),\n ...(typeof error['message'] === 'string' ? { message: error['message'] } : {}),\n details,\n }\n}\n\nfunction detailOfType(body: GoogleErrorBody, type: string): Record<string, unknown>[] {\n return body.details.filter((d) => d['@type'] === `type.googleapis.com/${type}`)\n}\n\n/** `ErrorInfo.reason` values of the details, in order. */\nfunction errorInfoReasons(body: GoogleErrorBody): string[] {\n return detailOfType(body, 'google.rpc.ErrorInfo').flatMap((d) =>\n typeof d['reason'] === 'string' ? [d['reason']] : [],\n )\n}\n\n/** True when a `QuotaFailure` violation's `quotaId` names a per-day quota. */\nfunction isDailyQuota(body: GoogleErrorBody): boolean {\n return detailOfType(body, 'google.rpc.QuotaFailure').some(\n (failure) =>\n Array.isArray(failure['violations']) &&\n failure['violations'].some(\n (v) =>\n isRecord(v) &&\n typeof v['quotaId'] === 'string' &&\n v['quotaId'].includes('PerDay'),\n ),\n )\n}\n\n// A protobuf Duration in JSON: decimal seconds (at most 9 fractional digits)\n// followed by `s`. Anything else (`\"3\"`, `\"1h\"`, `\"6m0s\"`) is not a Duration.\nconst PROTO_DURATION = /^\\d+(?:\\.\\d{1,9})?s$/\n\n/**\n * The text of a `RetryInfo.retryDelay`. The documented JSON form is the string\n * `\"34s\"`; an object `{ seconds, nanos }` (the proto field layout, which a\n * proxy or SDK may hand over unconverted) is rendered to the same text.\n * `undefined` for anything that is not a Duration.\n */\nfunction durationText(delay: unknown): string | undefined {\n if (typeof delay === 'string') return PROTO_DURATION.test(delay) ? delay : undefined\n if (!isRecord(delay)) return undefined\n const { seconds, nanos } = delay\n const whole =\n typeof seconds === 'number' && Number.isSafeInteger(seconds) && seconds >= 0\n ? String(seconds)\n : typeof seconds === 'string' && /^\\d+$/.test(seconds)\n ? seconds\n : seconds === undefined\n ? '0'\n : undefined\n const fraction =\n typeof nanos === 'number' && Number.isInteger(nanos) && nanos >= 0 && nanos < 1e9\n ? String(nanos).padStart(9, '0')\n : nanos === undefined\n ? '0'\n : undefined\n return whole !== undefined && fraction !== undefined\n ? `${whole}.${fraction}s`\n : undefined\n}\n\n/**\n * `RetryInfo.retryDelay` in milliseconds. It is a protobuf Duration written as\n * decimal seconds with an `s` suffix (`\"34s\"`, `\"34.5s\"`); a value that is not\n * a Duration is ignored, and core's `parseRetryAfter` applies the shared\n * rounding and cap. A zero delay is not a delay (`undefined`), so the caller's\n * own back-off applies.\n */\nfunction retryDelayMs(body: GoogleErrorBody): number | undefined {\n for (const info of detailOfType(body, 'google.rpc.RetryInfo')) {\n const text = durationText(info['retryDelay'])\n if (text === undefined) continue\n const ms = parseRetryAfter({ 'retry-after': text }, Date.now())\n if (ms !== undefined) return ms\n }\n return undefined\n}\n\nconst API_KEY_REASONS = new Set(['API_KEY_INVALID', 'API_KEY_EXPIRED'])\nconst STALE_CACHE_MESSAGE = 'CachedContent not found'\n\n/**\n * Whether a raw error from a delete call says the resource is already gone, so\n * the delete is idempotent: HTTP 404 or `NOT_FOUND`, or HTTP 403 whose message\n * says the resource is not found or \"may not exist\"; an error with no status at\n * all is not-found when its message names a file or cache that was not found.\n * Any other known status (a 500 whose message says \"file not found\") is a\n * failed delete; a status is known wherever core reads one (`status`,\n * `statusCode`, `code`, `response`, `error`, a `cause`, as a number or a\n * numeric string) or in `httpStatus`. Google answers an unknown\n * or expired file id (and an unknown or expired cache) with that 403, not a 404:\n * the `CachedContent not found (or permission denied)` shape is a live capture\n * (probe P6); the Files API wording (\"You do not have permission to access the\n * File ... or it may not exist\") is quoted by public bug reports and is not\n * captured here (`error-bodies-2026-10-03.json`, `reported`). A real permission\n * failure carries the same status and cannot be told apart, which is why a\n * file or cache delete treats the shape as success.\n */\nexport function isGoogleNotFoundError(err: unknown): boolean {\n if (typeof err !== 'object' || err === null) return false\n const obj = err as Record<string, unknown>\n // The HTTP status core reads from an error (`status`, `statusCode`, `code`,\n // `response.*`, `error.*`, then each `cause`; a number or a three-digit\n // numeric string), plus the `httpStatus` field an `LlmError` carries.\n const httpStatus = classifyError(err).httpStatus ?? numericStatus(obj['httpStatus'])\n if (\n httpStatus === 404 ||\n obj['status'] === 'NOT_FOUND' ||\n obj['code'] === 'NOT_FOUND'\n ) {\n return true\n }\n const body = parseGoogleErrorBody(err)\n const message =\n body?.message ?? (typeof obj['message'] === 'string' ? obj['message'] : '')\n if (httpStatus === 403) return /may not exist|not found/i.test(message)\n // Message-only detection is for an error that carries no status at all. An\n // error with a known status is not-found only in the documented cases above:\n // a 500 whose message mentions a file that was not found is a failed delete.\n const statusKnown =\n httpStatus !== undefined ||\n body?.status !== undefined ||\n typeof obj['status'] === 'string' ||\n [obj['status'], obj['code']].some((value) => typeof value === 'number')\n if (statusKnown) return false\n return /not\\s*found|404/i.test(message) && /file|cachedcontent/i.test(message)\n}\n\n/** A status written as a number or a three-digit numeric string. */\nfunction numericStatus(value: unknown): number | undefined {\n const n =\n typeof value === 'number'\n ? value\n : typeof value === 'string' && /^\\d{3}$/.test(value.trim())\n ? Number(value)\n : undefined\n return n !== undefined && Number.isInteger(n) && n >= 100 && n <= 599 ? n : undefined\n}\n\n/** Optional extra fields threaded onto the returned {@link LlmError}. */\nexport interface ClassifyGoogleErrorExtra {\n /** Service tier actually attempted by the provider when known. */\n servedServiceTier?: string\n /**\n * Set by the adapter when its own client-side ceiling, or the SDK's transport\n * timer, ended the call (the caller and the engine's deadline had not\n * aborted): what happened, in words. The error is then a `timeout` that is not\n * retryable, `reason: 'transport_timeout'`.\n */\n transportTimeout?: string\n}\n\n/**\n * Classify a raw error thrown from a `@google/genai` client call into a\n * typed {@link LlmError} always tagged `provider: 'google'`.\n *\n * Delegates to `@gullabs/core`'s `classifyError` (an already-classified\n * `LlmError` passes through unchanged), applies the structured-body overlays\n * described in the module header, and rebuilds the result with\n * `provider: 'google'` forced on, so every error surfaced by this adapter is\n * tagged even one injected pre-classified.\n */\nexport function classifyGoogleError(\n rawErr: unknown,\n extra?: ClassifyGoogleErrorExtra,\n): LlmError {\n const base = classifyError(rawErr)\n const body = parseGoogleErrorBody(rawErr)\n\n let kind = base.kind\n let retryable = base.retryable\n let reason = base.reason\n let retryAfterMs = base.retryAfterMs\n let message = base.message\n\n // A transport-level timeout (no HTTP answer) is not retried: the same limit\n // is reached again, and the provider may already have run, and billed, the\n // request. An HTTP 408 or 504 is an answer from Google and keeps core's rule.\n // An already-classified error is not second-guessed.\n if (extra?.transportTimeout !== undefined) {\n kind = 'timeout'\n retryable = false\n reason = 'transport_timeout'\n retryAfterMs = undefined\n message = extra.transportTimeout\n } else if (\n !(rawErr instanceof LlmError) &&\n base.kind === 'timeout' &&\n base.httpStatus === undefined\n ) {\n retryable = false\n reason = 'transport_timeout'\n retryAfterMs = undefined\n }\n\n if (body !== undefined && base.httpStatus !== undefined) {\n if (errorInfoReasons(body).some((r) => API_KEY_REASONS.has(r))) {\n kind = 'invalid_auth'\n retryable = false\n } else if (\n base.httpStatus === 403 &&\n body.message?.startsWith(STALE_CACHE_MESSAGE) === true\n ) {\n kind = 'bad_request'\n retryable = false\n reason = 'cache_not_found'\n } else if (base.httpStatus === 429) {\n if (isDailyQuota(body)) {\n kind = 'rate_limited'\n retryable = false\n reason = 'daily_quota'\n retryAfterMs = undefined\n } else {\n retryAfterMs = retryDelayMs(body) ?? retryAfterMs\n }\n }\n }\n\n return new LlmError(message, {\n kind,\n retryable,\n ...(reason !== undefined ? { reason } : {}),\n ...(base.httpStatus !== undefined ? { httpStatus: base.httpStatus } : {}),\n ...(retryAfterMs !== undefined ? { retryAfterMs } : {}),\n provider: 'google',\n cause: base.cause ?? rawErr,\n ...(extra?.servedServiceTier !== undefined\n ? { servedServiceTier: extra.servedServiceTier }\n : {}),\n })\n}\n","import type { Scheduler } from '@gullabs/core'\n\n/**\n * The platform's timers, for code called outside the engine (no `ctx.scheduler`)\n * and for a store built without a scheduler.\n */\nexport const PLATFORM_SCHEDULER: Scheduler = {\n setTimeout: (callback, ms) => globalThis.setTimeout(callback, ms),\n clearTimeout: (handle) => {\n globalThis.clearTimeout(handle as ReturnType<typeof globalThis.setTimeout>)\n },\n}\n","/**\n * Gemini pricing snapshot for @gullabs/google.\n *\n * All rates are in **micro-USD per million tokens** (µUSD/M).\n * To get the cost for N tokens: `cost_µUSD = N * ratePerM / 1_000_000`.\n *\n * **Service tiers.** Each model stores concrete `standard` and `flex` rates\n * transcribed from Google's pricing page. Flex is not a flat 50% of standard: on\n * several models the cached lane stays at the standard cached rate (or a\n * published rate that is not half). A tier that is not one of those two is\n * unpriced (reject-don't-map). `priority` is intentionally absent: it needs\n * downgrade accounting and is a backlog item. The Batch API has no path in this\n * library (no schema admits a batch tier), so its rates are not carried.\n *\n * **Long-context tier.** Gemini Pro models charge a premium when the GROSS\n * input token count exceeds 200,000. Selected by `inputTokens` (incl. cached),\n * not by billable input. Core's selector uses `> 200_000`.\n *\n * **Thinking tokens.** Already inside `outputTokens` (GROSS convention) and\n * billed at the output rate — no separate thinking lane.\n *\n * **Audio input.** Gemini 2.5 Flash, 2.5 Flash-Lite and 3.1 Flash-Lite charge\n * more for audio input than for text, image and video tokens ({@link GeminiRates.audio}).\n * The adapter records the prompt's per-modality token counts\n * (`usageMetadata.promptTokensDetails` and `cacheTokensDetails`) as\n * `usage.details.input_<modality>` / `cached_<modality>`, and the pricing source\n * bills the audio tokens at the audio rates and the rest at the text rate. Every\n * other model is billed one input rate for all modalities on the page. Models with\n * an audio rate have no `gt200k` band, so the long-context band never needs the\n * audio split.\n *\n * Re-verified against https://ai.google.dev/gemini-api/docs/pricing on\n * 2026-09-25. Standard token rates for already-registered models were\n * unchanged from the 2026-08-12 snapshot; flex cached rates were not. The audio\n * input and cached-audio rates (standard and flex) were read from the same page\n * on 2026-10-03; the page showed \"Last Updated 2026-10-01 UTC\".\n *\n * **Grounding with Google Search** is a tool lane, not a token rate; see\n * {@link GEMINI_GROUNDING_PRICING}. It was added from the same pricing page\n * on 2026-10-03. {@link pricingVersion} is `gemini-2026-10-03` because the\n * snapshot gained the grounding lane and the audio lane that day (a grounded or\n * audio call prices differently under it). The 2026-10-03 read of the page also\n * matched the standard text and cached rates of the models it listed (and the\n * flex text and cached rates of the three audio models); only the models the page\n * summary did not list keep their 2026-09-25 verification.\n *\n * @module\n */\n\nimport type { ModelRates } from '@gullabs/core'\n\n/**\n * Identifies this pricing snapshot — bump the date when rates change.\n *\n * This is a snapshot date tied to Gemini's own pricing page, not a generic\n * core concept — it lives here (not `@gullabs/core`) alongside the rates it\n * dates.\n */\nexport const pricingVersion = 'gemini-2026-10-03' as const\n\n/** Tiers this snapshot prices. Anything else is unpriced. */\nexport const GEMINI_PRICED_TIERS = ['standard', 'flex'] as const\n\nexport type GeminiPricedTier = (typeof GEMINI_PRICED_TIERS)[number]\n\n/** Audio input rates for a model that prices audio apart from text (µUSD per million tokens). */\ninterface GeminiAudioRates {\n /** Non-cached audio input tokens. */\n inputPerM: number\n /** Cached audio input tokens. */\n cachedPerM: number\n}\n\n/** {@link ModelRates} plus the audio input rates, for models that publish them. */\ninterface GeminiRates extends ModelRates {\n /**\n * Present only on a model whose pricing page lists a separate audio input\n * price. Priced on the audio tokens `promptTokensDetails` reports; every other\n * input token uses the text/image/video rates above.\n */\n audio?: GeminiAudioRates\n}\n\n/** Concrete per-tier rates for one model. */\nexport interface GeminiTierRates {\n standard: GeminiRates\n flex: GeminiRates\n}\n\n/** Freezes a rate object and the `gt200k` and `audio` objects it holds. */\nfunction freezeRates(rates: GeminiRates): GeminiRates {\n if (rates.gt200k !== undefined) Object.freeze(rates.gt200k)\n if (rates.audio !== undefined) Object.freeze(rates.audio)\n return Object.freeze(rates)\n}\n\nfunction tiers(standard: GeminiRates, flex: GeminiRates): GeminiTierRates {\n return Object.freeze({ standard: freezeRates(standard), flex: freezeRates(flex) })\n}\n\n/**\n * Deep-frozen Gemini pricing snapshot (per-1M in µUSD), keyed by model id, then\n * by priced tier; no rate object, `gt200k` band or `audio` rate can be changed.\n * Every number is transcribed from the pricing page.\n *\n * Keys are exact priced model identifiers. Unlisted variants are unpriced.\n *\n * Source: https://ai.google.dev/gemini-api/docs/pricing (re-verified 2026-09-25;\n * the audio input and cached-audio rates read 2026-10-03, page last updated\n * 2026-10-01).\n */\nexport const GEMINI_PRICING: Readonly<Record<string, GeminiTierRates>> = Object.freeze({\n // Gemini 2.5 Pro. Flex cached equals standard on both context bands. No separate audio price.\n 'gemini-2.5-pro': tiers(\n {\n inputPerM: 1_250_000,\n cachedPerM: 125_000,\n outputPerM: 10_000_000,\n gt200k: { inputPerM: 2_500_000, cachedPerM: 250_000, outputPerM: 15_000_000 },\n },\n {\n inputPerM: 625_000,\n cachedPerM: 125_000,\n outputPerM: 5_000_000,\n gt200k: { inputPerM: 1_250_000, cachedPerM: 250_000, outputPerM: 7_500_000 },\n },\n ),\n\n // Gemini 2.5 Flash. Flex cached stays $0.03. Audio: $1.00 / cached $0.10 standard,\n // $0.50 / cached $0.10 flex.\n 'gemini-2.5-flash': tiers(\n {\n inputPerM: 300_000,\n cachedPerM: 30_000,\n outputPerM: 2_500_000,\n audio: { inputPerM: 1_000_000, cachedPerM: 100_000 },\n },\n {\n inputPerM: 150_000,\n cachedPerM: 30_000,\n outputPerM: 1_250_000,\n audio: { inputPerM: 500_000, cachedPerM: 100_000 },\n },\n ),\n\n // Gemini 2.5 Flash-Lite. Flex cached stays $0.01. Audio: $0.30 / cached $0.03\n // standard, $0.15 / cached $0.03 flex.\n 'gemini-2.5-flash-lite': tiers(\n {\n inputPerM: 100_000,\n cachedPerM: 10_000,\n outputPerM: 400_000,\n audio: { inputPerM: 300_000, cachedPerM: 30_000 },\n },\n {\n inputPerM: 50_000,\n cachedPerM: 10_000,\n outputPerM: 200_000,\n audio: { inputPerM: 150_000, cachedPerM: 30_000 },\n },\n ),\n\n // Gemini 3.1 Flash-Lite. Flex cached is the published $0.0125. Audio: $0.50 /\n // cached $0.05 standard, $0.25 / cached $0.025 flex.\n 'gemini-3.1-flash-lite': tiers(\n {\n inputPerM: 250_000,\n cachedPerM: 25_000,\n outputPerM: 1_500_000,\n audio: { inputPerM: 500_000, cachedPerM: 50_000 },\n },\n {\n inputPerM: 125_000,\n cachedPerM: 12_500,\n outputPerM: 750_000,\n audio: { inputPerM: 250_000, cachedPerM: 25_000 },\n },\n ),\n\n // Gemini 3.8 / 3.7 / 3.6 Flash intro rates (2026-09-25), one rate for all\n // modalities. Flex cached is half of the intro cached rate. Re-snapshot on 2027-01-01.\n 'gemini-3.8-flash': tiers(\n { inputPerM: 750_000, cachedPerM: 75_000, outputPerM: 3_750_000 },\n { inputPerM: 375_000, cachedPerM: 37_500, outputPerM: 1_875_000 },\n ),\n 'gemini-3.7-flash': tiers(\n { inputPerM: 750_000, cachedPerM: 75_000, outputPerM: 3_750_000 },\n { inputPerM: 375_000, cachedPerM: 37_500, outputPerM: 1_875_000 },\n ),\n 'gemini-3.6-flash': tiers(\n { inputPerM: 750_000, cachedPerM: 75_000, outputPerM: 3_750_000 },\n { inputPerM: 375_000, cachedPerM: 37_500, outputPerM: 1_875_000 },\n ),\n\n // Gemini 3.5 Flash-Lite, one rate for all modalities (audio included). Flex\n // cached is the published $0.02, not half of $0.03.\n 'gemini-3.5-flash-lite': tiers(\n { inputPerM: 300_000, cachedPerM: 30_000, outputPerM: 2_500_000 },\n { inputPerM: 150_000, cachedPerM: 20_000, outputPerM: 1_250_000 },\n ),\n\n // Gemini 3.1 Pro Preview. Flex cached equals standard on both bands. No separate audio price.\n 'gemini-3.1-pro-preview': tiers(\n {\n inputPerM: 2_000_000,\n cachedPerM: 200_000,\n outputPerM: 12_000_000,\n gt200k: { inputPerM: 4_000_000, cachedPerM: 400_000, outputPerM: 18_000_000 },\n },\n {\n inputPerM: 1_000_000,\n cachedPerM: 200_000,\n outputPerM: 6_000_000,\n gt200k: { inputPerM: 2_000_000, cachedPerM: 400_000, outputPerM: 9_000_000 },\n },\n ),\n})\n\n/**\n * How a model bills grounding with Google Search, in µUSD per unit.\n *\n * - `'query'`: Gemini 3 bills each search query the model performed. The unit\n * count is `usage.details.web_search_calls`, counted as occurrences in\n * `webSearchQueries` (a repeated query counts each time; whether Google bills\n * a repeat is not established, so the count is the conservative one).\n * - `'prompt'`: Gemini 2.5 bills each prompt that was grounded, once however\n * many queries it ran. A grounded prompt is one whose response reports at\n * least one query.\n *\n * Transcribed from https://ai.google.dev/gemini-api/docs/pricing, grounding\n * with Google Search, read 2026-10-03 (Gemini 3: $14 per 1,000 queries;\n * Gemini 2.5: $35 per 1,000 grounded prompts). The page also publishes a free\n * allowance (as read 2026-10: 5,000 requests per month shared\n * across Gemini 3.x, 1,500 requests per day on Gemini 2.5). It is shared across\n * a project's calls, so no single call can know whether it was free: every\n * grounding fee is charged in full here, which is why a call that ran Search is\n * never reported as exact.\n *\n * Keys are exact priced model identifiers. Gemma has no token price in this\n * snapshot, so it has no grounding price either.\n */\nexport interface GeminiGroundingRate {\n readonly unit: 'query' | 'prompt'\n readonly microUsdPerUnit: number\n}\n\nconst PER_QUERY: GeminiGroundingRate = Object.freeze({\n unit: 'query',\n microUsdPerUnit: 14_000,\n})\nconst PER_GROUNDED_PROMPT: GeminiGroundingRate = Object.freeze({\n unit: 'prompt',\n microUsdPerUnit: 35_000,\n})\n\nexport const GEMINI_GROUNDING_PRICING: Readonly<Record<string, GeminiGroundingRate>> =\n Object.freeze({\n 'gemini-2.5-pro': PER_GROUNDED_PROMPT,\n 'gemini-2.5-flash': PER_GROUNDED_PROMPT,\n 'gemini-2.5-flash-lite': PER_GROUNDED_PROMPT,\n 'gemini-3.1-flash-lite': PER_QUERY,\n 'gemini-3.8-flash': PER_QUERY,\n 'gemini-3.7-flash': PER_QUERY,\n 'gemini-3.6-flash': PER_QUERY,\n 'gemini-3.5-flash-lite': PER_QUERY,\n 'gemini-3.1-pro-preview': PER_QUERY,\n })\n\n/** The grounding rate for an exact priced model id, or `undefined`. */\nexport function resolveGeminiGroundingRate(\n model: string,\n): GeminiGroundingRate | undefined {\n return Object.hasOwn(GEMINI_GROUNDING_PRICING, model)\n ? GEMINI_GROUNDING_PRICING[model]\n : undefined\n}\n\n/**\n * Concrete rates for `(model, tier)`. `undefined` tier is standard. A defined\n * tier this snapshot does not price returns `undefined`.\n */\nfunction isPricedGeminiTier(tier: string): tier is GeminiPricedTier {\n return (GEMINI_PRICED_TIERS as readonly string[]).includes(tier)\n}\n\nfunction lookupGeminiTierRates(\n model: string,\n tier?: string,\n): GeminiTierRates | undefined {\n const entry = Object.hasOwn(GEMINI_PRICING, model) ? GEMINI_PRICING[model] : undefined\n if (entry === undefined) return undefined\n // Only the three published tiers are priced. Inherited names such as\n // `constructor` and `toString` must not pass this check.\n if (tier !== undefined && !isPricedGeminiTier(tier)) return undefined\n return entry\n}\n\n/** Resolve the concrete {@link GeminiRates} for `(model, tier)`. */\nexport function resolveGeminiRates(\n model: string,\n tier: string | undefined,\n): GeminiRates | undefined {\n const entry = lookupGeminiTierRates(model, tier)\n if (entry === undefined) return undefined\n const key = tier ?? 'standard'\n return entry[key as GeminiPricedTier]\n}\n","/**\n * Gemini pricing source for @gullabs/google.\n *\n * Provides `geminiPricingSource` — a factory returning a `PricingSource` port\n * implementation backed by the frozen Gemini pricing snapshot ({@link\n * GEMINI_PRICING}). Uses exact priced model identifiers,\n * resolves the concrete per-tier rates, and delegates the token arithmetic to\n * `@gullabs/core`'s `computeCost` (audio input and grounding are priced here). Core itself carries zero Gemini pricing\n * knowledge and applies no tier multiplier.\n *\n * @module\n */\n\nimport { computeCost } from '@gullabs/core'\nimport type { Cost, PricingSource, Usage } from '@gullabs/core'\n\nimport {\n GEMINI_PRICING,\n pricingVersion,\n resolveGeminiGroundingRate,\n resolveGeminiRates,\n} from './pricing.js'\n\n/** A non-negative whole token count from `usage.details`, or `undefined`. */\nfunction tokenDetail(usage: Usage, key: string): number | undefined {\n const value = usage.details[key]\n return typeof value === 'number' && Number.isFinite(value) && value >= 0\n ? Math.floor(value)\n : undefined\n}\n\n/** The sum of the `<prefix>_<modality>` lanes the response reported, or `undefined` when it listed none. */\nfunction modalitySplitTotal(\n usage: Usage,\n prefix: 'input_' | 'cached_',\n): number | undefined {\n let total: number | undefined\n for (const [key, value] of Object.entries(usage.details)) {\n if (key.startsWith(prefix) && Number.isFinite(value) && value >= 0) {\n total = (total ?? 0) + value\n }\n }\n return total\n}\n\n/** Why the audio share of a call's prompt cannot be pinned down from the response. */\nexport type PromptSplitGap =\n /** Audio was sent, but the response reports no audio tokens (an absent entry or `{ AUDIO, 0 }`). */\n | 'audio-unreported'\n /** Cached tokens exist and nothing in the response says how many are audio. */\n | 'cached-audio-unknown'\n /** The reported counts contradict each other (audio above the prompt, cached audio above the cache, ...). */\n | 'inconsistent'\n\n/**\n * The prompt split into four lanes that always sum to `usage.inputTokens`: audio and\n * other (text, image, video) tokens, each uncached and cached. `gaps` lists every\n * reason the audio share is not fully known from the response; an empty list means\n * the lanes are exact.\n *\n * Rules, in order:\n * - An `AUDIO` entry of `promptTokensDetails` (`details.input_audio`) is the audio\n * count of the whole prompt, the cached part included; an `AUDIO` entry of\n * `cacheTokensDetails` (`details.cached_audio`) is the cached audio. A reported\n * cached audio count is priced even when the prompt split is absent: cached audio is\n * part of the prompt audio, so it raises the prompt audio to at least that count.\n * - A request that carried audio (`details.audio_input_requested`) and a response with\n * no audio tokens leaves the uncached audio unknown (`audio-unreported`); audio\n * always has tokens, so zero is the same missing information as an absent entry.\n * - Cached tokens with no cached audio count are known audio-free only when the prompt\n * split proves the prompt holds no audio (a zero entry, or a listing without audio\n * that covers every prompt token); otherwise `cached-audio-unknown`. A cache that\n * lists no audio and covers every cached token arrives as `cached_audio: 0`.\n * - Counts that contradict each other are clamped into the lanes and reported as\n * `inconsistent`.\n *\n * @internal\n */\nexport function promptLanes(usage: Usage): {\n audioUncached: number\n audioCached: number\n otherUncached: number\n otherCached: number\n gaps: readonly PromptSplitGap[]\n} {\n const total = usage.inputTokens\n const cachedReported = usage.cachedInputTokens ?? 0\n const promptAudio = tokenDetail(usage, 'input_audio')\n const cachedAudio = tokenDetail(usage, 'cached_audio')\n const gaps: PromptSplitGap[] = []\n const gap = (reason: PromptSplitGap): void => {\n if (!gaps.includes(reason)) gaps.push(reason)\n }\n\n const cached = Math.min(cachedReported, total)\n if (cachedReported > total) gap('inconsistent')\n\n const audioCached = Math.min(cachedAudio ?? 0, cached)\n if ((cachedAudio ?? 0) > cached) gap('inconsistent')\n if (promptAudio !== undefined && promptAudio < audioCached) gap('inconsistent')\n\n const audioTotal = Math.min(Math.max(promptAudio ?? 0, audioCached), total)\n if ((promptAudio ?? 0) > total) gap('inconsistent')\n const audioUncached = Math.min(audioTotal - audioCached, total - cached)\n if (audioTotal - audioCached > total - cached) gap('inconsistent')\n\n if (usage.details['audio_input_requested'] === 1 && !((promptAudio ?? 0) > 0)) {\n gap('audio-unreported')\n }\n const promptSplit = modalitySplitTotal(usage, 'input_')\n const promptHoldsNoAudio =\n promptAudio === 0 ||\n (promptAudio === undefined && promptSplit !== undefined && promptSplit >= total)\n if (cached > 0 && cachedAudio === undefined && !promptHoldsNoAudio) {\n gap('cached-audio-unknown')\n }\n\n return {\n audioUncached,\n audioCached,\n otherUncached: total - cached - audioUncached,\n otherCached: cached - audioCached,\n gaps,\n }\n}\n\n/**\n * Price one call: the input split by modality, the token lanes through core,\n * then the grounding fee on the `tools` lane from the normalised search facts in\n * `usage.details`.\n *\n * **Audio input.** A model whose rates carry `audio` bills the audio tokens of\n * the prompt (`details.input_audio`, from `promptTokensDetails`) at the audio\n * rates, and of those the cached ones (`details.cached_audio`, from\n * `cacheTokensDetails`) at the cached audio rate; every other token is priced at\n * the text/image/video rates through core. The four lanes ({@link promptLanes})\n * always sum to the prompt. Reported cached audio is priced even when the prompt\n * split is absent. The cost is `'estimated'` whenever the response leaves the\n * audio share unknown or contradicts itself ({@link PromptSplitGap}): audio was\n * sent but none reported, cached tokens whose audio share nothing rules out, or\n * counts that do not add up.\n *\n * **Missing usage.** `details.usage_missing` (the response had no\n * `usageMetadata`) is unpriced and `'estimated'`: the amount is unknown.\n *\n * **Grounding.**\n * - No `web_search_requested`: the call is token-priced and exact.\n * - Requested, count known to be zero: Search did not run; token-priced, exact.\n * - Requested, count unknown (`web_search_calls` absent): the fee cannot be\n * known, so the `tools` lane stays 0 and the cost is `'estimated'`.\n * - Search ran (count >= 1): the fee is added to `tools` and the cost is\n * `'estimated'`, because the free allowance is unknowable per call and\n * the fee is charged in full.\n *\n * `microUsd` stays the sum of the four lanes.\n */\nfunction priceCall(model: string, usage: Usage, tier: string | undefined): Cost {\n // The adapter marks a 200 that carried no `usageMetadata`: the tokens billed\n // are unknown, so no amount (and certainly not an exact zero) is reported.\n if (usage.details['usage_missing'] === 1) {\n return {\n microUsd: null,\n usd: null,\n pricingVersion,\n confidence: 'estimated',\n details: { input: 0, cached: 0, output: 0, tools: 0 },\n unpricedReason:\n 'The response carried no usageMetadata, so the tokens billed are unknown.',\n }\n }\n const modelRates = resolveGeminiRates(model, tier)\n const audioRates = modelRates?.audio\n\n let cost: Cost\n if (audioRates === undefined) {\n cost = computeCost(model, usage, tier, resolveGeminiRates, pricingVersion)\n } else {\n const lanes = promptLanes(usage)\n const textUsage: Usage = {\n ...usage,\n inputTokens: lanes.otherUncached + lanes.otherCached,\n cachedInputTokens: lanes.otherCached,\n }\n const text = computeCost(model, textUsage, tier, resolveGeminiRates, pricingVersion)\n const audioUncachedCost = Math.round(\n (lanes.audioUncached * audioRates.inputPerM) / 1_000_000,\n )\n const audioCachedCost = Math.round(\n (lanes.audioCached * audioRates.cachedPerM) / 1_000_000,\n )\n const microUsd = (text.microUsd ?? 0) + audioUncachedCost + audioCachedCost\n cost = {\n ...text,\n microUsd,\n usd: microUsd / 1_000_000,\n // An audio share the response does not pin down can understate the amount.\n ...(lanes.gaps.length > 0 ? { confidence: 'estimated' as const } : {}),\n details: {\n ...text.details,\n input: text.details.input + audioUncachedCost,\n cached: text.details.cached + audioCachedCost,\n },\n }\n }\n\n if (cost.microUsd === null) return cost\n\n if (usage.details['web_search_requested'] !== 1) return cost\n\n const calls = usage.details['web_search_calls']\n if (calls === 0) return cost\n\n const rate = resolveGeminiGroundingRate(model)\n const tools =\n rate === undefined || calls === undefined\n ? 0\n : rate.unit === 'query'\n ? Math.round(calls * rate.microUsdPerUnit)\n : rate.microUsdPerUnit\n const microUsd = cost.microUsd + tools\n return {\n ...cost,\n microUsd,\n usd: microUsd / 1_000_000,\n confidence: 'estimated',\n details: { ...cost.details, tools },\n }\n}\n\n/**\n * Factory that returns the **google-scoped** {@link PricingSource} port\n * implementation backed by the built-in Gemini pricing snapshot.\n *\n * `PricingSource` is provider-scoped by contract — this source only knows\n * bare Gemini/Gemma model keys. Compose it into `ClientConfig.pricingSources`\n * under the `'google'` key (or bundle it via {@link googleProvider}); do not\n * use it for other providers.\n *\n * The returned object is stateless and can be shared across calls.\n *\n * @example\n * ```ts\n * import { geminiPricingSource } from '@gullabs/google'\n *\n * const pricing = geminiPricingSource()\n * const cost = pricing.price('gemini-2.5-pro', usage, 'flex')\n * ```\n */\nexport function geminiPricingSource(): PricingSource {\n return {\n version: pricingVersion,\n price(model: string, usage: Usage, tier?: string): Cost {\n return priceCall(model, usage, tier)\n },\n hasModel(model: string): boolean {\n return resolveGeminiRates(model, undefined) !== undefined\n },\n listModels(): readonly string[] {\n return Object.keys(GEMINI_PRICING)\n },\n }\n}\n","/**\n * The UTF-8 byte length of a string, counted without allocating the encoded copy.\n * It agrees with `new TextEncoder().encode(text).length`, including for a lone\n * surrogate (encoded as U+FFFD, three bytes).\n */\nexport function utf8ByteLength(text: string): number {\n let bytes = 0\n for (let i = 0; i < text.length; i += 1) {\n const unit = text.charCodeAt(i)\n if (unit < 0x80) bytes += 1\n else if (unit < 0x800) bytes += 2\n else if (unit >= 0xd800 && unit <= 0xdbff) {\n const next = text.charCodeAt(i + 1)\n if (next >= 0xdc00 && next <= 0xdfff) {\n bytes += 4\n i += 1\n } else bytes += 3\n } else bytes += 3\n }\n return bytes\n}\n","/**\n * Gemini 3 thought signatures as an overlay on the host's actual history.\n *\n * Gemini 3.x returns an opaque `thoughtSignature` on the first function call of\n * each model turn (and sometimes on text parts) and rejects a replayed turn\n * whose function call has lost it. The library never keeps a copy of the\n * history. `result.transientProviderState` is only an overlay saying which part\n * of the host's own messages gets which signature:\n *\n * ```ts\n * { google: { signatures: [{ messageIndex, partIndex, kind, model, partSha256, signature }] } }\n * ```\n *\n * `messageIndex` indexes the messages the adapter receives (`request.messages`\n * as the engine hands them on, after any middleware), `partIndex` indexes that\n * message's `parts` (thought parts are never in a message), `kind` is the part\n * kind that was signed (`'text'` or `'tool-call'`), `model` is the model string\n * the request named, and `partSha256` is the SHA-256 of the part's RFC 8785\n * canonical JSON, so an edited argument or text is detected and key order\n * (Postgres `jsonb`) does not matter.\n *\n * A function-call signature is required on replay, so a stale one is\n * `bad_request`. A text signature is optional (Google accepts the next turn\n * without it), so a stale one (edited, moved, removed, or issued for another\n * model) is dropped with a warning and nothing else is lost.\n *\n * @module\n */\n\nimport { LlmError, canonicalJson, sha256Hex } from '@gullabs/core'\nimport type { JsonValue, Message, Part } from '@gullabs/core'\n\n/** The part kinds Google signs. */\nexport type GoogleSignedKind = 'text' | 'tool-call'\n\n/** One signature, pinned to a part of the host's history. */\nexport type GoogleSignatureEntry = {\n messageIndex: number\n partIndex: number\n /** The kind of part that was signed; decides whether a stale entry is fatal. */\n kind: GoogleSignedKind\n model: string\n partSha256: string\n signature: string\n}\n\n/** The shape of `transientProviderState` for Gemini 3.x models. */\nexport type GoogleSignatureState = {\n google: { signatures: GoogleSignatureEntry[] }\n}\n\nconst STATE_PATH = 'transientProviderState'\nconst SHA256_HEX = /^[0-9a-f]{64}$/\nconst ENTRY_KEYS = new Set([\n 'messageIndex',\n 'partIndex',\n 'kind',\n 'model',\n 'partSha256',\n 'signature',\n])\n\nfunction badState(path: string, why: string): LlmError {\n return new LlmError(`${path}: ${why}`, {\n kind: 'bad_request',\n retryable: false,\n provider: 'google',\n issues: [{ path, message: why }],\n })\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * The JSON a part is hashed as. Only the parts Google signs are admitted: text,\n * and tool calls (id, name and arguments).\n */\nfunction hashedForm(part: Part, path: string): JsonValue {\n switch (part.kind) {\n case 'text':\n return { kind: 'text', text: part.text }\n case 'tool-call':\n return {\n kind: 'tool-call',\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n args: part.args,\n }\n default:\n throw badState(\n path,\n `a thought signature cannot be attached to a \"${part.kind}\" part`,\n )\n }\n}\n\n/** SHA-256 (lowercase hex) of the part's RFC 8785 canonical JSON. */\nexport function partSha256(part: Part, path = 'part'): string {\n return sha256Hex(canonicalJson(hashedForm(part, path)))\n}\n\n/** Strictly parse `transientProviderState` for a Gemini 3.x request. */\nexport function parseSignatureState(value: unknown): GoogleSignatureEntry[] {\n if (value === undefined) return []\n if (!isRecord(value)) {\n throw badState(STATE_PATH, 'must be { google: { signatures: [...] } }')\n }\n for (const key of Object.keys(value)) {\n if (key !== 'google') {\n throw badState(\n `${STATE_PATH}.${key}`,\n `holds another provider's state; Google state is { google: { signatures: [...] } }`,\n )\n }\n }\n const google = value['google']\n if (!isRecord(google)) {\n throw badState(`${STATE_PATH}.google`, 'must be { signatures: [...] }')\n }\n for (const key of Object.keys(google)) {\n if (key !== 'signatures') {\n throw badState(`${STATE_PATH}.google.${key}`, 'is not a known key')\n }\n }\n const list = google['signatures']\n if (!Array.isArray(list)) {\n throw badState(`${STATE_PATH}.google.signatures`, 'must be an array')\n }\n return list.map((raw, index) => {\n const path = `${STATE_PATH}.google.signatures.${index}`\n if (!isRecord(raw)) throw badState(path, 'must be an object')\n for (const key of Object.keys(raw)) {\n if (!ENTRY_KEYS.has(key)) throw badState(`${path}.${key}`, 'is not a known key')\n }\n const { messageIndex, partIndex, kind, model, partSha256: digest, signature } = raw\n if (\n typeof messageIndex !== 'number' ||\n !Number.isInteger(messageIndex) ||\n messageIndex < 0\n ) {\n throw badState(`${path}.messageIndex`, 'must be a non-negative integer')\n }\n if (typeof partIndex !== 'number' || !Number.isInteger(partIndex) || partIndex < 0) {\n throw badState(`${path}.partIndex`, 'must be a non-negative integer')\n }\n if (kind !== 'text' && kind !== 'tool-call') {\n throw badState(`${path}.kind`, 'must be \"text\" or \"tool-call\"')\n }\n if (typeof model !== 'string' || model.length === 0) {\n throw badState(`${path}.model`, 'must be a non-empty string')\n }\n if (typeof digest !== 'string' || !SHA256_HEX.test(digest)) {\n throw badState(`${path}.partSha256`, 'must be 64 lowercase hex characters')\n }\n if (typeof signature !== 'string' || signature.length === 0) {\n throw badState(`${path}.signature`, 'must be a non-empty string')\n }\n return { messageIndex, partIndex, kind, model, partSha256: digest, signature }\n })\n}\n\nconst STALE =\n 'history was edited, reordered or produced by another model after the signature was issued'\n\n/** What {@link resolveSignatures} found in the overlay. */\ninterface ResolvedSignatures {\n /** `\"messageIndex:partIndex\"` to signature, for the entries that verified. */\n bySlot: Map<string, string>\n /** The entries that verified, in order: the overlay to carry forward. */\n kept: GoogleSignatureEntry[]\n /** One line per text entry that was dropped as stale. */\n dropped: string[]\n}\n\n/**\n * Check the overlay against the host's messages. An entry verifies when it\n * names an assistant message and a part whose hash matches, issued for the\n * model this request names. A stale **text** entry (any of those fail) is\n * dropped and reported in `dropped`: Google treats text signatures as optional.\n * A stale **function-call** entry, a duplicate, or a hash that cannot be\n * computed (a host part outside the JSON domain) is `bad_request`. Then every\n * assistant message that replays tool calls must have an entry for its first\n * tool-call part: Google signs only the first function call of a model turn,\n * and rejects the turn without it.\n */\nexport function resolveSignatures(\n entries: readonly GoogleSignatureEntry[],\n messages: readonly Message[],\n model: string,\n): ResolvedSignatures {\n const bySlot = new Map<string, string>()\n const kept: GoogleSignatureEntry[] = []\n const dropped: string[] = []\n const seen = new Set<string>()\n\n for (const [index, entry] of entries.entries()) {\n const path = `${STATE_PATH}.google.signatures.${index}`\n const slot = `${entry.messageIndex}:${entry.partIndex}`\n const where = `messages.${entry.messageIndex}.parts.${entry.partIndex}`\n /** A stale entry: fatal for a function call, dropped for text. */\n const stale = (field: string, why: string): void => {\n if (entry.kind === 'tool-call') throw badState(`${path}.${field}`, why)\n dropped.push(`${where}: ${why}`)\n }\n\n if (seen.has(slot)) throw badState(path, `duplicates the entry for ${where}`)\n seen.add(slot)\n if (entry.model !== model) {\n stale(\n 'model',\n `was issued for model \"${entry.model}\" but this request names \"${model}\"; signatures are not replayed across models (${STALE})`,\n )\n continue\n }\n const message = messages[entry.messageIndex]\n if (message === undefined || message.role !== 'assistant') {\n stale(\n 'messageIndex',\n `does not point at an assistant message in messages (${STALE})`,\n )\n continue\n }\n const part = message.parts[entry.partIndex]\n if (part === undefined) {\n stale('partIndex', `is out of range for the message (${STALE})`)\n continue\n }\n if (part.kind !== entry.kind) {\n stale(\n 'kind',\n `is for a \"${entry.kind}\" part but ${where} is a \"${part.kind}\" part (${STALE})`,\n )\n continue\n }\n if (partSha256(part, where) !== entry.partSha256) {\n stale('partSha256', `does not match ${where} (${STALE})`)\n continue\n }\n bySlot.set(slot, entry.signature)\n kept.push(entry)\n }\n\n for (const [mi, message] of messages.entries()) {\n if (message.role !== 'assistant') continue\n const first = message.parts.findIndex((part) => part.kind === 'tool-call')\n if (first === -1 || bySlot.has(`${mi}:${first}`)) continue\n const call = message.parts[first]\n throw badState(\n `messages.${mi}.parts.${first}`,\n `replays tool call \"${call?.kind === 'tool-call' ? call.toolCallId : ''}\" without its thought signature in transientProviderState; Gemini 3 rejects a function call that lost it. Send the transientProviderState from the result that produced this message, and the history unedited, with the same model string. If you removed messages from the history, remove their entries with dropMessagesFromSignatureState`,\n )\n }\n return { bySlot, kept, dropped }\n}\n\n/** Build the entry for a part the model signed (a text or tool-call part). */\nexport function signatureEntry(\n messageIndex: number,\n partIndex: number,\n model: string,\n part: Part,\n signature: string,\n): GoogleSignatureEntry {\n if (part.kind !== 'text' && part.kind !== 'tool-call') {\n throw badState(\n `messages.${messageIndex}.parts.${partIndex}`,\n `a thought signature cannot be attached to a \"${part.kind}\" part`,\n )\n }\n return {\n messageIndex,\n partIndex,\n kind: part.kind,\n model,\n partSha256: partSha256(part),\n signature,\n }\n}\n\n/**\n * Remove the entries for messages the host removed from its history, and shift\n * the `messageIndex` of every later entry down so it still points at the same\n * message. `indices` are positions in the history the state was issued for\n * (before the removal). Whole turns only: remove a tool-call message together\n * with its tool-result message, and never keep a tool-call message while\n * removing its entry. Returns `undefined` when no entry remains, so the result\n * can be sent as `transientProviderState` or omitted.\n */\nexport function dropMessagesFromSignatureState(\n state: unknown,\n indices: readonly number[],\n): GoogleSignatureState | undefined {\n const removed = new Set<number>()\n for (const [i, value] of indices.entries()) {\n if (!Number.isInteger(value) || value < 0) {\n throw new LlmError(\n `dropMessagesFromSignatureState: indices.${i} must be a non-negative integer.`,\n {\n kind: 'bad_request',\n retryable: false,\n issues: [{ path: `indices.${i}`, message: 'must be a non-negative integer' }],\n },\n )\n }\n if (removed.has(value)) {\n throw new LlmError(\n `dropMessagesFromSignatureState: indices.${i} repeats message ${value}.`,\n {\n kind: 'bad_request',\n retryable: false,\n issues: [{ path: `indices.${i}`, message: 'is a duplicate' }],\n },\n )\n }\n removed.add(value)\n }\n const sorted = [...removed].sort((a, b) => a - b)\n const signatures: GoogleSignatureEntry[] = []\n for (const entry of parseSignatureState(state)) {\n if (removed.has(entry.messageIndex)) continue\n const shift = sorted.filter((index) => index < entry.messageIndex).length\n signatures.push({ ...entry, messageIndex: entry.messageIndex - shift })\n }\n return signatures.length > 0 ? { google: { signatures } } : undefined\n}\n","/**\n * geminiAdapter — @gullabs/google Gemini provider adapter.\n *\n * Pure request⇄response mapping over @google/genai (via GeminiClientLike).\n * Never persists, never computes cost, never loops.\n *\n * @module\n */\n\nimport {\n LlmError,\n assertNever,\n assertJsonSchemaProfile,\n assertInputMimeTypesAdmitted,\n assertModelMatchesDescriptor,\n isMediaTypeAdmitted,\n} from '@gullabs/core'\nimport type {\n ProviderAdapter,\n ResolvedRequest,\n AdapterCtx,\n AdapterResult,\n Scheduler,\n TimerHandle,\n Usage,\n Warning,\n FinishReason,\n JsonValue,\n AuthMaterial,\n Part,\n Message,\n TokenCountRequest,\n TokenCount,\n ToolChoice,\n} from '@gullabs/core'\nimport {\n buildGoogleClient,\n FLEX_DEFAULT_TIMEOUT_MS,\n MAX_TIMER_MS,\n STANDARD_DEFAULT_TIMEOUT_MS,\n TRANSPORT_TIMEOUT_BUFFER_MS,\n} from './client.js'\nimport {\n GOOGLE_HIGH_EFFORT_MIN_OUTPUT_TOKENS,\n GOOGLE_REASONING_EFFORT_BUDGET,\n} from './reasoning-budget.js'\nimport { googleJsonSchemaProfile } from './json-schema.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from './safety-settings.js'\nimport {\n countWebSearchQueries,\n normalizeGroundingCitations,\n readSearchEntryPoint,\n} from './grounding.js'\nimport type { AnswerTextPart } from './grounding.js'\nimport {\n isSynthesizedToolCallId,\n reserveProviderToolCallIds,\n resolveToolCallId,\n} from './tool-call-id.js'\nimport type {\n GeminiClientLike,\n GeminiGenerateConfig,\n GeminiContent,\n GeminiContentPart,\n GeminiResponseShape,\n GeminiUsageMetadataShape,\n GeminiCountTokensParams,\n} from './client.js'\nimport { isGeminiCapacityError } from './flex-fallback.js'\nimport { classifyGoogleError } from './errors.js'\nimport { PLATFORM_SCHEDULER } from './platform-scheduler.js'\nimport { promptLanes } from './cost.js'\nimport { utf8ByteLength } from './utf8.js'\nimport {\n parseSignatureState,\n resolveSignatures,\n signatureEntry,\n} from './thought-signatures.js'\nimport type { GoogleSignatureEntry } from './thought-signatures.js'\n\ntype GeminiGoogleSearchTool = { googleSearch: Record<string, never> }\n\ntype GeminiAllowedTool = GeminiGoogleSearchTool\n\ntype GeminiSafetySetting = {\n category: string\n threshold: string\n}\n\ntype GeminiDispatchConfig = GeminiGenerateConfig & {\n cachedContent?: string\n httpOptions?: { timeout?: number }\n safetySettings?: GeminiSafetySetting[]\n tools?: GeminiGenerateConfig['tools']\n}\n\nconst ALLOWED_GOOGLE_PROVIDER_OPTION_KEYS = new Set([\n 'allowSchemaWithSearch',\n 'cachedContent',\n 'flexFallback',\n 'httpOptions',\n 'requireGrounding',\n 'safetySettings',\n 'tools',\n])\n\nconst ALLOWED_GOOGLE_HTTP_OPTION_KEYS = new Set(['timeout'])\n\nconst RESERVED_GOOGLE_PROVIDER_OPTION_KEYS = new Set([\n 'abortSignal',\n 'imageConfig',\n 'maxOutputTokens',\n 'mediaResolution',\n 'responseFormat',\n 'responseMimeType',\n 'responseModalities',\n 'responseSchema',\n 'responseJsonSchema',\n 'serviceTier',\n 'speechConfig',\n 'stopSequences',\n 'temperature',\n 'thinkingConfig',\n 'topK',\n 'topP',\n '_responseJsonSchema',\n])\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction isEmptyPlainObject(value: unknown): value is Record<string, never> {\n return isPlainRecord(value) && Object.keys(value).length === 0\n}\n\nfunction badGoogleProviderOptions(message: string): LlmError {\n return new LlmError(message, { kind: 'bad_request', retryable: false })\n}\n\nfunction parseGoogleTool(tool: unknown, model: string): GeminiAllowedTool {\n if (!isPlainRecord(tool)) {\n throw badGoogleProviderOptions(\n `providerOptions.google.tools entries must be objects for model \"${model}\".`,\n )\n }\n\n const keys = Object.keys(tool)\n if (keys.length !== 1) {\n throw badGoogleProviderOptions(\n `providerOptions.google.tools entries must have exactly one supported tool key for model \"${model}\".`,\n )\n }\n\n const key = keys[0]\n switch (key) {\n case 'googleSearch': {\n if (!isEmptyPlainObject(tool['googleSearch'])) {\n throw badGoogleProviderOptions(\n `providerOptions.google.tools[].googleSearch must be an empty object for model \"${model}\".`,\n )\n }\n return { googleSearch: {} }\n }\n\n default:\n throw badGoogleProviderOptions(\n `providerOptions.google.tools[].${key} is not supported for model \"${model}\".`,\n )\n }\n}\n\nconst SAFETY_CATEGORY_SET: ReadonlySet<string> = new Set(GOOGLE_SAFETY_CATEGORIES)\nconst SAFETY_THRESHOLD_SET: ReadonlySet<string> = new Set(GOOGLE_SAFETY_THRESHOLDS)\n\nfunction parseGoogleSafetySetting(\n setting: unknown,\n index: number,\n model: string,\n): GeminiSafetySetting {\n if (!isPlainRecord(setting)) {\n throw badGoogleProviderOptions(\n `providerOptions.google.safetySettings[${index}] must be an object for model \"${model}\".`,\n )\n }\n\n const keys = Object.keys(setting)\n const unknownKeys = keys.filter((key) => key !== 'category' && key !== 'threshold')\n if (unknownKeys.length > 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google.safetySettings[${index}] contains unsupported keys [${unknownKeys.join(\n ', ',\n )}] for model \"${model}\". Allowed keys: category, threshold.`,\n )\n }\n\n if (\n typeof setting['category'] !== 'string' ||\n !SAFETY_CATEGORY_SET.has(setting['category'])\n ) {\n throw badGoogleProviderOptions(\n `providerOptions.google.safetySettings[${index}].category must be one of ${GOOGLE_SAFETY_CATEGORIES.join(', ')} for model \"${model}\".`,\n )\n }\n\n if (\n typeof setting['threshold'] !== 'string' ||\n !SAFETY_THRESHOLD_SET.has(setting['threshold'])\n ) {\n throw badGoogleProviderOptions(\n `providerOptions.google.safetySettings[${index}].threshold must be one of ${GOOGLE_SAFETY_THRESHOLDS.join(', ')} for model \"${model}\".`,\n )\n }\n\n return {\n category: setting['category'],\n threshold: setting['threshold'],\n }\n}\n\ntype MappedGoogleProviderOptions = Partial<GeminiDispatchConfig> & {\n /**\n * The tool kinds the named cache holds, when the host passed a handle that\n * records them (`{ cacheName, toolKinds }`). Absent for a bare cache name:\n * what the cache holds is then unknown.\n */\n cachedToolKinds?: readonly string[]\n flexFallback?: boolean\n /** Effective `requireGrounding`: the explicit value, else on when the host opted into schema + search. */\n requireGrounding?: boolean\n}\n\n/** The JSON type of a value, for an error message that names what was received. */\nfunction describeType(value: unknown): string {\n return value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value\n}\n\n/**\n * Why a model that never had a measured schema + Search result cannot be sent\n * both. `structuredOutputWithTools: false` means a capture showed Search\n * missing and the host may opt in per call; absent means nothing was measured,\n * so there is no behaviour to opt into.\n */\nfunction noSchemaWithSearchEvidence(model: string): string {\n return `Structured output with googleSearch is not supported for model \"${model}\": no live capture shows Search running when a response schema is attached to this model (the captures cover Gemini 3.x only), so there is no measured behaviour to opt into and providerOptions.google.allowSchemaWithSearch does not apply. Make two calls instead: grounded research without a schema, then structured synthesis (the two-call recipe in docs/grounded-structured.md).`\n}\n\n/**\n * The schema + Search rule, shared by Search sent as a tool and Search held by a cache\n * handle: on a model whose capture showed Search missing under a response schema\n * (`structuredOutputWithTools: false`) the call needs `allowSchemaWithSearch`; on a model\n * never measured (absent) there is nothing to opt into.\n */\nfunction assertSchemaWithSearchAllowed(\n model: string,\n structuredOutputWithTools: boolean | undefined,\n allowSchemaWithSearch: boolean | undefined,\n declaredBy: string,\n): void {\n if (structuredOutputWithTools === undefined) {\n throw badGoogleProviderOptions(noSchemaWithSearchEvidence(model))\n }\n if (allowSchemaWithSearch !== true) {\n throw badGoogleProviderOptions(\n `Structured output with googleSearch is not enabled for model \"${model}\" (Search is declared by ${declaredBy}): the provider accepts the request but Search does not reliably run when a response schema is attached. Make two calls instead: grounded research without a schema, then structured synthesis (the two-call recipe in docs/grounded-structured.md). To send both in one call anyway, set providerOptions.google.allowSchemaWithSearch: true; the call then fails unless the response proves Search ran (requireGrounding), and that failure is not retryable because the same call keeps missing.`,\n )\n }\n}\n\nfunction mapGoogleProviderOptions({\n googleOpts,\n model,\n structuredOutputRequested,\n descriptorGrounding,\n descriptorCaching,\n structuredOutputWithTools,\n}: {\n googleOpts: unknown\n model: string\n structuredOutputRequested: boolean\n descriptorGrounding: boolean | undefined\n descriptorCaching: boolean\n structuredOutputWithTools: boolean | undefined\n}): MappedGoogleProviderOptions {\n if (googleOpts === undefined) {\n return {}\n }\n\n if (!isPlainRecord(googleOpts)) {\n throw badGoogleProviderOptions(\n `providerOptions.google must be an object for model \"${model}\".`,\n )\n }\n\n const reservedKeys = Object.keys(googleOpts).filter((key) =>\n RESERVED_GOOGLE_PROVIDER_OPTION_KEYS.has(key),\n )\n if (reservedKeys.length > 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google reserves keys [${reservedKeys.join(\n ', ',\n )}] for typed model config on \"${model}\".`,\n )\n }\n\n const unknownKeys = Object.keys(googleOpts).filter(\n (key) => !ALLOWED_GOOGLE_PROVIDER_OPTION_KEYS.has(key),\n )\n if (unknownKeys.length > 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google contains unsupported keys [${unknownKeys.join(\n ', ',\n )}] for model \"${model}\". Allowed keys: allowSchemaWithSearch, cachedContent, flexFallback, httpOptions, requireGrounding, safetySettings, tools.`,\n )\n }\n\n const mapped: MappedGoogleProviderOptions = {}\n\n if (googleOpts['cachedContent'] !== undefined) {\n if (!descriptorCaching) {\n throw badGoogleProviderOptions(\n `providerOptions.google.cachedContent is not supported for model \"${model}\": the model has no explicit-caching capability.`,\n )\n }\n const cached = googleOpts['cachedContent']\n if (typeof cached === 'string' && cached.length > 0) {\n mapped.cachedContent = cached\n } else if (isPlainRecord(cached)) {\n const extraKeys = Object.keys(cached).filter(\n (key) => key !== 'cacheName' && key !== 'toolKinds',\n )\n const cacheName = cached['cacheName']\n const toolKinds = cached['toolKinds']\n if (\n extraKeys.length > 0 ||\n typeof cacheName !== 'string' ||\n cacheName.length === 0 ||\n (toolKinds !== undefined &&\n (!Array.isArray(toolKinds) ||\n !toolKinds.every((kind) => typeof kind === 'string')))\n ) {\n throw badGoogleProviderOptions(\n `providerOptions.google.cachedContent must be a non-empty cache name, or { cacheName: non-empty string, toolKinds?: string[] } and nothing else (pass handle.cacheName and handle.toolKinds, not the whole handle), for model \"${model}\".`,\n )\n }\n mapped.cachedContent = cacheName\n if (toolKinds !== undefined) mapped.cachedToolKinds = toolKinds\n } else {\n throw badGoogleProviderOptions(\n `providerOptions.google.cachedContent must be a non-empty cache name, or { cacheName: non-empty string, toolKinds?: string[] }, for model \"${model}\".`,\n )\n }\n }\n\n if (googleOpts['flexFallback'] !== undefined) {\n if (typeof googleOpts['flexFallback'] !== 'boolean') {\n throw badGoogleProviderOptions(\n `providerOptions.google.flexFallback must be a boolean for model \"${model}\".`,\n )\n }\n mapped.flexFallback = googleOpts['flexFallback']\n }\n\n if (googleOpts['httpOptions'] !== undefined) {\n if (!isPlainRecord(googleOpts['httpOptions'])) {\n throw badGoogleProviderOptions(\n `providerOptions.google.httpOptions must be an object for model \"${model}\".`,\n )\n }\n\n const unknownHttpOptionKeys = Object.keys(googleOpts['httpOptions']).filter(\n (key) => !ALLOWED_GOOGLE_HTTP_OPTION_KEYS.has(key),\n )\n if (unknownHttpOptionKeys.length > 0) {\n throw badGoogleProviderOptions(\n `providerOptions.google.httpOptions contains unsupported keys [${unknownHttpOptionKeys.join(\n ', ',\n )}] for model \"${model}\". Allowed keys: timeout.`,\n )\n }\n\n const timeout = googleOpts['httpOptions']['timeout']\n if (timeout !== undefined) {\n if (\n typeof timeout !== 'number' ||\n !Number.isInteger(timeout) ||\n timeout <= 0 ||\n timeout > MAX_TIMER_MS\n ) {\n throw badGoogleProviderOptions(\n `providerOptions.google.httpOptions.timeout must be a positive integer of at most ${MAX_TIMER_MS} ms (the longest delay a Node timer holds; a larger one aborts the call after 1 ms) for model \"${model}\".`,\n )\n }\n mapped.httpOptions = { timeout }\n } else {\n mapped.httpOptions = {}\n }\n }\n\n if (googleOpts['safetySettings'] !== undefined) {\n if (!Array.isArray(googleOpts['safetySettings'])) {\n throw badGoogleProviderOptions(\n `providerOptions.google.safetySettings must be an array for model \"${model}\".`,\n )\n }\n\n mapped.safetySettings = googleOpts['safetySettings'].map((setting, index) =>\n parseGoogleSafetySetting(setting, index, model),\n )\n }\n\n const allowSchemaWithSearch = googleOpts['allowSchemaWithSearch']\n if (allowSchemaWithSearch !== undefined && typeof allowSchemaWithSearch !== 'boolean') {\n throw badGoogleProviderOptions(\n `providerOptions.google.allowSchemaWithSearch must be a boolean for model \"${model}\", received ${describeType(allowSchemaWithSearch)}.`,\n )\n }\n const requireGrounding = googleOpts['requireGrounding']\n if (requireGrounding !== undefined && typeof requireGrounding !== 'boolean') {\n throw badGoogleProviderOptions(\n `providerOptions.google.requireGrounding must be a boolean for model \"${model}\", received ${describeType(requireGrounding)}.`,\n )\n }\n\n if (googleOpts['tools'] !== undefined) {\n if (!Array.isArray(googleOpts['tools'])) {\n throw badGoogleProviderOptions(\n `providerOptions.google.tools must be an array for model \"${model}\".`,\n )\n }\n\n const tools = googleOpts['tools'].map((tool) => parseGoogleTool(tool, model))\n if (descriptorGrounding !== true) {\n throw badGoogleProviderOptions(\n `providerOptions.google.tools is not supported for model \"${model}\".`,\n )\n }\n\n if (structuredOutputRequested && structuredOutputWithTools !== true) {\n assertSchemaWithSearchAllowed(\n model,\n structuredOutputWithTools,\n allowSchemaWithSearch,\n 'providerOptions.google.tools',\n )\n }\n\n mapped.tools = tools\n }\n\n // Search held by a cache handle (`{ cacheName, toolKinds: ['googleSearch'] }`) is Search\n // like any other: the same schema rule applies. A bare cache name says nothing about what\n // the cache holds, so it is not judged here; the response is (a schema call that did not\n // opt in and whose response reports search queries returns a warning, see the adapter).\n const searchInCache = mapped.cachedToolKinds?.includes('googleSearch') === true\n if (searchInCache) {\n if (descriptorGrounding !== true) {\n throw badGoogleProviderOptions(\n `providerOptions.google.cachedContent.toolKinds lists googleSearch, which is not supported for model \"${model}\": the model does not support grounding.`,\n )\n }\n if (structuredOutputRequested && structuredOutputWithTools !== true) {\n assertSchemaWithSearchAllowed(\n model,\n structuredOutputWithTools,\n allowSchemaWithSearch,\n 'the cache handle (cachedContent.toolKinds)',\n )\n }\n }\n\n const searchSent =\n searchInCache || mapped.tools?.some((tool) => 'googleSearch' in tool) === true\n if (allowSchemaWithSearch === true) {\n if (descriptorGrounding !== true) {\n throw badGoogleProviderOptions(\n `providerOptions.google.allowSchemaWithSearch is not supported for model \"${model}\": the model does not support grounding.`,\n )\n }\n if (!searchSent || !structuredOutputRequested) {\n throw badGoogleProviderOptions(\n `providerOptions.google.allowSchemaWithSearch requires both Search (providerOptions.google.tools: [{ googleSearch: {} }], or a cachedContent handle whose toolKinds lists googleSearch) and output.jsonSchema for model \"${model}\".`,\n )\n }\n if (structuredOutputWithTools === undefined) {\n throw badGoogleProviderOptions(noSchemaWithSearchEvidence(model))\n }\n }\n\n if (requireGrounding === true && !searchSent) {\n throw badGoogleProviderOptions(\n `providerOptions.google.requireGrounding requires Search: providerOptions.google.tools: [{ googleSearch: {} }], or a cachedContent handle whose toolKinds lists googleSearch, for model \"${model}\".`,\n )\n }\n const effectiveRequireGrounding = requireGrounding ?? allowSchemaWithSearch === true\n if (effectiveRequireGrounding) mapped.requireGrounding = true\n\n return mapped\n}\n\nfunction assertSamplingAllowed(\n config: GeminiDispatchConfig,\n model: string,\n sampling: string | undefined,\n): void {\n if (sampling !== 'fixed') {\n return\n }\n\n const offendingSampling: string[] = []\n if ('temperature' in config) {\n offendingSampling.push('temperature')\n }\n if ('topP' in config) {\n offendingSampling.push('topP')\n }\n if ('topK' in config) {\n offendingSampling.push('topK')\n }\n\n if (offendingSampling.length > 0) {\n throw new LlmError(\n `Sampling parameters [${offendingSampling.join(', ')}] are not supported for model \"${model}\" (fixed sampling).`,\n { kind: 'bad_request', retryable: false },\n )\n }\n}\n\n// ---------------------------------------------------------------------------\n// FinishReason mapping (Gemini SDK enum → our FinishReason)\n// ---------------------------------------------------------------------------\n\n/**\n * Largest request Google accepts without the Files API: \"Always use the Files\n * API when the total request size (including the files, text prompt, system\n * instructions, etc.) is larger than 100 MB. For PDF files, the limit is 50\n * MB.\" (ai.google.dev/gemini-api/docs/files and /file-input-methods, both\n * dated 2026-09-23, read 2026-10-03). MB is read as MiB, the looser reading,\n * so the check never rejects what Google would accept.\n */\nconst MAX_INLINE_REQUEST_BYTES = 100 * 1024 * 1024\nconst MAX_INLINE_PDF_BYTES = 50 * 1024 * 1024\n/** The one media type the PDF cap applies to, matched as admission matches it. */\nconst PDF_MEDIA_TYPES: readonly string[] = ['application/pdf']\n\n/**\n * Rejects, before dispatch, a request whose inline data and text certainly\n * exceed Google's request limit. The size counted is a lower bound of the\n * request body: base64 characters of inline media, UTF-8 bytes of text and the\n * system instruction.\n */\nfunction assertInlinePayloadWithinLimits(\n contents: readonly GeminiContent[],\n system: string | undefined,\n): void {\n let total = system === undefined ? 0 : utf8ByteLength(system)\n contents.forEach((content, mi) => {\n content.parts.forEach((part, pi) => {\n if ('text' in part) total += utf8ByteLength(part.text)\n if (!('inlineData' in part)) return\n const { mimeType, data } = part.inlineData\n total += data.length\n if (isMediaTypeAdmitted(mimeType, PDF_MEDIA_TYPES)) {\n const decoded = Math.floor((data.length * 3) / 4)\n if (decoded > MAX_INLINE_PDF_BYTES) {\n throw new LlmError(\n `messages[${mi}].parts[${pi}] is an inline PDF of about ${decoded} bytes, over Google's 50 MB inline PDF limit. Upload it with GoogleFileStore and send a file-uri part.`,\n {\n kind: 'bad_request',\n retryable: false,\n provider: 'google',\n issues: [\n {\n path: `messages[${mi}].parts[${pi}]`,\n message: 'inline PDF over 50 MB',\n },\n ],\n },\n )\n }\n }\n })\n })\n if (total > MAX_INLINE_REQUEST_BYTES) {\n throw new LlmError(\n `The request carries at least ${total} bytes of inline data and text, over Google's 100 MB request limit. Upload large media with GoogleFileStore and send file-uri parts.`,\n {\n kind: 'bad_request',\n retryable: false,\n provider: 'google',\n issues: [{ path: 'messages', message: 'request over 100 MB' }],\n },\n )\n }\n}\n\n/** Candidate fields copied to `providerMetadata.google.candidate` when present. */\nconst CANDIDATE_METADATA_KEYS = [\n 'finishReason',\n 'finishMessage',\n 'safetyRatings',\n 'citationMetadata',\n 'urlContextMetadata',\n] as const\n\n/** Longest `finishMessage` copied into a row or an error (characters). */\nconst MAX_FINISH_MESSAGE_CHARS = 512\n/** Most entries kept from any array in copied candidate metadata. */\nconst MAX_METADATA_ARRAY = 50\n/** Longest string kept inside copied candidate metadata (characters). */\nconst MAX_METADATA_STRING = 2048\n/** Deepest nesting copied from candidate metadata. */\nconst MAX_METADATA_DEPTH = 8\n/** Most safety ratings listed in an error message. */\nconst MAX_RATINGS_IN_MESSAGE = 12\n\nfunction truncateText(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max)}…` : text\n}\n\n/**\n * A bounded copy of provider metadata for a row: strings are cut at\n * `MAX_METADATA_STRING`, arrays at `MAX_METADATA_ARRAY` entries, nesting at\n * `MAX_METADATA_DEPTH`. `state.truncated` says whether anything was cut.\n * `providerMetadata` is persisted on every row, and these fields can carry\n * model text (a malformed function call's `finishMessage`) or long source lists.\n */\nfunction boundMetadata(\n value: unknown,\n state: { truncated: boolean },\n depth = 0,\n): JsonValue {\n if (typeof value === 'string') {\n if (value.length > MAX_METADATA_STRING) state.truncated = true\n return truncateText(value, MAX_METADATA_STRING)\n }\n if (value === null || typeof value !== 'object') return value as JsonValue\n if (depth >= MAX_METADATA_DEPTH) {\n state.truncated = true\n return null\n }\n if (Array.isArray(value)) {\n if (value.length > MAX_METADATA_ARRAY) state.truncated = true\n return value\n .slice(0, MAX_METADATA_ARRAY)\n .map((item) => boundMetadata(item, state, depth + 1))\n }\n const out: { [k: string]: JsonValue } = {}\n for (const [key, item] of Object.entries(value as Record<string, unknown>)) {\n if (item !== undefined) out[key] = boundMetadata(item, state, depth + 1)\n }\n return out\n}\n\n/**\n * `category=probability` per safety rating (`(blocked)` when the rating blocked\n * the response), bounded, for an error message: which category refused the\n * call is the evidence a host needs from a filtered empty response.\n */\nfunction describeSafetyRatings(ratings: unknown): string {\n if (!Array.isArray(ratings) || ratings.length === 0) return ''\n const parts = ratings.slice(0, MAX_RATINGS_IN_MESSAGE).flatMap((rating) => {\n if (typeof rating !== 'object' || rating === null) return []\n const { category, probability, blocked } = rating as Record<string, unknown>\n if (typeof category !== 'string') return []\n return [\n `${truncateText(category, 80)}=${\n typeof probability === 'string' ? truncateText(probability, 40) : 'unknown'\n }${blocked === true ? ' (blocked)' : ''}`,\n ]\n })\n if (parts.length === 0) return ''\n const more =\n ratings.length > MAX_RATINGS_IN_MESSAGE\n ? ` and ${ratings.length - MAX_RATINGS_IN_MESSAGE} more`\n : ''\n return `${parts.join(', ')}${more}`\n}\n\nfunction mapFinishReason(raw: string | undefined): FinishReason | undefined {\n if (raw === undefined) return undefined\n switch (raw) {\n case 'STOP':\n return 'stop'\n case 'MAX_TOKENS':\n return 'length'\n case 'SAFETY':\n case 'RECITATION':\n case 'BLOCKLIST':\n case 'PROHIBITED_CONTENT':\n case 'SPII':\n case 'IMAGE_SAFETY':\n case 'IMAGE_PROHIBITED_CONTENT':\n case 'IMAGE_RECITATION':\n return 'content_filter'\n default:\n return 'other'\n }\n}\n\n// ---------------------------------------------------------------------------\n// mediaResolution mapping (normalized hint → Gemini PartMediaResolutionLevel)\n// ---------------------------------------------------------------------------\n\n/**\n * Map our normalized cross-provider `mediaResolution` hint to the Gemini\n * `PartMediaResolutionLevel` string-enum value emitted on `Part.mediaResolution`.\n */\nfunction mapMediaResolution(\n res: 'low' | 'medium' | 'high',\n): 'MEDIA_RESOLUTION_LOW' | 'MEDIA_RESOLUTION_MEDIUM' | 'MEDIA_RESOLUTION_HIGH' {\n switch (res) {\n case 'low':\n return 'MEDIA_RESOLUTION_LOW'\n case 'medium':\n return 'MEDIA_RESOLUTION_MEDIUM'\n case 'high':\n return 'MEDIA_RESOLUTION_HIGH'\n default:\n return assertNever(res)\n }\n}\n\n// ---------------------------------------------------------------------------\n// Usage mapping — #1 correctness rule\n// ---------------------------------------------------------------------------\n\n/**\n * Map Gemini usageMetadata to our Usage type.\n *\n * **GROSS convention enforced here:**\n * - outputTokens = candidatesTokenCount + (thoughtsTokenCount ?? 0)\n * → thinkingTokens ⊆ outputTokens so cost math doesn't double-count.\n * - inputTokens = promptTokenCount (cachedContentTokenCount is already a\n * subset of promptTokenCount → cachedInputTokens = cachedContentTokenCount).\n */\nfunction mapUsage(meta: GeminiUsageMetadataShape | undefined): Usage {\n const promptTokenCount = meta?.promptTokenCount ?? 0\n const candidatesTokenCount = meta?.candidatesTokenCount ?? 0\n const cachedContentTokenCount = meta?.cachedContentTokenCount\n const thoughtsTokenCount = meta?.thoughtsTokenCount\n const toolUsePromptTokenCount = meta?.toolUsePromptTokenCount\n\n // #1 RULE: outputTokens = candidates + thoughts (GROSS; thinking ⊆ output)\n const outputTokens = candidatesTokenCount + (thoughtsTokenCount ?? 0)\n const inputTokens = promptTokenCount\n const totalTokens = meta?.totalTokenCount\n\n // Canonical details keys: input, cached, output.\n const details: Record<string, number> = {\n input: inputTokens,\n output: outputTokens,\n ...(cachedContentTokenCount !== undefined ? { cached: cachedContentTokenCount } : {}),\n ...(thoughtsTokenCount !== undefined ? { thinking: thoughtsTokenCount } : {}),\n // Tokens of Search results fed back to the model. They sit in\n // `totalTokenCount` but outside `promptTokenCount`. Google's pricing page\n // (read 2026-10) says retrieved search results are not charged\n // as input tokens, so they are recorded and not priced; no live billing\n // reconciliation has confirmed it, so the total mismatch still marks the\n // cost `estimated`.\n ...(toolUsePromptTokenCount !== undefined\n ? { tool_use_prompt: toolUsePromptTokenCount }\n : {}),\n }\n\n // Per-modality prompt tokens, under `input_<modality>` (the whole prompt, cached\n // part included) and `cached_<modality>` (the cached part): the pricing source\n // bills audio apart from text on the models that price it apart. A modality\n // listed twice sums.\n let cachedSplitTokens: number | undefined\n for (const [prefix, entries] of [\n ['input', meta?.promptTokensDetails],\n ['cached', meta?.cacheTokensDetails],\n ] as const) {\n if (!Array.isArray(entries)) continue\n if (prefix === 'cached') cachedSplitTokens = 0\n for (const entry of entries as readonly unknown[]) {\n // Malformed provider output (a null entry, a missing field) is skipped.\n if (typeof entry !== 'object' || entry === null) continue\n const { modality, tokenCount: count } = entry as {\n modality?: unknown\n tokenCount?: unknown\n }\n if (\n typeof modality !== 'string' ||\n modality === '' ||\n typeof count !== 'number' ||\n !Number.isFinite(count) ||\n count < 0\n ) {\n continue\n }\n const key = `${prefix}_${modality.toLowerCase()}`\n details[key] = (details[key] ?? 0) + count\n if (prefix === 'cached') cachedSplitTokens = (cachedSplitTokens ?? 0) + count\n }\n }\n // A cache split that lists no audio and covers every cached token proves the\n // cached audio is zero (a text cache beside audio in the new part of the prompt),\n // so the pricing source need not treat it as unknown. A split that covers fewer\n // tokens than were cached leaves the remainder, and so the audio share, unknown.\n if (\n cachedSplitTokens !== undefined &&\n cachedContentTokenCount !== undefined &&\n cachedContentTokenCount > 0 &&\n cachedSplitTokens >= cachedContentTokenCount &&\n details['cached_audio'] === undefined\n ) {\n details['cached_audio'] = 0\n }\n\n // Raw: the full usageMetadata object verbatim (as JsonValue).\n const raw: JsonValue =\n meta !== undefined ? (meta as unknown as { [k: string]: JsonValue }) : null\n\n const usage: Usage = {\n inputTokens,\n outputTokens,\n details,\n raw,\n ...(cachedContentTokenCount !== undefined\n ? { cachedInputTokens: cachedContentTokenCount }\n : {}),\n ...(thoughtsTokenCount !== undefined ? { thinkingTokens: thoughtsTokenCount } : {}),\n ...(totalTokens !== undefined ? { totalTokens } : {}),\n }\n\n return usage\n}\n\n// ---------------------------------------------------------------------------\n// Message → Gemini contents mapping (shared by run() and countTokens())\n// ---------------------------------------------------------------------------\n\n/**\n * Map a single {@link Part} to its Gemini SDK equivalent.\n *\n * - `text` → `{ text }`\n * - `inline-media` → `{ inlineData: { mimeType, data } }` + optional `mediaResolution`\n * - `file-uri` → `{ fileData: { mimeType, fileUri } }` + optional `mediaResolution`\n * - `file-ref` → rejected (`bad_request`) — Gemini Files uses URIs, not bare ids\n *\n * `mediaResolution` IS supported as a per-part field by the Gemini SDK\n * (`Part.mediaResolution`). The normalised value is mapped to the\n * `PartMediaResolutionLevel` string enum before emission.\n */\nfunction mapGoogleToolChoice(choice: ToolChoice): {\n mode: 'AUTO' | 'ANY' | 'NONE'\n allowedFunctionNames?: string[]\n} {\n if (choice === 'auto') return { mode: 'AUTO' }\n if (choice === 'required') return { mode: 'ANY' }\n if (choice === 'none') return { mode: 'NONE' }\n return { mode: 'ANY', allowedFunctionNames: [choice.name] }\n}\n\n/**\n * Gemini's `functionResponse.response` must be a JSON object. An error result\n * is `{ error }`; a non-object result is wrapped as `{ output }`.\n */\nfunction toFunctionResponseObject(p: {\n result: JsonValue\n isError?: boolean\n}): Record<string, unknown> {\n if (p.isError === true) return { error: p.result }\n if (typeof p.result === 'object' && p.result !== null && !Array.isArray(p.result)) {\n return p.result\n }\n return { output: p.result }\n}\n\nfunction mapPart(p: Part, signature: string | undefined): GeminiContentPart {\n switch (p.kind) {\n case 'text':\n return {\n text: p.text,\n ...(signature !== undefined ? { thoughtSignature: signature } : {}),\n }\n\n case 'inline-media': {\n return {\n inlineData: {\n mimeType: p.mimeType,\n data: p.data,\n },\n ...(p.mediaResolution !== undefined\n ? { mediaResolution: { level: mapMediaResolution(p.mediaResolution) } }\n : {}),\n }\n }\n\n case 'file-uri': {\n return {\n fileData: {\n mimeType: p.mimeType,\n fileUri: p.uri,\n },\n ...(p.mediaResolution !== undefined\n ? { mediaResolution: { level: mapMediaResolution(p.mediaResolution) } }\n : {}),\n }\n }\n\n case 'file-ref':\n throw new LlmError(\n 'Google Gemini expects FileUriPart with a Files API uri; got file-ref (provider file id). Upload via GoogleFileStore and pass the returned uri.',\n { kind: 'bad_request', retryable: false, provider: 'google' },\n )\n\n case 'tool-call':\n return {\n functionCall: {\n // A synthesized id never reached Gemini; sending it would only be noise.\n ...(isSynthesizedToolCallId(p.toolCallId) ? {} : { id: p.toolCallId }),\n name: p.toolName,\n args: p.args,\n },\n ...(signature !== undefined ? { thoughtSignature: signature } : {}),\n }\n\n case 'tool-result':\n return {\n functionResponse: {\n ...(isSynthesizedToolCallId(p.toolCallId) ? {} : { id: p.toolCallId }),\n name: p.toolName,\n response: toFunctionResponseObject(p),\n },\n }\n\n default:\n return assertNever(p)\n }\n}\n\n/**\n * Map engine {@link Message}s to Gemini SDK `contents`.\n *\n * Shared by `run()` (generation) and `countTokens()` (token counting) so both\n * code paths map messages identically — a divergence here would make token\n * counts unrepresentative of the actual generation call.\n */\nexport function mapMessagesToGeminiContents(\n messages: Message[],\n signatures?: ReadonlyMap<string, string>,\n): GeminiContent[] {\n return messages.map((msg, mi) => ({\n role: msg.role === 'assistant' ? 'model' : 'user',\n parts: msg.parts.map((part, pi) => mapPart(part, signatures?.get(`${mi}:${pi}`))),\n }))\n}\n\n// ---------------------------------------------------------------------------\n// Adapter options\n// ---------------------------------------------------------------------------\n\nexport interface GeminiAdapterOptions {\n /**\n * Inject a pre-built client (real or fake).\n * When omitted, `buildGoogleClient` is called with `ctx.auth` at call time,\n * inside the classified try/catch so any construction failure is wrapped\n * as a typed `LlmError`.\n */\n client?: GeminiClientLike\n}\n\n// ---------------------------------------------------------------------------\n// geminiAdapter factory\n// ---------------------------------------------------------------------------\n\n/**\n * Create a Gemini provider adapter.\n *\n * @param opts.client - Optional pre-built client (e.g. for testing).\n */\nexport function geminiAdapter(opts?: GeminiAdapterOptions): ProviderAdapter {\n return geminiAdapterWithClientFactory(opts?.client, buildGoogleClient)\n}\n\n/**\n * The adapter with its client factory replaced: the seam a test uses to make\n * client construction fail without the real SDK. Not exported from the package\n * index, so it is in no shipped type.\n *\n * @internal\n */\nexport function geminiAdapterWithClientFactory(\n injectedClient: GeminiClientLike | undefined,\n buildClient: (auth: AuthMaterial) => GeminiClientLike | Promise<GeminiClientLike>,\n): ProviderAdapter {\n return {\n id: 'google',\n\n async run(req: ResolvedRequest, ctx: AdapterCtx): Promise<AdapterResult> {\n if (req.provider !== 'google') {\n throw new LlmError(\n `geminiAdapter received a request for provider \"${req.provider}\", expected \"google\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n\n const warnings: Warning[] = []\n const model = req.model\n const descriptor = req.modelDescriptor\n assertModelMatchesDescriptor(req, descriptor, 'google')\n assertInputMimeTypesAdmitted(req.messages, descriptor, 'google')\n const signsHistory = descriptor.capabilities?.providerState === true\n if (req.transientProviderState !== undefined && !signsHistory) {\n throw new LlmError(`Model \"${model}\" does not admit transientProviderState.`, {\n kind: 'bad_request',\n retryable: false,\n })\n }\n\n // ------------------------------------------------------------------\n // 1. Map messages → contents. Gemini 3.x replays each turn's thought\n // signatures from the overlay in transientProviderState, checked\n // against the host's own messages (no copy of the history is kept).\n // ------------------------------------------------------------------\n\n const resolved = signsHistory\n ? resolveSignatures(\n parseSignatureState(req.transientProviderState),\n req.messages,\n model,\n )\n : undefined\n // Stale text entries were dropped; the verified ones are carried forward.\n const incomingSignatures: GoogleSignatureEntry[] = resolved?.kept ?? []\n if (resolved !== undefined && resolved.dropped.length > 0) {\n warnings.push({\n type: 'other',\n message: `google: dropped ${resolved.dropped.length} stale text signature(s) from transientProviderState (${resolved.dropped.join('; ')}); Google treats text signatures as optional, so nothing required was lost.`,\n })\n }\n const contents: GeminiContent[] = mapMessagesToGeminiContents(\n req.messages,\n resolved?.bySlot,\n )\n // An empty system string adds no instruction, so it is absent everywhere\n // (here, the `cachedContent` conflict check and `countTokens`).\n const system =\n req.system !== undefined && req.system !== '' ? req.system : undefined\n assertInlinePayloadWithinLimits(contents, system)\n\n // ------------------------------------------------------------------\n // 2. Build GenerateContentConfig\n // ------------------------------------------------------------------\n const genConfig = req.config\n const config: GeminiDispatchConfig = {}\n\n // System instruction\n if (system !== undefined) {\n config.systemInstruction = { parts: [{ text: system }] }\n }\n\n // Basic generation parameters (only include when defined)\n if (genConfig.temperature !== undefined) {\n config.temperature = genConfig.temperature\n }\n if (genConfig.topP !== undefined) {\n config.topP = genConfig.topP\n }\n if (genConfig.topK !== undefined) {\n config.topK = genConfig.topK\n }\n if (genConfig.maxOutputTokens !== undefined) {\n config.maxOutputTokens = genConfig.maxOutputTokens\n }\n if (genConfig.stopSequences !== undefined) {\n config.stopSequences = genConfig.stopSequences\n }\n\n // Service tier (FLEX or STANDARD)\n // Real SDK: GenerateContentConfig.serviceTier = ServiceTier enum (\"flex\"|\"standard\")\n const explicit = (genConfig as { serviceTier?: 'flex' | 'standard' }).serviceTier\n const supported = descriptor.capabilities?.serviceTiers\n if (explicit !== undefined) {\n // caller explicitly chose a tier — reject if the model can't honour it\n if (supported === undefined || !supported.includes(explicit)) {\n throw new LlmError(\n `serviceTier \"${explicit}\" is not supported for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n config.serviceTier = explicit\n }\n\n // ------------------------------------------------------------------\n // 3. Reasoning → thinkingConfig\n // ------------------------------------------------------------------\n const reasoning = genConfig.reasoning\n if (reasoning !== undefined) {\n const reasoningApi = descriptor.capabilities?.reasoningApi\n\n if (reasoning.effort === 'max') {\n throw new LlmError(\n `reasoning.effort \"max\" is not supported for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n\n if (reasoning.effort !== undefined && reasoning.budgetTokens !== undefined) {\n throw new LlmError(\n `Provide either reasoning.effort or reasoning.budgetTokens, not both, for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n\n if (reasoningApi === 'budget') {\n // gemini-2.5* → thinkingBudget. `xhigh` is not a Gemini thinking\n // budget — reject rather than invent a token count.\n if (\n reasoning.effort === 'none' &&\n descriptor.capabilities?.admittedReasoningEfforts?.includes('none') !== true\n ) {\n throw new LlmError(\n `reasoning.effort \"none\" is not supported for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n if (reasoning.effort === 'xhigh') {\n throw new LlmError(\n `reasoning.effort \"xhigh\" is not supported for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n const budget =\n reasoning.budgetTokens !== undefined\n ? reasoning.budgetTokens\n : reasoning.effort !== undefined\n ? GOOGLE_REASONING_EFFORT_BUDGET[reasoning.effort]\n : undefined\n\n // Google says actual thinking can under- or overflow the budget, so a\n // budget at or above the output cap is a risk, not an invalid request.\n if (\n budget !== undefined &&\n budget > 0 &&\n genConfig.maxOutputTokens !== undefined &&\n budget >= genConfig.maxOutputTokens\n ) {\n warnings.push({\n type: 'other',\n message: `google: thinkingBudget (${budget}) is not below maxOutputTokens (${genConfig.maxOutputTokens}); thinking may consume the whole cap and leave no answer. Raise maxOutputTokens or lower the reasoning budget.`,\n })\n }\n\n config.thinkingConfig = {\n ...(budget !== undefined ? { thinkingBudget: budget } : {}),\n ...(reasoning.includeThoughts === true ? { includeThoughts: true } : {}),\n }\n } else if (reasoningApi === 'level') {\n // gemini-3.* → thinkingLevel\n if (reasoning.budgetTokens !== undefined) {\n throw new LlmError(\n `reasoning.budgetTokens is not supported for model \"${model}\" (it uses thinkingLevel, not thinkingBudget); use reasoning.effort instead.`,\n { kind: 'bad_request', retryable: false },\n )\n }\n\n // Real SDK ThinkingLevel enum: \"LOW\" | \"MEDIUM\" | \"HIGH\" | \"MINIMAL\".\n // `none` maps to MINIMAL only when the descriptor admits it.\n const admitted = descriptor.capabilities?.admittedReasoningEfforts\n const admitsNone = admitted?.includes('none') === true\n let thinkingLevel: string | undefined\n if (reasoning.effort !== undefined) {\n switch (reasoning.effort) {\n case 'none':\n if (!admitsNone) {\n throw new LlmError(\n `reasoning.effort \"none\" is not supported for model \"${model}\"; thinkingLevel MINIMAL is not emitted.`,\n { kind: 'bad_request', retryable: false },\n )\n }\n thinkingLevel = 'MINIMAL'\n break\n case 'low':\n thinkingLevel = 'LOW'\n break\n case 'medium':\n thinkingLevel = 'MEDIUM'\n break\n case 'high':\n thinkingLevel = 'HIGH'\n break\n case 'xhigh':\n throw new LlmError(\n `reasoning.effort \"${reasoning.effort}\" is not supported for model \"${model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n default:\n assertNever(reasoning.effort)\n }\n }\n\n // A level model has no budget to compare with the cap, so the rule is\n // the measured one: at `high`, thinking reached 4,000+ tokens in about 10%\n // of calls (docs/thinking-token-distribution.md). A risk, not a rejection.\n if (\n thinkingLevel === 'HIGH' &&\n genConfig.maxOutputTokens !== undefined &&\n genConfig.maxOutputTokens < GOOGLE_HIGH_EFFORT_MIN_OUTPUT_TOKENS\n ) {\n warnings.push({\n type: 'other',\n message: `google: reasoning.effort \"high\" can spend several thousand thinking tokens (measured up to 8,859) and maxOutputTokens is ${genConfig.maxOutputTokens}, below ${GOOGLE_HIGH_EFFORT_MIN_OUTPUT_TOKENS}; thinking may consume the whole cap and leave no answer. Raise maxOutputTokens or lower the effort.`,\n })\n }\n\n config.thinkingConfig = {\n ...(thinkingLevel !== undefined ? { thinkingLevel } : {}),\n ...(reasoning.includeThoughts === true ? { includeThoughts: true } : {}),\n }\n } else {\n throw new LlmError(\n `Model \"${model}\" does not support reasoning/thinkingConfig.`,\n { kind: 'bad_request', retryable: false },\n )\n }\n }\n\n // ------------------------------------------------------------------\n // 4. Structured output → responseMimeType + responseJsonSchema\n // ------------------------------------------------------------------\n const structuredOutputRequested = req.outputJsonSchema !== undefined\n if (structuredOutputRequested) {\n // This adapter has one structured-output path, the native one; a schema\n // for a model without it would be dropped, so it is rejected.\n if (descriptor.capabilities?.nativeStructuredOutput === false) {\n throw new LlmError(\n `output.jsonSchema is not supported for model \"${model}\": the model has no native structured output and the Google adapter has no other path.`,\n {\n kind: 'bad_request',\n retryable: false,\n provider: 'google',\n issues: [\n {\n path: 'output.jsonSchema',\n message: 'model has no native structured output',\n },\n ],\n },\n )\n }\n // Standard JSON Schema, verbatim and in the host's key order. A\n // keyword Google would silently ignore is rejected here, not sent.\n assertJsonSchemaProfile(\n req.outputJsonSchema as JsonValue,\n 'output.jsonSchema',\n googleJsonSchemaProfile(descriptor.model),\n )\n config.responseMimeType = 'application/json'\n config.responseJsonSchema = req.outputJsonSchema\n }\n\n // ------------------------------------------------------------------\n // 5. providerOptions.google → explicit allowlisted mapping\n // ------------------------------------------------------------------\n const googleProviderConfig = mapGoogleProviderOptions({\n googleOpts: genConfig.providerOptions?.['google'],\n model,\n structuredOutputRequested,\n descriptorGrounding: descriptor.capabilities?.grounding,\n descriptorCaching: descriptor.capabilities?.caching !== undefined,\n structuredOutputWithTools: descriptor.capabilities?.structuredOutputWithTools,\n })\n // Search facts, normalised across providers (ADR-035): `web_search_requested`\n // is 1 when Search was asked for; `web_search_calls` is the number of\n // queries the response reports (occurrences, not unique strings), absent\n // when the response does not say. The pricing source reads both, because\n // it sees only `(model, usage, tier)`.\n //\n // Search was asked for when the request sent `googleSearch`, or when the\n // handle behind `cachedContent` records that its cache holds the tool (the\n // request then carries no tool). When the request declares no search (a\n // bare cache name says nothing about what the cache holds), grounding\n // metadata in the response is the evidence: queries observed mean the fee\n // was incurred, so it is priced from them, and the cost is never exact.\n const googleSearchSent =\n googleProviderConfig.tools?.some((tool) => 'googleSearch' in tool) === true\n const searchDeclared =\n googleSearchSent ||\n googleProviderConfig.cachedToolKinds?.includes('googleSearch') === true\n const requireGrounding = googleProviderConfig.requireGrounding === true\n // A schema call on a model where Search misses under a response schema, with no\n // Search declared (a bare cache name may hold the tool): not blocked up front, so the\n // response is the evidence. See `groundingWarnings`.\n const schemaSearchUndeclared =\n structuredOutputRequested &&\n !searchDeclared &&\n descriptor.capabilities?.structuredOutputWithTools !== true\n // Audio in the prompt is billed at its own rate on some models, from the\n // per-modality counts the response reports; `audio_input_requested` lets the\n // pricing source tell a response that omits them from a request without audio.\n const audioRequested = req.messages.some((message) =>\n message.parts.some(\n (part) =>\n (part.kind === 'inline-media' || part.kind === 'file-uri') &&\n part.mimeType.toLowerCase().startsWith('audio/'),\n ),\n )\n const mapUsageWithAudioMarker = (\n meta: GeminiUsageMetadataShape | undefined,\n ): Usage => {\n const mapped = mapUsage(meta)\n if (audioRequested) mapped.details['audio_input_requested'] = 1\n return mapped\n }\n const usageFor = (\n meta: GeminiUsageMetadataShape | undefined,\n groundingMetadata?: unknown,\n ): Usage => {\n const mapped = mapUsageWithAudioMarker(meta)\n const queries = countWebSearchQueries(groundingMetadata)\n if (searchDeclared) {\n mapped.details['web_search_requested'] = 1\n if (queries !== undefined) mapped.details['web_search_calls'] = queries\n } else if (groundingMetadata !== undefined) {\n // Undeclared Search with grounding metadata: queries observed price the\n // fee; none observed leaves the count unknown (estimated, tools lane 0).\n mapped.details['web_search_requested'] = 1\n if (queries !== undefined && queries > 0) {\n mapped.details['web_search_calls'] = queries\n }\n }\n return mapped\n }\n /** Warnings about a grounded call whose response does not show what Search did. */\n const groundingWarnings = (groundingMetadata: unknown): Warning[] => {\n if (!searchDeclared) {\n if (groundingMetadata === undefined) return []\n const queries = countWebSearchQueries(groundingMetadata)\n const undeclaredSearchWarnings: Warning[] =\n schemaSearchUndeclared && queries !== undefined && queries > 0\n ? [\n {\n type: 'other',\n message: `google: this call attached a response schema and the response reports search queries, so Search ran from the cache named in cachedContent. Schema plus Search is not admitted by default for model \"${model}\" (Search does not reliably run when a schema is attached) and no googleSearch was declared, so nothing checked that it would run or opted in; the result is returned, the Search fee is priced from the observed queries (cost.confidence is \"estimated\"), and this pattern is unreliable. Declare Search with cachedContent: { cacheName, toolKinds: ['googleSearch'] } together with allowSchemaWithSearch: true (the call then fails unless the response proves Search ran), or use the two-call recipe in docs/grounded-structured.md.`,\n },\n ]\n : []\n return [\n ...undeclaredSearchWarnings,\n {\n type: 'other',\n message:\n queries !== undefined && queries > 0\n ? `google: the response reports ${queries} search quer${queries === 1 ? 'y' : 'ies'} but the request did not declare googleSearch (a cachedContent cache can hold the tool); the Search fee was priced from the observed queries, and cost.confidence is \"estimated\" because the free allowance is unknowable per call.`\n : 'google: the response carries groundingMetadata but the request did not declare googleSearch and the metadata names no query, so the number of searches is unknown; grounding fees are not included in cost, so cost.confidence is \"estimated\".',\n },\n ]\n }\n if (groundingMetadata === undefined) {\n return [\n {\n type: 'other',\n message:\n 'google: googleSearch was requested (sent, or held by the cache named in cachedContent) but the response carries no groundingMetadata, so Search may not have run, or may have run without being reported; grounding fees are not included in cost, so cost.confidence is \"estimated\".',\n },\n ]\n }\n if (countWebSearchQueries(groundingMetadata) === undefined) {\n return [\n {\n type: 'other',\n message:\n 'google: groundingMetadata has no webSearchQueries, so the number of searches is unknown; grounding fees are not included in cost, so cost.confidence is \"estimated\".',\n },\n ]\n }\n return []\n }\n /** Warnings about an audio request whose response does not split the prompt by modality. */\n const modalityWarnings = (\n meta: GeminiUsageMetadataShape | undefined,\n ): Warning[] => {\n if (meta === undefined) return []\n const warnings: Warning[] = []\n const { gaps } = promptLanes(mapUsageWithAudioMarker(meta))\n if (gaps.includes('audio-unreported')) {\n warnings.push({\n type: 'other',\n message:\n 'google: the request carries audio but usageMetadata.promptTokensDetails reports no AUDIO tokens, so the audio input rate could not be applied; on a model that prices audio apart from text, cost.confidence is \"estimated\" and the amount can understate.',\n })\n }\n if (gaps.includes('cached-audio-unknown')) {\n warnings.push({\n type: 'other',\n message:\n 'google: usageMetadata reports cached tokens without showing how many are audio (no AUDIO entry in cacheTokensDetails, and no per-modality prompt split that rules audio out), so audio in the cached content cannot be ruled out; on a model that prices audio apart from text, cost.confidence is \"estimated\" and the amount can understate.',\n })\n }\n if (gaps.includes('inconsistent')) {\n warnings.push({\n type: 'other',\n message:\n 'google: the per-modality token counts in usageMetadata contradict each other (audio above the prompt or the cache, or lanes that exceed the prompt); the counts were clamped, and on a model that prices audio apart from text, cost.confidence is \"estimated\".',\n })\n }\n return warnings\n }\n /** `usage` (and the grounding note) a failed-but-billed attempt carries. */\n const billedFailure = (\n meta: GeminiUsageMetadataShape | undefined,\n groundingMetadata?: unknown,\n ): { usage?: Usage; warnings?: Warning[] } => {\n if (meta === undefined) return {}\n const failureWarnings = [\n ...groundingWarnings(groundingMetadata),\n ...modalityWarnings(meta),\n ]\n return {\n usage: usageFor(meta, groundingMetadata),\n ...(failureWarnings.length > 0 ? { warnings: failureWarnings } : {}),\n }\n }\n\n if (googleProviderConfig.cachedContent !== undefined) {\n config.cachedContent = googleProviderConfig.cachedContent\n }\n if (googleProviderConfig.httpOptions !== undefined) {\n config.httpOptions = googleProviderConfig.httpOptions\n // The SDK arms its own timer from `httpOptions.timeout`. When the engine\n // arms its deadline at `timeoutMs`, a shorter SDK timer would end the call\n // first with a raw SDK abort instead of the engine's clean `timeout`.\n const sdkTimeout = googleProviderConfig.httpOptions.timeout\n if (\n sdkTimeout !== undefined &&\n genConfig.timeoutMs !== undefined &&\n sdkTimeout < genConfig.timeoutMs + TRANSPORT_TIMEOUT_BUFFER_MS\n ) {\n throw badGoogleProviderOptions(\n `providerOptions.google.httpOptions.timeout (${sdkTimeout} ms) must be at least timeoutMs + ${TRANSPORT_TIMEOUT_BUFFER_MS} ms (${\n genConfig.timeoutMs + TRANSPORT_TIMEOUT_BUFFER_MS\n } ms) for model \"${model}\": a shorter SDK timer would abort the call before the engine's own timeout and surface a raw SDK abort.`,\n )\n }\n }\n if (googleProviderConfig.safetySettings !== undefined) {\n config.safetySettings = googleProviderConfig.safetySettings\n }\n if (googleProviderConfig.tools !== undefined) {\n config.tools = googleProviderConfig.tools\n }\n\n if (req.tools !== undefined && req.tools.length > 0) {\n if (descriptor.capabilities?.functionCalling !== true) {\n throw new LlmError(\n `tools is not supported for google model \"${model}\" (capabilities.functionCalling is not true).`,\n { kind: 'bad_request', retryable: false, provider: 'google' },\n )\n }\n if (googleProviderConfig.tools !== undefined) {\n throw new LlmError(\n 'tools cannot be combined with providerOptions.google.tools (googleSearch): this adapter does not send function declarations and Search in one request.',\n { kind: 'bad_request', retryable: false, provider: 'google' },\n )\n }\n const toolProfile = googleJsonSchemaProfile(descriptor.model)\n req.tools.forEach((tool, index) => {\n assertJsonSchemaProfile(\n tool.inputJsonSchema,\n `tools[${index}].inputJsonSchema`,\n toolProfile,\n )\n })\n config.tools = [\n {\n functionDeclarations: req.tools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n parametersJsonSchema: tool.inputJsonSchema,\n })),\n },\n ]\n if (req.toolChoice !== undefined) {\n config.toolConfig = {\n functionCallingConfig: mapGoogleToolChoice(req.toolChoice),\n }\n }\n }\n\n // Gemini rejects a request that sets `system_instruction`, `tools` or\n // `tool_config` together with `cachedContent`: they must live in the cache\n // (`GoogleCacheStore.create` accepts them). Reject before dispatch.\n if (config.cachedContent !== undefined) {\n const conflicts = [\n ...(system !== undefined ? ['system'] : []),\n ...(req.tools !== undefined && req.tools.length > 0 ? ['tools'] : []),\n ...(googleProviderConfig.tools !== undefined\n ? ['providerOptions.google.tools']\n : []),\n ]\n if (conflicts.length > 0) {\n throw new LlmError(\n `providerOptions.google.cachedContent cannot be combined with ${conflicts.join(\n ' or ',\n )} for model \"${model}\": Gemini requires the system instruction and tools to be stored in the cache. Put them in GoogleCacheStore.create and omit them from the request.`,\n {\n kind: 'bad_request',\n retryable: false,\n provider: 'google',\n issues: conflicts.map((path) => ({\n path,\n message: 'cannot be sent with cachedContent',\n })),\n },\n )\n }\n }\n\n // ------------------------------------------------------------------\n // 5a. Fixed-sampling models reject sampling params even when a custom\n // descriptor or direct adapter test bypasses core parsing.\n // ------------------------------------------------------------------\n assertSamplingAllowed(config, model, descriptor.capabilities?.sampling)\n\n // ------------------------------------------------------------------\n // 6. AbortSignal passthrough + client-side tier ceiling\n //\n // @google/genai issue #1277: on SDK versions before 2.0.0,\n // httpOptions.timeout is a no-op for generateContent. Upstream landed a\n // related Undici dispatcher fix in 2.0.0 (commit 850f680), so this\n // ceiling is now a second guard, not the only one. On explicit flex calls\n // without timeoutMs, the engine arms NO AbortSignal; relying solely on\n // httpOptions.timeout risks a silent hang. We arm our own\n // AbortController here and combine it with any incoming signal so WE\n // enforce the ceiling regardless of the SDK bug.\n //\n // Flex and standard default paths need this extra timer when timeoutMs is\n // absent. When timeoutMs IS set the engine already arms a hard AbortSignal\n // at exactly timeoutMs.\n //\n // Abort reason uses DOMException with name 'TimeoutError' so classifyError\n // maps the resulting LlmError to kind:'timeout' (retryable:true), matching\n // how the rest of the codebase surfaces timeout errors.\n //\n // AbortSignal.any requires Node ≥ 20.3; our engine floor is Node ≥ 22.12,\n // so this is always available in supported environments.\n //\n // Real SDK: GenerateContentConfig.abortSignal (in config, NOT in params)\n // ------------------------------------------------------------------\n // The ceiling runs on the engine's scheduler (`ctx.scheduler`, which a host\n // test replaces with a FakeClock); the platform's timers only when the\n // adapter is called outside the engine.\n const timers: Scheduler = ctx.scheduler ?? PLATFORM_SCHEDULER\n let tierTimeoutHandle: TimerHandle | undefined\n // Set when this adapter's own client-side ceiling fired (see below).\n let ceilingFiredMs: number | undefined\n\n const clearTierTimeout = (): void => {\n ceilingFiredMs = undefined\n if (tierTimeoutHandle !== undefined) {\n timers.clearTimeout(tierTimeoutHandle)\n tierTimeoutHandle = undefined\n }\n }\n\n const applyTierTimeout = (tier: string | undefined): void => {\n clearTierTimeout()\n delete config.abortSignal\n\n const defaultTimeoutMs =\n genConfig.timeoutMs === undefined\n ? tier === 'flex'\n ? FLEX_DEFAULT_TIMEOUT_MS\n : tier === 'standard'\n ? STANDARD_DEFAULT_TIMEOUT_MS\n : undefined\n : undefined\n\n if (defaultTimeoutMs !== undefined) {\n const tierController = new AbortController()\n const tierLabel = tier === 'standard' ? 'Standard' : 'Flex'\n const timeoutReason = new DOMException(\n `${tierLabel} timeout: call exceeded ${defaultTimeoutMs}ms client-side ceiling` +\n ' (@google/genai #1277 belt-and-suspenders)',\n 'TimeoutError',\n )\n tierTimeoutHandle = timers.setTimeout(() => {\n ceilingFiredMs = defaultTimeoutMs\n tierController.abort(timeoutReason)\n }, defaultTimeoutMs)\n config.abortSignal =\n ctx.signal !== undefined\n ? AbortSignal.any([tierController.signal, ctx.signal])\n : tierController.signal\n } else if (ctx.signal !== undefined) {\n config.abortSignal = ctx.signal\n }\n }\n\n applyTierTimeout(config.serviceTier)\n\n // ------------------------------------------------------------------\n // 7. Transport timeout — set httpOptions.timeout so the @google/genai\n // HTTP transport does NOT preempt the AbortSignal hard ceiling.\n //\n // Policy (precedence, highest first):\n // 1. Caller-supplied providerOptions.google.httpOptions.timeout wins.\n // 2. timeoutMs is set → computed transport timeout = timeoutMs +\n // TRANSPORT_TIMEOUT_BUFFER_MS so the engine's AbortSignal (hard\n // ceiling at timeoutMs) always fires before the SDK transport timer.\n // 3. serviceTier 'flex', no timeoutMs → FLEX_DEFAULT_TIMEOUT_MS (no\n // buffer; there is no engine AbortSignal deadline in this case).\n // 4. serviceTier 'standard', no timeoutMs → STANDARD_DEFAULT_TIMEOUT_MS.\n //\n // Only assign config.httpOptions when the merged object is non-empty\n // (exactOptionalPropertyTypes-safe).\n // ------------------------------------------------------------------\n\n // Capture caller-supplied httpOptions BEFORE we overwrite.\n // These arrived via the allowlisted provider-options mapper above.\n const callerHttpOptions = config.httpOptions\n\n const computedTimeoutMs: number | undefined =\n genConfig.timeoutMs !== undefined\n ? genConfig.timeoutMs + TRANSPORT_TIMEOUT_BUFFER_MS\n : config.serviceTier === 'flex'\n ? FLEX_DEFAULT_TIMEOUT_MS\n : config.serviceTier === 'standard'\n ? STANDARD_DEFAULT_TIMEOUT_MS\n : undefined\n\n const mergedHttpOptions: { timeout?: number } = {\n ...(computedTimeoutMs !== undefined ? { timeout: computedTimeoutMs } : {}),\n ...callerHttpOptions,\n }\n\n if (Object.keys(mergedHttpOptions).length > 0) {\n config.httpOptions = mergedHttpOptions\n }\n\n // ------------------------------------------------------------------\n // 8b. Client construction + SDK call — both inside the classifier\n // so that ANY failure in run() (including a bad auth constructor)\n // is rethrown as a typed LlmError(provider:'google').\n // ------------------------------------------------------------------\n let response: GeminiResponseShape\n let servedServiceTier = config.serviceTier\n const dispatch = async (): Promise<GeminiResponseShape> => {\n const dispatchConfig: GeminiGenerateConfig = {\n ...config,\n ...(config.httpOptions !== undefined\n ? { httpOptions: { ...config.httpOptions } }\n : {}),\n }\n const params = {\n model,\n contents,\n config: dispatchConfig,\n }\n const client: GeminiClientLike =\n injectedClient !== undefined ? injectedClient : await buildClient(ctx.auth)\n ctx.logger.debug(\n {\n model,\n configKeys: Object.keys(dispatchConfig),\n serviceTier: dispatchConfig.serviceTier,\n },\n 'llm.adapter.dispatch',\n )\n return client.models.generateContent(params)\n }\n // What ended a call that nobody asked to end, when it was this adapter's\n // own timer or the SDK's: the client-side ceiling, or the SDK's transport\n // timer (it aborts its own request with a plain `AbortError`). The caller's\n // abort and the engine's deadline abort `ctx.signal`, and the engine answers\n // those itself. Not retryable: the same limit is reached again, and Google\n // may already have run, and billed, the request.\n const transportTimeoutOf = (rawErr: unknown): string | undefined => {\n if (ctx.signal?.aborted === true) return undefined\n if (ceilingFiredMs !== undefined) {\n return `Google call hit the ${ceilingFiredMs}ms client-side ceiling`\n }\n const sdkTimeoutMs = config.httpOptions?.timeout\n if (\n sdkTimeoutMs !== undefined &&\n rawErr instanceof Error &&\n rawErr.name === 'AbortError'\n ) {\n return `Google call hit the SDK transport timeout of ${sdkTimeoutMs}ms`\n }\n return undefined\n }\n try {\n response = await dispatch()\n } catch (rawErr) {\n // Classify SDK errors → LlmError\n const transportTimeout = transportTimeoutOf(rawErr)\n const typed = classifyGoogleError(rawErr, {\n ...(servedServiceTier !== undefined ? { servedServiceTier } : {}),\n ...(transportTimeout !== undefined ? { transportTimeout } : {}),\n })\n\n if (\n config.serviceTier === 'flex' &&\n googleProviderConfig.flexFallback !== false &&\n isGeminiCapacityError(typed)\n ) {\n config.serviceTier = 'standard'\n servedServiceTier = 'standard'\n warnings.push({\n type: 'other',\n message: `google: the flex call hit a capacity error (${\n typed.httpStatus ?? 'no status'\n }) and was sent again at the standard tier, billed at standard rates.${\n genConfig.timeoutMs === undefined\n ? ` Without timeoutMs the standard attempt runs under the ${STANDARD_DEFAULT_TIMEOUT_MS} ms client-side ceiling, not the flex ${FLEX_DEFAULT_TIMEOUT_MS} ms one.`\n : ''\n }`,\n })\n const fallbackTimeout =\n genConfig.timeoutMs !== undefined\n ? genConfig.timeoutMs + TRANSPORT_TIMEOUT_BUFFER_MS\n : STANDARD_DEFAULT_TIMEOUT_MS\n config.httpOptions = {\n timeout: fallbackTimeout,\n ...callerHttpOptions,\n }\n applyTierTimeout('standard')\n try {\n response = await dispatch()\n } catch (fallbackRawErr) {\n const fallbackTransportTimeout = transportTimeoutOf(fallbackRawErr)\n throw classifyGoogleError(fallbackRawErr, {\n servedServiceTier: 'standard',\n ...(fallbackTransportTimeout !== undefined\n ? { transportTimeout: fallbackTransportTimeout }\n : {}),\n })\n }\n } else {\n throw typed\n }\n } finally {\n // Always clear the tier timeout timer so it never leaks,\n // regardless of whether the call succeeded, threw, or was aborted.\n clearTierTimeout()\n }\n\n // The Gemini Developer API echoes the tier actually served in usage\n // metadata. Prefer that over the requested tier, including on success\n // after a provider-side tier change, so pricing uses the correct lane.\n const echoedTier = response.usageMetadata?.serviceTier\n if (typeof echoedTier === 'string' && echoedTier.length > 0) {\n if (config.serviceTier !== undefined && echoedTier !== config.serviceTier) {\n warnings.push({\n type: 'other',\n message: `google: requested serviceTier \"${config.serviceTier}\" but provider served \"${echoedTier}\"; billing uses the served tier.`,\n })\n }\n servedServiceTier = echoedTier\n }\n\n // ------------------------------------------------------------------\n // 8. Blocked response check. A candidate-less HTTP 200 without a\n // blockReason is a provider failure, not evidence of a safety block.\n // ------------------------------------------------------------------\n const hasBlockReason = response.promptFeedback?.blockReason !== undefined\n const candidate = response.candidates?.[0]\n\n if (hasBlockReason || candidate === undefined) {\n const reason = response.promptFeedback?.blockReason ?? 'NO_CANDIDATES'\n const thoughtTokens = response.usageMetadata?.thoughtsTokenCount ?? 0\n // The usual cause of a candidate-less 200 that billed reasoning is a\n // cap spent on thinking, so name it. The payload does not prove the cause,\n // but the same request with the same cap is billed again and fails the\n // same way, so such a failure is not retried; a candidate-less 200 that\n // billed no reasoning has no such evidence and stays retryable.\n const reasoningHint =\n !hasBlockReason && thoughtTokens > 0\n ? `. The call billed ${thoughtTokens} reasoning tokens, and maxOutputTokens (${\n config.maxOutputTokens ?? 'the provider default'\n }) includes reasoning tokens, so a low cap can be used up by reasoning before any answer is produced`\n : ''\n const promptRatings = hasBlockReason\n ? describeSafetyRatings(response.promptFeedback?.safetyRatings)\n : ''\n throw new LlmError(\n `Gemini response has no usable candidate: ${reason}${\n promptRatings !== '' ? ` (safetyRatings: ${promptRatings})` : ''\n }${reasoningHint}`,\n {\n kind: hasBlockReason ? 'content_filter' : 'server',\n retryable: !hasBlockReason && thoughtTokens === 0,\n provider: 'google',\n ...billedFailure(response.usageMetadata),\n ...(servedServiceTier !== undefined ? { servedServiceTier } : {}),\n },\n )\n }\n\n // ------------------------------------------------------------------\n // 9. Map response\n // ------------------------------------------------------------------\n const groundingMetadata = candidate.groundingMetadata\n const parts = candidate.content?.parts ?? []\n\n // A function call is complete only when the candidate ended normally\n // (`STOP`, or no finish reason). Alongside any other finish (`MAX_TOKENS`\n // cut it, `SAFETY` filtered it, `OTHER` and the rest) it is not a call a\n // host may run: it is dropped from `toolCalls` and from the assistant\n // message, and a warning names it. The finish reason then says why.\n const callsComplete =\n candidate.finishReason === undefined || candidate.finishReason === 'STOP'\n const isFunctionCall = (part: (typeof parts)[number]): boolean =>\n part.functionCall !== undefined && typeof part.functionCall.name === 'string'\n\n // An output-side filter stop that produced neither answer text nor a\n // complete tool call is a failure, like a blocked prompt: `content_filter`,\n // not retryable (the same call is refused again), billed. A stop that kept\n // partial text is returned with `finishReason: 'content_filter'`.\n const hasAnswer = parts.some(\n (part) =>\n (part.thought !== true &&\n typeof part.text === 'string' &&\n part.text.length > 0) ||\n (callsComplete && isFunctionCall(part)),\n )\n const filteredCandidateError = (note: string): LlmError => {\n const finishMessage =\n candidate.finishMessage !== undefined\n ? truncateText(candidate.finishMessage, MAX_FINISH_MESSAGE_CHARS)\n : undefined\n const ratings = describeSafetyRatings(candidate.safetyRatings)\n const bounded = { truncated: false }\n return new LlmError(\n `Gemini candidate was filtered (finishReason ${candidate.finishReason}${\n finishMessage !== undefined ? `: ${finishMessage}` : ''\n }${ratings !== '' ? `; safetyRatings: ${ratings}` : ''}); ${note}. The attempt was billed.`,\n {\n kind: 'content_filter',\n retryable: false,\n provider: 'google',\n // The raw evidence, bounded: which category blocked, and why.\n cause: {\n finishReason: candidate.finishReason ?? null,\n ...(finishMessage !== undefined ? { finishMessage } : {}),\n ...(candidate.safetyRatings !== undefined\n ? { safetyRatings: boundMetadata(candidate.safetyRatings, bounded) }\n : {}),\n },\n ...billedFailure(response.usageMetadata, groundingMetadata),\n ...(servedServiceTier !== undefined ? { servedServiceTier } : {}),\n },\n )\n }\n if (mapFinishReason(candidate.finishReason) === 'content_filter' && !hasAnswer) {\n throw filteredCandidateError(\n 'it carries no answer text and no complete tool call',\n )\n }\n\n // requireGrounding fails closed: only a response that reports at least one\n // search query proves Search ran. It is judged only on a candidate that\n // finished normally (STOP, or no finish reason): a filtered candidate\n // surfaces its real error, and a truncated one returns `length`, because\n // neither outcome is evidence about Search and a retry would repeat it.\n if (requireGrounding) {\n const queries = countWebSearchQueries(groundingMetadata)\n if (groundingMetadata === undefined || queries === undefined || queries < 1) {\n const finishReason = mapFinishReason(candidate.finishReason)\n if (finishReason === 'content_filter') {\n throw filteredCandidateError('the grounding check was not applied')\n }\n if (candidate.finishReason === undefined || candidate.finishReason === 'STOP') {\n const why =\n groundingMetadata === undefined\n ? 'the response has no groundingMetadata'\n : queries === undefined\n ? 'groundingMetadata has no webSearchQueries'\n : 'groundingMetadata reports zero webSearchQueries'\n // A call without a response schema grounded in 4 of 4 captured\n // calls, so a retry may ground. With a schema attached the same\n // request missed on every capture of five of six Gemini 3 models, so\n // a retry repeats a billed failure: not retryable.\n const retryable = !structuredOutputRequested\n throw new LlmError(\n `google: requireGrounding is set but there is no evidence that Search ran: ${why}. The attempt was billed for its tokens${\n retryable\n ? '; a retry may ground.'\n : '; it is not retryable, because a call with a response schema attached keeps missing (use the two-call recipe in docs/grounded-structured.md).'\n }`,\n {\n kind: 'server',\n retryable,\n reason: 'grounding_missing',\n provider: 'google',\n ...billedFailure(response.usageMetadata, groundingMetadata),\n ...(servedServiceTier !== undefined ? { servedServiceTier } : {}),\n },\n )\n }\n }\n }\n\n // Separate thought parts from text parts, and build the ordered assistant\n // message (provider order, thought parts omitted) with the signatures the\n // model issued for it.\n const textParts: string[] = []\n const thoughtParts: string[] = []\n const toolCalls: NonNullable<AdapterResult['toolCalls']> = []\n const messageParts: Part[] = []\n const issuedSignatures: Array<{ partIndex: number; signature: string }> = []\n let droppedSignatures = 0\n\n const droppedCalls: string[] = []\n const nameCounts = new Map<string, number>()\n // Reserve the provider's ids and every id already in the history, so a\n // synthesized id is unique within the conversation.\n const reservedIds = reserveProviderToolCallIds([\n ...parts.map((part) => part.functionCall?.id),\n ...req.messages.flatMap((message) =>\n message.parts.flatMap((part) =>\n part.kind === 'tool-call' || part.kind === 'tool-result'\n ? [part.toolCallId]\n : [],\n ),\n ),\n ])\n for (const part of parts) {\n const signature =\n typeof part.thoughtSignature === 'string' && part.thoughtSignature.length > 0\n ? part.thoughtSignature\n : undefined\n let represented = false\n if (isFunctionCall(part) && !callsComplete) {\n droppedCalls.push(part.functionCall?.name ?? '')\n represented = true\n } else if (\n part.functionCall !== undefined &&\n typeof part.functionCall.name === 'string'\n ) {\n const toolName = part.functionCall.name\n const call = {\n toolCallId: resolveToolCallId(\n part.functionCall.id,\n toolName,\n nameCounts,\n reservedIds,\n ),\n toolName,\n args: (part.functionCall.args ?? {}) as JsonValue,\n }\n toolCalls.push(call)\n if (signature !== undefined) {\n issuedSignatures.push({ partIndex: messageParts.length, signature })\n }\n messageParts.push({ kind: 'tool-call', ...call })\n represented = true\n }\n if (part.text !== undefined) {\n if (part.thought === true) {\n thoughtParts.push(part.text)\n } else {\n textParts.push(part.text)\n if (part.text.length > 0) {\n if (signature !== undefined && !represented) {\n issuedSignatures.push({ partIndex: messageParts.length, signature })\n }\n messageParts.push({ kind: 'text', text: part.text })\n represented = true\n }\n }\n }\n if (signature !== undefined && !represented) droppedSignatures += 1\n }\n\n if (droppedCalls.length > 0) {\n const named = droppedCalls.map((name) => `\"${name}\"`).join(', ')\n warnings.push({\n type: 'other',\n message: `google: dropped ${droppedCalls.length} function call(s) (${named}) because the candidate ended with finishReason ${candidate.finishReason ?? 'unspecified'}, not STOP: ${\n candidate.finishReason === 'MAX_TOKENS'\n ? 'the call was cut by the output cap and is incomplete'\n : 'a call beside an abnormal stop is not a call to run'\n }. The result carries no tool call; finishReason is \"${mapFinishReason(candidate.finishReason) ?? 'other'}\".`,\n })\n }\n\n const text = textParts.join('')\n const reasoningText = thoughtParts.length > 0 ? thoughtParts.join('') : undefined\n\n // The result's state is the incoming overlay plus one entry per part of\n // this message the model signed, bound to the index the host will append\n // the message at and to the model string this request named.\n let transientProviderState: JsonValue | undefined\n if (signsHistory) {\n const issued: GoogleSignatureEntry[] = []\n for (const { partIndex, signature } of issuedSignatures) {\n const part = messageParts[partIndex] as Part\n try {\n issued.push(\n signatureEntry(req.messages.length, partIndex, model, part, signature),\n )\n } catch (error) {\n // The call is already billed: never fail it for a part that cannot be\n // hashed (a lone surrogate in provider output). Return the result without\n // an entry; replaying a call that lacks one is rejected on the next turn.\n if (!(error instanceof LlmError)) throw error\n warnings.push({\n type: 'other',\n message: `google: no signature entry for messages.${req.messages.length}.parts.${partIndex} (a \"${part.kind}\" part): ${error.message} The result is returned without it; ${\n part.kind === 'tool-call'\n ? 'replaying this function call on the next turn will be rejected'\n : 'a text signature is optional, so nothing required is lost'\n }.`,\n })\n }\n }\n const signatures = [...incomingSignatures, ...issued]\n if (signatures.length > 0) {\n transientProviderState = { google: { signatures } }\n }\n if (droppedSignatures > 0) {\n warnings.push({\n type: 'other',\n message: `google: dropped ${droppedSignatures} thoughtSignature(s) on parts that have no message representation (thought or empty parts); Gemini requires only the function-call ones.`,\n })\n }\n const firstCall = messageParts.findIndex((part) => part.kind === 'tool-call')\n if (\n firstCall !== -1 &&\n !issuedSignatures.some((entry) => entry.partIndex === firstCall)\n ) {\n warnings.push({\n type: 'other',\n message:\n 'google: the first function call in this response carries no thoughtSignature; replaying it on the next turn will be rejected.',\n })\n }\n }\n\n // Parse structured output (JSON text → rawStructured).\n let rawStructured: unknown\n if (structuredOutputRequested && text.length > 0) {\n try {\n rawStructured = JSON.parse(text)\n } catch {\n // Core reports outputParsed:false; callers own validation/retry policy.\n // Gemma wraps its answer in a markdown fence often enough to name the\n // cause; the text is returned as sent, never unwrapped here.\n if (descriptor.model.startsWith('gemma-') && /^\\s*```/.test(text)) {\n warnings.push({\n type: 'other',\n message: `google: gemma_fenced_json: the answer from \"${model}\" is wrapped in a markdown code fence, so it is not parseable JSON and outputParsed is false. Gemma 4 fenced 67 of 162 schema answers (41%) in a live probe (2026-10-03) although the schema is native. The text is returned as the model sent it; call again, or unwrap the fence on the host side.`,\n })\n }\n }\n }\n\n // ------------------------------------------------------------------\n // 10. Build AdapterResult\n // ------------------------------------------------------------------\n const usage = usageFor(response.usageMetadata, groundingMetadata)\n // A 200 without `usageMetadata` billed tokens nobody reported: the usage\n // is unknown, not zero. The marker makes the pricing source report the\n // call unpriced (`microUsd: null`, estimated) instead of an exact $0.\n if (response.usageMetadata === undefined) {\n usage.details['usage_missing'] = 1\n warnings.push({\n type: 'other',\n message:\n 'google: the response carries no usageMetadata, so token usage is unknown; the call is recorded with zero tokens and is not priced (cost.microUsd is null, cost.confidence is \"estimated\").',\n })\n }\n const finishReason = mapFinishReason(candidate.finishReason)\n warnings.push(...groundingWarnings(groundingMetadata))\n warnings.push(...modalityWarnings(response.usageMetadata))\n\n // Where each answer-text part sits in `text`, so a grounding segment\n // (UTF-8 byte offsets into one part) becomes a range of `text`. Gemini's\n // `partIndex` does not count thought parts (see `AnswerTextPart`).\n const answerParts: Array<AnswerTextPart | undefined> = []\n let answerOffset = 0\n for (const part of parts) {\n if (part.thought === true) continue\n if (typeof part.text === 'string') {\n answerParts.push({ text: part.text, offset: answerOffset })\n answerOffset += part.text.length\n } else {\n answerParts.push(undefined)\n }\n }\n\n const result: AdapterResult = {\n model,\n message: { role: 'assistant', parts: messageParts },\n usage,\n warnings,\n ...(transientProviderState !== undefined ? { transientProviderState } : {}),\n ...(servedServiceTier !== undefined ? { servedServiceTier } : {}),\n ...(text.length > 0 ? { text } : {}),\n ...(reasoningText !== undefined ? { reasoningText } : {}),\n ...(rawStructured !== undefined ? { rawStructured } : {}),\n ...(toolCalls.length > 0\n ? { toolCalls, finishReason: 'tool_calls' }\n : finishReason !== undefined\n ? { finishReason }\n : {}),\n ...(response.modelVersion !== undefined\n ? { modelVersion: response.modelVersion }\n : {}),\n ...(response.responseId !== undefined ? { responseId: response.responseId } : {}),\n // Build providerMetadata — merge promptFeedback + groundingMetadata when\n // present. `google.searchEntryPoint` is the Search Suggestions widget\n // Google requires a grounded answer to display.\n ...((): { providerMetadata: JsonValue } | Record<string, never> => {\n const pf = response.promptFeedback\n const gm = groundingMetadata\n // The candidate's own fields (raw finish reason and message, safety\n // ratings, citation and URL-context metadata), so a host can tell a\n // malformed tool call from a language refusal behind `'other'`.\n const candidateFields: { [k: string]: JsonValue } = {}\n const bounded = { truncated: false }\n for (const key of CANDIDATE_METADATA_KEYS) {\n const value = (candidate as unknown as Record<string, unknown>)[key]\n if (value === undefined) continue\n candidateFields[key] =\n key === 'finishMessage' && typeof value === 'string'\n ? (() => {\n if (value.length > MAX_FINISH_MESSAGE_CHARS) bounded.truncated = true\n return truncateText(value, MAX_FINISH_MESSAGE_CHARS)\n })()\n : boundMetadata(value, bounded)\n }\n const googleMeta: { [k: string]: JsonValue } = {}\n if (Object.keys(candidateFields).length > 0) {\n googleMeta['candidate'] = candidateFields\n }\n if (\n pf === undefined &&\n gm === undefined &&\n Object.keys(googleMeta).length === 0\n ) {\n return {}\n }\n const meta: { [k: string]: JsonValue } = {}\n // `promptFeedback` and `groundingMetadata` are bounded like the\n // candidate fields: `webSearchQueries` come from the user's prompt and\n // every `groundingSupports[].segment.text` copies the answer.\n if (pf !== undefined) {\n meta['promptFeedback'] = boundMetadata(pf, bounded)\n }\n if (gm !== undefined) {\n const searchEntryPoint = readSearchEntryPoint(gm)\n if (searchEntryPoint !== undefined) {\n // Stored once, under `google.searchEntryPoint`: the widget HTML is\n // kilobytes and `providerMetadata` is persisted on every grounded\n // row, so the raw copy omits it.\n const { searchEntryPoint: _widget, ...rest } = gm as Record<string, unknown>\n meta['groundingMetadata'] = boundMetadata(rest, bounded)\n googleMeta['searchEntryPoint'] = searchEntryPoint\n } else {\n meta['groundingMetadata'] = boundMetadata(gm, bounded)\n }\n }\n if (bounded.truncated) {\n warnings.push({\n type: 'other',\n message: `google: providerMetadata was truncated (finishMessage over ${MAX_FINISH_MESSAGE_CHARS} characters, a string over ${MAX_METADATA_STRING}, a list over ${MAX_METADATA_ARRAY} entries or nesting over ${MAX_METADATA_DEPTH} levels, in the candidate fields, promptFeedback or groundingMetadata); the citations are built from the full response.`,\n })\n }\n if (Object.keys(googleMeta).length > 0) meta['google'] = googleMeta\n return { providerMetadata: meta as JsonValue }\n })(),\n ...(() => {\n if (groundingMetadata === undefined) return {}\n const citations = normalizeGroundingCitations(\n groundingMetadata,\n answerParts,\n (message) => warnings.push({ type: 'other', message }),\n )\n return citations.length > 0 ? { citations } : {}\n })(),\n }\n\n return result\n },\n\n async countTokens(req: TokenCountRequest, ctx: AdapterCtx): Promise<TokenCount> {\n if (req.provider !== 'google') {\n throw new LlmError(\n `geminiAdapter received a request for provider \"${req.provider}\", expected \"google\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n\n // The SDK's Gemini Developer API `countTokens` carries only `contents`, so\n // a `system` or `tools` count goes through the REST `generateContentRequest`\n // form (see `buildGoogleClient`). The count covers `messages`, `system` and\n // `tools`; it carries no response schema, thinking config, `toolConfig`,\n // safety settings or Search tool, which `generate()` also sends. An empty\n // system string adds no tokens and is treated as absent.\n const system =\n req.system !== undefined && req.system !== '' ? req.system : undefined\n const tools =\n req.tools !== undefined && req.tools.length > 0 ? req.tools : undefined\n if (tools !== undefined) {\n const descriptor = ctx.modelDescriptor\n if (\n descriptor !== undefined &&\n descriptor.capabilities?.functionCalling !== true\n ) {\n throw new LlmError(\n `tools is not supported for google model \"${req.model}\" (capabilities.functionCalling is not true).`,\n { kind: 'bad_request', retryable: false, provider: 'google' },\n )\n }\n const toolProfile = googleJsonSchemaProfile(descriptor?.model ?? req.model)\n tools.forEach((tool, index) => {\n assertJsonSchemaProfile(\n tool.inputJsonSchema,\n `tools[${index}].inputJsonSchema`,\n toolProfile,\n )\n })\n }\n\n if (ctx.modelDescriptor !== undefined) {\n assertInputMimeTypesAdmitted(req.messages, ctx.modelDescriptor, 'google')\n }\n const contents = mapMessagesToGeminiContents(req.messages)\n assertInlinePayloadWithinLimits(contents, system)\n const params: GeminiCountTokensParams = {\n model: req.model,\n contents,\n ...(system !== undefined\n ? { systemInstruction: { parts: [{ text: system }] } }\n : {}),\n ...(tools !== undefined\n ? {\n tools: [\n {\n functionDeclarations: tools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n parametersJsonSchema: tool.inputJsonSchema,\n })),\n },\n ],\n }\n : {}),\n ...(ctx.signal !== undefined ? { config: { abortSignal: ctx.signal } } : {}),\n }\n\n try {\n const client: GeminiClientLike =\n injectedClient !== undefined ? injectedClient : await buildClient(ctx.auth)\n const response = await client.models.countTokens(params)\n\n if (response.totalTokens === undefined) {\n // Provider fault, not caller fault: the SDK call succeeded but the\n // payload is malformed — classify as a (retryable) server error.\n throw new LlmError(\n 'Gemini countTokens response is malformed: missing required field: totalTokens',\n { kind: 'server', retryable: true, provider: 'google' },\n )\n }\n\n const details: Record<string, number> | undefined =\n response.cachedContentTokenCount !== undefined\n ? { cached: response.cachedContentTokenCount }\n : undefined\n\n // Gemini 3 can bill each replayed thought signature (up to about 110 prompt\n // tokens each, 0 on some models) and countTokens carries none, so a history with function calls\n // is counted short of what generate() will bill. Live capture\n // 2026-10-03: the endpoint accepts function calls without signatures and\n // returns the same count with or without them.\n const omitsSignatures =\n ctx.modelDescriptor?.capabilities?.providerState === true &&\n req.messages.some(\n (message) =>\n message.role === 'assistant' &&\n message.parts.some((part) => part.kind === 'tool-call'),\n )\n\n return {\n totalTokens: response.totalTokens,\n accuracy: omitsSignatures ? 'estimated' : 'exact',\n ...(details !== undefined ? { details } : {}),\n raw: response as unknown as JsonValue,\n }\n } catch (rawErr) {\n throw classifyGoogleError(rawErr)\n }\n },\n }\n}\n","import { z } from 'zod'\n\n/**\n * `providerOptions.google.cachedContent` for the models that cache explicitly:\n * the cache's resource name, or `{ cacheName, toolKinds }` taken from a\n * `GoogleCacheHandle` (`toolKinds` records which tools the cache holds, so a\n * cached `googleSearch` is priced as Search). The request sent to Google\n * carries only the name. Like every config object it is strict: a whole handle\n * (with `expiresAt`, `model`) is rejected, and the type refuses it too.\n */\nexport const cachedContentSchema = z\n .union([\n z.string().min(1),\n z.strictObject({\n cacheName: z.string().min(1).meta({\n title: 'Cache Name',\n description: 'Google cached content resource name.',\n }),\n toolKinds: z.array(z.string().min(1)).optional().meta({\n title: 'Tool Kinds',\n description:\n 'The tool kinds the cache holds (`GoogleCacheHandle.toolKinds`), e.g. googleSearch.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Cached Content',\n description:\n 'Google cached content: the resource name, or { cacheName, toolKinds } from a cache handle.',\n })\n","/**\n * Token limits and admitted input media types for the registered Google\n * models, read from Google's own documentation (re-read 2026-10-03).\n *\n * One table feeds both the descriptors (`limits`, `inputMimeTypes`) and the\n * per-model config schemas (`maxOutputTokens` is capped only when a number is\n * documented), so a descriptor and its schema cannot drift.\n *\n * Sources, all read 2026-10-03:\n *\n * - Gemini: `https://ai.google.dev/gemini-api/docs/models/<model-id>`, one page\n * per model. Every registered Gemini model lists \"Input token limit\n * 1,048,576\" and \"Output token limit 65,536\". The output limit includes\n * thinking tokens.\n * - Gemma 4: the model card, `https://ai.google.dev/gemma/docs/core/model_card_4`,\n * states a \"256K tokens\" context window (read as 262,144). Neither it nor\n * `https://ai.google.dev/gemma/docs/core/gemma_on_gemini_api` documents an\n * output limit, so `maxOutputTokens` is `null` (see\n * {@link ModelLimits.maxOutputTokens}): no figure is invented and the schema\n * applies no cap.\n * - Gemini input media: Google publishes lists for images\n * (`https://ai.google.dev/gemini-api/docs/image-understanding`: PNG, JPEG,\n * WebP, HEIC, HEIF), audio (`.../audio`), and video\n * (`.../video-understanding`), but no closed list for documents:\n * `.../document-processing` says only that PDF is understood natively and\n * \"you can pass other MIME types for document understanding, like TXT,\n * Markdown, HTML, XML, etc.\", extracted as plain text. `.../files` lists no\n * types either. The descriptor therefore admits the documented families by\n * prefix (`text/*`, `image/*`, `audio/*`, `video/*`) plus `application/pdf`,\n * and leaves a type inside a family that Google does not accept to Google's\n * own error. `application/json`, `application/xml` and other `application/*`\n * types are not in any documented family and stay rejected.\n * - Gemma 4 input media: the model card lists \"Supported Modalities: Text,\n * Image\" for the 31B and 26B A4B models and says \"All models support image\n * inputs and can process videos as frames\", with video \"a maximum of 60\n * seconds\" at one frame per second; audio input is E2B/E4B/12B only. No Gemma\n * page names image or video media types, so `image/*` and `video/*` are\n * admitted and nothing else. That the Gemini API's Gemma endpoint takes a\n * video part (rather than frames sent as images) has not been probed.\n *\n * @module\n */\n\nimport type { ModelLimits } from '@gullabs/core'\n\ntype GoogleModelId =\n | 'gemini-2.5-pro'\n | 'gemini-2.5-flash'\n | 'gemini-2.5-flash-lite'\n | 'gemini-3.1-flash-lite'\n | 'gemini-3.1-pro-preview'\n | 'gemini-3.8-flash'\n | 'gemini-3.7-flash'\n | 'gemini-3.6-flash'\n | 'gemini-3.5-flash-lite'\n | 'gemma-4-31b-it'\n | 'gemma-4-26b-a4b-it'\n\n/** One frozen object per model: no descriptor can change another's limits. */\nconst geminiLimits = (): ModelLimits =>\n Object.freeze({ contextWindow: 1_048_576, maxOutputTokens: 65_536 })\nconst gemma4Limits = (): ModelLimits =>\n Object.freeze({ contextWindow: 262_144, maxOutputTokens: null })\n\nexport const GOOGLE_MODEL_LIMITS: Readonly<Record<GoogleModelId, ModelLimits>> = {\n 'gemini-2.5-pro': geminiLimits(),\n 'gemini-2.5-flash': geminiLimits(),\n 'gemini-2.5-flash-lite': geminiLimits(),\n 'gemini-3.1-flash-lite': geminiLimits(),\n 'gemini-3.1-pro-preview': geminiLimits(),\n 'gemini-3.8-flash': geminiLimits(),\n 'gemini-3.7-flash': geminiLimits(),\n 'gemini-3.6-flash': geminiLimits(),\n 'gemini-3.5-flash-lite': geminiLimits(),\n 'gemma-4-31b-it': gemma4Limits(),\n 'gemma-4-26b-a4b-it': gemma4Limits(),\n}\n\n/**\n * Media types every Gemini model in the registry accepts as input parts: the\n * documented families (text, image, audio, video) and PDF. See the module\n * comment for why the families are not closed lists. One rule serves\n * `generate` and `GoogleFileStore.upload`.\n */\nexport const GEMINI_INPUT_MIME_TYPES: readonly string[] = Object.freeze([\n 'application/pdf',\n 'text/*',\n 'image/*',\n 'audio/*',\n 'video/*',\n])\n\n/** Media types the Gemma 4 models accept: image and video (frames), no audio. */\nexport const GEMMA_INPUT_MIME_TYPES: readonly string[] = Object.freeze([\n 'image/*',\n 'video/*',\n])\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { cachedContentSchema } from './cached-content.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemini25ProConfigSchema = z\n .union([\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-pro.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-pro.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-pro.',\n }),\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-2.5-pro'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-pro.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-pro.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-2.5-pro.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-2.5-pro. Thinking off is not supported.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z.number().int().min(128).max(32768).meta({\n title: 'Reasoning Budget Tokens',\n description: 'thinkingBudget token range for gemini-2.5-pro.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Pro thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-pro.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-2.5-pro.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-pro.',\n }),\n }),\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-pro.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-pro.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-pro.',\n }),\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-2.5-pro'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-pro.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-pro.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-2.5-pro.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-2.5-pro. Thinking off is not supported.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z.number().int().min(128).max(32768).meta({\n title: 'Reasoning Budget Tokens',\n description: 'thinkingBudget token range for gemini-2.5-pro.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Pro thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-pro.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-2.5-pro.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-pro.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini25ProConfig',\n description:\n 'Strict generateContent config for model gemini-2.5-pro. Budget reasoning, tunable sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', temperature: 0.7, reasoning: { effort: 'high' } }],\n })\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { cachedContentSchema } from './cached-content.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemini25FlashConfigSchema = z\n .union([\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-flash.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-flash.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-flash.',\n }),\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-2.5-flash'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-flash.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-2.5-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemini-2.5-flash.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z.number().int().min(0).max(24576).meta({\n title: 'Reasoning Budget Tokens',\n description: 'thinkingBudget token range for gemini-2.5-flash.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Flash thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-2.5-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-flash.',\n }),\n }),\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-flash.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-flash.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-flash.',\n }),\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-2.5-flash'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-flash.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-2.5-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemini-2.5-flash.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z.number().int().min(0).max(24576).meta({\n title: 'Reasoning Budget Tokens',\n description: 'thinkingBudget token range for gemini-2.5-flash.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Flash thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-2.5-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-flash.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini25FlashConfig',\n description:\n 'Strict generateContent config for model gemini-2.5-flash. Budget reasoning, tunable sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', temperature: 0.7, reasoning: { effort: 'none' } }],\n })\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { cachedContentSchema } from './cached-content.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemini25FlashLiteConfigSchema = z\n .union([\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-flash-lite.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-flash-lite.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-flash-lite.',\n }),\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-2.5-flash-lite'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-flash-lite.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-2.5-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemini-2.5-flash-lite.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z\n .union([z.literal(0), z.number().int().min(512).max(24576)])\n .meta({\n title: 'Reasoning Budget Tokens',\n description:\n 'thinkingBudget token range for gemini-2.5-flash-lite. Zero disables thinking; non-zero values must be 512..24576.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Flash-Lite thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-2.5-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-flash-lite.',\n }),\n }),\n z.strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemini-2.5-flash-lite.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemini-2.5-flash-lite.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemini-2.5-flash-lite.',\n }),\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-2.5-flash-lite'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-2.5-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-2.5-flash-lite.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-2.5-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemini-2.5-flash-lite.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n budgetTokens: z\n .union([z.literal(0), z.number().int().min(512).max(24576)])\n .meta({\n title: 'Reasoning Budget Tokens',\n description:\n 'thinkingBudget token range for gemini-2.5-flash-lite. Zero disables thinking; non-zero values must be 512..24576.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 2.5 Flash-Lite thinkingBudget configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-2.5-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-2.5-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-2.5-flash-lite.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini25FlashLiteConfig',\n description:\n 'Strict generateContent config for model gemini-2.5-flash-lite. Budget reasoning, tunable sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', temperature: 0.7, reasoning: { budgetTokens: 0 } }],\n })\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { cachedContentSchema } from './cached-content.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemini31FlashLiteConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-3.1-flash-lite'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.1-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.1-flash-lite.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.1-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.1-flash-lite; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.1 Flash-Lite thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.1-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.1-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.1-flash-lite.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-3.1-flash-lite'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.1-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.1-flash-lite.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.1-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.1-flash-lite; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.1 Flash-Lite thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.1-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.1-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.1-flash-lite.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini31FlashLiteConfig',\n description:\n 'Strict generateContent config for model gemini-3.1-flash-lite. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'medium' } }],\n })\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { cachedContentSchema } from './cached-content.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemini31ProPreviewConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(\n GOOGLE_MODEL_LIMITS['gemini-3.1-pro-preview'],\n )\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.1-pro-preview.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.1-pro-preview.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.1-pro-preview.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.1-pro-preview. Thinking off is not supported.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.1 Pro Preview thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.1-pro-preview.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.1-pro-preview.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.1-pro-preview.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(\n GOOGLE_MODEL_LIMITS['gemini-3.1-pro-preview'],\n )\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.1-pro-preview.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.1-pro-preview.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.1-pro-preview.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.1-pro-preview. Thinking off is not supported.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.1 Pro Preview thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.1-pro-preview.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.1-pro-preview.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.1-pro-preview.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini31ProPreviewConfig',\n description:\n 'Strict generateContent config for model gemini-3.1-pro-preview. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'high' } }],\n })\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { cachedContentSchema } from './cached-content.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemini35FlashLiteConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-3.5-flash-lite'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.5-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.5-flash-lite.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.5-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.5-flash-lite; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.5 Flash-Lite thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.5-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.5-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.5-flash-lite.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-3.5-flash-lite'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.5-flash-lite.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.5-flash-lite.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.5-flash-lite.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.5-flash-lite; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.5 Flash-Lite thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.5-flash-lite.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description:\n 'Allowlisted Google provider options for gemini-3.5-flash-lite.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.5-flash-lite.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini35FlashLiteConfig',\n description:\n 'Strict generateContent config for model gemini-3.5-flash-lite. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'medium' } }],\n })\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { cachedContentSchema } from './cached-content.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemini36FlashConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-3.6-flash'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.6-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.6-flash.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.6-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.6-flash; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.6 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.6-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.6-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.6-flash.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-3.6-flash'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.6-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.6-flash.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.6-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.6-flash; none maps to minimal thinking.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.6 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.6-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.6-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.6-flash.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini36FlashConfig',\n description:\n 'Strict generateContent config for model gemini-3.6-flash. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'medium' } }],\n })\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { cachedContentSchema } from './cached-content.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemini37FlashConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-3.7-flash'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.7-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.7-flash.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.7-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.7-flash. none is not admitted; thinkingLevel MINIMAL is never emitted.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.7 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.7-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.7-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.7-flash.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-3.7-flash'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.7-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.7-flash.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.7-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.7-flash. none is not admitted; thinkingLevel MINIMAL is never emitted.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.7 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.7-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.7-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.7-flash.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini37FlashConfig',\n description:\n 'Strict generateContent config for model gemini-3.7-flash. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'medium' } }],\n })\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { cachedContentSchema } from './cached-content.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemini38FlashConfigSchema = z\n .union([\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-3.8-flash'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.8-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.8-flash.',\n }),\n serviceTier: z.literal('flex').meta({\n title: 'Service Tier',\n description: 'Explicit flex tier for gemini-3.8-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.8-flash. none is not admitted; thinkingLevel MINIMAL is never emitted.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.8 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.8-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n flexFallback: z.boolean().optional().meta({\n title: 'Flex Fallback',\n description:\n 'Allow provider fallback from flex when flex was explicitly selected.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.8-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.8-flash.',\n }),\n }),\n z.strictObject({\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemini-3.8-flash'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemini-3.8-flash.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemini-3.8-flash.',\n }),\n serviceTier: z.literal('standard').optional().meta({\n title: 'Service Tier',\n description: 'Standard tier or omitted tier for gemini-3.8-flash.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['low', 'medium', 'high']).meta({\n title: 'Reasoning Effort',\n description:\n 'Reasoning effort for gemini-3.8-flash. none is not admitted; thinkingLevel MINIMAL is never emitted.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemini 3.8 Flash thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n allowSchemaWithSearch: z.boolean().optional().meta({\n title: 'Allow Schema With Search',\n description:\n 'Admit googleSearch together with a response schema. Turns requireGrounding on unless it is false.',\n }),\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n cachedContent: cachedContentSchema,\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemini-3.8-flash.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemini-3.8-flash.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemini-3.8-flash.',\n }),\n }),\n ])\n .meta({\n title: 'Gemini38FlashConfig',\n description:\n 'Strict generateContent config for model gemini-3.8-flash. Level reasoning, fixed sampling, flex/standard tiers, structured output, grounding, priced.',\n examples: [{ serviceTier: 'flex', reasoning: { effort: 'medium' } }],\n })\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemma431bItConfigSchema = z\n .strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemma-4-31b-it.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemma-4-31b-it.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemma-4-31b-it.',\n }),\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemma-4-31b-it'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemma-4-31b-it.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemma-4-31b-it.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemma-4-31b-it.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemma 4 31B IT thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemma-4-31b-it.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemma-4-31b-it.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemma-4-31b-it.',\n }),\n })\n .meta({\n title: 'Gemma431bItConfig',\n description:\n 'Strict generateContent config for model gemma-4-31b-it. Level reasoning, tunable sampling, no service tier, structured output, grounding, intentionally unpriced.',\n examples: [{ temperature: 0.7, reasoning: { effort: 'high' } }],\n })\n","import { maxOutputTokensSchema } from '@gullabs/core'\nimport { z } from 'zod'\n\nimport { GOOGLE_MAX_TIMEOUT_MS, MAX_TIMER_MS } from '../client.js'\nimport { GOOGLE_MODEL_LIMITS } from '../model-limits.js'\nimport { GOOGLE_SAFETY_CATEGORIES, GOOGLE_SAFETY_THRESHOLDS } from '../safety-settings.js'\n\nexport const Gemma426bA4bItConfigSchema = z\n .strictObject({\n temperature: z\n .number()\n .min(0)\n .max(2)\n .optional()\n .meta({\n title: 'Temperature',\n description: 'Sampling temperature for gemma-4-26b-a4b-it.',\n examples: [0.7],\n }),\n topP: z.number().min(0).max(1).optional().meta({\n title: 'Top P',\n description: 'Nucleus sampling probability for gemma-4-26b-a4b-it.',\n }),\n topK: z.number().int().positive().optional().meta({\n title: 'Top K',\n description: 'Top-k sampling limit for gemma-4-26b-a4b-it.',\n }),\n maxOutputTokens: maxOutputTokensSchema(GOOGLE_MODEL_LIMITS['gemma-4-26b-a4b-it'])\n .optional()\n .meta({\n title: 'Max Output Tokens',\n description: 'Maximum output token cap for gemma-4-26b-a4b-it.',\n }),\n stopSequences: z.array(z.string()).max(5).optional().meta({\n title: 'Stop Sequences',\n description: 'Up to five stop sequences for gemma-4-26b-a4b-it.',\n }),\n reasoning: z\n .union([\n z.strictObject({\n effort: z.enum(['none', 'high']).meta({\n title: 'Reasoning Effort',\n description: 'Reasoning effort for gemma-4-26b-a4b-it.',\n }),\n includeThoughts: z.boolean().optional().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n z.strictObject({\n includeThoughts: z.boolean().meta({\n title: 'Include Thoughts',\n description: 'Return provider thought summaries when supported.',\n }),\n }),\n ])\n .optional()\n .meta({\n title: 'Reasoning',\n description: 'Gemma 4 26B A4B IT thinkingLevel configuration.',\n }),\n timeoutMs: z.number().int().positive().max(GOOGLE_MAX_TIMEOUT_MS).optional().meta({\n title: 'Timeout',\n description: 'Logical request timeout in milliseconds.',\n }),\n providerOptions: z\n .strictObject({\n google: z\n .strictObject({\n requireGrounding: z.boolean().optional().meta({\n title: 'Require Grounding',\n description:\n 'Fail the call unless the response proves Google Search ran (grounding metadata with at least one query). Judged only on a candidate that finished with STOP: a MAX_TOKENS or other abnormal finish returns with its own finish reason, a filtered one throws content_filter. The error is retryable only when no response schema is attached.',\n }),\n safetySettings: z\n .array(\n z.strictObject({\n category: z.enum(GOOGLE_SAFETY_CATEGORIES).meta({\n title: 'Safety Category',\n description: 'Documented Google safety category.',\n }),\n threshold: z.enum(GOOGLE_SAFETY_THRESHOLDS).meta({\n title: 'Safety Threshold',\n description: 'Documented Google safety threshold.',\n }),\n }),\n )\n .optional()\n .meta({\n title: 'Safety Settings',\n description: 'Allowlisted Google safety settings.',\n }),\n tools: z\n .array(\n z.strictObject({\n googleSearch: z.strictObject({}).meta({\n title: 'Google Search',\n description: 'Google Search grounding tool.',\n }),\n }),\n )\n .min(1)\n .optional()\n .meta({\n title: 'Tools',\n description: 'Allowlisted Google tools for gemma-4-26b-a4b-it.',\n }),\n httpOptions: z\n .strictObject({\n timeout: z.number().int().positive().max(MAX_TIMER_MS).optional().meta({\n title: 'HTTP Timeout',\n description:\n 'Per-request Google transport timeout in milliseconds, at most 2147483647; with timeoutMs set, at least timeoutMs + 5000.',\n }),\n })\n .optional()\n .meta({\n title: 'HTTP Options',\n description: 'Allowlisted Google transport options.',\n }),\n })\n .optional()\n .meta({\n title: 'Google Provider Options',\n description: 'Allowlisted Google provider options for gemma-4-26b-a4b-it.',\n }),\n })\n .optional()\n .meta({\n title: 'Provider Options',\n description: 'Provider-specific options accepted for gemma-4-26b-a4b-it.',\n }),\n })\n .meta({\n title: 'Gemma426bA4bItConfig',\n description:\n 'Strict generateContent config for model gemma-4-26b-a4b-it. Level reasoning, tunable sampling, no service tier, structured output, grounding, intentionally unpriced.',\n examples: [{ temperature: 0.7, reasoning: { effort: 'none' } }],\n })\n","/**\n * Model descriptor registry for @gullabs/google.\n *\n * Centralises Gemini/Gemma model knowledge: reasoning-effort vocabularies,\n * capability flags, and the built-in descriptor arrays. `@gullabs/core` owns\n * only the generic registry machinery (`ModelDescriptor`, `ModelRegistry`,\n * `createModelRegistry`) — this module supplies the Gemini-specific data.\n *\n * @module\n */\n\nimport type { ModelDescriptor, ModelRegistry, ReasoningEffort } from '@gullabs/core'\nimport { createModelRegistry } from '@gullabs/core'\n\nimport {\n Gemma426bA4bItConfigSchema,\n Gemma431bItConfigSchema,\n Gemini25FlashConfigSchema,\n Gemini25FlashLiteConfigSchema,\n Gemini25ProConfigSchema,\n Gemini31FlashLiteConfigSchema,\n Gemini31ProPreviewConfigSchema,\n Gemini35FlashLiteConfigSchema,\n Gemini36FlashConfigSchema,\n Gemini37FlashConfigSchema,\n Gemini38FlashConfigSchema,\n} from './model-config/index.js'\nimport {\n GEMINI_INPUT_MIME_TYPES,\n GEMMA_INPUT_MIME_TYPES,\n GOOGLE_MODEL_LIMITS,\n} from './model-limits.js'\nimport { toConfigJsonSchema, toConfigKeys, zodToStandardSchema } from '@gullabs/core'\n\nconst GEMINI_STANDARD_REASONING_EFFORTS = [\n 'low',\n 'medium',\n 'high',\n] as const satisfies ReadonlyArray<ReasoningEffort>\nconst GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS = [\n 'none',\n 'low',\n 'medium',\n 'high',\n] as const satisfies ReadonlyArray<ReasoningEffort>\nconst GEMMA_REASONING_EFFORTS = [\n 'none',\n 'high',\n] as const satisfies ReadonlyArray<ReasoningEffort>\n\nexport const geminiModelDescriptors: ModelDescriptor[] = [\n {\n model: 'gemini-2.5-pro',\n provider: 'google',\n limits: GOOGLE_MODEL_LIMITS['gemini-2.5-pro'],\n pricingFamily: 'gemini-2.5-pro',\n capabilities: {\n inputMimeTypes: GEMINI_INPUT_MIME_TYPES,\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n reasoningApi: 'budget',\n admittedReasoningEfforts: GEMINI_STANDARD_REASONING_EFFORTS,\n sampling: 'tunable',\n caching: { explicit: true, minTokens: 2048 },\n grounding: true,\n functionCalling: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini25ProConfigSchema,\n configKeys: toConfigKeys(Gemini25ProConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemini25ProConfigSchema),\n validateConfig: zodToStandardSchema(Gemini25ProConfigSchema),\n },\n {\n model: 'gemini-2.5-flash',\n provider: 'google',\n limits: GOOGLE_MODEL_LIMITS['gemini-2.5-flash'],\n pricingFamily: 'gemini-2.5-flash',\n capabilities: {\n inputMimeTypes: GEMINI_INPUT_MIME_TYPES,\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n reasoningApi: 'budget',\n admittedReasoningEfforts: GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS,\n sampling: 'tunable',\n caching: { explicit: true, minTokens: 2048 },\n grounding: true,\n functionCalling: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini25FlashConfigSchema,\n configKeys: toConfigKeys(Gemini25FlashConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemini25FlashConfigSchema),\n validateConfig: zodToStandardSchema(Gemini25FlashConfigSchema),\n },\n {\n model: 'gemini-2.5-flash-lite',\n provider: 'google',\n limits: GOOGLE_MODEL_LIMITS['gemini-2.5-flash-lite'],\n pricingFamily: 'gemini-2.5-flash-lite',\n capabilities: {\n inputMimeTypes: GEMINI_INPUT_MIME_TYPES,\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n reasoningApi: 'budget',\n admittedReasoningEfforts: GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS,\n sampling: 'tunable',\n caching: { explicit: true, minTokens: 2048 },\n grounding: true,\n functionCalling: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini25FlashLiteConfigSchema,\n configKeys: toConfigKeys(Gemini25FlashLiteConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemini25FlashLiteConfigSchema),\n validateConfig: zodToStandardSchema(Gemini25FlashLiteConfigSchema),\n },\n {\n model: 'gemini-3.1-flash-lite',\n provider: 'google',\n // Google's deprecations page (https://ai.google.dev/gemini-api/docs/deprecations,\n // \"Page last updated\" 2026-10-01, read 2026-10-03) lists a May 7, 2027\n // shutdown, replacement gemini-3.5-flash-lite.\n shutdownDate: '2027-05-07',\n limits: GOOGLE_MODEL_LIMITS['gemini-3.1-flash-lite'],\n pricingFamily: 'gemini-3.1-flash-lite',\n capabilities: {\n inputMimeTypes: GEMINI_INPUT_MIME_TYPES,\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: false,\n continuation: 'history',\n providerState: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini31FlashLiteConfigSchema,\n configKeys: toConfigKeys(Gemini31FlashLiteConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemini31FlashLiteConfigSchema),\n validateConfig: zodToStandardSchema(Gemini31FlashLiteConfigSchema),\n },\n {\n model: 'gemini-3.1-pro-preview',\n provider: 'google',\n limits: GOOGLE_MODEL_LIMITS['gemini-3.1-pro-preview'],\n pricingFamily: 'gemini-3.1-pro-preview',\n capabilities: {\n inputMimeTypes: GEMINI_INPUT_MIME_TYPES,\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_STANDARD_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: false,\n continuation: 'history',\n providerState: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini31ProPreviewConfigSchema,\n configKeys: toConfigKeys(Gemini31ProPreviewConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemini31ProPreviewConfigSchema),\n validateConfig: zodToStandardSchema(Gemini31ProPreviewConfigSchema),\n },\n {\n model: 'gemini-3.8-flash',\n provider: 'google',\n limits: GOOGLE_MODEL_LIMITS['gemini-3.8-flash'],\n pricingFamily: 'gemini-3.8-flash',\n capabilities: {\n inputMimeTypes: GEMINI_INPUT_MIME_TYPES,\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_STANDARD_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: false,\n continuation: 'history',\n providerState: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini38FlashConfigSchema,\n configKeys: toConfigKeys(Gemini38FlashConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemini38FlashConfigSchema),\n validateConfig: zodToStandardSchema(Gemini38FlashConfigSchema),\n },\n {\n model: 'gemini-3.7-flash',\n provider: 'google',\n limits: GOOGLE_MODEL_LIMITS['gemini-3.7-flash'],\n pricingFamily: 'gemini-3.7-flash',\n capabilities: {\n inputMimeTypes: GEMINI_INPUT_MIME_TYPES,\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_STANDARD_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: false,\n continuation: 'history',\n providerState: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini37FlashConfigSchema,\n configKeys: toConfigKeys(Gemini37FlashConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemini37FlashConfigSchema),\n validateConfig: zodToStandardSchema(Gemini37FlashConfigSchema),\n },\n {\n model: 'gemini-3.6-flash',\n provider: 'google',\n limits: GOOGLE_MODEL_LIMITS['gemini-3.6-flash'],\n pricingFamily: 'gemini-3.6-flash',\n capabilities: {\n inputMimeTypes: GEMINI_INPUT_MIME_TYPES,\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: false,\n continuation: 'history',\n providerState: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini36FlashConfigSchema,\n configKeys: toConfigKeys(Gemini36FlashConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemini36FlashConfigSchema),\n validateConfig: zodToStandardSchema(Gemini36FlashConfigSchema),\n },\n {\n model: 'gemini-3.5-flash-lite',\n provider: 'google',\n limits: GOOGLE_MODEL_LIMITS['gemini-3.5-flash-lite'],\n pricingFamily: 'gemini-3.5-flash-lite',\n capabilities: {\n inputMimeTypes: GEMINI_INPUT_MIME_TYPES,\n reasoning: true,\n structuredOutput: true,\n nativeStructuredOutput: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMINI_LEVEL_WITH_NONE_REASONING_EFFORTS,\n sampling: 'fixed',\n caching: { explicit: true, minTokens: 1024 },\n grounding: true,\n functionCalling: true,\n structuredOutputWithTools: false,\n continuation: 'history',\n providerState: true,\n serviceTiers: ['flex', 'standard'],\n },\n configSchema: Gemini35FlashLiteConfigSchema,\n configKeys: toConfigKeys(Gemini35FlashLiteConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemini35FlashLiteConfigSchema),\n validateConfig: zodToStandardSchema(Gemini35FlashLiteConfigSchema),\n },\n]\n\n// Google's pricing page marks grounding \"Not available\" for Gemma 4 (read\n// 2026-10), while `grounding: true` below rests on a live capture, so it is\n// the capture, not the page, that this flag follows (ADR-013).\n// `grounding: true` on both Gemma descriptors rests on a live capture (ADR-013):\n// `__fixtures__/gemma-grounding-2026-10-03.json` (a derived summary of six calls, not the\n// raw responses), three Search prompts per model. `groundingMetadata` came back on all 5\n// completed calls; the sixth ended at `MAX_TOKENS` with an empty answer (thinking used the\n// 800-token cap), which neither shows nor rules out grounding.\nexport const gemmaModelDescriptors: ModelDescriptor[] = [\n {\n model: 'gemma-4-31b-it',\n provider: 'google',\n limits: GOOGLE_MODEL_LIMITS['gemma-4-31b-it'],\n capabilities: {\n inputMimeTypes: GEMMA_INPUT_MIME_TYPES,\n reasoning: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMMA_REASONING_EFFORTS,\n structuredOutput: true,\n nativeStructuredOutput: true,\n grounding: true,\n sampling: 'tunable',\n },\n configSchema: Gemma431bItConfigSchema,\n configKeys: toConfigKeys(Gemma431bItConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemma431bItConfigSchema),\n validateConfig: zodToStandardSchema(Gemma431bItConfigSchema),\n },\n {\n model: 'gemma-4-26b-a4b-it',\n provider: 'google',\n limits: GOOGLE_MODEL_LIMITS['gemma-4-26b-a4b-it'],\n capabilities: {\n inputMimeTypes: GEMMA_INPUT_MIME_TYPES,\n reasoning: true,\n reasoningApi: 'level',\n admittedReasoningEfforts: GEMMA_REASONING_EFFORTS,\n structuredOutput: true,\n nativeStructuredOutput: true,\n grounding: true,\n sampling: 'tunable',\n },\n configSchema: Gemma426bA4bItConfigSchema,\n configKeys: toConfigKeys(Gemma426bA4bItConfigSchema),\n configJsonSchema: toConfigJsonSchema(Gemma426bA4bItConfigSchema),\n validateConfig: zodToStandardSchema(Gemma426bA4bItConfigSchema),\n },\n]\n\n/**\n * Pre-built registry of all built-in Gemini + Gemma descriptors.\n *\n * Most callers should prefer {@link googleProvider} (which bundles this same\n * descriptor set via `composeProviders`); this export remains for callers\n * that need a bare `ModelRegistry` without going through the plugin seam.\n */\nexport const defaultGeminiRegistry: ModelRegistry = createModelRegistry([\n ...geminiModelDescriptors,\n ...gemmaModelDescriptors,\n])\n","/**\n * `googleProvider` — {@link ProviderPlugin} factory for @gullabs/google.\n *\n * Bundles the Gemini adapter, the built-in Gemini + Gemma model descriptors,\n * and the Gemini pricing source into a single plugin for\n * {@link composeProviders}.\n *\n * @module\n */\n\nimport type { ProviderPlugin } from '@gullabs/core'\n\nimport { geminiAdapter } from './adapter.js'\nimport type { GeminiAdapterOptions } from './adapter.js'\nimport { geminiPricingSource } from './cost.js'\nimport { geminiModelDescriptors, gemmaModelDescriptors } from './models.js'\n\n/**\n * Create a {@link ProviderPlugin} for the Gemini provider.\n *\n * @param opts - Forwarded to {@link geminiAdapter}.\n * @returns A plugin bundling the Gemini adapter, Gemini + Gemma model\n * descriptors, and the built-in Gemini pricing source.\n *\n * @example\n * ```ts\n * import { createClient, composeProviders } from '@gullabs/core'\n * import { googleProvider } from '@gullabs/google'\n *\n * const client = createClient({\n * ...composeProviders([googleProvider()]),\n * })\n * ```\n */\nexport function googleProvider(opts?: GeminiAdapterOptions): ProviderPlugin {\n return {\n adapter: geminiAdapter(opts),\n modelDescriptors: [...geminiModelDescriptors, ...gemmaModelDescriptors],\n pricingSource: geminiPricingSource(),\n }\n}\n","/**\n * GoogleFileStore — thin wrapper over the Gemini File API.\n *\n * Handles upload + polling until ACTIVE, and tracked deletion.\n * Injectable sleep and client for tests (no network required).\n *\n * @module\n */\n\nimport type { AuthMaterial, Logger, Scheduler } from '@gullabs/core'\nimport { LlmError, assertMediaTypeAdmitted, redactSecrets } from '@gullabs/core'\n\nimport { MAX_TIMER_MS, newGoogleGenAI } from './client.js'\nimport { classifyGoogleError, isGoogleNotFoundError } from './errors.js'\nimport { GEMINI_INPUT_MIME_TYPES } from './model-limits.js'\nimport { PLATFORM_SCHEDULER } from './platform-scheduler.js'\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/** A handle to a file stored in the Gemini File API. */\nexport interface GoogleFileHandle {\n /** Resource name, e.g. \"files/abc123\". */\n name: string\n /** URI to pass as FileUriPart.uri in an LlmRequest. */\n uri: string\n mimeType: string\n /** Provider auto-deletes ~48 h after upload. Absent when not returned. */\n expiresAt?: Date\n}\n\n/** The `File` resource fields the store reads. */\ntype FileResp = {\n name?: string\n uri?: string\n mimeType?: string\n state?: string\n expirationTime?: string\n /** Real field `File.error` (`FileStatus`): why processing failed. */\n error?: { code?: number; message?: string; details?: Record<string, unknown>[] }\n}\n\n/**\n * Minimal structural interface for the Gemini Files client surface we use.\n * Satisfied by the real ai.files object or a test fake.\n */\nexport interface GeminiFilesClientLike {\n upload(params: {\n file: Uint8Array | Blob\n config?: { mimeType?: string; displayName?: string; abortSignal?: AbortSignal }\n }): Promise<FileResp>\n get(params: { name: string }): Promise<FileResp>\n delete(params: { name: string }): Promise<void>\n}\n\n/**\n * Options for {@link GoogleFileStore.delete} / {@link GoogleFileStore.deleteAll}.\n *\n * Default is fail-open (P5 side-effect style). Pass `failClosed: true` when\n * the host gates durable state on known delete success. Shape matches\n * `@gullabs/xai` `FileDeleteOptions` by convention.\n */\nexport interface FileDeleteOptions {\n signal?: AbortSignal\n /**\n * When true, non-not-found failures throw typed `LlmError`.\n * When false/omitted, failures invoke `onDeleteError` and resolve.\n * Not-found is success in both modes (idempotent).\n */\n failClosed?: boolean\n}\n\nexport interface GoogleFileStoreOptions {\n auth: AuthMaterial\n /** Injectable client for tests; skips SDK import when provided. */\n client?: GeminiFilesClientLike\n /** Called on delete failures instead of rethrowing. Default: console.error. */\n onDeleteError?: (name: string, err: unknown) => void\n /** Optional structured logger. When provided, routes delete failures to logger.error. */\n logger?: Logger\n poll?: {\n /** Delay between state polls. Default: 3000 ms. */\n intervalMs?: number\n /** Max time to wait for ACTIVE. Default: 300 000 ms (5 min). */\n timeoutMs?: number\n }\n /**\n * Timer source for the poll wait; pass the client's `FakeClock` in tests so\n * one `advance` fires the wait. Default: the platform's timers. (`now` is the\n * poll timeout's clock; pass `() => clock.now()` with it.)\n */\n scheduler?: Scheduler\n /**\n * Replaces the poll wait wholesale (instant polling in tests). When given,\n * `scheduler` is not used for the wait, and the wait cannot be cancelled: if\n * the deadline or an abort ends the upload first, a timer your `sleep` set\n * stays pending until it fires. The default wait is cleared at once.\n */\n sleep?: (ms: number) => Promise<void>\n /** Injectable clock for deterministic tests. Default: `Date.now`. */\n now?: () => number\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_INTERVAL_MS = 3_000\nconst DEFAULT_TIMEOUT_MS = 300_000\n\n/** A poll wait, and how to end it early (a no-op for a host's own `sleep`). */\ninterface Wait {\n promise: Promise<void>\n cancel: () => void\n}\n\n/** The default wait: its timer is cleared by `cancel`, so a lost race leaves none. */\nconst waitOn =\n (scheduler: Scheduler) =>\n (ms: number): Wait => {\n let timer: ReturnType<Scheduler['setTimeout']> | undefined\n const promise = new Promise<void>((resolve) => {\n timer = scheduler.setTimeout(resolve, ms)\n })\n return {\n promise,\n cancel: () => {\n if (timer !== undefined) scheduler.clearTimeout(timer)\n },\n }\n }\n\n/**\n * `server`, not `timeout`: ADR-036 makes every `timeout` retryable, and this must not be.\n * The upload already succeeded, so a retry would upload the bytes again and orphan the\n * first file (upload is not idempotent, ADR-024). Poll the existing file by name instead.\n */\nfunction pollTimeoutError(name: string): LlmError {\n return new LlmError(`Timed out waiting for uploaded file \"${name}\" to become ACTIVE`, {\n kind: 'server',\n retryable: false,\n provider: 'google',\n })\n}\n\nasync function buildFilesClient(auth: AuthMaterial): Promise<GeminiFilesClientLike> {\n const ai = await newGoogleGenAI(auth)\n\n return {\n async upload(params) {\n // Real SDK accepts string | Blob; convert Uint8Array → Blob.\n // Uint8Array.from() copies into a fresh, plain ArrayBuffer-backed\n // array — BlobPart requires Uint8Array<ArrayBuffer>, which excludes\n // the SharedArrayBuffer-backed views that Uint8Array<ArrayBufferLike>\n // (the type of params.file) may structurally include.\n const fileArg: Blob =\n params.file instanceof Uint8Array\n ? new Blob([Uint8Array.from(params.file)], {\n ...(params.config?.mimeType !== undefined\n ? { type: params.config.mimeType }\n : {}),\n })\n : params.file\n\n const result = await (ai.files.upload as (p: unknown) => Promise<FileResp>)({\n file: fileArg,\n ...(params.config !== undefined ? { config: params.config } : {}),\n })\n return result\n },\n\n async get(params) {\n const result = await (ai.files.get as (p: unknown) => Promise<FileResp>)(params)\n return result\n },\n\n async delete(params) {\n await (ai.files.delete as (p: unknown) => Promise<unknown>)(params)\n },\n }\n}\n\nfunction makeHandle(\n resp: FileResp,\n fallback: { name: string; uri: string; mimeType: string },\n): GoogleFileHandle {\n const et = resp.expirationTime\n return {\n name: resp.name ?? fallback.name,\n uri: resp.uri ?? fallback.uri,\n mimeType: resp.mimeType ?? fallback.mimeType,\n ...(et !== undefined && et.length > 0 ? { expiresAt: new Date(et) } : {}),\n }\n}\n\n// ---------------------------------------------------------------------------\n// GoogleFileStore\n// ---------------------------------------------------------------------------\n\n/**\n * **Auth snapshot note:** this store captures the `AuthMaterial` at construction\n * time and memoizes a single SDK client from it (`clientPromise`). This is\n * correct and sufficient for static API keys. If refreshable credentials\n * (short-lived OAuth/STS tokens) are added in the future, this memoization is\n * the seam that will need rework: the cached client would hold stale credentials\n * for the lifetime of a long-lived store instance. At that point, the store\n * will need to either rebuild the client on each operation or accept a\n * credential-resolver callback rather than a plain `AuthMaterial` value.\n * See ADR-020 in DECISIONS.md.\n */\nexport class GoogleFileStore {\n private readonly auth: AuthMaterial\n private readonly clientOverride: GeminiFilesClientLike | undefined\n private readonly onDeleteError: (name: string, err: unknown) => void\n private readonly logger: Logger | undefined\n private readonly intervalMs: number\n private readonly timeoutMs: number\n private readonly startWait: (ms: number) => Wait\n private readonly scheduler: Scheduler\n private readonly now: () => number\n /** Memoised client promise — built at most once per store instance. */\n private clientPromise: Promise<GeminiFilesClientLike> | undefined\n\n constructor(opts: GoogleFileStoreOptions) {\n this.auth = opts.auth\n this.clientOverride = opts.client\n this.logger = opts.logger\n this.onDeleteError =\n opts.onDeleteError ??\n ((name, err) => {\n if (this.logger !== undefined) {\n this.logger.error(\n { name, error: redactSecrets(classifyGoogleError(err).message) },\n 'gemini.file.delete.failed',\n )\n } else {\n console.error(\n `[GoogleFileStore] delete failed for \"${name}\":`,\n redactSecrets(classifyGoogleError(err).message),\n )\n }\n })\n this.intervalMs = opts.poll?.intervalMs ?? DEFAULT_INTERVAL_MS\n this.timeoutMs = opts.poll?.timeoutMs ?? DEFAULT_TIMEOUT_MS\n this.scheduler = opts.scheduler ?? PLATFORM_SCHEDULER\n const customSleep = opts.sleep\n this.startWait =\n customSleep !== undefined\n ? (ms) => ({ promise: customSleep(ms), cancel: () => {} })\n : waitOn(this.scheduler)\n this.now = opts.now ?? (() => Date.now())\n }\n\n private getClient(): Promise<GeminiFilesClientLike> {\n if (this.clientOverride !== undefined) return Promise.resolve(this.clientOverride)\n if (this.clientPromise === undefined) {\n this.clientPromise = buildFilesClient(this.auth)\n }\n return this.clientPromise\n }\n\n /**\n * Upload bytes to the Gemini File API and wait until the file is ACTIVE.\n *\n * @param source - Raw bytes or Blob.\n * @param mimeType - IANA media type, e.g. `\"image/png\"`. It must pass the same\n * admission rule `generate` applies to a Gemini model's parts (one shared\n * function, so a file that uploads can be used): an empty or unadmitted type\n * is `bad_request` before any bytes are sent. The string is sent to Google\n * unchanged.\n * @param opts - Optional display name.\n */\n async upload(\n source: Uint8Array | Blob,\n mimeType: string,\n opts?: { displayName?: string; signal?: AbortSignal },\n ): Promise<GoogleFileHandle> {\n const signal = opts?.signal\n assertMediaTypeAdmitted(\n mimeType,\n GEMINI_INPUT_MIME_TYPES,\n 'mimeType',\n 'google',\n 'a Google file upload',\n )\n const client = await this.getClient()\n\n if (signal?.aborted === true) {\n throw new LlmError('File upload aborted', { kind: 'aborted', retryable: false })\n }\n\n let uploadResp: FileResp\n try {\n // The signal goes to the SDK, and the wait is also raced against it: the\n // SDK's upload does not act on `abortSignal` (checked in\n // `@google/genai` 2.25.0), and an abort cannot recall bytes already sent,\n // so the file may still be stored; the caller is released at once.\n uploadResp = await abortable(\n client.upload({\n file: source,\n config: {\n mimeType,\n ...(opts?.displayName !== undefined ? { displayName: opts.displayName } : {}),\n ...(signal !== undefined ? { abortSignal: signal } : {}),\n },\n }),\n signal,\n )\n } catch (e) {\n throw classifyGoogleError(e)\n }\n\n const { name, uri } = uploadResp\n\n if (\n name === undefined ||\n name.length === 0 ||\n uri === undefined ||\n uri.length === 0\n ) {\n // Provider fault, not caller fault: the SDK call succeeded but the\n // payload is malformed — classify as a server error. NOT retryable:\n // upload() is side-effecting and not idempotent — the provider may have\n // already stored the file even though the payload carries no name/uri,\n // so there is no handle to clean up and an automatic retry could\n // orphan/duplicate provider-side resources.\n throw new LlmError('File upload response missing required fields (name or uri)', {\n kind: 'server',\n retryable: false,\n provider: 'google',\n })\n }\n\n const fallback = { name, uri, mimeType }\n\n if (uploadResp.state === 'ACTIVE') {\n return makeHandle(uploadResp, fallback)\n }\n\n if (uploadResp.state === 'FAILED') {\n throw failedFile('File processing failed immediately after upload', uploadResp)\n }\n\n // PROCESSING (or unknown) — poll until ACTIVE or timeout.\n const deadline = this.now() + this.timeoutMs\n\n // Pre-flight: if the signal is already aborted, throw before creating any\n // promise so we never produce an unhandled rejection. Cast: TS keeps the\n // narrowing from the check before the upload across the awaits.\n if ((signal?.aborted as boolean | undefined) === true) {\n throw new LlmError('File upload polling aborted', {\n kind: 'aborted',\n retryable: false,\n })\n }\n\n // Build an abort-race promise so future aborts wake up the sleep race\n // immediately rather than waiting the full interval. Created only when\n // the signal is NOT already aborted (guard above handles that case). It is\n // observed from the start (a loop that ends before the first race, or after\n // the last, must not leave a rejection nobody handles), and its listener is\n // removed on every way out of the loop.\n let onAbort: (() => void) | undefined\n const abortRacePromise: Promise<never> | undefined =\n signal !== undefined\n ? new Promise<never>((_, reject) => {\n onAbort = () => {\n reject(\n new LlmError('File upload polling aborted', {\n kind: 'aborted',\n retryable: false,\n }),\n )\n }\n signal.addEventListener('abort', onAbort, { once: true })\n })\n : undefined\n abortRacePromise?.catch(() => {})\n\n try {\n return await this.pollUntilActive(\n client,\n name,\n fallback,\n deadline,\n signal,\n abortRacePromise,\n )\n } finally {\n if (signal !== undefined && onAbort !== undefined) {\n signal.removeEventListener('abort', onAbort)\n }\n }\n }\n\n /**\n * `work` raced against the abort promise and the time left until `deadline`\n * (the deadline is a non-retryable `server` error). `work` is observed, so a\n * late rejection after the race is lost is not unhandled; the deadline timer\n * is always cleared.\n */\n private async raceDeadline<T>(\n work: Promise<T>,\n name: string,\n deadline: number,\n abortRacePromise: Promise<never> | undefined,\n ): Promise<T> {\n work.catch(() => {})\n const remainingMs = deadline - this.now()\n let deadlineTimer: ReturnType<Scheduler['setTimeout']> | undefined\n const deadlineRace = new Promise<never>((_, reject) => {\n // Too far out for a timer: the abort is then the only early exit.\n if (remainingMs > MAX_TIMER_MS) return\n deadlineTimer = this.scheduler.setTimeout(\n () => {\n reject(pollTimeoutError(name))\n },\n Math.max(remainingMs, 0),\n )\n })\n deadlineRace.catch(() => {})\n try {\n return await Promise.race(\n abortRacePromise !== undefined\n ? [work, deadlineRace, abortRacePromise]\n : [work, deadlineRace],\n )\n } finally {\n if (deadlineTimer !== undefined) this.scheduler.clearTimeout(deadlineTimer)\n }\n }\n\n /** Polls `name` until ACTIVE; see {@link GoogleFileStore.upload}. */\n private async pollUntilActive(\n client: GeminiFilesClientLike,\n name: string,\n fallback: { name: string; uri: string; mimeType: string },\n deadline: number,\n signal: AbortSignal | undefined,\n abortRacePromise: Promise<never> | undefined,\n ): Promise<GoogleFileHandle> {\n for (;;) {\n if (this.now() >= deadline) {\n throw pollTimeoutError(name)\n }\n\n // The wait is raced against the abort and the rest of the polling\n // deadline: a poll interval longer than the time left ends at the\n // deadline, not after it.\n const wait = this.startWait(this.intervalMs)\n try {\n await this.raceDeadline(wait.promise, name, deadline, abortRacePromise)\n } finally {\n wait.cancel()\n }\n\n // The clock is checked again before a request starts: a wait that a custom\n // `sleep` let run past the deadline must not buy one more poll.\n if (this.now() >= deadline) {\n throw pollTimeoutError(name)\n }\n\n // The poll request is raced the same way, so a `get()` that stalls ends at\n // whichever comes first instead of holding `upload()` open. The losing\n // request is observed, so a late rejection is not unhandled.\n const pollCall = (async (): Promise<FileResp> => {\n try {\n return await client.get({ name })\n } catch (e) {\n throw classifyGoogleError(e)\n }\n })()\n const pollResp = await this.raceDeadline(pollCall, name, deadline, abortRacePromise)\n\n // Also guard here: the signal may have fired during client.get()\n // before we looped back to the sleep race.\n if (signal?.aborted === true) {\n throw new LlmError('File upload polling aborted', {\n kind: 'aborted',\n retryable: false,\n })\n }\n\n // A response that arrives after the deadline is not accepted, `ACTIVE`\n // included: the caller was promised an answer by then.\n if (this.now() >= deadline) {\n throw pollTimeoutError(name)\n }\n\n if (pollResp.state === 'ACTIVE') {\n return makeHandle(pollResp, fallback)\n }\n\n if (pollResp.state === 'FAILED') {\n throw failedFile('File processing failed during polling', pollResp)\n }\n // PROCESSING — continue loop\n }\n }\n\n /**\n * Delete a single uploaded file. Idempotent: not-found → success.\n *\n * Default (`failClosed` omitted/false): errors go to `onDeleteError` and\n * resolve (P5 fail-open). With `failClosed: true`, non-not-found errors\n * throw typed `LlmError` and `onDeleteError` is not called.\n *\n * Empty/blank `handle.name` always throws `bad_request`.\n */\n async delete(handle: GoogleFileHandle, opts?: FileDeleteOptions): Promise<void> {\n const name = handle.name\n if (typeof name !== 'string' || name.trim() === '') {\n throw new LlmError('GoogleFileHandle.name must be a non-empty string.', {\n kind: 'bad_request',\n retryable: false,\n provider: 'google',\n })\n }\n\n const failClosed = opts?.failClosed === true\n\n try {\n if (opts?.signal?.aborted === true) {\n throw new LlmError('Google file delete aborted', {\n kind: 'aborted',\n retryable: false,\n provider: 'google',\n })\n }\n const client = await this.getClient()\n await client.delete({ name })\n } catch (err) {\n if (isGoogleNotFoundError(err)) {\n return\n }\n const withProvider = classifyGoogleError(err)\n\n if (failClosed) {\n throw withProvider\n }\n this.onDeleteError(name, withProvider)\n }\n }\n\n /**\n * Delete multiple files.\n *\n * Fail-open (default): `Promise.allSettled` per handle.\n * Fail-closed: `Promise.all` — first throw rejects; in-flight siblings are\n * not cancelled. Prefer per-handle delete when gating durable release state.\n */\n async deleteAll(handles: GoogleFileHandle[], opts?: FileDeleteOptions): Promise<void> {\n if (opts?.failClosed === true) {\n await Promise.all(handles.map((h) => this.delete(h, opts)))\n return\n }\n await Promise.allSettled(handles.map((h) => this.delete(h, opts)))\n }\n}\n\n/**\n * gRPC codes (`google.rpc.Code`) a `File.error` status can carry that name a\n * provider-side, transient failure: `DEADLINE_EXCEEDED` (4), `INTERNAL` (13)\n * and `UNAVAILABLE` (14). Processing the same bytes again can succeed.\n */\nconst TRANSIENT_FILE_STATUS_CODES = new Set([4, 13, 14])\n\n/**\n * A `FAILED` file, carrying the provider's own `File.error` (message in the\n * text, the whole `FileStatus` as `cause`). `File.error` is a `google.rpc.Status`:\n * a transient code (`DEADLINE_EXCEEDED`, `INTERNAL`, `UNAVAILABLE`) is a\n * retryable `server` error, since the failure is the provider's and a fresh\n * upload can succeed; any other code, or none, is a non-retryable `bad_request`\n * (the file itself cannot be processed).\n */\nfunction failedFile(prefix: string, resp: FileResp): LlmError {\n const providerMessage = resp.error?.message\n const transient =\n typeof resp.error?.code === 'number' &&\n TRANSIENT_FILE_STATUS_CODES.has(resp.error.code)\n return new LlmError(\n providerMessage !== undefined && providerMessage.length > 0\n ? `${prefix}: ${providerMessage}`\n : prefix,\n {\n kind: transient ? 'server' : 'bad_request',\n retryable: transient,\n provider: 'google',\n ...(resp.error !== undefined ? { cause: resp.error } : {}),\n },\n )\n}\n\n/**\n * Races `promise` against `signal`: an abort rejects with an `aborted`\n * `LlmError` while the underlying work carries on unobserved.\n */\nasync function abortable<T>(\n promise: Promise<T>,\n signal: AbortSignal | undefined,\n): Promise<T> {\n if (signal === undefined) return promise\n promise.catch(() => {})\n let onAbort: (() => void) | undefined\n const aborted = new Promise<never>((_, reject) => {\n onAbort = () => {\n reject(new LlmError('File upload aborted', { kind: 'aborted', retryable: false }))\n }\n signal.addEventListener('abort', onAbort, { once: true })\n if (signal.aborted) onAbort()\n })\n try {\n return await Promise.race([promise, aborted])\n } finally {\n if (onAbort !== undefined) signal.removeEventListener('abort', onAbort)\n }\n}\n","/**\n * GoogleCacheStore — thin wrapper over the Gemini Context Cache API.\n *\n * Manages create / get-or-create / refresh / delete lifecycle for cached\n * contents. In-memory cache entries are PROCESS-SCOPED; they are not shared\n * across processes, workers, or restarts.\n *\n * Injectable client and `now` function keep tests free of network and clock.\n *\n * @module\n */\n\nimport type { AuthMaterial, Logger } from '@gullabs/core'\nimport type { Content, Tool, ToolConfig } from '@google/genai'\n\nimport { newGoogleGenAI } from './client.js'\nimport { classifyGoogleError, isGoogleNotFoundError } from './errors.js'\nimport { LlmError, redactSecrets } from '@gullabs/core'\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/**\n * A handle to a cached content resource in the Gemini Context Cache API.\n *\n * Pass `cacheName` as `providerOptions.google.cachedContent` in LlmRequest.\n */\nexport interface GoogleCacheHandle {\n /** Resource name, e.g. \"cachedContents/xyz\". */\n cacheName: string\n /**\n * Local view of when the cache expires (server-authoritative; computed from\n * ttl or parsed from the server response `expireTime`).\n */\n expiresAt: Date\n /** Caches are model-bound; never use a handle with a different model. */\n model: string\n /**\n * Tokens the cache holds, from `usageMetadata.totalTokenCount` of the create\n * response. Cache storage is billed per token-hour (see Google's pricing page)\n * and no usage record carries it, so a host that prices storage reads this.\n * Absent when the response had no `usageMetadata`. Kept across a TTL refresh.\n */\n totalTokenCount?: number\n /**\n * The kinds of tool the cache holds, from the `tools` given to `create` (the\n * keys of each `Tool`: `googleSearch`, `functionDeclarations`, ...); empty when\n * it holds none. Pass it with the name as\n * `providerOptions.google.cachedContent: { cacheName, toolKinds }` so a cached\n * `googleSearch` is priced as Search: the request carries no tool, so nothing\n * else says Search runs. Absent on a handle built by hand, where the content of\n * the cache is unknown. Kept across a TTL refresh.\n */\n toolKinds?: readonly string[]\n}\n\n/** Key used to look up or create an entry in the in-process cache map. */\nexport interface CacheKey {\n model: string\n /** Caller-chosen stable identifier, e.g. a hash of the cached content. */\n stableKey: string\n}\n\n/**\n * Minimal structural interface for the Gemini Caches client surface we use.\n * Satisfied by the real `ai.caches` object or a test fake.\n */\nexport interface GeminiCachesClientLike {\n create(params: {\n model: string\n config: {\n contents?: Content[]\n systemInstruction?: Content | string\n tools?: Tool[]\n toolConfig?: ToolConfig\n ttl?: string\n displayName?: string\n }\n }): Promise<{\n name?: string\n model?: string\n expireTime?: string\n usageMetadata?: { totalTokenCount?: number }\n }>\n\n update(params: {\n name: string\n config: { ttl?: string; expireTime?: string }\n }): Promise<{ name?: string; expireTime?: string }>\n\n delete(params: { name: string }): Promise<unknown>\n}\n\nexport interface GoogleCacheStoreOptions {\n auth: AuthMaterial\n /** Injectable client for tests; skips SDK import when provided. */\n client?: GeminiCachesClientLike\n /**\n * When true, concurrent `getOrCreate` calls for the same key share one\n * in-flight create. Default false.\n */\n coalesce?: boolean\n /**\n * Subtracted from the local expiry so we stop using a cache slightly before\n * the server evicts it. Default 30 s.\n */\n expirySkewSeconds?: number\n /** Called on delete failures instead of rethrowing. */\n onDeleteError?: (cacheName: string, err: unknown) => void\n /** Optional structured logger. When provided, routes delete failures to logger.error. */\n logger?: Logger\n /** Injectable clock for deterministic tests. Default: `Date.now`. */\n now?: () => number\n /**\n * Opt-in pre-flight token-count gate applied before every cache create\n * (both `create()` directly and the `getOrCreate()` path it delegates to,\n * including the coalesced path — enforced once, inside `create()`, so\n * there is no separate \"in-flight\" gap to close).\n */\n preflight?: {\n /** Minimum token count required before a cache create is allowed to proceed. */\n minTokens: number\n /**\n * Counts tokens for the exact token-bearing payload of the impending\n * create — `model` + `contents` + `systemInstruction` + `tools` only.\n * `toolConfig`, `ttl` and `displayName` are excluded: they carry no tokens\n * and are irrelevant to the pre-flight check.\n *\n * This callback receives genai-native `Content[]`/`Content|string` — it\n * does NOT receive the library's `Message[]` shape and there is no\n * automatic conversion between the two (explicit seam, by design). Hosts\n * using genai-native content directly can wire this to a raw\n * `client.models.countTokens` call; hosts building from the library's\n * `Message[]` should call `@gullabs/core`'s `client.countTokens` rather\n * than expecting this callback to convert for them.\n */\n countTokens: (payload: {\n model: string\n contents?: Content[]\n systemInstruction?: Content | string\n tools?: Tool[]\n }) => Promise<number>\n }\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_SKEW_SECONDS = 30\nconst DEFAULT_EXTENSION_SECONDS = 3600\n\n/** The distinct kinds (keys with a value) of a list of `Tool` objects. */\nfunction toolKindsOf(tools: readonly Tool[] | undefined): string[] {\n const kinds = new Set<string>()\n for (const tool of tools ?? []) {\n for (const [kind, value] of Object.entries(tool)) {\n if (value !== undefined) kinds.add(kind)\n }\n }\n return [...kinds]\n}\n\n/**\n * When a cache expires: the server's `expireTime` when it parses, else\n * `fallbackMs`. An unparseable `expireTime` would make an Invalid Date, which is\n * never live, so every `getOrCreate` would create (and bill storage for) a new\n * cache.\n */\nfunction expiryOf(expireTime: string | undefined, fallbackMs: number): Date {\n if (expireTime !== undefined && expireTime.length > 0) {\n const parsed = new Date(expireTime)\n if (!Number.isNaN(parsed.getTime())) return parsed\n }\n return new Date(fallbackMs)\n}\n\nasync function buildCachesClient(auth: AuthMaterial): Promise<GeminiCachesClientLike> {\n const ai = await newGoogleGenAI(auth)\n\n return {\n async create(params) {\n const result = await (\n ai.caches.create as (p: unknown) => Promise<{\n name?: string\n model?: string\n expireTime?: string\n usageMetadata?: { totalTokenCount?: number }\n }>\n )(params)\n return result\n },\n\n async update(params) {\n const result = await (\n ai.caches.update as (p: unknown) => Promise<{\n name?: string\n expireTime?: string\n }>\n )(params)\n return result\n },\n\n async delete(params) {\n await (ai.caches.delete as (p: unknown) => Promise<unknown>)(params)\n },\n }\n}\n\n// ---------------------------------------------------------------------------\n// GoogleCacheStore\n// ---------------------------------------------------------------------------\n\ninterface EntryRecord {\n handle: GoogleCacheHandle\n /** Original ttlSeconds used to create this entry; used as extension default. */\n ttlSeconds: number\n}\n\n/**\n * Process-scoped helper for the Gemini Context Cache API.\n *\n * NOTE: `getOrCreate` reuse is PROCESS-SCOPED only. Entries survive only for\n * the lifetime of this `GoogleCacheStore` instance. Across restarts, new\n * caches will be created (and old ones will be server-evicted after their TTL).\n *\n * **Auth snapshot note:** this store captures the `AuthMaterial` at construction\n * time and memoizes a single SDK client from it (`clientPromise`). This is\n * correct and sufficient for static API keys. If refreshable credentials\n * (short-lived OAuth/STS tokens) are added in the future, this memoization is\n * the seam that will need rework: the cached client would hold stale credentials\n * for the lifetime of a long-lived store instance. At that point, the store\n * will need to either rebuild the client on each operation or accept a\n * credential-resolver callback rather than a plain `AuthMaterial` value.\n * See ADR-020 in DECISIONS.md.\n */\nexport class GoogleCacheStore {\n private readonly auth: AuthMaterial\n private readonly clientOverride: GeminiCachesClientLike | undefined\n private readonly coalesce: boolean\n private readonly skewMs: number\n private readonly onDeleteError: (cacheName: string, err: unknown) => void\n private readonly logger: Logger | undefined\n private readonly now: () => number\n private readonly preflight: GoogleCacheStoreOptions['preflight']\n\n /** Memoised client promise — built at most once per store instance. */\n private clientPromise: Promise<GeminiCachesClientLike> | undefined\n\n /** In-process cache of live handles, keyed by `${model}:${stableKey}`. */\n private readonly entries: Map<string, EntryRecord> = new Map()\n\n /** In-flight create promises when coalescing is enabled. */\n private readonly inflight: Map<string, Promise<GoogleCacheHandle>> = new Map()\n\n constructor(opts: GoogleCacheStoreOptions) {\n this.auth = opts.auth\n this.clientOverride = opts.client\n this.coalesce = opts.coalesce ?? false\n this.skewMs = (opts.expirySkewSeconds ?? DEFAULT_SKEW_SECONDS) * 1000\n this.logger = opts.logger\n this.onDeleteError =\n opts.onDeleteError ??\n ((cacheName, err) => {\n if (this.logger !== undefined) {\n this.logger.error(\n { name: cacheName, error: redactSecrets(classifyGoogleError(err).message) },\n 'gemini.cache.delete.failed',\n )\n } else {\n console.error(\n `[GoogleCacheStore] delete failed for \"${cacheName}\":`,\n redactSecrets(classifyGoogleError(err).message),\n )\n }\n })\n this.now = opts.now ?? (() => Date.now())\n this.preflight = opts.preflight\n }\n\n private getClient(): Promise<GeminiCachesClientLike> {\n if (this.clientOverride !== undefined) return Promise.resolve(this.clientOverride)\n if (this.clientPromise === undefined) {\n this.clientPromise = buildCachesClient(this.auth)\n }\n return this.clientPromise\n }\n\n private isLive(handle: GoogleCacheHandle): boolean {\n return handle.expiresAt.getTime() - this.skewMs > this.now()\n }\n\n /**\n * Create a new cached content resource.\n *\n * The `expiresAt` on the returned handle is computed from the server's\n * `expireTime` when available, with a local-clock fallback of\n * `now + ttlSeconds * 1000`.\n */\n async create(input: {\n model: string\n ttlSeconds: number\n contents?: Content[]\n systemInstruction?: Content | string\n /**\n * Tool declarations to store in the cache. Gemini rejects a request that\n * sends `tools` or `toolConfig` together with `cachedContent`, so a cache\n * used by a tool-calling call must hold them (the adapter rejects the\n * combination before dispatch).\n */\n tools?: Tool[]\n toolConfig?: ToolConfig\n displayName?: string\n }): Promise<GoogleCacheHandle> {\n if (!Number.isInteger(input.ttlSeconds) || input.ttlSeconds <= 0) {\n throw new LlmError(\n `GoogleCacheStore.create: ttlSeconds must be a positive integer, got ${String(input.ttlSeconds)}.`,\n { kind: 'bad_request', retryable: false, provider: 'google' },\n )\n }\n if (this.preflight !== undefined) {\n const counted = await this.preflight.countTokens({\n model: input.model,\n ...(input.contents !== undefined ? { contents: input.contents } : {}),\n ...(input.systemInstruction !== undefined\n ? { systemInstruction: input.systemInstruction }\n : {}),\n ...(input.tools !== undefined ? { tools: input.tools } : {}),\n })\n if (counted < this.preflight.minTokens) {\n throw new LlmError(\n `GoogleCacheStore preflight: counted ${counted} token(s), below the configured ` +\n `minimum of ${this.preflight.minTokens} for model \"${input.model}\".`,\n { kind: 'bad_request', retryable: false },\n )\n }\n }\n\n const client = await this.getClient()\n\n const config: {\n ttl: string\n contents?: Content[]\n systemInstruction?: Content | string\n tools?: Tool[]\n toolConfig?: ToolConfig\n displayName?: string\n } = { ttl: `${input.ttlSeconds}s` }\n\n if (input.contents !== undefined) config.contents = input.contents\n if (input.systemInstruction !== undefined)\n config.systemInstruction = input.systemInstruction\n if (input.tools !== undefined) config.tools = input.tools\n if (input.toolConfig !== undefined) config.toolConfig = input.toolConfig\n if (input.displayName !== undefined) config.displayName = input.displayName\n\n let resp: Awaited<ReturnType<GeminiCachesClientLike['create']>>\n try {\n resp = await client.create({ model: input.model, config })\n } catch (e) {\n throw classifyGoogleError(e)\n }\n\n if (resp.name === undefined || resp.name.length === 0) {\n // Provider fault, not caller fault: the SDK call succeeded but the\n // payload is malformed — classify as a server error. NOT retryable:\n // create() is side-effecting and not idempotent — the provider may have\n // already created the cached content even though the payload carries no\n // name, so there is no handle to clean up and an automatic retry could\n // orphan/duplicate provider-side resources.\n throw new LlmError('Cache create response missing required field: name', {\n kind: 'server',\n retryable: false,\n provider: 'google',\n })\n }\n\n const expiresAt = expiryOf(resp.expireTime, this.now() + input.ttlSeconds * 1000)\n\n const totalTokenCount = resp.usageMetadata?.totalTokenCount\n return {\n cacheName: resp.name,\n model: resp.model ?? input.model,\n expiresAt,\n ...(typeof totalTokenCount === 'number' && Number.isFinite(totalTokenCount)\n ? { totalTokenCount }\n : {}),\n toolKinds: toolKindsOf(input.tools),\n }\n }\n\n /**\n * Return a live cached-content handle, creating one if none exists or the\n * cached entry has expired (accounting for skew).\n *\n * Reuse is PROCESS-SCOPED only — this store instance's in-memory map.\n *\n * When `coalesce` is enabled, concurrent calls for the same key share one\n * in-flight create.\n */\n async getOrCreate(\n key: CacheKey,\n factory: () => Promise<{\n ttlSeconds: number\n contents?: Content[]\n systemInstruction?: Content | string\n tools?: Tool[]\n toolConfig?: ToolConfig\n }>,\n ): Promise<GoogleCacheHandle> {\n const mapKey = `${key.model}:${key.stableKey}`\n\n // Return existing live entry if available.\n const existing = this.entries.get(mapKey)\n if (existing !== undefined) {\n if (this.isLive(existing.handle)) return existing.handle\n // An expired entry is dropped now, not kept until the next create.\n this.entries.delete(mapKey)\n }\n\n // If coalescing, piggyback on an in-flight create for this key.\n if (this.coalesce) {\n const inFlight = this.inflight.get(mapKey)\n if (inFlight !== undefined) {\n return inFlight\n }\n }\n\n const doCreate = async (): Promise<GoogleCacheHandle> => {\n const factoryResult = await factory()\n const handle = await this.create({\n model: key.model,\n ttlSeconds: factoryResult.ttlSeconds,\n ...(factoryResult.contents !== undefined\n ? { contents: factoryResult.contents }\n : {}),\n ...(factoryResult.systemInstruction !== undefined\n ? { systemInstruction: factoryResult.systemInstruction }\n : {}),\n ...(factoryResult.tools !== undefined ? { tools: factoryResult.tools } : {}),\n ...(factoryResult.toolConfig !== undefined\n ? { toolConfig: factoryResult.toolConfig }\n : {}),\n })\n this.entries.set(mapKey, { handle, ttlSeconds: factoryResult.ttlSeconds })\n return handle\n }\n\n if (this.coalesce) {\n const promise = doCreate().finally(() => {\n this.inflight.delete(mapKey)\n })\n this.inflight.set(mapKey, promise)\n return promise\n }\n\n return doCreate()\n }\n\n /**\n * Extend the cache TTL if it will expire within `thresholdSeconds`.\n *\n * Fail-open: if the update call throws, the original handle is returned\n * unchanged. This method NEVER throws.\n *\n * @param handle - Handle to potentially refresh.\n * @param opts.thresholdSeconds - Extend if expiry is within this many seconds.\n * Default 300.\n * @param opts.extensionSeconds - New TTL to set. Default: original TTL from\n * entries map, or 3600 s when the handle was not created via `getOrCreate`.\n */\n async refreshIfExpiringSoon(\n handle: GoogleCacheHandle,\n opts?: { thresholdSeconds?: number; extensionSeconds?: number },\n ): Promise<GoogleCacheHandle> {\n const thresholdMs = (opts?.thresholdSeconds ?? 300) * 1000\n\n if (handle.expiresAt.getTime() - this.now() > thresholdMs) {\n // Not near expiry — return unchanged.\n return handle\n }\n\n // Find the original ttl from the entries map for this handle.\n let extensionSeconds = opts?.extensionSeconds\n if (extensionSeconds === undefined) {\n for (const entry of this.entries.values()) {\n if (entry.handle.cacheName === handle.cacheName) {\n extensionSeconds = entry.ttlSeconds\n break\n }\n }\n extensionSeconds = extensionSeconds ?? DEFAULT_EXTENSION_SECONDS\n }\n\n try {\n const client = await this.getClient()\n const resp = await client.update({\n name: handle.cacheName,\n config: { ttl: `${extensionSeconds}s` },\n })\n\n const newExpiresAt = expiryOf(resp.expireTime, this.now() + extensionSeconds * 1000)\n\n const newHandle: GoogleCacheHandle = {\n cacheName: handle.cacheName,\n model: handle.model,\n expiresAt: newExpiresAt,\n ...(handle.totalTokenCount !== undefined\n ? { totalTokenCount: handle.totalTokenCount }\n : {}),\n ...(handle.toolKinds !== undefined ? { toolKinds: handle.toolKinds } : {}),\n }\n\n // Update the entries map entry if this handle is tracked.\n for (const [k, entry] of this.entries.entries()) {\n if (entry.handle.cacheName === handle.cacheName) {\n this.entries.set(k, { handle: newHandle, ttlSeconds: extensionSeconds })\n break\n }\n }\n\n return newHandle\n } catch {\n // Fail-open: return original handle unchanged.\n return handle\n }\n }\n\n /**\n * Delete a cached content resource. Idempotent: a cache that is already gone\n * (HTTP 404, or the 403 `CachedContent not found` Google sends for an expired\n * one) is success, not an error.\n *\n * Any other error is forwarded to `onDeleteError` and NOT rethrown.\n * The handle is removed from the in-process entries map regardless.\n */\n async delete(handle: GoogleCacheHandle): Promise<void> {\n // Always remove from local map, even if delete fails.\n for (const [k, entry] of this.entries.entries()) {\n if (entry.handle.cacheName === handle.cacheName) {\n this.entries.delete(k)\n break\n }\n }\n\n try {\n const client = await this.getClient()\n await client.delete({ name: handle.cacheName })\n } catch (err) {\n if (isGoogleNotFoundError(err)) return\n this.onDeleteError(handle.cacheName, err)\n }\n }\n}\n","/**\n * geminiContentToMessages — migration utility: `@google/genai` `Content[]` →\n * any-llm's normalized `Message[]`.\n *\n * For consumers moving hand-authored `@google/genai` prompts onto this\n * library. Uses `@google/genai` TYPES ONLY (no runtime SDK dependency — the\n * package is a peer dep, imported here with `import type`).\n *\n * Reject-don't-map: every genai `Content`/`Part` shape this utility cannot\n * losslessly represent in any-llm's normalized types throws a typed\n * `LlmError('bad_request')` naming the offending field or kind. Nothing is\n * ever silently dropped — that silent-loss failure mode is exactly what this\n * utility exists to eliminate for migrating callers.\n *\n * Validation is an exhaustive own-key scan: the set of defined keys on each\n * `Part` must be EXACTLY one of the recognized combinations (`['text']`,\n * `['inlineData']`, `['inlineData', 'mediaResolution']`, `['fileData']`,\n * `['fileData', 'mediaResolution']`), plus `functionCall` / `functionResponse`.\n * A `thoughtSignature` on a model text or `functionCall` part is imported into\n * `transientProviderState` (see {@link GeminiContentToMessagesInput.model});\n * on any other part it throws. Any other key — including unknown\n * future SDK fields — or any combination outside that set throws. Keys whose\n * value is `undefined` are treated as absent (genai types are all-optional;\n * only defined values count).\n *\n * @module\n */\n\nimport { LlmError } from '@gullabs/core'\nimport type { JsonValue, Message, Part } from '@gullabs/core'\nimport type { Content, Part as GenaiPart } from '@google/genai'\nimport { reserveProviderToolCallIds, resolveToolCallId } from './tool-call-id.js'\nimport { signatureEntry } from './thought-signatures.js'\nimport type { GoogleSignatureEntry } from './thought-signatures.js'\n\n/**\n * Input accepted by {@link geminiContentToMessages}.\n */\nexport interface GeminiContentToMessagesInput {\n /** Raw `@google/genai` conversation history to convert. */\n contents: Content[]\n /**\n * Raw `@google/genai` system instruction — either the SDK's shorthand\n * plain string, or a full `Content` (only text parts supported; any\n * non-text part throws).\n */\n systemInstruction?: Content | string\n /**\n * The model string the converted history will be sent to. Required when any\n * part carries a `thoughtSignature`: signatures are bound to the model that\n * issued them and are never replayed on another one.\n */\n model?: string\n}\n\n/**\n * Output produced by {@link geminiContentToMessages}.\n */\nexport interface GeminiContentToMessagesResult {\n /** Concatenated system text, present only when `systemInstruction` was given. */\n system?: string\n /** Normalized any-llm messages, one per input `Content`. */\n messages: Message[]\n /**\n * The thought signatures found on model parts, as the overlay a Gemini 3.x\n * request takes as `transientProviderState`. Present only when at least one\n * part carried a `thoughtSignature`. Send it with `messages` unedited and the\n * same `model`.\n */\n transientProviderState?: JsonValue\n}\n\nfunction badRequest(message: string): LlmError {\n return new LlmError(message, { kind: 'bad_request', retryable: false })\n}\n\n/**\n * Own keys of `obj` whose value is defined. genai types are all-optional;\n * a key explicitly set to `undefined` is treated as absent.\n */\nfunction definedKeys(obj: object): string[] {\n return Object.keys(obj).filter(\n (key) => (obj as Record<string, unknown>)[key] !== undefined,\n )\n}\n\n// ---------------------------------------------------------------------------\n// mediaResolution mapping (Gemini PartMediaResolutionLevel → our normalized hint)\n// ---------------------------------------------------------------------------\n\nfunction mapMediaResolutionLevel(\n level: string,\n location: string,\n): 'low' | 'medium' | 'high' {\n switch (level) {\n case 'MEDIA_RESOLUTION_LOW':\n return 'low'\n case 'MEDIA_RESOLUTION_MEDIUM':\n return 'medium'\n case 'MEDIA_RESOLUTION_HIGH':\n return 'high'\n default:\n throw badRequest(\n `${location}: unsupported Part.mediaResolution.level \"${level}\" — any-llm only ` +\n 'supports MEDIA_RESOLUTION_LOW, MEDIA_RESOLUTION_MEDIUM, MEDIA_RESOLUTION_HIGH.',\n )\n }\n}\n\n/**\n * Convert a defined `Part.mediaResolution` object to the normalized hint.\n *\n * Exhaustive own-key scan: the only representable key is `level`, and it must\n * carry a usable value. An explicit-but-empty `mediaResolution` (empty object,\n * or `level: undefined`) is ambiguous — the caller wrote something any-llm\n * cannot interpret — so it throws rather than being silently ignored.\n */\nfunction convertMediaResolution(\n mediaResolution: NonNullable<GenaiPart['mediaResolution']>,\n location: string,\n): 'low' | 'medium' | 'high' {\n const extraKeys = definedKeys(mediaResolution).filter((key) => key !== 'level')\n if (extraKeys.length > 0) {\n throw badRequest(\n `${location}: Part.mediaResolution keys [${extraKeys.join(', ')}] are not ` +\n 'representable in any-llm — only mediaResolution.level is supported.',\n )\n }\n\n if (mediaResolution.level === undefined) {\n throw badRequest(\n `${location}: Part.mediaResolution is present but carries no level — an ` +\n 'explicit-but-empty mediaResolution is ambiguous; set level or omit the field.',\n )\n }\n\n return mapMediaResolutionLevel(mediaResolution.level, location)\n}\n\n// ---------------------------------------------------------------------------\n// Part mapping (exhaustive own-key scan, reject-don't-map)\n// ---------------------------------------------------------------------------\n\n/**\n * Convert a single `@google/genai` `Part` to its any-llm equivalent.\n *\n * The defined-key set of the part must be exactly one of: `['text']`,\n * `['inlineData']`, `['inlineData', 'mediaResolution']`, `['fileData']`,\n * `['fileData', 'mediaResolution']` (or a lone `functionCall` / `functionResponse`).\n * Anything else — executable code, thought-flagged parts, `videoMetadata`,\n * `partMetadata`, unknown future SDK fields, `text` combined with any other\n * key, or a part with zero recognized fields — throws `LlmError('bad_request')`\n * naming the offending key(s). `thoughtSignature` is not a content key here: it\n * is read by {@link convertPartWithSignature}.\n */\nfunction convertPart(\n part: GenaiPart,\n location: string,\n nameCounts: Map<string, number>,\n reservedIds: Set<string>,\n): Part {\n const keys = definedKeys(part).filter((key) => key !== 'thoughtSignature')\n const baseKeys = keys.filter(\n (key) => key === 'text' || key === 'inlineData' || key === 'fileData',\n )\n\n if (baseKeys.length === 0) {\n if (keys.includes('functionCall') && keys.every((k) => k === 'functionCall')) {\n const fc = (\n part as { functionCall?: { id?: string; name?: string; args?: unknown } }\n ).functionCall\n if (fc === undefined || typeof fc.name !== 'string' || fc.name.length === 0) {\n throw badRequest(`${location}: functionCall.name is required.`)\n }\n return {\n kind: 'tool-call',\n toolCallId: resolveToolCallId(fc.id, fc.name, nameCounts, reservedIds),\n toolName: fc.name,\n args: (fc.args ?? {}) as JsonValue,\n }\n }\n if (\n keys.includes('functionResponse') &&\n keys.every((k) => k === 'functionResponse')\n ) {\n const fr = (\n part as { functionResponse?: { id?: string; name?: string; response?: unknown } }\n ).functionResponse\n if (fr === undefined || typeof fr.name !== 'string' || fr.name.length === 0) {\n throw badRequest(`${location}: functionResponse.name is required.`)\n }\n return {\n kind: 'tool-result',\n toolCallId: resolveToolCallId(\n fr.id,\n fr.name,\n nameCounts,\n reservedIds,\n `result:${fr.name}`,\n ),\n toolName: fr.name,\n result: (fr.response ?? null) as JsonValue,\n }\n }\n if (keys.length === 0) {\n throw badRequest(\n `${location}: Part has no recognized fields set (expected exactly one of ` +\n 'text, inlineData, fileData).',\n )\n }\n throw badRequest(\n `${location}: Part keys [${keys.join(', ')}] are not supported by ` +\n 'geminiContentToMessages — only text, inlineData, fileData, functionCall, ' +\n 'and functionResponse parts can be represented in any-llm.',\n )\n }\n\n if (baseKeys.length > 1) {\n throw badRequest(\n `${location}: Part has more than one of text/inlineData/fileData set ` +\n `([${baseKeys.join(', ')}]) — geminiContentToMessages requires exactly one.`,\n )\n }\n\n const base = baseKeys[0] as 'text' | 'inlineData' | 'fileData'\n const extraKeys = keys.filter(\n (key) => key !== base && !(base !== 'text' && key === 'mediaResolution'),\n )\n if (extraKeys.length > 0) {\n throw badRequest(\n `${location}: Part keys [${extraKeys.join(', ')}] cannot be represented in ` +\n `any-llm alongside ${base} — nothing is silently dropped.`,\n )\n }\n\n if (part.text !== undefined) {\n return { kind: 'text', text: part.text }\n }\n\n if (part.inlineData !== undefined) {\n const inlineData = part.inlineData\n const inlineExtraKeys = definedKeys(inlineData).filter(\n (key) => key !== 'mimeType' && key !== 'data',\n )\n if (inlineExtraKeys.length > 0) {\n throw badRequest(\n `${location}: Part.inlineData keys [${inlineExtraKeys.join(', ')}] are not ` +\n 'representable in any-llm.',\n )\n }\n if (inlineData.mimeType === undefined) {\n throw badRequest(`${location}: Part.inlineData.mimeType is required.`)\n }\n if (inlineData.data === undefined) {\n throw badRequest(`${location}: Part.inlineData.data is required.`)\n }\n return {\n kind: 'inline-media',\n mimeType: inlineData.mimeType,\n data: inlineData.data,\n ...(part.mediaResolution !== undefined\n ? { mediaResolution: convertMediaResolution(part.mediaResolution, location) }\n : {}),\n }\n }\n\n if (part.fileData !== undefined) {\n const fileData = part.fileData\n const fileExtraKeys = definedKeys(fileData).filter(\n (key) => key !== 'fileUri' && key !== 'mimeType',\n )\n if (fileExtraKeys.length > 0) {\n throw badRequest(\n `${location}: Part.fileData keys [${fileExtraKeys.join(', ')}] are not ` +\n 'representable in any-llm.',\n )\n }\n if (fileData.fileUri === undefined) {\n throw badRequest(`${location}: Part.fileData.fileUri is required.`)\n }\n if (fileData.mimeType === undefined) {\n throw badRequest(`${location}: Part.fileData.mimeType is required.`)\n }\n return {\n kind: 'file-uri',\n uri: fileData.fileUri,\n mimeType: fileData.mimeType,\n ...(part.mediaResolution !== undefined\n ? { mediaResolution: convertMediaResolution(part.mediaResolution, location) }\n : {}),\n }\n }\n\n // Unreachable: baseKeys.length === 1 guarantees one of the branches above.\n throw badRequest(`${location}: Part has no recognized fields set.`)\n}\n\n/**\n * {@link convertPart} plus the part's `thoughtSignature`, which is importable\n * only from a model text or `functionCall` part: those are the parts Gemini 3.x\n * signs and a message can represent.\n */\nfunction convertPartWithSignature(\n part: GenaiPart,\n location: string,\n role: 'user' | 'assistant',\n nameCounts: Map<string, number>,\n reservedIds: Set<string>,\n): { part: Part; signature?: string } {\n const converted = convertPart(part, location, nameCounts, reservedIds)\n const signature = part.thoughtSignature\n if (signature === undefined) return { part: converted }\n if (typeof signature !== 'string' || signature.length === 0) {\n throw badRequest(`${location}: Part.thoughtSignature must be a non-empty string.`)\n }\n if (\n role !== 'assistant' ||\n (converted.kind !== 'text' && converted.kind !== 'tool-call')\n ) {\n throw badRequest(\n `${location}: Part.thoughtSignature can only be imported from a model text or functionCall part.`,\n )\n }\n return { part: converted, signature }\n}\n\n// ---------------------------------------------------------------------------\n// Role mapping (no inference)\n// ---------------------------------------------------------------------------\n\nfunction convertRole(role: string | undefined, location: string): 'user' | 'assistant' {\n if (role === 'user') return 'user'\n if (role === 'model') return 'assistant'\n throw badRequest(\n `${location}: Content.role \"${String(role)}\" is not supported — only \"user\" and ` +\n '\"model\" are recognized. any-llm never infers a missing role.',\n )\n}\n\n// ---------------------------------------------------------------------------\n// systemInstruction mapping (NEVER inferred from contents)\n// ---------------------------------------------------------------------------\n\n/**\n * Concatenate the text parts of a `systemInstruction`.\n *\n * A string is used as-is. For a `Content`, the envelope's defined-key set\n * must be exactly `['parts']` (or empty) — `role`, or any unknown future\n * Content field, throws naming the key(s). Every part's defined-key set must\n * be exactly `['text']` — any other key (media, tool shapes, thought flags,\n * `mediaResolution`, unknown future fields) throws naming the offending\n * key(s). A `Content` with zero parts yields `''` (the caller explicitly\n * supplied a system instruction; the derivation is just empty).\n */\nfunction convertSystemInstruction(systemInstruction: Content | string): string {\n if (typeof systemInstruction === 'string') {\n return systemInstruction\n }\n\n const envelopeExtraKeys = definedKeys(systemInstruction).filter(\n (key) => key !== 'parts',\n )\n if (envelopeExtraKeys.length > 0) {\n throw badRequest(\n `systemInstruction: Content keys [${envelopeExtraKeys.join(', ')}] are not ` +\n 'supported on a system instruction — only parts is allowed.',\n )\n }\n\n const parts = systemInstruction.parts ?? []\n const textFragments: string[] = []\n\n parts.forEach((part, index) => {\n const keys = definedKeys(part)\n if (keys.length !== 1 || keys[0] !== 'text' || part.text === undefined) {\n const offending = keys.filter((key) => key !== 'text')\n const named = offending.length > 0 ? offending : keys\n throw badRequest(\n `systemInstruction.parts[${index}]: only text parts are allowed in a system ` +\n `instruction — part keys [${named.length > 0 ? named.join(', ') : 'none'}] ` +\n 'are not supported.',\n )\n }\n textFragments.push(part.text)\n })\n\n return textFragments.join('')\n}\n\n// ---------------------------------------------------------------------------\n// geminiContentToMessages\n// ---------------------------------------------------------------------------\n\n/**\n * Convert `@google/genai` `Content[]` / `Part[]` into any-llm's normalized\n * `{ system?, messages }` shape.\n *\n * A migration utility for callers moving hand-authored `@google/genai`\n * prompts onto any-llm. Exhaustive and reject-don't-map: any genai shape\n * that cannot be losslessly represented in any-llm's normalized types\n * throws `LlmError('bad_request')` naming the offending kind/field instead\n * of silently dropping it.\n *\n * `system` is derived ONLY from the explicit `systemInstruction` input —\n * never inferred from `contents`.\n *\n * @example\n * ```ts\n * // Before: hand-rolled @google/genai prompt\n * const contents: Content[] = [\n * { role: 'user', parts: [{ text: 'Describe this image.' }, { inlineData: { mimeType: 'image/png', data } }] },\n * { role: 'model', parts: [{ text: 'A red bicycle leaning against a brick wall.' }] },\n * ]\n *\n * // After: migrate onto any-llm's normalized shape in one call\n * import { geminiContentToMessages } from '@gullabs/google'\n *\n * const { system, messages } = geminiContentToMessages({\n * contents,\n * systemInstruction: 'You are a concise visual describer.',\n * })\n *\n * const result = await client.generate({ provider: 'google', model: 'gemini-2.5-pro', system, messages }, { auth })\n * ```\n */\nexport function geminiContentToMessages(\n input: GeminiContentToMessagesInput,\n): GeminiContentToMessagesResult {\n const system =\n input.systemInstruction !== undefined\n ? convertSystemInstruction(input.systemInstruction)\n : undefined\n\n const nameCounts = new Map<string, number>()\n const reservedIds = reserveProviderToolCallIds(\n input.contents.flatMap((content) =>\n (content.parts ?? []).flatMap((part) => {\n const p = part as {\n functionCall?: { id?: string }\n functionResponse?: { id?: string }\n }\n return [p.functionCall?.id, p.functionResponse?.id]\n }),\n ),\n )\n const signatures: GoogleSignatureEntry[] = []\n const messages: Message[] = input.contents.map((content, contentIndex) => {\n const location = `contents[${contentIndex}]`\n const envelopeExtraKeys = definedKeys(content).filter(\n (key) => key !== 'role' && key !== 'parts',\n )\n if (envelopeExtraKeys.length > 0) {\n throw badRequest(\n `${location}: Content keys [${envelopeExtraKeys.join(', ')}] are not ` +\n 'supported — only role and parts are allowed.',\n )\n }\n const role = convertRole(content.role, location)\n const parts = (content.parts ?? []).map((part, partIndex) => {\n const partLocation = `${location}.parts[${partIndex}]`\n const converted = convertPartWithSignature(\n part,\n partLocation,\n role,\n nameCounts,\n reservedIds,\n )\n if (converted.signature !== undefined) {\n if (input.model === undefined) {\n throw badRequest(\n `${partLocation}: Part.thoughtSignature requires the \\`model\\` input; a signature is bound to the model that issued it.`,\n )\n }\n signatures.push(\n signatureEntry(\n contentIndex,\n partIndex,\n input.model,\n converted.part,\n converted.signature,\n ),\n )\n }\n return converted.part\n })\n return { role, parts }\n })\n\n return {\n ...(system !== undefined ? { system } : {}),\n messages,\n ...(signatures.length > 0\n ? { transientProviderState: { google: { signatures } } }\n : {}),\n }\n}\n"]}
|