@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.js
CHANGED
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(internal_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/anthropic-messages-language-model.ts
|
|
30
30
|
var import_provider3 = require("@ai-sdk/provider");
|
|
31
|
-
var
|
|
31
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/anthropic-error.ts
|
|
34
34
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -128,7 +128,16 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
128
128
|
type: import_v42.z.literal("server_tool_use"),
|
|
129
129
|
id: import_v42.z.string(),
|
|
130
130
|
name: import_v42.z.string(),
|
|
131
|
-
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish()
|
|
131
|
+
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
132
|
+
caller: import_v42.z.union([
|
|
133
|
+
import_v42.z.object({
|
|
134
|
+
type: import_v42.z.literal("code_execution_20260120"),
|
|
135
|
+
tool_id: import_v42.z.string()
|
|
136
|
+
}),
|
|
137
|
+
import_v42.z.object({
|
|
138
|
+
type: import_v42.z.literal("direct")
|
|
139
|
+
})
|
|
140
|
+
]).optional()
|
|
132
141
|
}),
|
|
133
142
|
import_v42.z.object({
|
|
134
143
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -216,6 +225,18 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
216
225
|
})
|
|
217
226
|
).optional().default([])
|
|
218
227
|
}),
|
|
228
|
+
import_v42.z.object({
|
|
229
|
+
type: import_v42.z.literal("encrypted_code_execution_result"),
|
|
230
|
+
encrypted_stdout: import_v42.z.string(),
|
|
231
|
+
stderr: import_v42.z.string(),
|
|
232
|
+
return_code: import_v42.z.number(),
|
|
233
|
+
content: import_v42.z.array(
|
|
234
|
+
import_v42.z.object({
|
|
235
|
+
type: import_v42.z.literal("code_execution_output"),
|
|
236
|
+
file_id: import_v42.z.string()
|
|
237
|
+
})
|
|
238
|
+
).optional().default([])
|
|
239
|
+
}),
|
|
219
240
|
import_v42.z.object({
|
|
220
241
|
type: import_v42.z.literal("code_execution_tool_result_error"),
|
|
221
242
|
error_code: import_v42.z.string()
|
|
@@ -438,7 +459,16 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
438
459
|
type: import_v42.z.literal("server_tool_use"),
|
|
439
460
|
id: import_v42.z.string(),
|
|
440
461
|
name: import_v42.z.string(),
|
|
441
|
-
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish()
|
|
462
|
+
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
463
|
+
caller: import_v42.z.union([
|
|
464
|
+
import_v42.z.object({
|
|
465
|
+
type: import_v42.z.literal("code_execution_20260120"),
|
|
466
|
+
tool_id: import_v42.z.string()
|
|
467
|
+
}),
|
|
468
|
+
import_v42.z.object({
|
|
469
|
+
type: import_v42.z.literal("direct")
|
|
470
|
+
})
|
|
471
|
+
]).optional()
|
|
442
472
|
}),
|
|
443
473
|
import_v42.z.object({
|
|
444
474
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -526,6 +556,18 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
526
556
|
})
|
|
527
557
|
).optional().default([])
|
|
528
558
|
}),
|
|
559
|
+
import_v42.z.object({
|
|
560
|
+
type: import_v42.z.literal("encrypted_code_execution_result"),
|
|
561
|
+
encrypted_stdout: import_v42.z.string(),
|
|
562
|
+
stderr: import_v42.z.string(),
|
|
563
|
+
return_code: import_v42.z.number(),
|
|
564
|
+
content: import_v42.z.array(
|
|
565
|
+
import_v42.z.object({
|
|
566
|
+
type: import_v42.z.literal("code_execution_output"),
|
|
567
|
+
file_id: import_v42.z.string()
|
|
568
|
+
})
|
|
569
|
+
).optional().default([])
|
|
570
|
+
}),
|
|
529
571
|
import_v42.z.object({
|
|
530
572
|
type: import_v42.z.literal("code_execution_tool_result_error"),
|
|
531
573
|
error_code: import_v42.z.string()
|
|
@@ -995,10 +1037,10 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
995
1037
|
return factory(args);
|
|
996
1038
|
};
|
|
997
1039
|
|
|
998
|
-
// src/tool/web-
|
|
1040
|
+
// src/tool/web-search_20260209.ts
|
|
999
1041
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1000
1042
|
var import_v45 = require("zod/v4");
|
|
1001
|
-
var
|
|
1043
|
+
var webSearch_20260209ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1002
1044
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1003
1045
|
import_v45.z.object({
|
|
1004
1046
|
maxUses: import_v45.z.number().optional(),
|
|
@@ -1014,7 +1056,7 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1014
1056
|
})
|
|
1015
1057
|
)
|
|
1016
1058
|
);
|
|
1017
|
-
var
|
|
1059
|
+
var webSearch_20260209OutputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1018
1060
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1019
1061
|
import_v45.z.array(
|
|
1020
1062
|
import_v45.z.object({
|
|
@@ -1027,7 +1069,7 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1027
1069
|
)
|
|
1028
1070
|
)
|
|
1029
1071
|
);
|
|
1030
|
-
var
|
|
1072
|
+
var webSearch_20260209InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1031
1073
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1032
1074
|
import_v45.z.object({
|
|
1033
1075
|
query: import_v45.z.string()
|
|
@@ -1035,74 +1077,180 @@ var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1035
1077
|
)
|
|
1036
1078
|
);
|
|
1037
1079
|
var factory2 = (0, import_provider_utils5.createProviderToolFactoryWithOutputSchema)({
|
|
1038
|
-
id: "anthropic.
|
|
1039
|
-
inputSchema:
|
|
1040
|
-
outputSchema:
|
|
1080
|
+
id: "anthropic.web_search_20260209",
|
|
1081
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1082
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1041
1083
|
supportsDeferredResults: true
|
|
1042
1084
|
});
|
|
1043
|
-
var
|
|
1085
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1044
1086
|
return factory2(args);
|
|
1045
1087
|
};
|
|
1046
1088
|
|
|
1047
|
-
// src/tool/web-
|
|
1089
|
+
// src/tool/web-search_20250305.ts
|
|
1048
1090
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1049
1091
|
var import_v46 = require("zod/v4");
|
|
1050
|
-
var
|
|
1092
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1051
1093
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1052
1094
|
import_v46.z.object({
|
|
1053
1095
|
maxUses: import_v46.z.number().optional(),
|
|
1054
1096
|
allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1055
1097
|
blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1056
|
-
|
|
1057
|
-
|
|
1098
|
+
userLocation: import_v46.z.object({
|
|
1099
|
+
type: import_v46.z.literal("approximate"),
|
|
1100
|
+
city: import_v46.z.string().optional(),
|
|
1101
|
+
region: import_v46.z.string().optional(),
|
|
1102
|
+
country: import_v46.z.string().optional(),
|
|
1103
|
+
timezone: import_v46.z.string().optional()
|
|
1104
|
+
}).optional()
|
|
1058
1105
|
})
|
|
1059
1106
|
)
|
|
1060
1107
|
);
|
|
1061
|
-
var
|
|
1108
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1062
1109
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1063
|
-
import_v46.z.
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
content: import_v46.z.object({
|
|
1067
|
-
type: import_v46.z.literal("document"),
|
|
1110
|
+
import_v46.z.array(
|
|
1111
|
+
import_v46.z.object({
|
|
1112
|
+
url: import_v46.z.string(),
|
|
1068
1113
|
title: import_v46.z.string().nullable(),
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1114
|
+
pageAge: import_v46.z.string().nullable(),
|
|
1115
|
+
encryptedContent: import_v46.z.string(),
|
|
1116
|
+
type: import_v46.z.literal("web_search_result")
|
|
1117
|
+
})
|
|
1118
|
+
)
|
|
1119
|
+
)
|
|
1120
|
+
);
|
|
1121
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1122
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1123
|
+
import_v46.z.object({
|
|
1124
|
+
query: import_v46.z.string()
|
|
1125
|
+
})
|
|
1126
|
+
)
|
|
1127
|
+
);
|
|
1128
|
+
var factory3 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
|
|
1129
|
+
id: "anthropic.web_search_20250305",
|
|
1130
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1131
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1132
|
+
supportsDeferredResults: true
|
|
1133
|
+
});
|
|
1134
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1135
|
+
return factory3(args);
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
// src/tool/web-fetch-20260209.ts
|
|
1139
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1140
|
+
var import_v47 = require("zod/v4");
|
|
1141
|
+
var webFetch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1142
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1143
|
+
import_v47.z.object({
|
|
1144
|
+
maxUses: import_v47.z.number().optional(),
|
|
1145
|
+
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1146
|
+
blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1147
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1148
|
+
maxContentTokens: import_v47.z.number().optional()
|
|
1149
|
+
})
|
|
1150
|
+
)
|
|
1151
|
+
);
|
|
1152
|
+
var webFetch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1153
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1154
|
+
import_v47.z.object({
|
|
1155
|
+
type: import_v47.z.literal("web_fetch_result"),
|
|
1156
|
+
url: import_v47.z.string(),
|
|
1157
|
+
content: import_v47.z.object({
|
|
1158
|
+
type: import_v47.z.literal("document"),
|
|
1159
|
+
title: import_v47.z.string().nullable(),
|
|
1160
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1161
|
+
source: import_v47.z.union([
|
|
1162
|
+
import_v47.z.object({
|
|
1163
|
+
type: import_v47.z.literal("base64"),
|
|
1164
|
+
mediaType: import_v47.z.literal("application/pdf"),
|
|
1165
|
+
data: import_v47.z.string()
|
|
1075
1166
|
}),
|
|
1076
|
-
|
|
1077
|
-
type:
|
|
1078
|
-
mediaType:
|
|
1079
|
-
data:
|
|
1167
|
+
import_v47.z.object({
|
|
1168
|
+
type: import_v47.z.literal("text"),
|
|
1169
|
+
mediaType: import_v47.z.literal("text/plain"),
|
|
1170
|
+
data: import_v47.z.string()
|
|
1080
1171
|
})
|
|
1081
1172
|
])
|
|
1082
1173
|
}),
|
|
1083
|
-
retrievedAt:
|
|
1174
|
+
retrievedAt: import_v47.z.string().nullable()
|
|
1084
1175
|
})
|
|
1085
1176
|
)
|
|
1086
1177
|
);
|
|
1087
|
-
var
|
|
1088
|
-
() => (0,
|
|
1089
|
-
|
|
1090
|
-
url:
|
|
1178
|
+
var webFetch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1179
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1180
|
+
import_v47.z.object({
|
|
1181
|
+
url: import_v47.z.string()
|
|
1091
1182
|
})
|
|
1092
1183
|
)
|
|
1093
1184
|
);
|
|
1094
|
-
var
|
|
1185
|
+
var factory4 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1186
|
+
id: "anthropic.web_fetch_20260209",
|
|
1187
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1188
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1189
|
+
supportsDeferredResults: true
|
|
1190
|
+
});
|
|
1191
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1192
|
+
return factory4(args);
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1195
|
+
// src/tool/web-fetch-20250910.ts
|
|
1196
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1197
|
+
var import_v48 = require("zod/v4");
|
|
1198
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
1199
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1200
|
+
import_v48.z.object({
|
|
1201
|
+
maxUses: import_v48.z.number().optional(),
|
|
1202
|
+
allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
1203
|
+
blockedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
1204
|
+
citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
|
|
1205
|
+
maxContentTokens: import_v48.z.number().optional()
|
|
1206
|
+
})
|
|
1207
|
+
)
|
|
1208
|
+
);
|
|
1209
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1210
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1211
|
+
import_v48.z.object({
|
|
1212
|
+
type: import_v48.z.literal("web_fetch_result"),
|
|
1213
|
+
url: import_v48.z.string(),
|
|
1214
|
+
content: import_v48.z.object({
|
|
1215
|
+
type: import_v48.z.literal("document"),
|
|
1216
|
+
title: import_v48.z.string().nullable(),
|
|
1217
|
+
citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
|
|
1218
|
+
source: import_v48.z.union([
|
|
1219
|
+
import_v48.z.object({
|
|
1220
|
+
type: import_v48.z.literal("base64"),
|
|
1221
|
+
mediaType: import_v48.z.literal("application/pdf"),
|
|
1222
|
+
data: import_v48.z.string()
|
|
1223
|
+
}),
|
|
1224
|
+
import_v48.z.object({
|
|
1225
|
+
type: import_v48.z.literal("text"),
|
|
1226
|
+
mediaType: import_v48.z.literal("text/plain"),
|
|
1227
|
+
data: import_v48.z.string()
|
|
1228
|
+
})
|
|
1229
|
+
])
|
|
1230
|
+
}),
|
|
1231
|
+
retrievedAt: import_v48.z.string().nullable()
|
|
1232
|
+
})
|
|
1233
|
+
)
|
|
1234
|
+
);
|
|
1235
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1236
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1237
|
+
import_v48.z.object({
|
|
1238
|
+
url: import_v48.z.string()
|
|
1239
|
+
})
|
|
1240
|
+
)
|
|
1241
|
+
);
|
|
1242
|
+
var factory5 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1095
1243
|
id: "anthropic.web_fetch_20250910",
|
|
1096
1244
|
inputSchema: webFetch_20250910InputSchema,
|
|
1097
1245
|
outputSchema: webFetch_20250910OutputSchema,
|
|
1098
1246
|
supportsDeferredResults: true
|
|
1099
1247
|
});
|
|
1100
1248
|
var webFetch_20250910 = (args = {}) => {
|
|
1101
|
-
return
|
|
1249
|
+
return factory5(args);
|
|
1102
1250
|
};
|
|
1103
1251
|
|
|
1104
1252
|
// src/anthropic-prepare-tools.ts
|
|
1105
|
-
var
|
|
1253
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1106
1254
|
async function prepareTools({
|
|
1107
1255
|
tools,
|
|
1108
1256
|
toolChoice,
|
|
@@ -1242,7 +1390,7 @@ async function prepareTools({
|
|
|
1242
1390
|
break;
|
|
1243
1391
|
}
|
|
1244
1392
|
case "anthropic.text_editor_20250728": {
|
|
1245
|
-
const args = await (0,
|
|
1393
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1246
1394
|
value: tool.args,
|
|
1247
1395
|
schema: textEditor_20250728ArgsSchema
|
|
1248
1396
|
});
|
|
@@ -1282,7 +1430,7 @@ async function prepareTools({
|
|
|
1282
1430
|
}
|
|
1283
1431
|
case "anthropic.web_fetch_20250910": {
|
|
1284
1432
|
betas.add("web-fetch-2025-09-10");
|
|
1285
|
-
const args = await (0,
|
|
1433
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1286
1434
|
value: tool.args,
|
|
1287
1435
|
schema: webFetch_20250910ArgsSchema
|
|
1288
1436
|
});
|
|
@@ -1298,8 +1446,26 @@ async function prepareTools({
|
|
|
1298
1446
|
});
|
|
1299
1447
|
break;
|
|
1300
1448
|
}
|
|
1449
|
+
case "anthropic.web_fetch_20260209": {
|
|
1450
|
+
betas.add("code-execution-web-tools-2026-02-09");
|
|
1451
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1452
|
+
value: tool.args,
|
|
1453
|
+
schema: webFetch_20260209ArgsSchema
|
|
1454
|
+
});
|
|
1455
|
+
anthropicTools2.push({
|
|
1456
|
+
type: "web_fetch_20260209",
|
|
1457
|
+
name: "web_fetch",
|
|
1458
|
+
max_uses: args.maxUses,
|
|
1459
|
+
allowed_domains: args.allowedDomains,
|
|
1460
|
+
blocked_domains: args.blockedDomains,
|
|
1461
|
+
citations: args.citations,
|
|
1462
|
+
max_content_tokens: args.maxContentTokens,
|
|
1463
|
+
cache_control: void 0
|
|
1464
|
+
});
|
|
1465
|
+
break;
|
|
1466
|
+
}
|
|
1301
1467
|
case "anthropic.web_search_20250305": {
|
|
1302
|
-
const args = await (0,
|
|
1468
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1303
1469
|
value: tool.args,
|
|
1304
1470
|
schema: webSearch_20250305ArgsSchema
|
|
1305
1471
|
});
|
|
@@ -1314,6 +1480,23 @@ async function prepareTools({
|
|
|
1314
1480
|
});
|
|
1315
1481
|
break;
|
|
1316
1482
|
}
|
|
1483
|
+
case "anthropic.web_search_20260209": {
|
|
1484
|
+
betas.add("code-execution-web-tools-2026-02-09");
|
|
1485
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1486
|
+
value: tool.args,
|
|
1487
|
+
schema: webSearch_20260209ArgsSchema
|
|
1488
|
+
});
|
|
1489
|
+
anthropicTools2.push({
|
|
1490
|
+
type: "web_search_20260209",
|
|
1491
|
+
name: "web_search",
|
|
1492
|
+
max_uses: args.maxUses,
|
|
1493
|
+
allowed_domains: args.allowedDomains,
|
|
1494
|
+
blocked_domains: args.blockedDomains,
|
|
1495
|
+
user_location: args.userLocation,
|
|
1496
|
+
cache_control: void 0
|
|
1497
|
+
});
|
|
1498
|
+
break;
|
|
1499
|
+
}
|
|
1317
1500
|
case "anthropic.tool_search_regex_20251119": {
|
|
1318
1501
|
betas.add("advanced-tool-use-2025-11-20");
|
|
1319
1502
|
anthropicTools2.push({
|
|
@@ -1443,140 +1626,140 @@ function convertAnthropicMessagesUsage({
|
|
|
1443
1626
|
|
|
1444
1627
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1445
1628
|
var import_provider2 = require("@ai-sdk/provider");
|
|
1446
|
-
var
|
|
1629
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
1447
1630
|
|
|
1448
1631
|
// src/tool/code-execution_20250522.ts
|
|
1449
|
-
var
|
|
1450
|
-
var
|
|
1451
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
1452
|
-
() => (0,
|
|
1453
|
-
|
|
1454
|
-
type:
|
|
1455
|
-
stdout:
|
|
1456
|
-
stderr:
|
|
1457
|
-
return_code:
|
|
1458
|
-
content:
|
|
1459
|
-
|
|
1460
|
-
type:
|
|
1461
|
-
file_id:
|
|
1632
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1633
|
+
var import_v49 = require("zod/v4");
|
|
1634
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1635
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1636
|
+
import_v49.z.object({
|
|
1637
|
+
type: import_v49.z.literal("code_execution_result"),
|
|
1638
|
+
stdout: import_v49.z.string(),
|
|
1639
|
+
stderr: import_v49.z.string(),
|
|
1640
|
+
return_code: import_v49.z.number(),
|
|
1641
|
+
content: import_v49.z.array(
|
|
1642
|
+
import_v49.z.object({
|
|
1643
|
+
type: import_v49.z.literal("code_execution_output"),
|
|
1644
|
+
file_id: import_v49.z.string()
|
|
1462
1645
|
})
|
|
1463
1646
|
).optional().default([])
|
|
1464
1647
|
})
|
|
1465
1648
|
)
|
|
1466
1649
|
);
|
|
1467
|
-
var codeExecution_20250522InputSchema = (0,
|
|
1468
|
-
() => (0,
|
|
1469
|
-
|
|
1470
|
-
code:
|
|
1650
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1651
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1652
|
+
import_v49.z.object({
|
|
1653
|
+
code: import_v49.z.string()
|
|
1471
1654
|
})
|
|
1472
1655
|
)
|
|
1473
1656
|
);
|
|
1474
|
-
var
|
|
1657
|
+
var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
|
|
1475
1658
|
id: "anthropic.code_execution_20250522",
|
|
1476
1659
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1477
1660
|
outputSchema: codeExecution_20250522OutputSchema
|
|
1478
1661
|
});
|
|
1479
1662
|
var codeExecution_20250522 = (args = {}) => {
|
|
1480
|
-
return
|
|
1663
|
+
return factory6(args);
|
|
1481
1664
|
};
|
|
1482
1665
|
|
|
1483
1666
|
// src/tool/code-execution_20250825.ts
|
|
1484
|
-
var
|
|
1485
|
-
var
|
|
1486
|
-
var codeExecution_20250825OutputSchema = (0,
|
|
1487
|
-
() => (0,
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
type:
|
|
1491
|
-
stdout:
|
|
1492
|
-
stderr:
|
|
1493
|
-
return_code:
|
|
1494
|
-
content:
|
|
1495
|
-
|
|
1496
|
-
type:
|
|
1497
|
-
file_id:
|
|
1667
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1668
|
+
var import_v410 = require("zod/v4");
|
|
1669
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1670
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
1671
|
+
import_v410.z.discriminatedUnion("type", [
|
|
1672
|
+
import_v410.z.object({
|
|
1673
|
+
type: import_v410.z.literal("code_execution_result"),
|
|
1674
|
+
stdout: import_v410.z.string(),
|
|
1675
|
+
stderr: import_v410.z.string(),
|
|
1676
|
+
return_code: import_v410.z.number(),
|
|
1677
|
+
content: import_v410.z.array(
|
|
1678
|
+
import_v410.z.object({
|
|
1679
|
+
type: import_v410.z.literal("code_execution_output"),
|
|
1680
|
+
file_id: import_v410.z.string()
|
|
1498
1681
|
})
|
|
1499
1682
|
).optional().default([])
|
|
1500
1683
|
}),
|
|
1501
|
-
|
|
1502
|
-
type:
|
|
1503
|
-
content:
|
|
1504
|
-
|
|
1505
|
-
type:
|
|
1506
|
-
file_id:
|
|
1684
|
+
import_v410.z.object({
|
|
1685
|
+
type: import_v410.z.literal("bash_code_execution_result"),
|
|
1686
|
+
content: import_v410.z.array(
|
|
1687
|
+
import_v410.z.object({
|
|
1688
|
+
type: import_v410.z.literal("bash_code_execution_output"),
|
|
1689
|
+
file_id: import_v410.z.string()
|
|
1507
1690
|
})
|
|
1508
1691
|
),
|
|
1509
|
-
stdout:
|
|
1510
|
-
stderr:
|
|
1511
|
-
return_code:
|
|
1692
|
+
stdout: import_v410.z.string(),
|
|
1693
|
+
stderr: import_v410.z.string(),
|
|
1694
|
+
return_code: import_v410.z.number()
|
|
1512
1695
|
}),
|
|
1513
|
-
|
|
1514
|
-
type:
|
|
1515
|
-
error_code:
|
|
1696
|
+
import_v410.z.object({
|
|
1697
|
+
type: import_v410.z.literal("bash_code_execution_tool_result_error"),
|
|
1698
|
+
error_code: import_v410.z.string()
|
|
1516
1699
|
}),
|
|
1517
|
-
|
|
1518
|
-
type:
|
|
1519
|
-
error_code:
|
|
1700
|
+
import_v410.z.object({
|
|
1701
|
+
type: import_v410.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1702
|
+
error_code: import_v410.z.string()
|
|
1520
1703
|
}),
|
|
1521
|
-
|
|
1522
|
-
type:
|
|
1523
|
-
content:
|
|
1524
|
-
file_type:
|
|
1525
|
-
num_lines:
|
|
1526
|
-
start_line:
|
|
1527
|
-
total_lines:
|
|
1704
|
+
import_v410.z.object({
|
|
1705
|
+
type: import_v410.z.literal("text_editor_code_execution_view_result"),
|
|
1706
|
+
content: import_v410.z.string(),
|
|
1707
|
+
file_type: import_v410.z.string(),
|
|
1708
|
+
num_lines: import_v410.z.number().nullable(),
|
|
1709
|
+
start_line: import_v410.z.number().nullable(),
|
|
1710
|
+
total_lines: import_v410.z.number().nullable()
|
|
1528
1711
|
}),
|
|
1529
|
-
|
|
1530
|
-
type:
|
|
1531
|
-
is_file_update:
|
|
1712
|
+
import_v410.z.object({
|
|
1713
|
+
type: import_v410.z.literal("text_editor_code_execution_create_result"),
|
|
1714
|
+
is_file_update: import_v410.z.boolean()
|
|
1532
1715
|
}),
|
|
1533
|
-
|
|
1534
|
-
type:
|
|
1535
|
-
lines:
|
|
1536
|
-
new_lines:
|
|
1537
|
-
new_start:
|
|
1538
|
-
old_lines:
|
|
1539
|
-
old_start:
|
|
1716
|
+
import_v410.z.object({
|
|
1717
|
+
type: import_v410.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1718
|
+
lines: import_v410.z.array(import_v410.z.string()).nullable(),
|
|
1719
|
+
new_lines: import_v410.z.number().nullable(),
|
|
1720
|
+
new_start: import_v410.z.number().nullable(),
|
|
1721
|
+
old_lines: import_v410.z.number().nullable(),
|
|
1722
|
+
old_start: import_v410.z.number().nullable()
|
|
1540
1723
|
})
|
|
1541
1724
|
])
|
|
1542
1725
|
)
|
|
1543
1726
|
);
|
|
1544
|
-
var codeExecution_20250825InputSchema = (0,
|
|
1545
|
-
() => (0,
|
|
1546
|
-
|
|
1727
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1728
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
1729
|
+
import_v410.z.discriminatedUnion("type", [
|
|
1547
1730
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1548
|
-
|
|
1549
|
-
type:
|
|
1550
|
-
code:
|
|
1731
|
+
import_v410.z.object({
|
|
1732
|
+
type: import_v410.z.literal("programmatic-tool-call"),
|
|
1733
|
+
code: import_v410.z.string()
|
|
1551
1734
|
}),
|
|
1552
|
-
|
|
1553
|
-
type:
|
|
1554
|
-
command:
|
|
1735
|
+
import_v410.z.object({
|
|
1736
|
+
type: import_v410.z.literal("bash_code_execution"),
|
|
1737
|
+
command: import_v410.z.string()
|
|
1555
1738
|
}),
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
type:
|
|
1559
|
-
command:
|
|
1560
|
-
path:
|
|
1739
|
+
import_v410.z.discriminatedUnion("command", [
|
|
1740
|
+
import_v410.z.object({
|
|
1741
|
+
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1742
|
+
command: import_v410.z.literal("view"),
|
|
1743
|
+
path: import_v410.z.string()
|
|
1561
1744
|
}),
|
|
1562
|
-
|
|
1563
|
-
type:
|
|
1564
|
-
command:
|
|
1565
|
-
path:
|
|
1566
|
-
file_text:
|
|
1745
|
+
import_v410.z.object({
|
|
1746
|
+
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1747
|
+
command: import_v410.z.literal("create"),
|
|
1748
|
+
path: import_v410.z.string(),
|
|
1749
|
+
file_text: import_v410.z.string().nullish()
|
|
1567
1750
|
}),
|
|
1568
|
-
|
|
1569
|
-
type:
|
|
1570
|
-
command:
|
|
1571
|
-
path:
|
|
1572
|
-
old_str:
|
|
1573
|
-
new_str:
|
|
1751
|
+
import_v410.z.object({
|
|
1752
|
+
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1753
|
+
command: import_v410.z.literal("str_replace"),
|
|
1754
|
+
path: import_v410.z.string(),
|
|
1755
|
+
old_str: import_v410.z.string(),
|
|
1756
|
+
new_str: import_v410.z.string()
|
|
1574
1757
|
})
|
|
1575
1758
|
])
|
|
1576
1759
|
])
|
|
1577
1760
|
)
|
|
1578
1761
|
);
|
|
1579
|
-
var
|
|
1762
|
+
var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
|
|
1580
1763
|
id: "anthropic.code_execution_20250825",
|
|
1581
1764
|
inputSchema: codeExecution_20250825InputSchema,
|
|
1582
1765
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -1586,25 +1769,142 @@ var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSch
|
|
|
1586
1769
|
supportsDeferredResults: true
|
|
1587
1770
|
});
|
|
1588
1771
|
var codeExecution_20250825 = (args = {}) => {
|
|
1589
|
-
return
|
|
1772
|
+
return factory7(args);
|
|
1773
|
+
};
|
|
1774
|
+
|
|
1775
|
+
// src/tool/code-execution_20260120.ts
|
|
1776
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
1777
|
+
var import_v411 = require("zod/v4");
|
|
1778
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)(
|
|
1779
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
1780
|
+
import_v411.z.discriminatedUnion("type", [
|
|
1781
|
+
import_v411.z.object({
|
|
1782
|
+
type: import_v411.z.literal("code_execution_result"),
|
|
1783
|
+
stdout: import_v411.z.string(),
|
|
1784
|
+
stderr: import_v411.z.string(),
|
|
1785
|
+
return_code: import_v411.z.number(),
|
|
1786
|
+
content: import_v411.z.array(
|
|
1787
|
+
import_v411.z.object({
|
|
1788
|
+
type: import_v411.z.literal("code_execution_output"),
|
|
1789
|
+
file_id: import_v411.z.string()
|
|
1790
|
+
})
|
|
1791
|
+
).optional().default([])
|
|
1792
|
+
}),
|
|
1793
|
+
import_v411.z.object({
|
|
1794
|
+
type: import_v411.z.literal("encrypted_code_execution_result"),
|
|
1795
|
+
encrypted_stdout: import_v411.z.string(),
|
|
1796
|
+
stderr: import_v411.z.string(),
|
|
1797
|
+
return_code: import_v411.z.number(),
|
|
1798
|
+
content: import_v411.z.array(
|
|
1799
|
+
import_v411.z.object({
|
|
1800
|
+
type: import_v411.z.literal("code_execution_output"),
|
|
1801
|
+
file_id: import_v411.z.string()
|
|
1802
|
+
})
|
|
1803
|
+
).optional().default([])
|
|
1804
|
+
}),
|
|
1805
|
+
import_v411.z.object({
|
|
1806
|
+
type: import_v411.z.literal("bash_code_execution_result"),
|
|
1807
|
+
content: import_v411.z.array(
|
|
1808
|
+
import_v411.z.object({
|
|
1809
|
+
type: import_v411.z.literal("bash_code_execution_output"),
|
|
1810
|
+
file_id: import_v411.z.string()
|
|
1811
|
+
})
|
|
1812
|
+
),
|
|
1813
|
+
stdout: import_v411.z.string(),
|
|
1814
|
+
stderr: import_v411.z.string(),
|
|
1815
|
+
return_code: import_v411.z.number()
|
|
1816
|
+
}),
|
|
1817
|
+
import_v411.z.object({
|
|
1818
|
+
type: import_v411.z.literal("bash_code_execution_tool_result_error"),
|
|
1819
|
+
error_code: import_v411.z.string()
|
|
1820
|
+
}),
|
|
1821
|
+
import_v411.z.object({
|
|
1822
|
+
type: import_v411.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1823
|
+
error_code: import_v411.z.string()
|
|
1824
|
+
}),
|
|
1825
|
+
import_v411.z.object({
|
|
1826
|
+
type: import_v411.z.literal("text_editor_code_execution_view_result"),
|
|
1827
|
+
content: import_v411.z.string(),
|
|
1828
|
+
file_type: import_v411.z.string(),
|
|
1829
|
+
num_lines: import_v411.z.number().nullable(),
|
|
1830
|
+
start_line: import_v411.z.number().nullable(),
|
|
1831
|
+
total_lines: import_v411.z.number().nullable()
|
|
1832
|
+
}),
|
|
1833
|
+
import_v411.z.object({
|
|
1834
|
+
type: import_v411.z.literal("text_editor_code_execution_create_result"),
|
|
1835
|
+
is_file_update: import_v411.z.boolean()
|
|
1836
|
+
}),
|
|
1837
|
+
import_v411.z.object({
|
|
1838
|
+
type: import_v411.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1839
|
+
lines: import_v411.z.array(import_v411.z.string()).nullable(),
|
|
1840
|
+
new_lines: import_v411.z.number().nullable(),
|
|
1841
|
+
new_start: import_v411.z.number().nullable(),
|
|
1842
|
+
old_lines: import_v411.z.number().nullable(),
|
|
1843
|
+
old_start: import_v411.z.number().nullable()
|
|
1844
|
+
})
|
|
1845
|
+
])
|
|
1846
|
+
)
|
|
1847
|
+
);
|
|
1848
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
1849
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
1850
|
+
import_v411.z.discriminatedUnion("type", [
|
|
1851
|
+
import_v411.z.object({
|
|
1852
|
+
type: import_v411.z.literal("programmatic-tool-call"),
|
|
1853
|
+
code: import_v411.z.string()
|
|
1854
|
+
}),
|
|
1855
|
+
import_v411.z.object({
|
|
1856
|
+
type: import_v411.z.literal("bash_code_execution"),
|
|
1857
|
+
command: import_v411.z.string()
|
|
1858
|
+
}),
|
|
1859
|
+
import_v411.z.discriminatedUnion("command", [
|
|
1860
|
+
import_v411.z.object({
|
|
1861
|
+
type: import_v411.z.literal("text_editor_code_execution"),
|
|
1862
|
+
command: import_v411.z.literal("view"),
|
|
1863
|
+
path: import_v411.z.string()
|
|
1864
|
+
}),
|
|
1865
|
+
import_v411.z.object({
|
|
1866
|
+
type: import_v411.z.literal("text_editor_code_execution"),
|
|
1867
|
+
command: import_v411.z.literal("create"),
|
|
1868
|
+
path: import_v411.z.string(),
|
|
1869
|
+
file_text: import_v411.z.string().nullish()
|
|
1870
|
+
}),
|
|
1871
|
+
import_v411.z.object({
|
|
1872
|
+
type: import_v411.z.literal("text_editor_code_execution"),
|
|
1873
|
+
command: import_v411.z.literal("str_replace"),
|
|
1874
|
+
path: import_v411.z.string(),
|
|
1875
|
+
old_str: import_v411.z.string(),
|
|
1876
|
+
new_str: import_v411.z.string()
|
|
1877
|
+
})
|
|
1878
|
+
])
|
|
1879
|
+
])
|
|
1880
|
+
)
|
|
1881
|
+
);
|
|
1882
|
+
var factory8 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
1883
|
+
id: "anthropic.code_execution_20260120",
|
|
1884
|
+
inputSchema: codeExecution_20260120InputSchema,
|
|
1885
|
+
outputSchema: codeExecution_20260120OutputSchema,
|
|
1886
|
+
supportsDeferredResults: true
|
|
1887
|
+
});
|
|
1888
|
+
var codeExecution_20260120 = (args = {}) => {
|
|
1889
|
+
return factory8(args);
|
|
1590
1890
|
};
|
|
1591
1891
|
|
|
1592
1892
|
// src/tool/tool-search-regex_20251119.ts
|
|
1593
|
-
var
|
|
1594
|
-
var
|
|
1595
|
-
var toolSearchRegex_20251119OutputSchema = (0,
|
|
1596
|
-
() => (0,
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
type:
|
|
1600
|
-
toolName:
|
|
1893
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
1894
|
+
var import_v412 = require("zod/v4");
|
|
1895
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils13.lazySchema)(
|
|
1896
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1897
|
+
import_v412.z.array(
|
|
1898
|
+
import_v412.z.object({
|
|
1899
|
+
type: import_v412.z.literal("tool_reference"),
|
|
1900
|
+
toolName: import_v412.z.string()
|
|
1601
1901
|
})
|
|
1602
1902
|
)
|
|
1603
1903
|
)
|
|
1604
1904
|
);
|
|
1605
|
-
var toolSearchRegex_20251119InputSchema = (0,
|
|
1606
|
-
() => (0,
|
|
1607
|
-
|
|
1905
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
1906
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1907
|
+
import_v412.z.object({
|
|
1608
1908
|
/**
|
|
1609
1909
|
* A regex pattern to search for tools.
|
|
1610
1910
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -1615,28 +1915,28 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils10.lazySchema
|
|
|
1615
1915
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1616
1916
|
* - "(?i)slack" - case-insensitive search
|
|
1617
1917
|
*/
|
|
1618
|
-
pattern:
|
|
1918
|
+
pattern: import_v412.z.string(),
|
|
1619
1919
|
/**
|
|
1620
1920
|
* Maximum number of tools to return. Optional.
|
|
1621
1921
|
*/
|
|
1622
|
-
limit:
|
|
1922
|
+
limit: import_v412.z.number().optional()
|
|
1623
1923
|
})
|
|
1624
1924
|
)
|
|
1625
1925
|
);
|
|
1626
|
-
var
|
|
1926
|
+
var factory9 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
|
|
1627
1927
|
id: "anthropic.tool_search_regex_20251119",
|
|
1628
1928
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
1629
1929
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
1630
1930
|
supportsDeferredResults: true
|
|
1631
1931
|
});
|
|
1632
1932
|
var toolSearchRegex_20251119 = (args = {}) => {
|
|
1633
|
-
return
|
|
1933
|
+
return factory9(args);
|
|
1634
1934
|
};
|
|
1635
1935
|
|
|
1636
1936
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1637
1937
|
function convertToString(data) {
|
|
1638
1938
|
if (typeof data === "string") {
|
|
1639
|
-
return new TextDecoder().decode((0,
|
|
1939
|
+
return new TextDecoder().decode((0, import_provider_utils14.convertBase64ToUint8Array)(data));
|
|
1640
1940
|
}
|
|
1641
1941
|
if (data instanceof Uint8Array) {
|
|
1642
1942
|
return new TextDecoder().decode(data);
|
|
@@ -1666,7 +1966,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1666
1966
|
cacheControlValidator,
|
|
1667
1967
|
toolNameMapping
|
|
1668
1968
|
}) {
|
|
1669
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
1969
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
1670
1970
|
const betas = /* @__PURE__ */ new Set();
|
|
1671
1971
|
const blocks = groupIntoBlocks(prompt);
|
|
1672
1972
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -1674,7 +1974,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1674
1974
|
const messages = [];
|
|
1675
1975
|
async function shouldEnableCitations(providerMetadata) {
|
|
1676
1976
|
var _a2, _b2;
|
|
1677
|
-
const anthropicOptions = await (0,
|
|
1977
|
+
const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
|
|
1678
1978
|
provider: "anthropic",
|
|
1679
1979
|
providerOptions: providerMetadata,
|
|
1680
1980
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1682,7 +1982,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1682
1982
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
1683
1983
|
}
|
|
1684
1984
|
async function getDocumentMetadata(providerMetadata) {
|
|
1685
|
-
const anthropicOptions = await (0,
|
|
1985
|
+
const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
|
|
1686
1986
|
provider: "anthropic",
|
|
1687
1987
|
providerOptions: providerMetadata,
|
|
1688
1988
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1748,7 +2048,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1748
2048
|
} : {
|
|
1749
2049
|
type: "base64",
|
|
1750
2050
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
1751
|
-
data: (0,
|
|
2051
|
+
data: (0, import_provider_utils14.convertToBase64)(part.data)
|
|
1752
2052
|
},
|
|
1753
2053
|
cache_control: cacheControl
|
|
1754
2054
|
});
|
|
@@ -1768,7 +2068,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1768
2068
|
} : {
|
|
1769
2069
|
type: "base64",
|
|
1770
2070
|
media_type: "application/pdf",
|
|
1771
|
-
data: (0,
|
|
2071
|
+
data: (0, import_provider_utils14.convertToBase64)(part.data)
|
|
1772
2072
|
},
|
|
1773
2073
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
1774
2074
|
...metadata.context && { context: metadata.context },
|
|
@@ -1906,7 +2206,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1906
2206
|
return void 0;
|
|
1907
2207
|
}
|
|
1908
2208
|
}
|
|
1909
|
-
}).filter(
|
|
2209
|
+
}).filter(import_provider_utils14.isNonNullable);
|
|
1910
2210
|
break;
|
|
1911
2211
|
case "text":
|
|
1912
2212
|
case "error-text":
|
|
@@ -1982,7 +2282,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1982
2282
|
}
|
|
1983
2283
|
case "reasoning": {
|
|
1984
2284
|
if (sendReasoning) {
|
|
1985
|
-
const reasoningMetadata = await (0,
|
|
2285
|
+
const reasoningMetadata = await (0, import_provider_utils14.parseProviderOptions)({
|
|
1986
2286
|
provider: "anthropic",
|
|
1987
2287
|
providerOptions: part.providerOptions,
|
|
1988
2288
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -2188,7 +2488,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2188
2488
|
break;
|
|
2189
2489
|
}
|
|
2190
2490
|
if (output.value.type === "code_execution_result") {
|
|
2191
|
-
const codeExecutionOutput = await (0,
|
|
2491
|
+
const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2192
2492
|
value: output.value,
|
|
2193
2493
|
schema: codeExecution_20250522OutputSchema
|
|
2194
2494
|
});
|
|
@@ -2204,8 +2504,27 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2204
2504
|
},
|
|
2205
2505
|
cache_control: cacheControl
|
|
2206
2506
|
});
|
|
2507
|
+
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
2508
|
+
const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2509
|
+
value: output.value,
|
|
2510
|
+
schema: codeExecution_20260120OutputSchema
|
|
2511
|
+
});
|
|
2512
|
+
if (codeExecutionOutput.type === "encrypted_code_execution_result") {
|
|
2513
|
+
anthropicContent.push({
|
|
2514
|
+
type: "code_execution_tool_result",
|
|
2515
|
+
tool_use_id: part.toolCallId,
|
|
2516
|
+
content: {
|
|
2517
|
+
type: codeExecutionOutput.type,
|
|
2518
|
+
encrypted_stdout: codeExecutionOutput.encrypted_stdout,
|
|
2519
|
+
stderr: codeExecutionOutput.stderr,
|
|
2520
|
+
return_code: codeExecutionOutput.return_code,
|
|
2521
|
+
content: (_p = codeExecutionOutput.content) != null ? _p : []
|
|
2522
|
+
},
|
|
2523
|
+
cache_control: cacheControl
|
|
2524
|
+
});
|
|
2525
|
+
}
|
|
2207
2526
|
} else {
|
|
2208
|
-
const codeExecutionOutput = await (0,
|
|
2527
|
+
const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2209
2528
|
value: output.value,
|
|
2210
2529
|
schema: codeExecution_20250825OutputSchema
|
|
2211
2530
|
});
|
|
@@ -2218,7 +2537,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2218
2537
|
stdout: codeExecutionOutput.stdout,
|
|
2219
2538
|
stderr: codeExecutionOutput.stderr,
|
|
2220
2539
|
return_code: codeExecutionOutput.return_code,
|
|
2221
|
-
content: (
|
|
2540
|
+
content: (_q = codeExecutionOutput.content) != null ? _q : []
|
|
2222
2541
|
},
|
|
2223
2542
|
cache_control: cacheControl
|
|
2224
2543
|
});
|
|
@@ -2251,7 +2570,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2251
2570
|
errorValue = output.value;
|
|
2252
2571
|
}
|
|
2253
2572
|
} catch (e) {
|
|
2254
|
-
const extractedErrorCode = (
|
|
2573
|
+
const extractedErrorCode = (_r = output.value) == null ? void 0 : _r.errorCode;
|
|
2255
2574
|
errorValue = {
|
|
2256
2575
|
errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unknown"
|
|
2257
2576
|
};
|
|
@@ -2261,7 +2580,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2261
2580
|
tool_use_id: part.toolCallId,
|
|
2262
2581
|
content: {
|
|
2263
2582
|
type: "web_fetch_tool_result_error",
|
|
2264
|
-
error_code: (
|
|
2583
|
+
error_code: (_s = errorValue.errorCode) != null ? _s : "unknown"
|
|
2265
2584
|
},
|
|
2266
2585
|
cache_control: cacheControl
|
|
2267
2586
|
});
|
|
@@ -2274,7 +2593,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2274
2593
|
});
|
|
2275
2594
|
break;
|
|
2276
2595
|
}
|
|
2277
|
-
const webFetchOutput = await (0,
|
|
2596
|
+
const webFetchOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2278
2597
|
value: output.value,
|
|
2279
2598
|
schema: webFetch_20250910OutputSchema
|
|
2280
2599
|
});
|
|
@@ -2309,7 +2628,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2309
2628
|
});
|
|
2310
2629
|
break;
|
|
2311
2630
|
}
|
|
2312
|
-
const webSearchOutput = await (0,
|
|
2631
|
+
const webSearchOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2313
2632
|
value: output.value,
|
|
2314
2633
|
schema: webSearch_20250305OutputSchema
|
|
2315
2634
|
});
|
|
@@ -2336,7 +2655,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2336
2655
|
});
|
|
2337
2656
|
break;
|
|
2338
2657
|
}
|
|
2339
|
-
const toolSearchOutput = await (0,
|
|
2658
|
+
const toolSearchOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2340
2659
|
value: output.value,
|
|
2341
2660
|
schema: toolSearchRegex_20251119OutputSchema
|
|
2342
2661
|
});
|
|
@@ -2500,7 +2819,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2500
2819
|
var _a;
|
|
2501
2820
|
this.modelId = modelId;
|
|
2502
2821
|
this.config = config;
|
|
2503
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
2822
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils15.generateId;
|
|
2504
2823
|
}
|
|
2505
2824
|
supportsUrl(url) {
|
|
2506
2825
|
return url.protocol === "https:";
|
|
@@ -2574,12 +2893,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2574
2893
|
}
|
|
2575
2894
|
}
|
|
2576
2895
|
const providerOptionsName = this.providerOptionsName;
|
|
2577
|
-
const canonicalOptions = await (0,
|
|
2896
|
+
const canonicalOptions = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2578
2897
|
provider: "anthropic",
|
|
2579
2898
|
providerOptions,
|
|
2580
2899
|
schema: anthropicLanguageModelOptions
|
|
2581
2900
|
});
|
|
2582
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0,
|
|
2901
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils15.parseProviderOptions)({
|
|
2583
2902
|
provider: providerOptionsName,
|
|
2584
2903
|
providerOptions,
|
|
2585
2904
|
schema: anthropicLanguageModelOptions
|
|
@@ -2606,7 +2925,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2606
2925
|
} : void 0;
|
|
2607
2926
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
2608
2927
|
const cacheControlValidator = new CacheControlValidator();
|
|
2609
|
-
const toolNameMapping = (0,
|
|
2928
|
+
const toolNameMapping = (0, import_provider_utils15.createToolNameMapping)({
|
|
2610
2929
|
tools,
|
|
2611
2930
|
providerToolNames: {
|
|
2612
2931
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -2622,7 +2941,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2622
2941
|
"anthropic.bash_20250124": "bash",
|
|
2623
2942
|
"anthropic.memory_20250818": "memory",
|
|
2624
2943
|
"anthropic.web_search_20250305": "web_search",
|
|
2944
|
+
"anthropic.web_search_20260209": "web_search",
|
|
2625
2945
|
"anthropic.web_fetch_20250910": "web_fetch",
|
|
2946
|
+
"anthropic.web_fetch_20260209": "web_fetch",
|
|
2626
2947
|
"anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
|
|
2627
2948
|
"anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
|
|
2628
2949
|
}
|
|
@@ -2887,15 +3208,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2887
3208
|
betas,
|
|
2888
3209
|
headers
|
|
2889
3210
|
}) {
|
|
2890
|
-
return (0,
|
|
2891
|
-
await (0,
|
|
3211
|
+
return (0, import_provider_utils15.combineHeaders)(
|
|
3212
|
+
await (0, import_provider_utils15.resolve)(this.config.headers),
|
|
2892
3213
|
headers,
|
|
2893
3214
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
2894
3215
|
);
|
|
2895
3216
|
}
|
|
2896
3217
|
async getBetasFromHeaders(requestHeaders) {
|
|
2897
3218
|
var _a, _b;
|
|
2898
|
-
const configHeaders = await (0,
|
|
3219
|
+
const configHeaders = await (0, import_provider_utils15.resolve)(this.config.headers);
|
|
2899
3220
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
2900
3221
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
2901
3222
|
return new Set(
|
|
@@ -2937,7 +3258,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2937
3258
|
});
|
|
2938
3259
|
}
|
|
2939
3260
|
async doGenerate(options) {
|
|
2940
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3261
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2941
3262
|
const {
|
|
2942
3263
|
args,
|
|
2943
3264
|
warnings,
|
|
@@ -2954,16 +3275,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2954
3275
|
const citationDocuments = [
|
|
2955
3276
|
...this.extractCitationDocuments(options.prompt)
|
|
2956
3277
|
];
|
|
3278
|
+
const markCodeExecutionDynamic = hasWebTool20260209WithoutCodeExecution(
|
|
3279
|
+
args.tools
|
|
3280
|
+
);
|
|
2957
3281
|
const {
|
|
2958
3282
|
responseHeaders,
|
|
2959
3283
|
value: response,
|
|
2960
3284
|
rawValue: rawResponse
|
|
2961
|
-
} = await (0,
|
|
3285
|
+
} = await (0, import_provider_utils15.postJsonToApi)({
|
|
2962
3286
|
url: this.buildRequestUrl(false),
|
|
2963
3287
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
2964
3288
|
body: this.transformRequestBody(args),
|
|
2965
3289
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
2966
|
-
successfulResponseHandler: (0,
|
|
3290
|
+
successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
|
|
2967
3291
|
anthropicMessagesResponseSchema
|
|
2968
3292
|
),
|
|
2969
3293
|
abortSignal: options.abortSignal,
|
|
@@ -3075,7 +3399,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3075
3399
|
toolCallId: part.id,
|
|
3076
3400
|
toolName: toolNameMapping.toCustomToolName(part.name),
|
|
3077
3401
|
input: JSON.stringify(inputToSerialize),
|
|
3078
|
-
providerExecuted: true
|
|
3402
|
+
providerExecuted: true,
|
|
3403
|
+
// We want this 'code_execution' tool call to be allowed even if the tool is not explicitly provided.
|
|
3404
|
+
// Since the validation generally bypasses dynamic tools, we mark this specific tool as dynamic.
|
|
3405
|
+
...markCodeExecutionDynamic && part.name === "code_execution" ? { dynamic: true } : {}
|
|
3079
3406
|
});
|
|
3080
3407
|
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
3081
3408
|
serverToolCalls[part.id] = part.name;
|
|
@@ -3219,6 +3546,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3219
3546
|
content: (_c = part.content.content) != null ? _c : []
|
|
3220
3547
|
}
|
|
3221
3548
|
});
|
|
3549
|
+
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
3550
|
+
content.push({
|
|
3551
|
+
type: "tool-result",
|
|
3552
|
+
toolCallId: part.tool_use_id,
|
|
3553
|
+
toolName: toolNameMapping.toCustomToolName("code_execution"),
|
|
3554
|
+
result: {
|
|
3555
|
+
type: part.content.type,
|
|
3556
|
+
encrypted_stdout: part.content.encrypted_stdout,
|
|
3557
|
+
stderr: part.content.stderr,
|
|
3558
|
+
return_code: part.content.return_code,
|
|
3559
|
+
content: (_d = part.content.content) != null ? _d : []
|
|
3560
|
+
}
|
|
3561
|
+
});
|
|
3222
3562
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
3223
3563
|
content.push({
|
|
3224
3564
|
type: "tool-result",
|
|
@@ -3295,13 +3635,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3295
3635
|
finishReason: response.stop_reason,
|
|
3296
3636
|
isJsonResponseFromTool
|
|
3297
3637
|
}),
|
|
3298
|
-
raw: (
|
|
3638
|
+
raw: (_e = response.stop_reason) != null ? _e : void 0
|
|
3299
3639
|
},
|
|
3300
3640
|
usage: convertAnthropicMessagesUsage({ usage: response.usage }),
|
|
3301
3641
|
request: { body: args },
|
|
3302
3642
|
response: {
|
|
3303
|
-
id: (
|
|
3304
|
-
modelId: (
|
|
3643
|
+
id: (_f = response.id) != null ? _f : void 0,
|
|
3644
|
+
modelId: (_g = response.model) != null ? _g : void 0,
|
|
3305
3645
|
headers: responseHeaders,
|
|
3306
3646
|
body: rawResponse
|
|
3307
3647
|
},
|
|
@@ -3358,13 +3698,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3358
3698
|
const citationDocuments = [
|
|
3359
3699
|
...this.extractCitationDocuments(options.prompt)
|
|
3360
3700
|
];
|
|
3701
|
+
const markCodeExecutionDynamic = hasWebTool20260209WithoutCodeExecution(
|
|
3702
|
+
body.tools
|
|
3703
|
+
);
|
|
3361
3704
|
const url = this.buildRequestUrl(true);
|
|
3362
|
-
const { responseHeaders, value: response } = await (0,
|
|
3705
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
|
|
3363
3706
|
url,
|
|
3364
3707
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3365
3708
|
body: this.transformRequestBody(body),
|
|
3366
3709
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3367
|
-
successfulResponseHandler: (0,
|
|
3710
|
+
successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
|
|
3368
3711
|
anthropicMessagesChunkSchema
|
|
3369
3712
|
),
|
|
3370
3713
|
abortSignal: options.abortSignal,
|
|
@@ -3398,7 +3741,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3398
3741
|
controller.enqueue({ type: "stream-start", warnings });
|
|
3399
3742
|
},
|
|
3400
3743
|
transform(chunk, controller) {
|
|
3401
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
3744
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3402
3745
|
if (options.includeRawChunks) {
|
|
3403
3746
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
3404
3747
|
}
|
|
@@ -3507,12 +3850,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3507
3850
|
].includes(part.name)) {
|
|
3508
3851
|
const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
|
|
3509
3852
|
const customToolName = toolNameMapping.toCustomToolName(providerToolName);
|
|
3853
|
+
const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
|
|
3510
3854
|
contentBlocks[value.index] = {
|
|
3511
3855
|
type: "tool-call",
|
|
3512
3856
|
toolCallId: part.id,
|
|
3513
3857
|
toolName: customToolName,
|
|
3514
|
-
input:
|
|
3858
|
+
input: finalInput,
|
|
3515
3859
|
providerExecuted: true,
|
|
3860
|
+
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
3516
3861
|
firstDelta: true,
|
|
3517
3862
|
providerToolName: part.name
|
|
3518
3863
|
};
|
|
@@ -3520,7 +3865,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3520
3865
|
type: "tool-input-start",
|
|
3521
3866
|
id: part.id,
|
|
3522
3867
|
toolName: customToolName,
|
|
3523
|
-
providerExecuted: true
|
|
3868
|
+
providerExecuted: true,
|
|
3869
|
+
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {}
|
|
3524
3870
|
});
|
|
3525
3871
|
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
3526
3872
|
serverToolCalls[part.id] = part.name;
|
|
@@ -3645,6 +3991,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3645
3991
|
content: (_c = part.content.content) != null ? _c : []
|
|
3646
3992
|
}
|
|
3647
3993
|
});
|
|
3994
|
+
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
3995
|
+
controller.enqueue({
|
|
3996
|
+
type: "tool-result",
|
|
3997
|
+
toolCallId: part.tool_use_id,
|
|
3998
|
+
toolName: toolNameMapping.toCustomToolName("code_execution"),
|
|
3999
|
+
result: {
|
|
4000
|
+
type: part.content.type,
|
|
4001
|
+
encrypted_stdout: part.content.encrypted_stdout,
|
|
4002
|
+
stderr: part.content.stderr,
|
|
4003
|
+
return_code: part.content.return_code,
|
|
4004
|
+
content: (_d = part.content.content) != null ? _d : []
|
|
4005
|
+
}
|
|
4006
|
+
});
|
|
3648
4007
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
3649
4008
|
controller.enqueue({
|
|
3650
4009
|
type: "tool-result",
|
|
@@ -3794,6 +4153,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3794
4153
|
toolName: contentBlock.toolName,
|
|
3795
4154
|
input: finalInput,
|
|
3796
4155
|
providerExecuted: contentBlock.providerExecuted,
|
|
4156
|
+
...markCodeExecutionDynamic && contentBlock.providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
3797
4157
|
...contentBlock.caller && {
|
|
3798
4158
|
providerMetadata: {
|
|
3799
4159
|
anthropic: {
|
|
@@ -3911,12 +4271,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3911
4271
|
}
|
|
3912
4272
|
case "message_start": {
|
|
3913
4273
|
usage.input_tokens = value.message.usage.input_tokens;
|
|
3914
|
-
usage.cache_read_input_tokens = (
|
|
3915
|
-
usage.cache_creation_input_tokens = (
|
|
4274
|
+
usage.cache_read_input_tokens = (_e = value.message.usage.cache_read_input_tokens) != null ? _e : 0;
|
|
4275
|
+
usage.cache_creation_input_tokens = (_f = value.message.usage.cache_creation_input_tokens) != null ? _f : 0;
|
|
3916
4276
|
rawUsage = {
|
|
3917
4277
|
...value.message.usage
|
|
3918
4278
|
};
|
|
3919
|
-
cacheCreationInputTokens = (
|
|
4279
|
+
cacheCreationInputTokens = (_g = value.message.usage.cache_creation_input_tokens) != null ? _g : null;
|
|
3920
4280
|
if (value.message.container != null) {
|
|
3921
4281
|
container = {
|
|
3922
4282
|
expiresAt: value.message.container.expires_at,
|
|
@@ -3935,8 +4295,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3935
4295
|
}
|
|
3936
4296
|
controller.enqueue({
|
|
3937
4297
|
type: "response-metadata",
|
|
3938
|
-
id: (
|
|
3939
|
-
modelId: (
|
|
4298
|
+
id: (_h = value.message.id) != null ? _h : void 0,
|
|
4299
|
+
modelId: (_i = value.message.model) != null ? _i : void 0
|
|
3940
4300
|
});
|
|
3941
4301
|
if (value.message.content != null) {
|
|
3942
4302
|
for (let contentIndex = 0; contentIndex < value.message.content.length; contentIndex++) {
|
|
@@ -3952,7 +4312,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3952
4312
|
id: part.id,
|
|
3953
4313
|
toolName: part.name
|
|
3954
4314
|
});
|
|
3955
|
-
const inputStr = JSON.stringify((
|
|
4315
|
+
const inputStr = JSON.stringify((_j = part.input) != null ? _j : {});
|
|
3956
4316
|
controller.enqueue({
|
|
3957
4317
|
type: "tool-input-delta",
|
|
3958
4318
|
id: part.id,
|
|
@@ -4000,17 +4360,17 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4000
4360
|
finishReason: value.delta.stop_reason,
|
|
4001
4361
|
isJsonResponseFromTool
|
|
4002
4362
|
}),
|
|
4003
|
-
raw: (
|
|
4363
|
+
raw: (_k = value.delta.stop_reason) != null ? _k : void 0
|
|
4004
4364
|
};
|
|
4005
|
-
stopSequence = (
|
|
4365
|
+
stopSequence = (_l = value.delta.stop_sequence) != null ? _l : null;
|
|
4006
4366
|
container = value.delta.container != null ? {
|
|
4007
4367
|
expiresAt: value.delta.container.expires_at,
|
|
4008
4368
|
id: value.delta.container.id,
|
|
4009
|
-
skills: (
|
|
4369
|
+
skills: (_n = (_m = value.delta.container.skills) == null ? void 0 : _m.map((skill) => ({
|
|
4010
4370
|
type: skill.type,
|
|
4011
4371
|
skillId: skill.skill_id,
|
|
4012
4372
|
version: skill.version
|
|
4013
|
-
}))) != null ?
|
|
4373
|
+
}))) != null ? _n : null
|
|
4014
4374
|
} : null;
|
|
4015
4375
|
if (value.context_management) {
|
|
4016
4376
|
contextManagement = mapAnthropicResponseContextManagement(
|
|
@@ -4139,6 +4499,24 @@ function getModelCapabilities(modelId) {
|
|
|
4139
4499
|
};
|
|
4140
4500
|
}
|
|
4141
4501
|
}
|
|
4502
|
+
function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
4503
|
+
if (!tools) {
|
|
4504
|
+
return false;
|
|
4505
|
+
}
|
|
4506
|
+
let hasWebTool20260209 = false;
|
|
4507
|
+
let hasCodeExecutionTool = false;
|
|
4508
|
+
for (const tool of tools) {
|
|
4509
|
+
if ("type" in tool && (tool.type === "web_fetch_20260209" || tool.type === "web_search_20260209")) {
|
|
4510
|
+
hasWebTool20260209 = true;
|
|
4511
|
+
continue;
|
|
4512
|
+
}
|
|
4513
|
+
if (tool.name === "code_execution") {
|
|
4514
|
+
hasCodeExecutionTool = true;
|
|
4515
|
+
break;
|
|
4516
|
+
}
|
|
4517
|
+
}
|
|
4518
|
+
return hasWebTool20260209 && !hasCodeExecutionTool;
|
|
4519
|
+
}
|
|
4142
4520
|
function mapAnthropicResponseContextManagement(contextManagement) {
|
|
4143
4521
|
return contextManagement ? {
|
|
4144
4522
|
appliedEdits: contextManagement.applied_edits.map((edit) => {
|
|
@@ -4166,149 +4544,44 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4166
4544
|
}
|
|
4167
4545
|
|
|
4168
4546
|
// src/tool/bash_20241022.ts
|
|
4169
|
-
var
|
|
4170
|
-
var
|
|
4171
|
-
var bash_20241022InputSchema = (0,
|
|
4172
|
-
() => (0,
|
|
4173
|
-
|
|
4174
|
-
command:
|
|
4175
|
-
restart:
|
|
4547
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
4548
|
+
var import_v413 = require("zod/v4");
|
|
4549
|
+
var bash_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
4550
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
4551
|
+
import_v413.z.object({
|
|
4552
|
+
command: import_v413.z.string(),
|
|
4553
|
+
restart: import_v413.z.boolean().optional()
|
|
4176
4554
|
})
|
|
4177
4555
|
)
|
|
4178
4556
|
);
|
|
4179
|
-
var bash_20241022 = (0,
|
|
4557
|
+
var bash_20241022 = (0, import_provider_utils16.createProviderToolFactory)({
|
|
4180
4558
|
id: "anthropic.bash_20241022",
|
|
4181
4559
|
inputSchema: bash_20241022InputSchema
|
|
4182
4560
|
});
|
|
4183
4561
|
|
|
4184
4562
|
// src/tool/bash_20250124.ts
|
|
4185
|
-
var
|
|
4186
|
-
var
|
|
4187
|
-
var bash_20250124InputSchema = (0,
|
|
4188
|
-
() => (0,
|
|
4189
|
-
|
|
4190
|
-
command:
|
|
4191
|
-
restart:
|
|
4563
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4564
|
+
var import_v414 = require("zod/v4");
|
|
4565
|
+
var bash_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4566
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
4567
|
+
import_v414.z.object({
|
|
4568
|
+
command: import_v414.z.string(),
|
|
4569
|
+
restart: import_v414.z.boolean().optional()
|
|
4192
4570
|
})
|
|
4193
4571
|
)
|
|
4194
4572
|
);
|
|
4195
|
-
var bash_20250124 = (0,
|
|
4573
|
+
var bash_20250124 = (0, import_provider_utils17.createProviderToolFactory)({
|
|
4196
4574
|
id: "anthropic.bash_20250124",
|
|
4197
4575
|
inputSchema: bash_20250124InputSchema
|
|
4198
4576
|
});
|
|
4199
4577
|
|
|
4200
|
-
// src/tool/code-execution_20260120.ts
|
|
4201
|
-
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
4202
|
-
var import_v412 = require("zod/v4");
|
|
4203
|
-
var codeExecution_20260120OutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4204
|
-
() => (0, import_provider_utils15.zodSchema)(
|
|
4205
|
-
import_v412.z.discriminatedUnion("type", [
|
|
4206
|
-
import_v412.z.object({
|
|
4207
|
-
type: import_v412.z.literal("code_execution_result"),
|
|
4208
|
-
stdout: import_v412.z.string(),
|
|
4209
|
-
stderr: import_v412.z.string(),
|
|
4210
|
-
return_code: import_v412.z.number(),
|
|
4211
|
-
content: import_v412.z.array(
|
|
4212
|
-
import_v412.z.object({
|
|
4213
|
-
type: import_v412.z.literal("code_execution_output"),
|
|
4214
|
-
file_id: import_v412.z.string()
|
|
4215
|
-
})
|
|
4216
|
-
).optional().default([])
|
|
4217
|
-
}),
|
|
4218
|
-
import_v412.z.object({
|
|
4219
|
-
type: import_v412.z.literal("bash_code_execution_result"),
|
|
4220
|
-
content: import_v412.z.array(
|
|
4221
|
-
import_v412.z.object({
|
|
4222
|
-
type: import_v412.z.literal("bash_code_execution_output"),
|
|
4223
|
-
file_id: import_v412.z.string()
|
|
4224
|
-
})
|
|
4225
|
-
),
|
|
4226
|
-
stdout: import_v412.z.string(),
|
|
4227
|
-
stderr: import_v412.z.string(),
|
|
4228
|
-
return_code: import_v412.z.number()
|
|
4229
|
-
}),
|
|
4230
|
-
import_v412.z.object({
|
|
4231
|
-
type: import_v412.z.literal("bash_code_execution_tool_result_error"),
|
|
4232
|
-
error_code: import_v412.z.string()
|
|
4233
|
-
}),
|
|
4234
|
-
import_v412.z.object({
|
|
4235
|
-
type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
|
|
4236
|
-
error_code: import_v412.z.string()
|
|
4237
|
-
}),
|
|
4238
|
-
import_v412.z.object({
|
|
4239
|
-
type: import_v412.z.literal("text_editor_code_execution_view_result"),
|
|
4240
|
-
content: import_v412.z.string(),
|
|
4241
|
-
file_type: import_v412.z.string(),
|
|
4242
|
-
num_lines: import_v412.z.number().nullable(),
|
|
4243
|
-
start_line: import_v412.z.number().nullable(),
|
|
4244
|
-
total_lines: import_v412.z.number().nullable()
|
|
4245
|
-
}),
|
|
4246
|
-
import_v412.z.object({
|
|
4247
|
-
type: import_v412.z.literal("text_editor_code_execution_create_result"),
|
|
4248
|
-
is_file_update: import_v412.z.boolean()
|
|
4249
|
-
}),
|
|
4250
|
-
import_v412.z.object({
|
|
4251
|
-
type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
|
|
4252
|
-
lines: import_v412.z.array(import_v412.z.string()).nullable(),
|
|
4253
|
-
new_lines: import_v412.z.number().nullable(),
|
|
4254
|
-
new_start: import_v412.z.number().nullable(),
|
|
4255
|
-
old_lines: import_v412.z.number().nullable(),
|
|
4256
|
-
old_start: import_v412.z.number().nullable()
|
|
4257
|
-
})
|
|
4258
|
-
])
|
|
4259
|
-
)
|
|
4260
|
-
);
|
|
4261
|
-
var codeExecution_20260120InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4262
|
-
() => (0, import_provider_utils15.zodSchema)(
|
|
4263
|
-
import_v412.z.discriminatedUnion("type", [
|
|
4264
|
-
import_v412.z.object({
|
|
4265
|
-
type: import_v412.z.literal("programmatic-tool-call"),
|
|
4266
|
-
code: import_v412.z.string()
|
|
4267
|
-
}),
|
|
4268
|
-
import_v412.z.object({
|
|
4269
|
-
type: import_v412.z.literal("bash_code_execution"),
|
|
4270
|
-
command: import_v412.z.string()
|
|
4271
|
-
}),
|
|
4272
|
-
import_v412.z.discriminatedUnion("command", [
|
|
4273
|
-
import_v412.z.object({
|
|
4274
|
-
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4275
|
-
command: import_v412.z.literal("view"),
|
|
4276
|
-
path: import_v412.z.string()
|
|
4277
|
-
}),
|
|
4278
|
-
import_v412.z.object({
|
|
4279
|
-
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4280
|
-
command: import_v412.z.literal("create"),
|
|
4281
|
-
path: import_v412.z.string(),
|
|
4282
|
-
file_text: import_v412.z.string().nullish()
|
|
4283
|
-
}),
|
|
4284
|
-
import_v412.z.object({
|
|
4285
|
-
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4286
|
-
command: import_v412.z.literal("str_replace"),
|
|
4287
|
-
path: import_v412.z.string(),
|
|
4288
|
-
old_str: import_v412.z.string(),
|
|
4289
|
-
new_str: import_v412.z.string()
|
|
4290
|
-
})
|
|
4291
|
-
])
|
|
4292
|
-
])
|
|
4293
|
-
)
|
|
4294
|
-
);
|
|
4295
|
-
var factory7 = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
4296
|
-
id: "anthropic.code_execution_20260120",
|
|
4297
|
-
inputSchema: codeExecution_20260120InputSchema,
|
|
4298
|
-
outputSchema: codeExecution_20260120OutputSchema,
|
|
4299
|
-
supportsDeferredResults: true
|
|
4300
|
-
});
|
|
4301
|
-
var codeExecution_20260120 = (args = {}) => {
|
|
4302
|
-
return factory7(args);
|
|
4303
|
-
};
|
|
4304
|
-
|
|
4305
4578
|
// src/tool/computer_20241022.ts
|
|
4306
|
-
var
|
|
4307
|
-
var
|
|
4308
|
-
var computer_20241022InputSchema = (0,
|
|
4309
|
-
() => (0,
|
|
4310
|
-
|
|
4311
|
-
action:
|
|
4579
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
4580
|
+
var import_v415 = require("zod/v4");
|
|
4581
|
+
var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
4582
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
4583
|
+
import_v415.z.object({
|
|
4584
|
+
action: import_v415.z.enum([
|
|
4312
4585
|
"key",
|
|
4313
4586
|
"type",
|
|
4314
4587
|
"mouse_move",
|
|
@@ -4320,23 +4593,23 @@ var computer_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
|
4320
4593
|
"screenshot",
|
|
4321
4594
|
"cursor_position"
|
|
4322
4595
|
]),
|
|
4323
|
-
coordinate:
|
|
4324
|
-
text:
|
|
4596
|
+
coordinate: import_v415.z.array(import_v415.z.number().int()).optional(),
|
|
4597
|
+
text: import_v415.z.string().optional()
|
|
4325
4598
|
})
|
|
4326
4599
|
)
|
|
4327
4600
|
);
|
|
4328
|
-
var computer_20241022 = (0,
|
|
4601
|
+
var computer_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
4329
4602
|
id: "anthropic.computer_20241022",
|
|
4330
4603
|
inputSchema: computer_20241022InputSchema
|
|
4331
4604
|
});
|
|
4332
4605
|
|
|
4333
4606
|
// src/tool/computer_20250124.ts
|
|
4334
|
-
var
|
|
4335
|
-
var
|
|
4336
|
-
var computer_20250124InputSchema = (0,
|
|
4337
|
-
() => (0,
|
|
4338
|
-
|
|
4339
|
-
action:
|
|
4607
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4608
|
+
var import_v416 = require("zod/v4");
|
|
4609
|
+
var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4610
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
4611
|
+
import_v416.z.object({
|
|
4612
|
+
action: import_v416.z.enum([
|
|
4340
4613
|
"key",
|
|
4341
4614
|
"hold_key",
|
|
4342
4615
|
"type",
|
|
@@ -4354,27 +4627,27 @@ var computer_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
4354
4627
|
"wait",
|
|
4355
4628
|
"screenshot"
|
|
4356
4629
|
]),
|
|
4357
|
-
coordinate:
|
|
4358
|
-
duration:
|
|
4359
|
-
scroll_amount:
|
|
4360
|
-
scroll_direction:
|
|
4361
|
-
start_coordinate:
|
|
4362
|
-
text:
|
|
4630
|
+
coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
|
|
4631
|
+
duration: import_v416.z.number().optional(),
|
|
4632
|
+
scroll_amount: import_v416.z.number().optional(),
|
|
4633
|
+
scroll_direction: import_v416.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4634
|
+
start_coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
|
|
4635
|
+
text: import_v416.z.string().optional()
|
|
4363
4636
|
})
|
|
4364
4637
|
)
|
|
4365
4638
|
);
|
|
4366
|
-
var computer_20250124 = (0,
|
|
4639
|
+
var computer_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
4367
4640
|
id: "anthropic.computer_20250124",
|
|
4368
4641
|
inputSchema: computer_20250124InputSchema
|
|
4369
4642
|
});
|
|
4370
4643
|
|
|
4371
4644
|
// src/tool/computer_20251124.ts
|
|
4372
|
-
var
|
|
4373
|
-
var
|
|
4374
|
-
var computer_20251124InputSchema = (0,
|
|
4375
|
-
() => (0,
|
|
4376
|
-
|
|
4377
|
-
action:
|
|
4645
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
4646
|
+
var import_v417 = require("zod/v4");
|
|
4647
|
+
var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
4648
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
4649
|
+
import_v417.z.object({
|
|
4650
|
+
action: import_v417.z.enum([
|
|
4378
4651
|
"key",
|
|
4379
4652
|
"hold_key",
|
|
4380
4653
|
"type",
|
|
@@ -4393,173 +4666,173 @@ var computer_20251124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
4393
4666
|
"screenshot",
|
|
4394
4667
|
"zoom"
|
|
4395
4668
|
]),
|
|
4396
|
-
coordinate:
|
|
4397
|
-
duration:
|
|
4398
|
-
region:
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4669
|
+
coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
|
|
4670
|
+
duration: import_v417.z.number().optional(),
|
|
4671
|
+
region: import_v417.z.tuple([
|
|
4672
|
+
import_v417.z.number().int(),
|
|
4673
|
+
import_v417.z.number().int(),
|
|
4674
|
+
import_v417.z.number().int(),
|
|
4675
|
+
import_v417.z.number().int()
|
|
4403
4676
|
]).optional(),
|
|
4404
|
-
scroll_amount:
|
|
4405
|
-
scroll_direction:
|
|
4406
|
-
start_coordinate:
|
|
4407
|
-
text:
|
|
4677
|
+
scroll_amount: import_v417.z.number().optional(),
|
|
4678
|
+
scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4679
|
+
start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
|
|
4680
|
+
text: import_v417.z.string().optional()
|
|
4408
4681
|
})
|
|
4409
4682
|
)
|
|
4410
4683
|
);
|
|
4411
|
-
var computer_20251124 = (0,
|
|
4684
|
+
var computer_20251124 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
4412
4685
|
id: "anthropic.computer_20251124",
|
|
4413
4686
|
inputSchema: computer_20251124InputSchema
|
|
4414
4687
|
});
|
|
4415
4688
|
|
|
4416
4689
|
// src/tool/memory_20250818.ts
|
|
4417
|
-
var
|
|
4418
|
-
var
|
|
4419
|
-
var memory_20250818InputSchema = (0,
|
|
4420
|
-
() => (0,
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
command:
|
|
4424
|
-
path:
|
|
4425
|
-
view_range:
|
|
4690
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
4691
|
+
var import_v418 = require("zod/v4");
|
|
4692
|
+
var memory_20250818InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
4693
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
4694
|
+
import_v418.z.discriminatedUnion("command", [
|
|
4695
|
+
import_v418.z.object({
|
|
4696
|
+
command: import_v418.z.literal("view"),
|
|
4697
|
+
path: import_v418.z.string(),
|
|
4698
|
+
view_range: import_v418.z.tuple([import_v418.z.number(), import_v418.z.number()]).optional()
|
|
4426
4699
|
}),
|
|
4427
|
-
|
|
4428
|
-
command:
|
|
4429
|
-
path:
|
|
4430
|
-
file_text:
|
|
4700
|
+
import_v418.z.object({
|
|
4701
|
+
command: import_v418.z.literal("create"),
|
|
4702
|
+
path: import_v418.z.string(),
|
|
4703
|
+
file_text: import_v418.z.string()
|
|
4431
4704
|
}),
|
|
4432
|
-
|
|
4433
|
-
command:
|
|
4434
|
-
path:
|
|
4435
|
-
old_str:
|
|
4436
|
-
new_str:
|
|
4705
|
+
import_v418.z.object({
|
|
4706
|
+
command: import_v418.z.literal("str_replace"),
|
|
4707
|
+
path: import_v418.z.string(),
|
|
4708
|
+
old_str: import_v418.z.string(),
|
|
4709
|
+
new_str: import_v418.z.string()
|
|
4437
4710
|
}),
|
|
4438
|
-
|
|
4439
|
-
command:
|
|
4440
|
-
path:
|
|
4441
|
-
insert_line:
|
|
4442
|
-
insert_text:
|
|
4711
|
+
import_v418.z.object({
|
|
4712
|
+
command: import_v418.z.literal("insert"),
|
|
4713
|
+
path: import_v418.z.string(),
|
|
4714
|
+
insert_line: import_v418.z.number(),
|
|
4715
|
+
insert_text: import_v418.z.string()
|
|
4443
4716
|
}),
|
|
4444
|
-
|
|
4445
|
-
command:
|
|
4446
|
-
path:
|
|
4717
|
+
import_v418.z.object({
|
|
4718
|
+
command: import_v418.z.literal("delete"),
|
|
4719
|
+
path: import_v418.z.string()
|
|
4447
4720
|
}),
|
|
4448
|
-
|
|
4449
|
-
command:
|
|
4450
|
-
old_path:
|
|
4451
|
-
new_path:
|
|
4721
|
+
import_v418.z.object({
|
|
4722
|
+
command: import_v418.z.literal("rename"),
|
|
4723
|
+
old_path: import_v418.z.string(),
|
|
4724
|
+
new_path: import_v418.z.string()
|
|
4452
4725
|
})
|
|
4453
4726
|
])
|
|
4454
4727
|
)
|
|
4455
4728
|
);
|
|
4456
|
-
var memory_20250818 = (0,
|
|
4729
|
+
var memory_20250818 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
4457
4730
|
id: "anthropic.memory_20250818",
|
|
4458
4731
|
inputSchema: memory_20250818InputSchema
|
|
4459
4732
|
});
|
|
4460
4733
|
|
|
4461
4734
|
// src/tool/text-editor_20241022.ts
|
|
4462
|
-
var
|
|
4463
|
-
var
|
|
4464
|
-
var textEditor_20241022InputSchema = (0,
|
|
4465
|
-
() => (0,
|
|
4466
|
-
|
|
4467
|
-
command:
|
|
4468
|
-
path:
|
|
4469
|
-
file_text:
|
|
4470
|
-
insert_line:
|
|
4471
|
-
new_str:
|
|
4472
|
-
insert_text:
|
|
4473
|
-
old_str:
|
|
4474
|
-
view_range:
|
|
4735
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
4736
|
+
var import_v419 = require("zod/v4");
|
|
4737
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
4738
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
4739
|
+
import_v419.z.object({
|
|
4740
|
+
command: import_v419.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4741
|
+
path: import_v419.z.string(),
|
|
4742
|
+
file_text: import_v419.z.string().optional(),
|
|
4743
|
+
insert_line: import_v419.z.number().int().optional(),
|
|
4744
|
+
new_str: import_v419.z.string().optional(),
|
|
4745
|
+
insert_text: import_v419.z.string().optional(),
|
|
4746
|
+
old_str: import_v419.z.string().optional(),
|
|
4747
|
+
view_range: import_v419.z.array(import_v419.z.number().int()).optional()
|
|
4475
4748
|
})
|
|
4476
4749
|
)
|
|
4477
4750
|
);
|
|
4478
|
-
var textEditor_20241022 = (0,
|
|
4751
|
+
var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
4479
4752
|
id: "anthropic.text_editor_20241022",
|
|
4480
4753
|
inputSchema: textEditor_20241022InputSchema
|
|
4481
4754
|
});
|
|
4482
4755
|
|
|
4483
4756
|
// src/tool/text-editor_20250124.ts
|
|
4484
|
-
var
|
|
4485
|
-
var
|
|
4486
|
-
var textEditor_20250124InputSchema = (0,
|
|
4487
|
-
() => (0,
|
|
4488
|
-
|
|
4489
|
-
command:
|
|
4490
|
-
path:
|
|
4491
|
-
file_text:
|
|
4492
|
-
insert_line:
|
|
4493
|
-
new_str:
|
|
4494
|
-
insert_text:
|
|
4495
|
-
old_str:
|
|
4496
|
-
view_range:
|
|
4757
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
4758
|
+
var import_v420 = require("zod/v4");
|
|
4759
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
4760
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
4761
|
+
import_v420.z.object({
|
|
4762
|
+
command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4763
|
+
path: import_v420.z.string(),
|
|
4764
|
+
file_text: import_v420.z.string().optional(),
|
|
4765
|
+
insert_line: import_v420.z.number().int().optional(),
|
|
4766
|
+
new_str: import_v420.z.string().optional(),
|
|
4767
|
+
insert_text: import_v420.z.string().optional(),
|
|
4768
|
+
old_str: import_v420.z.string().optional(),
|
|
4769
|
+
view_range: import_v420.z.array(import_v420.z.number().int()).optional()
|
|
4497
4770
|
})
|
|
4498
4771
|
)
|
|
4499
4772
|
);
|
|
4500
|
-
var textEditor_20250124 = (0,
|
|
4773
|
+
var textEditor_20250124 = (0, import_provider_utils23.createProviderToolFactory)({
|
|
4501
4774
|
id: "anthropic.text_editor_20250124",
|
|
4502
4775
|
inputSchema: textEditor_20250124InputSchema
|
|
4503
4776
|
});
|
|
4504
4777
|
|
|
4505
4778
|
// src/tool/text-editor_20250429.ts
|
|
4506
|
-
var
|
|
4507
|
-
var
|
|
4508
|
-
var textEditor_20250429InputSchema = (0,
|
|
4509
|
-
() => (0,
|
|
4510
|
-
|
|
4511
|
-
command:
|
|
4512
|
-
path:
|
|
4513
|
-
file_text:
|
|
4514
|
-
insert_line:
|
|
4515
|
-
new_str:
|
|
4516
|
-
insert_text:
|
|
4517
|
-
old_str:
|
|
4518
|
-
view_range:
|
|
4779
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
4780
|
+
var import_v421 = require("zod/v4");
|
|
4781
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
4782
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
4783
|
+
import_v421.z.object({
|
|
4784
|
+
command: import_v421.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4785
|
+
path: import_v421.z.string(),
|
|
4786
|
+
file_text: import_v421.z.string().optional(),
|
|
4787
|
+
insert_line: import_v421.z.number().int().optional(),
|
|
4788
|
+
new_str: import_v421.z.string().optional(),
|
|
4789
|
+
insert_text: import_v421.z.string().optional(),
|
|
4790
|
+
old_str: import_v421.z.string().optional(),
|
|
4791
|
+
view_range: import_v421.z.array(import_v421.z.number().int()).optional()
|
|
4519
4792
|
})
|
|
4520
4793
|
)
|
|
4521
4794
|
);
|
|
4522
|
-
var textEditor_20250429 = (0,
|
|
4795
|
+
var textEditor_20250429 = (0, import_provider_utils24.createProviderToolFactory)({
|
|
4523
4796
|
id: "anthropic.text_editor_20250429",
|
|
4524
4797
|
inputSchema: textEditor_20250429InputSchema
|
|
4525
4798
|
});
|
|
4526
4799
|
|
|
4527
4800
|
// src/tool/tool-search-bm25_20251119.ts
|
|
4528
|
-
var
|
|
4529
|
-
var
|
|
4530
|
-
var toolSearchBm25_20251119OutputSchema = (0,
|
|
4531
|
-
() => (0,
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
type:
|
|
4535
|
-
toolName:
|
|
4801
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
4802
|
+
var import_v422 = require("zod/v4");
|
|
4803
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
4804
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
4805
|
+
import_v422.z.array(
|
|
4806
|
+
import_v422.z.object({
|
|
4807
|
+
type: import_v422.z.literal("tool_reference"),
|
|
4808
|
+
toolName: import_v422.z.string()
|
|
4536
4809
|
})
|
|
4537
4810
|
)
|
|
4538
4811
|
)
|
|
4539
4812
|
);
|
|
4540
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
4541
|
-
() => (0,
|
|
4542
|
-
|
|
4813
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
4814
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
4815
|
+
import_v422.z.object({
|
|
4543
4816
|
/**
|
|
4544
4817
|
* A natural language query to search for tools.
|
|
4545
4818
|
* Claude will use BM25 text search to find relevant tools.
|
|
4546
4819
|
*/
|
|
4547
|
-
query:
|
|
4820
|
+
query: import_v422.z.string(),
|
|
4548
4821
|
/**
|
|
4549
4822
|
* Maximum number of tools to return. Optional.
|
|
4550
4823
|
*/
|
|
4551
|
-
limit:
|
|
4824
|
+
limit: import_v422.z.number().optional()
|
|
4552
4825
|
})
|
|
4553
4826
|
)
|
|
4554
4827
|
);
|
|
4555
|
-
var
|
|
4828
|
+
var factory10 = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
|
|
4556
4829
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4557
4830
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4558
4831
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
4559
4832
|
supportsDeferredResults: true
|
|
4560
4833
|
});
|
|
4561
4834
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
4562
|
-
return
|
|
4835
|
+
return factory10(args);
|
|
4563
4836
|
};
|
|
4564
4837
|
|
|
4565
4838
|
// src/anthropic-tools.ts
|
|
@@ -4706,6 +4979,16 @@ var anthropicTools = {
|
|
|
4706
4979
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
4707
4980
|
*/
|
|
4708
4981
|
webFetch_20250910,
|
|
4982
|
+
/**
|
|
4983
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
4984
|
+
*
|
|
4985
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
4986
|
+
* @param allowedDomains - Only fetch from these domains
|
|
4987
|
+
* @param blockedDomains - Never fetch from these domains
|
|
4988
|
+
* @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.
|
|
4989
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
4990
|
+
*/
|
|
4991
|
+
webFetch_20260209,
|
|
4709
4992
|
/**
|
|
4710
4993
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
4711
4994
|
*
|
|
@@ -4715,6 +4998,15 @@ var anthropicTools = {
|
|
|
4715
4998
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
4716
4999
|
*/
|
|
4717
5000
|
webSearch_20250305,
|
|
5001
|
+
/**
|
|
5002
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
5003
|
+
*
|
|
5004
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
5005
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
5006
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
5007
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
5008
|
+
*/
|
|
5009
|
+
webSearch_20260209,
|
|
4718
5010
|
/**
|
|
4719
5011
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
4720
5012
|
*
|