@ai-sdk/anthropic 3.0.134 → 3.0.136
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 +17 -0
- package/dist/index.d.mts +121 -156
- package/dist/index.d.ts +121 -156
- package/dist/index.js +528 -515
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +485 -469
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +521 -508
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +484 -468
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/anthropic-messages-api.ts +65 -57
- package/src/anthropic-messages-options.ts +386 -367
package/dist/index.js
CHANGED
|
@@ -29,14 +29,14 @@ module.exports = __toCommonJS(index_exports);
|
|
|
29
29
|
|
|
30
30
|
// src/anthropic-provider.ts
|
|
31
31
|
var import_provider4 = require("@ai-sdk/provider");
|
|
32
|
-
var
|
|
32
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.136" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/anthropic-messages-language-model.ts
|
|
38
38
|
var import_provider3 = require("@ai-sdk/provider");
|
|
39
|
-
var
|
|
39
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
40
40
|
|
|
41
41
|
// src/anthropic-error.ts
|
|
42
42
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -60,13 +60,13 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
|
|
|
60
60
|
// src/anthropic-messages-api.ts
|
|
61
61
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
62
62
|
var import_v42 = require("zod/v4");
|
|
63
|
-
var anthropicStopDetailsSchema = import_v42.z.object({
|
|
63
|
+
var anthropicStopDetailsSchema = () => import_v42.z.object({
|
|
64
64
|
type: import_v42.z.string(),
|
|
65
65
|
category: import_v42.z.string().nullish(),
|
|
66
66
|
explanation: import_v42.z.string().nullish(),
|
|
67
67
|
recommended_model: import_v42.z.string().nullish()
|
|
68
68
|
});
|
|
69
|
-
var anthropicSafeguardResultSchema = import_v42.z.object({
|
|
69
|
+
var anthropicSafeguardResultSchema = () => import_v42.z.object({
|
|
70
70
|
type: import_v42.z.string(),
|
|
71
71
|
status: import_v42.z.object({
|
|
72
72
|
type: import_v42.z.string(),
|
|
@@ -80,7 +80,7 @@ var anthropicSafeguardResultSchema = import_v42.z.object({
|
|
|
80
80
|
).nullish()
|
|
81
81
|
})
|
|
82
82
|
});
|
|
83
|
-
var anthropicToolCallCallerSchema = import_v42.z.union([
|
|
83
|
+
var anthropicToolCallCallerSchema = () => import_v42.z.union([
|
|
84
84
|
import_v42.z.object({
|
|
85
85
|
type: import_v42.z.literal("code_execution_20250825"),
|
|
86
86
|
tool_id: import_v42.z.string()
|
|
@@ -93,7 +93,7 @@ var anthropicToolCallCallerSchema = import_v42.z.union([
|
|
|
93
93
|
type: import_v42.z.literal("direct")
|
|
94
94
|
})
|
|
95
95
|
]);
|
|
96
|
-
var anthropicInputTransformationSchema = import_v42.z.object({
|
|
96
|
+
var anthropicInputTransformationSchema = () => import_v42.z.object({
|
|
97
97
|
type: import_v42.z.string(),
|
|
98
98
|
path: import_v42.z.string(),
|
|
99
99
|
reason: import_v42.z.string()
|
|
@@ -156,7 +156,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
156
156
|
name: import_v42.z.string(),
|
|
157
157
|
input: import_v42.z.unknown(),
|
|
158
158
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
159
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
159
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
160
160
|
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
161
161
|
toolset_name: import_v42.z.string().nullish()
|
|
162
162
|
}),
|
|
@@ -165,7 +165,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
165
165
|
id: import_v42.z.string(),
|
|
166
166
|
name: import_v42.z.string(),
|
|
167
167
|
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
168
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
168
|
+
caller: anthropicToolCallCallerSchema().optional()
|
|
169
169
|
}),
|
|
170
170
|
import_v42.z.object({
|
|
171
171
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -188,7 +188,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
188
188
|
import_v42.z.object({
|
|
189
189
|
type: import_v42.z.literal("web_fetch_tool_result"),
|
|
190
190
|
tool_use_id: import_v42.z.string(),
|
|
191
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
191
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
192
192
|
content: import_v42.z.union([
|
|
193
193
|
import_v42.z.object({
|
|
194
194
|
type: import_v42.z.literal("web_fetch_result"),
|
|
@@ -221,7 +221,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
221
221
|
import_v42.z.object({
|
|
222
222
|
type: import_v42.z.literal("web_search_tool_result"),
|
|
223
223
|
tool_use_id: import_v42.z.string(),
|
|
224
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
224
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
225
225
|
content: import_v42.z.union([
|
|
226
226
|
import_v42.z.array(
|
|
227
227
|
import_v42.z.object({
|
|
@@ -378,9 +378,9 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
378
378
|
),
|
|
379
379
|
stop_reason: import_v42.z.string().nullish(),
|
|
380
380
|
stop_sequence: import_v42.z.string().nullish(),
|
|
381
|
-
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
382
|
-
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
383
|
-
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema).nullish(),
|
|
381
|
+
stop_details: anthropicStopDetailsSchema().nullish(),
|
|
382
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema()).nullish(),
|
|
383
|
+
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema()).nullish(),
|
|
384
384
|
usage: import_v42.z.looseObject({
|
|
385
385
|
input_tokens: import_v42.z.number(),
|
|
386
386
|
output_tokens: import_v42.z.number(),
|
|
@@ -460,13 +460,13 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
460
460
|
id: import_v42.z.string(),
|
|
461
461
|
name: import_v42.z.string(),
|
|
462
462
|
input: import_v42.z.unknown(),
|
|
463
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
463
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
464
464
|
toolset_name: import_v42.z.string().nullish()
|
|
465
465
|
})
|
|
466
466
|
])
|
|
467
467
|
).nullish(),
|
|
468
468
|
stop_reason: import_v42.z.string().nullish(),
|
|
469
|
-
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
469
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema()).nullish(),
|
|
470
470
|
container: import_v42.z.object({
|
|
471
471
|
expires_at: import_v42.z.string(),
|
|
472
472
|
id: import_v42.z.string()
|
|
@@ -492,7 +492,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
492
492
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
493
493
|
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).optional(),
|
|
494
494
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
495
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
495
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
496
496
|
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
497
497
|
toolset_name: import_v42.z.string().nullish()
|
|
498
498
|
}),
|
|
@@ -509,7 +509,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
509
509
|
id: import_v42.z.string(),
|
|
510
510
|
name: import_v42.z.string(),
|
|
511
511
|
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
512
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
512
|
+
caller: anthropicToolCallCallerSchema().optional()
|
|
513
513
|
}),
|
|
514
514
|
import_v42.z.object({
|
|
515
515
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -532,7 +532,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
532
532
|
import_v42.z.object({
|
|
533
533
|
type: import_v42.z.literal("web_fetch_tool_result"),
|
|
534
534
|
tool_use_id: import_v42.z.string(),
|
|
535
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
535
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
536
536
|
content: import_v42.z.union([
|
|
537
537
|
import_v42.z.object({
|
|
538
538
|
type: import_v42.z.literal("web_fetch_result"),
|
|
@@ -565,7 +565,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
565
565
|
import_v42.z.object({
|
|
566
566
|
type: import_v42.z.literal("web_search_tool_result"),
|
|
567
567
|
tool_use_id: import_v42.z.string(),
|
|
568
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
568
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
569
569
|
content: import_v42.z.union([
|
|
570
570
|
import_v42.z.array(
|
|
571
571
|
import_v42.z.object({
|
|
@@ -789,8 +789,8 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
789
789
|
delta: import_v42.z.object({
|
|
790
790
|
stop_reason: import_v42.z.string().nullish(),
|
|
791
791
|
stop_sequence: import_v42.z.string().nullish(),
|
|
792
|
-
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
793
|
-
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema).nullish(),
|
|
792
|
+
stop_details: anthropicStopDetailsSchema().nullish(),
|
|
793
|
+
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema()).nullish(),
|
|
794
794
|
container: import_v42.z.object({
|
|
795
795
|
expires_at: import_v42.z.string(),
|
|
796
796
|
id: import_v42.z.string(),
|
|
@@ -830,7 +830,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
830
830
|
})
|
|
831
831
|
).nullish()
|
|
832
832
|
}),
|
|
833
|
-
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
833
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema()).nullish(),
|
|
834
834
|
context_management: import_v42.z.object({
|
|
835
835
|
applied_edits: import_v42.z.array(
|
|
836
836
|
import_v42.z.union([
|
|
@@ -870,349 +870,362 @@ var anthropicReasoningMetadataSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
870
870
|
);
|
|
871
871
|
|
|
872
872
|
// src/anthropic-messages-options.ts
|
|
873
|
+
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
873
874
|
var import_v43 = require("zod/v4");
|
|
874
|
-
var anthropicFilePartProviderOptions =
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
*/
|
|
883
|
-
enabled: import_v43.z.boolean()
|
|
884
|
-
}).optional(),
|
|
885
|
-
/**
|
|
886
|
-
* Custom title for the document.
|
|
887
|
-
* If not provided, the filename will be used.
|
|
888
|
-
*/
|
|
889
|
-
title: import_v43.z.string().optional(),
|
|
890
|
-
/**
|
|
891
|
-
* Context about the document that will be passed to the model
|
|
892
|
-
* but not used towards cited content.
|
|
893
|
-
* Useful for storing document metadata as text or stringified JSON.
|
|
894
|
-
*/
|
|
895
|
-
context: import_v43.z.string().optional()
|
|
896
|
-
});
|
|
897
|
-
var anthropicSystemMessageProviderOptions = import_v43.z.object({
|
|
898
|
-
/**
|
|
899
|
-
* Clears this mid-conversation system message after the current turn.
|
|
900
|
-
*
|
|
901
|
-
* Requires the `mid-conversation-system-clear-at-2026-08-21` beta,
|
|
902
|
-
* which is added automatically.
|
|
903
|
-
*/
|
|
904
|
-
clearAt: import_v43.z.literal("next_user_message").optional(),
|
|
905
|
-
/**
|
|
906
|
-
* Sets the model effort from the next user turn until a later message
|
|
907
|
-
* changes it. An effort-only system message with empty content can appear
|
|
908
|
-
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
909
|
-
* added automatically.
|
|
910
|
-
*/
|
|
911
|
-
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
912
|
-
/**
|
|
913
|
-
* Mid-conversation tool changes. Adds or removes tools from the
|
|
914
|
-
* conversation's tool set between turns without invalidating the prompt
|
|
915
|
-
* cache.
|
|
916
|
-
*
|
|
917
|
-
* Only supported on system messages that appear mid-conversation (not the
|
|
918
|
-
* initial system prompt). A system message carrying tool changes must come
|
|
919
|
-
* right before an assistant message or at the end of the messages.
|
|
920
|
-
*
|
|
921
|
-
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
922
|
-
* option (typically with `deferLoading: true` so they are not loaded until
|
|
923
|
-
* the addition surfaces them). The required
|
|
924
|
-
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
925
|
-
*/
|
|
926
|
-
toolChanges: import_v43.z.array(
|
|
927
|
-
import_v43.z.discriminatedUnion("type", [
|
|
928
|
-
import_v43.z.object({
|
|
929
|
-
type: import_v43.z.literal("tool_addition"),
|
|
930
|
-
toolName: import_v43.z.string()
|
|
931
|
-
}),
|
|
932
|
-
import_v43.z.object({
|
|
933
|
-
type: import_v43.z.literal("tool_removal"),
|
|
934
|
-
toolName: import_v43.z.string()
|
|
935
|
-
})
|
|
936
|
-
])
|
|
937
|
-
).optional()
|
|
938
|
-
});
|
|
939
|
-
var anthropicThinkingBlockBinding = import_v43.z.object({
|
|
940
|
-
prefixMismatchBehavior: import_v43.z.enum(["error", "drop_block"])
|
|
941
|
-
});
|
|
942
|
-
var anthropicLanguageModelOptions = import_v43.z.object({
|
|
943
|
-
/**
|
|
944
|
-
* Whether to send reasoning to the model.
|
|
945
|
-
*
|
|
946
|
-
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
947
|
-
*/
|
|
948
|
-
sendReasoning: import_v43.z.boolean().optional(),
|
|
949
|
-
/**
|
|
950
|
-
* Determines how structured outputs are generated.
|
|
951
|
-
*
|
|
952
|
-
* - `outputFormat`: Use the `output_config.format` parameter to specify the structured output format.
|
|
953
|
-
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
954
|
-
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
955
|
-
*/
|
|
956
|
-
structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
957
|
-
/**
|
|
958
|
-
* Configuration for enabling Claude's extended thinking.
|
|
959
|
-
*
|
|
960
|
-
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
961
|
-
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
962
|
-
*
|
|
963
|
-
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
964
|
-
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
965
|
-
* provider drops the unsupported setting, emits a warning, and sends an
|
|
966
|
-
* adaptive thinking request. Use `effort` to control how much they think.
|
|
967
|
-
*
|
|
968
|
-
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
969
|
-
* and the provider uses it in place of `disabled` for that model.
|
|
970
|
-
*/
|
|
971
|
-
thinking: import_v43.z.union([
|
|
972
|
-
import_v43.z.discriminatedUnion("type", [
|
|
973
|
-
import_v43.z.object({
|
|
974
|
-
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
975
|
-
type: import_v43.z.literal("adaptive"),
|
|
976
|
-
/**
|
|
977
|
-
* Controls whether thinking content is included in the response.
|
|
978
|
-
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
979
|
-
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
980
|
-
* - `"updates"`: Thinking updates are returned between tool calls.
|
|
981
|
-
*/
|
|
982
|
-
display: import_v43.z.enum(["omitted", "summarized", "updates"]).optional(),
|
|
983
|
-
/**
|
|
984
|
-
* Controls how thinking blocks are bound to an assistant prefix.
|
|
985
|
-
*
|
|
986
|
-
* Requires the `thinking-binding-controls-2026-08-01` beta,
|
|
987
|
-
* which is added automatically.
|
|
988
|
-
*/
|
|
989
|
-
blockBinding: anthropicThinkingBlockBinding.optional()
|
|
990
|
-
}),
|
|
991
|
-
import_v43.z.object({
|
|
992
|
-
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
993
|
-
type: import_v43.z.literal("enabled"),
|
|
994
|
-
budgetTokens: import_v43.z.number().optional()
|
|
995
|
-
}),
|
|
996
|
-
import_v43.z.object({
|
|
997
|
-
type: import_v43.z.literal("disabled")
|
|
998
|
-
}),
|
|
999
|
-
import_v43.z.object({
|
|
875
|
+
var anthropicFilePartProviderOptions = (0, import_provider_utils3.lazySchema)(
|
|
876
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
877
|
+
import_v43.z.object({
|
|
878
|
+
/**
|
|
879
|
+
* Citation configuration for this document.
|
|
880
|
+
* When enabled, this document will generate citations in the response.
|
|
881
|
+
*/
|
|
882
|
+
citations: import_v43.z.object({
|
|
1000
883
|
/**
|
|
1001
|
-
*
|
|
1002
|
-
* between tool calls are returned as summarized thinking blocks.
|
|
1003
|
-
* Only supported at `low`, `medium`, and `high` effort.
|
|
884
|
+
* Enable citations for this document
|
|
1004
885
|
*/
|
|
1005
|
-
|
|
1006
|
-
})
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
886
|
+
enabled: import_v43.z.boolean()
|
|
887
|
+
}).optional(),
|
|
888
|
+
/**
|
|
889
|
+
* Custom title for the document.
|
|
890
|
+
* If not provided, the filename will be used.
|
|
891
|
+
*/
|
|
892
|
+
title: import_v43.z.string().optional(),
|
|
893
|
+
/**
|
|
894
|
+
* Context about the document that will be passed to the model
|
|
895
|
+
* but not used towards cited content.
|
|
896
|
+
* Useful for storing document metadata as text or stringified JSON.
|
|
897
|
+
*/
|
|
898
|
+
context: import_v43.z.string().optional()
|
|
1014
899
|
})
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
*/
|
|
1020
|
-
disableParallelToolUse: import_v43.z.boolean().optional(),
|
|
1021
|
-
/**
|
|
1022
|
-
* Cache control settings for this message.
|
|
1023
|
-
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
1024
|
-
*/
|
|
1025
|
-
cacheControl: import_v43.z.object({
|
|
1026
|
-
type: import_v43.z.literal("ephemeral"),
|
|
1027
|
-
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
|
|
1028
|
-
}).optional(),
|
|
1029
|
-
/**
|
|
1030
|
-
* Metadata to include with the request.
|
|
1031
|
-
*
|
|
1032
|
-
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
1033
|
-
*/
|
|
1034
|
-
metadata: import_v43.z.object({
|
|
1035
|
-
/**
|
|
1036
|
-
* An external identifier for the user associated with the request.
|
|
1037
|
-
*
|
|
1038
|
-
* Should be a UUID, hash value, or other opaque identifier.
|
|
1039
|
-
* Must not contain PII (name, email, phone number, etc.).
|
|
1040
|
-
*/
|
|
1041
|
-
userId: import_v43.z.string().optional()
|
|
1042
|
-
}).optional(),
|
|
1043
|
-
/**
|
|
1044
|
-
* MCP servers to be utilized in this request.
|
|
1045
|
-
*/
|
|
1046
|
-
mcpServers: import_v43.z.array(
|
|
900
|
+
)
|
|
901
|
+
);
|
|
902
|
+
var anthropicSystemMessageProviderOptions = (0, import_provider_utils3.lazySchema)(
|
|
903
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
1047
904
|
import_v43.z.object({
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
905
|
+
/**
|
|
906
|
+
* Clears this mid-conversation system message after the current turn.
|
|
907
|
+
*
|
|
908
|
+
* Requires the `mid-conversation-system-clear-at-2026-08-21` beta,
|
|
909
|
+
* which is added automatically.
|
|
910
|
+
*/
|
|
911
|
+
clearAt: import_v43.z.literal("next_user_message").optional(),
|
|
912
|
+
/**
|
|
913
|
+
* Sets the model effort from the next user turn until a later message
|
|
914
|
+
* changes it. An effort-only system message with empty content can appear
|
|
915
|
+
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
916
|
+
* added automatically.
|
|
917
|
+
*/
|
|
918
|
+
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
919
|
+
/**
|
|
920
|
+
* Mid-conversation tool changes. Adds or removes tools from the
|
|
921
|
+
* conversation's tool set between turns without invalidating the prompt
|
|
922
|
+
* cache.
|
|
923
|
+
*
|
|
924
|
+
* Only supported on system messages that appear mid-conversation (not the
|
|
925
|
+
* initial system prompt). A system message carrying tool changes must come
|
|
926
|
+
* right before an assistant message or at the end of the messages.
|
|
927
|
+
*
|
|
928
|
+
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
929
|
+
* option (typically with `deferLoading: true` so they are not loaded until
|
|
930
|
+
* the addition surfaces them). The required
|
|
931
|
+
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
932
|
+
*/
|
|
933
|
+
toolChanges: import_v43.z.array(
|
|
934
|
+
import_v43.z.discriminatedUnion("type", [
|
|
935
|
+
import_v43.z.object({
|
|
936
|
+
type: import_v43.z.literal("tool_addition"),
|
|
937
|
+
toolName: import_v43.z.string()
|
|
938
|
+
}),
|
|
939
|
+
import_v43.z.object({
|
|
940
|
+
type: import_v43.z.literal("tool_removal"),
|
|
941
|
+
toolName: import_v43.z.string()
|
|
942
|
+
})
|
|
943
|
+
])
|
|
944
|
+
).optional()
|
|
1056
945
|
})
|
|
1057
|
-
)
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
id: import_v43.z.string().optional(),
|
|
1065
|
-
skills: import_v43.z.array(
|
|
1066
|
-
import_v43.z.object({
|
|
1067
|
-
type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
|
|
1068
|
-
skillId: import_v43.z.string(),
|
|
1069
|
-
version: import_v43.z.string().optional()
|
|
1070
|
-
})
|
|
1071
|
-
).optional()
|
|
1072
|
-
}).optional(),
|
|
1073
|
-
/**
|
|
1074
|
-
* Whether to enable fine-grained (eager) streaming of tool call inputs
|
|
1075
|
-
* and structured outputs for every function tool in the request. When
|
|
1076
|
-
* true (the default), each function tool receives a default of
|
|
1077
|
-
* `eager_input_streaming: true` unless it explicitly sets
|
|
1078
|
-
* `providerOptions.anthropic.eagerInputStreaming`.
|
|
1079
|
-
*
|
|
1080
|
-
* @default true
|
|
1081
|
-
*/
|
|
1082
|
-
toolStreaming: import_v43.z.boolean().optional(),
|
|
1083
|
-
/**
|
|
1084
|
-
* Controls how much effort the model spends on thinking, text responses,
|
|
1085
|
-
* and tool calls. On models that always use adaptive thinking
|
|
1086
|
-
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1087
|
-
*
|
|
1088
|
-
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1089
|
-
*/
|
|
1090
|
-
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1091
|
-
/**
|
|
1092
|
-
* Task budget for agentic turns. Informs the model of the total token budget
|
|
1093
|
-
* available for the current task, allowing it to prioritize work and wind down
|
|
1094
|
-
* gracefully as the budget is consumed.
|
|
1095
|
-
*
|
|
1096
|
-
* Advisory only — does not enforce a hard token limit.
|
|
1097
|
-
*/
|
|
1098
|
-
taskBudget: import_v43.z.object({
|
|
1099
|
-
type: import_v43.z.literal("tokens"),
|
|
1100
|
-
total: import_v43.z.number().int().min(2e4),
|
|
1101
|
-
remaining: import_v43.z.number().int().min(0).optional()
|
|
1102
|
-
}).optional(),
|
|
1103
|
-
/**
|
|
1104
|
-
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
1105
|
-
* Only supported with claude-opus-4-6.
|
|
1106
|
-
*/
|
|
1107
|
-
speed: import_v43.z.enum(["fast", "standard"]).optional(),
|
|
1108
|
-
/**
|
|
1109
|
-
* Controls where model inference runs for this request.
|
|
1110
|
-
*
|
|
1111
|
-
* - `"global"`: Inference may run in any available geography (default).
|
|
1112
|
-
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
1113
|
-
*
|
|
1114
|
-
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
1115
|
-
*/
|
|
1116
|
-
inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
|
|
1117
|
-
/**
|
|
1118
|
-
* Server-side fallback configuration.
|
|
1119
|
-
*
|
|
1120
|
-
* When the primary model's safety classifiers block a turn, the API
|
|
1121
|
-
* automatically retries it server-side on a fallback model. A
|
|
1122
|
-
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
1123
|
-
*
|
|
1124
|
-
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
1125
|
-
* recommended fallback model based on the refusal category. Requires the
|
|
1126
|
-
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
1127
|
-
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
1128
|
-
* request as a direct request to that entry's model, so it must be
|
|
1129
|
-
* formatted accordingly: `model` is required, and an entry may
|
|
1130
|
-
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
1131
|
-
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
1132
|
-
* beta). The value is passed through to the API as-is, and the
|
|
1133
|
-
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
1134
|
-
*/
|
|
1135
|
-
fallbacks: import_v43.z.union([
|
|
1136
|
-
import_v43.z.literal("default"),
|
|
1137
|
-
import_v43.z.array(
|
|
1138
|
-
import_v43.z.object({
|
|
1139
|
-
model: import_v43.z.string(),
|
|
1140
|
-
max_tokens: import_v43.z.number().int().optional(),
|
|
1141
|
-
thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1142
|
-
output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1143
|
-
speed: import_v43.z.enum(["fast", "standard"]).optional()
|
|
1144
|
-
})
|
|
1145
|
-
)
|
|
1146
|
-
]).optional(),
|
|
1147
|
-
/**
|
|
1148
|
-
* A set of beta features to enable.
|
|
1149
|
-
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1150
|
-
*/
|
|
1151
|
-
anthropicBeta: import_v43.z.array(import_v43.z.string()).optional(),
|
|
1152
|
-
/**
|
|
1153
|
-
* Server-side safeguards to run as part of the request.
|
|
1154
|
-
*
|
|
1155
|
-
* `dangerous_tool_use` asks the API to classify every `tool_use` block in
|
|
1156
|
-
* the response for dangerous actions (the check Claude Code's auto mode
|
|
1157
|
-
* relies on). The per-call verdicts are returned in
|
|
1158
|
-
* `providerMetadata.anthropic.safeguardResults`, keyed by tool call id.
|
|
1159
|
-
* `classifierContext` is passed through to the API as `classifier_context`.
|
|
1160
|
-
* The `dangerous-tool-use-2026-09-03` beta is added automatically.
|
|
1161
|
-
*/
|
|
1162
|
-
safeguards: import_v43.z.array(
|
|
946
|
+
)
|
|
947
|
+
);
|
|
948
|
+
var anthropicLanguageModelOptions = (0, import_provider_utils3.lazySchema)(() => {
|
|
949
|
+
const anthropicThinkingBlockBinding = import_v43.z.object({
|
|
950
|
+
prefixMismatchBehavior: import_v43.z.enum(["error", "drop_block"])
|
|
951
|
+
});
|
|
952
|
+
return (0, import_provider_utils3.zodSchema)(
|
|
1163
953
|
import_v43.z.object({
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
954
|
+
/**
|
|
955
|
+
* Whether to send reasoning to the model.
|
|
956
|
+
*
|
|
957
|
+
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
958
|
+
*/
|
|
959
|
+
sendReasoning: import_v43.z.boolean().optional(),
|
|
960
|
+
/**
|
|
961
|
+
* Determines how structured outputs are generated.
|
|
962
|
+
*
|
|
963
|
+
* - `outputFormat`: Use the `output_config.format` parameter to specify the structured output format.
|
|
964
|
+
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
965
|
+
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
966
|
+
*/
|
|
967
|
+
structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
968
|
+
/**
|
|
969
|
+
* Configuration for enabling Claude's extended thinking.
|
|
970
|
+
*
|
|
971
|
+
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
972
|
+
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
973
|
+
*
|
|
974
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
975
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
976
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
977
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
978
|
+
*
|
|
979
|
+
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
980
|
+
* and the provider uses it in place of `disabled` for that model.
|
|
981
|
+
*/
|
|
982
|
+
thinking: import_v43.z.union([
|
|
983
|
+
import_v43.z.discriminatedUnion("type", [
|
|
984
|
+
import_v43.z.object({
|
|
985
|
+
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
986
|
+
type: import_v43.z.literal("adaptive"),
|
|
987
|
+
/**
|
|
988
|
+
* Controls whether thinking content is included in the response.
|
|
989
|
+
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
990
|
+
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
991
|
+
* - `"updates"`: Thinking updates are returned between tool calls.
|
|
992
|
+
*/
|
|
993
|
+
display: import_v43.z.enum(["omitted", "summarized", "updates"]).optional(),
|
|
994
|
+
/**
|
|
995
|
+
* Controls how thinking blocks are bound to an assistant prefix.
|
|
996
|
+
*
|
|
997
|
+
* Requires the `thinking-binding-controls-2026-08-01` beta,
|
|
998
|
+
* which is added automatically.
|
|
999
|
+
*/
|
|
1000
|
+
blockBinding: anthropicThinkingBlockBinding.optional()
|
|
1001
|
+
}),
|
|
1002
|
+
import_v43.z.object({
|
|
1003
|
+
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
1004
|
+
type: import_v43.z.literal("enabled"),
|
|
1005
|
+
budgetTokens: import_v43.z.number().optional()
|
|
1006
|
+
}),
|
|
1007
|
+
import_v43.z.object({
|
|
1008
|
+
type: import_v43.z.literal("disabled")
|
|
1009
|
+
}),
|
|
1010
|
+
import_v43.z.object({
|
|
1011
|
+
/**
|
|
1012
|
+
* for `claude-sonnet-5-5`: no upfront thinking, but progress notes
|
|
1013
|
+
* between tool calls are returned as summarized thinking blocks.
|
|
1014
|
+
* Only supported at `low`, `medium`, and `high` effort.
|
|
1015
|
+
*/
|
|
1016
|
+
type: import_v43.z.literal("between_tools")
|
|
1017
|
+
})
|
|
1018
|
+
]),
|
|
1019
|
+
/**
|
|
1020
|
+
* Configures prefix mismatch recovery without changing the model's
|
|
1021
|
+
* default thinking mode.
|
|
1022
|
+
*/
|
|
1023
|
+
import_v43.z.object({
|
|
1024
|
+
blockBinding: anthropicThinkingBlockBinding
|
|
1025
|
+
})
|
|
1026
|
+
]).optional(),
|
|
1027
|
+
/**
|
|
1028
|
+
* Whether to disable parallel function calling during tool use. Default is false.
|
|
1029
|
+
* When set to true, Claude will use at most one tool per response.
|
|
1030
|
+
*/
|
|
1031
|
+
disableParallelToolUse: import_v43.z.boolean().optional(),
|
|
1032
|
+
/**
|
|
1033
|
+
* Cache control settings for this message.
|
|
1034
|
+
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
1035
|
+
*/
|
|
1036
|
+
cacheControl: import_v43.z.object({
|
|
1037
|
+
type: import_v43.z.literal("ephemeral"),
|
|
1038
|
+
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
|
|
1039
|
+
}).optional(),
|
|
1040
|
+
/**
|
|
1041
|
+
* Metadata to include with the request.
|
|
1042
|
+
*
|
|
1043
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
1044
|
+
*/
|
|
1045
|
+
metadata: import_v43.z.object({
|
|
1046
|
+
/**
|
|
1047
|
+
* An external identifier for the user associated with the request.
|
|
1048
|
+
*
|
|
1049
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
1050
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
1051
|
+
*/
|
|
1052
|
+
userId: import_v43.z.string().optional()
|
|
1053
|
+
}).optional(),
|
|
1054
|
+
/**
|
|
1055
|
+
* MCP servers to be utilized in this request.
|
|
1056
|
+
*/
|
|
1057
|
+
mcpServers: import_v43.z.array(
|
|
1058
|
+
import_v43.z.object({
|
|
1059
|
+
type: import_v43.z.literal("url"),
|
|
1060
|
+
name: import_v43.z.string(),
|
|
1061
|
+
url: import_v43.z.string(),
|
|
1062
|
+
authorizationToken: import_v43.z.string().nullish(),
|
|
1063
|
+
toolConfiguration: import_v43.z.object({
|
|
1064
|
+
enabled: import_v43.z.boolean().nullish(),
|
|
1065
|
+
allowedTools: import_v43.z.array(import_v43.z.string()).nullish()
|
|
1066
|
+
}).nullish()
|
|
1067
|
+
})
|
|
1068
|
+
).optional(),
|
|
1069
|
+
/**
|
|
1070
|
+
* Agent Skills configuration. Skills enable Claude to perform specialized tasks
|
|
1071
|
+
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
1072
|
+
* Requires code execution tool to be enabled.
|
|
1073
|
+
*/
|
|
1074
|
+
container: import_v43.z.object({
|
|
1075
|
+
id: import_v43.z.string().optional(),
|
|
1076
|
+
skills: import_v43.z.array(
|
|
1077
|
+
import_v43.z.object({
|
|
1078
|
+
type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
|
|
1079
|
+
skillId: import_v43.z.string(),
|
|
1080
|
+
version: import_v43.z.string().optional()
|
|
1081
|
+
})
|
|
1082
|
+
).optional()
|
|
1083
|
+
}).optional(),
|
|
1084
|
+
/**
|
|
1085
|
+
* Whether to enable fine-grained (eager) streaming of tool call inputs
|
|
1086
|
+
* and structured outputs for every function tool in the request. When
|
|
1087
|
+
* true (the default), each function tool receives a default of
|
|
1088
|
+
* `eager_input_streaming: true` unless it explicitly sets
|
|
1089
|
+
* `providerOptions.anthropic.eagerInputStreaming`.
|
|
1090
|
+
*
|
|
1091
|
+
* @default true
|
|
1092
|
+
*/
|
|
1093
|
+
toolStreaming: import_v43.z.boolean().optional(),
|
|
1094
|
+
/**
|
|
1095
|
+
* Controls how much effort the model spends on thinking, text responses,
|
|
1096
|
+
* and tool calls. On models that always use adaptive thinking
|
|
1097
|
+
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1098
|
+
*
|
|
1099
|
+
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1100
|
+
*/
|
|
1101
|
+
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1102
|
+
/**
|
|
1103
|
+
* Task budget for agentic turns. Informs the model of the total token budget
|
|
1104
|
+
* available for the current task, allowing it to prioritize work and wind down
|
|
1105
|
+
* gracefully as the budget is consumed.
|
|
1106
|
+
*
|
|
1107
|
+
* Advisory only — does not enforce a hard token limit.
|
|
1108
|
+
*/
|
|
1109
|
+
taskBudget: import_v43.z.object({
|
|
1110
|
+
type: import_v43.z.literal("tokens"),
|
|
1111
|
+
total: import_v43.z.number().int().min(2e4),
|
|
1112
|
+
remaining: import_v43.z.number().int().min(0).optional()
|
|
1113
|
+
}).optional(),
|
|
1114
|
+
/**
|
|
1115
|
+
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
1116
|
+
* Only supported with claude-opus-4-6.
|
|
1117
|
+
*/
|
|
1118
|
+
speed: import_v43.z.enum(["fast", "standard"]).optional(),
|
|
1119
|
+
/**
|
|
1120
|
+
* Controls where model inference runs for this request.
|
|
1121
|
+
*
|
|
1122
|
+
* - `"global"`: Inference may run in any available geography (default).
|
|
1123
|
+
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
1124
|
+
*
|
|
1125
|
+
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
1126
|
+
*/
|
|
1127
|
+
inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
|
|
1128
|
+
/**
|
|
1129
|
+
* Server-side fallback configuration.
|
|
1130
|
+
*
|
|
1131
|
+
* When the primary model's safety classifiers block a turn, the API
|
|
1132
|
+
* automatically retries it server-side on a fallback model. A
|
|
1133
|
+
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
1134
|
+
*
|
|
1135
|
+
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
1136
|
+
* recommended fallback model based on the refusal category. Requires the
|
|
1137
|
+
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
1138
|
+
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
1139
|
+
* request as a direct request to that entry's model, so it must be
|
|
1140
|
+
* formatted accordingly: `model` is required, and an entry may
|
|
1141
|
+
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
1142
|
+
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
1143
|
+
* beta). The value is passed through to the API as-is, and the
|
|
1144
|
+
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
1145
|
+
*/
|
|
1146
|
+
fallbacks: import_v43.z.union([
|
|
1147
|
+
import_v43.z.literal("default"),
|
|
1148
|
+
import_v43.z.array(
|
|
1149
|
+
import_v43.z.object({
|
|
1150
|
+
model: import_v43.z.string(),
|
|
1151
|
+
max_tokens: import_v43.z.number().int().optional(),
|
|
1152
|
+
thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1153
|
+
output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1154
|
+
speed: import_v43.z.enum(["fast", "standard"]).optional()
|
|
1155
|
+
})
|
|
1156
|
+
)
|
|
1157
|
+
]).optional(),
|
|
1158
|
+
/**
|
|
1159
|
+
* A set of beta features to enable.
|
|
1160
|
+
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1161
|
+
*/
|
|
1162
|
+
anthropicBeta: import_v43.z.array(import_v43.z.string()).optional(),
|
|
1163
|
+
/**
|
|
1164
|
+
* Server-side safeguards to run as part of the request.
|
|
1165
|
+
*
|
|
1166
|
+
* `dangerous_tool_use` asks the API to classify every `tool_use` block in
|
|
1167
|
+
* the response for dangerous actions (the check Claude Code's auto mode
|
|
1168
|
+
* relies on). The per-call verdicts are returned in
|
|
1169
|
+
* `providerMetadata.anthropic.safeguardResults`, keyed by tool call id.
|
|
1170
|
+
* `classifierContext` is passed through to the API as `classifier_context`.
|
|
1171
|
+
* The `dangerous-tool-use-2026-09-03` beta is added automatically.
|
|
1172
|
+
*/
|
|
1173
|
+
safeguards: import_v43.z.array(
|
|
1171
1174
|
import_v43.z.object({
|
|
1172
|
-
type: import_v43.z.literal("
|
|
1173
|
-
|
|
1175
|
+
type: import_v43.z.literal("dangerous_tool_use"),
|
|
1176
|
+
classifierContext: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional()
|
|
1177
|
+
})
|
|
1178
|
+
).optional(),
|
|
1179
|
+
contextManagement: import_v43.z.object({
|
|
1180
|
+
edits: import_v43.z.array(
|
|
1181
|
+
import_v43.z.discriminatedUnion("type", [
|
|
1174
1182
|
import_v43.z.object({
|
|
1175
|
-
type: import_v43.z.literal("
|
|
1176
|
-
|
|
1183
|
+
type: import_v43.z.literal("clear_tool_uses_20250919"),
|
|
1184
|
+
trigger: import_v43.z.discriminatedUnion("type", [
|
|
1185
|
+
import_v43.z.object({
|
|
1186
|
+
type: import_v43.z.literal("input_tokens"),
|
|
1187
|
+
value: import_v43.z.number()
|
|
1188
|
+
}),
|
|
1189
|
+
import_v43.z.object({
|
|
1190
|
+
type: import_v43.z.literal("tool_uses"),
|
|
1191
|
+
value: import_v43.z.number()
|
|
1192
|
+
})
|
|
1193
|
+
]).optional(),
|
|
1194
|
+
keep: import_v43.z.object({
|
|
1195
|
+
type: import_v43.z.literal("tool_uses"),
|
|
1196
|
+
value: import_v43.z.number()
|
|
1197
|
+
}).optional(),
|
|
1198
|
+
clearAtLeast: import_v43.z.object({
|
|
1199
|
+
type: import_v43.z.literal("input_tokens"),
|
|
1200
|
+
value: import_v43.z.number()
|
|
1201
|
+
}).optional(),
|
|
1202
|
+
clearToolInputs: import_v43.z.boolean().optional(),
|
|
1203
|
+
excludeTools: import_v43.z.array(import_v43.z.string()).optional()
|
|
1177
1204
|
}),
|
|
1178
1205
|
import_v43.z.object({
|
|
1179
|
-
type: import_v43.z.literal("
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
type: import_v43.z.literal("input_tokens"),
|
|
1189
|
-
value: import_v43.z.number()
|
|
1190
|
-
}).optional(),
|
|
1191
|
-
clearToolInputs: import_v43.z.boolean().optional(),
|
|
1192
|
-
excludeTools: import_v43.z.array(import_v43.z.string()).optional()
|
|
1193
|
-
}),
|
|
1194
|
-
import_v43.z.object({
|
|
1195
|
-
type: import_v43.z.literal("clear_thinking_20251015"),
|
|
1196
|
-
keep: import_v43.z.union([
|
|
1197
|
-
import_v43.z.literal("all"),
|
|
1206
|
+
type: import_v43.z.literal("clear_thinking_20251015"),
|
|
1207
|
+
keep: import_v43.z.union([
|
|
1208
|
+
import_v43.z.literal("all"),
|
|
1209
|
+
import_v43.z.object({
|
|
1210
|
+
type: import_v43.z.literal("thinking_turns"),
|
|
1211
|
+
value: import_v43.z.number()
|
|
1212
|
+
})
|
|
1213
|
+
]).optional()
|
|
1214
|
+
}),
|
|
1198
1215
|
import_v43.z.object({
|
|
1199
|
-
type: import_v43.z.literal("
|
|
1200
|
-
|
|
1216
|
+
type: import_v43.z.literal("compact_20260112"),
|
|
1217
|
+
trigger: import_v43.z.object({
|
|
1218
|
+
type: import_v43.z.literal("input_tokens"),
|
|
1219
|
+
value: import_v43.z.number()
|
|
1220
|
+
}).optional(),
|
|
1221
|
+
pauseAfterCompaction: import_v43.z.boolean().optional(),
|
|
1222
|
+
instructions: import_v43.z.string().optional()
|
|
1201
1223
|
})
|
|
1202
|
-
])
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
type: import_v43.z.literal("input_tokens"),
|
|
1208
|
-
value: import_v43.z.number()
|
|
1209
|
-
}).optional(),
|
|
1210
|
-
pauseAfterCompaction: import_v43.z.boolean().optional(),
|
|
1211
|
-
instructions: import_v43.z.string().optional()
|
|
1212
|
-
})
|
|
1213
|
-
])
|
|
1214
|
-
)
|
|
1215
|
-
}).optional()
|
|
1224
|
+
])
|
|
1225
|
+
)
|
|
1226
|
+
}).optional()
|
|
1227
|
+
})
|
|
1228
|
+
);
|
|
1216
1229
|
});
|
|
1217
1230
|
|
|
1218
1231
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1266,10 +1279,10 @@ var CacheControlValidator = class {
|
|
|
1266
1279
|
};
|
|
1267
1280
|
|
|
1268
1281
|
// src/tool/advisor_20260301.ts
|
|
1269
|
-
var
|
|
1282
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1270
1283
|
var import_v44 = require("zod/v4");
|
|
1271
|
-
var advisor_20260301ArgsSchema = (0,
|
|
1272
|
-
() => (0,
|
|
1284
|
+
var advisor_20260301ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
1285
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1273
1286
|
import_v44.z.object({
|
|
1274
1287
|
model: import_v44.z.string(),
|
|
1275
1288
|
maxUses: import_v44.z.number().optional(),
|
|
@@ -1280,8 +1293,8 @@ var advisor_20260301ArgsSchema = (0, import_provider_utils3.lazySchema)(
|
|
|
1280
1293
|
})
|
|
1281
1294
|
)
|
|
1282
1295
|
);
|
|
1283
|
-
var advisor_20260301OutputSchema = (0,
|
|
1284
|
-
() => (0,
|
|
1296
|
+
var advisor_20260301OutputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1297
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1285
1298
|
import_v44.z.discriminatedUnion("type", [
|
|
1286
1299
|
import_v44.z.object({
|
|
1287
1300
|
type: import_v44.z.literal("advisor_result"),
|
|
@@ -1298,10 +1311,10 @@ var advisor_20260301OutputSchema = (0, import_provider_utils3.lazySchema)(
|
|
|
1298
1311
|
])
|
|
1299
1312
|
)
|
|
1300
1313
|
);
|
|
1301
|
-
var advisor_20260301InputSchema = (0,
|
|
1302
|
-
() => (0,
|
|
1314
|
+
var advisor_20260301InputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1315
|
+
() => (0, import_provider_utils4.zodSchema)(import_v44.z.object({}).strict())
|
|
1303
1316
|
);
|
|
1304
|
-
var factory = (0,
|
|
1317
|
+
var factory = (0, import_provider_utils4.createProviderToolFactoryWithOutputSchema)({
|
|
1305
1318
|
id: "anthropic.advisor_20260301",
|
|
1306
1319
|
inputSchema: advisor_20260301InputSchema,
|
|
1307
1320
|
outputSchema: advisor_20260301OutputSchema,
|
|
@@ -1312,7 +1325,7 @@ var advisor_20260301 = (args) => {
|
|
|
1312
1325
|
};
|
|
1313
1326
|
|
|
1314
1327
|
// src/tool/computer-toolset_20260801.ts
|
|
1315
|
-
var
|
|
1328
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1316
1329
|
var import_v45 = require("zod/v4");
|
|
1317
1330
|
var computerToolset_20260801Members = [
|
|
1318
1331
|
"screenshot",
|
|
@@ -1333,8 +1346,8 @@ var computerToolset_20260801Members = [
|
|
|
1333
1346
|
"hold_key",
|
|
1334
1347
|
"wait"
|
|
1335
1348
|
];
|
|
1336
|
-
var computerToolset_20260801InputSchema = (0,
|
|
1337
|
-
() => (0,
|
|
1349
|
+
var computerToolset_20260801InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1350
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1338
1351
|
import_v45.z.object({
|
|
1339
1352
|
action: import_v45.z.enum(computerToolset_20260801Members),
|
|
1340
1353
|
coordinate: import_v45.z.tuple([import_v45.z.number().int(), import_v45.z.number().int()]).optional(),
|
|
@@ -1353,8 +1366,8 @@ var computerToolset_20260801InputSchema = (0, import_provider_utils4.lazySchema)
|
|
|
1353
1366
|
})
|
|
1354
1367
|
)
|
|
1355
1368
|
);
|
|
1356
|
-
var computerToolset_20260801ArgsSchema = (0,
|
|
1357
|
-
() => (0,
|
|
1369
|
+
var computerToolset_20260801ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1370
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1358
1371
|
import_v45.z.object({
|
|
1359
1372
|
configs: import_v45.z.partialRecord(
|
|
1360
1373
|
import_v45.z.enum(computerToolset_20260801Members),
|
|
@@ -1366,23 +1379,23 @@ var computerToolset_20260801ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
|
1366
1379
|
})
|
|
1367
1380
|
)
|
|
1368
1381
|
);
|
|
1369
|
-
var computerToolset_20260801 = (0,
|
|
1382
|
+
var computerToolset_20260801 = (0, import_provider_utils5.createProviderToolFactory)({
|
|
1370
1383
|
id: "anthropic.computer_toolset_20260801",
|
|
1371
1384
|
inputSchema: computerToolset_20260801InputSchema
|
|
1372
1385
|
});
|
|
1373
1386
|
|
|
1374
1387
|
// src/tool/text-editor_20250728.ts
|
|
1375
|
-
var
|
|
1388
|
+
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1376
1389
|
var import_v46 = require("zod/v4");
|
|
1377
|
-
var textEditor_20250728ArgsSchema = (0,
|
|
1378
|
-
() => (0,
|
|
1390
|
+
var textEditor_20250728ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1391
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1379
1392
|
import_v46.z.object({
|
|
1380
1393
|
maxCharacters: import_v46.z.number().optional()
|
|
1381
1394
|
})
|
|
1382
1395
|
)
|
|
1383
1396
|
);
|
|
1384
|
-
var textEditor_20250728InputSchema = (0,
|
|
1385
|
-
() => (0,
|
|
1397
|
+
var textEditor_20250728InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1398
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1386
1399
|
import_v46.z.object({
|
|
1387
1400
|
command: import_v46.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1388
1401
|
path: import_v46.z.string(),
|
|
@@ -1395,7 +1408,7 @@ var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1395
1408
|
})
|
|
1396
1409
|
)
|
|
1397
1410
|
);
|
|
1398
|
-
var factory2 = (0,
|
|
1411
|
+
var factory2 = (0, import_provider_utils6.createProviderToolFactory)({
|
|
1399
1412
|
id: "anthropic.text_editor_20250728",
|
|
1400
1413
|
inputSchema: textEditor_20250728InputSchema
|
|
1401
1414
|
});
|
|
@@ -1404,10 +1417,10 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1404
1417
|
};
|
|
1405
1418
|
|
|
1406
1419
|
// src/tool/web-search_20260209.ts
|
|
1407
|
-
var
|
|
1420
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1408
1421
|
var import_v47 = require("zod/v4");
|
|
1409
|
-
var webSearch_20260209ArgsSchema = (0,
|
|
1410
|
-
() => (0,
|
|
1422
|
+
var webSearch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1423
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1411
1424
|
import_v47.z.object({
|
|
1412
1425
|
maxUses: import_v47.z.number().optional(),
|
|
1413
1426
|
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
@@ -1422,8 +1435,8 @@ var webSearch_20260209ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1422
1435
|
})
|
|
1423
1436
|
)
|
|
1424
1437
|
);
|
|
1425
|
-
var webSearch_20260209OutputSchema = (0,
|
|
1426
|
-
() => (0,
|
|
1438
|
+
var webSearch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1439
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1427
1440
|
import_v47.z.array(
|
|
1428
1441
|
import_v47.z.object({
|
|
1429
1442
|
url: import_v47.z.string(),
|
|
@@ -1435,14 +1448,14 @@ var webSearch_20260209OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1435
1448
|
)
|
|
1436
1449
|
)
|
|
1437
1450
|
);
|
|
1438
|
-
var webSearch_20260209InputSchema = (0,
|
|
1439
|
-
() => (0,
|
|
1451
|
+
var webSearch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1452
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1440
1453
|
import_v47.z.object({
|
|
1441
1454
|
query: import_v47.z.string()
|
|
1442
1455
|
})
|
|
1443
1456
|
)
|
|
1444
1457
|
);
|
|
1445
|
-
var factory3 = (0,
|
|
1458
|
+
var factory3 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1446
1459
|
id: "anthropic.web_search_20260209",
|
|
1447
1460
|
inputSchema: webSearch_20260209InputSchema,
|
|
1448
1461
|
outputSchema: webSearch_20260209OutputSchema,
|
|
@@ -1453,10 +1466,10 @@ var webSearch_20260209 = (args = {}) => {
|
|
|
1453
1466
|
};
|
|
1454
1467
|
|
|
1455
1468
|
// src/tool/web-search_20250305.ts
|
|
1456
|
-
var
|
|
1469
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1457
1470
|
var import_v48 = require("zod/v4");
|
|
1458
|
-
var webSearch_20250305ArgsSchema = (0,
|
|
1459
|
-
() => (0,
|
|
1471
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
1472
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1460
1473
|
import_v48.z.object({
|
|
1461
1474
|
maxUses: import_v48.z.number().optional(),
|
|
1462
1475
|
allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
@@ -1471,8 +1484,8 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
|
1471
1484
|
})
|
|
1472
1485
|
)
|
|
1473
1486
|
);
|
|
1474
|
-
var webSearch_20250305OutputSchema = (0,
|
|
1475
|
-
() => (0,
|
|
1487
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1488
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1476
1489
|
import_v48.z.array(
|
|
1477
1490
|
import_v48.z.object({
|
|
1478
1491
|
url: import_v48.z.string(),
|
|
@@ -1484,14 +1497,14 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
|
1484
1497
|
)
|
|
1485
1498
|
)
|
|
1486
1499
|
);
|
|
1487
|
-
var webSearch_20250305InputSchema = (0,
|
|
1488
|
-
() => (0,
|
|
1500
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1501
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1489
1502
|
import_v48.z.object({
|
|
1490
1503
|
query: import_v48.z.string()
|
|
1491
1504
|
})
|
|
1492
1505
|
)
|
|
1493
1506
|
);
|
|
1494
|
-
var factory4 = (0,
|
|
1507
|
+
var factory4 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1495
1508
|
id: "anthropic.web_search_20250305",
|
|
1496
1509
|
inputSchema: webSearch_20250305InputSchema,
|
|
1497
1510
|
outputSchema: webSearch_20250305OutputSchema,
|
|
@@ -1502,10 +1515,10 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1502
1515
|
};
|
|
1503
1516
|
|
|
1504
1517
|
// src/tool/web-fetch-20260209.ts
|
|
1505
|
-
var
|
|
1518
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1506
1519
|
var import_v49 = require("zod/v4");
|
|
1507
|
-
var webFetch_20260209ArgsSchema = (0,
|
|
1508
|
-
() => (0,
|
|
1520
|
+
var webFetch_20260209ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
1521
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1509
1522
|
import_v49.z.object({
|
|
1510
1523
|
maxUses: import_v49.z.number().optional(),
|
|
1511
1524
|
allowedDomains: import_v49.z.array(import_v49.z.string()).optional(),
|
|
@@ -1515,8 +1528,8 @@ var webFetch_20260209ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1515
1528
|
})
|
|
1516
1529
|
)
|
|
1517
1530
|
);
|
|
1518
|
-
var webFetch_20260209OutputSchema = (0,
|
|
1519
|
-
() => (0,
|
|
1531
|
+
var webFetch_20260209OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1532
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1520
1533
|
import_v49.z.object({
|
|
1521
1534
|
type: import_v49.z.literal("web_fetch_result"),
|
|
1522
1535
|
url: import_v49.z.string(),
|
|
@@ -1541,14 +1554,14 @@ var webFetch_20260209OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1541
1554
|
})
|
|
1542
1555
|
)
|
|
1543
1556
|
);
|
|
1544
|
-
var webFetch_20260209InputSchema = (0,
|
|
1545
|
-
() => (0,
|
|
1557
|
+
var webFetch_20260209InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1558
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1546
1559
|
import_v49.z.object({
|
|
1547
1560
|
url: import_v49.z.string()
|
|
1548
1561
|
})
|
|
1549
1562
|
)
|
|
1550
1563
|
);
|
|
1551
|
-
var factory5 = (0,
|
|
1564
|
+
var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
|
|
1552
1565
|
id: "anthropic.web_fetch_20260209",
|
|
1553
1566
|
inputSchema: webFetch_20260209InputSchema,
|
|
1554
1567
|
outputSchema: webFetch_20260209OutputSchema,
|
|
@@ -1559,10 +1572,10 @@ var webFetch_20260209 = (args = {}) => {
|
|
|
1559
1572
|
};
|
|
1560
1573
|
|
|
1561
1574
|
// src/tool/web-fetch-20250910.ts
|
|
1562
|
-
var
|
|
1575
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1563
1576
|
var import_v410 = require("zod/v4");
|
|
1564
|
-
var webFetch_20250910ArgsSchema = (0,
|
|
1565
|
-
() => (0,
|
|
1577
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils10.lazySchema)(
|
|
1578
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1566
1579
|
import_v410.z.object({
|
|
1567
1580
|
maxUses: import_v410.z.number().optional(),
|
|
1568
1581
|
allowedDomains: import_v410.z.array(import_v410.z.string()).optional(),
|
|
@@ -1572,8 +1585,8 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
|
1572
1585
|
})
|
|
1573
1586
|
)
|
|
1574
1587
|
);
|
|
1575
|
-
var webFetch_20250910OutputSchema = (0,
|
|
1576
|
-
() => (0,
|
|
1588
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1589
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1577
1590
|
import_v410.z.object({
|
|
1578
1591
|
type: import_v410.z.literal("web_fetch_result"),
|
|
1579
1592
|
url: import_v410.z.string(),
|
|
@@ -1598,14 +1611,14 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
|
1598
1611
|
})
|
|
1599
1612
|
)
|
|
1600
1613
|
);
|
|
1601
|
-
var webFetch_20250910InputSchema = (0,
|
|
1602
|
-
() => (0,
|
|
1614
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1615
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1603
1616
|
import_v410.z.object({
|
|
1604
1617
|
url: import_v410.z.string()
|
|
1605
1618
|
})
|
|
1606
1619
|
)
|
|
1607
1620
|
);
|
|
1608
|
-
var factory6 = (0,
|
|
1621
|
+
var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
|
|
1609
1622
|
id: "anthropic.web_fetch_20250910",
|
|
1610
1623
|
inputSchema: webFetch_20250910InputSchema,
|
|
1611
1624
|
outputSchema: webFetch_20250910OutputSchema,
|
|
@@ -1616,7 +1629,7 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1616
1629
|
};
|
|
1617
1630
|
|
|
1618
1631
|
// src/anthropic-prepare-tools.ts
|
|
1619
|
-
var
|
|
1632
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1620
1633
|
async function prepareTools({
|
|
1621
1634
|
tools,
|
|
1622
1635
|
toolChoice,
|
|
@@ -1729,7 +1742,7 @@ async function prepareTools({
|
|
|
1729
1742
|
break;
|
|
1730
1743
|
}
|
|
1731
1744
|
case "anthropic.computer_toolset_20260801": {
|
|
1732
|
-
const args = await (0,
|
|
1745
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1733
1746
|
value: tool.args,
|
|
1734
1747
|
schema: computerToolset_20260801ArgsSchema
|
|
1735
1748
|
});
|
|
@@ -1793,7 +1806,7 @@ async function prepareTools({
|
|
|
1793
1806
|
break;
|
|
1794
1807
|
}
|
|
1795
1808
|
case "anthropic.text_editor_20250728": {
|
|
1796
|
-
const args = await (0,
|
|
1809
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1797
1810
|
value: tool.args,
|
|
1798
1811
|
schema: textEditor_20250728ArgsSchema
|
|
1799
1812
|
});
|
|
@@ -1833,7 +1846,7 @@ async function prepareTools({
|
|
|
1833
1846
|
}
|
|
1834
1847
|
case "anthropic.web_fetch_20250910": {
|
|
1835
1848
|
betas.add("web-fetch-2025-09-10");
|
|
1836
|
-
const args = await (0,
|
|
1849
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1837
1850
|
value: tool.args,
|
|
1838
1851
|
schema: webFetch_20250910ArgsSchema
|
|
1839
1852
|
});
|
|
@@ -1851,7 +1864,7 @@ async function prepareTools({
|
|
|
1851
1864
|
}
|
|
1852
1865
|
case "anthropic.web_fetch_20260209": {
|
|
1853
1866
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1854
|
-
const args = await (0,
|
|
1867
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1855
1868
|
value: tool.args,
|
|
1856
1869
|
schema: webFetch_20260209ArgsSchema
|
|
1857
1870
|
});
|
|
@@ -1868,7 +1881,7 @@ async function prepareTools({
|
|
|
1868
1881
|
break;
|
|
1869
1882
|
}
|
|
1870
1883
|
case "anthropic.web_search_20250305": {
|
|
1871
|
-
const args = await (0,
|
|
1884
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1872
1885
|
value: tool.args,
|
|
1873
1886
|
schema: webSearch_20250305ArgsSchema
|
|
1874
1887
|
});
|
|
@@ -1885,7 +1898,7 @@ async function prepareTools({
|
|
|
1885
1898
|
}
|
|
1886
1899
|
case "anthropic.web_search_20260209": {
|
|
1887
1900
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1888
|
-
const args = await (0,
|
|
1901
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1889
1902
|
value: tool.args,
|
|
1890
1903
|
schema: webSearch_20260209ArgsSchema
|
|
1891
1904
|
});
|
|
@@ -1916,7 +1929,7 @@ async function prepareTools({
|
|
|
1916
1929
|
}
|
|
1917
1930
|
case "anthropic.advisor_20260301": {
|
|
1918
1931
|
betas.add("advisor-tool-2026-03-01");
|
|
1919
|
-
const args = await (0,
|
|
1932
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1920
1933
|
value: tool.args,
|
|
1921
1934
|
schema: advisor_20260301ArgsSchema
|
|
1922
1935
|
});
|
|
@@ -2093,13 +2106,13 @@ function convertAnthropicMessagesUsage({
|
|
|
2093
2106
|
|
|
2094
2107
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2095
2108
|
var import_provider2 = require("@ai-sdk/provider");
|
|
2096
|
-
var
|
|
2109
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2097
2110
|
|
|
2098
2111
|
// src/tool/code-execution_20250522.ts
|
|
2099
|
-
var
|
|
2112
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2100
2113
|
var import_v411 = require("zod/v4");
|
|
2101
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
2102
|
-
() => (0,
|
|
2114
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2115
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2103
2116
|
import_v411.z.object({
|
|
2104
2117
|
type: import_v411.z.literal("code_execution_result"),
|
|
2105
2118
|
stdout: import_v411.z.string(),
|
|
@@ -2114,14 +2127,14 @@ var codeExecution_20250522OutputSchema = (0, import_provider_utils11.lazySchema)
|
|
|
2114
2127
|
})
|
|
2115
2128
|
)
|
|
2116
2129
|
);
|
|
2117
|
-
var codeExecution_20250522InputSchema = (0,
|
|
2118
|
-
() => (0,
|
|
2130
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2131
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2119
2132
|
import_v411.z.object({
|
|
2120
2133
|
code: import_v411.z.string()
|
|
2121
2134
|
})
|
|
2122
2135
|
)
|
|
2123
2136
|
);
|
|
2124
|
-
var factory7 = (0,
|
|
2137
|
+
var factory7 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
2125
2138
|
id: "anthropic.code_execution_20250522",
|
|
2126
2139
|
inputSchema: codeExecution_20250522InputSchema,
|
|
2127
2140
|
outputSchema: codeExecution_20250522OutputSchema
|
|
@@ -2131,10 +2144,10 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
2131
2144
|
};
|
|
2132
2145
|
|
|
2133
2146
|
// src/tool/code-execution_20250825.ts
|
|
2134
|
-
var
|
|
2147
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2135
2148
|
var import_v412 = require("zod/v4");
|
|
2136
|
-
var codeExecution_20250825OutputSchema = (0,
|
|
2137
|
-
() => (0,
|
|
2149
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2150
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2138
2151
|
import_v412.z.discriminatedUnion("type", [
|
|
2139
2152
|
import_v412.z.object({
|
|
2140
2153
|
type: import_v412.z.literal("code_execution_result"),
|
|
@@ -2191,8 +2204,8 @@ var codeExecution_20250825OutputSchema = (0, import_provider_utils12.lazySchema)
|
|
|
2191
2204
|
])
|
|
2192
2205
|
)
|
|
2193
2206
|
);
|
|
2194
|
-
var codeExecution_20250825InputSchema = (0,
|
|
2195
|
-
() => (0,
|
|
2207
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2208
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2196
2209
|
import_v412.z.discriminatedUnion("type", [
|
|
2197
2210
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2198
2211
|
import_v412.z.object({
|
|
@@ -2226,7 +2239,7 @@ var codeExecution_20250825InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
|
2226
2239
|
])
|
|
2227
2240
|
)
|
|
2228
2241
|
);
|
|
2229
|
-
var factory8 = (0,
|
|
2242
|
+
var factory8 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
|
|
2230
2243
|
id: "anthropic.code_execution_20250825",
|
|
2231
2244
|
inputSchema: codeExecution_20250825InputSchema,
|
|
2232
2245
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -2240,10 +2253,10 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
2240
2253
|
};
|
|
2241
2254
|
|
|
2242
2255
|
// src/tool/code-execution_20260120.ts
|
|
2243
|
-
var
|
|
2256
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2244
2257
|
var import_v413 = require("zod/v4");
|
|
2245
|
-
var codeExecution_20260120OutputSchema = (0,
|
|
2246
|
-
() => (0,
|
|
2258
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2259
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2247
2260
|
import_v413.z.discriminatedUnion("type", [
|
|
2248
2261
|
import_v413.z.object({
|
|
2249
2262
|
type: import_v413.z.literal("code_execution_result"),
|
|
@@ -2312,8 +2325,8 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)
|
|
|
2312
2325
|
])
|
|
2313
2326
|
)
|
|
2314
2327
|
);
|
|
2315
|
-
var codeExecution_20260120InputSchema = (0,
|
|
2316
|
-
() => (0,
|
|
2328
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2329
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2317
2330
|
import_v413.z.discriminatedUnion("type", [
|
|
2318
2331
|
import_v413.z.object({
|
|
2319
2332
|
type: import_v413.z.literal("programmatic-tool-call"),
|
|
@@ -2346,7 +2359,7 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
|
2346
2359
|
])
|
|
2347
2360
|
)
|
|
2348
2361
|
);
|
|
2349
|
-
var factory9 = (0,
|
|
2362
|
+
var factory9 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
2350
2363
|
id: "anthropic.code_execution_20260120",
|
|
2351
2364
|
inputSchema: codeExecution_20260120InputSchema,
|
|
2352
2365
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
@@ -2357,10 +2370,10 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
2357
2370
|
};
|
|
2358
2371
|
|
|
2359
2372
|
// src/tool/tool-search-regex_20251119.ts
|
|
2360
|
-
var
|
|
2373
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2361
2374
|
var import_v414 = require("zod/v4");
|
|
2362
|
-
var toolSearchRegex_20251119OutputSchema = (0,
|
|
2363
|
-
() => (0,
|
|
2375
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2376
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2364
2377
|
import_v414.z.array(
|
|
2365
2378
|
import_v414.z.object({
|
|
2366
2379
|
type: import_v414.z.literal("tool_reference"),
|
|
@@ -2369,8 +2382,8 @@ var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils14.lazySchem
|
|
|
2369
2382
|
)
|
|
2370
2383
|
)
|
|
2371
2384
|
);
|
|
2372
|
-
var toolSearchRegex_20251119InputSchema = (0,
|
|
2373
|
-
() => (0,
|
|
2385
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2386
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2374
2387
|
import_v414.z.object({
|
|
2375
2388
|
/**
|
|
2376
2389
|
* A regex pattern to search for tools.
|
|
@@ -2390,7 +2403,7 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema
|
|
|
2390
2403
|
})
|
|
2391
2404
|
)
|
|
2392
2405
|
);
|
|
2393
|
-
var factory10 = (0,
|
|
2406
|
+
var factory10 = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
2394
2407
|
id: "anthropic.tool_search_regex_20251119",
|
|
2395
2408
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
2396
2409
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
@@ -2403,7 +2416,7 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
2403
2416
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2404
2417
|
function convertToString(data) {
|
|
2405
2418
|
if (typeof data === "string") {
|
|
2406
|
-
return new TextDecoder().decode((0,
|
|
2419
|
+
return new TextDecoder().decode((0, import_provider_utils16.convertBase64ToUint8Array)(data));
|
|
2407
2420
|
}
|
|
2408
2421
|
if (data instanceof Uint8Array) {
|
|
2409
2422
|
return new TextDecoder().decode(data);
|
|
@@ -2428,7 +2441,7 @@ function getUrlString(data) {
|
|
|
2428
2441
|
}
|
|
2429
2442
|
async function extractErrorValue(value) {
|
|
2430
2443
|
if (typeof value === "string") {
|
|
2431
|
-
const result = await (0,
|
|
2444
|
+
const result = await (0, import_provider_utils16.safeParseJSON)({ text: value });
|
|
2432
2445
|
if (result.success && typeof result.value === "object" && result.value !== null) {
|
|
2433
2446
|
return result.value;
|
|
2434
2447
|
}
|
|
@@ -2459,7 +2472,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2459
2472
|
let lastUserMessageIndex = -1;
|
|
2460
2473
|
async function shouldEnableCitations(providerMetadata) {
|
|
2461
2474
|
var _a2, _b2;
|
|
2462
|
-
const anthropicOptions = await (0,
|
|
2475
|
+
const anthropicOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2463
2476
|
provider: "anthropic",
|
|
2464
2477
|
providerOptions: providerMetadata,
|
|
2465
2478
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2467,7 +2480,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2467
2480
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
2468
2481
|
}
|
|
2469
2482
|
async function getDocumentMetadata(providerMetadata) {
|
|
2470
|
-
const anthropicOptions = await (0,
|
|
2483
|
+
const anthropicOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2471
2484
|
provider: "anthropic",
|
|
2472
2485
|
providerOptions: providerMetadata,
|
|
2473
2486
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2487,7 +2500,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2487
2500
|
let toolChangeCount = 0;
|
|
2488
2501
|
let hasMidConversationOptions = false;
|
|
2489
2502
|
for (const { content: text, providerOptions } of block.messages) {
|
|
2490
|
-
const systemMessageOptions = await (0,
|
|
2503
|
+
const systemMessageOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2491
2504
|
provider: "anthropic",
|
|
2492
2505
|
providerOptions,
|
|
2493
2506
|
schema: anthropicSystemMessageProviderOptions
|
|
@@ -2608,7 +2621,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2608
2621
|
} : {
|
|
2609
2622
|
type: "base64",
|
|
2610
2623
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
2611
|
-
data: (0,
|
|
2624
|
+
data: (0, import_provider_utils16.convertToBase64)(part.data)
|
|
2612
2625
|
},
|
|
2613
2626
|
cache_control: cacheControl
|
|
2614
2627
|
});
|
|
@@ -2628,7 +2641,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2628
2641
|
} : {
|
|
2629
2642
|
type: "base64",
|
|
2630
2643
|
media_type: "application/pdf",
|
|
2631
|
-
data: (0,
|
|
2644
|
+
data: (0, import_provider_utils16.convertToBase64)(part.data)
|
|
2632
2645
|
},
|
|
2633
2646
|
title: (_c = metadata.title) != null ? _c : part.filename,
|
|
2634
2647
|
...metadata.context && { context: metadata.context },
|
|
@@ -2772,7 +2785,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2772
2785
|
return void 0;
|
|
2773
2786
|
}
|
|
2774
2787
|
}
|
|
2775
|
-
}).filter(
|
|
2788
|
+
}).filter(import_provider_utils16.isNonNullable);
|
|
2776
2789
|
break;
|
|
2777
2790
|
case "text":
|
|
2778
2791
|
case "error-text":
|
|
@@ -2857,7 +2870,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2857
2870
|
}
|
|
2858
2871
|
case "reasoning": {
|
|
2859
2872
|
if (sendReasoning) {
|
|
2860
|
-
const reasoningMetadata = await (0,
|
|
2873
|
+
const reasoningMetadata = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2861
2874
|
provider: "anthropic",
|
|
2862
2875
|
providerOptions: part.providerOptions,
|
|
2863
2876
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -3055,7 +3068,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3055
3068
|
let errorInfo = {};
|
|
3056
3069
|
try {
|
|
3057
3070
|
if (typeof output.value === "string") {
|
|
3058
|
-
errorInfo = (0,
|
|
3071
|
+
errorInfo = (0, import_provider_utils16.secureJsonParse)(output.value);
|
|
3059
3072
|
} else if (typeof output.value === "object" && output.value !== null) {
|
|
3060
3073
|
errorInfo = output.value;
|
|
3061
3074
|
}
|
|
@@ -3099,7 +3112,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3099
3112
|
break;
|
|
3100
3113
|
}
|
|
3101
3114
|
if (output.value.type === "code_execution_result") {
|
|
3102
|
-
const codeExecutionOutput = await (0,
|
|
3115
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3103
3116
|
value: output.value,
|
|
3104
3117
|
schema: codeExecution_20250522OutputSchema
|
|
3105
3118
|
});
|
|
@@ -3116,7 +3129,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3116
3129
|
cache_control: cacheControl
|
|
3117
3130
|
});
|
|
3118
3131
|
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
3119
|
-
const codeExecutionOutput = await (0,
|
|
3132
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3120
3133
|
value: output.value,
|
|
3121
3134
|
schema: codeExecution_20260120OutputSchema
|
|
3122
3135
|
});
|
|
@@ -3135,7 +3148,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3135
3148
|
});
|
|
3136
3149
|
}
|
|
3137
3150
|
} else {
|
|
3138
|
-
const codeExecutionOutput = await (0,
|
|
3151
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3139
3152
|
value: output.value,
|
|
3140
3153
|
schema: codeExecution_20250825OutputSchema
|
|
3141
3154
|
});
|
|
@@ -3200,7 +3213,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3200
3213
|
});
|
|
3201
3214
|
break;
|
|
3202
3215
|
}
|
|
3203
|
-
const webFetchOutput = await (0,
|
|
3216
|
+
const webFetchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3204
3217
|
value: output.value,
|
|
3205
3218
|
schema: webFetch_20250910OutputSchema
|
|
3206
3219
|
});
|
|
@@ -3249,7 +3262,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3249
3262
|
});
|
|
3250
3263
|
break;
|
|
3251
3264
|
}
|
|
3252
|
-
const webSearchOutput = await (0,
|
|
3265
|
+
const webSearchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3253
3266
|
value: output.value,
|
|
3254
3267
|
schema: webSearch_20250305OutputSchema
|
|
3255
3268
|
});
|
|
@@ -3289,7 +3302,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3289
3302
|
});
|
|
3290
3303
|
break;
|
|
3291
3304
|
}
|
|
3292
|
-
const toolSearchOutput = await (0,
|
|
3305
|
+
const toolSearchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3293
3306
|
value: output.value,
|
|
3294
3307
|
schema: toolSearchRegex_20251119OutputSchema
|
|
3295
3308
|
});
|
|
@@ -3317,7 +3330,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3317
3330
|
});
|
|
3318
3331
|
break;
|
|
3319
3332
|
}
|
|
3320
|
-
const advisorOutput = await (0,
|
|
3333
|
+
const advisorOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3321
3334
|
value: output.value,
|
|
3322
3335
|
schema: advisor_20260301OutputSchema
|
|
3323
3336
|
});
|
|
@@ -3757,7 +3770,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3757
3770
|
var _a;
|
|
3758
3771
|
this.modelId = modelId;
|
|
3759
3772
|
this.config = config;
|
|
3760
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
3773
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils17.generateId;
|
|
3761
3774
|
}
|
|
3762
3775
|
supportsUrl(url) {
|
|
3763
3776
|
return url.protocol === "https:";
|
|
@@ -3833,12 +3846,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3833
3846
|
}
|
|
3834
3847
|
}
|
|
3835
3848
|
const providerOptionsName = this.providerOptionsName;
|
|
3836
|
-
const canonicalOptions = await (0,
|
|
3849
|
+
const canonicalOptions = await (0, import_provider_utils17.parseProviderOptions)({
|
|
3837
3850
|
provider: "anthropic",
|
|
3838
3851
|
providerOptions,
|
|
3839
3852
|
schema: anthropicLanguageModelOptions
|
|
3840
3853
|
});
|
|
3841
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0,
|
|
3854
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils17.parseProviderOptions)({
|
|
3842
3855
|
provider: providerOptionsName,
|
|
3843
3856
|
providerOptions,
|
|
3844
3857
|
schema: anthropicLanguageModelOptions
|
|
@@ -3923,7 +3936,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3923
3936
|
const cacheControlValidator = new CacheControlValidator(
|
|
3924
3937
|
this.config.cacheControlProviderOptionsName
|
|
3925
3938
|
);
|
|
3926
|
-
const toolNameMapping = (0,
|
|
3939
|
+
const toolNameMapping = (0, import_provider_utils17.createToolNameMapping)({
|
|
3927
3940
|
tools,
|
|
3928
3941
|
providerToolNames: {
|
|
3929
3942
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -4315,15 +4328,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4315
4328
|
betas,
|
|
4316
4329
|
headers
|
|
4317
4330
|
}) {
|
|
4318
|
-
return (0,
|
|
4319
|
-
await (0,
|
|
4331
|
+
return (0, import_provider_utils17.combineHeaders)(
|
|
4332
|
+
await (0, import_provider_utils17.resolve)(this.config.headers),
|
|
4320
4333
|
headers,
|
|
4321
4334
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
4322
4335
|
);
|
|
4323
4336
|
}
|
|
4324
4337
|
async getBetasFromHeaders(requestHeaders) {
|
|
4325
4338
|
var _a, _b;
|
|
4326
|
-
const configHeaders = await (0,
|
|
4339
|
+
const configHeaders = await (0, import_provider_utils17.resolve)(this.config.headers);
|
|
4327
4340
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
4328
4341
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
4329
4342
|
return new Set(
|
|
@@ -4389,12 +4402,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4389
4402
|
responseHeaders,
|
|
4390
4403
|
value: response,
|
|
4391
4404
|
rawValue: rawResponse
|
|
4392
|
-
} = await (0,
|
|
4405
|
+
} = await (0, import_provider_utils17.postJsonToApi)({
|
|
4393
4406
|
url: this.buildRequestUrl(false),
|
|
4394
4407
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
4395
4408
|
body: this.transformRequestBody(args, betas),
|
|
4396
4409
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
4397
|
-
successfulResponseHandler: (0,
|
|
4410
|
+
successfulResponseHandler: (0, import_provider_utils17.createJsonResponseHandler)(
|
|
4398
4411
|
anthropicMessagesResponseSchema
|
|
4399
4412
|
),
|
|
4400
4413
|
abortSignal: options.abortSignal,
|
|
@@ -4909,12 +4922,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4909
4922
|
body.tools
|
|
4910
4923
|
);
|
|
4911
4924
|
const url = this.buildRequestUrl(true);
|
|
4912
|
-
const { responseHeaders, value: response } = await (0,
|
|
4925
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils17.postJsonToApi)({
|
|
4913
4926
|
url,
|
|
4914
4927
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
4915
4928
|
body: this.transformRequestBody(body, betas),
|
|
4916
4929
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
4917
|
-
successfulResponseHandler: (0,
|
|
4930
|
+
successfulResponseHandler: (0, import_provider_utils17.createEventSourceResponseHandler)(
|
|
4918
4931
|
anthropicMessagesChunkSchema
|
|
4919
4932
|
),
|
|
4920
4933
|
abortSignal: options.abortSignal,
|
|
@@ -5460,7 +5473,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5460
5473
|
if (contentBlock.toolset != null) {
|
|
5461
5474
|
let memberInput = {};
|
|
5462
5475
|
try {
|
|
5463
|
-
memberInput = contentBlock.input === "" ? {} : (0,
|
|
5476
|
+
memberInput = contentBlock.input === "" ? {} : (0, import_provider_utils17.secureJsonParse)(contentBlock.input);
|
|
5464
5477
|
} catch (e) {
|
|
5465
5478
|
memberInput = void 0;
|
|
5466
5479
|
}
|
|
@@ -5483,7 +5496,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5483
5496
|
let finalInput = contentBlock.input === "" ? "{}" : contentBlock.input;
|
|
5484
5497
|
if (contentBlock.providerToolName === "code_execution") {
|
|
5485
5498
|
try {
|
|
5486
|
-
const parsed = (0,
|
|
5499
|
+
const parsed = (0, import_provider_utils17.secureJsonParse)(finalInput);
|
|
5487
5500
|
if (parsed != null && typeof parsed === "object" && "code" in parsed && !("type" in parsed)) {
|
|
5488
5501
|
finalInput = JSON.stringify({
|
|
5489
5502
|
type: "programmatic-tool-call",
|
|
@@ -6107,42 +6120,42 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
6107
6120
|
}
|
|
6108
6121
|
|
|
6109
6122
|
// src/tool/bash_20241022.ts
|
|
6110
|
-
var
|
|
6123
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
6111
6124
|
var import_v415 = require("zod/v4");
|
|
6112
|
-
var bash_20241022InputSchema = (0,
|
|
6113
|
-
() => (0,
|
|
6125
|
+
var bash_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
6126
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
6114
6127
|
import_v415.z.object({
|
|
6115
6128
|
command: import_v415.z.string(),
|
|
6116
6129
|
restart: import_v415.z.boolean().optional()
|
|
6117
6130
|
})
|
|
6118
6131
|
)
|
|
6119
6132
|
);
|
|
6120
|
-
var bash_20241022 = (0,
|
|
6133
|
+
var bash_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
6121
6134
|
id: "anthropic.bash_20241022",
|
|
6122
6135
|
inputSchema: bash_20241022InputSchema
|
|
6123
6136
|
});
|
|
6124
6137
|
|
|
6125
6138
|
// src/tool/bash_20250124.ts
|
|
6126
|
-
var
|
|
6139
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
6127
6140
|
var import_v416 = require("zod/v4");
|
|
6128
|
-
var bash_20250124InputSchema = (0,
|
|
6129
|
-
() => (0,
|
|
6141
|
+
var bash_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
6142
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
6130
6143
|
import_v416.z.object({
|
|
6131
6144
|
command: import_v416.z.string(),
|
|
6132
6145
|
restart: import_v416.z.boolean().optional()
|
|
6133
6146
|
})
|
|
6134
6147
|
)
|
|
6135
6148
|
);
|
|
6136
|
-
var bash_20250124 = (0,
|
|
6149
|
+
var bash_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
6137
6150
|
id: "anthropic.bash_20250124",
|
|
6138
6151
|
inputSchema: bash_20250124InputSchema
|
|
6139
6152
|
});
|
|
6140
6153
|
|
|
6141
6154
|
// src/tool/computer_20241022.ts
|
|
6142
|
-
var
|
|
6155
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
6143
6156
|
var import_v417 = require("zod/v4");
|
|
6144
|
-
var computer_20241022InputSchema = (0,
|
|
6145
|
-
() => (0,
|
|
6157
|
+
var computer_20241022InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
6158
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
6146
6159
|
import_v417.z.object({
|
|
6147
6160
|
action: import_v417.z.enum([
|
|
6148
6161
|
"key",
|
|
@@ -6161,16 +6174,16 @@ var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
6161
6174
|
})
|
|
6162
6175
|
)
|
|
6163
6176
|
);
|
|
6164
|
-
var computer_20241022 = (0,
|
|
6177
|
+
var computer_20241022 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
6165
6178
|
id: "anthropic.computer_20241022",
|
|
6166
6179
|
inputSchema: computer_20241022InputSchema
|
|
6167
6180
|
});
|
|
6168
6181
|
|
|
6169
6182
|
// src/tool/computer_20250124.ts
|
|
6170
|
-
var
|
|
6183
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
6171
6184
|
var import_v418 = require("zod/v4");
|
|
6172
|
-
var computer_20250124InputSchema = (0,
|
|
6173
|
-
() => (0,
|
|
6185
|
+
var computer_20250124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
6186
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
6174
6187
|
import_v418.z.object({
|
|
6175
6188
|
action: import_v418.z.enum([
|
|
6176
6189
|
"key",
|
|
@@ -6199,16 +6212,16 @@ var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
6199
6212
|
})
|
|
6200
6213
|
)
|
|
6201
6214
|
);
|
|
6202
|
-
var computer_20250124 = (0,
|
|
6215
|
+
var computer_20250124 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
6203
6216
|
id: "anthropic.computer_20250124",
|
|
6204
6217
|
inputSchema: computer_20250124InputSchema
|
|
6205
6218
|
});
|
|
6206
6219
|
|
|
6207
6220
|
// src/tool/computer_20251124.ts
|
|
6208
|
-
var
|
|
6221
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
6209
6222
|
var import_v419 = require("zod/v4");
|
|
6210
|
-
var computer_20251124InputSchema = (0,
|
|
6211
|
-
() => (0,
|
|
6223
|
+
var computer_20251124InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
6224
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
6212
6225
|
import_v419.z.object({
|
|
6213
6226
|
action: import_v419.z.enum([
|
|
6214
6227
|
"key",
|
|
@@ -6244,16 +6257,16 @@ var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
6244
6257
|
})
|
|
6245
6258
|
)
|
|
6246
6259
|
);
|
|
6247
|
-
var computer_20251124 = (0,
|
|
6260
|
+
var computer_20251124 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
6248
6261
|
id: "anthropic.computer_20251124",
|
|
6249
6262
|
inputSchema: computer_20251124InputSchema
|
|
6250
6263
|
});
|
|
6251
6264
|
|
|
6252
6265
|
// src/tool/memory_20250818.ts
|
|
6253
|
-
var
|
|
6266
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
6254
6267
|
var import_v420 = require("zod/v4");
|
|
6255
|
-
var memory_20250818InputSchema = (0,
|
|
6256
|
-
() => (0,
|
|
6268
|
+
var memory_20250818InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
6269
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
6257
6270
|
import_v420.z.discriminatedUnion("command", [
|
|
6258
6271
|
import_v420.z.object({
|
|
6259
6272
|
command: import_v420.z.literal("view"),
|
|
@@ -6289,16 +6302,16 @@ var memory_20250818InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
|
6289
6302
|
])
|
|
6290
6303
|
)
|
|
6291
6304
|
);
|
|
6292
|
-
var memory_20250818 = (0,
|
|
6305
|
+
var memory_20250818 = (0, import_provider_utils23.createProviderToolFactory)({
|
|
6293
6306
|
id: "anthropic.memory_20250818",
|
|
6294
6307
|
inputSchema: memory_20250818InputSchema
|
|
6295
6308
|
});
|
|
6296
6309
|
|
|
6297
6310
|
// src/tool/text-editor_20241022.ts
|
|
6298
|
-
var
|
|
6311
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
6299
6312
|
var import_v421 = require("zod/v4");
|
|
6300
|
-
var textEditor_20241022InputSchema = (0,
|
|
6301
|
-
() => (0,
|
|
6313
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
6314
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
6302
6315
|
import_v421.z.object({
|
|
6303
6316
|
command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6304
6317
|
path: import_v421.z.string(),
|
|
@@ -6311,16 +6324,16 @@ var textEditor_20241022InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
6311
6324
|
})
|
|
6312
6325
|
)
|
|
6313
6326
|
);
|
|
6314
|
-
var textEditor_20241022 = (0,
|
|
6327
|
+
var textEditor_20241022 = (0, import_provider_utils24.createProviderToolFactory)({
|
|
6315
6328
|
id: "anthropic.text_editor_20241022",
|
|
6316
6329
|
inputSchema: textEditor_20241022InputSchema
|
|
6317
6330
|
});
|
|
6318
6331
|
|
|
6319
6332
|
// src/tool/text-editor_20250124.ts
|
|
6320
|
-
var
|
|
6333
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
6321
6334
|
var import_v422 = require("zod/v4");
|
|
6322
|
-
var textEditor_20250124InputSchema = (0,
|
|
6323
|
-
() => (0,
|
|
6335
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
6336
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
6324
6337
|
import_v422.z.object({
|
|
6325
6338
|
command: import_v422.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6326
6339
|
path: import_v422.z.string(),
|
|
@@ -6333,16 +6346,16 @@ var textEditor_20250124InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
6333
6346
|
})
|
|
6334
6347
|
)
|
|
6335
6348
|
);
|
|
6336
|
-
var textEditor_20250124 = (0,
|
|
6349
|
+
var textEditor_20250124 = (0, import_provider_utils25.createProviderToolFactory)({
|
|
6337
6350
|
id: "anthropic.text_editor_20250124",
|
|
6338
6351
|
inputSchema: textEditor_20250124InputSchema
|
|
6339
6352
|
});
|
|
6340
6353
|
|
|
6341
6354
|
// src/tool/text-editor_20250429.ts
|
|
6342
|
-
var
|
|
6355
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
6343
6356
|
var import_v423 = require("zod/v4");
|
|
6344
|
-
var textEditor_20250429InputSchema = (0,
|
|
6345
|
-
() => (0,
|
|
6357
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils26.lazySchema)(
|
|
6358
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
6346
6359
|
import_v423.z.object({
|
|
6347
6360
|
command: import_v423.z.enum(["view", "create", "str_replace", "insert"]),
|
|
6348
6361
|
path: import_v423.z.string(),
|
|
@@ -6355,16 +6368,16 @@ var textEditor_20250429InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
6355
6368
|
})
|
|
6356
6369
|
)
|
|
6357
6370
|
);
|
|
6358
|
-
var textEditor_20250429 = (0,
|
|
6371
|
+
var textEditor_20250429 = (0, import_provider_utils26.createProviderToolFactory)({
|
|
6359
6372
|
id: "anthropic.text_editor_20250429",
|
|
6360
6373
|
inputSchema: textEditor_20250429InputSchema
|
|
6361
6374
|
});
|
|
6362
6375
|
|
|
6363
6376
|
// src/tool/tool-search-bm25_20251119.ts
|
|
6364
|
-
var
|
|
6377
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
6365
6378
|
var import_v424 = require("zod/v4");
|
|
6366
|
-
var toolSearchBm25_20251119OutputSchema = (0,
|
|
6367
|
-
() => (0,
|
|
6379
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
6380
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
6368
6381
|
import_v424.z.array(
|
|
6369
6382
|
import_v424.z.object({
|
|
6370
6383
|
type: import_v424.z.literal("tool_reference"),
|
|
@@ -6373,8 +6386,8 @@ var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils26.lazySchema
|
|
|
6373
6386
|
)
|
|
6374
6387
|
)
|
|
6375
6388
|
);
|
|
6376
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
6377
|
-
() => (0,
|
|
6389
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils27.lazySchema)(
|
|
6390
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
6378
6391
|
import_v424.z.object({
|
|
6379
6392
|
/**
|
|
6380
6393
|
* A natural language query to search for tools.
|
|
@@ -6388,7 +6401,7 @@ var toolSearchBm25_20251119InputSchema = (0, import_provider_utils26.lazySchema)
|
|
|
6388
6401
|
})
|
|
6389
6402
|
)
|
|
6390
6403
|
);
|
|
6391
|
-
var factory11 = (0,
|
|
6404
|
+
var factory11 = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
6392
6405
|
id: "anthropic.tool_search_bm25_20251119",
|
|
6393
6406
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
6394
6407
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
@@ -6656,13 +6669,13 @@ var anthropicTools = {
|
|
|
6656
6669
|
var ANTHROPIC_API_URL = "https://api.anthropic.com";
|
|
6657
6670
|
var ANTHROPIC_API_VERSIONED_URL = `${ANTHROPIC_API_URL}/v1`;
|
|
6658
6671
|
function normalizeBaseURL(baseURL) {
|
|
6659
|
-
const baseURLWithoutTrailingSlash = (0,
|
|
6672
|
+
const baseURLWithoutTrailingSlash = (0, import_provider_utils28.withoutTrailingSlash)(baseURL);
|
|
6660
6673
|
return baseURLWithoutTrailingSlash === ANTHROPIC_API_URL ? ANTHROPIC_API_VERSIONED_URL : baseURLWithoutTrailingSlash;
|
|
6661
6674
|
}
|
|
6662
6675
|
function createAnthropic(options = {}) {
|
|
6663
6676
|
var _a, _b;
|
|
6664
6677
|
const baseURL = (_a = normalizeBaseURL(
|
|
6665
|
-
(0,
|
|
6678
|
+
(0, import_provider_utils28.loadOptionalSetting)({
|
|
6666
6679
|
settingValue: options.baseURL,
|
|
6667
6680
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
6668
6681
|
})
|
|
@@ -6676,13 +6689,13 @@ function createAnthropic(options = {}) {
|
|
|
6676
6689
|
}
|
|
6677
6690
|
const getHeaders = () => {
|
|
6678
6691
|
const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
|
|
6679
|
-
"x-api-key": (0,
|
|
6692
|
+
"x-api-key": (0, import_provider_utils28.loadApiKey)({
|
|
6680
6693
|
apiKey: options.apiKey,
|
|
6681
6694
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
6682
6695
|
description: "Anthropic"
|
|
6683
6696
|
})
|
|
6684
6697
|
};
|
|
6685
|
-
return (0,
|
|
6698
|
+
return (0, import_provider_utils28.withUserAgentSuffix)(
|
|
6686
6699
|
{
|
|
6687
6700
|
"anthropic-version": "2023-06-01",
|
|
6688
6701
|
...authHeaders,
|
|
@@ -6698,7 +6711,7 @@ function createAnthropic(options = {}) {
|
|
|
6698
6711
|
baseURL,
|
|
6699
6712
|
headers: getHeaders,
|
|
6700
6713
|
fetch: options.fetch,
|
|
6701
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
6714
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils28.generateId,
|
|
6702
6715
|
supportedUrls: () => ({
|
|
6703
6716
|
"image/*": [/^https?:\/\/.*$/],
|
|
6704
6717
|
"application/pdf": [/^https?:\/\/.*$/]
|