@ai-sdk/anthropic 3.0.75 → 3.0.77

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/dist/index.js CHANGED
@@ -29,14 +29,14 @@ module.exports = __toCommonJS(index_exports);
29
29
 
30
30
  // src/anthropic-provider.ts
31
31
  var import_provider4 = require("@ai-sdk/provider");
32
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
32
+ var import_provider_utils26 = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "3.0.75" : "0.0.0-test";
35
+ var VERSION = true ? "3.0.77" : "0.0.0-test";
36
36
 
37
37
  // src/anthropic-messages-language-model.ts
38
38
  var import_provider3 = require("@ai-sdk/provider");
39
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
39
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
40
40
 
41
41
  // src/anthropic-error.ts
42
42
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -326,6 +326,25 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
326
326
  error_code: import_v42.z.string()
327
327
  })
328
328
  ])
329
+ }),
330
+ // advisor results for advisor_20260301:
331
+ import_v42.z.object({
332
+ type: import_v42.z.literal("advisor_tool_result"),
333
+ tool_use_id: import_v42.z.string(),
334
+ content: import_v42.z.discriminatedUnion("type", [
335
+ import_v42.z.object({
336
+ type: import_v42.z.literal("advisor_result"),
337
+ text: import_v42.z.string()
338
+ }),
339
+ import_v42.z.object({
340
+ type: import_v42.z.literal("advisor_redacted_result"),
341
+ encrypted_content: import_v42.z.string()
342
+ }),
343
+ import_v42.z.object({
344
+ type: import_v42.z.literal("advisor_tool_result_error"),
345
+ error_code: import_v42.z.string()
346
+ })
347
+ ])
329
348
  })
330
349
  ])
331
350
  ),
@@ -337,11 +356,23 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
337
356
  cache_creation_input_tokens: import_v42.z.number().nullish(),
338
357
  cache_read_input_tokens: import_v42.z.number().nullish(),
339
358
  iterations: import_v42.z.array(
340
- import_v42.z.object({
341
- type: import_v42.z.union([import_v42.z.literal("compaction"), import_v42.z.literal("message")]),
342
- input_tokens: import_v42.z.number(),
343
- output_tokens: import_v42.z.number()
344
- })
359
+ import_v42.z.union([
360
+ import_v42.z.object({
361
+ type: import_v42.z.union([import_v42.z.literal("compaction"), import_v42.z.literal("message")]),
362
+ input_tokens: import_v42.z.number(),
363
+ output_tokens: import_v42.z.number(),
364
+ cache_creation_input_tokens: import_v42.z.number().nullish(),
365
+ cache_read_input_tokens: import_v42.z.number().nullish()
366
+ }),
367
+ import_v42.z.object({
368
+ type: import_v42.z.literal("advisor_message"),
369
+ model: import_v42.z.string(),
370
+ input_tokens: import_v42.z.number(),
371
+ output_tokens: import_v42.z.number(),
372
+ cache_creation_input_tokens: import_v42.z.number().nullish(),
373
+ cache_read_input_tokens: import_v42.z.number().nullish()
374
+ })
375
+ ])
345
376
  ).nullish()
346
377
  }),
347
378
  container: import_v42.z.object({
@@ -657,6 +688,25 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
657
688
  error_code: import_v42.z.string()
658
689
  })
659
690
  ])
691
+ }),
692
+ // advisor results for advisor_20260301:
693
+ import_v42.z.object({
694
+ type: import_v42.z.literal("advisor_tool_result"),
695
+ tool_use_id: import_v42.z.string(),
696
+ content: import_v42.z.discriminatedUnion("type", [
697
+ import_v42.z.object({
698
+ type: import_v42.z.literal("advisor_result"),
699
+ text: import_v42.z.string()
700
+ }),
701
+ import_v42.z.object({
702
+ type: import_v42.z.literal("advisor_redacted_result"),
703
+ encrypted_content: import_v42.z.string()
704
+ }),
705
+ import_v42.z.object({
706
+ type: import_v42.z.literal("advisor_tool_result_error"),
707
+ error_code: import_v42.z.string()
708
+ })
709
+ ])
660
710
  })
661
711
  ])
662
712
  }),
@@ -751,11 +801,26 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
751
801
  cache_creation_input_tokens: import_v42.z.number().nullish(),
752
802
  cache_read_input_tokens: import_v42.z.number().nullish(),
753
803
  iterations: import_v42.z.array(
754
- import_v42.z.object({
755
- type: import_v42.z.union([import_v42.z.literal("compaction"), import_v42.z.literal("message")]),
756
- input_tokens: import_v42.z.number(),
757
- output_tokens: import_v42.z.number()
758
- })
804
+ import_v42.z.union([
805
+ import_v42.z.object({
806
+ type: import_v42.z.union([
807
+ import_v42.z.literal("compaction"),
808
+ import_v42.z.literal("message")
809
+ ]),
810
+ input_tokens: import_v42.z.number(),
811
+ output_tokens: import_v42.z.number(),
812
+ cache_creation_input_tokens: import_v42.z.number().nullish(),
813
+ cache_read_input_tokens: import_v42.z.number().nullish()
814
+ }),
815
+ import_v42.z.object({
816
+ type: import_v42.z.literal("advisor_message"),
817
+ model: import_v42.z.string(),
818
+ input_tokens: import_v42.z.number(),
819
+ output_tokens: import_v42.z.number(),
820
+ cache_creation_input_tokens: import_v42.z.number().nullish(),
821
+ cache_read_input_tokens: import_v42.z.number().nullish()
822
+ })
823
+ ])
759
824
  ).nullish()
760
825
  }),
