@ai-sdk/anthropic 2.0.26 → 2.0.28

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.
@@ -142,6 +142,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
142
142
  })
143
143
  ])
144
144
  }),
145
+ // code execution results for code_execution_20250522 tool:
145
146
  z2.object({
146
147
  type: z2.literal("code_execution_tool_result"),
147
148
  tool_use_id: z2.string(),
@@ -157,6 +158,62 @@ var anthropicMessagesResponseSchema = lazySchema2(
157
158
  error_code: z2.string()
158
159
  })
159
160
  ])
161
+ }),
162
+ // bash code execution results for code_execution_20250825 tool:
163
+ z2.object({
164
+ type: z2.literal("bash_code_execution_tool_result"),
165
+ tool_use_id: z2.string(),
166
+ content: z2.discriminatedUnion("type", [
167
+ z2.object({
168
+ type: z2.literal("bash_code_execution_result"),
169
+ content: z2.array(
170
+ z2.object({
171
+ type: z2.literal("bash_code_execution_output"),
172
+ file_id: z2.string()
173
+ })
174
+ ),
175
+ stdout: z2.string(),
176
+ stderr: z2.string(),
177
+ return_code: z2.number()
178
+ }),
179
+ z2.object({
180
+ type: z2.literal("bash_code_execution_tool_result_error"),
181
+ error_code: z2.string()
182
+ })
183
+ ])
184
+ }),
185
+ // text editor code execution results for code_execution_20250825 tool:
186
+ z2.object({
187
+ type: z2.literal("text_editor_code_execution_tool_result"),
188
+ tool_use_id: z2.string(),
189
+ content: z2.discriminatedUnion("type", [
190
+ z2.object({
191
+ type: z2.literal("text_editor_code_execution_tool_result_error"),
192
+ error_code: z2.string()
193
+ }),
194
+ z2.object({
195
+ type: z2.literal("text_editor_code_execution_view_result"),
196
+ content: z2.string(),
197
+ file_type: z2.string(),
198
+ num_lines: z2.number().nullable(),
199
+ start_line: z2.number().nullable(),
200
+ total_lines: z2.number().nullable()
201
+ }),
202
+ z2.object({
203
+ type: z2.literal("text_editor_code_execution_create_result"),
204
+ is_file_update: z2.boolean()
205
+ }),
206
+ z2.object({
207
+ type: z2.literal(
208
+ "text_editor_code_execution_str_replace_result"
209
+ ),
210
+ lines: z2.array(z2.string()).nullable(),
211
+ new_lines: z2.number().nullable(),
212
+ new_start: z2.number().nullable(),
213
+ old_lines: z2.number().nullable(),
214
+ old_start: z2.number().nullable()
215
+ })
216
+ ])
160
217
  })
161
218
  ])
162
219
  ),
@@ -257,6 +314,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
257
314
  })
258
315
  ])
259
316
  }),
317
+ // code execution results for code_execution_20250522 tool:
260
318
  z2.object({
261
319
  type: z2.literal("code_execution_tool_result"),
262
320
  tool_use_id: z2.string(),
@@ -272,6 +330,62 @@ var anthropicMessagesChunkSchema = lazySchema2(
272
330
  error_code: z2.string()
273
331
  })
274
332
  ])
