@ai-sdk/google 3.0.23 → 3.0.24

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.
@@ -883,16 +883,24 @@ var GoogleGenerativeAILanguageModel = class {
883
883
  }
884
884
  });
885
885
  lastCodeExecutionToolCallId = void 0;
886
- } else if ("text" in part && part.text != null && part.text.length > 0) {
887
- content.push({
888
- type: part.thought === true ? "reasoning" : "text",
889
- text: part.text,
890
- providerMetadata: part.thoughtSignature ? {
891
- [providerOptionsName]: {
892
- thoughtSignature: part.thoughtSignature
893
- }
894
- } : void 0
895
- });
886
+ } else if ("text" in part && part.text != null) {
887
+ const thoughtSignatureMetadata = part.thoughtSignature ? {
888
+ [providerOptionsName]: {
889
+ thoughtSignature: part.thoughtSignature
890
+ }
891
+ } : void 0;
892
+ if (part.text.length === 0) {
893
+ if (thoughtSignatureMetadata != null && content.length > 0) {
894
+ const lastContent = content[content.length - 1];
895
+ lastContent.providerMetadata = thoughtSignatureMetadata;
896
+ }
897
+ } else {
898
+ content.push({
899
+ type: part.thought === true ? "reasoning" : "text",
900
+ text: part.text,
901
+ providerMetadata: thoughtSignatureMetadata
902
+ });
903
+ }
896
904
  } else if ("functionCall" in part) {
897
905
  content.push({
898
906
  type: "tool-call",
@@ -1050,8 +1058,22 @@ var GoogleGenerativeAILanguageModel = class {
1050
1058
  });
1051
1059
  lastCodeExecutionToolCallId = void 0;
1052
1060
  }
1053
- } else if ("text" in part && part.text != null && part.text.length > 0) {
1054
- if (part.thought === true) {
1061
+ } else if ("text" in part && part.text != null) {
1062
+ const thoughtSignatureMetadata = part.thoughtSignature ? {
1063
+ [providerOptionsName]: {
1064
+ thoughtSignature: part.thoughtSignature
1065
+ }
1066
+ } : void 0;
1067
+ if (part.text.length === 0) {
1068
+ if (thoughtSignatureMetadata != null && currentTextBlockId !== null) {
1069
+ controller.enqueue({
1070
+ type: "text-delta",
1071
+ id: currentTextBlockId,
1072
+ delta: "",
1073
+ providerMetadata: thoughtSignatureMetadata
1074
+ });
1075
+ }
1076
+ } else if (part.thought === true) {
1055
1077
  if (currentTextBlockId !== null) {
1056
1078
  controller.enqueue({
1057
1079
  type: "text-end",
@@ -1064,22 +1086,14 @@ var GoogleGenerativeAILanguageModel = class {
1064
1086
  controller.enqueue({
1065
1087
  type: "reasoning-start",
1066
1088
  id: currentReasoningBlockId,
1067
- providerMetadata: part.thoughtSignature ? {
1068
- [providerOptionsName]: {
1069
- thoughtSignature: part.thoughtSignature
1070
- }
1071
- } : void 0
1089
+ providerMetadata: thoughtSignatureMetadata
1072
1090
  });
1073
1091
  }
1074
1092
  controller.enqueue({
1075
1093
  type: "reasoning-delta",
1076
1094
  id: currentReasoningBlockId,
1077
1095
  delta: part.text,
1078
- providerMetadata: part.thoughtSignature ? {
1079
- [providerOptionsName]: {
1080
- thoughtSignature: part.thoughtSignature
1081
- }
1082
- } : void 0
1096
+ providerMetadata: thoughtSignatureMetadata
1083
1097
  });
1084
1098
  } else {
1085
1099
  if (currentReasoningBlockId !== null) {
@@ -1094,22 +1108,14 @@ var GoogleGenerativeAILanguageModel = class {
1094
1108
  controller.enqueue({
1095
1109
  type: "text-start",
1096
1110
  id: currentTextBlockId,
1097
- providerMetadata: part.thoughtSignature ? {
1098
- [providerOptionsName]: {
1099
- thoughtSignature: part.thoughtSignature
1100
- }
1101
- } : void 0
1111
+ providerMetadata: thoughtSignatureMetadata
1102
1112
  });
1103
1113
  }
1104
1114
  controller.enqueue({
1105
1115
  type: "text-delta",
1106
1116
  id: currentTextBlockId,
1107
1117
  delta: part.text,
1108
- providerMetadata: part.thoughtSignature ? {
1109
- [providerOptionsName]: {
1110
- thoughtSignature: part.thoughtSignature
1111
- }
1112
- } : void 0
1118
+ providerMetadata: thoughtSignatureMetadata
1113
1119
  });
1114
1120
  }
1115
1121
  } else if ("inlineData" in part) {