/** * @license * Copyright 2025 Vybestack LLC * SPDX-License-Identifier: Apache-2.0 */ import type { Part } from '@google/genai'; /** * Synthetic thought signature used when a functionCall part lacks one. * This bypasses Gemini 3.x validation without containing actual reasoning. * * @see https://ai.google.dev/gemini-api/docs/thought-signatures */ export declare const SYNTHETIC_THOUGHT_SIGNATURE = "skip_thought_signature_validator"; /** * Content structure matching Gemini API format */ interface Content { role: string; parts: Part[]; } /** * Ensures that all functionCall parts in the "active loop" have a thoughtSignature. * * The active loop is defined as all content from the last user message with text * (not a functionResponse) to the end of the history. Gemini 3.x requires that * the first functionCall part in each model turn within this active loop has * a thoughtSignature property. * * This function: * 1. Finds the start of the active loop by locating the last user turn with text * 2. For each model turn in the active loop, ensures the first functionCall has a signature * 3. Preserves existing signatures if present * 4. Adds a synthetic signature if missing * * @param requestContents - The conversation history to process * @returns A new array with thoughtSignatures ensured (shallow copy if modified) */ export declare function ensureActiveLoopHasThoughtSignatures(requestContents: Content[]): Content[]; /** * Strips thought content from history before sending to the API. * Gemini returns parts with `thought: true` for reasoning content, * and these should not be sent back in subsequent requests. * * Also removes thoughtSignature properties to clean up the history. * * @param contents - The conversation history * @param policy - How to strip thoughts: 'all' removes all, 'allButLast' keeps last model turn, 'none' keeps all * @returns A new array with thought content stripped according to policy */ export declare function stripThoughtsFromHistory(contents: Content[], policy?: 'all' | 'allButLast' | 'none'): Content[]; export {};