@ai-sdk/anthropic 2.0.102 → 2.0.104
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 +21 -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 +90 -3
- package/dist/internal/index.d.ts +90 -3
- package/dist/internal/index.js +727 -359
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +719 -348
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
AnthropicMessagesLanguageModel: () => AnthropicMessagesLanguageModel,
|
|
24
24
|
anthropicTools: () => anthropicTools,
|
|
25
|
+
getModelCapabilities: () => getModelCapabilities,
|
|
25
26
|
prepareTools: () => prepareTools,
|
|
26
27
|
sanitizeJsonSchema: () => sanitizeJsonSchema
|
|
27
28
|
});
|
|
@@ -29,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
29
30
|
|
|
30
31
|
// src/anthropic-messages-language-model.ts
|
|
31
32
|
var import_provider3 = require("@ai-sdk/provider");
|
|
32
|
-
var
|
|
33
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
33
34
|
|
|
34
35
|
// src/anthropic-error.ts
|
|
35
36
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -115,7 +116,9 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
115
116
|
type: import_v42.z.literal("tool_use"),
|
|
116
117
|
id: import_v42.z.string(),
|
|
117
118
|
name: import_v42.z.string(),
|
|
118
|
-
input: import_v42.z.unknown()
|
|
119
|
+
input: import_v42.z.unknown(),
|
|
120
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
121
|
+
toolset_name: import_v42.z.string().nullish()
|
|
119
122
|
}),
|
|
120
123
|
import_v42.z.object({
|
|
121
124
|
type: import_v42.z.literal("server_tool_use"),
|
|
@@ -342,7 +345,9 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
342
345
|
import_v42.z.object({
|
|
343
346
|
type: import_v42.z.literal("tool_use"),
|
|
344
347
|
id: import_v42.z.string(),
|
|
345
|
-
name: import_v42.z.string()
|
|
348
|
+
name: import_v42.z.string(),
|
|
349
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
350
|
+
toolset_name: import_v42.z.string().nullish()
|
|
346
351
|
}),
|
|
347
352
|
import_v42.z.object({
|
|
348
353
|
type: import_v42.z.literal("redacted_thinking"),
|
|
@@ -669,7 +674,7 @@ var anthropicSystemMessageProviderOptions = import_v43.z.object({
|
|
|
669
674
|
clearAt: import_v43.z.literal("next_user_message").optional(),
|
|
670
675
|
/**
|
|
671
676
|
* Overrides the effort for the turn following this mid-conversation system
|
|
672
|
-
* message. The required `mid-conversation-
|
|
677
|
+
* message. The required `mid-conversation-output-config-2026-07-01` beta is added
|
|
673
678
|
* automatically.
|
|
674
679
|
*/
|
|
675
680
|
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
@@ -720,7 +725,7 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
720
725
|
*
|
|
721
726
|
* - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
|
|
722
727
|
* - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
|
|
723
|
-
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Fable 5.1).
|
|
728
|
+
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Opus 5.5 and Fable 5.1).
|
|
724
729
|
*/
|
|
725
730
|
structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
726
731
|
/**
|
|
@@ -728,6 +733,11 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
728
733
|
*
|
|
729
734
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
730
735
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
736
|
+
*
|
|
737
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
738
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
739
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
740
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
731
741
|
*/
|
|
732
742
|
thinking: import_v43.z.union([
|
|
733
743
|
import_v43.z.object({
|
|
@@ -973,30 +983,91 @@ var CacheControlValidator = class {
|
|
|
973
983
|
}
|
|
974
984
|
};
|
|
975
985
|
|
|
976
|
-
// src/tool/
|
|
986
|
+
// src/tool/computer-toolset_20260801.ts
|
|
977
987
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
978
988
|
var import_v44 = require("zod/v4");
|
|
979
|
-
var
|
|
989
|
+
var computerToolset_20260801Members = [
|
|
990
|
+
"screenshot",
|
|
991
|
+
"zoom",
|
|
992
|
+
"left_click",
|
|
993
|
+
"right_click",
|
|
994
|
+
"middle_click",
|
|
995
|
+
"double_click",
|
|
996
|
+
"triple_click",
|
|
997
|
+
"left_click_drag",
|
|
998
|
+
"mouse_move",
|
|
999
|
+
"left_mouse_down",
|
|
1000
|
+
"left_mouse_up",
|
|
1001
|
+
"cursor_position",
|
|
1002
|
+
"scroll",
|
|
1003
|
+
"type",
|
|
1004
|
+
"key",
|
|
1005
|
+
"hold_key",
|
|
1006
|
+
"wait"
|
|
1007
|
+
];
|
|
1008
|
+
var computerToolset_20260801InputSchema = (0, import_provider_utils3.lazySchema)(
|
|
980
1009
|
() => (0, import_provider_utils3.zodSchema)(
|
|
981
1010
|
import_v44.z.object({
|
|
982
|
-
|
|
1011
|
+
action: import_v44.z.enum(computerToolset_20260801Members),
|
|
1012
|
+
coordinate: import_v44.z.tuple([import_v44.z.number().int(), import_v44.z.number().int()]).optional(),
|
|
1013
|
+
duration: import_v44.z.number().optional(),
|
|
1014
|
+
region: import_v44.z.tuple([
|
|
1015
|
+
import_v44.z.number().int(),
|
|
1016
|
+
import_v44.z.number().int(),
|
|
1017
|
+
import_v44.z.number().int(),
|
|
1018
|
+
import_v44.z.number().int()
|
|
1019
|
+
]).optional(),
|
|
1020
|
+
repeat: import_v44.z.number().int().optional(),
|
|
1021
|
+
scroll_amount: import_v44.z.number().optional(),
|
|
1022
|
+
scroll_direction: import_v44.z.enum(["up", "down", "left", "right"]).optional(),
|
|
1023
|
+
start_coordinate: import_v44.z.tuple([import_v44.z.number().int(), import_v44.z.number().int()]).optional(),
|
|
1024
|
+
text: import_v44.z.string().optional()
|
|
983
1025
|
})
|
|
984
1026
|
)
|
|
985
1027
|
);
|
|
986
|
-
var
|
|
1028
|
+
var computerToolset_20260801ArgsSchema = (0, import_provider_utils3.lazySchema)(
|
|
987
1029
|
() => (0, import_provider_utils3.zodSchema)(
|
|
988
1030
|
import_v44.z.object({
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1031
|
+
configs: import_v44.z.partialRecord(
|
|
1032
|
+
import_v44.z.enum(computerToolset_20260801Members),
|
|
1033
|
+
import_v44.z.object({
|
|
1034
|
+
enabled: import_v44.z.boolean().optional(),
|
|
1035
|
+
deferLoading: import_v44.z.boolean().optional()
|
|
1036
|
+
})
|
|
1037
|
+
).optional()
|
|
1038
|
+
})
|
|
1039
|
+
)
|
|
1040
|
+
);
|
|
1041
|
+
var computerToolset_20260801 = (0, import_provider_utils3.createProviderDefinedToolFactory)({
|
|
1042
|
+
id: "anthropic.computer_toolset_20260801",
|
|
1043
|
+
name: "computer",
|
|
1044
|
+
inputSchema: computerToolset_20260801InputSchema
|
|
1045
|
+
});
|
|
1046
|
+
|
|
1047
|
+
// src/tool/text-editor_20250728.ts
|
|
1048
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1049
|
+
var import_v45 = require("zod/v4");
|
|
1050
|
+
var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
1051
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1052
|
+
import_v45.z.object({
|
|
1053
|
+
maxCharacters: import_v45.z.number().optional()
|
|
996
1054
|
})
|
|
997
1055
|
)
|
|
998
1056
|
);
|
|
999
|
-
var
|
|
1057
|
+
var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1058
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1059
|
+
import_v45.z.object({
|
|
1060
|
+
command: import_v45.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1061
|
+
path: import_v45.z.string(),
|
|
1062
|
+
file_text: import_v45.z.string().optional(),
|
|
1063
|
+
insert_line: import_v45.z.number().int().optional(),
|
|
1064
|
+
new_str: import_v45.z.string().optional(),
|
|
1065
|
+
old_str: import_v45.z.string().optional(),
|
|
1066
|
+
view_range: import_v45.z.array(import_v45.z.number().int()).optional()
|
|
1067
|
+
})
|
|
1068
|
+
)
|
|
1069
|
+
);
|
|
1070
|
+
var factory = (0, import_provider_utils4.createProviderDefinedToolFactory)({
|
|
1000
1071
|
id: "anthropic.text_editor_20250728",
|
|
1001
1072
|
name: "str_replace_based_edit_tool",
|
|
1002
1073
|
inputSchema: textEditor_20250728InputSchema
|
|
@@ -1006,45 +1077,45 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1006
1077
|
};
|
|
1007
1078
|
|
|
1008
1079
|
// src/tool/web-search_20250305.ts
|
|
1009
|
-
var
|
|
1010
|
-
var
|
|
1011
|
-
var webSearch_20250305ArgsSchema = (0,
|
|
1012
|
-
() => (0,
|
|
1013
|
-
|
|
1014
|
-
maxUses:
|
|
1015
|
-
allowedDomains:
|
|
1016
|
-
blockedDomains:
|
|
1017
|
-
userLocation:
|
|
1018
|
-
type:
|
|
1019
|
-
city:
|
|
1020
|
-
region:
|
|
1021
|
-
country:
|
|
1022
|
-
timezone:
|
|
1080
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1081
|
+
var import_v46 = require("zod/v4");
|
|
1082
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1083
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1084
|
+
import_v46.z.object({
|
|
1085
|
+
maxUses: import_v46.z.number().optional(),
|
|
1086
|
+
allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1087
|
+
blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1088
|
+
userLocation: import_v46.z.object({
|
|
1089
|
+
type: import_v46.z.literal("approximate"),
|
|
1090
|
+
city: import_v46.z.string().optional(),
|
|
1091
|
+
region: import_v46.z.string().optional(),
|
|
1092
|
+
country: import_v46.z.string().optional(),
|
|
1093
|
+
timezone: import_v46.z.string().optional()
|
|
1023
1094
|
}).optional()
|
|
1024
1095
|
})
|
|
1025
1096
|
)
|
|
1026
1097
|
);
|
|
1027
|
-
var webSearch_20250305OutputSchema = (0,
|
|
1028
|
-
() => (0,
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
url:
|
|
1032
|
-
title:
|
|
1033
|
-
pageAge:
|
|
1034
|
-
encryptedContent:
|
|
1035
|
-
type:
|
|
1098
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1099
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1100
|
+
import_v46.z.array(
|
|
1101
|
+
import_v46.z.object({
|
|
1102
|
+
url: import_v46.z.string(),
|
|
1103
|
+
title: import_v46.z.string().nullable(),
|
|
1104
|
+
pageAge: import_v46.z.string().nullable(),
|
|
1105
|
+
encryptedContent: import_v46.z.string(),
|
|
1106
|
+
type: import_v46.z.literal("web_search_result")
|
|
1036
1107
|
})
|
|
1037
1108
|
)
|
|
1038
1109
|
)
|
|
1039
1110
|
);
|
|
1040
|
-
var webSearch_20250305InputSchema = (0,
|
|
1041
|
-
() => (0,
|
|
1042
|
-
|
|
1043
|
-
query:
|
|
1111
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1112
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1113
|
+
import_v46.z.object({
|
|
1114
|
+
query: import_v46.z.string()
|
|
1044
1115
|
})
|
|
1045
1116
|
)
|
|
1046
1117
|
);
|
|
1047
|
-
var factory2 = (0,
|
|
1118
|
+
var factory2 = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1048
1119
|
id: "anthropic.web_search_20250305",
|
|
1049
1120
|
name: "web_search",
|
|
1050
1121
|
inputSchema: webSearch_20250305InputSchema,
|
|
@@ -1055,53 +1126,53 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1055
1126
|
};
|
|
1056
1127
|
|
|
1057
1128
|
// src/tool/web-fetch-20250910.ts
|
|
1058
|
-
var
|
|
1059
|
-
var
|
|
1060
|
-
var webFetch_20250910ArgsSchema = (0,
|
|
1061
|
-
() => (0,
|
|
1062
|
-
|
|
1063
|
-
maxUses:
|
|
1064
|
-
allowedDomains:
|
|
1065
|
-
blockedDomains:
|
|
1066
|
-
citations:
|
|
1067
|
-
maxContentTokens:
|
|
1129
|
+
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1130
|
+
var import_v47 = require("zod/v4");
|
|
1131
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1132
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1133
|
+
import_v47.z.object({
|
|
1134
|
+
maxUses: import_v47.z.number().optional(),
|
|
1135
|
+
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1136
|
+
blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1137
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1138
|
+
maxContentTokens: import_v47.z.number().optional()
|
|
1068
1139
|
})
|
|
1069
1140
|
)
|
|
1070
1141
|
);
|
|
1071
|
-
var webFetch_20250910OutputSchema = (0,
|
|
1072
|
-
() => (0,
|
|
1073
|
-
|
|
1074
|
-
type:
|
|
1075
|
-
url:
|
|
1076
|
-
content:
|
|
1077
|
-
type:
|
|
1078
|
-
title:
|
|
1079
|
-
citations:
|
|
1080
|
-
source:
|
|
1081
|
-
|
|
1082
|
-
type:
|
|
1083
|
-
mediaType:
|
|
1084
|
-
data:
|
|
1142
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1143
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1144
|
+
import_v47.z.object({
|
|
1145
|
+
type: import_v47.z.literal("web_fetch_result"),
|
|
1146
|
+
url: import_v47.z.string(),
|
|
1147
|
+
content: import_v47.z.object({
|
|
1148
|
+
type: import_v47.z.literal("document"),
|
|
1149
|
+
title: import_v47.z.string().nullable(),
|
|
1150
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1151
|
+
source: import_v47.z.union([
|
|
1152
|
+
import_v47.z.object({
|
|
1153
|
+
type: import_v47.z.literal("base64"),
|
|
1154
|
+
mediaType: import_v47.z.literal("application/pdf"),
|
|
1155
|
+
data: import_v47.z.string()
|
|
1085
1156
|
}),
|
|
1086
|
-
|
|
1087
|
-
type:
|
|
1088
|
-
mediaType:
|
|
1089
|
-
data:
|
|
1157
|
+
import_v47.z.object({
|
|
1158
|
+
type: import_v47.z.literal("text"),
|
|
1159
|
+
mediaType: import_v47.z.literal("text/plain"),
|
|
1160
|
+
data: import_v47.z.string()
|
|
1090
1161
|
})
|
|
1091
1162
|
])
|
|
1092
1163
|
}),
|
|
1093
|
-
retrievedAt:
|
|
1164
|
+
retrievedAt: import_v47.z.string().nullable()
|
|
1094
1165
|
})
|
|
1095
1166
|
)
|
|
1096
1167
|
);
|
|
1097
|
-
var webFetch_20250910InputSchema = (0,
|
|
1098
|
-
() => (0,
|
|
1099
|
-
|
|
1100
|
-
url:
|
|
1168
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1169
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1170
|
+
import_v47.z.object({
|
|
1171
|
+
url: import_v47.z.string()
|
|
1101
1172
|
})
|
|
1102
1173
|
)
|
|
1103
1174
|
);
|
|
1104
|
-
var factory3 = (0,
|
|
1175
|
+
var factory3 = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1105
1176
|
id: "anthropic.web_fetch_20250910",
|
|
1106
1177
|
name: "web_fetch",
|
|
1107
1178
|
inputSchema: webFetch_20250910InputSchema,
|
|
@@ -1112,12 +1183,13 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1112
1183
|
};
|
|
1113
1184
|
|
|
1114
1185
|
// src/anthropic-prepare-tools.ts
|
|
1115
|
-
var
|
|
1186
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1116
1187
|
async function prepareTools({
|
|
1117
1188
|
tools,
|
|
1118
1189
|
toolChoice,
|
|
1119
1190
|
disableParallelToolUse,
|
|
1120
|
-
cacheControlValidator
|
|
1191
|
+
cacheControlValidator,
|
|
1192
|
+
rejectsForcedToolUse = false
|
|
1121
1193
|
}) {
|
|
1122
1194
|
var _a;
|
|
1123
1195
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -1172,6 +1244,31 @@ async function prepareTools({
|
|
|
1172
1244
|
});
|
|
1173
1245
|
break;
|
|
1174
1246
|
}
|
|
1247
|
+
case "anthropic.computer_toolset_20260801": {
|
|
1248
|
+
const args = await (0, import_provider_utils7.validateTypes)({
|
|
1249
|
+
value: tool.args,
|
|
1250
|
+
schema: computerToolset_20260801ArgsSchema
|
|
1251
|
+
});
|
|
1252
|
+
const configs = args.configs != null ? Object.fromEntries(
|
|
1253
|
+
Object.entries(args.configs).map(([member, config]) => [
|
|
1254
|
+
member,
|
|
1255
|
+
{
|
|
1256
|
+
...(config == null ? void 0 : config.enabled) != null && {
|
|
1257
|
+
enabled: config.enabled
|
|
1258
|
+
},
|
|
1259
|
+
...(config == null ? void 0 : config.deferLoading) != null && {
|
|
1260
|
+
defer_loading: config.deferLoading
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
])
|
|
1264
|
+
) : void 0;
|
|
1265
|
+
anthropicTools2.push({
|
|
1266
|
+
type: "computer_toolset_20260801",
|
|
1267
|
+
...configs != null && { configs },
|
|
1268
|
+
cache_control: void 0
|
|
1269
|
+
});
|
|
1270
|
+
break;
|
|
1271
|
+
}
|
|
1175
1272
|
case "anthropic.computer_20250124": {
|
|
1176
1273
|
betas.add("computer-use-2025-01-24");
|
|
1177
1274
|
anthropicTools2.push({
|
|
@@ -1224,7 +1321,7 @@ async function prepareTools({
|
|
|
1224
1321
|
break;
|
|
1225
1322
|
}
|
|
1226
1323
|
case "anthropic.text_editor_20250728": {
|
|
1227
|
-
const args = await (0,
|
|
1324
|
+
const args = await (0, import_provider_utils7.validateTypes)({
|
|
1228
1325
|
value: tool.args,
|
|
1229
1326
|
schema: textEditor_20250728ArgsSchema
|
|
1230
1327
|
});
|
|
@@ -1264,7 +1361,7 @@ async function prepareTools({
|
|
|
1264
1361
|
}
|
|
1265
1362
|
case "anthropic.web_fetch_20250910": {
|
|
1266
1363
|
betas.add("web-fetch-2025-09-10");
|
|
1267
|
-
const args = await (0,
|
|
1364
|
+
const args = await (0, import_provider_utils7.validateTypes)({
|
|
1268
1365
|
value: tool.args,
|
|
1269
1366
|
schema: webFetch_20250910ArgsSchema
|
|
1270
1367
|
});
|
|
@@ -1281,7 +1378,7 @@ async function prepareTools({
|
|
|
1281
1378
|
break;
|
|
1282
1379
|
}
|
|
1283
1380
|
case "anthropic.web_search_20250305": {
|
|
1284
|
-
const args = await (0,
|
|
1381
|
+
const args = await (0, import_provider_utils7.validateTypes)({
|
|
1285
1382
|
value: tool.args,
|
|
1286
1383
|
schema: webSearch_20250305ArgsSchema
|
|
1287
1384
|
});
|
|
@@ -1330,6 +1427,22 @@ async function prepareTools({
|
|
|
1330
1427
|
betas
|
|
1331
1428
|
};
|
|
1332
1429
|
case "required":
|
|
1430
|
+
if (rejectsForcedToolUse) {
|
|
1431
|
+
toolWarnings.push({
|
|
1432
|
+
type: "unsupported-setting",
|
|
1433
|
+
setting: "toolChoice",
|
|
1434
|
+
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.`
|
|
1435
|
+
});
|
|
1436
|
+
return {
|
|
1437
|
+
tools: anthropicTools2,
|
|
1438
|
+
toolChoice: {
|
|
1439
|
+
type: "auto",
|
|
1440
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
1441
|
+
},
|
|
1442
|
+
toolWarnings,
|
|
1443
|
+
betas
|
|
1444
|
+
};
|
|
1445
|
+
}
|
|
1333
1446
|
return {
|
|
1334
1447
|
tools: anthropicTools2,
|
|
1335
1448
|
toolChoice: {
|
|
@@ -1342,6 +1455,24 @@ async function prepareTools({
|
|
|
1342
1455
|
case "none":
|
|
1343
1456
|
return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
|
|
1344
1457
|
case "tool":
|
|
1458
|
+
if (rejectsForcedToolUse) {
|
|
1459
|
+
toolWarnings.push({
|
|
1460
|
+
type: "unsupported-setting",
|
|
1461
|
+
setting: "toolChoice",
|
|
1462
|
+
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.`
|
|
1463
|
+
});
|
|
1464
|
+
return {
|
|
1465
|
+
tools: anthropicTools2.filter(
|
|
1466
|
+
(tool) => "name" in tool && tool.name === toolChoice.toolName
|
|
1467
|
+
),
|
|
1468
|
+
toolChoice: {
|
|
1469
|
+
type: "auto",
|
|
1470
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
1471
|
+
},
|
|
1472
|
+
toolWarnings,
|
|
1473
|
+
betas
|
|
1474
|
+
};
|
|
1475
|
+
}
|
|
1345
1476
|
return {
|
|
1346
1477
|
tools: anthropicTools2,
|
|
1347
1478
|
toolChoice: {
|
|
@@ -1363,29 +1494,29 @@ async function prepareTools({
|
|
|
1363
1494
|
|
|
1364
1495
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1365
1496
|
var import_provider2 = require("@ai-sdk/provider");
|
|
1366
|
-
var
|
|
1497
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1367
1498
|
|
|
1368
1499
|
// src/tool/code-execution_20250522.ts
|
|
1369
|
-
var
|
|
1370
|
-
var
|
|
1371
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
1372
|
-
() => (0,
|
|
1373
|
-
|
|
1374
|
-
type:
|
|
1375
|
-
stdout:
|
|
1376
|
-
stderr:
|
|
1377
|
-
return_code:
|
|
1500
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1501
|
+
var import_v48 = require("zod/v4");
|
|
1502
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1503
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1504
|
+
import_v48.z.object({
|
|
1505
|
+
type: import_v48.z.literal("code_execution_result"),
|
|
1506
|
+
stdout: import_v48.z.string(),
|
|
1507
|
+
stderr: import_v48.z.string(),
|
|
1508
|
+
return_code: import_v48.z.number()
|
|
1378
1509
|
})
|
|
1379
1510
|
)
|
|
1380
1511
|
);
|
|
1381
|
-
var codeExecution_20250522InputSchema = (0,
|
|
1382
|
-
() => (0,
|
|
1383
|
-
|
|
1384
|
-
code:
|
|
1512
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1513
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1514
|
+
import_v48.z.object({
|
|
1515
|
+
code: import_v48.z.string()
|
|
1385
1516
|
})
|
|
1386
1517
|
)
|
|
1387
1518
|
);
|
|
1388
|
-
var factory4 = (0,
|
|
1519
|
+
var factory4 = (0, import_provider_utils8.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1389
1520
|
id: "anthropic.code_execution_20250522",
|
|
1390
1521
|
name: "code_execution",
|
|
1391
1522
|
inputSchema: codeExecution_20250522InputSchema,
|
|
@@ -1396,85 +1527,85 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1396
1527
|
};
|
|
1397
1528
|
|
|
1398
1529
|
// src/tool/code-execution_20250825.ts
|
|
1399
|
-
var
|
|
1400
|
-
var
|
|
1401
|
-
var codeExecution_20250825OutputSchema = (0,
|
|
1402
|
-
() => (0,
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
type:
|
|
1406
|
-
content:
|
|
1407
|
-
|
|
1408
|
-
type:
|
|
1409
|
-
file_id:
|
|
1530
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1531
|
+
var import_v49 = require("zod/v4");
|
|
1532
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1533
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1534
|
+
import_v49.z.discriminatedUnion("type", [
|
|
1535
|
+
import_v49.z.object({
|
|
1536
|
+
type: import_v49.z.literal("bash_code_execution_result"),
|
|
1537
|
+
content: import_v49.z.array(
|
|
1538
|
+
import_v49.z.object({
|
|
1539
|
+
type: import_v49.z.literal("bash_code_execution_output"),
|
|
1540
|
+
file_id: import_v49.z.string()
|
|
1410
1541
|
})
|
|
1411
1542
|
),
|
|
1412
|
-
stdout:
|
|
1413
|
-
stderr:
|
|
1414
|
-
return_code:
|
|
1543
|
+
stdout: import_v49.z.string(),
|
|
1544
|
+
stderr: import_v49.z.string(),
|
|
1545
|
+
return_code: import_v49.z.number()
|
|
1415
1546
|
}),
|
|
1416
|
-
|
|
1417
|
-
type:
|
|
1418
|
-
error_code:
|
|
1547
|
+
import_v49.z.object({
|
|
1548
|
+
type: import_v49.z.literal("bash_code_execution_tool_result_error"),
|
|
1549
|
+
error_code: import_v49.z.string()
|
|
1419
1550
|
}),
|
|
1420
|
-
|
|
1421
|
-
type:
|
|
1422
|
-
error_code:
|
|
1551
|
+
import_v49.z.object({
|
|
1552
|
+
type: import_v49.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1553
|
+
error_code: import_v49.z.string()
|
|
1423
1554
|
}),
|
|
1424
|
-
|
|
1425
|
-
type:
|
|
1426
|
-
content:
|
|
1427
|
-
file_type:
|
|
1428
|
-
num_lines:
|
|
1429
|
-
start_line:
|
|
1430
|
-
total_lines:
|
|
1555
|
+
import_v49.z.object({
|
|
1556
|
+
type: import_v49.z.literal("text_editor_code_execution_view_result"),
|
|
1557
|
+
content: import_v49.z.string(),
|
|
1558
|
+
file_type: import_v49.z.string(),
|
|
1559
|
+
num_lines: import_v49.z.number().nullable(),
|
|
1560
|
+
start_line: import_v49.z.number().nullable(),
|
|
1561
|
+
total_lines: import_v49.z.number().nullable()
|
|
1431
1562
|
}),
|
|
1432
|
-
|
|
1433
|
-
type:
|
|
1434
|
-
is_file_update:
|
|
1563
|
+
import_v49.z.object({
|
|
1564
|
+
type: import_v49.z.literal("text_editor_code_execution_create_result"),
|
|
1565
|
+
is_file_update: import_v49.z.boolean()
|
|
1435
1566
|
}),
|
|
1436
|
-
|
|
1437
|
-
type:
|
|
1438
|
-
lines:
|
|
1439
|
-
new_lines:
|
|
1440
|
-
new_start:
|
|
1441
|
-
old_lines:
|
|
1442
|
-
old_start:
|
|
1567
|
+
import_v49.z.object({
|
|
1568
|
+
type: import_v49.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1569
|
+
lines: import_v49.z.array(import_v49.z.string()).nullable(),
|
|
1570
|
+
new_lines: import_v49.z.number().nullable(),
|
|
1571
|
+
new_start: import_v49.z.number().nullable(),
|
|
1572
|
+
old_lines: import_v49.z.number().nullable(),
|
|
1573
|
+
old_start: import_v49.z.number().nullable()
|
|
1443
1574
|
})
|
|
1444
1575
|
])
|
|
1445
1576
|
)
|
|
1446
1577
|
);
|
|
1447
|
-
var codeExecution_20250825InputSchema = (0,
|
|
1448
|
-
() => (0,
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
type:
|
|
1452
|
-
command:
|
|
1578
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1579
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1580
|
+
import_v49.z.discriminatedUnion("type", [
|
|
1581
|
+
import_v49.z.object({
|
|
1582
|
+
type: import_v49.z.literal("bash_code_execution"),
|
|
1583
|
+
command: import_v49.z.string()
|
|
1453
1584
|
}),
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
type:
|
|
1457
|
-
command:
|
|
1458
|
-
path:
|
|
1585
|
+
import_v49.z.discriminatedUnion("command", [
|
|
1586
|
+
import_v49.z.object({
|
|
1587
|
+
type: import_v49.z.literal("text_editor_code_execution"),
|
|
1588
|
+
command: import_v49.z.literal("view"),
|
|
1589
|
+
path: import_v49.z.string()
|
|
1459
1590
|
}),
|
|
1460
|
-
|
|
1461
|
-
type:
|
|
1462
|
-
command:
|
|
1463
|
-
path:
|
|
1464
|
-
file_text:
|
|
1591
|
+
import_v49.z.object({
|
|
1592
|
+
type: import_v49.z.literal("text_editor_code_execution"),
|
|
1593
|
+
command: import_v49.z.literal("create"),
|
|
1594
|
+
path: import_v49.z.string(),
|
|
1595
|
+
file_text: import_v49.z.string().nullish()
|
|
1465
1596
|
}),
|
|
1466
|
-
|
|
1467
|
-
type:
|
|
1468
|
-
command:
|
|
1469
|
-
path:
|
|
1470
|
-
old_str:
|
|
1471
|
-
new_str:
|
|
1597
|
+
import_v49.z.object({
|
|
1598
|
+
type: import_v49.z.literal("text_editor_code_execution"),
|
|
1599
|
+
command: import_v49.z.literal("str_replace"),
|
|
1600
|
+
path: import_v49.z.string(),
|
|
1601
|
+
old_str: import_v49.z.string(),
|
|
1602
|
+
new_str: import_v49.z.string()
|
|
1472
1603
|
})
|
|
1473
1604
|
])
|
|
1474
1605
|
])
|
|
1475
1606
|
)
|
|
1476
1607
|
);
|
|
1477
|
-
var factory5 = (0,
|
|
1608
|
+
var factory5 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1478
1609
|
id: "anthropic.code_execution_20250825",
|
|
1479
1610
|
name: "code_execution",
|
|
1480
1611
|
inputSchema: codeExecution_20250825InputSchema,
|
|
@@ -1505,7 +1636,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1505
1636
|
prompt,
|
|
1506
1637
|
sendReasoning,
|
|
1507
1638
|
warnings,
|
|
1508
|
-
cacheControlValidator
|
|
1639
|
+
cacheControlValidator,
|
|
1640
|
+
toolsetNames = {}
|
|
1509
1641
|
}) {
|
|
1510
1642
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1511
1643
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -1515,7 +1647,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1515
1647
|
const messages = [];
|
|
1516
1648
|
async function shouldEnableCitations(providerMetadata) {
|
|
1517
1649
|
var _a2, _b2;
|
|
1518
|
-
const anthropicOptions = await (0,
|
|
1650
|
+
const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1519
1651
|
provider: "anthropic",
|
|
1520
1652
|
providerOptions: providerMetadata,
|
|
1521
1653
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1523,7 +1655,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1523
1655
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
1524
1656
|
}
|
|
1525
1657
|
async function getDocumentMetadata(providerMetadata) {
|
|
1526
|
-
const anthropicOptions = await (0,
|
|
1658
|
+
const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1527
1659
|
provider: "anthropic",
|
|
1528
1660
|
providerOptions: providerMetadata,
|
|
1529
1661
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1544,7 +1676,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1544
1676
|
let clearAt = void 0;
|
|
1545
1677
|
let effort = void 0;
|
|
1546
1678
|
for (const { content: text, providerOptions } of block.messages) {
|
|
1547
|
-
const systemMessageOptions = await (0,
|
|
1679
|
+
const systemMessageOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1548
1680
|
provider: "anthropic",
|
|
1549
1681
|
providerOptions,
|
|
1550
1682
|
schema: anthropicSystemMessageProviderOptions
|
|
@@ -1599,7 +1731,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1599
1731
|
betas.add("mid-conversation-system-clear-at-2026-08-21");
|
|
1600
1732
|
}
|
|
1601
1733
|
if (effort != null) {
|
|
1602
|
-
betas.add("mid-conversation-
|
|
1734
|
+
betas.add("mid-conversation-output-config-2026-07-01");
|
|
1603
1735
|
}
|
|
1604
1736
|
}
|
|
1605
1737
|
break;
|
|
@@ -1639,7 +1771,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1639
1771
|
} : {
|
|
1640
1772
|
type: "base64",
|
|
1641
1773
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
1642
|
-
data: (0,
|
|
1774
|
+
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
1643
1775
|
},
|
|
1644
1776
|
cache_control: cacheControl
|
|
1645
1777
|
});
|
|
@@ -1659,7 +1791,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1659
1791
|
} : {
|
|
1660
1792
|
type: "base64",
|
|
1661
1793
|
media_type: "application/pdf",
|
|
1662
|
-
data: (0,
|
|
1794
|
+
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
1663
1795
|
},
|
|
1664
1796
|
title: (_e = metadata.title) != null ? _e : part.filename,
|
|
1665
1797
|
...metadata.context && { context: metadata.context },
|
|
@@ -1764,9 +1896,15 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1764
1896
|
contentValue = JSON.stringify(output.value);
|
|
1765
1897
|
break;
|
|
1766
1898
|
}
|
|
1899
|
+
const toolsetName = getAnthropicToolsetName({
|
|
1900
|
+
toolName: part.toolName,
|
|
1901
|
+
providerOptions: part.providerOptions,
|
|
1902
|
+
toolsetNames
|
|
1903
|
+
});
|
|
1767
1904
|
anthropicContent.push({
|
|
1768
1905
|
type: "tool_result",
|
|
1769
1906
|
tool_use_id: part.toolCallId,
|
|
1907
|
+
...toolsetName != null && { toolset_name: toolsetName },
|
|
1770
1908
|
content: contentValue,
|
|
1771
1909
|
is_error: output.type === "error-text" || output.type === "error-json" ? true : void 0,
|
|
1772
1910
|
cache_control: cacheControl
|
|
@@ -1827,7 +1965,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1827
1965
|
}
|
|
1828
1966
|
case "reasoning": {
|
|
1829
1967
|
if (sendReasoning) {
|
|
1830
|
-
const reasoningMetadata = await (0,
|
|
1968
|
+
const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1831
1969
|
provider: "anthropic",
|
|
1832
1970
|
providerOptions: part.providerOptions,
|
|
1833
1971
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -1901,6 +2039,30 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1901
2039
|
}
|
|
1902
2040
|
break;
|
|
1903
2041
|
}
|
|
2042
|
+
const toolsetName = getAnthropicToolsetName({
|
|
2043
|
+
toolName: part.toolName,
|
|
2044
|
+
providerOptions: part.providerOptions,
|
|
2045
|
+
toolsetNames
|
|
2046
|
+
});
|
|
2047
|
+
if (toolsetName != null) {
|
|
2048
|
+
const { action, ...memberInput } = typeof part.input === "object" && part.input !== null && !Array.isArray(part.input) ? part.input : {};
|
|
2049
|
+
if (typeof action !== "string") {
|
|
2050
|
+
warnings.push({
|
|
2051
|
+
type: "other",
|
|
2052
|
+
message: `toolset tool call for tool ${part.toolName} is missing the action`
|
|
2053
|
+
});
|
|
2054
|
+
break;
|
|
2055
|
+
}
|
|
2056
|
+
anthropicContent.push({
|
|
2057
|
+
type: "tool_use",
|
|
2058
|
+
id: part.toolCallId,
|
|
2059
|
+
name: action,
|
|
2060
|
+
toolset_name: toolsetName,
|
|
2061
|
+
input: memberInput,
|
|
2062
|
+
cache_control: cacheControl
|
|
2063
|
+
});
|
|
2064
|
+
break;
|
|
2065
|
+
}
|
|
1904
2066
|
anthropicContent.push({
|
|
1905
2067
|
type: "tool_use",
|
|
1906
2068
|
id: part.toolCallId,
|
|
@@ -1928,7 +2090,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1928
2090
|
break;
|
|
1929
2091
|
}
|
|
1930
2092
|
if (output.value.type === "code_execution_result") {
|
|
1931
|
-
const codeExecutionOutput = await (0,
|
|
2093
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1932
2094
|
value: output.value,
|
|
1933
2095
|
schema: codeExecution_20250522OutputSchema
|
|
1934
2096
|
});
|
|
@@ -1944,7 +2106,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1944
2106
|
cache_control: cacheControl
|
|
1945
2107
|
});
|
|
1946
2108
|
} else {
|
|
1947
|
-
const codeExecutionOutput = await (0,
|
|
2109
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1948
2110
|
value: output.value,
|
|
1949
2111
|
schema: codeExecution_20250825OutputSchema
|
|
1950
2112
|
});
|
|
@@ -1981,7 +2143,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1981
2143
|
});
|
|
1982
2144
|
break;
|
|
1983
2145
|
}
|
|
1984
|
-
const webFetchOutput = await (0,
|
|
2146
|
+
const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1985
2147
|
value: output.value,
|
|
1986
2148
|
schema: webFetch_20250910OutputSchema
|
|
1987
2149
|
});
|
|
@@ -2016,7 +2178,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2016
2178
|
});
|
|
2017
2179
|
break;
|
|
2018
2180
|
}
|
|
2019
|
-
const webSearchOutput = await (0,
|
|
2181
|
+
const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
2020
2182
|
value: output.value,
|
|
2021
2183
|
schema: webSearch_20250305OutputSchema
|
|
2022
2184
|
});
|
|
@@ -2127,6 +2289,19 @@ function moveToolUseBlocksToEnd(content) {
|
|
|
2127
2289
|
flushSegment();
|
|
2128
2290
|
return result;
|
|
2129
2291
|
}
|
|
2292
|
+
function getAnthropicToolsetName({
|
|
2293
|
+
toolName,
|
|
2294
|
+
providerOptions,
|
|
2295
|
+
toolsetNames
|
|
2296
|
+
}) {
|
|
2297
|
+
var _a;
|
|
2298
|
+
const fromTools = toolsetNames[toolName];
|
|
2299
|
+
if (fromTools != null) {
|
|
2300
|
+
return fromTools;
|
|
2301
|
+
}
|
|
2302
|
+
const fromMetadata = (_a = providerOptions == null ? void 0 : providerOptions.anthropic) == null ? void 0 : _a.toolsetName;
|
|
2303
|
+
return typeof fromMetadata === "string" ? fromMetadata : void 0;
|
|
2304
|
+
}
|
|
2130
2305
|
|
|
2131
2306
|
// src/map-anthropic-stop-reason.ts
|
|
2132
2307
|
function mapAnthropicStopReason({
|
|
@@ -2298,6 +2473,24 @@ function isPlainObject(value) {
|
|
|
2298
2473
|
}
|
|
2299
2474
|
|
|
2300
2475
|
// src/anthropic-messages-language-model.ts
|
|
2476
|
+
function getAnthropicToolsetNames(tools) {
|
|
2477
|
+
const toolsetNames = {};
|
|
2478
|
+
for (const tool of tools != null ? tools : []) {
|
|
2479
|
+
if (tool.type === "provider-defined" && tool.id === "anthropic.computer_toolset_20260801") {
|
|
2480
|
+
toolsetNames[tool.name] = "computer";
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
return toolsetNames;
|
|
2484
|
+
}
|
|
2485
|
+
function toToolsetMemberInput({
|
|
2486
|
+
memberName,
|
|
2487
|
+
input
|
|
2488
|
+
}) {
|
|
2489
|
+
return {
|
|
2490
|
+
action: memberName,
|
|
2491
|
+
...typeof input === "object" && input !== null && !Array.isArray(input) ? input : {}
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2301
2494
|
function getJsonResponseToolName(tools) {
|
|
2302
2495
|
const toolNames = new Set(tools == null ? void 0 : tools.map((tool) => tool.name));
|
|
2303
2496
|
let name = "json";
|
|
@@ -2342,7 +2535,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2342
2535
|
var _a;
|
|
2343
2536
|
this.modelId = modelId;
|
|
2344
2537
|
this.config = config;
|
|
2345
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
2538
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
|
|
2346
2539
|
}
|
|
2347
2540
|
supportsUrl(url) {
|
|
2348
2541
|
return url.protocol === "https:";
|
|
@@ -2414,7 +2607,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2414
2607
|
});
|
|
2415
2608
|
}
|
|
2416
2609
|
}
|
|
2417
|
-
const anthropicOptions = await (0,
|
|
2610
|
+
const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
|
|
2418
2611
|
provider: "anthropic",
|
|
2419
2612
|
providerOptions,
|
|
2420
2613
|
schema: anthropicProviderOptions
|
|
@@ -2424,6 +2617,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2424
2617
|
supportsStructuredOutput,
|
|
2425
2618
|
rejectsSamplingParameters,
|
|
2426
2619
|
rejectsThinkingDisabledAboveHighEffort,
|
|
2620
|
+
rejectsThinkingDisabled,
|
|
2621
|
+
rejectsForcedToolUse,
|
|
2427
2622
|
isKnownModel
|
|
2428
2623
|
} = getModelCapabilities(this.modelId);
|
|
2429
2624
|
if (!isKnownModel && maxOutputTokens == null) {
|
|
@@ -2459,8 +2654,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2459
2654
|
}
|
|
2460
2655
|
}
|
|
2461
2656
|
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
2462
|
-
const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") ? "auto" : "jsonTool";
|
|
2463
|
-
|
|
2657
|
+
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";
|
|
2658
|
+
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
2659
|
+
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
2660
|
+
warnings.push({
|
|
2661
|
+
type: "unsupported-setting",
|
|
2662
|
+
setting: "providerOptions.anthropic.structuredOutputMode",
|
|
2663
|
+
details: `structuredOutputMode 'jsonTool' is not supported by ${this.modelId} because it rejects forced tool use. Using 'outputFormat' instead.`
|
|
2664
|
+
});
|
|
2665
|
+
useStructuredOutput = true;
|
|
2666
|
+
}
|
|
2464
2667
|
const jsonResponseToolName = getJsonResponseToolName(tools);
|
|
2465
2668
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
2466
2669
|
type: "function",
|
|
@@ -2476,12 +2679,37 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2476
2679
|
});
|
|
2477
2680
|
}
|
|
2478
2681
|
const cacheControlValidator = new CacheControlValidator();
|
|
2682
|
+
const toolsetNames = getAnthropicToolsetNames(tools);
|
|
2479
2683
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
2480
2684
|
prompt,
|
|
2481
2685
|
sendReasoning: (_b = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _b : true,
|
|
2482
2686
|
warnings,
|
|
2483
|
-
cacheControlValidator
|
|
2687
|
+
cacheControlValidator,
|
|
2688
|
+
toolsetNames
|
|
2484
2689
|
});
|
|
2690
|
+
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
2691
|
+
const thinking = anthropicOptions.thinking;
|
|
2692
|
+
if ("type" in thinking && thinking.type === "disabled") {
|
|
2693
|
+
warnings.push({
|
|
2694
|
+
type: "unsupported-setting",
|
|
2695
|
+
setting: "providerOptions.anthropic.thinking",
|
|
2696
|
+
details: `thinking cannot be disabled for ${this.modelId}; it always uses adaptive thinking. The thinking setting has been removed. Lower 'effort' to reduce thinking.`
|
|
2697
|
+
});
|
|
2698
|
+
anthropicOptions.thinking = void 0;
|
|
2699
|
+
} else if ("type" in thinking && thinking.type === "enabled") {
|
|
2700
|
+
warnings.push({
|
|
2701
|
+
type: "unsupported-setting",
|
|
2702
|
+
setting: "providerOptions.anthropic.thinking",
|
|
2703
|
+
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.`
|
|
2704
|
+
});
|
|
2705
|
+
anthropicOptions.thinking = {
|
|
2706
|
+
type: "adaptive",
|
|
2707
|
+
...thinking.blockBinding != null && {
|
|
2708
|
+
blockBinding: thinking.blockBinding
|
|
2709
|
+
}
|
|
2710
|
+
};
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2485
2713
|
const thinkingOptions = anthropicOptions == null ? void 0 : anthropicOptions.thinking;
|
|
2486
2714
|
const thinkingType = thinkingOptions != null && "type" in thinkingOptions ? thinkingOptions.type : void 0;
|
|
2487
2715
|
if (rejectsThinkingDisabledAboveHighEffort && thinkingType === "disabled" && anthropicOptions != null && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
@@ -2723,12 +2951,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2723
2951
|
tools: [...tools != null ? tools : [], jsonResponseTool],
|
|
2724
2952
|
toolChoice: tools != null && tools.length > 0 ? { type: "required" } : { type: "tool", toolName: jsonResponseTool.name },
|
|
2725
2953
|
disableParallelToolUse: true,
|
|
2726
|
-
cacheControlValidator
|
|
2954
|
+
cacheControlValidator,
|
|
2955
|
+
rejectsForcedToolUse
|
|
2727
2956
|
} : {
|
|
2728
2957
|
tools: tools != null ? tools : [],
|
|
2729
2958
|
toolChoice,
|
|
2730
2959
|
disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
|
|
2731
|
-
cacheControlValidator
|
|
2960
|
+
cacheControlValidator,
|
|
2961
|
+
rejectsForcedToolUse
|
|
2732
2962
|
}
|
|
2733
2963
|
);
|
|
2734
2964
|
const cacheWarnings = cacheControlValidator.getWarnings();
|
|
@@ -2752,15 +2982,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2752
2982
|
betas,
|
|
2753
2983
|
headers
|
|
2754
2984
|
}) {
|
|
2755
|
-
return (0,
|
|
2756
|
-
await (0,
|
|
2985
|
+
return (0, import_provider_utils11.combineHeaders)(
|
|
2986
|
+
await (0, import_provider_utils11.resolve)(this.config.headers),
|
|
2757
2987
|
headers,
|
|
2758
2988
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
2759
2989
|
);
|
|
2760
2990
|
}
|
|
2761
2991
|
async getBetasFromHeaders(requestHeaders) {
|
|
2762
2992
|
var _a, _b;
|
|
2763
|
-
const configHeaders = await (0,
|
|
2993
|
+
const configHeaders = await (0, import_provider_utils11.resolve)(this.config.headers);
|
|
2764
2994
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
2765
2995
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
2766
2996
|
return new Set(
|
|
@@ -2812,12 +3042,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2812
3042
|
responseHeaders,
|
|
2813
3043
|
value: response,
|
|
2814
3044
|
rawValue: rawResponse
|
|
2815
|
-
} = await (0,
|
|
3045
|
+
} = await (0, import_provider_utils11.postJsonToApi)({
|
|
2816
3046
|
url: this.buildRequestUrl(false),
|
|
2817
3047
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
2818
3048
|
body: this.transformRequestBody(args, betas),
|
|
2819
3049
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
2820
|
-
successfulResponseHandler: (0,
|
|
3050
|
+
successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
|
|
2821
3051
|
anthropicMessagesResponseSchema
|
|
2822
3052
|
),
|
|
2823
3053
|
abortSignal: options.abortSignal,
|
|
@@ -2902,6 +3132,21 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2902
3132
|
type: "text",
|
|
2903
3133
|
text: JSON.stringify(part.input)
|
|
2904
3134
|
});
|
|
3135
|
+
} else if (part.toolset_name != null) {
|
|
3136
|
+
content.push({
|
|
3137
|
+
type: "tool-call",
|
|
3138
|
+
toolCallId: part.id,
|
|
3139
|
+
toolName: part.toolset_name,
|
|
3140
|
+
input: JSON.stringify(
|
|
3141
|
+
toToolsetMemberInput({
|
|
3142
|
+
memberName: part.name,
|
|
3143
|
+
input: part.input
|
|
3144
|
+
})
|
|
3145
|
+
),
|
|
3146
|
+
providerMetadata: {
|
|
3147
|
+
anthropic: { toolsetName: part.toolset_name }
|
|
3148
|
+
}
|
|
3149
|
+
});
|
|
2905
3150
|
} else {
|
|
2906
3151
|
content.push({
|
|
2907
3152
|
type: "tool-call",
|
|
@@ -3166,12 +3411,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3166
3411
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
3167
3412
|
const body = { ...args, stream: true };
|
|
3168
3413
|
const url = this.buildRequestUrl(true);
|
|
3169
|
-
const { responseHeaders, value: response } = await (0,
|
|
3414
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
|
|
3170
3415
|
url,
|
|
3171
3416
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3172
3417
|
body: this.transformRequestBody(body, betas),
|
|
3173
3418
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3174
|
-
successfulResponseHandler: (0,
|
|
3419
|
+
successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
|
|
3175
3420
|
anthropicMessagesChunkSchema
|
|
3176
3421
|
),
|
|
3177
3422
|
abortSignal: options.abortSignal,
|
|
@@ -3286,6 +3531,23 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3286
3531
|
type: "text-start",
|
|
3287
3532
|
id: String(value.index)
|
|
3288
3533
|
});
|
|
3534
|
+
} else if (value.content_block.toolset_name != null) {
|
|
3535
|
+
contentBlocks[value.index] = {
|
|
3536
|
+
type: "tool-call",
|
|
3537
|
+
toolCallId: value.content_block.id,
|
|
3538
|
+
toolName: value.content_block.toolset_name,
|
|
3539
|
+
input: "",
|
|
3540
|
+
firstDelta: true,
|
|
3541
|
+
toolset: {
|
|
3542
|
+
name: value.content_block.toolset_name,
|
|
3543
|
+
memberName: value.content_block.name
|
|
3544
|
+
}
|
|
3545
|
+
};
|
|
3546
|
+
controller.enqueue({
|
|
3547
|
+
type: "tool-input-start",
|
|
3548
|
+
id: value.content_block.id,
|
|
3549
|
+
toolName: value.content_block.toolset_name
|
|
3550
|
+
});
|
|
3289
3551
|
} else {
|
|
3290
3552
|
contentBlocks[value.index] = {
|
|
3291
3553
|
type: "tool-call",
|
|
@@ -3496,6 +3758,25 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3496
3758
|
break;
|
|
3497
3759
|
}
|
|
3498
3760
|
case "tool-call": {
|
|
3761
|
+
if (contentBlock.toolset != null) {
|
|
3762
|
+
let memberInput = {};
|
|
3763
|
+
try {
|
|
3764
|
+
memberInput = contentBlock.input === "" ? {} : JSON.parse(contentBlock.input);
|
|
3765
|
+
} catch (e) {
|
|
3766
|
+
memberInput = void 0;
|
|
3767
|
+
}
|
|
3768
|
+
contentBlock.input = memberInput === void 0 ? contentBlock.input : JSON.stringify(
|
|
3769
|
+
toToolsetMemberInput({
|
|
3770
|
+
memberName: contentBlock.toolset.memberName,
|
|
3771
|
+
input: memberInput
|
|
3772
|
+
})
|
|
3773
|
+
);
|
|
3774
|
+
controller.enqueue({
|
|
3775
|
+
type: "tool-input-delta",
|
|
3776
|
+
id: contentBlock.toolCallId,
|
|
3777
|
+
delta: contentBlock.input
|
|
3778
|
+
});
|
|
3779
|
+
}
|
|
3499
3780
|
controller.enqueue({
|
|
3500
3781
|
type: "tool-input-end",
|
|
3501
3782
|
id: contentBlock.toolCallId
|
|
@@ -3506,7 +3787,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3506
3787
|
toolCallId: contentBlock.toolCallId,
|
|
3507
3788
|
toolName,
|
|
3508
3789
|
input: contentBlock.input === "" ? "{}" : contentBlock.input,
|
|
3509
|
-
providerExecuted: contentBlock.providerExecuted
|
|
3790
|
+
providerExecuted: contentBlock.providerExecuted,
|
|
3791
|
+
...contentBlock.toolset && {
|
|
3792
|
+
providerMetadata: {
|
|
3793
|
+
anthropic: { toolsetName: contentBlock.toolset.name }
|
|
3794
|
+
}
|
|
3795
|
+
}
|
|
3510
3796
|
});
|
|
3511
3797
|
break;
|
|
3512
3798
|
}
|
|
@@ -3579,6 +3865,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3579
3865
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
3580
3866
|
return;
|
|
3581
3867
|
}
|
|
3868
|
+
if (contentBlock.toolset != null) {
|
|
3869
|
+
contentBlock.input += delta;
|
|
3870
|
+
return;
|
|
3871
|
+
}
|
|
3582
3872
|
if (contentBlock.firstDelta && (contentBlock.toolName === "bash_code_execution" || contentBlock.toolName === "text_editor_code_execution")) {
|
|
3583
3873
|
delta = `{"type": "${contentBlock.toolName}",${delta.substring(1)}`;
|
|
3584
3874
|
}
|
|
@@ -3795,20 +4085,54 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3795
4085
|
}
|
|
3796
4086
|
};
|
|
3797
4087
|
function getModelCapabilities(modelId) {
|
|
3798
|
-
if (modelId.includes("claude-opus-5")) {
|
|
4088
|
+
if (modelId.includes("claude-opus-5-5")) {
|
|
4089
|
+
return {
|
|
4090
|
+
maxOutputTokens: 128e3,
|
|
4091
|
+
supportsStructuredOutput: true,
|
|
4092
|
+
rejectsSamplingParameters: true,
|
|
4093
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4094
|
+
rejectsThinkingDisabled: true,
|
|
4095
|
+
rejectsForcedToolUse: true,
|
|
4096
|
+
isKnownModel: true
|
|
4097
|
+
};
|
|
4098
|
+
} else if (modelId.includes("claude-opus-5")) {
|
|
3799
4099
|
return {
|
|
3800
4100
|
maxOutputTokens: 128e3,
|
|
3801
4101
|
supportsStructuredOutput: true,
|
|
3802
4102
|
rejectsSamplingParameters: true,
|
|
3803
4103
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4104
|
+
rejectsThinkingDisabled: false,
|
|
4105
|
+
rejectsForcedToolUse: false,
|
|
4106
|
+
isKnownModel: true
|
|
4107
|
+
};
|
|
4108
|
+
} else if (modelId.includes("claude-fable-5-1")) {
|
|
4109
|
+
return {
|
|
4110
|
+
maxOutputTokens: 128e3,
|
|
4111
|
+
supportsStructuredOutput: true,
|
|
4112
|
+
rejectsSamplingParameters: true,
|
|
4113
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4114
|
+
rejectsThinkingDisabled: true,
|
|
4115
|
+
rejectsForcedToolUse: true,
|
|
3804
4116
|
isKnownModel: true
|
|
3805
4117
|
};
|
|
3806
|
-
} else if (modelId.includes("claude-
|
|
4118
|
+
} else if (modelId.includes("claude-fable-5")) {
|
|
3807
4119
|
return {
|
|
3808
4120
|
maxOutputTokens: 128e3,
|
|
3809
4121
|
supportsStructuredOutput: true,
|
|
3810
4122
|
rejectsSamplingParameters: true,
|
|
3811
4123
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4124
|
+
rejectsThinkingDisabled: true,
|
|
4125
|
+
rejectsForcedToolUse: false,
|
|
4126
|
+
isKnownModel: true
|
|
4127
|
+
};
|
|
4128
|
+
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) {
|
|
4129
|
+
return {
|
|
4130
|
+
maxOutputTokens: 128e3,
|
|
4131
|
+
supportsStructuredOutput: true,
|
|
4132
|
+
rejectsSamplingParameters: true,
|
|
4133
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4134
|
+
rejectsThinkingDisabled: false,
|
|
4135
|
+
rejectsForcedToolUse: false,
|
|
3812
4136
|
isKnownModel: true
|
|
3813
4137
|
};
|
|
3814
4138
|
} else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
|
|
@@ -3817,6 +4141,8 @@ function getModelCapabilities(modelId) {
|
|
|
3817
4141
|
supportsStructuredOutput: true,
|
|
3818
4142
|
rejectsSamplingParameters: false,
|
|
3819
4143
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4144
|
+
rejectsThinkingDisabled: false,
|
|
4145
|
+
rejectsForcedToolUse: false,
|
|
3820
4146
|
isKnownModel: true
|
|
3821
4147
|
};
|
|
3822
4148
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
@@ -3825,6 +4151,8 @@ function getModelCapabilities(modelId) {
|
|
|
3825
4151
|
supportsStructuredOutput: true,
|
|
3826
4152
|
rejectsSamplingParameters: false,
|
|
3827
4153
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4154
|
+
rejectsThinkingDisabled: false,
|
|
4155
|
+
rejectsForcedToolUse: false,
|
|
3828
4156
|
isKnownModel: true
|
|
3829
4157
|
};
|
|
3830
4158
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
@@ -3833,6 +4161,8 @@ function getModelCapabilities(modelId) {
|
|
|
3833
4161
|
supportsStructuredOutput: true,
|
|
3834
4162
|
rejectsSamplingParameters: false,
|
|
3835
4163
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4164
|
+
rejectsThinkingDisabled: false,
|
|
4165
|
+
rejectsForcedToolUse: false,
|
|
3836
4166
|
isKnownModel: true
|
|
3837
4167
|
};
|
|
3838
4168
|
} else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet")) {
|
|
@@ -3841,6 +4171,8 @@ function getModelCapabilities(modelId) {
|
|
|
3841
4171
|
supportsStructuredOutput: false,
|
|
3842
4172
|
rejectsSamplingParameters: false,
|
|
3843
4173
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4174
|
+
rejectsThinkingDisabled: false,
|
|
4175
|
+
rejectsForcedToolUse: false,
|
|
3844
4176
|
isKnownModel: true
|
|
3845
4177
|
};
|
|
3846
4178
|
} else if (modelId.includes("claude-opus-4-")) {
|
|
@@ -3849,6 +4181,8 @@ function getModelCapabilities(modelId) {
|
|
|
3849
4181
|
supportsStructuredOutput: false,
|
|
3850
4182
|
rejectsSamplingParameters: false,
|
|
3851
4183
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4184
|
+
rejectsThinkingDisabled: false,
|
|
4185
|
+
rejectsForcedToolUse: false,
|
|
3852
4186
|
isKnownModel: true
|
|
3853
4187
|
};
|
|
3854
4188
|
} else if (modelId.includes("claude-3-haiku")) {
|
|
@@ -3857,6 +4191,8 @@ function getModelCapabilities(modelId) {
|
|
|
3857
4191
|
supportsStructuredOutput: false,
|
|
3858
4192
|
rejectsSamplingParameters: false,
|
|
3859
4193
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4194
|
+
rejectsThinkingDisabled: false,
|
|
4195
|
+
rejectsForcedToolUse: false,
|
|
3860
4196
|
isKnownModel: true
|
|
3861
4197
|
};
|
|
3862
4198
|
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
@@ -3865,6 +4201,8 @@ function getModelCapabilities(modelId) {
|
|
|
3865
4201
|
supportsStructuredOutput: false,
|
|
3866
4202
|
rejectsSamplingParameters: false,
|
|
3867
4203
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4204
|
+
rejectsThinkingDisabled: false,
|
|
4205
|
+
rejectsForcedToolUse: false,
|
|
3868
4206
|
isKnownModel: false
|
|
3869
4207
|
};
|
|
3870
4208
|
} else if (modelId.includes("claude-")) {
|
|
@@ -3873,6 +4211,8 @@ function getModelCapabilities(modelId) {
|
|
|
3873
4211
|
supportsStructuredOutput: true,
|
|
3874
4212
|
rejectsSamplingParameters: true,
|
|
3875
4213
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4214
|
+
rejectsThinkingDisabled: false,
|
|
4215
|
+
rejectsForcedToolUse: false,
|
|
3876
4216
|
isKnownModel: false
|
|
3877
4217
|
};
|
|
3878
4218
|
} else {
|
|
@@ -3881,6 +4221,8 @@ function getModelCapabilities(modelId) {
|
|
|
3881
4221
|
supportsStructuredOutput: false,
|
|
3882
4222
|
rejectsSamplingParameters: false,
|
|
3883
4223
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4224
|
+
rejectsThinkingDisabled: false,
|
|
4225
|
+
rejectsForcedToolUse: false,
|
|
3884
4226
|
isKnownModel: false
|
|
3885
4227
|
};
|
|
3886
4228
|
}
|
|
@@ -3898,135 +4240,135 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
3898
4240
|
}
|
|
3899
4241
|
|
|
3900
4242
|
// src/tool/bash_20241022.ts
|
|
3901
|
-
var
|
|
3902
|
-
var
|
|
3903
|
-
var bash_20241022InputSchema = (0,
|
|
3904
|
-
() => (0,
|
|
3905
|
-
|
|
3906
|
-
command:
|
|
3907
|
-
restart:
|
|
4243
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
4244
|
+
var import_v410 = require("zod/v4");
|
|
4245
|
+
var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
4246
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
4247
|
+
import_v410.z.object({
|
|
4248
|
+
command: import_v410.z.string(),
|
|
4249
|
+
restart: import_v410.z.boolean().optional()
|
|
3908
4250
|
})
|
|
3909
4251
|
)
|
|
3910
4252
|
);
|
|
3911
|
-
var bash_20241022 = (0,
|
|
4253
|
+
var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
|
|
3912
4254
|
id: "anthropic.bash_20241022",
|
|
3913
4255
|
name: "bash",
|
|
3914
4256
|
inputSchema: bash_20241022InputSchema
|
|
3915
4257
|
});
|
|
3916
4258
|
|
|
3917
4259
|
// src/tool/bash_20250124.ts
|
|
3918
|
-
var
|
|
3919
|
-
var
|
|
3920
|
-
var bash_20250124InputSchema = (0,
|
|
3921
|
-
() => (0,
|
|
3922
|
-
|
|
3923
|
-
command:
|
|
3924
|
-
restart:
|
|
4260
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
4261
|
+
var import_v411 = require("zod/v4");
|
|
4262
|
+
var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
4263
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
4264
|
+
import_v411.z.object({
|
|
4265
|
+
command: import_v411.z.string(),
|
|
4266
|
+
restart: import_v411.z.boolean().optional()
|
|
3925
4267
|
})
|
|
3926
4268
|
)
|
|
3927
4269
|
);
|
|
3928
|
-
var bash_20250124 = (0,
|
|
4270
|
+
var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
3929
4271
|
id: "anthropic.bash_20250124",
|
|
3930
4272
|
name: "bash",
|
|
3931
4273
|
inputSchema: bash_20250124InputSchema
|
|
3932
4274
|
});
|
|
3933
4275
|
|
|
3934
4276
|
// src/tool/code-execution_20260120.ts
|
|
3935
|
-
var
|
|
3936
|
-
var
|
|
3937
|
-
var codeExecution_20260120OutputSchema = (0,
|
|
3938
|
-
() => (0,
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
type:
|
|
3942
|
-
stdout:
|
|
3943
|
-
stderr:
|
|
3944
|
-
return_code:
|
|
3945
|
-
content:
|
|
3946
|
-
|
|
3947
|
-
type:
|
|
3948
|
-
file_id:
|
|
4277
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
4278
|
+
var import_v412 = require("zod/v4");
|
|
4279
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
4280
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
4281
|
+
import_v412.z.discriminatedUnion("type", [
|
|
4282
|
+
import_v412.z.object({
|
|
4283
|
+
type: import_v412.z.literal("code_execution_result"),
|
|
4284
|
+
stdout: import_v412.z.string(),
|
|
4285
|
+
stderr: import_v412.z.string(),
|
|
4286
|
+
return_code: import_v412.z.number(),
|
|
4287
|
+
content: import_v412.z.array(
|
|
4288
|
+
import_v412.z.object({
|
|
4289
|
+
type: import_v412.z.literal("code_execution_output"),
|
|
4290
|
+
file_id: import_v412.z.string()
|
|
3949
4291
|
})
|
|
3950
4292
|
).optional().default([])
|
|
3951
4293
|
}),
|
|
3952
|
-
|
|
3953
|
-
type:
|
|
3954
|
-
content:
|
|
3955
|
-
|
|
3956
|
-
type:
|
|
3957
|
-
file_id:
|
|
4294
|
+
import_v412.z.object({
|
|
4295
|
+
type: import_v412.z.literal("bash_code_execution_result"),
|
|
4296
|
+
content: import_v412.z.array(
|
|
4297
|
+
import_v412.z.object({
|
|
4298
|
+
type: import_v412.z.literal("bash_code_execution_output"),
|
|
4299
|
+
file_id: import_v412.z.string()
|
|
3958
4300
|
})
|
|
3959
4301
|
),
|
|
3960
|
-
stdout:
|
|
3961
|
-
stderr:
|
|
3962
|
-
return_code:
|
|
4302
|
+
stdout: import_v412.z.string(),
|
|
4303
|
+
stderr: import_v412.z.string(),
|
|
4304
|
+
return_code: import_v412.z.number()
|
|
3963
4305
|
}),
|
|
3964
|
-
|
|
3965
|
-
type:
|
|
3966
|
-
error_code:
|
|
4306
|
+
import_v412.z.object({
|
|
4307
|
+
type: import_v412.z.literal("bash_code_execution_tool_result_error"),
|
|
4308
|
+
error_code: import_v412.z.string()
|
|
3967
4309
|
}),
|
|
3968
|
-
|
|
3969
|
-
type:
|
|
3970
|
-
error_code:
|
|
4310
|
+
import_v412.z.object({
|
|
4311
|
+
type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
|
|
4312
|
+
error_code: import_v412.z.string()
|
|
3971
4313
|
}),
|
|
3972
|
-
|
|
3973
|
-
type:
|
|
3974
|
-
content:
|
|
3975
|
-
file_type:
|
|
3976
|
-
num_lines:
|
|
3977
|
-
start_line:
|
|
3978
|
-
total_lines:
|
|
4314
|
+
import_v412.z.object({
|
|
4315
|
+
type: import_v412.z.literal("text_editor_code_execution_view_result"),
|
|
4316
|
+
content: import_v412.z.string(),
|
|
4317
|
+
file_type: import_v412.z.string(),
|
|
4318
|
+
num_lines: import_v412.z.number().nullable(),
|
|
4319
|
+
start_line: import_v412.z.number().nullable(),
|
|
4320
|
+
total_lines: import_v412.z.number().nullable()
|
|
3979
4321
|
}),
|
|
3980
|
-
|
|
3981
|
-
type:
|
|
3982
|
-
is_file_update:
|
|
4322
|
+
import_v412.z.object({
|
|
4323
|
+
type: import_v412.z.literal("text_editor_code_execution_create_result"),
|
|
4324
|
+
is_file_update: import_v412.z.boolean()
|
|
3983
4325
|
}),
|
|
3984
|
-
|
|
3985
|
-
type:
|
|
3986
|
-
lines:
|
|
3987
|
-
new_lines:
|
|
3988
|
-
new_start:
|
|
3989
|
-
old_lines:
|
|
3990
|
-
old_start:
|
|
4326
|
+
import_v412.z.object({
|
|
4327
|
+
type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
|
|
4328
|
+
lines: import_v412.z.array(import_v412.z.string()).nullable(),
|
|
4329
|
+
new_lines: import_v412.z.number().nullable(),
|
|
4330
|
+
new_start: import_v412.z.number().nullable(),
|
|
4331
|
+
old_lines: import_v412.z.number().nullable(),
|
|
4332
|
+
old_start: import_v412.z.number().nullable()
|
|
3991
4333
|
})
|
|
3992
4334
|
])
|
|
3993
4335
|
)
|
|
3994
4336
|
);
|
|
3995
|
-
var codeExecution_20260120InputSchema = (0,
|
|
3996
|
-
() => (0,
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
type:
|
|
4000
|
-
code:
|
|
4337
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
4338
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
4339
|
+
import_v412.z.discriminatedUnion("type", [
|
|
4340
|
+
import_v412.z.object({
|
|
4341
|
+
type: import_v412.z.literal("programmatic-tool-call"),
|
|
4342
|
+
code: import_v412.z.string()
|
|
4001
4343
|
}),
|
|
4002
|
-
|
|
4003
|
-
type:
|
|
4004
|
-
command:
|
|
4344
|
+
import_v412.z.object({
|
|
4345
|
+
type: import_v412.z.literal("bash_code_execution"),
|
|
4346
|
+
command: import_v412.z.string()
|
|
4005
4347
|
}),
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
type:
|
|
4009
|
-
command:
|
|
4010
|
-
path:
|
|
4348
|
+
import_v412.z.discriminatedUnion("command", [
|
|
4349
|
+
import_v412.z.object({
|
|
4350
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4351
|
+
command: import_v412.z.literal("view"),
|
|
4352
|
+
path: import_v412.z.string()
|
|
4011
4353
|
}),
|
|
4012
|
-
|
|
4013
|
-
type:
|
|
4014
|
-
command:
|
|
4015
|
-
path:
|
|
4016
|
-
file_text:
|
|
4354
|
+
import_v412.z.object({
|
|
4355
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4356
|
+
command: import_v412.z.literal("create"),
|
|
4357
|
+
path: import_v412.z.string(),
|
|
4358
|
+
file_text: import_v412.z.string().nullish()
|
|
4017
4359
|
}),
|
|
4018
|
-
|
|
4019
|
-
type:
|
|
4020
|
-
command:
|
|
4021
|
-
path:
|
|
4022
|
-
old_str:
|
|
4023
|
-
new_str:
|
|
4360
|
+
import_v412.z.object({
|
|
4361
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4362
|
+
command: import_v412.z.literal("str_replace"),
|
|
4363
|
+
path: import_v412.z.string(),
|
|
4364
|
+
old_str: import_v412.z.string(),
|
|
4365
|
+
new_str: import_v412.z.string()
|
|
4024
4366
|
})
|
|
4025
4367
|
])
|
|
4026
4368
|
])
|
|
4027
4369
|
)
|
|
4028
4370
|
);
|
|
4029
|
-
var factory6 = (0,
|
|
4371
|
+
var factory6 = (0, import_provider_utils14.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
4030
4372
|
id: "anthropic.code_execution_20260120",
|
|
4031
4373
|
name: "code_execution",
|
|
4032
4374
|
inputSchema: codeExecution_20260120InputSchema,
|
|
@@ -4037,12 +4379,12 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
4037
4379
|
};
|
|
4038
4380
|
|
|
4039
4381
|
// src/tool/computer_20241022.ts
|
|
4040
|
-
var
|
|
4041
|
-
var
|
|
4042
|
-
var computer_20241022InputSchema = (0,
|
|
4043
|
-
() => (0,
|
|
4044
|
-
|
|
4045
|
-
action:
|
|
4382
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
4383
|
+
var import_v413 = require("zod/v4");
|
|
4384
|
+
var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4385
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
4386
|
+
import_v413.z.object({
|
|
4387
|
+
action: import_v413.z.enum([
|
|
4046
4388
|
"key",
|
|
4047
4389
|
"type",
|
|
4048
4390
|
"mouse_move",
|
|
@@ -4054,24 +4396,24 @@ var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
4054
4396
|
"screenshot",
|
|
4055
4397
|
"cursor_position"
|
|
4056
4398
|
]),
|
|
4057
|
-
coordinate:
|
|
4058
|
-
text:
|
|
4399
|
+
coordinate: import_v413.z.array(import_v413.z.number().int()).optional(),
|
|
4400
|
+
text: import_v413.z.string().optional()
|
|
4059
4401
|
})
|
|
4060
4402
|
)
|
|
4061
4403
|
);
|
|
4062
|
-
var computer_20241022 = (0,
|
|
4404
|
+
var computer_20241022 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
4063
4405
|
id: "anthropic.computer_20241022",
|
|
4064
4406
|
name: "computer",
|
|
4065
4407
|
inputSchema: computer_20241022InputSchema
|
|
4066
4408
|
});
|
|
4067
4409
|
|
|
4068
4410
|
// src/tool/computer_20250124.ts
|
|
4069
|
-
var
|
|
4070
|
-
var
|
|
4071
|
-
var computer_20250124InputSchema = (0,
|
|
4072
|
-
() => (0,
|
|
4073
|
-
|
|
4074
|
-
action:
|
|
4411
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
4412
|
+
var import_v414 = require("zod/v4");
|
|
4413
|
+
var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
4414
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
4415
|
+
import_v414.z.object({
|
|
4416
|
+
action: import_v414.z.enum([
|
|
4075
4417
|
"key",
|
|
4076
4418
|
"hold_key",
|
|
4077
4419
|
"type",
|
|
@@ -4089,93 +4431,71 @@ var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
|
4089
4431
|
"wait",
|
|
4090
4432
|
"screenshot"
|
|
4091
4433
|
]),
|
|
4092
|
-
coordinate:
|
|
4093
|
-
duration:
|
|
4094
|
-
scroll_amount:
|
|
4095
|
-
scroll_direction:
|
|
4096
|
-
start_coordinate:
|
|
4097
|
-
text:
|
|
4434
|
+
coordinate: import_v414.z.tuple([import_v414.z.number().int(), import_v414.z.number().int()]).optional(),
|
|
4435
|
+
duration: import_v414.z.number().optional(),
|
|
4436
|
+
scroll_amount: import_v414.z.number().optional(),
|
|
4437
|
+
scroll_direction: import_v414.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4438
|
+
start_coordinate: import_v414.z.tuple([import_v414.z.number().int(), import_v414.z.number().int()]).optional(),
|
|
4439
|
+
text: import_v414.z.string().optional()
|
|
4098
4440
|
})
|
|
4099
4441
|
)
|
|
4100
4442
|
);
|
|
4101
|
-
var computer_20250124 = (0,
|
|
4443
|
+
var computer_20250124 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
|
|
4102
4444
|
id: "anthropic.computer_20250124",
|
|
4103
4445
|
name: "computer",
|
|
4104
4446
|
inputSchema: computer_20250124InputSchema
|
|
4105
4447
|
});
|
|
4106
4448
|
|
|
4107
4449
|
// src/tool/memory_20250818.ts
|
|
4108
|
-
var
|
|
4109
|
-
var
|
|
4110
|
-
var memory_20250818InputSchema = (0,
|
|
4111
|
-
() => (0,
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
command:
|
|
4115
|
-
path:
|
|
4116
|
-
view_range:
|
|
4450
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4451
|
+
var import_v415 = require("zod/v4");
|
|
4452
|
+
var memory_20250818InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4453
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
4454
|
+
import_v415.z.discriminatedUnion("command", [
|
|
4455
|
+
import_v415.z.object({
|
|
4456
|
+
command: import_v415.z.literal("view"),
|
|
4457
|
+
path: import_v415.z.string(),
|
|
4458
|
+
view_range: import_v415.z.tuple([import_v415.z.number(), import_v415.z.number()]).optional()
|
|
4117
4459
|
}),
|
|
4118
|
-
|
|
4119
|
-
command:
|
|
4120
|
-
path:
|
|
4121
|
-
file_text:
|
|
4460
|
+
import_v415.z.object({
|
|
4461
|
+
command: import_v415.z.literal("create"),
|
|
4462
|
+
path: import_v415.z.string(),
|
|
4463
|
+
file_text: import_v415.z.string()
|
|
4122
4464
|
}),
|
|
4123
|
-
|
|
4124
|
-
command:
|
|
4125
|
-
path:
|
|
4126
|
-
old_str:
|
|
4127
|
-
new_str:
|
|
4465
|
+
import_v415.z.object({
|
|
4466
|
+
command: import_v415.z.literal("str_replace"),
|
|
4467
|
+
path: import_v415.z.string(),
|
|
4468
|
+
old_str: import_v415.z.string(),
|
|
4469
|
+
new_str: import_v415.z.string()
|
|
4128
4470
|
}),
|
|
4129
|
-
|
|
4130
|
-
command:
|
|
4131
|
-
path:
|
|
4132
|
-
insert_line:
|
|
4133
|
-
insert_text:
|
|
4471
|
+
import_v415.z.object({
|
|
4472
|
+
command: import_v415.z.literal("insert"),
|
|
4473
|
+
path: import_v415.z.string(),
|
|
4474
|
+
insert_line: import_v415.z.number(),
|
|
4475
|
+
insert_text: import_v415.z.string()
|
|
4134
4476
|
}),
|
|
4135
|
-
|
|
4136
|
-
command:
|
|
4137
|
-
path:
|
|
4477
|
+
import_v415.z.object({
|
|
4478
|
+
command: import_v415.z.literal("delete"),
|
|
4479
|
+
path: import_v415.z.string()
|
|
4138
4480
|
}),
|
|
4139
|
-
|
|
4140
|
-
command:
|
|
4141
|
-
old_path:
|
|
4142
|
-
new_path:
|
|
4481
|
+
import_v415.z.object({
|
|
4482
|
+
command: import_v415.z.literal("rename"),
|
|
4483
|
+
old_path: import_v415.z.string(),
|
|
4484
|
+
new_path: import_v415.z.string()
|
|
4143
4485
|
})
|
|
4144
4486
|
])
|
|
4145
4487
|
)
|
|
4146
4488
|
);
|
|
4147
|
-
var memory_20250818 = (0,
|
|
4489
|
+
var memory_20250818 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
|
|
4148
4490
|
id: "anthropic.memory_20250818",
|
|
4149
4491
|
name: "memory",
|
|
4150
4492
|
inputSchema: memory_20250818InputSchema
|
|
4151
4493
|
});
|
|
4152
4494
|
|
|
4153
4495
|
// src/tool/text-editor_20241022.ts
|
|
4154
|
-
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4155
|
-
var import_v415 = require("zod/v4");
|
|
4156
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4157
|
-
() => (0, import_provider_utils17.zodSchema)(
|
|
4158
|
-
import_v415.z.object({
|
|
4159
|
-
command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4160
|
-
path: import_v415.z.string(),
|
|
4161
|
-
file_text: import_v415.z.string().optional(),
|
|
4162
|
-
insert_line: import_v415.z.number().int().optional(),
|
|
4163
|
-
new_str: import_v415.z.string().optional(),
|
|
4164
|
-
old_str: import_v415.z.string().optional(),
|
|
4165
|
-
view_range: import_v415.z.array(import_v415.z.number().int()).optional()
|
|
4166
|
-
})
|
|
4167
|
-
)
|
|
4168
|
-
);
|
|
4169
|
-
var textEditor_20241022 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
|
|
4170
|
-
id: "anthropic.text_editor_20241022",
|
|
4171
|
-
name: "str_replace_editor",
|
|
4172
|
-
inputSchema: textEditor_20241022InputSchema
|
|
4173
|
-
});
|
|
4174
|
-
|
|
4175
|
-
// src/tool/text-editor_20250124.ts
|
|
4176
4496
|
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
4177
4497
|
var import_v416 = require("zod/v4");
|
|
4178
|
-
var
|
|
4498
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
4179
4499
|
() => (0, import_provider_utils18.zodSchema)(
|
|
4180
4500
|
import_v416.z.object({
|
|
4181
4501
|
command: import_v416.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4188,19 +4508,19 @@ var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
4188
4508
|
})
|
|
4189
4509
|
)
|
|
4190
4510
|
);
|
|
4191
|
-
var
|
|
4192
|
-
id: "anthropic.
|
|
4511
|
+
var textEditor_20241022 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
|
|
4512
|
+
id: "anthropic.text_editor_20241022",
|
|
4193
4513
|
name: "str_replace_editor",
|
|
4194
|
-
inputSchema:
|
|
4514
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4195
4515
|
});
|
|
4196
4516
|
|
|
4197
|
-
// src/tool/text-
|
|
4517
|
+
// src/tool/text-editor_20250124.ts
|
|
4198
4518
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4199
4519
|
var import_v417 = require("zod/v4");
|
|
4200
|
-
var
|
|
4520
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4201
4521
|
() => (0, import_provider_utils19.zodSchema)(
|
|
4202
4522
|
import_v417.z.object({
|
|
4203
|
-
command: import_v417.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4523
|
+
command: import_v417.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4204
4524
|
path: import_v417.z.string(),
|
|
4205
4525
|
file_text: import_v417.z.string().optional(),
|
|
4206
4526
|
insert_line: import_v417.z.number().int().optional(),
|
|
@@ -4210,7 +4530,29 @@ var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
4210
4530
|
})
|
|
4211
4531
|
)
|
|
4212
4532
|
);
|
|
4213
|
-
var
|
|
4533
|
+
var textEditor_20250124 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
|
|
4534
|
+
id: "anthropic.text_editor_20250124",
|
|
4535
|
+
name: "str_replace_editor",
|
|
4536
|
+
inputSchema: textEditor_20250124InputSchema
|
|
4537
|
+
});
|
|
4538
|
+
|
|
4539
|
+
// src/tool/text-editor_20250429.ts
|
|
4540
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
4541
|
+
var import_v418 = require("zod/v4");
|
|
4542
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
4543
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
4544
|
+
import_v418.z.object({
|
|
4545
|
+
command: import_v418.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4546
|
+
path: import_v418.z.string(),
|
|
4547
|
+
file_text: import_v418.z.string().optional(),
|
|
4548
|
+
insert_line: import_v418.z.number().int().optional(),
|
|
4549
|
+
new_str: import_v418.z.string().optional(),
|
|
4550
|
+
old_str: import_v418.z.string().optional(),
|
|
4551
|
+
view_range: import_v418.z.array(import_v418.z.number().int()).optional()
|
|
4552
|
+
})
|
|
4553
|
+
)
|
|
4554
|
+
);
|
|
4555
|
+
var textEditor_20250429 = (0, import_provider_utils20.createProviderDefinedToolFactory)({
|
|
4214
4556
|
id: "anthropic.text_editor_20250429",
|
|
4215
4557
|
name: "str_replace_based_edit_tool",
|
|
4216
4558
|
inputSchema: textEditor_20250429InputSchema
|
|
@@ -4299,6 +4641,31 @@ var anthropicTools = {
|
|
|
4299
4641
|
* @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.
|
|
4300
4642
|
*/
|
|
4301
4643
|
computer_20250124,
|
|
4644
|
+
/**
|
|
4645
|
+
* The computer toolset lets Claude control a computer through screenshots,
|
|
4646
|
+
* mouse, and keyboard. It replaces the versioned computer tools
|
|
4647
|
+
* (`computer_20250124` and earlier) on newer models.
|
|
4648
|
+
*
|
|
4649
|
+
* The API returns each computer action as its own `tool_use` block with
|
|
4650
|
+
* `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
|
|
4651
|
+
* and exposes the member name as `action`, so `execute` receives the same
|
|
4652
|
+
* input shape as the older computer tools. Claude may return several actions
|
|
4653
|
+
* in one turn.
|
|
4654
|
+
*
|
|
4655
|
+
* Coordinates are always in the pixel space of the screenshots you return;
|
|
4656
|
+
* there are no display size parameters. Zoom is enabled by default.
|
|
4657
|
+
*
|
|
4658
|
+
* Does not require a beta header.
|
|
4659
|
+
*
|
|
4660
|
+
* Tool name must be `computer`.
|
|
4661
|
+
*
|
|
4662
|
+
* Supported models: Claude Opus 5.5 (required; older computer tool types
|
|
4663
|
+
* are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
|
|
4664
|
+
*
|
|
4665
|
+
* @param configs - Per-member settings keyed by member name, e.g.
|
|
4666
|
+
* `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
|
|
4667
|
+
*/
|
|
4668
|
+
computerToolset_20260801,
|
|
4302
4669
|
/**
|
|
4303
4670
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
4304
4671
|
* Claude can create, read, update, and delete files that persist between sessions,
|
|
@@ -4384,6 +4751,7 @@ var anthropicTools = {
|
|
|
4384
4751
|
0 && (module.exports = {
|
|
4385
4752
|
AnthropicMessagesLanguageModel,
|
|
4386
4753
|
anthropicTools,
|
|
4754
|
+
getModelCapabilities,
|
|
4387
4755
|
prepareTools,
|
|
4388
4756
|
sanitizeJsonSchema
|
|
4389
4757
|
});
|