@ai-sdk/xai 3.0.102 → 3.0.104

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,27 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 3.0.104
4
+
5
+ ### Patch Changes
6
+
7
+ - 327642b: fix: more precise default message for tool execution denial
8
+ - 19eece6: fix reasoning text extraction from content in responses doGenerate
9
+ - Updated dependencies [4d4e176]
10
+ - Updated dependencies [bef93ae]
11
+ - Updated dependencies [d559de9]
12
+ - Updated dependencies [327642b]
13
+ - @ai-sdk/openai-compatible@2.0.58
14
+ - @ai-sdk/provider-utils@4.0.37
15
+
16
+ ## 3.0.103
17
+
18
+ ### Patch Changes
19
+
20
+ - cb4e5e1: Emit provider-executed tool results for completed xAI Responses API streaming tool calls.
21
+ - Updated dependencies [0952964]
22
+ - @ai-sdk/provider-utils@4.0.36
23
+ - @ai-sdk/openai-compatible@2.0.57
24
+
3
25
  ## 3.0.102
4
26
 
5
27
  ### Patch Changes
package/dist/index.js CHANGED
@@ -129,7 +129,7 @@ function convertToXaiChatMessages(prompt) {
129
129
  contentValue = output.value;
130
130
  break;
131
131
  case "execution-denied":
132
- contentValue = (_a = output.reason) != null ? _a : "Tool execution denied.";
132
+ contentValue = (_a = output.reason) != null ? _a : "Tool call execution denied.";
133
133
  break;
134
134
  case "content":
135
135
  case "json":
@@ -1415,6 +1415,7 @@ var outputItemSchema = import_v46.z.discriminatedUnion("type", [
1415
1415
  type: import_v46.z.literal("reasoning"),
1416
1416
  id: import_v46.z.string(),
1417
1417
  summary: import_v46.z.array(reasoningSummaryPartSchema),
1418
+ content: import_v46.z.array(import_v46.z.object({ type: import_v46.z.string(), text: import_v46.z.string() })).nullish(),
1418
1419
  status: import_v46.z.string(),
1419
1420
  encrypted_content: import_v46.z.string().nullish()
1420
1421
  })
@@ -2184,7 +2185,7 @@ var XaiResponsesLanguageModel = class {
2184
2185
  };
2185
2186
  }
2186
2187
  async doGenerate(options) {
2187
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2188
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
2188
2189
  const {
2189
2190
  args: body,
2190
2191
  warnings,
@@ -2305,8 +2306,8 @@ var XaiResponsesLanguageModel = class {
2305
2306
  break;
2306
2307
  }
2307
2308
  case "reasoning": {
2308
- const summaryTexts = part.summary.map((s) => s.text).filter((text) => text && text.length > 0);
2309
- const reasoningText = summaryTexts.join("");
2309
+ const texts = part.summary.length > 0 ? part.summary.map((s) => s.text) : ((_m = part.content) != null ? _m : []).map((c) => c.text);
2310
+ const reasoningText = texts.filter((text) => text && text.length > 0).join("");
2310
2311
  if (reasoningText || part.encrypted_content) {
2311
2312
  const hasMetadata = part.encrypted_content || part.id;
2312
2313
  content.push({
@@ -2335,7 +2336,7 @@ var XaiResponsesLanguageModel = class {
2335
2336
  content,
2336
2337
  finishReason: {
2337
2338
  unified: hasFunctionCall ? "tool-calls" : mapXaiResponsesFinishReason(response.status),
2338
- raw: (_m = response.status) != null ? _m : void 0
2339
+ raw: (_n = response.status) != null ? _n : void 0
2339
2340
  },
2340
2341
  usage: response.usage ? convertXaiResponsesUsage(response.usage) : {
2341
2342
  inputTokens: { total: 0, noCache: 0, cacheRead: 0, cacheWrite: 0 },
@@ -2696,6 +2697,14 @@ var XaiResponsesLanguageModel = class {
2696
2697
  providerExecuted: true
2697
2698
  });
2698
2699
  }
2700
+ if (event.type === "response.output_item.done") {
2701
+ controller.enqueue({
2702
+ type: "tool-result",
2703
+ toolCallId: part.id,
2704
+ toolName,
2705
+ result: {}
2706
+ });
2707
+ }
2699
2708
  return;
2700
2709
  }
2701
2710
  if (part.type === "message") {
@@ -2843,7 +2852,7 @@ var xaiTools = {
2843
2852
  };
2844
2853
 
2845
2854
  // src/version.ts
2846
- var VERSION = true ? "3.0.102" : "0.0.0-test";
2855
+ var VERSION = true ? "3.0.104" : "0.0.0-test";
2847
2856
 
2848
2857
  // src/xai-video-model.ts
2849
2858
  var import_provider6 = require("@ai-sdk/provider");