ai 5.0.265 → 5.0.266

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
@@ -727,7 +727,7 @@ import {
727
727
  } from "@ai-sdk/provider-utils";
728
728
 
729
729
  // src/version.ts
730
- var VERSION = true ? "5.0.265" : "0.0.0-test";
730
+ var VERSION = true ? "5.0.266" : "0.0.0-test";
731
731
 
732
732
  // src/util/download/download.ts
733
733
  var download = async ({
@@ -1970,6 +1970,9 @@ async function parseToolCall({
1970
1970
  }) {
1971
1971
  try {
1972
1972
  if (tools == null) {
1973
+ if (toolCall.providerExecuted) {
1974
+ return await parseProviderExecutedDynamicToolCall(toolCall);
1975
+ }
1973
1976
  throw new NoSuchToolError({ toolName: toolCall.toolName });
1974
1977
  }
1975
1978
  try {
@@ -2017,6 +2020,25 @@ async function parseToolCall({
2017
2020
  };
2018
2021
  }
2019
2022
  }
2023
+ async function parseProviderExecutedDynamicToolCall(toolCall) {
2024
+ const parseResult = toolCall.input.trim() === "" ? { success: true, value: {} } : await safeParseJSON({ text: toolCall.input });
2025
+ if (parseResult.success === false) {
2026
+ throw new InvalidToolInputError({
2027
+ toolName: toolCall.toolName,
2028
+ toolInput: toolCall.input,
2029
+ cause: parseResult.error
2030
+ });
2031
+ }
2032
+ return {
2033
+ type: "tool-call",
2034
+ toolCallId: toolCall.toolCallId,
2035
+ toolName: toolCall.toolName,
2036
+ input: parseResult.value,
2037
+ providerExecuted: true,
2038
+ dynamic: true,
2039
+ providerMetadata: toolCall.providerMetadata
2040
+ };
2041
+ }
2020
2042
  async function doParseToolCall({
2021
2043
  toolCall,
2022
2044
  tools
@@ -2024,6 +2046,9 @@ async function doParseToolCall({
2024
2046
  const toolName = toolCall.toolName;
2025
2047
  const tool2 = tools[toolName];
2026
2048
  if (tool2 == null) {
2049
+ if (toolCall.providerExecuted) {
2050
+ return await parseProviderExecutedDynamicToolCall(toolCall);
2051
+ }
2027
2052
  throw new NoSuchToolError({
2028
2053
  toolName: toolCall.toolName,
2029
2054
  availableTools: Object.keys(tools)