333
+ }),
334
+ // bash code execution results for code_execution_20250825 tool:
335
+ z2.object({
336
+ type: z2.literal("bash_code_execution_tool_result"),
337
+ tool_use_id: z2.string(),
338
+ content: z2.discriminatedUnion("type", [
339
+ z2.object({
340
+ type: z2.literal("bash_code_execution_result"),
341
+ content: z2.array(
342
+ z2.object({
343
+ type: z2.literal("bash_code_execution_output"),
344
+ file_id: z2.string()
345
+ })
346
+ ),
347
+ stdout: z2.string(),
348
+ stderr: z2.string(),
349
+ return_code: z2.number()
350
+ }),
351
+ z2.object({
352
+ type: z2.literal("bash_code_execution_tool_result_error"),
353
+ error_code: z2.string()
354
+ })
355
+ ])
356
+ }),
357
+ // text editor code execution results for code_execution_20250825 tool:
358
+ z2.object({
359
+ type: z2.literal("text_editor_code_execution_tool_result"),
360
+ tool_use_id: z2.string(),
361
+ content: z2.discriminatedUnion("type", [
362
+ z2.object({
363
+ type: z2.literal("text_editor_code_execution_tool_result_error"),
364
+ error_code: z2.string()
365
+ }),
366
+ z2.object({
367
+ type: z2.literal("text_editor_code_execution_view_result"),
368
+ content: z2.string(),
369
+ file_type: z2.string(),
370
+ num_lines: z2.number().nullable(),
371
+ start_line: z2.number().nullable(),
372
+ total_lines: z2.number().nullable()
373
+ }),
374
+ z2.object({
375
+ type: z2.literal("text_editor_code_execution_create_result"),
376
+ is_file_update: z2.boolean()
377
+ }),
378
+ z2.object({
379
+ type: z2.literal(
380
+ "text_editor_code_execution_str_replace_result"
381
+ ),
382
+ lines: z2.array(z2.string()).nullable(),
383
+ new_lines: z2.number().nullable(),
384
+ new_start: z2.number().nullable(),
385
+ old_lines: z2.number().nullable(),
386
+ old_start: z2.number().nullable()
387
+ })
388
+ ])
275
389
  })
276
390
  ])
277
391
  }),
@@ -607,6 +721,14 @@ async function prepareTools({
607
721
  });
608
722
  break;
609
723
  }
