@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/internal/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
30
30
|
|
|
31
31
|
// src/anthropic-messages-language-model.ts
|
|
32
32
|
var import_provider3 = require("@ai-sdk/provider");
|
|
33
|
-
var
|
|
33
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
34
34
|
|
|
35
35
|
// src/anthropic-error.ts
|
|
36
36
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -54,13 +54,13 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
|
|
|
54
54
|
// src/anthropic-messages-api.ts
|
|
55
55
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
56
56
|
var import_v42 = require("zod/v4");
|
|
57
|
-
var anthropicStopDetailsSchema = import_v42.z.object({
|
|
57
|
+
var anthropicStopDetailsSchema = () => import_v42.z.object({
|
|
58
58
|
type: import_v42.z.string(),
|
|
59
59
|
category: import_v42.z.string().nullish(),
|
|
60
60
|
explanation: import_v42.z.string().nullish(),
|
|
61
61
|
recommended_model: import_v42.z.string().nullish()
|
|
62
62
|
});
|
|
63
|
-
var anthropicSafeguardResultSchema = import_v42.z.object({
|
|
63
|
+
var anthropicSafeguardResultSchema = () => import_v42.z.object({
|
|
64
64
|
type: import_v42.z.string(),
|
|
65
65
|
status: import_v42.z.object({
|
|
66
66
|
type: import_v42.z.string(),
|
|
@@ -74,7 +74,7 @@ var anthropicSafeguardResultSchema = import_v42.z.object({
|
|
|
74
74
|
).nullish()
|
|
75
75
|
})
|
|
76
76
|
});
|
|
77
|
-
var anthropicToolCallCallerSchema = import_v42.z.union([
|
|
77
|
+
var anthropicToolCallCallerSchema = () => import_v42.z.union([
|
|
78
78
|
import_v42.z.object({
|
|
79
79
|
type: import_v42.z.literal("code_execution_20250825"),
|
|
80
80
|
tool_id: import_v42.z.string()
|
|
@@ -87,7 +87,7 @@ var anthropicToolCallCallerSchema = import_v42.z.union([
|
|
|
87
87
|
type: import_v42.z.literal("direct")
|
|
88
88
|
})
|
|
89
89
|
]);
|
|
90
|
-
var anthropicInputTransformationSchema = import_v42.z.object({
|
|
90
|
+
var anthropicInputTransformationSchema = () => import_v42.z.object({
|
|
91
91
|
type: import_v42.z.string(),
|
|
92
92
|
path: import_v42.z.string(),
|
|
93
93
|
reason: import_v42.z.string()
|
|
@@ -150,7 +150,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
150
150
|
name: import_v42.z.string(),
|
|
151
151
|
input: import_v42.z.unknown(),
|
|
152
152
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
153
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
153
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
154
154
|
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
155
155
|
toolset_name: import_v42.z.string().nullish()
|
|
156
156
|
}),
|
|
@@ -159,7 +159,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
159
159
|
id: import_v42.z.string(),
|
|
160
160
|
name: import_v42.z.string(),
|
|
161
161
|
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
162
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
162
|
+
caller: anthropicToolCallCallerSchema().optional()
|
|
163
163
|
}),
|
|
164
164
|
import_v42.z.object({
|
|
165
165
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -182,7 +182,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
182
182
|
import_v42.z.object({
|
|
183
183
|
type: import_v42.z.literal("web_fetch_tool_result"),
|
|
184
184
|
tool_use_id: import_v42.z.string(),
|
|
185
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
185
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
186
186
|
content: import_v42.z.union([
|
|
187
187
|
import_v42.z.object({
|
|
188
188
|
type: import_v42.z.literal("web_fetch_result"),
|
|
@@ -215,7 +215,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
215
215
|
import_v42.z.object({
|
|
216
216
|
type: import_v42.z.literal("web_search_tool_result"),
|
|
217
217
|
tool_use_id: import_v42.z.string(),
|
|
218
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
218
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
219
219
|
content: import_v42.z.union([
|
|
220
220
|
import_v42.z.array(
|
|
221
221
|
import_v42.z.object({
|
|
@@ -372,9 +372,9 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
372
372
|
),
|
|
373
373
|
stop_reason: import_v42.z.string().nullish(),
|
|
374
374
|
stop_sequence: import_v42.z.string().nullish(),
|
|
375
|
-
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
376
|
-
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
377
|
-
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema).nullish(),
|
|
375
|
+
stop_details: anthropicStopDetailsSchema().nullish(),
|
|
376
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema()).nullish(),
|
|
377
|
+
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema()).nullish(),
|
|
378
378
|
usage: import_v42.z.looseObject({
|
|
379
379
|
input_tokens: import_v42.z.number(),
|
|
380
380
|
output_tokens: import_v42.z.number(),
|
|
@@ -454,13 +454,13 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
454
454
|
id: import_v42.z.string(),
|
|
455
455
|
name: import_v42.z.string(),
|
|
456
456
|
input: import_v42.z.unknown(),
|
|
457
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
457
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
458
458
|
toolset_name: import_v42.z.string().nullish()
|
|
459
459
|
})
|
|
460
460
|
])
|
|
461
461
|
).nullish(),
|
|
462
462
|
stop_reason: import_v42.z.string().nullish(),
|
|
463
|
-
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
463
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema()).nullish(),
|
|
464
464
|
container: import_v42.z.object({
|
|
465
465
|
expires_at: import_v42.z.string(),
|
|
466
466
|
id: import_v42.z.string()
|
|
@@ -486,7 +486,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
486
486
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
487
487
|
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).optional(),
|
|
488
488
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
489
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
489
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
490
490
|
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
491
491
|
toolset_name: import_v42.z.string().nullish()
|
|
492
492
|
}),
|
|
@@ -503,7 +503,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
503
503
|
id: import_v42.z.string(),
|
|
504
504
|
name: import_v42.z.string(),
|
|
505
505
|
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
506
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
506
|
+
caller: anthropicToolCallCallerSchema().optional()
|
|
507
507
|
}),
|
|
508
508
|
import_v42.z.object({
|
|
509
509
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -526,7 +526,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
526
526
|
import_v42.z.object({
|
|
527
527
|
type: import_v42.z.literal("web_fetch_tool_result"),
|
|
528
528
|
tool_use_id: import_v42.z.string(),
|
|
529
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
529
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
530
530
|
content: import_v42.z.union([
|
|
531
531
|
import_v42.z.object({
|
|
532
532
|
type: import_v42.z.literal("web_fetch_result"),
|
|
@@ -559,7 +559,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
559
559
|
import_v42.z.object({
|
|
560
560
|
type: import_v42.z.literal("web_search_tool_result"),
|
|
561
561
|
tool_use_id: import_v42.z.string(),
|
|
562
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
562
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
563
563
|
content: import_v42.z.union([
|
|
564
564
|
import_v42.z.array(
|
|
565
565
|
import_v42.z.object({
|
|
@@ -783,8 +783,8 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
783
783
|
delta: import_v42.z.object({
|
|
784
784
|
stop_reason: import_v42.z.string().nullish(),
|
|
785
785
|
stop_sequence: import_v42.z.string().nullish(),
|
|
786
|
-
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
787
|
-
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema).nullish(),
|
|
786
|
+
stop_details: anthropicStopDetailsSchema().nullish(),
|
|
787
|
+
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema()).nullish(),
|
|
788
788
|
container: import_v42.z.object({
|
|
789
789
|
expires_at: import_v42.z.string(),
|
|
790
790
|
id: import_v42.z.string(),
|
|
@@ -824,7 +824,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
824
824
|
})
|
|
825
825
|
).nullish()
|
|
826
826
|
}),
|
|
827
|
-
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
827
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema()).nullish(),
|
|
828
828
|
context_management: import_v42.z.object({
|
|
829
829
|
applied_edits: import_v42.z.array(
|
|
830
830
|
import_v42.z.union([
|
|
@@ -864,349 +864,362 @@ var anthropicReasoningMetadataSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
864
864
|
);
|
|
865
865
|
|
|
866
866
|
// src/anthropic-messages-options.ts
|
|
867
|
+
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
867
868
|
var import_v43 = require("zod/v4");
|
|
868
|
-
var anthropicFilePartProviderOptions =
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
*/
|
|
877
|
-
enabled: import_v43.z.boolean()
|
|
878
|
-
}).optional(),
|
|
879
|
-
/**
|
|
880
|
-
* Custom title for the document.
|
|
881
|
-
* If not provided, the filename will be used.
|
|
882
|
-
*/
|
|
883
|
-
title: import_v43.z.string().optional(),
|
|
884
|
-
/**
|
|
885
|
-
* Context about the document that will be passed to the model
|
|
886
|
-
* but not used towards cited content.
|
|
887
|
-
* Useful for storing document metadata as text or stringified JSON.
|
|
888
|
-
*/
|
|
889
|
-
context: import_v43.z.string().optional()
|
|
890
|
-
});
|
|
891
|
-
var anthropicSystemMessageProviderOptions = import_v43.z.object({
|
|
892
|
-
/**
|
|
893
|
-
* Clears this mid-conversation system message after the current turn.
|
|
894
|
-
*
|
|
895
|
-
* Requires the `mid-conversation-system-clear-at-2026-08-21` beta,
|
|
896
|
-
* which is added automatically.
|
|
897
|
-
*/
|
|
898
|
-
clearAt: import_v43.z.literal("next_user_message").optional(),
|
|
899
|
-
/**
|
|
900
|
-
* Sets the model effort from the next user turn until a later message
|
|
901
|
-
* changes it. An effort-only system message with empty content can appear
|
|
902
|
-
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
903
|
-
* added automatically.
|
|
904
|
-
*/
|
|
905
|
-
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
906
|
-
/**
|
|
907
|
-
* Mid-conversation tool changes. Adds or removes tools from the
|
|
908
|
-
* conversation's tool set between turns without invalidating the prompt
|
|
909
|
-
* cache.
|
|
910
|
-
*
|
|
911
|
-
* Only supported on system messages that appear mid-conversation (not the
|
|
912
|
-
* initial system prompt). A system message carrying tool changes must come
|
|
913
|
-
* right before an assistant message or at the end of the messages.
|
|
914
|
-
*
|
|
915
|
-
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
916
|
-
* option (typically with `deferLoading: true` so they are not loaded until
|
|
917
|
-
* the addition surfaces them). The required
|
|
918
|
-
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
919
|
-
*/
|
|
920
|
-
toolChanges: import_v43.z.array(
|
|
921
|
-
import_v43.z.discriminatedUnion("type", [
|
|
922
|
-
import_v43.z.object({
|
|
923
|
-
type: import_v43.z.literal("tool_addition"),
|
|
924
|
-
toolName: import_v43.z.string()
|
|
925
|
-
}),
|
|
926
|
-
import_v43.z.object({
|
|
927
|
-
type: import_v43.z.literal("tool_removal"),
|
|
928
|
-
toolName: import_v43.z.string()
|
|
929
|
-
})
|
|
930
|
-
])
|
|
931
|
-
).optional()
|
|
932
|
-
});
|
|
933
|
-
var anthropicThinkingBlockBinding = import_v43.z.object({
|
|
934
|
-
prefixMismatchBehavior: import_v43.z.enum(["error", "drop_block"])
|
|
935
|
-
});
|
|
936
|
-
var anthropicLanguageModelOptions = import_v43.z.object({
|
|
937
|
-
/**
|
|
938
|
-
* Whether to send reasoning to the model.
|
|
939
|
-
*
|
|
940
|
-
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
941
|
-
*/
|
|
942
|
-
sendReasoning: import_v43.z.boolean().optional(),
|
|
943
|
-
/**
|
|
944
|
-
* Determines how structured outputs are generated.
|
|
945
|
-
*
|
|
946
|
-
* - `outputFormat`: Use the `output_config.format` parameter to specify the structured output format.
|
|
947
|
-
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
948
|
-
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
949
|
-
*/
|
|
950
|
-
structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
951
|
-
/**
|
|
952
|
-
* Configuration for enabling Claude's extended thinking.
|
|
953
|
-
*
|
|
954
|
-
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
955
|
-
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
956
|
-
*
|
|
957
|
-
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
958
|
-
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
959
|
-
* provider drops the unsupported setting, emits a warning, and sends an
|
|
960
|
-
* adaptive thinking request. Use `effort` to control how much they think.
|
|
961
|
-
*
|
|
962
|
-
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
963
|
-
* and the provider uses it in place of `disabled` for that model.
|
|
964
|
-
*/
|
|
965
|
-
thinking: import_v43.z.union([
|
|
966
|
-
import_v43.z.discriminatedUnion("type", [
|
|
967
|
-
import_v43.z.object({
|
|
968
|
-
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
969
|
-
type: import_v43.z.literal("adaptive"),
|
|
970
|
-
/**
|
|
971
|
-
* Controls whether thinking content is included in the response.
|
|
972
|
-
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
973
|
-
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
974
|
-
* - `"updates"`: Thinking updates are returned between tool calls.
|
|
975
|
-
*/
|
|
976
|
-
display: import_v43.z.enum(["omitted", "summarized", "updates"]).optional(),
|
|
977
|
-
/**
|
|
978
|
-
* Controls how thinking blocks are bound to an assistant prefix.
|
|
979
|
-
*
|
|
980
|
-
* Requires the `thinking-binding-controls-2026-08-01` beta,
|
|
981
|
-
* which is added automatically.
|
|
982
|
-
*/
|
|
983
|
-
blockBinding: anthropicThinkingBlockBinding.optional()
|
|
984
|
-
}),
|
|
985
|
-
import_v43.z.object({
|
|
986
|
-
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
987
|
-
type: import_v43.z.literal("enabled"),
|
|
988
|
-
budgetTokens: import_v43.z.number().optional()
|
|
989
|
-
}),
|
|
990
|
-
import_v43.z.object({
|
|
991
|
-
type: import_v43.z.literal("disabled")
|
|
992
|
-
}),
|
|
993
|
-
import_v43.z.object({
|
|
869
|
+
var anthropicFilePartProviderOptions = (0, import_provider_utils3.lazySchema)(
|
|
870
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
871
|
+
import_v43.z.object({
|
|
872
|
+
/**
|
|
873
|
+
* Citation configuration for this document.
|
|
874
|
+
* When enabled, this document will generate citations in the response.
|
|
875
|
+
*/
|
|
876
|
+
citations: import_v43.z.object({
|
|
994
877
|
/**
|
|
995
|
-
*
|
|
996
|
-
* between tool calls are returned as summarized thinking blocks.
|
|
997
|
-
* Only supported at `low`, `medium`, and `high` effort.
|
|
878
|
+
* Enable citations for this document
|
|
998
879
|
*/
|
|
999
|
-
|
|
1000
|
-
})
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
880
|
+
enabled: import_v43.z.boolean()
|
|
881
|
+
}).optional(),
|
|
882
|
+
/**
|
|
883
|
+
* Custom title for the document.
|
|
884
|
+
* If not provided, the filename will be used.
|
|
885
|
+
*/
|
|
886
|
+
title: import_v43.z.string().optional(),
|
|
887
|
+
/**
|
|
888
|
+
* Context about the document that will be passed to the model
|
|
889
|
+
* but not used towards cited content.
|
|
890
|
+
* Useful for storing document metadata as text or stringified JSON.
|
|
891
|
+
*/
|
|
892
|
+
context: import_v43.z.string().optional()
|
|
1008
893
|
})
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
*/
|
|
1014
|
-
disableParallelToolUse: import_v43.z.boolean().optional(),
|
|
1015
|
-
/**
|
|
1016
|
-
* Cache control settings for this message.
|
|
1017
|
-
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
1018
|
-
*/
|
|
1019
|
-
cacheControl: import_v43.z.object({
|
|
1020
|
-
type: import_v43.z.literal("ephemeral"),
|
|
1021
|
-
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
|
|
1022
|
-
}).optional(),
|
|
1023
|
-
/**
|
|
1024
|
-
* Metadata to include with the request.
|
|
1025
|
-
*
|
|
1026
|
-
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
1027
|
-
*/
|
|
1028
|
-
metadata: import_v43.z.object({
|
|
1029
|
-
/**
|
|
1030
|
-
* An external identifier for the user associated with the request.
|
|
1031
|
-
*
|
|
1032
|
-
* Should be a UUID, hash value, or other opaque identifier.
|
|
1033
|
-
* Must not contain PII (name, email, phone number, etc.).
|
|
1034
|
-
*/
|
|
1035
|
-
userId: import_v43.z.string().optional()
|
|
1036
|
-
}).optional(),
|
|
1037
|
-
/**
|
|
1038
|
-
* MCP servers to be utilized in this request.
|
|
1039
|
-
*/
|
|
1040
|
-
mcpServers: import_v43.z.array(
|
|
894
|
+
)
|
|
895
|
+
);
|
|
896
|
+
var anthropicSystemMessageProviderOptions = (0, import_provider_utils3.lazySchema)(
|
|
897
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
1041
898
|
import_v43.z.object({
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
899
|
+
/**
|
|
900
|
+
* Clears this mid-conversation system message after the current turn.
|
|
901
|
+
*
|
|
902
|
+
* Requires the `mid-conversation-system-clear-at-2026-08-21` beta,
|
|
903
|
+
* which is added automatically.
|
|
904
|
+
*/
|
|
905
|
+
clearAt: import_v43.z.literal("next_user_message").optional(),
|
|
906
|
+
/**
|
|
907
|
+
* Sets the model effort from the next user turn until a later message
|
|
908
|
+
* changes it. An effort-only system message with empty content can appear
|
|
909
|
+
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
910
|
+
* added automatically.
|
|
911
|
+
*/
|
|
912
|
+
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
913
|
+
/**
|
|
914
|
+
* Mid-conversation tool changes. Adds or removes tools from the
|
|
915
|
+
* conversation's tool set between turns without invalidating the prompt
|
|
916
|
+
* cache.
|
|
917
|
+
*
|
|
918
|
+
* Only supported on system messages that appear mid-conversation (not the
|
|
919
|
+
* initial system prompt). A system message carrying tool changes must come
|
|
920
|
+
* right before an assistant message or at the end of the messages.
|
|
921
|
+
*
|
|
922
|
+
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
923
|
+
* option (typically with `deferLoading: true` so they are not loaded until
|
|
924
|
+
* the addition surfaces them). The required
|
|
925
|
+
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
926
|
+
*/
|
|
927
|
+
toolChanges: import_v43.z.array(
|
|
928
|
+
import_v43.z.discriminatedUnion("type", [
|
|
929
|
+
import_v43.z.object({
|
|
930
|
+
type: import_v43.z.literal("tool_addition"),
|
|
931
|
+
toolName: import_v43.z.string()
|
|
932
|
+
}),
|
|
933
|
+
import_v43.z.object({
|
|
934
|
+
type: import_v43.z.literal("tool_removal"),
|
|
935
|
+
toolName: import_v43.z.string()
|
|
936
|
+
})
|
|
937
|
+
])
|
|
938
|
+
).optional()
|
|
1050
939
|
})
|
|
1051
|
-
)
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
id: import_v43.z.string().optional(),
|
|
1059
|
-
skills: import_v43.z.array(
|
|
1060
|
-
import_v43.z.object({
|
|
1061
|
-
type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
|
|
1062
|
-
skillId: import_v43.z.string(),
|
|
1063
|
-
version: import_v43.z.string().optional()
|
|
1064
|
-
})
|
|
1065
|
-
).optional()
|
|
1066
|
-
}).optional(),
|
|
1067
|
-
/**
|
|
1068
|
-
* Whether to enable fine-grained (eager) streaming of tool call inputs
|
|
1069
|
-
* and structured outputs for every function tool in the request. When
|
|
1070
|
-
* true (the default), each function tool receives a default of
|
|
1071
|
-
* `eager_input_streaming: true` unless it explicitly sets
|
|
1072
|
-
* `providerOptions.anthropic.eagerInputStreaming`.
|
|
1073
|
-
*
|
|
1074
|
-
* @default true
|
|
1075
|
-
*/
|
|
1076
|
-
toolStreaming: import_v43.z.boolean().optional(),
|
|
1077
|
-
/**
|
|
1078
|
-
* Controls how much effort the model spends on thinking, text responses,
|
|
1079
|
-
* and tool calls. On models that always use adaptive thinking
|
|
1080
|
-
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1081
|
-
*
|
|
1082
|
-
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1083
|
-
*/
|
|
1084
|
-
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1085
|
-
/**
|
|
1086
|
-
* Task budget for agentic turns. Informs the model of the total token budget
|
|
1087
|
-
* available for the current task, allowing it to prioritize work and wind down
|
|
1088
|
-
* gracefully as the budget is consumed.
|
|
1089
|
-
*
|
|
1090
|
-
* Advisory only — does not enforce a hard token limit.
|
|
1091
|
-
*/
|
|
1092
|
-
taskBudget: import_v43.z.object({
|
|
1093
|
-
type: import_v43.z.literal("tokens"),
|
|
1094
|
-
total: import_v43.z.number().int().min(2e4),
|
|
1095
|
-
remaining: import_v43.z.number().int().min(0).optional()
|
|
1096
|
-
}).optional(),
|
|
1097
|
-
/**
|
|
1098
|
-
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
1099
|
-
* Only supported with claude-opus-4-6.
|
|
1100
|
-
*/
|
|
1101
|
-
speed: import_v43.z.enum(["fast", "standard"]).optional(),
|
|
1102
|
-
/**
|
|
1103
|
-
* Controls where model inference runs for this request.
|
|
1104
|
-
*
|
|
1105
|
-
* - `"global"`: Inference may run in any available geography (default).
|
|
1106
|
-
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
1107
|
-
*
|
|
1108
|
-
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
1109
|
-
*/
|
|
1110
|
-
inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
|
|
1111
|
-
/**
|
|
1112
|
-
* Server-side fallback configuration.
|
|
1113
|
-
*
|
|
1114
|
-
* When the primary model's safety classifiers block a turn, the API
|
|
1115
|
-
* automatically retries it server-side on a fallback model. A
|
|
1116
|
-
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
1117
|
-
*
|
|
1118
|
-
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
1119
|
-
* recommended fallback model based on the refusal category. Requires the
|
|
1120
|
-
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
1121
|
-
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
1122
|
-
* request as a direct request to that entry's model, so it must be
|
|
1123
|
-
* formatted accordingly: `model` is required, and an entry may
|
|
1124
|
-
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
1125
|
-
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
1126
|
-
* beta). The value is passed through to the API as-is, and the
|
|
1127
|
-
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
1128
|
-
*/
|
|
1129
|
-
fallbacks: import_v43.z.union([
|
|
1130
|
-
import_v43.z.literal("default"),
|
|
1131
|
-
import_v43.z.array(
|
|
1132
|
-
import_v43.z.object({
|
|
1133
|
-
model: import_v43.z.string(),
|
|
1134
|
-
max_tokens: import_v43.z.number().int().optional(),
|
|
1135
|
-
thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1136
|
-
output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1137
|
-
speed: import_v43.z.enum(["fast", "standard"]).optional()
|
|
1138
|
-
})
|
|
1139
|
-
)
|
|
1140
|
-
]).optional(),
|
|
1141
|
-
/**
|
|
1142
|
-
* A set of beta features to enable.
|
|
1143
|
-
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1144
|
-
*/
|
|
1145
|
-
anthropicBeta: import_v43.z.array(import_v43.z.string()).optional(),
|
|
1146
|
-
/**
|
|
1147
|
-
* Server-side safeguards to run as part of the request.
|
|
1148
|
-
*
|
|
1149
|
-
* `dangerous_tool_use` asks the API to classify every `tool_use` block in
|
|
1150
|
-
* the response for dangerous actions (the check Claude Code's auto mode
|
|
1151
|
-
* relies on). The per-call verdicts are returned in
|
|
1152
|
-
* `providerMetadata.anthropic.safeguardResults`, keyed by tool call id.
|
|
1153
|
-
* `classifierContext` is passed through to the API as `classifier_context`.
|
|
1154
|
-
* The `dangerous-tool-use-2026-09-03` beta is added automatically.
|
|
1155
|
-
*/
|
|
1156
|
-
safeguards: import_v43.z.array(
|
|
940
|
+
)
|
|
941
|
+
);
|
|
942
|
+
var anthropicLanguageModelOptions = (0, import_provider_utils3.lazySchema)(() => {
|
|
943
|
+
const anthropicThinkingBlockBinding = import_v43.z.object({
|
|
944
|
+
prefixMismatchBehavior: import_v43.z.enum(["error", "drop_block"])
|
|
945
|
+
});
|
|
946
|
+
return (0, import_provider_utils3.zodSchema)(
|
|
1157
947
|
import_v43.z.object({
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
948
|
+
/**
|
|
949
|
+
* Whether to send reasoning to the model.
|
|
950
|
+
*
|
|
951
|
+
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
952
|
+
*/
|
|
953
|
+
sendReasoning: import_v43.z.boolean().optional(),
|
|
954
|
+
/**
|
|
955
|
+
* Determines how structured outputs are generated.
|
|
956
|
+
*
|
|
957
|
+
* - `outputFormat`: Use the `output_config.format` parameter to specify the structured output format.
|
|
958
|
+
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
959
|
+
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
960
|
+
*/
|
|
961
|
+
structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
962
|
+
/**
|
|
963
|
+
* Configuration for enabling Claude's extended thinking.
|
|
964
|
+
*
|
|
965
|
+
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
966
|
+
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
967
|
+
*
|
|
968
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
969
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
970
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
971
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
972
|
+
*
|
|
973
|
+
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
974
|
+
* and the provider uses it in place of `disabled` for that model.
|
|
975
|
+
*/
|
|
976
|
+
thinking: import_v43.z.union([
|
|
977
|
+
import_v43.z.discriminatedUnion("type", [
|
|
978
|
+
import_v43.z.object({
|
|
979
|
+
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
980
|
+
type: import_v43.z.literal("adaptive"),
|
|
981
|
+
/**
|
|
982
|
+
* Controls whether thinking content is included in the response.
|
|
983
|
+
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
984
|
+
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
985
|
+
* - `"updates"`: Thinking updates are returned between tool calls.
|
|
986
|
+
*/
|
|
987
|
+
display: import_v43.z.enum(["omitted", "summarized", "updates"]).optional(),
|
|
988
|
+
/**
|
|
989
|
+
* Controls how thinking blocks are bound to an assistant prefix.
|
|
990
|
+
*
|
|
991
|
+
* Requires the `thinking-binding-controls-2026-08-01` beta,
|
|
992
|
+
* which is added automatically.
|
|
993
|
+
*/
|
|
994
|
+
blockBinding: anthropicThinkingBlockBinding.optional()
|
|
995
|
+
}),
|
|
996
|
+
import_v43.z.object({
|
|
997
|
+
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
998
|
+
type: import_v43.z.literal("enabled"),
|
|
999
|
+
budgetTokens: import_v43.z.number().optional()
|
|
1000
|
+
}),
|
|
1001
|
+
import_v43.z.object({
|
|
1002
|
+
type: import_v43.z.literal("disabled")
|
|
1003
|
+
}),
|
|
1004
|
+
import_v43.z.object({
|
|
1005
|
+
/**
|
|
1006
|
+
* for `claude-sonnet-5-5`: no upfront thinking, but progress notes
|
|
1007
|
+
* between tool calls are returned as summarized thinking blocks.
|
|
1008
|
+
* Only supported at `low`, `medium`, and `high` effort.
|
|
1009
|
+
*/
|
|
1010
|
+
type: import_v43.z.literal("between_tools")
|
|
1011
|
+
})
|
|
1012
|
+
]),
|
|
1013
|
+
/**
|
|
1014
|
+
* Configures prefix mismatch recovery without changing the model's
|
|
1015
|
+
* default thinking mode.
|
|
1016
|
+
*/
|
|
1017
|
+
import_v43.z.object({
|
|
1018
|
+
blockBinding: anthropicThinkingBlockBinding
|
|
1019
|
+
})
|
|
1020
|
+
]).optional(),
|
|
1021
|
+
/**
|
|
1022
|
+
* Whether to disable parallel function calling during tool use. Default is false.
|
|
1023
|
+
* When set to true, Claude will use at most one tool per response.
|
|
1024
|
+
*/
|
|
1025
|
+
disableParallelToolUse: import_v43.z.boolean().optional(),
|
|
1026
|
+
/**
|
|
1027
|
+
* Cache control settings for this message.
|
|
1028
|
+
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
1029
|
+
*/
|
|
1030
|
+
cacheControl: import_v43.z.object({
|
|
1031
|
+
type: import_v43.z.literal("ephemeral"),
|
|
1032
|
+
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
|
|
1033
|
+
}).optional(),
|
|
1034
|
+
/**
|
|
1035
|
+
* Metadata to include with the request.
|
|
1036
|
+
*
|
|
1037
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
1038
|
+
*/
|
|
1039
|
+
metadata: import_v43.z.object({
|
|
1040
|
+
/**
|
|
1041
|
+
* An external identifier for the user associated with the request.
|
|
1042
|
+
*
|
|
1043
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
1044
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
1045
|
+
*/
|
|
1046
|
+
userId: import_v43.z.string().optional()
|
|
1047
|
+
}).optional(),
|
|
1048
|
+
/**
|
|
1049
|
+
* MCP servers to be utilized in this request.
|
|
1050
|
+
*/
|
|
1051
|
+
mcpServers: import_v43.z.array(
|
|
1052
|
+
import_v43.z.object({
|
|
1053
|
+
type: import_v43.z.literal("url"),
|
|
1054
|
+
name: import_v43.z.string(),
|
|
1055
|
+
url: import_v43.z.string(),
|
|
1056
|
+
authorizationToken: import_v43.z.string().nullish(),
|
|
1057
|
+
toolConfiguration: import_v43.z.object({
|
|
1058
|
+
enabled: import_v43.z.boolean().nullish(),
|
|
1059
|
+
allowedTools: import_v43.z.array(import_v43.z.string()).nullish()
|
|
1060
|
+
}).nullish()
|
|
1061
|
+
})
|
|
1062
|
+
).optional(),
|
|
1063
|
+
/**
|
|
1064
|
+
* Agent Skills configuration. Skills enable Claude to perform specialized tasks
|
|
1065
|
+
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
1066
|
+
* Requires code execution tool to be enabled.
|
|
1067
|
+
*/
|
|
1068
|
+
container: import_v43.z.object({
|
|
1069
|
+
id: import_v43.z.string().optional(),
|
|
1070
|
+
skills: import_v43.z.array(
|
|
1071
|
+
import_v43.z.object({
|
|
1072
|
+
type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
|
|
1073
|
+
skillId: import_v43.z.string(),
|
|
1074
|
+
version: import_v43.z.string().optional()
|
|
1075
|
+
})
|
|
1076
|
+
).optional()
|
|
1077
|
+
}).optional(),
|
|
1078
|
+
/**
|
|
1079
|
+
* Whether to enable fine-grained (eager) streaming of tool call inputs
|
|
1080
|
+
* and structured outputs for every function tool in the request. When
|
|
1081
|
+
* true (the default), each function tool receives a default of
|
|
1082
|
+
* `eager_input_streaming: true` unless it explicitly sets
|
|
1083
|
+
* `providerOptions.anthropic.eagerInputStreaming`.
|
|
1084
|
+
*
|
|
1085
|
+
* @default true
|
|
1086
|
+
*/
|
|
1087
|
+
toolStreaming: import_v43.z.boolean().optional(),
|
|
1088
|
+
/**
|
|
1089
|
+
* Controls how much effort the model spends on thinking, text responses,
|
|
1090
|
+
* and tool calls. On models that always use adaptive thinking
|
|
1091
|
+
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1092
|
+
*
|
|
1093
|
+
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1094
|
+
*/
|
|
1095
|
+
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1096
|
+
/**
|
|
1097
|
+
* Task budget for agentic turns. Informs the model of the total token budget
|
|
1098
|
+
* available for the current task, allowing it to prioritize work and wind down
|
|
1099
|
+
* gracefully as the budget is consumed.
|
|
1100
|
+
*
|
|
1101
|
+
* Advisory only — does not enforce a hard token limit.
|
|
1102
|
+
*/
|
|
1103
|
+
taskBudget: import_v43.z.object({
|
|
1104
|
+
type: import_v43.z.literal("tokens"),
|
|
1105
|
+
total: import_v43.z.number().int().min(2e4),
|
|
1106
|
+
remaining: import_v43.z.number().int().min(0).optional()
|
|
1107
|
+
}).optional(),
|
|
1108
|
+
/**
|
|
1109
|
+
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
1110
|
+
* Only supported with claude-opus-4-6.
|
|
1111
|
+
*/
|
|
1112
|
+
speed: import_v43.z.enum(["fast", "standard"]).optional(),
|
|
1113
|
+
/**
|
|
1114
|
+
* Controls where model inference runs for this request.
|
|
1115
|
+
*
|
|
1116
|
+
* - `"global"`: Inference may run in any available geography (default).
|
|
1117
|
+
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
1118
|
+
*
|
|
1119
|
+
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
1120
|
+
*/
|
|
1121
|
+
inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
|
|
1122
|
+
/**
|
|
1123
|
+
* Server-side fallback configuration.
|
|
1124
|
+
*
|
|
1125
|
+
* When the primary model's safety classifiers block a turn, the API
|
|
1126
|
+
* automatically retries it server-side on a fallback model. A
|
|
1127
|
+
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
1128
|
+
*
|
|
1129
|
+
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
1130
|
+
* recommended fallback model based on the refusal category. Requires the
|
|
1131
|
+
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
1132
|
+
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
1133
|
+
* request as a direct request to that entry's model, so it must be
|
|
1134
|
+
* formatted accordingly: `model` is required, and an entry may
|
|
1135
|
+
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
1136
|
+
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
1137
|
+
* beta). The value is passed through to the API as-is, and the
|
|
1138
|
+
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
1139
|
+
*/
|
|
1140
|
+
fallbacks: import_v43.z.union([
|
|
1141
|
+
import_v43.z.literal("default"),
|
|
1142
|
+
import_v43.z.array(
|
|
1143
|
+
import_v43.z.object({
|
|
1144
|
+
model: import_v43.z.string(),
|
|
1145
|
+
max_tokens: import_v43.z.number().int().optional(),
|
|
1146
|
+
thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1147
|
+
output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1148
|
+
speed: import_v43.z.enum(["fast", "standard"]).optional()
|
|
1149
|
+
})
|
|
1150
|
+
)
|
|
1151
|
+
]).optional(),
|
|
1152
|
+
/**
|
|
1153
|
+
* A set of beta features to enable.
|
|
1154
|
+
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1155
|
+
*/
|
|
1156
|
+
anthropicBeta: import_v43.z.array(import_v43.z.string()).optional(),
|
|
1157
|
+
/**
|
|
1158
|
+
* Server-side safeguards to run as part of the request.
|
|
1159
|
+
*
|
|
1160
|
+
* `dangerous_tool_use` asks the API to classify every `tool_use` block in
|
|
1161
|
+
* the response for dangerous actions (the check Claude Code's auto mode
|
|
1162
|
+
* relies on). The per-call verdicts are returned in
|
|
1163
|
+
* `providerMetadata.anthropic.safeguardResults`, keyed by tool call id.
|
|
1164
|
+
* `classifierContext` is passed through to the API as `classifier_context`.
|
|
1165
|
+
* The `dangerous-tool-use-2026-09-03` beta is added automatically.
|
|
1166
|
+
*/
|
|
1167
|
+
safeguards: import_v43.z.array(
|
|
1165
1168
|
import_v43.z.object({
|
|
1166
|
-
type: import_v43.z.literal("
|
|
1167
|
-
|
|
1169
|
+
type: import_v43.z.literal("dangerous_tool_use"),
|
|
1170
|
+
classifierContext: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional()
|
|
1171
|
+
})
|
|
1172
|
+
).optional(),
|
|
1173
|
+
contextManagement: import_v43.z.object({
|
|
1174
|
+
edits: import_v43.z.array(
|
|
1175
|
+
import_v43.z.discriminatedUnion("type", [
|
|
1168
1176
|
import_v43.z.object({
|
|
1169
|
-
type: import_v43.z.literal("
|
|
1170
|
-
|
|
1177
|
+
type: import_v43.z.literal("clear_tool_uses_20250919"),
|
|
1178
|
+
trigger: import_v43.z.discriminatedUnion("type", [
|
|
1179
|
+
import_v43.z.object({
|
|
1180
|
+
type: import_v43.z.literal("input_tokens"),
|
|
1181
|
+
value: import_v43.z.number()
|
|
1182
|
+
}),
|
|
1183
|
+
import_v43.z.object({
|
|
1184
|
+
type: import_v43.z.literal("tool_uses"),
|
|
1185
|
+
value: import_v43.z.number()
|
|
1186
|
+
})
|
|
1187
|
+
]).optional(),
|
|
1188
|
+
keep: import_v43.z.object({
|
|
1189
|
+
type: import_v43.z.literal("tool_uses"),
|
|
1190
|
+
value: import_v43.z.number()
|
|
1191
|
+
}).optional(),
|
|
1192
|
+
clearAtLeast: import_v43.z.object({
|
|
1193
|
+
type: import_v43.z.literal("input_tokens"),
|
|
1194
|
+
value: import_v43.z.number()
|
|
1195
|
+
}).optional(),
|
|
1196
|
+
clearToolInputs: import_v43.z.boolean().optional(),
|
|
1197
|
+
excludeTools: import_v43.z.array(import_v43.z.string()).optional()
|
|
1171
1198
|
}),
|
|
1172
1199
|
import_v43.z.object({
|
|
1173
|
-
type: import_v43.z.literal("
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
type: import_v43.z.literal("input_tokens"),
|
|
1183
|
-
value: import_v43.z.number()
|
|
1184
|
-
}).optional(),
|
|
1185
|
-
clearToolInputs: import_v43.z.boolean().optional(),
|
|
1186
|
-
excludeTools: import_v43.z.array(import_v43.z.string()).optional()
|
|
1187
|
-
}),
|
|
1188
|
-
import_v43.z.object({
|
|
1189
|
-
type: import_v43.z.literal("clear_thinking_20251015"),
|
|
1190
|
-
keep: import_v43.z.union([
|
|
1191
|
-
import_v43.z.literal("all"),
|
|
1200
|
+
type: import_v43.z.literal("clear_thinking_20251015"),
|
|
1201
|
+
keep: import_v43.z.union([
|
|
1202
|
+
import_v43.z.literal("all"),
|
|
1203
|
+
import_v43.z.object({
|
|
1204
|
+
type: import_v43.z.literal("thinking_turns"),
|
|
1205
|
+
value: import_v43.z.number()
|
|
1206
|
+
})
|
|
1207
|
+
]).optional()
|
|
1208
|
+
}),
|
|
1192
1209
|
import_v43.z.object({
|
|
1193
|
-
type: import_v43.z.literal("
|
|
1194
|
-
|
|
1210
|
+
type: import_v43.z.literal("compact_20260112"),
|
|
1211
|
+
trigger: import_v43.z.object({
|
|
1212
|
+
type: import_v43.z.literal("input_tokens"),
|
|
1213
|
+
value: import_v43.z.number()
|
|
1214
|
+
}).optional(),
|
|
1215
|
+
pauseAfterCompaction: import_v43.z.boolean().optional(),
|
|
1216
|
+
instructions: import_v43.z.string().optional()
|
|
1195
1217
|
})
|
|
1196
|
-
])
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
type: import_v43.z.literal("input_tokens"),
|
|
1202
|
-
value: import_v43.z.number()
|
|
1203
|
-
}).optional(),
|
|
1204
|
-
pauseAfterCompaction: import_v43.z.boolean().optional(),
|
|
1205
|
-
instructions: import_v43.z.string().optional()
|
|
1206
|
-
})
|
|
1207
|
-
])
|
|
1208
|
-
)
|
|
1209
|
-
}).optional()
|
|
1218
|
+
])
|
|
1219
|
+
)
|
|
1220
|
+
}).optional()
|
|
1221
|
+
})
|
|
1222
|
+
);
|
|
1210
1223
|
});
|
|
1211
1224
|
|
|
1212
1225
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1260,10 +1273,10 @@ var CacheControlValidator = class {
|
|
|
1260
1273
|
};
|
|
1261
1274
|
|
|
1262
1275
|
// src/tool/advisor_20260301.ts
|
|
1263
|
-
var
|
|
1276
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1264
1277
|
var import_v44 = require("zod/v4");
|
|
1265
|
-
var advisor_20260301ArgsSchema = (0,
|
|
1266
|
-
() => (0,
|
|
1278
|
+
var advisor_20260301ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
1279
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1267
1280
|
import_v44.z.object({
|
|
1268
1281
|
model: import_v44.z.string(),
|
|
1269
1282
|
maxUses: import_v44.z.number().optional(),
|
|
@@ -1274,8 +1287,8 @@ var advisor_20260301ArgsSchema = (0, import_provider_utils3.lazySchema)(
|
|
|
1274
1287
|
})
|
|
1275
1288
|
)
|
|
1276
1289
|
);
|
|
1277
|
-
var advisor_20260301OutputSchema = (0,
|
|
1278
|
-
() => (0,
|
|
1290
|
+
var advisor_20260301OutputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1291
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1279
1292
|
import_v44.z.discriminatedUnion("type", [
|
|
1280
1293
|
import_v44.z.object({
|
|
1281
1294
|
type: import_v44.z.literal("advisor_result"),
|
|
@@ -1292,10 +1305,10 @@ var advisor_20260301OutputSchema = (0, import_provider_utils3.lazySchema)(
|
|
|
1292
1305
|
])
|
|
1293
1306
|
)
|
|
1294
1307
|
);
|
|
1295
|
-
var advisor_20260301InputSchema = (0,
|
|
1296
|
-
() => (0,
|
|
1308
|
+
var advisor_20260301InputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1309
|
+
() => (0, import_provider_utils4.zodSchema)(import_v44.z.object({}).strict())
|
|
1297
1310
|
);
|
|
1298
|
-
var factory = (0,
|
|
1311
|
+
var factory = (0, import_provider_utils4.createProviderToolFactoryWithOutputSchema)({
|
|
1299
1312
|
id: "anthropic.advisor_20260301",
|
|
1300
1313
|
inputSchema: advisor_20260301InputSchema,
|
|
1301
1314
|
outputSchema: advisor_20260301OutputSchema,
|
|
@@ -1306,7 +1319,7 @@ var advisor_20260301 = (args) => {
|
|
|
1306
1319
|
};
|
|
1307
1320
|
|
|
1308
1321
|
// src/tool/computer-toolset_20260801.ts
|
|
1309
|
-
var
|
|
1322
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1310
1323
|
var import_v45 = require("zod/v4");
|
|
1311
1324
|
var computerToolset_20260801Members = [
|
|
1312
1325
|
"screenshot",
|
|
@@ -1327,8 +1340,8 @@ var computerToolset_20260801Members = [
|
|
|
1327
1340
|
"hold_key",
|
|
1328
1341
|
"wait"
|
|
1329
1342
|
];
|
|
1330
|
-
var computerToolset_20260801InputSchema = (0,
|
|
1331
|
-
() => (0,
|
|
1343
|
+
var computerToolset_20260801InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1344
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1332
1345
|
import_v45.z.object({
|
|
1333
1346
|
action: import_v45.z.enum(computerToolset_20260801Members),
|
|
1334
1347
|
coordinate: import_v45.z.tuple([import_v45.z.number().int(), import_v45.z.number().int()]).optional(),
|
|
@@ -1347,8 +1360,8 @@ var computerToolset_20260801InputSchema = (0, import_provider_utils4.lazySchema)
|
|
|
1347
1360
|
})
|
|
1348
1361
|
)
|
|
1349
1362
|
);
|
|
1350
|
-
var computerToolset_20260801ArgsSchema = (0,
|
|
1351
|
-
() => (0,
|
|
1363
|
+
var computerToolset_20260801ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1364
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1352
1365
|
import_v45.z.object({
|
|
1353
1366
|
configs: import_v45.z.partialRecord(
|
|
1354
1367
|
import_v45.z.enum(computerToolset_20260801Members),
|
|
@@ -1360,23 +1373,23 @@ var computerToolset_20260801ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
|
1360
1373
|
})
|
|
1361
1374
|
)
|
|
1362
1375
|
);
|
|
1363
|
-
var computerToolset_20260801 = (0,
|
|
1376
|
+
var computerToolset_20260801 = (0, import_provider_utils5.createProviderToolFactory)({
|
|
1364
1377
|
id: "anthropic.computer_toolset_20260801",
|
|
1365
1378
|
inputSchema: computerToolset_20260801InputSchema
|
|
1366
1379
|
});
|
|
1367
1380
|
|
|
1368
1381
|
// src/tool/text-editor_20250728.ts
|
|
1369
|
-
var
|
|
1382
|
+
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1370
1383
|
var import_v46 = require("zod/v4");
|
|
1371
|
-
var textEditor_20250728ArgsSchema = (0,
|
|
1372
|
-
() => (0,
|
|
1384
|
+
var textEditor_20250728ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1385
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1373
1386
|
import_v46.z.object({
|
|
1374
1387
|
maxCharacters: import_v46.z.number().optional()
|
|
1375
1388
|
})
|
|
1376
1389
|
)
|
|
1377
1390
|
);
|
|
1378
|
-
var textEditor_20250728InputSchema = (0,
|
|
1379
|
-
() => (0,
|
|
1391
|
+
var textEditor_20250728InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1392
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1380
1393
|
import_v46.z.object({
|
|
1381
1394
|
command: import_v46.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1382
1395
|
path: import_v46.z.string(),
|
|
@@ -1389,7 +1402,7 @@ var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1389
1402
|
})
|
|
1390
1403
|
)
|
|
1391
1404
|
);
|
|
1392
|
-
var factory2 = (0,
|
|
1405
|
+
var factory2 = (0, import_provider_utils6.createProviderToolFactory)({
|
|
1393
1406
|
id: "anthropic.text_editor_20250728",
|
|
1394
1407
|
inputSchema: textEditor_20250728InputSchema
|
|
1395
1408
|
});
|
|
@@ -1398,10 +1411,10 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1398
1411
|
};
|
|
1399
1412
|
|
|
1400
1413
|
// src/tool/web-search_20260209.ts
|
|
1401
|
-
var
|
|
1414
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1402
1415
|
var import_v47 = require("zod/v4");
|
|
1403
|
-
var webSearch_20260209ArgsSchema = (0,
|
|
1404
|
-
() => (0,
|
|
1416
|
+
var webSearch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1417
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1405
1418
|
import_v47.z.object({
|
|
1406
1419
|
maxUses: import_v47.z.number().optional(),
|
|
1407
1420
|
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
@@ -1416,8 +1429,8 @@ var webSearch_20260209ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1416
1429
|
})
|
|
1417
1430
|
)
|
|
1418
1431
|
);
|
|
1419
|
-
var webSearch_20260209OutputSchema = (0,
|
|
1420
|
-
() => (0,
|
|
1432
|
+
var webSearch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1433
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1421
1434
|
import_v47.z.array(
|
|
1422
1435
|
import_v47.z.object({
|
|
1423
1436
|
url: import_v47.z.string(),
|
|
@@ -1429,14 +1442,14 @@ var webSearch_20260209OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1429
1442
|
)
|
|
1430
1443
|
)
|
|
1431
1444
|
);
|
|
1432
|
-
var webSearch_20260209InputSchema = (0,
|
|
1433
|
-
() => (0,
|
|
1445
|
+
var webSearch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1446
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1434
1447
|
import_v47.z.object({
|
|
1435
1448
|
query: import_v47.z.string()
|
|
1436
1449
|
})
|
|
1437
1450
|
)
|
|
1438
1451
|
);
|
|
1439
|
-
var factory3 = (0,
|
|
1452
|
+
var factory3 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1440
1453
|
id: "anthropic.web_search_20260209",
|
|
1441
1454
|
inputSchema: webSearch_20260209InputSchema,
|
|
1442
1455
|
outputSchema: webSearch_20260209OutputSchema,
|
|
@@ -1447,10 +1460,10 @@ var webSearch_20260209 = (args = {}) => {
|
|
|
1447
1460
|
};
|
|
1448
1461
|
|
|
1449
1462
|
// src/tool/web-search_20250305.ts
|
|
1450
|
-
var
|
|
1463
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1451
1464
|
var import_v48 = require("zod/v4");
|
|
1452
|
-
var webSearch_20250305ArgsSchema = (0,
|
|
1453
|
-
() => (0,
|
|
1465
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
1466
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1454
1467
|
import_v48.z.object({
|
|
1455
1468
|
maxUses: import_v48.z.number().optional(),
|
|
1456
1469
|
allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
@@ -1465,8 +1478,8 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
|
1465
1478
|
})
|
|
1466
1479
|
)
|
|
1467
1480
|
);
|
|
1468
|
-
var webSearch_20250305OutputSchema = (0,
|
|
1469
|
-
() => (0,
|
|
1481
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1482
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1470
1483
|
import_v48.z.array(
|
|
1471
1484
|
import_v48.z.object({
|
|
1472
1485
|
url: import_v48.z.string(),
|
|
@@ -1478,14 +1491,14 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
|
1478
1491
|
)
|
|
1479
1492
|
)
|
|
1480
1493
|
);
|
|
1481
|
-
var webSearch_20250305InputSchema = (0,
|
|
1482
|
-
() => (0,
|
|
1494
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1495
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1483
1496
|
import_v48.z.object({
|
|
1484
1497
|
query: import_v48.z.string()
|
|
1485
1498
|
})
|
|
1486
1499
|
)
|
|
1487
1500
|
);
|
|
1488
|
-
var factory4 = (0,
|
|
1501
|
+
var factory4 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1489
1502
|
id: "anthropic.web_search_20250305",
|
|
1490
1503
|
inputSchema: webSearch_20250305InputSchema,
|
|
1491
1504
|
outputSchema: webSearch_20250305OutputSchema,
|
|
@@ -1496,10 +1509,10 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1496
1509
|
};
|
|
1497
1510
|
|
|
1498
1511
|
// src/tool/web-fetch-20260209.ts
|
|
1499
|
-
var
|
|
1512
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1500
1513
|
var import_v49 = require("zod/v4");
|
|
1501
|
-
var webFetch_20260209ArgsSchema = (0,
|
|
1502
|
-
() => (0,
|
|
1514
|
+
var webFetch_20260209ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
1515
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1503
1516
|
import_v49.z.object({
|
|
1504
1517
|
maxUses: import_v49.z.number().optional(),
|
|
1505
1518
|
allowedDomains: import_v49.z.array(import_v49.z.string()).optional(),
|
|
@@ -1509,8 +1522,8 @@ var webFetch_20260209ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1509
1522
|
})
|
|
1510
1523
|
)
|
|
1511
1524
|
);
|
|
1512
|
-
var webFetch_20260209OutputSchema = (0,
|
|
1513
|
-
() => (0,
|
|
1525
|
+
var webFetch_20260209OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1526
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1514
1527
|
import_v49.z.object({
|
|
1515
1528
|
type: import_v49.z.literal("web_fetch_result"),
|
|
1516
1529
|
url: import_v49.z.string(),
|
|
@@ -1535,14 +1548,14 @@ var webFetch_20260209OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1535
1548
|
})
|
|
1536
1549
|
)
|
|
1537
1550
|
);
|
|
1538
|
-
var webFetch_20260209InputSchema = (0,
|
|
1539
|
-
() => (0,
|
|
1551
|
+
var webFetch_20260209InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1552
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1540
1553
|
import_v49.z.object({
|
|
1541
1554
|
url: import_v49.z.string()
|
|
1542
1555
|
})
|
|
1543
1556
|
)
|
|
1544
1557
|
);
|
|
1545
|
-
var factory5 = (0,
|
|
1558
|
+
var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
|
|
1546
1559
|
id: "anthropic.web_fetch_20260209",
|
|
1547
1560
|
inputSchema: webFetch_20260209InputSchema,
|
|
1548
1561
|
outputSchema: webFetch_20260209OutputSchema,
|
|
@@ -1553,10 +1566,10 @@ var webFetch_20260209 = (args = {}) => {
|
|
|
1553
1566
|
};
|
|
1554
1567
|
|
|
1555
1568
|
// src/tool/web-fetch-20250910.ts
|
|
1556
|
-
var
|
|
1569
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1557
1570
|
var import_v410 = require("zod/v4");
|
|
1558
|
-
var webFetch_20250910ArgsSchema = (0,
|
|
1559
|
-
() => (0,
|
|
1571
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils10.lazySchema)(
|
|
1572
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1560
1573
|
import_v410.z.object({
|
|
1561
1574
|
maxUses: import_v410.z.number().optional(),
|
|
1562
1575
|
allowedDomains: import_v410.z.array(import_v410.z.string()).optional(),
|
|
@@ -1566,8 +1579,8 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
|
1566
1579
|
})
|
|
1567
1580
|
)
|
|
1568
1581
|
);
|
|
1569
|
-
var webFetch_20250910OutputSchema = (0,
|
|
1570
|
-
() => (0,
|
|
1582
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1583
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1571
1584
|
import_v410.z.object({
|
|
1572
1585
|
type: import_v410.z.literal("web_fetch_result"),
|
|
1573
1586
|
url: import_v410.z.string(),
|
|
@@ -1592,14 +1605,14 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
|
1592
1605
|
})
|
|
1593
1606
|
)
|
|
1594
1607
|
);
|
|
1595
|
-
var webFetch_20250910InputSchema = (0,
|
|
1596
|
-
() => (0,
|
|
1608
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1609
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1597
1610
|
import_v410.z.object({
|
|
1598
1611
|
url: import_v410.z.string()
|
|
1599
1612
|
})
|
|
1600
1613
|
)
|
|
1601
1614
|
);
|
|
1602
|
-
var factory6 = (0,
|
|
1615
|
+
var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
|
|
1603
1616
|
id: "anthropic.web_fetch_20250910",
|
|
1604
1617
|
inputSchema: webFetch_20250910InputSchema,
|
|
1605
1618
|
outputSchema: webFetch_20250910OutputSchema,
|
|
@@ -1610,7 +1623,7 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1610
1623
|
};
|
|
1611
1624
|
|
|
1612
1625
|
// src/anthropic-prepare-tools.ts
|
|
1613
|
-
var
|
|
1626
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1614
1627
|
async function prepareTools({
|
|
1615
1628
|
tools,
|
|
1616
1629
|
toolChoice,
|
|
@@ -1723,7 +1736,7 @@ async function prepareTools({
|
|
|
1723
1736
|
break;
|
|
1724
1737
|
}
|
|
1725
1738
|
case "anthropic.computer_toolset_20260801": {
|
|
1726
|
-
const args = await (0,
|
|
1739
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1727
1740
|
value: tool.args,
|
|
1728
1741
|
schema: computerToolset_20260801ArgsSchema
|
|
1729
1742
|
});
|
|
@@ -1787,7 +1800,7 @@ async function prepareTools({
|
|
|
1787
1800
|
break;
|
|
1788
1801
|
}
|
|
1789
1802
|
case "anthropic.text_editor_20250728": {
|
|
1790
|
-
const args = await (0,
|
|
1803
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1791
1804
|
value: tool.args,
|
|
1792
1805
|
schema: textEditor_20250728ArgsSchema
|
|
1793
1806
|
});
|
|
@@ -1827,7 +1840,7 @@ async function prepareTools({
|
|
|
1827
1840
|
}
|
|
1828
1841
|
case "anthropic.web_fetch_20250910": {
|
|
1829
1842
|
betas.add("web-fetch-2025-09-10");
|
|
1830
|
-
const args = await (0,
|
|
1843
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1831
1844
|
value: tool.args,
|
|
1832
1845
|
schema: webFetch_20250910ArgsSchema
|
|
1833
1846
|
});
|
|
@@ -1845,7 +1858,7 @@ async function prepareTools({
|
|
|
1845
1858
|
}
|
|
1846
1859
|
case "anthropic.web_fetch_20260209": {
|
|
1847
1860
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1848
|
-
const args = await (0,
|
|
1861
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1849
1862
|
value: tool.args,
|
|
1850
1863
|
schema: webFetch_20260209ArgsSchema
|
|
1851
1864
|
});
|
|
@@ -1862,7 +1875,7 @@ async function prepareTools({
|
|
|
1862
1875
|
break;
|
|
1863
1876
|
}
|
|
1864
1877
|
case "anthropic.web_search_20250305": {
|
|
1865
|
-
const args = await (0,
|
|
1878
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1866
1879
|
value: tool.args,
|
|
1867
1880
|
schema: webSearch_20250305ArgsSchema
|
|
1868
1881
|
});
|
|
@@ -1879,7 +1892,7 @@ async function prepareTools({
|
|
|
1879
1892
|
}
|
|
1880
1893
|
case "anthropic.web_search_20260209": {
|
|
1881
1894
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1882
|
-
const args = await (0,
|
|
1895
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1883
1896
|
value: tool.args,
|
|
1884
1897
|
schema: webSearch_20260209ArgsSchema
|
|
1885
1898
|
});
|
|
@@ -1910,7 +1923,7 @@ async function prepareTools({
|
|
|
1910
1923
|
}
|
|
1911
1924
|
case "anthropic.advisor_20260301": {
|
|
1912
1925
|
betas.add("advisor-tool-2026-03-01");
|
|
1913
|
-
const args = await (0,
|
|
1926
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1914
1927
|
value: tool.args,
|
|
1915
1928
|
schema: advisor_20260301ArgsSchema
|
|
1916
1929
|
});
|
|
@@ -2087,13 +2100,13 @@ function convertAnthropicMessagesUsage({
|
|
|
2087
2100
|
|
|
2088
2101
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2089
2102
|
var import_provider2 = require("@ai-sdk/provider");
|
|
2090
|
-
var
|
|
2103
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2091
2104
|
|
|
2092
2105
|
// src/tool/code-execution_20250522.ts
|
|
2093
|
-
var
|
|
2106
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2094
2107
|
var import_v411 = require("zod/v4");
|
|
2095
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
2096
|
-
() => (0,
|
|
2108
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2109
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2097
2110
|
import_v411.z.object({
|
|
2098
2111
|
type: import_v411.z.literal("code_execution_result"),
|
|
2099
2112
|
stdout: import_v411.z.string(),
|
|
@@ -2108,14 +2121,14 @@ var codeExecution_20250522OutputSchema = (0, import_provider_utils11.lazySchema)
|
|
|
2108
2121
|
})
|
|
2109
2122
|
)
|
|
2110
2123
|
);
|
|
2111
|
-
var codeExecution_20250522InputSchema = (0,
|
|
2112
|
-
() => (0,
|
|
2124
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2125
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2113
2126
|
import_v411.z.object({
|
|
2114
2127
|
code: import_v411.z.string()
|
|
2115
2128
|
})
|
|
2116
2129
|
)
|
|
2117
2130
|
);
|
|
2118
|
-
var factory7 = (0,
|
|
2131
|
+
var factory7 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
2119
2132
|
id: "anthropic.code_execution_20250522",
|
|
2120
2133
|
inputSchema: codeExecution_20250522InputSchema,
|
|
2121
2134
|
outputSchema: codeExecution_20250522OutputSchema
|
|
@@ -2125,10 +2138,10 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
2125
2138
|
};
|
|
2126
2139
|
|
|
2127
2140
|
// src/tool/code-execution_20250825.ts
|
|
2128
|
-
var
|
|
2141
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2129
2142
|
var import_v412 = require("zod/v4");
|
|
2130
|
-
var codeExecution_20250825OutputSchema = (0,
|
|
2131
|
-
() => (0,
|
|
2143
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2144
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2132
2145
|
import_v412.z.discriminatedUnion("type", [
|
|
2133
2146
|
import_v412.z.object({
|
|
2134
2147
|
type: import_v412.z.literal("code_execution_result"),
|
|
@@ -2185,8 +2198,8 @@ var codeExecution_20250825OutputSchema = (0, import_provider_utils12.lazySchema)
|
|
|
2185
2198
|
])
|
|
2186
2199
|
)
|
|
2187
2200
|
);
|
|
2188
|
-
var codeExecution_20250825InputSchema = (0,
|
|
2189
|
-
() => (0,
|
|
2201
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2202
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2190
2203
|
import_v412.z.discriminatedUnion("type", [
|
|
2191
2204
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2192
2205
|
import_v412.z.object({
|
|
@@ -2220,7 +2233,7 @@ var codeExecution_20250825InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
|
2220
2233
|
])
|
|
2221
2234
|
)
|
|
2222
2235
|
);
|
|
2223
|
-
var factory8 = (0,
|
|
2236
|
+
var factory8 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
|
|
2224
2237
|
id: "anthropic.code_execution_20250825",
|
|
2225
2238
|
inputSchema: codeExecution_20250825InputSchema,
|
|
2226
2239
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -2234,10 +2247,10 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
2234
2247
|
};
|
|
2235
2248
|
|
|
2236
2249
|
// src/tool/code-execution_20260120.ts
|
|
2237
|
-
var
|
|
2250
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2238
2251
|
var import_v413 = require("zod/v4");
|
|
2239
|
-
var codeExecution_20260120OutputSchema = (0,
|
|
2240
|
-
() => (0,
|
|
2252
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2253
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2241
2254
|
import_v413.z.discriminatedUnion("type", [
|
|
2242
2255
|
import_v413.z.object({
|
|
2243
2256
|
type: import_v413.z.literal("code_execution_result"),
|
|
@@ -2306,8 +2319,8 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)
|
|
|
2306
2319
|
])
|
|
2307
2320
|
)
|
|
2308
2321
|
);
|
|
2309
|
-
var codeExecution_20260120InputSchema = (0,
|
|
2310
|
-
() => (0,
|
|
2322
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2323
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2311
2324
|
import_v413.z.discriminatedUnion("type", [
|
|
2312
2325
|
import_v413.z.object({
|
|
2313
2326
|
type: import_v413.z.literal("programmatic-tool-call"),
|
|
@@ -2340,7 +2353,7 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
|
2340
2353
|
])
|
|
2341
2354
|
)
|
|
2342
2355
|
);
|
|
2343
|
-
var factory9 = (0,
|
|
2356
|
+
var factory9 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
2344
2357
|
id: "anthropic.code_execution_20260120",
|
|
2345
2358
|
inputSchema: codeExecution_20260120InputSchema,
|
|
2346
2359
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
@@ -2351,10 +2364,10 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
2351
2364
|
};
|
|
2352
2365
|
|
|
2353
2366
|
// src/tool/tool-search-regex_20251119.ts
|
|
2354
|
-
var
|
|
2367
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2355
2368
|
var import_v414 = require("zod/v4");
|
|
2356
|
-
var toolSearchRegex_20251119OutputSchema = (0,
|
|
2357
|
-
() => (0,
|
|
2369
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2370
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2358
2371
|
import_v414.z.array(
|
|
2359
2372
|
import_v414.z.object({
|
|
2360
2373
|
type: import_v414.z.literal("tool_reference"),
|
|
@@ -2363,8 +2376,8 @@ var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils14.lazySchem
|
|
|
2363
2376
|
)
|
|
2364
2377
|
)
|
|
2365
2378
|
);
|
|
2366
|
-
var toolSearchRegex_20251119InputSchema = (0,
|
|
2367
|
-
() => (0,
|
|
2379
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2380
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2368
2381
|
import_v414.z.object({
|
|
2369
2382
|
/**
|
|
2370
2383
|
* A regex pattern to search for tools.
|
|
@@ -2384,7 +2397,7 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema
|
|
|
2384
2397
|
})
|
|
2385
2398
|
)
|
|
2386
2399
|
);
|
|
2387
|
-
var factory10 = (0,
|
|
2400
|
+
var factory10 = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
2388
2401
|
id: "anthropic.tool_search_regex_20251119",
|
|
2389
2402
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
2390
2403
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
@@ -2397,7 +2410,7 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
2397
2410
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2398
2411
|
function convertToString(data) {
|
|
2399
2412
|
if (typeof data === "string") {
|
|
2400
|
-
return new TextDecoder().decode((0,
|
|
2413
|
+
return new TextDecoder().decode((0, import_provider_utils16.convertBase64ToUint8Array)(data));
|
|
2401
2414
|
}
|
|
2402
2415
|
if (data instanceof Uint8Array) {
|
|
2403
2416
|
return new TextDecoder().decode(data);
|
|
@@ -2422,7 +2435,7 @@ function getUrlString(data) {
|
|
|
2422
2435
|
}
|
|
2423
2436
|
async function extractErrorValue(value) {
|
|
2424
2437
|
if (typeof value === "string") {
|
|
2425
|
-
const result = await (0,
|
|
2438
|
+
const result = await (0, import_provider_utils16.safeParseJSON)({ text: value });
|
|
2426
2439
|
if (result.success && typeof result.value === "object" && result.value !== null) {
|
|
2427
2440
|
return result.value;
|
|
2428
2441
|
}
|
|
@@ -2453,7 +2466,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2453
2466
|
let lastUserMessageIndex = -1;
|
|
2454
2467
|
async function shouldEnableCitations(providerMetadata) {
|
|
2455
2468
|
var _a2, _b2;
|
|
2456
|
-
const anthropicOptions = await (0,
|
|
2469
|
+
const anthropicOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2457
2470
|
provider: "anthropic",
|
|
2458
2471
|
providerOptions: providerMetadata,
|
|
2459
2472
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2461,7 +2474,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2461
2474
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
2462
2475
|
}
|
|
2463
2476
|
async function getDocumentMetadata(providerMetadata) {
|
|
2464
|
-
const anthropicOptions = await (0,
|
|
2477
|
+
const anthropicOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2465
2478
|
provider: "anthropic",
|
|
2466
2479
|
providerOptions: providerMetadata,
|
|
2467
2480
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2481,7 +2494,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2481
2494
|
let toolChangeCount = 0;
|
|
2482
2495
|
let hasMidConversationOptions = false;
|
|
2483
2496
|
for (const { content: text, providerOptions } of block.messages) {
|
|
2484
|
-
const systemMessageOptions = await (0,
|
|
2497
|
+
const systemMessageOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2485
2498
|
provider: "anthropic",
|
|
2486
2499
|
providerOptions,
|
|
2487
2500
|
schema: anthropicSystemMessageProviderOptions
|
|
@@ -2602,7 +2615,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2602
2615
|
} : {
|
|
2603
2616
|
type: "base64",
|
|
2604
2617
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
2605
|
-
data: (0,
|
|
2618
|
+
data: (0, import_provider_utils16.convertToBase64)(part.data)
|
|
2606
2619
|
},
|
|
2607
2620
|
cache_control: cacheControl
|
|
2608
2621
|
});
|
|
@@ -2622,7 +2635,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2622
2635
|
} : {
|
|
2623
2636
|
type: "base64",
|
|
2624
2637
|
media_type: "application/pdf",
|
|
2625
|
-
data: (0,
|
|
2638
|
+
data: (0, import_provider_utils16.convertToBase64)(part.data)
|
|
2626
2639
|
},
|
|
2627
2640
|
title: (_c = metadata.title) != null ? _c : part.filename,
|
|
2628
2641
|
...metadata.context && { context: metadata.context },
|
|
@@ -2766,7 +2779,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2766
2779
|
return void 0;
|
|
2767
2780
|
}
|
|
2768
2781
|
}
|
|
2769
|
-
}).filter(
|
|
2782
|
+
}).filter(import_provider_utils16.isNonNullable);
|
|
2770
2783
|
break;
|
|
2771
2784
|
case "text":
|
|
2772
2785
|
case "error-text":
|
|
@@ -2851,7 +2864,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2851
2864
|
}
|
|
2852
2865
|
case "reasoning": {
|
|
2853
2866
|
if (sendReasoning) {
|
|
2854
|
-
const reasoningMetadata = await (0,
|
|
2867
|
+
const reasoningMetadata = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2855
2868
|
provider: "anthropic",
|
|
2856
2869
|
providerOptions: part.providerOptions,
|
|
2857
2870
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -3049,7 +3062,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3049
3062
|
let errorInfo = {};
|
|
3050
3063
|
try {
|
|
3051
3064
|
if (typeof output.value === "string") {
|
|
3052
|
-
errorInfo = (0,
|
|
3065
|
+
errorInfo = (0, import_provider_utils16.secureJsonParse)(output.value);
|
|
3053
3066
|
} else if (typeof output.value === "object" && output.value !== null) {
|
|
3054
3067
|
errorInfo = output.value;
|
|
3055
3068
|
}
|
|
@@ -3093,7 +3106,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3093
3106
|
break;
|
|
3094
3107
|
}
|
|
3095
3108
|
if (output.value.type === "code_execution_result") {
|
|
3096
|
-
const codeExecutionOutput = await (0,
|
|
3109
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3097
3110
|
value: output.value,
|
|
3098
3111
|
schema: codeExecution_20250522OutputSchema
|
|
3099
3112
|
});
|
|
@@ -3110,7 +3123,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3110
3123
|
cache_control: cacheControl
|
|
3111
3124
|
});
|
|
3112
3125
|
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
3113
|
-
const codeExecutionOutput = await (0,
|
|
3126
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3114
3127
|
value: output.value,
|
|
3115
3128
|
schema: codeExecution_20260120OutputSchema
|
|
3116
3129
|
});
|
|
@@ -3129,7 +3142,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3129
3142
|
});
|
|
3130
3143
|
}
|
|
3131
3144
|
} else {
|
|
3132
|
-
const codeExecutionOutput = await (0,
|
|
3145
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3133
3146
|
value: output.value,
|
|
3134
3147
|
schema: codeExecution_20250825OutputSchema
|
|
3135
3148
|
});
|
|
@@ -3194,7 +3207,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3194
3207
|
});
|
|
3195
3208
|
break;
|
|
3196
3209
|
}
|
|
3197
|
-
const webFetchOutput = await (0,
|
|
3210
|
+
const webFetchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3198
3211
|
value: output.value,
|
|
3199
3212
|
schema: webFetch_20250910OutputSchema
|
|
3200
3213
|
});
|
|
@@ -3243,7 +3256,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3243
3256
|
});
|
|
3244
3257
|
break;
|
|
3245
3258
|
}
|
|
3246
|
-
const webSearchOutput = await (0,
|
|
3259
|
+
const webSearchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3247
3260
|
value: output.value,
|
|
3248
3261
|
schema: webSearch_20250305OutputSchema
|
|
3249
3262
|
});
|
|
@@ -3283,7 +3296,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3283
3296
|
});
|
|
3284
3297
|
break;
|
|
3285
3298
|
}
|
|
3286
|
-
const toolSearchOutput = await (0,
|
|
3299
|
+
const toolSearchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3287
3300
|
value: output.value,
|
|
3288
3301
|
schema: toolSearchRegex_20251119OutputSchema
|
|
3289
3302
|
});
|
|
@@ -3311,7 +3324,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3311
3324
|
});
|
|
3312
3325
|
break;
|
|
3313
3326
|
}
|
|
3314
|
-
const advisorOutput = await (0,
|
|
3327
|
+
const advisorOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3315
3328
|
value: output.value,
|
|
3316
3329
|
schema: advisor_20260301OutputSchema
|
|
3317
3330
|
});
|
|
@@ -3751,7 +3764,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3751
3764
|
var _a;
|
|
3752
3765
|
this.modelId = modelId;
|
|
3753
3766
|
this.config = config;
|
|
3754
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
3767
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils17.generateId;
|
|
3755
3768
|
}
|
|
3756
3769
|
supportsUrl(url) {
|
|
3757
3770
|
return url.protocol === "https:";
|
|
@@ -3827,12 +3840,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3827
3840
|
}
|
|
3828
3841
|
}
|
|
3829
3842
|
const providerOptionsName = this.providerOptionsName;
|
|
3830
|
-
const canonicalOptions = await (0,
|
|
3843
|
+
const canonicalOptions = await (0, import_provider_utils17.parseProviderOptions)({
|
|
3831
3844
|
provider: "anthropic",
|
|
3832
3845
|
providerOptions,
|
|
3833
3846
|
schema: anthropicLanguageModelOptions
|
|
3834
3847
|
});
|
|
3835
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0,
|
|
3848
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils17.parseProviderOptions)({
|
|
3836
3849
|
provider: providerOptionsName,
|
|
3837
3850
|
providerOptions,
|
|
3838
3851
|
schema: anthropicLanguageModelOptions
|
|
@@ -3917,7 +3930,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3917
3930
|
const cacheControlValidator = new CacheControlValidator(
|
|
3918
3931
|
this.config.cacheControlProviderOptionsName
|
|
3919
3932
|
);
|
|
3920
|
-
const toolNameMapping = (0,
|
|
3933
|
+
const toolNameMapping = (0, import_provider_utils17.createToolNameMapping)({
|
|
3921
3934
|
tools,
|
|
3922
3935
|
providerToolNames: {
|
|
3923
3936
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -4309,15 +4322,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4309
4322
|
betas,
|
|
4310
4323
|
headers
|
|
4311
4324
|
}) {
|
|
4312
|
-
return (0,
|
|
4313
|
-
await (0,
|
|
4325
|
+
return (0, import_provider_utils17.combineHeaders)(
|
|
4326
|
+
await (0, import_provider_utils17.resolve)(this.config.headers),
|
|
4314
4327
|
headers,
|
|
4315
4328
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
4316
4329
|
);
|
|
4317
4330
|
}
|
|
4318
4331
|
async getBetasFromHeaders(requestHeaders) {
|
|
4319
4332
|
var _a, _b;
|
|
4320
|
-
const configHeaders = await (0,
|
|
4333
|
+
const configHeaders = await (0, import_provider_utils17.resolve)(this.config.headers);
|
|
4321
4334
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
4322
4335
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
4323
4336
|
return new Set(
|
|
@@ -4383,12 +4396,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4383
4396
|
responseHeaders,
|
|
4384
4397
|
value: response,
|
|
4385
4398
|
rawValue: rawResponse
|
|
4386
|
-
} = await (0,
|
|
4399
|
+
} = await (0, import_provider_utils17.postJsonToApi)({
|
|
4387
4400
|
url: this.buildRequestUrl(false),
|
|
4388
4401
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
4389
4402
|
body: this.transformRequestBody(args, betas),
|
|
4390
4403
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
4391
|
-
successfulResponseHandler: (0,
|
|
4404
|
+
successfulResponseHandler: (0, import_provider_utils17.createJsonResponseHandler)(
|
|
4392
4405
|
anthropicMessagesResponseSchema
|
|
4393
4406
|
),
|
|
4394
4407
|
abortSignal: options.abortSignal,
|
|
@@ -4903,12 +4916,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4903
4916
|
body.tools
|
|
4904
4917
|
);
|
|
4905
4918
|
const url = this.buildRequestUrl(true);
|
|
4906
|
-
const { responseHeaders, value: response } = await (0,
|
|
4919
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils17.postJsonToApi)({
|
|
4907
4920
|
url,
|
|
4908
4921
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
4909
4922
|
body: this.transformRequestBody(body, betas),
|
|
4910
4923
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
4911
|
-
successfulResponseHandler: (0,
|
|
4924
|
+
successfulResponseHandler: (0, import_provider_utils17.createEventSourceResponseHandler)(
|
|
4912
4925
|
anthropicMessagesChunkSchema
|
|
4913
4926
|
),
|
|
4914
4927
|
abortSignal: options.abortSignal,
|
|
@@ -5454,7 +5467,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5454
5467
|
if (contentBlock.toolset != null) {
|
|
5455
5468
|
let memberInput = {};
|
|
5456
5469
|
try {
|
|
5457
|
-
memberInput = contentBlock.input === "" ? {} : (0,
|
|
5470
|
+
memberInput = contentBlock.input === "" ? {} : (0, import_provider_utils17.secureJsonParse)(contentBlock.input);
|
|
5458
5471
|
} catch (e) {
|
|
5459
5472
|
memberInput = void 0;
|
|
5460
5473
|
}
|
|
@@ -5477,7 +5490,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5477
5490
|
let finalInput = contentBlock.input === "" ? "{}" : contentBlock.input;
|
|
5478
5491
|
if (contentBlock.providerToolName === "code_execution") {
|
|
5479
5492
|
try {
|
|
5480
|
-
const parsed = (0,
|
|
5493
|
+
const parsed = (0, import_provider_utils17.secureJsonParse)(finalInput);
|
|
5481
5494
|
if (parsed != null && typeof parsed === "object" && "code" in parsed && !("type" in parsed)) {
|
|
5482
5495
|
finalInput = JSON.stringify({
|
|
5483
5496
|
type: "programmatic-tool-call",
|
|
@@ -6101,42 +6114,42 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
6101
6114
|
}
|
|
6102
6115
|
|
|
6103
6116
|
// src/tool/bash_20241022.ts
|
|
6104
|
-
var
|
|
6117
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
6105
6118
|
var import_v415 = require("zod/v4");
|
|
6106
|
-
var bash_20241022InputSchema = (0,
|
|
6107
|
-
() => (0,
|
|
6119
|
+
var bash_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
6120
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
6108
6121
|
import_v415.z.object({
|
|
6109
6122
|
command: import_v415.z.string(),
|
|
6110
6123
|
restart: import_v415.z.boolean().optional()
|
|
6111
6124
|
})
|
|
6112
6125
|
)
|
|
6113
6126
|
);
|
|
6114
|
-
var bash_20241022 = (0,
|
|
6127
|
+
var bash_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
6115
6128
|
id: "anthropic.bash_20241022",
|
|
6116
6129
|
inputSchema: bash_20241022InputSchema
|
|
6117
6130
|
});
|
|
6118
6131
|
|
|
6119
6132
|
// src/tool/bash_20250124.ts
|
|
6120
|
-
var
|
|
6133
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
6121
6134
|
var import_v416 = require("zod/v4");
|
|
6122
|
-
var bash_20250124InputSchema = (0,
|
|
6123
|
-
() => (0,
|
|
6135
|
+
var bash_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
6136
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
6124
6137
|
import_v416.z.object({
|
|
6125
6138
|
command: import_v416.z.string(),
|
|
6126
6139
|
restart: import_v416.z.boolean().optional()
|
|
6127
6140
|
})
|
|
6128
6141
|
)
|
|
6129
6142
|
);
|
|
6130
|
-
var bash_20250124 = (0,
|
|
6143
|
+
var bash_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
6131
6144
|
id: "anthropic.bash_20250124",
|
|
6132
6145
|
inputSchema: bash_20250124InputSchema
|
|
6133
6146
|
});
|
|
6134
6147
|
|
|
6135
6148
|
// src/tool/computer_20241022.ts
|
|
6136
|
-
var
|
|
6149
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
6137
6150
|
var import_v417 = require("zod/v4");
|
|
6138
|
-
var computer_20241022InputSchema = (0,
|
|
6139
|
-
() => (0,
|
|
6151
|
+
var computer_20241022InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
6152
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
6140
6153
|
import_v417.z.object({
|
|
6141
6154
|
action: import_v417.z.enum([
|
|
6142
6155
|
"key",
|
|
@@ -6155,16 +6168,16 @@ var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
6155
6168
|
})
|
|
6156
6169
|
)
|
|
6157
6170
|
);
|
|
6158
|
-
var computer_20241022 = (0,
|
|
6171
|
+
var computer_20241022 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
6159
6172
|
id: "anthropic.computer_20241022",
|
|
6160
6173
|
inputSchema: computer_20241022InputSchema
|
|
6161
6174
|
});
|
|
6162
6175
|
|
|
6163
6176
|
// src/tool/computer_20250124.ts
|
|
6164
|
-
var
|
|
6177
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
6165
6178
|
var import_v418 = require("zod/v4");
|
|
6166
|
-
var computer_20250124InputSchema = (0,
|
|
6167
|
-
() => (0,
|
|
6179
|
+
var computer_20250124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
6180
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
6168
6181
|
import_v418.z.object({
|
|
6169
6182
|
action: import_v418.z.enum([
|
|
6170
6183
|
"key",
|
|
@@ -6193,16 +6206,16 @@ var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
6193
6206
|
})
|
|
6194
6207
|
)
|
|
6195
6208
|
);
|
|
6196
|
-
var computer_20250124 = (0,
|
|
6209
|
+
var computer_20250124 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
6197
6210
|
id: "anthropic.computer_20250124",
|
|
6198
6211
|
inputSchema: computer_20250124InputSchema
|
|
6199
6212
|
});
|
|
6200
6213
|
|
|
6201
6214
|
// src/tool/computer_20251124.ts
|
|
6202
|
-
var
|
|
6215
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
6203
6216
|
var import_v419 = require("zod/v4");
|
|
6204
|
-
var computer_20251124InputSchema = (0,
|
|
6205
|
-
() => (0,
|
|
6217
|
+
var computer_20251124InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
6218
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
6206
6219
|
import_v419.z.object({
|
|
6207
6220
|
action: import_v419.z.enum([
|
|
6208
6221
|
"key",
|
|
@@ -6238,16 +6251,16 @@ var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
6238
6251
|
})
|
|
6239
6252
|
)
|
|
6240
6253
|
);
|
|
6241
|
-
var computer_20251124 = (0,
|
|
6254
|
+
var computer_20251124 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
6242
6255
|
id: "anthropic.computer_20251124",
|
|
6243
6256
|
inputSchema: computer_20251124InputSchema
|
|
6244
6257
|
});
|
|
6245
6258
|
|
|
6246
6259
|
// src/tool/memory_20250818.ts
|
|
6247
|
-
var
|
|
6260
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
6248
6261
|
var import_v420 = require("zod/v4");
|
|
6249
|
-
var memory_20250818InputSchema = (0,
|
|
6250
|
-
() => (0,
|
|
6262
|
+
var memory_20250818InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
6263
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
6251
6264
|
import_v420.z.discriminatedUnion("command", [
|
|
6252
6265
|
import_v420.z.object({
|
|
6253
6266
|
command: import_v420.z.literal("view"),
|
|
@@ -6283,16 +6296,16 @@ var memory_20250818InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
|
6283
6296
|
])
|
|
6284
6297
|
)
|
|
6285
6298
|
);
|
|
6286
|
-
var memory_20250818 = (0,
|
|
6299
|
+
var memory_20250818 = (0, import_provider_utils23.createProviderToolFactory)({
|
|
6287
6300
|
id: "anthropic.memory_20250818",
|
|
6288
6301
|
inputSchema: memory_20250818InputSchema
|
|
6289
6302
|
});
|
|
6290
6303
|
|
|
6291
6304
|
// src/tool/text-editor_20241022.ts
|
|
6292
|
-
var
|
|
6305
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
6293
6306
|
var import_v421 = require("zod/v4");
|
|
6294
|
-
var textEditor_20241022InputSchema = (0,
|
|
6295
|
-
() => (0,
|
|
6307
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
6308
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
6296
6309
|
import_v421.z.object({
|
|
6297
6310
|
command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6298
6311
|
path: import_v421.z.string(),
|
|
@@ -6305,16 +6318,16 @@ var textEditor_20241022InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
6305
6318
|
})
|
|
6306
6319
|
)
|
|
6307
6320
|
);
|
|
6308
|
-
var textEditor_20241022 = (0,
|
|
6321
|
+
var textEditor_20241022 = (0, import_provider_utils24.createProviderToolFactory)({
|
|
6309
6322
|
id: "anthropic.text_editor_20241022",
|
|
6310
6323
|
inputSchema: textEditor_20241022InputSchema
|
|
6311
6324
|
});
|
|
6312
6325
|
|
|
6313
6326
|
// src/tool/text-editor_20250124.ts
|
|
6314
|
-
var
|
|
6327
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
6315
6328
|
var import_v422 = require("zod/v4");
|
|
6316
|
-
var textEditor_20250124InputSchema = (0,
|
|
6317
|
-
() => (0,
|
|
6329
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
6330
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
6318
6331
|
import_v422.z.object({
|
|
6319
6332
|
command: import_v422.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6320
6333
|
path: import_v422.z.string(),
|
|
@@ -6327,16 +6340,16 @@ var textEditor_20250124InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
6327
6340
|
})
|
|
6328
6341
|
)
|
|
6329
6342
|
);
|
|
6330
|
-
var textEditor_20250124 = (0,
|
|
6343
|
+
var textEditor_20250124 = (0, import_provider_utils25.createProviderToolFactory)({
|
|
6331
6344
|
id: "anthropic.text_editor_20250124",
|
|
6332
6345
|
inputSchema: textEditor_20250124InputSchema
|
|
6333
6346
|
});
|
|
6334
6347
|
|
|
6335
6348
|
// src/tool/text-editor_20250429.ts
|
|
6336
|
-
var
|
|
6349
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
6337
6350
|
var import_v423 = require("zod/v4");
|
|
6338
|
-
var textEditor_20250429InputSchema = (0,
|
|
6339
|
-
() => (0,
|
|
6351
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils26.lazySchema)(
|
|
6352
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
6340
6353
|
import_v423.z.object({
|
|
6341
6354
|
command: import_v423.z.enum(["view", "create", "str_replace", "insert"]),
|
|
6342
6355
|
path: import_v423.z.string(),
|
|
@@ -6349,16 +6362,16 @@ var textEditor_20250429InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
6349
6362
|
})
|
|
6350
6363
|
)
|
|
6351
6364
|
);
|
|
6352
|
-
var textEditor_20250429 = (0,
|
|
6365
|
+
var textEditor_20250429 = (0, import_provider_utils26.createProviderToolFactory)({
|
|
6353
6366
|
id: "anthropic.text_editor_20250429",
|
|
6354
6367
|
inputSchema: textEditor_20250429InputSchema
|
|
6355
6368
|
});
|
|
6356
6369
|
|
|
6357
6370
|
// src/tool/tool-search-bm25_20251119.ts
|
|
6358
|
-
var
|
|
6371
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
6359
6372
|
var import_v424 = require("zod/v4");
|
|
6360
|
-
var toolSearchBm25_20251119OutputSchema = (0,
|
|
6361
|
-
() => (0,
|
|
6373
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
6374
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
6362
6375
|
import_v424.z.array(
|
|
6363
6376
|
import_v424.z.object({
|
|
6364
6377
|
type: import_v424.z.literal("tool_reference"),
|
|
@@ -6367,8 +6380,8 @@ var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils26.lazySchema
|
|
|
6367
6380
|
)
|
|
6368
6381
|
)
|
|
6369
6382
|
);
|
|
6370
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
6371
|
-
() => (0,
|
|
6383
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils27.lazySchema)(
|
|
6384
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
6372
6385
|
import_v424.z.object({
|
|
6373
6386
|
/**
|
|
6374
6387
|
* A natural language query to search for tools.
|
|
@@ -6382,7 +6395,7 @@ var toolSearchBm25_20251119InputSchema = (0, import_provider_utils26.lazySchema)
|
|
|
6382
6395
|
})
|
|
6383
6396
|
)
|
|
6384
6397
|
);
|
|
6385
|
-
var factory11 = (0,
|
|
6398
|
+
var factory11 = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
6386
6399
|
id: "anthropic.tool_search_bm25_20251119",
|
|
6387
6400
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
6388
6401
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|