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/dist/index.mjs CHANGED
@@ -1774,11 +1774,13 @@ async function parseToolCall({
1774
1774
  return await doParseToolCall({ toolCall: repairedToolCall, tools });
1775
1775
  }
1776
1776
  } catch (error) {
1777
+ const parsedInput = await safeParseJSON({ text: toolCall.input });
1778
+ const input = parsedInput.success ? parsedInput.value : toolCall.input;
1777
1779
  return {
1778
1780
  type: "tool-call",
1779
1781
  toolCallId: toolCall.toolCallId,
1780
1782
  toolName: toolCall.toolName,
1781
- input: toolCall.input,
1783
+ input,
1782
1784
  dynamic: true,
1783
1785
  invalid: true,
1784
1786
  error