@ai-sdk/anthropic 3.0.89 → 3.0.90

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/anthropic
2
2
 
3
+ ## 3.0.90
4
+
5
+ ### Patch Changes
6
+
7
+ - 28ff5a7: fix(anthropic): correctly map delta type when code execution tools are used
8
+
3
9
  ## 3.0.89
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
32
32
  var import_provider_utils26 = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "3.0.89" : "0.0.0-test";
35
+ var VERSION = true ? "3.0.90" : "0.0.0-test";
36
36
 
37
37
  // src/anthropic-messages-language-model.ts
38
38
  var import_provider3 = require("@ai-sdk/provider");
@@ -4461,6 +4461,7 @@ var AnthropicMessagesLanguageModel = class {
4461
4461
  "bash_code_execution"
4462
4462
  ].includes(part.name)) {
4463
4463
  const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
4464
+ const providerToolInputType = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? part.name : part.name === "code_execution" ? "programmatic-tool-call" : void 0;
4464
4465
  const customToolName = toolNameMapping.toCustomToolName(providerToolName);
4465
4466
  const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
4466
4467
  contentBlocks[value.index] = {
@@ -4474,8 +4475,9 @@ var AnthropicMessagesLanguageModel = class {
4474
4475
  // tool was not explicitly provided. We therefore bypass the general validation by marking the
4475
4476
  // tool as dynamic.
4476
4477
  ...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
4477
- firstDelta: true,
4478
- providerToolName
4478
+ firstDelta: finalInput.length === 0,
4479
+ providerToolName,
4480
+ providerToolInputType
4479
4481
  };
4480
4482
  controller.enqueue({
4481
4483
  type: "tool-input-start",
@@ -4915,8 +4917,8 @@ var AnthropicMessagesLanguageModel = class {
4915
4917
  if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
4916
4918
  return;
4917
4919
  }
4918
- if (contentBlock.firstDelta && contentBlock.providerToolName === "code_execution") {
4919
- delta = `{"type": "programmatic-tool-call",${delta.substring(1)}`;
4920
+ if (contentBlock.firstDelta && contentBlock.providerToolInputType != null) {
4921
+ delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
4920
4922
  }
4921
4923
  controller.enqueue({
4922
4924
  type: "tool-input-delta",