@ai-sdk/anthropic 2.0.102 → 2.0.103
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 +49 -1
- package/dist/index.d.ts +49 -1
- package/dist/index.js +732 -366
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +719 -349
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +67 -2
- package/dist/internal/index.d.ts +67 -2
- package/dist/internal/index.js +725 -359
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +718 -348
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.mjs
CHANGED
|
@@ -104,7 +104,9 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
104
104
|
type: z2.literal("tool_use"),
|
|
105
105
|
id: z2.string(),
|
|
106
106
|
name: z2.string(),
|
|
107
|
-
input: z2.unknown()
|
|
107
|
+
input: z2.unknown(),
|
|
108
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
109
|
+
toolset_name: z2.string().nullish()
|
|
108
110
|
}),
|
|
109
111
|
z2.object({
|
|
110
112
|
type: z2.literal("server_tool_use"),
|
|
@@ -331,7 +333,9 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
331
333
|
z2.object({
|
|
332
334
|
type: z2.literal("tool_use"),
|
|
333
335
|
id: z2.string(),
|
|
334
|
-
name: z2.string()
|
|
336
|
+
name: z2.string(),
|
|
337
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
338
|
+
toolset_name: z2.string().nullish()
|
|
335
339
|
}),
|
|
336
340
|
z2.object({
|
|
337
341
|
type: z2.literal("redacted_thinking"),
|
|
@@ -658,7 +662,7 @@ var anthropicSystemMessageProviderOptions = z3.object({
|
|
|
658
662
|
clearAt: z3.literal("next_user_message").optional(),
|
|
659
663
|
/**
|
|
660
664
|
* Overrides the effort for the turn following this mid-conversation system
|
|
661
|
-
* message. The required `mid-conversation-
|
|
665
|
+
* message. The required `mid-conversation-output-config-2026-07-01` beta is added
|
|
662
666
|
* automatically.
|
|
663
667
|
*/
|
|
664
668
|
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
@@ -709,7 +713,7 @@ var anthropicProviderOptions = z3.object({
|
|
|
709
713
|
*
|
|
710
714
|
* - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
|
|
711
715
|
* - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
|
|
712
|
-
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Fable 5.1).
|
|
716
|
+
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Opus 5.5 and Fable 5.1).
|
|
713
717
|
*/
|
|
714
718
|
structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
715
719
|
/**
|
|
@@ -717,6 +721,11 @@ var anthropicProviderOptions = z3.object({
|
|
|
717
721
|
*
|
|
718
722
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
719
723
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
724
|
+
*
|
|
725
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
726
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
727
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
728
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
720
729
|
*/
|
|
721
730
|
thinking: z3.union([
|
|
722
731
|
z3.object({
|
|
@@ -964,34 +973,99 @@ var CacheControlValidator = class {
|
|
|
964
973
|
}
|
|
965
974
|
};
|
|
966
975
|
|
|
967
|
-
// src/tool/
|
|
976
|
+
// src/tool/computer-toolset_20260801.ts
|
|
968
977
|
import {
|
|
969
978
|
createProviderDefinedToolFactory,
|
|
970
979
|
lazySchema as lazySchema3,
|
|
971
980
|
zodSchema as zodSchema3
|
|
972
981
|
} from "@ai-sdk/provider-utils";
|
|
973
982
|
import { z as z4 } from "zod/v4";
|
|
974
|
-
var
|
|
983
|
+
var computerToolset_20260801Members = [
|
|
984
|
+
"screenshot",
|
|
985
|
+
"zoom",
|
|
986
|
+
"left_click",
|
|
987
|
+
"right_click",
|
|
988
|
+
"middle_click",
|
|
989
|
+
"double_click",
|
|
990
|
+
"triple_click",
|
|
991
|
+
"left_click_drag",
|
|
992
|
+
"mouse_move",
|
|
993
|
+
"left_mouse_down",
|
|
994
|
+
"left_mouse_up",
|
|
995
|
+
"cursor_position",
|
|
996
|
+
"scroll",
|
|
997
|
+
"type",
|
|
998
|
+
"key",
|
|
999
|
+
"hold_key",
|
|
1000
|
+
"wait"
|
|
1001
|
+
];
|
|
1002
|
+
var computerToolset_20260801InputSchema = lazySchema3(
|
|
975
1003
|
() => zodSchema3(
|
|
976
1004
|
z4.object({
|
|
977
|
-
|
|
1005
|
+
action: z4.enum(computerToolset_20260801Members),
|
|
1006
|
+
coordinate: z4.tuple([z4.number().int(), z4.number().int()]).optional(),
|
|
1007
|
+
duration: z4.number().optional(),
|
|
1008
|
+
region: z4.tuple([
|
|
1009
|
+
z4.number().int(),
|
|
1010
|
+
z4.number().int(),
|
|
1011
|
+
z4.number().int(),
|
|
1012
|
+
z4.number().int()
|
|
1013
|
+
]).optional(),
|
|
1014
|
+
repeat: z4.number().int().optional(),
|
|
1015
|
+
scroll_amount: z4.number().optional(),
|
|
1016
|
+
scroll_direction: z4.enum(["up", "down", "left", "right"]).optional(),
|
|
1017
|
+
start_coordinate: z4.tuple([z4.number().int(), z4.number().int()]).optional(),
|
|
1018
|
+
text: z4.string().optional()
|
|
978
1019
|
})
|
|
979
1020
|
)
|
|
980
1021
|
);
|
|
981
|
-
var
|
|
1022
|
+
var computerToolset_20260801ArgsSchema = lazySchema3(
|
|
982
1023
|
() => zodSchema3(
|
|
983
1024
|
z4.object({
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1025
|
+
configs: z4.partialRecord(
|
|
1026
|
+
z4.enum(computerToolset_20260801Members),
|
|
1027
|
+
z4.object({
|
|
1028
|
+
enabled: z4.boolean().optional(),
|
|
1029
|
+
deferLoading: z4.boolean().optional()
|
|
1030
|
+
})
|
|
1031
|
+
).optional()
|
|
1032
|
+
})
|
|
1033
|
+
)
|
|
1034
|
+
);
|
|
1035
|
+
var computerToolset_20260801 = createProviderDefinedToolFactory({
|
|
1036
|
+
id: "anthropic.computer_toolset_20260801",
|
|
1037
|
+
name: "computer",
|
|
1038
|
+
inputSchema: computerToolset_20260801InputSchema
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
// src/tool/text-editor_20250728.ts
|
|
1042
|
+
import {
|
|
1043
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
|
|
1044
|
+
lazySchema as lazySchema4,
|
|
1045
|
+
zodSchema as zodSchema4
|
|
1046
|
+
} from "@ai-sdk/provider-utils";
|
|
1047
|
+
import { z as z5 } from "zod/v4";
|
|
1048
|
+
var textEditor_20250728ArgsSchema = lazySchema4(
|
|
1049
|
+
() => zodSchema4(
|
|
1050
|
+
z5.object({
|
|
1051
|
+
maxCharacters: z5.number().optional()
|
|
991
1052
|
})
|
|
992
1053
|
)
|
|
993
1054
|
);
|
|
994
|
-
var
|
|
1055
|
+
var textEditor_20250728InputSchema = lazySchema4(
|
|
1056
|
+
() => zodSchema4(
|
|
1057
|
+
z5.object({
|
|
1058
|
+
command: z5.enum(["view", "create", "str_replace", "insert"]),
|
|
1059
|
+
path: z5.string(),
|
|
1060
|
+
file_text: z5.string().optional(),
|
|
1061
|
+
insert_line: z5.number().int().optional(),
|
|
1062
|
+
new_str: z5.string().optional(),
|
|
1063
|
+
old_str: z5.string().optional(),
|
|
1064
|
+
view_range: z5.array(z5.number().int()).optional()
|
|
1065
|
+
})
|
|
1066
|
+
)
|
|
1067
|
+
);
|
|
1068
|
+
var factory = createProviderDefinedToolFactory2({
|
|
995
1069
|
id: "anthropic.text_editor_20250728",
|
|
996
1070
|
name: "str_replace_based_edit_tool",
|
|
997
1071
|
inputSchema: textEditor_20250728InputSchema
|
|
@@ -1003,43 +1077,43 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1003
1077
|
// src/tool/web-search_20250305.ts
|
|
1004
1078
|
import {
|
|
1005
1079
|
createProviderDefinedToolFactoryWithOutputSchema,
|
|
1006
|
-
lazySchema as
|
|
1007
|
-
zodSchema as
|
|
1080
|
+
lazySchema as lazySchema5,
|
|
1081
|
+
zodSchema as zodSchema5
|
|
1008
1082
|
} from "@ai-sdk/provider-utils";
|
|
1009
|
-
import { z as
|
|
1010
|
-
var webSearch_20250305ArgsSchema =
|
|
1011
|
-
() =>
|
|
1012
|
-
|
|
1013
|
-
maxUses:
|
|
1014
|
-
allowedDomains:
|
|
1015
|
-
blockedDomains:
|
|
1016
|
-
userLocation:
|
|
1017
|
-
type:
|
|
1018
|
-
city:
|
|
1019
|
-
region:
|
|
1020
|
-
country:
|
|
1021
|
-
timezone:
|
|
1083
|
+
import { z as z6 } from "zod/v4";
|
|
1084
|
+
var webSearch_20250305ArgsSchema = lazySchema5(
|
|
1085
|
+
() => zodSchema5(
|
|
1086
|
+
z6.object({
|
|
1087
|
+
maxUses: z6.number().optional(),
|
|
1088
|
+
allowedDomains: z6.array(z6.string()).optional(),
|
|
1089
|
+
blockedDomains: z6.array(z6.string()).optional(),
|
|
1090
|
+
userLocation: z6.object({
|
|
1091
|
+
type: z6.literal("approximate"),
|
|
1092
|
+
city: z6.string().optional(),
|
|
1093
|
+
region: z6.string().optional(),
|
|
1094
|
+
country: z6.string().optional(),
|
|
1095
|
+
timezone: z6.string().optional()
|
|
1022
1096
|
}).optional()
|
|
1023
1097
|
})
|
|
1024
1098
|
)
|
|
1025
1099
|
);
|
|
1026
|
-
var webSearch_20250305OutputSchema =
|
|
1027
|
-
() =>
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
url:
|
|
1031
|
-
title:
|
|
1032
|
-
pageAge:
|
|
1033
|
-
encryptedContent:
|
|
1034
|
-
type:
|
|
1100
|
+
var webSearch_20250305OutputSchema = lazySchema5(
|
|
1101
|
+
() => zodSchema5(
|
|
1102
|
+
z6.array(
|
|
1103
|
+
z6.object({
|
|
1104
|
+
url: z6.string(),
|
|
1105
|
+
title: z6.string().nullable(),
|
|
1106
|
+
pageAge: z6.string().nullable(),
|
|
1107
|
+
encryptedContent: z6.string(),
|
|
1108
|
+
type: z6.literal("web_search_result")
|
|
1035
1109
|
})
|
|
1036
1110
|
)
|
|
1037
1111
|
)
|
|
1038
1112
|
);
|
|
1039
|
-
var webSearch_20250305InputSchema =
|
|
1040
|
-
() =>
|
|
1041
|
-
|
|
1042
|
-
query:
|
|
1113
|
+
var webSearch_20250305InputSchema = lazySchema5(
|
|
1114
|
+
() => zodSchema5(
|
|
1115
|
+
z6.object({
|
|
1116
|
+
query: z6.string()
|
|
1043
1117
|
})
|
|
1044
1118
|
)
|
|
1045
1119
|
);
|
|
@@ -1056,51 +1130,51 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1056
1130
|
// src/tool/web-fetch-20250910.ts
|
|
1057
1131
|
import {
|
|
1058
1132
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
|
|
1059
|
-
lazySchema as
|
|
1060
|
-
zodSchema as
|
|
1133
|
+
lazySchema as lazySchema6,
|
|
1134
|
+
zodSchema as zodSchema6
|
|
1061
1135
|
} from "@ai-sdk/provider-utils";
|
|
1062
|
-
import { z as
|
|
1063
|
-
var webFetch_20250910ArgsSchema =
|
|
1064
|
-
() =>
|
|
1065
|
-
|
|
1066
|
-
maxUses:
|
|
1067
|
-
allowedDomains:
|
|
1068
|
-
blockedDomains:
|
|
1069
|
-
citations:
|
|
1070
|
-
maxContentTokens:
|
|
1136
|
+
import { z as z7 } from "zod/v4";
|
|
1137
|
+
var webFetch_20250910ArgsSchema = lazySchema6(
|
|
1138
|
+
() => zodSchema6(
|
|
1139
|
+
z7.object({
|
|
1140
|
+
maxUses: z7.number().optional(),
|
|
1141
|
+
allowedDomains: z7.array(z7.string()).optional(),
|
|
1142
|
+
blockedDomains: z7.array(z7.string()).optional(),
|
|
1143
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1144
|
+
maxContentTokens: z7.number().optional()
|
|
1071
1145
|
})
|
|
1072
1146
|
)
|
|
1073
1147
|
);
|
|
1074
|
-
var webFetch_20250910OutputSchema =
|
|
1075
|
-
() =>
|
|
1076
|
-
|
|
1077
|
-
type:
|
|
1078
|
-
url:
|
|
1079
|
-
content:
|
|
1080
|
-
type:
|
|
1081
|
-
title:
|
|
1082
|
-
citations:
|
|
1083
|
-
source:
|
|
1084
|
-
|
|
1085
|
-
type:
|
|
1086
|
-
mediaType:
|
|
1087
|
-
data:
|
|
1148
|
+
var webFetch_20250910OutputSchema = lazySchema6(
|
|
1149
|
+
() => zodSchema6(
|
|
1150
|
+
z7.object({
|
|
1151
|
+
type: z7.literal("web_fetch_result"),
|
|
1152
|
+
url: z7.string(),
|
|
1153
|
+
content: z7.object({
|
|
1154
|
+
type: z7.literal("document"),
|
|
1155
|
+
title: z7.string().nullable(),
|
|
1156
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1157
|
+
source: z7.union([
|
|
1158
|
+
z7.object({
|
|
1159
|
+
type: z7.literal("base64"),
|
|
1160
|
+
mediaType: z7.literal("application/pdf"),
|
|
1161
|
+
data: z7.string()
|
|
1088
1162
|
}),
|
|
1089
|
-
|
|
1090
|
-
type:
|
|
1091
|
-
mediaType:
|
|
1092
|
-
data:
|
|
1163
|
+
z7.object({
|
|
1164
|
+
type: z7.literal("text"),
|
|
1165
|
+
mediaType: z7.literal("text/plain"),
|
|
1166
|
+
data: z7.string()
|
|
1093
1167
|
})
|
|
1094
1168
|
])
|
|
1095
1169
|
}),
|
|
1096
|
-
retrievedAt:
|
|
1170
|
+
retrievedAt: z7.string().nullable()
|
|
1097
1171
|
})
|
|
1098
1172
|
)
|
|
1099
1173
|
);
|
|
1100
|
-
var webFetch_20250910InputSchema =
|
|
1101
|
-
() =>
|
|
1102
|
-
|
|
1103
|
-
url:
|
|
1174
|
+
var webFetch_20250910InputSchema = lazySchema6(
|
|
1175
|
+
() => zodSchema6(
|
|
1176
|
+
z7.object({
|
|
1177
|
+
url: z7.string()
|
|
1104
1178
|
})
|
|
1105
1179
|
)
|
|
1106
1180
|
);
|
|
@@ -1120,7 +1194,8 @@ async function prepareTools({
|
|
|
1120
1194
|
tools,
|
|
1121
1195
|
toolChoice,
|
|
1122
1196
|
disableParallelToolUse,
|
|
1123
|
-
cacheControlValidator
|
|
1197
|
+
cacheControlValidator,
|
|
1198
|
+
rejectsForcedToolUse = false
|
|
1124
1199
|
}) {
|
|
1125
1200
|
var _a;
|
|
1126
1201
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -1175,6 +1250,31 @@ async function prepareTools({
|
|
|
1175
1250
|
});
|
|
1176
1251
|
break;
|
|
1177
1252
|
}
|
|
1253
|
+
case "anthropic.computer_toolset_20260801": {
|
|
1254
|
+
const args = await validateTypes({
|
|
1255
|
+
value: tool.args,
|
|
1256
|
+
schema: computerToolset_20260801ArgsSchema
|
|
1257
|
+
});
|
|
1258
|
+
const configs = args.configs != null ? Object.fromEntries(
|
|
1259
|
+
Object.entries(args.configs).map(([member, config]) => [
|
|
1260
|
+
member,
|
|
1261
|
+
{
|
|
1262
|
+
...(config == null ? void 0 : config.enabled) != null && {
|
|
1263
|
+
enabled: config.enabled
|
|
1264
|
+
},
|
|
1265
|
+
...(config == null ? void 0 : config.deferLoading) != null && {
|
|
1266
|
+
defer_loading: config.deferLoading
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
])
|
|
1270
|
+
) : void 0;
|
|
1271
|
+
anthropicTools2.push({
|
|
1272
|
+
type: "computer_toolset_20260801",
|
|
1273
|
+
...configs != null && { configs },
|
|
1274
|
+
cache_control: void 0
|
|
1275
|
+
});
|
|
1276
|
+
break;
|
|
1277
|
+
}
|
|
1178
1278
|
case "anthropic.computer_20250124": {
|
|
1179
1279
|
betas.add("computer-use-2025-01-24");
|
|
1180
1280
|
anthropicTools2.push({
|
|
@@ -1333,6 +1433,22 @@ async function prepareTools({
|
|
|
1333
1433
|
betas
|
|
1334
1434
|
};
|
|
1335
1435
|
case "required":
|
|
1436
|
+
if (rejectsForcedToolUse) {
|
|
1437
|
+
toolWarnings.push({
|
|
1438
|
+
type: "unsupported-setting",
|
|
1439
|
+
setting: "toolChoice",
|
|
1440
|
+
details: `toolChoice 'required' is not supported by this model because it rejects forced tool use. Using 'auto' instead. Instruct the model to use a tool in the prompt and verify that a tool call was made.`
|
|
1441
|
+
});
|
|
1442
|
+
return {
|
|
1443
|
+
tools: anthropicTools2,
|
|
1444
|
+
toolChoice: {
|
|
1445
|
+
type: "auto",
|
|
1446
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
1447
|
+
},
|
|
1448
|
+
toolWarnings,
|
|
1449
|
+
betas
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1336
1452
|
return {
|
|
1337
1453
|
tools: anthropicTools2,
|
|
1338
1454
|
toolChoice: {
|
|
@@ -1345,6 +1461,24 @@ async function prepareTools({
|
|
|
1345
1461
|
case "none":
|
|
1346
1462
|
return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
|
|
1347
1463
|
case "tool":
|
|
1464
|
+
if (rejectsForcedToolUse) {
|
|
1465
|
+
toolWarnings.push({
|
|
1466
|
+
type: "unsupported-setting",
|
|
1467
|
+
setting: "toolChoice",
|
|
1468
|
+
details: `toolChoice 'tool' is not supported by this model because it rejects forced tool use. Only the '${toolChoice.toolName}' tool is sent with 'auto' tool choice. Instruct the model to use the tool in the prompt and verify that a tool call was made.`
|
|
1469
|
+
});
|
|
1470
|
+
return {
|
|
1471
|
+
tools: anthropicTools2.filter(
|
|
1472
|
+
(tool) => "name" in tool && tool.name === toolChoice.toolName
|
|
1473
|
+
),
|
|
1474
|
+
toolChoice: {
|
|
1475
|
+
type: "auto",
|
|
1476
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
1477
|
+
},
|
|
1478
|
+
toolWarnings,
|
|
1479
|
+
betas
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1348
1482
|
return {
|
|
1349
1483
|
tools: anthropicTools2,
|
|
1350
1484
|
toolChoice: {
|
|
@@ -1377,24 +1511,24 @@ import {
|
|
|
1377
1511
|
// src/tool/code-execution_20250522.ts
|
|
1378
1512
|
import {
|
|
1379
1513
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
|
|
1380
|
-
lazySchema as
|
|
1381
|
-
zodSchema as
|
|
1514
|
+
lazySchema as lazySchema7,
|
|
1515
|
+
zodSchema as zodSchema7
|
|
1382
1516
|
} from "@ai-sdk/provider-utils";
|
|
1383
|
-
import { z as
|
|
1384
|
-
var codeExecution_20250522OutputSchema =
|
|
1385
|
-
() =>
|
|
1386
|
-
|
|
1387
|
-
type:
|
|
1388
|
-
stdout:
|
|
1389
|
-
stderr:
|
|
1390
|
-
return_code:
|
|
1517
|
+
import { z as z8 } from "zod/v4";
|
|
1518
|
+
var codeExecution_20250522OutputSchema = lazySchema7(
|
|
1519
|
+
() => zodSchema7(
|
|
1520
|
+
z8.object({
|
|
1521
|
+
type: z8.literal("code_execution_result"),
|
|
1522
|
+
stdout: z8.string(),
|
|
1523
|
+
stderr: z8.string(),
|
|
1524
|
+
return_code: z8.number()
|
|
1391
1525
|
})
|
|
1392
1526
|
)
|
|
1393
1527
|
);
|
|
1394
|
-
var codeExecution_20250522InputSchema =
|
|
1395
|
-
() =>
|
|
1396
|
-
|
|
1397
|
-
code:
|
|
1528
|
+
var codeExecution_20250522InputSchema = lazySchema7(
|
|
1529
|
+
() => zodSchema7(
|
|
1530
|
+
z8.object({
|
|
1531
|
+
code: z8.string()
|
|
1398
1532
|
})
|
|
1399
1533
|
)
|
|
1400
1534
|
);
|
|
@@ -1411,81 +1545,81 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1411
1545
|
// src/tool/code-execution_20250825.ts
|
|
1412
1546
|
import {
|
|
1413
1547
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
|
|
1414
|
-
lazySchema as
|
|
1415
|
-
zodSchema as
|
|
1548
|
+
lazySchema as lazySchema8,
|
|
1549
|
+
zodSchema as zodSchema8
|
|
1416
1550
|
} from "@ai-sdk/provider-utils";
|
|
1417
|
-
import { z as
|
|
1418
|
-
var codeExecution_20250825OutputSchema =
|
|
1419
|
-
() =>
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
type:
|
|
1423
|
-
content:
|
|
1424
|
-
|
|
1425
|
-
type:
|
|
1426
|
-
file_id:
|
|
1551
|
+
import { z as z9 } from "zod/v4";
|
|
1552
|
+
var codeExecution_20250825OutputSchema = lazySchema8(
|
|
1553
|
+
() => zodSchema8(
|
|
1554
|
+
z9.discriminatedUnion("type", [
|
|
1555
|
+
z9.object({
|
|
1556
|
+
type: z9.literal("bash_code_execution_result"),
|
|
1557
|
+
content: z9.array(
|
|
1558
|
+
z9.object({
|
|
1559
|
+
type: z9.literal("bash_code_execution_output"),
|
|
1560
|
+
file_id: z9.string()
|
|
1427
1561
|
})
|
|
1428
1562
|
),
|
|
1429
|
-
stdout:
|
|
1430
|
-
stderr:
|
|
1431
|
-
return_code:
|
|
1563
|
+
stdout: z9.string(),
|
|
1564
|
+
stderr: z9.string(),
|
|
1565
|
+
return_code: z9.number()
|
|
1432
1566
|
}),
|
|
1433
|
-
|
|
1434
|
-
type:
|
|
1435
|
-
error_code:
|
|
1567
|
+
z9.object({
|
|
1568
|
+
type: z9.literal("bash_code_execution_tool_result_error"),
|
|
1569
|
+
error_code: z9.string()
|
|
1436
1570
|
}),
|
|
1437
|
-
|
|
1438
|
-
type:
|
|
1439
|
-
error_code:
|
|
1571
|
+
z9.object({
|
|
1572
|
+
type: z9.literal("text_editor_code_execution_tool_result_error"),
|
|
1573
|
+
error_code: z9.string()
|
|
1440
1574
|
}),
|
|
1441
|
-
|
|
1442
|
-
type:
|
|
1443
|
-
content:
|
|
1444
|
-
file_type:
|
|
1445
|
-
num_lines:
|
|
1446
|
-
start_line:
|
|
1447
|
-
total_lines:
|
|
1575
|
+
z9.object({
|
|
1576
|
+
type: z9.literal("text_editor_code_execution_view_result"),
|
|
1577
|
+
content: z9.string(),
|
|
1578
|
+
file_type: z9.string(),
|
|
1579
|
+
num_lines: z9.number().nullable(),
|
|
1580
|
+
start_line: z9.number().nullable(),
|
|
1581
|
+
total_lines: z9.number().nullable()
|
|
1448
1582
|
}),
|
|
1449
|
-
|
|
1450
|
-
type:
|
|
1451
|
-
is_file_update:
|
|
1583
|
+
z9.object({
|
|
1584
|
+
type: z9.literal("text_editor_code_execution_create_result"),
|
|
1585
|
+
is_file_update: z9.boolean()
|
|
1452
1586
|
}),
|
|
1453
|
-
|
|
1454
|
-
type:
|
|
1455
|
-
lines:
|
|
1456
|
-
new_lines:
|
|
1457
|
-
new_start:
|
|
1458
|
-
old_lines:
|
|
1459
|
-
old_start:
|
|
1587
|
+
z9.object({
|
|
1588
|
+
type: z9.literal("text_editor_code_execution_str_replace_result"),
|
|
1589
|
+
lines: z9.array(z9.string()).nullable(),
|
|
1590
|
+
new_lines: z9.number().nullable(),
|
|
1591
|
+
new_start: z9.number().nullable(),
|
|
1592
|
+
old_lines: z9.number().nullable(),
|
|
1593
|
+
old_start: z9.number().nullable()
|
|
1460
1594
|
})
|
|
1461
1595
|
])
|
|
1462
1596
|
)
|
|
1463
1597
|
);
|
|
1464
|
-
var codeExecution_20250825InputSchema =
|
|
1465
|
-
() =>
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
type:
|
|
1469
|
-
command:
|
|
1598
|
+
var codeExecution_20250825InputSchema = lazySchema8(
|
|
1599
|
+
() => zodSchema8(
|
|
1600
|
+
z9.discriminatedUnion("type", [
|
|
1601
|
+
z9.object({
|
|
1602
|
+
type: z9.literal("bash_code_execution"),
|
|
1603
|
+
command: z9.string()
|
|
1470
1604
|
}),
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
type:
|
|
1474
|
-
command:
|
|
1475
|
-
path:
|
|
1605
|
+
z9.discriminatedUnion("command", [
|
|
1606
|
+
z9.object({
|
|
1607
|
+
type: z9.literal("text_editor_code_execution"),
|
|
1608
|
+
command: z9.literal("view"),
|
|
1609
|
+
path: z9.string()
|
|
1476
1610
|
}),
|
|
1477
|
-
|
|
1478
|
-
type:
|
|
1479
|
-
command:
|
|
1480
|
-
path:
|
|
1481
|
-
file_text:
|
|
1611
|
+
z9.object({
|
|
1612
|
+
type: z9.literal("text_editor_code_execution"),
|
|
1613
|
+
command: z9.literal("create"),
|
|
1614
|
+
path: z9.string(),
|
|
1615
|
+
file_text: z9.string().nullish()
|
|
1482
1616
|
}),
|
|
1483
|
-
|
|
1484
|
-
type:
|
|
1485
|
-
command:
|
|
1486
|
-
path:
|
|
1487
|
-
old_str:
|
|
1488
|
-
new_str:
|
|
1617
|
+
z9.object({
|
|
1618
|
+
type: z9.literal("text_editor_code_execution"),
|
|
1619
|
+
command: z9.literal("str_replace"),
|
|
1620
|
+
path: z9.string(),
|
|
1621
|
+
old_str: z9.string(),
|
|
1622
|
+
new_str: z9.string()
|
|
1489
1623
|
})
|
|
1490
1624
|
])
|
|
1491
1625
|
])
|
|
@@ -1522,7 +1656,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1522
1656
|
prompt,
|
|
1523
1657
|
sendReasoning,
|
|
1524
1658
|
warnings,
|
|
1525
|
-
cacheControlValidator
|
|
1659
|
+
cacheControlValidator,
|
|
1660
|
+
toolsetNames = {}
|
|
1526
1661
|
}) {
|
|
1527
1662
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1528
1663
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -1616,7 +1751,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1616
1751
|
betas.add("mid-conversation-system-clear-at-2026-08-21");
|
|
1617
1752
|
}
|
|
1618
1753
|
if (effort != null) {
|
|
1619
|
-
betas.add("mid-conversation-
|
|
1754
|
+
betas.add("mid-conversation-output-config-2026-07-01");
|
|
1620
1755
|
}
|
|
1621
1756
|
}
|
|
1622
1757
|
break;
|
|
@@ -1781,9 +1916,15 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1781
1916
|
contentValue = JSON.stringify(output.value);
|
|
1782
1917
|
break;
|
|
1783
1918
|
}
|
|
1919
|
+
const toolsetName = getAnthropicToolsetName({
|
|
1920
|
+
toolName: part.toolName,
|
|
1921
|
+
providerOptions: part.providerOptions,
|
|
1922
|
+
toolsetNames
|
|
1923
|
+
});
|
|
1784
1924
|
anthropicContent.push({
|
|
1785
1925
|
type: "tool_result",
|
|
1786
1926
|
tool_use_id: part.toolCallId,
|
|
1927
|
+
...toolsetName != null && { toolset_name: toolsetName },
|
|
1787
1928
|
content: contentValue,
|
|
1788
1929
|
is_error: output.type === "error-text" || output.type === "error-json" ? true : void 0,
|
|
1789
1930
|
cache_control: cacheControl
|
|
@@ -1918,6 +2059,30 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1918
2059
|
}
|
|
1919
2060
|
break;
|
|
1920
2061
|
}
|
|
2062
|
+
const toolsetName = getAnthropicToolsetName({
|
|
2063
|
+
toolName: part.toolName,
|
|
2064
|
+
providerOptions: part.providerOptions,
|
|
2065
|
+
toolsetNames
|
|
2066
|
+
});
|
|
2067
|
+
if (toolsetName != null) {
|
|
2068
|
+
const { action, ...memberInput } = typeof part.input === "object" && part.input !== null && !Array.isArray(part.input) ? part.input : {};
|
|
2069
|
+
if (typeof action !== "string") {
|
|
2070
|
+
warnings.push({
|
|
2071
|
+
type: "other",
|
|
2072
|
+
message: `toolset tool call for tool ${part.toolName} is missing the action`
|
|
2073
|
+
});
|
|
2074
|
+
break;
|
|
2075
|
+
}
|
|
2076
|
+
anthropicContent.push({
|
|
2077
|
+
type: "tool_use",
|
|
2078
|
+
id: part.toolCallId,
|
|
2079
|
+
name: action,
|
|
2080
|
+
toolset_name: toolsetName,
|
|
2081
|
+
input: memberInput,
|
|
2082
|
+
cache_control: cacheControl
|
|
2083
|
+
});
|
|
2084
|
+
break;
|
|
2085
|
+
}
|
|
1921
2086
|
anthropicContent.push({
|
|
1922
2087
|
type: "tool_use",
|
|
1923
2088
|
id: part.toolCallId,
|
|
@@ -2144,6 +2309,19 @@ function moveToolUseBlocksToEnd(content) {
|
|
|
2144
2309
|
flushSegment();
|
|
2145
2310
|
return result;
|
|
2146
2311
|
}
|
|
2312
|
+
function getAnthropicToolsetName({
|
|
2313
|
+
toolName,
|
|
2314
|
+
providerOptions,
|
|
2315
|
+
toolsetNames
|
|
2316
|
+
}) {
|
|
2317
|
+
var _a;
|
|
2318
|
+
const fromTools = toolsetNames[toolName];
|
|
2319
|
+
if (fromTools != null) {
|
|
2320
|
+
return fromTools;
|
|
2321
|
+
}
|
|
2322
|
+
const fromMetadata = (_a = providerOptions == null ? void 0 : providerOptions.anthropic) == null ? void 0 : _a.toolsetName;
|
|
2323
|
+
return typeof fromMetadata === "string" ? fromMetadata : void 0;
|
|
2324
|
+
}
|
|
2147
2325
|
|
|
2148
2326
|
// src/map-anthropic-stop-reason.ts
|
|
2149
2327
|
function mapAnthropicStopReason({
|
|
@@ -2315,6 +2493,24 @@ function isPlainObject(value) {
|
|
|
2315
2493
|
}
|
|
2316
2494
|
|
|
2317
2495
|
// src/anthropic-messages-language-model.ts
|
|
2496
|
+
function getAnthropicToolsetNames(tools) {
|
|
2497
|
+
const toolsetNames = {};
|
|
2498
|
+
for (const tool of tools != null ? tools : []) {
|
|
2499
|
+
if (tool.type === "provider-defined" && tool.id === "anthropic.computer_toolset_20260801") {
|
|
2500
|
+
toolsetNames[tool.name] = "computer";
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
return toolsetNames;
|
|
2504
|
+
}
|
|
2505
|
+
function toToolsetMemberInput({
|
|
2506
|
+
memberName,
|
|
2507
|
+
input
|
|
2508
|
+
}) {
|
|
2509
|
+
return {
|
|
2510
|
+
action: memberName,
|
|
2511
|
+
...typeof input === "object" && input !== null && !Array.isArray(input) ? input : {}
|
|
2512
|
+
};
|
|
2513
|
+
}
|
|
2318
2514
|
function getJsonResponseToolName(tools) {
|
|
2319
2515
|
const toolNames = new Set(tools == null ? void 0 : tools.map((tool) => tool.name));
|
|
2320
2516
|
let name = "json";
|
|
@@ -2441,6 +2637,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2441
2637
|
supportsStructuredOutput,
|
|
2442
2638
|
rejectsSamplingParameters,
|
|
2443
2639
|
rejectsThinkingDisabledAboveHighEffort,
|
|
2640
|
+
rejectsThinkingDisabled,
|
|
2641
|
+
rejectsForcedToolUse,
|
|
2444
2642
|
isKnownModel
|
|
2445
2643
|
} = getModelCapabilities(this.modelId);
|
|
2446
2644
|
if (!isKnownModel && maxOutputTokens == null) {
|
|
@@ -2476,8 +2674,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2476
2674
|
}
|
|
2477
2675
|
}
|
|
2478
2676
|
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
2479
|
-
const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") ? "auto" : "jsonTool";
|
|
2480
|
-
|
|
2677
|
+
const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") || this.modelId.includes("claude-opus-5-5") ? "auto" : "jsonTool";
|
|
2678
|
+
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
2679
|
+
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
2680
|
+
warnings.push({
|
|
2681
|
+
type: "unsupported-setting",
|
|
2682
|
+
setting: "providerOptions.anthropic.structuredOutputMode",
|
|
2683
|
+
details: `structuredOutputMode 'jsonTool' is not supported by ${this.modelId} because it rejects forced tool use. Using 'outputFormat' instead.`
|
|
2684
|
+
});
|
|
2685
|
+
useStructuredOutput = true;
|
|
2686
|
+
}
|
|
2481
2687
|
const jsonResponseToolName = getJsonResponseToolName(tools);
|
|
2482
2688
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
2483
2689
|
type: "function",
|
|
@@ -2493,12 +2699,37 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2493
2699
|
});
|
|
2494
2700
|
}
|
|
2495
2701
|
const cacheControlValidator = new CacheControlValidator();
|
|
2702
|
+
const toolsetNames = getAnthropicToolsetNames(tools);
|
|
2496
2703
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
2497
2704
|
prompt,
|
|
2498
2705
|
sendReasoning: (_b = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _b : true,
|
|
2499
2706
|
warnings,
|
|
2500
|
-
cacheControlValidator
|
|
2707
|
+
cacheControlValidator,
|
|
2708
|
+
toolsetNames
|
|
2501
2709
|
});
|
|
2710
|
+
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
2711
|
+
const thinking = anthropicOptions.thinking;
|
|
2712
|
+
if ("type" in thinking && thinking.type === "disabled") {
|
|
2713
|
+
warnings.push({
|
|
2714
|
+
type: "unsupported-setting",
|
|
2715
|
+
setting: "providerOptions.anthropic.thinking",
|
|
2716
|
+
details: `thinking cannot be disabled for ${this.modelId}; it always uses adaptive thinking. The thinking setting has been removed. Lower 'effort' to reduce thinking.`
|
|
2717
|
+
});
|
|
2718
|
+
anthropicOptions.thinking = void 0;
|
|
2719
|
+
} else if ("type" in thinking && thinking.type === "enabled") {
|
|
2720
|
+
warnings.push({
|
|
2721
|
+
type: "unsupported-setting",
|
|
2722
|
+
setting: "providerOptions.anthropic.thinking",
|
|
2723
|
+
details: `budget-based thinking is not supported by ${this.modelId}; it always uses adaptive thinking. Using adaptive thinking instead. Use 'effort' to control how much the model thinks.`
|
|
2724
|
+
});
|
|
2725
|
+
anthropicOptions.thinking = {
|
|
2726
|
+
type: "adaptive",
|
|
2727
|
+
...thinking.blockBinding != null && {
|
|
2728
|
+
blockBinding: thinking.blockBinding
|
|
2729
|
+
}
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2502
2733
|
const thinkingOptions = anthropicOptions == null ? void 0 : anthropicOptions.thinking;
|
|
2503
2734
|
const thinkingType = thinkingOptions != null && "type" in thinkingOptions ? thinkingOptions.type : void 0;
|
|
2504
2735
|
if (rejectsThinkingDisabledAboveHighEffort && thinkingType === "disabled" && anthropicOptions != null && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
@@ -2740,12 +2971,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2740
2971
|
tools: [...tools != null ? tools : [], jsonResponseTool],
|
|
2741
2972
|
toolChoice: tools != null && tools.length > 0 ? { type: "required" } : { type: "tool", toolName: jsonResponseTool.name },
|
|
2742
2973
|
disableParallelToolUse: true,
|
|
2743
|
-
cacheControlValidator
|
|
2974
|
+
cacheControlValidator,
|
|
2975
|
+
rejectsForcedToolUse
|
|
2744
2976
|
} : {
|
|
2745
2977
|
tools: tools != null ? tools : [],
|
|
2746
2978
|
toolChoice,
|
|
2747
2979
|
disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
|
|
2748
|
-
cacheControlValidator
|
|
2980
|
+
cacheControlValidator,
|
|
2981
|
+
rejectsForcedToolUse
|
|
2749
2982
|
}
|
|
2750
2983
|
);
|
|
2751
2984
|
const cacheWarnings = cacheControlValidator.getWarnings();
|
|
@@ -2919,6 +3152,21 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2919
3152
|
type: "text",
|
|
2920
3153
|
text: JSON.stringify(part.input)
|
|
2921
3154
|
});
|
|
3155
|
+
} else if (part.toolset_name != null) {
|
|
3156
|
+
content.push({
|
|
3157
|
+
type: "tool-call",
|
|
3158
|
+
toolCallId: part.id,
|
|
3159
|
+
toolName: part.toolset_name,
|
|
3160
|
+
input: JSON.stringify(
|
|
3161
|
+
toToolsetMemberInput({
|
|
3162
|
+
memberName: part.name,
|
|
3163
|
+
input: part.input
|
|
3164
|
+
})
|
|
3165
|
+
),
|
|
3166
|
+
providerMetadata: {
|
|
3167
|
+
anthropic: { toolsetName: part.toolset_name }
|
|
3168
|
+
}
|
|
3169
|
+
});
|
|
2922
3170
|
} else {
|
|
2923
3171
|
content.push({
|
|
2924
3172
|
type: "tool-call",
|
|
@@ -3303,6 +3551,23 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3303
3551
|
type: "text-start",
|
|
3304
3552
|
id: String(value.index)
|
|
3305
3553
|
});
|
|
3554
|
+
} else if (value.content_block.toolset_name != null) {
|
|
3555
|
+
contentBlocks[value.index] = {
|
|
3556
|
+
type: "tool-call",
|
|
3557
|
+
toolCallId: value.content_block.id,
|
|
3558
|
+
toolName: value.content_block.toolset_name,
|
|
3559
|
+
input: "",
|
|
3560
|
+
firstDelta: true,
|
|
3561
|
+
toolset: {
|
|
3562
|
+
name: value.content_block.toolset_name,
|
|
3563
|
+
memberName: value.content_block.name
|
|
3564
|
+
}
|
|
3565
|
+
};
|
|
3566
|
+
controller.enqueue({
|
|
3567
|
+
type: "tool-input-start",
|
|
3568
|
+
id: value.content_block.id,
|
|
3569
|
+
toolName: value.content_block.toolset_name
|
|
3570
|
+
});
|
|
3306
3571
|
} else {
|
|
3307
3572
|
contentBlocks[value.index] = {
|
|
3308
3573
|
type: "tool-call",
|
|
@@ -3513,6 +3778,25 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3513
3778
|
break;
|
|
3514
3779
|
}
|
|
3515
3780
|
case "tool-call": {
|
|
3781
|
+
if (contentBlock.toolset != null) {
|
|
3782
|
+
let memberInput = {};
|
|
3783
|
+
try {
|
|
3784
|
+
memberInput = contentBlock.input === "" ? {} : JSON.parse(contentBlock.input);
|
|
3785
|
+
} catch (e) {
|
|
3786
|
+
memberInput = void 0;
|
|
3787
|
+
}
|
|
3788
|
+
contentBlock.input = memberInput === void 0 ? contentBlock.input : JSON.stringify(
|
|
3789
|
+
toToolsetMemberInput({
|
|
3790
|
+
memberName: contentBlock.toolset.memberName,
|
|
3791
|
+
input: memberInput
|
|
3792
|
+
})
|
|
3793
|
+
);
|
|
3794
|
+
controller.enqueue({
|
|
3795
|
+
type: "tool-input-delta",
|
|
3796
|
+
id: contentBlock.toolCallId,
|
|
3797
|
+
delta: contentBlock.input
|
|
3798
|
+
});
|
|
3799
|
+
}
|
|
3516
3800
|
controller.enqueue({
|
|
3517
3801
|
type: "tool-input-end",
|
|
3518
3802
|
id: contentBlock.toolCallId
|
|
@@ -3523,7 +3807,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3523
3807
|
toolCallId: contentBlock.toolCallId,
|
|
3524
3808
|
toolName,
|
|
3525
3809
|
input: contentBlock.input === "" ? "{}" : contentBlock.input,
|
|
3526
|
-
providerExecuted: contentBlock.providerExecuted
|
|
3810
|
+
providerExecuted: contentBlock.providerExecuted,
|
|
3811
|
+
...contentBlock.toolset && {
|
|
3812
|
+
providerMetadata: {
|
|
3813
|
+
anthropic: { toolsetName: contentBlock.toolset.name }
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3527
3816
|
});
|
|
3528
3817
|
break;
|
|
3529
3818
|
}
|
|
@@ -3596,6 +3885,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3596
3885
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
3597
3886
|
return;
|
|
3598
3887
|
}
|
|
3888
|
+
if (contentBlock.toolset != null) {
|
|
3889
|
+
contentBlock.input += delta;
|
|
3890
|
+
return;
|
|
3891
|
+
}
|
|
3599
3892
|
if (contentBlock.firstDelta && (contentBlock.toolName === "bash_code_execution" || contentBlock.toolName === "text_editor_code_execution")) {
|
|
3600
3893
|
delta = `{"type": "${contentBlock.toolName}",${delta.substring(1)}`;
|
|
3601
3894
|
}
|
|
@@ -3812,20 +4105,54 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3812
4105
|
}
|
|
3813
4106
|
};
|
|
3814
4107
|
function getModelCapabilities(modelId) {
|
|
3815
|
-
if (modelId.includes("claude-opus-5")) {
|
|
4108
|
+
if (modelId.includes("claude-opus-5-5")) {
|
|
3816
4109
|
return {
|
|
3817
4110
|
maxOutputTokens: 128e3,
|
|
3818
4111
|
supportsStructuredOutput: true,
|
|
3819
4112
|
rejectsSamplingParameters: true,
|
|
3820
4113
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4114
|
+
rejectsThinkingDisabled: true,
|
|
4115
|
+
rejectsForcedToolUse: true,
|
|
4116
|
+
isKnownModel: true
|
|
4117
|
+
};
|
|
4118
|
+
} else if (modelId.includes("claude-opus-5")) {
|
|
4119
|
+
return {
|
|
4120
|
+
maxOutputTokens: 128e3,
|
|
4121
|
+
supportsStructuredOutput: true,
|
|
4122
|
+
rejectsSamplingParameters: true,
|
|
4123
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4124
|
+
rejectsThinkingDisabled: false,
|
|
4125
|
+
rejectsForcedToolUse: false,
|
|
4126
|
+
isKnownModel: true
|
|
4127
|
+
};
|
|
4128
|
+
} else if (modelId.includes("claude-fable-5-1")) {
|
|
4129
|
+
return {
|
|
4130
|
+
maxOutputTokens: 128e3,
|
|
4131
|
+
supportsStructuredOutput: true,
|
|
4132
|
+
rejectsSamplingParameters: true,
|
|
4133
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4134
|
+
rejectsThinkingDisabled: true,
|
|
4135
|
+
rejectsForcedToolUse: true,
|
|
4136
|
+
isKnownModel: true
|
|
4137
|
+
};
|
|
4138
|
+
} else if (modelId.includes("claude-fable-5")) {
|
|
4139
|
+
return {
|
|
4140
|
+
maxOutputTokens: 128e3,
|
|
4141
|
+
supportsStructuredOutput: true,
|
|
4142
|
+
rejectsSamplingParameters: true,
|
|
4143
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4144
|
+
rejectsThinkingDisabled: true,
|
|
4145
|
+
rejectsForcedToolUse: false,
|
|
3821
4146
|
isKnownModel: true
|
|
3822
4147
|
};
|
|
3823
|
-
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-
|
|
4148
|
+
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) {
|
|
3824
4149
|
return {
|
|
3825
4150
|
maxOutputTokens: 128e3,
|
|
3826
4151
|
supportsStructuredOutput: true,
|
|
3827
4152
|
rejectsSamplingParameters: true,
|
|
3828
4153
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4154
|
+
rejectsThinkingDisabled: false,
|
|
4155
|
+
rejectsForcedToolUse: false,
|
|
3829
4156
|
isKnownModel: true
|
|
3830
4157
|
};
|
|
3831
4158
|
} else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
|
|
@@ -3834,6 +4161,8 @@ function getModelCapabilities(modelId) {
|
|
|
3834
4161
|
supportsStructuredOutput: true,
|
|
3835
4162
|
rejectsSamplingParameters: false,
|
|
3836
4163
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4164
|
+
rejectsThinkingDisabled: false,
|
|
4165
|
+
rejectsForcedToolUse: false,
|
|
3837
4166
|
isKnownModel: true
|
|
3838
4167
|
};
|
|
3839
4168
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
@@ -3842,6 +4171,8 @@ function getModelCapabilities(modelId) {
|
|
|
3842
4171
|
supportsStructuredOutput: true,
|
|
3843
4172
|
rejectsSamplingParameters: false,
|
|
3844
4173
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4174
|
+
rejectsThinkingDisabled: false,
|
|
4175
|
+
rejectsForcedToolUse: false,
|
|
3845
4176
|
isKnownModel: true
|
|
3846
4177
|
};
|
|
3847
4178
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
@@ -3850,6 +4181,8 @@ function getModelCapabilities(modelId) {
|
|
|
3850
4181
|
supportsStructuredOutput: true,
|
|
3851
4182
|
rejectsSamplingParameters: false,
|
|
3852
4183
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4184
|
+
rejectsThinkingDisabled: false,
|
|
4185
|
+
rejectsForcedToolUse: false,
|
|
3853
4186
|
isKnownModel: true
|
|
3854
4187
|
};
|
|
3855
4188
|
} else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet")) {
|
|
@@ -3858,6 +4191,8 @@ function getModelCapabilities(modelId) {
|
|
|
3858
4191
|
supportsStructuredOutput: false,
|
|
3859
4192
|
rejectsSamplingParameters: false,
|
|
3860
4193
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4194
|
+
rejectsThinkingDisabled: false,
|
|
4195
|
+
rejectsForcedToolUse: false,
|
|
3861
4196
|
isKnownModel: true
|
|
3862
4197
|
};
|
|
3863
4198
|
} else if (modelId.includes("claude-opus-4-")) {
|
|
@@ -3866,6 +4201,8 @@ function getModelCapabilities(modelId) {
|
|
|
3866
4201
|
supportsStructuredOutput: false,
|
|
3867
4202
|
rejectsSamplingParameters: false,
|
|
3868
4203
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4204
|
+
rejectsThinkingDisabled: false,
|
|
4205
|
+
rejectsForcedToolUse: false,
|
|
3869
4206
|
isKnownModel: true
|
|
3870
4207
|
};
|
|
3871
4208
|
} else if (modelId.includes("claude-3-haiku")) {
|
|
@@ -3874,6 +4211,8 @@ function getModelCapabilities(modelId) {
|
|
|
3874
4211
|
supportsStructuredOutput: false,
|
|
3875
4212
|
rejectsSamplingParameters: false,
|
|
3876
4213
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4214
|
+
rejectsThinkingDisabled: false,
|
|
4215
|
+
rejectsForcedToolUse: false,
|
|
3877
4216
|
isKnownModel: true
|
|
3878
4217
|
};
|
|
3879
4218
|
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
@@ -3882,6 +4221,8 @@ function getModelCapabilities(modelId) {
|
|
|
3882
4221
|
supportsStructuredOutput: false,
|
|
3883
4222
|
rejectsSamplingParameters: false,
|
|
3884
4223
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4224
|
+
rejectsThinkingDisabled: false,
|
|
4225
|
+
rejectsForcedToolUse: false,
|
|
3885
4226
|
isKnownModel: false
|
|
3886
4227
|
};
|
|
3887
4228
|
} else if (modelId.includes("claude-")) {
|
|
@@ -3890,6 +4231,8 @@ function getModelCapabilities(modelId) {
|
|
|
3890
4231
|
supportsStructuredOutput: true,
|
|
3891
4232
|
rejectsSamplingParameters: true,
|
|
3892
4233
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4234
|
+
rejectsThinkingDisabled: false,
|
|
4235
|
+
rejectsForcedToolUse: false,
|
|
3893
4236
|
isKnownModel: false
|
|
3894
4237
|
};
|
|
3895
4238
|
} else {
|
|
@@ -3898,6 +4241,8 @@ function getModelCapabilities(modelId) {
|
|
|
3898
4241
|
supportsStructuredOutput: false,
|
|
3899
4242
|
rejectsSamplingParameters: false,
|
|
3900
4243
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4244
|
+
rejectsThinkingDisabled: false,
|
|
4245
|
+
rejectsForcedToolUse: false,
|
|
3901
4246
|
isKnownModel: false
|
|
3902
4247
|
};
|
|
3903
4248
|
}
|
|
@@ -3916,20 +4261,20 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
3916
4261
|
|
|
3917
4262
|
// src/tool/bash_20241022.ts
|
|
3918
4263
|
import {
|
|
3919
|
-
createProviderDefinedToolFactory as
|
|
3920
|
-
lazySchema as
|
|
3921
|
-
zodSchema as
|
|
4264
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory3,
|
|
4265
|
+
lazySchema as lazySchema9,
|
|
4266
|
+
zodSchema as zodSchema9
|
|
3922
4267
|
} from "@ai-sdk/provider-utils";
|
|
3923
|
-
import { z as
|
|
3924
|
-
var bash_20241022InputSchema =
|
|
3925
|
-
() =>
|
|
3926
|
-
|
|
3927
|
-
command:
|
|
3928
|
-
restart:
|
|
4268
|
+
import { z as z10 } from "zod/v4";
|
|
4269
|
+
var bash_20241022InputSchema = lazySchema9(
|
|
4270
|
+
() => zodSchema9(
|
|
4271
|
+
z10.object({
|
|
4272
|
+
command: z10.string(),
|
|
4273
|
+
restart: z10.boolean().optional()
|
|
3929
4274
|
})
|
|
3930
4275
|
)
|
|
3931
4276
|
);
|
|
3932
|
-
var bash_20241022 =
|
|
4277
|
+
var bash_20241022 = createProviderDefinedToolFactory3({
|
|
3933
4278
|
id: "anthropic.bash_20241022",
|
|
3934
4279
|
name: "bash",
|
|
3935
4280
|
inputSchema: bash_20241022InputSchema
|
|
@@ -3937,20 +4282,20 @@ var bash_20241022 = createProviderDefinedToolFactory2({
|
|
|
3937
4282
|
|
|
3938
4283
|
// src/tool/bash_20250124.ts
|
|
3939
4284
|
import {
|
|
3940
|
-
createProviderDefinedToolFactory as
|
|
3941
|
-
lazySchema as
|
|
3942
|
-
zodSchema as
|
|
4285
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
|
|
4286
|
+
lazySchema as lazySchema10,
|
|
4287
|
+
zodSchema as zodSchema10
|
|
3943
4288
|
} from "@ai-sdk/provider-utils";
|
|
3944
|
-
import { z as
|
|
3945
|
-
var bash_20250124InputSchema =
|
|
3946
|
-
() =>
|
|
3947
|
-
|
|
3948
|
-
command:
|
|
3949
|
-
restart:
|
|
4289
|
+
import { z as z11 } from "zod/v4";
|
|
4290
|
+
var bash_20250124InputSchema = lazySchema10(
|
|
4291
|
+
() => zodSchema10(
|
|
4292
|
+
z11.object({
|
|
4293
|
+
command: z11.string(),
|
|
4294
|
+
restart: z11.boolean().optional()
|
|
3950
4295
|
})
|
|
3951
4296
|
)
|
|
3952
4297
|
);
|
|
3953
|
-
var bash_20250124 =
|
|
4298
|
+
var bash_20250124 = createProviderDefinedToolFactory4({
|
|
3954
4299
|
id: "anthropic.bash_20250124",
|
|
3955
4300
|
name: "bash",
|
|
3956
4301
|
inputSchema: bash_20250124InputSchema
|
|
@@ -3959,97 +4304,97 @@ var bash_20250124 = createProviderDefinedToolFactory3({
|
|
|
3959
4304
|
// src/tool/code-execution_20260120.ts
|
|
3960
4305
|
import {
|
|
3961
4306
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
|
|
3962
|
-
lazySchema as
|
|
3963
|
-
zodSchema as
|
|
4307
|
+
lazySchema as lazySchema11,
|
|
4308
|
+
zodSchema as zodSchema11
|
|
3964
4309
|
} from "@ai-sdk/provider-utils";
|
|
3965
|
-
import { z as
|
|
3966
|
-
var codeExecution_20260120OutputSchema =
|
|
3967
|
-
() =>
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
type:
|
|
3971
|
-
stdout:
|
|
3972
|
-
stderr:
|
|
3973
|
-
return_code:
|
|
3974
|
-
content:
|
|
3975
|
-
|
|
3976
|
-
type:
|
|
3977
|
-
file_id:
|
|
4310
|
+
import { z as z12 } from "zod/v4";
|
|
4311
|
+
var codeExecution_20260120OutputSchema = lazySchema11(
|
|
4312
|
+
() => zodSchema11(
|
|
4313
|
+
z12.discriminatedUnion("type", [
|
|
4314
|
+
z12.object({
|
|
4315
|
+
type: z12.literal("code_execution_result"),
|
|
4316
|
+
stdout: z12.string(),
|
|
4317
|
+
stderr: z12.string(),
|
|
4318
|
+
return_code: z12.number(),
|
|
4319
|
+
content: z12.array(
|
|
4320
|
+
z12.object({
|
|
4321
|
+
type: z12.literal("code_execution_output"),
|
|
4322
|
+
file_id: z12.string()
|
|
3978
4323
|
})
|
|
3979
4324
|
).optional().default([])
|
|
3980
4325
|
}),
|
|
3981
|
-
|
|
3982
|
-
type:
|
|
3983
|
-
content:
|
|
3984
|
-
|
|
3985
|
-
type:
|
|
3986
|
-
file_id:
|
|
4326
|
+
z12.object({
|
|
4327
|
+
type: z12.literal("bash_code_execution_result"),
|
|
4328
|
+
content: z12.array(
|
|
4329
|
+
z12.object({
|
|
4330
|
+
type: z12.literal("bash_code_execution_output"),
|
|
4331
|
+
file_id: z12.string()
|
|
3987
4332
|
})
|
|
3988
4333
|
),
|
|
3989
|
-
stdout:
|
|
3990
|
-
stderr:
|
|
3991
|
-
return_code:
|
|
4334
|
+
stdout: z12.string(),
|
|
4335
|
+
stderr: z12.string(),
|
|
4336
|
+
return_code: z12.number()
|
|
3992
4337
|
}),
|
|
3993
|
-
|
|
3994
|
-
type:
|
|
3995
|
-
error_code:
|
|
4338
|
+
z12.object({
|
|
4339
|
+
type: z12.literal("bash_code_execution_tool_result_error"),
|
|
4340
|
+
error_code: z12.string()
|
|
3996
4341
|
}),
|
|
3997
|
-
|
|
3998
|
-
type:
|
|
3999
|
-
error_code:
|
|
4342
|
+
z12.object({
|
|
4343
|
+
type: z12.literal("text_editor_code_execution_tool_result_error"),
|
|
4344
|
+
error_code: z12.string()
|
|
4000
4345
|
}),
|
|
4001
|
-
|
|
4002
|
-
type:
|
|
4003
|
-
content:
|
|
4004
|
-
file_type:
|
|
4005
|
-
num_lines:
|
|
4006
|
-
start_line:
|
|
4007
|
-
total_lines:
|
|
4346
|
+
z12.object({
|
|
4347
|
+
type: z12.literal("text_editor_code_execution_view_result"),
|
|
4348
|
+
content: z12.string(),
|
|
4349
|
+
file_type: z12.string(),
|
|
4350
|
+
num_lines: z12.number().nullable(),
|
|
4351
|
+
start_line: z12.number().nullable(),
|
|
4352
|
+
total_lines: z12.number().nullable()
|
|
4008
4353
|
}),
|
|
4009
|
-
|
|
4010
|
-
type:
|
|
4011
|
-
is_file_update:
|
|
4354
|
+
z12.object({
|
|
4355
|
+
type: z12.literal("text_editor_code_execution_create_result"),
|
|
4356
|
+
is_file_update: z12.boolean()
|
|
4012
4357
|
}),
|
|
4013
|
-
|
|
4014
|
-
type:
|
|
4015
|
-
lines:
|
|
4016
|
-
new_lines:
|
|
4017
|
-
new_start:
|
|
4018
|
-
old_lines:
|
|
4019
|
-
old_start:
|
|
4358
|
+
z12.object({
|
|
4359
|
+
type: z12.literal("text_editor_code_execution_str_replace_result"),
|
|
4360
|
+
lines: z12.array(z12.string()).nullable(),
|
|
4361
|
+
new_lines: z12.number().nullable(),
|
|
4362
|
+
new_start: z12.number().nullable(),
|
|
4363
|
+
old_lines: z12.number().nullable(),
|
|
4364
|
+
old_start: z12.number().nullable()
|
|
4020
4365
|
})
|
|
4021
4366
|
])
|
|
4022
4367
|
)
|
|
4023
4368
|
);
|
|
4024
|
-
var codeExecution_20260120InputSchema =
|
|
4025
|
-
() =>
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
type:
|
|
4029
|
-
code:
|
|
4369
|
+
var codeExecution_20260120InputSchema = lazySchema11(
|
|
4370
|
+
() => zodSchema11(
|
|
4371
|
+
z12.discriminatedUnion("type", [
|
|
4372
|
+
z12.object({
|
|
4373
|
+
type: z12.literal("programmatic-tool-call"),
|
|
4374
|
+
code: z12.string()
|
|
4030
4375
|
}),
|
|
4031
|
-
|
|
4032
|
-
type:
|
|
4033
|
-
command:
|
|
4376
|
+
z12.object({
|
|
4377
|
+
type: z12.literal("bash_code_execution"),
|
|
4378
|
+
command: z12.string()
|
|
4034
4379
|
}),
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
type:
|
|
4038
|
-
command:
|
|
4039
|
-
path:
|
|
4380
|
+
z12.discriminatedUnion("command", [
|
|
4381
|
+
z12.object({
|
|
4382
|
+
type: z12.literal("text_editor_code_execution"),
|
|
4383
|
+
command: z12.literal("view"),
|
|
4384
|
+
path: z12.string()
|
|
4040
4385
|
}),
|
|
4041
|
-
|
|
4042
|
-
type:
|
|
4043
|
-
command:
|
|
4044
|
-
path:
|
|
4045
|
-
file_text:
|
|
4386
|
+
z12.object({
|
|
4387
|
+
type: z12.literal("text_editor_code_execution"),
|
|
4388
|
+
command: z12.literal("create"),
|
|
4389
|
+
path: z12.string(),
|
|
4390
|
+
file_text: z12.string().nullish()
|
|
4046
4391
|
}),
|
|
4047
|
-
|
|
4048
|
-
type:
|
|
4049
|
-
command:
|
|
4050
|
-
path:
|
|
4051
|
-
old_str:
|
|
4052
|
-
new_str:
|
|
4392
|
+
z12.object({
|
|
4393
|
+
type: z12.literal("text_editor_code_execution"),
|
|
4394
|
+
command: z12.literal("str_replace"),
|
|
4395
|
+
path: z12.string(),
|
|
4396
|
+
old_str: z12.string(),
|
|
4397
|
+
new_str: z12.string()
|
|
4053
4398
|
})
|
|
4054
4399
|
])
|
|
4055
4400
|
])
|
|
@@ -4067,15 +4412,15 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
4067
4412
|
|
|
4068
4413
|
// src/tool/computer_20241022.ts
|
|
4069
4414
|
import {
|
|
4070
|
-
createProviderDefinedToolFactory as
|
|
4071
|
-
lazySchema as
|
|
4072
|
-
zodSchema as
|
|
4415
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
|
|
4416
|
+
lazySchema as lazySchema12,
|
|
4417
|
+
zodSchema as zodSchema12
|
|
4073
4418
|
} from "@ai-sdk/provider-utils";
|
|
4074
|
-
import { z as
|
|
4075
|
-
var computer_20241022InputSchema =
|
|
4076
|
-
() =>
|
|
4077
|
-
|
|
4078
|
-
action:
|
|
4419
|
+
import { z as z13 } from "zod/v4";
|
|
4420
|
+
var computer_20241022InputSchema = lazySchema12(
|
|
4421
|
+
() => zodSchema12(
|
|
4422
|
+
z13.object({
|
|
4423
|
+
action: z13.enum([
|
|
4079
4424
|
"key",
|
|
4080
4425
|
"type",
|
|
4081
4426
|
"mouse_move",
|
|
@@ -4087,12 +4432,12 @@ var computer_20241022InputSchema = lazySchema11(
|
|
|
4087
4432
|
"screenshot",
|
|
4088
4433
|
"cursor_position"
|
|
4089
4434
|
]),
|
|
4090
|
-
coordinate:
|
|
4091
|
-
text:
|
|
4435
|
+
coordinate: z13.array(z13.number().int()).optional(),
|
|
4436
|
+
text: z13.string().optional()
|
|
4092
4437
|
})
|
|
4093
4438
|
)
|
|
4094
4439
|
);
|
|
4095
|
-
var computer_20241022 =
|
|
4440
|
+
var computer_20241022 = createProviderDefinedToolFactory5({
|
|
4096
4441
|
id: "anthropic.computer_20241022",
|
|
4097
4442
|
name: "computer",
|
|
4098
4443
|
inputSchema: computer_20241022InputSchema
|
|
@@ -4100,15 +4445,15 @@ var computer_20241022 = createProviderDefinedToolFactory4({
|
|
|
4100
4445
|
|
|
4101
4446
|
// src/tool/computer_20250124.ts
|
|
4102
4447
|
import {
|
|
4103
|
-
createProviderDefinedToolFactory as
|
|
4104
|
-
lazySchema as
|
|
4105
|
-
zodSchema as
|
|
4448
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory6,
|
|
4449
|
+
lazySchema as lazySchema13,
|
|
4450
|
+
zodSchema as zodSchema13
|
|
4106
4451
|
} from "@ai-sdk/provider-utils";
|
|
4107
|
-
import { z as
|
|
4108
|
-
var computer_20250124InputSchema =
|
|
4109
|
-
() =>
|
|
4110
|
-
|
|
4111
|
-
action:
|
|
4452
|
+
import { z as z14 } from "zod/v4";
|
|
4453
|
+
var computer_20250124InputSchema = lazySchema13(
|
|
4454
|
+
() => zodSchema13(
|
|
4455
|
+
z14.object({
|
|
4456
|
+
action: z14.enum([
|
|
4112
4457
|
"key",
|
|
4113
4458
|
"hold_key",
|
|
4114
4459
|
"type",
|
|
@@ -4126,16 +4471,16 @@ var computer_20250124InputSchema = lazySchema12(
|
|
|
4126
4471
|
"wait",
|
|
4127
4472
|
"screenshot"
|
|
4128
4473
|
]),
|
|
4129
|
-
coordinate:
|
|
4130
|
-
duration:
|
|
4131
|
-
scroll_amount:
|
|
4132
|
-
scroll_direction:
|
|
4133
|
-
start_coordinate:
|
|
4134
|
-
text:
|
|
4474
|
+
coordinate: z14.tuple([z14.number().int(), z14.number().int()]).optional(),
|
|
4475
|
+
duration: z14.number().optional(),
|
|
4476
|
+
scroll_amount: z14.number().optional(),
|
|
4477
|
+
scroll_direction: z14.enum(["up", "down", "left", "right"]).optional(),
|
|
4478
|
+
start_coordinate: z14.tuple([z14.number().int(), z14.number().int()]).optional(),
|
|
4479
|
+
text: z14.string().optional()
|
|
4135
4480
|
})
|
|
4136
4481
|
)
|
|
4137
4482
|
);
|
|
4138
|
-
var computer_20250124 =
|
|
4483
|
+
var computer_20250124 = createProviderDefinedToolFactory6({
|
|
4139
4484
|
id: "anthropic.computer_20250124",
|
|
4140
4485
|
name: "computer",
|
|
4141
4486
|
inputSchema: computer_20250124InputSchema
|
|
@@ -4143,88 +4488,62 @@ var computer_20250124 = createProviderDefinedToolFactory5({
|
|
|
4143
4488
|
|
|
4144
4489
|
// src/tool/memory_20250818.ts
|
|
4145
4490
|
import {
|
|
4146
|
-
createProviderDefinedToolFactory as
|
|
4147
|
-
lazySchema as
|
|
4148
|
-
zodSchema as
|
|
4491
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
|
|
4492
|
+
lazySchema as lazySchema14,
|
|
4493
|
+
zodSchema as zodSchema14
|
|
4149
4494
|
} from "@ai-sdk/provider-utils";
|
|
4150
|
-
import { z as
|
|
4151
|
-
var memory_20250818InputSchema =
|
|
4152
|
-
() =>
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
command:
|
|
4156
|
-
path:
|
|
4157
|
-
view_range:
|
|
4495
|
+
import { z as z15 } from "zod/v4";
|
|
4496
|
+
var memory_20250818InputSchema = lazySchema14(
|
|
4497
|
+
() => zodSchema14(
|
|
4498
|
+
z15.discriminatedUnion("command", [
|
|
4499
|
+
z15.object({
|
|
4500
|
+
command: z15.literal("view"),
|
|
4501
|
+
path: z15.string(),
|
|
4502
|
+
view_range: z15.tuple([z15.number(), z15.number()]).optional()
|
|
4158
4503
|
}),
|
|
4159
|
-
|
|
4160
|
-
command:
|
|
4161
|
-
path:
|
|
4162
|
-
file_text:
|
|
4504
|
+
z15.object({
|
|
4505
|
+
command: z15.literal("create"),
|
|
4506
|
+
path: z15.string(),
|
|
4507
|
+
file_text: z15.string()
|
|
4163
4508
|
}),
|
|
4164
|
-
|
|
4165
|
-
command:
|
|
4166
|
-
path:
|
|
4167
|
-
old_str:
|
|
4168
|
-
new_str:
|
|
4509
|
+
z15.object({
|
|
4510
|
+
command: z15.literal("str_replace"),
|
|
4511
|
+
path: z15.string(),
|
|
4512
|
+
old_str: z15.string(),
|
|
4513
|
+
new_str: z15.string()
|
|
4169
4514
|
}),
|
|
4170
|
-
|
|
4171
|
-
command:
|
|
4172
|
-
path:
|
|
4173
|
-
insert_line:
|
|
4174
|
-
insert_text:
|
|
4515
|
+
z15.object({
|
|
4516
|
+
command: z15.literal("insert"),
|
|
4517
|
+
path: z15.string(),
|
|
4518
|
+
insert_line: z15.number(),
|
|
4519
|
+
insert_text: z15.string()
|
|
4175
4520
|
}),
|
|
4176
|
-
|
|
4177
|
-
command:
|
|
4178
|
-
path:
|
|
4521
|
+
z15.object({
|
|
4522
|
+
command: z15.literal("delete"),
|
|
4523
|
+
path: z15.string()
|
|
4179
4524
|
}),
|
|
4180
|
-
|
|
4181
|
-
command:
|
|
4182
|
-
old_path:
|
|
4183
|
-
new_path:
|
|
4525
|
+
z15.object({
|
|
4526
|
+
command: z15.literal("rename"),
|
|
4527
|
+
old_path: z15.string(),
|
|
4528
|
+
new_path: z15.string()
|
|
4184
4529
|
})
|
|
4185
4530
|
])
|
|
4186
4531
|
)
|
|
4187
4532
|
);
|
|
4188
|
-
var memory_20250818 =
|
|
4533
|
+
var memory_20250818 = createProviderDefinedToolFactory7({
|
|
4189
4534
|
id: "anthropic.memory_20250818",
|
|
4190
4535
|
name: "memory",
|
|
4191
4536
|
inputSchema: memory_20250818InputSchema
|
|
4192
4537
|
});
|
|
4193
4538
|
|
|
4194
4539
|
// src/tool/text-editor_20241022.ts
|
|
4195
|
-
import {
|
|
4196
|
-
createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
|
|
4197
|
-
lazySchema as lazySchema14,
|
|
4198
|
-
zodSchema as zodSchema14
|
|
4199
|
-
} from "@ai-sdk/provider-utils";
|
|
4200
|
-
import { z as z15 } from "zod/v4";
|
|
4201
|
-
var textEditor_20241022InputSchema = lazySchema14(
|
|
4202
|
-
() => zodSchema14(
|
|
4203
|
-
z15.object({
|
|
4204
|
-
command: z15.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4205
|
-
path: z15.string(),
|
|
4206
|
-
file_text: z15.string().optional(),
|
|
4207
|
-
insert_line: z15.number().int().optional(),
|
|
4208
|
-
new_str: z15.string().optional(),
|
|
4209
|
-
old_str: z15.string().optional(),
|
|
4210
|
-
view_range: z15.array(z15.number().int()).optional()
|
|
4211
|
-
})
|
|
4212
|
-
)
|
|
4213
|
-
);
|
|
4214
|
-
var textEditor_20241022 = createProviderDefinedToolFactory7({
|
|
4215
|
-
id: "anthropic.text_editor_20241022",
|
|
4216
|
-
name: "str_replace_editor",
|
|
4217
|
-
inputSchema: textEditor_20241022InputSchema
|
|
4218
|
-
});
|
|
4219
|
-
|
|
4220
|
-
// src/tool/text-editor_20250124.ts
|
|
4221
4540
|
import {
|
|
4222
4541
|
createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
|
|
4223
4542
|
lazySchema as lazySchema15,
|
|
4224
4543
|
zodSchema as zodSchema15
|
|
4225
4544
|
} from "@ai-sdk/provider-utils";
|
|
4226
4545
|
import { z as z16 } from "zod/v4";
|
|
4227
|
-
var
|
|
4546
|
+
var textEditor_20241022InputSchema = lazySchema15(
|
|
4228
4547
|
() => zodSchema15(
|
|
4229
4548
|
z16.object({
|
|
4230
4549
|
command: z16.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4237,23 +4556,23 @@ var textEditor_20250124InputSchema = lazySchema15(
|
|
|
4237
4556
|
})
|
|
4238
4557
|
)
|
|
4239
4558
|
);
|
|
4240
|
-
var
|
|
4241
|
-
id: "anthropic.
|
|
4559
|
+
var textEditor_20241022 = createProviderDefinedToolFactory8({
|
|
4560
|
+
id: "anthropic.text_editor_20241022",
|
|
4242
4561
|
name: "str_replace_editor",
|
|
4243
|
-
inputSchema:
|
|
4562
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4244
4563
|
});
|
|
4245
4564
|
|
|
4246
|
-
// src/tool/text-
|
|
4565
|
+
// src/tool/text-editor_20250124.ts
|
|
4247
4566
|
import {
|
|
4248
4567
|
createProviderDefinedToolFactory as createProviderDefinedToolFactory9,
|
|
4249
4568
|
lazySchema as lazySchema16,
|
|
4250
4569
|
zodSchema as zodSchema16
|
|
4251
4570
|
} from "@ai-sdk/provider-utils";
|
|
4252
4571
|
import { z as z17 } from "zod/v4";
|
|
4253
|
-
var
|
|
4572
|
+
var textEditor_20250124InputSchema = lazySchema16(
|
|
4254
4573
|
() => zodSchema16(
|
|
4255
4574
|
z17.object({
|
|
4256
|
-
command: z17.enum(["view", "create", "str_replace", "insert"]),
|
|
4575
|
+
command: z17.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4257
4576
|
path: z17.string(),
|
|
4258
4577
|
file_text: z17.string().optional(),
|
|
4259
4578
|
insert_line: z17.number().int().optional(),
|
|
@@ -4263,7 +4582,33 @@ var textEditor_20250429InputSchema = lazySchema16(
|
|
|
4263
4582
|
})
|
|
4264
4583
|
)
|
|
4265
4584
|
);
|
|
4266
|
-
var
|
|
4585
|
+
var textEditor_20250124 = createProviderDefinedToolFactory9({
|
|
4586
|
+
id: "anthropic.text_editor_20250124",
|
|
4587
|
+
name: "str_replace_editor",
|
|
4588
|
+
inputSchema: textEditor_20250124InputSchema
|
|
4589
|
+
});
|
|
4590
|
+
|
|
4591
|
+
// src/tool/text-editor_20250429.ts
|
|
4592
|
+
import {
|
|
4593
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory10,
|
|
4594
|
+
lazySchema as lazySchema17,
|
|
4595
|
+
zodSchema as zodSchema17
|
|
4596
|
+
} from "@ai-sdk/provider-utils";
|
|
4597
|
+
import { z as z18 } from "zod/v4";
|
|
4598
|
+
var textEditor_20250429InputSchema = lazySchema17(
|
|
4599
|
+
() => zodSchema17(
|
|
4600
|
+
z18.object({
|
|
4601
|
+
command: z18.enum(["view", "create", "str_replace", "insert"]),
|
|
4602
|
+
path: z18.string(),
|
|
4603
|
+
file_text: z18.string().optional(),
|
|
4604
|
+
insert_line: z18.number().int().optional(),
|
|
4605
|
+
new_str: z18.string().optional(),
|
|
4606
|
+
old_str: z18.string().optional(),
|
|
4607
|
+
view_range: z18.array(z18.number().int()).optional()
|
|
4608
|
+
})
|
|
4609
|
+
)
|
|
4610
|
+
);
|
|
4611
|
+
var textEditor_20250429 = createProviderDefinedToolFactory10({
|
|
4267
4612
|
id: "anthropic.text_editor_20250429",
|
|
4268
4613
|
name: "str_replace_based_edit_tool",
|
|
4269
4614
|
inputSchema: textEditor_20250429InputSchema
|
|
@@ -4352,6 +4697,31 @@ var anthropicTools = {
|
|
|
4352
4697
|
* @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
|
|
4353
4698
|
*/
|
|
4354
4699
|
computer_20250124,
|
|
4700
|
+
/**
|
|
4701
|
+
* The computer toolset lets Claude control a computer through screenshots,
|
|
4702
|
+
* mouse, and keyboard. It replaces the versioned computer tools
|
|
4703
|
+
* (`computer_20250124` and earlier) on newer models.
|
|
4704
|
+
*
|
|
4705
|
+
* The API returns each computer action as its own `tool_use` block with
|
|
4706
|
+
* `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
|
|
4707
|
+
* and exposes the member name as `action`, so `execute` receives the same
|
|
4708
|
+
* input shape as the older computer tools. Claude may return several actions
|
|
4709
|
+
* in one turn.
|
|
4710
|
+
*
|
|
4711
|
+
* Coordinates are always in the pixel space of the screenshots you return;
|
|
4712
|
+
* there are no display size parameters. Zoom is enabled by default.
|
|
4713
|
+
*
|
|
4714
|
+
* Does not require a beta header.
|
|
4715
|
+
*
|
|
4716
|
+
* Tool name must be `computer`.
|
|
4717
|
+
*
|
|
4718
|
+
* Supported models: Claude Opus 5.5 (required; older computer tool types
|
|
4719
|
+
* are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
|
|
4720
|
+
*
|
|
4721
|
+
* @param configs - Per-member settings keyed by member name, e.g.
|
|
4722
|
+
* `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
|
|
4723
|
+
*/
|
|
4724
|
+
computerToolset_20260801,
|
|
4355
4725
|
/**
|
|
4356
4726
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
4357
4727
|
* Claude can create, read, update, and delete files that persist between sessions,
|