@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/internal/index.mjs
CHANGED
|
@@ -115,7 +115,16 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
115
115
|
type: z2.literal("server_tool_use"),
|
|
116
116
|
id: z2.string(),
|
|
117
117
|
name: z2.string(),
|
|
118
|
-
input: z2.record(z2.string(), z2.unknown()).nullish()
|
|
118
|
+
input: z2.record(z2.string(), z2.unknown()).nullish(),
|
|
119
|
+
caller: z2.union([
|
|
120
|
+
z2.object({
|
|
121
|
+
type: z2.literal("code_execution_20260120"),
|
|
122
|
+
tool_id: z2.string()
|
|
123
|
+
}),
|
|
124
|
+
z2.object({
|
|
125
|
+
type: z2.literal("direct")
|
|
126
|
+
})
|
|
127
|
+
]).optional()
|
|
119
128
|
}),
|
|
120
129
|
z2.object({
|
|
121
130
|
type: z2.literal("mcp_tool_use"),
|
|
@@ -203,6 +212,18 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
203
212
|
})
|
|
204
213
|
).optional().default([])
|
|
205
214
|
}),
|
|
215
|
+
z2.object({
|
|
216
|
+
type: z2.literal("encrypted_code_execution_result"),
|
|
217
|
+
encrypted_stdout: z2.string(),
|
|
218
|
+
stderr: z2.string(),
|
|
219
|
+
return_code: z2.number(),
|
|
220
|
+
content: z2.array(
|
|
221
|
+
z2.object({
|
|
222
|
+
type: z2.literal("code_execution_output"),
|
|
223
|
+
file_id: z2.string()
|
|
224
|
+
})
|
|
225
|
+
).optional().default([])
|
|
226
|
+
}),
|
|
206
227
|
z2.object({
|
|
207
228
|
type: z2.literal("code_execution_tool_result_error"),
|
|
208
229
|
error_code: z2.string()
|
|
@@ -425,7 +446,16 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
425
446
|
type: z2.literal("server_tool_use"),
|
|
426
447
|
id: z2.string(),
|
|
427
448
|
name: z2.string(),
|
|
428
|
-
input: z2.record(z2.string(), z2.unknown()).nullish()
|
|
449
|
+
input: z2.record(z2.string(), z2.unknown()).nullish(),
|
|
450
|
+
caller: z2.union([
|
|
451
|
+
z2.object({
|
|
452
|
+
type: z2.literal("code_execution_20260120"),
|
|
453
|
+
tool_id: z2.string()
|
|
454
|
+
}),
|
|
455
|
+
z2.object({
|
|
456
|
+
type: z2.literal("direct")
|
|
457
|
+
})
|
|
458
|
+
]).optional()
|
|
429
459
|
}),
|
|
430
460
|
z2.object({
|
|
431
461
|
type: z2.literal("mcp_tool_use"),
|
|
@@ -513,6 +543,18 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
513
543
|
})
|
|
514
544
|
).optional().default([])
|
|
515
545
|
}),
|
|
546
|
+
z2.object({
|
|
547
|
+
type: z2.literal("encrypted_code_execution_result"),
|
|
548
|
+
encrypted_stdout: z2.string(),
|
|
549
|
+
stderr: z2.string(),
|
|
550
|
+
return_code: z2.number(),
|
|
551
|
+
content: z2.array(
|
|
552
|
+
z2.object({
|
|
553
|
+
type: z2.literal("code_execution_output"),
|
|
554
|
+
file_id: z2.string()
|
|
555
|
+
})
|
|
556
|
+
).optional().default([])
|
|
557
|
+
}),
|
|
516
558
|
z2.object({
|
|
517
559
|
type: z2.literal("code_execution_tool_result_error"),
|
|
518
560
|
error_code: z2.string()
|
|
@@ -984,14 +1026,14 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
984
1026
|
return factory(args);
|
|
985
1027
|
};
|
|
986
1028
|
|
|
987
|
-
// src/tool/web-
|
|
1029
|
+
// src/tool/web-search_20260209.ts
|
|
988
1030
|
import {
|
|
989
1031
|
createProviderToolFactoryWithOutputSchema,
|
|
990
1032
|
lazySchema as lazySchema4,
|
|
991
1033
|
zodSchema as zodSchema4
|
|
992
1034
|
} from "@ai-sdk/provider-utils";
|
|
993
1035
|
import { z as z5 } from "zod/v4";
|
|
994
|
-
var
|
|
1036
|
+
var webSearch_20260209ArgsSchema = lazySchema4(
|
|
995
1037
|
() => zodSchema4(
|
|
996
1038
|
z5.object({
|
|
997
1039
|
maxUses: z5.number().optional(),
|
|
@@ -1007,7 +1049,7 @@ var webSearch_20250305ArgsSchema = lazySchema4(
|
|
|
1007
1049
|
})
|
|
1008
1050
|
)
|
|
1009
1051
|
);
|
|
1010
|
-
var
|
|
1052
|
+
var webSearch_20260209OutputSchema = lazySchema4(
|
|
1011
1053
|
() => zodSchema4(
|
|
1012
1054
|
z5.array(
|
|
1013
1055
|
z5.object({
|
|
@@ -1020,7 +1062,7 @@ var webSearch_20250305OutputSchema = lazySchema4(
|
|
|
1020
1062
|
)
|
|
1021
1063
|
)
|
|
1022
1064
|
);
|
|
1023
|
-
var
|
|
1065
|
+
var webSearch_20260209InputSchema = lazySchema4(
|
|
1024
1066
|
() => zodSchema4(
|
|
1025
1067
|
z5.object({
|
|
1026
1068
|
query: z5.string()
|
|
@@ -1028,74 +1070,188 @@ var webSearch_20250305InputSchema = lazySchema4(
|
|
|
1028
1070
|
)
|
|
1029
1071
|
);
|
|
1030
1072
|
var factory2 = createProviderToolFactoryWithOutputSchema({
|
|
1031
|
-
id: "anthropic.
|
|
1032
|
-
inputSchema:
|
|
1033
|
-
outputSchema:
|
|
1073
|
+
id: "anthropic.web_search_20260209",
|
|
1074
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1075
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1034
1076
|
supportsDeferredResults: true
|
|
1035
1077
|
});
|
|
1036
|
-
var
|
|
1078
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1037
1079
|
return factory2(args);
|
|
1038
1080
|
};
|
|
1039
1081
|
|
|
1040
|
-
// src/tool/web-
|
|
1082
|
+
// src/tool/web-search_20250305.ts
|
|
1041
1083
|
import {
|
|
1042
1084
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1043
1085
|
lazySchema as lazySchema5,
|
|
1044
1086
|
zodSchema as zodSchema5
|
|
1045
1087
|
} from "@ai-sdk/provider-utils";
|
|
1046
1088
|
import { z as z6 } from "zod/v4";
|
|
1047
|
-
var
|
|
1089
|
+
var webSearch_20250305ArgsSchema = lazySchema5(
|
|
1048
1090
|
() => zodSchema5(
|
|
1049
1091
|
z6.object({
|
|
1050
1092
|
maxUses: z6.number().optional(),
|
|
1051
1093
|
allowedDomains: z6.array(z6.string()).optional(),
|
|
1052
1094
|
blockedDomains: z6.array(z6.string()).optional(),
|
|
1053
|
-
|
|
1054
|
-
|
|
1095
|
+
userLocation: z6.object({
|
|
1096
|
+
type: z6.literal("approximate"),
|
|
1097
|
+
city: z6.string().optional(),
|
|
1098
|
+
region: z6.string().optional(),
|
|
1099
|
+
country: z6.string().optional(),
|
|
1100
|
+
timezone: z6.string().optional()
|
|
1101
|
+
}).optional()
|
|
1055
1102
|
})
|
|
1056
1103
|
)
|
|
1057
1104
|
);
|
|
1058
|
-
var
|
|
1105
|
+
var webSearch_20250305OutputSchema = lazySchema5(
|
|
1059
1106
|
() => zodSchema5(
|
|
1060
|
-
z6.
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
content: z6.object({
|
|
1064
|
-
type: z6.literal("document"),
|
|
1107
|
+
z6.array(
|
|
1108
|
+
z6.object({
|
|
1109
|
+
url: z6.string(),
|
|
1065
1110
|
title: z6.string().nullable(),
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1111
|
+
pageAge: z6.string().nullable(),
|
|
1112
|
+
encryptedContent: z6.string(),
|
|
1113
|
+
type: z6.literal("web_search_result")
|
|
1114
|
+
})
|
|
1115
|
+
)
|
|
1116
|
+
)
|
|
1117
|
+
);
|
|
1118
|
+
var webSearch_20250305InputSchema = lazySchema5(
|
|
1119
|
+
() => zodSchema5(
|
|
1120
|
+
z6.object({
|
|
1121
|
+
query: z6.string()
|
|
1122
|
+
})
|
|
1123
|
+
)
|
|
1124
|
+
);
|
|
1125
|
+
var factory3 = createProviderToolFactoryWithOutputSchema2({
|
|
1126
|
+
id: "anthropic.web_search_20250305",
|
|
1127
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1128
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1129
|
+
supportsDeferredResults: true
|
|
1130
|
+
});
|
|
1131
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1132
|
+
return factory3(args);
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
// src/tool/web-fetch-20260209.ts
|
|
1136
|
+
import {
|
|
1137
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1138
|
+
lazySchema as lazySchema6,
|
|
1139
|
+
zodSchema as zodSchema6
|
|
1140
|
+
} from "@ai-sdk/provider-utils";
|
|
1141
|
+
import { z as z7 } from "zod/v4";
|
|
1142
|
+
var webFetch_20260209ArgsSchema = lazySchema6(
|
|
1143
|
+
() => zodSchema6(
|
|
1144
|
+
z7.object({
|
|
1145
|
+
maxUses: z7.number().optional(),
|
|
1146
|
+
allowedDomains: z7.array(z7.string()).optional(),
|
|
1147
|
+
blockedDomains: z7.array(z7.string()).optional(),
|
|
1148
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1149
|
+
maxContentTokens: z7.number().optional()
|
|
1150
|
+
})
|
|
1151
|
+
)
|
|
1152
|
+
);
|
|
1153
|
+
var webFetch_20260209OutputSchema = lazySchema6(
|
|
1154
|
+
() => zodSchema6(
|
|
1155
|
+
z7.object({
|
|
1156
|
+
type: z7.literal("web_fetch_result"),
|
|
1157
|
+
url: z7.string(),
|
|
1158
|
+
content: z7.object({
|
|
1159
|
+
type: z7.literal("document"),
|
|
1160
|
+
title: z7.string().nullable(),
|
|
1161
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1162
|
+
source: z7.union([
|
|
1163
|
+
z7.object({
|
|
1164
|
+
type: z7.literal("base64"),
|
|
1165
|
+
mediaType: z7.literal("application/pdf"),
|
|
1166
|
+
data: z7.string()
|
|
1072
1167
|
}),
|
|
1073
|
-
|
|
1074
|
-
type:
|
|
1075
|
-
mediaType:
|
|
1076
|
-
data:
|
|
1168
|
+
z7.object({
|
|
1169
|
+
type: z7.literal("text"),
|
|
1170
|
+
mediaType: z7.literal("text/plain"),
|
|
1171
|
+
data: z7.string()
|
|
1077
1172
|
})
|
|
1078
1173
|
])
|
|
1079
1174
|
}),
|
|
1080
|
-
retrievedAt:
|
|
1175
|
+
retrievedAt: z7.string().nullable()
|
|
1081
1176
|
})
|
|
1082
1177
|
)
|
|
1083
1178
|
);
|
|
1084
|
-
var
|
|
1085
|
-
() =>
|
|
1086
|
-
|
|
1087
|
-
url:
|
|
1179
|
+
var webFetch_20260209InputSchema = lazySchema6(
|
|
1180
|
+
() => zodSchema6(
|
|
1181
|
+
z7.object({
|
|
1182
|
+
url: z7.string()
|
|
1088
1183
|
})
|
|
1089
1184
|
)
|
|
1090
1185
|
);
|
|
1091
|
-
var
|
|
1186
|
+
var factory4 = createProviderToolFactoryWithOutputSchema3({
|
|
1187
|
+
id: "anthropic.web_fetch_20260209",
|
|
1188
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1189
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1190
|
+
supportsDeferredResults: true
|
|
1191
|
+
});
|
|
1192
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1193
|
+
return factory4(args);
|
|
1194
|
+
};
|
|
1195
|
+
|
|
1196
|
+
// src/tool/web-fetch-20250910.ts
|
|
1197
|
+
import {
|
|
1198
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1199
|
+
lazySchema as lazySchema7,
|
|
1200
|
+
zodSchema as zodSchema7
|
|
1201
|
+
} from "@ai-sdk/provider-utils";
|
|
1202
|
+
import { z as z8 } from "zod/v4";
|
|
1203
|
+
var webFetch_20250910ArgsSchema = lazySchema7(
|
|
1204
|
+
() => zodSchema7(
|
|
1205
|
+
z8.object({
|
|
1206
|
+
maxUses: z8.number().optional(),
|
|
1207
|
+
allowedDomains: z8.array(z8.string()).optional(),
|
|
1208
|
+
blockedDomains: z8.array(z8.string()).optional(),
|
|
1209
|
+
citations: z8.object({ enabled: z8.boolean() }).optional(),
|
|
1210
|
+
maxContentTokens: z8.number().optional()
|
|
1211
|
+
})
|
|
1212
|
+
)
|
|
1213
|
+
);
|
|
1214
|
+
var webFetch_20250910OutputSchema = lazySchema7(
|
|
1215
|
+
() => zodSchema7(
|
|
1216
|
+
z8.object({
|
|
1217
|
+
type: z8.literal("web_fetch_result"),
|
|
1218
|
+
url: z8.string(),
|
|
1219
|
+
content: z8.object({
|
|
1220
|
+
type: z8.literal("document"),
|
|
1221
|
+
title: z8.string().nullable(),
|
|
1222
|
+
citations: z8.object({ enabled: z8.boolean() }).optional(),
|
|
1223
|
+
source: z8.union([
|
|
1224
|
+
z8.object({
|
|
1225
|
+
type: z8.literal("base64"),
|
|
1226
|
+
mediaType: z8.literal("application/pdf"),
|
|
1227
|
+
data: z8.string()
|
|
1228
|
+
}),
|
|
1229
|
+
z8.object({
|
|
1230
|
+
type: z8.literal("text"),
|
|
1231
|
+
mediaType: z8.literal("text/plain"),
|
|
1232
|
+
data: z8.string()
|
|
1233
|
+
})
|
|
1234
|
+
])
|
|
1235
|
+
}),
|
|
1236
|
+
retrievedAt: z8.string().nullable()
|
|
1237
|
+
})
|
|
1238
|
+
)
|
|
1239
|
+
);
|
|
1240
|
+
var webFetch_20250910InputSchema = lazySchema7(
|
|
1241
|
+
() => zodSchema7(
|
|
1242
|
+
z8.object({
|
|
1243
|
+
url: z8.string()
|
|
1244
|
+
})
|
|
1245
|
+
)
|
|
1246
|
+
);
|
|
1247
|
+
var factory5 = createProviderToolFactoryWithOutputSchema4({
|
|
1092
1248
|
id: "anthropic.web_fetch_20250910",
|
|
1093
1249
|
inputSchema: webFetch_20250910InputSchema,
|
|
1094
1250
|
outputSchema: webFetch_20250910OutputSchema,
|
|
1095
1251
|
supportsDeferredResults: true
|
|
1096
1252
|
});
|
|
1097
1253
|
var webFetch_20250910 = (args = {}) => {
|
|
1098
|
-
return
|
|
1254
|
+
return factory5(args);
|
|
1099
1255
|
};
|
|
1100
1256
|
|
|
1101
1257
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1295,6 +1451,24 @@ async function prepareTools({
|
|
|
1295
1451
|
});
|
|
1296
1452
|
break;
|
|
1297
1453
|
}
|
|
1454
|
+
case "anthropic.web_fetch_20260209": {
|
|
1455
|
+
betas.add("code-execution-web-tools-2026-02-09");
|
|
1456
|
+
const args = await validateTypes({
|
|
1457
|
+
value: tool.args,
|
|
1458
|
+
schema: webFetch_20260209ArgsSchema
|
|
1459
|
+
});
|
|
1460
|
+
anthropicTools2.push({
|
|
1461
|
+
type: "web_fetch_20260209",
|
|
1462
|
+
name: "web_fetch",
|
|
1463
|
+
max_uses: args.maxUses,
|
|
1464
|
+
allowed_domains: args.allowedDomains,
|
|
1465
|
+
blocked_domains: args.blockedDomains,
|
|
1466
|
+
citations: args.citations,
|
|
1467
|
+
max_content_tokens: args.maxContentTokens,
|
|
1468
|
+
cache_control: void 0
|
|
1469
|
+
});
|
|
1470
|
+
break;
|
|
1471
|
+
}
|
|
1298
1472
|
case "anthropic.web_search_20250305": {
|
|
1299
1473
|
const args = await validateTypes({
|
|
1300
1474
|
value: tool.args,
|
|
@@ -1311,6 +1485,23 @@ async function prepareTools({
|
|
|
1311
1485
|
});
|
|
1312
1486
|
break;
|
|
1313
1487
|
}
|
|
1488
|
+
case "anthropic.web_search_20260209": {
|
|
1489
|
+
betas.add("code-execution-web-tools-2026-02-09");
|
|
1490
|
+
const args = await validateTypes({
|
|
1491
|
+
value: tool.args,
|
|
1492
|
+
schema: webSearch_20260209ArgsSchema
|
|
1493
|
+
});
|
|
1494
|
+
anthropicTools2.push({
|
|
1495
|
+
type: "web_search_20260209",
|
|
1496
|
+
name: "web_search",
|
|
1497
|
+
max_uses: args.maxUses,
|
|
1498
|
+
allowed_domains: args.allowedDomains,
|
|
1499
|
+
blocked_domains: args.blockedDomains,
|
|
1500
|
+
user_location: args.userLocation,
|
|
1501
|
+
cache_control: void 0
|
|
1502
|
+
});
|
|
1503
|
+
break;
|
|
1504
|
+
}
|
|
1314
1505
|
case "anthropic.tool_search_regex_20251119": {
|
|
1315
1506
|
betas.add("advanced-tool-use-2025-11-20");
|
|
1316
1507
|
anthropicTools2.push({
|
|
@@ -1452,144 +1643,144 @@ import {
|
|
|
1452
1643
|
|
|
1453
1644
|
// src/tool/code-execution_20250522.ts
|
|
1454
1645
|
import {
|
|
1455
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1456
|
-
lazySchema as
|
|
1457
|
-
zodSchema as
|
|
1646
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1647
|
+
lazySchema as lazySchema8,
|
|
1648
|
+
zodSchema as zodSchema8
|
|
1458
1649
|
} from "@ai-sdk/provider-utils";
|
|
1459
|
-
import { z as
|
|
1460
|
-
var codeExecution_20250522OutputSchema =
|
|
1461
|
-
() =>
|
|
1462
|
-
|
|
1463
|
-
type:
|
|
1464
|
-
stdout:
|
|
1465
|
-
stderr:
|
|
1466
|
-
return_code:
|
|
1467
|
-
content:
|
|
1468
|
-
|
|
1469
|
-
type:
|
|
1470
|
-
file_id:
|
|
1650
|
+
import { z as z9 } from "zod/v4";
|
|
1651
|
+
var codeExecution_20250522OutputSchema = lazySchema8(
|
|
1652
|
+
() => zodSchema8(
|
|
1653
|
+
z9.object({
|
|
1654
|
+
type: z9.literal("code_execution_result"),
|
|
1655
|
+
stdout: z9.string(),
|
|
1656
|
+
stderr: z9.string(),
|
|
1657
|
+
return_code: z9.number(),
|
|
1658
|
+
content: z9.array(
|
|
1659
|
+
z9.object({
|
|
1660
|
+
type: z9.literal("code_execution_output"),
|
|
1661
|
+
file_id: z9.string()
|
|
1471
1662
|
})
|
|
1472
1663
|
).optional().default([])
|
|
1473
1664
|
})
|
|
1474
1665
|
)
|
|
1475
1666
|
);
|
|
1476
|
-
var codeExecution_20250522InputSchema =
|
|
1477
|
-
() =>
|
|
1478
|
-
|
|
1479
|
-
code:
|
|
1667
|
+
var codeExecution_20250522InputSchema = lazySchema8(
|
|
1668
|
+
() => zodSchema8(
|
|
1669
|
+
z9.object({
|
|
1670
|
+
code: z9.string()
|
|
1480
1671
|
})
|
|
1481
1672
|
)
|
|
1482
1673
|
);
|
|
1483
|
-
var
|
|
1674
|
+
var factory6 = createProviderToolFactoryWithOutputSchema5({
|
|
1484
1675
|
id: "anthropic.code_execution_20250522",
|
|
1485
1676
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1486
1677
|
outputSchema: codeExecution_20250522OutputSchema
|
|
1487
1678
|
});
|
|
1488
1679
|
var codeExecution_20250522 = (args = {}) => {
|
|
1489
|
-
return
|
|
1680
|
+
return factory6(args);
|
|
1490
1681
|
};
|
|
1491
1682
|
|
|
1492
1683
|
// src/tool/code-execution_20250825.ts
|
|
1493
1684
|
import {
|
|
1494
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1495
|
-
lazySchema as
|
|
1496
|
-
zodSchema as
|
|
1685
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
1686
|
+
lazySchema as lazySchema9,
|
|
1687
|
+
zodSchema as zodSchema9
|
|
1497
1688
|
} from "@ai-sdk/provider-utils";
|
|
1498
|
-
import { z as
|
|
1499
|
-
var codeExecution_20250825OutputSchema =
|
|
1500
|
-
() =>
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
type:
|
|
1504
|
-
stdout:
|
|
1505
|
-
stderr:
|
|
1506
|
-
return_code:
|
|
1507
|
-
content:
|
|
1508
|
-
|
|
1509
|
-
type:
|
|
1510
|
-
file_id:
|
|
1689
|
+
import { z as z10 } from "zod/v4";
|
|
1690
|
+
var codeExecution_20250825OutputSchema = lazySchema9(
|
|
1691
|
+
() => zodSchema9(
|
|
1692
|
+
z10.discriminatedUnion("type", [
|
|
1693
|
+
z10.object({
|
|
1694
|
+
type: z10.literal("code_execution_result"),
|
|
1695
|
+
stdout: z10.string(),
|
|
1696
|
+
stderr: z10.string(),
|
|
1697
|
+
return_code: z10.number(),
|
|
1698
|
+
content: z10.array(
|
|
1699
|
+
z10.object({
|
|
1700
|
+
type: z10.literal("code_execution_output"),
|
|
1701
|
+
file_id: z10.string()
|
|
1511
1702
|
})
|
|
1512
1703
|
).optional().default([])
|
|
1513
1704
|
}),
|
|
1514
|
-
|
|
1515
|
-
type:
|
|
1516
|
-
content:
|
|
1517
|
-
|
|
1518
|
-
type:
|
|
1519
|
-
file_id:
|
|
1705
|
+
z10.object({
|
|
1706
|
+
type: z10.literal("bash_code_execution_result"),
|
|
1707
|
+
content: z10.array(
|
|
1708
|
+
z10.object({
|
|
1709
|
+
type: z10.literal("bash_code_execution_output"),
|
|
1710
|
+
file_id: z10.string()
|
|
1520
1711
|
})
|
|
1521
1712
|
),
|
|
1522
|
-
stdout:
|
|
1523
|
-
stderr:
|
|
1524
|
-
return_code:
|
|
1713
|
+
stdout: z10.string(),
|
|
1714
|
+
stderr: z10.string(),
|
|
1715
|
+
return_code: z10.number()
|
|
1525
1716
|
}),
|
|
1526
|
-
|
|
1527
|
-
type:
|
|
1528
|
-
error_code:
|
|
1717
|
+
z10.object({
|
|
1718
|
+
type: z10.literal("bash_code_execution_tool_result_error"),
|
|
1719
|
+
error_code: z10.string()
|
|
1529
1720
|
}),
|
|
1530
|
-
|
|
1531
|
-
type:
|
|
1532
|
-
error_code:
|
|
1721
|
+
z10.object({
|
|
1722
|
+
type: z10.literal("text_editor_code_execution_tool_result_error"),
|
|
1723
|
+
error_code: z10.string()
|
|
1533
1724
|
}),
|
|
1534
|
-
|
|
1535
|
-
type:
|
|
1536
|
-
content:
|
|
1537
|
-
file_type:
|
|
1538
|
-
num_lines:
|
|
1539
|
-
start_line:
|
|
1540
|
-
total_lines:
|
|
1725
|
+
z10.object({
|
|
1726
|
+
type: z10.literal("text_editor_code_execution_view_result"),
|
|
1727
|
+
content: z10.string(),
|
|
1728
|
+
file_type: z10.string(),
|
|
1729
|
+
num_lines: z10.number().nullable(),
|
|
1730
|
+
start_line: z10.number().nullable(),
|
|
1731
|
+
total_lines: z10.number().nullable()
|
|
1541
1732
|
}),
|
|
1542
|
-
|
|
1543
|
-
type:
|
|
1544
|
-
is_file_update:
|
|
1733
|
+
z10.object({
|
|
1734
|
+
type: z10.literal("text_editor_code_execution_create_result"),
|
|
1735
|
+
is_file_update: z10.boolean()
|
|
1545
1736
|
}),
|
|
1546
|
-
|
|
1547
|
-
type:
|
|
1548
|
-
lines:
|
|
1549
|
-
new_lines:
|
|
1550
|
-
new_start:
|
|
1551
|
-
old_lines:
|
|
1552
|
-
old_start:
|
|
1737
|
+
z10.object({
|
|
1738
|
+
type: z10.literal("text_editor_code_execution_str_replace_result"),
|
|
1739
|
+
lines: z10.array(z10.string()).nullable(),
|
|
1740
|
+
new_lines: z10.number().nullable(),
|
|
1741
|
+
new_start: z10.number().nullable(),
|
|
1742
|
+
old_lines: z10.number().nullable(),
|
|
1743
|
+
old_start: z10.number().nullable()
|
|
1553
1744
|
})
|
|
1554
1745
|
])
|
|
1555
1746
|
)
|
|
1556
1747
|
);
|
|
1557
|
-
var codeExecution_20250825InputSchema =
|
|
1558
|
-
() =>
|
|
1559
|
-
|
|
1748
|
+
var codeExecution_20250825InputSchema = lazySchema9(
|
|
1749
|
+
() => zodSchema9(
|
|
1750
|
+
z10.discriminatedUnion("type", [
|
|
1560
1751
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1561
|
-
|
|
1562
|
-
type:
|
|
1563
|
-
code:
|
|
1752
|
+
z10.object({
|
|
1753
|
+
type: z10.literal("programmatic-tool-call"),
|
|
1754
|
+
code: z10.string()
|
|
1564
1755
|
}),
|
|
1565
|
-
|
|
1566
|
-
type:
|
|
1567
|
-
command:
|
|
1756
|
+
z10.object({
|
|
1757
|
+
type: z10.literal("bash_code_execution"),
|
|
1758
|
+
command: z10.string()
|
|
1568
1759
|
}),
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
type:
|
|
1572
|
-
command:
|
|
1573
|
-
path:
|
|
1760
|
+
z10.discriminatedUnion("command", [
|
|
1761
|
+
z10.object({
|
|
1762
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1763
|
+
command: z10.literal("view"),
|
|
1764
|
+
path: z10.string()
|
|
1574
1765
|
}),
|
|
1575
|
-
|
|
1576
|
-
type:
|
|
1577
|
-
command:
|
|
1578
|
-
path:
|
|
1579
|
-
file_text:
|
|
1766
|
+
z10.object({
|
|
1767
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1768
|
+
command: z10.literal("create"),
|
|
1769
|
+
path: z10.string(),
|
|
1770
|
+
file_text: z10.string().nullish()
|
|
1580
1771
|
}),
|
|
1581
|
-
|
|
1582
|
-
type:
|
|
1583
|
-
command:
|
|
1584
|
-
path:
|
|
1585
|
-
old_str:
|
|
1586
|
-
new_str:
|
|
1772
|
+
z10.object({
|
|
1773
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1774
|
+
command: z10.literal("str_replace"),
|
|
1775
|
+
path: z10.string(),
|
|
1776
|
+
old_str: z10.string(),
|
|
1777
|
+
new_str: z10.string()
|
|
1587
1778
|
})
|
|
1588
1779
|
])
|
|
1589
1780
|
])
|
|
1590
1781
|
)
|
|
1591
1782
|
);
|
|
1592
|
-
var
|
|
1783
|
+
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
1593
1784
|
id: "anthropic.code_execution_20250825",
|
|
1594
1785
|
inputSchema: codeExecution_20250825InputSchema,
|
|
1595
1786
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -1599,29 +1790,150 @@ var factory5 = createProviderToolFactoryWithOutputSchema4({
|
|
|
1599
1790
|
supportsDeferredResults: true
|
|
1600
1791
|
});
|
|
1601
1792
|
var codeExecution_20250825 = (args = {}) => {
|
|
1602
|
-
return
|
|
1793
|
+
return factory7(args);
|
|
1794
|
+
};
|
|
1795
|
+
|
|
1796
|
+
// src/tool/code-execution_20260120.ts
|
|
1797
|
+
import {
|
|
1798
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
1799
|
+
lazySchema as lazySchema10,
|
|
1800
|
+
zodSchema as zodSchema10
|
|
1801
|
+
} from "@ai-sdk/provider-utils";
|
|
1802
|
+
import { z as z11 } from "zod/v4";
|
|
1803
|
+
var codeExecution_20260120OutputSchema = lazySchema10(
|
|
1804
|
+
() => zodSchema10(
|
|
1805
|
+
z11.discriminatedUnion("type", [
|
|
1806
|
+
z11.object({
|
|
1807
|
+
type: z11.literal("code_execution_result"),
|
|
1808
|
+
stdout: z11.string(),
|
|
1809
|
+
stderr: z11.string(),
|
|
1810
|
+
return_code: z11.number(),
|
|
1811
|
+
content: z11.array(
|
|
1812
|
+
z11.object({
|
|
1813
|
+
type: z11.literal("code_execution_output"),
|
|
1814
|
+
file_id: z11.string()
|
|
1815
|
+
})
|
|
1816
|
+
).optional().default([])
|
|
1817
|
+
}),
|
|
1818
|
+
z11.object({
|
|
1819
|
+
type: z11.literal("encrypted_code_execution_result"),
|
|
1820
|
+
encrypted_stdout: z11.string(),
|
|
1821
|
+
stderr: z11.string(),
|
|
1822
|
+
return_code: z11.number(),
|
|
1823
|
+
content: z11.array(
|
|
1824
|
+
z11.object({
|
|
1825
|
+
type: z11.literal("code_execution_output"),
|
|
1826
|
+
file_id: z11.string()
|
|
1827
|
+
})
|
|
1828
|
+
).optional().default([])
|
|
1829
|
+
}),
|
|
1830
|
+
z11.object({
|
|
1831
|
+
type: z11.literal("bash_code_execution_result"),
|
|
1832
|
+
content: z11.array(
|
|
1833
|
+
z11.object({
|
|
1834
|
+
type: z11.literal("bash_code_execution_output"),
|
|
1835
|
+
file_id: z11.string()
|
|
1836
|
+
})
|
|
1837
|
+
),
|
|
1838
|
+
stdout: z11.string(),
|
|
1839
|
+
stderr: z11.string(),
|
|
1840
|
+
return_code: z11.number()
|
|
1841
|
+
}),
|
|
1842
|
+
z11.object({
|
|
1843
|
+
type: z11.literal("bash_code_execution_tool_result_error"),
|
|
1844
|
+
error_code: z11.string()
|
|
1845
|
+
}),
|
|
1846
|
+
z11.object({
|
|
1847
|
+
type: z11.literal("text_editor_code_execution_tool_result_error"),
|
|
1848
|
+
error_code: z11.string()
|
|
1849
|
+
}),
|
|
1850
|
+
z11.object({
|
|
1851
|
+
type: z11.literal("text_editor_code_execution_view_result"),
|
|
1852
|
+
content: z11.string(),
|
|
1853
|
+
file_type: z11.string(),
|
|
1854
|
+
num_lines: z11.number().nullable(),
|
|
1855
|
+
start_line: z11.number().nullable(),
|
|
1856
|
+
total_lines: z11.number().nullable()
|
|
1857
|
+
}),
|
|
1858
|
+
z11.object({
|
|
1859
|
+
type: z11.literal("text_editor_code_execution_create_result"),
|
|
1860
|
+
is_file_update: z11.boolean()
|
|
1861
|
+
}),
|
|
1862
|
+
z11.object({
|
|
1863
|
+
type: z11.literal("text_editor_code_execution_str_replace_result"),
|
|
1864
|
+
lines: z11.array(z11.string()).nullable(),
|
|
1865
|
+
new_lines: z11.number().nullable(),
|
|
1866
|
+
new_start: z11.number().nullable(),
|
|
1867
|
+
old_lines: z11.number().nullable(),
|
|
1868
|
+
old_start: z11.number().nullable()
|
|
1869
|
+
})
|
|
1870
|
+
])
|
|
1871
|
+
)
|
|
1872
|
+
);
|
|
1873
|
+
var codeExecution_20260120InputSchema = lazySchema10(
|
|
1874
|
+
() => zodSchema10(
|
|
1875
|
+
z11.discriminatedUnion("type", [
|
|
1876
|
+
z11.object({
|
|
1877
|
+
type: z11.literal("programmatic-tool-call"),
|
|
1878
|
+
code: z11.string()
|
|
1879
|
+
}),
|
|
1880
|
+
z11.object({
|
|
1881
|
+
type: z11.literal("bash_code_execution"),
|
|
1882
|
+
command: z11.string()
|
|
1883
|
+
}),
|
|
1884
|
+
z11.discriminatedUnion("command", [
|
|
1885
|
+
z11.object({
|
|
1886
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1887
|
+
command: z11.literal("view"),
|
|
1888
|
+
path: z11.string()
|
|
1889
|
+
}),
|
|
1890
|
+
z11.object({
|
|
1891
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1892
|
+
command: z11.literal("create"),
|
|
1893
|
+
path: z11.string(),
|
|
1894
|
+
file_text: z11.string().nullish()
|
|
1895
|
+
}),
|
|
1896
|
+
z11.object({
|
|
1897
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1898
|
+
command: z11.literal("str_replace"),
|
|
1899
|
+
path: z11.string(),
|
|
1900
|
+
old_str: z11.string(),
|
|
1901
|
+
new_str: z11.string()
|
|
1902
|
+
})
|
|
1903
|
+
])
|
|
1904
|
+
])
|
|
1905
|
+
)
|
|
1906
|
+
);
|
|
1907
|
+
var factory8 = createProviderToolFactoryWithOutputSchema7({
|
|
1908
|
+
id: "anthropic.code_execution_20260120",
|
|
1909
|
+
inputSchema: codeExecution_20260120InputSchema,
|
|
1910
|
+
outputSchema: codeExecution_20260120OutputSchema,
|
|
1911
|
+
supportsDeferredResults: true
|
|
1912
|
+
});
|
|
1913
|
+
var codeExecution_20260120 = (args = {}) => {
|
|
1914
|
+
return factory8(args);
|
|
1603
1915
|
};
|
|
1604
1916
|
|
|
1605
1917
|
// src/tool/tool-search-regex_20251119.ts
|
|
1606
1918
|
import {
|
|
1607
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1608
|
-
lazySchema as
|
|
1609
|
-
zodSchema as
|
|
1919
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
1920
|
+
lazySchema as lazySchema11,
|
|
1921
|
+
zodSchema as zodSchema11
|
|
1610
1922
|
} from "@ai-sdk/provider-utils";
|
|
1611
|
-
import { z as
|
|
1612
|
-
var toolSearchRegex_20251119OutputSchema =
|
|
1613
|
-
() =>
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
type:
|
|
1617
|
-
toolName:
|
|
1923
|
+
import { z as z12 } from "zod/v4";
|
|
1924
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema11(
|
|
1925
|
+
() => zodSchema11(
|
|
1926
|
+
z12.array(
|
|
1927
|
+
z12.object({
|
|
1928
|
+
type: z12.literal("tool_reference"),
|
|
1929
|
+
toolName: z12.string()
|
|
1618
1930
|
})
|
|
1619
1931
|
)
|
|
1620
1932
|
)
|
|
1621
1933
|
);
|
|
1622
|
-
var toolSearchRegex_20251119InputSchema =
|
|
1623
|
-
() =>
|
|
1624
|
-
|
|
1934
|
+
var toolSearchRegex_20251119InputSchema = lazySchema11(
|
|
1935
|
+
() => zodSchema11(
|
|
1936
|
+
z12.object({
|
|
1625
1937
|
/**
|
|
1626
1938
|
* A regex pattern to search for tools.
|
|
1627
1939
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -1632,22 +1944,22 @@ var toolSearchRegex_20251119InputSchema = lazySchema8(
|
|
|
1632
1944
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1633
1945
|
* - "(?i)slack" - case-insensitive search
|
|
1634
1946
|
*/
|
|
1635
|
-
pattern:
|
|
1947
|
+
pattern: z12.string(),
|
|
1636
1948
|
/**
|
|
1637
1949
|
* Maximum number of tools to return. Optional.
|
|
1638
1950
|
*/
|
|
1639
|
-
limit:
|
|
1951
|
+
limit: z12.number().optional()
|
|
1640
1952
|
})
|
|
1641
1953
|
)
|
|
1642
1954
|
);
|
|
1643
|
-
var
|
|
1955
|
+
var factory9 = createProviderToolFactoryWithOutputSchema8({
|
|
1644
1956
|
id: "anthropic.tool_search_regex_20251119",
|
|
1645
1957
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
1646
1958
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
1647
1959
|
supportsDeferredResults: true
|
|
1648
1960
|
});
|
|
1649
1961
|
var toolSearchRegex_20251119 = (args = {}) => {
|
|
1650
|
-
return
|
|
1962
|
+
return factory9(args);
|
|
1651
1963
|
};
|
|
1652
1964
|
|
|
1653
1965
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
@@ -1683,7 +1995,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1683
1995
|
cacheControlValidator,
|
|
1684
1996
|
toolNameMapping
|
|
1685
1997
|
}) {
|
|
1686
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
1998
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
1687
1999
|
const betas = /* @__PURE__ */ new Set();
|
|
1688
2000
|
const blocks = groupIntoBlocks(prompt);
|
|
1689
2001
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -2221,6 +2533,25 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2221
2533
|
},
|
|
2222
2534
|
cache_control: cacheControl
|
|
2223
2535
|
});
|
|
2536
|
+
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
2537
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2538
|
+
value: output.value,
|
|
2539
|
+
schema: codeExecution_20260120OutputSchema
|
|
2540
|
+
});
|
|
2541
|
+
if (codeExecutionOutput.type === "encrypted_code_execution_result") {
|
|
2542
|
+
anthropicContent.push({
|
|
2543
|
+
type: "code_execution_tool_result",
|
|
2544
|
+
tool_use_id: part.toolCallId,
|
|
2545
|
+
content: {
|
|
2546
|
+
type: codeExecutionOutput.type,
|
|
2547
|
+
encrypted_stdout: codeExecutionOutput.encrypted_stdout,
|
|
2548
|
+
stderr: codeExecutionOutput.stderr,
|
|
2549
|
+
return_code: codeExecutionOutput.return_code,
|
|
2550
|
+
content: (_p = codeExecutionOutput.content) != null ? _p : []
|
|
2551
|
+
},
|
|
2552
|
+
cache_control: cacheControl
|
|
2553
|
+
});
|
|
2554
|
+
}
|
|
2224
2555
|
} else {
|
|
2225
2556
|
const codeExecutionOutput = await validateTypes2({
|
|
2226
2557
|
value: output.value,
|
|
@@ -2235,7 +2566,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2235
2566
|
stdout: codeExecutionOutput.stdout,
|
|
2236
2567
|
stderr: codeExecutionOutput.stderr,
|
|
2237
2568
|
return_code: codeExecutionOutput.return_code,
|
|
2238
|
-
content: (
|
|
2569
|
+
content: (_q = codeExecutionOutput.content) != null ? _q : []
|
|
2239
2570
|
},
|
|
2240
2571
|
cache_control: cacheControl
|
|
2241
2572
|
});
|
|
@@ -2268,7 +2599,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2268
2599
|
errorValue = output.value;
|
|
2269
2600
|
}
|
|
2270
2601
|
} catch (e) {
|
|
2271
|
-
const extractedErrorCode = (
|
|
2602
|
+
const extractedErrorCode = (_r = output.value) == null ? void 0 : _r.errorCode;
|
|
2272
2603
|
errorValue = {
|
|
2273
2604
|
errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unknown"
|
|
2274
2605
|
};
|
|
@@ -2278,7 +2609,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2278
2609
|
tool_use_id: part.toolCallId,
|
|
2279
2610
|
content: {
|
|
2280
2611
|
type: "web_fetch_tool_result_error",
|
|
2281
|
-
error_code: (
|
|
2612
|
+
error_code: (_s = errorValue.errorCode) != null ? _s : "unknown"
|
|
2282
2613
|
},
|
|
2283
2614
|
cache_control: cacheControl
|
|
2284
2615
|
});
|
|
@@ -2639,7 +2970,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2639
2970
|
"anthropic.bash_20250124": "bash",
|
|
2640
2971
|
"anthropic.memory_20250818": "memory",
|
|
2641
2972
|
"anthropic.web_search_20250305": "web_search",
|
|
2973
|
+
"anthropic.web_search_20260209": "web_search",
|
|
2642
2974
|
"anthropic.web_fetch_20250910": "web_fetch",
|
|
2975
|
+
"anthropic.web_fetch_20260209": "web_fetch",
|
|
2643
2976
|
"anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
|
|
2644
2977
|
"anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
|
|
2645
2978
|
}
|
|
@@ -2954,7 +3287,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2954
3287
|
});
|
|
2955
3288
|
}
|
|
2956
3289
|
async doGenerate(options) {
|
|
2957
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3290
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2958
3291
|
const {
|
|
2959
3292
|
args,
|
|
2960
3293
|
warnings,
|
|
@@ -2971,6 +3304,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2971
3304
|
const citationDocuments = [
|
|
2972
3305
|
...this.extractCitationDocuments(options.prompt)
|
|
2973
3306
|
];
|
|
3307
|
+
const markCodeExecutionDynamic = hasWebTool20260209WithoutCodeExecution(
|
|
3308
|
+
args.tools
|
|
3309
|
+
);
|
|
2974
3310
|
const {
|
|
2975
3311
|
responseHeaders,
|
|
2976
3312
|
value: response,
|
|
@@ -3092,7 +3428,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3092
3428
|
toolCallId: part.id,
|
|
3093
3429
|
toolName: toolNameMapping.toCustomToolName(part.name),
|
|
3094
3430
|
input: JSON.stringify(inputToSerialize),
|
|
3095
|
-
providerExecuted: true
|
|
3431
|
+
providerExecuted: true,
|
|
3432
|
+
// We want this 'code_execution' tool call to be allowed even if the tool is not explicitly provided.
|
|
3433
|
+
// Since the validation generally bypasses dynamic tools, we mark this specific tool as dynamic.
|
|
3434
|
+
...markCodeExecutionDynamic && part.name === "code_execution" ? { dynamic: true } : {}
|
|
3096
3435
|
});
|
|
3097
3436
|
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
3098
3437
|
serverToolCalls[part.id] = part.name;
|
|
@@ -3236,6 +3575,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3236
3575
|
content: (_c = part.content.content) != null ? _c : []
|
|
3237
3576
|
}
|
|
3238
3577
|
});
|
|
3578
|
+
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
3579
|
+
content.push({
|
|
3580
|
+
type: "tool-result",
|
|
3581
|
+
toolCallId: part.tool_use_id,
|
|
3582
|
+
toolName: toolNameMapping.toCustomToolName("code_execution"),
|
|
3583
|
+
result: {
|
|
3584
|
+
type: part.content.type,
|
|
3585
|
+
encrypted_stdout: part.content.encrypted_stdout,
|
|
3586
|
+
stderr: part.content.stderr,
|
|
3587
|
+
return_code: part.content.return_code,
|
|
3588
|
+
content: (_d = part.content.content) != null ? _d : []
|
|
3589
|
+
}
|
|
3590
|
+
});
|
|
3239
3591
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
3240
3592
|
content.push({
|
|
3241
3593
|
type: "tool-result",
|
|
@@ -3312,13 +3664,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3312
3664
|
finishReason: response.stop_reason,
|
|
3313
3665
|
isJsonResponseFromTool
|
|
3314
3666
|
}),
|
|
3315
|
-
raw: (
|
|
3667
|
+
raw: (_e = response.stop_reason) != null ? _e : void 0
|
|
3316
3668
|
},
|
|
3317
3669
|
usage: convertAnthropicMessagesUsage({ usage: response.usage }),
|
|
3318
3670
|
request: { body: args },
|
|
3319
3671
|
response: {
|
|
3320
|
-
id: (
|
|
3321
|
-
modelId: (
|
|
3672
|
+
id: (_f = response.id) != null ? _f : void 0,
|
|
3673
|
+
modelId: (_g = response.model) != null ? _g : void 0,
|
|
3322
3674
|
headers: responseHeaders,
|
|
3323
3675
|
body: rawResponse
|
|
3324
3676
|
},
|
|
@@ -3375,6 +3727,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3375
3727
|
const citationDocuments = [
|
|
3376
3728
|
...this.extractCitationDocuments(options.prompt)
|
|
3377
3729
|
];
|
|
3730
|
+
const markCodeExecutionDynamic = hasWebTool20260209WithoutCodeExecution(
|
|
3731
|
+
body.tools
|
|
3732
|
+
);
|
|
3378
3733
|
const url = this.buildRequestUrl(true);
|
|
3379
3734
|
const { responseHeaders, value: response } = await postJsonToApi({
|
|
3380
3735
|
url,
|
|
@@ -3415,7 +3770,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3415
3770
|
controller.enqueue({ type: "stream-start", warnings });
|
|
3416
3771
|
},
|
|
3417
3772
|
transform(chunk, controller) {
|
|
3418
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
3773
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3419
3774
|
if (options.includeRawChunks) {
|
|
3420
3775
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
3421
3776
|
}
|
|
@@ -3524,12 +3879,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3524
3879
|
].includes(part.name)) {
|
|
3525
3880
|
const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
|
|
3526
3881
|
const customToolName = toolNameMapping.toCustomToolName(providerToolName);
|
|
3882
|
+
const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
|
|
3527
3883
|
contentBlocks[value.index] = {
|
|
3528
3884
|
type: "tool-call",
|
|
3529
3885
|
toolCallId: part.id,
|
|
3530
3886
|
toolName: customToolName,
|
|
3531
|
-
input:
|
|
3887
|
+
input: finalInput,
|
|
3532
3888
|
providerExecuted: true,
|
|
3889
|
+
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
3533
3890
|
firstDelta: true,
|
|
3534
3891
|
providerToolName: part.name
|
|
3535
3892
|
};
|
|
@@ -3537,7 +3894,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3537
3894
|
type: "tool-input-start",
|
|
3538
3895
|
id: part.id,
|
|
3539
3896
|
toolName: customToolName,
|
|
3540
|
-
providerExecuted: true
|
|
3897
|
+
providerExecuted: true,
|
|
3898
|
+
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {}
|
|
3541
3899
|
});
|
|
3542
3900
|
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
3543
3901
|
serverToolCalls[part.id] = part.name;
|
|
@@ -3662,6 +4020,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3662
4020
|
content: (_c = part.content.content) != null ? _c : []
|
|
3663
4021
|
}
|
|
3664
4022
|
});
|
|
4023
|
+
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
4024
|
+
controller.enqueue({
|
|
4025
|
+
type: "tool-result",
|
|
4026
|
+
toolCallId: part.tool_use_id,
|
|
4027
|
+
toolName: toolNameMapping.toCustomToolName("code_execution"),
|
|
4028
|
+
result: {
|
|
4029
|
+
type: part.content.type,
|
|
4030
|
+
encrypted_stdout: part.content.encrypted_stdout,
|
|
4031
|
+
stderr: part.content.stderr,
|
|
4032
|
+
return_code: part.content.return_code,
|
|
4033
|
+
content: (_d = part.content.content) != null ? _d : []
|
|
4034
|
+
}
|
|
4035
|
+
});
|
|
3665
4036
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
3666
4037
|
controller.enqueue({
|
|
3667
4038
|
type: "tool-result",
|
|
@@ -3811,6 +4182,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3811
4182
|
toolName: contentBlock.toolName,
|
|
3812
4183
|
input: finalInput,
|
|
3813
4184
|
providerExecuted: contentBlock.providerExecuted,
|
|
4185
|
+
...markCodeExecutionDynamic && contentBlock.providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
3814
4186
|
...contentBlock.caller && {
|
|
3815
4187
|
providerMetadata: {
|
|
3816
4188
|
anthropic: {
|
|
@@ -3928,12 +4300,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3928
4300
|
}
|
|
3929
4301
|
case "message_start": {
|
|
3930
4302
|
usage.input_tokens = value.message.usage.input_tokens;
|
|
3931
|
-
usage.cache_read_input_tokens = (
|
|
3932
|
-
usage.cache_creation_input_tokens = (
|
|
4303
|
+
usage.cache_read_input_tokens = (_e = value.message.usage.cache_read_input_tokens) != null ? _e : 0;
|
|
4304
|
+
usage.cache_creation_input_tokens = (_f = value.message.usage.cache_creation_input_tokens) != null ? _f : 0;
|
|
3933
4305
|
rawUsage = {
|
|
3934
4306
|
...value.message.usage
|
|
3935
4307
|
};
|
|
3936
|
-
cacheCreationInputTokens = (
|
|
4308
|
+
cacheCreationInputTokens = (_g = value.message.usage.cache_creation_input_tokens) != null ? _g : null;
|
|
3937
4309
|
if (value.message.container != null) {
|
|
3938
4310
|
container = {
|
|
3939
4311
|
expiresAt: value.message.container.expires_at,
|
|
@@ -3952,8 +4324,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3952
4324
|
}
|
|
3953
4325
|
controller.enqueue({
|
|
3954
4326
|
type: "response-metadata",
|
|
3955
|
-
id: (
|
|
3956
|
-
modelId: (
|
|
4327
|
+
id: (_h = value.message.id) != null ? _h : void 0,
|
|
4328
|
+
modelId: (_i = value.message.model) != null ? _i : void 0
|
|
3957
4329
|
});
|
|
3958
4330
|
if (value.message.content != null) {
|
|
3959
4331
|
for (let contentIndex = 0; contentIndex < value.message.content.length; contentIndex++) {
|
|
@@ -3969,7 +4341,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3969
4341
|
id: part.id,
|
|
3970
4342
|
toolName: part.name
|
|
3971
4343
|
});
|
|
3972
|
-
const inputStr = JSON.stringify((
|
|
4344
|
+
const inputStr = JSON.stringify((_j = part.input) != null ? _j : {});
|
|
3973
4345
|
controller.enqueue({
|
|
3974
4346
|
type: "tool-input-delta",
|
|
3975
4347
|
id: part.id,
|
|
@@ -4017,17 +4389,17 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4017
4389
|
finishReason: value.delta.stop_reason,
|
|
4018
4390
|
isJsonResponseFromTool
|
|
4019
4391
|
}),
|
|
4020
|
-
raw: (
|
|
4392
|
+
raw: (_k = value.delta.stop_reason) != null ? _k : void 0
|
|
4021
4393
|
};
|
|
4022
|
-
stopSequence = (
|
|
4394
|
+
stopSequence = (_l = value.delta.stop_sequence) != null ? _l : null;
|
|
4023
4395
|
container = value.delta.container != null ? {
|
|
4024
4396
|
expiresAt: value.delta.container.expires_at,
|
|
4025
4397
|
id: value.delta.container.id,
|
|
4026
|
-
skills: (
|
|
4398
|
+
skills: (_n = (_m = value.delta.container.skills) == null ? void 0 : _m.map((skill) => ({
|
|
4027
4399
|
type: skill.type,
|
|
4028
4400
|
skillId: skill.skill_id,
|
|
4029
4401
|
version: skill.version
|
|
4030
|
-
}))) != null ?
|
|
4402
|
+
}))) != null ? _n : null
|
|
4031
4403
|
} : null;
|
|
4032
4404
|
if (value.context_management) {
|
|
4033
4405
|
contextManagement = mapAnthropicResponseContextManagement(
|
|
@@ -4156,6 +4528,24 @@ function getModelCapabilities(modelId) {
|
|
|
4156
4528
|
};
|
|
4157
4529
|
}
|
|
4158
4530
|
}
|
|
4531
|
+
function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
4532
|
+
if (!tools) {
|
|
4533
|
+
return false;
|
|
4534
|
+
}
|
|
4535
|
+
let hasWebTool20260209 = false;
|
|
4536
|
+
let hasCodeExecutionTool = false;
|
|
4537
|
+
for (const tool of tools) {
|
|
4538
|
+
if ("type" in tool && (tool.type === "web_fetch_20260209" || tool.type === "web_search_20260209")) {
|
|
4539
|
+
hasWebTool20260209 = true;
|
|
4540
|
+
continue;
|
|
4541
|
+
}
|
|
4542
|
+
if (tool.name === "code_execution") {
|
|
4543
|
+
hasCodeExecutionTool = true;
|
|
4544
|
+
break;
|
|
4545
|
+
}
|
|
4546
|
+
}
|
|
4547
|
+
return hasWebTool20260209 && !hasCodeExecutionTool;
|
|
4548
|
+
}
|
|
4159
4549
|
function mapAnthropicResponseContextManagement(contextManagement) {
|
|
4160
4550
|
return contextManagement ? {
|
|
4161
4551
|
appliedEdits: contextManagement.applied_edits.map((edit) => {
|
|
@@ -4185,15 +4575,15 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4185
4575
|
// src/tool/bash_20241022.ts
|
|
4186
4576
|
import {
|
|
4187
4577
|
createProviderToolFactory as createProviderToolFactory2,
|
|
4188
|
-
lazySchema as
|
|
4189
|
-
zodSchema as
|
|
4578
|
+
lazySchema as lazySchema12,
|
|
4579
|
+
zodSchema as zodSchema12
|
|
4190
4580
|
} from "@ai-sdk/provider-utils";
|
|
4191
|
-
import { z as
|
|
4192
|
-
var bash_20241022InputSchema =
|
|
4193
|
-
() =>
|
|
4194
|
-
|
|
4195
|
-
command:
|
|
4196
|
-
restart:
|
|
4581
|
+
import { z as z13 } from "zod/v4";
|
|
4582
|
+
var bash_20241022InputSchema = lazySchema12(
|
|
4583
|
+
() => zodSchema12(
|
|
4584
|
+
z13.object({
|
|
4585
|
+
command: z13.string(),
|
|
4586
|
+
restart: z13.boolean().optional()
|
|
4197
4587
|
})
|
|
4198
4588
|
)
|
|
4199
4589
|
);
|
|
@@ -4205,15 +4595,15 @@ var bash_20241022 = createProviderToolFactory2({
|
|
|
4205
4595
|
// src/tool/bash_20250124.ts
|
|
4206
4596
|
import {
|
|
4207
4597
|
createProviderToolFactory as createProviderToolFactory3,
|
|
4208
|
-
lazySchema as
|
|
4209
|
-
zodSchema as
|
|
4598
|
+
lazySchema as lazySchema13,
|
|
4599
|
+
zodSchema as zodSchema13
|
|
4210
4600
|
} from "@ai-sdk/provider-utils";
|
|
4211
|
-
import { z as
|
|
4212
|
-
var bash_20250124InputSchema =
|
|
4213
|
-
() =>
|
|
4214
|
-
|
|
4215
|
-
command:
|
|
4216
|
-
restart:
|
|
4601
|
+
import { z as z14 } from "zod/v4";
|
|
4602
|
+
var bash_20250124InputSchema = lazySchema13(
|
|
4603
|
+
() => zodSchema13(
|
|
4604
|
+
z14.object({
|
|
4605
|
+
command: z14.string(),
|
|
4606
|
+
restart: z14.boolean().optional()
|
|
4217
4607
|
})
|
|
4218
4608
|
)
|
|
4219
4609
|
);
|
|
@@ -4222,126 +4612,17 @@ var bash_20250124 = createProviderToolFactory3({
|
|
|
4222
4612
|
inputSchema: bash_20250124InputSchema
|
|
4223
4613
|
});
|
|
4224
4614
|
|
|
4225
|
-
// src/tool/code-execution_20260120.ts
|
|
4226
|
-
import {
|
|
4227
|
-
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
4228
|
-
lazySchema as lazySchema11,
|
|
4229
|
-
zodSchema as zodSchema11
|
|
4230
|
-
} from "@ai-sdk/provider-utils";
|
|
4231
|
-
import { z as z12 } from "zod/v4";
|
|
4232
|
-
var codeExecution_20260120OutputSchema = lazySchema11(
|
|
4233
|
-
() => zodSchema11(
|
|
4234
|
-
z12.discriminatedUnion("type", [
|
|
4235
|
-
z12.object({
|
|
4236
|
-
type: z12.literal("code_execution_result"),
|
|
4237
|
-
stdout: z12.string(),
|
|
4238
|
-
stderr: z12.string(),
|
|
4239
|
-
return_code: z12.number(),
|
|
4240
|
-
content: z12.array(
|
|
4241
|
-
z12.object({
|
|
4242
|
-
type: z12.literal("code_execution_output"),
|
|
4243
|
-
file_id: z12.string()
|
|
4244
|
-
})
|
|
4245
|
-
).optional().default([])
|
|
4246
|
-
}),
|
|
4247
|
-
z12.object({
|
|
4248
|
-
type: z12.literal("bash_code_execution_result"),
|
|
4249
|
-
content: z12.array(
|
|
4250
|
-
z12.object({
|
|
4251
|
-
type: z12.literal("bash_code_execution_output"),
|
|
4252
|
-
file_id: z12.string()
|
|
4253
|
-
})
|
|
4254
|
-
),
|
|
4255
|
-
stdout: z12.string(),
|
|
4256
|
-
stderr: z12.string(),
|
|
4257
|
-
return_code: z12.number()
|
|
4258
|
-
}),
|
|
4259
|
-
z12.object({
|
|
4260
|
-
type: z12.literal("bash_code_execution_tool_result_error"),
|
|
4261
|
-
error_code: z12.string()
|
|
4262
|
-
}),
|
|
4263
|
-
z12.object({
|
|
4264
|
-
type: z12.literal("text_editor_code_execution_tool_result_error"),
|
|
4265
|
-
error_code: z12.string()
|
|
4266
|
-
}),
|
|
4267
|
-
z12.object({
|
|
4268
|
-
type: z12.literal("text_editor_code_execution_view_result"),
|
|
4269
|
-
content: z12.string(),
|
|
4270
|
-
file_type: z12.string(),
|
|
4271
|
-
num_lines: z12.number().nullable(),
|
|
4272
|
-
start_line: z12.number().nullable(),
|
|
4273
|
-
total_lines: z12.number().nullable()
|
|
4274
|
-
}),
|
|
4275
|
-
z12.object({
|
|
4276
|
-
type: z12.literal("text_editor_code_execution_create_result"),
|
|
4277
|
-
is_file_update: z12.boolean()
|
|
4278
|
-
}),
|
|
4279
|
-
z12.object({
|
|
4280
|
-
type: z12.literal("text_editor_code_execution_str_replace_result"),
|
|
4281
|
-
lines: z12.array(z12.string()).nullable(),
|
|
4282
|
-
new_lines: z12.number().nullable(),
|
|
4283
|
-
new_start: z12.number().nullable(),
|
|
4284
|
-
old_lines: z12.number().nullable(),
|
|
4285
|
-
old_start: z12.number().nullable()
|
|
4286
|
-
})
|
|
4287
|
-
])
|
|
4288
|
-
)
|
|
4289
|
-
);
|
|
4290
|
-
var codeExecution_20260120InputSchema = lazySchema11(
|
|
4291
|
-
() => zodSchema11(
|
|
4292
|
-
z12.discriminatedUnion("type", [
|
|
4293
|
-
z12.object({
|
|
4294
|
-
type: z12.literal("programmatic-tool-call"),
|
|
4295
|
-
code: z12.string()
|
|
4296
|
-
}),
|
|
4297
|
-
z12.object({
|
|
4298
|
-
type: z12.literal("bash_code_execution"),
|
|
4299
|
-
command: z12.string()
|
|
4300
|
-
}),
|
|
4301
|
-
z12.discriminatedUnion("command", [
|
|
4302
|
-
z12.object({
|
|
4303
|
-
type: z12.literal("text_editor_code_execution"),
|
|
4304
|
-
command: z12.literal("view"),
|
|
4305
|
-
path: z12.string()
|
|
4306
|
-
}),
|
|
4307
|
-
z12.object({
|
|
4308
|
-
type: z12.literal("text_editor_code_execution"),
|
|
4309
|
-
command: z12.literal("create"),
|
|
4310
|
-
path: z12.string(),
|
|
4311
|
-
file_text: z12.string().nullish()
|
|
4312
|
-
}),
|
|
4313
|
-
z12.object({
|
|
4314
|
-
type: z12.literal("text_editor_code_execution"),
|
|
4315
|
-
command: z12.literal("str_replace"),
|
|
4316
|
-
path: z12.string(),
|
|
4317
|
-
old_str: z12.string(),
|
|
4318
|
-
new_str: z12.string()
|
|
4319
|
-
})
|
|
4320
|
-
])
|
|
4321
|
-
])
|
|
4322
|
-
)
|
|
4323
|
-
);
|
|
4324
|
-
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
4325
|
-
id: "anthropic.code_execution_20260120",
|
|
4326
|
-
inputSchema: codeExecution_20260120InputSchema,
|
|
4327
|
-
outputSchema: codeExecution_20260120OutputSchema,
|
|
4328
|
-
supportsDeferredResults: true
|
|
4329
|
-
});
|
|
4330
|
-
var codeExecution_20260120 = (args = {}) => {
|
|
4331
|
-
return factory7(args);
|
|
4332
|
-
};
|
|
4333
|
-
|
|
4334
4615
|
// src/tool/computer_20241022.ts
|
|
4335
4616
|
import {
|
|
4336
4617
|
createProviderToolFactory as createProviderToolFactory4,
|
|
4337
|
-
lazySchema as
|
|
4338
|
-
zodSchema as
|
|
4618
|
+
lazySchema as lazySchema14,
|
|
4619
|
+
zodSchema as zodSchema14
|
|
4339
4620
|
} from "@ai-sdk/provider-utils";
|
|
4340
|
-
import { z as
|
|
4341
|
-
var computer_20241022InputSchema =
|
|
4342
|
-
() =>
|
|
4343
|
-
|
|
4344
|
-
action:
|
|
4621
|
+
import { z as z15 } from "zod/v4";
|
|
4622
|
+
var computer_20241022InputSchema = lazySchema14(
|
|
4623
|
+
() => zodSchema14(
|
|
4624
|
+
z15.object({
|
|
4625
|
+
action: z15.enum([
|
|
4345
4626
|
"key",
|
|
4346
4627
|
"type",
|
|
4347
4628
|
"mouse_move",
|
|
@@ -4353,8 +4634,8 @@ var computer_20241022InputSchema = lazySchema12(
|
|
|
4353
4634
|
"screenshot",
|
|
4354
4635
|
"cursor_position"
|
|
4355
4636
|
]),
|
|
4356
|
-
coordinate:
|
|
4357
|
-
text:
|
|
4637
|
+
coordinate: z15.array(z15.number().int()).optional(),
|
|
4638
|
+
text: z15.string().optional()
|
|
4358
4639
|
})
|
|
4359
4640
|
)
|
|
4360
4641
|
);
|
|
@@ -4366,14 +4647,14 @@ var computer_20241022 = createProviderToolFactory4({
|
|
|
4366
4647
|
// src/tool/computer_20250124.ts
|
|
4367
4648
|
import {
|
|
4368
4649
|
createProviderToolFactory as createProviderToolFactory5,
|
|
4369
|
-
lazySchema as
|
|
4370
|
-
zodSchema as
|
|
4650
|
+
lazySchema as lazySchema15,
|
|
4651
|
+
zodSchema as zodSchema15
|
|
4371
4652
|
} from "@ai-sdk/provider-utils";
|
|
4372
|
-
import { z as
|
|
4373
|
-
var computer_20250124InputSchema =
|
|
4374
|
-
() =>
|
|
4375
|
-
|
|
4376
|
-
action:
|
|
4653
|
+
import { z as z16 } from "zod/v4";
|
|
4654
|
+
var computer_20250124InputSchema = lazySchema15(
|
|
4655
|
+
() => zodSchema15(
|
|
4656
|
+
z16.object({
|
|
4657
|
+
action: z16.enum([
|
|
4377
4658
|
"key",
|
|
4378
4659
|
"hold_key",
|
|
4379
4660
|
"type",
|
|
@@ -4391,12 +4672,12 @@ var computer_20250124InputSchema = lazySchema13(
|
|
|
4391
4672
|
"wait",
|
|
4392
4673
|
"screenshot"
|
|
4393
4674
|
]),
|
|
4394
|
-
coordinate:
|
|
4395
|
-
duration:
|
|
4396
|
-
scroll_amount:
|
|
4397
|
-
scroll_direction:
|
|
4398
|
-
start_coordinate:
|
|
4399
|
-
text:
|
|
4675
|
+
coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
|
|
4676
|
+
duration: z16.number().optional(),
|
|
4677
|
+
scroll_amount: z16.number().optional(),
|
|
4678
|
+
scroll_direction: z16.enum(["up", "down", "left", "right"]).optional(),
|
|
4679
|
+
start_coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
|
|
4680
|
+
text: z16.string().optional()
|
|
4400
4681
|
})
|
|
4401
4682
|
)
|
|
4402
4683
|
);
|
|
@@ -4408,14 +4689,14 @@ var computer_20250124 = createProviderToolFactory5({
|
|
|
4408
4689
|
// src/tool/computer_20251124.ts
|
|
4409
4690
|
import {
|
|
4410
4691
|
createProviderToolFactory as createProviderToolFactory6,
|
|
4411
|
-
lazySchema as
|
|
4412
|
-
zodSchema as
|
|
4692
|
+
lazySchema as lazySchema16,
|
|
4693
|
+
zodSchema as zodSchema16
|
|
4413
4694
|
} from "@ai-sdk/provider-utils";
|
|
4414
|
-
import { z as
|
|
4415
|
-
var computer_20251124InputSchema =
|
|
4416
|
-
() =>
|
|
4417
|
-
|
|
4418
|
-
action:
|
|
4695
|
+
import { z as z17 } from "zod/v4";
|
|
4696
|
+
var computer_20251124InputSchema = lazySchema16(
|
|
4697
|
+
() => zodSchema16(
|
|
4698
|
+
z17.object({
|
|
4699
|
+
action: z17.enum([
|
|
4419
4700
|
"key",
|
|
4420
4701
|
"hold_key",
|
|
4421
4702
|
"type",
|
|
@@ -4434,18 +4715,18 @@ var computer_20251124InputSchema = lazySchema14(
|
|
|
4434
4715
|
"screenshot",
|
|
4435
4716
|
"zoom"
|
|
4436
4717
|
]),
|
|
4437
|
-
coordinate:
|
|
4438
|
-
duration:
|
|
4439
|
-
region:
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4718
|
+
coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4719
|
+
duration: z17.number().optional(),
|
|
4720
|
+
region: z17.tuple([
|
|
4721
|
+
z17.number().int(),
|
|
4722
|
+
z17.number().int(),
|
|
4723
|
+
z17.number().int(),
|
|
4724
|
+
z17.number().int()
|
|
4444
4725
|
]).optional(),
|
|
4445
|
-
scroll_amount:
|
|
4446
|
-
scroll_direction:
|
|
4447
|
-
start_coordinate:
|
|
4448
|
-
text:
|
|
4726
|
+
scroll_amount: z17.number().optional(),
|
|
4727
|
+
scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
|
|
4728
|
+
start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4729
|
+
text: z17.string().optional()
|
|
4449
4730
|
})
|
|
4450
4731
|
)
|
|
4451
4732
|
);
|
|
@@ -4457,43 +4738,43 @@ var computer_20251124 = createProviderToolFactory6({
|
|
|
4457
4738
|
// src/tool/memory_20250818.ts
|
|
4458
4739
|
import {
|
|
4459
4740
|
createProviderToolFactory as createProviderToolFactory7,
|
|
4460
|
-
lazySchema as
|
|
4461
|
-
zodSchema as
|
|
4741
|
+
lazySchema as lazySchema17,
|
|
4742
|
+
zodSchema as zodSchema17
|
|
4462
4743
|
} from "@ai-sdk/provider-utils";
|
|
4463
|
-
import { z as
|
|
4464
|
-
var memory_20250818InputSchema =
|
|
4465
|
-
() =>
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
command:
|
|
4469
|
-
path:
|
|
4470
|
-
view_range:
|
|
4744
|
+
import { z as z18 } from "zod/v4";
|
|
4745
|
+
var memory_20250818InputSchema = lazySchema17(
|
|
4746
|
+
() => zodSchema17(
|
|
4747
|
+
z18.discriminatedUnion("command", [
|
|
4748
|
+
z18.object({
|
|
4749
|
+
command: z18.literal("view"),
|
|
4750
|
+
path: z18.string(),
|
|
4751
|
+
view_range: z18.tuple([z18.number(), z18.number()]).optional()
|
|
4471
4752
|
}),
|
|
4472
|
-
|
|
4473
|
-
command:
|
|
4474
|
-
path:
|
|
4475
|
-
file_text:
|
|
4753
|
+
z18.object({
|
|
4754
|
+
command: z18.literal("create"),
|
|
4755
|
+
path: z18.string(),
|
|
4756
|
+
file_text: z18.string()
|
|
4476
4757
|
}),
|
|
4477
|
-
|
|
4478
|
-
command:
|
|
4479
|
-
path:
|
|
4480
|
-
old_str:
|
|
4481
|
-
new_str:
|
|
4758
|
+
z18.object({
|
|
4759
|
+
command: z18.literal("str_replace"),
|
|
4760
|
+
path: z18.string(),
|
|
4761
|
+
old_str: z18.string(),
|
|
4762
|
+
new_str: z18.string()
|
|
4482
4763
|
}),
|
|
4483
|
-
|
|
4484
|
-
command:
|
|
4485
|
-
path:
|
|
4486
|
-
insert_line:
|
|
4487
|
-
insert_text:
|
|
4764
|
+
z18.object({
|
|
4765
|
+
command: z18.literal("insert"),
|
|
4766
|
+
path: z18.string(),
|
|
4767
|
+
insert_line: z18.number(),
|
|
4768
|
+
insert_text: z18.string()
|
|
4488
4769
|
}),
|
|
4489
|
-
|
|
4490
|
-
command:
|
|
4491
|
-
path:
|
|
4770
|
+
z18.object({
|
|
4771
|
+
command: z18.literal("delete"),
|
|
4772
|
+
path: z18.string()
|
|
4492
4773
|
}),
|
|
4493
|
-
|
|
4494
|
-
command:
|
|
4495
|
-
old_path:
|
|
4496
|
-
new_path:
|
|
4774
|
+
z18.object({
|
|
4775
|
+
command: z18.literal("rename"),
|
|
4776
|
+
old_path: z18.string(),
|
|
4777
|
+
new_path: z18.string()
|
|
4497
4778
|
})
|
|
4498
4779
|
])
|
|
4499
4780
|
)
|
|
@@ -4506,21 +4787,21 @@ var memory_20250818 = createProviderToolFactory7({
|
|
|
4506
4787
|
// src/tool/text-editor_20241022.ts
|
|
4507
4788
|
import {
|
|
4508
4789
|
createProviderToolFactory as createProviderToolFactory8,
|
|
4509
|
-
lazySchema as
|
|
4510
|
-
zodSchema as
|
|
4790
|
+
lazySchema as lazySchema18,
|
|
4791
|
+
zodSchema as zodSchema18
|
|
4511
4792
|
} from "@ai-sdk/provider-utils";
|
|
4512
|
-
import { z as
|
|
4513
|
-
var textEditor_20241022InputSchema =
|
|
4514
|
-
() =>
|
|
4515
|
-
|
|
4516
|
-
command:
|
|
4517
|
-
path:
|
|
4518
|
-
file_text:
|
|
4519
|
-
insert_line:
|
|
4520
|
-
new_str:
|
|
4521
|
-
insert_text:
|
|
4522
|
-
old_str:
|
|
4523
|
-
view_range:
|
|
4793
|
+
import { z as z19 } from "zod/v4";
|
|
4794
|
+
var textEditor_20241022InputSchema = lazySchema18(
|
|
4795
|
+
() => zodSchema18(
|
|
4796
|
+
z19.object({
|
|
4797
|
+
command: z19.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4798
|
+
path: z19.string(),
|
|
4799
|
+
file_text: z19.string().optional(),
|
|
4800
|
+
insert_line: z19.number().int().optional(),
|
|
4801
|
+
new_str: z19.string().optional(),
|
|
4802
|
+
insert_text: z19.string().optional(),
|
|
4803
|
+
old_str: z19.string().optional(),
|
|
4804
|
+
view_range: z19.array(z19.number().int()).optional()
|
|
4524
4805
|
})
|
|
4525
4806
|
)
|
|
4526
4807
|
);
|
|
@@ -4532,21 +4813,21 @@ var textEditor_20241022 = createProviderToolFactory8({
|
|
|
4532
4813
|
// src/tool/text-editor_20250124.ts
|
|
4533
4814
|
import {
|
|
4534
4815
|
createProviderToolFactory as createProviderToolFactory9,
|
|
4535
|
-
lazySchema as
|
|
4536
|
-
zodSchema as
|
|
4816
|
+
lazySchema as lazySchema19,
|
|
4817
|
+
zodSchema as zodSchema19
|
|
4537
4818
|
} from "@ai-sdk/provider-utils";
|
|
4538
|
-
import { z as
|
|
4539
|
-
var textEditor_20250124InputSchema =
|
|
4540
|
-
() =>
|
|
4541
|
-
|
|
4542
|
-
command:
|
|
4543
|
-
path:
|
|
4544
|
-
file_text:
|
|
4545
|
-
insert_line:
|
|
4546
|
-
new_str:
|
|
4547
|
-
insert_text:
|
|
4548
|
-
old_str:
|
|
4549
|
-
view_range:
|
|
4819
|
+
import { z as z20 } from "zod/v4";
|
|
4820
|
+
var textEditor_20250124InputSchema = lazySchema19(
|
|
4821
|
+
() => zodSchema19(
|
|
4822
|
+
z20.object({
|
|
4823
|
+
command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4824
|
+
path: z20.string(),
|
|
4825
|
+
file_text: z20.string().optional(),
|
|
4826
|
+
insert_line: z20.number().int().optional(),
|
|
4827
|
+
new_str: z20.string().optional(),
|
|
4828
|
+
insert_text: z20.string().optional(),
|
|
4829
|
+
old_str: z20.string().optional(),
|
|
4830
|
+
view_range: z20.array(z20.number().int()).optional()
|
|
4550
4831
|
})
|
|
4551
4832
|
)
|
|
4552
4833
|
);
|
|
@@ -4558,21 +4839,21 @@ var textEditor_20250124 = createProviderToolFactory9({
|
|
|
4558
4839
|
// src/tool/text-editor_20250429.ts
|
|
4559
4840
|
import {
|
|
4560
4841
|
createProviderToolFactory as createProviderToolFactory10,
|
|
4561
|
-
lazySchema as
|
|
4562
|
-
zodSchema as
|
|
4842
|
+
lazySchema as lazySchema20,
|
|
4843
|
+
zodSchema as zodSchema20
|
|
4563
4844
|
} from "@ai-sdk/provider-utils";
|
|
4564
|
-
import { z as
|
|
4565
|
-
var textEditor_20250429InputSchema =
|
|
4566
|
-
() =>
|
|
4567
|
-
|
|
4568
|
-
command:
|
|
4569
|
-
path:
|
|
4570
|
-
file_text:
|
|
4571
|
-
insert_line:
|
|
4572
|
-
new_str:
|
|
4573
|
-
insert_text:
|
|
4574
|
-
old_str:
|
|
4575
|
-
view_range:
|
|
4845
|
+
import { z as z21 } from "zod/v4";
|
|
4846
|
+
var textEditor_20250429InputSchema = lazySchema20(
|
|
4847
|
+
() => zodSchema20(
|
|
4848
|
+
z21.object({
|
|
4849
|
+
command: z21.enum(["view", "create", "str_replace", "insert"]),
|
|
4850
|
+
path: z21.string(),
|
|
4851
|
+
file_text: z21.string().optional(),
|
|
4852
|
+
insert_line: z21.number().int().optional(),
|
|
4853
|
+
new_str: z21.string().optional(),
|
|
4854
|
+
insert_text: z21.string().optional(),
|
|
4855
|
+
old_str: z21.string().optional(),
|
|
4856
|
+
view_range: z21.array(z21.number().int()).optional()
|
|
4576
4857
|
})
|
|
4577
4858
|
)
|
|
4578
4859
|
);
|
|
@@ -4583,44 +4864,44 @@ var textEditor_20250429 = createProviderToolFactory10({
|
|
|
4583
4864
|
|
|
4584
4865
|
// src/tool/tool-search-bm25_20251119.ts
|
|
4585
4866
|
import {
|
|
4586
|
-
createProviderToolFactoryWithOutputSchema as
|
|
4587
|
-
lazySchema as
|
|
4588
|
-
zodSchema as
|
|
4867
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
4868
|
+
lazySchema as lazySchema21,
|
|
4869
|
+
zodSchema as zodSchema21
|
|
4589
4870
|
} from "@ai-sdk/provider-utils";
|
|
4590
|
-
import { z as
|
|
4591
|
-
var toolSearchBm25_20251119OutputSchema =
|
|
4592
|
-
() =>
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
type:
|
|
4596
|
-
toolName:
|
|
4871
|
+
import { z as z22 } from "zod/v4";
|
|
4872
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema21(
|
|
4873
|
+
() => zodSchema21(
|
|
4874
|
+
z22.array(
|
|
4875
|
+
z22.object({
|
|
4876
|
+
type: z22.literal("tool_reference"),
|
|
4877
|
+
toolName: z22.string()
|
|
4597
4878
|
})
|
|
4598
4879
|
)
|
|
4599
4880
|
)
|
|
4600
4881
|
);
|
|
4601
|
-
var toolSearchBm25_20251119InputSchema =
|
|
4602
|
-
() =>
|
|
4603
|
-
|
|
4882
|
+
var toolSearchBm25_20251119InputSchema = lazySchema21(
|
|
4883
|
+
() => zodSchema21(
|
|
4884
|
+
z22.object({
|
|
4604
4885
|
/**
|
|
4605
4886
|
* A natural language query to search for tools.
|
|
4606
4887
|
* Claude will use BM25 text search to find relevant tools.
|
|
4607
4888
|
*/
|
|
4608
|
-
query:
|
|
4889
|
+
query: z22.string(),
|
|
4609
4890
|
/**
|
|
4610
4891
|
* Maximum number of tools to return. Optional.
|
|
4611
4892
|
*/
|
|
4612
|
-
limit:
|
|
4893
|
+
limit: z22.number().optional()
|
|
4613
4894
|
})
|
|
4614
4895
|
)
|
|
4615
4896
|
);
|
|
4616
|
-
var
|
|
4897
|
+
var factory10 = createProviderToolFactoryWithOutputSchema9({
|
|
4617
4898
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4618
4899
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4619
4900
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
4620
4901
|
supportsDeferredResults: true
|
|
4621
4902
|
});
|
|
4622
4903
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
4623
|
-
return
|
|
4904
|
+
return factory10(args);
|
|
4624
4905
|
};
|
|
4625
4906
|
|
|
4626
4907
|
// src/anthropic-tools.ts
|
|
@@ -4767,6 +5048,16 @@ var anthropicTools = {
|
|
|
4767
5048
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
4768
5049
|
*/
|
|
4769
5050
|
webFetch_20250910,
|
|
5051
|
+
/**
|
|
5052
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
5053
|
+
*
|
|
5054
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
5055
|
+
* @param allowedDomains - Only fetch from these domains
|
|
5056
|
+
* @param blockedDomains - Never fetch from these domains
|
|
5057
|
+
* @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.
|
|
5058
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
5059
|
+
*/
|
|
5060
|
+
webFetch_20260209,
|
|
4770
5061
|
/**
|
|
4771
5062
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
4772
5063
|
*
|
|
@@ -4776,6 +5067,15 @@ var anthropicTools = {
|
|
|
4776
5067
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
4777
5068
|
*/
|
|
4778
5069
|
webSearch_20250305,
|
|
5070
|
+
/**
|
|
5071
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
5072
|
+
*
|
|
5073
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
5074
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
5075
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
5076
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
5077
|
+
*/
|
|
5078
|
+
webSearch_20260209,
|
|
4779
5079
|
/**
|
|
4780
5080
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
4781
5081
|
*
|