@ai-sdk/anthropic 3.0.93 → 3.0.94

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.
@@ -10,7 +10,8 @@ import {
10
10
  generateId,
11
11
  parseProviderOptions as parseProviderOptions2,
12
12
  postJsonToApi,
13
- resolve
13
+ resolve,
14
+ secureJsonParse as secureJsonParse2
14
15
  } from "@ai-sdk/provider-utils";
15
16
 
16
17
  // src/anthropic-error.ts
@@ -1874,8 +1875,9 @@ import {
1874
1875
  convertToBase64,
1875
1876
  parseProviderOptions,
1876
1877
  safeParseJSON,
1877
- validateTypes as validateTypes2,
1878
- isNonNullable
1878
+ isNonNullable,
1879
+ secureJsonParse,
1880
+ validateTypes as validateTypes2
1879
1881
  } from "@ai-sdk/provider-utils";
1880
1882
 
1881
1883
  // src/tool/code-execution_20250522.ts
@@ -2740,7 +2742,7 @@ async function convertToAnthropicMessagesPrompt({
2740
2742
  let errorInfo = {};
2741
2743
  try {
2742
2744
  if (typeof output.value === "string") {
2743
- errorInfo = JSON.parse(output.value);
2745
+ errorInfo = secureJsonParse(output.value);
2744
2746
  } else if (typeof output.value === "object" && output.value !== null) {
2745
2747
  errorInfo = output.value;
2746
2748
  }
@@ -4848,7 +4850,7 @@ var AnthropicMessagesLanguageModel = class {
4848
4850
  let finalInput = contentBlock.input === "" ? "{}" : contentBlock.input;
4849
4851
  if (contentBlock.providerToolName === "code_execution") {
4850
4852
  try {
4851
- const parsed = JSON.parse(finalInput);
4853
+ const parsed = secureJsonParse2(finalInput);
4852
4854
  if (parsed != null && typeof parsed === "object" && "code" in parsed && !("type" in parsed)) {
4853
4855
  finalInput = JSON.stringify({
4854
4856
  type: "programmatic-tool-call",