@ai-sdk/anthropic 2.0.92 → 2.0.93

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
@@ -11,7 +11,7 @@ import {
11
11
  } from "@ai-sdk/provider-utils";
12
12
 
13
13
  // src/version.ts
14
- var VERSION = true ? "2.0.92" : "0.0.0-test";
14
+ var VERSION = true ? "2.0.93" : "0.0.0-test";
15
15
 
16
16
  // src/anthropic-messages-language-model.ts
17
17
  import {
@@ -1851,12 +1851,13 @@ async function convertToAnthropicMessagesPrompt({
1851
1851
  case "tool-call": {
1852
1852
  if (part.providerExecuted) {
1853
1853
  if (part.toolName === "code_execution" && part.input != null && typeof part.input === "object" && "type" in part.input && typeof part.input.type === "string" && (part.input.type === "bash_code_execution" || part.input.type === "text_editor_code_execution")) {
1854
+ const { type: type2, ...input } = part.input;
1854
1855
  anthropicContent.push({
1855
1856
  type: "server_tool_use",
1856
1857
  id: part.toolCallId,
1857
- name: part.input.type,
1858
+ name: type2,
1858
1859
  // map back to subtool name
1859
- input: part.input,
1860
+ input,
1860
1861
  cache_control: cacheControl
1861
1862
  });
1862
1863
  } else if (part.toolName === "code_execution" || // code execution 20250522
@@ -1928,7 +1929,15 @@ async function convertToAnthropicMessagesPrompt({
1928
1929
  type: "bash_code_execution_tool_result",
1929
1930
  tool_use_id: part.toolCallId,
1930
1931
  cache_control: cacheControl,
1931
- content: codeExecutionOutput
1932
+ // Prompt caching requires stable key ordering:
1933
+ // https://platform.claude.com/docs/en/build-with-claude/prompt-caching#troubleshooting-common-issues
1934
+ content: codeExecutionOutput.type === "bash_code_execution_result" ? {
1935
+ type: codeExecutionOutput.type,
1936
+ stdout: codeExecutionOutput.stdout,
1937
+ stderr: codeExecutionOutput.stderr,
1938
+ return_code: codeExecutionOutput.return_code,
1939
+ content: codeExecutionOutput.content
1940
+ } : codeExecutionOutput
1932
1941
  } : {
1933
1942
  type: "text_editor_code_execution_tool_result",
1934
1943
  tool_use_id: part.toolCallId,