ai 5.0.18 → 5.0.19

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
2
2
 
3
+ ## 5.0.19
4
+
5
+ ### Patch Changes
6
+
7
+ - 8da6e9c: fix(ai): use parsed tool input if possible when validation fails
8
+
3
9
  ## 5.0.18
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1848,11 +1848,13 @@ async function parseToolCall({
1848
1848
  return await doParseToolCall({ toolCall: repairedToolCall, tools });
1849
1849
  }
1850
1850
  } catch (error) {
1851
+ const parsedInput = await (0, import_provider_utils8.safeParseJSON)({ text: toolCall.input });
1852
+ const input = parsedInput.success ? parsedInput.value : toolCall.input;
1851
1853
  return {
1852
1854
  type: "tool-call",
1853
1855
  toolCallId: toolCall.toolCallId,
1854
1856
  toolName: toolCall.toolName,
1855
- input: toolCall.input,
1857
+ input,
1856
1858
  dynamic: true,
1857
1859
  invalid: true,
1858
1860
  error