@ai-sdk/anthropic 3.0.53 → 3.0.54
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 +6 -0
- package/dist/index.d.mts +98 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.js +635 -400
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +618 -375
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +100 -2
- package/dist/internal/index.d.ts +100 -2
- package/dist/internal/index.js +628 -393
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +617 -374
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-messages-api.ts +61 -2
- package/src/anthropic-messages-language-model.ts +64 -1
- package/src/anthropic-prepare-tools.ts +37 -0
- package/src/anthropic-tools.ts +23 -0
- package/src/convert-to-anthropic-messages-prompt.ts +6 -0
- package/src/tool/web-fetch-20260209.ts +145 -0
- package/src/tool/web-search_20260209.ts +136 -0
package/dist/index.js
CHANGED
|
@@ -29,14 +29,14 @@ module.exports = __toCommonJS(src_exports);
|
|
|
29
29
|
|
|
30
30
|
// src/anthropic-provider.ts
|
|
31
31
|
var import_provider4 = require("@ai-sdk/provider");
|
|
32
|
-
var
|
|
32
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.54" : "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
|
|
39
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
40
40
|
|
|
41
41
|
// src/anthropic-error.ts
|
|
42
42
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -136,7 +136,16 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
136
136
|
type: import_v42.z.literal("server_tool_use"),
|
|
137
137
|
id: import_v42.z.string(),
|
|
138
138
|
name: import_v42.z.string(),
|
|
139
|
-
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish()
|
|
139
|
+
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
140
|
+
caller: import_v42.z.union([
|
|
141
|
+
import_v42.z.object({
|
|
142
|
+
type: import_v42.z.literal("code_execution_20260120"),
|
|
143
|
+
tool_id: import_v42.z.string()
|
|
144
|
+
}),
|
|
145
|
+
import_v42.z.object({
|
|
146
|
+
type: import_v42.z.literal("direct")
|
|
147
|
+
})
|
|
148
|
+
]).optional()
|
|
140
149
|
}),
|
|
141
150
|
import_v42.z.object({
|
|
142
151
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -224,6 +233,18 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
224
233
|
})
|
|
225
234
|
).optional().default([])
|
|
226
235
|
}),
|
|
236
|
+
import_v42.z.object({
|
|
237
|
+
type: import_v42.z.literal("encrypted_code_execution_result"),
|
|
238
|
+
encrypted_stdout: import_v42.z.string(),
|
|
239
|
+
stderr: import_v42.z.string(),
|
|
240
|
+
return_code: import_v42.z.number(),
|
|
241
|
+
content: import_v42.z.array(
|
|
242
|
+
import_v42.z.object({
|
|
243
|
+
type: import_v42.z.literal("code_execution_output"),
|
|
244
|
+
file_id: import_v42.z.string()
|
|
245
|
+
})
|
|
246
|
+
).optional().default([])
|
|
247
|
+
}),
|
|
227
248
|
import_v42.z.object({
|
|
228
249
|
type: import_v42.z.literal("code_execution_tool_result_error"),
|
|
229
250
|
error_code: import_v42.z.string()
|
|
@@ -446,7 +467,16 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
446
467
|
type: import_v42.z.literal("server_tool_use"),
|
|
447
468
|
id: import_v42.z.string(),
|
|
448
469
|
name: import_v42.z.string(),
|
|
449
|
-
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish()
|
|
470
|
+
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
471
|
+
caller: import_v42.z.union([
|
|
472
|
+
import_v42.z.object({
|
|
473
|
+
type: import_v42.z.literal("code_execution_20260120"),
|
|
474
|
+
tool_id: import_v42.z.string()
|
|
475
|
+
}),
|
|
476
|
+
import_v42.z.object({
|
|
477
|
+
type: import_v42.z.literal("direct")
|
|
478
|
+
})
|
|
479
|
+
]).optional()
|
|
450
480
|
}),
|
|
451
481
|
import_v42.z.object({
|
|
452
482
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -534,6 +564,18 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
534
564
|
})
|
|
535
565
|
).optional().default([])
|
|
536
566
|
}),
|
|
567
|
+
import_v42.z.object({
|
|
568
|
+
type: import_v42.z.literal("encrypted_code_execution_result"),
|
|
569
|
+
encrypted_stdout: import_v42.z.string(),
|
|
570
|
+
stderr: import_v42.z.string(),
|
|
571
|
+
return_code: import_v42.z.number(),
|
|
572
|
+
content: import_v42.z.array(
|
|
573
|
+
import_v42.z.object({
|
|
574
|
+
type: import_v42.z.literal("code_execution_output"),
|
|
575
|
+
file_id: import_v42.z.string()
|
|
576
|
+
})
|
|
577
|
+
).optional().default([])
|
|
578
|
+
}),
|
|
537
579
|
import_v42.z.object({
|
|
538
580
|
type: import_v42.z.literal("code_execution_tool_result_error"),
|
|
539
581
|
error_code: import_v42.z.string()
|
|
@@ -1003,10 +1045,10 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1003
1045
|
return factory(args);
|
|
1004
1046
|
};
|
|
1005
1047
|
|
|
1006
|
-
// src/tool/web-
|
|
1048
|
+
// src/tool/web-search_20260209.ts
|
|
1007
1049
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1008
1050
|
var import_v45 = require("zod/v4");
|
|
1009
|
-
var
|
|
1051
|
+
var webSearch_20260209ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1010
1052
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1011
1053
|
import_v45.z.object({
|
|
1012
1054
|
maxUses: import_v45.z.number().optional(),
|
|
@@ -1022,7 +1064,7 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1022
1064
|
})
|
|
1023
1065
|
)
|
|
1024
1066
|
);
|
|
1025
|
-
var
|
|
1067
|
+
var webSearch_20260209OutputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1026
1068
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1027
1069
|
import_v45.z.array(
|
|
1028
1070
|
import_v45.z.object({
|
|
@@ -1035,7 +1077,7 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1035
1077
|
)
|
|
1036
1078
|
)
|
|
1037
1079
|
);
|
|
1038
|
-
var
|
|
1080
|
+
var webSearch_20260209InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1039
1081
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1040
1082
|
import_v45.z.object({
|
|
1041
1083
|
query: import_v45.z.string()
|
|
@@ -1043,74 +1085,180 @@ var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1043
1085
|
)
|
|
1044
1086
|
);
|
|
1045
1087
|
var factory2 = (0, import_provider_utils5.createProviderToolFactoryWithOutputSchema)({
|
|
1046
|
-
id: "anthropic.
|
|
1047
|
-
inputSchema:
|
|
1048
|
-
outputSchema:
|
|
1088
|
+
id: "anthropic.web_search_20260209",
|
|
1089
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1090
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1049
1091
|
supportsDeferredResults: true
|
|
1050
1092
|
});
|
|
1051
|
-
var
|
|
1093
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1052
1094
|
return factory2(args);
|
|
1053
1095
|
};
|
|
1054
1096
|
|
|
1055
|
-
// src/tool/web-
|
|
1097
|
+
// src/tool/web-search_20250305.ts
|
|
1056
1098
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1057
1099
|
var import_v46 = require("zod/v4");
|
|
1058
|
-
var
|
|
1100
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1059
1101
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1060
1102
|
import_v46.z.object({
|
|
1061
1103
|
maxUses: import_v46.z.number().optional(),
|
|
1062
1104
|
allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1063
1105
|
blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1064
|
-
|
|
1065
|
-
|
|
1106
|
+
userLocation: import_v46.z.object({
|
|
1107
|
+
type: import_v46.z.literal("approximate"),
|
|
1108
|
+
city: import_v46.z.string().optional(),
|
|
1109
|
+
region: import_v46.z.string().optional(),
|
|
1110
|
+
country: import_v46.z.string().optional(),
|
|
1111
|
+
timezone: import_v46.z.string().optional()
|
|
1112
|
+
}).optional()
|
|
1066
1113
|
})
|
|
1067
1114
|
)
|
|
1068
1115
|
);
|
|
1069
|
-
var
|
|
1116
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1070
1117
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1071
|
-
import_v46.z.
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
content: import_v46.z.object({
|
|
1075
|
-
type: import_v46.z.literal("document"),
|
|
1118
|
+
import_v46.z.array(
|
|
1119
|
+
import_v46.z.object({
|
|
1120
|
+
url: import_v46.z.string(),
|
|
1076
1121
|
title: import_v46.z.string().nullable(),
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1122
|
+
pageAge: import_v46.z.string().nullable(),
|
|
1123
|
+
encryptedContent: import_v46.z.string(),
|
|
1124
|
+
type: import_v46.z.literal("web_search_result")
|
|
1125
|
+
})
|
|
1126
|
+
)
|
|
1127
|
+
)
|
|
1128
|
+
);
|
|
1129
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1130
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1131
|
+
import_v46.z.object({
|
|
1132
|
+
query: import_v46.z.string()
|
|
1133
|
+
})
|
|
1134
|
+
)
|
|
1135
|
+
);
|
|
1136
|
+
var factory3 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
|
|
1137
|
+
id: "anthropic.web_search_20250305",
|
|
1138
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1139
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1140
|
+
supportsDeferredResults: true
|
|
1141
|
+
});
|
|
1142
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1143
|
+
return factory3(args);
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
// src/tool/web-fetch-20260209.ts
|
|
1147
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1148
|
+
var import_v47 = require("zod/v4");
|
|
1149
|
+
var webFetch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1150
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1151
|
+
import_v47.z.object({
|
|
1152
|
+
maxUses: import_v47.z.number().optional(),
|
|
1153
|
+
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1154
|
+
blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1155
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1156
|
+
maxContentTokens: import_v47.z.number().optional()
|
|
1157
|
+
})
|
|
1158
|
+
)
|
|
1159
|
+
);
|
|
1160
|
+
var webFetch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1161
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1162
|
+
import_v47.z.object({
|
|
1163
|
+
type: import_v47.z.literal("web_fetch_result"),
|
|
1164
|
+
url: import_v47.z.string(),
|
|
1165
|
+
content: import_v47.z.object({
|
|
1166
|
+
type: import_v47.z.literal("document"),
|
|
1167
|
+
title: import_v47.z.string().nullable(),
|
|
1168
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1169
|
+
source: import_v47.z.union([
|
|
1170
|
+
import_v47.z.object({
|
|
1171
|
+
type: import_v47.z.literal("base64"),
|
|
1172
|
+
mediaType: import_v47.z.literal("application/pdf"),
|
|
1173
|
+
data: import_v47.z.string()
|
|
1083
1174
|
}),
|
|
1084
|
-
|
|
1085
|
-
type:
|
|
1086
|
-
mediaType:
|
|
1087
|
-
data:
|
|
1175
|
+
import_v47.z.object({
|
|
1176
|
+
type: import_v47.z.literal("text"),
|
|
1177
|
+
mediaType: import_v47.z.literal("text/plain"),
|
|
1178
|
+
data: import_v47.z.string()
|
|
1088
1179
|
})
|
|
1089
1180
|
])
|
|
1090
1181
|
}),
|
|
1091
|
-
retrievedAt:
|
|
1182
|
+
retrievedAt: import_v47.z.string().nullable()
|
|
1092
1183
|
})
|
|
1093
1184
|
)
|
|
1094
1185
|
);
|
|
1095
|
-
var
|
|
1096
|
-
() => (0,
|
|
1097
|
-
|
|
1098
|
-
url:
|
|
1186
|
+
var webFetch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1187
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1188
|
+
import_v47.z.object({
|
|
1189
|
+
url: import_v47.z.string()
|
|
1099
1190
|
})
|
|
1100
1191
|
)
|
|
1101
1192
|
);
|
|
1102
|
-
var
|
|
1193
|
+
var factory4 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1194
|
+
id: "anthropic.web_fetch_20260209",
|
|
1195
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1196
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1197
|
+
supportsDeferredResults: true
|
|
1198
|
+
});
|
|
1199
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1200
|
+
return factory4(args);
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1203
|
+
// src/tool/web-fetch-20250910.ts
|
|
1204
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1205
|
+
var import_v48 = require("zod/v4");
|
|
1206
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
1207
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1208
|
+
import_v48.z.object({
|
|
1209
|
+
maxUses: import_v48.z.number().optional(),
|
|
1210
|
+
allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
1211
|
+
blockedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
1212
|
+
citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
|
|
1213
|
+
maxContentTokens: import_v48.z.number().optional()
|
|
1214
|
+
})
|
|
1215
|
+
)
|
|
1216
|
+
);
|
|
1217
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1218
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1219
|
+
import_v48.z.object({
|
|
1220
|
+
type: import_v48.z.literal("web_fetch_result"),
|
|
1221
|
+
url: import_v48.z.string(),
|
|
1222
|
+
content: import_v48.z.object({
|
|
1223
|
+
type: import_v48.z.literal("document"),
|
|
1224
|
+
title: import_v48.z.string().nullable(),
|
|
1225
|
+
citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
|
|
1226
|
+
source: import_v48.z.union([
|
|
1227
|
+
import_v48.z.object({
|
|
1228
|
+
type: import_v48.z.literal("base64"),
|
|
1229
|
+
mediaType: import_v48.z.literal("application/pdf"),
|
|
1230
|
+
data: import_v48.z.string()
|
|
1231
|
+
}),
|
|
1232
|
+
import_v48.z.object({
|
|
1233
|
+
type: import_v48.z.literal("text"),
|
|
1234
|
+
mediaType: import_v48.z.literal("text/plain"),
|
|
1235
|
+
data: import_v48.z.string()
|
|
1236
|
+
})
|
|
1237
|
+
])
|
|
1238
|
+
}),
|
|
1239
|
+
retrievedAt: import_v48.z.string().nullable()
|
|
1240
|
+
})
|
|
1241
|
+
)
|
|
1242
|
+
);
|
|
1243
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1244
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1245
|
+
import_v48.z.object({
|
|
1246
|
+
url: import_v48.z.string()
|
|
1247
|
+
})
|
|
1248
|
+
)
|
|
1249
|
+
);
|
|
1250
|
+
var factory5 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1103
1251
|
id: "anthropic.web_fetch_20250910",
|
|
1104
1252
|
inputSchema: webFetch_20250910InputSchema,
|
|
1105
1253
|
outputSchema: webFetch_20250910OutputSchema,
|
|
1106
1254
|
supportsDeferredResults: true
|
|
1107
1255
|
});
|
|
1108
1256
|
var webFetch_20250910 = (args = {}) => {
|
|
1109
|
-
return
|
|
1257
|
+
return factory5(args);
|
|
1110
1258
|
};
|
|
1111
1259
|
|
|
1112
1260
|
// src/anthropic-prepare-tools.ts
|
|
1113
|
-
var
|
|
1261
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1114
1262
|
async function prepareTools({
|
|
1115
1263
|
tools,
|
|
1116
1264
|
toolChoice,
|
|
@@ -1250,7 +1398,7 @@ async function prepareTools({
|
|
|
1250
1398
|
break;
|
|
1251
1399
|
}
|
|
1252
1400
|
case "anthropic.text_editor_20250728": {
|
|
1253
|
-
const args = await (0,
|
|
1401
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1254
1402
|
value: tool.args,
|
|
1255
1403
|
schema: textEditor_20250728ArgsSchema
|
|
1256
1404
|
});
|
|
@@ -1290,7 +1438,7 @@ async function prepareTools({
|
|
|
1290
1438
|
}
|
|
1291
1439
|
case "anthropic.web_fetch_20250910": {
|
|
1292
1440
|
betas.add("web-fetch-2025-09-10");
|
|
1293
|
-
const args = await (0,
|
|
1441
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1294
1442
|
value: tool.args,
|
|
1295
1443
|
schema: webFetch_20250910ArgsSchema
|
|
1296
1444
|
});
|
|
@@ -1306,8 +1454,26 @@ async function prepareTools({
|
|
|
1306
1454
|
});
|
|
1307
1455
|
break;
|
|
1308
1456
|
}
|
|
1457
|
+
case "anthropic.web_fetch_20260209": {
|
|
1458
|
+
betas.add("code-execution-web-tools-2026-02-09");
|
|
1459
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1460
|
+
value: tool.args,
|
|
1461
|
+
schema: webFetch_20260209ArgsSchema
|
|
1462
|
+
});
|
|
1463
|
+
anthropicTools2.push({
|
|
1464
|
+
type: "web_fetch_20260209",
|
|
1465
|
+
name: "web_fetch",
|
|
1466
|
+
max_uses: args.maxUses,
|
|
1467
|
+
allowed_domains: args.allowedDomains,
|
|
1468
|
+
blocked_domains: args.blockedDomains,
|
|
1469
|
+
citations: args.citations,
|
|
1470
|
+
max_content_tokens: args.maxContentTokens,
|
|
1471
|
+
cache_control: void 0
|
|
1472
|
+
});
|
|
1473
|
+
break;
|
|
1474
|
+
}
|
|
1309
1475
|
case "anthropic.web_search_20250305": {
|
|
1310
|
-
const args = await (0,
|
|
1476
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1311
1477
|
value: tool.args,
|
|
1312
1478
|
schema: webSearch_20250305ArgsSchema
|
|
1313
1479
|
});
|
|
@@ -1322,6 +1488,23 @@ async function prepareTools({
|
|
|
1322
1488
|
});
|
|
1323
1489
|
break;
|
|
1324
1490
|
}
|
|
1491
|
+
case "anthropic.web_search_20260209": {
|
|
1492
|
+
betas.add("code-execution-web-tools-2026-02-09");
|
|
1493
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1494
|
+
value: tool.args,
|
|
1495
|
+
schema: webSearch_20260209ArgsSchema
|
|
1496
|
+
});
|
|
1497
|
+
anthropicTools2.push({
|
|
1498
|
+
type: "web_search_20260209",
|
|
1499
|
+
name: "web_search",
|
|
1500
|
+
max_uses: args.maxUses,
|
|
1501
|
+
allowed_domains: args.allowedDomains,
|
|
1502
|
+
blocked_domains: args.blockedDomains,
|
|
1503
|
+
user_location: args.userLocation,
|
|
1504
|
+
cache_control: void 0
|
|
1505
|
+
});
|
|
1506
|
+
break;
|
|
1507
|
+
}
|
|
1325
1508
|
case "anthropic.tool_search_regex_20251119": {
|
|
1326
1509
|
betas.add("advanced-tool-use-2025-11-20");
|
|
1327
1510
|
anthropicTools2.push({
|
|
@@ -1451,140 +1634,140 @@ function convertAnthropicMessagesUsage({
|
|
|
1451
1634
|
|
|
1452
1635
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1453
1636
|
var import_provider2 = require("@ai-sdk/provider");
|
|
1454
|
-
var
|
|
1637
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
1455
1638
|
|
|
1456
1639
|
// src/tool/code-execution_20250522.ts
|
|
1457
|
-
var
|
|
1458
|
-
var
|
|
1459
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
1460
|
-
() => (0,
|
|
1461
|
-
|
|
1462
|
-
type:
|
|
1463
|
-
stdout:
|
|
1464
|
-
stderr:
|
|
1465
|
-
return_code:
|
|
1466
|
-
content:
|
|
1467
|
-
|
|
1468
|
-
type:
|
|
1469
|
-
file_id:
|
|
1640
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1641
|
+
var import_v49 = require("zod/v4");
|
|
1642
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1643
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1644
|
+
import_v49.z.object({
|
|
1645
|
+
type: import_v49.z.literal("code_execution_result"),
|
|
1646
|
+
stdout: import_v49.z.string(),
|
|
1647
|
+
stderr: import_v49.z.string(),
|
|
1648
|
+
return_code: import_v49.z.number(),
|
|
1649
|
+
content: import_v49.z.array(
|
|
1650
|
+
import_v49.z.object({
|
|
1651
|
+
type: import_v49.z.literal("code_execution_output"),
|
|
1652
|
+
file_id: import_v49.z.string()
|
|
1470
1653
|
})
|
|
1471
1654
|
).optional().default([])
|
|
1472
1655
|
})
|
|
1473
1656
|
)
|
|
1474
1657
|
);
|
|
1475
|
-
var codeExecution_20250522InputSchema = (0,
|
|
1476
|
-
() => (0,
|
|
1477
|
-
|
|
1478
|
-
code:
|
|
1658
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1659
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1660
|
+
import_v49.z.object({
|
|
1661
|
+
code: import_v49.z.string()
|
|
1479
1662
|
})
|
|
1480
1663
|
)
|
|
1481
1664
|
);
|
|
1482
|
-
var
|
|
1665
|
+
var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
|
|
1483
1666
|
id: "anthropic.code_execution_20250522",
|
|
1484
1667
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1485
1668
|
outputSchema: codeExecution_20250522OutputSchema
|
|
1486
1669
|
});
|
|
1487
1670
|
var codeExecution_20250522 = (args = {}) => {
|
|
1488
|
-
return
|
|
1671
|
+
return factory6(args);
|
|
1489
1672
|
};
|
|
1490
1673
|
|
|
1491
1674
|
// src/tool/code-execution_20250825.ts
|
|
1492
|
-
var
|
|
1493
|
-
var
|
|
1494
|
-
var codeExecution_20250825OutputSchema = (0,
|
|
1495
|
-
() => (0,
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
type:
|
|
1499
|
-
stdout:
|
|
1500
|
-
stderr:
|
|
1501
|
-
return_code:
|
|
1502
|
-
content:
|
|
1503
|
-
|
|
1504
|
-
type:
|
|
1505
|
-
file_id:
|
|
1675
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1676
|
+
var import_v410 = require("zod/v4");
|
|
1677
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1678
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
1679
|
+
import_v410.z.discriminatedUnion("type", [
|
|
1680
|
+
import_v410.z.object({
|
|
1681
|
+
type: import_v410.z.literal("code_execution_result"),
|
|
1682
|
+
stdout: import_v410.z.string(),
|
|
1683
|
+
stderr: import_v410.z.string(),
|
|
1684
|
+
return_code: import_v410.z.number(),
|
|
1685
|
+
content: import_v410.z.array(
|
|
1686
|
+
import_v410.z.object({
|
|
1687
|
+
type: import_v410.z.literal("code_execution_output"),
|
|
1688
|
+
file_id: import_v410.z.string()
|
|
1506
1689
|
})
|
|
1507
1690
|
).optional().default([])
|
|
1508
1691
|
}),
|
|
1509
|
-
|
|
1510
|
-
type:
|
|
1511
|
-
content:
|
|
1512
|
-
|
|
1513
|
-
type:
|
|
1514
|
-
file_id:
|
|
1692
|
+
import_v410.z.object({
|
|
1693
|
+
type: import_v410.z.literal("bash_code_execution_result"),
|
|
1694
|
+
content: import_v410.z.array(
|
|
1695
|
+
import_v410.z.object({
|
|
1696
|
+
type: import_v410.z.literal("bash_code_execution_output"),
|
|
1697
|
+
file_id: import_v410.z.string()
|
|
1515
1698
|
})
|
|
1516
1699
|
),
|
|
1517
|
-
stdout:
|
|
1518
|
-
stderr:
|
|
1519
|
-
return_code:
|
|
1700
|
+
stdout: import_v410.z.string(),
|
|
1701
|
+
stderr: import_v410.z.string(),
|
|
1702
|
+
return_code: import_v410.z.number()
|
|
1520
1703
|
}),
|
|
1521
|
-
|
|
1522
|
-
type:
|
|
1523
|
-
error_code:
|
|
1704
|
+
import_v410.z.object({
|
|
1705
|
+
type: import_v410.z.literal("bash_code_execution_tool_result_error"),
|
|
1706
|
+
error_code: import_v410.z.string()
|
|
1524
1707
|
}),
|
|
1525
|
-
|
|
1526
|
-
type:
|
|
1527
|
-
error_code:
|
|
1708
|
+
import_v410.z.object({
|
|
1709
|
+
type: import_v410.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1710
|
+
error_code: import_v410.z.string()
|
|
1528
1711
|
}),
|
|
1529
|
-
|
|
1530
|
-
type:
|
|
1531
|
-
content:
|
|
1532
|
-
file_type:
|
|
1533
|
-
num_lines:
|
|
1534
|
-
start_line:
|
|
1535
|
-
total_lines:
|
|
1712
|
+
import_v410.z.object({
|
|
1713
|
+
type: import_v410.z.literal("text_editor_code_execution_view_result"),
|
|
1714
|
+
content: import_v410.z.string(),
|
|
1715
|
+
file_type: import_v410.z.string(),
|
|
1716
|
+
num_lines: import_v410.z.number().nullable(),
|
|
1717
|
+
start_line: import_v410.z.number().nullable(),
|
|
1718
|
+
total_lines: import_v410.z.number().nullable()
|
|
1536
1719
|
}),
|
|
1537
|
-
|
|
1538
|
-
type:
|
|
1539
|
-
is_file_update:
|
|
1720
|
+
import_v410.z.object({
|
|
1721
|
+
type: import_v410.z.literal("text_editor_code_execution_create_result"),
|
|
1722
|
+
is_file_update: import_v410.z.boolean()
|
|
1540
1723
|
}),
|
|
1541
|
-
|
|
1542
|
-
type:
|
|
1543
|
-
lines:
|
|
1544
|
-
new_lines:
|
|
1545
|
-
new_start:
|
|
1546
|
-
old_lines:
|
|
1547
|
-
old_start:
|
|
1724
|
+
import_v410.z.object({
|
|
1725
|
+
type: import_v410.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1726
|
+
lines: import_v410.z.array(import_v410.z.string()).nullable(),
|
|
1727
|
+
new_lines: import_v410.z.number().nullable(),
|
|
1728
|
+
new_start: import_v410.z.number().nullable(),
|
|
1729
|
+
old_lines: import_v410.z.number().nullable(),
|
|
1730
|
+
old_start: import_v410.z.number().nullable()
|
|
1548
1731
|
})
|
|
1549
1732
|
])
|
|
1550
1733
|
)
|
|
1551
1734
|
);
|
|
1552
|
-
var codeExecution_20250825InputSchema = (0,
|
|
1553
|
-
() => (0,
|
|
1554
|
-
|
|
1735
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1736
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
1737
|
+
import_v410.z.discriminatedUnion("type", [
|
|
1555
1738
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1556
|
-
|
|
1557
|
-
type:
|
|
1558
|
-
code:
|
|
1739
|
+
import_v410.z.object({
|
|
1740
|
+
type: import_v410.z.literal("programmatic-tool-call"),
|
|
1741
|
+
code: import_v410.z.string()
|
|
1559
1742
|
}),
|
|
1560
|
-
|
|
1561
|
-
type:
|
|
1562
|
-
command:
|
|
1743
|
+
import_v410.z.object({
|
|
1744
|
+
type: import_v410.z.literal("bash_code_execution"),
|
|
1745
|
+
command: import_v410.z.string()
|
|
1563
1746
|
}),
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
type:
|
|
1567
|
-
command:
|
|
1568
|
-
path:
|
|
1747
|
+
import_v410.z.discriminatedUnion("command", [
|
|
1748
|
+
import_v410.z.object({
|
|
1749
|
+
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1750
|
+
command: import_v410.z.literal("view"),
|
|
1751
|
+
path: import_v410.z.string()
|
|
1569
1752
|
}),
|
|
1570
|
-
|
|
1571
|
-
type:
|
|
1572
|
-
command:
|
|
1573
|
-
path:
|
|
1574
|
-
file_text:
|
|
1753
|
+
import_v410.z.object({
|
|
1754
|
+
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1755
|
+
command: import_v410.z.literal("create"),
|
|
1756
|
+
path: import_v410.z.string(),
|
|
1757
|
+
file_text: import_v410.z.string().nullish()
|
|
1575
1758
|
}),
|
|
1576
|
-
|
|
1577
|
-
type:
|
|
1578
|
-
command:
|
|
1579
|
-
path:
|
|
1580
|
-
old_str:
|
|
1581
|
-
new_str:
|
|
1759
|
+
import_v410.z.object({
|
|
1760
|
+
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1761
|
+
command: import_v410.z.literal("str_replace"),
|
|
1762
|
+
path: import_v410.z.string(),
|
|
1763
|
+
old_str: import_v410.z.string(),
|
|
1764
|
+
new_str: import_v410.z.string()
|
|
1582
1765
|
})
|
|
1583
1766
|
])
|
|
1584
1767
|
])
|
|
1585
1768
|
)
|
|
1586
1769
|
);
|
|
1587
|
-
var
|
|
1770
|
+
var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
|
|
1588
1771
|
id: "anthropic.code_execution_20250825",
|
|
1589
1772
|
inputSchema: codeExecution_20250825InputSchema,
|
|
1590
1773
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -1594,25 +1777,25 @@ var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSch
|
|
|
1594
1777
|
supportsDeferredResults: true
|
|
1595
1778
|
});
|
|
1596
1779
|
var codeExecution_20250825 = (args = {}) => {
|
|
1597
|
-
return
|
|
1780
|
+
return factory7(args);
|
|
1598
1781
|
};
|
|
1599
1782
|
|
|
1600
1783
|
// src/tool/tool-search-regex_20251119.ts
|
|
1601
|
-
var
|
|
1602
|
-
var
|
|
1603
|
-
var toolSearchRegex_20251119OutputSchema = (0,
|
|
1604
|
-
() => (0,
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
type:
|
|
1608
|
-
toolName:
|
|
1784
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
1785
|
+
var import_v411 = require("zod/v4");
|
|
1786
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils12.lazySchema)(
|
|
1787
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
1788
|
+
import_v411.z.array(
|
|
1789
|
+
import_v411.z.object({
|
|
1790
|
+
type: import_v411.z.literal("tool_reference"),
|
|
1791
|
+
toolName: import_v411.z.string()
|
|
1609
1792
|
})
|
|
1610
1793
|
)
|
|
1611
1794
|
)
|
|
1612
1795
|
);
|
|
1613
|
-
var toolSearchRegex_20251119InputSchema = (0,
|
|
1614
|
-
() => (0,
|
|
1615
|
-
|
|
1796
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
1797
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
1798
|
+
import_v411.z.object({
|
|
1616
1799
|
/**
|
|
1617
1800
|
* A regex pattern to search for tools.
|
|
1618
1801
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -1623,28 +1806,28 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils10.lazySchema
|
|
|
1623
1806
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1624
1807
|
* - "(?i)slack" - case-insensitive search
|
|
1625
1808
|
*/
|
|
1626
|
-
pattern:
|
|
1809
|
+
pattern: import_v411.z.string(),
|
|
1627
1810
|
/**
|
|
1628
1811
|
* Maximum number of tools to return. Optional.
|
|
1629
1812
|
*/
|
|
1630
|
-
limit:
|
|
1813
|
+
limit: import_v411.z.number().optional()
|
|
1631
1814
|
})
|
|
1632
1815
|
)
|
|
1633
1816
|
);
|
|
1634
|
-
var
|
|
1817
|
+
var factory8 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
1635
1818
|
id: "anthropic.tool_search_regex_20251119",
|
|
1636
1819
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
1637
1820
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
1638
1821
|
supportsDeferredResults: true
|
|
1639
1822
|
});
|
|
1640
1823
|
var toolSearchRegex_20251119 = (args = {}) => {
|
|
1641
|
-
return
|
|
1824
|
+
return factory8(args);
|
|
1642
1825
|
};
|
|
1643
1826
|
|
|
1644
1827
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1645
1828
|
function convertToString(data) {
|
|
1646
1829
|
if (typeof data === "string") {
|
|
1647
|
-
return new TextDecoder().decode((0,
|
|
1830
|
+
return new TextDecoder().decode((0, import_provider_utils13.convertBase64ToUint8Array)(data));
|
|
1648
1831
|
}
|
|
1649
1832
|
if (data instanceof Uint8Array) {
|
|
1650
1833
|
return new TextDecoder().decode(data);
|
|
@@ -1682,7 +1865,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1682
1865
|
const messages = [];
|
|
1683
1866
|
async function shouldEnableCitations(providerMetadata) {
|
|
1684
1867
|
var _a2, _b2;
|
|
1685
|
-
const anthropicOptions = await (0,
|
|
1868
|
+
const anthropicOptions = await (0, import_provider_utils13.parseProviderOptions)({
|
|
1686
1869
|
provider: "anthropic",
|
|
1687
1870
|
providerOptions: providerMetadata,
|
|
1688
1871
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1690,7 +1873,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1690
1873
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
1691
1874
|
}
|
|
1692
1875
|
async function getDocumentMetadata(providerMetadata) {
|
|
1693
|
-
const anthropicOptions = await (0,
|
|
1876
|
+
const anthropicOptions = await (0, import_provider_utils13.parseProviderOptions)({
|
|
1694
1877
|
provider: "anthropic",
|
|
1695
1878
|
providerOptions: providerMetadata,
|
|
1696
1879
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1756,7 +1939,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1756
1939
|
} : {
|
|
1757
1940
|
type: "base64",
|
|
1758
1941
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
1759
|
-
data: (0,
|
|
1942
|
+
data: (0, import_provider_utils13.convertToBase64)(part.data)
|
|
1760
1943
|
},
|
|
1761
1944
|
cache_control: cacheControl
|
|
1762
1945
|
});
|
|
@@ -1776,7 +1959,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1776
1959
|
} : {
|
|
1777
1960
|
type: "base64",
|
|
1778
1961
|
media_type: "application/pdf",
|
|
1779
|
-
data: (0,
|
|
1962
|
+
data: (0, import_provider_utils13.convertToBase64)(part.data)
|
|
1780
1963
|
},
|
|
1781
1964
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
1782
1965
|
...metadata.context && { context: metadata.context },
|
|
@@ -1914,7 +2097,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1914
2097
|
return void 0;
|
|
1915
2098
|
}
|
|
1916
2099
|
}
|
|
1917
|
-
}).filter(
|
|
2100
|
+
}).filter(import_provider_utils13.isNonNullable);
|
|
1918
2101
|
break;
|
|
1919
2102
|
case "text":
|
|
1920
2103
|
case "error-text":
|
|
@@ -1990,7 +2173,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1990
2173
|
}
|
|
1991
2174
|
case "reasoning": {
|
|
1992
2175
|
if (sendReasoning) {
|
|
1993
|
-
const reasoningMetadata = await (0,
|
|
2176
|
+
const reasoningMetadata = await (0, import_provider_utils13.parseProviderOptions)({
|
|
1994
2177
|
provider: "anthropic",
|
|
1995
2178
|
providerOptions: part.providerOptions,
|
|
1996
2179
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -2196,7 +2379,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2196
2379
|
break;
|
|
2197
2380
|
}
|
|
2198
2381
|
if (output.value.type === "code_execution_result") {
|
|
2199
|
-
const codeExecutionOutput = await (0,
|
|
2382
|
+
const codeExecutionOutput = await (0, import_provider_utils13.validateTypes)({
|
|
2200
2383
|
value: output.value,
|
|
2201
2384
|
schema: codeExecution_20250522OutputSchema
|
|
2202
2385
|
});
|
|
@@ -2213,7 +2396,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2213
2396
|
cache_control: cacheControl
|
|
2214
2397
|
});
|
|
2215
2398
|
} else {
|
|
2216
|
-
const codeExecutionOutput = await (0,
|
|
2399
|
+
const codeExecutionOutput = await (0, import_provider_utils13.validateTypes)({
|
|
2217
2400
|
value: output.value,
|
|
2218
2401
|
schema: codeExecution_20250825OutputSchema
|
|
2219
2402
|
});
|
|
@@ -2282,7 +2465,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2282
2465
|
});
|
|
2283
2466
|
break;
|
|
2284
2467
|
}
|
|
2285
|
-
const webFetchOutput = await (0,
|
|
2468
|
+
const webFetchOutput = await (0, import_provider_utils13.validateTypes)({
|
|
2286
2469
|
value: output.value,
|
|
2287
2470
|
schema: webFetch_20250910OutputSchema
|
|
2288
2471
|
});
|
|
@@ -2317,7 +2500,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2317
2500
|
});
|
|
2318
2501
|
break;
|
|
2319
2502
|
}
|
|
2320
|
-
const webSearchOutput = await (0,
|
|
2503
|
+
const webSearchOutput = await (0, import_provider_utils13.validateTypes)({
|
|
2321
2504
|
value: output.value,
|
|
2322
2505
|
schema: webSearch_20250305OutputSchema
|
|
2323
2506
|
});
|
|
@@ -2344,7 +2527,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2344
2527
|
});
|
|
2345
2528
|
break;
|
|
2346
2529
|
}
|
|
2347
|
-
const toolSearchOutput = await (0,
|
|
2530
|
+
const toolSearchOutput = await (0, import_provider_utils13.validateTypes)({
|
|
2348
2531
|
value: output.value,
|
|
2349
2532
|
schema: toolSearchRegex_20251119OutputSchema
|
|
2350
2533
|
});
|
|
@@ -2508,7 +2691,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2508
2691
|
var _a;
|
|
2509
2692
|
this.modelId = modelId;
|
|
2510
2693
|
this.config = config;
|
|
2511
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
2694
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils14.generateId;
|
|
2512
2695
|
}
|
|
2513
2696
|
supportsUrl(url) {
|
|
2514
2697
|
return url.protocol === "https:";
|
|
@@ -2582,12 +2765,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2582
2765
|
}
|
|
2583
2766
|
}
|
|
2584
2767
|
const providerOptionsName = this.providerOptionsName;
|
|
2585
|
-
const canonicalOptions = await (0,
|
|
2768
|
+
const canonicalOptions = await (0, import_provider_utils14.parseProviderOptions)({
|
|
2586
2769
|
provider: "anthropic",
|
|
2587
2770
|
providerOptions,
|
|
2588
2771
|
schema: anthropicLanguageModelOptions
|
|
2589
2772
|
});
|
|
2590
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0,
|
|
2773
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils14.parseProviderOptions)({
|
|
2591
2774
|
provider: providerOptionsName,
|
|
2592
2775
|
providerOptions,
|
|
2593
2776
|
schema: anthropicLanguageModelOptions
|
|
@@ -2614,7 +2797,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2614
2797
|
} : void 0;
|
|
2615
2798
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
2616
2799
|
const cacheControlValidator = new CacheControlValidator();
|
|
2617
|
-
const toolNameMapping = (0,
|
|
2800
|
+
const toolNameMapping = (0, import_provider_utils14.createToolNameMapping)({
|
|
2618
2801
|
tools,
|
|
2619
2802
|
providerToolNames: {
|
|
2620
2803
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -2630,7 +2813,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2630
2813
|
"anthropic.bash_20250124": "bash",
|
|
2631
2814
|
"anthropic.memory_20250818": "memory",
|
|
2632
2815
|
"anthropic.web_search_20250305": "web_search",
|
|
2816
|
+
"anthropic.web_search_20260209": "web_search",
|
|
2633
2817
|
"anthropic.web_fetch_20250910": "web_fetch",
|
|
2818
|
+
"anthropic.web_fetch_20260209": "web_fetch",
|
|
2634
2819
|
"anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
|
|
2635
2820
|
"anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
|
|
2636
2821
|
}
|
|
@@ -2895,15 +3080,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2895
3080
|
betas,
|
|
2896
3081
|
headers
|
|
2897
3082
|
}) {
|
|
2898
|
-
return (0,
|
|
2899
|
-
await (0,
|
|
3083
|
+
return (0, import_provider_utils14.combineHeaders)(
|
|
3084
|
+
await (0, import_provider_utils14.resolve)(this.config.headers),
|
|
2900
3085
|
headers,
|
|
2901
3086
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
2902
3087
|
);
|
|
2903
3088
|
}
|
|
2904
3089
|
async getBetasFromHeaders(requestHeaders) {
|
|
2905
3090
|
var _a, _b;
|
|
2906
|
-
const configHeaders = await (0,
|
|
3091
|
+
const configHeaders = await (0, import_provider_utils14.resolve)(this.config.headers);
|
|
2907
3092
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
2908
3093
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
2909
3094
|
return new Set(
|
|
@@ -2962,16 +3147,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2962
3147
|
const citationDocuments = [
|
|
2963
3148
|
...this.extractCitationDocuments(options.prompt)
|
|
2964
3149
|
];
|
|
3150
|
+
const markCodeExecutionDynamic = hasWebTool20260209WithoutCodeExecution(
|
|
3151
|
+
args.tools
|
|
3152
|
+
);
|
|
2965
3153
|
const {
|
|
2966
3154
|
responseHeaders,
|
|
2967
3155
|
value: response,
|
|
2968
3156
|
rawValue: rawResponse
|
|
2969
|
-
} = await (0,
|
|
3157
|
+
} = await (0, import_provider_utils14.postJsonToApi)({
|
|
2970
3158
|
url: this.buildRequestUrl(false),
|
|
2971
3159
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
2972
3160
|
body: this.transformRequestBody(args),
|
|
2973
3161
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
2974
|
-
successfulResponseHandler: (0,
|
|
3162
|
+
successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
|
|
2975
3163
|
anthropicMessagesResponseSchema
|
|
2976
3164
|
),
|
|
2977
3165
|
abortSignal: options.abortSignal,
|
|
@@ -3083,7 +3271,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3083
3271
|
toolCallId: part.id,
|
|
3084
3272
|
toolName: toolNameMapping.toCustomToolName(part.name),
|
|
3085
3273
|
input: JSON.stringify(inputToSerialize),
|
|
3086
|
-
providerExecuted: true
|
|
3274
|
+
providerExecuted: true,
|
|
3275
|
+
// We want this 'code_execution' tool call to be allowed even if the tool is not explicitly provided.
|
|
3276
|
+
// Since the validation generally bypasses dynamic tools, we mark this specific tool as dynamic.
|
|
3277
|
+
...markCodeExecutionDynamic && part.name === "code_execution" ? { dynamic: true } : {}
|
|
3087
3278
|
});
|
|
3088
3279
|
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
3089
3280
|
serverToolCalls[part.id] = part.name;
|
|
@@ -3366,13 +3557,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3366
3557
|
const citationDocuments = [
|
|
3367
3558
|
...this.extractCitationDocuments(options.prompt)
|
|
3368
3559
|
];
|
|
3560
|
+
const markCodeExecutionDynamic = hasWebTool20260209WithoutCodeExecution(
|
|
3561
|
+
body.tools
|
|
3562
|
+
);
|
|
3369
3563
|
const url = this.buildRequestUrl(true);
|
|
3370
|
-
const { responseHeaders, value: response } = await (0,
|
|
3564
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils14.postJsonToApi)({
|
|
3371
3565
|
url,
|
|
3372
3566
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3373
3567
|
body: this.transformRequestBody(body),
|
|
3374
3568
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3375
|
-
successfulResponseHandler: (0,
|
|
3569
|
+
successfulResponseHandler: (0, import_provider_utils14.createEventSourceResponseHandler)(
|
|
3376
3570
|
anthropicMessagesChunkSchema
|
|
3377
3571
|
),
|
|
3378
3572
|
abortSignal: options.abortSignal,
|
|
@@ -3515,12 +3709,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3515
3709
|
].includes(part.name)) {
|
|
3516
3710
|
const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
|
|
3517
3711
|
const customToolName = toolNameMapping.toCustomToolName(providerToolName);
|
|
3712
|
+
const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
|
|
3518
3713
|
contentBlocks[value.index] = {
|
|
3519
3714
|
type: "tool-call",
|
|
3520
3715
|
toolCallId: part.id,
|
|
3521
3716
|
toolName: customToolName,
|
|
3522
|
-
input:
|
|
3717
|
+
input: finalInput,
|
|
3523
3718
|
providerExecuted: true,
|
|
3719
|
+
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
3524
3720
|
firstDelta: true,
|
|
3525
3721
|
providerToolName: part.name
|
|
3526
3722
|
};
|
|
@@ -3528,7 +3724,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3528
3724
|
type: "tool-input-start",
|
|
3529
3725
|
id: part.id,
|
|
3530
3726
|
toolName: customToolName,
|
|
3531
|
-
providerExecuted: true
|
|
3727
|
+
providerExecuted: true,
|
|
3728
|
+
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {}
|
|
3532
3729
|
});
|
|
3533
3730
|
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
3534
3731
|
serverToolCalls[part.id] = part.name;
|
|
@@ -3802,6 +3999,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3802
3999
|
toolName: contentBlock.toolName,
|
|
3803
4000
|
input: finalInput,
|
|
3804
4001
|
providerExecuted: contentBlock.providerExecuted,
|
|
4002
|
+
...markCodeExecutionDynamic && contentBlock.providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
3805
4003
|
...contentBlock.caller && {
|
|
3806
4004
|
providerMetadata: {
|
|
3807
4005
|
anthropic: {
|
|
@@ -4147,6 +4345,24 @@ function getModelCapabilities(modelId) {
|
|
|
4147
4345
|
};
|
|
4148
4346
|
}
|
|
4149
4347
|
}
|
|
4348
|
+
function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
4349
|
+
if (!tools) {
|
|
4350
|
+
return false;
|
|
4351
|
+
}
|
|
4352
|
+
let hasWebTool20260209 = false;
|
|
4353
|
+
let hasCodeExecutionTool = false;
|
|
4354
|
+
for (const tool of tools) {
|
|
4355
|
+
if ("type" in tool && (tool.type === "web_fetch_20260209" || tool.type === "web_search_20260209")) {
|
|
4356
|
+
hasWebTool20260209 = true;
|
|
4357
|
+
continue;
|
|
4358
|
+
}
|
|
4359
|
+
if (tool.name === "code_execution") {
|
|
4360
|
+
hasCodeExecutionTool = true;
|
|
4361
|
+
break;
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
return hasWebTool20260209 && !hasCodeExecutionTool;
|
|
4365
|
+
}
|
|
4150
4366
|
function mapAnthropicResponseContextManagement(contextManagement) {
|
|
4151
4367
|
return contextManagement ? {
|
|
4152
4368
|
appliedEdits: contextManagement.applied_edits.map((edit) => {
|
|
@@ -4174,149 +4390,149 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4174
4390
|
}
|
|
4175
4391
|
|
|
4176
4392
|
// src/tool/bash_20241022.ts
|
|
4177
|
-
var
|
|
4178
|
-
var
|
|
4179
|
-
var bash_20241022InputSchema = (0,
|
|
4180
|
-
() => (0,
|
|
4181
|
-
|
|
4182
|
-
command:
|
|
4183
|
-
restart:
|
|
4393
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
4394
|
+
var import_v412 = require("zod/v4");
|
|
4395
|
+
var bash_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4396
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
4397
|
+
import_v412.z.object({
|
|
4398
|
+
command: import_v412.z.string(),
|
|
4399
|
+
restart: import_v412.z.boolean().optional()
|
|
4184
4400
|
})
|
|
4185
4401
|
)
|
|
4186
4402
|
);
|
|
4187
|
-
var bash_20241022 = (0,
|
|
4403
|
+
var bash_20241022 = (0, import_provider_utils15.createProviderToolFactory)({
|
|
4188
4404
|
id: "anthropic.bash_20241022",
|
|
4189
4405
|
inputSchema: bash_20241022InputSchema
|
|
4190
4406
|
});
|
|
4191
4407
|
|
|
4192
4408
|
// src/tool/bash_20250124.ts
|
|
4193
|
-
var
|
|
4194
|
-
var
|
|
4195
|
-
var bash_20250124InputSchema = (0,
|
|
4196
|
-
() => (0,
|
|
4197
|
-
|
|
4198
|
-
command:
|
|
4199
|
-
restart:
|
|
4409
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
4410
|
+
var import_v413 = require("zod/v4");
|
|
4411
|
+
var bash_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
4412
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
4413
|
+
import_v413.z.object({
|
|
4414
|
+
command: import_v413.z.string(),
|
|
4415
|
+
restart: import_v413.z.boolean().optional()
|
|
4200
4416
|
})
|
|
4201
4417
|
)
|
|
4202
4418
|
);
|
|
4203
|
-
var bash_20250124 = (0,
|
|
4419
|
+
var bash_20250124 = (0, import_provider_utils16.createProviderToolFactory)({
|
|
4204
4420
|
id: "anthropic.bash_20250124",
|
|
4205
4421
|
inputSchema: bash_20250124InputSchema
|
|
4206
4422
|
});
|
|
4207
4423
|
|
|
4208
4424
|
// src/tool/code-execution_20260120.ts
|
|
4209
|
-
var
|
|
4210
|
-
var
|
|
4211
|
-
var codeExecution_20260120OutputSchema = (0,
|
|
4212
|
-
() => (0,
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
type:
|
|
4216
|
-
stdout:
|
|
4217
|
-
stderr:
|
|
4218
|
-
return_code:
|
|
4219
|
-
content:
|
|
4220
|
-
|
|
4221
|
-
type:
|
|
4222
|
-
file_id:
|
|
4425
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4426
|
+
var import_v414 = require("zod/v4");
|
|
4427
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4428
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
4429
|
+
import_v414.z.discriminatedUnion("type", [
|
|
4430
|
+
import_v414.z.object({
|
|
4431
|
+
type: import_v414.z.literal("code_execution_result"),
|
|
4432
|
+
stdout: import_v414.z.string(),
|
|
4433
|
+
stderr: import_v414.z.string(),
|
|
4434
|
+
return_code: import_v414.z.number(),
|
|
4435
|
+
content: import_v414.z.array(
|
|
4436
|
+
import_v414.z.object({
|
|
4437
|
+
type: import_v414.z.literal("code_execution_output"),
|
|
4438
|
+
file_id: import_v414.z.string()
|
|
4223
4439
|
})
|
|
4224
4440
|
).optional().default([])
|
|
4225
4441
|
}),
|
|
4226
|
-
|
|
4227
|
-
type:
|
|
4228
|
-
content:
|
|
4229
|
-
|
|
4230
|
-
type:
|
|
4231
|
-
file_id:
|
|
4442
|
+
import_v414.z.object({
|
|
4443
|
+
type: import_v414.z.literal("bash_code_execution_result"),
|
|
4444
|
+
content: import_v414.z.array(
|
|
4445
|
+
import_v414.z.object({
|
|
4446
|
+
type: import_v414.z.literal("bash_code_execution_output"),
|
|
4447
|
+
file_id: import_v414.z.string()
|
|
4232
4448
|
})
|
|
4233
4449
|
),
|
|
4234
|
-
stdout:
|
|
4235
|
-
stderr:
|
|
4236
|
-
return_code:
|
|
4450
|
+
stdout: import_v414.z.string(),
|
|
4451
|
+
stderr: import_v414.z.string(),
|
|
4452
|
+
return_code: import_v414.z.number()
|
|
4237
4453
|
}),
|
|
4238
|
-
|
|
4239
|
-
type:
|
|
4240
|
-
error_code:
|
|
4454
|
+
import_v414.z.object({
|
|
4455
|
+
type: import_v414.z.literal("bash_code_execution_tool_result_error"),
|
|
4456
|
+
error_code: import_v414.z.string()
|
|
4241
4457
|
}),
|
|
4242
|
-
|
|
4243
|
-
type:
|
|
4244
|
-
error_code:
|
|
4458
|
+
import_v414.z.object({
|
|
4459
|
+
type: import_v414.z.literal("text_editor_code_execution_tool_result_error"),
|
|
4460
|
+
error_code: import_v414.z.string()
|
|
4245
4461
|
}),
|
|
4246
|
-
|
|
4247
|
-
type:
|
|
4248
|
-
content:
|
|
4249
|
-
file_type:
|
|
4250
|
-
num_lines:
|
|
4251
|
-
start_line:
|
|
4252
|
-
total_lines:
|
|
4462
|
+
import_v414.z.object({
|
|
4463
|
+
type: import_v414.z.literal("text_editor_code_execution_view_result"),
|
|
4464
|
+
content: import_v414.z.string(),
|
|
4465
|
+
file_type: import_v414.z.string(),
|
|
4466
|
+
num_lines: import_v414.z.number().nullable(),
|
|
4467
|
+
start_line: import_v414.z.number().nullable(),
|
|
4468
|
+
total_lines: import_v414.z.number().nullable()
|
|
4253
4469
|
}),
|
|
4254
|
-
|
|
4255
|
-
type:
|
|
4256
|
-
is_file_update:
|
|
4470
|
+
import_v414.z.object({
|
|
4471
|
+
type: import_v414.z.literal("text_editor_code_execution_create_result"),
|
|
4472
|
+
is_file_update: import_v414.z.boolean()
|
|
4257
4473
|
}),
|
|
4258
|
-
|
|
4259
|
-
type:
|
|
4260
|
-
lines:
|
|
4261
|
-
new_lines:
|
|
4262
|
-
new_start:
|
|
4263
|
-
old_lines:
|
|
4264
|
-
old_start:
|
|
4474
|
+
import_v414.z.object({
|
|
4475
|
+
type: import_v414.z.literal("text_editor_code_execution_str_replace_result"),
|
|
4476
|
+
lines: import_v414.z.array(import_v414.z.string()).nullable(),
|
|
4477
|
+
new_lines: import_v414.z.number().nullable(),
|
|
4478
|
+
new_start: import_v414.z.number().nullable(),
|
|
4479
|
+
old_lines: import_v414.z.number().nullable(),
|
|
4480
|
+
old_start: import_v414.z.number().nullable()
|
|
4265
4481
|
})
|
|
4266
4482
|
])
|
|
4267
4483
|
)
|
|
4268
4484
|
);
|
|
4269
|
-
var codeExecution_20260120InputSchema = (0,
|
|
4270
|
-
() => (0,
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
type:
|
|
4274
|
-
code:
|
|
4485
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4486
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
4487
|
+
import_v414.z.discriminatedUnion("type", [
|
|
4488
|
+
import_v414.z.object({
|
|
4489
|
+
type: import_v414.z.literal("programmatic-tool-call"),
|
|
4490
|
+
code: import_v414.z.string()
|
|
4275
4491
|
}),
|
|
4276
|
-
|
|
4277
|
-
type:
|
|
4278
|
-
command:
|
|
4492
|
+
import_v414.z.object({
|
|
4493
|
+
type: import_v414.z.literal("bash_code_execution"),
|
|
4494
|
+
command: import_v414.z.string()
|
|
4279
4495
|
}),
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
type:
|
|
4283
|
-
command:
|
|
4284
|
-
path:
|
|
4496
|
+
import_v414.z.discriminatedUnion("command", [
|
|
4497
|
+
import_v414.z.object({
|
|
4498
|
+
type: import_v414.z.literal("text_editor_code_execution"),
|
|
4499
|
+
command: import_v414.z.literal("view"),
|
|
4500
|
+
path: import_v414.z.string()
|
|
4285
4501
|
}),
|
|
4286
|
-
|
|
4287
|
-
type:
|
|
4288
|
-
command:
|
|
4289
|
-
path:
|
|
4290
|
-
file_text:
|
|
4502
|
+
import_v414.z.object({
|
|
4503
|
+
type: import_v414.z.literal("text_editor_code_execution"),
|
|
4504
|
+
command: import_v414.z.literal("create"),
|
|
4505
|
+
path: import_v414.z.string(),
|
|
4506
|
+
file_text: import_v414.z.string().nullish()
|
|
4291
4507
|
}),
|
|
4292
|
-
|
|
4293
|
-
type:
|
|
4294
|
-
command:
|
|
4295
|
-
path:
|
|
4296
|
-
old_str:
|
|
4297
|
-
new_str:
|
|
4508
|
+
import_v414.z.object({
|
|
4509
|
+
type: import_v414.z.literal("text_editor_code_execution"),
|
|
4510
|
+
command: import_v414.z.literal("str_replace"),
|
|
4511
|
+
path: import_v414.z.string(),
|
|
4512
|
+
old_str: import_v414.z.string(),
|
|
4513
|
+
new_str: import_v414.z.string()
|
|
4298
4514
|
})
|
|
4299
4515
|
])
|
|
4300
4516
|
])
|
|
4301
4517
|
)
|
|
4302
4518
|
);
|
|
4303
|
-
var
|
|
4519
|
+
var factory9 = (0, import_provider_utils17.createProviderToolFactoryWithOutputSchema)({
|
|
4304
4520
|
id: "anthropic.code_execution_20260120",
|
|
4305
4521
|
inputSchema: codeExecution_20260120InputSchema,
|
|
4306
4522
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
4307
4523
|
supportsDeferredResults: true
|
|
4308
4524
|
});
|
|
4309
4525
|
var codeExecution_20260120 = (args = {}) => {
|
|
4310
|
-
return
|
|
4526
|
+
return factory9(args);
|
|
4311
4527
|
};
|
|
4312
4528
|
|
|
4313
4529
|
// src/tool/computer_20241022.ts
|
|
4314
|
-
var
|
|
4315
|
-
var
|
|
4316
|
-
var computer_20241022InputSchema = (0,
|
|
4317
|
-
() => (0,
|
|
4318
|
-
|
|
4319
|
-
action:
|
|
4530
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
4531
|
+
var import_v415 = require("zod/v4");
|
|
4532
|
+
var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
4533
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
4534
|
+
import_v415.z.object({
|
|
4535
|
+
action: import_v415.z.enum([
|
|
4320
4536
|
"key",
|
|
4321
4537
|
"type",
|
|
4322
4538
|
"mouse_move",
|
|
@@ -4328,23 +4544,23 @@ var computer_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
|
4328
4544
|
"screenshot",
|
|
4329
4545
|
"cursor_position"
|
|
4330
4546
|
]),
|
|
4331
|
-
coordinate:
|
|
4332
|
-
text:
|
|
4547
|
+
coordinate: import_v415.z.array(import_v415.z.number().int()).optional(),
|
|
4548
|
+
text: import_v415.z.string().optional()
|
|
4333
4549
|
})
|
|
4334
4550
|
)
|
|
4335
4551
|
);
|
|
4336
|
-
var computer_20241022 = (0,
|
|
4552
|
+
var computer_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
4337
4553
|
id: "anthropic.computer_20241022",
|
|
4338
4554
|
inputSchema: computer_20241022InputSchema
|
|
4339
4555
|
});
|
|
4340
4556
|
|
|
4341
4557
|
// src/tool/computer_20250124.ts
|
|
4342
|
-
var
|
|
4343
|
-
var
|
|
4344
|
-
var computer_20250124InputSchema = (0,
|
|
4345
|
-
() => (0,
|
|
4346
|
-
|
|
4347
|
-
action:
|
|
4558
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4559
|
+
var import_v416 = require("zod/v4");
|
|
4560
|
+
var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4561
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
4562
|
+
import_v416.z.object({
|
|
4563
|
+
action: import_v416.z.enum([
|
|
4348
4564
|
"key",
|
|
4349
4565
|
"hold_key",
|
|
4350
4566
|
"type",
|
|
@@ -4362,27 +4578,27 @@ var computer_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
4362
4578
|
"wait",
|
|
4363
4579
|
"screenshot"
|
|
4364
4580
|
]),
|
|
4365
|
-
coordinate:
|
|
4366
|
-
duration:
|
|
4367
|
-
scroll_amount:
|
|
4368
|
-
scroll_direction:
|
|
4369
|
-
start_coordinate:
|
|
4370
|
-
text:
|
|
4581
|
+
coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
|
|
4582
|
+
duration: import_v416.z.number().optional(),
|
|
4583
|
+
scroll_amount: import_v416.z.number().optional(),
|
|
4584
|
+
scroll_direction: import_v416.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4585
|
+
start_coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
|
|
4586
|
+
text: import_v416.z.string().optional()
|
|
4371
4587
|
})
|
|
4372
4588
|
)
|
|
4373
4589
|
);
|
|
4374
|
-
var computer_20250124 = (0,
|
|
4590
|
+
var computer_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
4375
4591
|
id: "anthropic.computer_20250124",
|
|
4376
4592
|
inputSchema: computer_20250124InputSchema
|
|
4377
4593
|
});
|
|
4378
4594
|
|
|
4379
4595
|
// src/tool/computer_20251124.ts
|
|
4380
|
-
var
|
|
4381
|
-
var
|
|
4382
|
-
var computer_20251124InputSchema = (0,
|
|
4383
|
-
() => (0,
|
|
4384
|
-
|
|
4385
|
-
action:
|
|
4596
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
4597
|
+
var import_v417 = require("zod/v4");
|
|
4598
|
+
var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
4599
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
4600
|
+
import_v417.z.object({
|
|
4601
|
+
action: import_v417.z.enum([
|
|
4386
4602
|
"key",
|
|
4387
4603
|
"hold_key",
|
|
4388
4604
|
"type",
|
|
@@ -4401,173 +4617,173 @@ var computer_20251124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
4401
4617
|
"screenshot",
|
|
4402
4618
|
"zoom"
|
|
4403
4619
|
]),
|
|
4404
|
-
coordinate:
|
|
4405
|
-
duration:
|
|
4406
|
-
region:
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4620
|
+
coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
|
|
4621
|
+
duration: import_v417.z.number().optional(),
|
|
4622
|
+
region: import_v417.z.tuple([
|
|
4623
|
+
import_v417.z.number().int(),
|
|
4624
|
+
import_v417.z.number().int(),
|
|
4625
|
+
import_v417.z.number().int(),
|
|
4626
|
+
import_v417.z.number().int()
|
|
4411
4627
|
]).optional(),
|
|
4412
|
-
scroll_amount:
|
|
4413
|
-
scroll_direction:
|
|
4414
|
-
start_coordinate:
|
|
4415
|
-
text:
|
|
4628
|
+
scroll_amount: import_v417.z.number().optional(),
|
|
4629
|
+
scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4630
|
+
start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
|
|
4631
|
+
text: import_v417.z.string().optional()
|
|
4416
4632
|
})
|
|
4417
4633
|
)
|
|
4418
4634
|
);
|
|
4419
|
-
var computer_20251124 = (0,
|
|
4635
|
+
var computer_20251124 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
4420
4636
|
id: "anthropic.computer_20251124",
|
|
4421
4637
|
inputSchema: computer_20251124InputSchema
|
|
4422
4638
|
});
|
|
4423
4639
|
|
|
4424
4640
|
// src/tool/memory_20250818.ts
|
|
4425
|
-
var
|
|
4426
|
-
var
|
|
4427
|
-
var memory_20250818InputSchema = (0,
|
|
4428
|
-
() => (0,
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
command:
|
|
4432
|
-
path:
|
|
4433
|
-
view_range:
|
|
4641
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
4642
|
+
var import_v418 = require("zod/v4");
|
|
4643
|
+
var memory_20250818InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
4644
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
4645
|
+
import_v418.z.discriminatedUnion("command", [
|
|
4646
|
+
import_v418.z.object({
|
|
4647
|
+
command: import_v418.z.literal("view"),
|
|
4648
|
+
path: import_v418.z.string(),
|
|
4649
|
+
view_range: import_v418.z.tuple([import_v418.z.number(), import_v418.z.number()]).optional()
|
|
4434
4650
|
}),
|
|
4435
|
-
|
|
4436
|
-
command:
|
|
4437
|
-
path:
|
|
4438
|
-
file_text:
|
|
4651
|
+
import_v418.z.object({
|
|
4652
|
+
command: import_v418.z.literal("create"),
|
|
4653
|
+
path: import_v418.z.string(),
|
|
4654
|
+
file_text: import_v418.z.string()
|
|
4439
4655
|
}),
|
|
4440
|
-
|
|
4441
|
-
command:
|
|
4442
|
-
path:
|
|
4443
|
-
old_str:
|
|
4444
|
-
new_str:
|
|
4656
|
+
import_v418.z.object({
|
|
4657
|
+
command: import_v418.z.literal("str_replace"),
|
|
4658
|
+
path: import_v418.z.string(),
|
|
4659
|
+
old_str: import_v418.z.string(),
|
|
4660
|
+
new_str: import_v418.z.string()
|
|
4445
4661
|
}),
|
|
4446
|
-
|
|
4447
|
-
command:
|
|
4448
|
-
path:
|
|
4449
|
-
insert_line:
|
|
4450
|
-
insert_text:
|
|
4662
|
+
import_v418.z.object({
|
|
4663
|
+
command: import_v418.z.literal("insert"),
|
|
4664
|
+
path: import_v418.z.string(),
|
|
4665
|
+
insert_line: import_v418.z.number(),
|
|
4666
|
+
insert_text: import_v418.z.string()
|
|
4451
4667
|
}),
|
|
4452
|
-
|
|
4453
|
-
command:
|
|
4454
|
-
path:
|
|
4668
|
+
import_v418.z.object({
|
|
4669
|
+
command: import_v418.z.literal("delete"),
|
|
4670
|
+
path: import_v418.z.string()
|
|
4455
4671
|
}),
|
|
4456
|
-
|
|
4457
|
-
command:
|
|
4458
|
-
old_path:
|
|
4459
|
-
new_path:
|
|
4672
|
+
import_v418.z.object({
|
|
4673
|
+
command: import_v418.z.literal("rename"),
|
|
4674
|
+
old_path: import_v418.z.string(),
|
|
4675
|
+
new_path: import_v418.z.string()
|
|
4460
4676
|
})
|
|
4461
4677
|
])
|
|
4462
4678
|
)
|
|
4463
4679
|
);
|
|
4464
|
-
var memory_20250818 = (0,
|
|
4680
|
+
var memory_20250818 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
4465
4681
|
id: "anthropic.memory_20250818",
|
|
4466
4682
|
inputSchema: memory_20250818InputSchema
|
|
4467
4683
|
});
|
|
4468
4684
|
|
|
4469
4685
|
// src/tool/text-editor_20241022.ts
|
|
4470
|
-
var
|
|
4471
|
-
var
|
|
4472
|
-
var textEditor_20241022InputSchema = (0,
|
|
4473
|
-
() => (0,
|
|
4474
|
-
|
|
4475
|
-
command:
|
|
4476
|
-
path:
|
|
4477
|
-
file_text:
|
|
4478
|
-
insert_line:
|
|
4479
|
-
new_str:
|
|
4480
|
-
insert_text:
|
|
4481
|
-
old_str:
|
|
4482
|
-
view_range:
|
|
4686
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
4687
|
+
var import_v419 = require("zod/v4");
|
|
4688
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
4689
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
4690
|
+
import_v419.z.object({
|
|
4691
|
+
command: import_v419.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4692
|
+
path: import_v419.z.string(),
|
|
4693
|
+
file_text: import_v419.z.string().optional(),
|
|
4694
|
+
insert_line: import_v419.z.number().int().optional(),
|
|
4695
|
+
new_str: import_v419.z.string().optional(),
|
|
4696
|
+
insert_text: import_v419.z.string().optional(),
|
|
4697
|
+
old_str: import_v419.z.string().optional(),
|
|
4698
|
+
view_range: import_v419.z.array(import_v419.z.number().int()).optional()
|
|
4483
4699
|
})
|
|
4484
4700
|
)
|
|
4485
4701
|
);
|
|
4486
|
-
var textEditor_20241022 = (0,
|
|
4702
|
+
var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
4487
4703
|
id: "anthropic.text_editor_20241022",
|
|
4488
4704
|
inputSchema: textEditor_20241022InputSchema
|
|
4489
4705
|
});
|
|
4490
4706
|
|
|
4491
4707
|
// src/tool/text-editor_20250124.ts
|
|
4492
|
-
var
|
|
4493
|
-
var
|
|
4494
|
-
var textEditor_20250124InputSchema = (0,
|
|
4495
|
-
() => (0,
|
|
4496
|
-
|
|
4497
|
-
command:
|
|
4498
|
-
path:
|
|
4499
|
-
file_text:
|
|
4500
|
-
insert_line:
|
|
4501
|
-
new_str:
|
|
4502
|
-
insert_text:
|
|
4503
|
-
old_str:
|
|
4504
|
-
view_range:
|
|
4708
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
4709
|
+
var import_v420 = require("zod/v4");
|
|
4710
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
4711
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
4712
|
+
import_v420.z.object({
|
|
4713
|
+
command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4714
|
+
path: import_v420.z.string(),
|
|
4715
|
+
file_text: import_v420.z.string().optional(),
|
|
4716
|
+
insert_line: import_v420.z.number().int().optional(),
|
|
4717
|
+
new_str: import_v420.z.string().optional(),
|
|
4718
|
+
insert_text: import_v420.z.string().optional(),
|
|
4719
|
+
old_str: import_v420.z.string().optional(),
|
|
4720
|
+
view_range: import_v420.z.array(import_v420.z.number().int()).optional()
|
|
4505
4721
|
})
|
|
4506
4722
|
)
|
|
4507
4723
|
);
|
|
4508
|
-
var textEditor_20250124 = (0,
|
|
4724
|
+
var textEditor_20250124 = (0, import_provider_utils23.createProviderToolFactory)({
|
|
4509
4725
|
id: "anthropic.text_editor_20250124",
|
|
4510
4726
|
inputSchema: textEditor_20250124InputSchema
|
|
4511
4727
|
});
|
|
4512
4728
|
|
|
4513
4729
|
// src/tool/text-editor_20250429.ts
|
|
4514
|
-
var
|
|
4515
|
-
var
|
|
4516
|
-
var textEditor_20250429InputSchema = (0,
|
|
4517
|
-
() => (0,
|
|
4518
|
-
|
|
4519
|
-
command:
|
|
4520
|
-
path:
|
|
4521
|
-
file_text:
|
|
4522
|
-
insert_line:
|
|
4523
|
-
new_str:
|
|
4524
|
-
insert_text:
|
|
4525
|
-
old_str:
|
|
4526
|
-
view_range:
|
|
4730
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
4731
|
+
var import_v421 = require("zod/v4");
|
|
4732
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
4733
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
4734
|
+
import_v421.z.object({
|
|
4735
|
+
command: import_v421.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4736
|
+
path: import_v421.z.string(),
|
|
4737
|
+
file_text: import_v421.z.string().optional(),
|
|
4738
|
+
insert_line: import_v421.z.number().int().optional(),
|
|
4739
|
+
new_str: import_v421.z.string().optional(),
|
|
4740
|
+
insert_text: import_v421.z.string().optional(),
|
|
4741
|
+
old_str: import_v421.z.string().optional(),
|
|
4742
|
+
view_range: import_v421.z.array(import_v421.z.number().int()).optional()
|
|
4527
4743
|
})
|
|
4528
4744
|
)
|
|
4529
4745
|
);
|
|
4530
|
-
var textEditor_20250429 = (0,
|
|
4746
|
+
var textEditor_20250429 = (0, import_provider_utils24.createProviderToolFactory)({
|
|
4531
4747
|
id: "anthropic.text_editor_20250429",
|
|
4532
4748
|
inputSchema: textEditor_20250429InputSchema
|
|
4533
4749
|
});
|
|
4534
4750
|
|
|
4535
4751
|
// src/tool/tool-search-bm25_20251119.ts
|
|
4536
|
-
var
|
|
4537
|
-
var
|
|
4538
|
-
var toolSearchBm25_20251119OutputSchema = (0,
|
|
4539
|
-
() => (0,
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
type:
|
|
4543
|
-
toolName:
|
|
4752
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
4753
|
+
var import_v422 = require("zod/v4");
|
|
4754
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
4755
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
4756
|
+
import_v422.z.array(
|
|
4757
|
+
import_v422.z.object({
|
|
4758
|
+
type: import_v422.z.literal("tool_reference"),
|
|
4759
|
+
toolName: import_v422.z.string()
|
|
4544
4760
|
})
|
|
4545
4761
|
)
|
|
4546
4762
|
)
|
|
4547
4763
|
);
|
|
4548
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
4549
|
-
() => (0,
|
|
4550
|
-
|
|
4764
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
4765
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
4766
|
+
import_v422.z.object({
|
|
4551
4767
|
/**
|
|
4552
4768
|
* A natural language query to search for tools.
|
|
4553
4769
|
* Claude will use BM25 text search to find relevant tools.
|
|
4554
4770
|
*/
|
|
4555
|
-
query:
|
|
4771
|
+
query: import_v422.z.string(),
|
|
4556
4772
|
/**
|
|
4557
4773
|
* Maximum number of tools to return. Optional.
|
|
4558
4774
|
*/
|
|
4559
|
-
limit:
|
|
4775
|
+
limit: import_v422.z.number().optional()
|
|
4560
4776
|
})
|
|
4561
4777
|
)
|
|
4562
4778
|
);
|
|
4563
|
-
var
|
|
4779
|
+
var factory10 = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
|
|
4564
4780
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4565
4781
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4566
4782
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
4567
4783
|
supportsDeferredResults: true
|
|
4568
4784
|
});
|
|
4569
4785
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
4570
|
-
return
|
|
4786
|
+
return factory10(args);
|
|
4571
4787
|
};
|
|
4572
4788
|
|
|
4573
4789
|
// src/anthropic-tools.ts
|
|
@@ -4714,6 +4930,16 @@ var anthropicTools = {
|
|
|
4714
4930
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
4715
4931
|
*/
|
|
4716
4932
|
webFetch_20250910,
|
|
4933
|
+
/**
|
|
4934
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
4935
|
+
*
|
|
4936
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
4937
|
+
* @param allowedDomains - Only fetch from these domains
|
|
4938
|
+
* @param blockedDomains - Never fetch from these domains
|
|
4939
|
+
* @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
|
|
4940
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
4941
|
+
*/
|
|
4942
|
+
webFetch_20260209,
|
|
4717
4943
|
/**
|
|
4718
4944
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
4719
4945
|
*
|
|
@@ -4723,6 +4949,15 @@ var anthropicTools = {
|
|
|
4723
4949
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
4724
4950
|
*/
|
|
4725
4951
|
webSearch_20250305,
|
|
4952
|
+
/**
|
|
4953
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
4954
|
+
*
|
|
4955
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
4956
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
4957
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
4958
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
4959
|
+
*/
|
|
4960
|
+
webSearch_20260209,
|
|
4726
4961
|
/**
|
|
4727
4962
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
4728
4963
|
*
|
|
@@ -4756,8 +4991,8 @@ var anthropicTools = {
|
|
|
4756
4991
|
// src/anthropic-provider.ts
|
|
4757
4992
|
function createAnthropic(options = {}) {
|
|
4758
4993
|
var _a, _b;
|
|
4759
|
-
const baseURL = (_a = (0,
|
|
4760
|
-
(0,
|
|
4994
|
+
const baseURL = (_a = (0, import_provider_utils26.withoutTrailingSlash)(
|
|
4995
|
+
(0, import_provider_utils26.loadOptionalSetting)({
|
|
4761
4996
|
settingValue: options.baseURL,
|
|
4762
4997
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
4763
4998
|
})
|
|
@@ -4771,13 +5006,13 @@ function createAnthropic(options = {}) {
|
|
|
4771
5006
|
}
|
|
4772
5007
|
const getHeaders = () => {
|
|
4773
5008
|
const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
|
|
4774
|
-
"x-api-key": (0,
|
|
5009
|
+
"x-api-key": (0, import_provider_utils26.loadApiKey)({
|
|
4775
5010
|
apiKey: options.apiKey,
|
|
4776
5011
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
4777
5012
|
description: "Anthropic"
|
|
4778
5013
|
})
|
|
4779
5014
|
};
|
|
4780
|
-
return (0,
|
|
5015
|
+
return (0, import_provider_utils26.withUserAgentSuffix)(
|
|
4781
5016
|
{
|
|
4782
5017
|
"anthropic-version": "2023-06-01",
|
|
4783
5018
|
...authHeaders,
|
|
@@ -4793,7 +5028,7 @@ function createAnthropic(options = {}) {
|
|
|
4793
5028
|
baseURL,
|
|
4794
5029
|
headers: getHeaders,
|
|
4795
5030
|
fetch: options.fetch,
|
|
4796
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
5031
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils26.generateId,
|
|
4797
5032
|
supportedUrls: () => ({
|
|
4798
5033
|
"image/*": [/^https?:\/\/.*$/],
|
|
4799
5034
|
"application/pdf": [/^https?:\/\/.*$/]
|