@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/dist/index.mjs CHANGED
@@ -113,7 +113,7 @@ function convertToXaiChatMessages(prompt) {
113
113
  contentValue = output.value;
114
114
  break;
115
115
  case "execution-denied":
116
- contentValue = (_a = output.reason) != null ? _a : "Tool execution denied.";
116
+ contentValue = (_a = output.reason) != null ? _a : "Tool call execution denied.";
117
117
  break;
118
118
  case "content":
119
119
  case "json":
@@ -1418,6 +1418,7 @@ var outputItemSchema = z6.discriminatedUnion("type", [
1418
1418
  type: z6.literal("reasoning"),
1419
1419
  id: z6.string(),
1420
1420
  summary: z6.array(reasoningSummaryPartSchema),
1421
+ content: z6.array(z6.object({ type: z6.string(), text: z6.string() })).nullish(),
1421
1422
  status: z6.string(),
1422
1423
  encrypted_content: z6.string().nullish()
1423
1424
  })
@@ -2205,7 +2206,7 @@ var XaiResponsesLanguageModel = class {
2205
2206
  };
2206
2207
  }
2207
2208
  async doGenerate(options) {
2208
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2209
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
2209
2210
  const {
2210
2211
  args: body,
2211
2212
  warnings,
@@ -2326,8 +2327,8 @@ var XaiResponsesLanguageModel = class {
2326
2327
  break;
2327
2328
  }
2328
2329
  case "reasoning": {
2329
- const summaryTexts = part.summary.map((s) => s.text).filter((text) => text && text.length > 0);
2330
- const reasoningText = summaryTexts.join("");
2330
+ const texts = part.summary.length > 0 ? part.summary.map((s) => s.text) : ((_m = part.content) != null ? _m : []).map((c) => c.text);
2331
+ const reasoningText = texts.filter((text) => text && text.length > 0).join("");
2331
2332
  if (reasoningText || part.encrypted_content) {
2332
2333
  const hasMetadata = part.encrypted_content || part.id;
2333
2334
  content.push({
@@ -2356,7 +2357,7 @@ var XaiResponsesLanguageModel = class {
2356
2357
  content,
2357
2358
  finishReason: {
2358
2359
  unified: hasFunctionCall ? "tool-calls" : mapXaiResponsesFinishReason(response.status),
2359
- raw: (_m = response.status) != null ? _m : void 0
2360
+ raw: (_n = response.status) != null ? _n : void 0
2360
2361
  },
2361
2362
  usage: response.usage ? convertXaiResponsesUsage(response.usage) : {
2362
2363
  inputTokens: { total: 0, noCache: 0, cacheRead: 0, cacheWrite: 0 },
@@ -2717,6 +2718,14 @@ var XaiResponsesLanguageModel = class {
2717
2718
  providerExecuted: true
2718
2719
  });
2719
2720
  }
2721
+ if (event.type === "response.output_item.done") {
2722
+ controller.enqueue({
2723
+ type: "tool-result",
2724
+ toolCallId: part.id,
2725
+ toolName,
2726
+ result: {}
2727
+ });
2728
+ }
2720
2729
  return;
2721
2730
  }
2722
2731
  if (part.type === "message") {
@@ -2864,7 +2873,7 @@ var xaiTools = {
2864
2873
  };
2865
2874
 
2866
2875
  // src/version.ts
2867
- var VERSION = true ? "3.0.102" : "0.0.0-test";
2876
+ var VERSION = true ? "3.0.104" : "0.0.0-test";
2868
2877
 
2869
2878
  // src/xai-video-model.ts
2870
2879
  import {