@ai-sdk/anthropic 4.0.1 → 4.0.3

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.
@@ -4691,6 +4691,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
4691
4691
  "bash_code_execution"
4692
4692
  ].includes(part.name)) {
4693
4693
  const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
4694
+ const providerToolInputType = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? part.name : part.name === "code_execution" ? "programmatic-tool-call" : void 0;
4694
4695
  const customToolName = toolNameMapping.toCustomToolName(providerToolName);
4695
4696
  const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
4696
4697
  contentBlocks[value.index] = {
@@ -4704,8 +4705,9 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
4704
4705
  // tool was not explicitly provided. We therefore bypass the general validation by marking the
4705
4706
  // tool as dynamic.
4706
4707
  ...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
4707
- firstDelta: true,
4708
- providerToolName
4708
+ firstDelta: finalInput.length === 0,
4709
+ providerToolName,
4710
+ providerToolInputType
4709
4711
  };
4710
4712
  controller.enqueue({
4711
4713
  type: "tool-input-start",
@@ -5145,8 +5147,8 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
5145
5147
  if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
5146
5148
  return;
5147
5149
  }
5148
- if (contentBlock.firstDelta && contentBlock.providerToolName === "code_execution") {
5149
- delta = `{"type": "programmatic-tool-call",${delta.substring(1)}`;
5150
+ if (contentBlock.firstDelta && contentBlock.providerToolInputType != null) {
5151
+ delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
5150
5152
  }
5151
5153
  controller.enqueue({
5152
5154
  type: "tool-input-delta",