@ai-sdk/anthropic 2.0.27 → 2.0.29
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/internal/index.js
CHANGED
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(internal_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/anthropic-messages-language-model.ts
|
|
30
30
|
var import_provider3 = require("@ai-sdk/provider");
|
|
31
|
-
var
|
|
31
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/anthropic-error.ts
|
|
34
34
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -156,6 +156,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
156
156
|
})
|
|
157
157
|
])
|
|
158
158
|
}),
|
|
159
|
+
// code execution results for code_execution_20250522 tool:
|
|
159
160
|
import_v42.z.object({
|
|
160
161
|
type: import_v42.z.literal("code_execution_tool_result"),
|
|
161
162
|
tool_use_id: import_v42.z.string(),
|
|
@@ -171,6 +172,62 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
171
172
|
error_code: import_v42.z.string()
|
|
172
173
|
})
|
|
173
174
|
])
|
|
175
|
+
}),
|
|
176
|
+
// bash code execution results for code_execution_20250825 tool:
|
|
177
|
+
import_v42.z.object({
|
|
178
|
+
type: import_v42.z.literal("bash_code_execution_tool_result"),
|
|
179
|
+
tool_use_id: import_v42.z.string(),
|
|
180
|
+
content: import_v42.z.discriminatedUnion("type", [
|
|
181
|
+
import_v42.z.object({
|
|
182
|
+
type: import_v42.z.literal("bash_code_execution_result"),
|
|
183
|
+
content: import_v42.z.array(
|
|
184
|
+
import_v42.z.object({
|
|
185
|
+
type: import_v42.z.literal("bash_code_execution_output"),
|
|
186
|
+
file_id: import_v42.z.string()
|
|
187
|
+
})
|
|
188
|
+
),
|
|
189
|
+
stdout: import_v42.z.string(),
|
|
190
|
+
stderr: import_v42.z.string(),
|
|
191
|
+
return_code: import_v42.z.number()
|
|
192
|
+
}),
|
|
193
|
+
import_v42.z.object({
|
|
194
|
+
type: import_v42.z.literal("bash_code_execution_tool_result_error"),
|
|
195
|
+
error_code: import_v42.z.string()
|
|
196
|
+
})
|
|
197
|
+
])
|
|
198
|
+
}),
|
|
199
|
+
// text editor code execution results for code_execution_20250825 tool:
|
|
200
|
+
import_v42.z.object({
|
|
201
|
+
type: import_v42.z.literal("text_editor_code_execution_tool_result"),
|
|
202
|
+
tool_use_id: import_v42.z.string(),
|
|
203
|
+
content: import_v42.z.discriminatedUnion("type", [
|
|
204
|
+
import_v42.z.object({
|
|
205
|
+
type: import_v42.z.literal("text_editor_code_execution_tool_result_error"),
|
|
206
|
+
error_code: import_v42.z.string()
|
|
207
|
+
}),
|
|
208
|
+
import_v42.z.object({
|
|
209
|
+
type: import_v42.z.literal("text_editor_code_execution_view_result"),
|
|
210
|
+
content: import_v42.z.string(),
|
|
211
|
+
file_type: import_v42.z.string(),
|
|
212
|
+
num_lines: import_v42.z.number().nullable(),
|
|
213
|
+
start_line: import_v42.z.number().nullable(),
|
|
214
|
+
total_lines: import_v42.z.number().nullable()
|
|
215
|
+
}),
|
|
216
|
+
import_v42.z.object({
|
|
217
|
+
type: import_v42.z.literal("text_editor_code_execution_create_result"),
|
|
218
|
+
is_file_update: import_v42.z.boolean()
|
|
219
|
+
}),
|
|
220
|
+
import_v42.z.object({
|
|
221
|
+
type: import_v42.z.literal(
|
|
222
|
+
"text_editor_code_execution_str_replace_result"
|
|
223
|
+
),
|
|
224
|
+
lines: import_v42.z.array(import_v42.z.string()).nullable(),
|
|
225
|
+
new_lines: import_v42.z.number().nullable(),
|
|
226
|
+
new_start: import_v42.z.number().nullable(),
|
|
227
|
+
old_lines: import_v42.z.number().nullable(),
|
|
228
|
+
old_start: import_v42.z.number().nullable()
|
|
229
|
+
})
|
|
230
|
+
])
|
|
174
231
|
})
|
|
175
232
|
])
|
|
176
233
|
),
|
|
@@ -271,6 +328,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
271
328
|
})
|
|
272
329
|
])
|
|
273
330
|
}),
|
|
331
|
+
// code execution results for code_execution_20250522 tool:
|
|
274
332
|
import_v42.z.object({
|
|
275
333
|
type: import_v42.z.literal("code_execution_tool_result"),
|
|
276
334
|
tool_use_id: import_v42.z.string(),
|
|
@@ -286,6 +344,62 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
286
344
|
error_code: import_v42.z.string()
|
|
287
345
|
})
|
|
288
346
|
])
|
|
347
|
+
}),
|
|
348
|
+
// bash code execution results for code_execution_20250825 tool:
|
|
349
|
+
import_v42.z.object({
|
|
350
|
+
type: import_v42.z.literal("bash_code_execution_tool_result"),
|
|
351
|
+
tool_use_id: import_v42.z.string(),
|
|
352
|
+
content: import_v42.z.discriminatedUnion("type", [
|
|
353
|
+
import_v42.z.object({
|
|
354
|
+
type: import_v42.z.literal("bash_code_execution_result"),
|
|
355
|
+
content: import_v42.z.array(
|
|
356
|
+
import_v42.z.object({
|
|
357
|
+
type: import_v42.z.literal("bash_code_execution_output"),
|
|
358
|
+
file_id: import_v42.z.string()
|
|
359
|
+
})
|
|
360
|
+
),
|
|
361
|
+
stdout: import_v42.z.string(),
|
|
362
|
+
stderr: import_v42.z.string(),
|
|
363
|
+
return_code: import_v42.z.number()
|
|
364
|
+
}),
|
|
365
|
+
import_v42.z.object({
|
|
366
|
+
type: import_v42.z.literal("bash_code_execution_tool_result_error"),
|
|
367
|
+
error_code: import_v42.z.string()
|
|
368
|
+
})
|
|
369
|
+
])
|
|
370
|
+
}),
|
|
371
|
+
// text editor code execution results for code_execution_20250825 tool:
|
|
372
|
+
import_v42.z.object({
|
|
373
|
+
type: import_v42.z.literal("text_editor_code_execution_tool_result"),
|
|
374
|
+
tool_use_id: import_v42.z.string(),
|
|
375
|
+
content: import_v42.z.discriminatedUnion("type", [
|
|
376
|
+
import_v42.z.object({
|
|
377
|
+
type: import_v42.z.literal("text_editor_code_execution_tool_result_error"),
|
|
378
|
+
error_code: import_v42.z.string()
|
|
379
|
+
}),
|
|
380
|
+
import_v42.z.object({
|
|
381
|
+
type: import_v42.z.literal("text_editor_code_execution_view_result"),
|
|
382
|
+
content: import_v42.z.string(),
|
|
383
|
+
file_type: import_v42.z.string(),
|
|
384
|
+
num_lines: import_v42.z.number().nullable(),
|
|
385
|
+
start_line: import_v42.z.number().nullable(),
|
|
386
|
+
total_lines: import_v42.z.number().nullable()
|
|
387
|
+
}),
|
|
388
|
+
import_v42.z.object({
|
|
389
|
+
type: import_v42.z.literal("text_editor_code_execution_create_result"),
|
|
390
|
+
is_file_update: import_v42.z.boolean()
|
|
391
|
+
}),
|
|
392
|
+
import_v42.z.object({
|
|
393
|
+
type: import_v42.z.literal(
|
|
394
|
+
"text_editor_code_execution_str_replace_result"
|
|
395
|
+
),
|
|
396
|
+
lines: import_v42.z.array(import_v42.z.string()).nullable(),
|
|
397
|
+
new_lines: import_v42.z.number().nullable(),
|
|
398
|
+
new_start: import_v42.z.number().nullable(),
|
|
399
|
+
old_lines: import_v42.z.number().nullable(),
|
|
400
|
+
old_start: import_v42.z.number().nullable()
|
|
401
|
+
})
|
|
402
|
+
])
|
|
289
403
|
})
|
|
290
404
|
])
|
|
291
405
|
}),
|
|
@@ -611,6 +725,14 @@ async function prepareTools({
|
|
|
611
725
|
});
|
|
612
726
|
break;
|
|
613
727
|
}
|
|
728
|
+
case "anthropic.code_execution_20250825": {
|
|
729
|
+
betas.add("code-execution-2025-08-25");
|
|
730
|
+
anthropicTools2.push({
|
|
731
|
+
type: "code_execution_20250825",
|
|
732
|
+
name: "code_execution"
|
|
733
|
+
});
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
614
736
|
case "anthropic.computer_20250124": {
|
|
615
737
|
betas.add("computer-use-2025-01-24");
|
|
616
738
|
anthropicTools2.push({
|
|
@@ -685,6 +807,14 @@ async function prepareTools({
|
|
|
685
807
|
});
|
|
686
808
|
break;
|
|
687
809
|
}
|
|
810
|
+
case "anthropic.memory_20250818": {
|
|
811
|
+
betas.add("context-management-2025-06-27");
|
|
812
|
+
anthropicTools2.push({
|
|
813
|
+
name: "memory",
|
|
814
|
+
type: "memory_20250818"
|
|
815
|
+
});
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
688
818
|
case "anthropic.web_fetch_20250910": {
|
|
689
819
|
betas.add("web-fetch-2025-09-10");
|
|
690
820
|
const args = await (0, import_provider_utils7.validateTypes)({
|
|
@@ -784,7 +914,7 @@ async function prepareTools({
|
|
|
784
914
|
|
|
785
915
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
786
916
|
var import_provider2 = require("@ai-sdk/provider");
|
|
787
|
-
var
|
|
917
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
788
918
|
|
|
789
919
|
// src/tool/code-execution_20250522.ts
|
|
790
920
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
@@ -816,6 +946,95 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
816
946
|
return factory4(args);
|
|
817
947
|
};
|
|
818
948
|
|
|
949
|
+
// src/tool/code-execution_20250825.ts
|
|
950
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
951
|
+
var import_v48 = require("zod/v4");
|
|
952
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
953
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
954
|
+
import_v48.z.discriminatedUnion("type", [
|
|
955
|
+
import_v48.z.object({
|
|
956
|
+
type: import_v48.z.literal("bash_code_execution_result"),
|
|
957
|
+
content: import_v48.z.array(
|
|
958
|
+
import_v48.z.object({
|
|
959
|
+
type: import_v48.z.literal("bash_code_execution_output"),
|
|
960
|
+
file_id: import_v48.z.string()
|
|
961
|
+
})
|
|
962
|
+
),
|
|
963
|
+
stdout: import_v48.z.string(),
|
|
964
|
+
stderr: import_v48.z.string(),
|
|
965
|
+
return_code: import_v48.z.number()
|
|
966
|
+
}),
|
|
967
|
+
import_v48.z.object({
|
|
968
|
+
type: import_v48.z.literal("bash_code_execution_tool_result_error"),
|
|
969
|
+
error_code: import_v48.z.string()
|
|
970
|
+
}),
|
|
971
|
+
import_v48.z.object({
|
|
972
|
+
type: import_v48.z.literal("text_editor_code_execution_tool_result_error"),
|
|
973
|
+
error_code: import_v48.z.string()
|
|
974
|
+
}),
|
|
975
|
+
import_v48.z.object({
|
|
976
|
+
type: import_v48.z.literal("text_editor_code_execution_view_result"),
|
|
977
|
+
content: import_v48.z.string(),
|
|
978
|
+
file_type: import_v48.z.string(),
|
|
979
|
+
num_lines: import_v48.z.number().nullable(),
|
|
980
|
+
start_line: import_v48.z.number().nullable(),
|
|
981
|
+
total_lines: import_v48.z.number().nullable()
|
|
982
|
+
}),
|
|
983
|
+
import_v48.z.object({
|
|
984
|
+
type: import_v48.z.literal("text_editor_code_execution_create_result"),
|
|
985
|
+
is_file_update: import_v48.z.boolean()
|
|
986
|
+
}),
|
|
987
|
+
import_v48.z.object({
|
|
988
|
+
type: import_v48.z.literal("text_editor_code_execution_str_replace_result"),
|
|
989
|
+
lines: import_v48.z.array(import_v48.z.string()).nullable(),
|
|
990
|
+
new_lines: import_v48.z.number().nullable(),
|
|
991
|
+
new_start: import_v48.z.number().nullable(),
|
|
992
|
+
old_lines: import_v48.z.number().nullable(),
|
|
993
|
+
old_start: import_v48.z.number().nullable()
|
|
994
|
+
})
|
|
995
|
+
])
|
|
996
|
+
)
|
|
997
|
+
);
|
|
998
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
999
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1000
|
+
import_v48.z.discriminatedUnion("type", [
|
|
1001
|
+
import_v48.z.object({
|
|
1002
|
+
type: import_v48.z.literal("bash_code_execution"),
|
|
1003
|
+
command: import_v48.z.string()
|
|
1004
|
+
}),
|
|
1005
|
+
import_v48.z.discriminatedUnion("command", [
|
|
1006
|
+
import_v48.z.object({
|
|
1007
|
+
type: import_v48.z.literal("text_editor_code_execution"),
|
|
1008
|
+
command: import_v48.z.literal("view"),
|
|
1009
|
+
path: import_v48.z.string()
|
|
1010
|
+
}),
|
|
1011
|
+
import_v48.z.object({
|
|
1012
|
+
type: import_v48.z.literal("text_editor_code_execution"),
|
|
1013
|
+
command: import_v48.z.literal("create"),
|
|
1014
|
+
path: import_v48.z.string(),
|
|
1015
|
+
file_text: import_v48.z.string().nullish()
|
|
1016
|
+
}),
|
|
1017
|
+
import_v48.z.object({
|
|
1018
|
+
type: import_v48.z.literal("text_editor_code_execution"),
|
|
1019
|
+
command: import_v48.z.literal("str_replace"),
|
|
1020
|
+
path: import_v48.z.string(),
|
|
1021
|
+
old_str: import_v48.z.string(),
|
|
1022
|
+
new_str: import_v48.z.string()
|
|
1023
|
+
})
|
|
1024
|
+
])
|
|
1025
|
+
])
|
|
1026
|
+
)
|
|
1027
|
+
);
|
|
1028
|
+
var factory5 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1029
|
+
id: "anthropic.code_execution_20250825",
|
|
1030
|
+
name: "code_execution",
|
|
1031
|
+
inputSchema: codeExecution_20250825InputSchema,
|
|
1032
|
+
outputSchema: codeExecution_20250825OutputSchema
|
|
1033
|
+
});
|
|
1034
|
+
var codeExecution_20250825 = (args = {}) => {
|
|
1035
|
+
return factory5(args);
|
|
1036
|
+
};
|
|
1037
|
+
|
|
819
1038
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
820
1039
|
function convertToString(data) {
|
|
821
1040
|
if (typeof data === "string") {
|
|
@@ -845,7 +1064,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
845
1064
|
const messages = [];
|
|
846
1065
|
async function shouldEnableCitations(providerMetadata) {
|
|
847
1066
|
var _a2, _b2;
|
|
848
|
-
const anthropicOptions = await (0,
|
|
1067
|
+
const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
849
1068
|
provider: "anthropic",
|
|
850
1069
|
providerOptions: providerMetadata,
|
|
851
1070
|
schema: anthropicFilePartProviderOptions
|
|
@@ -853,7 +1072,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
853
1072
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
854
1073
|
}
|
|
855
1074
|
async function getDocumentMetadata(providerMetadata) {
|
|
856
|
-
const anthropicOptions = await (0,
|
|
1075
|
+
const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
857
1076
|
provider: "anthropic",
|
|
858
1077
|
providerOptions: providerMetadata,
|
|
859
1078
|
schema: anthropicFilePartProviderOptions
|
|
@@ -910,7 +1129,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
910
1129
|
} : {
|
|
911
1130
|
type: "base64",
|
|
912
1131
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
913
|
-
data: (0,
|
|
1132
|
+
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
914
1133
|
},
|
|
915
1134
|
cache_control: cacheControl
|
|
916
1135
|
});
|
|
@@ -930,7 +1149,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
930
1149
|
} : {
|
|
931
1150
|
type: "base64",
|
|
932
1151
|
media_type: "application/pdf",
|
|
933
|
-
data: (0,
|
|
1152
|
+
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
934
1153
|
},
|
|
935
1154
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
936
1155
|
...metadata.context && { context: metadata.context },
|
|
@@ -1077,7 +1296,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1077
1296
|
}
|
|
1078
1297
|
case "reasoning": {
|
|
1079
1298
|
if (sendReasoning) {
|
|
1080
|
-
const reasoningMetadata = await (0,
|
|
1299
|
+
const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1081
1300
|
provider: "anthropic",
|
|
1082
1301
|
providerOptions: part.providerOptions,
|
|
1083
1302
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -1118,7 +1337,17 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1118
1337
|
}
|
|
1119
1338
|
case "tool-call": {
|
|
1120
1339
|
if (part.providerExecuted) {
|
|
1121
|
-
if (part.toolName === "code_execution"
|
|
1340
|
+
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")) {
|
|
1341
|
+
anthropicContent.push({
|
|
1342
|
+
type: "server_tool_use",
|
|
1343
|
+
id: part.toolCallId,
|
|
1344
|
+
name: part.input.type,
|
|
1345
|
+
// map back to subtool name
|
|
1346
|
+
input: part.input,
|
|
1347
|
+
cache_control: cacheControl
|
|
1348
|
+
});
|
|
1349
|
+
} else if (part.toolName === "code_execution" || // code execution 20250522
|
|
1350
|
+
part.toolName === "web_fetch" || part.toolName === "web_search") {
|
|
1122
1351
|
anthropicContent.push({
|
|
1123
1352
|
type: "server_tool_use",
|
|
1124
1353
|
id: part.toolCallId,
|
|
@@ -1153,21 +1382,48 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1153
1382
|
});
|
|
1154
1383
|
break;
|
|
1155
1384
|
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1385
|
+
if (output.value == null || typeof output.value !== "object" || !("type" in output.value) || typeof output.value.type !== "string") {
|
|
1386
|
+
warnings.push({
|
|
1387
|
+
type: "other",
|
|
1388
|
+
message: `provider executed tool result output value is not a valid code execution result for tool ${part.toolName}`
|
|
1389
|
+
});
|
|
1390
|
+
break;
|
|
1391
|
+
}
|
|
1392
|
+
if (output.value.type === "code_execution_result") {
|
|
1393
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1394
|
+
value: output.value,
|
|
1395
|
+
schema: codeExecution_20250522OutputSchema
|
|
1396
|
+
});
|
|
1397
|
+
anthropicContent.push({
|
|
1398
|
+
type: "code_execution_tool_result",
|
|
1399
|
+
tool_use_id: part.toolCallId,
|
|
1400
|
+
content: {
|
|
1401
|
+
type: codeExecutionOutput.type,
|
|
1402
|
+
stdout: codeExecutionOutput.stdout,
|
|
1403
|
+
stderr: codeExecutionOutput.stderr,
|
|
1404
|
+
return_code: codeExecutionOutput.return_code
|
|
1405
|
+
},
|
|
1406
|
+
cache_control: cacheControl
|
|
1407
|
+
});
|
|
1408
|
+
} else {
|
|
1409
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1410
|
+
value: output.value,
|
|
1411
|
+
schema: codeExecution_20250825OutputSchema
|
|
1412
|
+
});
|
|
1413
|
+
anthropicContent.push(
|
|
1414
|
+
codeExecutionOutput.type === "bash_code_execution_result" || codeExecutionOutput.type === "bash_code_execution_tool_result_error" ? {
|
|
1415
|
+
type: "bash_code_execution_tool_result",
|
|
1416
|
+
tool_use_id: part.toolCallId,
|
|
1417
|
+
cache_control: cacheControl,
|
|
1418
|
+
content: codeExecutionOutput
|
|
1419
|
+
} : {
|
|
1420
|
+
type: "text_editor_code_execution_tool_result",
|
|
1421
|
+
tool_use_id: part.toolCallId,
|
|
1422
|
+
cache_control: cacheControl,
|
|
1423
|
+
content: codeExecutionOutput
|
|
1424
|
+
}
|
|
1425
|
+
);
|
|
1426
|
+
}
|
|
1171
1427
|
break;
|
|
1172
1428
|
}
|
|
1173
1429
|
if (part.toolName === "web_fetch") {
|
|
@@ -1179,7 +1435,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1179
1435
|
});
|
|
1180
1436
|
break;
|
|
1181
1437
|
}
|
|
1182
|
-
const webFetchOutput = await (0,
|
|
1438
|
+
const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1183
1439
|
value: output.value,
|
|
1184
1440
|
schema: webFetch_20250910OutputSchema
|
|
1185
1441
|
});
|
|
@@ -1214,7 +1470,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1214
1470
|
});
|
|
1215
1471
|
break;
|
|
1216
1472
|
}
|
|
1217
|
-
const webSearchOutput = await (0,
|
|
1473
|
+
const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1218
1474
|
value: output.value,
|
|
1219
1475
|
schema: webSearch_20250305OutputSchema
|
|
1220
1476
|
});
|
|
@@ -1359,7 +1615,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1359
1615
|
var _a;
|
|
1360
1616
|
this.modelId = modelId;
|
|
1361
1617
|
this.config = config;
|
|
1362
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
1618
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
|
|
1363
1619
|
}
|
|
1364
1620
|
supportsUrl(url) {
|
|
1365
1621
|
return url.protocol === "https:";
|
|
@@ -1428,7 +1684,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1428
1684
|
description: "Respond with a JSON object.",
|
|
1429
1685
|
inputSchema: responseFormat.schema
|
|
1430
1686
|
} : void 0;
|
|
1431
|
-
const anthropicOptions = await (0,
|
|
1687
|
+
const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
|
|
1432
1688
|
provider: "anthropic",
|
|
1433
1689
|
providerOptions,
|
|
1434
1690
|
schema: anthropicProviderOptions
|
|
@@ -1520,8 +1776,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1520
1776
|
betas,
|
|
1521
1777
|
headers
|
|
1522
1778
|
}) {
|
|
1523
|
-
return (0,
|
|
1524
|
-
await (0,
|
|
1779
|
+
return (0, import_provider_utils11.combineHeaders)(
|
|
1780
|
+
await (0, import_provider_utils11.resolve)(this.config.headers),
|
|
1525
1781
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {},
|
|
1526
1782
|
headers
|
|
1527
1783
|
);
|
|
@@ -1565,12 +1821,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1565
1821
|
responseHeaders,
|
|
1566
1822
|
value: response,
|
|
1567
1823
|
rawValue: rawResponse
|
|
1568
|
-
} = await (0,
|
|
1824
|
+
} = await (0, import_provider_utils11.postJsonToApi)({
|
|
1569
1825
|
url: this.buildRequestUrl(false),
|
|
1570
1826
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1571
1827
|
body: this.transformRequestBody(args),
|
|
1572
1828
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1573
|
-
successfulResponseHandler: (0,
|
|
1829
|
+
successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
|
|
1574
1830
|
anthropicMessagesResponseSchema
|
|
1575
1831
|
),
|
|
1576
1832
|
abortSignal: options.abortSignal,
|
|
@@ -1637,7 +1893,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1637
1893
|
break;
|
|
1638
1894
|
}
|
|
1639
1895
|
case "server_tool_use": {
|
|
1640
|
-
if (part.name === "
|
|
1896
|
+
if (part.name === "text_editor_code_execution" || part.name === "bash_code_execution") {
|
|
1897
|
+
content.push({
|
|
1898
|
+
type: "tool-call",
|
|
1899
|
+
toolCallId: part.id,
|
|
1900
|
+
toolName: "code_execution",
|
|
1901
|
+
input: JSON.stringify({ type: part.name, ...part.input }),
|
|
1902
|
+
providerExecuted: true
|
|
1903
|
+
});
|
|
1904
|
+
} else if (part.name === "web_search" || part.name === "code_execution" || part.name === "web_fetch") {
|
|
1641
1905
|
content.push({
|
|
1642
1906
|
type: "tool-call",
|
|
1643
1907
|
toolCallId: part.id,
|
|
@@ -1733,6 +1997,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1733
1997
|
}
|
|
1734
1998
|
break;
|
|
1735
1999
|
}
|
|
2000
|
+
// code execution 20250522:
|
|
1736
2001
|
case "code_execution_tool_result": {
|
|
1737
2002
|
if (part.content.type === "code_execution_result") {
|
|
1738
2003
|
content.push({
|
|
@@ -1762,6 +2027,18 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1762
2027
|
}
|
|
1763
2028
|
break;
|
|
1764
2029
|
}
|
|
2030
|
+
// code execution 20250825:
|
|
2031
|
+
case "bash_code_execution_tool_result":
|
|
2032
|
+
case "text_editor_code_execution_tool_result": {
|
|
2033
|
+
content.push({
|
|
2034
|
+
type: "tool-result",
|
|
2035
|
+
toolCallId: part.tool_use_id,
|
|
2036
|
+
toolName: "code_execution",
|
|
2037
|
+
result: part.content,
|
|
2038
|
+
providerExecuted: true
|
|
2039
|
+
});
|
|
2040
|
+
break;
|
|
2041
|
+
}
|
|
1765
2042
|
}
|
|
1766
2043
|
}
|
|
1767
2044
|
return {
|
|
@@ -1797,12 +2074,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1797
2074
|
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
|
|
1798
2075
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
1799
2076
|
const body = { ...args, stream: true };
|
|
1800
|
-
const { responseHeaders, value: response } = await (0,
|
|
2077
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
|
|
1801
2078
|
url: this.buildRequestUrl(true),
|
|
1802
2079
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1803
2080
|
body: this.transformRequestBody(body),
|
|
1804
2081
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1805
|
-
successfulResponseHandler: (0,
|
|
2082
|
+
successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
|
|
1806
2083
|
anthropicMessagesChunkSchema
|
|
1807
2084
|
),
|
|
1808
2085
|
abortSignal: options.abortSignal,
|
|
@@ -1878,7 +2155,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1878
2155
|
type: "tool-call",
|
|
1879
2156
|
toolCallId: value.content_block.id,
|
|
1880
2157
|
toolName: value.content_block.name,
|
|
1881
|
-
input: ""
|
|
2158
|
+
input: "",
|
|
2159
|
+
firstDelta: true
|
|
1882
2160
|
};
|
|
1883
2161
|
controller.enqueue(
|
|
1884
2162
|
usesJsonResponseTool ? { type: "text-start", id: String(value.index) } : {
|
|
@@ -1890,18 +2168,29 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1890
2168
|
return;
|
|
1891
2169
|
}
|
|
1892
2170
|
case "server_tool_use": {
|
|
1893
|
-
if (
|
|
2171
|
+
if ([
|
|
2172
|
+
"web_fetch",
|
|
2173
|
+
"web_search",
|
|
2174
|
+
// code execution 20250825:
|
|
2175
|
+
"code_execution",
|
|
2176
|
+
// code execution 20250825 text editor:
|
|
2177
|
+
"text_editor_code_execution",
|
|
2178
|
+
// code execution 20250825 bash:
|
|
2179
|
+
"bash_code_execution"
|
|
2180
|
+
].includes(value.content_block.name)) {
|
|
1894
2181
|
contentBlocks[value.index] = {
|
|
1895
2182
|
type: "tool-call",
|
|
1896
2183
|
toolCallId: value.content_block.id,
|
|
1897
2184
|
toolName: value.content_block.name,
|
|
1898
2185
|
input: "",
|
|
1899
|
-
providerExecuted: true
|
|
2186
|
+
providerExecuted: true,
|
|
2187
|
+
firstDelta: true
|
|
1900
2188
|
};
|
|
2189
|
+
const mappedToolName = value.content_block.name === "text_editor_code_execution" || value.content_block.name === "bash_code_execution" ? "code_execution" : value.content_block.name;
|
|
1901
2190
|
controller.enqueue({
|
|
1902
2191
|
type: "tool-input-start",
|
|
1903
2192
|
id: value.content_block.id,
|
|
1904
|
-
toolName:
|
|
2193
|
+
toolName: mappedToolName,
|
|
1905
2194
|
providerExecuted: true
|
|
1906
2195
|
});
|
|
1907
2196
|
}
|
|
@@ -1993,6 +2282,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1993
2282
|
}
|
|
1994
2283
|
return;
|
|
1995
2284
|
}
|
|
2285
|
+
// code execution 20250522:
|
|
1996
2286
|
case "code_execution_tool_result": {
|
|
1997
2287
|
const part = value.content_block;
|
|
1998
2288
|
if (part.content.type === "code_execution_result") {
|
|
@@ -2023,6 +2313,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2023
2313
|
}
|
|
2024
2314
|
return;
|
|
2025
2315
|
}
|
|
2316
|
+
// code execution 20250825:
|
|
2317
|
+
case "bash_code_execution_tool_result":
|
|
2318
|
+
case "text_editor_code_execution_tool_result": {
|
|
2319
|
+
const part = value.content_block;
|
|
2320
|
+
controller.enqueue({
|
|
2321
|
+
type: "tool-result",
|
|
2322
|
+
toolCallId: part.tool_use_id,
|
|
2323
|
+
toolName: "code_execution",
|
|
2324
|
+
result: part.content,
|
|
2325
|
+
providerExecuted: true
|
|
2326
|
+
});
|
|
2327
|
+
return;
|
|
2328
|
+
}
|
|
2026
2329
|
default: {
|
|
2027
2330
|
const _exhaustiveCheck = contentBlockType;
|
|
2028
2331
|
throw new Error(
|
|
@@ -2055,7 +2358,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2055
2358
|
type: "tool-input-end",
|
|
2056
2359
|
id: contentBlock.toolCallId
|
|
2057
2360
|
});
|
|
2058
|
-
|
|
2361
|
+
const toolName = contentBlock.toolName === "text_editor_code_execution" || contentBlock.toolName === "bash_code_execution" ? "code_execution" : contentBlock.toolName;
|
|
2362
|
+
controller.enqueue({
|
|
2363
|
+
type: "tool-call",
|
|
2364
|
+
toolCallId: contentBlock.toolCallId,
|
|
2365
|
+
toolName,
|
|
2366
|
+
input: contentBlock.input,
|
|
2367
|
+
providerExecuted: contentBlock.providerExecuted
|
|
2368
|
+
});
|
|
2059
2369
|
}
|
|
2060
2370
|
break;
|
|
2061
2371
|
}
|
|
@@ -2103,7 +2413,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2103
2413
|
}
|
|
2104
2414
|
case "input_json_delta": {
|
|
2105
2415
|
const contentBlock = contentBlocks[value.index];
|
|
2106
|
-
|
|
2416
|
+
let delta = value.delta.partial_json;
|
|
2417
|
+
if (delta.length === 0) {
|
|
2418
|
+
return;
|
|
2419
|
+
}
|
|
2107
2420
|
if (usesJsonResponseTool) {
|
|
2108
2421
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "text") {
|
|
2109
2422
|
return;
|
|
@@ -2117,12 +2430,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2117
2430
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
2118
2431
|
return;
|
|
2119
2432
|
}
|
|
2433
|
+
if (contentBlock.firstDelta && (contentBlock.toolName === "bash_code_execution" || contentBlock.toolName === "text_editor_code_execution")) {
|
|
2434
|
+
delta = `{"type": "${contentBlock.toolName}",${delta.substring(1)}`;
|
|
2435
|
+
}
|
|
2120
2436
|
controller.enqueue({
|
|
2121
2437
|
type: "tool-input-delta",
|
|
2122
2438
|
id: contentBlock.toolCallId,
|
|
2123
2439
|
delta
|
|
2124
2440
|
});
|
|
2125
2441
|
contentBlock.input += delta;
|
|
2442
|
+
contentBlock.firstDelta = false;
|
|
2126
2443
|
}
|
|
2127
2444
|
return;
|
|
2128
2445
|
}
|
|
@@ -2208,46 +2525,46 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2208
2525
|
};
|
|
2209
2526
|
|
|
2210
2527
|
// src/tool/bash_20241022.ts
|
|
2211
|
-
var
|
|
2212
|
-
var
|
|
2213
|
-
var bash_20241022InputSchema = (0,
|
|
2214
|
-
() => (0,
|
|
2215
|
-
|
|
2216
|
-
command:
|
|
2217
|
-
restart:
|
|
2528
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2529
|
+
var import_v49 = require("zod/v4");
|
|
2530
|
+
var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2531
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2532
|
+
import_v49.z.object({
|
|
2533
|
+
command: import_v49.z.string(),
|
|
2534
|
+
restart: import_v49.z.boolean().optional()
|
|
2218
2535
|
})
|
|
2219
2536
|
)
|
|
2220
2537
|
);
|
|
2221
|
-
var bash_20241022 = (0,
|
|
2538
|
+
var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
|
|
2222
2539
|
id: "anthropic.bash_20241022",
|
|
2223
2540
|
name: "bash",
|
|
2224
2541
|
inputSchema: bash_20241022InputSchema
|
|
2225
2542
|
});
|
|
2226
2543
|
|
|
2227
2544
|
// src/tool/bash_20250124.ts
|
|
2228
|
-
var
|
|
2229
|
-
var
|
|
2230
|
-
var bash_20250124InputSchema = (0,
|
|
2231
|
-
() => (0,
|
|
2232
|
-
|
|
2233
|
-
command:
|
|
2234
|
-
restart:
|
|
2545
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2546
|
+
var import_v410 = require("zod/v4");
|
|
2547
|
+
var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2548
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2549
|
+
import_v410.z.object({
|
|
2550
|
+
command: import_v410.z.string(),
|
|
2551
|
+
restart: import_v410.z.boolean().optional()
|
|
2235
2552
|
})
|
|
2236
2553
|
)
|
|
2237
2554
|
);
|
|
2238
|
-
var bash_20250124 = (0,
|
|
2555
|
+
var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2239
2556
|
id: "anthropic.bash_20250124",
|
|
2240
2557
|
name: "bash",
|
|
2241
2558
|
inputSchema: bash_20250124InputSchema
|
|
2242
2559
|
});
|
|
2243
2560
|
|
|
2244
2561
|
// src/tool/computer_20241022.ts
|
|
2245
|
-
var
|
|
2246
|
-
var
|
|
2247
|
-
var computer_20241022InputSchema = (0,
|
|
2248
|
-
() => (0,
|
|
2249
|
-
|
|
2250
|
-
action:
|
|
2562
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2563
|
+
var import_v411 = require("zod/v4");
|
|
2564
|
+
var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2565
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2566
|
+
import_v411.z.object({
|
|
2567
|
+
action: import_v411.z.enum([
|
|
2251
2568
|
"key",
|
|
2252
2569
|
"type",
|
|
2253
2570
|
"mouse_move",
|
|
@@ -2259,24 +2576,24 @@ var computer_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
|
2259
2576
|
"screenshot",
|
|
2260
2577
|
"cursor_position"
|
|
2261
2578
|
]),
|
|
2262
|
-
coordinate:
|
|
2263
|
-
text:
|
|
2579
|
+
coordinate: import_v411.z.array(import_v411.z.number().int()).optional(),
|
|
2580
|
+
text: import_v411.z.string().optional()
|
|
2264
2581
|
})
|
|
2265
2582
|
)
|
|
2266
2583
|
);
|
|
2267
|
-
var computer_20241022 = (0,
|
|
2584
|
+
var computer_20241022 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2268
2585
|
id: "anthropic.computer_20241022",
|
|
2269
2586
|
name: "computer",
|
|
2270
2587
|
inputSchema: computer_20241022InputSchema
|
|
2271
2588
|
});
|
|
2272
2589
|
|
|
2273
2590
|
// src/tool/computer_20250124.ts
|
|
2274
|
-
var
|
|
2275
|
-
var
|
|
2276
|
-
var computer_20250124InputSchema = (0,
|
|
2277
|
-
() => (0,
|
|
2278
|
-
|
|
2279
|
-
action:
|
|
2591
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2592
|
+
var import_v412 = require("zod/v4");
|
|
2593
|
+
var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2594
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2595
|
+
import_v412.z.object({
|
|
2596
|
+
action: import_v412.z.enum([
|
|
2280
2597
|
"key",
|
|
2281
2598
|
"hold_key",
|
|
2282
2599
|
"type",
|
|
@@ -2294,82 +2611,128 @@ var computer_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
2294
2611
|
"wait",
|
|
2295
2612
|
"screenshot"
|
|
2296
2613
|
]),
|
|
2297
|
-
coordinate:
|
|
2298
|
-
duration:
|
|
2299
|
-
scroll_amount:
|
|
2300
|
-
scroll_direction:
|
|
2301
|
-
start_coordinate:
|
|
2302
|
-
text:
|
|
2614
|
+
coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
|
|
2615
|
+
duration: import_v412.z.number().optional(),
|
|
2616
|
+
scroll_amount: import_v412.z.number().optional(),
|
|
2617
|
+
scroll_direction: import_v412.z.enum(["up", "down", "left", "right"]).optional(),
|
|
2618
|
+
start_coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
|
|
2619
|
+
text: import_v412.z.string().optional()
|
|
2303
2620
|
})
|
|
2304
2621
|
)
|
|
2305
2622
|
);
|
|
2306
|
-
var computer_20250124 = (0,
|
|
2623
|
+
var computer_20250124 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
2307
2624
|
id: "anthropic.computer_20250124",
|
|
2308
2625
|
name: "computer",
|
|
2309
2626
|
inputSchema: computer_20250124InputSchema
|
|
2310
2627
|
});
|
|
2311
2628
|
|
|
2629
|
+
// src/tool/memory_20250818.ts
|
|
2630
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2631
|
+
var import_v413 = require("zod/v4");
|
|
2632
|
+
var memory_20250818InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
2633
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
2634
|
+
import_v413.z.discriminatedUnion("command", [
|
|
2635
|
+
import_v413.z.object({
|
|
2636
|
+
command: import_v413.z.literal("view"),
|
|
2637
|
+
path: import_v413.z.string(),
|
|
2638
|
+
view_range: import_v413.z.tuple([import_v413.z.number(), import_v413.z.number()]).optional()
|
|
2639
|
+
}),
|
|
2640
|
+
import_v413.z.object({
|
|
2641
|
+
command: import_v413.z.literal("create"),
|
|
2642
|
+
path: import_v413.z.string(),
|
|
2643
|
+
file_text: import_v413.z.string()
|
|
2644
|
+
}),
|
|
2645
|
+
import_v413.z.object({
|
|
2646
|
+
command: import_v413.z.literal("str_replace"),
|
|
2647
|
+
path: import_v413.z.string(),
|
|
2648
|
+
old_str: import_v413.z.string(),
|
|
2649
|
+
new_str: import_v413.z.string()
|
|
2650
|
+
}),
|
|
2651
|
+
import_v413.z.object({
|
|
2652
|
+
command: import_v413.z.literal("insert"),
|
|
2653
|
+
path: import_v413.z.string(),
|
|
2654
|
+
insert_line: import_v413.z.number(),
|
|
2655
|
+
insert_text: import_v413.z.string()
|
|
2656
|
+
}),
|
|
2657
|
+
import_v413.z.object({
|
|
2658
|
+
command: import_v413.z.literal("delete"),
|
|
2659
|
+
path: import_v413.z.string()
|
|
2660
|
+
}),
|
|
2661
|
+
import_v413.z.object({
|
|
2662
|
+
command: import_v413.z.literal("rename"),
|
|
2663
|
+
old_path: import_v413.z.string(),
|
|
2664
|
+
new_path: import_v413.z.string()
|
|
2665
|
+
})
|
|
2666
|
+
])
|
|
2667
|
+
)
|
|
2668
|
+
);
|
|
2669
|
+
var memory_20250818 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
|
|
2670
|
+
id: "anthropic.memory_20250818",
|
|
2671
|
+
name: "memory",
|
|
2672
|
+
inputSchema: memory_20250818InputSchema
|
|
2673
|
+
});
|
|
2674
|
+
|
|
2312
2675
|
// src/tool/text-editor_20241022.ts
|
|
2313
|
-
var
|
|
2314
|
-
var
|
|
2315
|
-
var textEditor_20241022InputSchema = (0,
|
|
2316
|
-
() => (0,
|
|
2317
|
-
|
|
2318
|
-
command:
|
|
2319
|
-
path:
|
|
2320
|
-
file_text:
|
|
2321
|
-
insert_line:
|
|
2322
|
-
new_str:
|
|
2323
|
-
old_str:
|
|
2324
|
-
view_range:
|
|
2676
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
2677
|
+
var import_v414 = require("zod/v4");
|
|
2678
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
2679
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
2680
|
+
import_v414.z.object({
|
|
2681
|
+
command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2682
|
+
path: import_v414.z.string(),
|
|
2683
|
+
file_text: import_v414.z.string().optional(),
|
|
2684
|
+
insert_line: import_v414.z.number().int().optional(),
|
|
2685
|
+
new_str: import_v414.z.string().optional(),
|
|
2686
|
+
old_str: import_v414.z.string().optional(),
|
|
2687
|
+
view_range: import_v414.z.array(import_v414.z.number().int()).optional()
|
|
2325
2688
|
})
|
|
2326
2689
|
)
|
|
2327
2690
|
);
|
|
2328
|
-
var textEditor_20241022 = (0,
|
|
2691
|
+
var textEditor_20241022 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
|
|
2329
2692
|
id: "anthropic.text_editor_20241022",
|
|
2330
2693
|
name: "str_replace_editor",
|
|
2331
2694
|
inputSchema: textEditor_20241022InputSchema
|
|
2332
2695
|
});
|
|
2333
2696
|
|
|
2334
2697
|
// src/tool/text-editor_20250124.ts
|
|
2335
|
-
var
|
|
2336
|
-
var
|
|
2337
|
-
var textEditor_20250124InputSchema = (0,
|
|
2338
|
-
() => (0,
|
|
2339
|
-
|
|
2340
|
-
command:
|
|
2341
|
-
path:
|
|
2342
|
-
file_text:
|
|
2343
|
-
insert_line:
|
|
2344
|
-
new_str:
|
|
2345
|
-
old_str:
|
|
2346
|
-
view_range:
|
|
2698
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
2699
|
+
var import_v415 = require("zod/v4");
|
|
2700
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2701
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2702
|
+
import_v415.z.object({
|
|
2703
|
+
command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2704
|
+
path: import_v415.z.string(),
|
|
2705
|
+
file_text: import_v415.z.string().optional(),
|
|
2706
|
+
insert_line: import_v415.z.number().int().optional(),
|
|
2707
|
+
new_str: import_v415.z.string().optional(),
|
|
2708
|
+
old_str: import_v415.z.string().optional(),
|
|
2709
|
+
view_range: import_v415.z.array(import_v415.z.number().int()).optional()
|
|
2347
2710
|
})
|
|
2348
2711
|
)
|
|
2349
2712
|
);
|
|
2350
|
-
var textEditor_20250124 = (0,
|
|
2713
|
+
var textEditor_20250124 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
|
|
2351
2714
|
id: "anthropic.text_editor_20250124",
|
|
2352
2715
|
name: "str_replace_editor",
|
|
2353
2716
|
inputSchema: textEditor_20250124InputSchema
|
|
2354
2717
|
});
|
|
2355
2718
|
|
|
2356
2719
|
// src/tool/text-editor_20250429.ts
|
|
2357
|
-
var
|
|
2358
|
-
var
|
|
2359
|
-
var textEditor_20250429InputSchema = (0,
|
|
2360
|
-
() => (0,
|
|
2361
|
-
|
|
2362
|
-
command:
|
|
2363
|
-
path:
|
|
2364
|
-
file_text:
|
|
2365
|
-
insert_line:
|
|
2366
|
-
new_str:
|
|
2367
|
-
old_str:
|
|
2368
|
-
view_range:
|
|
2720
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
2721
|
+
var import_v416 = require("zod/v4");
|
|
2722
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2723
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
2724
|
+
import_v416.z.object({
|
|
2725
|
+
command: import_v416.z.enum(["view", "create", "str_replace", "insert"]),
|
|
2726
|
+
path: import_v416.z.string(),
|
|
2727
|
+
file_text: import_v416.z.string().optional(),
|
|
2728
|
+
insert_line: import_v416.z.number().int().optional(),
|
|
2729
|
+
new_str: import_v416.z.string().optional(),
|
|
2730
|
+
old_str: import_v416.z.string().optional(),
|
|
2731
|
+
view_range: import_v416.z.array(import_v416.z.number().int()).optional()
|
|
2369
2732
|
})
|
|
2370
2733
|
)
|
|
2371
2734
|
);
|
|
2372
|
-
var textEditor_20250429 = (0,
|
|
2735
|
+
var textEditor_20250429 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
|
|
2373
2736
|
id: "anthropic.text_editor_20250429",
|
|
2374
2737
|
name: "str_replace_based_edit_tool",
|
|
2375
2738
|
inputSchema: textEditor_20250429InputSchema
|
|
@@ -2406,6 +2769,19 @@ var anthropicTools = {
|
|
|
2406
2769
|
* Tool name must be `code_execution`.
|
|
2407
2770
|
*/
|
|
2408
2771
|
codeExecution_20250522,
|
|
2772
|
+
/**
|
|
2773
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
2774
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
2775
|
+
* the API conversation.
|
|
2776
|
+
*
|
|
2777
|
+
* The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
|
|
2778
|
+
* including writing code, in a secure, sandboxed environment.
|
|
2779
|
+
*
|
|
2780
|
+
* This is the latest version with enhanced Bash support and file operations.
|
|
2781
|
+
*
|
|
2782
|
+
* Tool name must be `code_execution`.
|
|
2783
|
+
*/
|
|
2784
|
+
codeExecution_20250825,
|
|
2409
2785
|
/**
|
|
2410
2786
|
* Claude can interact with computer environments through the computer use tool, which
|
|
2411
2787
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -2432,6 +2808,17 @@ var anthropicTools = {
|
|
|
2432
2808
|
* @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.
|
|
2433
2809
|
*/
|
|
2434
2810
|
computer_20250124,
|
|
2811
|
+
/**
|
|
2812
|
+
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
2813
|
+
* Claude can create, read, update, and delete files that persist between sessions,
|
|
2814
|
+
* allowing it to build knowledge over time without keeping everything in the context window.
|
|
2815
|
+
* The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
|
|
2816
|
+
*
|
|
2817
|
+
* Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
|
|
2818
|
+
*
|
|
2819
|
+
* Tool name must be `memory`.
|
|
2820
|
+
*/
|
|
2821
|
+
memory_20250818,
|
|
2435
2822
|
/**
|
|
2436
2823
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
2437
2824
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|