761
826
  context_management: import_v42.z.object({
@@ -1059,91 +1124,88 @@ var CacheControlValidator = class {
1059
1124
  }
1060
1125
  };
1061
1126
 
1062
- // src/tool/text-editor_20250728.ts
1127
+ // src/tool/advisor_20260301.ts
1063
1128
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1064
1129
  var import_v44 = require("zod/v4");
1065
- var textEditor_20250728ArgsSchema = (0, import_provider_utils3.lazySchema)(
1130
+ var advisor_20260301ArgsSchema = (0, import_provider_utils3.lazySchema)(
1066
1131
  () => (0, import_provider_utils3.zodSchema)(
1067
1132
  import_v44.z.object({
1068
- maxCharacters: import_v44.z.number().optional()
1133
+ model: import_v44.z.string(),
1134
+ maxUses: import_v44.z.number().optional(),
1135
+ caching: import_v44.z.object({
1136
+ type: import_v44.z.literal("ephemeral"),
1137
+ ttl: import_v44.z.union([import_v44.z.literal("5m"), import_v44.z.literal("1h")])
1138
+ }).optional()
1069
1139
  })
1070
1140
  )
1071
1141
  );
1072
- var textEditor_20250728InputSchema = (0, import_provider_utils3.lazySchema)(
1142
+ var advisor_20260301OutputSchema = (0, import_provider_utils3.lazySchema)(
1073
1143
  () => (0, import_provider_utils3.zodSchema)(
1074
- import_v44.z.object({
1075
- command: import_v44.z.enum(["view", "create", "str_replace", "insert"]),
1076
- path: import_v44.z.string(),
1077
- file_text: import_v44.z.string().optional(),
1078
- insert_line: import_v44.z.number().int().optional(),
1079
- new_str: import_v44.z.string().optional(),
1080
- insert_text: import_v44.z.string().optional(),
1081
- old_str: import_v44.z.string().optional(),
1082
- view_range: import_v44.z.array(import_v44.z.number().int()).optional()
1083
- })
1144
+ import_v44.z.discriminatedUnion("type", [
1145
+ import_v44.z.object({
1146
+ type: import_v44.z.literal("advisor_result"),
1147
+ text: import_v44.z.string()
1148
+ }),
1149
+ import_v44.z.object({
1150
+ type: import_v44.z.literal("advisor_redacted_result"),
1151
+ encryptedContent: import_v44.z.string()
1152
+ }),
1153
+ import_v44.z.object({
1154
+ type: import_v44.z.literal("advisor_tool_result_error"),
1155
+ errorCode: import_v44.z.string()
1156
+ })
1157
+ ])
1084
1158
  )
1085
1159
  );
1086
- var factory = (0, import_provider_utils3.createProviderToolFactory)({
1087
- id: "anthropic.text_editor_20250728",
1088
- inputSchema: textEditor_20250728InputSchema
1160
+ var advisor_20260301InputSchema = (0, import_provider_utils3.lazySchema)(
1161
+ () => (0, import_provider_utils3.zodSchema)(import_v44.z.object({}).strict())
1162
+ );
1163
+ var factory = (0, import_provider_utils3.createProviderToolFactoryWithOutputSchema)({
1164
+ id: "anthropic.advisor_20260301",
1165
+ inputSchema: advisor_20260301InputSchema,
1166
+ outputSchema: advisor_20260301OutputSchema,
1167
+ supportsDeferredResults: true
1089
1168
  });
1090
- var textEditor_20250728 = (args = {}) => {
1169
+ var advisor_20260301 = (args) => {
1091
1170
  return factory(args);
1092
1171
  };
1093
1172
 
1094
- // src/tool/web-search_20260209.ts
1173
+ // src/tool/text-editor_20250728.ts
1095
1174
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
1096
1175
  var import_v45 = require("zod/v4");
1097
- var webSearch_20260209ArgsSchema = (0, import_provider_utils4.lazySchema)(
1176
+ var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
1098
1177
  () => (0, import_provider_utils4.zodSchema)(
1099
1178
  import_v45.z.object({
1100
- maxUses: import_v45.z.number().optional(),
1101
- allowedDomains: import_v45.z.array(import_v45.z.string()).optional(),
1102
- blockedDomains: import_v45.z.array(import_v45.z.string()).optional(),
1103
- userLocation: import_v45.z.object({
1104
- type: import_v45.z.literal("approximate"),
1105
- city: import_v45.z.string().optional(),
1106
- region: import_v45.z.string().optional(),
1107
- country: import_v45.z.string().optional(),
1108
- timezone: import_v45.z.string().optional()
1109
- }).optional()
1179
+ maxCharacters: import_v45.z.number().optional()
1110
1180
  })
1111
1181
  )
1112
1182
  );
1113
- var webSearch_20260209OutputSchema = (0, import_provider_utils4.lazySchema)(
1114
- () => (0, import_provider_utils4.zodSchema)(
1115
- import_v45.z.array(
1116
- import_v45.z.object({
1117
- url: import_v45.z.string(),
1118
- title: import_v45.z.string().nullable(),
1119
- pageAge: import_v45.z.string().nullable(),
1120
- encryptedContent: import_v45.z.string(),
1121
- type: import_v45.z.literal("web_search_result")
1122
- })
1123
- )
1124
- )
1125
- );
1126
- var webSearch_20260209InputSchema = (0, import_provider_utils4.lazySchema)(
1183
+ var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
1127
1184
  () => (0, import_provider_utils4.zodSchema)(
1128
1185
  import_v45.z.object({
1129
- query: import_v45.z.string()
1186
+ command: import_v45.z.enum(["view", "create", "str_replace", "insert"]),
1187
+ path: import_v45.z.string(),
1188
+ file_text: import_v45.z.string().optional(),
1189
+ insert_line: import_v45.z.number().int().optional(),
1190
+ new_str: import_v45.z.string().optional(),
1191
+ insert_text: import_v45.z.string().optional(),
1192
+ old_str: import_v45.z.string().optional(),
1193
+ view_range: import_v45.z.array(import_v45.z.number().int()).optional()
1130
1194
  })
1131
1195
  )
1132
1196
  );
1133
- var factory2 = (0, import_provider_utils4.createProviderToolFactoryWithOutputSchema)({
1134
- id: "anthropic.web_search_20260209",
1135
- inputSchema: webSearch_20260209InputSchema,
1136
- outputSchema: webSearch_20260209OutputSchema,
1137
- supportsDeferredResults: true
1197
+ var factory2 = (0, import_provider_utils4.createProviderToolFactory)({
1198
+ id: "anthropic.text_editor_20250728",
1199
+ inputSchema: textEditor_20250728InputSchema
1138
1200
  });
1139
- var webSearch_20260209 = (args = {}) => {
1201
+ var textEditor_20250728 = (args = {}) => {
1140
1202
  return factory2(args);
1141
1203
  };
1142
1204
 
1143
- // src/tool/web-search_20250305.ts
1205
+ // src/tool/web-search_20260209.ts
1144
1206
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
1145
1207
  var import_v46 = require("zod/v4");
1146
- var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
1208
+ var webSearch_20260209ArgsSchema = (0, import_provider_utils5.lazySchema)(
1147
1209
  () => (0, import_provider_utils5.zodSchema)(
1148
1210
  import_v46.z.object({
1149
1211
  maxUses: import_v46.z.number().optional(),
@@ -1159,7 +1221,7 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
1159
1221
  })
1160
1222
  )
1161
1223
  );
1162
- var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
1224
+ var webSearch_20260209OutputSchema = (0, import_provider_utils5.lazySchema)(
1163
1225
  () => (0, import_provider_utils5.zodSchema)(
1164
1226
  import_v46.z.array(
1165
1227
  import_v46.z.object({
@@ -1172,7 +1234,7 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
1172
1234
  )
1173
1235
  )
1174
1236
  );
1175
- var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
1237
+ var webSearch_20260209InputSchema = (0, import_provider_utils5.lazySchema)(
1176
1238
  () => (0, import_provider_utils5.zodSchema)(
1177
1239
  import_v46.z.object({
1178
1240
  query: import_v46.z.string()
@@ -1180,76 +1242,68 @@ var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
1180
1242
  )
1181
1243
  );
1182
1244
  var factory3 = (0, import_provider_utils5.createProviderToolFactoryWithOutputSchema)({
1183
- id: "anthropic.web_search_20250305",
1184
- inputSchema: webSearch_20250305InputSchema,
1185
- outputSchema: webSearch_20250305OutputSchema,
1245
+ id: "anthropic.web_search_20260209",
1246
+ inputSchema: webSearch_20260209InputSchema,
1247
+ outputSchema: webSearch_20260209OutputSchema,
1186
1248
  supportsDeferredResults: true
1187
1249
  });
1188
- var webSearch_20250305 = (args = {}) => {
1250
+ var webSearch_20260209 = (args = {}) => {
1189
1251
  return factory3(args);
1190
1252
  };
1191
1253
 
1192
- // src/tool/web-fetch-20260209.ts
1254
+ // src/tool/web-search_20250305.ts
1193
1255
  var import_provider_utils6 = require("@ai-sdk/provider-utils");
1194
1256
  var import_v47 = require("zod/v4");
1195
- var webFetch_20260209ArgsSchema = (0, import_provider_utils6.lazySchema)(
1257
+ var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
1196
1258
  () => (0, import_provider_utils6.zodSchema)(
1197
1259
  import_v47.z.object({
1198
1260
  maxUses: import_v47.z.number().optional(),
1199
1261
  allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1200
1262
  blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
1201
- citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
1202
- maxContentTokens: import_v47.z.number().optional()
1263
+ userLocation: import_v47.z.object({
1264
+ type: import_v47.z.literal("approximate"),
1265
+ city: import_v47.z.string().optional(),
1266
+ region: import_v47.z.string().optional(),
1267
+ country: import_v47.z.string().optional(),
1268
+ timezone: import_v47.z.string().optional()
1269
+ }).optional()
1203
1270
  })
1204
1271
  )
1205
1272
  );
1206
- var webFetch_20260209OutputSchema = (0, import_provider_utils6.lazySchema)(
1273
+ var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
1207
1274
  () => (0, import_provider_utils6.zodSchema)(
1208
- import_v47.z.object({
1209
- type: import_v47.z.literal("web_fetch_result"),
1210
- url: import_v47.z.string(),
1211
- content: import_v47.z.object({
1212
- type: import_v47.z.literal("document"),
1275
+ import_v47.z.array(
1276
+ import_v47.z.object({
1277
+ url: import_v47.z.string(),
1213
1278
  title: import_v47.z.string().nullable(),
1214
- citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
1215
- source: import_v47.z.union([
1216
- import_v47.z.object({
1217
- type: import_v47.z.literal("base64"),
1218
- mediaType: import_v47.z.literal("application/pdf"),
1219
- data: import_v47.z.string()
1220
- }),
1221
- import_v47.z.object({
1222
- type: import_v47.z.literal("text"),
1223
- mediaType: import_v47.z.literal("text/plain"),
1224
- data: import_v47.z.string()
1225
- })
1226
- ])
1227
- }),
1228
- retrievedAt: import_v47.z.string().nullable()
1229
- })
1279
+ pageAge: import_v47.z.string().nullable(),
1280
+ encryptedContent: import_v47.z.string(),
1281
+ type: import_v47.z.literal("web_search_result")
1282
+ })
1283
+ )
1230
1284
  )
1231
1285
  );
1232
- var webFetch_20260209InputSchema = (0, import_provider_utils6.lazySchema)(
1286
+ var webSearch_20250305InputSchema = (0, import_provider_utils6.lazySchema)(
1233
1287
  () => (0, import_provider_utils6.zodSchema)(
1234
1288
  import_v47.z.object({
1235
- url: import_v47.z.string()
1289
+ query: import_v47.z.string()
1236
1290
  })
1237
1291
  )
1238
1292
  );
1239
1293
  var factory4 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
1240
- id: "anthropic.web_fetch_20260209",
1241
- inputSchema: webFetch_20260209InputSchema,
1242
- outputSchema: webFetch_20260209OutputSchema,
1294
+ id: "anthropic.web_search_20250305",
1295
+ inputSchema: webSearch_20250305InputSchema,
1296
+ outputSchema: webSearch_20250305OutputSchema,
1243
1297
  supportsDeferredResults: true
1244
1298
  });
1245
- var webFetch_20260209 = (args = {}) => {
1299
+ var webSearch_20250305 = (args = {}) => {
1246
1300
  return factory4(args);
1247
1301
  };
1248
1302
 
1249
- // src/tool/web-fetch-20250910.ts
1303
+ // src/tool/web-fetch-20260209.ts
1250
1304
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
1251
1305
  var import_v48 = require("zod/v4");
1252
- var webFetch_20250910ArgsSchema = (0, import_provider_utils7.lazySchema)(
1306
+ var webFetch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
1253
1307
  () => (0, import_provider_utils7.zodSchema)(
1254
1308
  import_v48.z.object({
1255
1309
  maxUses: import_v48.z.number().optional(),
@@ -1260,7 +1314,7 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils7.lazySchema)(
1260
1314
  })
1261
1315
  )
1262
1316
  );
1263
- var webFetch_20250910OutputSchema = (0, import_provider_utils7.lazySchema)(
1317
+ var webFetch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
1264
1318
  () => (0, import_provider_utils7.zodSchema)(
1265
1319
  import_v48.z.object({
1266
1320
  type: import_v48.z.literal("web_fetch_result"),
@@ -1286,7 +1340,7 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils7.lazySchema)(
1286
1340
  })
1287
1341
  )
1288
1342
  );
1289
- var webFetch_20250910InputSchema = (0, import_provider_utils7.lazySchema)(
1343
+ var webFetch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
1290
1344
  () => (0, import_provider_utils7.zodSchema)(
1291
1345
  import_v48.z.object({
1292
1346
  url: import_v48.z.string()
@@ -1294,17 +1348,74 @@ var webFetch_20250910InputSchema = (0, import_provider_utils7.lazySchema)(
1294
1348
  )
1295
1349
  );
1296
1350
  var factory5 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
1351
+ id: "anthropic.web_fetch_20260209",
1352
+ inputSchema: webFetch_20260209InputSchema,
1353
+ outputSchema: webFetch_20260209OutputSchema,
1354
+ supportsDeferredResults: true
1355
+ });
1356
+ var webFetch_20260209 = (args = {}) => {
1357
+ return factory5(args);
1358
+ };
1359
+
1360
+ // src/tool/web-fetch-20250910.ts
1361
+ var import_provider_utils8 = require("@ai-sdk/provider-utils");
1362
+ var import_v49 = require("zod/v4");
1363
+ var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
1364
+ () => (0, import_provider_utils8.zodSchema)(
1365
+ import_v49.z.object({
1366
+ maxUses: import_v49.z.number().optional(),
1367
+ allowedDomains: import_v49.z.array(import_v49.z.string()).optional(),
1368
+ blockedDomains: import_v49.z.array(import_v49.z.string()).optional(),
1369
+ citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
1370
+ maxContentTokens: import_v49.z.number().optional()
1371
+ })
1372
+ )
1373
+ );
1374
+ var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
1375
+ () => (0, import_provider_utils8.zodSchema)(
1376
+ import_v49.z.object({
1377
+ type: import_v49.z.literal("web_fetch_result"),
1378
+ url: import_v49.z.string(),
1379
+ content: import_v49.z.object({
1380
+ type: import_v49.z.literal("document"),
1381
+ title: import_v49.z.string().nullable(),
1382
+ citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
1383
+ source: import_v49.z.union([
1384
+ import_v49.z.object({
1385
+ type: import_v49.z.literal("base64"),
1386
+ mediaType: import_v49.z.literal("application/pdf"),
1387
+ data: import_v49.z.string()
1388
+ }),
1389
+ import_v49.z.object({
1390
+ type: import_v49.z.literal("text"),
1391
+ mediaType: import_v49.z.literal("text/plain"),
1392
+ data: import_v49.z.string()
1393
+ })
1394
+ ])
1395
+ }),
1396
+ retrievedAt: import_v49.z.string().nullable()
1397
+ })
1398
+ )
1399
+ );
1400
+ var webFetch_20250910InputSchema = (0, import_provider_utils8.lazySchema)(
1401
+ () => (0, import_provider_utils8.zodSchema)(
1402
+ import_v49.z.object({
1403
+ url: import_v49.z.string()
1404
+ })
1405
+ )
1406
+ );
1407
+ var factory6 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
1297
1408
  id: "anthropic.web_fetch_20250910",
1298
1409
  inputSchema: webFetch_20250910InputSchema,
1299
1410
  outputSchema: webFetch_20250910OutputSchema,
1300
1411
  supportsDeferredResults: true
1301
1412
  });
1302
1413
  var webFetch_20250910 = (args = {}) => {
1303
- return factory5(args);
1414
+ return factory6(args);
1304
1415
  };
1305
1416
 
1306
1417
  // src/anthropic-prepare-tools.ts
1307
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
1418
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1308
1419
  async function prepareTools({
1309
1420
  tools,
1310
1421
  toolChoice,
@@ -1455,7 +1566,7 @@ async function prepareTools({
1455
1566
  break;
1456
1567
  }
1457
1568
  case "anthropic.text_editor_20250728": {
1458
- const args = await (0, import_provider_utils8.validateTypes)({
1569
+ const args = await (0, import_provider_utils9.validateTypes)({
1459
1570
  value: tool.args,
1460
1571
  schema: textEditor_20250728ArgsSchema
1461
1572
  });
@@ -1495,7 +1606,7 @@ async function prepareTools({
1495
1606
  }
1496
1607
  case "anthropic.web_fetch_20250910": {
1497
1608
  betas.add("web-fetch-2025-09-10");
1498
- const args = await (0, import_provider_utils8.validateTypes)({
1609
+ const args = await (0, import_provider_utils9.validateTypes)({
1499
1610
  value: tool.args,
1500
1611
  schema: webFetch_20250910ArgsSchema
1501
1612
  });
@@ -1513,7 +1624,7 @@ async function prepareTools({
1513
1624
  }
1514
1625
  case "anthropic.web_fetch_20260209": {
1515
1626
  betas.add("code-execution-web-tools-2026-02-09");
1516
- const args = await (0, import_provider_utils8.validateTypes)({
1627
+ const args = await (0, import_provider_utils9.validateTypes)({
1517
1628
  value: tool.args,
1518
1629
  schema: webFetch_20260209ArgsSchema
1519
1630
  });
@@ -1530,7 +1641,7 @@ async function prepareTools({
1530
1641
  break;
1531
1642
  }
1532
1643
  case "anthropic.web_search_20250305": {
1533
- const args = await (0, import_provider_utils8.validateTypes)({
1644
+ const args = await (0, import_provider_utils9.validateTypes)({
1534
1645
  value: tool.args,
1535
1646
  schema: webSearch_20250305ArgsSchema
1536
1647
  });
@@ -1547,7 +1658,7 @@ async function prepareTools({
1547
1658
  }
1548
1659
  case "anthropic.web_search_20260209": {
1549
1660
  betas.add("code-execution-web-tools-2026-02-09");
1550
- const args = await (0, import_provider_utils8.validateTypes)({
1661
+ const args = await (0, import_provider_utils9.validateTypes)({
1551
1662
  value: tool.args,
1552
1663
  schema: webSearch_20260209ArgsSchema
1553
1664
  });
@@ -1576,6 +1687,21 @@ async function prepareTools({
1576
1687
  });
1577
1688
  break;
1578
1689
  }
1690
+ case "anthropic.advisor_20260301": {
1691
+ betas.add("advisor-tool-2026-03-01");
1692
+ const args = await (0, import_provider_utils9.validateTypes)({
1693
+ value: tool.args,
1694
+ schema: advisor_20260301ArgsSchema
1695
+ });
1696
+ anthropicTools2.push({
1697
+ type: "advisor_20260301",
1698
+ name: "advisor",
1699
+ model: args.model,
1700
+ ...args.maxUses !== void 0 && { max_uses: args.maxUses },
1701
+ ...args.caching !== void 0 && { caching: args.caching }
1702
+ });
1703
+ break;
1704
+ }
1579
1705
  default: {
1580
1706
  toolWarnings.push({
1581
1707
  type: "unsupported",
@@ -1658,15 +1784,23 @@ function convertAnthropicMessagesUsage({
1658
1784
  let inputTokens;
1659
1785
  let outputTokens;
1660
1786
  if (usage.iterations && usage.iterations.length > 0) {
1661
- const totals = usage.iterations.reduce(
1662
- (acc, iter) => ({
1663
- input: acc.input + iter.input_tokens,
1664
- output: acc.output + iter.output_tokens
1665
- }),
1666
- { input: 0, output: 0 }
1787
+ const executorIterations = usage.iterations.filter(
1788
+ (iter) => iter.type === "compaction" || iter.type === "message"
1667
1789
  );
1668
- inputTokens = totals.input;
1669
- outputTokens = totals.output;
1790
+ if (executorIterations.length > 0) {
1791
+ const totals = executorIterations.reduce(
1792
+ (acc, iter) => ({
1793
+ input: acc.input + iter.input_tokens,
1794
+ output: acc.output + iter.output_tokens
1795
+ }),
1796
+ { input: 0, output: 0 }
1797
+ );
1798
+ inputTokens = totals.input;
1799
+ outputTokens = totals.output;
1800
+ } else {
1801
+ inputTokens = usage.input_tokens;
1802
+ outputTokens = usage.output_tokens;
1803
+ }
1670
1804
  } else {
1671
1805
  inputTokens = usage.input_tokens;
1672
1806
  outputTokens = usage.output_tokens;
@@ -1689,156 +1823,47 @@ function convertAnthropicMessagesUsage({
1689
1823
 
1690
1824
  // src/convert-to-anthropic-messages-prompt.ts
1691
1825
  var import_provider2 = require("@ai-sdk/provider");
1692
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1826
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
1693
1827
 
1694
1828
  // src/tool/code-execution_20250522.ts
1695
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
1696
- var import_v49 = require("zod/v4");
1697
- var codeExecution_20250522OutputSchema = (0, import_provider_utils9.lazySchema)(
1698
- () => (0, import_provider_utils9.zodSchema)(
1699
- import_v49.z.object({
1700
- type: import_v49.z.literal("code_execution_result"),
1701
- stdout: import_v49.z.string(),
1702
- stderr: import_v49.z.string(),
1703
- return_code: import_v49.z.number(),
1704
- content: import_v49.z.array(
1705
- import_v49.z.object({
1706
- type: import_v49.z.literal("code_execution_output"),
1707
- file_id: import_v49.z.string()
1829
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
1830
+ var import_v410 = require("zod/v4");
1831
+ var codeExecution_20250522OutputSchema = (0, import_provider_utils10.lazySchema)(
1832
+ () => (0, import_provider_utils10.zodSchema)(
1833
+ import_v410.z.object({
1834
+ type: import_v410.z.literal("code_execution_result"),
1835
+ stdout: import_v410.z.string(),
1836
+ stderr: import_v410.z.string(),
1837
+ return_code: import_v410.z.number(),
1838
+ content: import_v410.z.array(
1839
+ import_v410.z.object({
1840
+ type: import_v410.z.literal("code_execution_output"),
1841
+ file_id: import_v410.z.string()
1708
1842
  })
1709
1843
  ).optional().default([])
1710
1844
  })
1711
1845
  )
1712
1846
  );
1713
- var codeExecution_20250522InputSchema = (0, import_provider_utils9.lazySchema)(
1714
- () => (0, import_provider_utils9.zodSchema)(
1715
- import_v49.z.object({
1716
- code: import_v49.z.string()
1847
+ var codeExecution_20250522InputSchema = (0, import_provider_utils10.lazySchema)(
1848
+ () => (0, import_provider_utils10.zodSchema)(
1849
+ import_v410.z.object({
1850
+ code: import_v410.z.string()
1717
1851
  })
1718
1852
  )
1719
1853
  );
1720
- var factory6 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
1854
+ var factory7 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
1721
1855
  id: "anthropic.code_execution_20250522",
1722
1856
  inputSchema: codeExecution_20250522InputSchema,
1723
1857
  outputSchema: codeExecution_20250522OutputSchema
1724
1858
  });
1725
1859
  var codeExecution_20250522 = (args = {}) => {
1726
- return factory6(args);
1727
- };
1728
-
1729
- // src/tool/code-execution_20250825.ts
1730
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1731
- var import_v410 = require("zod/v4");
1732
- var codeExecution_20250825OutputSchema = (0, import_provider_utils10.lazySchema)(
1733
- () => (0, import_provider_utils10.zodSchema)(
1734
- import_v410.z.discriminatedUnion("type", [
1735
- import_v410.z.object({
1736
- type: import_v410.z.literal("code_execution_result"),
1737
- stdout: import_v410.z.string(),
1738
- stderr: import_v410.z.string(),
1739
- return_code: import_v410.z.number(),
1740
- content: import_v410.z.array(
1741
- import_v410.z.object({
1742
- type: import_v410.z.literal("code_execution_output"),
1743
- file_id: import_v410.z.string()
1744
- })
1745
- ).optional().default([])
1746
- }),
1747
- import_v410.z.object({
1748
- type: import_v410.z.literal("bash_code_execution_result"),
1749
- content: import_v410.z.array(
1750
- import_v410.z.object({
1751
- type: import_v410.z.literal("bash_code_execution_output"),
1752
- file_id: import_v410.z.string()
1753
- })
1754
- ),
1755
- stdout: import_v410.z.string(),
1756
- stderr: import_v410.z.string(),
1757
- return_code: import_v410.z.number()
1758
- }),
1759
- import_v410.z.object({
1760
- type: import_v410.z.literal("bash_code_execution_tool_result_error"),
1761
- error_code: import_v410.z.string()
1762
- }),
1763
- import_v410.z.object({
1764
- type: import_v410.z.literal("text_editor_code_execution_tool_result_error"),
1765
- error_code: import_v410.z.string()
1766
- }),
1767
- import_v410.z.object({
1768
- type: import_v410.z.literal("text_editor_code_execution_view_result"),
1769
- content: import_v410.z.string(),
1770
- file_type: import_v410.z.string(),
1771
- num_lines: import_v410.z.number().nullable(),
1772
- start_line: import_v410.z.number().nullable(),
1773
- total_lines: import_v410.z.number().nullable()
1774
- }),
1775
- import_v410.z.object({
1776
- type: import_v410.z.literal("text_editor_code_execution_create_result"),
1777
- is_file_update: import_v410.z.boolean()
1778
- }),
1779
- import_v410.z.object({
1780
- type: import_v410.z.literal("text_editor_code_execution_str_replace_result"),
1781
- lines: import_v410.z.array(import_v410.z.string()).nullable(),
1782
- new_lines: import_v410.z.number().nullable(),
1783
- new_start: import_v410.z.number().nullable(),
1784
- old_lines: import_v410.z.number().nullable(),
1785
- old_start: import_v410.z.number().nullable()
1786
- })
1787
- ])
1788
- )
1789
- );
1790
- var codeExecution_20250825InputSchema = (0, import_provider_utils10.lazySchema)(
1791
- () => (0, import_provider_utils10.zodSchema)(
1792
- import_v410.z.discriminatedUnion("type", [
1793
- // Programmatic tool calling format (mapped from { code } by AI SDK)
1794
- import_v410.z.object({
1795
- type: import_v410.z.literal("programmatic-tool-call"),
1796
- code: import_v410.z.string()
1797
- }),
1798
- import_v410.z.object({
1799
- type: import_v410.z.literal("bash_code_execution"),
1800
- command: import_v410.z.string()
1801
- }),
1802
- import_v410.z.discriminatedUnion("command", [
1803
- import_v410.z.object({
1804
- type: import_v410.z.literal("text_editor_code_execution"),
1805
- command: import_v410.z.literal("view"),
1806
- path: import_v410.z.string()
1807
- }),
1808
- import_v410.z.object({
1809
- type: import_v410.z.literal("text_editor_code_execution"),
1810
- command: import_v410.z.literal("create"),
1811
- path: import_v410.z.string(),
1812
- file_text: import_v410.z.string().nullish()
1813
- }),
1814
- import_v410.z.object({
1815
- type: import_v410.z.literal("text_editor_code_execution"),
1816
- command: import_v410.z.literal("str_replace"),
1817
- path: import_v410.z.string(),
1818
- old_str: import_v410.z.string(),
1819
- new_str: import_v410.z.string()
1820
- })
1821
- ])
1822
- ])
1823
- )
1824
- );
1825
- var factory7 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
1826
- id: "anthropic.code_execution_20250825",
1827
- inputSchema: codeExecution_20250825InputSchema,
1828
- outputSchema: codeExecution_20250825OutputSchema,
1829
- // Programmatic tool calling: tool results may be deferred to a later turn
1830
- // when code execution triggers a client-executed tool that needs to be
1831
- // resolved before the code execution result can be returned.
1832
- supportsDeferredResults: true
1833
- });
1834
- var codeExecution_20250825 = (args = {}) => {
1835
1860
  return factory7(args);
1836
1861
  };
1837
1862
 
1838
- // src/tool/code-execution_20260120.ts
1863
+ // src/tool/code-execution_20250825.ts
1839
1864
  var import_provider_utils11 = require("@ai-sdk/provider-utils");
1840
1865
  var import_v411 = require("zod/v4");
1841
- var codeExecution_20260120OutputSchema = (0, import_provider_utils11.lazySchema)(
1866
+ var codeExecution_20250825OutputSchema = (0, import_provider_utils11.lazySchema)(
1842
1867
  () => (0, import_provider_utils11.zodSchema)(
1843
1868
  import_v411.z.discriminatedUnion("type", [
1844
1869
  import_v411.z.object({
@@ -1853,18 +1878,6 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils11.lazySchema)
1853
1878
  })
1854
1879
  ).optional().default([])
1855
1880
  }),
1856
- import_v411.z.object({
1857
- type: import_v411.z.literal("encrypted_code_execution_result"),
1858
- encrypted_stdout: import_v411.z.string(),
1859
- stderr: import_v411.z.string(),
1860
- return_code: import_v411.z.number(),
1861
- content: import_v411.z.array(
1862
- import_v411.z.object({
1863
- type: import_v411.z.literal("code_execution_output"),
1864
- file_id: import_v411.z.string()
1865
- })
1866
- ).optional().default([])
1867
- }),
1868
1881
  import_v411.z.object({
1869
1882
  type: import_v411.z.literal("bash_code_execution_result"),
1870
1883
  content: import_v411.z.array(
@@ -1908,9 +1921,10 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils11.lazySchema)
1908
1921
  ])
1909
1922
  )
1910
1923
  );
1911
- var codeExecution_20260120InputSchema = (0, import_provider_utils11.lazySchema)(
1924
+ var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
1912
1925
  () => (0, import_provider_utils11.zodSchema)(
1913
1926
  import_v411.z.discriminatedUnion("type", [
1927
+ // Programmatic tool calling format (mapped from { code } by AI SDK)
1914
1928
  import_v411.z.object({
1915
1929
  type: import_v411.z.literal("programmatic-tool-call"),
1916
1930
  code: import_v411.z.string()
@@ -1943,31 +1957,151 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils11.lazySchema)(
1943
1957
  )
1944
1958
  );
1945
1959
  var factory8 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
1946
- id: "anthropic.code_execution_20260120",
1947
- inputSchema: codeExecution_20260120InputSchema,
1948
- outputSchema: codeExecution_20260120OutputSchema,
1960
+ id: "anthropic.code_execution_20250825",
1961
+ inputSchema: codeExecution_20250825InputSchema,
1962
+ outputSchema: codeExecution_20250825OutputSchema,
1963
+ // Programmatic tool calling: tool results may be deferred to a later turn
1964
+ // when code execution triggers a client-executed tool that needs to be
1965
+ // resolved before the code execution result can be returned.
1949
1966
  supportsDeferredResults: true
1950
1967
  });
1951
- var codeExecution_20260120 = (args = {}) => {
1968
+ var codeExecution_20250825 = (args = {}) => {
1952
1969
  return factory8(args);
1953
1970
  };
1954
1971
 
1955
- // src/tool/tool-search-regex_20251119.ts
1972
+ // src/tool/code-execution_20260120.ts
1956
1973
  var import_provider_utils12 = require("@ai-sdk/provider-utils");
1957
1974
  var import_v412 = require("zod/v4");
1958
- var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils12.lazySchema)(
1975
+ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)(
1959
1976
  () => (0, import_provider_utils12.zodSchema)(
1960
- import_v412.z.array(
1977
+ import_v412.z.discriminatedUnion("type", [
1961
1978
  import_v412.z.object({
1962
- type: import_v412.z.literal("tool_reference"),
1963
- toolName: import_v412.z.string()
1979
+ type: import_v412.z.literal("code_execution_result"),
1980
+ stdout: import_v412.z.string(),
1981
+ stderr: import_v412.z.string(),
1982
+ return_code: import_v412.z.number(),
1983
+ content: import_v412.z.array(
1984
+ import_v412.z.object({
1985
+ type: import_v412.z.literal("code_execution_output"),
1986
+ file_id: import_v412.z.string()
1987
+ })
1988
+ ).optional().default([])
1989
+ }),
1990
+ import_v412.z.object({
1991
+ type: import_v412.z.literal("encrypted_code_execution_result"),
1992
+ encrypted_stdout: import_v412.z.string(),
1993
+ stderr: import_v412.z.string(),
1994
+ return_code: import_v412.z.number(),
1995
+ content: import_v412.z.array(
1996
+ import_v412.z.object({
1997
+ type: import_v412.z.literal("code_execution_output"),
1998
+ file_id: import_v412.z.string()
1999
+ })
2000
+ ).optional().default([])
2001
+ }),
2002
+ import_v412.z.object({
2003
+ type: import_v412.z.literal("bash_code_execution_result"),
2004
+ content: import_v412.z.array(
2005
+ import_v412.z.object({
2006
+ type: import_v412.z.literal("bash_code_execution_output"),
2007
+ file_id: import_v412.z.string()
2008
+ })
2009
+ ),
2010
+ stdout: import_v412.z.string(),
2011
+ stderr: import_v412.z.string(),
2012
+ return_code: import_v412.z.number()
2013
+ }),
2014
+ import_v412.z.object({
2015
+ type: import_v412.z.literal("bash_code_execution_tool_result_error"),
2016
+ error_code: import_v412.z.string()
2017
+ }),
2018
+ import_v412.z.object({
2019
+ type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
2020
+ error_code: import_v412.z.string()
2021
+ }),
2022
+ import_v412.z.object({
2023
+ type: import_v412.z.literal("text_editor_code_execution_view_result"),
2024
+ content: import_v412.z.string(),
2025
+ file_type: import_v412.z.string(),
2026
+ num_lines: import_v412.z.number().nullable(),
2027
+ start_line: import_v412.z.number().nullable(),
2028
+ total_lines: import_v412.z.number().nullable()
2029
+ }),
2030
+ import_v412.z.object({
2031
+ type: import_v412.z.literal("text_editor_code_execution_create_result"),
2032
+ is_file_update: import_v412.z.boolean()
2033
+ }),
2034
+ import_v412.z.object({
2035
+ type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
2036
+ lines: import_v412.z.array(import_v412.z.string()).nullable(),
2037
+ new_lines: import_v412.z.number().nullable(),
2038
+ new_start: import_v412.z.number().nullable(),
2039
+ old_lines: import_v412.z.number().nullable(),
2040
+ old_start: import_v412.z.number().nullable()
1964
2041
  })
1965
- )
2042
+ ])
1966
2043
  )
1967
2044
  );
1968
- var toolSearchRegex_20251119InputSchema = (0, import_provider_utils12.lazySchema)(
2045
+ var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
1969
2046
  () => (0, import_provider_utils12.zodSchema)(
1970
- import_v412.z.object({
2047
+ import_v412.z.discriminatedUnion("type", [
2048
+ import_v412.z.object({
2049
+ type: import_v412.z.literal("programmatic-tool-call"),
2050
+ code: import_v412.z.string()
2051
+ }),
2052
+ import_v412.z.object({
2053
+ type: import_v412.z.literal("bash_code_execution"),
2054
+ command: import_v412.z.string()
2055
+ }),
2056
+ import_v412.z.discriminatedUnion("command", [
2057
+ import_v412.z.object({
2058
+ type: import_v412.z.literal("text_editor_code_execution"),
2059
+ command: import_v412.z.literal("view"),
2060
+ path: import_v412.z.string()
2061
+ }),
2062
+ import_v412.z.object({
2063
+ type: import_v412.z.literal("text_editor_code_execution"),
2064
+ command: import_v412.z.literal("create"),
2065
+ path: import_v412.z.string(),
2066
+ file_text: import_v412.z.string().nullish()
2067
+ }),
2068
+ import_v412.z.object({
2069
+ type: import_v412.z.literal("text_editor_code_execution"),
2070
+ command: import_v412.z.literal("str_replace"),
2071
+ path: import_v412.z.string(),
2072
+ old_str: import_v412.z.string(),
2073
+ new_str: import_v412.z.string()
2074
+ })
2075
+ ])
2076
+ ])
2077
+ )
2078
+ );
2079
+ var factory9 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
2080
+ id: "anthropic.code_execution_20260120",
2081
+ inputSchema: codeExecution_20260120InputSchema,
2082
+ outputSchema: codeExecution_20260120OutputSchema,
2083
+ supportsDeferredResults: true
2084
+ });
2085
+ var codeExecution_20260120 = (args = {}) => {
2086
+ return factory9(args);
2087
+ };
2088
+
2089
+ // src/tool/tool-search-regex_20251119.ts
2090
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
2091
+ var import_v413 = require("zod/v4");
2092
+ var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils13.lazySchema)(
2093
+ () => (0, import_provider_utils13.zodSchema)(
2094
+ import_v413.z.array(
2095
+ import_v413.z.object({
2096
+ type: import_v413.z.literal("tool_reference"),
2097
+ toolName: import_v413.z.string()
2098
+ })
2099
+ )
2100
+ )
2101
+ );
2102
+ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema)(
2103
+ () => (0, import_provider_utils13.zodSchema)(
2104
+ import_v413.z.object({
1971
2105
  /**
1972
2106
  * A regex pattern to search for tools.
1973
2107
  * Uses Python re.search() syntax. Maximum 200 characters.
@@ -1978,28 +2112,28 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils12.lazySchema
1978
2112
  * - "database.*query|query.*database" - OR patterns for flexibility
1979
2113
  * - "(?i)slack" - case-insensitive search
1980
2114
  */
1981
- pattern: import_v412.z.string(),
2115
+ pattern: import_v413.z.string(),
1982
2116
  /**
1983
2117
  * Maximum number of tools to return. Optional.
1984
2118
  */
1985
- limit: import_v412.z.number().optional()
2119
+ limit: import_v413.z.number().optional()
1986
2120
  })
1987
2121
  )
1988
2122
  );
1989
- var factory9 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
2123
+ var factory10 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
1990
2124
  id: "anthropic.tool_search_regex_20251119",
1991
2125
  inputSchema: toolSearchRegex_20251119InputSchema,
1992
2126
  outputSchema: toolSearchRegex_20251119OutputSchema,
1993
2127
  supportsDeferredResults: true
1994
2128
  });
1995
2129
  var toolSearchRegex_20251119 = (args = {}) => {
1996
- return factory9(args);
2130
+ return factory10(args);
1997
2131
  };
1998
2132
 
1999
2133
  // src/convert-to-anthropic-messages-prompt.ts
2000
2134
  function convertToString(data) {
2001
2135
  if (typeof data === "string") {
2002
- return new TextDecoder().decode((0, import_provider_utils13.convertBase64ToUint8Array)(data));
2136
+ return new TextDecoder().decode((0, import_provider_utils14.convertBase64ToUint8Array)(data));
2003
2137
  }
2004
2138
  if (data instanceof Uint8Array) {
2005
2139
  return new TextDecoder().decode(data);
@@ -2037,7 +2171,7 @@ async function convertToAnthropicMessagesPrompt({
2037
2171
  const messages = [];
2038
2172
  async function shouldEnableCitations(providerMetadata) {
2039
2173
  var _a2, _b2;
2040
- const anthropicOptions = await (0, import_provider_utils13.parseProviderOptions)({
2174
+ const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
2041
2175
  provider: "anthropic",
2042
2176
  providerOptions: providerMetadata,
2043
2177
  schema: anthropicFilePartProviderOptions
@@ -2045,7 +2179,7 @@ async function convertToAnthropicMessagesPrompt({
2045
2179
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
2046
2180
  }
2047
2181
  async function getDocumentMetadata(providerMetadata) {
2048
- const anthropicOptions = await (0, import_provider_utils13.parseProviderOptions)({
2182
+ const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
2049
2183
  provider: "anthropic",
2050
2184
  providerOptions: providerMetadata,
2051
2185
  schema: anthropicFilePartProviderOptions
@@ -2111,7 +2245,7 @@ async function convertToAnthropicMessagesPrompt({
2111
2245
  } : {
2112
2246
  type: "base64",
2113
2247
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
2114
- data: (0, import_provider_utils13.convertToBase64)(part.data)
2248
+ data: (0, import_provider_utils14.convertToBase64)(part.data)
2115
2249
  },
2116
2250
  cache_control: cacheControl
2117
2251
  });
@@ -2131,7 +2265,7 @@ async function convertToAnthropicMessagesPrompt({
2131
2265
  } : {
2132
2266
  type: "base64",
2133
2267
  media_type: "application/pdf",
2134
- data: (0, import_provider_utils13.convertToBase64)(part.data)
2268
+ data: (0, import_provider_utils14.convertToBase64)(part.data)
2135
2269
  },
2136
2270
  title: (_b = metadata.title) != null ? _b : part.filename,
2137
2271
  ...metadata.context && { context: metadata.context },
@@ -2269,7 +2403,7 @@ async function convertToAnthropicMessagesPrompt({
2269
2403
  return void 0;
2270
2404
  }
2271
2405
  }
2272
- }).filter(import_provider_utils13.isNonNullable);
2406
+ }).filter(import_provider_utils14.isNonNullable);
2273
2407
  break;
2274
2408
  case "text":
2275
2409
  case "error-text":
@@ -2345,7 +2479,7 @@ async function convertToAnthropicMessagesPrompt({
2345
2479
  }
2346
2480
  case "reasoning": {
2347
2481
  if (sendReasoning) {
2348
- const reasoningMetadata = await (0, import_provider_utils13.parseProviderOptions)({
2482
+ const reasoningMetadata = await (0, import_provider_utils14.parseProviderOptions)({
2349
2483
  provider: "anthropic",
2350
2484
  providerOptions: part.providerOptions,
2351
2485
  schema: anthropicReasoningMetadataSchema
@@ -2457,6 +2591,14 @@ async function convertToAnthropicMessagesPrompt({
2457
2591
  input: part.input,
2458
2592
  cache_control: cacheControl
2459
2593
  });
2594
+ } else if (providerToolName === "advisor") {
2595
+ anthropicContent.push({
2596
+ type: "server_tool_use",
2597
+ id: part.toolCallId,
2598
+ name: "advisor",
2599
+ input: {},
2600
+ cache_control: cacheControl
2601
+ });
2460
2602
  } else {
2461
2603
  warnings.push({
2462
2604
  type: "other",
@@ -2551,7 +2693,7 @@ async function convertToAnthropicMessagesPrompt({
2551
2693
  break;
2552
2694
  }
2553
2695
  if (output.value.type === "code_execution_result") {
2554
- const codeExecutionOutput = await (0, import_provider_utils13.validateTypes)({
2696
+ const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2555
2697
  value: output.value,
2556
2698
  schema: codeExecution_20250522OutputSchema
2557
2699
  });
@@ -2568,7 +2710,7 @@ async function convertToAnthropicMessagesPrompt({
2568
2710
  cache_control: cacheControl
2569
2711
  });
2570
2712
  } else if (output.value.type === "encrypted_code_execution_result") {
2571
- const codeExecutionOutput = await (0, import_provider_utils13.validateTypes)({
2713
+ const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2572
2714
  value: output.value,
2573
2715
  schema: codeExecution_20260120OutputSchema
2574
2716
  });
@@ -2587,7 +2729,7 @@ async function convertToAnthropicMessagesPrompt({
2587
2729
  });
2588
2730
  }
2589
2731
  } else {
2590
- const codeExecutionOutput = await (0, import_provider_utils13.validateTypes)({
2732
+ const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
2591
2733
  value: output.value,
2592
2734
  schema: codeExecution_20250825OutputSchema
2593
2735
  });
@@ -2656,7 +2798,7 @@ async function convertToAnthropicMessagesPrompt({
2656
2798
  });
2657
2799
  break;
2658
2800
  }
2659
- const webFetchOutput = await (0, import_provider_utils13.validateTypes)({
2801
+ const webFetchOutput = await (0, import_provider_utils14.validateTypes)({
2660
2802
  value: output.value,
2661
2803
  schema: webFetch_20250910OutputSchema
2662
2804
  });
@@ -2691,7 +2833,7 @@ async function convertToAnthropicMessagesPrompt({
2691
2833
  });
2692
2834
  break;
2693
2835
  }
2694
- const webSearchOutput = await (0, import_provider_utils13.validateTypes)({
2836
+ const webSearchOutput = await (0, import_provider_utils14.validateTypes)({
2695
2837
  value: output.value,
2696
2838
  schema: webSearch_20250305OutputSchema
2697
2839
  });
@@ -2718,7 +2860,7 @@ async function convertToAnthropicMessagesPrompt({
2718
2860
  });
2719
2861
  break;
2720
2862
  }
2721
- const toolSearchOutput = await (0, import_provider_utils13.validateTypes)({
2863
+ const toolSearchOutput = await (0, import_provider_utils14.validateTypes)({
2722
2864
  value: output.value,
2723
2865
  schema: toolSearchRegex_20251119OutputSchema
2724
2866
  });
@@ -2737,6 +2879,52 @@ async function convertToAnthropicMessagesPrompt({
2737
2879
  });
2738
2880
  break;
2739
2881
  }
2882
+ if (providerToolName === "advisor") {
2883
+ const output = part.output;
2884
+ if (output.type !== "json" && output.type !== "error-json") {
2885
+ warnings.push({
2886
+ type: "other",
2887
+ message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
2888
+ });
2889
+ break;
2890
+ }
2891
+ const advisorOutput = await (0, import_provider_utils14.validateTypes)({
2892
+ value: output.value,
2893
+ schema: advisor_20260301OutputSchema
2894
+ });
2895
+ if (advisorOutput.type === "advisor_result") {
2896
+ anthropicContent.push({
2897
+ type: "advisor_tool_result",
2898
+ tool_use_id: part.toolCallId,
2899
+ content: {
2900
+ type: "advisor_result",
2901
+ text: advisorOutput.text
2902
+ },
2903
+ cache_control: cacheControl
2904
+ });
2905
+ } else if (advisorOutput.type === "advisor_redacted_result") {
2906
+ anthropicContent.push({
2907
+ type: "advisor_tool_result",
2908
+ tool_use_id: part.toolCallId,
2909
+ content: {
2910
+ type: "advisor_redacted_result",
2911
+ encrypted_content: advisorOutput.encryptedContent
2912
+ },
2913
+ cache_control: cacheControl
2914
+ });
2915
+ } else {
2916
+ anthropicContent.push({
2917
+ type: "advisor_tool_result",
2918
+ tool_use_id: part.toolCallId,
2919
+ content: {
2920
+ type: "advisor_tool_result_error",
2921
+ error_code: advisorOutput.errorCode
2922
+ },
2923
+ cache_control: cacheControl
2924
+ });
2925
+ }
2926
+ break;
2927
+ }
2740
2928
  warnings.push({
2741
2929
  type: "other",
2742
2930
  message: `provider executed tool result for tool ${part.toolName} is not supported`
@@ -3028,7 +3216,7 @@ var AnthropicMessagesLanguageModel = class {
3028
3216
  var _a;
3029
3217
  this.modelId = modelId;
3030
3218
  this.config = config;
3031
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils14.generateId;
3219
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils15.generateId;
3032
3220
  }
3033
3221
  supportsUrl(url) {
3034
3222
  return url.protocol === "https:";
@@ -3102,12 +3290,12 @@ var AnthropicMessagesLanguageModel = class {
3102
3290
  }
3103
3291
  }
3104
3292
  const providerOptionsName = this.providerOptionsName;
3105
- const canonicalOptions = await (0, import_provider_utils14.parseProviderOptions)({
3293
+ const canonicalOptions = await (0, import_provider_utils15.parseProviderOptions)({
3106
3294
  provider: "anthropic",
3107
3295
  providerOptions,
3108
3296
  schema: anthropicLanguageModelOptions
3109
3297
  });
3110
- const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils14.parseProviderOptions)({
3298
+ const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils15.parseProviderOptions)({
3111
3299
  provider: providerOptionsName,
3112
3300
  providerOptions,
3113
3301
  schema: anthropicLanguageModelOptions
@@ -3163,7 +3351,7 @@ var AnthropicMessagesLanguageModel = class {
3163
3351
  } : void 0;
3164
3352
  const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
3165
3353
  const cacheControlValidator = new CacheControlValidator();
3166
- const toolNameMapping = (0, import_provider_utils14.createToolNameMapping)({
3354
+ const toolNameMapping = (0, import_provider_utils15.createToolNameMapping)({
3167
3355
  tools,
3168
3356
  providerToolNames: {
3169
3357
  "anthropic.code_execution_20250522": "code_execution",
@@ -3183,7 +3371,8 @@ var AnthropicMessagesLanguageModel = class {
3183
3371
  "anthropic.web_fetch_20250910": "web_fetch",
3184
3372
  "anthropic.web_fetch_20260209": "web_fetch",
3185
3373
  "anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
3186
- "anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
3374
+ "anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25",
3375
+ "anthropic.advisor_20260301": "advisor"
3187
3376
  }
3188
3377
  });
3189
3378
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
@@ -3470,15 +3659,15 @@ var AnthropicMessagesLanguageModel = class {
3470
3659
  betas,
3471
3660
  headers
3472
3661
  }) {
3473
- return (0, import_provider_utils14.combineHeaders)(
3474
- await (0, import_provider_utils14.resolve)(this.config.headers),
3662
+ return (0, import_provider_utils15.combineHeaders)(
3663
+ await (0, import_provider_utils15.resolve)(this.config.headers),
3475
3664
  headers,
3476
3665
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
3477
3666
  );
3478
3667
  }
3479
3668
  async getBetasFromHeaders(requestHeaders) {
3480
3669
  var _a, _b;
3481
- const configHeaders = await (0, import_provider_utils14.resolve)(this.config.headers);
3670
+ const configHeaders = await (0, import_provider_utils15.resolve)(this.config.headers);
3482
3671
  const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
3483
3672
  const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
3484
3673
  return new Set(
@@ -3544,12 +3733,12 @@ var AnthropicMessagesLanguageModel = class {
3544
3733
  responseHeaders,
3545
3734
  value: response,
3546
3735
  rawValue: rawResponse
3547
- } = await (0, import_provider_utils14.postJsonToApi)({
3736
+ } = await (0, import_provider_utils15.postJsonToApi)({
3548
3737
  url: this.buildRequestUrl(false),
3549
3738
  headers: await this.getHeaders({ betas, headers: options.headers }),
3550
3739
  body: this.transformRequestBody(args, betas),
3551
3740
  failedResponseHandler: anthropicFailedResponseHandler,
3552
- successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
3741
+ successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3553
3742
  anthropicMessagesResponseSchema
3554
3743
  ),
3555
3744
  abortSignal: options.abortSignal,
@@ -3675,6 +3864,14 @@ var AnthropicMessagesLanguageModel = class {
3675
3864
  input: JSON.stringify(part.input),
3676
3865
  providerExecuted: true
3677
3866
  });
3867
+ } else if (part.name === "advisor") {
3868
+ content.push({
3869
+ type: "tool-call",
3870
+ toolCallId: part.id,
3871
+ toolName: toolNameMapping.toCustomToolName("advisor"),
3872
+ input: JSON.stringify(part.input),
3873
+ providerExecuted: true
3874
+ });
3678
3875
  }
3679
3876
  break;
3680
3877
  }
@@ -3888,6 +4085,43 @@ var AnthropicMessagesLanguageModel = class {
3888
4085
  }
3889
4086
  break;
3890
4087
  }
4088
+ // advisor results for advisor_20260301:
4089
+ case "advisor_tool_result": {
4090
+ const advisorToolName = toolNameMapping.toCustomToolName("advisor");
4091
+ if (part.content.type === "advisor_result") {
4092
+ content.push({
4093
+ type: "tool-result",
4094
+ toolCallId: part.tool_use_id,
4095
+ toolName: advisorToolName,
4096
+ result: {
4097
+ type: "advisor_result",
4098
+ text: part.content.text
4099
+ }
4100
+ });
4101
+ } else if (part.content.type === "advisor_redacted_result") {
4102
+ content.push({
4103
+ type: "tool-result",
4104
+ toolCallId: part.tool_use_id,
4105
+ toolName: advisorToolName,
4106
+ result: {
4107
+ type: "advisor_redacted_result",
4108
+ encryptedContent: part.content.encrypted_content
4109
+ }
4110
+ });
4111
+ } else {
4112
+ content.push({
4113
+ type: "tool-result",
4114
+ toolCallId: part.tool_use_id,
4115
+ toolName: advisorToolName,
4116
+ isError: true,
4117
+ result: {
4118
+ type: "advisor_tool_result_error",
4119
+ errorCode: part.content.error_code
4120
+ }
4121
+ });
4122
+ }
4123
+ break;
4124
+ }
3891
4125
  }
3892
4126
  }
3893
4127
  return {
@@ -3914,11 +4148,30 @@ var AnthropicMessagesLanguageModel = class {
3914
4148
  usage: response.usage,
3915
4149
  cacheCreationInputTokens: (_a2 = response.usage.cache_creation_input_tokens) != null ? _a2 : null,
3916
4150
  stopSequence: (_b2 = response.stop_sequence) != null ? _b2 : null,
3917
- iterations: response.usage.iterations ? response.usage.iterations.map((iter) => ({
3918
- type: iter.type,
3919
- inputTokens: iter.input_tokens,
3920
- outputTokens: iter.output_tokens
3921
- })) : null,
4151
+ iterations: response.usage.iterations ? response.usage.iterations.map(
4152
+ (iter) => iter.type === "advisor_message" ? {
4153
+ type: iter.type,
4154
+ model: iter.model,
4155
+ inputTokens: iter.input_tokens,
4156
+ outputTokens: iter.output_tokens,
4157
+ ...iter.cache_creation_input_tokens ? {
4158
+ cacheCreationInputTokens: iter.cache_creation_input_tokens
4159
+ } : {},
4160
+ ...iter.cache_read_input_tokens ? {
4161
+ cacheReadInputTokens: iter.cache_read_input_tokens
4162
+ } : {}
4163
+ } : {
4164
+ type: iter.type,
4165
+ inputTokens: iter.input_tokens,
4166
+ outputTokens: iter.output_tokens,
4167
+ ...iter.cache_creation_input_tokens ? {
4168
+ cacheCreationInputTokens: iter.cache_creation_input_tokens
4169
+ } : {},
4170
+ ...iter.cache_read_input_tokens ? {
4171
+ cacheReadInputTokens: iter.cache_read_input_tokens
4172
+ } : {}
4173
+ }
4174
+ ) : null,
3922
4175
  container: response.container ? {
3923
4176
  expiresAt: response.container.expires_at,
3924
4177
  id: response.container.id,
@@ -3964,12 +4217,12 @@ var AnthropicMessagesLanguageModel = class {
3964
4217
  body.tools
3965
4218
  );
3966
4219
  const url = this.buildRequestUrl(true);
3967
- const { responseHeaders, value: response } = await (0, import_provider_utils14.postJsonToApi)({
4220
+ const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
3968
4221
  url,
3969
4222
  headers: await this.getHeaders({ betas, headers: options.headers }),
3970
4223
  body: this.transformRequestBody(body, betas),
3971
4224
  failedResponseHandler: anthropicFailedResponseHandler,
3972
- successfulResponseHandler: (0, import_provider_utils14.createEventSourceResponseHandler)(
4225
+ successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
3973
4226
  anthropicMessagesChunkSchema
3974
4227
  ),
3975
4228
  abortSignal: options.abortSignal,
@@ -4150,6 +4403,23 @@ var AnthropicMessagesLanguageModel = class {
4150
4403
  toolName: customToolName,
4151
4404
  providerExecuted: true
4152
4405
  });
4406
+ } else if (part.name === "advisor") {
4407
+ const customToolName = toolNameMapping.toCustomToolName("advisor");
4408
+ contentBlocks[value.index] = {
4409
+ type: "tool-call",
4410
+ toolCallId: part.id,
4411
+ toolName: customToolName,
4412
+ input: "{}",
4413
+ providerExecuted: true,
4414
+ firstDelta: true,
4415
+ providerToolName: part.name
4416
+ };
4417
+ controller.enqueue({
4418
+ type: "tool-input-start",
4419
+ id: part.id,
4420
+ toolName: customToolName,
4421
+ providerExecuted: true
4422
+ });
4153
4423
  }
4154
4424
  return;
4155
4425
  }
@@ -4333,6 +4603,44 @@ var AnthropicMessagesLanguageModel = class {
4333
4603
  }
4334
4604
  return;
4335
4605
  }
4606
+ // advisor results for advisor_20260301:
4607
+ // arrives fully formed in a single content_block_start (no deltas).
4608
+ case "advisor_tool_result": {
4609
+ const advisorToolName = toolNameMapping.toCustomToolName("advisor");
4610
+ if (part.content.type === "advisor_result") {
4611
+ controller.enqueue({
4612
+ type: "tool-result",
4613
+ toolCallId: part.tool_use_id,
4614
+ toolName: advisorToolName,
4615
+ result: {
4616
+ type: "advisor_result",
4617
+ text: part.content.text
4618
+ }
4619
+ });
4620
+ } else if (part.content.type === "advisor_redacted_result") {
4621
+ controller.enqueue({
4622
+ type: "tool-result",
4623
+ toolCallId: part.tool_use_id,
4624
+ toolName: advisorToolName,
4625
+ result: {
4626
+ type: "advisor_redacted_result",
4627
+ encryptedContent: part.content.encrypted_content
4628
+ }
4629
+ });
4630
+ } else {
4631
+ controller.enqueue({
4632
+ type: "tool-result",
4633
+ toolCallId: part.tool_use_id,
4634
+ toolName: advisorToolName,
4635
+ isError: true,
4636
+ result: {
4637
+ type: "advisor_tool_result_error",
4638
+ errorCode: part.content.error_code
4639
+ }
4640
+ });
4641
+ }
4642
+ return;
4643
+ }
4336
4644
  case "mcp_tool_use": {
4337
4645
  mcpToolCalls[part.id] = {
4338
4646
  type: "tool-call",
@@ -4650,11 +4958,30 @@ var AnthropicMessagesLanguageModel = class {
4650
4958
  usage: rawUsage != null ? rawUsage : null,
4651
4959
  cacheCreationInputTokens,
4652
4960
  stopSequence,
4653
- iterations: usage.iterations ? usage.iterations.map((iter) => ({
4654
- type: iter.type,
4655
- inputTokens: iter.input_tokens,
4656
- outputTokens: iter.output_tokens
4657
- })) : null,
4961
+ iterations: usage.iterations ? usage.iterations.map(
4962
+ (iter) => iter.type === "advisor_message" ? {
4963
+ type: iter.type,
4964
+ model: iter.model,
4965
+ inputTokens: iter.input_tokens,
4966
+ outputTokens: iter.output_tokens,
4967
+ ...iter.cache_creation_input_tokens ? {
4968
+ cacheCreationInputTokens: iter.cache_creation_input_tokens
4969
+ } : {},
4970
+ ...iter.cache_read_input_tokens ? {
4971
+ cacheReadInputTokens: iter.cache_read_input_tokens
4972
+ } : {}
4973
+ } : {
4974
+ type: iter.type,
4975
+ inputTokens: iter.input_tokens,
4976
+ outputTokens: iter.output_tokens,
4977
+ ...iter.cache_creation_input_tokens ? {
4978
+ cacheCreationInputTokens: iter.cache_creation_input_tokens
4979
+ } : {},
4980
+ ...iter.cache_read_input_tokens ? {
4981
+ cacheReadInputTokens: iter.cache_read_input_tokens
4982
+ } : {}
4983
+ }
4984
+ ) : null,
4658
4985
  container,
4659
4986
  contextManagement
4660
4987
  };
@@ -4820,44 +5147,44 @@ function mapAnthropicResponseContextManagement(contextManagement) {
4820
5147
  }
4821
5148
 
4822
5149
  // src/tool/bash_20241022.ts
4823
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
4824
- var import_v413 = require("zod/v4");
4825
- var bash_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
4826
- () => (0, import_provider_utils15.zodSchema)(
4827
- import_v413.z.object({
4828
- command: import_v413.z.string(),
4829
- restart: import_v413.z.boolean().optional()
5150
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
5151
+ var import_v414 = require("zod/v4");
5152
+ var bash_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
5153
+ () => (0, import_provider_utils16.zodSchema)(
5154
+ import_v414.z.object({
5155
+ command: import_v414.z.string(),
5156
+ restart: import_v414.z.boolean().optional()
4830
5157
  })
4831
5158
  )
4832
5159
  );
4833
- var bash_20241022 = (0, import_provider_utils15.createProviderToolFactory)({
5160
+ var bash_20241022 = (0, import_provider_utils16.createProviderToolFactory)({
4834
5161
  id: "anthropic.bash_20241022",
4835
5162
  inputSchema: bash_20241022InputSchema
4836
5163
  });
4837
5164
 
4838
5165
  // src/tool/bash_20250124.ts
4839
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
4840
- var import_v414 = require("zod/v4");
4841
- var bash_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
4842
- () => (0, import_provider_utils16.zodSchema)(
4843
- import_v414.z.object({
4844
- command: import_v414.z.string(),
4845
- restart: import_v414.z.boolean().optional()
5166
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
5167
+ var import_v415 = require("zod/v4");
5168
+ var bash_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
5169
+ () => (0, import_provider_utils17.zodSchema)(
5170
+ import_v415.z.object({
5171
+ command: import_v415.z.string(),
5172
+ restart: import_v415.z.boolean().optional()
4846
5173
  })
4847
5174
  )
4848
5175
  );
4849
- var bash_20250124 = (0, import_provider_utils16.createProviderToolFactory)({
5176
+ var bash_20250124 = (0, import_provider_utils17.createProviderToolFactory)({
4850
5177
  id: "anthropic.bash_20250124",
4851
5178
  inputSchema: bash_20250124InputSchema
4852
5179
  });
4853
5180
 
4854
5181
  // src/tool/computer_20241022.ts
4855
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
4856
- var import_v415 = require("zod/v4");
4857
- var computer_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
4858
- () => (0, import_provider_utils17.zodSchema)(
4859
- import_v415.z.object({
4860
- action: import_v415.z.enum([
5182
+ var import_provider_utils18 = require("@ai-sdk/provider-utils");
5183
+ var import_v416 = require("zod/v4");
5184
+ var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
5185
+ () => (0, import_provider_utils18.zodSchema)(
5186
+ import_v416.z.object({
5187
+ action: import_v416.z.enum([
4861
5188
  "key",
4862
5189
  "type",
4863
5190
  "mouse_move",
@@ -4869,23 +5196,23 @@ var computer_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
4869
5196
  "screenshot",
4870
5197
  "cursor_position"
4871
5198
  ]),
4872
- coordinate: import_v415.z.array(import_v415.z.number().int()).optional(),
4873
- text: import_v415.z.string().optional()
5199
+ coordinate: import_v416.z.array(import_v416.z.number().int()).optional(),
5200
+ text: import_v416.z.string().optional()
4874
5201
  })
4875
5202
  )
4876
5203
  );
4877
- var computer_20241022 = (0, import_provider_utils17.createProviderToolFactory)({
5204
+ var computer_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
4878
5205
  id: "anthropic.computer_20241022",
4879
5206
  inputSchema: computer_20241022InputSchema
4880
5207
  });
4881
5208
 
4882
5209
  // src/tool/computer_20250124.ts
4883
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
4884
- var import_v416 = require("zod/v4");
4885
- var computer_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
4886
- () => (0, import_provider_utils18.zodSchema)(
4887
- import_v416.z.object({
4888
- action: import_v416.z.enum([
5210
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
5211
+ var import_v417 = require("zod/v4");
5212
+ var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
5213
+ () => (0, import_provider_utils19.zodSchema)(
5214
+ import_v417.z.object({
5215
+ action: import_v417.z.enum([
4889
5216
  "key",
4890
5217
  "hold_key",
4891
5218
  "type",
@@ -4903,27 +5230,27 @@ var computer_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
4903
5230
  "wait",
4904
5231
  "screenshot"
4905
5232
  ]),
4906
- coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
4907
- duration: import_v416.z.number().optional(),
4908
- scroll_amount: import_v416.z.number().optional(),
4909
- scroll_direction: import_v416.z.enum(["up", "down", "left", "right"]).optional(),
4910
- start_coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
4911
- text: import_v416.z.string().optional()
5233
+ coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
5234
+ duration: import_v417.z.number().optional(),
5235
+ scroll_amount: import_v417.z.number().optional(),
5236
+ scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
5237
+ start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
5238
+ text: import_v417.z.string().optional()
4912
5239
  })
4913
5240
  )
4914
5241
  );
4915
- var computer_20250124 = (0, import_provider_utils18.createProviderToolFactory)({
5242
+ var computer_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
4916
5243
  id: "anthropic.computer_20250124",
4917
5244
  inputSchema: computer_20250124InputSchema
4918
5245
  });
4919
5246
 
4920
5247
  // src/tool/computer_20251124.ts
4921
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
4922
- var import_v417 = require("zod/v4");
4923
- var computer_20251124InputSchema = (0, import_provider_utils19.lazySchema)(
4924
- () => (0, import_provider_utils19.zodSchema)(
4925
- import_v417.z.object({
4926
- action: import_v417.z.enum([
5248
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
5249
+ var import_v418 = require("zod/v4");
5250
+ var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
5251
+ () => (0, import_provider_utils20.zodSchema)(
5252
+ import_v418.z.object({
5253
+ action: import_v418.z.enum([
4927
5254
  "key",
4928
5255
  "hold_key",
4929
5256
  "type",
@@ -4942,97 +5269,75 @@ var computer_20251124InputSchema = (0, import_provider_utils19.lazySchema)(
4942
5269
  "screenshot",
4943
5270
  "zoom"
4944
5271
  ]),
4945
- coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4946
- duration: import_v417.z.number().optional(),
4947
- region: import_v417.z.tuple([
4948
- import_v417.z.number().int(),
4949
- import_v417.z.number().int(),
4950
- import_v417.z.number().int(),
4951
- import_v417.z.number().int()
5272
+ coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
5273
+ duration: import_v418.z.number().optional(),
5274
+ region: import_v418.z.tuple([
5275
+ import_v418.z.number().int(),
5276
+ import_v418.z.number().int(),
5277
+ import_v418.z.number().int(),
5278
+ import_v418.z.number().int()
4952
5279
  ]).optional(),
4953
- scroll_amount: import_v417.z.number().optional(),
4954
- scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
4955
- start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
4956
- text: import_v417.z.string().optional()
5280
+ scroll_amount: import_v418.z.number().optional(),
5281
+ scroll_direction: import_v418.z.enum(["up", "down", "left", "right"]).optional(),
5282
+ start_coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
5283
+ text: import_v418.z.string().optional()
4957
5284
  })
4958
5285
  )
4959
5286
  );
4960
- var computer_20251124 = (0, import_provider_utils19.createProviderToolFactory)({
5287
+ var computer_20251124 = (0, import_provider_utils20.createProviderToolFactory)({
4961
5288
  id: "anthropic.computer_20251124",
4962
5289
  inputSchema: computer_20251124InputSchema
4963
5290
  });
4964
5291
 
4965
5292
  // src/tool/memory_20250818.ts
4966
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
4967
- var import_v418 = require("zod/v4");
4968
- var memory_20250818InputSchema = (0, import_provider_utils20.lazySchema)(
4969
- () => (0, import_provider_utils20.zodSchema)(
4970
- import_v418.z.discriminatedUnion("command", [
4971
- import_v418.z.object({
4972
- command: import_v418.z.literal("view"),
4973
- path: import_v418.z.string(),
4974
- view_range: import_v418.z.tuple([import_v418.z.number(), import_v418.z.number()]).optional()
5293
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
5294
+ var import_v419 = require("zod/v4");
5295
+ var memory_20250818InputSchema = (0, import_provider_utils21.lazySchema)(
5296
+ () => (0, import_provider_utils21.zodSchema)(
5297
+ import_v419.z.discriminatedUnion("command", [
5298
+ import_v419.z.object({
5299
+ command: import_v419.z.literal("view"),
5300
+ path: import_v419.z.string(),
5301
+ view_range: import_v419.z.tuple([import_v419.z.number(), import_v419.z.number()]).optional()
4975
5302
  }),
4976
- import_v418.z.object({
4977
- command: import_v418.z.literal("create"),
4978
- path: import_v418.z.string(),
4979
- file_text: import_v418.z.string()
5303
+ import_v419.z.object({
5304
+ command: import_v419.z.literal("create"),
5305
+ path: import_v419.z.string(),
5306
+ file_text: import_v419.z.string()
4980
5307
  }),
4981
- import_v418.z.object({
4982
- command: import_v418.z.literal("str_replace"),
4983
- path: import_v418.z.string(),
4984
- old_str: import_v418.z.string(),
4985
- new_str: import_v418.z.string()
5308
+ import_v419.z.object({
5309
+ command: import_v419.z.literal("str_replace"),
5310
+ path: import_v419.z.string(),
5311
+ old_str: import_v419.z.string(),
5312
+ new_str: import_v419.z.string()
4986
5313
  }),
4987
- import_v418.z.object({
4988
- command: import_v418.z.literal("insert"),
4989
- path: import_v418.z.string(),
4990
- insert_line: import_v418.z.number(),
4991
- insert_text: import_v418.z.string()
5314
+ import_v419.z.object({
5315
+ command: import_v419.z.literal("insert"),
5316
+ path: import_v419.z.string(),
5317
+ insert_line: import_v419.z.number(),
5318
+ insert_text: import_v419.z.string()
4992
5319
  }),
4993
- import_v418.z.object({
4994
- command: import_v418.z.literal("delete"),
4995
- path: import_v418.z.string()
5320
+ import_v419.z.object({
5321
+ command: import_v419.z.literal("delete"),
5322
+ path: import_v419.z.string()
4996
5323
  }),
4997
- import_v418.z.object({
4998
- command: import_v418.z.literal("rename"),
4999
- old_path: import_v418.z.string(),
5000
- new_path: import_v418.z.string()
5324
+ import_v419.z.object({
5325
+ command: import_v419.z.literal("rename"),
5326
+ old_path: import_v419.z.string(),
5327
+ new_path: import_v419.z.string()
5001
5328
  })
5002
5329
  ])
5003
5330
  )
5004
5331
  );
5005
- var memory_20250818 = (0, import_provider_utils20.createProviderToolFactory)({
5332
+ var memory_20250818 = (0, import_provider_utils21.createProviderToolFactory)({
5006
5333
  id: "anthropic.memory_20250818",
5007
5334
  inputSchema: memory_20250818InputSchema
5008
5335
  });
5009
5336
 
5010
5337
  // src/tool/text-editor_20241022.ts
5011
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
5012
- var import_v419 = require("zod/v4");
5013
- var textEditor_20241022InputSchema = (0, import_provider_utils21.lazySchema)(
5014
- () => (0, import_provider_utils21.zodSchema)(
5015
- import_v419.z.object({
5016
- command: import_v419.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
5017
- path: import_v419.z.string(),
5018
- file_text: import_v419.z.string().optional(),
5019
- insert_line: import_v419.z.number().int().optional(),
5020
- new_str: import_v419.z.string().optional(),
5021
- insert_text: import_v419.z.string().optional(),
5022
- old_str: import_v419.z.string().optional(),
5023
- view_range: import_v419.z.array(import_v419.z.number().int()).optional()
5024
- })
5025
- )
5026
- );
5027
- var textEditor_20241022 = (0, import_provider_utils21.createProviderToolFactory)({
5028
- id: "anthropic.text_editor_20241022",
5029
- inputSchema: textEditor_20241022InputSchema
5030
- });
5031
-
5032
- // src/tool/text-editor_20250124.ts
5033
5338
  var import_provider_utils22 = require("@ai-sdk/provider-utils");
5034
5339
  var import_v420 = require("zod/v4");
5035
- var textEditor_20250124InputSchema = (0, import_provider_utils22.lazySchema)(
5340
+ var textEditor_20241022InputSchema = (0, import_provider_utils22.lazySchema)(
5036
5341
  () => (0, import_provider_utils22.zodSchema)(
5037
5342
  import_v420.z.object({
5038
5343
  command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -5046,18 +5351,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils22.lazySchema)(
5046
5351
  })
5047
5352
  )
5048
5353
  );
5049
- var textEditor_20250124 = (0, import_provider_utils22.createProviderToolFactory)({
5050
- id: "anthropic.text_editor_20250124",
5051
- inputSchema: textEditor_20250124InputSchema
5354
+ var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
5355
+ id: "anthropic.text_editor_20241022",
5356
+ inputSchema: textEditor_20241022InputSchema
5052
5357
  });
5053
5358
 
5054
- // src/tool/text-editor_20250429.ts
5359
+ // src/tool/text-editor_20250124.ts
5055
5360
  var import_provider_utils23 = require("@ai-sdk/provider-utils");
5056
5361
  var import_v421 = require("zod/v4");
5057
- var textEditor_20250429InputSchema = (0, import_provider_utils23.lazySchema)(
5362
+ var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
5058
5363
  () => (0, import_provider_utils23.zodSchema)(
5059
5364
  import_v421.z.object({
5060
- command: import_v421.z.enum(["view", "create", "str_replace", "insert"]),
5365
+ command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
5061
5366
  path: import_v421.z.string(),
5062
5367
  file_text: import_v421.z.string().optional(),
5063
5368
  insert_line: import_v421.z.number().int().optional(),
@@ -5068,51 +5373,102 @@ var textEditor_20250429InputSchema = (0, import_provider_utils23.lazySchema)(
5068
5373
  })
5069
5374
  )
5070
5375
  );
5071
- var textEditor_20250429 = (0, import_provider_utils23.createProviderToolFactory)({
5072
- id: "anthropic.text_editor_20250429",
5073
- inputSchema: textEditor_20250429InputSchema
5376
+ var textEditor_20250124 = (0, import_provider_utils23.createProviderToolFactory)({
5377
+ id: "anthropic.text_editor_20250124",
5378
+ inputSchema: textEditor_20250124InputSchema
5074
5379
  });
5075
5380
 
5076
- // src/tool/tool-search-bm25_20251119.ts
5381
+ // src/tool/text-editor_20250429.ts
5077
5382
  var import_provider_utils24 = require("@ai-sdk/provider-utils");
5078
5383
  var import_v422 = require("zod/v4");
5079
- var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils24.lazySchema)(
5384
+ var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
5080
5385
  () => (0, import_provider_utils24.zodSchema)(
5081
- import_v422.z.array(
5082
- import_v422.z.object({
5083
- type: import_v422.z.literal("tool_reference"),
5084
- toolName: import_v422.z.string()
5386
+ import_v422.z.object({
5387
+ command: import_v422.z.enum(["view", "create", "str_replace", "insert"]),
5388
+ path: import_v422.z.string(),
5389
+ file_text: import_v422.z.string().optional(),
5390
+ insert_line: import_v422.z.number().int().optional(),
5391
+ new_str: import_v422.z.string().optional(),
5392
+ insert_text: import_v422.z.string().optional(),
5393
+ old_str: import_v422.z.string().optional(),
5394
+ view_range: import_v422.z.array(import_v422.z.number().int()).optional()
5395
+ })
5396
+ )
5397
+ );
5398
+ var textEditor_20250429 = (0, import_provider_utils24.createProviderToolFactory)({
5399
+ id: "anthropic.text_editor_20250429",
5400
+ inputSchema: textEditor_20250429InputSchema
5401
+ });
5402
+
5403
+ // src/tool/tool-search-bm25_20251119.ts
5404
+ var import_provider_utils25 = require("@ai-sdk/provider-utils");
5405
+ var import_v423 = require("zod/v4");
5406
+ var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils25.lazySchema)(
5407
+ () => (0, import_provider_utils25.zodSchema)(
5408
+ import_v423.z.array(
5409
+ import_v423.z.object({
5410
+ type: import_v423.z.literal("tool_reference"),
5411
+ toolName: import_v423.z.string()
5085
5412
  })
5086
5413
  )
5087
5414
  )
5088
5415
  );
5089
- var toolSearchBm25_20251119InputSchema = (0, import_provider_utils24.lazySchema)(
5090
- () => (0, import_provider_utils24.zodSchema)(
5091
- import_v422.z.object({
5416
+ var toolSearchBm25_20251119InputSchema = (0, import_provider_utils25.lazySchema)(
5417
+ () => (0, import_provider_utils25.zodSchema)(
5418
+ import_v423.z.object({
5092
5419
  /**
5093
5420
  * A natural language query to search for tools.
5094
5421
  * Claude will use BM25 text search to find relevant tools.
5095
5422
  */
5096
- query: import_v422.z.string(),
5423
+ query: import_v423.z.string(),
5097
5424
  /**
5098
5425
  * Maximum number of tools to return. Optional.
5099
5426
  */
5100
- limit: import_v422.z.number().optional()
5427
+ limit: import_v423.z.number().optional()
5101
5428
  })
5102
5429
  )
5103
5430
  );
5104
- var factory10 = (0, import_provider_utils24.createProviderToolFactoryWithOutputSchema)({
5431
+ var factory11 = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
5105
5432
  id: "anthropic.tool_search_bm25_20251119",
5106
5433
  inputSchema: toolSearchBm25_20251119InputSchema,
5107
5434
  outputSchema: toolSearchBm25_20251119OutputSchema,
5108
5435
  supportsDeferredResults: true
5109
5436
  });
5110
5437
  var toolSearchBm25_20251119 = (args = {}) => {
5111
- return factory10(args);
5438
+ return factory11(args);
5112
5439
  };
5113
5440
 
5114
5441
  // src/anthropic-tools.ts
5115
5442
  var anthropicTools = {
5443
+ /**
5444
+ * Pairs a faster executor model with a higher-intelligence advisor model
5445
+ * that provides strategic guidance mid-generation.
5446
+ *
5447
+ * The advisor lets a faster, lower-cost executor model consult a
5448
+ * higher-intelligence advisor model server-side. The advisor reads the
5449
+ * executor's full transcript and produces a plan or course correction;
5450
+ * the executor continues with the task, informed by the advice. All of
5451
+ * this happens inside a single `/v1/messages` request.
5452
+ *
5453
+ * Beta header `advisor-tool-2026-03-01` is added automatically when this
5454
+ * tool is included.
5455
+ *
5456
+ * Multi-turn conversations: pass the full assistant content (including
5457
+ * `advisor_tool_result` blocks) back to the API on subsequent turns. If
5458
+ * you omit the advisor tool from `tools` on a follow-up turn while the
5459
+ * message history still contains `advisor_tool_result` blocks, the API
5460
+ * returns a `400 invalid_request_error`.
5461
+ *
5462
+ * Supported executor models: Claude Haiku 4.5, Sonnet 4.6, Opus 4.6,
5463
+ * Opus 4.7. The advisor must be at least as capable as the executor.
5464
+ *
5465
+ * @param model - The advisor model ID (required), e.g. `"claude-opus-4-7"`.
5466
+ * @param maxUses - Maximum advisor calls per request (per-request cap).
5467
+ * @param caching - Enables prompt caching for the advisor's transcript
5468
+ * across calls within a conversation. Worthwhile from ~3 advisor calls
5469
+ * per conversation.
5470
+ */
5471
+ advisor_20260301,
5116
5472
  /**
5117
5473
  * The bash tool enables Claude to execute shell commands in a persistent bash session,
5118
5474
  * allowing system operations, script execution, and command-line automation.
@@ -5316,8 +5672,8 @@ var anthropicTools = {
5316
5672
  // src/anthropic-provider.ts
5317
5673
  function createAnthropic(options = {}) {
5318
5674
  var _a, _b;
5319
- const baseURL = (_a = (0, import_provider_utils25.withoutTrailingSlash)(
5320
- (0, import_provider_utils25.loadOptionalSetting)({
5675
+ const baseURL = (_a = (0, import_provider_utils26.withoutTrailingSlash)(
5676
+ (0, import_provider_utils26.loadOptionalSetting)({
5321
5677
  settingValue: options.baseURL,
5322
5678
  environmentVariableName: "ANTHROPIC_BASE_URL"
5323
5679
  })
@@ -5331,13 +5687,13 @@ function createAnthropic(options = {}) {
5331
5687
  }
5332
5688
  const getHeaders = () => {
5333
5689
  const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
5334
- "x-api-key": (0, import_provider_utils25.loadApiKey)({
5690
+ "x-api-key": (0, import_provider_utils26.loadApiKey)({
5335
5691
  apiKey: options.apiKey,
5336
5692
  environmentVariableName: "ANTHROPIC_API_KEY",
5337
5693
  description: "Anthropic"
5338
5694
  })
5339
5695
  };
5340
- return (0, import_provider_utils25.withUserAgentSuffix)(
5696
+ return (0, import_provider_utils26.withUserAgentSuffix)(
5341
5697
  {
5342
5698
  "anthropic-version": "2023-06-01",
5343
5699
  ...authHeaders,
@@ -5353,7 +5709,7 @@ function createAnthropic(options = {}) {
5353
5709
  baseURL,
5354
5710
  headers: getHeaders,
5355
5711
  fetch: options.fetch,
5356
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils25.generateId,
5712
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils26.generateId,
5357
5713
  supportedUrls: () => ({
5358
5714
  "image/*": [/^https?:\/\/.*$/],
5359
5715
  "application/pdf": [/^https?:\/\/.*$/]