@ai-sdk/google 4.0.46 → 4.0.47

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.47
4
+
5
+ ### Patch Changes
6
+
7
+ - e6087c9: fix: handle empty string tool call IDs
8
+ - Updated dependencies [e6087c9]
9
+ - @ai-sdk/provider-utils@5.0.28
10
+
3
11
  ## 4.0.46
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "4.0.46" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.47" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -1881,7 +1881,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1881
1881
  };
1882
1882
  }
1883
1883
  async doGenerate(options) {
1884
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
1884
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1885
1885
  const { args, warnings, providerOptionsNames, extraHeaders } = await this.getArgs(options);
1886
1886
  const wrapProviderMetadata = (payload) => Object.fromEntries(
1887
1887
  providerOptionsNames.map((name) => [name, payload])
@@ -1953,9 +1953,9 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1953
1953
  } else if ("functionCall" in part && part.functionCall.name != null) {
1954
1954
  content.push({
1955
1955
  type: "tool-call",
1956
- toolCallId: (_e = part.functionCall.id) != null ? _e : this.config.generateId(),
1956
+ toolCallId: part.functionCall.id || this.config.generateId(),
1957
1957
  toolName: part.functionCall.name,
1958
- input: JSON.stringify((_f = part.functionCall.args) != null ? _f : {}),
1958
+ input: JSON.stringify((_e = part.functionCall.args) != null ? _e : {}),
1959
1959
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
1960
1960
  thoughtSignature: part.thoughtSignature
1961
1961
  }) : void 0
@@ -1972,13 +1972,13 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1972
1972
  }) : void 0
1973
1973
  });
1974
1974
  } else if ("toolCall" in part && part.toolCall) {
1975
- const toolCallId = (_g = part.toolCall.id) != null ? _g : this.config.generateId();
1975
+ const toolCallId = part.toolCall.id || this.config.generateId();
1976
1976
  lastServerToolCallId = toolCallId;
1977
1977
  content.push({
1978
1978
  type: "tool-call",
1979
1979
  toolCallId,
1980
1980
  toolName: `server:${part.toolCall.toolType}`,
1981
- input: JSON.stringify((_h = part.toolCall.args) != null ? _h : {}),
1981
+ input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
1982
1982
  providerExecuted: true,
1983
1983
  dynamic: true,
1984
1984
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
@@ -1991,12 +1991,12 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1991
1991
  })
1992
1992
  });
1993
1993
  } else if ("toolResponse" in part && part.toolResponse) {
1994
- const responseToolCallId = (_i = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _i : this.config.generateId();
1994
+ const responseToolCallId = lastServerToolCallId || part.toolResponse.id || this.config.generateId();
1995
1995
  content.push({
1996
1996
  type: "tool-result",
1997
1997
  toolCallId: responseToolCallId,
1998
1998
  toolName: `server:${part.toolResponse.toolType}`,
1999
- result: (_j = part.toolResponse.response) != null ? _j : {},
1999
+ result: (_g = part.toolResponse.response) != null ? _g : {},
2000
2000
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
2001
2001
  thoughtSignature: part.thoughtSignature,
2002
2002
  serverToolCallId: responseToolCallId,
@@ -2009,10 +2009,10 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2009
2009
  lastServerToolCallId = void 0;
2010
2010
  }
2011
2011
  }
2012
- const sources = (_k = extractSources({
2012
+ const sources = (_h = extractSources({
2013
2013
  groundingMetadata: candidate.groundingMetadata,
2014
2014
  generateId: this.config.generateId
2015
- })) != null ? _k : [];
2015
+ })) != null ? _h : [];
2016
2016
  for (const source of sources) {
2017
2017
  content.push(source);
2018
2018
  }
@@ -2026,23 +2026,23 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2026
2026
  (part) => part.type === "tool-call" && !part.providerExecuted
2027
2027
  )
2028
2028
  }),
2029
- raw: (_l = candidate.finishReason) != null ? _l : void 0
2029
+ raw: (_i = candidate.finishReason) != null ? _i : void 0
2030
2030
  },
