@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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 3.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 659c53d: fixed streaming tool input for custom_tool_call types (x_search, view_x_video) which were incorrectly returning empty input values
8
+
3
9
  ## 3.0.9
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1878,28 +1878,29 @@ var XaiResponsesLanguageModel = class {
1878
1878
  if (event.type === "response.output_item.added" || event.type === "response.output_item.done") {
1879
1879
  const part = event.item;
1880
1880
  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") {
1881
- if (!seenToolCalls.has(part.id)) {
1881
+ const webSearchSubTools = [
1882
+ "web_search",
1883
+ "web_search_with_snippets",
1884
+ "browse_page"
1885
+ ];
1886
+ const xSearchSubTools = [
1887
+ "x_user_search",
1888
+ "x_keyword_search",
1889
+ "x_semantic_search",
1890
+ "x_thread_fetch"
1891
+ ];
1892
+ let toolName = (_c = part.name) != null ? _c : "";
1893
+ if (webSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "web_search_call") {
1894
+ toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1895
+ } else if (xSearchSubTools.includes((_e = part.name) != null ? _e : "") || part.type === "x_search_call") {
1896
+ toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1897
+ } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1898
+ toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1899
+ }
1900
+ const toolInput = part.type === "custom_tool_call" ? (_f = part.input) != null ? _f : "" : (_g = part.arguments) != null ? _g : "";
1901
+ const shouldEmit = part.type === "custom_tool_call" ? event.type === "response.output_item.done" : !seenToolCalls.has(part.id);
1902
+ if (shouldEmit && !seenToolCalls.has(part.id)) {
1882
1903
  seenToolCalls.add(part.id);
1883
- const webSearchSubTools = [
1884
- "web_search",
1885
- "web_search_with_snippets",
1886
- "browse_page"
1887
- ];
1888
- const xSearchSubTools = [
1889
- "x_user_search",
1890
- "x_keyword_search",
1891
- "x_semantic_search",
1892
- "x_thread_fetch"
1893
- ];
1894
- let toolName = (_c = part.name) != null ? _c : "";
1895
- if (webSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "web_search_call") {
1896
- toolName = webSearchToolName != null ? webSearchToolName : "web_search";
1897
- } else if (xSearchSubTools.includes((_e = part.name) != null ? _e : "") || part.type === "x_search_call") {
1898
- toolName = xSearchToolName != null ? xSearchToolName : "x_search";
1899
- } else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
1900
- toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
1901
- }
1902
- const toolInput = part.type === "custom_tool_call" ? (_f = part.input) != null ? _f : "" : (_g = part.arguments) != null ? _g : "";
1903
1904
  controller.enqueue({
1904
1905
  type: "tool-input-start",
1905
1906
  id: part.id,
@@ -2054,7 +2055,7 @@ var xaiTools = {
2054
2055
  };
2055
2056
 
2056
2057
  // src/version.ts
2057
- var VERSION = true ? "3.0.9" : "0.0.0-test";
2058
+ var VERSION = true ? "3.0.10" : "0.0.0-test";
2058
2059
 
2059
2060
  // src/xai-provider.ts
2060
2061
  var xaiErrorStructure = {