@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/CHANGELOG.md +13 -0
- package/dist/index.d.mts +99 -4
- package/dist/index.d.ts +99 -4
- package/dist/index.js +810 -454
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +790 -430
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +63 -0
- package/dist/internal/index.d.ts +63 -0
- package/dist/internal/index.js +803 -447
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +789 -429
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +57 -0
- package/package.json +2 -2
- package/src/anthropic-message-metadata.ts +63 -13
- package/src/anthropic-messages-api.ts +113 -11
- package/src/anthropic-messages-language-model.ts +186 -11
- package/src/anthropic-prepare-tools.ts +17 -0
- package/src/anthropic-tools.ts +31 -0
- package/src/convert-anthropic-messages-usage.ts +50 -22
- package/src/convert-to-anthropic-messages-prompt.ts +62 -0
- package/src/tool/advisor_20260301.ts +128 -0
package/dist/internal/index.mjs
CHANGED
|
@@ -308,6 +308,25 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
308
308
|
error_code: z2.string()
|
|
309
309
|
})
|
|
310
310
|
])
|
|
311
|
+
}),
|
|
312
|
+
// advisor results for advisor_20260301:
|
|
313
|
+
z2.object({
|
|
314
|
+
type: z2.literal("advisor_tool_result"),
|
|
315
|
+
tool_use_id: z2.string(),
|
|
316
|
+
content: z2.discriminatedUnion("type", [
|
|
317
|
+
z2.object({
|
|
318
|
+
type: z2.literal("advisor_result"),
|
|
319
|
+
text: z2.string()
|
|
320
|
+
}),
|
|
321
|
+
z2.object({
|
|
322
|
+
type: z2.literal("advisor_redacted_result"),
|
|
323
|
+
encrypted_content: z2.string()
|
|
324
|
+
}),
|
|
325
|
+
z2.object({
|
|
326
|
+
type: z2.literal("advisor_tool_result_error"),
|
|
327
|
+
error_code: z2.string()
|
|
328
|
+
})
|
|
329
|
+
])
|
|
311
330
|
})
|
|
312
331
|
])
|
|
313
332
|
),
|
|
@@ -319,11 +338,23 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
319
338
|
cache_creation_input_tokens: z2.number().nullish(),
|
|
320
339
|
cache_read_input_tokens: z2.number().nullish(),
|
|
321
340
|
iterations: z2.array(
|
|
322
|
-
z2.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
341
|
+
z2.union([
|
|
342
|
+
z2.object({
|
|
343
|
+
type: z2.union([z2.literal("compaction"), z2.literal("message")]),
|
|
344
|
+
input_tokens: z2.number(),
|
|
345
|
+
output_tokens: z2.number(),
|
|
346
|
+
cache_creation_input_tokens: z2.number().nullish(),
|
|
347
|
+
cache_read_input_tokens: z2.number().nullish()
|
|
348
|
+
}),
|
|
349
|
+
z2.object({
|
|
350
|
+
type: z2.literal("advisor_message"),
|
|
351
|
+
model: z2.string(),
|
|
352
|
+
input_tokens: z2.number(),
|
|
353
|
+
output_tokens: z2.number(),
|
|
354
|
+
cache_creation_input_tokens: z2.number().nullish(),
|
|
355
|
+
cache_read_input_tokens: z2.number().nullish()
|
|
356
|
+
})
|
|
357
|
+
])
|
|
327
358
|
).nullish()
|
|
328
359
|
}),
|
|
329
360
|
container: z2.object({
|
|
@@ -639,6 +670,25 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
639
670
|
error_code: z2.string()
|
|
640
671
|
})
|
|
641
672
|
])
|
|
673
|
+
}),
|
|
674
|
+
// advisor results for advisor_20260301:
|
|
675
|
+
z2.object({
|
|
676
|
+
type: z2.literal("advisor_tool_result"),
|
|
677
|
+
tool_use_id: z2.string(),
|
|
678
|
+
content: z2.discriminatedUnion("type", [
|
|
679
|
+
z2.object({
|
|
680
|
+
type: z2.literal("advisor_result"),
|
|
681
|
+
text: z2.string()
|
|
682
|
+
}),
|
|
683
|
+
z2.object({
|
|
684
|
+
type: z2.literal("advisor_redacted_result"),
|
|
685
|
+
encrypted_content: z2.string()
|
|
686
|
+
}),
|
|
687
|
+
z2.object({
|
|
688
|
+
type: z2.literal("advisor_tool_result_error"),
|
|
689
|
+
error_code: z2.string()
|
|
690
|
+
})
|
|
691
|
+
])
|
|
642
692
|
})
|
|
643
693
|
])
|
|
644
694
|
}),
|
|
@@ -733,11 +783,26 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
733
783
|
cache_creation_input_tokens: z2.number().nullish(),
|
|
734
784
|
cache_read_input_tokens: z2.number().nullish(),
|
|
735
785
|
iterations: z2.array(
|
|
736
|
-
z2.
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
786
|
+
z2.union([
|
|
787
|
+
z2.object({
|
|
788
|
+
type: z2.union([
|
|
789
|
+
z2.literal("compaction"),
|
|
790
|
+
z2.literal("message")
|
|
791
|
+
]),
|
|
792
|
+
input_tokens: z2.number(),
|
|
793
|
+
output_tokens: z2.number(),
|
|
794
|
+
cache_creation_input_tokens: z2.number().nullish(),
|
|
795
|
+
cache_read_input_tokens: z2.number().nullish()
|
|
796
|
+
}),
|
|
797
|
+
z2.object({
|
|
798
|
+
type: z2.literal("advisor_message"),
|
|
799
|
+
model: z2.string(),
|
|
800
|
+
input_tokens: z2.number(),
|
|
801
|
+
output_tokens: z2.number(),
|
|
802
|
+
cache_creation_input_tokens: z2.number().nullish(),
|
|
803
|
+
cache_read_input_tokens: z2.number().nullish()
|
|
804
|
+
})
|
|
805
|
+
])
|
|
741
806
|
).nullish()
|
|
742
807
|
}),
|
|
743
808
|
context_management: z2.object({
|
|
@@ -1043,103 +1108,100 @@ var CacheControlValidator = class {
|
|
|
1043
1108
|
}
|
|
1044
1109
|
};
|
|
1045
1110
|
|
|
1046
|
-
// src/tool/
|
|
1111
|
+
// src/tool/advisor_20260301.ts
|
|
1047
1112
|
import {
|
|
1048
|
-
|
|
1113
|
+
createProviderToolFactoryWithOutputSchema,
|
|
1049
1114
|
lazySchema as lazySchema3,
|
|
1050
1115
|
zodSchema as zodSchema3
|
|
1051
1116
|
} from "@ai-sdk/provider-utils";
|
|
1052
1117
|
import { z as z4 } from "zod/v4";
|
|
1053
|
-
var
|
|
1118
|
+
var advisor_20260301ArgsSchema = lazySchema3(
|
|
1054
1119
|
() => zodSchema3(
|
|
1055
1120
|
z4.object({
|
|
1056
|
-
|
|
1121
|
+
model: z4.string(),
|
|
1122
|
+
maxUses: z4.number().optional(),
|
|
1123
|
+
caching: z4.object({
|
|
1124
|
+
type: z4.literal("ephemeral"),
|
|
1125
|
+
ttl: z4.union([z4.literal("5m"), z4.literal("1h")])
|
|
1126
|
+
}).optional()
|
|
1057
1127
|
})
|
|
1058
1128
|
)
|
|
1059
1129
|
);
|
|
1060
|
-
var
|
|
1130
|
+
var advisor_20260301OutputSchema = lazySchema3(
|
|
1061
1131
|
() => zodSchema3(
|
|
1062
|
-
z4.
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1132
|
+
z4.discriminatedUnion("type", [
|
|
1133
|
+
z4.object({
|
|
1134
|
+
type: z4.literal("advisor_result"),
|
|
1135
|
+
text: z4.string()
|
|
1136
|
+
}),
|
|
1137
|
+
z4.object({
|
|
1138
|
+
type: z4.literal("advisor_redacted_result"),
|
|
1139
|
+
encryptedContent: z4.string()
|
|
1140
|
+
}),
|
|
1141
|
+
z4.object({
|
|
1142
|
+
type: z4.literal("advisor_tool_result_error"),
|
|
1143
|
+
errorCode: z4.string()
|
|
1144
|
+
})
|
|
1145
|
+
])
|
|
1072
1146
|
)
|
|
1073
1147
|
);
|
|
1074
|
-
var
|
|
1075
|
-
|
|
1076
|
-
|
|
1148
|
+
var advisor_20260301InputSchema = lazySchema3(
|
|
1149
|
+
() => zodSchema3(z4.object({}).strict())
|
|
1150
|
+
);
|
|
1151
|
+
var factory = createProviderToolFactoryWithOutputSchema({
|
|
1152
|
+
id: "anthropic.advisor_20260301",
|
|
1153
|
+
inputSchema: advisor_20260301InputSchema,
|
|
1154
|
+
outputSchema: advisor_20260301OutputSchema,
|
|
1155
|
+
supportsDeferredResults: true
|
|
1077
1156
|
});
|
|
1078
|
-
var
|
|
1157
|
+
var advisor_20260301 = (args) => {
|
|
1079
1158
|
return factory(args);
|
|
1080
1159
|
};
|
|
1081
1160
|
|
|
1082
|
-
// src/tool/
|
|
1161
|
+
// src/tool/text-editor_20250728.ts
|
|
1083
1162
|
import {
|
|
1084
|
-
|
|
1163
|
+
createProviderToolFactory,
|
|
1085
1164
|
lazySchema as lazySchema4,
|
|
1086
1165
|
zodSchema as zodSchema4
|
|
1087
1166
|
} from "@ai-sdk/provider-utils";
|
|
1088
1167
|
import { z as z5 } from "zod/v4";
|
|
1089
|
-
var
|
|
1168
|
+
var textEditor_20250728ArgsSchema = lazySchema4(
|
|
1090
1169
|
() => zodSchema4(
|
|
1091
1170
|
z5.object({
|
|
1092
|
-
|
|
1093
|
-
allowedDomains: z5.array(z5.string()).optional(),
|
|
1094
|
-
blockedDomains: z5.array(z5.string()).optional(),
|
|
1095
|
-
userLocation: z5.object({
|
|
1096
|
-
type: z5.literal("approximate"),
|
|
1097
|
-
city: z5.string().optional(),
|
|
1098
|
-
region: z5.string().optional(),
|
|
1099
|
-
country: z5.string().optional(),
|
|
1100
|
-
timezone: z5.string().optional()
|
|
1101
|
-
}).optional()
|
|
1171
|
+
maxCharacters: z5.number().optional()
|
|
1102
1172
|
})
|
|
1103
1173
|
)
|
|
1104
1174
|
);
|
|
1105
|
-
var
|
|
1106
|
-
() => zodSchema4(
|
|
1107
|
-
z5.array(
|
|
1108
|
-
z5.object({
|
|
1109
|
-
url: z5.string(),
|
|
1110
|
-
title: z5.string().nullable(),
|
|
1111
|
-
pageAge: z5.string().nullable(),
|
|
1112
|
-
encryptedContent: z5.string(),
|
|
1113
|
-
type: z5.literal("web_search_result")
|
|
1114
|
-
})
|
|
1115
|
-
)
|
|
1116
|
-
)
|
|
1117
|
-
);
|
|
1118
|
-
var webSearch_20260209InputSchema = lazySchema4(
|
|
1175
|
+
var textEditor_20250728InputSchema = lazySchema4(
|
|
1119
1176
|
() => zodSchema4(
|
|
1120
1177
|
z5.object({
|
|
1121
|
-
|
|
1178
|
+
command: z5.enum(["view", "create", "str_replace", "insert"]),
|
|
1179
|
+
path: z5.string(),
|
|
1180
|
+
file_text: z5.string().optional(),
|
|
1181
|
+
insert_line: z5.number().int().optional(),
|
|
1182
|
+
new_str: z5.string().optional(),
|
|
1183
|
+
insert_text: z5.string().optional(),
|
|
1184
|
+
old_str: z5.string().optional(),
|
|
1185
|
+
view_range: z5.array(z5.number().int()).optional()
|
|
1122
1186
|
})
|
|
1123
1187
|
)
|
|
1124
1188
|
);
|
|
1125
|
-
var factory2 =
|
|
1126
|
-
id: "anthropic.
|
|
1127
|
-
inputSchema:
|
|
1128
|
-
outputSchema: webSearch_20260209OutputSchema,
|
|
1129
|
-
supportsDeferredResults: true
|
|
1189
|
+
var factory2 = createProviderToolFactory({
|
|
1190
|
+
id: "anthropic.text_editor_20250728",
|
|
1191
|
+
inputSchema: textEditor_20250728InputSchema
|
|
1130
1192
|
});
|
|
1131
|
-
var
|
|
1193
|
+
var textEditor_20250728 = (args = {}) => {
|
|
1132
1194
|
return factory2(args);
|
|
1133
1195
|
};
|
|
1134
1196
|
|
|
1135
|
-
// src/tool/web-
|
|
1197
|
+
// src/tool/web-search_20260209.ts
|
|
1136
1198
|
import {
|
|
1137
1199
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1138
1200
|
lazySchema as lazySchema5,
|
|
1139
1201
|
zodSchema as zodSchema5
|
|
1140
1202
|
} from "@ai-sdk/provider-utils";
|
|
1141
1203
|
import { z as z6 } from "zod/v4";
|
|
1142
|
-
var
|
|
1204
|
+
var webSearch_20260209ArgsSchema = lazySchema5(
|
|
1143
1205
|
() => zodSchema5(
|
|
1144
1206
|
z6.object({
|
|
1145
1207
|
maxUses: z6.number().optional(),
|
|
@@ -1155,7 +1217,7 @@ var webSearch_20250305ArgsSchema = lazySchema5(
|
|
|
1155
1217
|
})
|
|
1156
1218
|
)
|
|
1157
1219
|
);
|
|
1158
|
-
var
|
|
1220
|
+
var webSearch_20260209OutputSchema = lazySchema5(
|
|
1159
1221
|
() => zodSchema5(
|
|
1160
1222
|
z6.array(
|
|
1161
1223
|
z6.object({
|
|
@@ -1168,7 +1230,7 @@ var webSearch_20250305OutputSchema = lazySchema5(
|
|
|
1168
1230
|
)
|
|
1169
1231
|
)
|
|
1170
1232
|
);
|
|
1171
|
-
var
|
|
1233
|
+
var webSearch_20260209InputSchema = lazySchema5(
|
|
1172
1234
|
() => zodSchema5(
|
|
1173
1235
|
z6.object({
|
|
1174
1236
|
query: z6.string()
|
|
@@ -1176,84 +1238,76 @@ var webSearch_20250305InputSchema = lazySchema5(
|
|
|
1176
1238
|
)
|
|
1177
1239
|
);
|
|
1178
1240
|
var factory3 = createProviderToolFactoryWithOutputSchema2({
|
|
1179
|
-
id: "anthropic.
|
|
1180
|
-
inputSchema:
|
|
1181
|
-
outputSchema:
|
|
1241
|
+
id: "anthropic.web_search_20260209",
|
|
1242
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1243
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1182
1244
|
supportsDeferredResults: true
|
|
1183
1245
|
});
|
|
1184
|
-
var
|
|
1246
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1185
1247
|
return factory3(args);
|
|
1186
1248
|
};
|
|
1187
1249
|
|
|
1188
|
-
// src/tool/web-
|
|
1250
|
+
// src/tool/web-search_20250305.ts
|
|
1189
1251
|
import {
|
|
1190
1252
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1191
1253
|
lazySchema as lazySchema6,
|
|
1192
1254
|
zodSchema as zodSchema6
|
|
1193
1255
|
} from "@ai-sdk/provider-utils";
|
|
1194
1256
|
import { z as z7 } from "zod/v4";
|
|
1195
|
-
var
|
|
1257
|
+
var webSearch_20250305ArgsSchema = lazySchema6(
|
|
1196
1258
|
() => zodSchema6(
|
|
1197
1259
|
z7.object({
|
|
1198
1260
|
maxUses: z7.number().optional(),
|
|
1199
1261
|
allowedDomains: z7.array(z7.string()).optional(),
|
|
1200
1262
|
blockedDomains: z7.array(z7.string()).optional(),
|
|
1201
|
-
|
|
1202
|
-
|
|
1263
|
+
userLocation: z7.object({
|
|
1264
|
+
type: z7.literal("approximate"),
|
|
1265
|
+
city: z7.string().optional(),
|
|
1266
|
+
region: z7.string().optional(),
|
|
1267
|
+
country: z7.string().optional(),
|
|
1268
|
+
timezone: z7.string().optional()
|
|
1269
|
+
}).optional()
|
|
1203
1270
|
})
|
|
1204
1271
|
)
|
|
1205
1272
|
);
|
|
1206
|
-
var
|
|
1273
|
+
var webSearch_20250305OutputSchema = lazySchema6(
|
|
1207
1274
|
() => zodSchema6(
|
|
1208
|
-
z7.
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
content: z7.object({
|
|
1212
|
-
type: z7.literal("document"),
|
|
1275
|
+
z7.array(
|
|
1276
|
+
z7.object({
|
|
1277
|
+
url: z7.string(),
|
|
1213
1278
|
title: z7.string().nullable(),
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
data: z7.string()
|
|
1220
|
-
}),
|
|
1221
|
-
z7.object({
|
|
1222
|
-
type: z7.literal("text"),
|
|
1223
|
-
mediaType: z7.literal("text/plain"),
|
|
1224
|
-
data: z7.string()
|
|
1225
|
-
})
|
|
1226
|
-
])
|
|
1227
|
-
}),
|
|
1228
|
-
retrievedAt: z7.string().nullable()
|
|
1229
|
-
})
|
|
1279
|
+
pageAge: z7.string().nullable(),
|
|
1280
|
+
encryptedContent: z7.string(),
|
|
1281
|
+
type: z7.literal("web_search_result")
|
|
1282
|
+
})
|
|
1283
|
+
)
|
|
1230
1284
|
)
|
|
1231
1285
|
);
|
|
1232
|
-
var
|
|
1286
|
+
var webSearch_20250305InputSchema = lazySchema6(
|
|
1233
1287
|
() => zodSchema6(
|
|
1234
1288
|
z7.object({
|
|
1235
|
-
|
|
1289
|
+
query: z7.string()
|
|
1236
1290
|
})
|
|
1237
1291
|
)
|
|
1238
1292
|
);
|
|
1239
1293
|
var factory4 = createProviderToolFactoryWithOutputSchema3({
|
|
1240
|
-
id: "anthropic.
|
|
1241
|
-
inputSchema:
|
|
1242
|
-
outputSchema:
|
|
1294
|
+
id: "anthropic.web_search_20250305",
|
|
1295
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1296
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1243
1297
|
supportsDeferredResults: true
|
|
1244
1298
|
});
|
|
1245
|
-
var
|
|
1299
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1246
1300
|
return factory4(args);
|
|
1247
1301
|
};
|
|
1248
1302
|
|
|
1249
|
-
// src/tool/web-fetch-
|
|
1303
|
+
// src/tool/web-fetch-20260209.ts
|
|
1250
1304
|
import {
|
|
1251
1305
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1252
1306
|
lazySchema as lazySchema7,
|
|
1253
1307
|
zodSchema as zodSchema7
|
|
1254
1308
|
} from "@ai-sdk/provider-utils";
|
|
1255
1309
|
import { z as z8 } from "zod/v4";
|
|
1256
|
-
var
|
|
1310
|
+
var webFetch_20260209ArgsSchema = lazySchema7(
|
|
1257
1311
|
() => zodSchema7(
|
|
1258
1312
|
z8.object({
|
|
1259
1313
|
maxUses: z8.number().optional(),
|
|
@@ -1264,7 +1318,7 @@ var webFetch_20250910ArgsSchema = lazySchema7(
|
|
|
1264
1318
|
})
|
|
1265
1319
|
)
|
|
1266
1320
|
);
|
|
1267
|
-
var
|
|
1321
|
+
var webFetch_20260209OutputSchema = lazySchema7(
|
|
1268
1322
|
() => zodSchema7(
|
|
1269
1323
|
z8.object({
|
|
1270
1324
|
type: z8.literal("web_fetch_result"),
|
|
@@ -1290,7 +1344,7 @@ var webFetch_20250910OutputSchema = lazySchema7(
|
|
|
1290
1344
|
})
|
|
1291
1345
|
)
|
|
1292
1346
|
);
|
|
1293
|
-
var
|
|
1347
|
+
var webFetch_20260209InputSchema = lazySchema7(
|
|
1294
1348
|
() => zodSchema7(
|
|
1295
1349
|
z8.object({
|
|
1296
1350
|
url: z8.string()
|
|
@@ -1298,13 +1352,74 @@ var webFetch_20250910InputSchema = lazySchema7(
|
|
|
1298
1352
|
)
|
|
1299
1353
|
);
|
|
1300
1354
|
var factory5 = createProviderToolFactoryWithOutputSchema4({
|
|
1355
|
+
id: "anthropic.web_fetch_20260209",
|
|
1356
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1357
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1358
|
+
supportsDeferredResults: true
|
|
1359
|
+
});
|
|
1360
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1361
|
+
return factory5(args);
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
// src/tool/web-fetch-20250910.ts
|
|
1365
|
+
import {
|
|
1366
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1367
|
+
lazySchema as lazySchema8,
|
|
1368
|
+
zodSchema as zodSchema8
|
|
1369
|
+
} from "@ai-sdk/provider-utils";
|
|
1370
|
+
import { z as z9 } from "zod/v4";
|
|
1371
|
+
var webFetch_20250910ArgsSchema = lazySchema8(
|
|
1372
|
+
() => zodSchema8(
|
|
1373
|
+
z9.object({
|
|
1374
|
+
maxUses: z9.number().optional(),
|
|
1375
|
+
allowedDomains: z9.array(z9.string()).optional(),
|
|
1376
|
+
blockedDomains: z9.array(z9.string()).optional(),
|
|
1377
|
+
citations: z9.object({ enabled: z9.boolean() }).optional(),
|
|
1378
|
+
maxContentTokens: z9.number().optional()
|
|
1379
|
+
})
|
|
1380
|
+
)
|
|
1381
|
+
);
|
|
1382
|
+
var webFetch_20250910OutputSchema = lazySchema8(
|
|
1383
|
+
() => zodSchema8(
|
|
1384
|
+
z9.object({
|
|
1385
|
+
type: z9.literal("web_fetch_result"),
|
|
1386
|
+
url: z9.string(),
|
|
1387
|
+
content: z9.object({
|
|
1388
|
+
type: z9.literal("document"),
|
|
1389
|
+
title: z9.string().nullable(),
|
|
1390
|
+
citations: z9.object({ enabled: z9.boolean() }).optional(),
|
|
1391
|
+
source: z9.union([
|
|
1392
|
+
z9.object({
|
|
1393
|
+
type: z9.literal("base64"),
|
|
1394
|
+
mediaType: z9.literal("application/pdf"),
|
|
1395
|
+
data: z9.string()
|
|
1396
|
+
}),
|
|
1397
|
+
z9.object({
|
|
1398
|
+
type: z9.literal("text"),
|
|
1399
|
+
mediaType: z9.literal("text/plain"),
|
|
1400
|
+
data: z9.string()
|
|
1401
|
+
})
|
|
1402
|
+
])
|
|
1403
|
+
}),
|
|
1404
|
+
retrievedAt: z9.string().nullable()
|
|
1405
|
+
})
|
|
1406
|
+
)
|
|
1407
|
+
);
|
|
1408
|
+
var webFetch_20250910InputSchema = lazySchema8(
|
|
1409
|
+
() => zodSchema8(
|
|
1410
|
+
z9.object({
|
|
1411
|
+
url: z9.string()
|
|
1412
|
+
})
|
|
1413
|
+
)
|
|
1414
|
+
);
|
|
1415
|
+
var factory6 = createProviderToolFactoryWithOutputSchema5({
|
|
1301
1416
|
id: "anthropic.web_fetch_20250910",
|
|
1302
1417
|
inputSchema: webFetch_20250910InputSchema,
|
|
1303
1418
|
outputSchema: webFetch_20250910OutputSchema,
|
|
1304
1419
|
supportsDeferredResults: true
|
|
1305
1420
|
});
|
|
1306
1421
|
var webFetch_20250910 = (args = {}) => {
|
|
1307
|
-
return
|
|
1422
|
+
return factory6(args);
|
|
1308
1423
|
};
|
|
1309
1424
|
|
|
1310
1425
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1580,6 +1695,21 @@ async function prepareTools({
|
|
|
1580
1695
|
});
|
|
1581
1696
|
break;
|
|
1582
1697
|
}
|
|
1698
|
+
case "anthropic.advisor_20260301": {
|
|
1699
|
+
betas.add("advisor-tool-2026-03-01");
|
|
1700
|
+
const args = await validateTypes({
|
|
1701
|
+
value: tool.args,
|
|
1702
|
+
schema: advisor_20260301ArgsSchema
|
|
1703
|
+
});
|
|
1704
|
+
anthropicTools2.push({
|
|
1705
|
+
type: "advisor_20260301",
|
|
1706
|
+
name: "advisor",
|
|
1707
|
+
model: args.model,
|
|
1708
|
+
...args.maxUses !== void 0 && { max_uses: args.maxUses },
|
|
1709
|
+
...args.caching !== void 0 && { caching: args.caching }
|
|
1710
|
+
});
|
|
1711
|
+
break;
|
|
1712
|
+
}
|
|
1583
1713
|
default: {
|
|
1584
1714
|
toolWarnings.push({
|
|
1585
1715
|
type: "unsupported",
|
|
@@ -1662,15 +1792,23 @@ function convertAnthropicMessagesUsage({
|
|
|
1662
1792
|
let inputTokens;
|
|
1663
1793
|
let outputTokens;
|
|
1664
1794
|
if (usage.iterations && usage.iterations.length > 0) {
|
|
1665
|
-
const
|
|
1666
|
-
(
|
|
1667
|
-
input: acc.input + iter.input_tokens,
|
|
1668
|
-
output: acc.output + iter.output_tokens
|
|
1669
|
-
}),
|
|
1670
|
-
{ input: 0, output: 0 }
|
|
1795
|
+
const executorIterations = usage.iterations.filter(
|
|
1796
|
+
(iter) => iter.type === "compaction" || iter.type === "message"
|
|
1671
1797
|
);
|
|
1672
|
-
|
|
1673
|
-
|
|
1798
|
+
if (executorIterations.length > 0) {
|
|
1799
|
+
const totals = executorIterations.reduce(
|
|
1800
|
+
(acc, iter) => ({
|
|
1801
|
+
input: acc.input + iter.input_tokens,
|
|
1802
|
+
output: acc.output + iter.output_tokens
|
|
1803
|
+
}),
|
|
1804
|
+
{ input: 0, output: 0 }
|
|
1805
|
+
);
|
|
1806
|
+
inputTokens = totals.input;
|
|
1807
|
+
outputTokens = totals.output;
|
|
1808
|
+
} else {
|
|
1809
|
+
inputTokens = usage.input_tokens;
|
|
1810
|
+
outputTokens = usage.output_tokens;
|
|
1811
|
+
}
|
|
1674
1812
|
} else {
|
|
1675
1813
|
inputTokens = usage.input_tokens;
|
|
1676
1814
|
outputTokens = usage.output_tokens;
|
|
@@ -1705,164 +1843,51 @@ import {
|
|
|
1705
1843
|
|
|
1706
1844
|
// src/tool/code-execution_20250522.ts
|
|
1707
1845
|
import {
|
|
1708
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1709
|
-
lazySchema as
|
|
1710
|
-
zodSchema as
|
|
1846
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
1847
|
+
lazySchema as lazySchema9,
|
|
1848
|
+
zodSchema as zodSchema9
|
|
1711
1849
|
} from "@ai-sdk/provider-utils";
|
|
1712
|
-
import { z as
|
|
1713
|
-
var codeExecution_20250522OutputSchema =
|
|
1714
|
-
() =>
|
|
1715
|
-
|
|
1716
|
-
type:
|
|
1717
|
-
stdout:
|
|
1718
|
-
stderr:
|
|
1719
|
-
return_code:
|
|
1720
|
-
content:
|
|
1721
|
-
|
|
1722
|
-
type:
|
|
1723
|
-
file_id:
|
|
1850
|
+
import { z as z10 } from "zod/v4";
|
|
1851
|
+
var codeExecution_20250522OutputSchema = lazySchema9(
|
|
1852
|
+
() => zodSchema9(
|
|
1853
|
+
z10.object({
|
|
1854
|
+
type: z10.literal("code_execution_result"),
|
|
1855
|
+
stdout: z10.string(),
|
|
1856
|
+
stderr: z10.string(),
|
|
1857
|
+
return_code: z10.number(),
|
|
1858
|
+
content: z10.array(
|
|
1859
|
+
z10.object({
|
|
1860
|
+
type: z10.literal("code_execution_output"),
|
|
1861
|
+
file_id: z10.string()
|
|
1724
1862
|
})
|
|
1725
1863
|
).optional().default([])
|
|
1726
1864
|
})
|
|
1727
1865
|
)
|
|
1728
1866
|
);
|
|
1729
|
-
var codeExecution_20250522InputSchema =
|
|
1730
|
-
() =>
|
|
1731
|
-
|
|
1732
|
-
code:
|
|
1867
|
+
var codeExecution_20250522InputSchema = lazySchema9(
|
|
1868
|
+
() => zodSchema9(
|
|
1869
|
+
z10.object({
|
|
1870
|
+
code: z10.string()
|
|
1733
1871
|
})
|
|
1734
1872
|
)
|
|
1735
1873
|
);
|
|
1736
|
-
var
|
|
1874
|
+
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
1737
1875
|
id: "anthropic.code_execution_20250522",
|
|
1738
1876
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1739
1877
|
outputSchema: codeExecution_20250522OutputSchema
|
|
1740
1878
|
});
|
|
1741
1879
|
var codeExecution_20250522 = (args = {}) => {
|
|
1742
|
-
return factory6(args);
|
|
1743
|
-
};
|
|
1744
|
-
|
|
1745
|
-
// src/tool/code-execution_20250825.ts
|
|
1746
|
-
import {
|
|
1747
|
-
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
1748
|
-
lazySchema as lazySchema9,
|
|
1749
|
-
zodSchema as zodSchema9
|
|
1750
|
-
} from "@ai-sdk/provider-utils";
|
|
1751
|
-
import { z as z10 } from "zod/v4";
|
|
1752
|
-
var codeExecution_20250825OutputSchema = lazySchema9(
|
|
1753
|
-
() => zodSchema9(
|
|
1754
|
-
z10.discriminatedUnion("type", [
|
|
1755
|
-
z10.object({
|
|
1756
|
-
type: z10.literal("code_execution_result"),
|
|
1757
|
-
stdout: z10.string(),
|
|
1758
|
-
stderr: z10.string(),
|
|
1759
|
-
return_code: z10.number(),
|
|
1760
|
-
content: z10.array(
|
|
1761
|
-
z10.object({
|
|
1762
|
-
type: z10.literal("code_execution_output"),
|
|
1763
|
-
file_id: z10.string()
|
|
1764
|
-
})
|
|
1765
|
-
).optional().default([])
|
|
1766
|
-
}),
|
|
1767
|
-
z10.object({
|
|
1768
|
-
type: z10.literal("bash_code_execution_result"),
|
|
1769
|
-
content: z10.array(
|
|
1770
|
-
z10.object({
|
|
1771
|
-
type: z10.literal("bash_code_execution_output"),
|
|
1772
|
-
file_id: z10.string()
|
|
1773
|
-
})
|
|
1774
|
-
),
|
|
1775
|
-
stdout: z10.string(),
|
|
1776
|
-
stderr: z10.string(),
|
|
1777
|
-
return_code: z10.number()
|
|
1778
|
-
}),
|
|
1779
|
-
z10.object({
|
|
1780
|
-
type: z10.literal("bash_code_execution_tool_result_error"),
|
|
1781
|
-
error_code: z10.string()
|
|
1782
|
-
}),
|
|
1783
|
-
z10.object({
|
|
1784
|
-
type: z10.literal("text_editor_code_execution_tool_result_error"),
|
|
1785
|
-
error_code: z10.string()
|
|
1786
|
-
}),
|
|
1787
|
-
z10.object({
|
|
1788
|
-
type: z10.literal("text_editor_code_execution_view_result"),
|
|
1789
|
-
content: z10.string(),
|
|
1790
|
-
file_type: z10.string(),
|
|
1791
|
-
num_lines: z10.number().nullable(),
|
|
1792
|
-
start_line: z10.number().nullable(),
|
|
1793
|
-
total_lines: z10.number().nullable()
|
|
1794
|
-
}),
|
|
1795
|
-
z10.object({
|
|
1796
|
-
type: z10.literal("text_editor_code_execution_create_result"),
|
|
1797
|
-
is_file_update: z10.boolean()
|
|
1798
|
-
}),
|
|
1799
|
-
z10.object({
|
|
1800
|
-
type: z10.literal("text_editor_code_execution_str_replace_result"),
|
|
1801
|
-
lines: z10.array(z10.string()).nullable(),
|
|
1802
|
-
new_lines: z10.number().nullable(),
|
|
1803
|
-
new_start: z10.number().nullable(),
|
|
1804
|
-
old_lines: z10.number().nullable(),
|
|
1805
|
-
old_start: z10.number().nullable()
|
|
1806
|
-
})
|
|
1807
|
-
])
|
|
1808
|
-
)
|
|
1809
|
-
);
|
|
1810
|
-
var codeExecution_20250825InputSchema = lazySchema9(
|
|
1811
|
-
() => zodSchema9(
|
|
1812
|
-
z10.discriminatedUnion("type", [
|
|
1813
|
-
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1814
|
-
z10.object({
|
|
1815
|
-
type: z10.literal("programmatic-tool-call"),
|
|
1816
|
-
code: z10.string()
|
|
1817
|
-
}),
|
|
1818
|
-
z10.object({
|
|
1819
|
-
type: z10.literal("bash_code_execution"),
|
|
1820
|
-
command: z10.string()
|
|
1821
|
-
}),
|
|
1822
|
-
z10.discriminatedUnion("command", [
|
|
1823
|
-
z10.object({
|
|
1824
|
-
type: z10.literal("text_editor_code_execution"),
|
|
1825
|
-
command: z10.literal("view"),
|
|
1826
|
-
path: z10.string()
|
|
1827
|
-
}),
|
|
1828
|
-
z10.object({
|
|
1829
|
-
type: z10.literal("text_editor_code_execution"),
|
|
1830
|
-
command: z10.literal("create"),
|
|
1831
|
-
path: z10.string(),
|
|
1832
|
-
file_text: z10.string().nullish()
|
|
1833
|
-
}),
|
|
1834
|
-
z10.object({
|
|
1835
|
-
type: z10.literal("text_editor_code_execution"),
|
|
1836
|
-
command: z10.literal("str_replace"),
|
|
1837
|
-
path: z10.string(),
|
|
1838
|
-
old_str: z10.string(),
|
|
1839
|
-
new_str: z10.string()
|
|
1840
|
-
})
|
|
1841
|
-
])
|
|
1842
|
-
])
|
|
1843
|
-
)
|
|
1844
|
-
);
|
|
1845
|
-
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
1846
|
-
id: "anthropic.code_execution_20250825",
|
|
1847
|
-
inputSchema: codeExecution_20250825InputSchema,
|
|
1848
|
-
outputSchema: codeExecution_20250825OutputSchema,
|
|
1849
|
-
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
1850
|
-
// when code execution triggers a client-executed tool that needs to be
|
|
1851
|
-
// resolved before the code execution result can be returned.
|
|
1852
|
-
supportsDeferredResults: true
|
|
1853
|
-
});
|
|
1854
|
-
var codeExecution_20250825 = (args = {}) => {
|
|
1855
1880
|
return factory7(args);
|
|
1856
1881
|
};
|
|
1857
1882
|
|
|
1858
|
-
// src/tool/code-
|
|
1883
|
+
// src/tool/code-execution_20250825.ts
|
|
1859
1884
|
import {
|
|
1860
1885
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
1861
1886
|
lazySchema as lazySchema10,
|
|
1862
1887
|
zodSchema as zodSchema10
|
|
1863
1888
|
} from "@ai-sdk/provider-utils";
|
|
1864
1889
|
import { z as z11 } from "zod/v4";
|
|
1865
|
-
var
|
|
1890
|
+
var codeExecution_20250825OutputSchema = lazySchema10(
|
|
1866
1891
|
() => zodSchema10(
|
|
1867
1892
|
z11.discriminatedUnion("type", [
|
|
1868
1893
|
z11.object({
|
|
@@ -1877,18 +1902,6 @@ var codeExecution_20260120OutputSchema = lazySchema10(
|
|
|
1877
1902
|
})
|
|
1878
1903
|
).optional().default([])
|
|
1879
1904
|
}),
|
|
1880
|
-
z11.object({
|
|
1881
|
-
type: z11.literal("encrypted_code_execution_result"),
|
|
1882
|
-
encrypted_stdout: z11.string(),
|
|
1883
|
-
stderr: z11.string(),
|
|
1884
|
-
return_code: z11.number(),
|
|
1885
|
-
content: z11.array(
|
|
1886
|
-
z11.object({
|
|
1887
|
-
type: z11.literal("code_execution_output"),
|
|
1888
|
-
file_id: z11.string()
|
|
1889
|
-
})
|
|
1890
|
-
).optional().default([])
|
|
1891
|
-
}),
|
|
1892
1905
|
z11.object({
|
|
1893
1906
|
type: z11.literal("bash_code_execution_result"),
|
|
1894
1907
|
content: z11.array(
|
|
@@ -1932,9 +1945,10 @@ var codeExecution_20260120OutputSchema = lazySchema10(
|
|
|
1932
1945
|
])
|
|
1933
1946
|
)
|
|
1934
1947
|
);
|
|
1935
|
-
var
|
|
1948
|
+
var codeExecution_20250825InputSchema = lazySchema10(
|
|
1936
1949
|
() => zodSchema10(
|
|
1937
1950
|
z11.discriminatedUnion("type", [
|
|
1951
|
+
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1938
1952
|
z11.object({
|
|
1939
1953
|
type: z11.literal("programmatic-tool-call"),
|
|
1940
1954
|
code: z11.string()
|
|
@@ -1967,35 +1981,159 @@ var codeExecution_20260120InputSchema = lazySchema10(
|
|
|
1967
1981
|
)
|
|
1968
1982
|
);
|
|
1969
1983
|
var factory8 = createProviderToolFactoryWithOutputSchema7({
|
|
1970
|
-
id: "anthropic.
|
|
1971
|
-
inputSchema:
|
|
1972
|
-
outputSchema:
|
|
1984
|
+
id: "anthropic.code_execution_20250825",
|
|
1985
|
+
inputSchema: codeExecution_20250825InputSchema,
|
|
1986
|
+
outputSchema: codeExecution_20250825OutputSchema,
|
|
1987
|
+
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
1988
|
+
// when code execution triggers a client-executed tool that needs to be
|
|
1989
|
+
// resolved before the code execution result can be returned.
|
|
1973
1990
|
supportsDeferredResults: true
|
|
1974
1991
|
});
|
|
1975
|
-
var
|
|
1992
|
+
var codeExecution_20250825 = (args = {}) => {
|
|
1976
1993
|
return factory8(args);
|
|
1977
1994
|
};
|
|
1978
1995
|
|
|
1979
|
-
// src/tool/
|
|
1996
|
+
// src/tool/code-execution_20260120.ts
|
|
1980
1997
|
import {
|
|
1981
1998
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
1982
1999
|
lazySchema as lazySchema11,
|
|
1983
2000
|
zodSchema as zodSchema11
|
|
1984
2001
|
} from "@ai-sdk/provider-utils";
|
|
1985
2002
|
import { z as z12 } from "zod/v4";
|
|
1986
|
-
var
|
|
2003
|
+
var codeExecution_20260120OutputSchema = lazySchema11(
|
|
2004
|
+
() => zodSchema11(
|
|
2005
|
+
z12.discriminatedUnion("type", [
|
|
2006
|
+
z12.object({
|
|
2007
|
+
type: z12.literal("code_execution_result"),
|
|
2008
|
+
stdout: z12.string(),
|
|
2009
|
+
stderr: z12.string(),
|
|
2010
|
+
return_code: z12.number(),
|
|
2011
|
+
content: z12.array(
|
|
2012
|
+
z12.object({
|
|
2013
|
+
type: z12.literal("code_execution_output"),
|
|
2014
|
+
file_id: z12.string()
|
|
2015
|
+
})
|
|
2016
|
+
).optional().default([])
|
|
2017
|
+
}),
|
|
2018
|
+
z12.object({
|
|
2019
|
+
type: z12.literal("encrypted_code_execution_result"),
|
|
2020
|
+
encrypted_stdout: z12.string(),
|
|
2021
|
+
stderr: z12.string(),
|
|
2022
|
+
return_code: z12.number(),
|
|
2023
|
+
content: z12.array(
|
|
2024
|
+
z12.object({
|
|
2025
|
+
type: z12.literal("code_execution_output"),
|
|
2026
|
+
file_id: z12.string()
|
|
2027
|
+
})
|
|
2028
|
+
).optional().default([])
|
|
2029
|
+
}),
|
|
2030
|
+
z12.object({
|
|
2031
|
+
type: z12.literal("bash_code_execution_result"),
|
|
2032
|
+
content: z12.array(
|
|
2033
|
+
z12.object({
|
|
2034
|
+
type: z12.literal("bash_code_execution_output"),
|
|
2035
|
+
file_id: z12.string()
|
|
2036
|
+
})
|
|
2037
|
+
),
|
|
2038
|
+
stdout: z12.string(),
|
|
2039
|
+
stderr: z12.string(),
|
|
2040
|
+
return_code: z12.number()
|
|
2041
|
+
}),
|
|
2042
|
+
z12.object({
|
|
2043
|
+
type: z12.literal("bash_code_execution_tool_result_error"),
|
|
2044
|
+
error_code: z12.string()
|
|
2045
|
+
}),
|
|
2046
|
+
z12.object({
|
|
2047
|
+
type: z12.literal("text_editor_code_execution_tool_result_error"),
|
|
2048
|
+
error_code: z12.string()
|
|
2049
|
+
}),
|
|
2050
|
+
z12.object({
|
|
2051
|
+
type: z12.literal("text_editor_code_execution_view_result"),
|
|
2052
|
+
content: z12.string(),
|
|
2053
|
+
file_type: z12.string(),
|
|
2054
|
+
num_lines: z12.number().nullable(),
|
|
2055
|
+
start_line: z12.number().nullable(),
|
|
2056
|
+
total_lines: z12.number().nullable()
|
|
2057
|
+
}),
|
|
2058
|
+
z12.object({
|
|
2059
|
+
type: z12.literal("text_editor_code_execution_create_result"),
|
|
2060
|
+
is_file_update: z12.boolean()
|
|
2061
|
+
}),
|
|
2062
|
+
z12.object({
|
|
2063
|
+
type: z12.literal("text_editor_code_execution_str_replace_result"),
|
|
2064
|
+
lines: z12.array(z12.string()).nullable(),
|
|
2065
|
+
new_lines: z12.number().nullable(),
|
|
2066
|
+
new_start: z12.number().nullable(),
|
|
2067
|
+
old_lines: z12.number().nullable(),
|
|
2068
|
+
old_start: z12.number().nullable()
|
|
2069
|
+
})
|
|
2070
|
+
])
|
|
2071
|
+
)
|
|
2072
|
+
);
|
|
2073
|
+
var codeExecution_20260120InputSchema = lazySchema11(
|
|
1987
2074
|
() => zodSchema11(
|
|
1988
|
-
z12.
|
|
2075
|
+
z12.discriminatedUnion("type", [
|
|
1989
2076
|
z12.object({
|
|
1990
|
-
type: z12.literal("
|
|
1991
|
-
|
|
2077
|
+
type: z12.literal("programmatic-tool-call"),
|
|
2078
|
+
code: z12.string()
|
|
2079
|
+
}),
|
|
2080
|
+
z12.object({
|
|
2081
|
+
type: z12.literal("bash_code_execution"),
|
|
2082
|
+
command: z12.string()
|
|
2083
|
+
}),
|
|
2084
|
+
z12.discriminatedUnion("command", [
|
|
2085
|
+
z12.object({
|
|
2086
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2087
|
+
command: z12.literal("view"),
|
|
2088
|
+
path: z12.string()
|
|
2089
|
+
}),
|
|
2090
|
+
z12.object({
|
|
2091
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2092
|
+
command: z12.literal("create"),
|
|
2093
|
+
path: z12.string(),
|
|
2094
|
+
file_text: z12.string().nullish()
|
|
2095
|
+
}),
|
|
2096
|
+
z12.object({
|
|
2097
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2098
|
+
command: z12.literal("str_replace"),
|
|
2099
|
+
path: z12.string(),
|
|
2100
|
+
old_str: z12.string(),
|
|
2101
|
+
new_str: z12.string()
|
|
2102
|
+
})
|
|
2103
|
+
])
|
|
2104
|
+
])
|
|
2105
|
+
)
|
|
2106
|
+
);
|
|
2107
|
+
var factory9 = createProviderToolFactoryWithOutputSchema8({
|
|
2108
|
+
id: "anthropic.code_execution_20260120",
|
|
2109
|
+
inputSchema: codeExecution_20260120InputSchema,
|
|
2110
|
+
outputSchema: codeExecution_20260120OutputSchema,
|
|
2111
|
+
supportsDeferredResults: true
|
|
2112
|
+
});
|
|
2113
|
+
var codeExecution_20260120 = (args = {}) => {
|
|
2114
|
+
return factory9(args);
|
|
2115
|
+
};
|
|
2116
|
+
|
|
2117
|
+
// src/tool/tool-search-regex_20251119.ts
|
|
2118
|
+
import {
|
|
2119
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
2120
|
+
lazySchema as lazySchema12,
|
|
2121
|
+
zodSchema as zodSchema12
|
|
2122
|
+
} from "@ai-sdk/provider-utils";
|
|
2123
|
+
import { z as z13 } from "zod/v4";
|
|
2124
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema12(
|
|
2125
|
+
() => zodSchema12(
|
|
2126
|
+
z13.array(
|
|
2127
|
+
z13.object({
|
|
2128
|
+
type: z13.literal("tool_reference"),
|
|
2129
|
+
toolName: z13.string()
|
|
1992
2130
|
})
|
|
1993
2131
|
)
|
|
1994
2132
|
)
|
|
1995
2133
|
);
|
|
1996
|
-
var toolSearchRegex_20251119InputSchema =
|
|
1997
|
-
() =>
|
|
1998
|
-
|
|
2134
|
+
var toolSearchRegex_20251119InputSchema = lazySchema12(
|
|
2135
|
+
() => zodSchema12(
|
|
2136
|
+
z13.object({
|
|
1999
2137
|
/**
|
|
2000
2138
|
* A regex pattern to search for tools.
|
|
2001
2139
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -2006,22 +2144,22 @@ var toolSearchRegex_20251119InputSchema = lazySchema11(
|
|
|
2006
2144
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
2007
2145
|
* - "(?i)slack" - case-insensitive search
|
|
2008
2146
|
*/
|
|
2009
|
-
pattern:
|
|
2147
|
+
pattern: z13.string(),
|
|
2010
2148
|
/**
|
|
2011
2149
|
* Maximum number of tools to return. Optional.
|
|
2012
2150
|
*/
|
|
2013
|
-
limit:
|
|
2151
|
+
limit: z13.number().optional()
|
|
2014
2152
|
})
|
|
2015
2153
|
)
|
|
2016
2154
|
);
|
|
2017
|
-
var
|
|
2155
|
+
var factory10 = createProviderToolFactoryWithOutputSchema9({
|
|
2018
2156
|
id: "anthropic.tool_search_regex_20251119",
|
|
2019
2157
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
2020
2158
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
2021
2159
|
supportsDeferredResults: true
|
|
2022
2160
|
});
|
|
2023
2161
|
var toolSearchRegex_20251119 = (args = {}) => {
|
|
2024
|
-
return
|
|
2162
|
+
return factory10(args);
|
|
2025
2163
|
};
|
|
2026
2164
|
|
|
2027
2165
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
@@ -2485,6 +2623,14 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2485
2623
|
input: part.input,
|
|
2486
2624
|
cache_control: cacheControl
|
|
2487
2625
|
});
|
|
2626
|
+
} else if (providerToolName === "advisor") {
|
|
2627
|
+
anthropicContent.push({
|
|
2628
|
+
type: "server_tool_use",
|
|
2629
|
+
id: part.toolCallId,
|
|
2630
|
+
name: "advisor",
|
|
2631
|
+
input: {},
|
|
2632
|
+
cache_control: cacheControl
|
|
2633
|
+
});
|
|
2488
2634
|
} else {
|
|
2489
2635
|
warnings.push({
|
|
2490
2636
|
type: "other",
|
|
@@ -2765,6 +2911,52 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2765
2911
|
});
|
|
2766
2912
|
break;
|
|
2767
2913
|
}
|
|
2914
|
+
if (providerToolName === "advisor") {
|
|
2915
|
+
const output = part.output;
|
|
2916
|
+
if (output.type !== "json" && output.type !== "error-json") {
|
|
2917
|
+
warnings.push({
|
|
2918
|
+
type: "other",
|
|
2919
|
+
message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
|
|
2920
|
+
});
|
|
2921
|
+
break;
|
|
2922
|
+
}
|
|
2923
|
+
const advisorOutput = await validateTypes2({
|
|
2924
|
+
value: output.value,
|
|
2925
|
+
schema: advisor_20260301OutputSchema
|
|
2926
|
+
});
|
|
2927
|
+
if (advisorOutput.type === "advisor_result") {
|
|
2928
|
+
anthropicContent.push({
|
|
2929
|
+
type: "advisor_tool_result",
|
|
2930
|
+
tool_use_id: part.toolCallId,
|
|
2931
|
+
content: {
|
|
2932
|
+
type: "advisor_result",
|
|
2933
|
+
text: advisorOutput.text
|
|
2934
|
+
},
|
|
2935
|
+
cache_control: cacheControl
|
|
2936
|
+
});
|
|
2937
|
+
} else if (advisorOutput.type === "advisor_redacted_result") {
|
|
2938
|
+
anthropicContent.push({
|
|
2939
|
+
type: "advisor_tool_result",
|
|
2940
|
+
tool_use_id: part.toolCallId,
|
|
2941
|
+
content: {
|
|
2942
|
+
type: "advisor_redacted_result",
|
|
2943
|
+
encrypted_content: advisorOutput.encryptedContent
|
|
2944
|
+
},
|
|
2945
|
+
cache_control: cacheControl
|
|
2946
|
+
});
|
|
2947
|
+
} else {
|
|
2948
|
+
anthropicContent.push({
|
|
2949
|
+
type: "advisor_tool_result",
|
|
2950
|
+
tool_use_id: part.toolCallId,
|
|
2951
|
+
content: {
|
|
2952
|
+
type: "advisor_tool_result_error",
|
|
2953
|
+
error_code: advisorOutput.errorCode
|
|
2954
|
+
},
|
|
2955
|
+
cache_control: cacheControl
|
|
2956
|
+
});
|
|
2957
|
+
}
|
|
2958
|
+
break;
|
|
2959
|
+
}
|
|
2768
2960
|
warnings.push({
|
|
2769
2961
|
type: "other",
|
|
2770
2962
|
message: `provider executed tool result for tool ${part.toolName} is not supported`
|
|
@@ -3211,7 +3403,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3211
3403
|
"anthropic.web_fetch_20250910": "web_fetch",
|
|
3212
3404
|
"anthropic.web_fetch_20260209": "web_fetch",
|
|
3213
3405
|
"anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
|
|
3214
|
-
"anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
|
|
3406
|
+
"anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25",
|
|
3407
|
+
"anthropic.advisor_20260301": "advisor"
|
|
3215
3408
|
}
|
|
3216
3409
|
});
|
|
3217
3410
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
@@ -3703,6 +3896,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3703
3896
|
input: JSON.stringify(part.input),
|
|
3704
3897
|
providerExecuted: true
|
|
3705
3898
|
});
|
|
3899
|
+
} else if (part.name === "advisor") {
|
|
3900
|
+
content.push({
|
|
3901
|
+
type: "tool-call",
|
|
3902
|
+
toolCallId: part.id,
|
|
3903
|
+
toolName: toolNameMapping.toCustomToolName("advisor"),
|
|
3904
|
+
input: JSON.stringify(part.input),
|
|
3905
|
+
providerExecuted: true
|
|
3906
|
+
});
|
|
3706
3907
|
}
|
|
3707
3908
|
break;
|
|
3708
3909
|
}
|
|
@@ -3916,6 +4117,43 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3916
4117
|
}
|
|
3917
4118
|
break;
|
|
3918
4119
|
}
|
|
4120
|
+
// advisor results for advisor_20260301:
|
|
4121
|
+
case "advisor_tool_result": {
|
|
4122
|
+
const advisorToolName = toolNameMapping.toCustomToolName("advisor");
|
|
4123
|
+
if (part.content.type === "advisor_result") {
|
|
4124
|
+
content.push({
|
|
4125
|
+
type: "tool-result",
|
|
4126
|
+
toolCallId: part.tool_use_id,
|
|
4127
|
+
toolName: advisorToolName,
|
|
4128
|
+
result: {
|
|
4129
|
+
type: "advisor_result",
|
|
4130
|
+
text: part.content.text
|
|
4131
|
+
}
|
|
4132
|
+
});
|
|
4133
|
+
} else if (part.content.type === "advisor_redacted_result") {
|
|
4134
|
+
content.push({
|
|
4135
|
+
type: "tool-result",
|
|
4136
|
+
toolCallId: part.tool_use_id,
|
|
4137
|
+
toolName: advisorToolName,
|
|
4138
|
+
result: {
|
|
4139
|
+
type: "advisor_redacted_result",
|
|
4140
|
+
encryptedContent: part.content.encrypted_content
|
|
4141
|
+
}
|
|
4142
|
+
});
|
|
4143
|
+
} else {
|
|
4144
|
+
content.push({
|
|
4145
|
+
type: "tool-result",
|
|
4146
|
+
toolCallId: part.tool_use_id,
|
|
4147
|
+
toolName: advisorToolName,
|
|
4148
|
+
isError: true,
|
|
4149
|
+
result: {
|
|
4150
|
+
type: "advisor_tool_result_error",
|
|
4151
|
+
errorCode: part.content.error_code
|
|
4152
|
+
}
|
|
4153
|
+
});
|
|
4154
|
+
}
|
|
4155
|
+
break;
|
|
4156
|
+
}
|
|
3919
4157
|
}
|
|
3920
4158
|
}
|
|
3921
4159
|
return {
|
|
@@ -3942,11 +4180,30 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3942
4180
|
usage: response.usage,
|
|
3943
4181
|
cacheCreationInputTokens: (_a2 = response.usage.cache_creation_input_tokens) != null ? _a2 : null,
|
|
3944
4182
|
stopSequence: (_b2 = response.stop_sequence) != null ? _b2 : null,
|
|
3945
|
-
iterations: response.usage.iterations ? response.usage.iterations.map(
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
4183
|
+
iterations: response.usage.iterations ? response.usage.iterations.map(
|
|
4184
|
+
(iter) => iter.type === "advisor_message" ? {
|
|
4185
|
+
type: iter.type,
|
|
4186
|
+
model: iter.model,
|
|
4187
|
+
inputTokens: iter.input_tokens,
|
|
4188
|
+
outputTokens: iter.output_tokens,
|
|
4189
|
+
...iter.cache_creation_input_tokens ? {
|
|
4190
|
+
cacheCreationInputTokens: iter.cache_creation_input_tokens
|
|
4191
|
+
} : {},
|
|
4192
|
+
...iter.cache_read_input_tokens ? {
|
|
4193
|
+
cacheReadInputTokens: iter.cache_read_input_tokens
|
|
4194
|
+
} : {}
|
|
4195
|
+
} : {
|
|
4196
|
+
type: iter.type,
|
|
4197
|
+
inputTokens: iter.input_tokens,
|
|
4198
|
+
outputTokens: iter.output_tokens,
|
|
4199
|
+
...iter.cache_creation_input_tokens ? {
|
|
4200
|
+
cacheCreationInputTokens: iter.cache_creation_input_tokens
|
|
4201
|
+
} : {},
|
|
4202
|
+
...iter.cache_read_input_tokens ? {
|
|
4203
|
+
cacheReadInputTokens: iter.cache_read_input_tokens
|
|
4204
|
+
} : {}
|
|
4205
|
+
}
|
|
4206
|
+
) : null,
|
|
3950
4207
|
container: response.container ? {
|
|
3951
4208
|
expiresAt: response.container.expires_at,
|
|
3952
4209
|
id: response.container.id,
|
|
@@ -4178,6 +4435,23 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4178
4435
|
toolName: customToolName,
|
|
4179
4436
|
providerExecuted: true
|
|
4180
4437
|
});
|
|
4438
|
+
} else if (part.name === "advisor") {
|
|
4439
|
+
const customToolName = toolNameMapping.toCustomToolName("advisor");
|
|
4440
|
+
contentBlocks[value.index] = {
|
|
4441
|
+
type: "tool-call",
|
|
4442
|
+
toolCallId: part.id,
|
|
4443
|
+
toolName: customToolName,
|
|
4444
|
+
input: "{}",
|
|
4445
|
+
providerExecuted: true,
|
|
4446
|
+
firstDelta: true,
|
|
4447
|
+
providerToolName: part.name
|
|
4448
|
+
};
|
|
4449
|
+
controller.enqueue({
|
|
4450
|
+
type: "tool-input-start",
|
|
4451
|
+
id: part.id,
|
|
4452
|
+
toolName: customToolName,
|
|
4453
|
+
providerExecuted: true
|
|
4454
|
+
});
|
|
4181
4455
|
}
|
|
4182
4456
|
return;
|
|
4183
4457
|
}
|
|
@@ -4361,6 +4635,44 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4361
4635
|
}
|
|
4362
4636
|
return;
|
|
4363
4637
|
}
|
|
4638
|
+
// advisor results for advisor_20260301:
|
|
4639
|
+
// arrives fully formed in a single content_block_start (no deltas).
|
|
4640
|
+
case "advisor_tool_result": {
|
|
4641
|
+
const advisorToolName = toolNameMapping.toCustomToolName("advisor");
|
|
4642
|
+
if (part.content.type === "advisor_result") {
|
|
4643
|
+
controller.enqueue({
|
|
4644
|
+
type: "tool-result",
|
|
4645
|
+
toolCallId: part.tool_use_id,
|
|
4646
|
+
toolName: advisorToolName,
|
|
4647
|
+
result: {
|
|
4648
|
+
type: "advisor_result",
|
|
4649
|
+
text: part.content.text
|
|
4650
|
+
}
|
|
4651
|
+
});
|
|
4652
|
+
} else if (part.content.type === "advisor_redacted_result") {
|
|
4653
|
+
controller.enqueue({
|
|
4654
|
+
type: "tool-result",
|
|
4655
|
+
toolCallId: part.tool_use_id,
|
|
4656
|
+
toolName: advisorToolName,
|
|
4657
|
+
result: {
|
|
4658
|
+
type: "advisor_redacted_result",
|
|
4659
|
+
encryptedContent: part.content.encrypted_content
|
|
4660
|
+
}
|
|
4661
|
+
});
|
|
4662
|
+
} else {
|
|
4663
|
+
controller.enqueue({
|
|
4664
|
+
type: "tool-result",
|
|
4665
|
+
toolCallId: part.tool_use_id,
|
|
4666
|
+
toolName: advisorToolName,
|
|
4667
|
+
isError: true,
|
|
4668
|
+
result: {
|
|
4669
|
+
type: "advisor_tool_result_error",
|
|
4670
|
+
errorCode: part.content.error_code
|
|
4671
|
+
}
|
|
4672
|
+
});
|
|
4673
|
+
}
|
|
4674
|
+
return;
|
|
4675
|
+
}
|
|
4364
4676
|
case "mcp_tool_use": {
|
|
4365
4677
|
mcpToolCalls[part.id] = {
|
|
4366
4678
|
type: "tool-call",
|
|
@@ -4678,11 +4990,30 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4678
4990
|
usage: rawUsage != null ? rawUsage : null,
|
|
4679
4991
|
cacheCreationInputTokens,
|
|
4680
4992
|
stopSequence,
|
|
4681
|
-
iterations: usage.iterations ? usage.iterations.map(
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4993
|
+
iterations: usage.iterations ? usage.iterations.map(
|
|
4994
|
+
(iter) => iter.type === "advisor_message" ? {
|
|
4995
|
+
type: iter.type,
|
|
4996
|
+
model: iter.model,
|
|
4997
|
+
inputTokens: iter.input_tokens,
|
|
4998
|
+
outputTokens: iter.output_tokens,
|
|
4999
|
+
...iter.cache_creation_input_tokens ? {
|
|
5000
|
+
cacheCreationInputTokens: iter.cache_creation_input_tokens
|
|
5001
|
+
} : {},
|
|
5002
|
+
...iter.cache_read_input_tokens ? {
|
|
5003
|
+
cacheReadInputTokens: iter.cache_read_input_tokens
|
|
5004
|
+
} : {}
|
|
5005
|
+
} : {
|
|
5006
|
+
type: iter.type,
|
|
5007
|
+
inputTokens: iter.input_tokens,
|
|
5008
|
+
outputTokens: iter.output_tokens,
|
|
5009
|
+
...iter.cache_creation_input_tokens ? {
|
|
5010
|
+
cacheCreationInputTokens: iter.cache_creation_input_tokens
|
|
5011
|
+
} : {},
|
|
5012
|
+
...iter.cache_read_input_tokens ? {
|
|
5013
|
+
cacheReadInputTokens: iter.cache_read_input_tokens
|
|
5014
|
+
} : {}
|
|
5015
|
+
}
|
|
5016
|
+
) : null,
|
|
4686
5017
|
container,
|
|
4687
5018
|
contextManagement
|
|
4688
5019
|
};
|
|
@@ -4850,15 +5181,15 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4850
5181
|
// src/tool/bash_20241022.ts
|
|
4851
5182
|
import {
|
|
4852
5183
|
createProviderToolFactory as createProviderToolFactory2,
|
|
4853
|
-
lazySchema as
|
|
4854
|
-
zodSchema as
|
|
5184
|
+
lazySchema as lazySchema13,
|
|
5185
|
+
zodSchema as zodSchema13
|
|
4855
5186
|
} from "@ai-sdk/provider-utils";
|
|
4856
|
-
import { z as
|
|
4857
|
-
var bash_20241022InputSchema =
|
|
4858
|
-
() =>
|
|
4859
|
-
|
|
4860
|
-
command:
|
|
4861
|
-
restart:
|
|
5187
|
+
import { z as z14 } from "zod/v4";
|
|
5188
|
+
var bash_20241022InputSchema = lazySchema13(
|
|
5189
|
+
() => zodSchema13(
|
|
5190
|
+
z14.object({
|
|
5191
|
+
command: z14.string(),
|
|
5192
|
+
restart: z14.boolean().optional()
|
|
4862
5193
|
})
|
|
4863
5194
|
)
|
|
4864
5195
|
);
|
|
@@ -4870,15 +5201,15 @@ var bash_20241022 = createProviderToolFactory2({
|
|
|
4870
5201
|
// src/tool/bash_20250124.ts
|
|
4871
5202
|
import {
|
|
4872
5203
|
createProviderToolFactory as createProviderToolFactory3,
|
|
4873
|
-
lazySchema as
|
|
4874
|
-
zodSchema as
|
|
5204
|
+
lazySchema as lazySchema14,
|
|
5205
|
+
zodSchema as zodSchema14
|
|
4875
5206
|
} from "@ai-sdk/provider-utils";
|
|
4876
|
-
import { z as
|
|
4877
|
-
var bash_20250124InputSchema =
|
|
4878
|
-
() =>
|
|
4879
|
-
|
|
4880
|
-
command:
|
|
4881
|
-
restart:
|
|
5207
|
+
import { z as z15 } from "zod/v4";
|
|
5208
|
+
var bash_20250124InputSchema = lazySchema14(
|
|
5209
|
+
() => zodSchema14(
|
|
5210
|
+
z15.object({
|
|
5211
|
+
command: z15.string(),
|
|
5212
|
+
restart: z15.boolean().optional()
|
|
4882
5213
|
})
|
|
4883
5214
|
)
|
|
4884
5215
|
);
|
|
@@ -4890,14 +5221,14 @@ var bash_20250124 = createProviderToolFactory3({
|
|
|
4890
5221
|
// src/tool/computer_20241022.ts
|
|
4891
5222
|
import {
|
|
4892
5223
|
createProviderToolFactory as createProviderToolFactory4,
|
|
4893
|
-
lazySchema as
|
|
4894
|
-
zodSchema as
|
|
5224
|
+
lazySchema as lazySchema15,
|
|
5225
|
+
zodSchema as zodSchema15
|
|
4895
5226
|
} from "@ai-sdk/provider-utils";
|
|
4896
|
-
import { z as
|
|
4897
|
-
var computer_20241022InputSchema =
|
|
4898
|
-
() =>
|
|
4899
|
-
|
|
4900
|
-
action:
|
|
5227
|
+
import { z as z16 } from "zod/v4";
|
|
5228
|
+
var computer_20241022InputSchema = lazySchema15(
|
|
5229
|
+
() => zodSchema15(
|
|
5230
|
+
z16.object({
|
|
5231
|
+
action: z16.enum([
|
|
4901
5232
|
"key",
|
|
4902
5233
|
"type",
|
|
4903
5234
|
"mouse_move",
|
|
@@ -4909,8 +5240,8 @@ var computer_20241022InputSchema = lazySchema14(
|
|
|
4909
5240
|
"screenshot",
|
|
4910
5241
|
"cursor_position"
|
|
4911
5242
|
]),
|
|
4912
|
-
coordinate:
|
|
4913
|
-
text:
|
|
5243
|
+
coordinate: z16.array(z16.number().int()).optional(),
|
|
5244
|
+
text: z16.string().optional()
|
|
4914
5245
|
})
|
|
4915
5246
|
)
|
|
4916
5247
|
);
|
|
@@ -4922,14 +5253,14 @@ var computer_20241022 = createProviderToolFactory4({
|
|
|
4922
5253
|
// src/tool/computer_20250124.ts
|
|
4923
5254
|
import {
|
|
4924
5255
|
createProviderToolFactory as createProviderToolFactory5,
|
|
4925
|
-
lazySchema as
|
|
4926
|
-
zodSchema as
|
|
5256
|
+
lazySchema as lazySchema16,
|
|
5257
|
+
zodSchema as zodSchema16
|
|
4927
5258
|
} from "@ai-sdk/provider-utils";
|
|
4928
|
-
import { z as
|
|
4929
|
-
var computer_20250124InputSchema =
|
|
4930
|
-
() =>
|
|
4931
|
-
|
|
4932
|
-
action:
|
|
5259
|
+
import { z as z17 } from "zod/v4";
|
|
5260
|
+
var computer_20250124InputSchema = lazySchema16(
|
|
5261
|
+
() => zodSchema16(
|
|
5262
|
+
z17.object({
|
|
5263
|
+
action: z17.enum([
|
|
4933
5264
|
"key",
|
|
4934
5265
|
"hold_key",
|
|
4935
5266
|
"type",
|
|
@@ -4947,12 +5278,12 @@ var computer_20250124InputSchema = lazySchema15(
|
|
|
4947
5278
|
"wait",
|
|
4948
5279
|
"screenshot"
|
|
4949
5280
|
]),
|
|
4950
|
-
coordinate:
|
|
4951
|
-
duration:
|
|
4952
|
-
scroll_amount:
|
|
4953
|
-
scroll_direction:
|
|
4954
|
-
start_coordinate:
|
|
4955
|
-
text:
|
|
5281
|
+
coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
5282
|
+
duration: z17.number().optional(),
|
|
5283
|
+
scroll_amount: z17.number().optional(),
|
|
5284
|
+
scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
|
|
5285
|
+
start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
5286
|
+
text: z17.string().optional()
|
|
4956
5287
|
})
|
|
4957
5288
|
)
|
|
4958
5289
|
);
|
|
@@ -4964,14 +5295,14 @@ var computer_20250124 = createProviderToolFactory5({
|
|
|
4964
5295
|
// src/tool/computer_20251124.ts
|
|
4965
5296
|
import {
|
|
4966
5297
|
createProviderToolFactory as createProviderToolFactory6,
|
|
4967
|
-
lazySchema as
|
|
4968
|
-
zodSchema as
|
|
5298
|
+
lazySchema as lazySchema17,
|
|
5299
|
+
zodSchema as zodSchema17
|
|
4969
5300
|
} from "@ai-sdk/provider-utils";
|
|
4970
|
-
import { z as
|
|
4971
|
-
var computer_20251124InputSchema =
|
|
4972
|
-
() =>
|
|
4973
|
-
|
|
4974
|
-
action:
|
|
5301
|
+
import { z as z18 } from "zod/v4";
|
|
5302
|
+
var computer_20251124InputSchema = lazySchema17(
|
|
5303
|
+
() => zodSchema17(
|
|
5304
|
+
z18.object({
|
|
5305
|
+
action: z18.enum([
|
|
4975
5306
|
"key",
|
|
4976
5307
|
"hold_key",
|
|
4977
5308
|
"type",
|
|
@@ -4990,18 +5321,18 @@ var computer_20251124InputSchema = lazySchema16(
|
|
|
4990
5321
|
"screenshot",
|
|
4991
5322
|
"zoom"
|
|
4992
5323
|
]),
|
|
4993
|
-
coordinate:
|
|
4994
|
-
duration:
|
|
4995
|
-
region:
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5324
|
+
coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
|
|
5325
|
+
duration: z18.number().optional(),
|
|
5326
|
+
region: z18.tuple([
|
|
5327
|
+
z18.number().int(),
|
|
5328
|
+
z18.number().int(),
|
|
5329
|
+
z18.number().int(),
|
|
5330
|
+
z18.number().int()
|
|
5000
5331
|
]).optional(),
|
|
5001
|
-
scroll_amount:
|
|
5002
|
-
scroll_direction:
|
|
5003
|
-
start_coordinate:
|
|
5004
|
-
text:
|
|
5332
|
+
scroll_amount: z18.number().optional(),
|
|
5333
|
+
scroll_direction: z18.enum(["up", "down", "left", "right"]).optional(),
|
|
5334
|
+
start_coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
|
|
5335
|
+
text: z18.string().optional()
|
|
5005
5336
|
})
|
|
5006
5337
|
)
|
|
5007
5338
|
);
|
|
@@ -5013,43 +5344,43 @@ var computer_20251124 = createProviderToolFactory6({
|
|
|
5013
5344
|
// src/tool/memory_20250818.ts
|
|
5014
5345
|
import {
|
|
5015
5346
|
createProviderToolFactory as createProviderToolFactory7,
|
|
5016
|
-
lazySchema as
|
|
5017
|
-
zodSchema as
|
|
5347
|
+
lazySchema as lazySchema18,
|
|
5348
|
+
zodSchema as zodSchema18
|
|
5018
5349
|
} from "@ai-sdk/provider-utils";
|
|
5019
|
-
import { z as
|
|
5020
|
-
var memory_20250818InputSchema =
|
|
5021
|
-
() =>
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
command:
|
|
5025
|
-
path:
|
|
5026
|
-
view_range:
|
|
5350
|
+
import { z as z19 } from "zod/v4";
|
|
5351
|
+
var memory_20250818InputSchema = lazySchema18(
|
|
5352
|
+
() => zodSchema18(
|
|
5353
|
+
z19.discriminatedUnion("command", [
|
|
5354
|
+
z19.object({
|
|
5355
|
+
command: z19.literal("view"),
|
|
5356
|
+
path: z19.string(),
|
|
5357
|
+
view_range: z19.tuple([z19.number(), z19.number()]).optional()
|
|
5027
5358
|
}),
|
|
5028
|
-
|
|
5029
|
-
command:
|
|
5030
|
-
path:
|
|
5031
|
-
file_text:
|
|
5359
|
+
z19.object({
|
|
5360
|
+
command: z19.literal("create"),
|
|
5361
|
+
path: z19.string(),
|
|
5362
|
+
file_text: z19.string()
|
|
5032
5363
|
}),
|
|
5033
|
-
|
|
5034
|
-
command:
|
|
5035
|
-
path:
|
|
5036
|
-
old_str:
|
|
5037
|
-
new_str:
|
|
5364
|
+
z19.object({
|
|
5365
|
+
command: z19.literal("str_replace"),
|
|
5366
|
+
path: z19.string(),
|
|
5367
|
+
old_str: z19.string(),
|
|
5368
|
+
new_str: z19.string()
|
|
5038
5369
|
}),
|
|
5039
|
-
|
|
5040
|
-
command:
|
|
5041
|
-
path:
|
|
5042
|
-
insert_line:
|
|
5043
|
-
insert_text:
|
|
5370
|
+
z19.object({
|
|
5371
|
+
command: z19.literal("insert"),
|
|
5372
|
+
path: z19.string(),
|
|
5373
|
+
insert_line: z19.number(),
|
|
5374
|
+
insert_text: z19.string()
|
|
5044
5375
|
}),
|
|
5045
|
-
|
|
5046
|
-
command:
|
|
5047
|
-
path:
|
|
5376
|
+
z19.object({
|
|
5377
|
+
command: z19.literal("delete"),
|
|
5378
|
+
path: z19.string()
|
|
5048
5379
|
}),
|
|
5049
|
-
|
|
5050
|
-
command:
|
|
5051
|
-
old_path:
|
|
5052
|
-
new_path:
|
|
5380
|
+
z19.object({
|
|
5381
|
+
command: z19.literal("rename"),
|
|
5382
|
+
old_path: z19.string(),
|
|
5383
|
+
new_path: z19.string()
|
|
5053
5384
|
})
|
|
5054
5385
|
])
|
|
5055
5386
|
)
|
|
@@ -5062,37 +5393,11 @@ var memory_20250818 = createProviderToolFactory7({
|
|
|
5062
5393
|
// src/tool/text-editor_20241022.ts
|
|
5063
5394
|
import {
|
|
5064
5395
|
createProviderToolFactory as createProviderToolFactory8,
|
|
5065
|
-
lazySchema as lazySchema18,
|
|
5066
|
-
zodSchema as zodSchema18
|
|
5067
|
-
} from "@ai-sdk/provider-utils";
|
|
5068
|
-
import { z as z19 } from "zod/v4";
|
|
5069
|
-
var textEditor_20241022InputSchema = lazySchema18(
|
|
5070
|
-
() => zodSchema18(
|
|
5071
|
-
z19.object({
|
|
5072
|
-
command: z19.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
5073
|
-
path: z19.string(),
|
|
5074
|
-
file_text: z19.string().optional(),
|
|
5075
|
-
insert_line: z19.number().int().optional(),
|
|
5076
|
-
new_str: z19.string().optional(),
|
|
5077
|
-
insert_text: z19.string().optional(),
|
|
5078
|
-
old_str: z19.string().optional(),
|
|
5079
|
-
view_range: z19.array(z19.number().int()).optional()
|
|
5080
|
-
})
|
|
5081
|
-
)
|
|
5082
|
-
);
|
|
5083
|
-
var textEditor_20241022 = createProviderToolFactory8({
|
|
5084
|
-
id: "anthropic.text_editor_20241022",
|
|
5085
|
-
inputSchema: textEditor_20241022InputSchema
|
|
5086
|
-
});
|
|
5087
|
-
|
|
5088
|
-
// src/tool/text-editor_20250124.ts
|
|
5089
|
-
import {
|
|
5090
|
-
createProviderToolFactory as createProviderToolFactory9,
|
|
5091
5396
|
lazySchema as lazySchema19,
|
|
5092
5397
|
zodSchema as zodSchema19
|
|
5093
5398
|
} from "@ai-sdk/provider-utils";
|
|
5094
5399
|
import { z as z20 } from "zod/v4";
|
|
5095
|
-
var
|
|
5400
|
+
var textEditor_20241022InputSchema = lazySchema19(
|
|
5096
5401
|
() => zodSchema19(
|
|
5097
5402
|
z20.object({
|
|
5098
5403
|
command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -5106,22 +5411,22 @@ var textEditor_20250124InputSchema = lazySchema19(
|
|
|
5106
5411
|
})
|
|
5107
5412
|
)
|
|
5108
5413
|
);
|
|
5109
|
-
var
|
|
5110
|
-
id: "anthropic.
|
|
5111
|
-
inputSchema:
|
|
5414
|
+
var textEditor_20241022 = createProviderToolFactory8({
|
|
5415
|
+
id: "anthropic.text_editor_20241022",
|
|
5416
|
+
inputSchema: textEditor_20241022InputSchema
|
|
5112
5417
|
});
|
|
5113
5418
|
|
|
5114
|
-
// src/tool/text-
|
|
5419
|
+
// src/tool/text-editor_20250124.ts
|
|
5115
5420
|
import {
|
|
5116
|
-
createProviderToolFactory as
|
|
5421
|
+
createProviderToolFactory as createProviderToolFactory9,
|
|
5117
5422
|
lazySchema as lazySchema20,
|
|
5118
5423
|
zodSchema as zodSchema20
|
|
5119
5424
|
} from "@ai-sdk/provider-utils";
|
|
5120
5425
|
import { z as z21 } from "zod/v4";
|
|
5121
|
-
var
|
|
5426
|
+
var textEditor_20250124InputSchema = lazySchema20(
|
|
5122
5427
|
() => zodSchema20(
|
|
5123
5428
|
z21.object({
|
|
5124
|
-
command: z21.enum(["view", "create", "str_replace", "insert"]),
|
|
5429
|
+
command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
5125
5430
|
path: z21.string(),
|
|
5126
5431
|
file_text: z21.string().optional(),
|
|
5127
5432
|
insert_line: z21.number().int().optional(),
|
|
@@ -5132,55 +5437,110 @@ var textEditor_20250429InputSchema = lazySchema20(
|
|
|
5132
5437
|
})
|
|
5133
5438
|
)
|
|
5134
5439
|
);
|
|
5135
|
-
var
|
|
5136
|
-
id: "anthropic.
|
|
5137
|
-
inputSchema:
|
|
5440
|
+
var textEditor_20250124 = createProviderToolFactory9({
|
|
5441
|
+
id: "anthropic.text_editor_20250124",
|
|
5442
|
+
inputSchema: textEditor_20250124InputSchema
|
|
5138
5443
|
});
|
|
5139
5444
|
|
|
5140
|
-
// src/tool/
|
|
5445
|
+
// src/tool/text-editor_20250429.ts
|
|
5141
5446
|
import {
|
|
5142
|
-
|
|
5447
|
+
createProviderToolFactory as createProviderToolFactory10,
|
|
5143
5448
|
lazySchema as lazySchema21,
|
|
5144
5449
|
zodSchema as zodSchema21
|
|
5145
5450
|
} from "@ai-sdk/provider-utils";
|
|
5146
5451
|
import { z as z22 } from "zod/v4";
|
|
5147
|
-
var
|
|
5452
|
+
var textEditor_20250429InputSchema = lazySchema21(
|
|
5148
5453
|
() => zodSchema21(
|
|
5149
|
-
z22.
|
|
5150
|
-
z22.
|
|
5151
|
-
|
|
5152
|
-
|
|
5454
|
+
z22.object({
|
|
5455
|
+
command: z22.enum(["view", "create", "str_replace", "insert"]),
|
|
5456
|
+
path: z22.string(),
|
|
5457
|
+
file_text: z22.string().optional(),
|
|
5458
|
+
insert_line: z22.number().int().optional(),
|
|
5459
|
+
new_str: z22.string().optional(),
|
|
5460
|
+
insert_text: z22.string().optional(),
|
|
5461
|
+
old_str: z22.string().optional(),
|
|
5462
|
+
view_range: z22.array(z22.number().int()).optional()
|
|
5463
|
+
})
|
|
5464
|
+
)
|
|
5465
|
+
);
|
|
5466
|
+
var textEditor_20250429 = createProviderToolFactory10({
|
|
5467
|
+
id: "anthropic.text_editor_20250429",
|
|
5468
|
+
inputSchema: textEditor_20250429InputSchema
|
|
5469
|
+
});
|
|
5470
|
+
|
|
5471
|
+
// src/tool/tool-search-bm25_20251119.ts
|
|
5472
|
+
import {
|
|
5473
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
|
|
5474
|
+
lazySchema as lazySchema22,
|
|
5475
|
+
zodSchema as zodSchema22
|
|
5476
|
+
} from "@ai-sdk/provider-utils";
|
|
5477
|
+
import { z as z23 } from "zod/v4";
|
|
5478
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema22(
|
|
5479
|
+
() => zodSchema22(
|
|
5480
|
+
z23.array(
|
|
5481
|
+
z23.object({
|
|
5482
|
+
type: z23.literal("tool_reference"),
|
|
5483
|
+
toolName: z23.string()
|
|
5153
5484
|
})
|
|
5154
5485
|
)
|
|
5155
5486
|
)
|
|
5156
5487
|
);
|
|
5157
|
-
var toolSearchBm25_20251119InputSchema =
|
|
5158
|
-
() =>
|
|
5159
|
-
|
|
5488
|
+
var toolSearchBm25_20251119InputSchema = lazySchema22(
|
|
5489
|
+
() => zodSchema22(
|
|
5490
|
+
z23.object({
|
|
5160
5491
|
/**
|
|
5161
5492
|
* A natural language query to search for tools.
|
|
5162
5493
|
* Claude will use BM25 text search to find relevant tools.
|
|
5163
5494
|
*/
|
|
5164
|
-
query:
|
|
5495
|
+
query: z23.string(),
|
|
5165
5496
|
/**
|
|
5166
5497
|
* Maximum number of tools to return. Optional.
|
|
5167
5498
|
*/
|
|
5168
|
-
limit:
|
|
5499
|
+
limit: z23.number().optional()
|
|
5169
5500
|
})
|
|
5170
5501
|
)
|
|
5171
5502
|
);
|
|
5172
|
-
var
|
|
5503
|
+
var factory11 = createProviderToolFactoryWithOutputSchema10({
|
|
5173
5504
|
id: "anthropic.tool_search_bm25_20251119",
|
|
5174
5505
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
5175
5506
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
5176
5507
|
supportsDeferredResults: true
|
|
5177
5508
|
});
|
|
5178
5509
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
5179
|
-
return
|
|
5510
|
+
return factory11(args);
|
|
5180
5511
|
};
|
|
5181
5512
|
|
|
5182
5513
|
// src/anthropic-tools.ts
|
|
5183
5514
|
var anthropicTools = {
|
|
5515
|
+
/**
|
|
5516
|
+
* Pairs a faster executor model with a higher-intelligence advisor model
|
|
5517
|
+
* that provides strategic guidance mid-generation.
|
|
5518
|
+
*
|
|
5519
|
+
* The advisor lets a faster, lower-cost executor model consult a
|
|
5520
|
+
* higher-intelligence advisor model server-side. The advisor reads the
|
|
5521
|
+
* executor's full transcript and produces a plan or course correction;
|
|
5522
|
+
* the executor continues with the task, informed by the advice. All of
|
|
5523
|
+
* this happens inside a single `/v1/messages` request.
|
|
5524
|
+
*
|
|
5525
|
+
* Beta header `advisor-tool-2026-03-01` is added automatically when this
|
|
5526
|
+
* tool is included.
|
|
5527
|
+
*
|
|
5528
|
+
* Multi-turn conversations: pass the full assistant content (including
|
|
5529
|
+
* `advisor_tool_result` blocks) back to the API on subsequent turns. If
|
|
5530
|
+
* you omit the advisor tool from `tools` on a follow-up turn while the
|
|
5531
|
+
* message history still contains `advisor_tool_result` blocks, the API
|
|
5532
|
+
* returns a `400 invalid_request_error`.
|
|
5533
|
+
*
|
|
5534
|
+
* Supported executor models: Claude Haiku 4.5, Sonnet 4.6, Opus 4.6,
|
|
5535
|
+
* Opus 4.7. The advisor must be at least as capable as the executor.
|
|
5536
|
+
*
|
|
5537
|
+
* @param model - The advisor model ID (required), e.g. `"claude-opus-4-7"`.
|
|
5538
|
+
* @param maxUses - Maximum advisor calls per request (per-request cap).
|
|
5539
|
+
* @param caching - Enables prompt caching for the advisor's transcript
|
|
5540
|
+
* across calls within a conversation. Worthwhile from ~3 advisor calls
|
|
5541
|
+
* per conversation.
|
|
5542
|
+
*/
|
|
5543
|
+
advisor_20260301,
|
|
5184
5544
|
/**
|
|
5185
5545
|
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
5186
5546
|
* allowing system operations, script execution, and command-line automation.
|