@ai-sdk/anthropic 3.0.0-beta.22 → 3.0.0-beta.23
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 +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({
|
|
@@ -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 },
|
|
@@ -1080,7 +1291,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1080
1291
|
}
|
|
1081
1292
|
case "reasoning": {
|
|
1082
1293
|
if (sendReasoning) {
|
|
1083
|
-
const reasoningMetadata = await (0,
|
|
1294
|
+
const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1084
1295
|
provider: "anthropic",
|
|
1085
1296
|
providerOptions: part.providerOptions,
|
|
1086
1297
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -1121,7 +1332,17 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1121
1332
|
}
|
|
1122
1333
|
case "tool-call": {
|
|
1123
1334
|
if (part.providerExecuted) {
|
|
1124
|
-
if (part.toolName === "code_execution"
|
|
1335
|
+
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")) {
|
|
1336
|
+
anthropicContent.push({
|
|
1337
|
+
type: "server_tool_use",
|
|
1338
|
+
id: part.toolCallId,
|
|
1339
|
+
name: part.input.type,
|
|
1340
|
+
// map back to subtool name
|
|
1341
|
+
input: part.input,
|
|
1342
|
+
cache_control: cacheControl
|
|
1343
|
+
});
|
|
1344
|
+
} else if (part.toolName === "code_execution" || // code execution 20250522
|
|
1345
|
+
part.toolName === "web_fetch" || part.toolName === "web_search") {
|
|
1125
1346
|
anthropicContent.push({
|
|
1126
1347
|
type: "server_tool_use",
|
|
1127
1348
|
id: part.toolCallId,
|
|
@@ -1156,21 +1377,48 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1156
1377
|
});
|
|
1157
1378
|
break;
|
|
1158
1379
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1380
|
+
if (output.value == null || typeof output.value !== "object" || !("type" in output.value) || typeof output.value.type !== "string") {
|
|
1381
|
+
warnings.push({
|
|
1382
|
+
type: "other",
|
|
1383
|
+
message: `provider executed tool result output value is not a valid code execution result for tool ${part.toolName}`
|
|
1384
|
+
});
|
|
1385
|
+
break;
|
|
1386
|
+
}
|
|
1387
|
+
if (output.value.type === "code_execution_result") {
|
|
1388
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1389
|
+
value: output.value,
|
|
1390
|
+
schema: codeExecution_20250522OutputSchema
|
|
1391
|
+
});
|
|
1392
|
+
anthropicContent.push({
|
|
1393
|
+
type: "code_execution_tool_result",
|
|
1394
|
+
tool_use_id: part.toolCallId,
|
|
1395
|
+
content: {
|
|
1396
|
+
type: codeExecutionOutput.type,
|
|
1397
|
+
stdout: codeExecutionOutput.stdout,
|
|
1398
|
+
stderr: codeExecutionOutput.stderr,
|
|
1399
|
+
return_code: codeExecutionOutput.return_code
|
|
1400
|
+
},
|
|
1401
|
+
cache_control: cacheControl
|
|
1402
|
+
});
|
|
1403
|
+
} else {
|
|
1404
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1405
|
+
value: output.value,
|
|
1406
|
+
schema: codeExecution_20250825OutputSchema
|
|
1407
|
+
});
|
|
1408
|
+
anthropicContent.push(
|
|
1409
|
+
codeExecutionOutput.type === "bash_code_execution_result" || codeExecutionOutput.type === "bash_code_execution_tool_result_error" ? {
|
|
1410
|
+
type: "bash_code_execution_tool_result",
|
|
1411
|
+
tool_use_id: part.toolCallId,
|
|
1412
|
+
cache_control: cacheControl,
|
|
1413
|
+
content: codeExecutionOutput
|
|
1414
|
+
} : {
|
|
1415
|
+
type: "text_editor_code_execution_tool_result",
|
|
1416
|
+
tool_use_id: part.toolCallId,
|
|
1417
|
+
cache_control: cacheControl,
|
|
1418
|
+
content: codeExecutionOutput
|
|
1419
|
+
}
|
|
1420
|
+
);
|
|
1421
|
+
}
|
|
1174
1422
|
break;
|
|
1175
1423
|
}
|
|
1176
1424
|
if (part.toolName === "web_fetch") {
|
|
@@ -1182,7 +1430,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1182
1430
|
});
|
|
1183
1431
|
break;
|
|
1184
1432
|
}
|
|
1185
|
-
const webFetchOutput = await (0,
|
|
1433
|
+
const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1186
1434
|
value: output.value,
|
|
1187
1435
|
schema: webFetch_20250910OutputSchema
|
|
1188
1436
|
});
|
|
@@ -1217,7 +1465,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1217
1465
|
});
|
|
1218
1466
|
break;
|
|
1219
1467
|
}
|
|
1220
|
-
const webSearchOutput = await (0,
|
|
1468
|
+
const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1221
1469
|
value: output.value,
|
|
1222
1470
|
schema: webSearch_20250305OutputSchema
|
|
1223
1471
|
});
|
|
@@ -1362,7 +1610,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1362
1610
|
var _a;
|
|
1363
1611
|
this.modelId = modelId;
|
|
1364
1612
|
this.config = config;
|
|
1365
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
1613
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
|
|
1366
1614
|
}
|
|
1367
1615
|
supportsUrl(url) {
|
|
1368
1616
|
return url.protocol === "https:";
|
|
@@ -1431,7 +1679,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1431
1679
|
description: "Respond with a JSON object.",
|
|
1432
1680
|
inputSchema: responseFormat.schema
|
|
1433
1681
|
} : void 0;
|
|
1434
|
-
const anthropicOptions = await (0,
|
|
1682
|
+
const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
|
|
1435
1683
|
provider: "anthropic",
|
|
1436
1684
|
providerOptions,
|
|
1437
1685
|
schema: anthropicProviderOptions
|
|
@@ -1523,8 +1771,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1523
1771
|
betas,
|
|
1524
1772
|
headers
|
|
1525
1773
|
}) {
|
|
1526
|
-
return (0,
|
|
1527
|
-
await (0,
|
|
1774
|
+
return (0, import_provider_utils11.combineHeaders)(
|
|
1775
|
+
await (0, import_provider_utils11.resolve)(this.config.headers),
|
|
1528
1776
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {},
|
|
1529
1777
|
headers
|
|
1530
1778
|
);
|
|
@@ -1568,12 +1816,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1568
1816
|
responseHeaders,
|
|
1569
1817
|
value: response,
|
|
1570
1818
|
rawValue: rawResponse
|
|
1571
|
-
} = await (0,
|
|
1819
|
+
} = await (0, import_provider_utils11.postJsonToApi)({
|
|
1572
1820
|
url: this.buildRequestUrl(false),
|
|
1573
1821
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1574
1822
|
body: this.transformRequestBody(args),
|
|
1575
1823
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1576
|
-
successfulResponseHandler: (0,
|
|
1824
|
+
successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
|
|
1577
1825
|
anthropicMessagesResponseSchema
|
|
1578
1826
|
),
|
|
1579
1827
|
abortSignal: options.abortSignal,
|
|
@@ -1640,7 +1888,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1640
1888
|
break;
|
|
1641
1889
|
}
|
|
1642
1890
|
case "server_tool_use": {
|
|
1643
|
-
if (part.name === "
|
|
1891
|
+
if (part.name === "text_editor_code_execution" || part.name === "bash_code_execution") {
|
|
1892
|
+
content.push({
|
|
1893
|
+
type: "tool-call",
|
|
1894
|
+
toolCallId: part.id,
|
|
1895
|
+
toolName: "code_execution",
|
|
1896
|
+
input: JSON.stringify({ type: part.name, ...part.input }),
|
|
1897
|
+
providerExecuted: true
|
|
1898
|
+
});
|
|
1899
|
+
} else if (part.name === "web_search" || part.name === "code_execution" || part.name === "web_fetch") {
|
|
1644
1900
|
content.push({
|
|
1645
1901
|
type: "tool-call",
|
|
1646
1902
|
toolCallId: part.id,
|
|
@@ -1736,6 +1992,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1736
1992
|
}
|
|
1737
1993
|
break;
|
|
1738
1994
|
}
|
|
1995
|
+
// code execution 20250522:
|
|
1739
1996
|
case "code_execution_tool_result": {
|
|
1740
1997
|
if (part.content.type === "code_execution_result") {
|
|
1741
1998
|
content.push({
|
|
@@ -1765,6 +2022,18 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1765
2022
|
}
|
|
1766
2023
|
break;
|
|
1767
2024
|
}
|
|
2025
|
+
// code execution 20250825:
|
|
2026
|
+
case "bash_code_execution_tool_result":
|
|
2027
|
+
case "text_editor_code_execution_tool_result": {
|
|
2028
|
+
content.push({
|
|
2029
|
+
type: "tool-result",
|
|
2030
|
+
toolCallId: part.tool_use_id,
|
|
2031
|
+
toolName: "code_execution",
|
|
2032
|
+
result: part.content,
|
|
2033
|
+
providerExecuted: true
|
|
2034
|
+
});
|
|
2035
|
+
break;
|
|
2036
|
+
}
|
|
1768
2037
|
}
|
|
1769
2038
|
}
|
|
1770
2039
|
return {
|
|
@@ -1800,12 +2069,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1800
2069
|
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
|
|
1801
2070
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
1802
2071
|
const body = { ...args, stream: true };
|
|
1803
|
-
const { responseHeaders, value: response } = await (0,
|
|
2072
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
|
|
1804
2073
|
url: this.buildRequestUrl(true),
|
|
1805
2074
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1806
2075
|
body: this.transformRequestBody(body),
|
|
1807
2076
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1808
|
-
successfulResponseHandler: (0,
|
|
2077
|
+
successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
|
|
1809
2078
|
anthropicMessagesChunkSchema
|
|
1810
2079
|
),
|
|
1811
2080
|
abortSignal: options.abortSignal,
|
|
@@ -1881,7 +2150,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1881
2150
|
type: "tool-call",
|
|
1882
2151
|
toolCallId: value.content_block.id,
|
|
1883
2152
|
toolName: value.content_block.name,
|
|
1884
|
-
input: ""
|
|
2153
|
+
input: "",
|
|
2154
|
+
firstDelta: true
|
|
1885
2155
|
};
|
|
1886
2156
|
controller.enqueue(
|
|
1887
2157
|
usesJsonResponseTool ? { type: "text-start", id: String(value.index) } : {
|
|
@@ -1893,18 +2163,29 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1893
2163
|
return;
|
|
1894
2164
|
}
|
|
1895
2165
|
case "server_tool_use": {
|
|
1896
|
-
if (
|
|
2166
|
+
if ([
|
|
2167
|
+
"web_fetch",
|
|
2168
|
+
"web_search",
|
|
2169
|
+
// code execution 20250825:
|
|
2170
|
+
"code_execution",
|
|
2171
|
+
// code execution 20250825 text editor:
|
|
2172
|
+
"text_editor_code_execution",
|
|
2173
|
+
// code execution 20250825 bash:
|
|
2174
|
+
"bash_code_execution"
|
|
2175
|
+
].includes(value.content_block.name)) {
|
|
1897
2176
|
contentBlocks[value.index] = {
|
|
1898
2177
|
type: "tool-call",
|
|
1899
2178
|
toolCallId: value.content_block.id,
|
|
1900
2179
|
toolName: value.content_block.name,
|
|
1901
2180
|
input: "",
|
|
1902
|
-
providerExecuted: true
|
|
2181
|
+
providerExecuted: true,
|
|
2182
|
+
firstDelta: true
|
|
1903
2183
|
};
|
|
2184
|
+
const mappedToolName = value.content_block.name === "text_editor_code_execution" || value.content_block.name === "bash_code_execution" ? "code_execution" : value.content_block.name;
|
|
1904
2185
|
controller.enqueue({
|
|
1905
2186
|
type: "tool-input-start",
|
|
1906
2187
|
id: value.content_block.id,
|
|
1907
|
-
toolName:
|
|
2188
|
+
toolName: mappedToolName,
|
|
1908
2189
|
providerExecuted: true
|
|
1909
2190
|
});
|
|
1910
2191
|
}
|
|
@@ -1996,6 +2277,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1996
2277
|
}
|
|
1997
2278
|
return;
|
|
1998
2279
|
}
|
|
2280
|
+
// code execution 20250522:
|
|
1999
2281
|
case "code_execution_tool_result": {
|
|
2000
2282
|
const part = value.content_block;
|
|
2001
2283
|
if (part.content.type === "code_execution_result") {
|
|
@@ -2026,6 +2308,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2026
2308
|
}
|
|
2027
2309
|
return;
|
|
2028
2310
|
}
|
|
2311
|
+
// code execution 20250825:
|
|
2312
|
+
case "bash_code_execution_tool_result":
|
|
2313
|
+
case "text_editor_code_execution_tool_result": {
|
|
2314
|
+
const part = value.content_block;
|
|
2315
|
+
controller.enqueue({
|
|
2316
|
+
type: "tool-result",
|
|
2317
|
+
toolCallId: part.tool_use_id,
|
|
2318
|
+
toolName: "code_execution",
|
|
2319
|
+
result: part.content,
|
|
2320
|
+
providerExecuted: true
|
|
2321
|
+
});
|
|
2322
|
+
return;
|
|
2323
|
+
}
|
|
2029
2324
|
default: {
|
|
2030
2325
|
const _exhaustiveCheck = contentBlockType;
|
|
2031
2326
|
throw new Error(
|
|
@@ -2058,7 +2353,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2058
2353
|
type: "tool-input-end",
|
|
2059
2354
|
id: contentBlock.toolCallId
|
|
2060
2355
|
});
|
|
2061
|
-
|
|
2356
|
+
const toolName = contentBlock.toolName === "text_editor_code_execution" || contentBlock.toolName === "bash_code_execution" ? "code_execution" : contentBlock.toolName;
|
|
2357
|
+
controller.enqueue({
|
|
2358
|
+
type: "tool-call",
|
|
2359
|
+
toolCallId: contentBlock.toolCallId,
|
|
2360
|
+
toolName,
|
|
2361
|
+
input: contentBlock.input,
|
|
2362
|
+
providerExecuted: contentBlock.providerExecuted
|
|
2363
|
+
});
|
|
2062
2364
|
}
|
|
2063
2365
|
break;
|
|
2064
2366
|
}
|
|
@@ -2106,7 +2408,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2106
2408
|
}
|
|
2107
2409
|
case "input_json_delta": {
|
|
2108
2410
|
const contentBlock = contentBlocks[value.index];
|
|
2109
|
-
|
|
2411
|
+
let delta = value.delta.partial_json;
|
|
2412
|
+
if (delta.length === 0) {
|
|
2413
|
+
return;
|
|
2414
|
+
}
|
|
2110
2415
|
if (usesJsonResponseTool) {
|
|
2111
2416
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "text") {
|
|
2112
2417
|
return;
|
|
@@ -2120,12 +2425,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2120
2425
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
2121
2426
|
return;
|
|
2122
2427
|
}
|
|
2428
|
+
if (contentBlock.firstDelta && (contentBlock.toolName === "bash_code_execution" || contentBlock.toolName === "text_editor_code_execution")) {
|
|
2429
|
+
delta = `{"type": "${contentBlock.toolName}",${delta.substring(1)}`;
|
|
2430
|
+
}
|
|
2123
2431
|
controller.enqueue({
|
|
2124
2432
|
type: "tool-input-delta",
|
|
2125
2433
|
id: contentBlock.toolCallId,
|
|
2126
2434
|
delta
|
|
2127
2435
|
});
|
|
2128
2436
|
contentBlock.input += delta;
|
|
2437
|
+
contentBlock.firstDelta = false;
|
|
2129
2438
|
}
|
|
2130
2439
|
return;
|
|
2131
2440
|
}
|
|
@@ -2211,46 +2520,46 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2211
2520
|
};
|
|
2212
2521
|
|
|
2213
2522
|
// src/tool/bash_20241022.ts
|
|
2214
|
-
var
|
|
2215
|
-
var
|
|
2216
|
-
var bash_20241022InputSchema = (0,
|
|
2217
|
-
() => (0,
|
|
2218
|
-
|
|
2219
|
-
command:
|
|
2220
|
-
restart:
|
|
2523
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2524
|
+
var import_v49 = require("zod/v4");
|
|
2525
|
+
var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2526
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2527
|
+
import_v49.z.object({
|
|
2528
|
+
command: import_v49.z.string(),
|
|
2529
|
+
restart: import_v49.z.boolean().optional()
|
|
2221
2530
|
})
|
|
2222
2531
|
)
|
|
2223
2532
|
);
|
|
2224
|
-
var bash_20241022 = (0,
|
|
2533
|
+
var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
|
|
2225
2534
|
id: "anthropic.bash_20241022",
|
|
2226
2535
|
name: "bash",
|
|
2227
2536
|
inputSchema: bash_20241022InputSchema
|
|
2228
2537
|
});
|
|
2229
2538
|
|
|
2230
2539
|
// src/tool/bash_20250124.ts
|
|
2231
|
-
var
|
|
2232
|
-
var
|
|
2233
|
-
var bash_20250124InputSchema = (0,
|
|
2234
|
-
() => (0,
|
|
2235
|
-
|
|
2236
|
-
command:
|
|
2237
|
-
restart:
|
|
2540
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2541
|
+
var import_v410 = require("zod/v4");
|
|
2542
|
+
var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2543
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2544
|
+
import_v410.z.object({
|
|
2545
|
+
command: import_v410.z.string(),
|
|
2546
|
+
restart: import_v410.z.boolean().optional()
|
|
2238
2547
|
})
|
|
2239
2548
|
)
|
|
2240
2549
|
);
|
|
2241
|
-
var bash_20250124 = (0,
|
|
2550
|
+
var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2242
2551
|
id: "anthropic.bash_20250124",
|
|
2243
2552
|
name: "bash",
|
|
2244
2553
|
inputSchema: bash_20250124InputSchema
|
|
2245
2554
|
});
|
|
2246
2555
|
|
|
2247
2556
|
// src/tool/computer_20241022.ts
|
|
2248
|
-
var
|
|
2249
|
-
var
|
|
2250
|
-
var computer_20241022InputSchema = (0,
|
|
2251
|
-
() => (0,
|
|
2252
|
-
|
|
2253
|
-
action:
|
|
2557
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2558
|
+
var import_v411 = require("zod/v4");
|
|
2559
|
+
var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2560
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2561
|
+
import_v411.z.object({
|
|
2562
|
+
action: import_v411.z.enum([
|
|
2254
2563
|
"key",
|
|
2255
2564
|
"type",
|
|
2256
2565
|
"mouse_move",
|
|
@@ -2262,24 +2571,24 @@ var computer_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
|
2262
2571
|
"screenshot",
|
|
2263
2572
|
"cursor_position"
|
|
2264
2573
|
]),
|
|
2265
|
-
coordinate:
|
|
2266
|
-
text:
|
|
2574
|
+
coordinate: import_v411.z.array(import_v411.z.number().int()).optional(),
|
|
2575
|
+
text: import_v411.z.string().optional()
|
|
2267
2576
|
})
|
|
2268
2577
|
)
|
|
2269
2578
|
);
|
|
2270
|
-
var computer_20241022 = (0,
|
|
2579
|
+
var computer_20241022 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2271
2580
|
id: "anthropic.computer_20241022",
|
|
2272
2581
|
name: "computer",
|
|
2273
2582
|
inputSchema: computer_20241022InputSchema
|
|
2274
2583
|
});
|
|
2275
2584
|
|
|
2276
2585
|
// src/tool/computer_20250124.ts
|
|
2277
|
-
var
|
|
2278
|
-
var
|
|
2279
|
-
var computer_20250124InputSchema = (0,
|
|
2280
|
-
() => (0,
|
|
2281
|
-
|
|
2282
|
-
action:
|
|
2586
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2587
|
+
var import_v412 = require("zod/v4");
|
|
2588
|
+
var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2589
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2590
|
+
import_v412.z.object({
|
|
2591
|
+
action: import_v412.z.enum([
|
|
2283
2592
|
"key",
|
|
2284
2593
|
"hold_key",
|
|
2285
2594
|
"type",
|
|
@@ -2297,47 +2606,25 @@ var computer_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
2297
2606
|
"wait",
|
|
2298
2607
|
"screenshot"
|
|
2299
2608
|
]),
|
|
2300
|
-
coordinate:
|
|
2301
|
-
duration:
|
|
2302
|
-
scroll_amount:
|
|
2303
|
-
scroll_direction:
|
|
2304
|
-
start_coordinate:
|
|
2305
|
-
text:
|
|
2609
|
+
coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
|
|
2610
|
+
duration: import_v412.z.number().optional(),
|
|
2611
|
+
scroll_amount: import_v412.z.number().optional(),
|
|
2612
|
+
scroll_direction: import_v412.z.enum(["up", "down", "left", "right"]).optional(),
|
|
2613
|
+
start_coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
|
|
2614
|
+
text: import_v412.z.string().optional()
|
|
2306
2615
|
})
|
|
2307
2616
|
)
|
|
2308
2617
|
);
|
|
2309
|
-
var computer_20250124 = (0,
|
|
2618
|
+
var computer_20250124 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
2310
2619
|
id: "anthropic.computer_20250124",
|
|
2311
2620
|
name: "computer",
|
|
2312
2621
|
inputSchema: computer_20250124InputSchema
|
|
2313
2622
|
});
|
|
2314
2623
|
|
|
2315
2624
|
// src/tool/text-editor_20241022.ts
|
|
2316
|
-
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2317
|
-
var import_v412 = require("zod/v4");
|
|
2318
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2319
|
-
() => (0, import_provider_utils15.zodSchema)(
|
|
2320
|
-
import_v412.z.object({
|
|
2321
|
-
command: import_v412.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2322
|
-
path: import_v412.z.string(),
|
|
2323
|
-
file_text: import_v412.z.string().optional(),
|
|
2324
|
-
insert_line: import_v412.z.number().int().optional(),
|
|
2325
|
-
new_str: import_v412.z.string().optional(),
|
|
2326
|
-
old_str: import_v412.z.string().optional(),
|
|
2327
|
-
view_range: import_v412.z.array(import_v412.z.number().int()).optional()
|
|
2328
|
-
})
|
|
2329
|
-
)
|
|
2330
|
-
);
|
|
2331
|
-
var textEditor_20241022 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
2332
|
-
id: "anthropic.text_editor_20241022",
|
|
2333
|
-
name: "str_replace_editor",
|
|
2334
|
-
inputSchema: textEditor_20241022InputSchema
|
|
2335
|
-
});
|
|
2336
|
-
|
|
2337
|
-
// src/tool/text-editor_20250124.ts
|
|
2338
2625
|
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2339
2626
|
var import_v413 = require("zod/v4");
|
|
2340
|
-
var
|
|
2627
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
2341
2628
|
() => (0, import_provider_utils16.zodSchema)(
|
|
2342
2629
|
import_v413.z.object({
|
|
2343
2630
|
command: import_v413.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -2350,19 +2637,19 @@ var textEditor_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
|
2350
2637
|
})
|
|
2351
2638
|
)
|
|
2352
2639
|
);
|
|
2353
|
-
var
|
|
2354
|
-
id: "anthropic.
|
|
2640
|
+
var textEditor_20241022 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
|
|
2641
|
+
id: "anthropic.text_editor_20241022",
|
|
2355
2642
|
name: "str_replace_editor",
|
|
2356
|
-
inputSchema:
|
|
2643
|
+
inputSchema: textEditor_20241022InputSchema
|
|
2357
2644
|
});
|
|
2358
2645
|
|
|
2359
|
-
// src/tool/text-
|
|
2646
|
+
// src/tool/text-editor_20250124.ts
|
|
2360
2647
|
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
2361
2648
|
var import_v414 = require("zod/v4");
|
|
2362
|
-
var
|
|
2649
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
2363
2650
|
() => (0, import_provider_utils17.zodSchema)(
|
|
2364
2651
|
import_v414.z.object({
|
|
2365
|
-
command: import_v414.z.enum(["view", "create", "str_replace", "insert"]),
|
|
2652
|
+
command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2366
2653
|
path: import_v414.z.string(),
|
|
2367
2654
|
file_text: import_v414.z.string().optional(),
|
|
2368
2655
|
insert_line: import_v414.z.number().int().optional(),
|
|
@@ -2372,7 +2659,29 @@ var textEditor_20250429InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
2372
2659
|
})
|
|
2373
2660
|
)
|
|
2374
2661
|
);
|
|
2375
|
-
var
|
|
2662
|
+
var textEditor_20250124 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
|
|
2663
|
+
id: "anthropic.text_editor_20250124",
|
|
2664
|
+
name: "str_replace_editor",
|
|
2665
|
+
inputSchema: textEditor_20250124InputSchema
|
|
2666
|
+
});
|
|
2667
|
+
|
|
2668
|
+
// src/tool/text-editor_20250429.ts
|
|
2669
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
2670
|
+
var import_v415 = require("zod/v4");
|
|
2671
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2672
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
2673
|
+
import_v415.z.object({
|
|
2674
|
+
command: import_v415.z.enum(["view", "create", "str_replace", "insert"]),
|
|
2675
|
+
path: import_v415.z.string(),
|
|
2676
|
+
file_text: import_v415.z.string().optional(),
|
|
2677
|
+
insert_line: import_v415.z.number().int().optional(),
|
|
2678
|
+
new_str: import_v415.z.string().optional(),
|
|
2679
|
+
old_str: import_v415.z.string().optional(),
|
|
2680
|
+
view_range: import_v415.z.array(import_v415.z.number().int()).optional()
|
|
2681
|
+
})
|
|
2682
|
+
)
|
|
2683
|
+
);
|
|
2684
|
+
var textEditor_20250429 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
|
|
2376
2685
|
id: "anthropic.text_editor_20250429",
|
|
2377
2686
|
name: "str_replace_based_edit_tool",
|
|
2378
2687
|
inputSchema: textEditor_20250429InputSchema
|
|
@@ -2409,6 +2718,19 @@ var anthropicTools = {
|
|
|
2409
2718
|
* Tool name must be `code_execution`.
|
|
2410
2719
|
*/
|
|
2411
2720
|
codeExecution_20250522,
|
|
2721
|
+
/**
|
|
2722
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
2723
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
2724
|
+
* the API conversation.
|
|
2725
|
+
*
|
|
2726
|
+
* The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
|
|
2727
|
+
* including writing code, in a secure, sandboxed environment.
|
|
2728
|
+
*
|
|
2729
|
+
* This is the latest version with enhanced Bash support and file operations.
|
|
2730
|
+
*
|
|
2731
|
+
* Tool name must be `code_execution`.
|
|
2732
|
+
*/
|
|
2733
|
+
codeExecution_20250825,
|
|
2412
2734
|
/**
|
|
2413
2735
|
* Claude can interact with computer environments through the computer use tool, which
|
|
2414
2736
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|