@ai-sdk/xai 3.0.8 → 3.0.10

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
@@ -1187,6 +1187,16 @@ var xaiResponsesChunkSchema = z4.union([
1187
1187
  item_id: z4.string(),
1188
1188
  output_index: z4.number()
1189
1189
  }),
1190
+ z4.object({
1191
+ type: z4.literal("response.custom_tool_call_input.done"),
1192
+ item_id: z4.string(),
1193
+ output_index: z4.number()
1194
+ }),
1195
+ z4.object({
1196
+ type: z4.literal("response.custom_tool_call_input.delta"),
1197
+ item_id: z4.string(),
1198
+ output_index: z4.number()
1199
+ }),
1190
1200
  z4.object({
1191
1201
  type: z4.literal("response.code_execution_call.in_progress"),
1192
1202
  item_id: z4.string(),
@@ -1869,28 +1879,29 @@ var XaiResponsesLanguageModel = class {
1869
1879
  if (event.type === "response.output_item.added" || event.type === "response.output_item.done") {
1870
1880
  const part = event.item;
1871
1881
  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") {
1872
- if (!seenToolCalls.has(part.id)) {
1882
+ const webSearchSubTools = [
1883
+ "web_search",
1884
+ "web_search_with_snippets",
1885
+ "browse_page"
1886
+ ];
1887
+ const xSearchSubTools = [
1888
+ "x_user_search",
1889
+ "x_keyword_search",
1890
+ "x_semantic_search",
1891
+ "x_thread_fetch"
1892
+ ];
1893
+ let toolName = (_c = part.name) != null ? _c : "";
1894
+ if (webSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "web_search_call") {
1895
+ toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1896
+ } else if (xSearchSubTools.includes((_e = part.name) != null ? _e : "") || part.type === "x_search_call") {
1897
+ toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1898
+ } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1899
+ toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1900
+ }
1901
+ const toolInput = part.type === "custom_tool_call" ? (_f = part.input) != null ? _f : "" : (_g = part.arguments) != null ? _g : "";
1902
+ const shouldEmit = part.type === "custom_tool_call" ? event.type === "response.output_item.done" : !seenToolCalls.has(part.id);
1903
+ if (shouldEmit && !seenToolCalls.has(part.id)) {
1873
1904
  seenToolCalls.add(part.id);
1874
- const webSearchSubTools = [
1875
- "web_search",
1876
- "web_search_with_snippets",
1877
- "browse_page"
1878
- ];
1879
- const xSearchSubTools = [
1880
- "x_user_search",
1881
- "x_keyword_search",
1882
- "x_semantic_search",
1883
- "x_thread_fetch"
1884
- ];
1885
- let toolName = (_c = part.name) != null ? _c : "";
1886
- if (webSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "web_search_call") {
1887
- toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1888
- } else if (xSearchSubTools.includes((_e = part.name) != null ? _e : "") || part.type === "x_search_call") {
1889
- toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1890
- } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1891
- toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1892
- }
1893
- const toolInput = part.type === "custom_tool_call" ? (_f = part.input) != null ? _f : "" : (_g = part.arguments) != null ? _g : "";
1894
1905
  controller.enqueue({
1895
1906
  type: "tool-input-start",
1896
1907
  id: part.id,
@@ -2045,7 +2056,7 @@ var xaiTools = {
2045
2056
  };
2046
2057
 
2047
2058
  // src/version.ts
2048
- var VERSION = true ? "3.0.8" : "0.0.0-test";
2059
+ var VERSION = true ? "3.0.10" : "0.0.0-test";
2049
2060
 
2050
2061
  // src/xai-provider.ts
2051
2062
  var xaiErrorStructure = {