import type { Context, FetchImpl, Model, ProviderSessionState } from "../types"; import { AssistantMessageEventStream } from "../utils/event-stream"; import { type GoogleSharedStreamOptions } from "./google-shared"; type GoogleInteractionsApi = "google-generative-ai" | "google-vertex"; /** Provider session state storing the last Gemini Interactions response id. */ export interface GoogleInteractionsProviderSessionState extends ProviderSessionState { lastInteractionId?: string; } /** Conversation anchor for continuing an Interactions turn from a prior assistant response. */ export interface InteractionAnchor { id?: string; messageIndex?: number; } /** Provider-specific URL, headers, and fetch implementation for an Interactions request. */ export interface GoogleInteractionsPlan { url: string; headers: Record; fetch?: FetchImpl; } /** * Streams Gemini Interactions API model-mode responses for direct Google and Vertex providers. * * `fallback`, when supplied, is the legacy `:streamGenerateContent` stream factory. It runs * transparently — forwarding its events into this stream — when the Interactions attempt fails * before any content is emitted with a signal that the model/endpoint does not support * Interactions (HTTP 404/400). Provide it only for auto-selected Interactions requests so an * explicit `useInteractionsApi: true` still surfaces failures. */ export declare function streamGoogleInteractions(args: { model: Model; context: Context; options: GoogleSharedStreamOptions | undefined; api: T; anchor: InteractionAnchor; state: GoogleInteractionsProviderSessionState | undefined; prepare: () => GoogleInteractionsPlan | Promise; fallback?: () => AssistantMessageEventStream; }): AssistantMessageEventStream; /** * Whether a model is served by the Gemini Interactions API. Interactions is a Gemini 3-era * transport, so the catalog subset that supports it is Gemini 3.0+. Older Gemini and non-Gemini * ids keep `:streamGenerateContent`, which covers the full catalog. */ export declare function modelSupportsInteractions(model: Pick): boolean; /** * Resolves whether a Google provider call should use Interactions and which lineage anchor to send. * * Precedence: explicit `useInteractionsApi: false` always wins (force generateContent); otherwise * Interactions engages when explicitly requested, when continuing a stored interaction * (`previousInteractionId`/assistant lineage/session state), or when `autoEligible` (the * zero-config default for the capable model subset on the official endpoint). `auto` flags the * last case for the caller — it is the only mode that wires up the generateContent fallback. */ export declare function resolveInteractionDispatch(args: { context: Context; options: GoogleSharedStreamOptions | undefined; provider: string; autoEligible: boolean; }): { useInteractions: boolean; auto: boolean; anchor: InteractionAnchor; state: GoogleInteractionsProviderSessionState | undefined; }; export {};