@ai-sdk/anthropic 4.0.0 → 4.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@ai-sdk/provider": "4.0.0",
39
- "@ai-sdk/provider-utils": "5.0.0"
39
+ "@ai-sdk/provider-utils": "5.0.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "22.19.19",
@@ -1495,6 +1495,7 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
1495
1495
  providerExecuted?: boolean;
1496
1496
  firstDelta: boolean;
1497
1497
  providerToolName?: string;
1498
+ providerToolInputType?: string;
1498
1499
  caller?: {
1499
1500
  type:
1500
1501
  | 'code_execution_20250825'
@@ -1699,6 +1700,13 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
1699
1700
  part.name === 'bash_code_execution'
1700
1701
  ? 'code_execution'
1701
1702
  : part.name;
1703
+ const providerToolInputType =
1704
+ part.name === 'text_editor_code_execution' ||
1705
+ part.name === 'bash_code_execution'
1706
+ ? part.name
1707
+ : part.name === 'code_execution'
1708
+ ? 'programmatic-tool-call'
1709
+ : undefined;
1702
1710
 
1703
1711
  const customToolName =
1704
1712
  toolNameMapping.toCustomToolName(providerToolName);
@@ -1727,8 +1735,9 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
1727
1735
  providerToolName === 'code_execution'
1728
1736
  ? { dynamic: true }
1729
1737
  : {}),
1730
- firstDelta: true,
1738
+ firstDelta: finalInput.length === 0,
1731
1739
  providerToolName,
1740
+ providerToolInputType,
1732
1741
  };
1733
1742
 
1734
1743
  controller.enqueue({
@@ -2257,9 +2266,9 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
2257
2266
  // the type to the delta and change the tool name.
2258
2267
  if (
2259
2268
  contentBlock.firstDelta &&
2260
- contentBlock.providerToolName === 'code_execution'
2269
+ contentBlock.providerToolInputType != null
2261
2270
  ) {
2262
- delta = `{"type": "programmatic-tool-call",${delta.substring(1)}`;
2271
+ delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
2263
2272
  }
2264
2273
 
2265
2274
  controller.enqueue({