@ai-sdk/anthropic 2.0.70 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 2.0.72
4
+
5
+ ### Patch Changes
6
+
7
+ - 98bd0e2: feat(provider/anthropic): support new code_execution tool
8
+
9
+ ## 2.0.71
10
+
11
+ ### Patch Changes
12
+
13
+ - b0a0821: feat (provider/anthropic): support passing metadata.user_id
14
+
3
15
  ## 2.0.70
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -147,6 +147,9 @@ declare const anthropicProviderOptions: z.ZodObject<{
147
147
  type: z.ZodLiteral<"ephemeral">;
148
148
  ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
149
149
  }, z.core.$strip>>;
150
+ metadata: z.ZodOptional<z.ZodObject<{
151
+ userId: z.ZodOptional<z.ZodString>;
152
+ }, z.core.$strip>>;
150
153
  container: z.ZodOptional<z.ZodObject<{
151
154
  id: z.ZodOptional<z.ZodString>;
152
155
  skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -368,6 +371,143 @@ declare const anthropicTools: {
368
371
  old_lines: number | null;
369
372
  old_start: number | null;
370
373
  }>;
374
+ /**
375
+ * Claude can analyze data, create visualizations, perform complex calculations,
376
+ * run system commands, create and edit files, and process uploaded files directly within
377
+ * the API conversation.
378
+ *
379
+ * The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
380
+ * including writing code, in a secure, sandboxed environment.
381
+ *
382
+ * This is the recommended version. Does not require a beta header.
383
+ *
384
+ * Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
385
+ */
386
+ codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
387
+ type: "programmatic-tool-call";
388
+ code: string;
389
+ } | {
390
+ type: "bash_code_execution";
391
+ command: string;
392
+ } | {
393
+ type: "text_editor_code_execution";
394
+ command: "view";
395
+ path: string;
396
+ } | {
397
+ type: "text_editor_code_execution";
398
+ command: "create";
399
+ path: string;
400
+ file_text?: string | null;
401
+ } | {
402
+ type: "text_editor_code_execution";
403
+ command: "str_replace";
404
+ path: string;
405
+ old_str: string;
406
+ new_str: string;
407
+ }, {
408
+ type: "code_execution_result";
409
+ stdout: string;
410
+ stderr: string;
411
+ return_code: number;
412
+ content: Array<{
413
+ type: "code_execution_output";
414
+ file_id: string;
415
+ }>;
416
+ } | {
417
+ type: "bash_code_execution_result";
418
+ content: Array<{
419
+ type: "bash_code_execution_output";
420
+ file_id: string;
421
+ }>;
422
+ stdout: string;
423
+ stderr: string;
424
+ return_code: number;
425
+ } | {
426
+ type: "bash_code_execution_tool_result_error";
427
+ error_code: string;
428
+ } | {
429
+ type: "text_editor_code_execution_tool_result_error";
430
+ error_code: string;
431
+ } | {
432
+ type: "text_editor_code_execution_view_result";
433
+ content: string;
434
+ file_type: string;
435
+ num_lines: number | null;
436
+ start_line: number | null;
437
+ total_lines: number | null;
438
+ } | {
439
+ type: "text_editor_code_execution_create_result";
440
+ is_file_update: boolean;
441
+ } | {
442
+ type: "text_editor_code_execution_str_replace_result";
443
+ lines: string[] | null;
444
+ new_lines: number | null;
445
+ new_start: number | null;
446
+ old_lines: number | null;
447
+ old_start: number | null;
448
+ }, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
449
+ type: "programmatic-tool-call";
450
+ code: string;
451
+ } | {
452
+ type: "bash_code_execution";
453
+ command: string;
454
+ } | {
455
+ type: "text_editor_code_execution";
456
+ command: "view";
457
+ path: string;
458
+ } | {
459
+ type: "text_editor_code_execution";
460
+ command: "create";
461
+ path: string;
462
+ file_text?: string | null;
463
+ } | {
464
+ type: "text_editor_code_execution";
465
+ command: "str_replace";
466
+ path: string;
467
+ old_str: string;
468
+ new_str: string;
469
+ }, {
470
+ type: "code_execution_result";
471
+ stdout: string;
472
+ stderr: string;
473
+ return_code: number;
474
+ content: Array<{
475
+ type: "code_execution_output";
476
+ file_id: string;
477
+ }>;
478
+ } | {
479
+ type: "bash_code_execution_result";
480
+ content: Array<{
481
+ type: "bash_code_execution_output";
482
+ file_id: string;
483
+ }>;
484
+ stdout: string;
485
+ stderr: string;
486
+ return_code: number;
487
+ } | {
488
+ type: "bash_code_execution_tool_result_error";
489
+ error_code: string;
490
+ } | {
491
+ type: "text_editor_code_execution_tool_result_error";
492
+ error_code: string;
493
+ } | {
494
+ type: "text_editor_code_execution_view_result";
495
+ content: string;
496
+ file_type: string;
497
+ num_lines: number | null;
498
+ start_line: number | null;
499
+ total_lines: number | null;
500
+ } | {
501
+ type: "text_editor_code_execution_create_result";
502
+ is_file_update: boolean;
503
+ } | {
504
+ type: "text_editor_code_execution_str_replace_result";
505
+ lines: string[] | null;
506
+ new_lines: number | null;
507
+ new_start: number | null;
508
+ old_lines: number | null;
509
+ old_start: number | null;
510
+ }>;
371
511
  /**
372
512
  * Claude can interact with computer environments through the computer use tool, which
373
513
  * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
package/dist/index.d.ts CHANGED
@@ -147,6 +147,9 @@ declare const anthropicProviderOptions: z.ZodObject<{
147
147
  type: z.ZodLiteral<"ephemeral">;
148
148
  ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
149
149
  }, z.core.$strip>>;
150
+ metadata: z.ZodOptional<z.ZodObject<{
151
+ userId: z.ZodOptional<z.ZodString>;
152
+ }, z.core.$strip>>;
150
153
  container: z.ZodOptional<z.ZodObject<{
151
154
  id: z.ZodOptional<z.ZodString>;
152
155
  skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -368,6 +371,143 @@ declare const anthropicTools: {
368
371
  old_lines: number | null;
369
372
  old_start: number | null;
370
373
  }>;
374
+ /**
375
+ * Claude can analyze data, create visualizations, perform complex calculations,
376
+ * run system commands, create and edit files, and process uploaded files directly within
377
+ * the API conversation.
378
+ *
379
+ * The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
380
+ * including writing code, in a secure, sandboxed environment.
381
+ *
382
+ * This is the recommended version. Does not require a beta header.
383
+ *
384
+ * Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
385
+ */
386
+ codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
387
+ type: "programmatic-tool-call";
388
+ code: string;
389
+ } | {
390
+ type: "bash_code_execution";
391
+ command: string;
392
+ } | {
393
+ type: "text_editor_code_execution";
394
+ command: "view";
395
+ path: string;
396
+ } | {
397
+ type: "text_editor_code_execution";
398
+ command: "create";
399
+ path: string;
400
+ file_text?: string | null;
401
+ } | {
402
+ type: "text_editor_code_execution";
403
+ command: "str_replace";
404
+ path: string;
405
+ old_str: string;
406
+ new_str: string;
407
+ }, {
408
+ type: "code_execution_result";
409
+ stdout: string;
410
+ stderr: string;
411
+ return_code: number;
412
+ content: Array<{
413
+ type: "code_execution_output";
414
+ file_id: string;
415
+ }>;
416
+ } | {
417
+ type: "bash_code_execution_result";
418
+ content: Array<{
419
+ type: "bash_code_execution_output";
420
+ file_id: string;
421
+ }>;
422
+ stdout: string;
423
+ stderr: string;
424
+ return_code: number;
425
+ } | {
426
+ type: "bash_code_execution_tool_result_error";
427
+ error_code: string;
428
+ } | {
429
+ type: "text_editor_code_execution_tool_result_error";
430
+ error_code: string;
431
+ } | {
432
+ type: "text_editor_code_execution_view_result";
433
+ content: string;
434
+ file_type: string;
435
+ num_lines: number | null;
436
+ start_line: number | null;
437
+ total_lines: number | null;
438
+ } | {
439
+ type: "text_editor_code_execution_create_result";
440
+ is_file_update: boolean;
441
+ } | {
442
+ type: "text_editor_code_execution_str_replace_result";
443
+ lines: string[] | null;
444
+ new_lines: number | null;
445
+ new_start: number | null;
446
+ old_lines: number | null;
447
+ old_start: number | null;
448
+ }, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
449
+ type: "programmatic-tool-call";
450
+ code: string;
451
+ } | {
452
+ type: "bash_code_execution";
453
+ command: string;
454
+ } | {
455
+ type: "text_editor_code_execution";
456
+ command: "view";
457
+ path: string;
458
+ } | {
459
+ type: "text_editor_code_execution";
460
+ command: "create";
461
+ path: string;
462
+ file_text?: string | null;
463
+ } | {
464
+ type: "text_editor_code_execution";
465
+ command: "str_replace";
466
+ path: string;
467
+ old_str: string;
468
+ new_str: string;
469
+ }, {
470
+ type: "code_execution_result";
471
+ stdout: string;
472
+ stderr: string;
473
+ return_code: number;
474
+ content: Array<{
475
+ type: "code_execution_output";
476
+ file_id: string;
477
+ }>;
478
+ } | {
479
+ type: "bash_code_execution_result";
480
+ content: Array<{
481
+ type: "bash_code_execution_output";
482
+ file_id: string;
483
+ }>;
484
+ stdout: string;
485
+ stderr: string;
486
+ return_code: number;
487
+ } | {
488
+ type: "bash_code_execution_tool_result_error";
489
+ error_code: string;
490
+ } | {
491
+ type: "text_editor_code_execution_tool_result_error";
492
+ error_code: string;
493
+ } | {
494
+ type: "text_editor_code_execution_view_result";
495
+ content: string;
496
+ file_type: string;
497
+ num_lines: number | null;
498
+ start_line: number | null;
499
+ total_lines: number | null;
500
+ } | {
501
+ type: "text_editor_code_execution_create_result";
502
+ is_file_update: boolean;
503
+ } | {
504
+ type: "text_editor_code_execution_str_replace_result";
505
+ lines: string[] | null;
506
+ new_lines: number | null;
507
+ new_start: number | null;
508
+ old_lines: number | null;
509
+ old_start: number | null;
510
+ }>;
371
511
  /**
372
512
  * Claude can interact with computer environments through the computer use tool, which
373
513
  * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.