@ai-sdk/xai 3.0.38 → 3.0.39

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,11 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 3.0.39
4
+
5
+ ### Patch Changes
6
+
7
+ - 58800f3: fix(xai): emit reasoning-start before reasoning-end for encrypted reasoning
8
+
3
9
  ## 3.0.38
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2040,6 +2040,7 @@ var XaiResponsesLanguageModel = class {
2040
2040
  }
2041
2041
  if (event.type === "response.reasoning_summary_part.added") {
2042
2042
  const blockId = `reasoning-${event.item_id}`;
2043
+ activeReasoning[event.item_id] = {};
2043
2044
  controller.enqueue({
2044
2045
  type: "reasoning-start",
2045
2046
  id: blockId,
@@ -2132,9 +2133,22 @@ var XaiResponsesLanguageModel = class {
2132
2133
  const part = event.item;
2133
2134
  if (part.type === "reasoning") {
2134
2135
  if (event.type === "response.output_item.done") {
2136
+ const blockId = `reasoning-${part.id}`;
2137
+ if (!(part.id in activeReasoning)) {
2138
+ activeReasoning[part.id] = {};
2139
+ controller.enqueue({
2140
+ type: "reasoning-start",
2141
+ id: blockId,
2142
+ providerMetadata: {
2143
+ xai: {
2144
+ ...part.id && { itemId: part.id }
2145
+ }
2146
+ }
2147
+ });
2148
+ }
2135
2149
  controller.enqueue({
2136
2150
  type: "reasoning-end",
2137
- id: `reasoning-${part.id}`,
2151
+ id: blockId,
2138
2152
  providerMetadata: {
2139
2153
  xai: {
2140
2154
  ...part.encrypted_content && {
@@ -2329,7 +2343,7 @@ var xaiTools = {
2329
2343
  };
2330
2344
 
2331
2345
  // src/version.ts
2332
- var VERSION = true ? "3.0.38" : "0.0.0-test";
2346
+ var VERSION = true ? "3.0.39" : "0.0.0-test";
2333
2347
 
2334
2348
  // src/xai-provider.ts
2335
2349
  var xaiErrorStructure = {