724
+ case "anthropic.code_execution_20250825": {
725
+ betas.add("code-execution-2025-08-25");
726
+ anthropicTools2.push({
727
+ type: "code_execution_20250825",
728
+ name: "code_execution"
729
+ });
730
+ break;
731
+ }
610
732
  case "anthropic.computer_20250124": {
611
733
  betas.add("computer-use-2025-01-24");
612
734
  anthropicTools2.push({
@@ -822,6 +944,99 @@ var codeExecution_20250522 = (args = {}) => {
822
944
  return factory4(args);
823
945
  };
824
946
 
947
+ // src/tool/code-execution_20250825.ts
948
+ import {
949
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
950
+ lazySchema as lazySchema7,
951
+ zodSchema as zodSchema7
952
+ } from "@ai-sdk/provider-utils";
953
+ import { z as z8 } from "zod/v4";
954
+ var codeExecution_20250825OutputSchema = lazySchema7(
955
+ () => zodSchema7(
956
+ z8.discriminatedUnion("type", [
957
+ z8.object({
958
+ type: z8.literal("bash_code_execution_result"),
959
+ content: z8.array(
960
+ z8.object({
961
+ type: z8.literal("bash_code_execution_output"),
962
+ file_id: z8.string()
963
+ })
964
+ ),
965
+ stdout: z8.string(),
966
+ stderr: z8.string(),
967
+ return_code: z8.number()
968
+ }),
969
+ z8.object({
970
+ type: z8.literal("bash_code_execution_tool_result_error"),
971
+ error_code: z8.string()
972
+ }),
973
+ z8.object({
974
+ type: z8.literal("text_editor_code_execution_tool_result_error"),
975
+ error_code: z8.string()
976
+ }),
977
+ z8.object({
978
+ type: z8.literal("text_editor_code_execution_view_result"),
979
+ content: z8.string(),
980
+ file_type: z8.string(),
981
+ num_lines: z8.number().nullable(),
982
+ start_line: z8.number().nullable(),
983
+ total_lines: z8.number().nullable()
984
+ }),
985
+ z8.object({
986
+ type: z8.literal("text_editor_code_execution_create_result"),
987
+ is_file_update: z8.boolean()
988
+ }),
989
+ z8.object({
990
+ type: z8.literal("text_editor_code_execution_str_replace_result"),
991
+ lines: z8.array(z8.string()).nullable(),
992
+ new_lines: z8.number().nullable(),
993
+ new_start: z8.number().nullable(),
994
+ old_lines: z8.number().nullable(),
995
+ old_start: z8.number().nullable()
996
+ })
997
+ ])
998
+ )
999
+ );
1000
+ var codeExecution_20250825InputSchema = lazySchema7(
1001
+ () => zodSchema7(
1002
+ z8.discriminatedUnion("type", [
1003
+ z8.object({
1004
+ type: z8.literal("bash_code_execution"),
1005
+ command: z8.string()
1006
+ }),
1007
+ z8.discriminatedUnion("command", [
1008
+ z8.object({
1009
+ type: z8.literal("text_editor_code_execution"),
1010
+ command: z8.literal("view"),
1011
+ path: z8.string()
1012
+ }),
1013
+ z8.object({
1014
+ type: z8.literal("text_editor_code_execution"),
1015
+ command: z8.literal("create"),
1016
+ path: z8.string(),
1017
+ file_text: z8.string().nullish()
1018
+ }),
1019
+ z8.object({
1020
+ type: z8.literal("text_editor_code_execution"),
1021
+ command: z8.literal("str_replace"),
1022
+ path: z8.string(),
1023
+ old_str: z8.string(),
1024
+ new_str: z8.string()
1025
+ })
1026
+ ])
1027
+ ])
1028
+ )
1029
+ );
1030
+ var factory5 = createProviderDefinedToolFactoryWithOutputSchema4({
1031
+ id: "anthropic.code_execution_20250825",
1032
+ name: "code_execution",
1033
+ inputSchema: codeExecution_20250825InputSchema,
1034
+ outputSchema: codeExecution_20250825OutputSchema
1035
+ });
1036
+ var codeExecution_20250825 = (args = {}) => {
1037
+ return factory5(args);
1038
+ };
1039
+
825
1040
  // src/convert-to-anthropic-messages-prompt.ts
826
1041
  function convertToString(data) {
827
1042
  if (typeof data === "string") {
@@ -1009,6 +1224,18 @@ async function convertToAnthropicMessagesPrompt({
1009
1224
  cache_control: void 0
1010
1225
  };
1011
1226
  }
1227
+ if (contentPart.mediaType === "application/pdf") {
1228
+ betas.add("pdfs-2024-09-25");
1229
+ return {
1230
+ type: "document",
1231
+ source: {
1232
+ type: "base64",
1233
+ media_type: contentPart.mediaType,
1234
+ data: contentPart.data
1235
+ },
1236
+ cache_control: void 0
1237
+ };
1238
+ }
1012
1239
  throw new UnsupportedFunctionalityError2({
1013
1240
  functionality: `media type: ${contentPart.mediaType}`
1014
1241
  });
@@ -1112,7 +1339,17 @@ async function convertToAnthropicMessagesPrompt({
1112
1339
  }
1113
1340
  case "tool-call": {
1114
1341
  if (part.providerExecuted) {
1115
- if (part.toolName === "code_execution" || part.toolName === "web_fetch" || part.toolName === "web_search") {
1342
+ 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")) {
1343
+ anthropicContent.push({
1344
+ type: "server_tool_use",
1345
+ id: part.toolCallId,
1346
+ name: part.input.type,
1347
+ // map back to subtool name
1348
+ input: part.input,
1349
+ cache_control: cacheControl
1350
+ });
1351
+ } else if (part.toolName === "code_execution" || // code execution 20250522
1352
+ part.toolName === "web_fetch" || part.toolName === "web_search") {
1116
1353
  anthropicContent.push({
1117
1354
  type: "server_tool_use",
1118
1355
  id: part.toolCallId,
@@ -1147,21 +1384,48 @@ async function convertToAnthropicMessagesPrompt({
1147
1384
  });
1148
1385
  break;
1149
1386
  }
1150
- const codeExecutionOutput = await validateTypes2({
1151
- value: output.value,
1152
- schema: codeExecution_20250522OutputSchema
1153
- });
1154
- anthropicContent.push({
1155
- type: "code_execution_tool_result",
1156
- tool_use_id: part.toolCallId,
1157
- content: {
1158
- type: codeExecutionOutput.type,
1159
- stdout: codeExecutionOutput.stdout,
1160
- stderr: codeExecutionOutput.stderr,
1161
- return_code: codeExecutionOutput.return_code
1162
- },
1163
- cache_control: cacheControl
1164
- });
1387
+ if (output.value == null || typeof output.value !== "object" || !("type" in output.value) || typeof output.value.type !== "string") {
1388
+ warnings.push({
1389
+ type: "other",
1390
+ message: `provider executed tool result output value is not a valid code execution result for tool ${part.toolName}`
1391
+ });
1392
+ break;
1393
+ }
1394
+ if (output.value.type === "code_execution_result") {
1395
+ const codeExecutionOutput = await validateTypes2({
1396
+ value: output.value,
1397
+ schema: codeExecution_20250522OutputSchema
1398
+ });
1399
+ anthropicContent.push({
1400
+ type: "code_execution_tool_result",
1401
+ tool_use_id: part.toolCallId,
1402
+ content: {
1403
+ type: codeExecutionOutput.type,
1404
+ stdout: codeExecutionOutput.stdout,
1405
+ stderr: codeExecutionOutput.stderr,
1406
+ return_code: codeExecutionOutput.return_code
1407
+ },
1408
+ cache_control: cacheControl
1409
+ });
1410
+ } else {
1411
+ const codeExecutionOutput = await validateTypes2({
1412
+ value: output.value,
1413
+ schema: codeExecution_20250825OutputSchema
1414
+ });
1415
+ anthropicContent.push(
1416
+ codeExecutionOutput.type === "bash_code_execution_result" || codeExecutionOutput.type === "bash_code_execution_tool_result_error" ? {
1417
+ type: "bash_code_execution_tool_result",
1418
+ tool_use_id: part.toolCallId,
1419
+ cache_control: cacheControl,
1420
+ content: codeExecutionOutput
1421
+ } : {
1422
+ type: "text_editor_code_execution_tool_result",
1423
+ tool_use_id: part.toolCallId,
1424
+ cache_control: cacheControl,
1425
+ content: codeExecutionOutput
1426
+ }
1427
+ );
1428
+ }
1165
1429
  break;
1166
1430
  }
1167
1431
  if (part.toolName === "web_fetch") {
@@ -1631,7 +1895,15 @@ var AnthropicMessagesLanguageModel = class {
1631
1895
  break;
1632
1896
  }
1633
1897
  case "server_tool_use": {
1634
- if (part.name === "web_search" || part.name === "code_execution" || part.name === "web_fetch") {
1898
+ if (part.name === "text_editor_code_execution" || part.name === "bash_code_execution") {
1899
+ content.push({
1900
+ type: "tool-call",
1901
+ toolCallId: part.id,
1902
+ toolName: "code_execution",
1903
+ input: JSON.stringify({ type: part.name, ...part.input }),
1904
+ providerExecuted: true
1905
+ });
1906
+ } else if (part.name === "web_search" || part.name === "code_execution" || part.name === "web_fetch") {
1635
1907
  content.push({
1636
1908
  type: "tool-call",
1637
1909
  toolCallId: part.id,
@@ -1727,6 +1999,7 @@ var AnthropicMessagesLanguageModel = class {
1727
1999
  }
1728
2000
  break;
1729
2001
  }
2002
+ // code execution 20250522:
1730
2003
  case "code_execution_tool_result": {
1731
2004
  if (part.content.type === "code_execution_result") {
1732
2005
  content.push({
@@ -1756,6 +2029,18 @@ var AnthropicMessagesLanguageModel = class {
1756
2029
  }
1757
2030
  break;
1758
2031
  }
2032
+ // code execution 20250825:
2033
+ case "bash_code_execution_tool_result":
2034
+ case "text_editor_code_execution_tool_result": {
2035
+ content.push({
2036
+ type: "tool-result",
2037
+ toolCallId: part.tool_use_id,
2038
+ toolName: "code_execution",
2039
+ result: part.content,
2040
+ providerExecuted: true
2041
+ });
2042
+ break;
2043
+ }
1759
2044
  }
1760
2045
  }
1761
2046
  return {
@@ -1872,7 +2157,8 @@ var AnthropicMessagesLanguageModel = class {
1872
2157
  type: "tool-call",
1873
2158
  toolCallId: value.content_block.id,
1874
2159
  toolName: value.content_block.name,
1875
- input: ""
2160
+ input: "",
2161
+ firstDelta: true
1876
2162
  };
1877
2163
  controller.enqueue(
1878
2164
  usesJsonResponseTool ? { type: "text-start", id: String(value.index) } : {
@@ -1884,18 +2170,29 @@ var AnthropicMessagesLanguageModel = class {
1884
2170
  return;
1885
2171
  }
1886
2172
  case "server_tool_use": {
1887
- if (value.content_block.name === "web_fetch" || value.content_block.name === "web_search" || value.content_block.name === "code_execution") {
2173
+ if ([
2174
+ "web_fetch",
2175
+ "web_search",
2176
+ // code execution 20250825:
2177
+ "code_execution",
2178
+ // code execution 20250825 text editor:
2179
+ "text_editor_code_execution",
2180
+ // code execution 20250825 bash:
2181
+ "bash_code_execution"
2182
+ ].includes(value.content_block.name)) {
1888
2183
  contentBlocks[value.index] = {
1889
2184
  type: "tool-call",
1890
2185
  toolCallId: value.content_block.id,
1891
2186
  toolName: value.content_block.name,
1892
2187
  input: "",
1893
- providerExecuted: true
2188
+ providerExecuted: true,
2189
+ firstDelta: true
1894
2190
  };
2191
+ const mappedToolName = value.content_block.name === "text_editor_code_execution" || value.content_block.name === "bash_code_execution" ? "code_execution" : value.content_block.name;
1895
2192
  controller.enqueue({
1896
2193
  type: "tool-input-start",
1897
2194
  id: value.content_block.id,
1898
- toolName: value.content_block.name,
2195
+ toolName: mappedToolName,
1899
2196
  providerExecuted: true
1900
2197
  });
1901
2198
  }
@@ -1987,6 +2284,7 @@ var AnthropicMessagesLanguageModel = class {
1987
2284
  }
1988
2285
  return;
1989
2286
  }
2287
+ // code execution 20250522:
1990
2288
  case "code_execution_tool_result": {
1991
2289
  const part = value.content_block;
1992
2290
  if (part.content.type === "code_execution_result") {
@@ -2017,6 +2315,19 @@ var AnthropicMessagesLanguageModel = class {
2017
2315
  }
2018
2316
  return;
2019
2317
  }
2318
+ // code execution 20250825:
2319
+ case "bash_code_execution_tool_result":
2320
+ case "text_editor_code_execution_tool_result": {
2321
+ const part = value.content_block;
2322
+ controller.enqueue({
2323
+ type: "tool-result",
2324
+ toolCallId: part.tool_use_id,
2325
+ toolName: "code_execution",
2326
+ result: part.content,
2327
+ providerExecuted: true
2328
+ });
2329
+ return;
2330
+ }
2020
2331
  default: {
2021
2332
  const _exhaustiveCheck = contentBlockType;
2022
2333
  throw new Error(
@@ -2049,7 +2360,14 @@ var AnthropicMessagesLanguageModel = class {
2049
2360
  type: "tool-input-end",
2050
2361
  id: contentBlock.toolCallId
2051
2362
  });
2052
- controller.enqueue(contentBlock);
2363
+ const toolName = contentBlock.toolName === "text_editor_code_execution" || contentBlock.toolName === "bash_code_execution" ? "code_execution" : contentBlock.toolName;
2364
+ controller.enqueue({
2365
+ type: "tool-call",
2366
+ toolCallId: contentBlock.toolCallId,
2367
+ toolName,
2368
+ input: contentBlock.input,
2369
+ providerExecuted: contentBlock.providerExecuted
2370
+ });
2053
2371
  }
2054
2372
  break;
2055
2373
  }
@@ -2097,7 +2415,10 @@ var AnthropicMessagesLanguageModel = class {
2097
2415
  }
2098
2416
  case "input_json_delta": {
2099
2417
  const contentBlock = contentBlocks[value.index];
2100
- const delta = value.delta.partial_json;
2418
+ let delta = value.delta.partial_json;
2419
+ if (delta.length === 0) {
2420
+ return;
2421
+ }
2101
2422
  if (usesJsonResponseTool) {
2102
2423
  if ((contentBlock == null ? void 0 : contentBlock.type) !== "text") {
2103
2424
  return;
@@ -2111,12 +2432,16 @@ var AnthropicMessagesLanguageModel = class {
2111
2432
  if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
2112
2433
  return;
2113
2434
  }
2435
+ if (contentBlock.firstDelta && (contentBlock.toolName === "bash_code_execution" || contentBlock.toolName === "text_editor_code_execution")) {
2436
+ delta = `{"type": "${contentBlock.toolName}",${delta.substring(1)}`;
2437
+ }
2114
2438
  controller.enqueue({
2115
2439
  type: "tool-input-delta",
2116
2440
  id: contentBlock.toolCallId,
2117
2441
  delta
2118
2442
  });
2119
2443
  contentBlock.input += delta;
2444
+ contentBlock.firstDelta = false;
2120
2445
  }
2121
2446
  return;
2122
2447
  }
@@ -2204,15 +2529,15 @@ var AnthropicMessagesLanguageModel = class {
2204
2529
  // src/tool/bash_20241022.ts
2205
2530
  import {
2206
2531
  createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
2207
- lazySchema as lazySchema7,
2208
- zodSchema as zodSchema7
2532
+ lazySchema as lazySchema8,
2533
+ zodSchema as zodSchema8
2209
2534
  } from "@ai-sdk/provider-utils";
2210
- import { z as z8 } from "zod/v4";
2211
- var bash_20241022InputSchema = lazySchema7(
2212
- () => zodSchema7(
2213
- z8.object({
2214
- command: z8.string(),
2215
- restart: z8.boolean().optional()
2535
+ import { z as z9 } from "zod/v4";
2536
+ var bash_20241022InputSchema = lazySchema8(
2537
+ () => zodSchema8(
2538
+ z9.object({
2539
+ command: z9.string(),
2540
+ restart: z9.boolean().optional()
2216
2541
  })
2217
2542
  )
2218
2543
  );
@@ -2225,15 +2550,15 @@ var bash_20241022 = createProviderDefinedToolFactory2({
2225
2550
  // src/tool/bash_20250124.ts
2226
2551
  import {
2227
2552
  createProviderDefinedToolFactory as createProviderDefinedToolFactory3,
2228
- lazySchema as lazySchema8,
2229
- zodSchema as zodSchema8
2553
+ lazySchema as lazySchema9,
2554
+ zodSchema as zodSchema9
2230
2555
  } from "@ai-sdk/provider-utils";
2231
- import { z as z9 } from "zod/v4";
2232
- var bash_20250124InputSchema = lazySchema8(
2233
- () => zodSchema8(
2234
- z9.object({
2235
- command: z9.string(),
2236
- restart: z9.boolean().optional()
2556
+ import { z as z10 } from "zod/v4";
2557
+ var bash_20250124InputSchema = lazySchema9(
2558
+ () => zodSchema9(
2559
+ z10.object({
2560
+ command: z10.string(),
2561
+ restart: z10.boolean().optional()
2237
2562
  })
2238
2563
  )
2239
2564
  );
@@ -2246,14 +2571,14 @@ var bash_20250124 = createProviderDefinedToolFactory3({
2246
2571
  // src/tool/computer_20241022.ts
2247
2572
  import {
2248
2573
  createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
2249
- lazySchema as lazySchema9,
2250
- zodSchema as zodSchema9
2574
+ lazySchema as lazySchema10,
2575
+ zodSchema as zodSchema10
2251
2576
  } from "@ai-sdk/provider-utils";
2252
- import { z as z10 } from "zod/v4";
2253
- var computer_20241022InputSchema = lazySchema9(
2254
- () => zodSchema9(
2255
- z10.object({
2256
- action: z10.enum([
2577
+ import { z as z11 } from "zod/v4";
2578
+ var computer_20241022InputSchema = lazySchema10(
2579
+ () => zodSchema10(
2580
+ z11.object({
2581
+ action: z11.enum([
2257
2582
  "key",
2258
2583
  "type",
2259
2584
  "mouse_move",
@@ -2265,8 +2590,8 @@ var computer_20241022InputSchema = lazySchema9(
2265
2590
  "screenshot",
2266
2591
  "cursor_position"
2267
2592
  ]),
2268
- coordinate: z10.array(z10.number().int()).optional(),
2269
- text: z10.string().optional()
2593
+ coordinate: z11.array(z11.number().int()).optional(),
2594
+ text: z11.string().optional()
2270
2595
  })
2271
2596
  )
2272
2597
  );
@@ -2279,14 +2604,14 @@ var computer_20241022 = createProviderDefinedToolFactory4({
2279
2604
  // src/tool/computer_20250124.ts
2280
2605
  import {
2281
2606
  createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
2282
- lazySchema as lazySchema10,
2283
- zodSchema as zodSchema10
2607
+ lazySchema as lazySchema11,
2608
+ zodSchema as zodSchema11
2284
2609
  } from "@ai-sdk/provider-utils";
2285
- import { z as z11 } from "zod/v4";
2286
- var computer_20250124InputSchema = lazySchema10(
2287
- () => zodSchema10(
2288
- z11.object({
2289
- action: z11.enum([
2610
+ import { z as z12 } from "zod/v4";
2611
+ var computer_20250124InputSchema = lazySchema11(
2612
+ () => zodSchema11(
2613
+ z12.object({
2614
+ action: z12.enum([
2290
2615
  "key",
2291
2616
  "hold_key",
2292
2617
  "type",
@@ -2304,12 +2629,12 @@ var computer_20250124InputSchema = lazySchema10(
2304
2629
  "wait",
2305
2630
  "screenshot"
2306
2631
  ]),
2307
- coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2308
- duration: z11.number().optional(),
2309
- scroll_amount: z11.number().optional(),
2310
- scroll_direction: z11.enum(["up", "down", "left", "right"]).optional(),
2311
- start_coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2312
- text: z11.string().optional()
2632
+ coordinate: z12.tuple([z12.number().int(), z12.number().int()]).optional(),
2633
+ duration: z12.number().optional(),
2634
+ scroll_amount: z12.number().optional(),
2635
+ scroll_direction: z12.enum(["up", "down", "left", "right"]).optional(),
2636
+ start_coordinate: z12.tuple([z12.number().int(), z12.number().int()]).optional(),
2637
+ text: z12.string().optional()
2313
2638
  })
2314
2639
  )
2315
2640
  );
@@ -2322,37 +2647,11 @@ var computer_20250124 = createProviderDefinedToolFactory5({
2322
2647
  // src/tool/text-editor_20241022.ts
2323
2648
  import {
2324
2649
  createProviderDefinedToolFactory as createProviderDefinedToolFactory6,
2325
- lazySchema as lazySchema11,
2326
- zodSchema as zodSchema11
2327
- } from "@ai-sdk/provider-utils";
2328
- import { z as z12 } from "zod/v4";
2329
- var textEditor_20241022InputSchema = lazySchema11(
2330
- () => zodSchema11(
2331
- z12.object({
2332
- command: z12.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2333
- path: z12.string(),
2334
- file_text: z12.string().optional(),
2335
- insert_line: z12.number().int().optional(),
2336
- new_str: z12.string().optional(),
2337
- old_str: z12.string().optional(),
2338
- view_range: z12.array(z12.number().int()).optional()
2339
- })
2340
- )
2341
- );
2342
- var textEditor_20241022 = createProviderDefinedToolFactory6({
2343
- id: "anthropic.text_editor_20241022",
2344
- name: "str_replace_editor",
2345
- inputSchema: textEditor_20241022InputSchema
2346
- });
2347
-
2348
- // src/tool/text-editor_20250124.ts
2349
- import {
2350
- createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
2351
2650
  lazySchema as lazySchema12,
2352
2651
  zodSchema as zodSchema12
2353
2652
  } from "@ai-sdk/provider-utils";
2354
2653
  import { z as z13 } from "zod/v4";
2355
- var textEditor_20250124InputSchema = lazySchema12(
2654
+ var textEditor_20241022InputSchema = lazySchema12(
2356
2655
  () => zodSchema12(
2357
2656
  z13.object({
2358
2657
  command: z13.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -2365,23 +2664,23 @@ var textEditor_20250124InputSchema = lazySchema12(
2365
2664
  })
2366
2665
  )
2367
2666
  );
2368
- var textEditor_20250124 = createProviderDefinedToolFactory7({
2369
- id: "anthropic.text_editor_20250124",
2667
+ var textEditor_20241022 = createProviderDefinedToolFactory6({
2668
+ id: "anthropic.text_editor_20241022",
2370
2669
  name: "str_replace_editor",
2371
- inputSchema: textEditor_20250124InputSchema
2670
+ inputSchema: textEditor_20241022InputSchema
2372
2671
  });
2373
2672
 
2374
- // src/tool/text-editor_20250429.ts
2673
+ // src/tool/text-editor_20250124.ts
2375
2674
  import {
2376
- createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
2675
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
2377
2676
  lazySchema as lazySchema13,
2378
2677
  zodSchema as zodSchema13
2379
2678
  } from "@ai-sdk/provider-utils";
2380
2679
  import { z as z14 } from "zod/v4";
2381
- var textEditor_20250429InputSchema = lazySchema13(
2680
+ var textEditor_20250124InputSchema = lazySchema13(
2382
2681
  () => zodSchema13(
2383
2682
  z14.object({
2384
- command: z14.enum(["view", "create", "str_replace", "insert"]),
2683
+ command: z14.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2385
2684
  path: z14.string(),
2386
2685
  file_text: z14.string().optional(),
2387
2686
  insert_line: z14.number().int().optional(),
@@ -2391,6 +2690,32 @@ var textEditor_20250429InputSchema = lazySchema13(
2391
2690
  })
2392
2691
  )
2393
2692
  );
2693
+ var textEditor_20250124 = createProviderDefinedToolFactory7({
2694
+ id: "anthropic.text_editor_20250124",
2695
+ name: "str_replace_editor",
2696
+ inputSchema: textEditor_20250124InputSchema
2697
+ });
2698
+
2699
+ // src/tool/text-editor_20250429.ts
2700
+ import {
2701
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
2702
+ lazySchema as lazySchema14,
2703
+ zodSchema as zodSchema14
2704
+ } from "@ai-sdk/provider-utils";
2705
+ import { z as z15 } from "zod/v4";
2706
+ var textEditor_20250429InputSchema = lazySchema14(
2707
+ () => zodSchema14(
2708
+ z15.object({
2709
+ command: z15.enum(["view", "create", "str_replace", "insert"]),
2710
+ path: z15.string(),
2711
+ file_text: z15.string().optional(),
2712
+ insert_line: z15.number().int().optional(),
2713
+ new_str: z15.string().optional(),
2714
+ old_str: z15.string().optional(),
2715
+ view_range: z15.array(z15.number().int()).optional()
2716
+ })
2717
+ )
2718
+ );
2394
2719
  var textEditor_20250429 = createProviderDefinedToolFactory8({
2395
2720
  id: "anthropic.text_editor_20250429",
2396
2721
  name: "str_replace_based_edit_tool",
@@ -2428,6 +2753,19 @@ var anthropicTools = {
2428
2753
  * Tool name must be `code_execution`.
2429
2754
  */
2430
2755
  codeExecution_20250522,
2756
+ /**
2757
+ * Claude can analyze data, create visualizations, perform complex calculations,
2758
+ * run system commands, create and edit files, and process uploaded files directly within
2759
+ * the API conversation.
2760
+ *
2761
+ * The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
2762
+ * including writing code, in a secure, sandboxed environment.
2763
+ *
2764
+ * This is the latest version with enhanced Bash support and file operations.
2765
+ *
2766
+ * Tool name must be `code_execution`.
2767
+ */
2768
+ codeExecution_20250825,
2431
2769
  /**
2432
2770
  * Claude can interact with computer environments through the computer use tool, which
2433
2771
  * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.