2031
2031
  usage: convertGoogleUsage(usageMetadata),
2032
2032
  warnings,
2033
2033
  providerMetadata: wrapProviderMetadata({
2034
- promptFeedback: (_m = response.promptFeedback) != null ? _m : null,
2035
- groundingMetadata: (_n = candidate.groundingMetadata) != null ? _n : null,
2036
- urlContextMetadata: (_o = candidate.urlContextMetadata) != null ? _o : null,
2037
- safetyRatings: (_p = candidate.safetyRatings) != null ? _p : null,
2034
+ promptFeedback: (_j = response.promptFeedback) != null ? _j : null,
2035
+ groundingMetadata: (_k = candidate.groundingMetadata) != null ? _k : null,
2036
+ urlContextMetadata: (_l = candidate.urlContextMetadata) != null ? _l : null,
2037
+ safetyRatings: (_m = candidate.safetyRatings) != null ? _m : null,
2038
2038
  usageMetadata: usageMetadata != null ? usageMetadata : null,
2039
- finishMessage: (_q = candidate.finishMessage) != null ? _q : null,
2040
- serviceTier: (_r = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _r : null
2039
+ finishMessage: (_n = candidate.finishMessage) != null ? _n : null,
2040
+ serviceTier: (_o = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _o : null
2041
2041
  }),
2042
2042
  request: { body: args },
2043
2043
  response: {
2044
2044
  // TODO timestamp, model id
2045
- id: (_s = response.responseId) != null ? _s : void 0,
2045
+ id: (_p = response.responseId) != null ? _p : void 0,
2046
2046
  headers: responseHeaders,
2047
2047
  body: rawResponse
2048
2048
  }
@@ -2122,7 +2122,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2122
2122
  controller.enqueue({ type: "stream-start", warnings });
2123
2123
  },
2124
2124
  transform(chunk, controller) {
2125
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
2125
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2126
2126
  if (options.includeRawChunks) {
2127
2127
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2128
2128
  }
@@ -2276,7 +2276,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2276
2276
  providerMetadata: fileMeta
2277
2277
  });
