@ai-sdk/anthropic 2.0.26 → 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 +12 -0
- package/dist/index.d.mts +105 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.js +448 -114
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +434 -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 +442 -108
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +433 -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 },
|
|
@@ -1003,6 +1214,18 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1003
1214
|
cache_control: void 0
|
|
1004
1215
|
};
|
|
1005
1216
|
}
|
|
1217
|
+
if (contentPart.mediaType === "application/pdf") {
|
|
1218
|
+
betas.add("pdfs-2024-09-25");
|
|
1219
|
+
return {
|
|
1220
|
+
type: "document",
|
|
1221
|
+
source: {
|
|
1222
|
+
type: "base64",
|
|
1223
|
+
media_type: contentPart.mediaType,
|
|
1224
|
+
data: contentPart.data
|
|
1225
|
+
},
|
|
1226
|
+
cache_control: void 0
|
|
1227
|
+
};
|
|
1228
|
+
}
|
|
1006
1229
|
throw new import_provider2.UnsupportedFunctionalityError({
|
|
1007
1230
|
functionality: `media type: ${contentPart.mediaType}`
|
|
1008
1231
|
});
|
|
@@ -1065,7 +1288,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1065
1288
|
}
|
|
1066
1289
|
case "reasoning": {
|
|
1067
1290
|
if (sendReasoning) {
|
|
1068
|
-
const reasoningMetadata = await (0,
|
|
1291
|
+
const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1069
1292
|
provider: "anthropic",
|
|
1070
1293
|
providerOptions: part.providerOptions,
|
|
1071
1294
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -1106,7 +1329,17 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1106
1329
|
}
|
|
1107
1330
|
case "tool-call": {
|
|
1108
1331
|
if (part.providerExecuted) {
|
|
1109
|
-
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") {
|
|
1110
1343
|
anthropicContent.push({
|
|
1111
1344
|
type: "server_tool_use",
|
|
1112
1345
|
id: part.toolCallId,
|
|
@@ -1141,21 +1374,48 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1141
1374
|
});
|
|
1142
1375
|
break;
|
|
1143
1376
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
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
|
+
}
|
|
1159
1419
|
break;
|
|
1160
1420
|
}
|
|
1161
1421
|
if (part.toolName === "web_fetch") {
|
|
@@ -1167,7 +1427,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1167
1427
|
});
|
|
1168
1428
|
break;
|
|
1169
1429
|
}
|
|
1170
|
-
const webFetchOutput = await (0,
|
|
1430
|
+
const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1171
1431
|
value: output.value,
|
|
1172
1432
|
schema: webFetch_20250910OutputSchema
|
|
1173
1433
|
});
|
|
@@ -1202,7 +1462,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1202
1462
|
});
|
|
1203
1463
|
break;
|
|
1204
1464
|
}
|
|
1205
|
-
const webSearchOutput = await (0,
|
|
1465
|
+
const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1206
1466
|
value: output.value,
|
|
1207
1467
|
schema: webSearch_20250305OutputSchema
|
|
1208
1468
|
});
|
|
@@ -1347,7 +1607,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1347
1607
|
var _a;
|
|
1348
1608
|
this.modelId = modelId;
|
|
1349
1609
|
this.config = config;
|
|
1350
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
1610
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
|
|
1351
1611
|
}
|
|
1352
1612
|
supportsUrl(url) {
|
|
1353
1613
|
return url.protocol === "https:";
|
|
@@ -1416,7 +1676,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1416
1676
|
description: "Respond with a JSON object.",
|
|
1417
1677
|
inputSchema: responseFormat.schema
|
|
1418
1678
|
} : void 0;
|
|
1419
|
-
const anthropicOptions = await (0,
|
|
1679
|
+
const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
|
|
1420
1680
|
provider: "anthropic",
|
|
1421
1681
|
providerOptions,
|
|
1422
1682
|
schema: anthropicProviderOptions
|
|
@@ -1508,8 +1768,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1508
1768
|
betas,
|
|
1509
1769
|
headers
|
|
1510
1770
|
}) {
|
|
1511
|
-
return (0,
|
|
1512
|
-
await (0,
|
|
1771
|
+
return (0, import_provider_utils11.combineHeaders)(
|
|
1772
|
+
await (0, import_provider_utils11.resolve)(this.config.headers),
|
|
1513
1773
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {},
|
|
1514
1774
|
headers
|
|
1515
1775
|
);
|
|
@@ -1553,12 +1813,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1553
1813
|
responseHeaders,
|
|
1554
1814
|
value: response,
|
|
1555
1815
|
rawValue: rawResponse
|
|
1556
|
-
} = await (0,
|
|
1816
|
+
} = await (0, import_provider_utils11.postJsonToApi)({
|
|
1557
1817
|
url: this.buildRequestUrl(false),
|
|
1558
1818
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1559
1819
|
body: this.transformRequestBody(args),
|
|
1560
1820
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1561
|
-
successfulResponseHandler: (0,
|
|
1821
|
+
successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
|
|
1562
1822
|
anthropicMessagesResponseSchema
|
|
1563
1823
|
),
|
|
1564
1824
|
abortSignal: options.abortSignal,
|
|
@@ -1625,7 +1885,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1625
1885
|
break;
|
|
1626
1886
|
}
|
|
1627
1887
|
case "server_tool_use": {
|
|
1628
|
-
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") {
|
|
1629
1897
|
content.push({
|
|
1630
1898
|
type: "tool-call",
|
|
1631
1899
|
toolCallId: part.id,
|
|
@@ -1721,6 +1989,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1721
1989
|
}
|
|
1722
1990
|
break;
|
|
1723
1991
|
}
|
|
1992
|
+
// code execution 20250522:
|
|
1724
1993
|
case "code_execution_tool_result": {
|
|
1725
1994
|
if (part.content.type === "code_execution_result") {
|
|
1726
1995
|
content.push({
|
|
@@ -1750,6 +2019,18 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1750
2019
|
}
|
|
1751
2020
|
break;
|
|
1752
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
|
+
}
|
|
1753
2034
|
}
|
|
1754
2035
|
}
|
|
1755
2036
|
return {
|
|
@@ -1785,12 +2066,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1785
2066
|
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
|
|
1786
2067
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
1787
2068
|
const body = { ...args, stream: true };
|
|
1788
|
-
const { responseHeaders, value: response } = await (0,
|
|
2069
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
|
|
1789
2070
|
url: this.buildRequestUrl(true),
|
|
1790
2071
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1791
2072
|
body: this.transformRequestBody(body),
|
|
1792
2073
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1793
|
-
successfulResponseHandler: (0,
|
|
2074
|
+
successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
|
|
1794
2075
|
anthropicMessagesChunkSchema
|
|
1795
2076
|
),
|
|
1796
2077
|
abortSignal: options.abortSignal,
|
|
@@ -1866,7 +2147,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1866
2147
|
type: "tool-call",
|
|
1867
2148
|
toolCallId: value.content_block.id,
|
|
1868
2149
|
toolName: value.content_block.name,
|
|
1869
|
-
input: ""
|
|
2150
|
+
input: "",
|
|
2151
|
+
firstDelta: true
|
|
1870
2152
|
};
|
|
1871
2153
|
controller.enqueue(
|
|
1872
2154
|
usesJsonResponseTool ? { type: "text-start", id: String(value.index) } : {
|
|
@@ -1878,18 +2160,29 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1878
2160
|
return;
|
|
1879
2161
|
}
|
|
1880
2162
|
case "server_tool_use": {
|
|
1881
|
-
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)) {
|
|
1882
2173
|
contentBlocks[value.index] = {
|
|
1883
2174
|
type: "tool-call",
|
|
1884
2175
|
toolCallId: value.content_block.id,
|
|
1885
2176
|
toolName: value.content_block.name,
|
|
1886
2177
|
input: "",
|
|
1887
|
-
providerExecuted: true
|
|
2178
|
+
providerExecuted: true,
|
|
2179
|
+
firstDelta: true
|
|
1888
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;
|
|
1889
2182
|
controller.enqueue({
|
|
1890
2183
|
type: "tool-input-start",
|
|
1891
2184
|
id: value.content_block.id,
|
|
1892
|
-
toolName:
|
|
2185
|
+
toolName: mappedToolName,
|
|
1893
2186
|
providerExecuted: true
|
|
1894
2187
|
});
|
|
1895
2188
|
}
|
|
@@ -1981,6 +2274,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1981
2274
|
}
|
|
1982
2275
|
return;
|
|
1983
2276
|
}
|
|
2277
|
+
// code execution 20250522:
|
|
1984
2278
|
case "code_execution_tool_result": {
|
|
1985
2279
|
const part = value.content_block;
|
|
1986
2280
|
if (part.content.type === "code_execution_result") {
|
|
@@ -2011,6 +2305,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2011
2305
|
}
|
|
2012
2306
|
return;
|
|
2013
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
|
+
}
|
|
2014
2321
|
default: {
|
|
2015
2322
|
const _exhaustiveCheck = contentBlockType;
|
|
2016
2323
|
throw new Error(
|
|
@@ -2043,7 +2350,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2043
2350
|
type: "tool-input-end",
|
|
2044
2351
|
id: contentBlock.toolCallId
|
|
2045
2352
|
});
|
|
2046
|
-
|
|
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
|
+
});
|
|
2047
2361
|
}
|
|
2048
2362
|
break;
|
|
2049
2363
|
}
|
|
@@ -2091,7 +2405,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2091
2405
|
}
|
|
2092
2406
|
case "input_json_delta": {
|
|
2093
2407
|
const contentBlock = contentBlocks[value.index];
|
|
2094
|
-
|
|
2408
|
+
let delta = value.delta.partial_json;
|
|
2409
|
+
if (delta.length === 0) {
|
|
2410
|
+
return;
|
|
2411
|
+
}
|
|
2095
2412
|
if (usesJsonResponseTool) {
|
|
2096
2413
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "text") {
|
|
2097
2414
|
return;
|
|
@@ -2105,12 +2422,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2105
2422
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
2106
2423
|
return;
|
|
2107
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
|
+
}
|
|
2108
2428
|
controller.enqueue({
|
|
2109
2429
|
type: "tool-input-delta",
|
|
2110
2430
|
id: contentBlock.toolCallId,
|
|
2111
2431
|
delta
|
|
2112
2432
|
});
|
|
2113
2433
|
contentBlock.input += delta;
|
|
2434
|
+
contentBlock.firstDelta = false;
|
|
2114
2435
|
}
|
|
2115
2436
|
return;
|
|
2116
2437
|
}
|
|
@@ -2196,46 +2517,46 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2196
2517
|
};
|
|
2197
2518
|
|
|
2198
2519
|
// src/tool/bash_20241022.ts
|
|
2199
|
-
var
|
|
2200
|
-
var
|
|
2201
|
-
var bash_20241022InputSchema = (0,
|
|
2202
|
-
() => (0,
|
|
2203
|
-
|
|
2204
|
-
command:
|
|
2205
|
-
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()
|
|
2206
2527
|
})
|
|
2207
2528
|
)
|
|
2208
2529
|
);
|
|
2209
|
-
var bash_20241022 = (0,
|
|
2530
|
+
var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
|
|
2210
2531
|
id: "anthropic.bash_20241022",
|
|
2211
2532
|
name: "bash",
|
|
2212
2533
|
inputSchema: bash_20241022InputSchema
|
|
2213
2534
|
});
|
|
2214
2535
|
|
|
2215
2536
|
// src/tool/bash_20250124.ts
|
|
2216
|
-
var
|
|
2217
|
-
var
|
|
2218
|
-
var bash_20250124InputSchema = (0,
|
|
2219
|
-
() => (0,
|
|
2220
|
-
|
|
2221
|
-
command:
|
|
2222
|
-
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()
|
|
2223
2544
|
})
|
|
2224
2545
|
)
|
|
2225
2546
|
);
|
|
2226
|
-
var bash_20250124 = (0,
|
|
2547
|
+
var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2227
2548
|
id: "anthropic.bash_20250124",
|
|
2228
2549
|
name: "bash",
|
|
2229
2550
|
inputSchema: bash_20250124InputSchema
|
|
2230
2551
|
});
|
|
2231
2552
|
|
|
2232
2553
|
// src/tool/computer_20241022.ts
|
|
2233
|
-
var
|
|
2234
|
-
var
|
|
2235
|
-
var computer_20241022InputSchema = (0,
|
|
2236
|
-
() => (0,
|
|
2237
|
-
|
|
2238
|
-
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([
|
|
2239
2560
|
"key",
|
|
2240
2561
|
"type",
|
|
2241
2562
|
"mouse_move",
|
|
@@ -2247,24 +2568,24 @@ var computer_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
|
2247
2568
|
"screenshot",
|
|
2248
2569
|
"cursor_position"
|
|
2249
2570
|
]),
|
|
2250
|
-
coordinate:
|
|
2251
|
-
text:
|
|
2571
|
+
coordinate: import_v411.z.array(import_v411.z.number().int()).optional(),
|
|
2572
|
+
text: import_v411.z.string().optional()
|
|
2252
2573
|
})
|
|
2253
2574
|
)
|
|
2254
2575
|
);
|
|
2255
|
-
var computer_20241022 = (0,
|
|
2576
|
+
var computer_20241022 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2256
2577
|
id: "anthropic.computer_20241022",
|
|
2257
2578
|
name: "computer",
|
|
2258
2579
|
inputSchema: computer_20241022InputSchema
|
|
2259
2580
|
});
|
|
2260
2581
|
|
|
2261
2582
|
// src/tool/computer_20250124.ts
|
|
2262
|
-
var
|
|
2263
|
-
var
|
|
2264
|
-
var computer_20250124InputSchema = (0,
|
|
2265
|
-
() => (0,
|
|
2266
|
-
|
|
2267
|
-
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([
|
|
2268
2589
|
"key",
|
|
2269
2590
|
"hold_key",
|
|
2270
2591
|
"type",
|
|
@@ -2282,47 +2603,25 @@ var computer_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
2282
2603
|
"wait",
|
|
2283
2604
|
"screenshot"
|
|
2284
2605
|
]),
|
|
2285
|
-
coordinate:
|
|
2286
|
-
duration:
|
|
2287
|
-
scroll_amount:
|
|
2288
|
-
scroll_direction:
|
|
2289
|
-
start_coordinate:
|
|
2290
|
-
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()
|
|
2291
2612
|
})
|
|
2292
2613
|
)
|
|
2293
2614
|
);
|
|
2294
|
-
var computer_20250124 = (0,
|
|
2615
|
+
var computer_20250124 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
2295
2616
|
id: "anthropic.computer_20250124",
|
|
2296
2617
|
name: "computer",
|
|
2297
2618
|
inputSchema: computer_20250124InputSchema
|
|
2298
2619
|
});
|
|
2299
2620
|
|
|
2300
2621
|
// src/tool/text-editor_20241022.ts
|
|
2301
|
-
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2302
|
-
var import_v412 = require("zod/v4");
|
|
2303
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2304
|
-
() => (0, import_provider_utils15.zodSchema)(
|
|
2305
|
-
import_v412.z.object({
|
|
2306
|
-
command: import_v412.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2307
|
-
path: import_v412.z.string(),
|
|
2308
|
-
file_text: import_v412.z.string().optional(),
|
|
2309
|
-
insert_line: import_v412.z.number().int().optional(),
|
|
2310
|
-
new_str: import_v412.z.string().optional(),
|
|
2311
|
-
old_str: import_v412.z.string().optional(),
|
|
2312
|
-
view_range: import_v412.z.array(import_v412.z.number().int()).optional()
|
|
2313
|
-
})
|
|
2314
|
-
)
|
|
2315
|
-
);
|
|
2316
|
-
var textEditor_20241022 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
2317
|
-
id: "anthropic.text_editor_20241022",
|
|
2318
|
-
name: "str_replace_editor",
|
|
2319
|
-
inputSchema: textEditor_20241022InputSchema
|
|
2320
|
-
});
|
|
2321
|
-
|
|
2322
|
-
// src/tool/text-editor_20250124.ts
|
|
2323
2622
|
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2324
2623
|
var import_v413 = require("zod/v4");
|
|
2325
|
-
var
|
|
2624
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
2326
2625
|
() => (0, import_provider_utils16.zodSchema)(
|
|
2327
2626
|
import_v413.z.object({
|
|
2328
2627
|
command: import_v413.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -2335,19 +2634,19 @@ var textEditor_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
|
2335
2634
|
})
|
|
2336
2635
|
)
|
|
2337
2636
|
);
|
|
2338
|
-
var
|
|
2339
|
-
id: "anthropic.
|
|
2637
|
+
var textEditor_20241022 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
|
|
2638
|
+
id: "anthropic.text_editor_20241022",
|
|
2340
2639
|
name: "str_replace_editor",
|
|
2341
|
-
inputSchema:
|
|
2640
|
+
inputSchema: textEditor_20241022InputSchema
|
|
2342
2641
|
});
|
|
2343
2642
|
|
|
2344
|
-
// src/tool/text-
|
|
2643
|
+
// src/tool/text-editor_20250124.ts
|
|
2345
2644
|
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
2346
2645
|
var import_v414 = require("zod/v4");
|
|
2347
|
-
var
|
|
2646
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
2348
2647
|
() => (0, import_provider_utils17.zodSchema)(
|
|
2349
2648
|
import_v414.z.object({
|
|
2350
|
-
command: import_v414.z.enum(["view", "create", "str_replace", "insert"]),
|
|
2649
|
+
command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2351
2650
|
path: import_v414.z.string(),
|
|
2352
2651
|
file_text: import_v414.z.string().optional(),
|
|
2353
2652
|
insert_line: import_v414.z.number().int().optional(),
|
|
@@ -2357,7 +2656,29 @@ var textEditor_20250429InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
2357
2656
|
})
|
|
2358
2657
|
)
|
|
2359
2658
|
);
|
|
2360
|
-
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)({
|
|
2361
2682
|
id: "anthropic.text_editor_20250429",
|
|
2362
2683
|
name: "str_replace_based_edit_tool",
|
|
2363
2684
|
inputSchema: textEditor_20250429InputSchema
|
|
@@ -2394,6 +2715,19 @@ var anthropicTools = {
|
|
|
2394
2715
|
* Tool name must be `code_execution`.
|
|
2395
2716
|
*/
|
|
2396
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,
|
|
2397
2731
|
/**
|
|
2398
2732
|
* Claude can interact with computer environments through the computer use tool, which
|
|
2399
2733
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|