diff --git a/packages/ai/src/providers/google-gemini-cli.ts b/packages/ai/src/providers/google-gemini-cli.ts index 54ac33aa..02b11367 100644 --- a/packages/ai/src/providers/google-gemini-cli.ts +++ b/packages/ai/src/providers/google-gemini-cli.ts @@ -511,12 +511,10 @@ export const streamGoogleGeminiCli: StreamFunction<"google-gemini-cli"> = ( }); } else { currentBlock.text += part.text; - if (part.thoughtSignature) { - currentBlock.textSignature = retainThoughtSignature( - currentBlock.textSignature, - part.thoughtSignature, - ); - } + currentBlock.textSignature = retainThoughtSignature( + currentBlock.textSignature, + part.thoughtSignature, + ); stream.push({ type: "text_delta", contentIndex: blockIndex(), diff --git a/packages/ai/src/providers/google-shared.ts b/packages/ai/src/providers/google-shared.ts index 5e680acd..60d8b058 100644 --- a/packages/ai/src/providers/google-shared.ts +++ b/packages/ai/src/providers/google-shared.ts @@ -85,7 +85,10 @@ export function convertMessages(model: Model, contex if (block.type === "text") { // Skip empty text blocks - they can cause issues with some models (e.g. Claude via Antigravity) if (!block.text || block.text.trim() === "") continue; - parts.push({ text: sanitizeSurrogates(block.text) }); + parts.push({ + text: sanitizeSurrogates(block.text), + ...(block.textSignature && { thoughtSignature: block.textSignature }), + }); } else if (block.type === "thinking") { // Skip empty thinking blocks if (!block.thinking || block.thinking.trim() === "") continue; diff --git a/packages/ai/src/providers/google-vertex.ts b/packages/ai/src/providers/google-vertex.ts index b91c96eb..384e4ca3 100644 --- a/packages/ai/src/providers/google-vertex.ts +++ b/packages/ai/src/providers/google-vertex.ts @@ -142,12 +142,10 @@ export const streamGoogleVertex: StreamFunction<"google-vertex"> = ( }); } else { currentBlock.text += part.text; - if (part.thoughtSignature) { - currentBlock.textSignature = retainThoughtSignature( - currentBlock.textSignature, - part.thoughtSignature, - ); - } + currentBlock.textSignature = retainThoughtSignature( + currentBlock.textSignature, + part.thoughtSignature, + ); stream.push({ type: "text_delta", contentIndex: blockIndex(), diff --git a/packages/ai/src/providers/google.ts b/packages/ai/src/providers/google.ts index eb7733df..128dde7c 100644 --- a/packages/ai/src/providers/google.ts +++ b/packages/ai/src/providers/google.ts @@ -129,12 +129,10 @@ export const streamGoogle: StreamFunction<"google-generative-ai"> = ( }); } else { currentBlock.text += part.text; - if (part.thoughtSignature) { - currentBlock.textSignature = retainThoughtSignature( - currentBlock.textSignature, - part.thoughtSignature, - ); - } + currentBlock.textSignature = retainThoughtSignature( + currentBlock.textSignature, + part.thoughtSignature, + ); stream.push({ type: "text_delta", contentIndex: blockIndex(),