@ai-sdk/anthropic 2.0.71 → 2.0.72

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.
@@ -998,6 +998,13 @@ async function prepareTools({
998
998
  });
999
999
  break;
1000
1000
  }
1001
+ case "anthropic.code_execution_20260120": {
1002
+ anthropicTools2.push({
1003
+ type: "code_execution_20260120",
1004
+ name: "code_execution"
1005
+ });
1006
+ break;
1007
+ }
1001
1008
  case "anthropic.computer_20250124": {
1002
1009
  betas.add("computer-use-2025-01-24");
1003
1010
  anthropicTools2.push({
@@ -2196,7 +2203,7 @@ var AnthropicMessagesLanguageModel = class {
2196
2203
  betas.add("skills-2025-10-02");
2197
2204
  betas.add("files-api-2025-04-14");
2198
2205
  if (!(tools == null ? void 0 : tools.some(
2199
- (tool) => tool.type === "provider-defined" && tool.id === "anthropic.code_execution_20250825"
2206
+ (tool) => tool.type === "provider-defined" && (tool.id === "anthropic.code_execution_20250825" || tool.id === "anthropic.code_execution_20260120")
2200
2207
  ))) {
2201
2208
  warnings.push({
2202
2209
  type: "other",
@@ -3307,17 +3314,126 @@ var bash_20250124 = createProviderDefinedToolFactory3({
3307
3314
  inputSchema: bash_20250124InputSchema
3308
3315
  });
3309
3316
 
3310
- // src/tool/computer_20241022.ts
3317
+ // src/tool/code-execution_20260120.ts
3311
3318
  import {
3312
- createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
3319
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
3313
3320
  lazySchema as lazySchema10,
3314
3321
  zodSchema as zodSchema10
3315
3322
  } from "@ai-sdk/provider-utils";
3316
3323
  import { z as z11 } from "zod/v4";
3317
- var computer_20241022InputSchema = lazySchema10(
3324
+ var codeExecution_20260120OutputSchema = lazySchema10(
3318
3325
  () => zodSchema10(
3319
- z11.object({
3320
- action: z11.enum([
3326
+ z11.discriminatedUnion("type", [
3327
+ z11.object({
3328
+ type: z11.literal("code_execution_result"),
3329
+ stdout: z11.string(),
3330
+ stderr: z11.string(),
3331
+ return_code: z11.number(),
3332
+ content: z11.array(
3333
+ z11.object({
3334
+ type: z11.literal("code_execution_output"),
3335
+ file_id: z11.string()
3336
+ })
3337
+ ).optional().default([])
3338
+ }),
3339
+ z11.object({
3340
+ type: z11.literal("bash_code_execution_result"),
3341
+ content: z11.array(
3342
+ z11.object({
3343
+ type: z11.literal("bash_code_execution_output"),
3344
+ file_id: z11.string()
3345
+ })
3346
+ ),
3347
+ stdout: z11.string(),
3348
+ stderr: z11.string(),
3349
+ return_code: z11.number()
3350
+ }),
3351
+ z11.object({
3352
+ type: z11.literal("bash_code_execution_tool_result_error"),
3353
+ error_code: z11.string()
3354
+ }),
3355
+ z11.object({
3356
+ type: z11.literal("text_editor_code_execution_tool_result_error"),
3357
+ error_code: z11.string()
3358
+ }),
3359
+ z11.object({
3360
+ type: z11.literal("text_editor_code_execution_view_result"),
3361
+ content: z11.string(),
3362
+ file_type: z11.string(),
3363
+ num_lines: z11.number().nullable(),
3364
+ start_line: z11.number().nullable(),
3365
+ total_lines: z11.number().nullable()
3366
+ }),
3367
+ z11.object({
3368
+ type: z11.literal("text_editor_code_execution_create_result"),
3369
+ is_file_update: z11.boolean()
3370
+ }),
3371
+ z11.object({
3372
+ type: z11.literal("text_editor_code_execution_str_replace_result"),
3373
+ lines: z11.array(z11.string()).nullable(),
3374
+ new_lines: z11.number().nullable(),
3375
+ new_start: z11.number().nullable(),
3376
+ old_lines: z11.number().nullable(),
3377
+ old_start: z11.number().nullable()
3378
+ })
3379
+ ])
3380
+ )
3381
+ );
3382
+ var codeExecution_20260120InputSchema = lazySchema10(
3383
+ () => zodSchema10(
3384
+ z11.discriminatedUnion("type", [
3385
+ z11.object({
3386
+ type: z11.literal("programmatic-tool-call"),
3387
+ code: z11.string()
3388
+ }),
3389
+ z11.object({
3390
+ type: z11.literal("bash_code_execution"),
3391
+ command: z11.string()
3392
+ }),
3393
+ z11.discriminatedUnion("command", [
3394
+ z11.object({
3395
+ type: z11.literal("text_editor_code_execution"),
3396
+ command: z11.literal("view"),
3397
+ path: z11.string()
3398
+ }),
3399
+ z11.object({
3400
+ type: z11.literal("text_editor_code_execution"),
3401
+ command: z11.literal("create"),
3402
+ path: z11.string(),
3403
+ file_text: z11.string().nullish()
3404
+ }),
3405
+ z11.object({
3406
+ type: z11.literal("text_editor_code_execution"),
3407
+ command: z11.literal("str_replace"),
3408
+ path: z11.string(),
3409
+ old_str: z11.string(),
3410
+ new_str: z11.string()
3411
+ })
3412
+ ])
3413
+ ])
3414
+ )
3415
+ );
3416
+ var factory6 = createProviderDefinedToolFactoryWithOutputSchema5({
3417
+ id: "anthropic.code_execution_20260120",
3418
+ name: "code_execution",
3419
+ inputSchema: codeExecution_20260120InputSchema,
3420
+ outputSchema: codeExecution_20260120OutputSchema
3421
+ });
3422
+ var codeExecution_20260120 = (args = {}) => {
3423
+ return factory6(args);
3424
+ };
3425
+
3426
+ // src/tool/computer_20241022.ts
3427
+ import {
3428
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
3429
+ lazySchema as lazySchema11,
3430
+ zodSchema as zodSchema11
3431
+ } from "@ai-sdk/provider-utils";
3432
+ import { z as z12 } from "zod/v4";
3433
+ var computer_20241022InputSchema = lazySchema11(
3434
+ () => zodSchema11(
3435
+ z12.object({
3436
+ action: z12.enum([
3321
3437
  "key",
3322
3438
  "type",
3323
3439
  "mouse_move",
@@ -3329,8 +3445,8 @@ var computer_20241022InputSchema = lazySchema10(
3329
3445
  "screenshot",
3330
3446
  "cursor_position"
3331
3447
  ]),
3332
- coordinate: z11.array(z11.number().int()).optional(),
3333
- text: z11.string().optional()
3448
+ coordinate: z12.array(z12.number().int()).optional(),
3449
+ text: z12.string().optional()
3334
3450
  })
3335
3451
  )
3336
3452
  );
@@ -3343,14 +3459,14 @@ var computer_20241022 = createProviderDefinedToolFactory4({
3343
3459
  // src/tool/computer_20250124.ts
3344
3460
  import {
3345
3461
  createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
3346
- lazySchema as lazySchema11,
3347
- zodSchema as zodSchema11
3462
+ lazySchema as lazySchema12,
3463
+ zodSchema as zodSchema12
3348
3464
  } from "@ai-sdk/provider-utils";
3349
- import { z as z12 } from "zod/v4";
3350
- var computer_20250124InputSchema = lazySchema11(
3351
- () => zodSchema11(
3352
- z12.object({
3353
- action: z12.enum([
3465
+ import { z as z13 } from "zod/v4";
3466
+ var computer_20250124InputSchema = lazySchema12(
3467
+ () => zodSchema12(
3468
+ z13.object({
3469
+ action: z13.enum([
3354
3470
  "key",
3355
3471
  "hold_key",
3356
3472
  "type",
@@ -3368,12 +3484,12 @@ var computer_20250124InputSchema = lazySchema11(
3368
3484
  "wait",
3369
3485
  "screenshot"
3370
3486
  ]),
3371
- coordinate: z12.tuple([z12.number().int(), z12.number().int()]).optional(),
3372
- duration: z12.number().optional(),
3373
- scroll_amount: z12.number().optional(),
3374
- scroll_direction: z12.enum(["up", "down", "left", "right"]).optional(),
3375
- start_coordinate: z12.tuple([z12.number().int(), z12.number().int()]).optional(),
3376
- text: z12.string().optional()
3487
+ coordinate: z13.tuple([z13.number().int(), z13.number().int()]).optional(),
3488
+ duration: z13.number().optional(),
3489
+ scroll_amount: z13.number().optional(),
3490
+ scroll_direction: z13.enum(["up", "down", "left", "right"]).optional(),
3491
+ start_coordinate: z13.tuple([z13.number().int(), z13.number().int()]).optional(),
3492
+ text: z13.string().optional()
3377
3493
  })
3378
3494
  )
3379
3495
  );
@@ -3386,43 +3502,43 @@ var computer_20250124 = createProviderDefinedToolFactory5({
3386
3502
  // src/tool/memory_20250818.ts
3387
3503
  import {
3388
3504
  createProviderDefinedToolFactory as createProviderDefinedToolFactory6,
3389
- lazySchema as lazySchema12,
3390
- zodSchema as zodSchema12
3505
+ lazySchema as lazySchema13,
3506
+ zodSchema as zodSchema13
3391
3507
  } from "@ai-sdk/provider-utils";
3392
- import { z as z13 } from "zod/v4";
3393
- var memory_20250818InputSchema = lazySchema12(
3394
- () => zodSchema12(
3395
- z13.discriminatedUnion("command", [
3396
- z13.object({
3397
- command: z13.literal("view"),
3398
- path: z13.string(),
3399
- view_range: z13.tuple([z13.number(), z13.number()]).optional()
3508
+ import { z as z14 } from "zod/v4";
3509
+ var memory_20250818InputSchema = lazySchema13(
3510
+ () => zodSchema13(
3511
+ z14.discriminatedUnion("command", [
3512
+ z14.object({
3513
+ command: z14.literal("view"),
3514
+ path: z14.string(),
3515
+ view_range: z14.tuple([z14.number(), z14.number()]).optional()
3400
3516
  }),
3401
- z13.object({
3402
- command: z13.literal("create"),
3403
- path: z13.string(),
3404
- file_text: z13.string()
3517
+ z14.object({
3518
+ command: z14.literal("create"),
3519
+ path: z14.string(),
3520
+ file_text: z14.string()
3405
3521
  }),
3406
- z13.object({
3407
- command: z13.literal("str_replace"),
3408
- path: z13.string(),
3409
- old_str: z13.string(),
3410
- new_str: z13.string()
3522
+ z14.object({
3523
+ command: z14.literal("str_replace"),
3524
+ path: z14.string(),
3525
+ old_str: z14.string(),
3526
+ new_str: z14.string()
3411
3527
  }),
3412
- z13.object({
3413
- command: z13.literal("insert"),
3414
- path: z13.string(),
3415
- insert_line: z13.number(),
3416
- insert_text: z13.string()
3528
+ z14.object({
3529
+ command: z14.literal("insert"),
3530
+ path: z14.string(),
3531
+ insert_line: z14.number(),
3532
+ insert_text: z14.string()
3417
3533
  }),
3418
- z13.object({
3419
- command: z13.literal("delete"),
3420
- path: z13.string()
3534
+ z14.object({
3535
+ command: z14.literal("delete"),
3536
+ path: z14.string()
3421
3537
  }),
3422
- z13.object({
3423
- command: z13.literal("rename"),
3424
- old_path: z13.string(),
3425
- new_path: z13.string()
3538
+ z14.object({
3539
+ command: z14.literal("rename"),
3540
+ old_path: z14.string(),
3541
+ new_path: z14.string()
3426
3542
  })
3427
3543
  ])
3428
3544
  )
@@ -3436,37 +3552,11 @@ var memory_20250818 = createProviderDefinedToolFactory6({
3436
3552
  // src/tool/text-editor_20241022.ts
3437
3553
  import {
3438
3554
  createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
3439
- lazySchema as lazySchema13,
3440
- zodSchema as zodSchema13
3441
- } from "@ai-sdk/provider-utils";
3442
- import { z as z14 } from "zod/v4";
3443
- var textEditor_20241022InputSchema = lazySchema13(
3444
- () => zodSchema13(
3445
- z14.object({
3446
- command: z14.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
3447
- path: z14.string(),
3448
- file_text: z14.string().optional(),
3449
- insert_line: z14.number().int().optional(),
3450
- new_str: z14.string().optional(),
3451
- old_str: z14.string().optional(),
3452
- view_range: z14.array(z14.number().int()).optional()
3453
- })
3454
- )
3455
- );
3456
- var textEditor_20241022 = createProviderDefinedToolFactory7({
3457
- id: "anthropic.text_editor_20241022",
3458
- name: "str_replace_editor",
3459
- inputSchema: textEditor_20241022InputSchema
3460
- });
3461
-
3462
- // src/tool/text-editor_20250124.ts
3463
- import {
3464
- createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
3465
3555
  lazySchema as lazySchema14,
3466
3556
  zodSchema as zodSchema14
3467
3557
  } from "@ai-sdk/provider-utils";
3468
3558
  import { z as z15 } from "zod/v4";
3469
- var textEditor_20250124InputSchema = lazySchema14(
3559
+ var textEditor_20241022InputSchema = lazySchema14(
3470
3560
  () => zodSchema14(
3471
3561
  z15.object({
3472
3562
  command: z15.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -3479,23 +3569,23 @@ var textEditor_20250124InputSchema = lazySchema14(
3479
3569
  })
3480
3570
  )
3481
3571
  );
3482
- var textEditor_20250124 = createProviderDefinedToolFactory8({
3483
- id: "anthropic.text_editor_20250124",
3572
+ var textEditor_20241022 = createProviderDefinedToolFactory7({
3573
+ id: "anthropic.text_editor_20241022",
3484
3574
  name: "str_replace_editor",
3485
- inputSchema: textEditor_20250124InputSchema
3575
+ inputSchema: textEditor_20241022InputSchema
3486
3576
  });
3487
3577
 
3488
- // src/tool/text-editor_20250429.ts
3578
+ // src/tool/text-editor_20250124.ts
3489
3579
  import {
3490
- createProviderDefinedToolFactory as createProviderDefinedToolFactory9,
3580
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
3491
3581
  lazySchema as lazySchema15,
3492
3582
  zodSchema as zodSchema15
3493
3583
  } from "@ai-sdk/provider-utils";
3494
3584
  import { z as z16 } from "zod/v4";
3495
- var textEditor_20250429InputSchema = lazySchema15(
3585
+ var textEditor_20250124InputSchema = lazySchema15(
3496
3586
  () => zodSchema15(
3497
3587
  z16.object({
3498
- command: z16.enum(["view", "create", "str_replace", "insert"]),
3588
+ command: z16.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
3499
3589
  path: z16.string(),
3500
3590
  file_text: z16.string().optional(),
3501
3591
  insert_line: z16.number().int().optional(),
@@ -3505,6 +3595,32 @@ var textEditor_20250429InputSchema = lazySchema15(
3505
3595
  })
3506
3596
  )
3507
3597
  );
3598
+ var textEditor_20250124 = createProviderDefinedToolFactory8({
3599
+ id: "anthropic.text_editor_20250124",
3600
+ name: "str_replace_editor",
3601
+ inputSchema: textEditor_20250124InputSchema
3602
+ });
3603
+
3604
+ // src/tool/text-editor_20250429.ts
3605
+ import {
3606
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory9,
3607
+ lazySchema as lazySchema16,
3608
+ zodSchema as zodSchema16
3609
+ } from "@ai-sdk/provider-utils";
3610
+ import { z as z17 } from "zod/v4";
3611
+ var textEditor_20250429InputSchema = lazySchema16(
3612
+ () => zodSchema16(
3613
+ z17.object({
3614
+ command: z17.enum(["view", "create", "str_replace", "insert"]),
3615
+ path: z17.string(),
3616
+ file_text: z17.string().optional(),
3617
+ insert_line: z17.number().int().optional(),
3618
+ new_str: z17.string().optional(),
3619
+ old_str: z17.string().optional(),
3620
+ view_range: z17.array(z17.number().int()).optional()
3621
+ })
3622
+ )
3623
+ );
3508
3624
  var textEditor_20250429 = createProviderDefinedToolFactory9({
3509
3625
  id: "anthropic.text_editor_20250429",
3510
3626
  name: "str_replace_based_edit_tool",
@@ -3555,6 +3671,19 @@ var anthropicTools = {
3555
3671
  * Tool name must be `code_execution`.
3556
3672
  */
3557
3673
  codeExecution_20250825,
3674
+ /**
3675
+ * Claude can analyze data, create visualizations, perform complex calculations,
3676
+ * run system commands, create and edit files, and process uploaded files directly within
3677
+ * the API conversation.
3678
+ *
3679
+ * The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
3680
+ * including writing code, in a secure, sandboxed environment.
3681
+ *
3682
+ * This is the recommended version. Does not require a beta header.
3683
+ *
3684
+ * Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
3685
+ */
3686
+ codeExecution_20260120,
3558
3687
  /**
3559
3688
  * Claude can interact with computer environments through the computer use tool, which
3560
3689
  * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.