@ai-sdk/anthropic 2.0.101 → 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 +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 +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 +3 -3
package/dist/index.js
CHANGED
|
@@ -28,14 +28,14 @@ module.exports = __toCommonJS(index_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/anthropic-provider.ts
|
|
30
30
|
var import_provider4 = require("@ai-sdk/provider");
|
|
31
|
-
var
|
|
31
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/version.ts
|
|
34
|
-
var VERSION = true ? "2.0.
|
|
34
|
+
var VERSION = true ? "2.0.103" : "0.0.0-test";
|
|
35
35
|
|
|
36
36
|
// src/anthropic-messages-language-model.ts
|
|
37
37
|
var import_provider3 = require("@ai-sdk/provider");
|
|
38
|
-
var
|
|
38
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
39
39
|
|
|
40
40
|
// src/anthropic-error.ts
|
|
41
41
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -121,7 +121,9 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
121
121
|
type: import_v42.z.literal("tool_use"),
|
|
122
122
|
id: import_v42.z.string(),
|
|
123
123
|
name: import_v42.z.string(),
|
|
124
|
-
input: import_v42.z.unknown()
|
|
124
|
+
input: import_v42.z.unknown(),
|
|
125
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
126
|
+
toolset_name: import_v42.z.string().nullish()
|
|
125
127
|
}),
|
|
126
128
|
import_v42.z.object({
|
|
127
129
|
type: import_v42.z.literal("server_tool_use"),
|
|
@@ -348,7 +350,9 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
348
350
|
import_v42.z.object({
|
|
349
351
|
type: import_v42.z.literal("tool_use"),
|
|
350
352
|
id: import_v42.z.string(),
|
|
351
|
-
name: import_v42.z.string()
|
|
353
|
+
name: import_v42.z.string(),
|
|
354
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
355
|
+
toolset_name: import_v42.z.string().nullish()
|
|
352
356
|
}),
|
|
353
357
|
import_v42.z.object({
|
|
354
358
|
type: import_v42.z.literal("redacted_thinking"),
|
|
@@ -675,7 +679,7 @@ var anthropicSystemMessageProviderOptions = import_v43.z.object({
|
|
|
675
679
|
clearAt: import_v43.z.literal("next_user_message").optional(),
|
|
676
680
|
/**
|
|
677
681
|
* Overrides the effort for the turn following this mid-conversation system
|
|
678
|
-
* message. The required `mid-conversation-
|
|
682
|
+
* message. The required `mid-conversation-output-config-2026-07-01` beta is added
|
|
679
683
|
* automatically.
|
|
680
684
|
*/
|
|
681
685
|
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
@@ -726,7 +730,7 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
726
730
|
*
|
|
727
731
|
* - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
|
|
728
732
|
* - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
|
|
729
|
-
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Fable 5.1).
|
|
733
|
+
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Opus 5.5 and Fable 5.1).
|
|
730
734
|
*/
|
|
731
735
|
structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
732
736
|
/**
|
|
@@ -734,6 +738,11 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
734
738
|
*
|
|
735
739
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
736
740
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
741
|
+
*
|
|
742
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
743
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
744
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
745
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
737
746
|
*/
|
|
738
747
|
thinking: import_v43.z.union([
|
|
739
748
|
import_v43.z.object({
|
|
@@ -979,30 +988,91 @@ var CacheControlValidator = class {
|
|
|
979
988
|
}
|
|
980
989
|
};
|
|
981
990
|
|
|
982
|
-
// src/tool/
|
|
991
|
+
// src/tool/computer-toolset_20260801.ts
|
|
983
992
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
984
993
|
var import_v44 = require("zod/v4");
|
|
985
|
-
var
|
|
994
|
+
var computerToolset_20260801Members = [
|
|
995
|
+
"screenshot",
|
|
996
|
+
"zoom",
|
|
997
|
+
"left_click",
|
|
998
|
+
"right_click",
|
|
999
|
+
"middle_click",
|
|
1000
|
+
"double_click",
|
|
1001
|
+
"triple_click",
|
|
1002
|
+
"left_click_drag",
|
|
1003
|
+
"mouse_move",
|
|
1004
|
+
"left_mouse_down",
|
|
1005
|
+
"left_mouse_up",
|
|
1006
|
+
"cursor_position",
|
|
1007
|
+
"scroll",
|
|
1008
|
+
"type",
|
|
1009
|
+
"key",
|
|
1010
|
+
"hold_key",
|
|
1011
|
+
"wait"
|
|
1012
|
+
];
|
|
1013
|
+
var computerToolset_20260801InputSchema = (0, import_provider_utils3.lazySchema)(
|
|
986
1014
|
() => (0, import_provider_utils3.zodSchema)(
|
|
987
1015
|
import_v44.z.object({
|
|
988
|
-
|
|
1016
|
+
action: import_v44.z.enum(computerToolset_20260801Members),
|
|
1017
|
+
coordinate: import_v44.z.tuple([import_v44.z.number().int(), import_v44.z.number().int()]).optional(),
|
|
1018
|
+
duration: import_v44.z.number().optional(),
|
|
1019
|
+
region: import_v44.z.tuple([
|
|
1020
|
+
import_v44.z.number().int(),
|
|
1021
|
+
import_v44.z.number().int(),
|
|
1022
|
+
import_v44.z.number().int(),
|
|
1023
|
+
import_v44.z.number().int()
|
|
1024
|
+
]).optional(),
|
|
1025
|
+
repeat: import_v44.z.number().int().optional(),
|
|
1026
|
+
scroll_amount: import_v44.z.number().optional(),
|
|
1027
|
+
scroll_direction: import_v44.z.enum(["up", "down", "left", "right"]).optional(),
|
|
1028
|
+
start_coordinate: import_v44.z.tuple([import_v44.z.number().int(), import_v44.z.number().int()]).optional(),
|
|
1029
|
+
text: import_v44.z.string().optional()
|
|
989
1030
|
})
|
|
990
1031
|
)
|
|
991
1032
|
);
|
|
992
|
-
var
|
|
1033
|
+
var computerToolset_20260801ArgsSchema = (0, import_provider_utils3.lazySchema)(
|
|
993
1034
|
() => (0, import_provider_utils3.zodSchema)(
|
|
994
1035
|
import_v44.z.object({
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1036
|
+
configs: import_v44.z.partialRecord(
|
|
1037
|
+
import_v44.z.enum(computerToolset_20260801Members),
|
|
1038
|
+
import_v44.z.object({
|
|
1039
|
+
enabled: import_v44.z.boolean().optional(),
|
|
1040
|
+
deferLoading: import_v44.z.boolean().optional()
|
|
1041
|
+
})
|
|
1042
|
+
).optional()
|
|
1043
|
+
})
|
|
1044
|
+
)
|
|
1045
|
+
);
|
|
1046
|
+
var computerToolset_20260801 = (0, import_provider_utils3.createProviderDefinedToolFactory)({
|
|
1047
|
+
id: "anthropic.computer_toolset_20260801",
|
|
1048
|
+
name: "computer",
|
|
1049
|
+
inputSchema: computerToolset_20260801InputSchema
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
// src/tool/text-editor_20250728.ts
|
|
1053
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1054
|
+
var import_v45 = require("zod/v4");
|
|
1055
|
+
var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
1056
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1057
|
+
import_v45.z.object({
|
|
1058
|
+
maxCharacters: import_v45.z.number().optional()
|
|
1002
1059
|
})
|
|
1003
1060
|
)
|
|
1004
1061
|
);
|
|
1005
|
-
var
|
|
1062
|
+
var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1063
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1064
|
+
import_v45.z.object({
|
|
1065
|
+
command: import_v45.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1066
|
+
path: import_v45.z.string(),
|
|
1067
|
+
file_text: import_v45.z.string().optional(),
|
|
1068
|
+
insert_line: import_v45.z.number().int().optional(),
|
|
1069
|
+
new_str: import_v45.z.string().optional(),
|
|
1070
|
+
old_str: import_v45.z.string().optional(),
|
|
1071
|
+
view_range: import_v45.z.array(import_v45.z.number().int()).optional()
|
|
1072
|
+
})
|
|
1073
|
+
)
|
|
1074
|
+
);
|
|
1075
|
+
var factory = (0, import_provider_utils4.createProviderDefinedToolFactory)({
|
|
1006
1076
|
id: "anthropic.text_editor_20250728",
|
|
1007
1077
|
name: "str_replace_based_edit_tool",
|
|
1008
1078
|
inputSchema: textEditor_20250728InputSchema
|
|
@@ -1012,45 +1082,45 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1012
1082
|
};
|
|
1013
1083
|
|
|
1014
1084
|
// src/tool/web-search_20250305.ts
|
|
1015
|
-
var
|
|
1016
|
-
var
|
|
1017
|
-
var webSearch_20250305ArgsSchema = (0,
|
|
1018
|
-
() => (0,
|
|
1019
|
-
|
|
1020
|
-
maxUses:
|
|
1021
|
-
allowedDomains:
|
|
1022
|
-
blockedDomains:
|
|
1023
|
-
userLocation:
|
|
1024
|
-
type:
|
|
1025
|
-
city:
|
|
1026
|
-
region:
|
|
1027
|
-
country:
|
|
1028
|
-
timezone:
|
|
1085
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1086
|
+
var import_v46 = require("zod/v4");
|
|
1087
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1088
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1089
|
+
import_v46.z.object({
|
|
1090
|
+
maxUses: import_v46.z.number().optional(),
|
|
1091
|
+
allowedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1092
|
+
blockedDomains: import_v46.z.array(import_v46.z.string()).optional(),
|
|
1093
|
+
userLocation: import_v46.z.object({
|
|
1094
|
+
type: import_v46.z.literal("approximate"),
|
|
1095
|
+
city: import_v46.z.string().optional(),
|
|
1096
|
+
region: import_v46.z.string().optional(),
|
|
1097
|
+
country: import_v46.z.string().optional(),
|
|
1098
|
+
timezone: import_v46.z.string().optional()
|
|
1029
1099
|
}).optional()
|
|
1030
1100
|
})
|
|
1031
1101
|
)
|
|
1032
1102
|
);
|
|
1033
|
-
var webSearch_20250305OutputSchema = (0,
|
|
1034
|
-
() => (0,
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
url:
|
|
1038
|
-
title:
|
|
1039
|
-
pageAge:
|
|
1040
|
-
encryptedContent:
|
|
1041
|
-
type:
|
|
1103
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1104
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1105
|
+
import_v46.z.array(
|
|
1106
|
+
import_v46.z.object({
|
|
1107
|
+
url: import_v46.z.string(),
|
|
1108
|
+
title: import_v46.z.string().nullable(),
|
|
1109
|
+
pageAge: import_v46.z.string().nullable(),
|
|
1110
|
+
encryptedContent: import_v46.z.string(),
|
|
1111
|
+
type: import_v46.z.literal("web_search_result")
|
|
1042
1112
|
})
|
|
1043
1113
|
)
|
|
1044
1114
|
)
|
|
1045
1115
|
);
|
|
1046
|
-
var webSearch_20250305InputSchema = (0,
|
|
1047
|
-
() => (0,
|
|
1048
|
-
|
|
1049
|
-
query:
|
|
1116
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1117
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1118
|
+
import_v46.z.object({
|
|
1119
|
+
query: import_v46.z.string()
|
|
1050
1120
|
})
|
|
1051
1121
|
)
|
|
1052
1122
|
);
|
|
1053
|
-
var factory2 = (0,
|
|
1123
|
+
var factory2 = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1054
1124
|
id: "anthropic.web_search_20250305",
|
|
1055
1125
|
name: "web_search",
|
|
1056
1126
|
inputSchema: webSearch_20250305InputSchema,
|
|
@@ -1061,53 +1131,53 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1061
1131
|
};
|
|
1062
1132
|
|
|
1063
1133
|
// src/tool/web-fetch-20250910.ts
|
|
1064
|
-
var
|
|
1065
|
-
var
|
|
1066
|
-
var webFetch_20250910ArgsSchema = (0,
|
|
1067
|
-
() => (0,
|
|
1068
|
-
|
|
1069
|
-
maxUses:
|
|
1070
|
-
allowedDomains:
|
|
1071
|
-
blockedDomains:
|
|
1072
|
-
citations:
|
|
1073
|
-
maxContentTokens:
|
|
1134
|
+
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1135
|
+
var import_v47 = require("zod/v4");
|
|
1136
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1137
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1138
|
+
import_v47.z.object({
|
|
1139
|
+
maxUses: import_v47.z.number().optional(),
|
|
1140
|
+
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1141
|
+
blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1142
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1143
|
+
maxContentTokens: import_v47.z.number().optional()
|
|
1074
1144
|
})
|
|
1075
1145
|
)
|
|
1076
1146
|
);
|
|
1077
|
-
var webFetch_20250910OutputSchema = (0,
|
|
1078
|
-
() => (0,
|
|
1079
|
-
|
|
1080
|
-
type:
|
|
1081
|
-
url:
|
|
1082
|
-
content:
|
|
1083
|
-
type:
|
|
1084
|
-
title:
|
|
1085
|
-
citations:
|
|
1086
|
-
source:
|
|
1087
|
-
|
|
1088
|
-
type:
|
|
1089
|
-
mediaType:
|
|
1090
|
-
data:
|
|
1147
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1148
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1149
|
+
import_v47.z.object({
|
|
1150
|
+
type: import_v47.z.literal("web_fetch_result"),
|
|
1151
|
+
url: import_v47.z.string(),
|
|
1152
|
+
content: import_v47.z.object({
|
|
1153
|
+
type: import_v47.z.literal("document"),
|
|
1154
|
+
title: import_v47.z.string().nullable(),
|
|
1155
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1156
|
+
source: import_v47.z.union([
|
|
1157
|
+
import_v47.z.object({
|
|
1158
|
+
type: import_v47.z.literal("base64"),
|
|
1159
|
+
mediaType: import_v47.z.literal("application/pdf"),
|
|
1160
|
+
data: import_v47.z.string()
|
|
1091
1161
|
}),
|
|
1092
|
-
|
|
1093
|
-
type:
|
|
1094
|
-
mediaType:
|
|
1095
|
-
data:
|
|
1162
|
+
import_v47.z.object({
|
|
1163
|
+
type: import_v47.z.literal("text"),
|
|
1164
|
+
mediaType: import_v47.z.literal("text/plain"),
|
|
1165
|
+
data: import_v47.z.string()
|
|
1096
1166
|
})
|
|
1097
1167
|
])
|
|
1098
1168
|
}),
|
|
1099
|
-
retrievedAt:
|
|
1169
|
+
retrievedAt: import_v47.z.string().nullable()
|
|
1100
1170
|
})
|
|
1101
1171
|
)
|
|
1102
1172
|
);
|
|
1103
|
-
var webFetch_20250910InputSchema = (0,
|
|
1104
|
-
() => (0,
|
|
1105
|
-
|
|
1106
|
-
url:
|
|
1173
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1174
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1175
|
+
import_v47.z.object({
|
|
1176
|
+
url: import_v47.z.string()
|
|
1107
1177
|
})
|
|
1108
1178
|
)
|
|
1109
1179
|
);
|
|
1110
|
-
var factory3 = (0,
|
|
1180
|
+
var factory3 = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1111
1181
|
id: "anthropic.web_fetch_20250910",
|
|
1112
1182
|
name: "web_fetch",
|
|
1113
1183
|
inputSchema: webFetch_20250910InputSchema,
|
|
@@ -1118,12 +1188,13 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1118
1188
|
};
|
|
1119
1189
|
|
|
1120
1190
|
// src/anthropic-prepare-tools.ts
|
|
1121
|
-
var
|
|
1191
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1122
1192
|
async function prepareTools({
|
|
1123
1193
|
tools,
|
|
1124
1194
|
toolChoice,
|
|
1125
1195
|
disableParallelToolUse,
|
|
1126
|
-
cacheControlValidator
|
|
1196
|
+
cacheControlValidator,
|
|
1197
|
+
rejectsForcedToolUse = false
|
|
1127
1198
|
}) {
|
|
1128
1199
|
var _a;
|
|
1129
1200
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -1178,6 +1249,31 @@ async function prepareTools({
|
|
|
1178
1249
|
});
|
|
1179
1250
|
break;
|
|
1180
1251
|
}
|
|
1252
|
+
case "anthropic.computer_toolset_20260801": {
|
|
1253
|
+
const args = await (0, import_provider_utils7.validateTypes)({
|
|
1254
|
+
value: tool.args,
|
|
1255
|
+
schema: computerToolset_20260801ArgsSchema
|
|
1256
|
+
});
|
|
1257
|
+
const configs = args.configs != null ? Object.fromEntries(
|
|
1258
|
+
Object.entries(args.configs).map(([member, config]) => [
|
|
1259
|
+
member,
|
|
1260
|
+
{
|
|
1261
|
+
...(config == null ? void 0 : config.enabled) != null && {
|
|
1262
|
+
enabled: config.enabled
|
|
1263
|
+
},
|
|
1264
|
+
...(config == null ? void 0 : config.deferLoading) != null && {
|
|
1265
|
+
defer_loading: config.deferLoading
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
])
|
|
1269
|
+
) : void 0;
|
|
1270
|
+
anthropicTools2.push({
|
|
1271
|
+
type: "computer_toolset_20260801",
|
|
1272
|
+
...configs != null && { configs },
|
|
1273
|
+
cache_control: void 0
|
|
1274
|
+
});
|
|
1275
|
+
break;
|
|
1276
|
+
}
|
|
1181
1277
|
case "anthropic.computer_20250124": {
|
|
1182
1278
|
betas.add("computer-use-2025-01-24");
|
|
1183
1279
|
anthropicTools2.push({
|
|
@@ -1230,7 +1326,7 @@ async function prepareTools({
|
|
|
1230
1326
|
break;
|
|
1231
1327
|
}
|
|
1232
1328
|
case "anthropic.text_editor_20250728": {
|
|
1233
|
-
const args = await (0,
|
|
1329
|
+
const args = await (0, import_provider_utils7.validateTypes)({
|
|
1234
1330
|
value: tool.args,
|
|
1235
1331
|
schema: textEditor_20250728ArgsSchema
|
|
1236
1332
|
});
|
|
@@ -1270,7 +1366,7 @@ async function prepareTools({
|
|
|
1270
1366
|
}
|
|
1271
1367
|
case "anthropic.web_fetch_20250910": {
|
|
1272
1368
|
betas.add("web-fetch-2025-09-10");
|
|
1273
|
-
const args = await (0,
|
|
1369
|
+
const args = await (0, import_provider_utils7.validateTypes)({
|
|
1274
1370
|
value: tool.args,
|
|
1275
1371
|
schema: webFetch_20250910ArgsSchema
|
|
1276
1372
|
});
|
|
@@ -1287,7 +1383,7 @@ async function prepareTools({
|
|
|
1287
1383
|
break;
|
|
1288
1384
|
}
|
|
1289
1385
|
case "anthropic.web_search_20250305": {
|
|
1290
|
-
const args = await (0,
|
|
1386
|
+
const args = await (0, import_provider_utils7.validateTypes)({
|
|
1291
1387
|
value: tool.args,
|
|
1292
1388
|
schema: webSearch_20250305ArgsSchema
|
|
1293
1389
|
});
|
|
@@ -1336,6 +1432,22 @@ async function prepareTools({
|
|
|
1336
1432
|
betas
|
|
1337
1433
|
};
|
|
1338
1434
|
case "required":
|
|
1435
|
+
if (rejectsForcedToolUse) {
|
|
1436
|
+
toolWarnings.push({
|
|
1437
|
+
type: "unsupported-setting",
|
|
1438
|
+
setting: "toolChoice",
|
|
1439
|
+
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.`
|
|
1440
|
+
});
|
|
1441
|
+
return {
|
|
1442
|
+
tools: anthropicTools2,
|
|
1443
|
+
toolChoice: {
|
|
1444
|
+
type: "auto",
|
|
1445
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
1446
|
+
},
|
|
1447
|
+
toolWarnings,
|
|
1448
|
+
betas
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1339
1451
|
return {
|
|
1340
1452
|
tools: anthropicTools2,
|
|
1341
1453
|
toolChoice: {
|
|
@@ -1348,6 +1460,24 @@ async function prepareTools({
|
|
|
1348
1460
|
case "none":
|
|
1349
1461
|
return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
|
|
1350
1462
|
case "tool":
|
|
1463
|
+
if (rejectsForcedToolUse) {
|
|
1464
|
+
toolWarnings.push({
|
|
1465
|
+
type: "unsupported-setting",
|
|
1466
|
+
setting: "toolChoice",
|
|
1467
|
+
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.`
|
|
1468
|
+
});
|
|
1469
|
+
return {
|
|
1470
|
+
tools: anthropicTools2.filter(
|
|
1471
|
+
(tool) => "name" in tool && tool.name === toolChoice.toolName
|
|
1472
|
+
),
|
|
1473
|
+
toolChoice: {
|
|
1474
|
+
type: "auto",
|
|
1475
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
1476
|
+
},
|
|
1477
|
+
toolWarnings,
|
|
1478
|
+
betas
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1351
1481
|
return {
|
|
1352
1482
|
tools: anthropicTools2,
|
|
1353
1483
|
toolChoice: {
|
|
@@ -1369,29 +1499,29 @@ async function prepareTools({
|
|
|
1369
1499
|
|
|
1370
1500
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1371
1501
|
var import_provider2 = require("@ai-sdk/provider");
|
|
1372
|
-
var
|
|
1502
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1373
1503
|
|
|
1374
1504
|
// src/tool/code-execution_20250522.ts
|
|
1375
|
-
var
|
|
1376
|
-
var
|
|
1377
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
1378
|
-
() => (0,
|
|
1379
|
-
|
|
1380
|
-
type:
|
|
1381
|
-
stdout:
|
|
1382
|
-
stderr:
|
|
1383
|
-
return_code:
|
|
1505
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1506
|
+
var import_v48 = require("zod/v4");
|
|
1507
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1508
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1509
|
+
import_v48.z.object({
|
|
1510
|
+
type: import_v48.z.literal("code_execution_result"),
|
|
1511
|
+
stdout: import_v48.z.string(),
|
|
1512
|
+
stderr: import_v48.z.string(),
|
|
1513
|
+
return_code: import_v48.z.number()
|
|
1384
1514
|
})
|
|
1385
1515
|
)
|
|
1386
1516
|
);
|
|
1387
|
-
var codeExecution_20250522InputSchema = (0,
|
|
1388
|
-
() => (0,
|
|
1389
|
-
|
|
1390
|
-
code:
|
|
1517
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1518
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1519
|
+
import_v48.z.object({
|
|
1520
|
+
code: import_v48.z.string()
|
|
1391
1521
|
})
|
|
1392
1522
|
)
|
|
1393
1523
|
);
|
|
1394
|
-
var factory4 = (0,
|
|
1524
|
+
var factory4 = (0, import_provider_utils8.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1395
1525
|
id: "anthropic.code_execution_20250522",
|
|
1396
1526
|
name: "code_execution",
|
|
1397
1527
|
inputSchema: codeExecution_20250522InputSchema,
|
|
@@ -1402,85 +1532,85 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1402
1532
|
};
|
|
1403
1533
|
|
|
1404
1534
|
// src/tool/code-execution_20250825.ts
|
|
1405
|
-
var
|
|
1406
|
-
var
|
|
1407
|
-
var codeExecution_20250825OutputSchema = (0,
|
|
1408
|
-
() => (0,
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
type:
|
|
1412
|
-
content:
|
|
1413
|
-
|
|
1414
|
-
type:
|
|
1415
|
-
file_id:
|
|
1535
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1536
|
+
var import_v49 = require("zod/v4");
|
|
1537
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1538
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1539
|
+
import_v49.z.discriminatedUnion("type", [
|
|
1540
|
+
import_v49.z.object({
|
|
1541
|
+
type: import_v49.z.literal("bash_code_execution_result"),
|
|
1542
|
+
content: import_v49.z.array(
|
|
1543
|
+
import_v49.z.object({
|
|
1544
|
+
type: import_v49.z.literal("bash_code_execution_output"),
|
|
1545
|
+
file_id: import_v49.z.string()
|
|
1416
1546
|
})
|
|
1417
1547
|
),
|
|
1418
|
-
stdout:
|
|
1419
|
-
stderr:
|
|
1420
|
-
return_code:
|
|
1548
|
+
stdout: import_v49.z.string(),
|
|
1549
|
+
stderr: import_v49.z.string(),
|
|
1550
|
+
return_code: import_v49.z.number()
|
|
1421
1551
|
}),
|
|
1422
|
-
|
|
1423
|
-
type:
|
|
1424
|
-
error_code:
|
|
1552
|
+
import_v49.z.object({
|
|
1553
|
+
type: import_v49.z.literal("bash_code_execution_tool_result_error"),
|
|
1554
|
+
error_code: import_v49.z.string()
|
|
1425
1555
|
}),
|
|
1426
|
-
|
|
1427
|
-
type:
|
|
1428
|
-
error_code:
|
|
1556
|
+
import_v49.z.object({
|
|
1557
|
+
type: import_v49.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1558
|
+
error_code: import_v49.z.string()
|
|
1429
1559
|
}),
|
|
1430
|
-
|
|
1431
|
-
type:
|
|
1432
|
-
content:
|
|
1433
|
-
file_type:
|
|
1434
|
-
num_lines:
|
|
1435
|
-
start_line:
|
|
1436
|
-
total_lines:
|
|
1560
|
+
import_v49.z.object({
|
|
1561
|
+
type: import_v49.z.literal("text_editor_code_execution_view_result"),
|
|
1562
|
+
content: import_v49.z.string(),
|
|
1563
|
+
file_type: import_v49.z.string(),
|
|
1564
|
+
num_lines: import_v49.z.number().nullable(),
|
|
1565
|
+
start_line: import_v49.z.number().nullable(),
|
|
1566
|
+
total_lines: import_v49.z.number().nullable()
|
|
1437
1567
|
}),
|
|
1438
|
-
|
|
1439
|
-
type:
|
|
1440
|
-
is_file_update:
|
|
1568
|
+
import_v49.z.object({
|
|
1569
|
+
type: import_v49.z.literal("text_editor_code_execution_create_result"),
|
|
1570
|
+
is_file_update: import_v49.z.boolean()
|
|
1441
1571
|
}),
|
|
1442
|
-
|
|
1443
|
-
type:
|
|
1444
|
-
lines:
|
|
1445
|
-
new_lines:
|
|
1446
|
-
new_start:
|
|
1447
|
-
old_lines:
|
|
1448
|
-
old_start:
|
|
1572
|
+
import_v49.z.object({
|
|
1573
|
+
type: import_v49.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1574
|
+
lines: import_v49.z.array(import_v49.z.string()).nullable(),
|
|
1575
|
+
new_lines: import_v49.z.number().nullable(),
|
|
1576
|
+
new_start: import_v49.z.number().nullable(),
|
|
1577
|
+
old_lines: import_v49.z.number().nullable(),
|
|
1578
|
+
old_start: import_v49.z.number().nullable()
|
|
1449
1579
|
})
|
|
1450
1580
|
])
|
|
1451
1581
|
)
|
|
1452
1582
|
);
|
|
1453
|
-
var codeExecution_20250825InputSchema = (0,
|
|
1454
|
-
() => (0,
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
type:
|
|
1458
|
-
command:
|
|
1583
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1584
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1585
|
+
import_v49.z.discriminatedUnion("type", [
|
|
1586
|
+
import_v49.z.object({
|
|
1587
|
+
type: import_v49.z.literal("bash_code_execution"),
|
|
1588
|
+
command: import_v49.z.string()
|
|
1459
1589
|
}),
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
type:
|
|
1463
|
-
command:
|
|
1464
|
-
path:
|
|
1590
|
+
import_v49.z.discriminatedUnion("command", [
|
|
1591
|
+
import_v49.z.object({
|
|
1592
|
+
type: import_v49.z.literal("text_editor_code_execution"),
|
|
1593
|
+
command: import_v49.z.literal("view"),
|
|
1594
|
+
path: import_v49.z.string()
|
|
1465
1595
|
}),
|
|
1466
|
-
|
|
1467
|
-
type:
|
|
1468
|
-
command:
|
|
1469
|
-
path:
|
|
1470
|
-
file_text:
|
|
1596
|
+
import_v49.z.object({
|
|
1597
|
+
type: import_v49.z.literal("text_editor_code_execution"),
|
|
1598
|
+
command: import_v49.z.literal("create"),
|
|
1599
|
+
path: import_v49.z.string(),
|
|
1600
|
+
file_text: import_v49.z.string().nullish()
|
|
1471
1601
|
}),
|
|
1472
|
-
|
|
1473
|
-
type:
|
|
1474
|
-
command:
|
|
1475
|
-
path:
|
|
1476
|
-
old_str:
|
|
1477
|
-
new_str:
|
|
1602
|
+
import_v49.z.object({
|
|
1603
|
+
type: import_v49.z.literal("text_editor_code_execution"),
|
|
1604
|
+
command: import_v49.z.literal("str_replace"),
|
|
1605
|
+
path: import_v49.z.string(),
|
|
1606
|
+
old_str: import_v49.z.string(),
|
|
1607
|
+
new_str: import_v49.z.string()
|
|
1478
1608
|
})
|
|
1479
1609
|
])
|
|
1480
1610
|
])
|
|
1481
1611
|
)
|
|
1482
1612
|
);
|
|
1483
|
-
var factory5 = (0,
|
|
1613
|
+
var factory5 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1484
1614
|
id: "anthropic.code_execution_20250825",
|
|
1485
1615
|
name: "code_execution",
|
|
1486
1616
|
inputSchema: codeExecution_20250825InputSchema,
|
|
@@ -1511,7 +1641,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1511
1641
|
prompt,
|
|
1512
1642
|
sendReasoning,
|
|
1513
1643
|
warnings,
|
|
1514
|
-
cacheControlValidator
|
|
1644
|
+
cacheControlValidator,
|
|
1645
|
+
toolsetNames = {}
|
|
1515
1646
|
}) {
|
|
1516
1647
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1517
1648
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -1521,7 +1652,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1521
1652
|
const messages = [];
|
|
1522
1653
|
async function shouldEnableCitations(providerMetadata) {
|
|
1523
1654
|
var _a2, _b2;
|
|
1524
|
-
const anthropicOptions = await (0,
|
|
1655
|
+
const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1525
1656
|
provider: "anthropic",
|
|
1526
1657
|
providerOptions: providerMetadata,
|
|
1527
1658
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1529,7 +1660,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1529
1660
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
1530
1661
|
}
|
|
1531
1662
|
async function getDocumentMetadata(providerMetadata) {
|
|
1532
|
-
const anthropicOptions = await (0,
|
|
1663
|
+
const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1533
1664
|
provider: "anthropic",
|
|
1534
1665
|
providerOptions: providerMetadata,
|
|
1535
1666
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1550,7 +1681,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1550
1681
|
let clearAt = void 0;
|
|
1551
1682
|
let effort = void 0;
|
|
1552
1683
|
for (const { content: text, providerOptions } of block.messages) {
|
|
1553
|
-
const systemMessageOptions = await (0,
|
|
1684
|
+
const systemMessageOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1554
1685
|
provider: "anthropic",
|
|
1555
1686
|
providerOptions,
|
|
1556
1687
|
schema: anthropicSystemMessageProviderOptions
|
|
@@ -1605,7 +1736,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1605
1736
|
betas.add("mid-conversation-system-clear-at-2026-08-21");
|
|
1606
1737
|
}
|
|
1607
1738
|
if (effort != null) {
|
|
1608
|
-
betas.add("mid-conversation-
|
|
1739
|
+
betas.add("mid-conversation-output-config-2026-07-01");
|
|
1609
1740
|
}
|
|
1610
1741
|
}
|
|
1611
1742
|
break;
|
|
@@ -1645,7 +1776,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1645
1776
|
} : {
|
|
1646
1777
|
type: "base64",
|
|
1647
1778
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
1648
|
-
data: (0,
|
|
1779
|
+
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
1649
1780
|
},
|
|
1650
1781
|
cache_control: cacheControl
|
|
1651
1782
|
});
|
|
@@ -1665,7 +1796,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1665
1796
|
} : {
|
|
1666
1797
|
type: "base64",
|
|
1667
1798
|
media_type: "application/pdf",
|
|
1668
|
-
data: (0,
|
|
1799
|
+
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
1669
1800
|
},
|
|
1670
1801
|
title: (_e = metadata.title) != null ? _e : part.filename,
|
|
1671
1802
|
...metadata.context && { context: metadata.context },
|
|
@@ -1770,9 +1901,15 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1770
1901
|
contentValue = JSON.stringify(output.value);
|
|
1771
1902
|
break;
|
|
1772
1903
|
}
|
|
1904
|
+
const toolsetName = getAnthropicToolsetName({
|
|
1905
|
+
toolName: part.toolName,
|
|
1906
|
+
providerOptions: part.providerOptions,
|
|
1907
|
+
toolsetNames
|
|
1908
|
+
});
|
|
1773
1909
|
anthropicContent.push({
|
|
1774
1910
|
type: "tool_result",
|
|
1775
1911
|
tool_use_id: part.toolCallId,
|
|
1912
|
+
...toolsetName != null && { toolset_name: toolsetName },
|
|
1776
1913
|
content: contentValue,
|
|
1777
1914
|
is_error: output.type === "error-text" || output.type === "error-json" ? true : void 0,
|
|
1778
1915
|
cache_control: cacheControl
|
|
@@ -1833,7 +1970,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1833
1970
|
}
|
|
1834
1971
|
case "reasoning": {
|
|
1835
1972
|
if (sendReasoning) {
|
|
1836
|
-
const reasoningMetadata = await (0,
|
|
1973
|
+
const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1837
1974
|
provider: "anthropic",
|
|
1838
1975
|
providerOptions: part.providerOptions,
|
|
1839
1976
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -1907,6 +2044,30 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1907
2044
|
}
|
|
1908
2045
|
break;
|
|
1909
2046
|
}
|
|
2047
|
+
const toolsetName = getAnthropicToolsetName({
|
|
2048
|
+
toolName: part.toolName,
|
|
2049
|
+
providerOptions: part.providerOptions,
|
|
2050
|
+
toolsetNames
|
|
2051
|
+
});
|
|
2052
|
+
if (toolsetName != null) {
|
|
2053
|
+
const { action, ...memberInput } = typeof part.input === "object" && part.input !== null && !Array.isArray(part.input) ? part.input : {};
|
|
2054
|
+
if (typeof action !== "string") {
|
|
2055
|
+
warnings.push({
|
|
2056
|
+
type: "other",
|
|
2057
|
+
message: `toolset tool call for tool ${part.toolName} is missing the action`
|
|
2058
|
+
});
|
|
2059
|
+
break;
|
|
2060
|
+
}
|
|
2061
|
+
anthropicContent.push({
|
|
2062
|
+
type: "tool_use",
|
|
2063
|
+
id: part.toolCallId,
|
|
2064
|
+
name: action,
|
|
2065
|
+
toolset_name: toolsetName,
|
|
2066
|
+
input: memberInput,
|
|
2067
|
+
cache_control: cacheControl
|
|
2068
|
+
});
|
|
2069
|
+
break;
|
|
2070
|
+
}
|
|
1910
2071
|
anthropicContent.push({
|
|
1911
2072
|
type: "tool_use",
|
|
1912
2073
|
id: part.toolCallId,
|
|
@@ -1934,7 +2095,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1934
2095
|
break;
|
|
1935
2096
|
}
|
|
1936
2097
|
if (output.value.type === "code_execution_result") {
|
|
1937
|
-
const codeExecutionOutput = await (0,
|
|
2098
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1938
2099
|
value: output.value,
|
|
1939
2100
|
schema: codeExecution_20250522OutputSchema
|
|
1940
2101
|
});
|
|
@@ -1950,7 +2111,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1950
2111
|
cache_control: cacheControl
|
|
1951
2112
|
});
|
|
1952
2113
|
} else {
|
|
1953
|
-
const codeExecutionOutput = await (0,
|
|
2114
|
+
const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1954
2115
|
value: output.value,
|
|
1955
2116
|
schema: codeExecution_20250825OutputSchema
|
|
1956
2117
|
});
|
|
@@ -1987,7 +2148,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1987
2148
|
});
|
|
1988
2149
|
break;
|
|
1989
2150
|
}
|
|
1990
|
-
const webFetchOutput = await (0,
|
|
2151
|
+
const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
1991
2152
|
value: output.value,
|
|
1992
2153
|
schema: webFetch_20250910OutputSchema
|
|
1993
2154
|
});
|
|
@@ -2022,7 +2183,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2022
2183
|
});
|
|
2023
2184
|
break;
|
|
2024
2185
|
}
|
|
2025
|
-
const webSearchOutput = await (0,
|
|
2186
|
+
const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
|
|
2026
2187
|
value: output.value,
|
|
2027
2188
|
schema: webSearch_20250305OutputSchema
|
|
2028
2189
|
});
|
|
@@ -2133,6 +2294,19 @@ function moveToolUseBlocksToEnd(content) {
|
|
|
2133
2294
|
flushSegment();
|
|
2134
2295
|
return result;
|
|
2135
2296
|
}
|
|
2297
|
+
function getAnthropicToolsetName({
|
|
2298
|
+
toolName,
|
|
2299
|
+
providerOptions,
|
|
2300
|
+
toolsetNames
|
|
2301
|
+
}) {
|
|
2302
|
+
var _a;
|
|
2303
|
+
const fromTools = toolsetNames[toolName];
|
|
2304
|
+
if (fromTools != null) {
|
|
2305
|
+
return fromTools;
|
|
2306
|
+
}
|
|
2307
|
+
const fromMetadata = (_a = providerOptions == null ? void 0 : providerOptions.anthropic) == null ? void 0 : _a.toolsetName;
|
|
2308
|
+
return typeof fromMetadata === "string" ? fromMetadata : void 0;
|
|
2309
|
+
}
|
|
2136
2310
|
|
|
2137
2311
|
// src/map-anthropic-stop-reason.ts
|
|
2138
2312
|
function mapAnthropicStopReason({
|
|
@@ -2304,6 +2478,24 @@ function isPlainObject(value) {
|
|
|
2304
2478
|
}
|
|
2305
2479
|
|
|
2306
2480
|
// src/anthropic-messages-language-model.ts
|
|
2481
|
+
function getAnthropicToolsetNames(tools) {
|
|
2482
|
+
const toolsetNames = {};
|
|
2483
|
+
for (const tool of tools != null ? tools : []) {
|
|
2484
|
+
if (tool.type === "provider-defined" && tool.id === "anthropic.computer_toolset_20260801") {
|
|
2485
|
+
toolsetNames[tool.name] = "computer";
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
return toolsetNames;
|
|
2489
|
+
}
|
|
2490
|
+
function toToolsetMemberInput({
|
|
2491
|
+
memberName,
|
|
2492
|
+
input
|
|
2493
|
+
}) {
|
|
2494
|
+
return {
|
|
2495
|
+
action: memberName,
|
|
2496
|
+
...typeof input === "object" && input !== null && !Array.isArray(input) ? input : {}
|
|
2497
|
+
};
|
|
2498
|
+
}
|
|
2307
2499
|
function getJsonResponseToolName(tools) {
|
|
2308
2500
|
const toolNames = new Set(tools == null ? void 0 : tools.map((tool) => tool.name));
|
|
2309
2501
|
let name = "json";
|
|
@@ -2348,7 +2540,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2348
2540
|
var _a;
|
|
2349
2541
|
this.modelId = modelId;
|
|
2350
2542
|
this.config = config;
|
|
2351
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
2543
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
|
|
2352
2544
|
}
|
|
2353
2545
|
supportsUrl(url) {
|
|
2354
2546
|
return url.protocol === "https:";
|
|
@@ -2420,7 +2612,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2420
2612
|
});
|
|
2421
2613
|
}
|
|
2422
2614
|
}
|
|
2423
|
-
const anthropicOptions = await (0,
|
|
2615
|
+
const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
|
|
2424
2616
|
provider: "anthropic",
|
|
2425
2617
|
providerOptions,
|
|
2426
2618
|
schema: anthropicProviderOptions
|
|
@@ -2430,6 +2622,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2430
2622
|
supportsStructuredOutput,
|
|
2431
2623
|
rejectsSamplingParameters,
|
|
2432
2624
|
rejectsThinkingDisabledAboveHighEffort,
|
|
2625
|
+
rejectsThinkingDisabled,
|
|
2626
|
+
rejectsForcedToolUse,
|
|
2433
2627
|
isKnownModel
|
|
2434
2628
|
} = getModelCapabilities(this.modelId);
|
|
2435
2629
|
if (!isKnownModel && maxOutputTokens == null) {
|
|
@@ -2465,8 +2659,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2465
2659
|
}
|
|
2466
2660
|
}
|
|
2467
2661
|
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
2468
|
-
const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") ? "auto" : "jsonTool";
|
|
2469
|
-
|
|
2662
|
+
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";
|
|
2663
|
+
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
2664
|
+
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
2665
|
+
warnings.push({
|
|
2666
|
+
type: "unsupported-setting",
|
|
2667
|
+
setting: "providerOptions.anthropic.structuredOutputMode",
|
|
2668
|
+
details: `structuredOutputMode 'jsonTool' is not supported by ${this.modelId} because it rejects forced tool use. Using 'outputFormat' instead.`
|
|
2669
|
+
});
|
|
2670
|
+
useStructuredOutput = true;
|
|
2671
|
+
}
|
|
2470
2672
|
const jsonResponseToolName = getJsonResponseToolName(tools);
|
|
2471
2673
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
2472
2674
|
type: "function",
|
|
@@ -2482,12 +2684,37 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2482
2684
|
});
|
|
2483
2685
|
}
|
|
2484
2686
|
const cacheControlValidator = new CacheControlValidator();
|
|
2687
|
+
const toolsetNames = getAnthropicToolsetNames(tools);
|
|
2485
2688
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
2486
2689
|
prompt,
|
|
2487
2690
|
sendReasoning: (_b = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _b : true,
|
|
2488
2691
|
warnings,
|
|
2489
|
-
cacheControlValidator
|
|
2692
|
+
cacheControlValidator,
|
|
2693
|
+
toolsetNames
|
|
2490
2694
|
});
|
|
2695
|
+
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
2696
|
+
const thinking = anthropicOptions.thinking;
|
|
2697
|
+
if ("type" in thinking && thinking.type === "disabled") {
|
|
2698
|
+
warnings.push({
|
|
2699
|
+
type: "unsupported-setting",
|
|
2700
|
+
setting: "providerOptions.anthropic.thinking",
|
|
2701
|
+
details: `thinking cannot be disabled for ${this.modelId}; it always uses adaptive thinking. The thinking setting has been removed. Lower 'effort' to reduce thinking.`
|
|
2702
|
+
});
|
|
2703
|
+
anthropicOptions.thinking = void 0;
|
|
2704
|
+
} else if ("type" in thinking && thinking.type === "enabled") {
|
|
2705
|
+
warnings.push({
|
|
2706
|
+
type: "unsupported-setting",
|
|
2707
|
+
setting: "providerOptions.anthropic.thinking",
|
|
2708
|
+
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.`
|
|
2709
|
+
});
|
|
2710
|
+
anthropicOptions.thinking = {
|
|
2711
|
+
type: "adaptive",
|
|
2712
|
+
...thinking.blockBinding != null && {
|
|
2713
|
+
blockBinding: thinking.blockBinding
|
|
2714
|
+
}
|
|
2715
|
+
};
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2491
2718
|
const thinkingOptions = anthropicOptions == null ? void 0 : anthropicOptions.thinking;
|
|
2492
2719
|
const thinkingType = thinkingOptions != null && "type" in thinkingOptions ? thinkingOptions.type : void 0;
|
|
2493
2720
|
if (rejectsThinkingDisabledAboveHighEffort && thinkingType === "disabled" && anthropicOptions != null && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
@@ -2729,12 +2956,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2729
2956
|
tools: [...tools != null ? tools : [], jsonResponseTool],
|
|
2730
2957
|
toolChoice: tools != null && tools.length > 0 ? { type: "required" } : { type: "tool", toolName: jsonResponseTool.name },
|
|
2731
2958
|
disableParallelToolUse: true,
|
|
2732
|
-
cacheControlValidator
|
|
2959
|
+
cacheControlValidator,
|
|
2960
|
+
rejectsForcedToolUse
|
|
2733
2961
|
} : {
|
|
2734
2962
|
tools: tools != null ? tools : [],
|
|
2735
2963
|
toolChoice,
|
|
2736
2964
|
disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
|
|
2737
|
-
cacheControlValidator
|
|
2965
|
+
cacheControlValidator,
|
|
2966
|
+
rejectsForcedToolUse
|
|
2738
2967
|
}
|
|
2739
2968
|
);
|
|
2740
2969
|
const cacheWarnings = cacheControlValidator.getWarnings();
|
|
@@ -2758,15 +2987,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2758
2987
|
betas,
|
|
2759
2988
|
headers
|
|
2760
2989
|
}) {
|
|
2761
|
-
return (0,
|
|
2762
|
-
await (0,
|
|
2990
|
+
return (0, import_provider_utils11.combineHeaders)(
|
|
2991
|
+
await (0, import_provider_utils11.resolve)(this.config.headers),
|
|
2763
2992
|
headers,
|
|
2764
2993
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
2765
2994
|
);
|
|
2766
2995
|
}
|
|
2767
2996
|
async getBetasFromHeaders(requestHeaders) {
|
|
2768
2997
|
var _a, _b;
|
|
2769
|
-
const configHeaders = await (0,
|
|
2998
|
+
const configHeaders = await (0, import_provider_utils11.resolve)(this.config.headers);
|
|
2770
2999
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
2771
3000
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
2772
3001
|
return new Set(
|
|
@@ -2818,12 +3047,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2818
3047
|
responseHeaders,
|
|
2819
3048
|
value: response,
|
|
2820
3049
|
rawValue: rawResponse
|
|
2821
|
-
} = await (0,
|
|
3050
|
+
} = await (0, import_provider_utils11.postJsonToApi)({
|
|
2822
3051
|
url: this.buildRequestUrl(false),
|
|
2823
3052
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
2824
3053
|
body: this.transformRequestBody(args, betas),
|
|
2825
3054
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
2826
|
-
successfulResponseHandler: (0,
|
|
3055
|
+
successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
|
|
2827
3056
|
anthropicMessagesResponseSchema
|
|
2828
3057
|
),
|
|
2829
3058
|
abortSignal: options.abortSignal,
|
|
@@ -2908,6 +3137,21 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2908
3137
|
type: "text",
|
|
2909
3138
|
text: JSON.stringify(part.input)
|
|
2910
3139
|
});
|
|
3140
|
+
} else if (part.toolset_name != null) {
|
|
3141
|
+
content.push({
|
|
3142
|
+
type: "tool-call",
|
|
3143
|
+
toolCallId: part.id,
|
|
3144
|
+
toolName: part.toolset_name,
|
|
3145
|
+
input: JSON.stringify(
|
|
3146
|
+
toToolsetMemberInput({
|
|
3147
|
+
memberName: part.name,
|
|
3148
|
+
input: part.input
|
|
3149
|
+
})
|
|
3150
|
+
),
|
|
3151
|
+
providerMetadata: {
|
|
3152
|
+
anthropic: { toolsetName: part.toolset_name }
|
|
3153
|
+
}
|
|
3154
|
+
});
|
|
2911
3155
|
} else {
|
|
2912
3156
|
content.push({
|
|
2913
3157
|
type: "tool-call",
|
|
@@ -3172,12 +3416,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3172
3416
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
3173
3417
|
const body = { ...args, stream: true };
|
|
3174
3418
|
const url = this.buildRequestUrl(true);
|
|
3175
|
-
const { responseHeaders, value: response } = await (0,
|
|
3419
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
|
|
3176
3420
|
url,
|
|
3177
3421
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3178
3422
|
body: this.transformRequestBody(body, betas),
|
|
3179
3423
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3180
|
-
successfulResponseHandler: (0,
|
|
3424
|
+
successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
|
|
3181
3425
|
anthropicMessagesChunkSchema
|
|
3182
3426
|
),
|
|
3183
3427
|
abortSignal: options.abortSignal,
|
|
@@ -3292,6 +3536,23 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3292
3536
|
type: "text-start",
|
|
3293
3537
|
id: String(value.index)
|
|
3294
3538
|
});
|
|
3539
|
+
} else if (value.content_block.toolset_name != null) {
|
|
3540
|
+
contentBlocks[value.index] = {
|
|
3541
|
+
type: "tool-call",
|
|
3542
|
+
toolCallId: value.content_block.id,
|
|
3543
|
+
toolName: value.content_block.toolset_name,
|
|
3544
|
+
input: "",
|
|
3545
|
+
firstDelta: true,
|
|
3546
|
+
toolset: {
|
|
3547
|
+
name: value.content_block.toolset_name,
|
|
3548
|
+
memberName: value.content_block.name
|
|
3549
|
+
}
|
|
3550
|
+
};
|
|
3551
|
+
controller.enqueue({
|
|
3552
|
+
type: "tool-input-start",
|
|
3553
|
+
id: value.content_block.id,
|
|
3554
|
+
toolName: value.content_block.toolset_name
|
|
3555
|
+
});
|
|
3295
3556
|
} else {
|
|
3296
3557
|
contentBlocks[value.index] = {
|
|
3297
3558
|
type: "tool-call",
|
|
@@ -3502,6 +3763,25 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3502
3763
|
break;
|
|
3503
3764
|
}
|
|
3504
3765
|
case "tool-call": {
|
|
3766
|
+
if (contentBlock.toolset != null) {
|
|
3767
|
+
let memberInput = {};
|
|
3768
|
+
try {
|
|
3769
|
+
memberInput = contentBlock.input === "" ? {} : JSON.parse(contentBlock.input);
|
|
3770
|
+
} catch (e) {
|
|
3771
|
+
memberInput = void 0;
|
|
3772
|
+
}
|
|
3773
|
+
contentBlock.input = memberInput === void 0 ? contentBlock.input : JSON.stringify(
|
|
3774
|
+
toToolsetMemberInput({
|
|
3775
|
+
memberName: contentBlock.toolset.memberName,
|
|
3776
|
+
input: memberInput
|
|
3777
|
+
})
|
|
3778
|
+
);
|
|
3779
|
+
controller.enqueue({
|
|
3780
|
+
type: "tool-input-delta",
|
|
3781
|
+
id: contentBlock.toolCallId,
|
|
3782
|
+
delta: contentBlock.input
|
|
3783
|
+
});
|
|
3784
|
+
}
|
|
3505
3785
|
controller.enqueue({
|
|
3506
3786
|
type: "tool-input-end",
|
|
3507
3787
|
id: contentBlock.toolCallId
|
|
@@ -3512,7 +3792,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3512
3792
|
toolCallId: contentBlock.toolCallId,
|
|
3513
3793
|
toolName,
|
|
3514
3794
|
input: contentBlock.input === "" ? "{}" : contentBlock.input,
|
|
3515
|
-
providerExecuted: contentBlock.providerExecuted
|
|
3795
|
+
providerExecuted: contentBlock.providerExecuted,
|
|
3796
|
+
...contentBlock.toolset && {
|
|
3797
|
+
providerMetadata: {
|
|
3798
|
+
anthropic: { toolsetName: contentBlock.toolset.name }
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3516
3801
|
});
|
|
3517
3802
|
break;
|
|
3518
3803
|
}
|
|
@@ -3585,6 +3870,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3585
3870
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
3586
3871
|
return;
|
|
3587
3872
|
}
|
|
3873
|
+
if (contentBlock.toolset != null) {
|
|
3874
|
+
contentBlock.input += delta;
|
|
3875
|
+
return;
|
|
3876
|
+
}
|
|
3588
3877
|
if (contentBlock.firstDelta && (contentBlock.toolName === "bash_code_execution" || contentBlock.toolName === "text_editor_code_execution")) {
|
|
3589
3878
|
delta = `{"type": "${contentBlock.toolName}",${delta.substring(1)}`;
|
|
3590
3879
|
}
|
|
@@ -3801,20 +4090,54 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3801
4090
|
}
|
|
3802
4091
|
};
|
|
3803
4092
|
function getModelCapabilities(modelId) {
|
|
3804
|
-
if (modelId.includes("claude-opus-5")) {
|
|
4093
|
+
if (modelId.includes("claude-opus-5-5")) {
|
|
4094
|
+
return {
|
|
4095
|
+
maxOutputTokens: 128e3,
|
|
4096
|
+
supportsStructuredOutput: true,
|
|
4097
|
+
rejectsSamplingParameters: true,
|
|
4098
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4099
|
+
rejectsThinkingDisabled: true,
|
|
4100
|
+
rejectsForcedToolUse: true,
|
|
4101
|
+
isKnownModel: true
|
|
4102
|
+
};
|
|
4103
|
+
} else if (modelId.includes("claude-opus-5")) {
|
|
3805
4104
|
return {
|
|
3806
4105
|
maxOutputTokens: 128e3,
|
|
3807
4106
|
supportsStructuredOutput: true,
|
|
3808
4107
|
rejectsSamplingParameters: true,
|
|
3809
4108
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4109
|
+
rejectsThinkingDisabled: false,
|
|
4110
|
+
rejectsForcedToolUse: false,
|
|
4111
|
+
isKnownModel: true
|
|
4112
|
+
};
|
|
4113
|
+
} else if (modelId.includes("claude-fable-5-1")) {
|
|
4114
|
+
return {
|
|
4115
|
+
maxOutputTokens: 128e3,
|
|
4116
|
+
supportsStructuredOutput: true,
|
|
4117
|
+
rejectsSamplingParameters: true,
|
|
4118
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4119
|
+
rejectsThinkingDisabled: true,
|
|
4120
|
+
rejectsForcedToolUse: true,
|
|
3810
4121
|
isKnownModel: true
|
|
3811
4122
|
};
|
|
3812
|
-
} else if (modelId.includes("claude-
|
|
4123
|
+
} else if (modelId.includes("claude-fable-5")) {
|
|
3813
4124
|
return {
|
|
3814
4125
|
maxOutputTokens: 128e3,
|
|
3815
4126
|
supportsStructuredOutput: true,
|
|
3816
4127
|
rejectsSamplingParameters: true,
|
|
3817
4128
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4129
|
+
rejectsThinkingDisabled: true,
|
|
4130
|
+
rejectsForcedToolUse: false,
|
|
4131
|
+
isKnownModel: true
|
|
4132
|
+
};
|
|
4133
|
+
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) {
|
|
4134
|
+
return {
|
|
4135
|
+
maxOutputTokens: 128e3,
|
|
4136
|
+
supportsStructuredOutput: true,
|
|
4137
|
+
rejectsSamplingParameters: true,
|
|
4138
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4139
|
+
rejectsThinkingDisabled: false,
|
|
4140
|
+
rejectsForcedToolUse: false,
|
|
3818
4141
|
isKnownModel: true
|
|
3819
4142
|
};
|
|
3820
4143
|
} else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
|
|
@@ -3823,6 +4146,8 @@ function getModelCapabilities(modelId) {
|
|
|
3823
4146
|
supportsStructuredOutput: true,
|
|
3824
4147
|
rejectsSamplingParameters: false,
|
|
3825
4148
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4149
|
+
rejectsThinkingDisabled: false,
|
|
4150
|
+
rejectsForcedToolUse: false,
|
|
3826
4151
|
isKnownModel: true
|
|
3827
4152
|
};
|
|
3828
4153
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
@@ -3831,6 +4156,8 @@ function getModelCapabilities(modelId) {
|
|
|
3831
4156
|
supportsStructuredOutput: true,
|
|
3832
4157
|
rejectsSamplingParameters: false,
|
|
3833
4158
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4159
|
+
rejectsThinkingDisabled: false,
|
|
4160
|
+
rejectsForcedToolUse: false,
|
|
3834
4161
|
isKnownModel: true
|
|
3835
4162
|
};
|
|
3836
4163
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
@@ -3839,6 +4166,8 @@ function getModelCapabilities(modelId) {
|
|
|
3839
4166
|
supportsStructuredOutput: true,
|
|
3840
4167
|
rejectsSamplingParameters: false,
|
|
3841
4168
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4169
|
+
rejectsThinkingDisabled: false,
|
|
4170
|
+
rejectsForcedToolUse: false,
|
|
3842
4171
|
isKnownModel: true
|
|
3843
4172
|
};
|
|
3844
4173
|
} else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet")) {
|
|
@@ -3847,6 +4176,8 @@ function getModelCapabilities(modelId) {
|
|
|
3847
4176
|
supportsStructuredOutput: false,
|
|
3848
4177
|
rejectsSamplingParameters: false,
|
|
3849
4178
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4179
|
+
rejectsThinkingDisabled: false,
|
|
4180
|
+
rejectsForcedToolUse: false,
|
|
3850
4181
|
isKnownModel: true
|
|
3851
4182
|
};
|
|
3852
4183
|
} else if (modelId.includes("claude-opus-4-")) {
|
|
@@ -3855,6 +4186,8 @@ function getModelCapabilities(modelId) {
|
|
|
3855
4186
|
supportsStructuredOutput: false,
|
|
3856
4187
|
rejectsSamplingParameters: false,
|
|
3857
4188
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4189
|
+
rejectsThinkingDisabled: false,
|
|
4190
|
+
rejectsForcedToolUse: false,
|
|
3858
4191
|
isKnownModel: true
|
|
3859
4192
|
};
|
|
3860
4193
|
} else if (modelId.includes("claude-3-haiku")) {
|
|
@@ -3863,6 +4196,8 @@ function getModelCapabilities(modelId) {
|
|
|
3863
4196
|
supportsStructuredOutput: false,
|
|
3864
4197
|
rejectsSamplingParameters: false,
|
|
3865
4198
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4199
|
+
rejectsThinkingDisabled: false,
|
|
4200
|
+
rejectsForcedToolUse: false,
|
|
3866
4201
|
isKnownModel: true
|
|
3867
4202
|
};
|
|
3868
4203
|
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
@@ -3871,6 +4206,8 @@ function getModelCapabilities(modelId) {
|
|
|
3871
4206
|
supportsStructuredOutput: false,
|
|
3872
4207
|
rejectsSamplingParameters: false,
|
|
3873
4208
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4209
|
+
rejectsThinkingDisabled: false,
|
|
4210
|
+
rejectsForcedToolUse: false,
|
|
3874
4211
|
isKnownModel: false
|
|
3875
4212
|
};
|
|
3876
4213
|
} else if (modelId.includes("claude-")) {
|
|
@@ -3879,6 +4216,8 @@ function getModelCapabilities(modelId) {
|
|
|
3879
4216
|
supportsStructuredOutput: true,
|
|
3880
4217
|
rejectsSamplingParameters: true,
|
|
3881
4218
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4219
|
+
rejectsThinkingDisabled: false,
|
|
4220
|
+
rejectsForcedToolUse: false,
|
|
3882
4221
|
isKnownModel: false
|
|
3883
4222
|
};
|
|
3884
4223
|
} else {
|
|
@@ -3887,6 +4226,8 @@ function getModelCapabilities(modelId) {
|
|
|
3887
4226
|
supportsStructuredOutput: false,
|
|
3888
4227
|
rejectsSamplingParameters: false,
|
|
3889
4228
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4229
|
+
rejectsThinkingDisabled: false,
|
|
4230
|
+
rejectsForcedToolUse: false,
|
|
3890
4231
|
isKnownModel: false
|
|
3891
4232
|
};
|
|
3892
4233
|
}
|
|
@@ -3904,135 +4245,135 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
3904
4245
|
}
|
|
3905
4246
|
|
|
3906
4247
|
// src/tool/bash_20241022.ts
|
|
3907
|
-
var
|
|
3908
|
-
var
|
|
3909
|
-
var bash_20241022InputSchema = (0,
|
|
3910
|
-
() => (0,
|
|
3911
|
-
|
|
3912
|
-
command:
|
|
3913
|
-
restart:
|
|
4248
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
4249
|
+
var import_v410 = require("zod/v4");
|
|
4250
|
+
var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
4251
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
4252
|
+
import_v410.z.object({
|
|
4253
|
+
command: import_v410.z.string(),
|
|
4254
|
+
restart: import_v410.z.boolean().optional()
|
|
3914
4255
|
})
|
|
3915
4256
|
)
|
|
3916
4257
|
);
|
|
3917
|
-
var bash_20241022 = (0,
|
|
4258
|
+
var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
|
|
3918
4259
|
id: "anthropic.bash_20241022",
|
|
3919
4260
|
name: "bash",
|
|
3920
4261
|
inputSchema: bash_20241022InputSchema
|
|
3921
4262
|
});
|
|
3922
4263
|
|
|
3923
4264
|
// src/tool/bash_20250124.ts
|
|
3924
|
-
var
|
|
3925
|
-
var
|
|
3926
|
-
var bash_20250124InputSchema = (0,
|
|
3927
|
-
() => (0,
|
|
3928
|
-
|
|
3929
|
-
command:
|
|
3930
|
-
restart:
|
|
4265
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
4266
|
+
var import_v411 = require("zod/v4");
|
|
4267
|
+
var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
4268
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
4269
|
+
import_v411.z.object({
|
|
4270
|
+
command: import_v411.z.string(),
|
|
4271
|
+
restart: import_v411.z.boolean().optional()
|
|
3931
4272
|
})
|
|
3932
4273
|
)
|
|
3933
4274
|
);
|
|
3934
|
-
var bash_20250124 = (0,
|
|
4275
|
+
var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
3935
4276
|
id: "anthropic.bash_20250124",
|
|
3936
4277
|
name: "bash",
|
|
3937
4278
|
inputSchema: bash_20250124InputSchema
|
|
3938
4279
|
});
|
|
3939
4280
|
|
|
3940
4281
|
// src/tool/code-execution_20260120.ts
|
|
3941
|
-
var
|
|
3942
|
-
var
|
|
3943
|
-
var codeExecution_20260120OutputSchema = (0,
|
|
3944
|
-
() => (0,
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
type:
|
|
3948
|
-
stdout:
|
|
3949
|
-
stderr:
|
|
3950
|
-
return_code:
|
|
3951
|
-
content:
|
|
3952
|
-
|
|
3953
|
-
type:
|
|
3954
|
-
file_id:
|
|
4282
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
4283
|
+
var import_v412 = require("zod/v4");
|
|
4284
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
4285
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
4286
|
+
import_v412.z.discriminatedUnion("type", [
|
|
4287
|
+
import_v412.z.object({
|
|
4288
|
+
type: import_v412.z.literal("code_execution_result"),
|
|
4289
|
+
stdout: import_v412.z.string(),
|
|
4290
|
+
stderr: import_v412.z.string(),
|
|
4291
|
+
return_code: import_v412.z.number(),
|
|
4292
|
+
content: import_v412.z.array(
|
|
4293
|
+
import_v412.z.object({
|
|
4294
|
+
type: import_v412.z.literal("code_execution_output"),
|
|
4295
|
+
file_id: import_v412.z.string()
|
|
3955
4296
|
})
|
|
3956
4297
|
).optional().default([])
|
|
3957
4298
|
}),
|
|
3958
|
-
|
|
3959
|
-
type:
|
|
3960
|
-
content:
|
|
3961
|
-
|
|
3962
|
-
type:
|
|
3963
|
-
file_id:
|
|
4299
|
+
import_v412.z.object({
|
|
4300
|
+
type: import_v412.z.literal("bash_code_execution_result"),
|
|
4301
|
+
content: import_v412.z.array(
|
|
4302
|
+
import_v412.z.object({
|
|
4303
|
+
type: import_v412.z.literal("bash_code_execution_output"),
|
|
4304
|
+
file_id: import_v412.z.string()
|
|
3964
4305
|
})
|
|
3965
4306
|
),
|
|
3966
|
-
stdout:
|
|
3967
|
-
stderr:
|
|
3968
|
-
return_code:
|
|
4307
|
+
stdout: import_v412.z.string(),
|
|
4308
|
+
stderr: import_v412.z.string(),
|
|
4309
|
+
return_code: import_v412.z.number()
|
|
3969
4310
|
}),
|
|
3970
|
-
|
|
3971
|
-
type:
|
|
3972
|
-
error_code:
|
|
4311
|
+
import_v412.z.object({
|
|
4312
|
+
type: import_v412.z.literal("bash_code_execution_tool_result_error"),
|
|
4313
|
+
error_code: import_v412.z.string()
|
|
3973
4314
|
}),
|
|
3974
|
-
|
|
3975
|
-
type:
|
|
3976
|
-
error_code:
|
|
4315
|
+
import_v412.z.object({
|
|
4316
|
+
type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
|
|
4317
|
+
error_code: import_v412.z.string()
|
|
3977
4318
|
}),
|
|
3978
|
-
|
|
3979
|
-
type:
|
|
3980
|
-
content:
|
|
3981
|
-
file_type:
|
|
3982
|
-
num_lines:
|
|
3983
|
-
start_line:
|
|
3984
|
-
total_lines:
|
|
4319
|
+
import_v412.z.object({
|
|
4320
|
+
type: import_v412.z.literal("text_editor_code_execution_view_result"),
|
|
4321
|
+
content: import_v412.z.string(),
|
|
4322
|
+
file_type: import_v412.z.string(),
|
|
4323
|
+
num_lines: import_v412.z.number().nullable(),
|
|
4324
|
+
start_line: import_v412.z.number().nullable(),
|
|
4325
|
+
total_lines: import_v412.z.number().nullable()
|
|
3985
4326
|
}),
|
|
3986
|
-
|
|
3987
|
-
type:
|
|
3988
|
-
is_file_update:
|
|
4327
|
+
import_v412.z.object({
|
|
4328
|
+
type: import_v412.z.literal("text_editor_code_execution_create_result"),
|
|
4329
|
+
is_file_update: import_v412.z.boolean()
|
|
3989
4330
|
}),
|
|
3990
|
-
|
|
3991
|
-
type:
|
|
3992
|
-
lines:
|
|
3993
|
-
new_lines:
|
|
3994
|
-
new_start:
|
|
3995
|
-
old_lines:
|
|
3996
|
-
old_start:
|
|
4331
|
+
import_v412.z.object({
|
|
4332
|
+
type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
|
|
4333
|
+
lines: import_v412.z.array(import_v412.z.string()).nullable(),
|
|
4334
|
+
new_lines: import_v412.z.number().nullable(),
|
|
4335
|
+
new_start: import_v412.z.number().nullable(),
|
|
4336
|
+
old_lines: import_v412.z.number().nullable(),
|
|
4337
|
+
old_start: import_v412.z.number().nullable()
|
|
3997
4338
|
})
|
|
3998
4339
|
])
|
|
3999
4340
|
)
|
|
4000
4341
|
);
|
|
4001
|
-
var codeExecution_20260120InputSchema = (0,
|
|
4002
|
-
() => (0,
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
type:
|
|
4006
|
-
code:
|
|
4342
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
4343
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
4344
|
+
import_v412.z.discriminatedUnion("type", [
|
|
4345
|
+
import_v412.z.object({
|
|
4346
|
+
type: import_v412.z.literal("programmatic-tool-call"),
|
|
4347
|
+
code: import_v412.z.string()
|
|
4007
4348
|
}),
|
|
4008
|
-
|
|
4009
|
-
type:
|
|
4010
|
-
command:
|
|
4349
|
+
import_v412.z.object({
|
|
4350
|
+
type: import_v412.z.literal("bash_code_execution"),
|
|
4351
|
+
command: import_v412.z.string()
|
|
4011
4352
|
}),
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
type:
|
|
4015
|
-
command:
|
|
4016
|
-
path:
|
|
4353
|
+
import_v412.z.discriminatedUnion("command", [
|
|
4354
|
+
import_v412.z.object({
|
|
4355
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4356
|
+
command: import_v412.z.literal("view"),
|
|
4357
|
+
path: import_v412.z.string()
|
|
4017
4358
|
}),
|
|
4018
|
-
|
|
4019
|
-
type:
|
|
4020
|
-
command:
|
|
4021
|
-
path:
|
|
4022
|
-
file_text:
|
|
4359
|
+
import_v412.z.object({
|
|
4360
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4361
|
+
command: import_v412.z.literal("create"),
|
|
4362
|
+
path: import_v412.z.string(),
|
|
4363
|
+
file_text: import_v412.z.string().nullish()
|
|
4023
4364
|
}),
|
|
4024
|
-
|
|
4025
|
-
type:
|
|
4026
|
-
command:
|
|
4027
|
-
path:
|
|
4028
|
-
old_str:
|
|
4029
|
-
new_str:
|
|
4365
|
+
import_v412.z.object({
|
|
4366
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
4367
|
+
command: import_v412.z.literal("str_replace"),
|
|
4368
|
+
path: import_v412.z.string(),
|
|
4369
|
+
old_str: import_v412.z.string(),
|
|
4370
|
+
new_str: import_v412.z.string()
|
|
4030
4371
|
})
|
|
4031
4372
|
])
|
|
4032
4373
|
])
|
|
4033
4374
|
)
|
|
4034
4375
|
);
|
|
4035
|
-
var factory6 = (0,
|
|
4376
|
+
var factory6 = (0, import_provider_utils14.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
4036
4377
|
id: "anthropic.code_execution_20260120",
|
|
4037
4378
|
name: "code_execution",
|
|
4038
4379
|
inputSchema: codeExecution_20260120InputSchema,
|
|
@@ -4043,12 +4384,12 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
4043
4384
|
};
|
|
4044
4385
|
|
|
4045
4386
|
// src/tool/computer_20241022.ts
|
|
4046
|
-
var
|
|
4047
|
-
var
|
|
4048
|
-
var computer_20241022InputSchema = (0,
|
|
4049
|
-
() => (0,
|
|
4050
|
-
|
|
4051
|
-
action:
|
|
4387
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
4388
|
+
var import_v413 = require("zod/v4");
|
|
4389
|
+
var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
4390
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
4391
|
+
import_v413.z.object({
|
|
4392
|
+
action: import_v413.z.enum([
|
|
4052
4393
|
"key",
|
|
4053
4394
|
"type",
|
|
4054
4395
|
"mouse_move",
|
|
@@ -4060,24 +4401,24 @@ var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
4060
4401
|
"screenshot",
|
|
4061
4402
|
"cursor_position"
|
|
4062
4403
|
]),
|
|
4063
|
-
coordinate:
|
|
4064
|
-
text:
|
|
4404
|
+
coordinate: import_v413.z.array(import_v413.z.number().int()).optional(),
|
|
4405
|
+
text: import_v413.z.string().optional()
|
|
4065
4406
|
})
|
|
4066
4407
|
)
|
|
4067
4408
|
);
|
|
4068
|
-
var computer_20241022 = (0,
|
|
4409
|
+
var computer_20241022 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
|
|
4069
4410
|
id: "anthropic.computer_20241022",
|
|
4070
4411
|
name: "computer",
|
|
4071
4412
|
inputSchema: computer_20241022InputSchema
|
|
4072
4413
|
});
|
|
4073
4414
|
|
|
4074
4415
|
// src/tool/computer_20250124.ts
|
|
4075
|
-
var
|
|
4076
|
-
var
|
|
4077
|
-
var computer_20250124InputSchema = (0,
|
|
4078
|
-
() => (0,
|
|
4079
|
-
|
|
4080
|
-
action:
|
|
4416
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
4417
|
+
var import_v414 = require("zod/v4");
|
|
4418
|
+
var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
4419
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
4420
|
+
import_v414.z.object({
|
|
4421
|
+
action: import_v414.z.enum([
|
|
4081
4422
|
"key",
|
|
4082
4423
|
"hold_key",
|
|
4083
4424
|
"type",
|
|
@@ -4095,93 +4436,71 @@ var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
|
4095
4436
|
"wait",
|
|
4096
4437
|
"screenshot"
|
|
4097
4438
|
]),
|
|
4098
|
-
coordinate:
|
|
4099
|
-
duration:
|
|
4100
|
-
scroll_amount:
|
|
4101
|
-
scroll_direction:
|
|
4102
|
-
start_coordinate:
|
|
4103
|
-
text:
|
|
4439
|
+
coordinate: import_v414.z.tuple([import_v414.z.number().int(), import_v414.z.number().int()]).optional(),
|
|
4440
|
+
duration: import_v414.z.number().optional(),
|
|
4441
|
+
scroll_amount: import_v414.z.number().optional(),
|
|
4442
|
+
scroll_direction: import_v414.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4443
|
+
start_coordinate: import_v414.z.tuple([import_v414.z.number().int(), import_v414.z.number().int()]).optional(),
|
|
4444
|
+
text: import_v414.z.string().optional()
|
|
4104
4445
|
})
|
|
4105
4446
|
)
|
|
4106
4447
|
);
|
|
4107
|
-
var computer_20250124 = (0,
|
|
4448
|
+
var computer_20250124 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
|
|
4108
4449
|
id: "anthropic.computer_20250124",
|
|
4109
4450
|
name: "computer",
|
|
4110
4451
|
inputSchema: computer_20250124InputSchema
|
|
4111
4452
|
});
|
|
4112
4453
|
|
|
4113
4454
|
// src/tool/memory_20250818.ts
|
|
4114
|
-
var
|
|
4115
|
-
var
|
|
4116
|
-
var memory_20250818InputSchema = (0,
|
|
4117
|
-
() => (0,
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
command:
|
|
4121
|
-
path:
|
|
4122
|
-
view_range:
|
|
4455
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4456
|
+
var import_v415 = require("zod/v4");
|
|
4457
|
+
var memory_20250818InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4458
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
4459
|
+
import_v415.z.discriminatedUnion("command", [
|
|
4460
|
+
import_v415.z.object({
|
|
4461
|
+
command: import_v415.z.literal("view"),
|
|
4462
|
+
path: import_v415.z.string(),
|
|
4463
|
+
view_range: import_v415.z.tuple([import_v415.z.number(), import_v415.z.number()]).optional()
|
|
4123
4464
|
}),
|
|
4124
|
-
|
|
4125
|
-
command:
|
|
4126
|
-
path:
|
|
4127
|
-
file_text:
|
|
4465
|
+
import_v415.z.object({
|
|
4466
|
+
command: import_v415.z.literal("create"),
|
|
4467
|
+
path: import_v415.z.string(),
|
|
4468
|
+
file_text: import_v415.z.string()
|
|
4128
4469
|
}),
|
|
4129
|
-
|
|
4130
|
-
command:
|
|
4131
|
-
path:
|
|
4132
|
-
old_str:
|
|
4133
|
-
new_str:
|
|
4470
|
+
import_v415.z.object({
|
|
4471
|
+
command: import_v415.z.literal("str_replace"),
|
|
4472
|
+
path: import_v415.z.string(),
|
|
4473
|
+
old_str: import_v415.z.string(),
|
|
4474
|
+
new_str: import_v415.z.string()
|
|
4134
4475
|
}),
|
|
4135
|
-
|
|
4136
|
-
command:
|
|
4137
|
-
path:
|
|
4138
|
-
insert_line:
|
|
4139
|
-
insert_text:
|
|
4476
|
+
import_v415.z.object({
|
|
4477
|
+
command: import_v415.z.literal("insert"),
|
|
4478
|
+
path: import_v415.z.string(),
|
|
4479
|
+
insert_line: import_v415.z.number(),
|
|
4480
|
+
insert_text: import_v415.z.string()
|
|
4140
4481
|
}),
|
|
4141
|
-
|
|
4142
|
-
command:
|
|
4143
|
-
path:
|
|
4482
|
+
import_v415.z.object({
|
|
4483
|
+
command: import_v415.z.literal("delete"),
|
|
4484
|
+
path: import_v415.z.string()
|
|
4144
4485
|
}),
|
|
4145
|
-
|
|
4146
|
-
command:
|
|
4147
|
-
old_path:
|
|
4148
|
-
new_path:
|
|
4486
|
+
import_v415.z.object({
|
|
4487
|
+
command: import_v415.z.literal("rename"),
|
|
4488
|
+
old_path: import_v415.z.string(),
|
|
4489
|
+
new_path: import_v415.z.string()
|
|
4149
4490
|
})
|
|
4150
4491
|
])
|
|
4151
4492
|
)
|
|
4152
4493
|
);
|
|
4153
|
-
var memory_20250818 = (0,
|
|
4494
|
+
var memory_20250818 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
|
|
4154
4495
|
id: "anthropic.memory_20250818",
|
|
4155
4496
|
name: "memory",
|
|
4156
4497
|
inputSchema: memory_20250818InputSchema
|
|
4157
4498
|
});
|
|
4158
4499
|
|
|
4159
4500
|
// src/tool/text-editor_20241022.ts
|
|
4160
|
-
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4161
|
-
var import_v415 = require("zod/v4");
|
|
4162
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4163
|
-
() => (0, import_provider_utils17.zodSchema)(
|
|
4164
|
-
import_v415.z.object({
|
|
4165
|
-
command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4166
|
-
path: import_v415.z.string(),
|
|
4167
|
-
file_text: import_v415.z.string().optional(),
|
|
4168
|
-
insert_line: import_v415.z.number().int().optional(),
|
|
4169
|
-
new_str: import_v415.z.string().optional(),
|
|
4170
|
-
old_str: import_v415.z.string().optional(),
|
|
4171
|
-
view_range: import_v415.z.array(import_v415.z.number().int()).optional()
|
|
4172
|
-
})
|
|
4173
|
-
)
|
|
4174
|
-
);
|
|
4175
|
-
var textEditor_20241022 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
|
|
4176
|
-
id: "anthropic.text_editor_20241022",
|
|
4177
|
-
name: "str_replace_editor",
|
|
4178
|
-
inputSchema: textEditor_20241022InputSchema
|
|
4179
|
-
});
|
|
4180
|
-
|
|
4181
|
-
// src/tool/text-editor_20250124.ts
|
|
4182
4501
|
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
4183
4502
|
var import_v416 = require("zod/v4");
|
|
4184
|
-
var
|
|
4503
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
4185
4504
|
() => (0, import_provider_utils18.zodSchema)(
|
|
4186
4505
|
import_v416.z.object({
|
|
4187
4506
|
command: import_v416.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4194,19 +4513,19 @@ var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
4194
4513
|
})
|
|
4195
4514
|
)
|
|
4196
4515
|
);
|
|
4197
|
-
var
|
|
4198
|
-
id: "anthropic.
|
|
4516
|
+
var textEditor_20241022 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
|
|
4517
|
+
id: "anthropic.text_editor_20241022",
|
|
4199
4518
|
name: "str_replace_editor",
|
|
4200
|
-
inputSchema:
|
|
4519
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4201
4520
|
});
|
|
4202
4521
|
|
|
4203
|
-
// src/tool/text-
|
|
4522
|
+
// src/tool/text-editor_20250124.ts
|
|
4204
4523
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4205
4524
|
var import_v417 = require("zod/v4");
|
|
4206
|
-
var
|
|
4525
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4207
4526
|
() => (0, import_provider_utils19.zodSchema)(
|
|
4208
4527
|
import_v417.z.object({
|
|
4209
|
-
command: import_v417.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4528
|
+
command: import_v417.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4210
4529
|
path: import_v417.z.string(),
|
|
4211
4530
|
file_text: import_v417.z.string().optional(),
|
|
4212
4531
|
insert_line: import_v417.z.number().int().optional(),
|
|
@@ -4216,7 +4535,29 @@ var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
4216
4535
|
})
|
|
4217
4536
|
)
|
|
4218
4537
|
);
|
|
4219
|
-
var
|
|
4538
|
+
var textEditor_20250124 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
|
|
4539
|
+
id: "anthropic.text_editor_20250124",
|
|
4540
|
+
name: "str_replace_editor",
|
|
4541
|
+
inputSchema: textEditor_20250124InputSchema
|
|
4542
|
+
});
|
|
4543
|
+
|
|
4544
|
+
// src/tool/text-editor_20250429.ts
|
|
4545
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
4546
|
+
var import_v418 = require("zod/v4");
|
|
4547
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
4548
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
4549
|
+
import_v418.z.object({
|
|
4550
|
+
command: import_v418.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4551
|
+
path: import_v418.z.string(),
|
|
4552
|
+
file_text: import_v418.z.string().optional(),
|
|
4553
|
+
insert_line: import_v418.z.number().int().optional(),
|
|
4554
|
+
new_str: import_v418.z.string().optional(),
|
|
4555
|
+
old_str: import_v418.z.string().optional(),
|
|
4556
|
+
view_range: import_v418.z.array(import_v418.z.number().int()).optional()
|
|
4557
|
+
})
|
|
4558
|
+
)
|
|
4559
|
+
);
|
|
4560
|
+
var textEditor_20250429 = (0, import_provider_utils20.createProviderDefinedToolFactory)({
|
|
4220
4561
|
id: "anthropic.text_editor_20250429",
|
|
4221
4562
|
name: "str_replace_based_edit_tool",
|
|
4222
4563
|
inputSchema: textEditor_20250429InputSchema
|
|
@@ -4305,6 +4646,31 @@ var anthropicTools = {
|
|
|
4305
4646
|
* @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.
|
|
4306
4647
|
*/
|
|
4307
4648
|
computer_20250124,
|
|
4649
|
+
/**
|
|
4650
|
+
* The computer toolset lets Claude control a computer through screenshots,
|
|
4651
|
+
* mouse, and keyboard. It replaces the versioned computer tools
|
|
4652
|
+
* (`computer_20250124` and earlier) on newer models.
|
|
4653
|
+
*
|
|
4654
|
+
* The API returns each computer action as its own `tool_use` block with
|
|
4655
|
+
* `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
|
|
4656
|
+
* and exposes the member name as `action`, so `execute` receives the same
|
|
4657
|
+
* input shape as the older computer tools. Claude may return several actions
|
|
4658
|
+
* in one turn.
|
|
4659
|
+
*
|
|
4660
|
+
* Coordinates are always in the pixel space of the screenshots you return;
|
|
4661
|
+
* there are no display size parameters. Zoom is enabled by default.
|
|
4662
|
+
*
|
|
4663
|
+
* Does not require a beta header.
|
|
4664
|
+
*
|
|
4665
|
+
* Tool name must be `computer`.
|
|
4666
|
+
*
|
|
4667
|
+
* Supported models: Claude Opus 5.5 (required; older computer tool types
|
|
4668
|
+
* are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
|
|
4669
|
+
*
|
|
4670
|
+
* @param configs - Per-member settings keyed by member name, e.g.
|
|
4671
|
+
* `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
|
|
4672
|
+
*/
|
|
4673
|
+
computerToolset_20260801,
|
|
4308
4674
|
/**
|
|
4309
4675
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
4310
4676
|
* Claude can create, read, update, and delete files that persist between sessions,
|
|
@@ -4390,17 +4756,17 @@ var anthropicTools = {
|
|
|
4390
4756
|
// src/anthropic-provider.ts
|
|
4391
4757
|
function createAnthropic(options = {}) {
|
|
4392
4758
|
var _a, _b;
|
|
4393
|
-
const baseURL = (_a = (0,
|
|
4394
|
-
(0,
|
|
4759
|
+
const baseURL = (_a = (0, import_provider_utils21.withoutTrailingSlash)(
|
|
4760
|
+
(0, import_provider_utils21.loadOptionalSetting)({
|
|
4395
4761
|
settingValue: options.baseURL,
|
|
4396
4762
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
4397
4763
|
})
|
|
4398
4764
|
)) != null ? _a : "https://api.anthropic.com/v1";
|
|
4399
4765
|
const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
|
|
4400
|
-
const getHeaders = () => (0,
|
|
4766
|
+
const getHeaders = () => (0, import_provider_utils21.withUserAgentSuffix)(
|
|
4401
4767
|
{
|
|
4402
4768
|
"anthropic-version": "2023-06-01",
|
|
4403
|
-
"x-api-key": (0,
|
|
4769
|
+
"x-api-key": (0, import_provider_utils21.loadApiKey)({
|
|
4404
4770
|
apiKey: options.apiKey,
|
|
4405
4771
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
4406
4772
|
description: "Anthropic"
|
|
@@ -4416,7 +4782,7 @@ function createAnthropic(options = {}) {
|
|
|
4416
4782
|
baseURL,
|
|
4417
4783
|
headers: getHeaders,
|
|
4418
4784
|
fetch: options.fetch,
|
|
4419
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
4785
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils21.generateId,
|
|
4420
4786
|
supportedUrls: () => ({
|
|
4421
4787
|
"image/*": [/^https?:\/\/.*$/]
|
|
4422
4788
|
})
|