{"version":3,"sources":["../../src/common/interaction-types.ts"],"sourcesContent":["/**\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { z } from 'genkit';\nimport { FunctionDeclaration } from './types.mjs';\n\n/**\n * A tool that can be used by the model.\n * See {@link https://ai.google.dev/gemini-api/docs/function-calling}\n */\nexport declare interface InteractionFunctionTool extends FunctionDeclaration {\n  type: 'function';\n}\n\n/**\n * A tool that can be used by the model to search Google.\n * See {@link https://ai.google.dev/gemini-api/docs/grounding}\n */\nexport declare interface InteractionGoogleSearchTool {\n  type: 'google_search';\n  /** Unknown search types are passed through for forward compatibility. */\n  search_types?: (\n    | 'web_search'\n    | 'image_search'\n    | 'enterprise_web_search'\n    | (string & {})\n  )[];\n}\n\n/**\n * A tool that can be used by the model to execute code.\n * See {@link https://ai.google.dev/gemini-api/docs/code-execution}\n */\nexport declare interface InteractionCodeExecutionTool {\n  type: 'code_execution';\n}\n\n/**\n * A tool that can be used by the model to read and summarize web page content.\n */\nexport declare interface InteractionUrlContextTool {\n  type: 'url_context';\n}\n\n/**\n * A tool that can be used by the model to search uploaded document corpora.\n */\nexport declare interface InteractionFileSearchTool {\n  type: 'file_search';\n  file_search_store_names?: string[];\n  metadata_filter?: string;\n  top_k?: number;\n}\n\nexport declare interface InteractionAllowedTools {\n  mode?: string;\n  tools?: string[];\n}\n\nexport declare interface InteractionToolChoiceConfig {\n  allowed_tools?: InteractionAllowedTools;\n}\n\n/**\n * A tool that can be used by the model to connect to remote MCP servers.\n */\nexport declare interface InteractionMcpServerTool {\n  type: 'mcp_server';\n  name?: string;\n  url?: string;\n  headers?: Record<string, string>;\n  allowed_tools?: InteractionAllowedTools[];\n}\n\nexport declare interface InteractionGoogleMapsTool {\n  type: 'google_maps';\n  enable_widget?: boolean;\n  latitude?: number;\n  longitude?: number;\n}\n\nexport declare interface InteractionComputerUseTool {\n  type: 'computer_use';\n  disabled_safety_policies?: string[];\n  enable_prompt_injection_detection?: boolean;\n  environment?: string;\n  excluded_predefined_functions?: string[];\n}\n\nexport declare interface InteractionRetrievalTool {\n  type: 'retrieval';\n  exa_ai_search_config?: Record<string, unknown>;\n  parallel_ai_search_config?: Record<string, unknown>;\n  rag_store_config?: Record<string, unknown>;\n  retrieval_types?: string[];\n  vertex_ai_search_config?: Record<string, unknown>;\n}\n\nexport declare interface InteractionDynamicTool {\n  type: string;\n  [key: string]: unknown;\n}\n\n/**\n * A tool that can be used by the model.\n */\nexport declare type InteractionTool =\n  | InteractionFunctionTool\n  | InteractionGoogleSearchTool\n  | InteractionCodeExecutionTool\n  | InteractionUrlContextTool\n  | InteractionFileSearchTool\n  | InteractionMcpServerTool\n  | InteractionGoogleMapsTool\n  | InteractionComputerUseTool\n  | InteractionRetrievalTool\n  | InteractionDynamicTool;\n\n// Text annotations are defined as Zod schemas (used for runtime validation)\n// with their TypeScript types derived via z.infer, so the shape is written\n// once. `.passthrough()` keeps fields not listed here.\n\n/** Fields shared by all text annotations. */\nconst AnnotationSpanShape = {\n  /** Start of the annotated segment (in bytes). */\n  start_index: z.number().optional(),\n  /** End of the annotated segment, exclusive. */\n  end_index: z.number().optional(),\n};\n\n/** A URL citation annotation. */\nexport const UrlCitationSchema = z\n  .object({\n    type: z.literal('url_citation'),\n    ...AnnotationSpanShape,\n    /** The URL. */\n    url: z.string().optional(),\n    /** The title of the URL. */\n    title: z.string().optional(),\n  })\n  .passthrough();\nexport type UrlCitation = z.infer<typeof UrlCitationSchema>;\n\n/** A file citation annotation. */\nexport const FileCitationSchema = z\n  .object({\n    type: z.literal('file_citation'),\n    ...AnnotationSpanShape,\n    /** The URI of the file. */\n    document_uri: z.string().optional(),\n    /** The name of the file. */\n    file_name: z.string().optional(),\n    /** Source attributed for a portion of the text. */\n    source: z.string().optional(),\n    /** Page number of the cited document, if applicable. */\n    page_number: z.number().optional(),\n    /** Media ID in case of image citations, if applicable. */\n    media_id: z.string().optional(),\n    /** User-provided metadata about the retrieved context. */\n    custom_metadata: z.record(z.unknown()).optional(),\n  })\n  .passthrough();\nexport type FileCitation = z.infer<typeof FileCitationSchema>;\n\n/** A place (Google Maps) citation annotation. */\nexport const PlaceCitationSchema = z\n  .object({\n    type: z.literal('place_citation'),\n    ...AnnotationSpanShape,\n    /** Title of the place. */\n    name: z.string().optional(),\n    /** The ID of the place, in `places/{place_id}` format. */\n    place_id: z.string().optional(),\n    /** URI reference of the place. */\n    url: z.string().optional(),\n    /** Review snippets about features of the place. */\n    review_snippets: z\n      .array(\n        z.object({\n          review_id: z.string().optional(),\n          title: z.string().optional(),\n          url: z.string().optional(),\n        })\n      )\n      .optional(),\n  })\n  .passthrough();\nexport type PlaceCitation = z.infer<typeof PlaceCitationSchema>;\n\n/**\n * Speech annotation for text content. Used as input to TTS models to assign a\n * turn to a speaker and set its delivery style.\n */\nexport const SpeechAnnotationSchema = z\n  .object({\n    type: z.literal('speech_metadata'),\n    ...AnnotationSpanShape,\n    /** The speaker to associate with this turn. */\n    speaker: z.string().optional(),\n    /** Style instruction for the speech synthesis. */\n    style: z.string().optional(),\n  })\n  .passthrough();\nexport type SpeechAnnotation = z.infer<typeof SpeechAnnotationSchema>;\n\n/** Word-level speech recognition annotation for transcription output. */\nexport const WordInfoSchema = z\n  .object({\n    type: z.literal('word_info'),\n    ...AnnotationSpanShape,\n    /** The transcribed word. */\n    text: z.string().optional(),\n    /** Start offset in time of the word relative to the start of the audio. */\n    start_offset: z.string().optional(),\n    /** End offset in time of the word relative to the start of the audio. */\n    end_offset: z.string().optional(),\n    /** Speaker label for this word (e.g. \"spk_1\"). */\n    speaker: z.string().optional(),\n  })\n  .passthrough();\nexport type WordInfo = z.infer<typeof WordInfoSchema>;\n\n/** An annotation on text content, discriminated by `type`. */\nexport const TextAnnotationSchema = z.discriminatedUnion('type', [\n  UrlCitationSchema,\n  FileCitationSchema,\n  PlaceCitationSchema,\n  SpeechAnnotationSchema,\n  WordInfoSchema,\n]);\nexport type TextAnnotation = z.infer<typeof TextAnnotationSchema>;\n\n/**\n * A text content block.\n */\nexport declare interface TextContent {\n  type: 'text';\n  /** The text content. */\n  text?: string;\n  /**\n   * Annotations on the text: citations on model output, or speech metadata on\n   * TTS input.\n   */\n  annotations?: TextAnnotation[];\n}\n\n/**\n * The resolution of the media.\n */\nexport declare type MediaResolution = 'low' | 'medium' | 'high' | 'ultra_high';\n\n/**\n * An image content block.\n */\nexport declare interface ImageContent {\n  type: 'image';\n  /** The image content. */\n  data?: string;\n  /** The URI of the image. */\n  uri?: string;\n  /** The mime type of the image. */\n  mime_type?: string;\n  /** The resolution of the media. */\n  resolution?: MediaResolution;\n}\n\n/**\n * An audio content block.\n */\nexport declare interface AudioContent {\n  type: 'audio';\n  /** The audio content. */\n  data?: string;\n  /** The URI of the audio. */\n  uri?: string;\n  /** The mime type of the audio. */\n  mime_type?: string;\n}\n\n/**\n * A document content block.\n */\nexport declare interface DocumentContent {\n  type: 'document';\n  /** The document content. */\n  data?: string;\n  /** The URI of the document. */\n  uri?: string;\n  /** The mime type of the document. */\n  mime_type?: string;\n}\n\n/**\n * A video content block.\n */\nexport declare interface VideoContent {\n  type: 'video';\n  /** The video content. */\n  data?: string;\n  /** The URI of the video. */\n  uri?: string;\n  /** The mime type of the video. */\n  mime_type?: string;\n  /** The resolution of the media. */\n  resolution?: MediaResolution;\n  /**\n   * How the model reads the video: `static` (frames at 1 FPS, the default)\n   * or `agentic` (the model explores the timeline and loads only what it\n   * needs; supported by newer models).\n   */\n  processing?: VideoProcessing;\n}\n\n/** How the model reads a video input. */\nexport type VideoProcessing = 'static' | 'agentic' | (string & {});\n\n/**\n * A thought content block.\n */\nexport declare interface ThoughtContent {\n  type: 'thought';\n  /** Signature to match the backend source to be part of the generation. */\n  signature?: string;\n  /** A summary of the thought. */\n  summary?: (TextContent | ImageContent)[];\n}\n\n/**\n * A function tool call content block.\n */\nexport declare interface FunctionCallContent {\n  type: 'function_call';\n  /** The name of the tool to call. */\n  name: string;\n  /** The arguments to pass to the function. */\n  arguments?: Record<string, unknown>;\n  /** A unique ID for this specific tool call. */\n  id: string;\n}\n\n/**\n * A function tool result content block.\n */\nexport declare interface FunctionResultContent {\n  type: 'function_result';\n  /** The name of the tool that was called. */\n  name: string;\n  /** Whether the tool call resulted in an error. */\n  is_error?: boolean;\n  /** The result of the tool call. */\n  result?: Record<string, unknown> | string;\n  /** ID to match the ID from the function call block. */\n  call_id: string;\n}\n\n/**\n * The content of the response.\n */\nexport type Content =\n  | TextContent\n  | ImageContent\n  | AudioContent\n  | DocumentContent\n  | VideoContent\n  | ThoughtContent\n  | FunctionCallContent\n  | FunctionResultContent;\n\nexport declare interface ModelOutputStep {\n  type: 'model_output';\n  content: Content[];\n}\n\nexport declare interface UserInputStep {\n  type: 'user_input';\n  content: Content[];\n}\n\nexport declare interface GoogleSearchCallStep {\n  type: 'google_search_call';\n  id: string;\n  arguments: { queries: string[] };\n  signature?: string;\n}\n\nexport declare interface GoogleSearchResultStep {\n  type: 'google_search_result';\n  call_id: string;\n  /** The search results, e.g. `[{ search_suggestions }]`. */\n  result: Record<string, unknown>[] | Record<string, unknown>;\n  is_error?: boolean;\n  signature?: string;\n}\n\nexport declare interface CodeExecutionCallStep {\n  type: 'code_execution_call';\n  id: string;\n  arguments: { code: string; language?: string; [key: string]: unknown };\n  signature?: string;\n}\n\nexport declare interface CodeExecutionResultStep {\n  type: 'code_execution_result';\n  call_id: string;\n  result: Record<string, unknown> | string;\n  signature?: string;\n}\n\nexport declare interface FunctionCallStep {\n  type: 'function_call';\n  name: string;\n  arguments?: Record<string, unknown>;\n  id: string;\n  signature?: string;\n}\n\nexport declare interface FunctionResultStep {\n  type: 'function_result';\n  name?: string;\n  call_id: string;\n  is_error?: boolean;\n  result: Record<string, unknown> | string | (ImageContent | TextContent)[];\n  signature?: string;\n}\n\nexport declare interface ThoughtStep {\n  type: 'thought';\n  signature?: string;\n  summary?: (TextContent | ImageContent)[];\n}\n\n/**\n * Agentic video understanding: the model asked to load part of a video (a\n * segment, frames or the transcript). Needs no reply.\n */\nexport declare interface ProcessingCallStep {\n  type: 'processing_call';\n  id: string;\n  signature?: string;\n}\n\n/** Agentic video understanding: the result of a `processing_call`. */\nexport declare interface ProcessingResultStep {\n  type: 'processing_result';\n  call_id: string;\n  signature?: string;\n}\n\nexport type Step =\n  | ModelOutputStep\n  | UserInputStep\n  | Content\n  | GoogleSearchCallStep\n  | GoogleSearchResultStep\n  | CodeExecutionCallStep\n  | CodeExecutionResultStep\n  | FunctionCallStep\n  | FunctionResultStep\n  | ThoughtStep\n  | ProcessingCallStep\n  | ProcessingResultStep;\n\n/**\n * A turn in a conversation.\n */\nexport declare interface Turn {\n  /** The originator of this turn. Must be user for input or model for model output. */\n  role: string;\n  /** The content of the turn. */\n  content: string | Content[];\n}\n\n/**\n * The token count for a single response modality.\n */\nexport declare interface ModalityTokens {\n  /** The modality associated with the token count. */\n  modality?: ResponseModality;\n  /** Number of tokens for the modality. */\n  tokens?: number;\n}\n\n/**\n * Statistics on the interaction request's token usage.\n */\n// These match what comes back from the REST API\n// Unfortunately they are forced snake case at the API level.\nexport declare interface Usage {\n  /** Number of tokens in the prompt (context). */\n  total_input_tokens?: number;\n  /** A breakdown of input token usage by modality. */\n  input_tokens_by_modality?: ModalityTokens[];\n  /** Number of tokens in the cached part of the prompt (the cached content). */\n  total_cached_tokens?: number;\n  /** A breakdown of cached token usage by modality. */\n  cached_tokens_by_modality?: ModalityTokens[];\n  /** Total number of tokens across all the generated responses. */\n  total_output_tokens?: number;\n  /** A breakdown of output token usage by modality. */\n  output_tokens_by_modality?: ModalityTokens[];\n  /** Number of tokens present in tool-use prompt(s). */\n  total_tool_use_tokens?: number;\n  /** A breakdown of tool-use token usage by modality. */\n  tool_use_by_modality?: ModalityTokens[];\n  /** Number of tokens of thoughts for thinking models. */\n  total_thought_tokens?: number;\n  /** Total token count for the interaction request (prompt + responses + other internal tokens). */\n  total_tokens?: number;\n}\n\n/**\n * The configuration for speech interaction.\n */\nexport declare interface SpeechConfig {\n  /** The voice of the speaker. */\n  voice?: string;\n  /** The language of the speech. */\n  language?: string;\n  /** The speaker's name, it should match the speaker name given in the prompt. */\n  speaker?: string;\n}\n\n/**\n * The configuration for image interaction.\n */\nexport declare interface ImageConfig {\n  /** The aspect ratio of the image. */\n  aspect_ratio?: string;\n  /** The size of the image. */\n  image_size?: string;\n}\n\n/**\n * The configuration for video generation (e.g. gemini-omni-1.1-flash).\n */\nexport declare interface VideoConfig {\n  /** The kind of generation. Inferred from the prompt if not set. */\n  task?:\n    | 'text_to_video'\n    | 'image_to_video'\n    | 'reference_to_video'\n    | 'edit'\n    | 'extend'\n    | (string & {});\n}\n\n/**\n * Configuration parameters for model interactions.\n */\nexport declare interface ModelGenerationConfig {\n  /** Controls the randomness of the output. */\n  temperature?: number;\n  /** The maximum cumulative probability of tokens to consider when sampling. */\n  top_p?: number;\n  /** Seed used in decoding for reproducibility. */\n  seed?: number;\n  /** A list of character sequences that will stop output interaction. */\n  stop_sequences?: string[];\n  /** The tool choice for the interaction. */\n  tool_choice?: string | InteractionToolChoiceConfig;\n  /** The level of thought tokens that the model should generate. */\n  thinking_level?: 'minimal' | 'low' | 'medium' | 'high';\n  /** Whether to include thought summaries in the response. */\n  thinking_summaries?: 'auto' | 'none';\n  /** The maximum number of tokens to include in the response. */\n  max_output_tokens?: number;\n  /**\n   * Speech configuration: an array for a single speaker, or\n   * `{ speakers: [...] }` for multi-speaker.\n   */\n  speech_config?: SpeechConfig[] | { speakers: SpeechConfig[] };\n  /** Configuration for image interaction. */\n  image_config?: ImageConfig;\n  /** Configuration for video generation. */\n  video_config?: VideoConfig;\n}\n\n/**\n * Configuration for dynamic agents.\n */\nexport declare interface DynamicAgentConfig {\n  type: 'dynamic';\n}\n\n/**\n * Configuration for the Deep Research agent.\n */\nexport declare interface DeepResearchAgentConfig {\n  type: 'deep-research';\n  /** Whether to include thought summaries in the response. */\n  thinking_summaries?: 'auto' | 'none';\n  /** Visualization allows the agent to generate charts and graphs to support its findings. */\n  visualization?: 'auto' | 'off';\n  /** Collaborative planning allows you to review and refine the research plan before execution. */\n  collaborative_planning?: boolean;\n}\n\n/**\n * Configuration for the Antigravity agent.\n */\nexport declare interface AntigravityAgentConfig {\n  type: 'antigravity';\n  /** The Gemini model the agent runs on (defaults to the agent's default). */\n  model?: string;\n}\n\n/**\n * Service Tier\n */\nexport declare type ServiceTier =\n  | 'flex'\n  | 'standard'\n  | 'priority'\n  | (string & {});\n\n/**\n * Configuration for the agent.\n */\nexport type InteractionsAgentConfig =\n  | DynamicAgentConfig\n  | DeepResearchAgentConfig\n  | AntigravityAgentConfig;\n\n/**\n * Indicates the model should return text, images, or audio.\n */\nexport declare type ResponseModality =\n  | 'text'\n  | 'image'\n  | 'audio'\n  | (string & {});\n\n/**\n * A safety setting: the threshold for blocking one harm category.\n * vertexAI only (googleAI rejects `safety_settings` with a 400).\n */\nexport declare interface InteractionSafetySetting {\n  /** The harm category, e.g. `hate_speech`. */\n  type:\n    | 'hate_speech'\n    | 'dangerous_content'\n    | 'harassment'\n    | 'sexually_explicit'\n    | (string & {});\n  /** The blocking threshold, e.g. `block_low_and_above`. */\n  threshold:\n    | 'block_low_and_above'\n    | 'block_medium_and_above'\n    | 'block_only_high'\n    | 'block_none'\n    | 'off'\n    | (string & {});\n  /** Whether to block by probability (default) or by severity. */\n  method?: 'probability' | 'severity' | (string & {});\n}\n\n/**\n * Parameters for creating interactions.\n */\nexport declare interface CreateInteractionRequest {\n  /** The ID of the previous interaction, if any. */\n  previous_interaction_id?: string;\n\n  /** The model to use for this request (mutually exclusive with agent) */\n  model?: string;\n  /** The agent to use for this request (mutually exclusive with model) */\n  agent?: string;\n\n  /** The environment configuration for the sandbox. */\n  environment?: string | Record<string, unknown>;\n\n  /** The inputs for the interaction. */\n  input: string | Step[] | Step;\n\n  /** System instruction for the interaction. */\n  system_instruction?: string;\n\n  /** A list of tool declarations the model may call during interaction. */\n  tools?: InteractionTool[];\n\n  /** Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field */\n  response_format?: Record<string, unknown> | Record<string, unknown>[];\n\n  /** The requested modalities of the response (TEXT, IMAGE, AUDIO). */\n  response_modalities?: ResponseModality[];\n\n  /** Whether the interaction will be streamed. */\n  stream?: boolean;\n  /** Whether to store the response and request for later retrieval. */\n  store?: boolean;\n  /** Whether to run the model interaction in the background. */\n  background?: boolean;\n\n  /** Configuration parameters for the model interaction. */\n  generation_config?: ModelGenerationConfig;\n  /** Configuration for the agent. */\n  agent_config?: InteractionsAgentConfig;\n  /** */\n  service_tier?: ServiceTier;\n  /** Safety settings. vertexAI only (googleAI rejects it with a 400). */\n  safety_settings?: InteractionSafetySetting[];\n  /**\n   * Key-value labels for billing and cost tracking. vertexAI only (accepted\n   * there, though not in its published spec; checked live Oct 2026).\n   */\n  labels?: Record<string, string>;\n}\n\nexport interface TextDelta {\n  type: 'text';\n  text: string;\n}\n\nexport interface ImageDelta {\n  type: 'image';\n  data?: string;\n  uri?: string;\n  mime_type?: string;\n  resolution?: MediaResolution;\n}\n\nexport interface AudioDelta {\n  type: 'audio';\n  data?: string;\n  uri?: string;\n  mime_type?: string;\n  sample_rate?: number;\n  channels?: number;\n}\n\nexport interface DocumentDelta {\n  type: 'document';\n  data?: string;\n  uri?: string;\n  mime_type?: string;\n}\n\nexport interface VideoDelta {\n  type: 'video';\n  data?: string;\n  uri?: string;\n  mime_type?: string;\n  resolution?: MediaResolution;\n}\n\nexport interface ThoughtSummaryDelta {\n  type: 'thought_summary';\n  content?: Content;\n}\n\nexport interface ThoughtSignatureDelta {\n  type: 'thought_signature';\n  signature?: string;\n}\n\nexport interface FunctionCallDelta {\n  type: 'function_call';\n  name: string;\n  arguments: Record<string, unknown>;\n  id: string;\n}\n\nexport interface ArgumentsDelta {\n  type: 'arguments_delta';\n  arguments?: string;\n}\n\nexport interface CodeExecutionCallDelta {\n  type: 'code_execution_call';\n  arguments: { code?: string; language?: string; [key: string]: unknown };\n  signature?: string;\n}\n\nexport interface UrlContextCallDelta {\n  type: 'url_context_call';\n  arguments: { urls?: string[] };\n  signature?: string;\n}\n\nexport interface GoogleSearchCallDelta {\n  type: 'google_search_call';\n  arguments: { queries?: string[] };\n  signature?: string;\n}\n\nexport interface McpServerToolCallDelta {\n  type: 'mcp_server_tool_call';\n  name: string;\n  server_name: string;\n  arguments: Record<string, unknown>;\n}\n\nexport interface FileSearchCallDelta {\n  type: 'file_search_call';\n  signature?: string;\n}\n\nexport interface GoogleMapsCallDelta {\n  type: 'google_maps_call';\n  arguments?: { queries?: string[] };\n  signature?: string;\n}\n\nexport interface FunctionResultDelta {\n  type: 'function_result';\n  name?: string;\n  call_id: string;\n  is_error?: boolean;\n  result: Record<string, unknown> | string | (ImageContent | TextContent)[];\n}\n\nexport interface CodeExecutionResultDelta {\n  type: 'code_execution_result';\n  result: string;\n  is_error?: boolean;\n  signature?: string;\n}\n\nexport interface UrlContextResultDelta {\n  type: 'url_context_result';\n  result: Record<string, unknown>[];\n  is_error?: boolean;\n  signature?: string;\n}\n\nexport interface GoogleSearchResultDelta {\n  type: 'google_search_result';\n  result: Record<string, unknown>[];\n  is_error?: boolean;\n  signature?: string;\n}\n\nexport interface McpServerToolResultDelta {\n  type: 'mcp_server_tool_result';\n  name?: string;\n  server_name?: string;\n  result: Record<string, unknown> | string | (ImageContent | TextContent)[];\n}\n\nexport interface FileSearchResultDelta {\n  type: 'file_search_result';\n  result: Record<string, unknown>[];\n  signature?: string;\n}\n\nexport interface GoogleMapsResultDelta {\n  type: 'google_maps_result';\n  result?: Record<string, unknown>[];\n  signature?: string;\n}\n\nexport interface TextAnnotationDelta {\n  type: 'text_annotation_delta';\n  annotations?: TextAnnotation[];\n}\n\nexport type StepDeltaData =\n  | TextDelta\n  | ImageDelta\n  | AudioDelta\n  | DocumentDelta\n  | VideoDelta\n  | ThoughtSummaryDelta\n  | ThoughtSignatureDelta\n  | FunctionCallDelta\n  | ArgumentsDelta\n  | CodeExecutionCallDelta\n  | UrlContextCallDelta\n  | GoogleSearchCallDelta\n  | McpServerToolCallDelta\n  | FileSearchCallDelta\n  | GoogleMapsCallDelta\n  | FunctionResultDelta\n  | CodeExecutionResultDelta\n  | UrlContextResultDelta\n  | GoogleSearchResultDelta\n  | McpServerToolResultDelta\n  | FileSearchResultDelta\n  | GoogleMapsResultDelta\n  | TextAnnotationDelta;\n\nexport type InteractionSseEvent =\n  | {\n      event_type: 'interaction.created';\n      interaction: Partial<GeminiInteraction>;\n      event_id?: string;\n    }\n  | {\n      event_type: 'interaction.completed';\n      interaction: Partial<GeminiInteraction>;\n      event_id?: string;\n    }\n  | {\n      event_type: 'interaction.status_update';\n      /** Only present when the interaction is stored (`store: true`). */\n      interaction_id?: string;\n      status: GeminiInteraction['status'];\n      event_id?: string;\n    }\n  | {\n      event_type: 'error';\n      error: { code: string; message: string };\n      event_id?: string;\n    }\n  | { event_type: 'step.start'; index: number; step: Step; event_id?: string }\n  | {\n      event_type: 'step.delta';\n      index: number;\n      delta: StepDeltaData;\n      event_id?: string;\n    }\n  | { event_type: 'step.stop'; index: number; event_id?: string };\n\nexport interface InteractionStreamResult {\n  stream: AsyncGenerator<InteractionSseEvent>;\n  response: Promise<GeminiInteraction>;\n}\n\nexport declare interface GeminiInteraction {\n  /** The name of the Model used for generating the interaction. */\n  model?: string;\n  /** The name of the Agent used for generating the interaction. */\n  agent?: string;\n  /** The environment ID for the sandbox, if used. */\n  environment_id?: string;\n  /** The unique identifier for the interaction completion. */\n  id?: string; // The interactionId to be used in subsequent interactions\n  /** The ID of the previous interaction, if any. */\n  previous_interaction_id?: string;\n  /** The status of the interaction. */\n  status?:\n    | 'in_progress'\n    | 'queued'\n    | 'requires_action'\n    | 'completed'\n    | 'incomplete'\n    | 'failed'\n    | 'cancelled';\n  /** The time at which the response was created in ISO 8601 format. */\n  created?: string;\n  /** The time at which the response was last updated in ISO 8601 format. */\n  updated?: string;\n  /** The role of the interaction. */\n  role?: string;\n  /** Steps comprising the interaction timeline. */\n  steps?: Step[];\n  /** Statistics on the interaction request's token usage. */\n  usage?: Usage;\n  /**\n   * Output only. Errors recorded on the interaction. Populated when `status`\n   * is `failed` (e.g. a safety block or an unrecoverable tool-call error).\n   */\n  errors?: InteractionError[];\n}\n\n/** An error recorded on an interaction or sent in an SSE `error` event. */\nexport declare interface InteractionError {\n  /** Error code, e.g. `safety` or `malformed_function_call`. */\n  code?: string;\n  /** Human-readable error message. */\n  message?: string;\n}\n"],"mappings":"AAeA,SAAS,SAAS;AAwHlB,MAAM,sBAAsB;AAAA;AAAA,EAE1B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAEjC,WAAW,EAAE,OAAO,EAAE,SAAS;AACjC;AAGO,MAAM,oBAAoB,EAC9B,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ,cAAc;AAAA,EAC9B,GAAG;AAAA;AAAA,EAEH,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAEzB,OAAO,EAAE,OAAO,EAAE,SAAS;AAC7B,CAAC,EACA,YAAY;AAIR,MAAM,qBAAqB,EAC/B,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ,eAAe;AAAA,EAC/B,GAAG;AAAA;AAAA,EAEH,cAAc,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAElC,WAAW,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE/B,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE5B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAEjC,UAAU,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE9B,iBAAiB,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS;AAClD,CAAC,EACA,YAAY;AAIR,MAAM,sBAAsB,EAChC,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ,gBAAgB;AAAA,EAChC,GAAG;AAAA;AAAA,EAEH,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE1B,UAAU,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE9B,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAEzB,iBAAiB,EACd;AAAA,IACC,EAAE,OAAO;AAAA,MACP,WAAW,EAAE,OAAO,EAAE,SAAS;AAAA,MAC/B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,MAC3B,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,IAC3B,CAAC;AAAA,EACH,EACC,SAAS;AACd,CAAC,EACA,YAAY;AAOR,MAAM,yBAAyB,EACnC,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ,iBAAiB;AAAA,EACjC,GAAG;AAAA;AAAA,EAEH,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE7B,OAAO,EAAE,OAAO,EAAE,SAAS;AAC7B,CAAC,EACA,YAAY;AAIR,MAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ,WAAW;AAAA,EAC3B,GAAG;AAAA;AAAA,EAEH,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE1B,cAAc,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAElC,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAEhC,SAAS,EAAE,OAAO,EAAE,SAAS;AAC/B,CAAC,EACA,YAAY;AAIR,MAAM,uBAAuB,EAAE,mBAAmB,QAAQ;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":[]}