@ai-sdk/anthropic 2.0.27 → 2.0.28
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 +6 -0
- package/dist/index.d.mts +105 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.js +436 -114
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +422 -96
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +108 -0
- package/dist/internal/index.d.ts +108 -0
- package/dist/internal/index.js +430 -108
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +421 -95
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
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({
|
|
@@ -784,7 +906,7 @@ async function prepareTools({
|
|
|
784
906
|
|
|
785
907
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
786
908
|
var import_provider2 = require("@ai-sdk/provider");
|
|
787
|
-
var
|
|
909
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
788
910
|
|
|
789
911
|
// src/tool/code-execution_20250522.ts
|
|
790
912
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
@@ -816,6 +938,95 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
816
938
|
return factory4(args);
|
|
817
939
|
};
|
|
818
940
|
|
|
941
|
+
// src/tool/code-execution_20250825.ts
|
|
942
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
943
|
+
var import_v48 = require("zod/v4");
|
|
944
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
945
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
946
|
+
import_v48.z.discriminatedUnion("type", [
|
|
947
|
+
import_v48.z.object({
|
|
948
|
+
type: import_v48.z.literal("bash_code_execution_result"),
|
|
949
|
+
content: import_v48.z.array(
|
|
950
|
+
import_v48.z.object({
|
|
951
|
+
type: import_v48.z.literal("bash_code_execution_output"),
|
|
952
|
+
file_id: import_v48.z.string()
|
|
953
|
+
})
|
|
954
|
+
),
|
|
955
|
+
stdout: import_v48.z.string(),
|
|
956
|
+
stderr: import_v48.z.string(),
|
|
957
|
+
return_code: import_v48.z.number()
|
|
958
|
+
}),
|
|
959
|
+
import_v48.z.object({
|
|
960
|
+
type: import_v48.z.literal("bash_code_execution_tool_result_error"),
|
|
961
|
+
error_code: import_v48.z.string()
|
|
962
|
+
}),
|
|
963
|
+
import_v48.z.object({
|
|
964
|
+
type: import_v48.z.literal("text_editor_code_execution_tool_result_error"),
|
|
965
|
+
error_code: import_v48.z.string()
|
|
966
|
+
}),
|
|
967
|
+
import_v48.z.object({
|
|
968
|
+
type: import_v48.z.literal("text_editor_code_execution_view_result"),
|
|
969
|
+
content: import_v48.z.string(),
|
|
970
|
+
file_type: import_v48.z.string(),
|
|
971
|
+
num_lines: import_v48.z.number().nullable(),
|
|
972
|
+
start_line: import_v48.z.number().nullable(),
|
|
973
|
+
total_lines: import_v48.z.number().nullable()
|
|
974
|
+
}),
|
|
975
|
+
import_v48.z.object({
|
|
976
|
+
type: import_v48.z.literal("text_editor_code_execution_create_result"),
|
|
977
|
+
is_file_update: import_v48.z.boolean()
|
|
978
|
+
}),
|
|
979
|
+
import_v48.z.object({
|
|
980
|
+
type: import_v48.z.literal("text_editor_code_execution_str_replace_result"),
|
|
981
|
+
lines: import_v48.z.array(import_v48.z.string()).nullable(),
|
|
982
|
+
new_lines: import_v48.z.number().nullable(),
|
|
983
|
+
new_start: import_v48.z.number().nullable(),
|
|
984
|
+
old_lines: import_v48.z.number().nullable(),
|
|
985
|
+
old_start: import_v48.z.number().nullable()
|
|
986
|
+
})
|
|
987
|
+
])
|
|
988
|
+
)
|
|
989
|
+
);
|
|
990
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
991
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
992
|
+
import_v48.z.discriminatedUnion("type", [
|
|
993
|
+
import_v48.z.object({
|
|
994
|
+
type: import_v48.z.literal("bash_code_execution"),
|
|
995
|
+
command: import_v48.z.string()
|
|
996
|
+
}),
|
|
997
|
+
import_v48.z.discriminatedUnion("command", [
|
|
998
|
+
import_v48.z.object({
|
|
999
|
+
type: import_v48.z.literal("text_editor_code_execution"),
|
|
1000
|
+
command: import_v48.z.literal("view"),
|
|
1001
|
+
path: import_v48.z.string()
|
|
1002
|
+
}),
|
|
1003
|
+
import_v48.z.object({
|
|
1004
|
+
type: import_v48.z.literal("text_editor_code_execution"),
|
|
1005
|
+
command: import_v48.z.literal("create"),
|
|
1006
|
+
path: import_v48.z.string(),
|
|
1007
|
+
file_text: import_v48.z.string().nullish()
|
|
1008
|
+
}),
|
|
1009
|
+
import_v48.z.object({
|
|
1010
|
+
type: import_v48.z.literal("text_editor_code_execution"),
|
|
1011
|
+
command: import_v48.z.literal("str_replace"),
|
|
1012
|
+
path: import_v48.z.string(),
|
|
1013
|
+
old_str: import_v48.z.string(),
|
|
1014
|
+
new_str: import_v48.z.string()
|
|
1015
|
+
})
|
|
1016
|
+
])
|
|
1017
|
+
])
|
|
1018
|
+
)
|
|
1019
|
+
);
|
|
1020
|
+
var factory5 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1021
|
+
id: "anthropic.code_execution_20250825",
|
|
1022
|
+
name: "code_execution",
|
|
1023
|
+
inputSchema: codeExecution_20250825InputSchema,
|
|
1024
|
+
outputSchema: codeExecution_20250825OutputSchema
|
|
1025
|
+
});
|
|
1026
|
+
var codeExecution_20250825 = (args = {}) => {
|
|
1027
|
+
return factory5(args);
|
|
1028
|
+
};
|
|
1029
|
+
|
|
819
1030
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
820
1031
|
function convertToString(data) {
|
|
821
1032
|
if (typeof data === "string") {
|
|
@@ -845,7 +1056,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
845
1056
|
const messages = [];
|
|
846
1057
|
async function shouldEnableCitations(providerMetadata) {
|
|
847
1058
|
var _a2, _b2;
|
|
848
|
-
const anthropicOptions = await (0,
|
|
1059
|
+
const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
849
1060
|
provider: "anthropic",
|
|
850
1061
|
providerOptions: providerMetadata,
|
|
851
1062
|
schema: anthropicFilePartProviderOptions
|
|
@@ -853,7 +1064,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
853
1064
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
854
1065
|
}
|
|
855
1066
|
async function getDocumentMetadata(providerMetadata) {
|
|
856
|
-
const anthropicOptions = await (0,
|
|
1067
|
+
const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
857
1068
|
provider: "anthropic",
|
|
858
1069
|
providerOptions: providerMetadata,
|
|
859
1070
|
schema: anthropicFilePartProviderOptions
|
|
@@ -910,7 +1121,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
910
1121
|
} : {
|
|
911
1122
|
type: "base64",
|
|
912
1123
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
913
|
-
data: (0,
|
|
1124
|
+
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
914
1125
|
},
|
|
915
1126
|
cache_control: cacheControl
|
|
916
1127
|
});
|
|
@@ -930,7 +1141,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
930
1141
|
} : {
|
|
931
1142
|
type: "base64",
|
|
932
1143
|
media_type: "application/pdf",
|
|
933
|
-
data: (0,
|
|
1144
|
+
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
934
1145
|
},
|
|
935
1146
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
936
1147
|
...metadata.context && { context: metadata.context },
|
|
@@ -1077,7 +1288,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1077
1288
|
}
|
|
1078
1289
|
case "reasoning": {
|
|
1079
1290
|
if (sendReasoning) {
|
|
1080
|
-
const reasoningMetadata = await (0,
|
|
1291
|
+
const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1081
1292
|
provider: "anthropic",
|
|
1082
1293
|
providerOptions: part.providerOptions,
|
|
1083
1294
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -1118,7 +1329,17 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1118
1329
|
}
|
|
1119
1330
|
case "tool-call": {
|
|
1120
1331
|
if (part.providerExecuted) {
|
|
1121
|
-
if (part.toolName === "code_execution"
|
|
1332
|
+
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")) {
|
|
1333
|
+
anthropicContent.push({
|
|
1334
|
+
type: "server_tool_use",
|
|
1335
|
+
id: part.toolCallId,
|
|
1336
|
+
name: part.input.type,
|
|
1337
|
+
// map back to subtool name
|
|
1338
|
+
input: part.input,
|
|
1339
|
+
cache_control: cacheControl
|
|
1340
|
+
});
|
|
1341
|
+
} else if (part.toolName === "code_execution" || // code execution 20250522
|
|
1342
|
+
part.toolName === "web_fetch" || part.toolName === "web_search") {
|
|
1122
1343
|
anthropicContent.push({
|
|
1123
1344
|
type: "server_tool_use",
|
|
1124
1345
|
id: part.toolCallId,
|
|
@@ -1153,21 +1374,48 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1153
1374
|
});
|
|
1154
1375
|
break;
|
|
1155
1376
|
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1377
|
+
if (output.value == null || typeof output.value !== "object" || !("type" in output.value) || typeof output.value.type !== "string") {
|
|
1378
|
+
warnings.push({
|
|
1379
|
+
type: "other",
|
|
1380
|
+
message: `provider executed tool result output value is not a valid code execution result for tool ${part.toolName}`
|
|
1381
|
+
});
|
|
1382
|
+
break;
|
|
1383
|
+
}
|
|
1384
|
+
if (output.value.type === "code_execution_result") {
|
|
1385
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1386
|
+
value: output.value,
|
|
1387
|
+
schema: codeExecution_20250522OutputSchema
|
|
1388
|
+
});
|
|
1389
|
+
anthropicContent.push({
|
|
1390
|
+
type: "code_execution_tool_result",
|
|
1391
|
+
tool_use_id: part.toolCallId,
|
|
1392
|
+
content: {
|
|
1393
|
+
type: codeExecutionOutput.type,
|
|
1394
|
+
stdout: codeExecutionOutput.stdout,
|
|
1395
|
+
stderr: codeExecutionOutput.stderr,
|
|
1396
|
+
return_code: codeExecutionOutput.return_code
|
|
1397
|
+
},
|
|
1398
|
+
cache_control: cacheControl
|
|
1399
|
+
});
|
|
1400
|
+
} else {
|
|
1401
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1402
|
+
value: output.value,
|
|
1403
|
+
schema: codeExecution_20250825OutputSchema
|
|
1404
|
+
});
|
|
1405
|
+
anthropicContent.push(
|
|
1406
|
+
codeExecutionOutput.type === "bash_code_execution_result" || codeExecutionOutput.type === "bash_code_execution_tool_result_error" ? {
|
|
1407
|
+
type: "bash_code_execution_tool_result",
|
|
1408
|
+
tool_use_id: part.toolCallId,
|
|
1409
|
+
cache_control: cacheControl,
|
|
1410
|
+
content: codeExecutionOutput
|
|
1411
|
+
} : {
|
|
1412
|
+
type: "text_editor_code_execution_tool_result",
|
|
1413
|
+
tool_use_id: part.toolCallId,
|
|
1414
|
+
cache_control: cacheControl,
|
|
1415
|
+
content: codeExecutionOutput
|
|
1416
|
+
}
|
|
1417
|
+
);
|
|
1418
|
+
}
|
|
1171
1419
|
break;
|
|
1172
1420
|
}
|
|
1173
1421
|
if (part.toolName === "web_fetch") {
|
|
@@ -1179,7 +1427,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1179
1427
|
});
|
|
1180
1428
|
break;
|
|
1181
1429
|
}
|
|
1182
|
-
const webFetchOutput = await (0,
|
|
1430
|
+
const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1183
1431
|
value: output.value,
|
|
1184
1432
|
schema: webFetch_20250910OutputSchema
|
|
1185
1433
|
});
|
|
@@ -1214,7 +1462,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1214
1462
|
});
|
|
1215
1463
|
break;
|
|
1216
1464
|
}
|
|
1217
|
-
const webSearchOutput = await (0,
|
|
1465
|
+
const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1218
1466
|
value: output.value,
|
|
1219
1467
|
schema: webSearch_20250305OutputSchema
|
|
1220
1468
|
});
|
|
@@ -1359,7 +1607,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1359
1607
|
var _a;
|
|
1360
1608
|
this.modelId = modelId;
|
|
1361
1609
|
this.config = config;
|
|
1362
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
1610
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
|
|
1363
1611
|
}
|
|
1364
1612
|
supportsUrl(url) {
|
|
1365
1613
|
return url.protocol === "https:";
|
|
@@ -1428,7 +1676,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1428
1676
|
description: "Respond with a JSON object.",
|
|
1429
1677
|
inputSchema: responseFormat.schema
|
|
1430
1678
|
} : void 0;
|
|
1431
|
-
const anthropicOptions = await (0,
|
|
1679
|
+
const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
|
|
1432
1680
|
provider: "anthropic",
|
|
1433
1681
|
providerOptions,
|
|
1434
1682
|
schema: anthropicProviderOptions
|
|
@@ -1520,8 +1768,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1520
1768
|
betas,
|
|
1521
1769
|
headers
|
|
1522
1770
|
}) {
|
|
1523
|
-
return (0,
|
|
1524
|
-
await (0,
|
|
1771
|
+
return (0, import_provider_utils11.combineHeaders)(
|
|
1772
|
+
await (0, import_provider_utils11.resolve)(this.config.headers),
|
|
1525
1773
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {},
|
|
1526
1774
|
headers
|
|
1527
1775
|
);
|
|
@@ -1565,12 +1813,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1565
1813
|
responseHeaders,
|
|
1566
1814
|
value: response,
|
|
1567
1815
|
rawValue: rawResponse
|
|
1568
|
-
} = await (0,
|
|
1816
|
+
} = await (0, import_provider_utils11.postJsonToApi)({
|
|
1569
1817
|
url: this.buildRequestUrl(false),
|
|
1570
1818
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1571
1819
|
body: this.transformRequestBody(args),
|
|
1572
1820
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1573
|
-
successfulResponseHandler: (0,
|
|
1821
|
+
successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
|
|
1574
1822
|
anthropicMessagesResponseSchema
|
|
1575
1823
|
),
|
|
1576
1824
|
abortSignal: options.abortSignal,
|
|
@@ -1637,7 +1885,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1637
1885
|
break;
|
|
1638
1886
|
}
|
|
1639
1887
|
case "server_tool_use": {
|
|
1640
|
-
if (part.name === "
|
|
1888
|
+
if (part.name === "text_editor_code_execution" || part.name === "bash_code_execution") {
|
|
1889
|
+
content.push({
|
|
1890
|
+
type: "tool-call",
|
|
1891
|
+
toolCallId: part.id,
|
|
1892
|
+
toolName: "code_execution",
|
|
1893
|
+
input: JSON.stringify({ type: part.name, ...part.input }),
|
|
1894
|
+
providerExecuted: true
|
|
1895
|
+
});
|
|
1896
|
+
} else if (part.name === "web_search" || part.name === "code_execution" || part.name === "web_fetch") {
|
|
1641
1897
|
content.push({
|
|
1642
1898
|
type: "tool-call",
|
|
1643
1899
|
toolCallId: part.id,
|
|
@@ -1733,6 +1989,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1733
1989
|
}
|
|
1734
1990
|
break;
|
|
1735
1991
|
}
|
|
1992
|
+
// code execution 20250522:
|
|
1736
1993
|
case "code_execution_tool_result": {
|
|
1737
1994
|
if (part.content.type === "code_execution_result") {
|
|
1738
1995
|
content.push({
|
|
@@ -1762,6 +2019,18 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1762
2019
|
}
|
|
1763
2020
|
break;
|
|
1764
2021
|
}
|
|
2022
|
+
// code execution 20250825:
|
|
2023
|
+
case "bash_code_execution_tool_result":
|
|
2024
|
+
case "text_editor_code_execution_tool_result": {
|
|
2025
|
+
content.push({
|
|
2026
|
+
type: "tool-result",
|
|
2027
|
+
toolCallId: part.tool_use_id,
|
|
2028
|
+
toolName: "code_execution",
|
|
2029
|
+
result: part.content,
|
|
2030
|
+
providerExecuted: true
|
|
2031
|
+
});
|
|
2032
|
+
break;
|
|
2033
|
+
}
|
|
1765
2034
|
}
|
|
1766
2035
|
}
|
|
1767
2036
|
return {
|
|
@@ -1797,12 +2066,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1797
2066
|
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
|
|
1798
2067
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
1799
2068
|
const body = { ...args, stream: true };
|
|
1800
|
-
const { responseHeaders, value: response } = await (0,
|
|
2069
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
|
|
1801
2070
|
url: this.buildRequestUrl(true),
|
|
1802
2071
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1803
2072
|
body: this.transformRequestBody(body),
|
|
1804
2073
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1805
|
-
successfulResponseHandler: (0,
|
|
2074
|
+
successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
|
|
1806
2075
|
anthropicMessagesChunkSchema
|
|
1807
2076
|
),
|
|
1808
2077
|
abortSignal: options.abortSignal,
|
|
@@ -1878,7 +2147,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1878
2147
|
type: "tool-call",
|
|
1879
2148
|
toolCallId: value.content_block.id,
|
|
1880
2149
|
toolName: value.content_block.name,
|
|
1881
|
-
input: ""
|
|
2150
|
+
input: "",
|
|
2151
|
+
firstDelta: true
|
|
1882
2152
|
};
|
|
1883
2153
|
controller.enqueue(
|
|
1884
2154
|
usesJsonResponseTool ? { type: "text-start", id: String(value.index) } : {
|
|
@@ -1890,18 +2160,29 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1890
2160
|
return;
|
|
1891
2161
|
}
|
|
1892
2162
|
case "server_tool_use": {
|
|
1893
|
-
if (
|
|
2163
|
+
if ([
|
|
2164
|
+
"web_fetch",
|
|
2165
|
+
"web_search",
|
|
2166
|
+
// code execution 20250825:
|
|
2167
|
+
"code_execution",
|
|
2168
|
+
// code execution 20250825 text editor:
|
|
2169
|
+
"text_editor_code_execution",
|
|
2170
|
+
// code execution 20250825 bash:
|
|
2171
|
+
"bash_code_execution"
|
|
2172
|
+
].includes(value.content_block.name)) {
|
|
1894
2173
|
contentBlocks[value.index] = {
|
|
1895
2174
|
type: "tool-call",
|
|
1896
2175
|
toolCallId: value.content_block.id,
|
|
1897
2176
|
toolName: value.content_block.name,
|
|
1898
2177
|
input: "",
|
|
1899
|
-
providerExecuted: true
|
|
2178
|
+
providerExecuted: true,
|
|
2179
|
+
firstDelta: true
|
|
1900
2180
|
};
|
|
2181
|
+
const mappedToolName = value.content_block.name === "text_editor_code_execution" || value.content_block.name === "bash_code_execution" ? "code_execution" : value.content_block.name;
|
|
1901
2182
|
controller.enqueue({
|
|
1902
2183
|
type: "tool-input-start",
|
|
1903
2184
|
id: value.content_block.id,
|
|
1904
|
-
toolName:
|
|
2185
|
+
toolName: mappedToolName,
|
|
1905
2186
|
providerExecuted: true
|
|
1906
2187
|
});
|
|
1907
2188
|
}
|
|
@@ -1993,6 +2274,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1993
2274
|
}
|
|
1994
2275
|
return;
|
|
1995
2276
|
}
|
|
2277
|
+
// code execution 20250522:
|
|
1996
2278
|
case "code_execution_tool_result": {
|
|
1997
2279
|
const part = value.content_block;
|
|
1998
2280
|
if (part.content.type === "code_execution_result") {
|
|
@@ -2023,6 +2305,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2023
2305
|
}
|
|
2024
2306
|
return;
|
|
2025
2307
|
}
|
|
2308
|
+
// code execution 20250825:
|
|
2309
|
+
case "bash_code_execution_tool_result":
|
|
2310
|
+
case "text_editor_code_execution_tool_result": {
|
|
2311
|
+
const part = value.content_block;
|
|
2312
|
+
controller.enqueue({
|
|
2313
|
+
type: "tool-result",
|
|
2314
|
+
toolCallId: part.tool_use_id,
|
|
2315
|
+
toolName: "code_execution",
|
|
2316
|
+
result: part.content,
|
|
2317
|
+
providerExecuted: true
|
|
2318
|
+
});
|
|
2319
|
+
return;
|
|
2320
|
+
}
|
|
2026
2321
|
default: {
|
|
2027
2322
|
const _exhaustiveCheck = contentBlockType;
|
|
2028
2323
|
throw new Error(
|
|
@@ -2055,7 +2350,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2055
2350
|
type: "tool-input-end",
|
|
2056
2351
|
id: contentBlock.toolCallId
|
|
2057
2352
|
});
|
|
2058
|
-
|
|
2353
|
+
const toolName = contentBlock.toolName === "text_editor_code_execution" || contentBlock.toolName === "bash_code_execution" ? "code_execution" : contentBlock.toolName;
|
|
2354
|
+
controller.enqueue({
|
|
2355
|
+
type: "tool-call",
|
|
2356
|
+
toolCallId: contentBlock.toolCallId,
|
|
2357
|
+
toolName,
|
|
2358
|
+
input: contentBlock.input,
|
|
2359
|
+
providerExecuted: contentBlock.providerExecuted
|
|
2360
|
+
});
|
|
2059
2361
|
}
|
|
2060
2362
|
break;
|
|
2061
2363
|
}
|
|
@@ -2103,7 +2405,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2103
2405
|
}
|
|
2104
2406
|
case "input_json_delta": {
|
|
2105
2407
|
const contentBlock = contentBlocks[value.index];
|
|
2106
|
-
|
|
2408
|
+
let delta = value.delta.partial_json;
|
|
2409
|
+
if (delta.length === 0) {
|
|
2410
|
+
return;
|
|
2411
|
+
}
|
|
2107
2412
|
if (usesJsonResponseTool) {
|
|
2108
2413
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "text") {
|
|
2109
2414
|
return;
|
|
@@ -2117,12 +2422,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2117
2422
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
2118
2423
|
return;
|
|
2119
2424
|
}
|
|
2425
|
+
if (contentBlock.firstDelta && (contentBlock.toolName === "bash_code_execution" || contentBlock.toolName === "text_editor_code_execution")) {
|
|
2426
|
+
delta = `{"type": "${contentBlock.toolName}",${delta.substring(1)}`;
|
|
2427
|
+
}
|
|
2120
2428
|
controller.enqueue({
|
|
2121
2429
|
type: "tool-input-delta",
|
|
2122
2430
|
id: contentBlock.toolCallId,
|
|
2123
2431
|
delta
|
|
2124
2432
|
});
|
|
2125
2433
|
contentBlock.input += delta;
|
|
2434
|
+
contentBlock.firstDelta = false;
|
|
2126
2435
|
}
|
|
2127
2436
|
return;
|
|
2128
2437
|
}
|
|
@@ -2208,46 +2517,46 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2208
2517
|
};
|
|
2209
2518
|
|
|
2210
2519
|
// src/tool/bash_20241022.ts
|
|
2211
|
-
var
|
|
2212
|
-
var
|
|
2213
|
-
var bash_20241022InputSchema = (0,
|
|
2214
|
-
() => (0,
|
|
2215
|
-
|
|
2216
|
-
command:
|
|
2217
|
-
restart:
|
|
2520
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2521
|
+
var import_v49 = require("zod/v4");
|
|
2522
|
+
var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2523
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2524
|
+
import_v49.z.object({
|
|
2525
|
+
command: import_v49.z.string(),
|
|
2526
|
+
restart: import_v49.z.boolean().optional()
|
|
2218
2527
|
})
|
|
2219
2528
|
)
|
|
2220
2529
|
);
|
|
2221
|
-
var bash_20241022 = (0,
|
|
2530
|
+
var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
|
|
2222
2531
|
id: "anthropic.bash_20241022",
|
|
2223
2532
|
name: "bash",
|
|
2224
2533
|
inputSchema: bash_20241022InputSchema
|
|
2225
2534
|
});
|
|
2226
2535
|
|
|
2227
2536
|
// src/tool/bash_20250124.ts
|
|
2228
|
-
var
|
|
2229
|
-
var
|
|
2230
|
-
var bash_20250124InputSchema = (0,
|
|
2231
|
-
() => (0,
|
|
2232
|
-
|
|
2233
|
-
command:
|
|
2234
|
-
restart:
|
|
2537
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2538
|
+
var import_v410 = require("zod/v4");
|
|
2539
|
+
var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2540
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2541
|
+
import_v410.z.object({
|
|
2542
|
+
command: import_v410.z.string(),
|
|
2543
|
+
restart: import_v410.z.boolean().optional()
|
|
2235
2544
|
})
|
|
2236
2545
|
)
|
|
2237
2546
|
);
|
|
2238
|
-
var bash_20250124 = (0,
|
|
2547
|
+
var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2239
2548
|
id: "anthropic.bash_20250124",
|
|
2240
2549
|
name: "bash",
|
|
2241
2550
|
inputSchema: bash_20250124InputSchema
|
|
2242
2551
|
});
|
|
2243
2552
|
|
|
2244
2553
|
// src/tool/computer_20241022.ts
|
|
2245
|
-
var
|
|
2246
|
-
var
|
|
2247
|
-
var computer_20241022InputSchema = (0,
|
|
2248
|
-
() => (0,
|
|
2249
|
-
|
|
2250
|
-
action:
|
|
2554
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2555
|
+
var import_v411 = require("zod/v4");
|
|
2556
|
+
var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2557
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2558
|
+
import_v411.z.object({
|
|
2559
|
+
action: import_v411.z.enum([
|
|
2251
2560
|
"key",
|
|
2252
2561
|
"type",
|
|
2253
2562
|
"mouse_move",
|
|
@@ -2259,24 +2568,24 @@ var computer_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
|
2259
2568
|
"screenshot",
|
|
2260
2569
|
"cursor_position"
|
|
2261
2570
|
]),
|
|
2262
|
-
coordinate:
|
|
2263
|
-
text:
|
|
2571
|
+
coordinate: import_v411.z.array(import_v411.z.number().int()).optional(),
|
|
2572
|
+
text: import_v411.z.string().optional()
|
|
2264
2573
|
})
|
|
2265
2574
|
)
|
|
2266
2575
|
);
|
|
2267
|
-
var computer_20241022 = (0,
|
|
2576
|
+
var computer_20241022 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2268
2577
|
id: "anthropic.computer_20241022",
|
|
2269
2578
|
name: "computer",
|
|
2270
2579
|
inputSchema: computer_20241022InputSchema
|
|
2271
2580
|
});
|
|
2272
2581
|
|
|
2273
2582
|
// src/tool/computer_20250124.ts
|
|
2274
|
-
var
|
|
2275
|
-
var
|
|
2276
|
-
var computer_20250124InputSchema = (0,
|
|
2277
|
-
() => (0,
|
|
2278
|
-
|
|
2279
|
-
action:
|
|
2583
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2584
|
+
var import_v412 = require("zod/v4");
|
|
2585
|
+
var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2586
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2587
|
+
import_v412.z.object({
|
|
2588
|
+
action: import_v412.z.enum([
|
|
2280
2589
|
"key",
|
|
2281
2590
|
"hold_key",
|
|
2282
2591
|
"type",
|
|
@@ -2294,47 +2603,25 @@ var computer_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
2294
2603
|
"wait",
|
|
2295
2604
|
"screenshot"
|
|
2296
2605
|
]),
|
|
2297
|
-
coordinate:
|
|
2298
|
-
duration:
|
|
2299
|
-
scroll_amount:
|
|
2300
|
-
scroll_direction:
|
|
2301
|
-
start_coordinate:
|
|
2302
|
-
text:
|
|
2606
|
+
coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
|
|
2607
|
+
duration: import_v412.z.number().optional(),
|
|
2608
|
+
scroll_amount: import_v412.z.number().optional(),
|
|
2609
|
+
scroll_direction: import_v412.z.enum(["up", "down", "left", "right"]).optional(),
|
|
2610
|
+
start_coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
|
|
2611
|
+
text: import_v412.z.string().optional()
|
|
2303
2612
|
})
|
|
2304
2613
|
)
|
|
2305
2614
|
);
|
|
2306
|
-
var computer_20250124 = (0,
|
|
2615
|
+
var computer_20250124 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
2307
2616
|
id: "anthropic.computer_20250124",
|
|
2308
2617
|
name: "computer",
|
|
2309
2618
|
inputSchema: computer_20250124InputSchema
|
|
2310
2619
|
});
|
|
2311
2620
|
|
|
2312
2621
|
// src/tool/text-editor_20241022.ts
|
|
2313
|
-
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2314
|
-
var import_v412 = require("zod/v4");
|
|
2315
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2316
|
-
() => (0, import_provider_utils15.zodSchema)(
|
|
2317
|
-
import_v412.z.object({
|
|
2318
|
-
command: import_v412.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2319
|
-
path: import_v412.z.string(),
|
|
2320
|
-
file_text: import_v412.z.string().optional(),
|
|
2321
|
-
insert_line: import_v412.z.number().int().optional(),
|
|
2322
|
-
new_str: import_v412.z.string().optional(),
|
|
2323
|
-
old_str: import_v412.z.string().optional(),
|
|
2324
|
-
view_range: import_v412.z.array(import_v412.z.number().int()).optional()
|
|
2325
|
-
})
|
|
2326
|
-
)
|
|
2327
|
-
);
|
|
2328
|
-
var textEditor_20241022 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
2329
|
-
id: "anthropic.text_editor_20241022",
|
|
2330
|
-
name: "str_replace_editor",
|
|
2331
|
-
inputSchema: textEditor_20241022InputSchema
|
|
2332
|
-
});
|
|
2333
|
-
|
|
2334
|
-
// src/tool/text-editor_20250124.ts
|
|
2335
2622
|
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2336
2623
|
var import_v413 = require("zod/v4");
|
|
2337
|
-
var
|
|
2624
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
2338
2625
|
() => (0, import_provider_utils16.zodSchema)(
|
|
2339
2626
|
import_v413.z.object({
|
|
2340
2627
|
command: import_v413.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -2347,19 +2634,19 @@ var textEditor_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
|
2347
2634
|
})
|
|
2348
2635
|
)
|
|
2349
2636
|
);
|
|
2350
|
-
var
|
|
2351
|
-
id: "anthropic.
|
|
2637
|
+
var textEditor_20241022 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
|
|
2638
|
+
id: "anthropic.text_editor_20241022",
|
|
2352
2639
|
name: "str_replace_editor",
|
|
2353
|
-
inputSchema:
|
|
2640
|
+
inputSchema: textEditor_20241022InputSchema
|
|
2354
2641
|
});
|
|
2355
2642
|
|
|
2356
|
-
// src/tool/text-
|
|
2643
|
+
// src/tool/text-editor_20250124.ts
|
|
2357
2644
|
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
2358
2645
|
var import_v414 = require("zod/v4");
|
|
2359
|
-
var
|
|
2646
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
2360
2647
|
() => (0, import_provider_utils17.zodSchema)(
|
|
2361
2648
|
import_v414.z.object({
|
|
2362
|
-
command: import_v414.z.enum(["view", "create", "str_replace", "insert"]),
|
|
2649
|
+
command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2363
2650
|
path: import_v414.z.string(),
|
|
2364
2651
|
file_text: import_v414.z.string().optional(),
|
|
2365
2652
|
insert_line: import_v414.z.number().int().optional(),
|
|
@@ -2369,7 +2656,29 @@ var textEditor_20250429InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
2369
2656
|
})
|
|
2370
2657
|
)
|
|
2371
2658
|
);
|
|
2372
|
-
var
|
|
2659
|
+
var textEditor_20250124 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
|
|
2660
|
+
id: "anthropic.text_editor_20250124",
|
|
2661
|
+
name: "str_replace_editor",
|
|
2662
|
+
inputSchema: textEditor_20250124InputSchema
|
|
2663
|
+
});
|
|
2664
|
+
|
|
2665
|
+
// src/tool/text-editor_20250429.ts
|
|
2666
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
2667
|
+
var import_v415 = require("zod/v4");
|
|
2668
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2669
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2670
|
+
import_v415.z.object({
|
|
2671
|
+
command: import_v415.z.enum(["view", "create", "str_replace", "insert"]),
|
|
2672
|
+
path: import_v415.z.string(),
|
|
2673
|
+
file_text: import_v415.z.string().optional(),
|
|
2674
|
+
insert_line: import_v415.z.number().int().optional(),
|
|
2675
|
+
new_str: import_v415.z.string().optional(),
|
|
2676
|
+
old_str: import_v415.z.string().optional(),
|
|
2677
|
+
view_range: import_v415.z.array(import_v415.z.number().int()).optional()
|
|
2678
|
+
})
|
|
2679
|
+
)
|
|
2680
|
+
);
|
|
2681
|
+
var textEditor_20250429 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
|
|
2373
2682
|
id: "anthropic.text_editor_20250429",
|
|
2374
2683
|
name: "str_replace_based_edit_tool",
|
|
2375
2684
|
inputSchema: textEditor_20250429InputSchema
|
|
@@ -2406,6 +2715,19 @@ var anthropicTools = {
|
|
|
2406
2715
|
* Tool name must be `code_execution`.
|
|
2407
2716
|
*/
|
|
2408
2717
|
codeExecution_20250522,
|
|
2718
|
+
/**
|
|
2719
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
2720
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
2721
|
+
* the API conversation.
|
|
2722
|
+
*
|
|
2723
|
+
* The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
|
|
2724
|
+
* including writing code, in a secure, sandboxed environment.
|
|
2725
|
+
*
|
|
2726
|
+
* This is the latest version with enhanced Bash support and file operations.
|
|
2727
|
+
*
|
|
2728
|
+
* Tool name must be `code_execution`.
|
|
2729
|
+
*/
|
|
2730
|
+
codeExecution_20250825,
|
|
2409
2731
|
/**
|
|
2410
2732
|
* Claude can interact with computer environments through the computer use tool, which
|
|
2411
2733
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|