ai 6.0.235 → 6.0.237

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,20 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.237
4
+
5
+ ### Patch Changes
6
+
7
+ - f6020d7: Avoid synthesizing client tool errors for invalid provider-executed tool calls.
8
+ - Updated dependencies [de438f5]
9
+ - @ai-sdk/gateway@3.0.159
10
+
11
+ ## 6.0.236
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [8418710]
16
+ - @ai-sdk/gateway@3.0.158
17
+
3
18
  ## 6.0.235
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2347,8 +2347,9 @@ interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends Output> {
2347
2347
  readonly providerMetadata: PromiseLike<ProviderMetadata | undefined>;
2348
2348
  /**
2349
2349
  * A text stream that returns only the generated text deltas. You can use it
2350
- * as either an AsyncIterable or a ReadableStream. When an error occurs, the
2351
- * stream will throw the error.
2350
+ * as either an AsyncIterable or a ReadableStream. Error parts are not
2351
+ * surfaced in this stream. Use the `onError` callback or `fullStream` to
2352
+ * observe them.
2352
2353
  */
2353
2354
  readonly textStream: AsyncIterableStream<string>;
2354
2355
  /**
package/dist/index.d.ts CHANGED
@@ -2347,8 +2347,9 @@ interface StreamTextResult<TOOLS extends ToolSet, OUTPUT extends Output> {
2347
2347
  readonly providerMetadata: PromiseLike<ProviderMetadata | undefined>;
2348
2348
  /**
2349
2349
  * A text stream that returns only the generated text deltas. You can use it
2350
- * as either an AsyncIterable or a ReadableStream. When an error occurs, the
2351
- * stream will throw the error.
2350
+ * as either an AsyncIterable or a ReadableStream. Error parts are not
2351
+ * surfaced in this stream. Use the `onError` callback or `fullStream` to
2352
+ * observe them.
2352
2353
  */
2353
2354
  readonly textStream: AsyncIterableStream<string>;
2354
2355
  /**
package/dist/index.js CHANGED
@@ -1304,7 +1304,7 @@ function detectMediaType({
1304
1304
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1305
1305
 
1306
1306
  // src/version.ts
1307
- var VERSION = true ? "6.0.235" : "0.0.0-test";
1307
+ var VERSION = true ? "6.0.237" : "0.0.0-test";
1308
1308
 
1309
1309
  // src/util/download/download.ts
1310
1310
  var download = async ({
@@ -4941,7 +4941,7 @@ async function generateText({
4941
4941
  }
4942
4942
  }
4943
4943
  const invalidToolCalls = stepToolCalls.filter(
4944
- (toolCall) => toolCall.invalid && toolCall.dynamic
4944
+ (toolCall) => toolCall.invalid && toolCall.dynamic && !toolCall.providerExecuted
4945
4945
  );
4946
4946
  clientToolOutputs = [];
4947
4947
  for (const toolCall of invalidToolCalls) {
@@ -6818,16 +6818,18 @@ function runToolsTransformation({
6818
6818
  toolCallsByToolCallId.set(toolCall.toolCallId, toolCall);
6819
6819
  controller.enqueue(toolCall);
6820
6820
  if (toolCall.invalid) {
6821
- enqueueToolResult({
6822
- type: "tool-error",
6823
- toolCallId: toolCall.toolCallId,
6824
- toolName: toolCall.toolName,
6825
- input: toolCall.input,
6826
- error: (0, import_provider_utils19.getErrorMessage)(toolCall.error),
6827
- dynamic: true,
6828
- title: toolCall.title,
6829
- ...toolCall.toolMetadata != null ? { toolMetadata: toolCall.toolMetadata } : {}
6830
- });
6821
+ if (!toolCall.providerExecuted) {
6822
+ enqueueToolResult({
6823
+ type: "tool-error",
6824
+ toolCallId: toolCall.toolCallId,
6825
+ toolName: toolCall.toolName,
6826
+ input: toolCall.input,
6827
+ error: (0, import_provider_utils19.getErrorMessage)(toolCall.error),
6828
+ dynamic: true,
6829
+ title: toolCall.title,
6830
+ ...toolCall.toolMetadata != null ? { toolMetadata: toolCall.toolMetadata } : {}
6831
+ });
6832
+ }
6831
6833
  break;
6832
6834
  }
6833
6835
  const tool2 = tools == null ? void 0 : tools[toolCall.toolName];