@ai-sdk/google 3.0.131 → 3.0.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -454,7 +454,7 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV3 {
454
454
  async doGenerate(
455
455
  options: LanguageModelV3CallOptions,
456
456
  ): Promise<LanguageModelV3GenerateResult> {
457
- const { args, warnings, isAgent, pollingTimeoutMs } =
457
+ const { args, warnings, isAgent, isBackground, pollingTimeoutMs } =
458
458
  await this.getArgs(options);
459
459
 
460
460
  const url = `${this.config.baseURL}/interactions`;
@@ -484,12 +484,12 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV3 {
484
484
  } = postResult;
485
485
 
486
486
  /*
487
- * Agent calls may return a non-terminal status (`in_progress` /
488
- * `requires_action`) when invoked with `background: true`. Poll
489
- * `GET /interactions/{id}` until terminal so the user-facing surface
490
- * matches a synchronous call.
487
+ * Agent calls and `background: true` calls (e.g. Gemini 4 long decode,
488
+ * where the server runs every hop) may return a non-terminal status
489
+ * (`in_progress` / `requires_action`). Poll `GET /interactions/{id}` until
490
+ * terminal so the user-facing surface matches a synchronous call.
491
491
  */
492
- if (isAgent && !isTerminalStatus(response.status)) {
492
+ if ((isAgent || isBackground) && !isTerminalStatus(response.status)) {
493
493
  const polled = await pollGoogleInteractionUntilTerminal({
494
494
  baseURL: this.config.baseURL,
495
495
  interactionId: response.id,
@@ -11,6 +11,9 @@ export function mapGoogleGenerativeAIFinishReason({
11
11
  case 'STOP':
12
12
  return hasToolCalls ? 'tool-calls' : 'stop';
13
13
  case 'MAX_TOKENS':
14
+ // Gemini 4 long decode: the per-request cap was reached while budget
15
+ // remains. Continued automatically; only surfaced if continuing fails.
16
+ case 'CONTINUATION':
14
17
  return 'length';
15
18
  case 'IMAGE_SAFETY':
16
19
  case 'RECITATION':