2278
2278
  } else if ("toolCall" in part && part.toolCall) {
2279
- const toolCallId = (_e = part.toolCall.id) != null ? _e : generateId3();
2279
+ const toolCallId = part.toolCall.id || generateId3();
2280
2280
  lastServerToolCallId = toolCallId;
2281
2281
  const serverMeta = wrapProviderMetadata({
2282
2282
  ...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
@@ -2287,13 +2287,13 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2287
2287
  type: "tool-call",
2288
2288
  toolCallId,
2289
2289
  toolName: `server:${part.toolCall.toolType}`,
2290
- input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
2290
+ input: JSON.stringify((_e = part.toolCall.args) != null ? _e : {}),
2291
2291
  providerExecuted: true,
2292
2292
  dynamic: true,
2293
2293
  providerMetadata: serverMeta
2294
2294
  });
2295
2295
  } else if ("toolResponse" in part && part.toolResponse) {
2296
- const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : generateId3();
2296
+ const responseToolCallId = lastServerToolCallId || part.toolResponse.id || generateId3();
2297
2297
  const serverMeta = wrapProviderMetadata({
2298
2298
  ...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
2299
2299
  serverToolCallId: responseToolCallId,
@@ -2303,7 +2303,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2303
2303
  type: "tool-result",
2304
2304
  toolCallId: responseToolCallId,
2305
2305
  toolName: `server:${part.toolResponse.toolType}`,
2306
- result: (_h = part.toolResponse.response) != null ? _h : {},
2306
+ result: (_f = part.toolResponse.response) != null ? _f : {},
2307
2307
  providerMetadata: serverMeta
2308
2308
  });
2309
2309
  lastServerToolCallId = void 0;
@@ -2320,7 +2320,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2320
2320
  const isNoArgsCompleteCall = part.functionCall.name != null && part.functionCall.args == null && part.functionCall.partialArgs == null && part.functionCall.willContinue !== true;
2321
2321
  if (isStreamingChunk) {
2322
2322
  if (part.functionCall.name != null) {
2323
- const toolCallId = (_i = part.functionCall.id) != null ? _i : generateId3();
2323
+ const toolCallId = part.functionCall.id || generateId3();
2324
2324
  const accumulator = new GoogleJSONAccumulator();
2325
2325
  activeStreamingToolCalls.push({
2326
2326
  toolCallId,
@@ -2368,9 +2368,9 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2368
2368
  } else if (isTerminalChunk && activeStreamingToolCalls.length > 0) {
2369
2369
  finishActiveStreamingToolCall(controller);
2370
2370
  } else if (isCompleteCall) {
2371
- const toolCallId = (_j = part.functionCall.id) != null ? _j : generateId3();
2371
+ const toolCallId = part.functionCall.id || generateId3();
2372
2372
  const toolName = part.functionCall.name;
2373
- const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_k = part.functionCall.args) != null ? _k : {});
2373
+ const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_g = part.functionCall.args) != null ? _g : {});
2374
2374
  controller.enqueue({
2375
2375
  type: "tool-input-start",
2376
2376
  id: toolCallId,
@@ -2397,7 +2397,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2397
2397
  });
2398
2398
  hasToolCalls = true;
2399
2399
  } else if (isNoArgsCompleteCall) {
2400
- const toolCallId = (_l = part.functionCall.id) != null ? _l : generateId3();
2400
+ const toolCallId = part.functionCall.id || generateId3();
2401
2401
  const toolName = part.functionCall.name;
2402
2402
  controller.enqueue({
2403
2403
  type: "tool-input-start",
@@ -2430,13 +2430,13 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2430
2430
  raw: candidate.finishReason
2431
2431
  };
2432
2432
  providerMetadata = wrapProviderMetadata({
2433
- promptFeedback: (_m = value.promptFeedback) != null ? _m : null,
2433
+ promptFeedback: (_h = value.promptFeedback) != null ? _h : null,
2434
2434
  groundingMetadata: lastGroundingMetadata,
2435
2435
  urlContextMetadata: lastUrlContextMetadata,
2436
- safetyRatings: (_n = candidate.safetyRatings) != null ? _n : null,
2436
+ safetyRatings: (_i = candidate.safetyRatings) != null ? _i : null,
2437
2437
  usageMetadata: usageMetadata != null ? usageMetadata : null,
2438
- finishMessage: (_o = candidate.finishMessage) != null ? _o : null,
2439
- serviceTier: (_p = usage == null ? void 0 : usage.serviceTier) != null ? _p : null
2438
+ finishMessage: (_j = candidate.finishMessage) != null ? _j : null,
2439
+ serviceTier: (_k = usage == null ? void 0 : usage.serviceTier) != null ? _k : null
2440
2440
  });
2441
2441
  }
2442
2442
  },
