import type { Context, Model, ProviderSessionState, StreamFunction, StreamOptions } from "../types"; import type { Content, FunctionCallingConfigMode, ThinkingConfig } from "./google-shared"; import { type GoogleThinkingLevel } from "./google-shared"; /** * Thinking level for Gemini 3 models. Re-exported from `google-shared` so existing * `import { GoogleThinkingLevel } from "./google-gemini-cli"` callers keep working. */ export type { GoogleThinkingLevel }; export interface GoogleGeminiCliOptions extends StreamOptions { /** * Tool selection mode. String forms map directly to Gemini * `FunctionCallingConfigMode`. The object form forces a single named tool — * `mode: "ANY"` is wire-required when `allowedFunctionNames` is set. */ toolChoice?: "auto" | "none" | "any" | { mode: "ANY"; allowedFunctionNames: [string, ...string[]]; }; /** * Thinking/reasoning configuration. * - Gemini 2.x models: use `budgetTokens` to set the thinking budget * - Gemini 3 models (gemini-3-pro-*, gemini-3-flash-*): use `level` instead * * When using `streamSimple`, this is handled automatically based on the model. */ thinking?: { enabled: boolean; /** Thinking budget in tokens. Use for Gemini 2.x models. */ budgetTokens?: number; /** Thinking level. Use for Gemini 3 models (LOW/HIGH for Pro, MINIMAL/LOW/MEDIUM/HIGH for Flash). */ level?: GoogleThinkingLevel; /** * Explicit wire suppression when `enabled` is false. Cloud Code Assist * re-applies the per-id baked server default when thinkingConfig is * omitted, so models with `thinking.suppressWhenOff` must send * `includeThoughts: false` plus a MINIMAL level (or zero budget). */ suppress?: { level: GoogleThinkingLevel; } | { budget: number; }; }; /** * Upstream wire model id override for collapsed effort-tier variants. * Serialized as `requestModelId ?? model.requestModelId ?? model.id`. */ requestModelId?: string; projectId?: string; /** Antigravity endpoint routing mode: "auto" (default with failover), "production", "sandbox". */ antigravityEndpointMode?: "auto" | "production" | "sandbox"; providerSessionState?: Map; } export interface AntigravityProviderSessionState extends ProviderSessionState { lastGoodEndpoint?: string; /** * Per-conversation request-envelope identity that mirrors the real * Antigravity client. `sessionId` is the signed-decimal session id; * `agentId`/`trajectoryId` are UUIDs; `stepIndex` is the monotonic step * counter; `lastExecutionId` is the prior response id echoed as * `labels.last_execution_id`. */ agentId?: string; trajectoryId?: string; sessionId?: string; stepIndex?: number; lastExecutionId?: string; } export declare function getAntigravityProviderSessionState(providerSessionState: Map | undefined): AntigravityProviderSessionState | undefined; export { ANTIGRAVITY_SYSTEM_INSTRUCTION, getAntigravityUserAgent, getGeminiCliHeaders, getGeminiCliUserAgent, } from "@oh-my-pi/pi-catalog/wire/gemini-headers"; interface ParsedGeminiCliCredentials { accessToken: string; projectId: string; refreshToken?: string; expiresAt?: number; email?: string; } export declare function parseGeminiCliCredentials(apiKeyRaw: string): ParsedGeminiCliCredentials; export declare function shouldRefreshGeminiCliCredentials(expiresAt: number | undefined, isAntigravity: boolean, nowMs?: number): boolean; interface CloudCodeAssistRequest { project: string; model: string; request: { contents: Content[]; sessionId?: string; systemInstruction?: { role?: string; parts: { text: string; }[]; }; generationConfig?: { maxOutputTokens?: number; temperature?: number; topP?: number; topK?: number; minP?: number; presencePenalty?: number; repetitionPenalty?: number; thinkingConfig?: ThinkingConfig; }; tools?: { functionDeclarations: Record[]; }[] | undefined; toolConfig?: { functionCallingConfig: { mode: FunctionCallingConfigMode; allowedFunctionNames?: string[]; }; }; labels?: Record; }; requestType?: string; userAgent?: string; requestId?: string; } export declare const streamGoogleGeminiCli: StreamFunction<"google-gemini-cli">; export declare function buildRequest(model: Model<"google-gemini-cli">, context: Context, projectId: string, options?: GoogleGeminiCliOptions, isAntigravity?: boolean): CloudCodeAssistRequest;