@ai-sdk/anthropic 3.0.53 → 3.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +116 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.js +743 -451
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +728 -428
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +118 -2
- package/dist/internal/index.d.ts +118 -2
- package/dist/internal/index.js +736 -444
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +727 -427
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-messages-api.ts +61 -2
- package/src/anthropic-messages-language-model.ts +93 -1
- package/src/anthropic-prepare-tools.ts +37 -0
- package/src/anthropic-tools.ts +23 -0
- package/src/convert-to-anthropic-messages-prompt.ts +37 -3
- package/src/tool/code-execution_20260120.ts +38 -0
- package/src/tool/web-fetch-20260209.ts +145 -0
- package/src/tool/web-search_20260209.ts +136 -0
package/dist/index.js
CHANGED
|
@@ -29,14 +29,14 @@ module.exports = __toCommonJS(src_exports);
|
|
|
29
29
|
|
|
30
30
|
// src/anthropic-provider.ts
|
|
31
31
|
var import_provider4 = require("@ai-sdk/provider");
|
|
32
|
-
var
|
|
32
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.55" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/anthropic-messages-language-model.ts
|
|
38
38
|
var import_provider3 = require("@ai-sdk/provider");
|
|
39
|
-
var
|
|
39
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
40
40
|
|
|
41
41
|
// src/anthropic-error.ts
|
|
42
42
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -136,7 +136,16 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
136
136
|
type: import_v42.z.literal("server_tool_use"),
|
|
137
137
|
id: import_v42.z.string(),
|
|
138
138
|
name: import_v42.z.string(),
|
|
139
|
-
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish()
|
|
139
|
+
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
140
|
+
caller: import_v42.z.union([
|
|
141
|
+
import_v42.z.object({
|
|
142
|
+
type: import_v42.z.literal("code_execution_20260120"),
|
|
143
|
+
tool_id: import_v42.z.string()
|
|
144
|
+
}),
|
|
145
|
+
import_v42.z.object({
|
|
146
|
+
type: import_v42.z.literal("direct")
|
|
147
|
+
})
|
|
148
|
+
]).optional()
|
|
140
149
|
}),
|
|
141
150
|
import_v42.z.object({
|
|
142
151
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -224,6 +233,18 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
224
233
|
})
|
|
225
234
|
).optional().default([])
|
|
226
235
|
}),
|
|
236
|
+
import_v42.z.object({
|
|
237
|
+
type: import_v42.z.literal("encrypted_code_execution_result"),
|
|
238
|
+
encrypted_stdout: import_v42.z.string(),
|
|
239
|
+
stderr: import_v42.z.string(),
|
|
240
|
+
return_code: import_v42.z.number(),
|
|
241
|
+
content: import_v42.z.array(
|
|
242
|
+
import_v42.z.object({
|
|
243
|
+
type: import_v42.z.literal("code_execution_output"),
|
|
244
|
+
file_id: import_v42.z.string()
|
|
245
|
+
})
|
|
246
|
+
).optional().default([])
|
|
247
|
+
}),
|
|
227
248
|
import_v42.z.object({
|
|
228
249
|
type: import_v42.z.literal("code_execution_tool_result_error"),
|
|
229
250
|
error_code: import_v42.z.string()
|
|
@@ -446,7 +467,16 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
446
467
|
type: import_v42.z.literal("server_tool_use"),
|
|
447
468
|
id: import_v42.z.string(),
|
|
448
469
|
name: import_v42.z.string(),
|
|
449
|
-
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish()
|
|
470
|
+
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
471
|
+
caller: import_v42.z.union([
|
|
472
|
+
import_v42.z.object({
|
|
473
|
+
type: import_v42.z.literal("code_execution_20260120"),
|
|
474
|
+
tool_id: import_v42.z.string()
|
|
475
|
+
}),
|
|
476
|
+
import_v42.z.object({
|
|
477
|
+
type: import_v42.z.literal("direct")
|
|
478
|
+
})
|
|
479
|
+
]).optional()
|
|
450
480
|
}),
|
|
451
481
|
import_v42.z.object({
|
|
452
482
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -534,6 +564,18 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
534
564
|
})
|
|
535
565
|
).optional().default([])
|
|
536
566
|
}),
|
|
567
|
+
import_v42.z.object({
|
|
568
|
+
type: import_v42.z.literal("encrypted_code_execution_result"),
|
|
569
|
+
encrypted_stdout: import_v42.z.string(),
|
|
570
|
+
stderr: import_v42.z.string(),
|
|
571
|
+
return_code: import_v42.z.number(),
|
|
572
|
+
content: import_v42.z.array(
|
|
573
|
+
import_v42.z.object({
|
|
574
|
+
type: import_v42.z.literal("code_execution_output"),
|
|
575
|
+
file_id: import_v42.z.string()
|
|
576
|
+
})
|
|
577
|
+
).optional().default([])
|
|
578
|
+
}),
|
|
537
579
|
import_v42.z.object({
|
|
538
580
|
type: import_v42.z.literal("code_execution_tool_result_error"),
|
|
539
581
|
error_code: import_v42.z.string()
|
|
@@ -1003,10 +1045,10 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1003
1045
|
return factory(args);
|
|
1004
1046
|
};
|
|
1005
1047
|
|
|
1006
|
-
// src/tool/web-
|
|
1048
|
+
// src/tool/web-search_20260209.ts
|
|
1007
1049
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1008
1050
|
var import_v45 = require("zod/v4");
|
|
1009
|
-
var
|
|
1051
|
+
var webSearch_20260209ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1010
1052
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1011
1053
|
import_v45.z.object({
|
|
1012
1054
|
maxUses: import_v45.z.number().optional(),
|
|
@@ -1022,7 +1064,7 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1022
1064
|
})
|
|
1023
1065
|
)
|
|
1024
1066
|
);
|
|
1025
|
-
var
|
|
1067
|
+
var webSearch_20260209OutputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1026
1068
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1027
1069
|
import_v45.z.array(
|
|
1028
1070
|
import_v45.z.object({
|
|
@@ -1035,7 +1077,7 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1035
1077
|
)
|
|
1036
1078
|
)
|
|
1037
1079
|
);
|
|
1038
|
-
var
|
|
1080
|
+
var webSearch_20260209InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1039
1081
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1040
1082
|
import_v45.z.object({
|
|
1041
1083
|
query: import_v45.z.string()
|
|
@@ -1043,74 +1085,180 @@ var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1043
1085
|
)
|
|
1044
1086
|
);
|
|
1045
1087
|
var factory2 = (0, import_provider_utils5.createProviderToolFactoryWithOutputSchema)({
|
|
1046
|
-
id: "anthropic.
|
|
1047
|
-
inputSchema:
|
|
1048
|
-
outputSchema:
|
|
1088
|
+
id: "anthropic.web_search_20260209",
|
|
1089
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1090
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1049
1091
|
supportsDeferredResults: true
|
|
1050
1092
|
});
|
|
1051
|
-
var
|
|
1093
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1052
1094
|
return factory2(args);
|
|
1053
1095
|
};
|
|
1054
1096
|
|
|
1055
|
-
// src/tool/web-
|
|
1097
|
+
// src/tool/web-search_20250305.ts
|
|
1056
1098
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1057
1099
|
var import_v46 = require("zod/v4");
|
|
1058
|
-
var
|
|
1100
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1059
1101
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1060
1102
|
import_v46.z.object({
|
|
1061
1103
|
maxUses: import_v46.z.number().optional(),
|
|
1062
1104
|
allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1063
1105
|
blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1064
|
-
|
|
1065
|
-
|
|
1106
|
+
userLocation: import_v46.z.object({
|
|
1107
|
+
type: import_v46.z.literal("approximate"),
|
|
1108
|
+
city: import_v46.z.string().optional(),
|
|
1109
|
+
region: import_v46.z.string().optional(),
|
|
1110
|
+
country: import_v46.z.string().optional(),
|
|
1111
|
+
timezone: import_v46.z.string().optional()
|
|
1112
|
+
}).optional()
|
|
1066
1113
|
})
|
|
1067
1114
|
)
|
|
1068
1115
|
);
|
|
1069
|
-
var
|
|
1116
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1070
1117
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1071
|
-
import_v46.z.
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
content: import_v46.z.object({
|
|
1075
|
-
type: import_v46.z.literal("document"),
|
|
1118
|
+
import_v46.z.array(
|
|
1119
|
+
import_v46.z.object({
|
|
1120
|
+
url: import_v46.z.string(),
|
|
1076
1121
|
title: import_v46.z.string().nullable(),
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1122
|
+
pageAge: import_v46.z.string().nullable(),
|
|
1123
|
+
encryptedContent: import_v46.z.string(),
|
|
1124
|
+
type: import_v46.z.literal("web_search_result")
|
|
1125
|
+
})
|
|
1126
|
+
)
|
|
1127
|
+
)
|
|
1128
|
+
);
|
|
1129
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1130
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1131
|
+
import_v46.z.object({
|
|
1132
|
+
query: import_v46.z.string()
|
|
1133
|
+
})
|
|
1134
|
+
)
|
|
1135
|
+
);
|
|
1136
|
+
var factory3 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
|
|
1137
|
+
id: "anthropic.web_search_20250305",
|
|
1138
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1139
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1140
|
+
supportsDeferredResults: true
|
|
1141
|
+
});
|
|
1142
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1143
|
+
return factory3(args);
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
// src/tool/web-fetch-20260209.ts
|
|
1147
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1148
|
+
var import_v47 = require("zod/v4");
|
|
1149
|
+
var webFetch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1150
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1151
|
+
import_v47.z.object({
|
|
1152
|
+
maxUses: import_v47.z.number().optional(),
|
|
1153
|
+
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1154
|
+
blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1155
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1156
|
+
maxContentTokens: import_v47.z.number().optional()
|
|
1157
|
+
})
|
|
1158
|
+
)
|
|
1159
|
+
);
|
|
1160
|
+
var webFetch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1161
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1162
|
+
import_v47.z.object({
|
|
1163
|
+
type: import_v47.z.literal("web_fetch_result"),
|
|
1164
|
+
url: import_v47.z.string(),
|
|
1165
|
+
content: import_v47.z.object({
|
|
1166
|
+
type: import_v47.z.literal("document"),
|
|
1167
|
+
title: import_v47.z.string().nullable(),
|
|
1168
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1169
|
+
source: import_v47.z.union([
|
|
1170
|
+
import_v47.z.object({
|
|
1171
|
+
type: import_v47.z.literal("base64"),
|
|
1172
|
+
mediaType: import_v47.z.literal("application/pdf"),
|
|
1173
|
+
data: import_v47.z.string()
|
|
1083
1174
|
}),
|
|
1084
|
-
|
|
1085
|
-
type:
|
|
1086
|
-
mediaType:
|
|
1087
|
-
data:
|
|
1175
|
+
import_v47.z.object({
|
|
1176
|
+
type: import_v47.z.literal("text"),
|
|
1177
|
+
mediaType: import_v47.z.literal("text/plain"),
|
|
1178
|
+
data: import_v47.z.string()
|
|
1088
1179
|
})
|
|
1089
1180
|
])
|
|
1090
1181
|
}),
|
|
1091
|
-
retrievedAt:
|
|
1182
|
+
retrievedAt: import_v47.z.string().nullable()
|
|
1092
1183
|
})
|
|
1093
1184
|
)
|
|
1094
1185
|
);
|
|
1095
|
-
var
|
|
1096
|
-
() => (0,
|
|
1097
|
-
|
|
1098
|
-
url:
|
|
1186
|
+
var webFetch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1187
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1188
|
+
import_v47.z.object({
|
|
1189
|
+
url: import_v47.z.string()
|
|
1099
1190
|
})
|
|
1100
1191
|
)
|
|
1101
1192
|
);
|
|
1102
|
-
var
|
|
1193
|
+
var factory4 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1194
|
+
id: "anthropic.web_fetch_20260209",
|
|
1195
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1196
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1197
|
+
supportsDeferredResults: true
|
|
1198
|
+
});
|
|
1199
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1200
|
+
return factory4(args);
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1203
|
+
// src/tool/web-fetch-20250910.ts
|
|
1204
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1205
|
+
var import_v48 = require("zod/v4");
|
|
1206
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
1207
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1208
|
+
import_v48.z.object({
|
|
1209
|
+
maxUses: import_v48.z.number().optional(),
|
|
1210
|
+
allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
1211
|
+
blockedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
1212
|
+
citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
|
|
1213
|
+
maxContentTokens: import_v48.z.number().optional()
|
|
1214
|
+
})
|
|
1215
|
+
)
|
|
1216
|
+
);
|
|
1217
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1218
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1219
|
+
import_v48.z.object({
|
|
1220
|
+
type: import_v48.z.literal("web_fetch_result"),
|
|
1221
|
+
url: import_v48.z.string(),
|
|
1222
|
+
content: import_v48.z.object({
|
|
1223
|
+
type: import_v48.z.literal("document"),
|
|
1224
|
+
title: import_v48.z.string().nullable(),
|
|
1225
|
+
citations: import_v48.z.object({ enabled: import_v48.z.boolean() }).optional(),
|
|
1226
|
+
source: import_v48.z.union([
|
|
1227
|
+
import_v48.z.object({
|
|
1228
|
+
type: import_v48.z.literal("base64"),
|
|
1229
|
+
mediaType: import_v48.z.literal("application/pdf"),
|
|
1230
|
+
data: import_v48.z.string()
|
|
1231
|
+
}),
|
|
1232
|
+
import_v48.z.object({
|
|
1233
|
+
type: import_v48.z.literal("text"),
|
|
1234
|
+
mediaType: import_v48.z.literal("text/plain"),
|
|
1235
|
+
data: import_v48.z.string()
|
|
1236
|
+
})
|
|
1237
|
+
])
|
|
1238
|
+
}),
|
|
1239
|
+
retrievedAt: import_v48.z.string().nullable()
|
|
1240
|
+
})
|
|
1241
|
+
)
|
|
1242
|
+
);
|
|
1243
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1244
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1245
|
+
import_v48.z.object({
|
|
1246
|
+
url: import_v48.z.string()
|
|
1247
|
+
})
|
|
1248
|
+
)
|
|
1249
|
+
);
|
|
1250
|
+
var factory5 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1103
1251
|
id: "anthropic.web_fetch_20250910",
|
|
1104
1252
|
inputSchema: webFetch_20250910InputSchema,
|
|
1105
1253
|
outputSchema: webFetch_20250910OutputSchema,
|
|
1106
1254
|
supportsDeferredResults: true
|
|
1107
1255
|
});
|
|
1108
1256
|
var webFetch_20250910 = (args = {}) => {
|
|
1109
|
-
return
|
|
1257
|
+
return factory5(args);
|
|
1110
1258
|
};
|
|
1111
1259
|
|
|
1112
1260
|
// src/anthropic-prepare-tools.ts
|
|
1113
|
-
var
|
|
1261
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1114
1262
|
async function prepareTools({
|
|
1115
1263
|
tools,
|
|
1116
1264
|
toolChoice,
|
|
@@ -1250,7 +1398,7 @@ async function prepareTools({
|
|
|
1250
1398
|
break;
|
|
1251
1399
|
}
|
|
1252
1400
|
case "anthropic.text_editor_20250728": {
|
|
1253
|
-
const args = await (0,
|
|
1401
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1254
1402
|
value: tool.args,
|
|
1255
1403
|
schema: textEditor_20250728ArgsSchema
|
|
1256
1404
|
});
|
|
@@ -1290,7 +1438,7 @@ async function prepareTools({
|
|
|
1290
1438
|
}
|
|
1291
1439
|
case "anthropic.web_fetch_20250910": {
|
|
1292
1440
|
betas.add("web-fetch-2025-09-10");
|
|
1293
|
-
const args = await (0,
|
|
1441
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1294
1442
|
value: tool.args,
|
|
1295
1443
|
schema: webFetch_20250910ArgsSchema
|
|
1296
1444
|
});
|
|
@@ -1306,8 +1454,26 @@ async function prepareTools({
|
|
|
1306
1454
|
});
|
|
1307
1455
|
break;
|
|
1308
1456
|
}
|
|
1457
|
+
case "anthropic.web_fetch_20260209": {
|
|
1458
|
+
betas.add("code-execution-web-tools-2026-02-09");
|
|
1459
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1460
|
+
value: tool.args,
|
|
1461
|
+
schema: webFetch_20260209ArgsSchema
|
|
1462
|
+
});
|
|
1463
|
+
anthropicTools2.push({
|
|
1464
|
+
type: "web_fetch_20260209",
|
|
1465
|
+
name: "web_fetch",
|
|
1466
|
+
max_uses: args.maxUses,
|
|
1467
|
+
allowed_domains: args.allowedDomains,
|
|
1468
|
+
blocked_domains: args.blockedDomains,
|
|
1469
|
+
citations: args.citations,
|
|
1470
|
+
max_content_tokens: args.maxContentTokens,
|
|
1471
|
+
cache_control: void 0
|
|
1472
|
+
});
|
|
1473
|
+
break;
|
|
1474
|
+
}
|
|
1309
1475
|
case "anthropic.web_search_20250305": {
|
|
1310
|
-
const args = await (0,
|
|
1476
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1311
1477
|
value: tool.args,
|
|
1312
1478
|
schema: webSearch_20250305ArgsSchema
|
|
1313
1479
|
});
|
|
@@ -1322,6 +1488,23 @@ async function prepareTools({
|
|
|
1322
1488
|
});
|
|
1323
1489
|
break;
|
|
1324
1490
|
}
|
|
1491
|
+
case "anthropic.web_search_20260209": {
|
|
1492
|
+
betas.add("code-execution-web-tools-2026-02-09");
|
|
1493
|
+
const args = await (0, import_provider_utils9.validateTypes)({
|
|
1494
|
+
value: tool.args,
|
|
1495
|
+
schema: webSearch_20260209ArgsSchema
|
|
1496
|
+
});
|
|
1497
|
+
anthropicTools2.push({
|
|
1498
|
+
type: "web_search_20260209",
|
|
1499
|
+
name: "web_search",
|
|
1500
|
+
max_uses: args.maxUses,
|
|
1501
|
+
allowed_domains: args.allowedDomains,
|
|
1502
|
+
blocked_domains: args.blockedDomains,
|
|
1503
|
+
user_location: args.userLocation,
|
|
1504
|
+
cache_control: void 0
|
|
1505
|
+
});
|
|
1506
|
+
break;
|
|
1507
|
+
}
|
|
1325
1508
|
case "anthropic.tool_search_regex_20251119": {
|
|
1326
1509
|
betas.add("advanced-tool-use-2025-11-20");
|
|
1327
1510
|
anthropicTools2.push({
|
|
@@ -1451,140 +1634,140 @@ function convertAnthropicMessagesUsage({
|
|
|
1451
1634
|
|
|
1452
1635
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1453
1636
|
var import_provider2 = require("@ai-sdk/provider");
|
|
1454
|
-
var
|
|
1637
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
1455
1638
|
|
|
1456
1639
|
// src/tool/code-execution_20250522.ts
|
|
1457
|
-
var
|
|
1458
|
-
var
|
|
1459
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
1460
|
-
() => (0,
|
|
1461
|
-
|
|
1462
|
-
type:
|
|
1463
|
-
stdout:
|
|
1464
|
-
stderr:
|
|
1465
|
-
return_code:
|
|
1466
|
-
content:
|
|
1467
|
-
|
|
1468
|
-
type:
|
|
1469
|
-
file_id:
|
|
1640
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1641
|
+
var import_v49 = require("zod/v4");
|
|
1642
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1643
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1644
|
+
import_v49.z.object({
|
|
1645
|
+
type: import_v49.z.literal("code_execution_result"),
|
|
1646
|
+
stdout: import_v49.z.string(),
|
|
1647
|
+
stderr: import_v49.z.string(),
|
|
1648
|
+
return_code: import_v49.z.number(),
|
|
1649
|
+
content: import_v49.z.array(
|
|
1650
|
+
import_v49.z.object({
|
|
1651
|
+
type: import_v49.z.literal("code_execution_output"),
|
|
1652
|
+
file_id: import_v49.z.string()
|
|
1470
1653
|
})
|
|
1471
1654
|
).optional().default([])
|
|
1472
1655
|
})
|
|
1473
1656
|
)
|
|
1474
1657
|
);
|
|
1475
|
-
var codeExecution_20250522InputSchema = (0,
|
|
1476
|
-
() => (0,
|
|
1477
|
-
|
|
1478
|
-
code:
|
|
1658
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1659
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1660
|
+
import_v49.z.object({
|
|
1661
|
+
code: import_v49.z.string()
|
|
1479
1662
|
})
|
|
1480
1663
|
)
|
|
1481
1664
|
);
|
|
1482
|
-
var
|
|
1665
|
+
var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
|
|
1483
1666
|
id: "anthropic.code_execution_20250522",
|
|
1484
1667
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1485
1668
|
outputSchema: codeExecution_20250522OutputSchema
|
|
1486
1669
|
});
|
|
1487
1670
|
var codeExecution_20250522 = (args = {}) => {
|
|
1488
|
-
return
|
|
1671
|
+
return factory6(args);
|
|
1489
1672
|
};
|
|
1490
1673
|
|
|
1491
1674
|
// src/tool/code-execution_20250825.ts
|
|
1492
|
-
var
|
|
1493
|
-
var
|
|
1494
|
-
var codeExecution_20250825OutputSchema = (0,
|
|
1495
|
-
() => (0,
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
type:
|
|
1499
|
-
stdout:
|
|
1500
|
-
stderr:
|
|
1501
|
-
return_code:
|
|
1502
|
-
content:
|
|
1503
|
-
|
|
1504
|
-
type:
|
|
1505
|
-
file_id:
|
|
1675
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1676
|
+
var import_v410 = require("zod/v4");
|
|
1677
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1678
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
1679
|
+
import_v410.z.discriminatedUnion("type", [
|
|
1680
|
+
import_v410.z.object({
|
|
1681
|
+
type: import_v410.z.literal("code_execution_result"),
|
|
1682
|
+
stdout: import_v410.z.string(),
|
|
1683
|
+
stderr: import_v410.z.string(),
|
|
1684
|
+
return_code: import_v410.z.number(),
|
|
1685
|
+
content: import_v410.z.array(
|
|
1686
|
+
import_v410.z.object({
|
|
1687
|
+
type: import_v410.z.literal("code_execution_output"),
|
|
1688
|
+
file_id: import_v410.z.string()
|
|
1506
1689
|
})
|
|
1507
1690
|
).optional().default([])
|
|
1508
1691
|
}),
|
|
1509
|
-
|
|
1510
|
-
type:
|
|
1511
|
-
content:
|
|
1512
|
-
|
|
1513
|
-
type:
|
|
1514
|
-
file_id:
|
|
1692
|
+
import_v410.z.object({
|
|
1693
|
+
type: import_v410.z.literal("bash_code_execution_result"),
|
|
1694
|
+
content: import_v410.z.array(
|
|
1695
|
+
import_v410.z.object({
|
|
1696
|
+
type: import_v410.z.literal("bash_code_execution_output"),
|
|
1697
|
+
file_id: import_v410.z.string()
|
|
1515
1698
|
})
|
|
1516
1699
|
),
|
|
1517
|
-
stdout:
|
|
1518
|
-
stderr:
|
|
1519
|
-
return_code:
|
|
1700
|
+
stdout: import_v410.z.string(),
|
|
1701
|
+
stderr: import_v410.z.string(),
|
|
1702
|
+
return_code: import_v410.z.number()
|
|
1520
1703
|
}),
|
|
1521
|
-
|
|
1522
|
-
type:
|
|
1523
|
-
error_code:
|
|
1704
|
+
import_v410.z.object({
|
|
1705
|
+
type: import_v410.z.literal("bash_code_execution_tool_result_error"),
|
|
1706
|
+
error_code: import_v410.z.string()
|
|
1524
1707
|
}),
|
|
1525
|
-
|
|
1526
|
-
type:
|
|
1527
|
-
error_code:
|
|
1708
|
+
import_v410.z.object({
|
|
1709
|
+
type: import_v410.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1710
|
+
error_code: import_v410.z.string()
|
|
1528
1711
|
}),
|
|
1529
|
-
|
|
1530
|
-
type:
|
|
1531
|
-
content:
|
|
1532
|
-
file_type:
|
|
1533
|
-
num_lines:
|
|
1534
|
-
start_line:
|
|
1535
|
-
total_lines:
|
|
1712
|
+
import_v410.z.object({
|
|
1713
|
+
type: import_v410.z.literal("text_editor_code_execution_view_result"),
|
|
1714
|
+
content: import_v410.z.string(),
|
|
1715
|
+
file_type: import_v410.z.string(),
|
|
1716
|
+
num_lines: import_v410.z.number().nullable(),
|
|
1717
|
+
start_line: import_v410.z.number().nullable(),
|
|
1718
|
+
total_lines: import_v410.z.number().nullable()
|
|
1536
1719
|
}),
|
|
1537
|
-
|
|
1538
|
-
type:
|
|
1539
|
-
is_file_update:
|
|
1720
|
+
import_v410.z.object({
|
|
1721
|
+
type: import_v410.z.literal("text_editor_code_execution_create_result"),
|
|
1722
|
+
is_file_update: import_v410.z.boolean()
|
|
1540
1723
|
}),
|
|
1541
|
-
|
|
1542
|
-
type:
|
|
1543
|
-
lines:
|
|
1544
|
-
new_lines:
|
|
1545
|
-
new_start:
|
|
1546
|
-
old_lines:
|
|
1547
|
-
old_start:
|
|
1724
|
+
import_v410.z.object({
|
|
1725
|
+
type: import_v410.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1726
|
+
lines: import_v410.z.array(import_v410.z.string()).nullable(),
|
|
1727
|
+
new_lines: import_v410.z.number().nullable(),
|
|
1728
|
+
new_start: import_v410.z.number().nullable(),
|
|
1729
|
+
old_lines: import_v410.z.number().nullable(),
|
|
1730
|
+
old_start: import_v410.z.number().nullable()
|
|
1548
1731
|
})
|
|
1549
1732
|
])
|
|
1550
1733
|
)
|
|
1551
1734
|
);
|
|
1552
|
-
var codeExecution_20250825InputSchema = (0,
|
|
1553
|
-
() => (0,
|
|
1554
|
-
|
|
1735
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1736
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
1737
|
+
import_v410.z.discriminatedUnion("type", [
|
|
1555
1738
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1556
|
-
|
|
1557
|
-
type:
|
|
1558
|
-
code:
|
|
1739
|
+
import_v410.z.object({
|
|
1740
|
+
type: import_v410.z.literal("programmatic-tool-call"),
|
|
1741
|
+
code: import_v410.z.string()
|
|
1559
1742
|
}),
|
|
1560
|
-
|
|
1561
|
-
type:
|
|
1562
|
-
command:
|
|
1743
|
+
import_v410.z.object({
|
|
1744
|
+
type: import_v410.z.literal("bash_code_execution"),
|
|
1745
|
+
command: import_v410.z.string()
|
|
1563
1746
|
}),
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
type:
|
|
1567
|
-
command:
|
|
1568
|
-
path:
|
|
1747
|
+
import_v410.z.discriminatedUnion("command", [
|
|
1748
|
+
import_v410.z.object({
|
|
1749
|
+
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1750
|
+
command: import_v410.z.literal("view"),
|
|
1751
|
+
path: import_v410.z.string()
|
|
1569
1752
|
}),
|
|
1570
|
-
|
|
1571
|
-
type:
|
|
1572
|
-
command:
|
|
1573
|
-
path:
|
|
1574
|
-
file_text:
|
|
1753
|
+
import_v410.z.object({
|
|
1754
|
+
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1755
|
+
command: import_v410.z.literal("create"),
|
|
1756
|
+
path: import_v410.z.string(),
|
|
1757
|
+
file_text: import_v410.z.string().nullish()
|
|
1575
1758
|
}),
|
|
1576
|
-
|
|
1577
|
-
type:
|
|
1578
|
-
command:
|
|
1579
|
-
path:
|
|
1580
|
-
old_str:
|
|
1581
|
-
new_str:
|
|
1759
|
+
import_v410.z.object({
|
|
1760
|
+
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1761
|
+
command: import_v410.z.literal("str_replace"),
|
|
1762
|
+
path: import_v410.z.string(),
|
|
1763
|
+
old_str: import_v410.z.string(),
|
|
1764
|
+
new_str: import_v410.z.string()
|
|
1582
1765
|
})
|
|
1583
1766
|
])
|
|
1584
1767
|
])
|
|
1585
1768
|
)
|
|
1586
1769
|
);
|
|
1587
|
-
var
|
|
1770
|
+
var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
|
|
1588
1771
|
id: "anthropic.code_execution_20250825",
|
|
1589
1772
|
inputSchema: codeExecution_20250825InputSchema,
|
|
1590
1773
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -1594,25 +1777,142 @@ var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSch
|
|
|
1594
1777
|
supportsDeferredResults: true
|
|
1595
1778
|
});
|
|
1596
1779
|
var codeExecution_20250825 = (args = {}) => {
|
|
1597
|
-
return
|
|
1780
|
+
return factory7(args);
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1783
|
+
// src/tool/code-execution_20260120.ts
|
|
1784
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
1785
|
+
var import_v411 = require("zod/v4");
|
|
1786
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)(
|
|
1787
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
1788
|
+
import_v411.z.discriminatedUnion("type", [
|
|
1789
|
+
import_v411.z.object({
|
|
1790
|
+
type: import_v411.z.literal("code_execution_result"),
|
|
1791
|
+
stdout: import_v411.z.string(),
|
|
1792
|
+
stderr: import_v411.z.string(),
|
|
1793
|
+
return_code: import_v411.z.number(),
|
|
1794
|
+
content: import_v411.z.array(
|
|
1795
|
+
import_v411.z.object({
|
|
1796
|
+
type: import_v411.z.literal("code_execution_output"),
|
|
1797
|
+
file_id: import_v411.z.string()
|
|
1798
|
+
})
|
|
1799
|
+
).optional().default([])
|
|
1800
|
+
}),
|
|
1801
|
+
import_v411.z.object({
|
|
1802
|
+
type: import_v411.z.literal("encrypted_code_execution_result"),
|
|
1803
|
+
encrypted_stdout: import_v411.z.string(),
|
|
1804
|
+
stderr: import_v411.z.string(),
|
|
1805
|
+
return_code: import_v411.z.number(),
|
|
1806
|
+
content: import_v411.z.array(
|
|
1807
|
+
import_v411.z.object({
|
|
1808
|
+
type: import_v411.z.literal("code_execution_output"),
|
|
1809
|
+
file_id: import_v411.z.string()
|
|
1810
|
+
})
|
|
1811
|
+
).optional().default([])
|
|
1812
|
+
}),
|
|
1813
|
+
import_v411.z.object({
|
|
1814
|
+
type: import_v411.z.literal("bash_code_execution_result"),
|
|
1815
|
+
content: import_v411.z.array(
|
|
1816
|
+
import_v411.z.object({
|
|
1817
|
+
type: import_v411.z.literal("bash_code_execution_output"),
|
|
1818
|
+
file_id: import_v411.z.string()
|
|
1819
|
+
})
|
|
1820
|
+
),
|
|
1821
|
+
stdout: import_v411.z.string(),
|
|
1822
|
+
stderr: import_v411.z.string(),
|
|
1823
|
+
return_code: import_v411.z.number()
|
|
1824
|
+
}),
|
|
1825
|
+
import_v411.z.object({
|
|
1826
|
+
type: import_v411.z.literal("bash_code_execution_tool_result_error"),
|
|
1827
|
+
error_code: import_v411.z.string()
|
|
1828
|
+
}),
|
|
1829
|
+
import_v411.z.object({
|
|
1830
|
+
type: import_v411.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1831
|
+
error_code: import_v411.z.string()
|
|
1832
|
+
}),
|
|
1833
|
+
import_v411.z.object({
|
|
1834
|
+
type: import_v411.z.literal("text_editor_code_execution_view_result"),
|
|
1835
|
+
content: import_v411.z.string(),
|
|
1836
|
+
file_type: import_v411.z.string(),
|
|
1837
|
+
num_lines: import_v411.z.number().nullable(),
|
|
1838
|
+
start_line: import_v411.z.number().nullable(),
|
|
1839
|
+
total_lines: import_v411.z.number().nullable()
|
|
1840
|
+
}),
|
|
1841
|
+
import_v411.z.object({
|
|
1842
|
+
type: import_v411.z.literal("text_editor_code_execution_create_result"),
|
|
1843
|
+
is_file_update: import_v411.z.boolean()
|
|
1844
|
+
}),
|
|
1845
|
+
import_v411.z.object({
|
|
1846
|
+
type: import_v411.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1847
|
+
lines: import_v411.z.array(import_v411.z.string()).nullable(),
|
|
1848
|
+
new_lines: import_v411.z.number().nullable(),
|
|
1849
|
+
new_start: import_v411.z.number().nullable(),
|
|
1850
|
+
old_lines: import_v411.z.number().nullable(),
|
|
1851
|
+
old_start: import_v411.z.number().nullable()
|
|
1852
|
+
})
|
|
1853
|
+
])
|
|
1854
|
+
)
|
|
1855
|
+
);
|
|
1856
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
1857
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
1858
|
+
import_v411.z.discriminatedUnion("type", [
|
|
1859
|
+
import_v411.z.object({
|
|
1860
|
+
type: import_v411.z.literal("programmatic-tool-call"),
|
|
1861
|
+
code: import_v411.z.string()
|
|
1862
|
+
}),
|
|
1863
|
+
import_v411.z.object({
|
|
1864
|
+
type: import_v411.z.literal("bash_code_execution"),
|
|
1865
|
+
command: import_v411.z.string()
|
|
1866
|
+
}),
|
|
1867
|
+
import_v411.z.discriminatedUnion("command", [
|
|
1868
|
+
import_v411.z.object({
|
|
1869
|
+
type: import_v411.z.literal("text_editor_code_execution"),
|
|
1870
|
+
command: import_v411.z.literal("view"),
|
|
1871
|
+
path: import_v411.z.string()
|
|
1872
|
+
}),
|
|
1873
|
+
import_v411.z.object({
|
|
1874
|
+
type: import_v411.z.literal("text_editor_code_execution"),
|
|
1875
|
+
command: import_v411.z.literal("create"),
|
|
1876
|
+
path: import_v411.z.string(),
|
|
1877
|
+
file_text: import_v411.z.string().nullish()
|
|
1878
|
+
}),
|
|
1879
|
+
import_v411.z.object({
|
|
1880
|
+
type: import_v411.z.literal("text_editor_code_execution"),
|
|
1881
|
+
command: import_v411.z.literal("str_replace"),
|
|
1882
|
+
path: import_v411.z.string(),
|
|
1883
|
+
old_str: import_v411.z.string(),
|
|
1884
|
+
new_str: import_v411.z.string()
|
|
1885
|
+
})
|
|
1886
|
+
])
|
|
1887
|
+
])
|
|
1888
|
+
)
|
|
1889
|
+
);
|
|
1890
|
+
var factory8 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
1891
|
+
id: "anthropic.code_execution_20260120",
|
|
1892
|
+
inputSchema: codeExecution_20260120InputSchema,
|
|
1893
|
+
outputSchema: codeExecution_20260120OutputSchema,
|
|
1894
|
+
supportsDeferredResults: true
|
|
1895
|
+
});
|
|
1896
|
+
var codeExecution_20260120 = (args = {}) => {
|
|
1897
|
+
return factory8(args);
|
|
1598
1898
|
};
|
|
1599
1899
|
|
|
1600
1900
|
// src/tool/tool-search-regex_20251119.ts
|
|
1601
|
-
var
|
|
1602
|
-
var
|
|
1603
|
-
var toolSearchRegex_20251119OutputSchema = (0,
|
|
1604
|
-
() => (0,
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
type:
|
|
1608
|
-
toolName:
|
|
1901
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
1902
|
+
var import_v412 = require("zod/v4");
|
|
1903
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils13.lazySchema)(
|
|
1904
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1905
|
+
import_v412.z.array(
|
|
1906
|
+
import_v412.z.object({
|
|
1907
|
+
type: import_v412.z.literal("tool_reference"),
|
|
1908
|
+
toolName: import_v412.z.string()
|
|
1609
1909
|
})
|
|
1610
1910
|
)
|
|
1611
1911
|
)
|
|
1612
1912
|
);
|
|
1613
|
-
var toolSearchRegex_20251119InputSchema = (0,
|
|
1614
|
-
() => (0,
|
|
1615
|
-
|
|
1913
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
1914
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1915
|
+
import_v412.z.object({
|
|
1616
1916
|
/**
|
|
1617
1917
|
* A regex pattern to search for tools.
|
|
1618
1918
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -1623,28 +1923,28 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils10.lazySchema
|
|
|
1623
1923
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1624
1924
|
* - "(?i)slack" - case-insensitive search
|
|
1625
1925
|
*/
|
|
1626
|
-
pattern:
|
|
1926
|
+
pattern: import_v412.z.string(),
|
|
1627
1927
|
/**
|
|
1628
1928
|
* Maximum number of tools to return. Optional.
|
|
1629
1929
|
*/
|
|
1630
|
-
limit:
|
|
1930
|
+
limit: import_v412.z.number().optional()
|
|
1631
1931
|
})
|
|
1632
1932
|
)
|
|
1633
1933
|
);
|
|
1634
|
-
var
|
|
1934
|
+
var factory9 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
|
|
1635
1935
|
id: "anthropic.tool_search_regex_20251119",
|
|
1636
1936
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
1637
1937
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
1638
1938
|
supportsDeferredResults: true
|
|
1639
1939
|
});
|
|
1640
1940
|
var toolSearchRegex_20251119 = (args = {}) => {
|
|
1641
|
-
return
|
|
1941
|
+
return factory9(args);
|
|
1642
1942
|
};
|
|
1643
1943
|
|
|
1644
1944
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1645
1945
|
function convertToString(data) {
|
|
1646
1946
|
if (typeof data === "string") {
|
|
1647
|
-
return new TextDecoder().decode((0,
|
|
1947
|
+
return new TextDecoder().decode((0, import_provider_utils14.convertBase64ToUint8Array)(data));
|
|
1648
1948
|
}
|
|
1649
1949
|
if (data instanceof Uint8Array) {
|
|
1650
1950
|
return new TextDecoder().decode(data);
|
|
@@ -1674,7 +1974,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1674
1974
|
cacheControlValidator,
|
|
1675
1975
|
toolNameMapping
|
|
1676
1976
|
}) {
|
|
1677
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
1977
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
1678
1978
|
const betas = /* @__PURE__ */ new Set();
|
|
1679
1979
|
const blocks = groupIntoBlocks(prompt);
|
|
1680
1980
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -1682,7 +1982,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1682
1982
|
const messages = [];
|
|
1683
1983
|
async function shouldEnableCitations(providerMetadata) {
|
|
1684
1984
|
var _a2, _b2;
|
|
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
|
|
@@ -1690,7 +1990,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1690
1990
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
1691
1991
|
}
|
|
1692
1992
|
async function getDocumentMetadata(providerMetadata) {
|
|
1693
|
-
const anthropicOptions = await (0,
|
|
1993
|
+
const anthropicOptions = await (0, import_provider_utils14.parseProviderOptions)({
|
|
1694
1994
|
provider: "anthropic",
|
|
1695
1995
|
providerOptions: providerMetadata,
|
|
1696
1996
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1756,7 +2056,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1756
2056
|
} : {
|
|
1757
2057
|
type: "base64",
|
|
1758
2058
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
1759
|
-
data: (0,
|
|
2059
|
+
data: (0, import_provider_utils14.convertToBase64)(part.data)
|
|
1760
2060
|
},
|
|
1761
2061
|
cache_control: cacheControl
|
|
1762
2062
|
});
|
|
@@ -1776,7 +2076,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1776
2076
|
} : {
|
|
1777
2077
|
type: "base64",
|
|
1778
2078
|
media_type: "application/pdf",
|
|
1779
|
-
data: (0,
|
|
2079
|
+
data: (0, import_provider_utils14.convertToBase64)(part.data)
|
|
1780
2080
|
},
|
|
1781
2081
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
1782
2082
|
...metadata.context && { context: metadata.context },
|
|
@@ -1914,7 +2214,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1914
2214
|
return void 0;
|
|
1915
2215
|
}
|
|
1916
2216
|
}
|
|
1917
|
-
}).filter(
|
|
2217
|
+
}).filter(import_provider_utils14.isNonNullable);
|
|
1918
2218
|
break;
|
|
1919
2219
|
case "text":
|
|
1920
2220
|
case "error-text":
|
|
@@ -1990,7 +2290,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1990
2290
|
}
|
|
1991
2291
|
case "reasoning": {
|
|
1992
2292
|
if (sendReasoning) {
|
|
1993
|
-
const reasoningMetadata = await (0,
|
|
2293
|
+
const reasoningMetadata = await (0, import_provider_utils14.parseProviderOptions)({
|
|
1994
2294
|
provider: "anthropic",
|
|
1995
2295
|
providerOptions: part.providerOptions,
|
|
1996
2296
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -2196,7 +2496,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2196
2496
|
break;
|
|
2197
2497
|
}
|
|
2198
2498
|
if (output.value.type === "code_execution_result") {
|
|
2199
|
-
const codeExecutionOutput = await (0,
|
|
2499
|
+
const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2200
2500
|
value: output.value,
|
|
2201
2501
|
schema: codeExecution_20250522OutputSchema
|
|
2202
2502
|
});
|
|
@@ -2212,8 +2512,27 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2212
2512
|
},
|
|
2213
2513
|
cache_control: cacheControl
|
|
2214
2514
|
});
|
|
2515
|
+
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
2516
|
+
const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2517
|
+
value: output.value,
|
|
2518
|
+
schema: codeExecution_20260120OutputSchema
|
|
2519
|
+
});
|
|
2520
|
+
if (codeExecutionOutput.type === "encrypted_code_execution_result") {
|
|
2521
|
+
anthropicContent.push({
|
|
2522
|
+
type: "code_execution_tool_result",
|
|
2523
|
+
tool_use_id: part.toolCallId,
|
|
2524
|
+
content: {
|
|
2525
|
+
type: codeExecutionOutput.type,
|
|
2526
|
+
encrypted_stdout: codeExecutionOutput.encrypted_stdout,
|
|
2527
|
+
stderr: codeExecutionOutput.stderr,
|
|
2528
|
+
return_code: codeExecutionOutput.return_code,
|
|
2529
|
+
content: (_p = codeExecutionOutput.content) != null ? _p : []
|
|
2530
|
+
},
|
|
2531
|
+
cache_control: cacheControl
|
|
2532
|
+
});
|
|
2533
|
+
}
|
|
2215
2534
|
} else {
|
|
2216
|
-
const codeExecutionOutput = await (0,
|
|
2535
|
+
const codeExecutionOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2217
2536
|
value: output.value,
|
|
2218
2537
|
schema: codeExecution_20250825OutputSchema
|
|
2219
2538
|
});
|
|
@@ -2226,7 +2545,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2226
2545
|
stdout: codeExecutionOutput.stdout,
|
|
2227
2546
|
stderr: codeExecutionOutput.stderr,
|
|
2228
2547
|
return_code: codeExecutionOutput.return_code,
|
|
2229
|
-
content: (
|
|
2548
|
+
content: (_q = codeExecutionOutput.content) != null ? _q : []
|
|
2230
2549
|
},
|
|
2231
2550
|
cache_control: cacheControl
|
|
2232
2551
|
});
|
|
@@ -2259,7 +2578,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2259
2578
|
errorValue = output.value;
|
|
2260
2579
|
}
|
|
2261
2580
|
} catch (e) {
|
|
2262
|
-
const extractedErrorCode = (
|
|
2581
|
+
const extractedErrorCode = (_r = output.value) == null ? void 0 : _r.errorCode;
|
|
2263
2582
|
errorValue = {
|
|
2264
2583
|
errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unknown"
|
|
2265
2584
|
};
|
|
@@ -2269,7 +2588,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2269
2588
|
tool_use_id: part.toolCallId,
|
|
2270
2589
|
content: {
|
|
2271
2590
|
type: "web_fetch_tool_result_error",
|
|
2272
|
-
error_code: (
|
|
2591
|
+
error_code: (_s = errorValue.errorCode) != null ? _s : "unknown"
|
|
2273
2592
|
},
|
|
2274
2593
|
cache_control: cacheControl
|
|
2275
2594
|
});
|
|
@@ -2282,7 +2601,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2282
2601
|
});
|
|
2283
2602
|
break;
|
|
2284
2603
|
}
|
|
2285
|
-
const webFetchOutput = await (0,
|
|
2604
|
+
const webFetchOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2286
2605
|
value: output.value,
|
|
2287
2606
|
schema: webFetch_20250910OutputSchema
|
|
2288
2607
|
});
|
|
@@ -2317,7 +2636,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2317
2636
|
});
|
|
2318
2637
|
break;
|
|
2319
2638
|
}
|
|
2320
|
-
const webSearchOutput = await (0,
|
|
2639
|
+
const webSearchOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2321
2640
|
value: output.value,
|
|
2322
2641
|
schema: webSearch_20250305OutputSchema
|
|
2323
2642
|
});
|
|
@@ -2344,7 +2663,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2344
2663
|
});
|
|
2345
2664
|
break;
|
|
2346
2665
|
}
|
|
2347
|
-
const toolSearchOutput = await (0,
|
|
2666
|
+
const toolSearchOutput = await (0, import_provider_utils14.validateTypes)({
|
|
2348
2667
|
value: output.value,
|
|
2349
2668
|
schema: toolSearchRegex_20251119OutputSchema
|
|
2350
2669
|
});
|
|
@@ -2508,7 +2827,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2508
2827
|
var _a;
|
|
2509
2828
|
this.modelId = modelId;
|
|
2510
2829
|
this.config = config;
|
|
2511
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
2830
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils15.generateId;
|
|
2512
2831
|
}
|
|
2513
2832
|
supportsUrl(url) {
|
|
2514
2833
|
return url.protocol === "https:";
|
|
@@ -2582,12 +2901,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2582
2901
|
}
|
|
2583
2902
|
}
|
|
2584
2903
|
const providerOptionsName = this.providerOptionsName;
|
|
2585
|
-
const canonicalOptions = await (0,
|
|
2904
|
+
const canonicalOptions = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2586
2905
|
provider: "anthropic",
|
|
2587
2906
|
providerOptions,
|
|
2588
2907
|
schema: anthropicLanguageModelOptions
|
|
2589
2908
|
});
|
|
2590
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0,
|
|
2909
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils15.parseProviderOptions)({
|
|
2591
2910
|
provider: providerOptionsName,
|
|
2592
2911
|
providerOptions,
|
|
2593
2912
|
schema: anthropicLanguageModelOptions
|
|
@@ -2614,7 +2933,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2614
2933
|
} : void 0;
|
|
2615
2934
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
2616
2935
|
const cacheControlValidator = new CacheControlValidator();
|
|
2617
|
-
const toolNameMapping = (0,
|
|
2936
|
+
const toolNameMapping = (0, import_provider_utils15.createToolNameMapping)({
|
|
2618
2937
|
tools,
|
|
2619
2938
|
providerToolNames: {
|
|
2620
2939
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -2630,7 +2949,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2630
2949
|
"anthropic.bash_20250124": "bash",
|
|
2631
2950
|
"anthropic.memory_20250818": "memory",
|
|
2632
2951
|
"anthropic.web_search_20250305": "web_search",
|
|
2952
|
+
"anthropic.web_search_20260209": "web_search",
|
|
2633
2953
|
"anthropic.web_fetch_20250910": "web_fetch",
|
|
2954
|
+
"anthropic.web_fetch_20260209": "web_fetch",
|
|
2634
2955
|
"anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
|
|
2635
2956
|
"anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
|
|
2636
2957
|
}
|
|
@@ -2895,15 +3216,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2895
3216
|
betas,
|
|
2896
3217
|
headers
|
|
2897
3218
|
}) {
|
|
2898
|
-
return (0,
|
|
2899
|
-
await (0,
|
|
3219
|
+
return (0, import_provider_utils15.combineHeaders)(
|
|
3220
|
+
await (0, import_provider_utils15.resolve)(this.config.headers),
|
|
2900
3221
|
headers,
|
|
2901
3222
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
2902
3223
|
);
|
|
2903
3224
|
}
|
|
2904
3225
|
async getBetasFromHeaders(requestHeaders) {
|
|
2905
3226
|
var _a, _b;
|
|
2906
|
-
const configHeaders = await (0,
|
|
3227
|
+
const configHeaders = await (0, import_provider_utils15.resolve)(this.config.headers);
|
|
2907
3228
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
2908
3229
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
2909
3230
|
return new Set(
|
|
@@ -2945,7 +3266,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2945
3266
|
});
|
|
2946
3267
|
}
|
|
2947
3268
|
async doGenerate(options) {
|
|
2948
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3269
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2949
3270
|
const {
|
|
2950
3271
|
args,
|
|
2951
3272
|
warnings,
|
|
@@ -2962,16 +3283,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2962
3283
|
const citationDocuments = [
|
|
2963
3284
|
...this.extractCitationDocuments(options.prompt)
|
|
2964
3285
|
];
|
|
3286
|
+
const markCodeExecutionDynamic = hasWebTool20260209WithoutCodeExecution(
|
|
3287
|
+
args.tools
|
|
3288
|
+
);
|
|
2965
3289
|
const {
|
|
2966
3290
|
responseHeaders,
|
|
2967
3291
|
value: response,
|
|
2968
3292
|
rawValue: rawResponse
|
|
2969
|
-
} = await (0,
|
|
3293
|
+
} = await (0, import_provider_utils15.postJsonToApi)({
|
|
2970
3294
|
url: this.buildRequestUrl(false),
|
|
2971
3295
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
2972
3296
|
body: this.transformRequestBody(args),
|
|
2973
3297
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
2974
|
-
successfulResponseHandler: (0,
|
|
3298
|
+
successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
|
|
2975
3299
|
anthropicMessagesResponseSchema
|
|
2976
3300
|
),
|
|
2977
3301
|
abortSignal: options.abortSignal,
|
|
@@ -3083,7 +3407,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3083
3407
|
toolCallId: part.id,
|
|
3084
3408
|
toolName: toolNameMapping.toCustomToolName(part.name),
|
|
3085
3409
|
input: JSON.stringify(inputToSerialize),
|
|
3086
|
-
providerExecuted: true
|
|
3410
|
+
providerExecuted: true,
|
|
3411
|
+
// We want this 'code_execution' tool call to be allowed even if the tool is not explicitly provided.
|
|
3412
|
+
// Since the validation generally bypasses dynamic tools, we mark this specific tool as dynamic.
|
|
3413
|
+
...markCodeExecutionDynamic && part.name === "code_execution" ? { dynamic: true } : {}
|
|
3087
3414
|
});
|
|
3088
3415
|
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
3089
3416
|
serverToolCalls[part.id] = part.name;
|
|
@@ -3227,6 +3554,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3227
3554
|
content: (_c = part.content.content) != null ? _c : []
|
|
3228
3555
|
}
|
|
3229
3556
|
});
|
|
3557
|
+
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
3558
|
+
content.push({
|
|
3559
|
+
type: "tool-result",
|
|
3560
|
+
toolCallId: part.tool_use_id,
|
|
3561
|
+
toolName: toolNameMapping.toCustomToolName("code_execution"),
|
|
3562
|
+
result: {
|
|
3563
|
+
type: part.content.type,
|
|
3564
|
+
encrypted_stdout: part.content.encrypted_stdout,
|
|
3565
|
+
stderr: part.content.stderr,
|
|
3566
|
+
return_code: part.content.return_code,
|
|
3567
|
+
content: (_d = part.content.content) != null ? _d : []
|
|
3568
|
+
}
|
|
3569
|
+
});
|
|
3230
3570
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
3231
3571
|
content.push({
|
|
3232
3572
|
type: "tool-result",
|
|
@@ -3303,13 +3643,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3303
3643
|
finishReason: response.stop_reason,
|
|
3304
3644
|
isJsonResponseFromTool
|
|
3305
3645
|
}),
|
|
3306
|
-
raw: (
|
|
3646
|
+
raw: (_e = response.stop_reason) != null ? _e : void 0
|
|
3307
3647
|
},
|
|
3308
3648
|
usage: convertAnthropicMessagesUsage({ usage: response.usage }),
|
|
3309
3649
|
request: { body: args },
|
|
3310
3650
|
response: {
|
|
3311
|
-
id: (
|
|
3312
|
-
modelId: (
|
|
3651
|
+
id: (_f = response.id) != null ? _f : void 0,
|
|
3652
|
+
modelId: (_g = response.model) != null ? _g : void 0,
|
|
3313
3653
|
headers: responseHeaders,
|
|
3314
3654
|
body: rawResponse
|
|
3315
3655
|
},
|
|
@@ -3366,13 +3706,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3366
3706
|
const citationDocuments = [
|
|
3367
3707
|
...this.extractCitationDocuments(options.prompt)
|
|
3368
3708
|
];
|
|
3709
|
+
const markCodeExecutionDynamic = hasWebTool20260209WithoutCodeExecution(
|
|
3710
|
+
body.tools
|
|
3711
|
+
);
|
|
3369
3712
|
const url = this.buildRequestUrl(true);
|
|
3370
|
-
const { responseHeaders, value: response } = await (0,
|
|
3713
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
|
|
3371
3714
|
url,
|
|
3372
3715
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3373
3716
|
body: this.transformRequestBody(body),
|
|
3374
3717
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3375
|
-
successfulResponseHandler: (0,
|
|
3718
|
+
successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
|
|
3376
3719
|
anthropicMessagesChunkSchema
|
|
3377
3720
|
),
|
|
3378
3721
|
abortSignal: options.abortSignal,
|
|
@@ -3406,7 +3749,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3406
3749
|
controller.enqueue({ type: "stream-start", warnings });
|
|
3407
3750
|
},
|
|
3408
3751
|
transform(chunk, controller) {
|
|
3409
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
3752
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3410
3753
|
if (options.includeRawChunks) {
|
|
3411
3754
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
3412
3755
|
}
|
|
@@ -3515,12 +3858,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3515
3858
|
].includes(part.name)) {
|
|
3516
3859
|
const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
|
|
3517
3860
|
const customToolName = toolNameMapping.toCustomToolName(providerToolName);
|
|
3861
|
+
const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
|
|
3518
3862
|
contentBlocks[value.index] = {
|
|
3519
3863
|
type: "tool-call",
|
|
3520
3864
|
toolCallId: part.id,
|
|
3521
3865
|
toolName: customToolName,
|
|
3522
|
-
input:
|
|
3866
|
+
input: finalInput,
|
|
3523
3867
|
providerExecuted: true,
|
|
3868
|
+
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
3524
3869
|
firstDelta: true,
|
|
3525
3870
|
providerToolName: part.name
|
|
3526
3871
|
};
|
|
@@ -3528,7 +3873,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3528
3873
|
type: "tool-input-start",
|
|
3529
3874
|
id: part.id,
|
|
3530
3875
|
toolName: customToolName,
|
|
3531
|
-
providerExecuted: true
|
|
3876
|
+
providerExecuted: true,
|
|
3877
|
+
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {}
|
|
3532
3878
|
});
|
|
3533
3879
|
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
3534
3880
|
serverToolCalls[part.id] = part.name;
|
|
@@ -3653,6 +3999,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3653
3999
|
content: (_c = part.content.content) != null ? _c : []
|
|
3654
4000
|
}
|
|
3655
4001
|
});
|
|
4002
|
+
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
4003
|
+
controller.enqueue({
|
|
4004
|
+
type: "tool-result",
|
|
4005
|
+
toolCallId: part.tool_use_id,
|
|
4006
|
+
toolName: toolNameMapping.toCustomToolName("code_execution"),
|
|
4007
|
+
result: {
|
|
4008
|
+
type: part.content.type,
|
|
4009
|
+
encrypted_stdout: part.content.encrypted_stdout,
|
|
4010
|
+
stderr: part.content.stderr,
|
|
4011
|
+
return_code: part.content.return_code,
|
|
4012
|
+
content: (_d = part.content.content) != null ? _d : []
|
|
4013
|
+
}
|
|
4014
|
+
});
|
|
3656
4015
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
3657
4016
|
controller.enqueue({
|
|
3658
4017
|
type: "tool-result",
|
|
@@ -3802,6 +4161,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3802
4161
|
toolName: contentBlock.toolName,
|
|
3803
4162
|
input: finalInput,
|
|
3804
4163
|
providerExecuted: contentBlock.providerExecuted,
|
|
4164
|
+
...markCodeExecutionDynamic && contentBlock.providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
3805
4165
|
...contentBlock.caller && {
|
|
3806
4166
|
providerMetadata: {
|
|
3807
4167
|
anthropic: {
|
|
@@ -3919,12 +4279,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3919
4279
|
}
|
|
3920
4280
|
case "message_start": {
|
|
3921
4281
|
usage.input_tokens = value.message.usage.input_tokens;
|
|
3922
|
-
usage.cache_read_input_tokens = (
|
|
3923
|
-
usage.cache_creation_input_tokens = (
|
|
4282
|
+
usage.cache_read_input_tokens = (_e = value.message.usage.cache_read_input_tokens) != null ? _e : 0;
|
|
4283
|
+
usage.cache_creation_input_tokens = (_f = value.message.usage.cache_creation_input_tokens) != null ? _f : 0;
|
|
3924
4284
|
rawUsage = {
|
|
3925
4285
|
...value.message.usage
|
|
3926
4286
|
};
|
|
3927
|
-
cacheCreationInputTokens = (
|
|
4287
|
+
cacheCreationInputTokens = (_g = value.message.usage.cache_creation_input_tokens) != null ? _g : null;
|
|
3928
4288
|
if (value.message.container != null) {
|
|
3929
4289
|
container = {
|
|
3930
4290
|
expiresAt: value.message.container.expires_at,
|
|
@@ -3943,8 +4303,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3943
4303
|
}
|
|
3944
4304
|
controller.enqueue({
|
|
3945
4305
|
type: "response-metadata",
|
|
3946
|
-
id: (
|
|
3947
|
-
modelId: (
|
|
4306
|
+
id: (_h = value.message.id) != null ? _h : void 0,
|
|
4307
|
+
modelId: (_i = value.message.model) != null ? _i : void 0
|
|
3948
4308
|
});
|
|
3949
4309
|
if (value.message.content != null) {
|
|
3950
4310
|
for (let contentIndex = 0; contentIndex < value.message.content.length; contentIndex++) {
|
|
@@ -3960,7 +4320,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3960
4320
|
id: part.id,
|
|
3961
4321
|
toolName: part.name
|
|
3962
4322
|
});
|
|
3963
|
-
const inputStr = JSON.stringify((
|
|
4323
|
+
const inputStr = JSON.stringify((_j = part.input) != null ? _j : {});
|
|
3964
4324
|
controller.enqueue({
|
|
3965
4325
|
type: "tool-input-delta",
|
|
3966
4326
|
id: part.id,
|
|
@@ -4008,17 +4368,17 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4008
4368
|
finishReason: value.delta.stop_reason,
|
|
4009
4369
|
isJsonResponseFromTool
|
|
4010
4370
|
}),
|
|
4011
|
-
raw: (
|
|
4371
|
+
raw: (_k = value.delta.stop_reason) != null ? _k : void 0
|
|
4012
4372
|
};
|
|
4013
|
-
stopSequence = (
|
|
4373
|
+
stopSequence = (_l = value.delta.stop_sequence) != null ? _l : null;
|
|
4014
4374
|
container = value.delta.container != null ? {
|
|
4015
4375
|
expiresAt: value.delta.container.expires_at,
|
|
4016
4376
|
id: value.delta.container.id,
|
|
4017
|
-
skills: (
|
|
4377
|
+
skills: (_n = (_m = value.delta.container.skills) == null ? void 0 : _m.map((skill) => ({
|
|
4018
4378
|
type: skill.type,
|
|
4019
4379
|
skillId: skill.skill_id,
|
|
4020
4380
|
version: skill.version
|
|
4021
|
-
}))) != null ?
|
|
4381
|
+
}))) != null ? _n : null
|
|
4022
4382
|
} : null;
|
|
4023
4383
|
if (value.context_management) {
|
|
4024
4384
|
contextManagement = mapAnthropicResponseContextManagement(
|
|
@@ -4147,6 +4507,24 @@ function getModelCapabilities(modelId) {
|
|
|
4147
4507
|
};
|
|
4148
4508
|
}
|
|
4149
4509
|
}
|
|
4510
|
+
function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
4511
|
+
if (!tools) {
|
|
4512
|
+
return false;
|
|
4513
|
+
}
|
|
4514
|
+
let hasWebTool20260209 = false;
|
|
4515
|
+
let hasCodeExecutionTool = false;
|
|
4516
|
+
for (const tool of tools) {
|
|
4517
|
+
if ("type" in tool && (tool.type === "web_fetch_20260209" || tool.type === "web_search_20260209")) {
|
|
4518
|
+
hasWebTool20260209 = true;
|
|
4519
|
+
continue;
|
|
4520
|
+
}
|
|
4521
|
+
if (tool.name === "code_execution") {
|
|
4522
|
+
hasCodeExecutionTool = true;
|
|
4523
|
+
break;
|
|
4524
|
+
}
|
|
4525
|
+
}
|
|
4526
|
+
return hasWebTool20260209 && !hasCodeExecutionTool;
|
|
4527
|
+
}
|
|
4150
4528
|
function mapAnthropicResponseContextManagement(contextManagement) {
|
|
4151
4529
|
return contextManagement ? {
|
|
4152
4530
|
appliedEdits: contextManagement.applied_edits.map((edit) => {
|
|
@@ -4174,149 +4552,44 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4174
4552
|
}
|
|
4175
4553
|
|
|
4176
4554
|
// src/tool/bash_20241022.ts
|
|
4177
|
-
var
|
|
4178
|
-
var
|
|
4179
|
-
var bash_20241022InputSchema = (0,
|
|
4180
|
-
() => (0,
|
|
4181
|
-
|
|
4182
|
-
command:
|
|
4183
|
-
restart:
|
|
4555
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
4556
|
+
var import_v413 = require("zod/v4");
|
|
4557
|
+
var bash_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
4558
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
4559
|
+
import_v413.z.object({
|
|
4560
|
+
command: import_v413.z.string(),
|
|
4561
|
+
restart: import_v413.z.boolean().optional()
|
|
4184
4562
|
})
|
|
4185
4563
|
)
|
|
4186
4564
|
);
|
|
4187
|
-
var bash_20241022 = (0,
|
|
4565
|
+
var bash_20241022 = (0, import_provider_utils16.createProviderToolFactory)({
|
|
4188
4566
|
id: "anthropic.bash_20241022",
|
|
4189
4567
|
inputSchema: bash_20241022InputSchema
|
|
4190
4568
|
});
|
|
4191
4569
|
|
|
4192
4570
|
// src/tool/bash_20250124.ts
|
|
4193
|
-
var
|
|
4194
|
-
var
|
|
4195
|
-
var bash_20250124InputSchema = (0,
|
|
4196
|
-
() => (0,
|
|
4197
|
-
|
|
4198
|
-
command:
|
|
4199
|
-
restart:
|
|
4571
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4572
|
+
var import_v414 = require("zod/v4");
|
|
4573
|
+
var bash_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4574
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
4575
|
+
import_v414.z.object({
|
|
4576
|
+
command: import_v414.z.string(),
|
|
4577
|
+
restart: import_v414.z.boolean().optional()
|
|
4200
4578
|
})
|
|
4201
4579
|
)
|
|
4202
4580
|
);
|
|
4203
|
-
var bash_20250124 = (0,
|
|
4581
|
+
var bash_20250124 = (0, import_provider_utils17.createProviderToolFactory)({
|
|
4204
4582
|
id: "anthropic.bash_20250124",
|
|
4205
4583
|
inputSchema: bash_20250124InputSchema
|
|
4206
4584
|
});
|
|
4207
4585
|
|
|
4208
|
-
// src/tool/code-execution_20260120.ts
|
|
4209
|
-
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
4210
|
-
var import_v412 = require("zod/v4");
|
|
4211
|
-
var codeExecution_20260120OutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4212
|
-
() => (0, import_provider_utils15.zodSchema)(
|
|
4213
|
-
import_v412.z.discriminatedUnion("type", [
|
|
4214
|
-
import_v412.z.object({
|
|
4215
|
-
type: import_v412.z.literal("code_execution_result"),
|
|
4216
|
-
stdout: import_v412.z.string(),
|
|
4217
|
-
stderr: import_v412.z.string(),
|
|
4218
|
-
return_code: import_v412.z.number(),
|
|
4219
|
-
content: import_v412.z.array(
|
|
4220
|
-
import_v412.z.object({
|
|
4221
|
-
type: import_v412.z.literal("code_execution_output"),
|
|
4222
|
-
file_id: import_v412.z.string()
|
|
4223
|
-
})
|
|
4224
|
-
).optional().default([])
|
|
4225
|
-
}),
|
|
4226
|
-
import_v412.z.object({
|
|
4227
|
-
type: import_v412.z.literal("bash_code_execution_result"),
|
|
4228
|
-
content: import_v412.z.array(
|
|
4229
|
-
import_v412.z.object({
|
|
4230
|
-
type: import_v412.z.literal("bash_code_execution_output"),
|
|
4231
|
-
file_id: import_v412.z.string()
|
|
4232
|
-
})
|
|
4233
|
-
),
|
|
4234
|
-
stdout: import_v412.z.string(),
|
|
4235
|
-
stderr: import_v412.z.string(),
|
|
4236
|
-
return_code: import_v412.z.number()
|
|
4237
|
-
}),
|
|
4238
|
-
import_v412.z.object({
|
|
4239
|
-
type: import_v412.z.literal("bash_code_execution_tool_result_error"),
|
|
4240
|
-
error_code: import_v412.z.string()
|
|
4241
|
-
}),
|
|
4242
|
-
import_v412.z.object({
|
|
4243
|
-
type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
|
|
4244
|
-
error_code: import_v412.z.string()
|
|
4245
|
-
}),
|
|
4246
|
-
import_v412.z.object({
|
|
4247
|
-
type: import_v412.z.literal("text_editor_code_execution_view_result"),
|
|
4248
|
-
content: import_v412.z.string(),
|
|
4249
|
-
file_type: import_v412.z.string(),
|
|
4250
|
-
num_lines: import_v412.z.number().nullable(),
|
|
4251
|
-
start_line: import_v412.z.number().nullable(),
|
|
4252
|
-
total_lines: import_v412.z.number().nullable()
|
|
4253
|
-
}),
|
|
4254
|
-
import_v412.z.object({
|
|
4255
|
-
type: import_v412.z.literal("text_editor_code_execution_create_result"),
|
|
4256
|
-
is_file_update: import_v412.z.boolean()
|
|
4257
|
-
}),
|
|
4258
|
-
import_v412.z.object({
|
|
4259
|
-
type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
|
|
4260
|
-
lines: import_v412.z.array(import_v412.z.string()).nullable(),
|
|
4261
|
-
new_lines: import_v412.z.number().nullable(),
|
|
4262
|
-
new_start: import_v412.z.number().nullable(),
|
|
4263
|
-
old_lines: import_v412.z.number().nullable(),
|
|
4264
|
-
old_start: import_v412.z.number().nullable()
|
|
4265
|
-
})
|
|
4266
|
-
])
|
|
4267
|
-
)
|
|
4268
|
-
);
|
|
4269
|
-
var codeExecution_20260120InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4270
|
-
() => (0, import_provider_utils15.zodSchema)(
|
|
4271
|
-
import_v412.z.discriminatedUnion("type", [
|
|
4272
|
-
import_v412.z.object({
|
|
4273
|
-
type: import_v412.z.literal("programmatic-tool-call"),
|
|
4274
|
-
code: import_v412.z.string()
|
|
4275
|
-
}),
|
|
4276
|
-
import_v412.z.object({
|
|
4277
|
-
type: import_v412.z.literal("bash_code_execution"),
|
|
4278
|
-
command: import_v412.z.string()
|
|
4279
|
-
}),
|
|
4280
|
-
import_v412.z.discriminatedUnion("command", [
|
|
4281
|
-
import_v412.z.object({
|
|
4282
|
-
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4283
|
-
command: import_v412.z.literal("view"),
|
|
4284
|
-
path: import_v412.z.string()
|
|
4285
|
-
}),
|
|
4286
|
-
import_v412.z.object({
|
|
4287
|
-
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4288
|
-
command: import_v412.z.literal("create"),
|
|
4289
|
-
path: import_v412.z.string(),
|
|
4290
|
-
file_text: import_v412.z.string().nullish()
|
|
4291
|
-
}),
|
|
4292
|
-
import_v412.z.object({
|
|
4293
|
-
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4294
|
-
command: import_v412.z.literal("str_replace"),
|
|
4295
|
-
path: import_v412.z.string(),
|
|
4296
|
-
old_str: import_v412.z.string(),
|
|
4297
|
-
new_str: import_v412.z.string()
|
|
4298
|
-
})
|
|
4299
|
-
])
|
|
4300
|
-
])
|
|
4301
|
-
)
|
|
4302
|
-
);
|
|
4303
|
-
var factory7 = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
4304
|
-
id: "anthropic.code_execution_20260120",
|
|
4305
|
-
inputSchema: codeExecution_20260120InputSchema,
|
|
4306
|
-
outputSchema: codeExecution_20260120OutputSchema,
|
|
4307
|
-
supportsDeferredResults: true
|
|
4308
|
-
});
|
|
4309
|
-
var codeExecution_20260120 = (args = {}) => {
|
|
4310
|
-
return factory7(args);
|
|
4311
|
-
};
|
|
4312
|
-
|
|
4313
4586
|
// src/tool/computer_20241022.ts
|
|
4314
|
-
var
|
|
4315
|
-
var
|
|
4316
|
-
var computer_20241022InputSchema = (0,
|
|
4317
|
-
() => (0,
|
|
4318
|
-
|
|
4319
|
-
action:
|
|
4587
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
4588
|
+
var import_v415 = require("zod/v4");
|
|
4589
|
+
var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
4590
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
4591
|
+
import_v415.z.object({
|
|
4592
|
+
action: import_v415.z.enum([
|
|
4320
4593
|
"key",
|
|
4321
4594
|
"type",
|
|
4322
4595
|
"mouse_move",
|
|
@@ -4328,23 +4601,23 @@ var computer_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
|
4328
4601
|
"screenshot",
|
|
4329
4602
|
"cursor_position"
|
|
4330
4603
|
]),
|
|
4331
|
-
coordinate:
|
|
4332
|
-
text:
|
|
4604
|
+
coordinate: import_v415.z.array(import_v415.z.number().int()).optional(),
|
|
4605
|
+
text: import_v415.z.string().optional()
|
|
4333
4606
|
})
|
|
4334
4607
|
)
|
|
4335
4608
|
);
|
|
4336
|
-
var computer_20241022 = (0,
|
|
4609
|
+
var computer_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
4337
4610
|
id: "anthropic.computer_20241022",
|
|
4338
4611
|
inputSchema: computer_20241022InputSchema
|
|
4339
4612
|
});
|
|
4340
4613
|
|
|
4341
4614
|
// src/tool/computer_20250124.ts
|
|
4342
|
-
var
|
|
4343
|
-
var
|
|
4344
|
-
var computer_20250124InputSchema = (0,
|
|
4345
|
-
() => (0,
|
|
4346
|
-
|
|
4347
|
-
action:
|
|
4615
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4616
|
+
var import_v416 = require("zod/v4");
|
|
4617
|
+
var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4618
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
4619
|
+
import_v416.z.object({
|
|
4620
|
+
action: import_v416.z.enum([
|
|
4348
4621
|
"key",
|
|
4349
4622
|
"hold_key",
|
|
4350
4623
|
"type",
|
|
@@ -4362,27 +4635,27 @@ var computer_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
4362
4635
|
"wait",
|
|
4363
4636
|
"screenshot"
|
|
4364
4637
|
]),
|
|
4365
|
-
coordinate:
|
|
4366
|
-
duration:
|
|
4367
|
-
scroll_amount:
|
|
4368
|
-
scroll_direction:
|
|
4369
|
-
start_coordinate:
|
|
4370
|
-
text:
|
|
4638
|
+
coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
|
|
4639
|
+
duration: import_v416.z.number().optional(),
|
|
4640
|
+
scroll_amount: import_v416.z.number().optional(),
|
|
4641
|
+
scroll_direction: import_v416.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4642
|
+
start_coordinate: import_v416.z.tuple([import_v416.z.number().int(), import_v416.z.number().int()]).optional(),
|
|
4643
|
+
text: import_v416.z.string().optional()
|
|
4371
4644
|
})
|
|
4372
4645
|
)
|
|
4373
4646
|
);
|
|
4374
|
-
var computer_20250124 = (0,
|
|
4647
|
+
var computer_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
4375
4648
|
id: "anthropic.computer_20250124",
|
|
4376
4649
|
inputSchema: computer_20250124InputSchema
|
|
4377
4650
|
});
|
|
4378
4651
|
|
|
4379
4652
|
// src/tool/computer_20251124.ts
|
|
4380
|
-
var
|
|
4381
|
-
var
|
|
4382
|
-
var computer_20251124InputSchema = (0,
|
|
4383
|
-
() => (0,
|
|
4384
|
-
|
|
4385
|
-
action:
|
|
4653
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
4654
|
+
var import_v417 = require("zod/v4");
|
|
4655
|
+
var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
4656
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
4657
|
+
import_v417.z.object({
|
|
4658
|
+
action: import_v417.z.enum([
|
|
4386
4659
|
"key",
|
|
4387
4660
|
"hold_key",
|
|
4388
4661
|
"type",
|
|
@@ -4401,173 +4674,173 @@ var computer_20251124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
4401
4674
|
"screenshot",
|
|
4402
4675
|
"zoom"
|
|
4403
4676
|
]),
|
|
4404
|
-
coordinate:
|
|
4405
|
-
duration:
|
|
4406
|
-
region:
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4677
|
+
coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
|
|
4678
|
+
duration: import_v417.z.number().optional(),
|
|
4679
|
+
region: import_v417.z.tuple([
|
|
4680
|
+
import_v417.z.number().int(),
|
|
4681
|
+
import_v417.z.number().int(),
|
|
4682
|
+
import_v417.z.number().int(),
|
|
4683
|
+
import_v417.z.number().int()
|
|
4411
4684
|
]).optional(),
|
|
4412
|
-
scroll_amount:
|
|
4413
|
-
scroll_direction:
|
|
4414
|
-
start_coordinate:
|
|
4415
|
-
text:
|
|
4685
|
+
scroll_amount: import_v417.z.number().optional(),
|
|
4686
|
+
scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4687
|
+
start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
|
|
4688
|
+
text: import_v417.z.string().optional()
|
|
4416
4689
|
})
|
|
4417
4690
|
)
|
|
4418
4691
|
);
|
|
4419
|
-
var computer_20251124 = (0,
|
|
4692
|
+
var computer_20251124 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
4420
4693
|
id: "anthropic.computer_20251124",
|
|
4421
4694
|
inputSchema: computer_20251124InputSchema
|
|
4422
4695
|
});
|
|
4423
4696
|
|
|
4424
4697
|
// src/tool/memory_20250818.ts
|
|
4425
|
-
var
|
|
4426
|
-
var
|
|
4427
|
-
var memory_20250818InputSchema = (0,
|
|
4428
|
-
() => (0,
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
command:
|
|
4432
|
-
path:
|
|
4433
|
-
view_range:
|
|
4698
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
4699
|
+
var import_v418 = require("zod/v4");
|
|
4700
|
+
var memory_20250818InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
4701
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
4702
|
+
import_v418.z.discriminatedUnion("command", [
|
|
4703
|
+
import_v418.z.object({
|
|
4704
|
+
command: import_v418.z.literal("view"),
|
|
4705
|
+
path: import_v418.z.string(),
|
|
4706
|
+
view_range: import_v418.z.tuple([import_v418.z.number(), import_v418.z.number()]).optional()
|
|
4434
4707
|
}),
|
|
4435
|
-
|
|
4436
|
-
command:
|
|
4437
|
-
path:
|
|
4438
|
-
file_text:
|
|
4708
|
+
import_v418.z.object({
|
|
4709
|
+
command: import_v418.z.literal("create"),
|
|
4710
|
+
path: import_v418.z.string(),
|
|
4711
|
+
file_text: import_v418.z.string()
|
|
4439
4712
|
}),
|
|
4440
|
-
|
|
4441
|
-
command:
|
|
4442
|
-
path:
|
|
4443
|
-
old_str:
|
|
4444
|
-
new_str:
|
|
4713
|
+
import_v418.z.object({
|
|
4714
|
+
command: import_v418.z.literal("str_replace"),
|
|
4715
|
+
path: import_v418.z.string(),
|
|
4716
|
+
old_str: import_v418.z.string(),
|
|
4717
|
+
new_str: import_v418.z.string()
|
|
4445
4718
|
}),
|
|
4446
|
-
|
|
4447
|
-
command:
|
|
4448
|
-
path:
|
|
4449
|
-
insert_line:
|
|
4450
|
-
insert_text:
|
|
4719
|
+
import_v418.z.object({
|
|
4720
|
+
command: import_v418.z.literal("insert"),
|
|
4721
|
+
path: import_v418.z.string(),
|
|
4722
|
+
insert_line: import_v418.z.number(),
|
|
4723
|
+
insert_text: import_v418.z.string()
|
|
4451
4724
|
}),
|
|
4452
|
-
|
|
4453
|
-
command:
|
|
4454
|
-
path:
|
|
4725
|
+
import_v418.z.object({
|
|
4726
|
+
command: import_v418.z.literal("delete"),
|
|
4727
|
+
path: import_v418.z.string()
|
|
4455
4728
|
}),
|
|
4456
|
-
|
|
4457
|
-
command:
|
|
4458
|
-
old_path:
|
|
4459
|
-
new_path:
|
|
4729
|
+
import_v418.z.object({
|
|
4730
|
+
command: import_v418.z.literal("rename"),
|
|
4731
|
+
old_path: import_v418.z.string(),
|
|
4732
|
+
new_path: import_v418.z.string()
|
|
4460
4733
|
})
|
|
4461
4734
|
])
|
|
4462
4735
|
)
|
|
4463
4736
|
);
|
|
4464
|
-
var memory_20250818 = (0,
|
|
4737
|
+
var memory_20250818 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
4465
4738
|
id: "anthropic.memory_20250818",
|
|
4466
4739
|
inputSchema: memory_20250818InputSchema
|
|
4467
4740
|
});
|
|
4468
4741
|
|
|
4469
4742
|
// src/tool/text-editor_20241022.ts
|
|
4470
|
-
var
|
|
4471
|
-
var
|
|
4472
|
-
var textEditor_20241022InputSchema = (0,
|
|
4473
|
-
() => (0,
|
|
4474
|
-
|
|
4475
|
-
command:
|
|
4476
|
-
path:
|
|
4477
|
-
file_text:
|
|
4478
|
-
insert_line:
|
|
4479
|
-
new_str:
|
|
4480
|
-
insert_text:
|
|
4481
|
-
old_str:
|
|
4482
|
-
view_range:
|
|
4743
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
4744
|
+
var import_v419 = require("zod/v4");
|
|
4745
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
4746
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
4747
|
+
import_v419.z.object({
|
|
4748
|
+
command: import_v419.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4749
|
+
path: import_v419.z.string(),
|
|
4750
|
+
file_text: import_v419.z.string().optional(),
|
|
4751
|
+
insert_line: import_v419.z.number().int().optional(),
|
|
4752
|
+
new_str: import_v419.z.string().optional(),
|
|
4753
|
+
insert_text: import_v419.z.string().optional(),
|
|
4754
|
+
old_str: import_v419.z.string().optional(),
|
|
4755
|
+
view_range: import_v419.z.array(import_v419.z.number().int()).optional()
|
|
4483
4756
|
})
|
|
4484
4757
|
)
|
|
4485
4758
|
);
|
|
4486
|
-
var textEditor_20241022 = (0,
|
|
4759
|
+
var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
4487
4760
|
id: "anthropic.text_editor_20241022",
|
|
4488
4761
|
inputSchema: textEditor_20241022InputSchema
|
|
4489
4762
|
});
|
|
4490
4763
|
|
|
4491
4764
|
// src/tool/text-editor_20250124.ts
|
|
4492
|
-
var
|
|
4493
|
-
var
|
|
4494
|
-
var textEditor_20250124InputSchema = (0,
|
|
4495
|
-
() => (0,
|
|
4496
|
-
|
|
4497
|
-
command:
|
|
4498
|
-
path:
|
|
4499
|
-
file_text:
|
|
4500
|
-
insert_line:
|
|
4501
|
-
new_str:
|
|
4502
|
-
insert_text:
|
|
4503
|
-
old_str:
|
|
4504
|
-
view_range:
|
|
4765
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
4766
|
+
var import_v420 = require("zod/v4");
|
|
4767
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
4768
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
4769
|
+
import_v420.z.object({
|
|
4770
|
+
command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4771
|
+
path: import_v420.z.string(),
|
|
4772
|
+
file_text: import_v420.z.string().optional(),
|
|
4773
|
+
insert_line: import_v420.z.number().int().optional(),
|
|
4774
|
+
new_str: import_v420.z.string().optional(),
|
|
4775
|
+
insert_text: import_v420.z.string().optional(),
|
|
4776
|
+
old_str: import_v420.z.string().optional(),
|
|
4777
|
+
view_range: import_v420.z.array(import_v420.z.number().int()).optional()
|
|
4505
4778
|
})
|
|
4506
4779
|
)
|
|
4507
4780
|
);
|
|
4508
|
-
var textEditor_20250124 = (0,
|
|
4781
|
+
var textEditor_20250124 = (0, import_provider_utils23.createProviderToolFactory)({
|
|
4509
4782
|
id: "anthropic.text_editor_20250124",
|
|
4510
4783
|
inputSchema: textEditor_20250124InputSchema
|
|
4511
4784
|
});
|
|
4512
4785
|
|
|
4513
4786
|
// src/tool/text-editor_20250429.ts
|
|
4514
|
-
var
|
|
4515
|
-
var
|
|
4516
|
-
var textEditor_20250429InputSchema = (0,
|
|
4517
|
-
() => (0,
|
|
4518
|
-
|
|
4519
|
-
command:
|
|
4520
|
-
path:
|
|
4521
|
-
file_text:
|
|
4522
|
-
insert_line:
|
|
4523
|
-
new_str:
|
|
4524
|
-
insert_text:
|
|
4525
|
-
old_str:
|
|
4526
|
-
view_range:
|
|
4787
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
4788
|
+
var import_v421 = require("zod/v4");
|
|
4789
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
4790
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
4791
|
+
import_v421.z.object({
|
|
4792
|
+
command: import_v421.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4793
|
+
path: import_v421.z.string(),
|
|
4794
|
+
file_text: import_v421.z.string().optional(),
|
|
4795
|
+
insert_line: import_v421.z.number().int().optional(),
|
|
4796
|
+
new_str: import_v421.z.string().optional(),
|
|
4797
|
+
insert_text: import_v421.z.string().optional(),
|
|
4798
|
+
old_str: import_v421.z.string().optional(),
|
|
4799
|
+
view_range: import_v421.z.array(import_v421.z.number().int()).optional()
|
|
4527
4800
|
})
|
|
4528
4801
|
)
|
|
4529
4802
|
);
|
|
4530
|
-
var textEditor_20250429 = (0,
|
|
4803
|
+
var textEditor_20250429 = (0, import_provider_utils24.createProviderToolFactory)({
|
|
4531
4804
|
id: "anthropic.text_editor_20250429",
|
|
4532
4805
|
inputSchema: textEditor_20250429InputSchema
|
|
4533
4806
|
});
|
|
4534
4807
|
|
|
4535
4808
|
// src/tool/tool-search-bm25_20251119.ts
|
|
4536
|
-
var
|
|
4537
|
-
var
|
|
4538
|
-
var toolSearchBm25_20251119OutputSchema = (0,
|
|
4539
|
-
() => (0,
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
type:
|
|
4543
|
-
toolName:
|
|
4809
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
4810
|
+
var import_v422 = require("zod/v4");
|
|
4811
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
4812
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
4813
|
+
import_v422.z.array(
|
|
4814
|
+
import_v422.z.object({
|
|
4815
|
+
type: import_v422.z.literal("tool_reference"),
|
|
4816
|
+
toolName: import_v422.z.string()
|
|
4544
4817
|
})
|
|
4545
4818
|
)
|
|
4546
4819
|
)
|
|
4547
4820
|
);
|
|
4548
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
4549
|
-
() => (0,
|
|
4550
|
-
|
|
4821
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
4822
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
4823
|
+
import_v422.z.object({
|
|
4551
4824
|
/**
|
|
4552
4825
|
* A natural language query to search for tools.
|
|
4553
4826
|
* Claude will use BM25 text search to find relevant tools.
|
|
4554
4827
|
*/
|
|
4555
|
-
query:
|
|
4828
|
+
query: import_v422.z.string(),
|
|
4556
4829
|
/**
|
|
4557
4830
|
* Maximum number of tools to return. Optional.
|
|
4558
4831
|
*/
|
|
4559
|
-
limit:
|
|
4832
|
+
limit: import_v422.z.number().optional()
|
|
4560
4833
|
})
|
|
4561
4834
|
)
|
|
4562
4835
|
);
|
|
4563
|
-
var
|
|
4836
|
+
var factory10 = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
|
|
4564
4837
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4565
4838
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4566
4839
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
4567
4840
|
supportsDeferredResults: true
|
|
4568
4841
|
});
|
|
4569
4842
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
4570
|
-
return
|
|
4843
|
+
return factory10(args);
|
|
4571
4844
|
};
|
|
4572
4845
|
|
|
4573
4846
|
// src/anthropic-tools.ts
|
|
@@ -4714,6 +4987,16 @@ var anthropicTools = {
|
|
|
4714
4987
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
4715
4988
|
*/
|
|
4716
4989
|
webFetch_20250910,
|
|
4990
|
+
/**
|
|
4991
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
4992
|
+
*
|
|
4993
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
4994
|
+
* @param allowedDomains - Only fetch from these domains
|
|
4995
|
+
* @param blockedDomains - Never fetch from these domains
|
|
4996
|
+
* @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.
|
|
4997
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
4998
|
+
*/
|
|
4999
|
+
webFetch_20260209,
|
|
4717
5000
|
/**
|
|
4718
5001
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
4719
5002
|
*
|
|
@@ -4723,6 +5006,15 @@ var anthropicTools = {
|
|
|
4723
5006
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
4724
5007
|
*/
|
|
4725
5008
|
webSearch_20250305,
|
|
5009
|
+
/**
|
|
5010
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
5011
|
+
*
|
|
5012
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
5013
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
5014
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
5015
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
5016
|
+
*/
|
|
5017
|
+
webSearch_20260209,
|
|
4726
5018
|
/**
|
|
4727
5019
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
4728
5020
|
*
|
|
@@ -4756,8 +5048,8 @@ var anthropicTools = {
|
|
|
4756
5048
|
// src/anthropic-provider.ts
|
|
4757
5049
|
function createAnthropic(options = {}) {
|
|
4758
5050
|
var _a, _b;
|
|
4759
|
-
const baseURL = (_a = (0,
|
|
4760
|
-
(0,
|
|
5051
|
+
const baseURL = (_a = (0, import_provider_utils26.withoutTrailingSlash)(
|
|
5052
|
+
(0, import_provider_utils26.loadOptionalSetting)({
|
|
4761
5053
|
settingValue: options.baseURL,
|
|
4762
5054
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
4763
5055
|
})
|
|
@@ -4771,13 +5063,13 @@ function createAnthropic(options = {}) {
|
|
|
4771
5063
|
}
|
|
4772
5064
|
const getHeaders = () => {
|
|
4773
5065
|
const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
|
|
4774
|
-
"x-api-key": (0,
|
|
5066
|
+
"x-api-key": (0, import_provider_utils26.loadApiKey)({
|
|
4775
5067
|
apiKey: options.apiKey,
|
|
4776
5068
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
4777
5069
|
description: "Anthropic"
|
|
4778
5070
|
})
|
|
4779
5071
|
};
|
|
4780
|
-
return (0,
|
|
5072
|
+
return (0, import_provider_utils26.withUserAgentSuffix)(
|
|
4781
5073
|
{
|
|
4782
5074
|
"anthropic-version": "2023-06-01",
|
|
4783
5075
|
...authHeaders,
|
|
@@ -4793,7 +5085,7 @@ function createAnthropic(options = {}) {
|
|
|
4793
5085
|
baseURL,
|
|
4794
5086
|
headers: getHeaders,
|
|
4795
5087
|
fetch: options.fetch,
|
|
4796
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
5088
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils26.generateId,
|
|
4797
5089
|
supportedUrls: () => ({
|
|
4798
5090
|
"image/*": [/^https?:\/\/.*$/],
|
|
4799
5091
|
"application/pdf": [/^https?:\/\/.*$/]
|