@@ -4417,7 +4417,7 @@ function buildGoogleInteractionsStreamTransform({
4417
4417
  controller.enqueue({ type: "stream-start", warnings });
4418
4418
  },
4419
4419
  transform(chunk, controller) {
4420
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
4420
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
4421
4421
  if (includeRawChunks) {
4422
4422
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
4423
4423
  }
@@ -4508,8 +4508,8 @@ function buildGoogleInteractionsStreamTransform({
4508
4508
  }
4509
4509
  }
4510
4510
  } else if (stepType === "function_call") {
4511
- const toolCallId = (_b = step == null ? void 0 : step.id) != null ? _b : blockId;
4512
- const toolName = (_c = step == null ? void 0 : step.name) != null ? _c : "unknown";
4511
+ const toolCallId = (step == null ? void 0 : step.id) || blockId;
4512
+ const toolName = (_b = step == null ? void 0 : step.name) != null ? _b : "unknown";
4513
4513
  hasFunctionCall = true;
4514
4514
  const state = {
4515
4515
  kind: "function_call",
@@ -4526,28 +4526,28 @@ function buildGoogleInteractionsStreamTransform({
4526
4526
  toolName
4527
4527
  });
4528
4528
  } else if (stepType != null && BUILTIN_TOOL_CALL_TYPES.has(stepType)) {
4529
- const toolName = stepType === "mcp_server_tool_call" ? (_d = step == null ? void 0 : step.name) != null ? _d : "mcp_server_tool" : builtinToolNameFromCallType(stepType);
4530
- const toolCallId = (_e = step == null ? void 0 : step.id) != null ? _e : blockId;
4529
+ const toolName = stepType === "mcp_server_tool_call" ? (_c = step == null ? void 0 : step.name) != null ? _c : "mcp_server_tool" : builtinToolNameFromCallType(stepType);
4530
+ const toolCallId = (step == null ? void 0 : step.id) || blockId;
4531
4531
  const state = {
4532
4532
  kind: "builtin_tool_call",
4533
4533
  id: blockId,
4534
4534
  blockType: stepType,
4535
4535
  toolCallId,
4536
4536
  toolName,
4537
- arguments: (_f = step == null ? void 0 : step.arguments) != null ? _f : {},
4537
+ arguments: (_d = step == null ? void 0 : step.arguments) != null ? _d : {},
4538
4538
  callEmitted: false
4539
4539
  };
4540
4540
  openBlocks.set(index, state);
4541
4541
  } else if (stepType != null && BUILTIN_TOOL_RESULT_TYPES.has(stepType)) {
4542
- const toolName = stepType === "mcp_server_tool_result" ? (_g = step == null ? void 0 : step.name) != null ? _g : "mcp_server_tool" : builtinToolNameFromResultType(stepType);
4543
- const callId = (_h = step == null ? void 0 : step.call_id) != null ? _h : blockId;
4542
+ const toolName = stepType === "mcp_server_tool_result" ? (_e = step == null ? void 0 : step.name) != null ? _e : "mcp_server_tool" : builtinToolNameFromResultType(stepType);
4543
+ const callId = (step == null ? void 0 : step.call_id) || blockId;
4544
4544
  const state = {
4545
4545
  kind: "builtin_tool_result",
4546
4546
  id: blockId,
4547
4547
  blockType: stepType,
4548
4548
  callId,
4549
4549
  toolName,
4550
- result: (_i = step == null ? void 0 : step.result) != null ? _i : null,
4550
+ result: (_f = step == null ? void 0 : step.result) != null ? _f : null,
4551
4551
  ...(step == null ? void 0 : step.is_error) != null ? { isError: step.is_error } : {},
4552
4552
  resultEmitted: false
4553
4553
  };
@@ -4561,7 +4561,7 @@ function buildGoogleInteractionsStreamTransform({
4561
4561
  const event = value;
4562
4562
  let open = openBlocks.get(event.index);
4563
4563
  if (open == null) break;
4564
- const dtype = (_j = event.delta) == null ? void 0 : _j.type;
4564
+ const dtype = (_g = event.delta) == null ? void 0 : _g.type;
4565
4565
  if (open.kind === "pending_model_output") {
4566
4566
  if (dtype === "text" || dtype === "text_annotation" || dtype === "text_annotation_delta") {
4567
4567
  const promoted = {
@@ -4582,14 +4582,14 @@ function buildGoogleInteractionsStreamTransform({
4582
4582
  if ((imageDelta == null ? void 0 : imageDelta.data) != null && imageDelta.data.length > 0) {
4583
4583
  controller.enqueue({
4584
4584
  type: "file",
4585
- mediaType: (_k = imageDelta.mime_type) != null ? _k : "image/png",
4585
+ mediaType: (_h = imageDelta.mime_type) != null ? _h : "image/png",
4586
4586
  data: { type: "data", data: imageDelta.data },
4587
4587
  ...providerMetadata ? { providerMetadata } : {}
4588
4588
  });
4589
4589
  } else if ((imageDelta == null ? void 0 : imageDelta.uri) != null && imageDelta.uri.length > 0) {
4590
4590
  controller.enqueue({
4591
4591
  type: "file",
4592
- mediaType: (_l = imageDelta.mime_type) != null ? _l : "image/png",
4592
+ mediaType: (_i = imageDelta.mime_type) != null ? _i : "image/png",
4593
4593
  data: { type: "url", url: new URL(imageDelta.uri) },
4594
4594
  ...providerMetadata ? { providerMetadata } : {}
4595
4595
  });
@@ -4608,14 +4608,14 @@ function buildGoogleInteractionsStreamTransform({
4608
4608
  if ((videoDelta == null ? void 0 : videoDelta.data) != null && videoDelta.data.length > 0) {
4609
4609
  controller.enqueue({
4610
4610
  type: "file",
4611
- mediaType: (_m = videoDelta.mime_type) != null ? _m : "video/mp4",
4611
+ mediaType: (_j = videoDelta.mime_type) != null ? _j : "video/mp4",
4612
4612
  data: { type: "data", data: videoDelta.data },
4613
4613
  ...providerMetadata ? { providerMetadata } : {}
4614
4614
  });
4615
4615
  } else if ((videoDelta == null ? void 0 : videoDelta.uri) != null && videoDelta.uri.length > 0) {
4616
4616
  controller.enqueue({
4617
4617
  type: "file",
4618
- mediaType: (_n = videoDelta.mime_type) != null ? _n : "video/mp4",
4618
+ mediaType: (_k = videoDelta.mime_type) != null ? _k : "video/mp4",
4619
4619
  data: { type: "url", url: new URL(videoDelta.uri) },
4620
4620
  ...providerMetadata ? { providerMetadata } : {}
4621
4621
  });
@@ -4624,7 +4624,7 @@ function buildGoogleInteractionsStreamTransform({
4624
4624
  }
4625
4625
  const delta = event.delta;
4626
4626
  if (open.kind === "text" && (delta == null ? void 0 : delta.type) === "text") {
4627
- const text = (_o = delta.text) != null ? _o : "";
4627
+ const text = (_l = delta.text) != null ? _l : "";
4628
4628
  if (text.length > 0) {
4629
4629
  controller.enqueue({
4630
4630
  type: "text-delta",
@@ -4674,7 +4674,7 @@ function buildGoogleInteractionsStreamTransform({
4674
4674
  delta: slice
4675
4675
  });
4676
4676
  }
4677
- if (delta.id != null) {
4677
+ if (delta.id != null && delta.id.length > 0) {
4678
4678
  open.toolCallId = delta.id;
4679
4679
  }
4680
4680
  if (delta.signature != null) {
@@ -4682,7 +4682,9 @@ function buildGoogleInteractionsStreamTransform({
4682
4682
  }
4683
4683
  hasFunctionCall = true;
4684
4684
  } else if (open.kind === "builtin_tool_call" && (delta == null ? void 0 : delta.type) === open.blockType) {
4685
- if (delta.id != null) open.toolCallId = delta.id;
4685
+ if (delta.id != null && delta.id.length > 0) {
4686
+ open.toolCallId = delta.id;
4687
+ }
4686
4688
  if (delta.arguments != null && typeof delta.arguments === "object") {
4687
4689
  open.arguments = delta.arguments;
4688
4690
  }
@@ -4690,7 +4692,9 @@ function buildGoogleInteractionsStreamTransform({
4690
4692
  open.toolName = delta.name;
4691
4693
  }
4692
4694
  } else if (open.kind === "builtin_tool_result" && (delta == null ? void 0 : delta.type) === open.blockType) {
4693
- if (delta.call_id != null) open.callId = delta.call_id;
4695
+ if (delta.call_id != null && delta.call_id.length > 0) {
4696
+ open.callId = delta.call_id;
4697
+ }
4694
4698
  if (delta.result !== void 0) open.result = delta.result;
4695
4699
  if (delta.is_error != null) open.isError = delta.is_error;
4696
4700
  if (delta.name != null && open.blockType === "mcp_server_tool_result") {
@@ -4727,14 +4731,14 @@ function buildGoogleInteractionsStreamTransform({
4727
4731
  if (open.data != null && open.data.length > 0) {
4728
4732
  controller.enqueue({
4729
4733
  type: "file",
4730
- mediaType: (_p = open.mimeType) != null ? _p : "image/png",
4734
+ mediaType: (_m = open.mimeType) != null ? _m : "image/png",
4731
4735
  data: { type: "data", data: open.data },
4732
4736
  ...providerMetadata ? { providerMetadata } : {}
4733
4737
  });
4734
4738
  } else if (open.uri != null && open.uri.length > 0) {
4735
4739
  controller.enqueue({
4736
4740
  type: "file",
4737
- mediaType: (_q = open.mimeType) != null ? _q : "image/png",
4741
+ mediaType: (_n = open.mimeType) != null ? _n : "image/png",
4738
4742
  data: { type: "url", url: new URL(open.uri) },
4739
4743
  ...providerMetadata ? { providerMetadata } : {}
4740
4744
  });
@@ -4761,7 +4765,7 @@ function buildGoogleInteractionsStreamTransform({
4761
4765
  type: "tool-call",
4762
4766
  toolCallId: open.toolCallId,
4763
4767
  toolName: open.toolName,
4764
- input: JSON.stringify((_r = open.arguments) != null ? _r : {}),
4768
+ input: JSON.stringify((_o = open.arguments) != null ? _o : {}),
4765
4769
  providerExecuted: true
4766
4770
  });
4767
4771
  open.callEmitted = true;
@@ -4770,7 +4774,7 @@ function buildGoogleInteractionsStreamTransform({
4770
4774
  type: "tool-result",
4771
4775
  toolCallId: open.callId,
4772
4776
  toolName: open.toolName,
4773
- result: (_s = open.result) != null ? _s : null
4777
+ result: (_p = open.result) != null ? _p : null
4774
4778
  });
4775
4779
  open.resultEmitted = true;
4776
4780
  const sources = builtinToolResultToSources({
@@ -4824,7 +4828,7 @@ function buildGoogleInteractionsStreamTransform({
4824
4828
  case "error": {
4825
4829
  const event = value;
4826
4830
  finishStatus = "failed";
4827
- const errorPayload = (_t = event.error) != null ? _t : {
4831
+ const errorPayload = (_q = event.error) != null ? _q : {
4828
4832
  message: "Unknown interaction error"
4829
4833
  };
4830
4834
  controller.enqueue({ type: "error", error: errorPayload });
@@ -5812,7 +5816,7 @@ function parseGoogleInteractionsOutputs({
5812
5816
  generateId: generateId3,
5813
5817
  interactionId
5814
5818
  }) {
5815
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
5819
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
5816
5820
  const content = [];
5817
5821
  let hasFunctionCall = false;
5818
5822
  if (steps == null) {
@@ -5919,19 +5923,19 @@ function parseGoogleInteractionsOutputs({
5919
5923
  const input = JSON.stringify((_i = call.arguments) != null ? _i : {});
5920
5924
  content.push({
5921
5925
  type: "tool-call",
5922
- toolCallId: (_j = call.id) != null ? _j : generateId3(),
5926
+ toolCallId: call.id || generateId3(),
5923
5927
  toolName,
5924
5928
  input,
5925
5929
  providerExecuted: true
5926
5930
  });
5927
5931
  } else if (BUILTIN_TOOL_RESULT_TYPES2.has(type)) {
5928
5932
  const result = step;
5929
- const toolName = type === "mcp_server_tool_result" ? (_k = result.name) != null ? _k : "mcp_server_tool" : builtinToolNameFromResultType2(type);
5933
+ const toolName = type === "mcp_server_tool_result" ? (_j = result.name) != null ? _j : "mcp_server_tool" : builtinToolNameFromResultType2(type);
5930
5934
  content.push({
5931
5935
  type: "tool-result",
5932
- toolCallId: (_l = result.call_id) != null ? _l : generateId3(),
5936
+ toolCallId: result.call_id || generateId3(),
5933
5937
  toolName,
5934
- result: (_m = result.result) != null ? _m : null
5938
+ result: (_k = result.result) != null ? _k : null
5935
5939
  });
5936
5940
  const sources = builtinToolResultToSources({
5937
5941
  block: step,