@ai-sdk/anthropic 2.0.101 → 2.0.103

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.
@@ -29,7 +29,7 @@ module.exports = __toCommonJS(index_exports);
29
29
 
30
30
  // src/anthropic-messages-language-model.ts
31
31
  var import_provider3 = require("@ai-sdk/provider");
32
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
32
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/anthropic-error.ts
35
35
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -115,7 +115,9 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
115
115
  type: import_v42.z.literal("tool_use"),
116
116
  id: import_v42.z.string(),
117
117
  name: import_v42.z.string(),
118
- input: import_v42.z.unknown()
118
+ input: import_v42.z.unknown(),
119
+ // Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
120
+ toolset_name: import_v42.z.string().nullish()
119
121
  }),
120
122
  import_v42.z.object({
121
123
  type: import_v42.z.literal("server_tool_use"),
@@ -342,7 +344,9 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
342
344
  import_v42.z.object({
343
345
  type: import_v42.z.literal("tool_use"),
344
346
  id: import_v42.z.string(),
345
- name: import_v42.z.string()
347
+ name: import_v42.z.string(),
348
+ // Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
349
+ toolset_name: import_v42.z.string().nullish()
346
350
  }),
347
351
  import_v42.z.object({
348
352
  type: import_v42.z.literal("redacted_thinking"),
@@ -669,7 +673,7 @@ var anthropicSystemMessageProviderOptions = import_v43.z.object({
669
673
  clearAt: import_v43.z.literal("next_user_message").optional(),
670
674
  /**
671
675
  * Overrides the effort for the turn following this mid-conversation system
672
- * message. The required `mid-conversation-effort-2026-08-01` beta is added
676
+ * message. The required `mid-conversation-output-config-2026-07-01` beta is added
673
677
  * automatically.
674
678
  */
675
679
  effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
@@ -720,7 +724,7 @@ var anthropicProviderOptions = import_v43.z.object({
720
724
  *
721
725
  * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
722
726
  * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
723
- * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Fable 5.1).
727
+ * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Opus 5.5 and Fable 5.1).
724
728
  */
725
729
  structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
726
730
  /**
@@ -728,6 +732,11 @@ var anthropicProviderOptions = import_v43.z.object({
728
732
  *
729
733
  * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
730
734
  * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
735
+ *
736
+ * Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
737
+ * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
738
+ * provider drops the unsupported setting, emits a warning, and sends an
739
+ * adaptive thinking request. Use `effort` to control how much they think.
731
740
  */
732
741
  thinking: import_v43.z.union([
733
742
  import_v43.z.object({
@@ -973,30 +982,91 @@ var CacheControlValidator = class {
973
982
  }
974
983
  };
975
984
 
976
- // src/tool/text-editor_20250728.ts
985
+ // src/tool/computer-toolset_20260801.ts
977
986
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
978
987
  var import_v44 = require("zod/v4");
979
- var textEditor_20250728ArgsSchema = (0, import_provider_utils3.lazySchema)(
988
+ var computerToolset_20260801Members = [
989
+ "screenshot",
990
+ "zoom",
991
+ "left_click",
992
+ "right_click",
993
+ "middle_click",
994
+ "double_click",
995
+ "triple_click",
996
+ "left_click_drag",
997
+ "mouse_move",
998
+ "left_mouse_down",
999
+ "left_mouse_up",
1000
+ "cursor_position",
1001
+ "scroll",
1002
+ "type",
1003
+ "key",
1004
+ "hold_key",
1005
+ "wait"
1006
+ ];
1007
+ var computerToolset_20260801InputSchema = (0, import_provider_utils3.lazySchema)(
980
1008
  () => (0, import_provider_utils3.zodSchema)(
981
1009
  import_v44.z.object({
982
- maxCharacters: import_v44.z.number().optional()
1010
+ action: import_v44.z.enum(computerToolset_20260801Members),
1011
+ coordinate: import_v44.z.tuple([import_v44.z.number().int(), import_v44.z.number().int()]).optional(),
1012
+ duration: import_v44.z.number().optional(),
1013
+ region: import_v44.z.tuple([
1014
+ import_v44.z.number().int(),
1015
+ import_v44.z.number().int(),
1016
+ import_v44.z.number().int(),
1017
+ import_v44.z.number().int()
1018
+ ]).optional(),
1019
+ repeat: import_v44.z.number().int().optional(),
1020
+ scroll_amount: import_v44.z.number().optional(),
1021
+ scroll_direction: import_v44.z.enum(["up", "down", "left", "right"]).optional(),
1022
+ start_coordinate: import_v44.z.tuple([import_v44.z.number().int(), import_v44.z.number().int()]).optional(),
1023
+ text: import_v44.z.string().optional()
983
1024
  })
984
1025
  )
985
1026
  );
986
- var textEditor_20250728InputSchema = (0, import_provider_utils3.lazySchema)(
1027
+ var computerToolset_20260801ArgsSchema = (0, import_provider_utils3.lazySchema)(
987
1028
  () => (0, import_provider_utils3.zodSchema)(
988
1029
  import_v44.z.object({
989
- command: import_v44.z.enum(["view", "create", "str_replace", "insert"]),
990
- path: import_v44.z.string(),
991
- file_text: import_v44.z.string().optional(),
992
- insert_line: import_v44.z.number().int().optional(),
993
- new_str: import_v44.z.string().optional(),
994
- old_str: import_v44.z.string().optional(),
995
- view_range: import_v44.z.array(import_v44.z.number().int()).optional()
1030
+ configs: import_v44.z.partialRecord(
1031
+ import_v44.z.enum(computerToolset_20260801Members),
1032
+ import_v44.z.object({
1033
+ enabled: import_v44.z.boolean().optional(),
1034
+ deferLoading: import_v44.z.boolean().optional()
1035
+ })
1036
+ ).optional()
1037
+ })
1038
+ )
1039
+ );
1040
+ var computerToolset_20260801 = (0, import_provider_utils3.createProviderDefinedToolFactory)({
1041
+ id: "anthropic.computer_toolset_20260801",
1042
+ name: "computer",
1043
+ inputSchema: computerToolset_20260801InputSchema
1044
+ });
1045
+
1046
+ // src/tool/text-editor_20250728.ts
1047
+ var import_provider_utils4 = require("@ai-sdk/provider-utils");
1048
+ var import_v45 = require("zod/v4");
1049
+ var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
1050
+ () => (0, import_provider_utils4.zodSchema)(
1051
+ import_v45.z.object({
1052
+ maxCharacters: import_v45.z.number().optional()
996
1053
  })
997
1054
  )
998
1055
  );
999
- var factory = (0, import_provider_utils3.createProviderDefinedToolFactory)({
1056
+ var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
1057
+ () => (0, import_provider_utils4.zodSchema)(
1058
+ import_v45.z.object({
1059
+ command: import_v45.z.enum(["view", "create", "str_replace", "insert"]),
1060
+ path: import_v45.z.string(),
1061
+ file_text: import_v45.z.string().optional(),
1062
+ insert_line: import_v45.z.number().int().optional(),
1063
+ new_str: import_v45.z.string().optional(),
1064
+ old_str: import_v45.z.string().optional(),
1065
+ view_range: import_v45.z.array(import_v45.z.number().int()).optional()
1066
+ })
1067
+ )
1068
+ );
1069
+ var factory = (0, import_provider_utils4.createProviderDefinedToolFactory)({
1000
1070
  id: "anthropic.text_editor_20250728",
1001
1071
  name: "str_replace_based_edit_tool",
1002
1072
  inputSchema: textEditor_20250728InputSchema
@@ -1006,45 +1076,45 @@ var textEditor_20250728 = (args = {}) => {
1006
1076
  };
1007
1077
 
1008
1078
  // src/tool/web-search_20250305.ts
1009
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
1010
- var import_v45 = require("zod/v4");
1011
- var webSearch_20250305ArgsSchema = (0, import_provider_utils4.lazySchema)(
1012
- () => (0, import_provider_utils4.zodSchema)(
1013
- import_v45.z.object({
1014
- maxUses: import_v45.z.number().optional(),
1015
- allowedDomains: import_v45.z.array(import_v45.z.string()).optional(),
1016
- blockedDomains: import_v45.z.array(import_v45.z.string()).optional(),
1017
- userLocation: import_v45.z.object({
1018
- type: import_v45.z.literal("approximate"),
1019
- city: import_v45.z.string().optional(),
1020
- region: import_v45.z.string().optional(),
1021
- country: import_v45.z.string().optional(),
1022
- timezone: import_v45.z.string().optional()
1079
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1080
+ var import_v46 = require("zod/v4");
1081
+ var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
1082
+ () => (0, import_provider_utils5.zodSchema)(
1083
+ import_v46.z.object({
1084
+ maxUses: import_v46.z.number().optional(),
1085
+ allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
1086
+ blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
1087
+ userLocation: import_v46.z.object({
1088
+ type: import_v46.z.literal("approximate"),
1089
+ city: import_v46.z.string().optional(),
1090
+ region: import_v46.z.string().optional(),
1091
+ country: import_v46.z.string().optional(),
1092
+ timezone: import_v46.z.string().optional()
1023
1093
  }).optional()
1024
1094
  })
1025
1095
  )
1026
1096
  );
1027
- var webSearch_20250305OutputSchema = (0, import_provider_utils4.lazySchema)(
1028
- () => (0, import_provider_utils4.zodSchema)(
1029
- import_v45.z.array(
1030
- import_v45.z.object({
1031
- url: import_v45.z.string(),
1032
- title: import_v45.z.string().nullable(),
1033
- pageAge: import_v45.z.string().nullable(),
1034
- encryptedContent: import_v45.z.string(),
1035
- type: import_v45.z.literal("web_search_result")
1097
+ var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
1098
+ () => (0, import_provider_utils5.zodSchema)(
1099
+ import_v46.z.array(
1100
+ import_v46.z.object({
1101
+ url: import_v46.z.string(),
1102
+ title: import_v46.z.string().nullable(),
1103
+ pageAge: import_v46.z.string().nullable(),
1104
+ encryptedContent: import_v46.z.string(),
1105
+ type: import_v46.z.literal("web_search_result")
1036
1106
  })
1037
1107
  )
1038
1108
  )
1039
1109
  );
1040
- var webSearch_20250305InputSchema = (0, import_provider_utils4.lazySchema)(
1041
- () => (0, import_provider_utils4.zodSchema)(
1042
- import_v45.z.object({
1043
- query: import_v45.z.string()
1110
+ var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
1111
+ () => (0, import_provider_utils5.zodSchema)(
1112
+ import_v46.z.object({
1113
+ query: import_v46.z.string()
1044
1114
  })
1045
1115
  )
1046
1116
  );
1047
- var factory2 = (0, import_provider_utils4.createProviderDefinedToolFactoryWithOutputSchema)({
1117
+ var factory2 = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
1048
1118
  id: "anthropic.web_search_20250305",
1049
1119
  name: "web_search",
1050
1120
  inputSchema: webSearch_20250305InputSchema,
@@ -1055,53 +1125,53 @@ var webSearch_20250305 = (args = {}) => {
1055
1125
  };
1056
1126
 
1057
1127
  // src/tool/web-fetch-20250910.ts
1058
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
1059
- var import_v46 = require("zod/v4");
1060
- var webFetch_20250910ArgsSchema = (0, import_provider_utils5.lazySchema)(
1061
- () => (0, import_provider_utils5.zodSchema)(
1062
- import_v46.z.object({
1063
- maxUses: import_v46.z.number().optional(),
1064
- allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
1065
- blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
1066
- citations: import_v46.z.object({ enabled: import_v46.z.boolean() }).optional(),
1067
- maxContentTokens: import_v46.z.number().optional()
1128
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
1129
+ var import_v47 = require("zod/v4");
1130
+ var webFetch_20250910ArgsSchema = (0, import_provider_utils6.lazySchema)(
1131
+ () => (0, import_provider_utils6.zodSchema)(
1132
+ import_v47.z.object({
1133
+ maxUses: import_v47.z.number().optional(),
1134
+ allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1135
+ blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1136
+ citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
1137
+ maxContentTokens: import_v47.z.number().optional()
1068
1138
  })
1069
1139
  )
1070
1140
  );
1071
- var webFetch_20250910OutputSchema = (0, import_provider_utils5.lazySchema)(
1072
- () => (0, import_provider_utils5.zodSchema)(
1073
- import_v46.z.object({
1074
- type: import_v46.z.literal("web_fetch_result"),
1075
- url: import_v46.z.string(),
1076
- content: import_v46.z.object({
1077
- type: import_v46.z.literal("document"),
1078
- title: import_v46.z.string().nullable(),
1079
- citations: import_v46.z.object({ enabled: import_v46.z.boolean() }).optional(),
1080
- source: import_v46.z.union([
1081
- import_v46.z.object({
1082
- type: import_v46.z.literal("base64"),
1083
- mediaType: import_v46.z.literal("application/pdf"),
1084
- data: import_v46.z.string()
1141
+ var webFetch_20250910OutputSchema = (0, import_provider_utils6.lazySchema)(
1142
+ () => (0, import_provider_utils6.zodSchema)(
1143
+ import_v47.z.object({
1144
+ type: import_v47.z.literal("web_fetch_result"),
1145
+ url: import_v47.z.string(),
1146
+ content: import_v47.z.object({
1147
+ type: import_v47.z.literal("document"),
1148
+ title: import_v47.z.string().nullable(),
1149
+ citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
1150
+ source: import_v47.z.union([
1151
+ import_v47.z.object({
1152
+ type: import_v47.z.literal("base64"),
1153
+ mediaType: import_v47.z.literal("application/pdf"),
1154
+ data: import_v47.z.string()
1085
1155
  }),
1086
- import_v46.z.object({
1087
- type: import_v46.z.literal("text"),
1088
- mediaType: import_v46.z.literal("text/plain"),
1089
- data: import_v46.z.string()
1156
+ import_v47.z.object({
1157
+ type: import_v47.z.literal("text"),
1158
+ mediaType: import_v47.z.literal("text/plain"),
1159
+ data: import_v47.z.string()
1090
1160
  })
1091
1161
  ])
1092
1162
  }),
1093
- retrievedAt: import_v46.z.string().nullable()
1163
+ retrievedAt: import_v47.z.string().nullable()
1094
1164
  })
1095
1165
  )
1096
1166
  );
1097
- var webFetch_20250910InputSchema = (0, import_provider_utils5.lazySchema)(
1098
- () => (0, import_provider_utils5.zodSchema)(
1099
- import_v46.z.object({
1100
- url: import_v46.z.string()
1167
+ var webFetch_20250910InputSchema = (0, import_provider_utils6.lazySchema)(
1168
+ () => (0, import_provider_utils6.zodSchema)(
1169
+ import_v47.z.object({
1170
+ url: import_v47.z.string()
1101
1171
  })
1102
1172
  )
1103
1173
  );
1104
- var factory3 = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
1174
+ var factory3 = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
1105
1175
  id: "anthropic.web_fetch_20250910",
1106
1176
  name: "web_fetch",
1107
1177
  inputSchema: webFetch_20250910InputSchema,
@@ -1112,12 +1182,13 @@ var webFetch_20250910 = (args = {}) => {
1112
1182
  };
1113
1183
 
1114
1184
  // src/anthropic-prepare-tools.ts
1115
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1185
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1116
1186
  async function prepareTools({
1117
1187
  tools,
1118
1188
  toolChoice,
1119
1189
  disableParallelToolUse,
1120
- cacheControlValidator
1190
+ cacheControlValidator,
1191
+ rejectsForcedToolUse = false
1121
1192
  }) {
1122
1193
  var _a;
1123
1194
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
@@ -1172,6 +1243,31 @@ async function prepareTools({
1172
1243
  });
1173
1244
  break;
1174
1245
  }
1246
+ case "anthropic.computer_toolset_20260801": {
1247
+ const args = await (0, import_provider_utils7.validateTypes)({
1248
+ value: tool.args,
1249
+ schema: computerToolset_20260801ArgsSchema
1250
+ });
1251
+ const configs = args.configs != null ? Object.fromEntries(
1252
+ Object.entries(args.configs).map(([member, config]) => [
1253
+ member,
1254
+ {
1255
+ ...(config == null ? void 0 : config.enabled) != null && {
1256
+ enabled: config.enabled
1257
+ },
1258
+ ...(config == null ? void 0 : config.deferLoading) != null && {
1259
+ defer_loading: config.deferLoading
1260
+ }
1261
+ }
1262
+ ])
1263
+ ) : void 0;
1264
+ anthropicTools2.push({
1265
+ type: "computer_toolset_20260801",
1266
+ ...configs != null && { configs },
1267
+ cache_control: void 0
1268
+ });
1269
+ break;
1270
+ }
1175
1271
  case "anthropic.computer_20250124": {
1176
1272
  betas.add("computer-use-2025-01-24");
1177
1273
  anthropicTools2.push({
@@ -1224,7 +1320,7 @@ async function prepareTools({
1224
1320
  break;
1225
1321
  }
1226
1322
  case "anthropic.text_editor_20250728": {
1227
- const args = await (0, import_provider_utils6.validateTypes)({
1323
+ const args = await (0, import_provider_utils7.validateTypes)({
1228
1324
  value: tool.args,
1229
1325
  schema: textEditor_20250728ArgsSchema
1230
1326
  });
@@ -1264,7 +1360,7 @@ async function prepareTools({
1264
1360
  }
1265
1361
  case "anthropic.web_fetch_20250910": {
1266
1362
  betas.add("web-fetch-2025-09-10");
1267
- const args = await (0, import_provider_utils6.validateTypes)({
1363
+ const args = await (0, import_provider_utils7.validateTypes)({
1268
1364
  value: tool.args,
1269
1365
  schema: webFetch_20250910ArgsSchema
1270
1366
  });
@@ -1281,7 +1377,7 @@ async function prepareTools({
1281
1377
  break;
1282
1378
  }
1283
1379
  case "anthropic.web_search_20250305": {
1284
- const args = await (0, import_provider_utils6.validateTypes)({
1380
+ const args = await (0, import_provider_utils7.validateTypes)({
1285
1381
  value: tool.args,
1286
1382
  schema: webSearch_20250305ArgsSchema
1287
1383
  });
@@ -1330,6 +1426,22 @@ async function prepareTools({
1330
1426
  betas
1331
1427
  };
1332
1428
  case "required":
1429
+ if (rejectsForcedToolUse) {
1430
+ toolWarnings.push({
1431
+ type: "unsupported-setting",
1432
+ setting: "toolChoice",
1433
+ details: `toolChoice 'required' is not supported by this model because it rejects forced tool use. Using 'auto' instead. Instruct the model to use a tool in the prompt and verify that a tool call was made.`
1434
+ });
1435
+ return {
1436
+ tools: anthropicTools2,
1437
+ toolChoice: {
1438
+ type: "auto",
1439
+ disable_parallel_tool_use: disableParallelToolUse
1440
+ },
1441
+ toolWarnings,
1442
+ betas
1443
+ };
1444
+ }
1333
1445
  return {
1334
1446
  tools: anthropicTools2,
1335
1447
  toolChoice: {
@@ -1342,6 +1454,24 @@ async function prepareTools({
1342
1454
  case "none":
1343
1455
  return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
1344
1456
  case "tool":
1457
+ if (rejectsForcedToolUse) {
1458
+ toolWarnings.push({
1459
+ type: "unsupported-setting",
1460
+ setting: "toolChoice",
1461
+ details: `toolChoice 'tool' is not supported by this model because it rejects forced tool use. Only the '${toolChoice.toolName}' tool is sent with 'auto' tool choice. Instruct the model to use the tool in the prompt and verify that a tool call was made.`
1462
+ });
1463
+ return {
1464
+ tools: anthropicTools2.filter(
1465
+ (tool) => "name" in tool && tool.name === toolChoice.toolName
1466
+ ),
1467
+ toolChoice: {
1468
+ type: "auto",
1469
+ disable_parallel_tool_use: disableParallelToolUse
1470
+ },
1471
+ toolWarnings,
1472
+ betas
1473
+ };
1474
+ }
1345
1475
  return {
1346
1476
  tools: anthropicTools2,
1347
1477
  toolChoice: {
@@ -1363,29 +1493,29 @@ async function prepareTools({
1363
1493
 
1364
1494
  // src/convert-to-anthropic-messages-prompt.ts
1365
1495
  var import_provider2 = require("@ai-sdk/provider");
1366
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1496
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
1367
1497
 
1368
1498
  // src/tool/code-execution_20250522.ts
1369
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
1370
- var import_v47 = require("zod/v4");
1371
- var codeExecution_20250522OutputSchema = (0, import_provider_utils7.lazySchema)(
1372
- () => (0, import_provider_utils7.zodSchema)(
1373
- import_v47.z.object({
1374
- type: import_v47.z.literal("code_execution_result"),
1375
- stdout: import_v47.z.string(),
1376
- stderr: import_v47.z.string(),
1377
- return_code: import_v47.z.number()
1499
+ var import_provider_utils8 = require("@ai-sdk/provider-utils");
1500
+ var import_v48 = require("zod/v4");
1501
+ var codeExecution_20250522OutputSchema = (0, import_provider_utils8.lazySchema)(
1502
+ () => (0, import_provider_utils8.zodSchema)(
1503
+ import_v48.z.object({
1504
+ type: import_v48.z.literal("code_execution_result"),
1505
+ stdout: import_v48.z.string(),
1506
+ stderr: import_v48.z.string(),
1507
+ return_code: import_v48.z.number()
1378
1508
  })
1379
1509
  )
1380
1510
  );
1381
- var codeExecution_20250522InputSchema = (0, import_provider_utils7.lazySchema)(
1382
- () => (0, import_provider_utils7.zodSchema)(
1383
- import_v47.z.object({
1384
- code: import_v47.z.string()
1511
+ var codeExecution_20250522InputSchema = (0, import_provider_utils8.lazySchema)(
1512
+ () => (0, import_provider_utils8.zodSchema)(
1513
+ import_v48.z.object({
1514
+ code: import_v48.z.string()
1385
1515
  })
1386
1516
  )
1387
1517
  );
1388
- var factory4 = (0, import_provider_utils7.createProviderDefinedToolFactoryWithOutputSchema)({
1518
+ var factory4 = (0, import_provider_utils8.createProviderDefinedToolFactoryWithOutputSchema)({
1389
1519
  id: "anthropic.code_execution_20250522",
1390
1520
  name: "code_execution",
1391
1521
  inputSchema: codeExecution_20250522InputSchema,
@@ -1396,85 +1526,85 @@ var codeExecution_20250522 = (args = {}) => {
1396
1526
  };
1397
1527
 
1398
1528
  // src/tool/code-execution_20250825.ts
1399
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
1400
- var import_v48 = require("zod/v4");
1401
- var codeExecution_20250825OutputSchema = (0, import_provider_utils8.lazySchema)(
1402
- () => (0, import_provider_utils8.zodSchema)(
1403
- import_v48.z.discriminatedUnion("type", [
1404
- import_v48.z.object({
1405
- type: import_v48.z.literal("bash_code_execution_result"),
1406
- content: import_v48.z.array(
1407
- import_v48.z.object({
1408
- type: import_v48.z.literal("bash_code_execution_output"),
1409
- file_id: import_v48.z.string()
1529
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1530
+ var import_v49 = require("zod/v4");
1531
+ var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
1532
+ () => (0, import_provider_utils9.zodSchema)(
1533
+ import_v49.z.discriminatedUnion("type", [
1534
+ import_v49.z.object({
1535
+ type: import_v49.z.literal("bash_code_execution_result"),
1536
+ content: import_v49.z.array(
1537
+ import_v49.z.object({
1538
+ type: import_v49.z.literal("bash_code_execution_output"),
1539
+ file_id: import_v49.z.string()
1410
1540
  })
1411
1541
  ),
1412
- stdout: import_v48.z.string(),
1413
- stderr: import_v48.z.string(),
1414
- return_code: import_v48.z.number()
1542
+ stdout: import_v49.z.string(),
1543
+ stderr: import_v49.z.string(),
1544
+ return_code: import_v49.z.number()
1415
1545
  }),
1416
- import_v48.z.object({
1417
- type: import_v48.z.literal("bash_code_execution_tool_result_error"),
1418
- error_code: import_v48.z.string()
1546
+ import_v49.z.object({
1547
+ type: import_v49.z.literal("bash_code_execution_tool_result_error"),
1548
+ error_code: import_v49.z.string()
1419
1549
  }),
1420
- import_v48.z.object({
1421
- type: import_v48.z.literal("text_editor_code_execution_tool_result_error"),
1422
- error_code: import_v48.z.string()
1550
+ import_v49.z.object({
1551
+ type: import_v49.z.literal("text_editor_code_execution_tool_result_error"),
1552
+ error_code: import_v49.z.string()
1423
1553
  }),
1424
- import_v48.z.object({
1425
- type: import_v48.z.literal("text_editor_code_execution_view_result"),
1426
- content: import_v48.z.string(),
1427
- file_type: import_v48.z.string(),
1428
- num_lines: import_v48.z.number().nullable(),
1429
- start_line: import_v48.z.number().nullable(),
1430
- total_lines: import_v48.z.number().nullable()
1554
+ import_v49.z.object({
1555
+ type: import_v49.z.literal("text_editor_code_execution_view_result"),
1556
+ content: import_v49.z.string(),
1557
+ file_type: import_v49.z.string(),
1558
+ num_lines: import_v49.z.number().nullable(),
1559
+ start_line: import_v49.z.number().nullable(),
1560
+ total_lines: import_v49.z.number().nullable()
1431
1561
  }),
1432
- import_v48.z.object({
1433
- type: import_v48.z.literal("text_editor_code_execution_create_result"),
1434
- is_file_update: import_v48.z.boolean()
1562
+ import_v49.z.object({
1563
+ type: import_v49.z.literal("text_editor_code_execution_create_result"),
1564
+ is_file_update: import_v49.z.boolean()
1435
1565
  }),
1436
- import_v48.z.object({
1437
- type: import_v48.z.literal("text_editor_code_execution_str_replace_result"),
1438
- lines: import_v48.z.array(import_v48.z.string()).nullable(),
1439
- new_lines: import_v48.z.number().nullable(),
1440
- new_start: import_v48.z.number().nullable(),
1441
- old_lines: import_v48.z.number().nullable(),
1442
- old_start: import_v48.z.number().nullable()
1566
+ import_v49.z.object({
1567
+ type: import_v49.z.literal("text_editor_code_execution_str_replace_result"),
1568
+ lines: import_v49.z.array(import_v49.z.string()).nullable(),
1569
+ new_lines: import_v49.z.number().nullable(),
1570
+ new_start: import_v49.z.number().nullable(),
1571
+ old_lines: import_v49.z.number().nullable(),
1572
+ old_start: import_v49.z.number().nullable()
1443
1573
  })
1444
1574
  ])
1445
1575
  )
1446
1576
  );
1447
- var codeExecution_20250825InputSchema = (0, import_provider_utils8.lazySchema)(
1448
- () => (0, import_provider_utils8.zodSchema)(
1449
- import_v48.z.discriminatedUnion("type", [
1450
- import_v48.z.object({
1451
- type: import_v48.z.literal("bash_code_execution"),
1452
- command: import_v48.z.string()
1577
+ var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
1578
+ () => (0, import_provider_utils9.zodSchema)(
1579
+ import_v49.z.discriminatedUnion("type", [
1580
+ import_v49.z.object({
1581
+ type: import_v49.z.literal("bash_code_execution"),
1582
+ command: import_v49.z.string()
1453
1583
  }),
1454
- import_v48.z.discriminatedUnion("command", [
1455
- import_v48.z.object({
1456
- type: import_v48.z.literal("text_editor_code_execution"),
1457
- command: import_v48.z.literal("view"),
1458
- path: import_v48.z.string()
1584
+ import_v49.z.discriminatedUnion("command", [
1585
+ import_v49.z.object({
1586
+ type: import_v49.z.literal("text_editor_code_execution"),
1587
+ command: import_v49.z.literal("view"),
1588
+ path: import_v49.z.string()
1459
1589
  }),
1460
- import_v48.z.object({
1461
- type: import_v48.z.literal("text_editor_code_execution"),
1462
- command: import_v48.z.literal("create"),
1463
- path: import_v48.z.string(),
1464
- file_text: import_v48.z.string().nullish()
1590
+ import_v49.z.object({
1591
+ type: import_v49.z.literal("text_editor_code_execution"),
1592
+ command: import_v49.z.literal("create"),
1593
+ path: import_v49.z.string(),
1594
+ file_text: import_v49.z.string().nullish()
1465
1595
  }),
1466
- import_v48.z.object({
1467
- type: import_v48.z.literal("text_editor_code_execution"),
1468
- command: import_v48.z.literal("str_replace"),
1469
- path: import_v48.z.string(),
1470
- old_str: import_v48.z.string(),
1471
- new_str: import_v48.z.string()
1596
+ import_v49.z.object({
1597
+ type: import_v49.z.literal("text_editor_code_execution"),
1598
+ command: import_v49.z.literal("str_replace"),
1599
+ path: import_v49.z.string(),
1600
+ old_str: import_v49.z.string(),
1601
+ new_str: import_v49.z.string()
1472
1602
  })
1473
1603
  ])
1474
1604
  ])
1475
1605
  )
1476
1606
  );
1477
- var factory5 = (0, import_provider_utils8.createProviderDefinedToolFactoryWithOutputSchema)({
1607
+ var factory5 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
1478
1608
  id: "anthropic.code_execution_20250825",
1479
1609
  name: "code_execution",
1480
1610
  inputSchema: codeExecution_20250825InputSchema,
@@ -1505,7 +1635,8 @@ async function convertToAnthropicMessagesPrompt({
1505
1635
  prompt,
1506
1636
  sendReasoning,
1507
1637
  warnings,
1508
- cacheControlValidator
1638
+ cacheControlValidator,
1639
+ toolsetNames = {}
1509
1640
  }) {
1510
1641
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1511
1642
  const betas = /* @__PURE__ */ new Set();
@@ -1515,7 +1646,7 @@ async function convertToAnthropicMessagesPrompt({
1515
1646
  const messages = [];
1516
1647
  async function shouldEnableCitations(providerMetadata) {
1517
1648
  var _a2, _b2;
1518
- const anthropicOptions = await (0, import_provider_utils9.parseProviderOptions)({
1649
+ const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
1519
1650
  provider: "anthropic",
1520
1651
  providerOptions: providerMetadata,
1521
1652
  schema: anthropicFilePartProviderOptions
@@ -1523,7 +1654,7 @@ async function convertToAnthropicMessagesPrompt({
1523
1654
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
1524
1655
  }
1525
1656
  async function getDocumentMetadata(providerMetadata) {
1526
- const anthropicOptions = await (0, import_provider_utils9.parseProviderOptions)({
1657
+ const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
1527
1658
  provider: "anthropic",
1528
1659
  providerOptions: providerMetadata,
1529
1660
  schema: anthropicFilePartProviderOptions
@@ -1544,7 +1675,7 @@ async function convertToAnthropicMessagesPrompt({
1544
1675
  let clearAt = void 0;
1545
1676
  let effort = void 0;
1546
1677
  for (const { content: text, providerOptions } of block.messages) {
1547
- const systemMessageOptions = await (0, import_provider_utils9.parseProviderOptions)({
1678
+ const systemMessageOptions = await (0, import_provider_utils10.parseProviderOptions)({
1548
1679
  provider: "anthropic",
1549
1680
  providerOptions,
1550
1681
  schema: anthropicSystemMessageProviderOptions
@@ -1599,7 +1730,7 @@ async function convertToAnthropicMessagesPrompt({
1599
1730
  betas.add("mid-conversation-system-clear-at-2026-08-21");
1600
1731
  }
1601
1732
  if (effort != null) {
1602
- betas.add("mid-conversation-effort-2026-08-01");
1733
+ betas.add("mid-conversation-output-config-2026-07-01");
1603
1734
  }
1604
1735
  }
1605
1736
  break;
@@ -1639,7 +1770,7 @@ async function convertToAnthropicMessagesPrompt({
1639
1770
  } : {
1640
1771
  type: "base64",
1641
1772
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
1642
- data: (0, import_provider_utils9.convertToBase64)(part.data)
1773
+ data: (0, import_provider_utils10.convertToBase64)(part.data)
1643
1774
  },
1644
1775
  cache_control: cacheControl
1645
1776
  });
@@ -1659,7 +1790,7 @@ async function convertToAnthropicMessagesPrompt({
1659
1790
  } : {
1660
1791
  type: "base64",
1661
1792
  media_type: "application/pdf",
1662
- data: (0, import_provider_utils9.convertToBase64)(part.data)
1793
+ data: (0, import_provider_utils10.convertToBase64)(part.data)
1663
1794
  },
1664
1795
  title: (_e = metadata.title) != null ? _e : part.filename,
1665
1796
  ...metadata.context && { context: metadata.context },
@@ -1764,9 +1895,15 @@ async function convertToAnthropicMessagesPrompt({
1764
1895
  contentValue = JSON.stringify(output.value);
1765
1896
  break;
1766
1897
  }
1898
+ const toolsetName = getAnthropicToolsetName({
1899
+ toolName: part.toolName,
1900
+ providerOptions: part.providerOptions,
1901
+ toolsetNames
1902
+ });
1767
1903
  anthropicContent.push({
1768
1904
  type: "tool_result",
1769
1905
  tool_use_id: part.toolCallId,
1906
+ ...toolsetName != null && { toolset_name: toolsetName },
1770
1907
  content: contentValue,
1771
1908
  is_error: output.type === "error-text" || output.type === "error-json" ? true : void 0,
1772
1909
  cache_control: cacheControl
@@ -1827,7 +1964,7 @@ async function convertToAnthropicMessagesPrompt({
1827
1964
  }
1828
1965
  case "reasoning": {
1829
1966
  if (sendReasoning) {
1830
- const reasoningMetadata = await (0, import_provider_utils9.parseProviderOptions)({
1967
+ const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
1831
1968
  provider: "anthropic",
1832
1969
  providerOptions: part.providerOptions,
1833
1970
  schema: anthropicReasoningMetadataSchema
@@ -1901,6 +2038,30 @@ async function convertToAnthropicMessagesPrompt({
1901
2038
  }
1902
2039
  break;
1903
2040
  }
2041
+ const toolsetName = getAnthropicToolsetName({
2042
+ toolName: part.toolName,
2043
+ providerOptions: part.providerOptions,
2044
+ toolsetNames
2045
+ });
2046
+ if (toolsetName != null) {
2047
+ const { action, ...memberInput } = typeof part.input === "object" && part.input !== null && !Array.isArray(part.input) ? part.input : {};
2048
+ if (typeof action !== "string") {
2049
+ warnings.push({
2050
+ type: "other",
2051
+ message: `toolset tool call for tool ${part.toolName} is missing the action`
2052
+ });
2053
+ break;
2054
+ }
2055
+ anthropicContent.push({
2056
+ type: "tool_use",
2057
+ id: part.toolCallId,
2058
+ name: action,
2059
+ toolset_name: toolsetName,
2060
+ input: memberInput,
2061
+ cache_control: cacheControl
2062
+ });
2063
+ break;
2064
+ }
1904
2065
  anthropicContent.push({
1905
2066
  type: "tool_use",
1906
2067
  id: part.toolCallId,
@@ -1928,7 +2089,7 @@ async function convertToAnthropicMessagesPrompt({
1928
2089
  break;
1929
2090
  }
1930
2091
  if (output.value.type === "code_execution_result") {
1931
- const codeExecutionOutput = await (0, import_provider_utils9.validateTypes)({
2092
+ const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
1932
2093
  value: output.value,
1933
2094
  schema: codeExecution_20250522OutputSchema
1934
2095
  });
@@ -1944,7 +2105,7 @@ async function convertToAnthropicMessagesPrompt({
1944
2105
  cache_control: cacheControl
1945
2106
  });
1946
2107
  } else {
1947
- const codeExecutionOutput = await (0, import_provider_utils9.validateTypes)({
2108
+ const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
1948
2109
  value: output.value,
1949
2110
  schema: codeExecution_20250825OutputSchema
1950
2111
  });
@@ -1981,7 +2142,7 @@ async function convertToAnthropicMessagesPrompt({
1981
2142
  });
1982
2143
  break;
1983
2144
  }
1984
- const webFetchOutput = await (0, import_provider_utils9.validateTypes)({
2145
+ const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
1985
2146
  value: output.value,
1986
2147
  schema: webFetch_20250910OutputSchema
1987
2148
  });
@@ -2016,7 +2177,7 @@ async function convertToAnthropicMessagesPrompt({
2016
2177
  });
2017
2178
  break;
2018
2179
  }
2019
- const webSearchOutput = await (0, import_provider_utils9.validateTypes)({
2180
+ const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
2020
2181
  value: output.value,
2021
2182
  schema: webSearch_20250305OutputSchema
2022
2183
  });
@@ -2127,6 +2288,19 @@ function moveToolUseBlocksToEnd(content) {
2127
2288
  flushSegment();
2128
2289
  return result;
2129
2290
  }
2291
+ function getAnthropicToolsetName({
2292
+ toolName,
2293
+ providerOptions,
2294
+ toolsetNames
2295
+ }) {
2296
+ var _a;
2297
+ const fromTools = toolsetNames[toolName];
2298
+ if (fromTools != null) {
2299
+ return fromTools;
2300
+ }
2301
+ const fromMetadata = (_a = providerOptions == null ? void 0 : providerOptions.anthropic) == null ? void 0 : _a.toolsetName;
2302
+ return typeof fromMetadata === "string" ? fromMetadata : void 0;
2303
+ }
2130
2304
 
2131
2305
  // src/map-anthropic-stop-reason.ts
2132
2306
  function mapAnthropicStopReason({
@@ -2298,6 +2472,24 @@ function isPlainObject(value) {
2298
2472
  }
2299
2473
 
2300
2474
  // src/anthropic-messages-language-model.ts
2475
+ function getAnthropicToolsetNames(tools) {
2476
+ const toolsetNames = {};
2477
+ for (const tool of tools != null ? tools : []) {
2478
+ if (tool.type === "provider-defined" && tool.id === "anthropic.computer_toolset_20260801") {
2479
+ toolsetNames[tool.name] = "computer";
2480
+ }
2481
+ }
2482
+ return toolsetNames;
2483
+ }
2484
+ function toToolsetMemberInput({
2485
+ memberName,
2486
+ input
2487
+ }) {
2488
+ return {
2489
+ action: memberName,
2490
+ ...typeof input === "object" && input !== null && !Array.isArray(input) ? input : {}
2491
+ };
2492
+ }
2301
2493
  function getJsonResponseToolName(tools) {
2302
2494
  const toolNames = new Set(tools == null ? void 0 : tools.map((tool) => tool.name));
2303
2495
  let name = "json";
@@ -2342,7 +2534,7 @@ var AnthropicMessagesLanguageModel = class {
2342
2534
  var _a;
2343
2535
  this.modelId = modelId;
2344
2536
  this.config = config;
2345
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils10.generateId;
2537
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
2346
2538
  }
2347
2539
  supportsUrl(url) {
2348
2540
  return url.protocol === "https:";
@@ -2414,7 +2606,7 @@ var AnthropicMessagesLanguageModel = class {
2414
2606
  });
2415
2607
  }
2416
2608
  }
2417
- const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
2609
+ const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
2418
2610
  provider: "anthropic",
2419
2611
  providerOptions,
2420
2612
  schema: anthropicProviderOptions
@@ -2424,6 +2616,8 @@ var AnthropicMessagesLanguageModel = class {
2424
2616
  supportsStructuredOutput,
2425
2617
  rejectsSamplingParameters,
2426
2618
  rejectsThinkingDisabledAboveHighEffort,
2619
+ rejectsThinkingDisabled,
2620
+ rejectsForcedToolUse,
2427
2621
  isKnownModel
2428
2622
  } = getModelCapabilities(this.modelId);
2429
2623
  if (!isKnownModel && maxOutputTokens == null) {
@@ -2459,8 +2653,16 @@ var AnthropicMessagesLanguageModel = class {
2459
2653
  }
2460
2654
  }
2461
2655
  const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
2462
- const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") ? "auto" : "jsonTool";
2463
- const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2656
+ const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") || this.modelId.includes("claude-opus-5-5") ? "auto" : "jsonTool";
2657
+ let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2658
+ if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
2659
+ warnings.push({
2660
+ type: "unsupported-setting",
2661
+ setting: "providerOptions.anthropic.structuredOutputMode",
2662
+ details: `structuredOutputMode 'jsonTool' is not supported by ${this.modelId} because it rejects forced tool use. Using 'outputFormat' instead.`
2663
+ });
2664
+ useStructuredOutput = true;
2665
+ }
2464
2666
  const jsonResponseToolName = getJsonResponseToolName(tools);
2465
2667
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
2466
2668
  type: "function",
@@ -2476,12 +2678,37 @@ var AnthropicMessagesLanguageModel = class {
2476
2678
  });
2477
2679
  }
2478
2680
  const cacheControlValidator = new CacheControlValidator();
2681
+ const toolsetNames = getAnthropicToolsetNames(tools);
2479
2682
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
2480
2683
  prompt,
2481
2684
  sendReasoning: (_b = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _b : true,
2482
2685
  warnings,
2483
- cacheControlValidator
2686
+ cacheControlValidator,
2687
+ toolsetNames
2484
2688
  });
2689
+ if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
2690
+ const thinking = anthropicOptions.thinking;
2691
+ if ("type" in thinking && thinking.type === "disabled") {
2692
+ warnings.push({
2693
+ type: "unsupported-setting",
2694
+ setting: "providerOptions.anthropic.thinking",
2695
+ details: `thinking cannot be disabled for ${this.modelId}; it always uses adaptive thinking. The thinking setting has been removed. Lower 'effort' to reduce thinking.`
2696
+ });
2697
+ anthropicOptions.thinking = void 0;
2698
+ } else if ("type" in thinking && thinking.type === "enabled") {
2699
+ warnings.push({
2700
+ type: "unsupported-setting",
2701
+ setting: "providerOptions.anthropic.thinking",
2702
+ details: `budget-based thinking is not supported by ${this.modelId}; it always uses adaptive thinking. Using adaptive thinking instead. Use 'effort' to control how much the model thinks.`
2703
+ });
2704
+ anthropicOptions.thinking = {
2705
+ type: "adaptive",
2706
+ ...thinking.blockBinding != null && {
2707
+ blockBinding: thinking.blockBinding
2708
+ }
2709
+ };
2710
+ }
2711
+ }
2485
2712
  const thinkingOptions = anthropicOptions == null ? void 0 : anthropicOptions.thinking;
2486
2713
  const thinkingType = thinkingOptions != null && "type" in thinkingOptions ? thinkingOptions.type : void 0;
2487
2714
  if (rejectsThinkingDisabledAboveHighEffort && thinkingType === "disabled" && anthropicOptions != null && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
@@ -2723,12 +2950,14 @@ var AnthropicMessagesLanguageModel = class {
2723
2950
  tools: [...tools != null ? tools : [], jsonResponseTool],
2724
2951
  toolChoice: tools != null && tools.length > 0 ? { type: "required" } : { type: "tool", toolName: jsonResponseTool.name },
2725
2952
  disableParallelToolUse: true,
2726
- cacheControlValidator
2953
+ cacheControlValidator,
2954
+ rejectsForcedToolUse
2727
2955
  } : {
2728
2956
  tools: tools != null ? tools : [],
2729
2957
  toolChoice,
2730
2958
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
2731
- cacheControlValidator
2959
+ cacheControlValidator,
2960
+ rejectsForcedToolUse
2732
2961
  }
2733
2962
  );
2734
2963
  const cacheWarnings = cacheControlValidator.getWarnings();
@@ -2752,15 +2981,15 @@ var AnthropicMessagesLanguageModel = class {
2752
2981
  betas,
2753
2982
  headers
2754
2983
  }) {
2755
- return (0, import_provider_utils10.combineHeaders)(
2756
- await (0, import_provider_utils10.resolve)(this.config.headers),
2984
+ return (0, import_provider_utils11.combineHeaders)(
2985
+ await (0, import_provider_utils11.resolve)(this.config.headers),
2757
2986
  headers,
2758
2987
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
2759
2988
  );
2760
2989
  }
2761
2990
  async getBetasFromHeaders(requestHeaders) {
2762
2991
  var _a, _b;
2763
- const configHeaders = await (0, import_provider_utils10.resolve)(this.config.headers);
2992
+ const configHeaders = await (0, import_provider_utils11.resolve)(this.config.headers);
2764
2993
  const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
2765
2994
  const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
2766
2995
  return new Set(
@@ -2812,12 +3041,12 @@ var AnthropicMessagesLanguageModel = class {
2812
3041
  responseHeaders,
2813
3042
  value: response,
2814
3043
  rawValue: rawResponse
2815
- } = await (0, import_provider_utils10.postJsonToApi)({
3044
+ } = await (0, import_provider_utils11.postJsonToApi)({
2816
3045
  url: this.buildRequestUrl(false),
2817
3046
  headers: await this.getHeaders({ betas, headers: options.headers }),
2818
3047
  body: this.transformRequestBody(args, betas),
2819
3048
  failedResponseHandler: anthropicFailedResponseHandler,
2820
- successfulResponseHandler: (0, import_provider_utils10.createJsonResponseHandler)(
3049
+ successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
2821
3050
  anthropicMessagesResponseSchema
2822
3051
  ),
2823
3052
  abortSignal: options.abortSignal,
@@ -2902,6 +3131,21 @@ var AnthropicMessagesLanguageModel = class {
2902
3131
  type: "text",
2903
3132
  text: JSON.stringify(part.input)
2904
3133
  });
3134
+ } else if (part.toolset_name != null) {
3135
+ content.push({
3136
+ type: "tool-call",
3137
+ toolCallId: part.id,
3138
+ toolName: part.toolset_name,
3139
+ input: JSON.stringify(
3140
+ toToolsetMemberInput({
3141
+ memberName: part.name,
3142
+ input: part.input
3143
+ })
3144
+ ),
3145
+ providerMetadata: {
3146
+ anthropic: { toolsetName: part.toolset_name }
3147
+ }
3148
+ });
2905
3149
  } else {
2906
3150
  content.push({
2907
3151
  type: "tool-call",
@@ -3166,12 +3410,12 @@ var AnthropicMessagesLanguageModel = class {
3166
3410
  const citationDocuments = this.extractCitationDocuments(options.prompt);
3167
3411
  const body = { ...args, stream: true };
3168
3412
  const url = this.buildRequestUrl(true);
3169
- const { responseHeaders, value: response } = await (0, import_provider_utils10.postJsonToApi)({
3413
+ const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
3170
3414
  url,
3171
3415
  headers: await this.getHeaders({ betas, headers: options.headers }),
3172
3416
  body: this.transformRequestBody(body, betas),
3173
3417
  failedResponseHandler: anthropicFailedResponseHandler,
3174
- successfulResponseHandler: (0, import_provider_utils10.createEventSourceResponseHandler)(
3418
+ successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
3175
3419
  anthropicMessagesChunkSchema
3176
3420
  ),
3177
3421
  abortSignal: options.abortSignal,
@@ -3286,6 +3530,23 @@ var AnthropicMessagesLanguageModel = class {
3286
3530
  type: "text-start",
3287
3531
  id: String(value.index)
3288
3532
  });
3533
+ } else if (value.content_block.toolset_name != null) {
3534
+ contentBlocks[value.index] = {
3535
+ type: "tool-call",
3536
+ toolCallId: value.content_block.id,
3537
+ toolName: value.content_block.toolset_name,
3538
+ input: "",
3539
+ firstDelta: true,
3540
+ toolset: {
3541
+ name: value.content_block.toolset_name,
3542
+ memberName: value.content_block.name
3543
+ }
3544
+ };
3545
+ controller.enqueue({
3546
+ type: "tool-input-start",
3547
+ id: value.content_block.id,
3548
+ toolName: value.content_block.toolset_name
3549
+ });
3289
3550
  } else {
3290
3551
  contentBlocks[value.index] = {
3291
3552
  type: "tool-call",
@@ -3496,6 +3757,25 @@ var AnthropicMessagesLanguageModel = class {
3496
3757
  break;
3497
3758
  }
3498
3759
  case "tool-call": {
3760
+ if (contentBlock.toolset != null) {
3761
+ let memberInput = {};
3762
+ try {
3763
+ memberInput = contentBlock.input === "" ? {} : JSON.parse(contentBlock.input);
3764
+ } catch (e) {
3765
+ memberInput = void 0;
3766
+ }
3767
+ contentBlock.input = memberInput === void 0 ? contentBlock.input : JSON.stringify(
3768
+ toToolsetMemberInput({
3769
+ memberName: contentBlock.toolset.memberName,
3770
+ input: memberInput
3771
+ })
3772
+ );
3773
+ controller.enqueue({
3774
+ type: "tool-input-delta",
3775
+ id: contentBlock.toolCallId,
3776
+ delta: contentBlock.input
3777
+ });
3778
+ }
3499
3779
  controller.enqueue({
3500
3780
  type: "tool-input-end",
3501
3781
  id: contentBlock.toolCallId
@@ -3506,7 +3786,12 @@ var AnthropicMessagesLanguageModel = class {
3506
3786
  toolCallId: contentBlock.toolCallId,
3507
3787
  toolName,
3508
3788
  input: contentBlock.input === "" ? "{}" : contentBlock.input,
3509
- providerExecuted: contentBlock.providerExecuted
3789
+ providerExecuted: contentBlock.providerExecuted,
3790
+ ...contentBlock.toolset && {
3791
+ providerMetadata: {
3792
+ anthropic: { toolsetName: contentBlock.toolset.name }
3793
+ }
3794
+ }
3510
3795
  });
3511
3796
  break;
3512
3797
  }
@@ -3579,6 +3864,10 @@ var AnthropicMessagesLanguageModel = class {
3579
3864
  if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
3580
3865
  return;
3581
3866
  }
3867
+ if (contentBlock.toolset != null) {
3868
+ contentBlock.input += delta;
3869
+ return;
3870
+ }
3582
3871
  if (contentBlock.firstDelta && (contentBlock.toolName === "bash_code_execution" || contentBlock.toolName === "text_editor_code_execution")) {
3583
3872
  delta = `{"type": "${contentBlock.toolName}",${delta.substring(1)}`;
3584
3873
  }
@@ -3795,20 +4084,54 @@ var AnthropicMessagesLanguageModel = class {
3795
4084
  }
3796
4085
  };
3797
4086
  function getModelCapabilities(modelId) {
3798
- if (modelId.includes("claude-opus-5")) {
4087
+ if (modelId.includes("claude-opus-5-5")) {
4088
+ return {
4089
+ maxOutputTokens: 128e3,
4090
+ supportsStructuredOutput: true,
4091
+ rejectsSamplingParameters: true,
4092
+ rejectsThinkingDisabledAboveHighEffort: true,
4093
+ rejectsThinkingDisabled: true,
4094
+ rejectsForcedToolUse: true,
4095
+ isKnownModel: true
4096
+ };
4097
+ } else if (modelId.includes("claude-opus-5")) {
3799
4098
  return {
3800
4099
  maxOutputTokens: 128e3,
3801
4100
  supportsStructuredOutput: true,
3802
4101
  rejectsSamplingParameters: true,
3803
4102
  rejectsThinkingDisabledAboveHighEffort: true,
4103
+ rejectsThinkingDisabled: false,
4104
+ rejectsForcedToolUse: false,
4105
+ isKnownModel: true
4106
+ };
4107
+ } else if (modelId.includes("claude-fable-5-1")) {
4108
+ return {
4109
+ maxOutputTokens: 128e3,
4110
+ supportsStructuredOutput: true,
4111
+ rejectsSamplingParameters: true,
4112
+ rejectsThinkingDisabledAboveHighEffort: false,
4113
+ rejectsThinkingDisabled: true,
4114
+ rejectsForcedToolUse: true,
3804
4115
  isKnownModel: true
3805
4116
  };
3806
- } else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5-1") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
4117
+ } else if (modelId.includes("claude-fable-5")) {
3807
4118
  return {
3808
4119
  maxOutputTokens: 128e3,
3809
4120
  supportsStructuredOutput: true,
3810
4121
  rejectsSamplingParameters: true,
3811
4122
  rejectsThinkingDisabledAboveHighEffort: false,
4123
+ rejectsThinkingDisabled: true,
4124
+ rejectsForcedToolUse: false,
4125
+ isKnownModel: true
4126
+ };
4127
+ } else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) {
4128
+ return {
4129
+ maxOutputTokens: 128e3,
4130
+ supportsStructuredOutput: true,
4131
+ rejectsSamplingParameters: true,
4132
+ rejectsThinkingDisabledAboveHighEffort: false,
4133
+ rejectsThinkingDisabled: false,
4134
+ rejectsForcedToolUse: false,
3812
4135
  isKnownModel: true
3813
4136
  };
3814
4137
  } else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
@@ -3817,6 +4140,8 @@ function getModelCapabilities(modelId) {
3817
4140
  supportsStructuredOutput: true,
3818
4141
  rejectsSamplingParameters: false,
3819
4142
  rejectsThinkingDisabledAboveHighEffort: false,
4143
+ rejectsThinkingDisabled: false,
4144
+ rejectsForcedToolUse: false,
3820
4145
  isKnownModel: true
3821
4146
  };
3822
4147
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
@@ -3825,6 +4150,8 @@ function getModelCapabilities(modelId) {
3825
4150
  supportsStructuredOutput: true,
3826
4151
  rejectsSamplingParameters: false,
3827
4152
  rejectsThinkingDisabledAboveHighEffort: false,
4153
+ rejectsThinkingDisabled: false,
4154
+ rejectsForcedToolUse: false,
3828
4155
  isKnownModel: true
3829
4156
  };
3830
4157
  } else if (modelId.includes("claude-opus-4-1")) {
@@ -3833,6 +4160,8 @@ function getModelCapabilities(modelId) {
3833
4160
  supportsStructuredOutput: true,
3834
4161
  rejectsSamplingParameters: false,
3835
4162
  rejectsThinkingDisabledAboveHighEffort: false,
4163
+ rejectsThinkingDisabled: false,
4164
+ rejectsForcedToolUse: false,
3836
4165
  isKnownModel: true
3837
4166
  };
3838
4167
  } else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet")) {
@@ -3841,6 +4170,8 @@ function getModelCapabilities(modelId) {
3841
4170
  supportsStructuredOutput: false,
3842
4171
  rejectsSamplingParameters: false,
3843
4172
  rejectsThinkingDisabledAboveHighEffort: false,
4173
+ rejectsThinkingDisabled: false,
4174
+ rejectsForcedToolUse: false,
3844
4175
  isKnownModel: true
3845
4176
  };
3846
4177
  } else if (modelId.includes("claude-opus-4-")) {
@@ -3849,6 +4180,8 @@ function getModelCapabilities(modelId) {
3849
4180
  supportsStructuredOutput: false,
3850
4181
  rejectsSamplingParameters: false,
3851
4182
  rejectsThinkingDisabledAboveHighEffort: false,
4183
+ rejectsThinkingDisabled: false,
4184
+ rejectsForcedToolUse: false,
3852
4185
  isKnownModel: true
3853
4186
  };
3854
4187
  } else if (modelId.includes("claude-3-haiku")) {
@@ -3857,6 +4190,8 @@ function getModelCapabilities(modelId) {
3857
4190
  supportsStructuredOutput: false,
3858
4191
  rejectsSamplingParameters: false,
3859
4192
  rejectsThinkingDisabledAboveHighEffort: false,
4193
+ rejectsThinkingDisabled: false,
4194
+ rejectsForcedToolUse: false,
3860
4195
  isKnownModel: true
3861
4196
  };
3862
4197
  } else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
@@ -3865,6 +4200,8 @@ function getModelCapabilities(modelId) {
3865
4200
  supportsStructuredOutput: false,
3866
4201
  rejectsSamplingParameters: false,
3867
4202
  rejectsThinkingDisabledAboveHighEffort: false,
4203
+ rejectsThinkingDisabled: false,
4204
+ rejectsForcedToolUse: false,
3868
4205
  isKnownModel: false
3869
4206
  };
3870
4207
  } else if (modelId.includes("claude-")) {
@@ -3873,6 +4210,8 @@ function getModelCapabilities(modelId) {
3873
4210
  supportsStructuredOutput: true,
3874
4211
  rejectsSamplingParameters: true,
3875
4212
  rejectsThinkingDisabledAboveHighEffort: true,
4213
+ rejectsThinkingDisabled: false,
4214
+ rejectsForcedToolUse: false,
3876
4215
  isKnownModel: false
3877
4216
  };
3878
4217
  } else {
@@ -3881,6 +4220,8 @@ function getModelCapabilities(modelId) {
3881
4220
  supportsStructuredOutput: false,
3882
4221
  rejectsSamplingParameters: false,
3883
4222
  rejectsThinkingDisabledAboveHighEffort: false,
4223
+ rejectsThinkingDisabled: false,
4224
+ rejectsForcedToolUse: false,
3884
4225
  isKnownModel: false
3885
4226
  };
3886
4227
  }
@@ -3898,135 +4239,135 @@ function mapAnthropicStopDetails(stopDetails) {
3898
4239
  }
3899
4240
 
3900
4241
  // src/tool/bash_20241022.ts
3901
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
3902
- var import_v49 = require("zod/v4");
3903
- var bash_20241022InputSchema = (0, import_provider_utils11.lazySchema)(
3904
- () => (0, import_provider_utils11.zodSchema)(
3905
- import_v49.z.object({
3906
- command: import_v49.z.string(),
3907
- restart: import_v49.z.boolean().optional()
4242
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
4243
+ var import_v410 = require("zod/v4");
4244
+ var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
4245
+ () => (0, import_provider_utils12.zodSchema)(
4246
+ import_v410.z.object({
4247
+ command: import_v410.z.string(),
4248
+ restart: import_v410.z.boolean().optional()
3908
4249
  })
3909
4250
  )
3910
4251
  );
3911
- var bash_20241022 = (0, import_provider_utils11.createProviderDefinedToolFactory)({
4252
+ var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
3912
4253
  id: "anthropic.bash_20241022",
3913
4254
  name: "bash",
3914
4255
  inputSchema: bash_20241022InputSchema
3915
4256
  });
3916
4257
 
3917
4258
  // src/tool/bash_20250124.ts
3918
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
3919
- var import_v410 = require("zod/v4");
3920
- var bash_20250124InputSchema = (0, import_provider_utils12.lazySchema)(
3921
- () => (0, import_provider_utils12.zodSchema)(
3922
- import_v410.z.object({
3923
- command: import_v410.z.string(),
3924
- restart: import_v410.z.boolean().optional()
4259
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
4260
+ var import_v411 = require("zod/v4");
4261
+ var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
4262
+ () => (0, import_provider_utils13.zodSchema)(
4263
+ import_v411.z.object({
4264
+ command: import_v411.z.string(),
4265
+ restart: import_v411.z.boolean().optional()
3925
4266
  })
3926
4267
  )
3927
4268
  );
3928
- var bash_20250124 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
4269
+ var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
3929
4270
  id: "anthropic.bash_20250124",
3930
4271
  name: "bash",
3931
4272
  inputSchema: bash_20250124InputSchema
3932
4273
  });
3933
4274
 
3934
4275
  // src/tool/code-execution_20260120.ts
3935
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
3936
- var import_v411 = require("zod/v4");
3937
- var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)(
3938
- () => (0, import_provider_utils13.zodSchema)(
3939
- import_v411.z.discriminatedUnion("type", [
3940
- import_v411.z.object({
3941
- type: import_v411.z.literal("code_execution_result"),
3942
- stdout: import_v411.z.string(),
3943
- stderr: import_v411.z.string(),
3944
- return_code: import_v411.z.number(),
3945
- content: import_v411.z.array(
3946
- import_v411.z.object({
3947
- type: import_v411.z.literal("code_execution_output"),
3948
- file_id: import_v411.z.string()
4276
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
4277
+ var import_v412 = require("zod/v4");
4278
+ var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)(
4279
+ () => (0, import_provider_utils14.zodSchema)(
4280
+ import_v412.z.discriminatedUnion("type", [
4281
+ import_v412.z.object({
4282
+ type: import_v412.z.literal("code_execution_result"),
4283
+ stdout: import_v412.z.string(),
4284
+ stderr: import_v412.z.string(),
4285
+ return_code: import_v412.z.number(),
4286
+ content: import_v412.z.array(
4287
+ import_v412.z.object({
4288
+ type: import_v412.z.literal("code_execution_output"),
4289
+ file_id: import_v412.z.string()
3949
4290
  })
3950
4291
  ).optional().default([])
3951
4292
  }),
3952
- import_v411.z.object({
3953
- type: import_v411.z.literal("bash_code_execution_result"),
3954
- content: import_v411.z.array(
3955
- import_v411.z.object({
3956
- type: import_v411.z.literal("bash_code_execution_output"),
3957
- file_id: import_v411.z.string()
4293
+ import_v412.z.object({
4294
+ type: import_v412.z.literal("bash_code_execution_result"),
4295
+ content: import_v412.z.array(
4296
+ import_v412.z.object({
4297
+ type: import_v412.z.literal("bash_code_execution_output"),
4298
+ file_id: import_v412.z.string()
3958
4299
  })
3959
4300
  ),
3960
- stdout: import_v411.z.string(),
3961
- stderr: import_v411.z.string(),
3962
- return_code: import_v411.z.number()
4301
+ stdout: import_v412.z.string(),
4302
+ stderr: import_v412.z.string(),
4303
+ return_code: import_v412.z.number()
3963
4304
  }),
3964
- import_v411.z.object({
3965
- type: import_v411.z.literal("bash_code_execution_tool_result_error"),
3966
- error_code: import_v411.z.string()
4305
+ import_v412.z.object({
4306
+ type: import_v412.z.literal("bash_code_execution_tool_result_error"),
4307
+ error_code: import_v412.z.string()
3967
4308
  }),
3968
- import_v411.z.object({
3969
- type: import_v411.z.literal("text_editor_code_execution_tool_result_error"),
3970
- error_code: import_v411.z.string()
4309
+ import_v412.z.object({
4310
+ type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
4311
+ error_code: import_v412.z.string()
3971
4312
  }),
3972
- import_v411.z.object({
3973
- type: import_v411.z.literal("text_editor_code_execution_view_result"),
3974
- content: import_v411.z.string(),
3975
- file_type: import_v411.z.string(),
3976
- num_lines: import_v411.z.number().nullable(),
3977
- start_line: import_v411.z.number().nullable(),
3978
- total_lines: import_v411.z.number().nullable()
4313
+ import_v412.z.object({
4314
+ type: import_v412.z.literal("text_editor_code_execution_view_result"),
4315
+ content: import_v412.z.string(),
4316
+ file_type: import_v412.z.string(),
4317
+ num_lines: import_v412.z.number().nullable(),
4318
+ start_line: import_v412.z.number().nullable(),
4319
+ total_lines: import_v412.z.number().nullable()
3979
4320
  }),
3980
- import_v411.z.object({
3981
- type: import_v411.z.literal("text_editor_code_execution_create_result"),
3982
- is_file_update: import_v411.z.boolean()
4321
+ import_v412.z.object({
4322
+ type: import_v412.z.literal("text_editor_code_execution_create_result"),
4323
+ is_file_update: import_v412.z.boolean()
3983
4324
  }),
3984
- import_v411.z.object({
3985
- type: import_v411.z.literal("text_editor_code_execution_str_replace_result"),
3986
- lines: import_v411.z.array(import_v411.z.string()).nullable(),
3987
- new_lines: import_v411.z.number().nullable(),
3988
- new_start: import_v411.z.number().nullable(),
3989
- old_lines: import_v411.z.number().nullable(),
3990
- old_start: import_v411.z.number().nullable()
4325
+ import_v412.z.object({
4326
+ type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
4327
+ lines: import_v412.z.array(import_v412.z.string()).nullable(),
4328
+ new_lines: import_v412.z.number().nullable(),
4329
+ new_start: import_v412.z.number().nullable(),
4330
+ old_lines: import_v412.z.number().nullable(),
4331
+ old_start: import_v412.z.number().nullable()
3991
4332
  })
3992
4333
  ])
3993
4334
  )
3994
4335
  );
3995
- var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
3996
- () => (0, import_provider_utils13.zodSchema)(
3997
- import_v411.z.discriminatedUnion("type", [
3998
- import_v411.z.object({
3999
- type: import_v411.z.literal("programmatic-tool-call"),
4000
- code: import_v411.z.string()
4336
+ var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
4337
+ () => (0, import_provider_utils14.zodSchema)(
4338
+ import_v412.z.discriminatedUnion("type", [
4339
+ import_v412.z.object({
4340
+ type: import_v412.z.literal("programmatic-tool-call"),
4341
+ code: import_v412.z.string()
4001
4342
  }),
4002
- import_v411.z.object({
4003
- type: import_v411.z.literal("bash_code_execution"),
4004
- command: import_v411.z.string()
4343
+ import_v412.z.object({
4344
+ type: import_v412.z.literal("bash_code_execution"),
4345
+ command: import_v412.z.string()
4005
4346
  }),
4006
- import_v411.z.discriminatedUnion("command", [
4007
- import_v411.z.object({
4008
- type: import_v411.z.literal("text_editor_code_execution"),
4009
- command: import_v411.z.literal("view"),
4010
- path: import_v411.z.string()
4347
+ import_v412.z.discriminatedUnion("command", [
4348
+ import_v412.z.object({
4349
+ type: import_v412.z.literal("text_editor_code_execution"),
4350
+ command: import_v412.z.literal("view"),
4351
+ path: import_v412.z.string()
4011
4352
  }),
4012
- import_v411.z.object({
4013
- type: import_v411.z.literal("text_editor_code_execution"),
4014
- command: import_v411.z.literal("create"),
4015
- path: import_v411.z.string(),
4016
- file_text: import_v411.z.string().nullish()
4353
+ import_v412.z.object({
4354
+ type: import_v412.z.literal("text_editor_code_execution"),
4355
+ command: import_v412.z.literal("create"),
4356
+ path: import_v412.z.string(),
4357
+ file_text: import_v412.z.string().nullish()
4017
4358
  }),
4018
- import_v411.z.object({
4019
- type: import_v411.z.literal("text_editor_code_execution"),
4020
- command: import_v411.z.literal("str_replace"),
4021
- path: import_v411.z.string(),
4022
- old_str: import_v411.z.string(),
4023
- new_str: import_v411.z.string()
4359
+ import_v412.z.object({
4360
+ type: import_v412.z.literal("text_editor_code_execution"),
4361
+ command: import_v412.z.literal("str_replace"),
4362
+ path: import_v412.z.string(),
4363
+ old_str: import_v412.z.string(),
4364
+ new_str: import_v412.z.string()
4024
4365
  })
4025
4366
  ])
4026
4367
  ])
4027
4368
  )
4028
4369
  );
4029
- var factory6 = (0, import_provider_utils13.createProviderDefinedToolFactoryWithOutputSchema)({
4370
+ var factory6 = (0, import_provider_utils14.createProviderDefinedToolFactoryWithOutputSchema)({
4030
4371
  id: "anthropic.code_execution_20260120",
4031
4372
  name: "code_execution",
4032
4373
  inputSchema: codeExecution_20260120InputSchema,
@@ -4037,12 +4378,12 @@ var codeExecution_20260120 = (args = {}) => {
4037
4378
  };
4038
4379
 
4039
4380
  // src/tool/computer_20241022.ts
4040
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
4041
- var import_v412 = require("zod/v4");
4042
- var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
4043
- () => (0, import_provider_utils14.zodSchema)(
4044
- import_v412.z.object({
4045
- action: import_v412.z.enum([
4381
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
4382
+ var import_v413 = require("zod/v4");
4383
+ var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
4384
+ () => (0, import_provider_utils15.zodSchema)(
4385
+ import_v413.z.object({
4386
+ action: import_v413.z.enum([
4046
4387
  "key",
4047
4388
  "type",
4048
4389
  "mouse_move",
@@ -4054,24 +4395,24 @@ var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
4054
4395
  "screenshot",
4055
4396
  "cursor_position"
4056
4397
  ]),
4057
- coordinate: import_v412.z.array(import_v412.z.number().int()).optional(),
4058
- text: import_v412.z.string().optional()
4398
+ coordinate: import_v413.z.array(import_v413.z.number().int()).optional(),
4399
+ text: import_v413.z.string().optional()
4059
4400
  })
4060
4401
  )
4061
4402
  );
4062
- var computer_20241022 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
4403
+ var computer_20241022 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
4063
4404
  id: "anthropic.computer_20241022",
4064
4405
  name: "computer",
4065
4406
  inputSchema: computer_20241022InputSchema
4066
4407
  });
4067
4408
 
4068
4409
  // src/tool/computer_20250124.ts
4069
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
4070
- var import_v413 = require("zod/v4");
4071
- var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
4072
- () => (0, import_provider_utils15.zodSchema)(
4073
- import_v413.z.object({
4074
- action: import_v413.z.enum([
4410
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
4411
+ var import_v414 = require("zod/v4");
4412
+ var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
4413
+ () => (0, import_provider_utils16.zodSchema)(
4414
+ import_v414.z.object({
4415
+ action: import_v414.z.enum([
4075
4416
  "key",
4076
4417
  "hold_key",
4077
4418
  "type",
@@ -4089,93 +4430,71 @@ var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
4089
4430
  "wait",
4090
4431
  "screenshot"
4091
4432
  ]),
4092
- coordinate: import_v413.z.tuple([import_v413.z.number().int(), import_v413.z.number().int()]).optional(),
4093
- duration: import_v413.z.number().optional(),
4094
- scroll_amount: import_v413.z.number().optional(),
4095
- scroll_direction: import_v413.z.enum(["up", "down", "left", "right"]).optional(),
4096
- start_coordinate: import_v413.z.tuple([import_v413.z.number().int(), import_v413.z.number().int()]).optional(),
4097
- text: import_v413.z.string().optional()
4433
+ coordinate: import_v414.z.tuple([import_v414.z.number().int(), import_v414.z.number().int()]).optional(),
4434
+ duration: import_v414.z.number().optional(),
4435
+ scroll_amount: import_v414.z.number().optional(),
4436
+ scroll_direction: import_v414.z.enum(["up", "down", "left", "right"]).optional(),
4437
+ start_coordinate: import_v414.z.tuple([import_v414.z.number().int(), import_v414.z.number().int()]).optional(),
4438
+ text: import_v414.z.string().optional()
4098
4439
  })
4099
4440
  )
4100
4441
  );
4101
- var computer_20250124 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
4442
+ var computer_20250124 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
4102
4443
  id: "anthropic.computer_20250124",
4103
4444
  name: "computer",
4104
4445
  inputSchema: computer_20250124InputSchema
4105
4446
  });
4106
4447
 
4107
4448
  // src/tool/memory_20250818.ts
4108
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
4109
- var import_v414 = require("zod/v4");
4110
- var memory_20250818InputSchema = (0, import_provider_utils16.lazySchema)(
4111
- () => (0, import_provider_utils16.zodSchema)(
4112
- import_v414.z.discriminatedUnion("command", [
4113
- import_v414.z.object({
4114
- command: import_v414.z.literal("view"),
4115
- path: import_v414.z.string(),
4116
- view_range: import_v414.z.tuple([import_v414.z.number(), import_v414.z.number()]).optional()
4449
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
4450
+ var import_v415 = require("zod/v4");
4451
+ var memory_20250818InputSchema = (0, import_provider_utils17.lazySchema)(
4452
+ () => (0, import_provider_utils17.zodSchema)(
4453
+ import_v415.z.discriminatedUnion("command", [
4454
+ import_v415.z.object({
4455
+ command: import_v415.z.literal("view"),
4456
+ path: import_v415.z.string(),
4457
+ view_range: import_v415.z.tuple([import_v415.z.number(), import_v415.z.number()]).optional()
4117
4458
  }),
4118
- import_v414.z.object({
4119
- command: import_v414.z.literal("create"),
4120
- path: import_v414.z.string(),
4121
- file_text: import_v414.z.string()
4459
+ import_v415.z.object({
4460
+ command: import_v415.z.literal("create"),
4461
+ path: import_v415.z.string(),
4462
+ file_text: import_v415.z.string()
4122
4463
  }),
4123
- import_v414.z.object({
4124
- command: import_v414.z.literal("str_replace"),
4125
- path: import_v414.z.string(),
4126
- old_str: import_v414.z.string(),
4127
- new_str: import_v414.z.string()
4464
+ import_v415.z.object({
4465
+ command: import_v415.z.literal("str_replace"),
4466
+ path: import_v415.z.string(),
4467
+ old_str: import_v415.z.string(),
4468
+ new_str: import_v415.z.string()
4128
4469
  }),
4129
- import_v414.z.object({
4130
- command: import_v414.z.literal("insert"),
4131
- path: import_v414.z.string(),
4132
- insert_line: import_v414.z.number(),
4133
- insert_text: import_v414.z.string()
4470
+ import_v415.z.object({
4471
+ command: import_v415.z.literal("insert"),
4472
+ path: import_v415.z.string(),
4473
+ insert_line: import_v415.z.number(),
4474
+ insert_text: import_v415.z.string()
4134
4475
  }),
4135
- import_v414.z.object({
4136
- command: import_v414.z.literal("delete"),
4137
- path: import_v414.z.string()
4476
+ import_v415.z.object({
4477
+ command: import_v415.z.literal("delete"),
4478
+ path: import_v415.z.string()
4138
4479
  }),
4139
- import_v414.z.object({
4140
- command: import_v414.z.literal("rename"),
4141
- old_path: import_v414.z.string(),
4142
- new_path: import_v414.z.string()
4480
+ import_v415.z.object({
4481
+ command: import_v415.z.literal("rename"),
4482
+ old_path: import_v415.z.string(),
4483
+ new_path: import_v415.z.string()
4143
4484
  })
4144
4485
  ])
4145
4486
  )
4146
4487
  );
4147
- var memory_20250818 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
4488
+ var memory_20250818 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
4148
4489
  id: "anthropic.memory_20250818",
4149
4490
  name: "memory",
4150
4491
  inputSchema: memory_20250818InputSchema
4151
4492
  });
4152
4493
 
4153
4494
  // src/tool/text-editor_20241022.ts
4154
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
4155
- var import_v415 = require("zod/v4");
4156
- var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
4157
- () => (0, import_provider_utils17.zodSchema)(
4158
- import_v415.z.object({
4159
- command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4160
- path: import_v415.z.string(),
4161
- file_text: import_v415.z.string().optional(),
4162
- insert_line: import_v415.z.number().int().optional(),
4163
- new_str: import_v415.z.string().optional(),
4164
- old_str: import_v415.z.string().optional(),
4165
- view_range: import_v415.z.array(import_v415.z.number().int()).optional()
4166
- })
4167
- )
4168
- );
4169
- var textEditor_20241022 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
4170
- id: "anthropic.text_editor_20241022",
4171
- name: "str_replace_editor",
4172
- inputSchema: textEditor_20241022InputSchema
4173
- });
4174
-
4175
- // src/tool/text-editor_20250124.ts
4176
4495
  var import_provider_utils18 = require("@ai-sdk/provider-utils");
4177
4496
  var import_v416 = require("zod/v4");
4178
- var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
4497
+ var textEditor_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
4179
4498
  () => (0, import_provider_utils18.zodSchema)(
4180
4499
  import_v416.z.object({
4181
4500
  command: import_v416.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -4188,19 +4507,19 @@ var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
4188
4507
  })
4189
4508
  )
4190
4509
  );
4191
- var textEditor_20250124 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
4192
- id: "anthropic.text_editor_20250124",
4510
+ var textEditor_20241022 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
4511
+ id: "anthropic.text_editor_20241022",
4193
4512
  name: "str_replace_editor",
4194
- inputSchema: textEditor_20250124InputSchema
4513
+ inputSchema: textEditor_20241022InputSchema
4195
4514
  });
4196
4515
 
4197
- // src/tool/text-editor_20250429.ts
4516
+ // src/tool/text-editor_20250124.ts
4198
4517
  var import_provider_utils19 = require("@ai-sdk/provider-utils");
4199
4518
  var import_v417 = require("zod/v4");
4200
- var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
4519
+ var textEditor_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
4201
4520
  () => (0, import_provider_utils19.zodSchema)(
4202
4521
  import_v417.z.object({
4203
- command: import_v417.z.enum(["view", "create", "str_replace", "insert"]),
4522
+ command: import_v417.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4204
4523
  path: import_v417.z.string(),
4205
4524
  file_text: import_v417.z.string().optional(),
4206
4525
  insert_line: import_v417.z.number().int().optional(),
@@ -4210,7 +4529,29 @@ var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
4210
4529
  })
4211
4530
  )
4212
4531
  );
4213
- var textEditor_20250429 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
4532
+ var textEditor_20250124 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
4533
+ id: "anthropic.text_editor_20250124",
4534
+ name: "str_replace_editor",
4535
+ inputSchema: textEditor_20250124InputSchema
4536
+ });
4537
+
4538
+ // src/tool/text-editor_20250429.ts
4539
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
4540
+ var import_v418 = require("zod/v4");
4541
+ var textEditor_20250429InputSchema = (0, import_provider_utils20.lazySchema)(
4542
+ () => (0, import_provider_utils20.zodSchema)(
4543
+ import_v418.z.object({
4544
+ command: import_v418.z.enum(["view", "create", "str_replace", "insert"]),
4545
+ path: import_v418.z.string(),
4546
+ file_text: import_v418.z.string().optional(),
4547
+ insert_line: import_v418.z.number().int().optional(),
4548
+ new_str: import_v418.z.string().optional(),
4549
+ old_str: import_v418.z.string().optional(),
4550
+ view_range: import_v418.z.array(import_v418.z.number().int()).optional()
4551
+ })
4552
+ )
4553
+ );
4554
+ var textEditor_20250429 = (0, import_provider_utils20.createProviderDefinedToolFactory)({
4214
4555
  id: "anthropic.text_editor_20250429",
4215
4556
  name: "str_replace_based_edit_tool",
4216
4557
  inputSchema: textEditor_20250429InputSchema
@@ -4299,6 +4640,31 @@ var anthropicTools = {
4299
4640
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
4300
4641
  */
4301
4642
  computer_20250124,
4643
+ /**
4644
+ * The computer toolset lets Claude control a computer through screenshots,
4645
+ * mouse, and keyboard. It replaces the versioned computer tools
4646
+ * (`computer_20250124` and earlier) on newer models.
4647
+ *
4648
+ * The API returns each computer action as its own `tool_use` block with
4649
+ * `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
4650
+ * and exposes the member name as `action`, so `execute` receives the same
4651
+ * input shape as the older computer tools. Claude may return several actions
4652
+ * in one turn.
4653
+ *
4654
+ * Coordinates are always in the pixel space of the screenshots you return;
4655
+ * there are no display size parameters. Zoom is enabled by default.
4656
+ *
4657
+ * Does not require a beta header.
4658
+ *
4659
+ * Tool name must be `computer`.
4660
+ *
4661
+ * Supported models: Claude Opus 5.5 (required; older computer tool types
4662
+ * are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
4663
+ *
4664
+ * @param configs - Per-member settings keyed by member name, e.g.
4665
+ * `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
4666
+ */
4667
+ computerToolset_20260801,
4302
4668
  /**
4303
4669
  * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
4304
4670
  * Claude can create, read, update, and delete files that persist between sessions,