@ai-sdk/xai 3.0.4 → 3.0.5

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
@@ -1212,11 +1212,29 @@ var xaiResponsesChunkSchema = z4.union([
1212
1212
  item_id: z4.string(),
1213
1213
  output_index: z4.number()
1214
1214
  }),
1215
+ z4.object({
1216
+ type: z4.literal("response.code_interpreter_call.interpreting"),
1217
+ item_id: z4.string(),
1218
+ output_index: z4.number()
1219
+ }),
1215
1220
  z4.object({
1216
1221
  type: z4.literal("response.code_interpreter_call.completed"),
1217
1222
  item_id: z4.string(),
1218
1223
  output_index: z4.number()
1219
1224
  }),
1225
+ // Code interpreter code streaming events
1226
+ z4.object({
1227
+ type: z4.literal("response.code_interpreter_call_code.delta"),
1228
+ item_id: z4.string(),
1229
+ output_index: z4.number(),
1230
+ delta: z4.string()
1231
+ }),
1232
+ z4.object({
1233
+ type: z4.literal("response.code_interpreter_call_code.done"),
1234
+ item_id: z4.string(),
1235
+ output_index: z4.number(),
1236
+ code: z4.string()
1237
+ }),
1220
1238
  z4.object({
1221
1239
  type: z4.literal("response.done"),
1222
1240
  response: xaiResponsesResponseSchema
@@ -1638,11 +1656,11 @@ var XaiResponsesLanguageModel = class {
1638
1656
  for (const part of response.output) {
1639
1657
  if (part.type === "web_search_call" || part.type === "x_search_call" || part.type === "code_interpreter_call" || part.type === "code_execution_call" || part.type === "view_image_call" || part.type === "view_x_video_call" || part.type === "custom_tool_call") {
1640
1658
  let toolName = (_b = part.name) != null ? _b : "";
1641
- if (webSearchSubTools.includes((_c = part.name) != null ? _c : "")) {
1659
+ if (webSearchSubTools.includes((_c = part.name) != null ? _c : "") || part.type === "web_search_call") {
1642
1660
  toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1643
- } else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "")) {
1661
+ } else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "x_search_call") {
1644
1662
  toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1645
- } else if (part.name === "code_execution") {
1663
+ } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1646
1664
  toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1647
1665
  }
1648
1666
  const toolInput = part.type === "custom_tool_call" ? (_e = part.input) != null ? _e : "" : (_f = part.arguments) != null ? _f : "";
@@ -1867,11 +1885,11 @@ var XaiResponsesLanguageModel = class {
1867
1885
  "x_thread_fetch"
1868
1886
  ];
1869
1887
  let toolName = (_c = part.name) != null ? _c : "";
1870
- if (webSearchSubTools.includes((_d = part.name) != null ? _d : "")) {
1888
+ if (webSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "web_search_call") {
1871
1889
  toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1872
- } else if (xSearchSubTools.includes((_e = part.name) != null ? _e : "")) {
1890
+ } else if (xSearchSubTools.includes((_e = part.name) != null ? _e : "") || part.type === "x_search_call") {
1873
1891
  toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1874
- } else if (part.name === "code_execution") {
1892
+ } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1875
1893
  toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1876
1894
  }
1877
1895
  const toolInput = part.type === "custom_tool_call" ? (_f = part.input) != null ? _f : "" : (_g = part.arguments) != null ? _g : "";
@@ -2029,7 +2047,7 @@ var xaiTools = {
2029
2047
  };
2030
2048
 
2031
2049
  // src/version.ts
2032
- var VERSION = true ? "3.0.4" : "0.0.0-test";
2050
+ var VERSION = true ? "3.0.5" : "0.0.0-test";
2033
2051
 
2034
2052
  // src/xai-provider.ts
2035
2053
  var xaiErrorStructure = {