@ai-sdk/xai 2.0.45 → 2.0.46

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
+ ## 2.0.46
4
+
5
+ ### Patch Changes
6
+
7
+ - eed2ef1: fix(xai): add missing stream response schema and provider tool name parsing
8
+
3
9
  ## 2.0.45
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1024,11 +1024,29 @@ var xaiResponsesChunkSchema = import_v44.z.union([
1024
1024
  item_id: import_v44.z.string(),
1025
1025
  output_index: import_v44.z.number()
1026
1026
  }),
1027
+ import_v44.z.object({
1028
+ type: import_v44.z.literal("response.code_interpreter_call.interpreting"),
1029
+ item_id: import_v44.z.string(),
1030
+ output_index: import_v44.z.number()
1031
+ }),
1027
1032
  import_v44.z.object({
1028
1033
  type: import_v44.z.literal("response.code_interpreter_call.completed"),
1029
1034
  item_id: import_v44.z.string(),
1030
1035
  output_index: import_v44.z.number()
1031
1036
  }),
1037
+ // Code interpreter code streaming events
1038
+ import_v44.z.object({
1039
+ type: import_v44.z.literal("response.code_interpreter_call_code.delta"),
1040
+ item_id: import_v44.z.string(),
1041
+ output_index: import_v44.z.number(),
1042
+ delta: import_v44.z.string()
1043
+ }),
1044
+ import_v44.z.object({
1045
+ type: import_v44.z.literal("response.code_interpreter_call_code.done"),
1046
+ item_id: import_v44.z.string(),
1047
+ output_index: import_v44.z.number(),
1048
+ code: import_v44.z.string()
1049
+ }),
1032
1050
  import_v44.z.object({
1033
1051
  type: import_v44.z.literal("response.done"),
1034
1052
  response: xaiResponsesResponseSchema
@@ -1596,11 +1614,11 @@ var XaiResponsesLanguageModel = class {
1596
1614
  for (const part of response.output) {
1597
1615
  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") {
1598
1616
  let toolName = (_b = part.name) != null ? _b : "";
1599
- if (webSearchSubTools.includes((_c = part.name) != null ? _c : "")) {
1617
+ if (webSearchSubTools.includes((_c = part.name) != null ? _c : "") || part.type === "web_search_call") {
1600
1618
  toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1601
- } else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "")) {
1619
+ } else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "x_search_call") {
1602
1620
  toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1603
- } else if (part.name === "code_execution") {
1621
+ } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1604
1622
  toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1605
1623
  }
1606
1624
  const toolInput = part.type === "custom_tool_call" ? (_e = part.input) != null ? _e : "" : (_f = part.arguments) != null ? _f : "";
@@ -1830,11 +1848,11 @@ var XaiResponsesLanguageModel = class {
1830
1848
  "x_thread_fetch"
1831
1849
  ];
1832
1850
  let toolName = (_e = part.name) != null ? _e : "";
1833
- if (webSearchSubTools.includes((_f = part.name) != null ? _f : "")) {
1851
+ if (webSearchSubTools.includes((_f = part.name) != null ? _f : "") || part.type === "web_search_call") {
1834
1852
  toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1835
- } else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "")) {
1853
+ } else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "") || part.type === "x_search_call") {
1836
1854
  toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1837
- } else if (part.name === "code_execution") {
1855
+ } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1838
1856
  toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1839
1857
  }
1840
1858
  const toolInput = part.type === "custom_tool_call" ? (_h = part.input) != null ? _h : "" : (_i = part.arguments) != null ? _i : "";
@@ -1995,7 +2013,7 @@ var xaiTools = {
1995
2013
  };
1996
2014
 
1997
2015
  // src/version.ts
1998
- var VERSION = true ? "2.0.45" : "0.0.0-test";
2016
+ var VERSION = true ? "2.0.46" : "0.0.0-test";
1999
2017
 
2000
2018
  // src/xai-provider.ts
2001
2019
  var xaiErrorStructure = {