@ai-sdk/anthropic 3.0.53 → 3.0.55
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 +12 -0
- package/dist/index.d.mts +116 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.js +743 -451
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +728 -428
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +118 -2
- package/dist/internal/index.d.ts +118 -2
- package/dist/internal/index.js +736 -444
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +727 -427
- 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 +93 -1
- package/src/anthropic-prepare-tools.ts +37 -0
- package/src/anthropic-tools.ts +23 -0
- package/src/convert-to-anthropic-messages-prompt.ts +37 -3
- package/src/tool/code-execution_20260120.ts +38 -0
- package/src/tool/web-fetch-20260209.ts +145 -0
- package/src/tool/web-search_20260209.ts +136 -0
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "@ai-sdk/provider-utils";
|
|
13
13
|
|
|
14
14
|
// src/version.ts
|
|
15
|
-
var VERSION = true ? "3.0.
|
|
15
|
+
var VERSION = true ? "3.0.55" : "0.0.0-test";
|
|
16
16
|
|
|
17
17
|
// src/anthropic-messages-language-model.ts
|
|
18
18
|
import {
|
|
@@ -131,7 +131,16 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
131
131
|
type: z2.literal("server_tool_use"),
|
|
132
132
|
id: z2.string(),
|
|
133
133
|
name: z2.string(),
|
|
134
|
-
input: z2.record(z2.string(), z2.unknown()).nullish()
|
|
134
|
+
input: z2.record(z2.string(), z2.unknown()).nullish(),
|
|
135
|
+
caller: z2.union([
|
|
136
|
+
z2.object({
|
|
137
|
+
type: z2.literal("code_execution_20260120"),
|
|
138
|
+
tool_id: z2.string()
|
|
139
|
+
}),
|
|
140
|
+
z2.object({
|
|
141
|
+
type: z2.literal("direct")
|
|
142
|
+
})
|
|
143
|
+
]).optional()
|
|
135
144
|
}),
|
|
136
145
|
z2.object({
|
|
137
146
|
type: z2.literal("mcp_tool_use"),
|
|
@@ -219,6 +228,18 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
219
228
|
})
|
|
220
229
|
).optional().default([])
|
|
221
230
|
}),
|
|
231
|
+
z2.object({
|
|
232
|
+
type: z2.literal("encrypted_code_execution_result"),
|
|
233
|
+
encrypted_stdout: z2.string(),
|
|
234
|
+
stderr: z2.string(),
|
|
235
|
+
return_code: z2.number(),
|
|
236
|
+
content: z2.array(
|
|
237
|
+
z2.object({
|
|
238
|
+
type: z2.literal("code_execution_output"),
|
|
239
|
+
file_id: z2.string()
|
|
240
|
+
})
|
|
241
|
+
).optional().default([])
|
|
242
|
+
}),
|
|
222
243
|
z2.object({
|
|
223
244
|
type: z2.literal("code_execution_tool_result_error"),
|
|
224
245
|
error_code: z2.string()
|
|
@@ -441,7 +462,16 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
441
462
|
type: z2.literal("server_tool_use"),
|
|
442
463
|
id: z2.string(),
|
|
443
464
|
name: z2.string(),
|
|
444
|
-
input: z2.record(z2.string(), z2.unknown()).nullish()
|
|
465
|
+
input: z2.record(z2.string(), z2.unknown()).nullish(),
|
|
466
|
+
caller: z2.union([
|
|
467
|
+
z2.object({
|
|
468
|
+
type: z2.literal("code_execution_20260120"),
|
|
469
|
+
tool_id: z2.string()
|
|
470
|
+
}),
|
|
471
|
+
z2.object({
|
|
472
|
+
type: z2.literal("direct")
|
|
473
|
+
})
|
|
474
|
+
]).optional()
|
|
445
475
|
}),
|
|
446
476
|
z2.object({
|
|
447
477
|
type: z2.literal("mcp_tool_use"),
|
|
@@ -529,6 +559,18 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
529
559
|
})
|
|
530
560
|
).optional().default([])
|
|
531
561
|
}),
|
|
562
|
+
z2.object({
|
|
563
|
+
type: z2.literal("encrypted_code_execution_result"),
|
|
564
|
+
encrypted_stdout: z2.string(),
|
|
565
|
+
stderr: z2.string(),
|
|
566
|
+
return_code: z2.number(),
|
|
567
|
+
content: z2.array(
|
|
568
|
+
z2.object({
|
|
569
|
+
type: z2.literal("code_execution_output"),
|
|
570
|
+
file_id: z2.string()
|
|
571
|
+
})
|
|
572
|
+
).optional().default([])
|
|
573
|
+
}),
|
|
532
574
|
z2.object({
|
|
533
575
|
type: z2.literal("code_execution_tool_result_error"),
|
|
534
576
|
error_code: z2.string()
|
|
@@ -1000,14 +1042,14 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1000
1042
|
return factory(args);
|
|
1001
1043
|
};
|
|
1002
1044
|
|
|
1003
|
-
// src/tool/web-
|
|
1045
|
+
// src/tool/web-search_20260209.ts
|
|
1004
1046
|
import {
|
|
1005
1047
|
createProviderToolFactoryWithOutputSchema,
|
|
1006
1048
|
lazySchema as lazySchema4,
|
|
1007
1049
|
zodSchema as zodSchema4
|
|
1008
1050
|
} from "@ai-sdk/provider-utils";
|
|
1009
1051
|
import { z as z5 } from "zod/v4";
|
|
1010
|
-
var
|
|
1052
|
+
var webSearch_20260209ArgsSchema = lazySchema4(
|
|
1011
1053
|
() => zodSchema4(
|
|
1012
1054
|
z5.object({
|
|
1013
1055
|
maxUses: z5.number().optional(),
|
|
@@ -1023,7 +1065,7 @@ var webSearch_20250305ArgsSchema = lazySchema4(
|
|
|
1023
1065
|
})
|
|
1024
1066
|
)
|
|
1025
1067
|
);
|
|
1026
|
-
var
|
|
1068
|
+
var webSearch_20260209OutputSchema = lazySchema4(
|
|
1027
1069
|
() => zodSchema4(
|
|
1028
1070
|
z5.array(
|
|
1029
1071
|
z5.object({
|
|
@@ -1036,7 +1078,7 @@ var webSearch_20250305OutputSchema = lazySchema4(
|
|
|
1036
1078
|
)
|
|
1037
1079
|
)
|
|
1038
1080
|
);
|
|
1039
|
-
var
|
|
1081
|
+
var webSearch_20260209InputSchema = lazySchema4(
|
|
1040
1082
|
() => zodSchema4(
|
|
1041
1083
|
z5.object({
|
|
1042
1084
|
query: z5.string()
|
|
@@ -1044,74 +1086,188 @@ var webSearch_20250305InputSchema = lazySchema4(
|
|
|
1044
1086
|
)
|
|
1045
1087
|
);
|
|
1046
1088
|
var factory2 = createProviderToolFactoryWithOutputSchema({
|
|
1047
|
-
id: "anthropic.
|
|
1048
|
-
inputSchema:
|
|
1049
|
-
outputSchema:
|
|
1089
|
+
id: "anthropic.web_search_20260209",
|
|
1090
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1091
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1050
1092
|
supportsDeferredResults: true
|
|
1051
1093
|
});
|
|
1052
|
-
var
|
|
1094
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1053
1095
|
return factory2(args);
|
|
1054
1096
|
};
|
|
1055
1097
|
|
|
1056
|
-
// src/tool/web-
|
|
1098
|
+
// src/tool/web-search_20250305.ts
|
|
1057
1099
|
import {
|
|
1058
1100
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1059
1101
|
lazySchema as lazySchema5,
|
|
1060
1102
|
zodSchema as zodSchema5
|
|
1061
1103
|
} from "@ai-sdk/provider-utils";
|
|
1062
1104
|
import { z as z6 } from "zod/v4";
|
|
1063
|
-
var
|
|
1105
|
+
var webSearch_20250305ArgsSchema = lazySchema5(
|
|
1064
1106
|
() => zodSchema5(
|
|
1065
1107
|
z6.object({
|
|
1066
1108
|
maxUses: z6.number().optional(),
|
|
1067
1109
|
allowedDomains: z6.array(z6.string()).optional(),
|
|
1068
1110
|
blockedDomains: z6.array(z6.string()).optional(),
|
|
1069
|
-
|
|
1070
|
-
|
|
1111
|
+
userLocation: z6.object({
|
|
1112
|
+
type: z6.literal("approximate"),
|
|
1113
|
+
city: z6.string().optional(),
|
|
1114
|
+
region: z6.string().optional(),
|
|
1115
|
+
country: z6.string().optional(),
|
|
1116
|
+
timezone: z6.string().optional()
|
|
1117
|
+
}).optional()
|
|
1071
1118
|
})
|
|
1072
1119
|
)
|
|
1073
1120
|
);
|
|
1074
|
-
var
|
|
1121
|
+
var webSearch_20250305OutputSchema = lazySchema5(
|
|
1075
1122
|
() => zodSchema5(
|
|
1076
|
-
z6.
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
content: z6.object({
|
|
1080
|
-
type: z6.literal("document"),
|
|
1123
|
+
z6.array(
|
|
1124
|
+
z6.object({
|
|
1125
|
+
url: z6.string(),
|
|
1081
1126
|
title: z6.string().nullable(),
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1127
|
+
pageAge: z6.string().nullable(),
|
|
1128
|
+
encryptedContent: z6.string(),
|
|
1129
|
+
type: z6.literal("web_search_result")
|
|
1130
|
+
})
|
|
1131
|
+
)
|
|
1132
|
+
)
|
|
1133
|
+
);
|
|
1134
|
+
var webSearch_20250305InputSchema = lazySchema5(
|
|
1135
|
+
() => zodSchema5(
|
|
1136
|
+
z6.object({
|
|
1137
|
+
query: z6.string()
|
|
1138
|
+
})
|
|
1139
|
+
)
|
|
1140
|
+
);
|
|
1141
|
+
var factory3 = createProviderToolFactoryWithOutputSchema2({
|
|
1142
|
+
id: "anthropic.web_search_20250305",
|
|
1143
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1144
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1145
|
+
supportsDeferredResults: true
|
|
1146
|
+
});
|
|
1147
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1148
|
+
return factory3(args);
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1151
|
+
// src/tool/web-fetch-20260209.ts
|
|
1152
|
+
import {
|
|
1153
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1154
|
+
lazySchema as lazySchema6,
|
|
1155
|
+
zodSchema as zodSchema6
|
|
1156
|
+
} from "@ai-sdk/provider-utils";
|
|
1157
|
+
import { z as z7 } from "zod/v4";
|
|
1158
|
+
var webFetch_20260209ArgsSchema = lazySchema6(
|
|
1159
|
+
() => zodSchema6(
|
|
1160
|
+
z7.object({
|
|
1161
|
+
maxUses: z7.number().optional(),
|
|
1162
|
+
allowedDomains: z7.array(z7.string()).optional(),
|
|
1163
|
+
blockedDomains: z7.array(z7.string()).optional(),
|
|
1164
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1165
|
+
maxContentTokens: z7.number().optional()
|
|
1166
|
+
})
|
|
1167
|
+
)
|
|
1168
|
+
);
|
|
1169
|
+
var webFetch_20260209OutputSchema = lazySchema6(
|
|
1170
|
+
() => zodSchema6(
|
|
1171
|
+
z7.object({
|
|
1172
|
+
type: z7.literal("web_fetch_result"),
|
|
1173
|
+
url: z7.string(),
|
|
1174
|
+
content: z7.object({
|
|
1175
|
+
type: z7.literal("document"),
|
|
1176
|
+
title: z7.string().nullable(),
|
|
1177
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1178
|
+
source: z7.union([
|
|
1179
|
+
z7.object({
|
|
1180
|
+
type: z7.literal("base64"),
|
|
1181
|
+
mediaType: z7.literal("application/pdf"),
|
|
1182
|
+
data: z7.string()
|
|
1088
1183
|
}),
|
|
1089
|
-
|
|
1090
|
-
type:
|
|
1091
|
-
mediaType:
|
|
1092
|
-
data:
|
|
1184
|
+
z7.object({
|
|
1185
|
+
type: z7.literal("text"),
|
|
1186
|
+
mediaType: z7.literal("text/plain"),
|
|
1187
|
+
data: z7.string()
|
|
1093
1188
|
})
|
|
1094
1189
|
])
|
|
1095
1190
|
}),
|
|
1096
|
-
retrievedAt:
|
|
1191
|
+
retrievedAt: z7.string().nullable()
|
|
1097
1192
|
})
|
|
1098
1193
|
)
|
|
1099
1194
|
);
|
|
1100
|
-
var
|
|
1101
|
-
() =>
|
|
1102
|
-
|
|
1103
|
-
url:
|
|
1195
|
+
var webFetch_20260209InputSchema = lazySchema6(
|
|
1196
|
+
() => zodSchema6(
|
|
1197
|
+
z7.object({
|
|
1198
|
+
url: z7.string()
|
|
1104
1199
|
})
|
|
1105
1200
|
)
|
|
1106
1201
|
);
|
|
1107
|
-
var
|
|
1202
|
+
var factory4 = createProviderToolFactoryWithOutputSchema3({
|
|
1203
|
+
id: "anthropic.web_fetch_20260209",
|
|
1204
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1205
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1206
|
+
supportsDeferredResults: true
|
|
1207
|
+
});
|
|
1208
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1209
|
+
return factory4(args);
|
|
1210
|
+
};
|
|
1211
|
+
|
|
1212
|
+
// src/tool/web-fetch-20250910.ts
|
|
1213
|
+
import {
|
|
1214
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1215
|
+
lazySchema as lazySchema7,
|
|
1216
|
+
zodSchema as zodSchema7
|
|
1217
|
+
} from "@ai-sdk/provider-utils";
|
|
1218
|
+
import { z as z8 } from "zod/v4";
|
|
1219
|
+
var webFetch_20250910ArgsSchema = lazySchema7(
|
|
1220
|
+
() => zodSchema7(
|
|
1221
|
+
z8.object({
|
|
1222
|
+
maxUses: z8.number().optional(),
|
|
1223
|
+
allowedDomains: z8.array(z8.string()).optional(),
|
|
1224
|
+
blockedDomains: z8.array(z8.string()).optional(),
|
|
1225
|
+
citations: z8.object({ enabled: z8.boolean() }).optional(),
|
|
1226
|
+
maxContentTokens: z8.number().optional()
|
|
1227
|
+
})
|
|
1228
|
+
)
|
|
1229
|
+
);
|
|
1230
|
+
var webFetch_20250910OutputSchema = lazySchema7(
|
|
1231
|
+
() => zodSchema7(
|
|
1232
|
+
z8.object({
|
|
1233
|
+
type: z8.literal("web_fetch_result"),
|
|
1234
|
+
url: z8.string(),
|
|
1235
|
+
content: z8.object({
|
|
1236
|
+
type: z8.literal("document"),
|
|
1237
|
+
title: z8.string().nullable(),
|
|
1238
|
+
citations: z8.object({ enabled: z8.boolean() }).optional(),
|
|
1239
|
+
source: z8.union([
|
|
1240
|
+
z8.object({
|
|
1241
|
+
type: z8.literal("base64"),
|
|
1242
|
+
mediaType: z8.literal("application/pdf"),
|
|
1243
|
+
data: z8.string()
|
|
1244
|
+
}),
|
|
1245
|
+
z8.object({
|
|
1246
|
+
type: z8.literal("text"),
|
|
1247
|
+
mediaType: z8.literal("text/plain"),
|
|
1248
|
+
data: z8.string()
|
|
1249
|
+
})
|
|
1250
|
+
])
|
|
1251
|
+
}),
|
|
1252
|
+
retrievedAt: z8.string().nullable()
|
|
1253
|
+
})
|
|
1254
|
+
)
|
|
1255
|
+
);
|
|
1256
|
+
var webFetch_20250910InputSchema = lazySchema7(
|
|
1257
|
+
() => zodSchema7(
|
|
1258
|
+
z8.object({
|
|
1259
|
+
url: z8.string()
|
|
1260
|
+
})
|
|
1261
|
+
)
|
|
1262
|
+
);
|
|
1263
|
+
var factory5 = createProviderToolFactoryWithOutputSchema4({
|
|
1108
1264
|
id: "anthropic.web_fetch_20250910",
|
|
1109
1265
|
inputSchema: webFetch_20250910InputSchema,
|
|
1110
1266
|
outputSchema: webFetch_20250910OutputSchema,
|
|
1111
1267
|
supportsDeferredResults: true
|
|
1112
1268
|
});
|
|
1113
1269
|
var webFetch_20250910 = (args = {}) => {
|
|
1114
|
-
return
|
|
1270
|
+
return factory5(args);
|
|
1115
1271
|
};
|
|
1116
1272
|
|
|
1117
1273
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1311,6 +1467,24 @@ async function prepareTools({
|
|
|
1311
1467
|
});
|
|
1312
1468
|
break;
|
|
1313
1469
|
}
|
|
1470
|
+
case "anthropic.web_fetch_20260209": {
|
|
1471
|
+
betas.add("code-execution-web-tools-2026-02-09");
|
|
1472
|
+
const args = await validateTypes({
|
|
1473
|
+
value: tool.args,
|
|
1474
|
+
schema: webFetch_20260209ArgsSchema
|
|
1475
|
+
});
|
|
1476
|
+
anthropicTools2.push({
|
|
1477
|
+
type: "web_fetch_20260209",
|
|
1478
|
+
name: "web_fetch",
|
|
1479
|
+
max_uses: args.maxUses,
|
|
1480
|
+
allowed_domains: args.allowedDomains,
|
|
1481
|
+
blocked_domains: args.blockedDomains,
|
|
1482
|
+
citations: args.citations,
|
|
1483
|
+
max_content_tokens: args.maxContentTokens,
|
|
1484
|
+
cache_control: void 0
|
|
1485
|
+
});
|
|
1486
|
+
break;
|
|
1487
|
+
}
|
|
1314
1488
|
case "anthropic.web_search_20250305": {
|
|
1315
1489
|
const args = await validateTypes({
|
|
1316
1490
|
value: tool.args,
|
|
@@ -1327,6 +1501,23 @@ async function prepareTools({
|
|
|
1327
1501
|
});
|
|
1328
1502
|
break;
|
|
1329
1503
|
}
|
|
1504
|
+
case "anthropic.web_search_20260209": {
|
|
1505
|
+
betas.add("code-execution-web-tools-2026-02-09");
|
|
1506
|
+
const args = await validateTypes({
|
|
1507
|
+
value: tool.args,
|
|
1508
|
+
schema: webSearch_20260209ArgsSchema
|
|
1509
|
+
});
|
|
1510
|
+
anthropicTools2.push({
|
|
1511
|
+
type: "web_search_20260209",
|
|
1512
|
+
name: "web_search",
|
|
1513
|
+
max_uses: args.maxUses,
|
|
1514
|
+
allowed_domains: args.allowedDomains,
|
|
1515
|
+
blocked_domains: args.blockedDomains,
|
|
1516
|
+
user_location: args.userLocation,
|
|
1517
|
+
cache_control: void 0
|
|
1518
|
+
});
|
|
1519
|
+
break;
|
|
1520
|
+
}
|
|
1330
1521
|
case "anthropic.tool_search_regex_20251119": {
|
|
1331
1522
|
betas.add("advanced-tool-use-2025-11-20");
|
|
1332
1523
|
anthropicTools2.push({
|
|
@@ -1468,144 +1659,144 @@ import {
|
|
|
1468
1659
|
|
|
1469
1660
|
// src/tool/code-execution_20250522.ts
|
|
1470
1661
|
import {
|
|
1471
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1472
|
-
lazySchema as
|
|
1473
|
-
zodSchema as
|
|
1662
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1663
|
+
lazySchema as lazySchema8,
|
|
1664
|
+
zodSchema as zodSchema8
|
|
1474
1665
|
} from "@ai-sdk/provider-utils";
|
|
1475
|
-
import { z as
|
|
1476
|
-
var codeExecution_20250522OutputSchema =
|
|
1477
|
-
() =>
|
|
1478
|
-
|
|
1479
|
-
type:
|
|
1480
|
-
stdout:
|
|
1481
|
-
stderr:
|
|
1482
|
-
return_code:
|
|
1483
|
-
content:
|
|
1484
|
-
|
|
1485
|
-
type:
|
|
1486
|
-
file_id:
|
|
1666
|
+
import { z as z9 } from "zod/v4";
|
|
1667
|
+
var codeExecution_20250522OutputSchema = lazySchema8(
|
|
1668
|
+
() => zodSchema8(
|
|
1669
|
+
z9.object({
|
|
1670
|
+
type: z9.literal("code_execution_result"),
|
|
1671
|
+
stdout: z9.string(),
|
|
1672
|
+
stderr: z9.string(),
|
|
1673
|
+
return_code: z9.number(),
|
|
1674
|
+
content: z9.array(
|
|
1675
|
+
z9.object({
|
|
1676
|
+
type: z9.literal("code_execution_output"),
|
|
1677
|
+
file_id: z9.string()
|
|
1487
1678
|
})
|
|
1488
1679
|
).optional().default([])
|
|
1489
1680
|
})
|
|
1490
1681
|
)
|
|
1491
1682
|
);
|
|
1492
|
-
var codeExecution_20250522InputSchema =
|
|
1493
|
-
() =>
|
|
1494
|
-
|
|
1495
|
-
code:
|
|
1683
|
+
var codeExecution_20250522InputSchema = lazySchema8(
|
|
1684
|
+
() => zodSchema8(
|
|
1685
|
+
z9.object({
|
|
1686
|
+
code: z9.string()
|
|
1496
1687
|
})
|
|
1497
1688
|
)
|
|
1498
1689
|
);
|
|
1499
|
-
var
|
|
1690
|
+
var factory6 = createProviderToolFactoryWithOutputSchema5({
|
|
1500
1691
|
id: "anthropic.code_execution_20250522",
|
|
1501
1692
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1502
1693
|
outputSchema: codeExecution_20250522OutputSchema
|
|
1503
1694
|
});
|
|
1504
1695
|
var codeExecution_20250522 = (args = {}) => {
|
|
1505
|
-
return
|
|
1696
|
+
return factory6(args);
|
|
1506
1697
|
};
|
|
1507
1698
|
|
|
1508
1699
|
// src/tool/code-execution_20250825.ts
|
|
1509
1700
|
import {
|
|
1510
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1511
|
-
lazySchema as
|
|
1512
|
-
zodSchema as
|
|
1701
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
1702
|
+
lazySchema as lazySchema9,
|
|
1703
|
+
zodSchema as zodSchema9
|
|
1513
1704
|
} from "@ai-sdk/provider-utils";
|
|
1514
|
-
import { z as
|
|
1515
|
-
var codeExecution_20250825OutputSchema =
|
|
1516
|
-
() =>
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
type:
|
|
1520
|
-
stdout:
|
|
1521
|
-
stderr:
|
|
1522
|
-
return_code:
|
|
1523
|
-
content:
|
|
1524
|
-
|
|
1525
|
-
type:
|
|
1526
|
-
file_id:
|
|
1705
|
+
import { z as z10 } from "zod/v4";
|
|
1706
|
+
var codeExecution_20250825OutputSchema = lazySchema9(
|
|
1707
|
+
() => zodSchema9(
|
|
1708
|
+
z10.discriminatedUnion("type", [
|
|
1709
|
+
z10.object({
|
|
1710
|
+
type: z10.literal("code_execution_result"),
|
|
1711
|
+
stdout: z10.string(),
|
|
1712
|
+
stderr: z10.string(),
|
|
1713
|
+
return_code: z10.number(),
|
|
1714
|
+
content: z10.array(
|
|
1715
|
+
z10.object({
|
|
1716
|
+
type: z10.literal("code_execution_output"),
|
|
1717
|
+
file_id: z10.string()
|
|
1527
1718
|
})
|
|
1528
1719
|
).optional().default([])
|
|
1529
1720
|
}),
|
|
1530
|
-
|
|
1531
|
-
type:
|
|
1532
|
-
content:
|
|
1533
|
-
|
|
1534
|
-
type:
|
|
1535
|
-
file_id:
|
|
1721
|
+
z10.object({
|
|
1722
|
+
type: z10.literal("bash_code_execution_result"),
|
|
1723
|
+
content: z10.array(
|
|
1724
|
+
z10.object({
|
|
1725
|
+
type: z10.literal("bash_code_execution_output"),
|
|
1726
|
+
file_id: z10.string()
|
|
1536
1727
|
})
|
|
1537
1728
|
),
|
|
1538
|
-
stdout:
|
|
1539
|
-
stderr:
|
|
1540
|
-
return_code:
|
|
1729
|
+
stdout: z10.string(),
|
|
1730
|
+
stderr: z10.string(),
|
|
1731
|
+
return_code: z10.number()
|
|
1541
1732
|
}),
|
|
1542
|
-
|
|
1543
|
-
type:
|
|
1544
|
-
error_code:
|
|
1733
|
+
z10.object({
|
|
1734
|
+
type: z10.literal("bash_code_execution_tool_result_error"),
|
|
1735
|
+
error_code: z10.string()
|
|
1545
1736
|
}),
|
|
1546
|
-
|
|
1547
|
-
type:
|
|
1548
|
-
error_code:
|
|
1737
|
+
z10.object({
|
|
1738
|
+
type: z10.literal("text_editor_code_execution_tool_result_error"),
|
|
1739
|
+
error_code: z10.string()
|
|
1549
1740
|
}),
|
|
1550
|
-
|
|
1551
|
-
type:
|
|
1552
|
-
content:
|
|
1553
|
-
file_type:
|
|
1554
|
-
num_lines:
|
|
1555
|
-
start_line:
|
|
1556
|
-
total_lines:
|
|
1741
|
+
z10.object({
|
|
1742
|
+
type: z10.literal("text_editor_code_execution_view_result"),
|
|
1743
|
+
content: z10.string(),
|
|
1744
|
+
file_type: z10.string(),
|
|
1745
|
+
num_lines: z10.number().nullable(),
|
|
1746
|
+
start_line: z10.number().nullable(),
|
|
1747
|
+
total_lines: z10.number().nullable()
|
|
1557
1748
|
}),
|
|
1558
|
-
|
|
1559
|
-
type:
|
|
1560
|
-
is_file_update:
|
|
1749
|
+
z10.object({
|
|
1750
|
+
type: z10.literal("text_editor_code_execution_create_result"),
|
|
1751
|
+
is_file_update: z10.boolean()
|
|
1561
1752
|
}),
|
|
1562
|
-
|
|
1563
|
-
type:
|
|
1564
|
-
lines:
|
|
1565
|
-
new_lines:
|
|
1566
|
-
new_start:
|
|
1567
|
-
old_lines:
|
|
1568
|
-
old_start:
|
|
1753
|
+
z10.object({
|
|
1754
|
+
type: z10.literal("text_editor_code_execution_str_replace_result"),
|
|
1755
|
+
lines: z10.array(z10.string()).nullable(),
|
|
1756
|
+
new_lines: z10.number().nullable(),
|
|
1757
|
+
new_start: z10.number().nullable(),
|
|
1758
|
+
old_lines: z10.number().nullable(),
|
|
1759
|
+
old_start: z10.number().nullable()
|
|
1569
1760
|
})
|
|
1570
1761
|
])
|
|
1571
1762
|
)
|
|
1572
1763
|
);
|
|
1573
|
-
var codeExecution_20250825InputSchema =
|
|
1574
|
-
() =>
|
|
1575
|
-
|
|
1764
|
+
var codeExecution_20250825InputSchema = lazySchema9(
|
|
1765
|
+
() => zodSchema9(
|
|
1766
|
+
z10.discriminatedUnion("type", [
|
|
1576
1767
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1577
|
-
|
|
1578
|
-
type:
|
|
1579
|
-
code:
|
|
1768
|
+
z10.object({
|
|
1769
|
+
type: z10.literal("programmatic-tool-call"),
|
|
1770
|
+
code: z10.string()
|
|
1580
1771
|
}),
|
|
1581
|
-
|
|
1582
|
-
type:
|
|
1583
|
-
command:
|
|
1772
|
+
z10.object({
|
|
1773
|
+
type: z10.literal("bash_code_execution"),
|
|
1774
|
+
command: z10.string()
|
|
1584
1775
|
}),
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
type:
|
|
1588
|
-
command:
|
|
1589
|
-
path:
|
|
1776
|
+
z10.discriminatedUnion("command", [
|
|
1777
|
+
z10.object({
|
|
1778
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1779
|
+
command: z10.literal("view"),
|
|
1780
|
+
path: z10.string()
|
|
1590
1781
|
}),
|
|
1591
|
-
|
|
1592
|
-
type:
|
|
1593
|
-
command:
|
|
1594
|
-
path:
|
|
1595
|
-
file_text:
|
|
1782
|
+
z10.object({
|
|
1783
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1784
|
+
command: z10.literal("create"),
|
|
1785
|
+
path: z10.string(),
|
|
1786
|
+
file_text: z10.string().nullish()
|
|
1596
1787
|
}),
|
|
1597
|
-
|
|
1598
|
-
type:
|
|
1599
|
-
command:
|
|
1600
|
-
path:
|
|
1601
|
-
old_str:
|
|
1602
|
-
new_str:
|
|
1788
|
+
z10.object({
|
|
1789
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1790
|
+
command: z10.literal("str_replace"),
|
|
1791
|
+
path: z10.string(),
|
|
1792
|
+
old_str: z10.string(),
|
|
1793
|
+
new_str: z10.string()
|
|
1603
1794
|
})
|
|
1604
1795
|
])
|
|
1605
1796
|
])
|
|
1606
1797
|
)
|
|
1607
1798
|
);
|
|
1608
|
-
var
|
|
1799
|
+
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
1609
1800
|
id: "anthropic.code_execution_20250825",
|
|
1610
1801
|
inputSchema: codeExecution_20250825InputSchema,
|
|
1611
1802
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -1615,29 +1806,150 @@ var factory5 = createProviderToolFactoryWithOutputSchema4({
|
|
|
1615
1806
|
supportsDeferredResults: true
|
|
1616
1807
|
});
|
|
1617
1808
|
var codeExecution_20250825 = (args = {}) => {
|
|
1618
|
-
return
|
|
1809
|
+
return factory7(args);
|
|
1810
|
+
};
|
|
1811
|
+
|
|
1812
|
+
// src/tool/code-execution_20260120.ts
|
|
1813
|
+
import {
|
|
1814
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
1815
|
+
lazySchema as lazySchema10,
|
|
1816
|
+
zodSchema as zodSchema10
|
|
1817
|
+
} from "@ai-sdk/provider-utils";
|
|
1818
|
+
import { z as z11 } from "zod/v4";
|
|
1819
|
+
var codeExecution_20260120OutputSchema = lazySchema10(
|
|
1820
|
+
() => zodSchema10(
|
|
1821
|
+
z11.discriminatedUnion("type", [
|
|
1822
|
+
z11.object({
|
|
1823
|
+
type: z11.literal("code_execution_result"),
|
|
1824
|
+
stdout: z11.string(),
|
|
1825
|
+
stderr: z11.string(),
|
|
1826
|
+
return_code: z11.number(),
|
|
1827
|
+
content: z11.array(
|
|
1828
|
+
z11.object({
|
|
1829
|
+
type: z11.literal("code_execution_output"),
|
|
1830
|
+
file_id: z11.string()
|
|
1831
|
+
})
|
|
1832
|
+
).optional().default([])
|
|
1833
|
+
}),
|
|
1834
|
+
z11.object({
|
|
1835
|
+
type: z11.literal("encrypted_code_execution_result"),
|
|
1836
|
+
encrypted_stdout: z11.string(),
|
|
1837
|
+
stderr: z11.string(),
|
|
1838
|
+
return_code: z11.number(),
|
|
1839
|
+
content: z11.array(
|
|
1840
|
+
z11.object({
|
|
1841
|
+
type: z11.literal("code_execution_output"),
|
|
1842
|
+
file_id: z11.string()
|
|
1843
|
+
})
|
|
1844
|
+
).optional().default([])
|
|
1845
|
+
}),
|
|
1846
|
+
z11.object({
|
|
1847
|
+
type: z11.literal("bash_code_execution_result"),
|
|
1848
|
+
content: z11.array(
|
|
1849
|
+
z11.object({
|
|
1850
|
+
type: z11.literal("bash_code_execution_output"),
|
|
1851
|
+
file_id: z11.string()
|
|
1852
|
+
})
|
|
1853
|
+
),
|
|
1854
|
+
stdout: z11.string(),
|
|
1855
|
+
stderr: z11.string(),
|
|
1856
|
+
return_code: z11.number()
|
|
1857
|
+
}),
|
|
1858
|
+
z11.object({
|
|
1859
|
+
type: z11.literal("bash_code_execution_tool_result_error"),
|
|
1860
|
+
error_code: z11.string()
|
|
1861
|
+
}),
|
|
1862
|
+
z11.object({
|
|
1863
|
+
type: z11.literal("text_editor_code_execution_tool_result_error"),
|
|
1864
|
+
error_code: z11.string()
|
|
1865
|
+
}),
|
|
1866
|
+
z11.object({
|
|
1867
|
+
type: z11.literal("text_editor_code_execution_view_result"),
|
|
1868
|
+
content: z11.string(),
|
|
1869
|
+
file_type: z11.string(),
|
|
1870
|
+
num_lines: z11.number().nullable(),
|
|
1871
|
+
start_line: z11.number().nullable(),
|
|
1872
|
+
total_lines: z11.number().nullable()
|
|
1873
|
+
}),
|
|
1874
|
+
z11.object({
|
|
1875
|
+
type: z11.literal("text_editor_code_execution_create_result"),
|
|
1876
|
+
is_file_update: z11.boolean()
|
|
1877
|
+
}),
|
|
1878
|
+
z11.object({
|
|
1879
|
+
type: z11.literal("text_editor_code_execution_str_replace_result"),
|
|
1880
|
+
lines: z11.array(z11.string()).nullable(),
|
|
1881
|
+
new_lines: z11.number().nullable(),
|
|
1882
|
+
new_start: z11.number().nullable(),
|
|
1883
|
+
old_lines: z11.number().nullable(),
|
|
1884
|
+
old_start: z11.number().nullable()
|
|
1885
|
+
})
|
|
1886
|
+
])
|
|
1887
|
+
)
|
|
1888
|
+
);
|
|
1889
|
+
var codeExecution_20260120InputSchema = lazySchema10(
|
|
1890
|
+
() => zodSchema10(
|
|
1891
|
+
z11.discriminatedUnion("type", [
|
|
1892
|
+
z11.object({
|
|
1893
|
+
type: z11.literal("programmatic-tool-call"),
|
|
1894
|
+
code: z11.string()
|
|
1895
|
+
}),
|
|
1896
|
+
z11.object({
|
|
1897
|
+
type: z11.literal("bash_code_execution"),
|
|
1898
|
+
command: z11.string()
|
|
1899
|
+
}),
|
|
1900
|
+
z11.discriminatedUnion("command", [
|
|
1901
|
+
z11.object({
|
|
1902
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1903
|
+
command: z11.literal("view"),
|
|
1904
|
+
path: z11.string()
|
|
1905
|
+
}),
|
|
1906
|
+
z11.object({
|
|
1907
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1908
|
+
command: z11.literal("create"),
|
|
1909
|
+
path: z11.string(),
|
|
1910
|
+
file_text: z11.string().nullish()
|
|
1911
|
+
}),
|
|
1912
|
+
z11.object({
|
|
1913
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1914
|
+
command: z11.literal("str_replace"),
|
|
1915
|
+
path: z11.string(),
|
|
1916
|
+
old_str: z11.string(),
|
|
1917
|
+
new_str: z11.string()
|
|
1918
|
+
})
|
|
1919
|
+
])
|
|
1920
|
+
])
|
|
1921
|
+
)
|
|
1922
|
+
);
|
|
1923
|
+
var factory8 = createProviderToolFactoryWithOutputSchema7({
|
|
1924
|
+
id: "anthropic.code_execution_20260120",
|
|
1925
|
+
inputSchema: codeExecution_20260120InputSchema,
|
|
1926
|
+
outputSchema: codeExecution_20260120OutputSchema,
|
|
1927
|
+
supportsDeferredResults: true
|
|
1928
|
+
});
|
|
1929
|
+
var codeExecution_20260120 = (args = {}) => {
|
|
1930
|
+
return factory8(args);
|
|
1619
1931
|
};
|
|
1620
1932
|
|
|
1621
1933
|
// src/tool/tool-search-regex_20251119.ts
|
|
1622
1934
|
import {
|
|
1623
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1624
|
-
lazySchema as
|
|
1625
|
-
zodSchema as
|
|
1935
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
1936
|
+
lazySchema as lazySchema11,
|
|
1937
|
+
zodSchema as zodSchema11
|
|
1626
1938
|
} from "@ai-sdk/provider-utils";
|
|
1627
|
-
import { z as
|
|
1628
|
-
var toolSearchRegex_20251119OutputSchema =
|
|
1629
|
-
() =>
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
type:
|
|
1633
|
-
toolName:
|
|
1939
|
+
import { z as z12 } from "zod/v4";
|
|
1940
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema11(
|
|
1941
|
+
() => zodSchema11(
|
|
1942
|
+
z12.array(
|
|
1943
|
+
z12.object({
|
|
1944
|
+
type: z12.literal("tool_reference"),
|
|
1945
|
+
toolName: z12.string()
|
|
1634
1946
|
})
|
|
1635
1947
|
)
|
|
1636
1948
|
)
|
|
1637
1949
|
);
|
|
1638
|
-
var toolSearchRegex_20251119InputSchema =
|
|
1639
|
-
() =>
|
|
1640
|
-
|
|
1950
|
+
var toolSearchRegex_20251119InputSchema = lazySchema11(
|
|
1951
|
+
() => zodSchema11(
|
|
1952
|
+
z12.object({
|
|
1641
1953
|
/**
|
|
1642
1954
|
* A regex pattern to search for tools.
|
|
1643
1955
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -1648,22 +1960,22 @@ var toolSearchRegex_20251119InputSchema = lazySchema8(
|
|
|
1648
1960
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1649
1961
|
* - "(?i)slack" - case-insensitive search
|
|
1650
1962
|
*/
|
|
1651
|
-
pattern:
|
|
1963
|
+
pattern: z12.string(),
|
|
1652
1964
|
/**
|
|
1653
1965
|
* Maximum number of tools to return. Optional.
|
|
1654
1966
|
*/
|
|
1655
|
-
limit:
|
|
1967
|
+
limit: z12.number().optional()
|
|
1656
1968
|
})
|
|
1657
1969
|
)
|
|
1658
1970
|
);
|
|
1659
|
-
var
|
|
1971
|
+
var factory9 = createProviderToolFactoryWithOutputSchema8({
|
|
1660
1972
|
id: "anthropic.tool_search_regex_20251119",
|
|
1661
1973
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
1662
1974
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
1663
1975
|
supportsDeferredResults: true
|
|
1664
1976
|
});
|
|
1665
1977
|
var toolSearchRegex_20251119 = (args = {}) => {
|
|
1666
|
-
return
|
|
1978
|
+
return factory9(args);
|
|
1667
1979
|
};
|
|
1668
1980
|
|
|
1669
1981
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
@@ -1699,7 +2011,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1699
2011
|
cacheControlValidator,
|
|
1700
2012
|
toolNameMapping
|
|
1701
2013
|
}) {
|
|
1702
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
2014
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
1703
2015
|
const betas = /* @__PURE__ */ new Set();
|
|
1704
2016
|
const blocks = groupIntoBlocks(prompt);
|
|
1705
2017
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -2237,6 +2549,25 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2237
2549
|
},
|
|
2238
2550
|
cache_control: cacheControl
|
|
2239
2551
|
});
|
|
2552
|
+
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
2553
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2554
|
+
value: output.value,
|
|
2555
|
+
schema: codeExecution_20260120OutputSchema
|
|
2556
|
+
});
|
|
2557
|
+
if (codeExecutionOutput.type === "encrypted_code_execution_result") {
|
|
2558
|
+
anthropicContent.push({
|
|
2559
|
+
type: "code_execution_tool_result",
|
|
2560
|
+
tool_use_id: part.toolCallId,
|
|
2561
|
+
content: {
|
|
2562
|
+
type: codeExecutionOutput.type,
|
|
2563
|
+
encrypted_stdout: codeExecutionOutput.encrypted_stdout,
|
|
2564
|
+
stderr: codeExecutionOutput.stderr,
|
|
2565
|
+
return_code: codeExecutionOutput.return_code,
|
|
2566
|
+
content: (_p = codeExecutionOutput.content) != null ? _p : []
|
|
2567
|
+
},
|
|
2568
|
+
cache_control: cacheControl
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2240
2571
|
} else {
|
|
2241
2572
|
const codeExecutionOutput = await validateTypes2({
|
|
2242
2573
|
value: output.value,
|
|
@@ -2251,7 +2582,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2251
2582
|
stdout: codeExecutionOutput.stdout,
|
|
2252
2583
|
stderr: codeExecutionOutput.stderr,
|
|
2253
2584
|
return_code: codeExecutionOutput.return_code,
|
|
2254
|
-
content: (
|
|
2585
|
+
content: (_q = codeExecutionOutput.content) != null ? _q : []
|
|
2255
2586
|
},
|
|
2256
2587
|
cache_control: cacheControl
|
|
2257
2588
|
});
|
|
@@ -2284,7 +2615,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2284
2615
|
errorValue = output.value;
|
|
2285
2616
|
}
|
|
2286
2617
|
} catch (e) {
|
|
2287
|
-
const extractedErrorCode = (
|
|
2618
|
+
const extractedErrorCode = (_r = output.value) == null ? void 0 : _r.errorCode;
|
|
2288
2619
|
errorValue = {
|
|
2289
2620
|
errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unknown"
|
|
2290
2621
|
};
|
|
@@ -2294,7 +2625,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2294
2625
|
tool_use_id: part.toolCallId,
|
|
2295
2626
|
content: {
|
|
2296
2627
|
type: "web_fetch_tool_result_error",
|
|
2297
|
-
error_code: (
|
|
2628
|
+
error_code: (_s = errorValue.errorCode) != null ? _s : "unknown"
|
|
2298
2629
|
},
|
|
2299
2630
|
cache_control: cacheControl
|
|
2300
2631
|
});
|
|
@@ -2655,7 +2986,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2655
2986
|
"anthropic.bash_20250124": "bash",
|
|
2656
2987
|
"anthropic.memory_20250818": "memory",
|
|
2657
2988
|
"anthropic.web_search_20250305": "web_search",
|
|
2989
|
+
"anthropic.web_search_20260209": "web_search",
|
|
2658
2990
|
"anthropic.web_fetch_20250910": "web_fetch",
|
|
2991
|
+
"anthropic.web_fetch_20260209": "web_fetch",
|
|
2659
2992
|
"anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
|
|
2660
2993
|
"anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
|
|
2661
2994
|
}
|
|
@@ -2970,7 +3303,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2970
3303
|
});
|
|
2971
3304
|
}
|
|
2972
3305
|
async doGenerate(options) {
|
|
2973
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3306
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2974
3307
|
const {
|
|
2975
3308
|
args,
|
|
2976
3309
|
warnings,
|
|
@@ -2987,6 +3320,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2987
3320
|
const citationDocuments = [
|
|
2988
3321
|
...this.extractCitationDocuments(options.prompt)
|
|
2989
3322
|
];
|
|
3323
|
+
const markCodeExecutionDynamic = hasWebTool20260209WithoutCodeExecution(
|
|
3324
|
+
args.tools
|
|
3325
|
+
);
|
|
2990
3326
|
const {
|
|
2991
3327
|
responseHeaders,
|
|
2992
3328
|
value: response,
|
|
@@ -3108,7 +3444,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3108
3444
|
toolCallId: part.id,
|
|
3109
3445
|
toolName: toolNameMapping.toCustomToolName(part.name),
|
|
3110
3446
|
input: JSON.stringify(inputToSerialize),
|
|
3111
|
-
providerExecuted: true
|
|
3447
|
+
providerExecuted: true,
|
|
3448
|
+
// We want this 'code_execution' tool call to be allowed even if the tool is not explicitly provided.
|
|
3449
|
+
// Since the validation generally bypasses dynamic tools, we mark this specific tool as dynamic.
|
|
3450
|
+
...markCodeExecutionDynamic && part.name === "code_execution" ? { dynamic: true } : {}
|
|
3112
3451
|
});
|
|
3113
3452
|
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
3114
3453
|
serverToolCalls[part.id] = part.name;
|
|
@@ -3252,6 +3591,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3252
3591
|
content: (_c = part.content.content) != null ? _c : []
|
|
3253
3592
|
}
|
|
3254
3593
|
});
|
|
3594
|
+
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
3595
|
+
content.push({
|
|
3596
|
+
type: "tool-result",
|
|
3597
|
+
toolCallId: part.tool_use_id,
|
|
3598
|
+
toolName: toolNameMapping.toCustomToolName("code_execution"),
|
|
3599
|
+
result: {
|
|
3600
|
+
type: part.content.type,
|
|
3601
|
+
encrypted_stdout: part.content.encrypted_stdout,
|
|
3602
|
+
stderr: part.content.stderr,
|
|
3603
|
+
return_code: part.content.return_code,
|
|
3604
|
+
content: (_d = part.content.content) != null ? _d : []
|
|
3605
|
+
}
|
|
3606
|
+
});
|
|
3255
3607
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
3256
3608
|
content.push({
|
|
3257
3609
|
type: "tool-result",
|
|
@@ -3328,13 +3680,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3328
3680
|
finishReason: response.stop_reason,
|
|
3329
3681
|
isJsonResponseFromTool
|
|
3330
3682
|
}),
|
|
3331
|
-
raw: (
|
|
3683
|
+
raw: (_e = response.stop_reason) != null ? _e : void 0
|
|
3332
3684
|
},
|
|
3333
3685
|
usage: convertAnthropicMessagesUsage({ usage: response.usage }),
|
|
3334
3686
|
request: { body: args },
|
|
3335
3687
|
response: {
|
|
3336
|
-
id: (
|
|
3337
|
-
modelId: (
|
|
3688
|
+
id: (_f = response.id) != null ? _f : void 0,
|
|
3689
|
+
modelId: (_g = response.model) != null ? _g : void 0,
|
|
3338
3690
|
headers: responseHeaders,
|
|
3339
3691
|
body: rawResponse
|
|
3340
3692
|
},
|
|
@@ -3391,6 +3743,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3391
3743
|
const citationDocuments = [
|
|
3392
3744
|
...this.extractCitationDocuments(options.prompt)
|
|
3393
3745
|
];
|
|
3746
|
+
const markCodeExecutionDynamic = hasWebTool20260209WithoutCodeExecution(
|
|
3747
|
+
body.tools
|
|
3748
|
+
);
|
|
3394
3749
|
const url = this.buildRequestUrl(true);
|
|
3395
3750
|
const { responseHeaders, value: response } = await postJsonToApi({
|
|
3396
3751
|
url,
|
|
@@ -3431,7 +3786,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3431
3786
|
controller.enqueue({ type: "stream-start", warnings });
|
|
3432
3787
|
},
|
|
3433
3788
|
transform(chunk, controller) {
|
|
3434
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
3789
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3435
3790
|
if (options.includeRawChunks) {
|
|
3436
3791
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
3437
3792
|
}
|
|
@@ -3540,12 +3895,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3540
3895
|
].includes(part.name)) {
|
|
3541
3896
|
const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
|
|
3542
3897
|
const customToolName = toolNameMapping.toCustomToolName(providerToolName);
|
|
3898
|
+
const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
|
|
3543
3899
|
contentBlocks[value.index] = {
|
|
3544
3900
|
type: "tool-call",
|
|
3545
3901
|
toolCallId: part.id,
|
|
3546
3902
|
toolName: customToolName,
|
|
3547
|
-
input:
|
|
3903
|
+
input: finalInput,
|
|
3548
3904
|
providerExecuted: true,
|
|
3905
|
+
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
3549
3906
|
firstDelta: true,
|
|
3550
3907
|
providerToolName: part.name
|
|
3551
3908
|
};
|
|
@@ -3553,7 +3910,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3553
3910
|
type: "tool-input-start",
|
|
3554
3911
|
id: part.id,
|
|
3555
3912
|
toolName: customToolName,
|
|
3556
|
-
providerExecuted: true
|
|
3913
|
+
providerExecuted: true,
|
|
3914
|
+
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {}
|
|
3557
3915
|
});
|
|
3558
3916
|
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
3559
3917
|
serverToolCalls[part.id] = part.name;
|
|
@@ -3678,6 +4036,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3678
4036
|
content: (_c = part.content.content) != null ? _c : []
|
|
3679
4037
|
}
|
|
3680
4038
|
});
|
|
4039
|
+
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
4040
|
+
controller.enqueue({
|
|
4041
|
+
type: "tool-result",
|
|
4042
|
+
toolCallId: part.tool_use_id,
|
|
4043
|
+
toolName: toolNameMapping.toCustomToolName("code_execution"),
|
|
4044
|
+
result: {
|
|
4045
|
+
type: part.content.type,
|
|
4046
|
+
encrypted_stdout: part.content.encrypted_stdout,
|
|
4047
|
+
stderr: part.content.stderr,
|
|
4048
|
+
return_code: part.content.return_code,
|
|
4049
|
+
content: (_d = part.content.content) != null ? _d : []
|
|
4050
|
+
}
|
|
4051
|
+
});
|
|
3681
4052
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
3682
4053
|
controller.enqueue({
|
|
3683
4054
|
type: "tool-result",
|
|
@@ -3827,6 +4198,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3827
4198
|
toolName: contentBlock.toolName,
|
|
3828
4199
|
input: finalInput,
|
|
3829
4200
|
providerExecuted: contentBlock.providerExecuted,
|
|
4201
|
+
...markCodeExecutionDynamic && contentBlock.providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
3830
4202
|
...contentBlock.caller && {
|
|
3831
4203
|
providerMetadata: {
|
|
3832
4204
|
anthropic: {
|
|
@@ -3944,12 +4316,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3944
4316
|
}
|
|
3945
4317
|
case "message_start": {
|
|
3946
4318
|
usage.input_tokens = value.message.usage.input_tokens;
|
|
3947
|
-
usage.cache_read_input_tokens = (
|
|
3948
|
-
usage.cache_creation_input_tokens = (
|
|
4319
|
+
usage.cache_read_input_tokens = (_e = value.message.usage.cache_read_input_tokens) != null ? _e : 0;
|
|
4320
|
+
usage.cache_creation_input_tokens = (_f = value.message.usage.cache_creation_input_tokens) != null ? _f : 0;
|
|
3949
4321
|
rawUsage = {
|
|
3950
4322
|
...value.message.usage
|
|
3951
4323
|
};
|
|
3952
|
-
cacheCreationInputTokens = (
|
|
4324
|
+
cacheCreationInputTokens = (_g = value.message.usage.cache_creation_input_tokens) != null ? _g : null;
|
|
3953
4325
|
if (value.message.container != null) {
|
|
3954
4326
|
container = {
|
|
3955
4327
|
expiresAt: value.message.container.expires_at,
|
|
@@ -3968,8 +4340,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3968
4340
|
}
|
|
3969
4341
|
controller.enqueue({
|
|
3970
4342
|
type: "response-metadata",
|
|
3971
|
-
id: (
|
|
3972
|
-
modelId: (
|
|
4343
|
+
id: (_h = value.message.id) != null ? _h : void 0,
|
|
4344
|
+
modelId: (_i = value.message.model) != null ? _i : void 0
|
|
3973
4345
|
});
|
|
3974
4346
|
if (value.message.content != null) {
|
|
3975
4347
|
for (let contentIndex = 0; contentIndex < value.message.content.length; contentIndex++) {
|
|
@@ -3985,7 +4357,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3985
4357
|
id: part.id,
|
|
3986
4358
|
toolName: part.name
|
|
3987
4359
|
});
|
|
3988
|
-
const inputStr = JSON.stringify((
|
|
4360
|
+
const inputStr = JSON.stringify((_j = part.input) != null ? _j : {});
|
|
3989
4361
|
controller.enqueue({
|
|
3990
4362
|
type: "tool-input-delta",
|
|
3991
4363
|
id: part.id,
|
|
@@ -4033,17 +4405,17 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4033
4405
|
finishReason: value.delta.stop_reason,
|
|
4034
4406
|
isJsonResponseFromTool
|
|
4035
4407
|
}),
|
|
4036
|
-
raw: (
|
|
4408
|
+
raw: (_k = value.delta.stop_reason) != null ? _k : void 0
|
|
4037
4409
|
};
|
|
4038
|
-
stopSequence = (
|
|
4410
|
+
stopSequence = (_l = value.delta.stop_sequence) != null ? _l : null;
|
|
4039
4411
|
container = value.delta.container != null ? {
|
|
4040
4412
|
expiresAt: value.delta.container.expires_at,
|
|
4041
4413
|
id: value.delta.container.id,
|
|
4042
|
-
skills: (
|
|
4414
|
+
skills: (_n = (_m = value.delta.container.skills) == null ? void 0 : _m.map((skill) => ({
|
|
4043
4415
|
type: skill.type,
|
|
4044
4416
|
skillId: skill.skill_id,
|
|
4045
4417
|
version: skill.version
|
|
4046
|
-
}))) != null ?
|
|
4418
|
+
}))) != null ? _n : null
|
|
4047
4419
|
} : null;
|
|
4048
4420
|
if (value.context_management) {
|
|
4049
4421
|
contextManagement = mapAnthropicResponseContextManagement(
|
|
@@ -4172,6 +4544,24 @@ function getModelCapabilities(modelId) {
|
|
|
4172
4544
|
};
|
|
4173
4545
|
}
|
|
4174
4546
|
}
|
|
4547
|
+
function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
4548
|
+
if (!tools) {
|
|
4549
|
+
return false;
|
|
4550
|
+
}
|
|
4551
|
+
let hasWebTool20260209 = false;
|
|
4552
|
+
let hasCodeExecutionTool = false;
|
|
4553
|
+
for (const tool of tools) {
|
|
4554
|
+
if ("type" in tool && (tool.type === "web_fetch_20260209" || tool.type === "web_search_20260209")) {
|
|
4555
|
+
hasWebTool20260209 = true;
|
|
4556
|
+
continue;
|
|
4557
|
+
}
|
|
4558
|
+
if (tool.name === "code_execution") {
|
|
4559
|
+
hasCodeExecutionTool = true;
|
|
4560
|
+
break;
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
return hasWebTool20260209 && !hasCodeExecutionTool;
|
|
4564
|
+
}
|
|
4175
4565
|
function mapAnthropicResponseContextManagement(contextManagement) {
|
|
4176
4566
|
return contextManagement ? {
|
|
4177
4567
|
appliedEdits: contextManagement.applied_edits.map((edit) => {
|
|
@@ -4201,15 +4591,15 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4201
4591
|
// src/tool/bash_20241022.ts
|
|
4202
4592
|
import {
|
|
4203
4593
|
createProviderToolFactory as createProviderToolFactory2,
|
|
4204
|
-
lazySchema as
|
|
4205
|
-
zodSchema as
|
|
4594
|
+
lazySchema as lazySchema12,
|
|
4595
|
+
zodSchema as zodSchema12
|
|
4206
4596
|
} from "@ai-sdk/provider-utils";
|
|
4207
|
-
import { z as
|
|
4208
|
-
var bash_20241022InputSchema =
|
|
4209
|
-
() =>
|
|
4210
|
-
|
|
4211
|
-
command:
|
|
4212
|
-
restart:
|
|
4597
|
+
import { z as z13 } from "zod/v4";
|
|
4598
|
+
var bash_20241022InputSchema = lazySchema12(
|
|
4599
|
+
() => zodSchema12(
|
|
4600
|
+
z13.object({
|
|
4601
|
+
command: z13.string(),
|
|
4602
|
+
restart: z13.boolean().optional()
|
|
4213
4603
|
})
|
|
4214
4604
|
)
|
|
4215
4605
|
);
|
|
@@ -4221,15 +4611,15 @@ var bash_20241022 = createProviderToolFactory2({
|
|
|
4221
4611
|
// src/tool/bash_20250124.ts
|
|
4222
4612
|
import {
|
|
4223
4613
|
createProviderToolFactory as createProviderToolFactory3,
|
|
4224
|
-
lazySchema as
|
|
4225
|
-
zodSchema as
|
|
4614
|
+
lazySchema as lazySchema13,
|
|
4615
|
+
zodSchema as zodSchema13
|
|
4226
4616
|
} from "@ai-sdk/provider-utils";
|
|
4227
|
-
import { z as
|
|
4228
|
-
var bash_20250124InputSchema =
|
|
4229
|
-
() =>
|
|
4230
|
-
|
|
4231
|
-
command:
|
|
4232
|
-
restart:
|
|
4617
|
+
import { z as z14 } from "zod/v4";
|
|
4618
|
+
var bash_20250124InputSchema = lazySchema13(
|
|
4619
|
+
() => zodSchema13(
|
|
4620
|
+
z14.object({
|
|
4621
|
+
command: z14.string(),
|
|
4622
|
+
restart: z14.boolean().optional()
|
|
4233
4623
|
})
|
|
4234
4624
|
)
|
|
4235
4625
|
);
|
|
@@ -4238,126 +4628,17 @@ var bash_20250124 = createProviderToolFactory3({
|
|
|
4238
4628
|
inputSchema: bash_20250124InputSchema
|
|
4239
4629
|
});
|
|
4240
4630
|
|
|
4241
|
-
// src/tool/code-execution_20260120.ts
|
|
4242
|
-
import {
|
|
4243
|
-
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
4244
|
-
lazySchema as lazySchema11,
|
|
4245
|
-
zodSchema as zodSchema11
|
|
4246
|
-
} from "@ai-sdk/provider-utils";
|
|
4247
|
-
import { z as z12 } from "zod/v4";
|
|
4248
|
-
var codeExecution_20260120OutputSchema = lazySchema11(
|
|
4249
|
-
() => zodSchema11(
|
|
4250
|
-
z12.discriminatedUnion("type", [
|
|
4251
|
-
z12.object({
|
|
4252
|
-
type: z12.literal("code_execution_result"),
|
|
4253
|
-
stdout: z12.string(),
|
|
4254
|
-
stderr: z12.string(),
|
|
4255
|
-
return_code: z12.number(),
|
|
4256
|
-
content: z12.array(
|
|
4257
|
-
z12.object({
|
|
4258
|
-
type: z12.literal("code_execution_output"),
|
|
4259
|
-
file_id: z12.string()
|
|
4260
|
-
})
|
|
4261
|
-
).optional().default([])
|
|
4262
|
-
}),
|
|
4263
|
-
z12.object({
|
|
4264
|
-
type: z12.literal("bash_code_execution_result"),
|
|
4265
|
-
content: z12.array(
|
|
4266
|
-
z12.object({
|
|
4267
|
-
type: z12.literal("bash_code_execution_output"),
|
|
4268
|
-
file_id: z12.string()
|
|
4269
|
-
})
|
|
4270
|
-
),
|
|
4271
|
-
stdout: z12.string(),
|
|
4272
|
-
stderr: z12.string(),
|
|
4273
|
-
return_code: z12.number()
|
|
4274
|
-
}),
|
|
4275
|
-
z12.object({
|
|
4276
|
-
type: z12.literal("bash_code_execution_tool_result_error"),
|
|
4277
|
-
error_code: z12.string()
|
|
4278
|
-
}),
|
|
4279
|
-
z12.object({
|
|
4280
|
-
type: z12.literal("text_editor_code_execution_tool_result_error"),
|
|
4281
|
-
error_code: z12.string()
|
|
4282
|
-
}),
|
|
4283
|
-
z12.object({
|
|
4284
|
-
type: z12.literal("text_editor_code_execution_view_result"),
|
|
4285
|
-
content: z12.string(),
|
|
4286
|
-
file_type: z12.string(),
|
|
4287
|
-
num_lines: z12.number().nullable(),
|
|
4288
|
-
start_line: z12.number().nullable(),
|
|
4289
|
-
total_lines: z12.number().nullable()
|
|
4290
|
-
}),
|
|
4291
|
-
z12.object({
|
|
4292
|
-
type: z12.literal("text_editor_code_execution_create_result"),
|
|
4293
|
-
is_file_update: z12.boolean()
|
|
4294
|
-
}),
|
|
4295
|
-
z12.object({
|
|
4296
|
-
type: z12.literal("text_editor_code_execution_str_replace_result"),
|
|
4297
|
-
lines: z12.array(z12.string()).nullable(),
|
|
4298
|
-
new_lines: z12.number().nullable(),
|
|
4299
|
-
new_start: z12.number().nullable(),
|
|
4300
|
-
old_lines: z12.number().nullable(),
|
|
4301
|
-
old_start: z12.number().nullable()
|
|
4302
|
-
})
|
|
4303
|
-
])
|
|
4304
|
-
)
|
|
4305
|
-
);
|
|
4306
|
-
var codeExecution_20260120InputSchema = lazySchema11(
|
|
4307
|
-
() => zodSchema11(
|
|
4308
|
-
z12.discriminatedUnion("type", [
|
|
4309
|
-
z12.object({
|
|
4310
|
-
type: z12.literal("programmatic-tool-call"),
|
|
4311
|
-
code: z12.string()
|
|
4312
|
-
}),
|
|
4313
|
-
z12.object({
|
|
4314
|
-
type: z12.literal("bash_code_execution"),
|
|
4315
|
-
command: z12.string()
|
|
4316
|
-
}),
|
|
4317
|
-
z12.discriminatedUnion("command", [
|
|
4318
|
-
z12.object({
|
|
4319
|
-
type: z12.literal("text_editor_code_execution"),
|
|
4320
|
-
command: z12.literal("view"),
|
|
4321
|
-
path: z12.string()
|
|
4322
|
-
}),
|
|
4323
|
-
z12.object({
|
|
4324
|
-
type: z12.literal("text_editor_code_execution"),
|
|
4325
|
-
command: z12.literal("create"),
|
|
4326
|
-
path: z12.string(),
|
|
4327
|
-
file_text: z12.string().nullish()
|
|
4328
|
-
}),
|
|
4329
|
-
z12.object({
|
|
4330
|
-
type: z12.literal("text_editor_code_execution"),
|
|
4331
|
-
command: z12.literal("str_replace"),
|
|
4332
|
-
path: z12.string(),
|
|
4333
|
-
old_str: z12.string(),
|
|
4334
|
-
new_str: z12.string()
|
|
4335
|
-
})
|
|
4336
|
-
])
|
|
4337
|
-
])
|
|
4338
|
-
)
|
|
4339
|
-
);
|
|
4340
|
-
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
4341
|
-
id: "anthropic.code_execution_20260120",
|
|
4342
|
-
inputSchema: codeExecution_20260120InputSchema,
|
|
4343
|
-
outputSchema: codeExecution_20260120OutputSchema,
|
|
4344
|
-
supportsDeferredResults: true
|
|
4345
|
-
});
|
|
4346
|
-
var codeExecution_20260120 = (args = {}) => {
|
|
4347
|
-
return factory7(args);
|
|
4348
|
-
};
|
|
4349
|
-
|
|
4350
4631
|
// src/tool/computer_20241022.ts
|
|
4351
4632
|
import {
|
|
4352
4633
|
createProviderToolFactory as createProviderToolFactory4,
|
|
4353
|
-
lazySchema as
|
|
4354
|
-
zodSchema as
|
|
4634
|
+
lazySchema as lazySchema14,
|
|
4635
|
+
zodSchema as zodSchema14
|
|
4355
4636
|
} from "@ai-sdk/provider-utils";
|
|
4356
|
-
import { z as
|
|
4357
|
-
var computer_20241022InputSchema =
|
|
4358
|
-
() =>
|
|
4359
|
-
|
|
4360
|
-
action:
|
|
4637
|
+
import { z as z15 } from "zod/v4";
|
|
4638
|
+
var computer_20241022InputSchema = lazySchema14(
|
|
4639
|
+
() => zodSchema14(
|
|
4640
|
+
z15.object({
|
|
4641
|
+
action: z15.enum([
|
|
4361
4642
|
"key",
|
|
4362
4643
|
"type",
|
|
4363
4644
|
"mouse_move",
|
|
@@ -4369,8 +4650,8 @@ var computer_20241022InputSchema = lazySchema12(
|
|
|
4369
4650
|
"screenshot",
|
|
4370
4651
|
"cursor_position"
|
|
4371
4652
|
]),
|
|
4372
|
-
coordinate:
|
|
4373
|
-
text:
|
|
4653
|
+
coordinate: z15.array(z15.number().int()).optional(),
|
|
4654
|
+
text: z15.string().optional()
|
|
4374
4655
|
})
|
|
4375
4656
|
)
|
|
4376
4657
|
);
|
|
@@ -4382,14 +4663,14 @@ var computer_20241022 = createProviderToolFactory4({
|
|
|
4382
4663
|
// src/tool/computer_20250124.ts
|
|
4383
4664
|
import {
|
|
4384
4665
|
createProviderToolFactory as createProviderToolFactory5,
|
|
4385
|
-
lazySchema as
|
|
4386
|
-
zodSchema as
|
|
4666
|
+
lazySchema as lazySchema15,
|
|
4667
|
+
zodSchema as zodSchema15
|
|
4387
4668
|
} from "@ai-sdk/provider-utils";
|
|
4388
|
-
import { z as
|
|
4389
|
-
var computer_20250124InputSchema =
|
|
4390
|
-
() =>
|
|
4391
|
-
|
|
4392
|
-
action:
|
|
4669
|
+
import { z as z16 } from "zod/v4";
|
|
4670
|
+
var computer_20250124InputSchema = lazySchema15(
|
|
4671
|
+
() => zodSchema15(
|
|
4672
|
+
z16.object({
|
|
4673
|
+
action: z16.enum([
|
|
4393
4674
|
"key",
|
|
4394
4675
|
"hold_key",
|
|
4395
4676
|
"type",
|
|
@@ -4407,12 +4688,12 @@ var computer_20250124InputSchema = lazySchema13(
|
|
|
4407
4688
|
"wait",
|
|
4408
4689
|
"screenshot"
|
|
4409
4690
|
]),
|
|
4410
|
-
coordinate:
|
|
4411
|
-
duration:
|
|
4412
|
-
scroll_amount:
|
|
4413
|
-
scroll_direction:
|
|
4414
|
-
start_coordinate:
|
|
4415
|
-
text:
|
|
4691
|
+
coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
|
|
4692
|
+
duration: z16.number().optional(),
|
|
4693
|
+
scroll_amount: z16.number().optional(),
|
|
4694
|
+
scroll_direction: z16.enum(["up", "down", "left", "right"]).optional(),
|
|
4695
|
+
start_coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
|
|
4696
|
+
text: z16.string().optional()
|
|
4416
4697
|
})
|
|
4417
4698
|
)
|
|
4418
4699
|
);
|
|
@@ -4424,14 +4705,14 @@ var computer_20250124 = createProviderToolFactory5({
|
|
|
4424
4705
|
// src/tool/computer_20251124.ts
|
|
4425
4706
|
import {
|
|
4426
4707
|
createProviderToolFactory as createProviderToolFactory6,
|
|
4427
|
-
lazySchema as
|
|
4428
|
-
zodSchema as
|
|
4708
|
+
lazySchema as lazySchema16,
|
|
4709
|
+
zodSchema as zodSchema16
|
|
4429
4710
|
} from "@ai-sdk/provider-utils";
|
|
4430
|
-
import { z as
|
|
4431
|
-
var computer_20251124InputSchema =
|
|
4432
|
-
() =>
|
|
4433
|
-
|
|
4434
|
-
action:
|
|
4711
|
+
import { z as z17 } from "zod/v4";
|
|
4712
|
+
var computer_20251124InputSchema = lazySchema16(
|
|
4713
|
+
() => zodSchema16(
|
|
4714
|
+
z17.object({
|
|
4715
|
+
action: z17.enum([
|
|
4435
4716
|
"key",
|
|
4436
4717
|
"hold_key",
|
|
4437
4718
|
"type",
|
|
@@ -4450,18 +4731,18 @@ var computer_20251124InputSchema = lazySchema14(
|
|
|
4450
4731
|
"screenshot",
|
|
4451
4732
|
"zoom"
|
|
4452
4733
|
]),
|
|
4453
|
-
coordinate:
|
|
4454
|
-
duration:
|
|
4455
|
-
region:
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4734
|
+
coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4735
|
+
duration: z17.number().optional(),
|
|
4736
|
+
region: z17.tuple([
|
|
4737
|
+
z17.number().int(),
|
|
4738
|
+
z17.number().int(),
|
|
4739
|
+
z17.number().int(),
|
|
4740
|
+
z17.number().int()
|
|
4460
4741
|
]).optional(),
|
|
4461
|
-
scroll_amount:
|
|
4462
|
-
scroll_direction:
|
|
4463
|
-
start_coordinate:
|
|
4464
|
-
text:
|
|
4742
|
+
scroll_amount: z17.number().optional(),
|
|
4743
|
+
scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
|
|
4744
|
+
start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4745
|
+
text: z17.string().optional()
|
|
4465
4746
|
})
|
|
4466
4747
|
)
|
|
4467
4748
|
);
|
|
@@ -4473,43 +4754,43 @@ var computer_20251124 = createProviderToolFactory6({
|
|
|
4473
4754
|
// src/tool/memory_20250818.ts
|
|
4474
4755
|
import {
|
|
4475
4756
|
createProviderToolFactory as createProviderToolFactory7,
|
|
4476
|
-
lazySchema as
|
|
4477
|
-
zodSchema as
|
|
4757
|
+
lazySchema as lazySchema17,
|
|
4758
|
+
zodSchema as zodSchema17
|
|
4478
4759
|
} from "@ai-sdk/provider-utils";
|
|
4479
|
-
import { z as
|
|
4480
|
-
var memory_20250818InputSchema =
|
|
4481
|
-
() =>
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
command:
|
|
4485
|
-
path:
|
|
4486
|
-
view_range:
|
|
4760
|
+
import { z as z18 } from "zod/v4";
|
|
4761
|
+
var memory_20250818InputSchema = lazySchema17(
|
|
4762
|
+
() => zodSchema17(
|
|
4763
|
+
z18.discriminatedUnion("command", [
|
|
4764
|
+
z18.object({
|
|
4765
|
+
command: z18.literal("view"),
|
|
4766
|
+
path: z18.string(),
|
|
4767
|
+
view_range: z18.tuple([z18.number(), z18.number()]).optional()
|
|
4487
4768
|
}),
|
|
4488
|
-
|
|
4489
|
-
command:
|
|
4490
|
-
path:
|
|
4491
|
-
file_text:
|
|
4769
|
+
z18.object({
|
|
4770
|
+
command: z18.literal("create"),
|
|
4771
|
+
path: z18.string(),
|
|
4772
|
+
file_text: z18.string()
|
|
4492
4773
|
}),
|
|
4493
|
-
|
|
4494
|
-
command:
|
|
4495
|
-
path:
|
|
4496
|
-
old_str:
|
|
4497
|
-
new_str:
|
|
4774
|
+
z18.object({
|
|
4775
|
+
command: z18.literal("str_replace"),
|
|
4776
|
+
path: z18.string(),
|
|
4777
|
+
old_str: z18.string(),
|
|
4778
|
+
new_str: z18.string()
|
|
4498
4779
|
}),
|
|
4499
|
-
|
|
4500
|
-
command:
|
|
4501
|
-
path:
|
|
4502
|
-
insert_line:
|
|
4503
|
-
insert_text:
|
|
4780
|
+
z18.object({
|
|
4781
|
+
command: z18.literal("insert"),
|
|
4782
|
+
path: z18.string(),
|
|
4783
|
+
insert_line: z18.number(),
|
|
4784
|
+
insert_text: z18.string()
|
|
4504
4785
|
}),
|
|
4505
|
-
|
|
4506
|
-
command:
|
|
4507
|
-
path:
|
|
4786
|
+
z18.object({
|
|
4787
|
+
command: z18.literal("delete"),
|
|
4788
|
+
path: z18.string()
|
|
4508
4789
|
}),
|
|
4509
|
-
|
|
4510
|
-
command:
|
|
4511
|
-
old_path:
|
|
4512
|
-
new_path:
|
|
4790
|
+
z18.object({
|
|
4791
|
+
command: z18.literal("rename"),
|
|
4792
|
+
old_path: z18.string(),
|
|
4793
|
+
new_path: z18.string()
|
|
4513
4794
|
})
|
|
4514
4795
|
])
|
|
4515
4796
|
)
|
|
@@ -4522,21 +4803,21 @@ var memory_20250818 = createProviderToolFactory7({
|
|
|
4522
4803
|
// src/tool/text-editor_20241022.ts
|
|
4523
4804
|
import {
|
|
4524
4805
|
createProviderToolFactory as createProviderToolFactory8,
|
|
4525
|
-
lazySchema as
|
|
4526
|
-
zodSchema as
|
|
4806
|
+
lazySchema as lazySchema18,
|
|
4807
|
+
zodSchema as zodSchema18
|
|
4527
4808
|
} from "@ai-sdk/provider-utils";
|
|
4528
|
-
import { z as
|
|
4529
|
-
var textEditor_20241022InputSchema =
|
|
4530
|
-
() =>
|
|
4531
|
-
|
|
4532
|
-
command:
|
|
4533
|
-
path:
|
|
4534
|
-
file_text:
|
|
4535
|
-
insert_line:
|
|
4536
|
-
new_str:
|
|
4537
|
-
insert_text:
|
|
4538
|
-
old_str:
|
|
4539
|
-
view_range:
|
|
4809
|
+
import { z as z19 } from "zod/v4";
|
|
4810
|
+
var textEditor_20241022InputSchema = lazySchema18(
|
|
4811
|
+
() => zodSchema18(
|
|
4812
|
+
z19.object({
|
|
4813
|
+
command: z19.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4814
|
+
path: z19.string(),
|
|
4815
|
+
file_text: z19.string().optional(),
|
|
4816
|
+
insert_line: z19.number().int().optional(),
|
|
4817
|
+
new_str: z19.string().optional(),
|
|
4818
|
+
insert_text: z19.string().optional(),
|
|
4819
|
+
old_str: z19.string().optional(),
|
|
4820
|
+
view_range: z19.array(z19.number().int()).optional()
|
|
4540
4821
|
})
|
|
4541
4822
|
)
|
|
4542
4823
|
);
|
|
@@ -4548,21 +4829,21 @@ var textEditor_20241022 = createProviderToolFactory8({
|
|
|
4548
4829
|
// src/tool/text-editor_20250124.ts
|
|
4549
4830
|
import {
|
|
4550
4831
|
createProviderToolFactory as createProviderToolFactory9,
|
|
4551
|
-
lazySchema as
|
|
4552
|
-
zodSchema as
|
|
4832
|
+
lazySchema as lazySchema19,
|
|
4833
|
+
zodSchema as zodSchema19
|
|
4553
4834
|
} from "@ai-sdk/provider-utils";
|
|
4554
|
-
import { z as
|
|
4555
|
-
var textEditor_20250124InputSchema =
|
|
4556
|
-
() =>
|
|
4557
|
-
|
|
4558
|
-
command:
|
|
4559
|
-
path:
|
|
4560
|
-
file_text:
|
|
4561
|
-
insert_line:
|
|
4562
|
-
new_str:
|
|
4563
|
-
insert_text:
|
|
4564
|
-
old_str:
|
|
4565
|
-
view_range:
|
|
4835
|
+
import { z as z20 } from "zod/v4";
|
|
4836
|
+
var textEditor_20250124InputSchema = lazySchema19(
|
|
4837
|
+
() => zodSchema19(
|
|
4838
|
+
z20.object({
|
|
4839
|
+
command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4840
|
+
path: z20.string(),
|
|
4841
|
+
file_text: z20.string().optional(),
|
|
4842
|
+
insert_line: z20.number().int().optional(),
|
|
4843
|
+
new_str: z20.string().optional(),
|
|
4844
|
+
insert_text: z20.string().optional(),
|
|
4845
|
+
old_str: z20.string().optional(),
|
|
4846
|
+
view_range: z20.array(z20.number().int()).optional()
|
|
4566
4847
|
})
|
|
4567
4848
|
)
|
|
4568
4849
|
);
|
|
@@ -4574,21 +4855,21 @@ var textEditor_20250124 = createProviderToolFactory9({
|
|
|
4574
4855
|
// src/tool/text-editor_20250429.ts
|
|
4575
4856
|
import {
|
|
4576
4857
|
createProviderToolFactory as createProviderToolFactory10,
|
|
4577
|
-
lazySchema as
|
|
4578
|
-
zodSchema as
|
|
4858
|
+
lazySchema as lazySchema20,
|
|
4859
|
+
zodSchema as zodSchema20
|
|
4579
4860
|
} from "@ai-sdk/provider-utils";
|
|
4580
|
-
import { z as
|
|
4581
|
-
var textEditor_20250429InputSchema =
|
|
4582
|
-
() =>
|
|
4583
|
-
|
|
4584
|
-
command:
|
|
4585
|
-
path:
|
|
4586
|
-
file_text:
|
|
4587
|
-
insert_line:
|
|
4588
|
-
new_str:
|
|
4589
|
-
insert_text:
|
|
4590
|
-
old_str:
|
|
4591
|
-
view_range:
|
|
4861
|
+
import { z as z21 } from "zod/v4";
|
|
4862
|
+
var textEditor_20250429InputSchema = lazySchema20(
|
|
4863
|
+
() => zodSchema20(
|
|
4864
|
+
z21.object({
|
|
4865
|
+
command: z21.enum(["view", "create", "str_replace", "insert"]),
|
|
4866
|
+
path: z21.string(),
|
|
4867
|
+
file_text: z21.string().optional(),
|
|
4868
|
+
insert_line: z21.number().int().optional(),
|
|
4869
|
+
new_str: z21.string().optional(),
|
|
4870
|
+
insert_text: z21.string().optional(),
|
|
4871
|
+
old_str: z21.string().optional(),
|
|
4872
|
+
view_range: z21.array(z21.number().int()).optional()
|
|
4592
4873
|
})
|
|
4593
4874
|
)
|
|
4594
4875
|
);
|
|
@@ -4599,44 +4880,44 @@ var textEditor_20250429 = createProviderToolFactory10({
|
|
|
4599
4880
|
|
|
4600
4881
|
// src/tool/tool-search-bm25_20251119.ts
|
|
4601
4882
|
import {
|
|
4602
|
-
createProviderToolFactoryWithOutputSchema as
|
|
4603
|
-
lazySchema as
|
|
4604
|
-
zodSchema as
|
|
4883
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
4884
|
+
lazySchema as lazySchema21,
|
|
4885
|
+
zodSchema as zodSchema21
|
|
4605
4886
|
} from "@ai-sdk/provider-utils";
|
|
4606
|
-
import { z as
|
|
4607
|
-
var toolSearchBm25_20251119OutputSchema =
|
|
4608
|
-
() =>
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
type:
|
|
4612
|
-
toolName:
|
|
4887
|
+
import { z as z22 } from "zod/v4";
|
|
4888
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema21(
|
|
4889
|
+
() => zodSchema21(
|
|
4890
|
+
z22.array(
|
|
4891
|
+
z22.object({
|
|
4892
|
+
type: z22.literal("tool_reference"),
|
|
4893
|
+
toolName: z22.string()
|
|
4613
4894
|
})
|
|
4614
4895
|
)
|
|
4615
4896
|
)
|
|
4616
4897
|
);
|
|
4617
|
-
var toolSearchBm25_20251119InputSchema =
|
|
4618
|
-
() =>
|
|
4619
|
-
|
|
4898
|
+
var toolSearchBm25_20251119InputSchema = lazySchema21(
|
|
4899
|
+
() => zodSchema21(
|
|
4900
|
+
z22.object({
|
|
4620
4901
|
/**
|
|
4621
4902
|
* A natural language query to search for tools.
|
|
4622
4903
|
* Claude will use BM25 text search to find relevant tools.
|
|
4623
4904
|
*/
|
|
4624
|
-
query:
|
|
4905
|
+
query: z22.string(),
|
|
4625
4906
|
/**
|
|
4626
4907
|
* Maximum number of tools to return. Optional.
|
|
4627
4908
|
*/
|
|
4628
|
-
limit:
|
|
4909
|
+
limit: z22.number().optional()
|
|
4629
4910
|
})
|
|
4630
4911
|
)
|
|
4631
4912
|
);
|
|
4632
|
-
var
|
|
4913
|
+
var factory10 = createProviderToolFactoryWithOutputSchema9({
|
|
4633
4914
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4634
4915
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4635
4916
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
4636
4917
|
supportsDeferredResults: true
|
|
4637
4918
|
});
|
|
4638
4919
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
4639
|
-
return
|
|
4920
|
+
return factory10(args);
|
|
4640
4921
|
};
|
|
4641
4922
|
|
|
4642
4923
|
// src/anthropic-tools.ts
|
|
@@ -4783,6 +5064,16 @@ var anthropicTools = {
|
|
|
4783
5064
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
4784
5065
|
*/
|
|
4785
5066
|
webFetch_20250910,
|
|
5067
|
+
/**
|
|
5068
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
5069
|
+
*
|
|
5070
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
5071
|
+
* @param allowedDomains - Only fetch from these domains
|
|
5072
|
+
* @param blockedDomains - Never fetch from these domains
|
|
5073
|
+
* @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.
|
|
5074
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
5075
|
+
*/
|
|
5076
|
+
webFetch_20260209,
|
|
4786
5077
|
/**
|
|
4787
5078
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
4788
5079
|
*
|
|
@@ -4792,6 +5083,15 @@ var anthropicTools = {
|
|
|
4792
5083
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
4793
5084
|
*/
|
|
4794
5085
|
webSearch_20250305,
|
|
5086
|
+
/**
|
|
5087
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
5088
|
+
*
|
|
5089
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
5090
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
5091
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
5092
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
5093
|
+
*/
|
|
5094
|
+
webSearch_20260209,
|
|
4795
5095
|
/**
|
|
4796
5096
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
4797
5097
|
*
|