@ai-sdk/xai 3.0.9 → 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
@@ -1879,28 +1879,29 @@ var XaiResponsesLanguageModel = class {
1879
1879
  if (event.type === "response.output_item.added" || event.type === "response.output_item.done") {
1880
1880
  const part = event.item;
1881
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") {
1882
- 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)) {
1883
1904
  seenToolCalls.add(part.id);
1884
- const webSearchSubTools = [
1885
- "web_search",
1886
- "web_search_with_snippets",
1887
- "browse_page"
1888
- ];
1889
- const xSearchSubTools = [
1890
- "x_user_search",
1891
- "x_keyword_search",
1892
- "x_semantic_search",
1893
- "x_thread_fetch"
1894
- ];
1895
- let toolName = (_c = part.name) != null ? _c : "";
1896
- if (webSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "web_search_call") {
1897
- toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1898
- } else if (xSearchSubTools.includes((_e = part.name) != null ? _e : "") || part.type === "x_search_call") {
1899
- toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1900
- } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1901
- toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1902
- }
1903
- const toolInput = part.type === "custom_tool_call" ? (_f = part.input) != null ? _f : "" : (_g = part.arguments) != null ? _g : "";
1904
1905
  controller.enqueue({
1905
1906
  type: "tool-input-start",
1906
1907
  id: part.id,
@@ -2055,7 +2056,7 @@ var xaiTools = {
2055
2056
  };
2056
2057
 
2057
2058
  // src/version.ts
2058
- var VERSION = true ? "3.0.9" : "0.0.0-test";
2059
+ var VERSION = true ? "3.0.10" : "0.0.0-test";
2059
2060
 
2060
2061
  // src/xai-provider.ts
2061
2062
  var xaiErrorStructure = {