@ai-sdk/anthropic 3.0.0-beta.22 → 3.0.0-beta.24
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 +141 -0
- package/dist/index.d.ts +141 -0
- package/dist/index.js +510 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +502 -107
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +147 -0
- package/dist/internal/index.d.ts +147 -0
- package/dist/internal/index.js +504 -117
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +501 -106
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,14 +28,14 @@ module.exports = __toCommonJS(src_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/anthropic-provider.ts
|
|
30
30
|
var import_provider4 = require("@ai-sdk/provider");
|
|
31
|
-
var
|
|
31
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/version.ts
|
|
34
|
-
var VERSION = true ? "3.0.0-beta.
|
|
34
|
+
var VERSION = true ? "3.0.0-beta.24" : "0.0.0-test";
|
|
35
35
|
|
|
36
36
|
// src/anthropic-messages-language-model.ts
|
|
37
37
|
var import_provider3 = require("@ai-sdk/provider");
|
|
38
|
-
var
|
|
38
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
39
39
|
|
|
40
40
|
// src/anthropic-error.ts
|
|
41
41
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -163,6 +163,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
163
163
|
})
|
|
164
164
|
])
|
|
165
165
|
}),
|
|
166
|
+
// code execution results for code_execution_20250522 tool:
|
|
166
167
|
import_v42.z.object({
|
|
167
168
|
type: import_v42.z.literal("code_execution_tool_result"),
|
|
168
169
|
tool_use_id: import_v42.z.string(),
|
|
@@ -178,6 +179,62 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
178
179
|
error_code: import_v42.z.string()
|
|
179
180
|
})
|
|
180
181
|
])
|
|
182
|
+
}),
|
|
183
|
+
// bash code execution results for code_execution_20250825 tool:
|
|
184
|
+
import_v42.z.object({
|
|
185
|
+
type: import_v42.z.literal("bash_code_execution_tool_result"),
|
|
186
|
+
tool_use_id: import_v42.z.string(),
|
|
187
|
+
content: import_v42.z.discriminatedUnion("type", [
|
|
188
|
+
import_v42.z.object({
|
|
189
|
+
type: import_v42.z.literal("bash_code_execution_result"),
|
|
190
|
+
content: import_v42.z.array(
|
|
191
|
+
import_v42.z.object({
|
|
192
|
+
type: import_v42.z.literal("bash_code_execution_output"),
|
|
193
|
+
file_id: import_v42.z.string()
|
|
194
|
+
})
|
|
195
|
+
),
|
|
196
|
+
stdout: import_v42.z.string(),
|
|
197
|
+
stderr: import_v42.z.string(),
|
|
198
|
+
return_code: import_v42.z.number()
|
|
199
|
+
}),
|
|
200
|
+
import_v42.z.object({
|
|
201
|
+
type: import_v42.z.literal("bash_code_execution_tool_result_error"),
|
|
202
|
+
error_code: import_v42.z.string()
|
|
203
|
+
})
|
|
204
|
+
])
|
|
205
|
+
}),
|
|
206
|
+
// text editor code execution results for code_execution_20250825 tool:
|
|
207
|
+
import_v42.z.object({
|
|
208
|
+
type: import_v42.z.literal("text_editor_code_execution_tool_result"),
|
|
209
|
+
tool_use_id: import_v42.z.string(),
|
|
210
|
+
content: import_v42.z.discriminatedUnion("type", [
|
|
211
|
+
import_v42.z.object({
|
|
212
|
+
type: import_v42.z.literal("text_editor_code_execution_tool_result_error"),
|
|
213
|
+
error_code: import_v42.z.string()
|
|
214
|
+
}),
|
|
215
|
+
import_v42.z.object({
|
|
216
|
+
type: import_v42.z.literal("text_editor_code_execution_view_result"),
|
|
217
|
+
content: import_v42.z.string(),
|
|
218
|
+
file_type: import_v42.z.string(),
|
|
219
|
+
num_lines: import_v42.z.number().nullable(),
|
|
220
|
+
start_line: import_v42.z.number().nullable(),
|
|
221
|
+
total_lines: import_v42.z.number().nullable()
|
|
222
|
+
}),
|
|
223
|
+
import_v42.z.object({
|
|
224
|
+
type: import_v42.z.literal("text_editor_code_execution_create_result"),
|
|
225
|
+
is_file_update: import_v42.z.boolean()
|
|
226
|
+
}),
|
|
227
|
+
import_v42.z.object({
|
|
228
|
+
type: import_v42.z.literal(
|
|
229
|
+
"text_editor_code_execution_str_replace_result"
|
|
230
|
+
),
|
|
231
|
+
lines: import_v42.z.array(import_v42.z.string()).nullable(),
|
|
232
|
+
new_lines: import_v42.z.number().nullable(),
|
|
233
|
+
new_start: import_v42.z.number().nullable(),
|
|
234
|
+
old_lines: import_v42.z.number().nullable(),
|
|
235
|
+
old_start: import_v42.z.number().nullable()
|
|
236
|
+
})
|
|
237
|
+
])
|
|
181
238
|
})
|
|
182
239
|
])
|
|
183
240
|
),
|
|
@@ -278,6 +335,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
278
335
|
})
|
|
279
336
|
])
|
|
280
337
|
}),
|
|
338
|
+
// code execution results for code_execution_20250522 tool:
|
|
281
339
|
import_v42.z.object({
|
|
282
340
|
type: import_v42.z.literal("code_execution_tool_result"),
|
|
283
341
|
tool_use_id: import_v42.z.string(),
|
|
@@ -293,6 +351,62 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
293
351
|
error_code: import_v42.z.string()
|
|
294
352
|
})
|
|
295
353
|
])
|
|
354
|
+
}),
|
|
355
|
+
// bash code execution results for code_execution_20250825 tool:
|
|
356
|
+
import_v42.z.object({
|
|
357
|
+
type: import_v42.z.literal("bash_code_execution_tool_result"),
|
|
358
|
+
tool_use_id: import_v42.z.string(),
|
|
359
|
+
content: import_v42.z.discriminatedUnion("type", [
|
|
360
|
+
import_v42.z.object({
|
|
361
|
+
type: import_v42.z.literal("bash_code_execution_result"),
|
|
362
|
+
content: import_v42.z.array(
|
|
363
|
+
import_v42.z.object({
|
|
364
|
+
type: import_v42.z.literal("bash_code_execution_output"),
|
|
365
|
+
file_id: import_v42.z.string()
|
|
366
|
+
})
|
|
367
|
+
),
|
|
368
|
+
stdout: import_v42.z.string(),
|
|
369
|
+
stderr: import_v42.z.string(),
|
|
370
|
+
return_code: import_v42.z.number()
|
|
371
|
+
}),
|
|
372
|
+
import_v42.z.object({
|
|
373
|
+
type: import_v42.z.literal("bash_code_execution_tool_result_error"),
|
|
374
|
+
error_code: import_v42.z.string()
|
|
375
|
+
})
|
|
376
|
+
])
|
|
377
|
+
}),
|
|
378
|
+
// text editor code execution results for code_execution_20250825 tool:
|
|
379
|
+
import_v42.z.object({
|
|
380
|
+
type: import_v42.z.literal("text_editor_code_execution_tool_result"),
|
|
381
|
+
tool_use_id: import_v42.z.string(),
|
|
382
|
+
content: import_v42.z.discriminatedUnion("type", [
|
|
383
|
+
import_v42.z.object({
|
|
384
|
+
type: import_v42.z.literal("text_editor_code_execution_tool_result_error"),
|
|
385
|
+
error_code: import_v42.z.string()
|
|
386
|
+
}),
|
|
387
|
+
import_v42.z.object({
|
|
388
|
+
type: import_v42.z.literal("text_editor_code_execution_view_result"),
|
|
389
|
+
content: import_v42.z.string(),
|
|
390
|
+
file_type: import_v42.z.string(),
|
|
391
|
+
num_lines: import_v42.z.number().nullable(),
|
|
392
|
+
start_line: import_v42.z.number().nullable(),
|
|
393
|
+
total_lines: import_v42.z.number().nullable()
|
|
394
|
+
}),
|
|
395
|
+
import_v42.z.object({
|
|
396
|
+
type: import_v42.z.literal("text_editor_code_execution_create_result"),
|
|
397
|
+
is_file_update: import_v42.z.boolean()
|
|
398
|
+
}),
|
|
399
|
+
import_v42.z.object({
|
|
400
|
+
type: import_v42.z.literal(
|
|
401
|
+
"text_editor_code_execution_str_replace_result"
|
|
402
|
+
),
|
|
403
|
+
lines: import_v42.z.array(import_v42.z.string()).nullable(),
|
|
404
|
+
new_lines: import_v42.z.number().nullable(),
|
|
405
|
+
new_start: import_v42.z.number().nullable(),
|
|
406
|
+
old_lines: import_v42.z.number().nullable(),
|
|
407
|
+
old_start: import_v42.z.number().nullable()
|
|
408
|
+
})
|
|
409
|
+
])
|
|
296
410
|
})
|
|
297
411
|
])
|
|
298
412
|
}),
|
|
@@ -618,6 +732,14 @@ async function prepareTools({
|
|
|
618
732
|
});
|
|
619
733
|
break;
|
|
620
734
|
}
|
|
735
|
+
case "anthropic.code_execution_20250825": {
|
|
736
|
+
betas.add("code-execution-2025-08-25");
|
|
737
|
+
anthropicTools2.push({
|
|
738
|
+
type: "code_execution_20250825",
|
|
739
|
+
name: "code_execution"
|
|
740
|
+
});
|
|
741
|
+
break;
|
|
742
|
+
}
|
|
621
743
|
case "anthropic.computer_20250124": {
|
|
622
744
|
betas.add("computer-use-2025-01-24");
|
|
623
745
|
anthropicTools2.push({
|
|
@@ -692,6 +814,14 @@ async function prepareTools({
|
|
|
692
814
|
});
|
|
693
815
|
break;
|
|
694
816
|
}
|
|
817
|
+
case "anthropic.memory_20250818": {
|
|
818
|
+
betas.add("context-management-2025-06-27");
|
|
819
|
+
anthropicTools2.push({
|
|
820
|
+
name: "memory",
|
|
821
|
+
type: "memory_20250818"
|
|
822
|
+
});
|
|
823
|
+
break;
|
|
824
|
+
}
|
|
695
825
|
case "anthropic.web_fetch_20250910": {
|
|
696
826
|
betas.add("web-fetch-2025-09-10");
|
|
697
827
|
const args = await (0, import_provider_utils7.validateTypes)({
|
|
@@ -791,7 +921,7 @@ async function prepareTools({
|
|
|
791
921
|
|
|
792
922
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
793
923
|
var import_provider2 = require("@ai-sdk/provider");
|
|
794
|
-
var
|
|
924
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
795
925
|
|
|
796
926
|
// src/tool/code-execution_20250522.ts
|
|
797
927
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
@@ -823,6 +953,95 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
823
953
|
return factory4(args);
|
|
824
954
|
};
|
|
825
955
|
|
|
956
|
+
// src/tool/code-execution_20250825.ts
|
|
957
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
958
|
+
var import_v48 = require("zod/v4");
|
|
959
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
960
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
961
|
+
import_v48.z.discriminatedUnion("type", [
|
|
962
|
+
import_v48.z.object({
|
|
963
|
+
type: import_v48.z.literal("bash_code_execution_result"),
|
|
964
|
+
content: import_v48.z.array(
|
|
965
|
+
import_v48.z.object({
|
|
966
|
+
type: import_v48.z.literal("bash_code_execution_output"),
|
|
967
|
+
file_id: import_v48.z.string()
|
|
968
|
+
})
|
|
969
|
+
),
|
|
970
|
+
stdout: import_v48.z.string(),
|
|
971
|
+
stderr: import_v48.z.string(),
|
|
972
|
+
return_code: import_v48.z.number()
|
|
973
|
+
}),
|
|
974
|
+
import_v48.z.object({
|
|
975
|
+
type: import_v48.z.literal("bash_code_execution_tool_result_error"),
|
|
976
|
+
error_code: import_v48.z.string()
|
|
977
|
+
}),
|
|
978
|
+
import_v48.z.object({
|
|
979
|
+
type: import_v48.z.literal("text_editor_code_execution_tool_result_error"),
|
|
980
|
+
error_code: import_v48.z.string()
|
|
981
|
+
}),
|
|
982
|
+
import_v48.z.object({
|
|
983
|
+
type: import_v48.z.literal("text_editor_code_execution_view_result"),
|
|
984
|
+
content: import_v48.z.string(),
|
|
985
|
+
file_type: import_v48.z.string(),
|
|
986
|
+
num_lines: import_v48.z.number().nullable(),
|
|
987
|
+
start_line: import_v48.z.number().nullable(),
|
|
988
|
+
total_lines: import_v48.z.number().nullable()
|
|
989
|
+
}),
|
|
990
|
+
import_v48.z.object({
|
|
991
|
+
type: import_v48.z.literal("text_editor_code_execution_create_result"),
|
|
992
|
+
is_file_update: import_v48.z.boolean()
|
|
993
|
+
}),
|
|
994
|
+
import_v48.z.object({
|
|
995
|
+
type: import_v48.z.literal("text_editor_code_execution_str_replace_result"),
|
|
996
|
+
lines: import_v48.z.array(import_v48.z.string()).nullable(),
|
|
997
|
+
new_lines: import_v48.z.number().nullable(),
|
|
998
|
+
new_start: import_v48.z.number().nullable(),
|
|
999
|
+
old_lines: import_v48.z.number().nullable(),
|
|
1000
|
+
old_start: import_v48.z.number().nullable()
|
|
1001
|
+
})
|
|
1002
|
+
])
|
|
1003
|
+
)
|
|
1004
|
+
);
|
|
1005
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1006
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1007
|
+
import_v48.z.discriminatedUnion("type", [
|
|
1008
|
+
import_v48.z.object({
|
|
1009
|
+
type: import_v48.z.literal("bash_code_execution"),
|
|
1010
|
+
command: import_v48.z.string()
|
|
1011
|
+
}),
|
|
1012
|
+
import_v48.z.discriminatedUnion("command", [
|
|
1013
|
+
import_v48.z.object({
|
|
1014
|
+
type: import_v48.z.literal("text_editor_code_execution"),
|
|
1015
|
+
command: import_v48.z.literal("view"),
|
|
1016
|
+
path: import_v48.z.string()
|
|
1017
|
+
}),
|
|
1018
|
+
import_v48.z.object({
|
|
1019
|
+
type: import_v48.z.literal("text_editor_code_execution"),
|
|
1020
|
+
command: import_v48.z.literal("create"),
|
|
1021
|
+
path: import_v48.z.string(),
|
|
1022
|
+
file_text: import_v48.z.string().nullish()
|
|
1023
|
+
}),
|
|
1024
|
+
import_v48.z.object({
|
|
1025
|
+
type: import_v48.z.literal("text_editor_code_execution"),
|
|
1026
|
+
command: import_v48.z.literal("str_replace"),
|
|
1027
|
+
path: import_v48.z.string(),
|
|
1028
|
+
old_str: import_v48.z.string(),
|
|
1029
|
+
new_str: import_v48.z.string()
|
|
1030
|
+
})
|
|
1031
|
+
])
|
|
1032
|
+
])
|
|
1033
|
+
)
|
|
1034
|
+
);
|
|
1035
|
+
var factory5 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1036
|
+
id: "anthropic.code_execution_20250825",
|
|
1037
|
+
name: "code_execution",
|
|
1038
|
+
inputSchema: codeExecution_20250825InputSchema,
|
|
1039
|
+
outputSchema: codeExecution_20250825OutputSchema
|
|
1040
|
+
});
|
|
1041
|
+
var codeExecution_20250825 = (args = {}) => {
|
|
1042
|
+
return factory5(args);
|
|
1043
|
+
};
|
|
1044
|
+
|
|
826
1045
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
827
1046
|
function convertToString(data) {
|
|
828
1047
|
if (typeof data === "string") {
|
|
@@ -852,7 +1071,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
852
1071
|
const messages = [];
|
|
853
1072
|
async function shouldEnableCitations(providerMetadata) {
|
|
854
1073
|
var _a2, _b2;
|
|
855
|
-
const anthropicOptions = await (0,
|
|
1074
|
+
const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
856
1075
|
provider: "anthropic",
|
|
857
1076
|
providerOptions: providerMetadata,
|
|
858
1077
|
schema: anthropicFilePartProviderOptions
|
|
@@ -860,7 +1079,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
860
1079
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
861
1080
|
}
|
|
862
1081
|
async function getDocumentMetadata(providerMetadata) {
|
|
863
|
-
const anthropicOptions = await (0,
|
|
1082
|
+
const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
864
1083
|
provider: "anthropic",
|
|
865
1084
|
providerOptions: providerMetadata,
|
|
866
1085
|
schema: anthropicFilePartProviderOptions
|
|
@@ -917,7 +1136,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
917
1136
|
} : {
|
|
918
1137
|
type: "base64",
|
|
919
1138
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
920
|
-
data: (0,
|
|
1139
|
+
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
921
1140
|
},
|
|
922
1141
|
cache_control: cacheControl
|
|
923
1142
|
});
|
|
@@ -937,7 +1156,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
937
1156
|
} : {
|
|
938
1157
|
type: "base64",
|
|
939
1158
|
media_type: "application/pdf",
|
|
940
|
-
data: (0,
|
|
1159
|
+
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
941
1160
|
},
|
|
942
1161
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
943
1162
|
...metadata.context && { context: metadata.context },
|
|
@@ -1087,7 +1306,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1087
1306
|
}
|
|
1088
1307
|
case "reasoning": {
|
|
1089
1308
|
if (sendReasoning) {
|
|
1090
|
-
const reasoningMetadata = await (0,
|
|
1309
|
+
const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1091
1310
|
provider: "anthropic",
|
|
1092
1311
|
providerOptions: part.providerOptions,
|
|
1093
1312
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -1128,7 +1347,17 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1128
1347
|
}
|
|
1129
1348
|
case "tool-call": {
|
|
1130
1349
|
if (part.providerExecuted) {
|
|
1131
|
-
if (part.toolName === "code_execution"
|
|
1350
|
+
if (part.toolName === "code_execution" && part.input != null && typeof part.input === "object" && "type" in part.input && typeof part.input.type === "string" && (part.input.type === "bash_code_execution" || part.input.type === "text_editor_code_execution")) {
|
|
1351
|
+
anthropicContent.push({
|
|
1352
|
+
type: "server_tool_use",
|
|
1353
|
+
id: part.toolCallId,
|
|
1354
|
+
name: part.input.type,
|
|
1355
|
+
// map back to subtool name
|
|
1356
|
+
input: part.input,
|
|
1357
|
+
cache_control: cacheControl
|
|
1358
|
+
});
|
|
1359
|
+
} else if (part.toolName === "code_execution" || // code execution 20250522
|
|
1360
|
+
part.toolName === "web_fetch" || part.toolName === "web_search") {
|
|
1132
1361
|
anthropicContent.push({
|
|
1133
1362
|
type: "server_tool_use",
|
|
1134
1363
|
id: part.toolCallId,
|
|
@@ -1163,21 +1392,48 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1163
1392
|
});
|
|
1164
1393
|
break;
|
|
1165
1394
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1395
|
+
if (output.value == null || typeof output.value !== "object" || !("type" in output.value) || typeof output.value.type !== "string") {
|
|
1396
|
+
warnings.push({
|
|
1397
|
+
type: "other",
|
|
1398
|
+
message: `provider executed tool result output value is not a valid code execution result for tool ${part.toolName}`
|
|
1399
|
+
});
|
|
1400
|
+
break;
|
|
1401
|
+
}
|
|
1402
|
+
if (output.value.type === "code_execution_result") {
|
|
1403
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1404
|
+
value: output.value,
|
|
1405
|
+
schema: codeExecution_20250522OutputSchema
|
|
1406
|
+
});
|
|
1407
|
+
anthropicContent.push({
|
|
1408
|
+
type: "code_execution_tool_result",
|
|
1409
|
+
tool_use_id: part.toolCallId,
|
|
1410
|
+
content: {
|
|
1411
|
+
type: codeExecutionOutput.type,
|
|
1412
|
+
stdout: codeExecutionOutput.stdout,
|
|
1413
|
+
stderr: codeExecutionOutput.stderr,
|
|
1414
|
+
return_code: codeExecutionOutput.return_code
|
|
1415
|
+
},
|
|
1416
|
+
cache_control: cacheControl
|
|
1417
|
+
});
|
|
1418
|
+
} else {
|
|
1419
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1420
|
+
value: output.value,
|
|
1421
|
+
schema: codeExecution_20250825OutputSchema
|
|
1422
|
+
});
|
|
1423
|
+
anthropicContent.push(
|
|
1424
|
+
codeExecutionOutput.type === "bash_code_execution_result" || codeExecutionOutput.type === "bash_code_execution_tool_result_error" ? {
|
|
1425
|
+
type: "bash_code_execution_tool_result",
|
|
1426
|
+
tool_use_id: part.toolCallId,
|
|
1427
|
+
cache_control: cacheControl,
|
|
1428
|
+
content: codeExecutionOutput
|
|
1429
|
+
} : {
|
|
1430
|
+
type: "text_editor_code_execution_tool_result",
|
|
1431
|
+
tool_use_id: part.toolCallId,
|
|
1432
|
+
cache_control: cacheControl,
|
|
1433
|
+
content: codeExecutionOutput
|
|
1434
|
+
}
|
|
1435
|
+
);
|
|
1436
|
+
}
|
|
1181
1437
|
break;
|
|
1182
1438
|
}
|
|
1183
1439
|
if (part.toolName === "web_fetch") {
|
|
@@ -1189,7 +1445,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1189
1445
|
});
|
|
1190
1446
|
break;
|
|
1191
1447
|
}
|
|
1192
|
-
const webFetchOutput = await (0,
|
|
1448
|
+
const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1193
1449
|
value: output.value,
|
|
1194
1450
|
schema: webFetch_20250910OutputSchema
|
|
1195
1451
|
});
|
|
@@ -1224,7 +1480,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1224
1480
|
});
|
|
1225
1481
|
break;
|
|
1226
1482
|
}
|
|
1227
|
-
const webSearchOutput = await (0,
|
|
1483
|
+
const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1228
1484
|
value: output.value,
|
|
1229
1485
|
schema: webSearch_20250305OutputSchema
|
|
1230
1486
|
});
|
|
@@ -1369,7 +1625,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1369
1625
|
var _a;
|
|
1370
1626
|
this.modelId = modelId;
|
|
1371
1627
|
this.config = config;
|
|
1372
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
1628
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
|
|
1373
1629
|
}
|
|
1374
1630
|
supportsUrl(url) {
|
|
1375
1631
|
return url.protocol === "https:";
|
|
@@ -1438,7 +1694,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1438
1694
|
description: "Respond with a JSON object.",
|
|
1439
1695
|
inputSchema: responseFormat.schema
|
|
1440
1696
|
} : void 0;
|
|
1441
|
-
const anthropicOptions = await (0,
|
|
1697
|
+
const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
|
|
1442
1698
|
provider: "anthropic",
|
|
1443
1699
|
providerOptions,
|
|
1444
1700
|
schema: anthropicProviderOptions
|
|
@@ -1530,8 +1786,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1530
1786
|
betas,
|
|
1531
1787
|
headers
|
|
1532
1788
|
}) {
|
|
1533
|
-
return (0,
|
|
1534
|
-
await (0,
|
|
1789
|
+
return (0, import_provider_utils11.combineHeaders)(
|
|
1790
|
+
await (0, import_provider_utils11.resolve)(this.config.headers),
|
|
1535
1791
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {},
|
|
1536
1792
|
headers
|
|
1537
1793
|
);
|
|
@@ -1575,12 +1831,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1575
1831
|
responseHeaders,
|
|
1576
1832
|
value: response,
|
|
1577
1833
|
rawValue: rawResponse
|
|
1578
|
-
} = await (0,
|
|
1834
|
+
} = await (0, import_provider_utils11.postJsonToApi)({
|
|
1579
1835
|
url: this.buildRequestUrl(false),
|
|
1580
1836
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1581
1837
|
body: this.transformRequestBody(args),
|
|
1582
1838
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1583
|
-
successfulResponseHandler: (0,
|
|
1839
|
+
successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
|
|
1584
1840
|
anthropicMessagesResponseSchema
|
|
1585
1841
|
),
|
|
1586
1842
|
abortSignal: options.abortSignal,
|
|
@@ -1647,7 +1903,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1647
1903
|
break;
|
|
1648
1904
|
}
|
|
1649
1905
|
case "server_tool_use": {
|
|
1650
|
-
if (part.name === "
|
|
1906
|
+
if (part.name === "text_editor_code_execution" || part.name === "bash_code_execution") {
|
|
1907
|
+
content.push({
|
|
1908
|
+
type: "tool-call",
|
|
1909
|
+
toolCallId: part.id,
|
|
1910
|
+
toolName: "code_execution",
|
|
1911
|
+
input: JSON.stringify({ type: part.name, ...part.input }),
|
|
1912
|
+
providerExecuted: true
|
|
1913
|
+
});
|
|
1914
|
+
} else if (part.name === "web_search" || part.name === "code_execution" || part.name === "web_fetch") {
|
|
1651
1915
|
content.push({
|
|
1652
1916
|
type: "tool-call",
|
|
1653
1917
|
toolCallId: part.id,
|
|
@@ -1743,6 +2007,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1743
2007
|
}
|
|
1744
2008
|
break;
|
|
1745
2009
|
}
|
|
2010
|
+
// code execution 20250522:
|
|
1746
2011
|
case "code_execution_tool_result": {
|
|
1747
2012
|
if (part.content.type === "code_execution_result") {
|
|
1748
2013
|
content.push({
|
|
@@ -1772,6 +2037,18 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1772
2037
|
}
|
|
1773
2038
|
break;
|
|
1774
2039
|
}
|
|
2040
|
+
// code execution 20250825:
|
|
2041
|
+
case "bash_code_execution_tool_result":
|
|
2042
|
+
case "text_editor_code_execution_tool_result": {
|
|
2043
|
+
content.push({
|
|
2044
|
+
type: "tool-result",
|
|
2045
|
+
toolCallId: part.tool_use_id,
|
|
2046
|
+
toolName: "code_execution",
|
|
2047
|
+
result: part.content,
|
|
2048
|
+
providerExecuted: true
|
|
2049
|
+
});
|
|
2050
|
+
break;
|
|
2051
|
+
}
|
|
1775
2052
|
}
|
|
1776
2053
|
}
|
|
1777
2054
|
return {
|
|
@@ -1807,12 +2084,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1807
2084
|
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
|
|
1808
2085
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
1809
2086
|
const body = { ...args, stream: true };
|
|
1810
|
-
const { responseHeaders, value: response } = await (0,
|
|
2087
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
|
|
1811
2088
|
url: this.buildRequestUrl(true),
|
|
1812
2089
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1813
2090
|
body: this.transformRequestBody(body),
|
|
1814
2091
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1815
|
-
successfulResponseHandler: (0,
|
|
2092
|
+
successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
|
|
1816
2093
|
anthropicMessagesChunkSchema
|
|
1817
2094
|
),
|
|
1818
2095
|
abortSignal: options.abortSignal,
|
|
@@ -1888,7 +2165,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1888
2165
|
type: "tool-call",
|
|
1889
2166
|
toolCallId: value.content_block.id,
|
|
1890
2167
|
toolName: value.content_block.name,
|
|
1891
|
-
input: ""
|
|
2168
|
+
input: "",
|
|
2169
|
+
firstDelta: true
|
|
1892
2170
|
};
|
|
1893
2171
|
controller.enqueue(
|
|
1894
2172
|
usesJsonResponseTool ? { type: "text-start", id: String(value.index) } : {
|
|
@@ -1900,18 +2178,29 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1900
2178
|
return;
|
|
1901
2179
|
}
|
|
1902
2180
|
case "server_tool_use": {
|
|
1903
|
-
if (
|
|
2181
|
+
if ([
|
|
2182
|
+
"web_fetch",
|
|
2183
|
+
"web_search",
|
|
2184
|
+
// code execution 20250825:
|
|
2185
|
+
"code_execution",
|
|
2186
|
+
// code execution 20250825 text editor:
|
|
2187
|
+
"text_editor_code_execution",
|
|
2188
|
+
// code execution 20250825 bash:
|
|
2189
|
+
"bash_code_execution"
|
|
2190
|
+
].includes(value.content_block.name)) {
|
|
1904
2191
|
contentBlocks[value.index] = {
|
|
1905
2192
|
type: "tool-call",
|
|
1906
2193
|
toolCallId: value.content_block.id,
|
|
1907
2194
|
toolName: value.content_block.name,
|
|
1908
2195
|
input: "",
|
|
1909
|
-
providerExecuted: true
|
|
2196
|
+
providerExecuted: true,
|
|
2197
|
+
firstDelta: true
|
|
1910
2198
|
};
|
|
2199
|
+
const mappedToolName = value.content_block.name === "text_editor_code_execution" || value.content_block.name === "bash_code_execution" ? "code_execution" : value.content_block.name;
|
|
1911
2200
|
controller.enqueue({
|
|
1912
2201
|
type: "tool-input-start",
|
|
1913
2202
|
id: value.content_block.id,
|
|
1914
|
-
toolName:
|
|
2203
|
+
toolName: mappedToolName,
|
|
1915
2204
|
providerExecuted: true
|
|
1916
2205
|
});
|
|
1917
2206
|
}
|
|
@@ -2003,6 +2292,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2003
2292
|
}
|
|
2004
2293
|
return;
|
|
2005
2294
|
}
|
|
2295
|
+
// code execution 20250522:
|
|
2006
2296
|
case "code_execution_tool_result": {
|
|
2007
2297
|
const part = value.content_block;
|
|
2008
2298
|
if (part.content.type === "code_execution_result") {
|
|
@@ -2033,6 +2323,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2033
2323
|
}
|
|
2034
2324
|
return;
|
|
2035
2325
|
}
|
|
2326
|
+
// code execution 20250825:
|
|
2327
|
+
case "bash_code_execution_tool_result":
|
|
2328
|
+
case "text_editor_code_execution_tool_result": {
|
|
2329
|
+
const part = value.content_block;
|
|
2330
|
+
controller.enqueue({
|
|
2331
|
+
type: "tool-result",
|
|
2332
|
+
toolCallId: part.tool_use_id,
|
|
2333
|
+
toolName: "code_execution",
|
|
2334
|
+
result: part.content,
|
|
2335
|
+
providerExecuted: true
|
|
2336
|
+
});
|
|
2337
|
+
return;
|
|
2338
|
+
}
|
|
2036
2339
|
default: {
|
|
2037
2340
|
const _exhaustiveCheck = contentBlockType;
|
|
2038
2341
|
throw new Error(
|
|
@@ -2065,7 +2368,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2065
2368
|
type: "tool-input-end",
|
|
2066
2369
|
id: contentBlock.toolCallId
|
|
2067
2370
|
});
|
|
2068
|
-
|
|
2371
|
+
const toolName = contentBlock.toolName === "text_editor_code_execution" || contentBlock.toolName === "bash_code_execution" ? "code_execution" : contentBlock.toolName;
|
|
2372
|
+
controller.enqueue({
|
|
2373
|
+
type: "tool-call",
|
|
2374
|
+
toolCallId: contentBlock.toolCallId,
|
|
2375
|
+
toolName,
|
|
2376
|
+
input: contentBlock.input,
|
|
2377
|
+
providerExecuted: contentBlock.providerExecuted
|
|
2378
|
+
});
|
|
2069
2379
|
}
|
|
2070
2380
|
break;
|
|
2071
2381
|
}
|
|
@@ -2113,7 +2423,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2113
2423
|
}
|
|
2114
2424
|
case "input_json_delta": {
|
|
2115
2425
|
const contentBlock = contentBlocks[value.index];
|
|
2116
|
-
|
|
2426
|
+
let delta = value.delta.partial_json;
|
|
2427
|
+
if (delta.length === 0) {
|
|
2428
|
+
return;
|
|
2429
|
+
}
|
|
2117
2430
|
if (usesJsonResponseTool) {
|
|
2118
2431
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "text") {
|
|
2119
2432
|
return;
|
|
@@ -2127,12 +2440,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2127
2440
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
2128
2441
|
return;
|
|
2129
2442
|
}
|
|
2443
|
+
if (contentBlock.firstDelta && (contentBlock.toolName === "bash_code_execution" || contentBlock.toolName === "text_editor_code_execution")) {
|
|
2444
|
+
delta = `{"type": "${contentBlock.toolName}",${delta.substring(1)}`;
|
|
2445
|
+
}
|
|
2130
2446
|
controller.enqueue({
|
|
2131
2447
|
type: "tool-input-delta",
|
|
2132
2448
|
id: contentBlock.toolCallId,
|
|
2133
2449
|
delta
|
|
2134
2450
|
});
|
|
2135
2451
|
contentBlock.input += delta;
|
|
2452
|
+
contentBlock.firstDelta = false;
|
|
2136
2453
|
}
|
|
2137
2454
|
return;
|
|
2138
2455
|
}
|
|
@@ -2218,46 +2535,46 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2218
2535
|
};
|
|
2219
2536
|
|
|
2220
2537
|
// src/tool/bash_20241022.ts
|
|
2221
|
-
var
|
|
2222
|
-
var
|
|
2223
|
-
var bash_20241022InputSchema = (0,
|
|
2224
|
-
() => (0,
|
|
2225
|
-
|
|
2226
|
-
command:
|
|
2227
|
-
restart:
|
|
2538
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2539
|
+
var import_v49 = require("zod/v4");
|
|
2540
|
+
var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2541
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2542
|
+
import_v49.z.object({
|
|
2543
|
+
command: import_v49.z.string(),
|
|
2544
|
+
restart: import_v49.z.boolean().optional()
|
|
2228
2545
|
})
|
|
2229
2546
|
)
|
|
2230
2547
|
);
|
|
2231
|
-
var bash_20241022 = (0,
|
|
2548
|
+
var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
|
|
2232
2549
|
id: "anthropic.bash_20241022",
|
|
2233
2550
|
name: "bash",
|
|
2234
2551
|
inputSchema: bash_20241022InputSchema
|
|
2235
2552
|
});
|
|
2236
2553
|
|
|
2237
2554
|
// src/tool/bash_20250124.ts
|
|
2238
|
-
var
|
|
2239
|
-
var
|
|
2240
|
-
var bash_20250124InputSchema = (0,
|
|
2241
|
-
() => (0,
|
|
2242
|
-
|
|
2243
|
-
command:
|
|
2244
|
-
restart:
|
|
2555
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2556
|
+
var import_v410 = require("zod/v4");
|
|
2557
|
+
var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2558
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2559
|
+
import_v410.z.object({
|
|
2560
|
+
command: import_v410.z.string(),
|
|
2561
|
+
restart: import_v410.z.boolean().optional()
|
|
2245
2562
|
})
|
|
2246
2563
|
)
|
|
2247
2564
|
);
|
|
2248
|
-
var bash_20250124 = (0,
|
|
2565
|
+
var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2249
2566
|
id: "anthropic.bash_20250124",
|
|
2250
2567
|
name: "bash",
|
|
2251
2568
|
inputSchema: bash_20250124InputSchema
|
|
2252
2569
|
});
|
|
2253
2570
|
|
|
2254
2571
|
// src/tool/computer_20241022.ts
|
|
2255
|
-
var
|
|
2256
|
-
var
|
|
2257
|
-
var computer_20241022InputSchema = (0,
|
|
2258
|
-
() => (0,
|
|
2259
|
-
|
|
2260
|
-
action:
|
|
2572
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2573
|
+
var import_v411 = require("zod/v4");
|
|
2574
|
+
var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2575
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2576
|
+
import_v411.z.object({
|
|
2577
|
+
action: import_v411.z.enum([
|
|
2261
2578
|
"key",
|
|
2262
2579
|
"type",
|
|
2263
2580
|
"mouse_move",
|
|
@@ -2269,24 +2586,24 @@ var computer_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
|
2269
2586
|
"screenshot",
|
|
2270
2587
|
"cursor_position"
|
|
2271
2588
|
]),
|
|
2272
|
-
coordinate:
|
|
2273
|
-
text:
|
|
2589
|
+
coordinate: import_v411.z.array(import_v411.z.number().int()).optional(),
|
|
2590
|
+
text: import_v411.z.string().optional()
|
|
2274
2591
|
})
|
|
2275
2592
|
)
|
|
2276
2593
|
);
|
|
2277
|
-
var computer_20241022 = (0,
|
|
2594
|
+
var computer_20241022 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2278
2595
|
id: "anthropic.computer_20241022",
|
|
2279
2596
|
name: "computer",
|
|
2280
2597
|
inputSchema: computer_20241022InputSchema
|
|
2281
2598
|
});
|
|
2282
2599
|
|
|
2283
2600
|
// src/tool/computer_20250124.ts
|
|
2284
|
-
var
|
|
2285
|
-
var
|
|
2286
|
-
var computer_20250124InputSchema = (0,
|
|
2287
|
-
() => (0,
|
|
2288
|
-
|
|
2289
|
-
action:
|
|
2601
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2602
|
+
var import_v412 = require("zod/v4");
|
|
2603
|
+
var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2604
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2605
|
+
import_v412.z.object({
|
|
2606
|
+
action: import_v412.z.enum([
|
|
2290
2607
|
"key",
|
|
2291
2608
|
"hold_key",
|
|
2292
2609
|
"type",
|
|
@@ -2304,82 +2621,128 @@ var computer_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
2304
2621
|
"wait",
|
|
2305
2622
|
"screenshot"
|
|
2306
2623
|
]),
|
|
2307
|
-
coordinate:
|
|
2308
|
-
duration:
|
|
2309
|
-
scroll_amount:
|
|
2310
|
-
scroll_direction:
|
|
2311
|
-
start_coordinate:
|
|
2312
|
-
text:
|
|
2624
|
+
coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
|
|
2625
|
+
duration: import_v412.z.number().optional(),
|
|
2626
|
+
scroll_amount: import_v412.z.number().optional(),
|
|
2627
|
+
scroll_direction: import_v412.z.enum(["up", "down", "left", "right"]).optional(),
|
|
2628
|
+
start_coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
|
|
2629
|
+
text: import_v412.z.string().optional()
|
|
2313
2630
|
})
|
|
2314
2631
|
)
|
|
2315
2632
|
);
|
|
2316
|
-
var computer_20250124 = (0,
|
|
2633
|
+
var computer_20250124 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
2317
2634
|
id: "anthropic.computer_20250124",
|
|
2318
2635
|
name: "computer",
|
|
2319
2636
|
inputSchema: computer_20250124InputSchema
|
|
2320
2637
|
});
|
|
2321
2638
|
|
|
2639
|
+
// src/tool/memory_20250818.ts
|
|
2640
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2641
|
+
var import_v413 = require("zod/v4");
|
|
2642
|
+
var memory_20250818InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
2643
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
2644
|
+
import_v413.z.discriminatedUnion("command", [
|
|
2645
|
+
import_v413.z.object({
|
|
2646
|
+
command: import_v413.z.literal("view"),
|
|
2647
|
+
path: import_v413.z.string(),
|
|
2648
|
+
view_range: import_v413.z.tuple([import_v413.z.number(), import_v413.z.number()]).optional()
|
|
2649
|
+
}),
|
|
2650
|
+
import_v413.z.object({
|
|
2651
|
+
command: import_v413.z.literal("create"),
|
|
2652
|
+
path: import_v413.z.string(),
|
|
2653
|
+
file_text: import_v413.z.string()
|
|
2654
|
+
}),
|
|
2655
|
+
import_v413.z.object({
|
|
2656
|
+
command: import_v413.z.literal("str_replace"),
|
|
2657
|
+
path: import_v413.z.string(),
|
|
2658
|
+
old_str: import_v413.z.string(),
|
|
2659
|
+
new_str: import_v413.z.string()
|
|
2660
|
+
}),
|
|
2661
|
+
import_v413.z.object({
|
|
2662
|
+
command: import_v413.z.literal("insert"),
|
|
2663
|
+
path: import_v413.z.string(),
|
|
2664
|
+
insert_line: import_v413.z.number(),
|
|
2665
|
+
insert_text: import_v413.z.string()
|
|
2666
|
+
}),
|
|
2667
|
+
import_v413.z.object({
|
|
2668
|
+
command: import_v413.z.literal("delete"),
|
|
2669
|
+
path: import_v413.z.string()
|
|
2670
|
+
}),
|
|
2671
|
+
import_v413.z.object({
|
|
2672
|
+
command: import_v413.z.literal("rename"),
|
|
2673
|
+
old_path: import_v413.z.string(),
|
|
2674
|
+
new_path: import_v413.z.string()
|
|
2675
|
+
})
|
|
2676
|
+
])
|
|
2677
|
+
)
|
|
2678
|
+
);
|
|
2679
|
+
var memory_20250818 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
|
|
2680
|
+
id: "anthropic.memory_20250818",
|
|
2681
|
+
name: "memory",
|
|
2682
|
+
inputSchema: memory_20250818InputSchema
|
|
2683
|
+
});
|
|
2684
|
+
|
|
2322
2685
|
// src/tool/text-editor_20241022.ts
|
|
2323
|
-
var
|
|
2324
|
-
var
|
|
2325
|
-
var textEditor_20241022InputSchema = (0,
|
|
2326
|
-
() => (0,
|
|
2327
|
-
|
|
2328
|
-
command:
|
|
2329
|
-
path:
|
|
2330
|
-
file_text:
|
|
2331
|
-
insert_line:
|
|
2332
|
-
new_str:
|
|
2333
|
-
old_str:
|
|
2334
|
-
view_range:
|
|
2686
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
2687
|
+
var import_v414 = require("zod/v4");
|
|
2688
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
2689
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
2690
|
+
import_v414.z.object({
|
|
2691
|
+
command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2692
|
+
path: import_v414.z.string(),
|
|
2693
|
+
file_text: import_v414.z.string().optional(),
|
|
2694
|
+
insert_line: import_v414.z.number().int().optional(),
|
|
2695
|
+
new_str: import_v414.z.string().optional(),
|
|
2696
|
+
old_str: import_v414.z.string().optional(),
|
|
2697
|
+
view_range: import_v414.z.array(import_v414.z.number().int()).optional()
|
|
2335
2698
|
})
|
|
2336
2699
|
)
|
|
2337
2700
|
);
|
|
2338
|
-
var textEditor_20241022 = (0,
|
|
2701
|
+
var textEditor_20241022 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
|
|
2339
2702
|
id: "anthropic.text_editor_20241022",
|
|
2340
2703
|
name: "str_replace_editor",
|
|
2341
2704
|
inputSchema: textEditor_20241022InputSchema
|
|
2342
2705
|
});
|
|
2343
2706
|
|
|
2344
2707
|
// src/tool/text-editor_20250124.ts
|
|
2345
|
-
var
|
|
2346
|
-
var
|
|
2347
|
-
var textEditor_20250124InputSchema = (0,
|
|
2348
|
-
() => (0,
|
|
2349
|
-
|
|
2350
|
-
command:
|
|
2351
|
-
path:
|
|
2352
|
-
file_text:
|
|
2353
|
-
insert_line:
|
|
2354
|
-
new_str:
|
|
2355
|
-
old_str:
|
|
2356
|
-
view_range:
|
|
2708
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
2709
|
+
var import_v415 = require("zod/v4");
|
|
2710
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2711
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2712
|
+
import_v415.z.object({
|
|
2713
|
+
command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2714
|
+
path: import_v415.z.string(),
|
|
2715
|
+
file_text: import_v415.z.string().optional(),
|
|
2716
|
+
insert_line: import_v415.z.number().int().optional(),
|
|
2717
|
+
new_str: import_v415.z.string().optional(),
|
|
2718
|
+
old_str: import_v415.z.string().optional(),
|
|
2719
|
+
view_range: import_v415.z.array(import_v415.z.number().int()).optional()
|
|
2357
2720
|
})
|
|
2358
2721
|
)
|
|
2359
2722
|
);
|
|
2360
|
-
var textEditor_20250124 = (0,
|
|
2723
|
+
var textEditor_20250124 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
|
|
2361
2724
|
id: "anthropic.text_editor_20250124",
|
|
2362
2725
|
name: "str_replace_editor",
|
|
2363
2726
|
inputSchema: textEditor_20250124InputSchema
|
|
2364
2727
|
});
|
|
2365
2728
|
|
|
2366
2729
|
// src/tool/text-editor_20250429.ts
|
|
2367
|
-
var
|
|
2368
|
-
var
|
|
2369
|
-
var textEditor_20250429InputSchema = (0,
|
|
2370
|
-
() => (0,
|
|
2371
|
-
|
|
2372
|
-
command:
|
|
2373
|
-
path:
|
|
2374
|
-
file_text:
|
|
2375
|
-
insert_line:
|
|
2376
|
-
new_str:
|
|
2377
|
-
old_str:
|
|
2378
|
-
view_range:
|
|
2730
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
2731
|
+
var import_v416 = require("zod/v4");
|
|
2732
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2733
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
2734
|
+
import_v416.z.object({
|
|
2735
|
+
command: import_v416.z.enum(["view", "create", "str_replace", "insert"]),
|
|
2736
|
+
path: import_v416.z.string(),
|
|
2737
|
+
file_text: import_v416.z.string().optional(),
|
|
2738
|
+
insert_line: import_v416.z.number().int().optional(),
|
|
2739
|
+
new_str: import_v416.z.string().optional(),
|
|
2740
|
+
old_str: import_v416.z.string().optional(),
|
|
2741
|
+
view_range: import_v416.z.array(import_v416.z.number().int()).optional()
|
|
2379
2742
|
})
|
|
2380
2743
|
)
|
|
2381
2744
|
);
|
|
2382
|
-
var textEditor_20250429 = (0,
|
|
2745
|
+
var textEditor_20250429 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
|
|
2383
2746
|
id: "anthropic.text_editor_20250429",
|
|
2384
2747
|
name: "str_replace_based_edit_tool",
|
|
2385
2748
|
inputSchema: textEditor_20250429InputSchema
|
|
@@ -2416,6 +2779,19 @@ var anthropicTools = {
|
|
|
2416
2779
|
* Tool name must be `code_execution`.
|
|
2417
2780
|
*/
|
|
2418
2781
|
codeExecution_20250522,
|
|
2782
|
+
/**
|
|
2783
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
2784
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
2785
|
+
* the API conversation.
|
|
2786
|
+
*
|
|
2787
|
+
* The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
|
|
2788
|
+
* including writing code, in a secure, sandboxed environment.
|
|
2789
|
+
*
|
|
2790
|
+
* This is the latest version with enhanced Bash support and file operations.
|
|
2791
|
+
*
|
|
2792
|
+
* Tool name must be `code_execution`.
|
|
2793
|
+
*/
|
|
2794
|
+
codeExecution_20250825,
|
|
2419
2795
|
/**
|
|
2420
2796
|
* Claude can interact with computer environments through the computer use tool, which
|
|
2421
2797
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -2442,6 +2818,17 @@ var anthropicTools = {
|
|
|
2442
2818
|
* @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
|
|
2443
2819
|
*/
|
|
2444
2820
|
computer_20250124,
|
|
2821
|
+
/**
|
|
2822
|
+
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
2823
|
+
* Claude can create, read, update, and delete files that persist between sessions,
|
|
2824
|
+
* allowing it to build knowledge over time without keeping everything in the context window.
|
|
2825
|
+
* The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
|
|
2826
|
+
*
|
|
2827
|
+
* Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
|
|
2828
|
+
*
|
|
2829
|
+
* Tool name must be `memory`.
|
|
2830
|
+
*/
|
|
2831
|
+
memory_20250818,
|
|
2445
2832
|
/**
|
|
2446
2833
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
2447
2834
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
@@ -2516,11 +2903,11 @@ var anthropicTools = {
|
|
|
2516
2903
|
// src/anthropic-provider.ts
|
|
2517
2904
|
function createAnthropic(options = {}) {
|
|
2518
2905
|
var _a;
|
|
2519
|
-
const baseURL = (_a = (0,
|
|
2520
|
-
const getHeaders = () => (0,
|
|
2906
|
+
const baseURL = (_a = (0, import_provider_utils20.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.anthropic.com/v1";
|
|
2907
|
+
const getHeaders = () => (0, import_provider_utils20.withUserAgentSuffix)(
|
|
2521
2908
|
{
|
|
2522
2909
|
"anthropic-version": "2023-06-01",
|
|
2523
|
-
"x-api-key": (0,
|
|
2910
|
+
"x-api-key": (0, import_provider_utils20.loadApiKey)({
|
|
2524
2911
|
apiKey: options.apiKey,
|
|
2525
2912
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
2526
2913
|
description: "Anthropic"
|
|
@@ -2536,7 +2923,7 @@ function createAnthropic(options = {}) {
|
|
|
2536
2923
|
baseURL,
|
|
2537
2924
|
headers: getHeaders,
|
|
2538
2925
|
fetch: options.fetch,
|
|
2539
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
2926
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils20.generateId,
|
|
2540
2927
|
supportedUrls: () => ({
|
|
2541
2928
|
"image/*": [/^https?:\/\/.*$/]
|
|
2542
2929
|
})
|