@ai-sdk/google 4.0.94 → 4.0.95

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.
@@ -482,7 +482,7 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV4 {
482
482
  async doGenerate(
483
483
  options: LanguageModelV4CallOptions,
484
484
  ): Promise<LanguageModelV4GenerateResult> {
485
- const { args, warnings, isAgent, pollingTimeoutMs } =
485
+ const { args, warnings, isAgent, isBackground, pollingTimeoutMs } =
486
486
  await this.getArgs(options);
487
487
 
488
488
  const url = `${this.config.baseURL}/interactions`;
@@ -511,12 +511,12 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV4 {
511
511
  } = postResult;
512
512
 
513
513
  /*
514
- * Agent calls may return a non-terminal status (`in_progress` /
515
- * `requires_action`) when invoked with `background: true`. Poll
516
- * `GET /interactions/{id}` until terminal so the user-facing surface
517
- * matches a synchronous call.
514
+ * Agent calls and `background: true` calls (e.g. Gemini 4 long decode,
515
+ * where the server runs every hop) may return a non-terminal status
516
+ * (`in_progress` / `requires_action`). Poll `GET /interactions/{id}` until
517
+ * terminal so the user-facing surface matches a synchronous call.
518
518
  */
519
- if (isAgent && !isTerminalStatus(response.status)) {
519
+ if ((isAgent || isBackground) && !isTerminalStatus(response.status)) {
520
520
  const polled = await pollGoogleInteractionUntilTerminal({
521
521
  baseURL: this.config.baseURL,
522
522
  interactionId: response.id,
@@ -11,6 +11,9 @@ export function mapGoogleFinishReason({
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':