@ai-sdk/anthropic 3.0.133 → 3.0.135
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 +16 -0
- package/dist/index.d.mts +121 -156
- package/dist/index.d.ts +121 -156
- package/dist/index.js +569 -537
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +526 -491
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +175 -139
- package/dist/internal/index.d.ts +175 -139
- package/dist/internal/index.js +562 -530
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +525 -490
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/anthropic-messages-api.ts +73 -57
- package/src/anthropic-messages-language-model.ts +31 -8
- package/src/anthropic-messages-options.ts +386 -367
- package/src/convert-to-anthropic-messages-prompt.ts +22 -0
- package/src/get-cache-control.ts +15 -3
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
|
+
*/
|
|
1165
1017
|
import_v43.z.object({
|
|
1166
|
-
|
|
1167
|
-
|
|
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(
|
|
1168
|
+
import_v43.z.object({
|
|
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
|
|
@@ -1214,19 +1227,24 @@ var import_provider = require("@ai-sdk/provider");
|
|
|
1214
1227
|
|
|
1215
1228
|
// src/get-cache-control.ts
|
|
1216
1229
|
var MAX_CACHE_BREAKPOINTS = 4;
|
|
1217
|
-
function getCacheControl(providerMetadata) {
|
|
1218
|
-
var _a;
|
|
1230
|
+
function getCacheControl(providerMetadata, providerOptionsName) {
|
|
1231
|
+
var _a, _b, _c;
|
|
1232
|
+
const custom = providerMetadata == null ? void 0 : providerMetadata[providerOptionsName];
|
|
1219
1233
|
const anthropic = providerMetadata == null ? void 0 : providerMetadata.anthropic;
|
|
1220
|
-
const cacheControlValue = (_a = anthropic == null ? void 0 : anthropic.cacheControl) != null ?
|
|
1234
|
+
const cacheControlValue = (_c = (_b = (_a = custom == null ? void 0 : custom.cacheControl) != null ? _a : custom == null ? void 0 : custom.cache_control) != null ? _b : anthropic == null ? void 0 : anthropic.cacheControl) != null ? _c : anthropic == null ? void 0 : anthropic.cache_control;
|
|
1221
1235
|
return cacheControlValue;
|
|
1222
1236
|
}
|
|
1223
1237
|
var CacheControlValidator = class {
|
|
1224
|
-
constructor() {
|
|
1238
|
+
constructor(providerOptionsName = "anthropic") {
|
|
1239
|
+
this.providerOptionsName = providerOptionsName;
|
|
1225
1240
|
this.breakpointCount = 0;
|
|
1226
1241
|
this.warnings = [];
|
|
1227
1242
|
}
|
|
1228
1243
|
getCacheControl(providerMetadata, context) {
|
|
1229
|
-
const cacheControlValue = getCacheControl(
|
|
1244
|
+
const cacheControlValue = getCacheControl(
|
|
1245
|
+
providerMetadata,
|
|
1246
|
+
this.providerOptionsName
|
|
1247
|
+
);
|
|
1230
1248
|
if (!cacheControlValue) {
|
|
1231
1249
|
return void 0;
|
|
1232
1250
|
}
|
|
@@ -1255,10 +1273,10 @@ var CacheControlValidator = class {
|
|
|
1255
1273
|
};
|
|
1256
1274
|
|
|
1257
1275
|
// src/tool/advisor_20260301.ts
|
|
1258
|
-
var
|
|
1276
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1259
1277
|
var import_v44 = require("zod/v4");
|
|
1260
|
-
var advisor_20260301ArgsSchema = (0,
|
|
1261
|
-
() => (0,
|
|
1278
|
+
var advisor_20260301ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
1279
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1262
1280
|
import_v44.z.object({
|
|
1263
1281
|
model: import_v44.z.string(),
|
|
1264
1282
|
maxUses: import_v44.z.number().optional(),
|
|
@@ -1269,8 +1287,8 @@ var advisor_20260301ArgsSchema = (0, import_provider_utils3.lazySchema)(
|
|
|
1269
1287
|
})
|
|
1270
1288
|
)
|
|
1271
1289
|
);
|
|
1272
|
-
var advisor_20260301OutputSchema = (0,
|
|
1273
|
-
() => (0,
|
|
1290
|
+
var advisor_20260301OutputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1291
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1274
1292
|
import_v44.z.discriminatedUnion("type", [
|
|
1275
1293
|
import_v44.z.object({
|
|
1276
1294
|
type: import_v44.z.literal("advisor_result"),
|
|
@@ -1287,10 +1305,10 @@ var advisor_20260301OutputSchema = (0, import_provider_utils3.lazySchema)(
|
|
|
1287
1305
|
])
|
|
1288
1306
|
)
|
|
1289
1307
|
);
|
|
1290
|
-
var advisor_20260301InputSchema = (0,
|
|
1291
|
-
() => (0,
|
|
1308
|
+
var advisor_20260301InputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1309
|
+
() => (0, import_provider_utils4.zodSchema)(import_v44.z.object({}).strict())
|
|
1292
1310
|
);
|
|
1293
|
-
var factory = (0,
|
|
1311
|
+
var factory = (0, import_provider_utils4.createProviderToolFactoryWithOutputSchema)({
|
|
1294
1312
|
id: "anthropic.advisor_20260301",
|
|
1295
1313
|
inputSchema: advisor_20260301InputSchema,
|
|
1296
1314
|
outputSchema: advisor_20260301OutputSchema,
|
|
@@ -1301,7 +1319,7 @@ var advisor_20260301 = (args) => {
|
|
|
1301
1319
|
};
|
|
1302
1320
|
|
|
1303
1321
|
// src/tool/computer-toolset_20260801.ts
|
|
1304
|
-
var
|
|
1322
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1305
1323
|
var import_v45 = require("zod/v4");
|
|
1306
1324
|
var computerToolset_20260801Members = [
|
|
1307
1325
|
"screenshot",
|
|
@@ -1322,8 +1340,8 @@ var computerToolset_20260801Members = [
|
|
|
1322
1340
|
"hold_key",
|
|
1323
1341
|
"wait"
|
|
1324
1342
|
];
|
|
1325
|
-
var computerToolset_20260801InputSchema = (0,
|
|
1326
|
-
() => (0,
|
|
1343
|
+
var computerToolset_20260801InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1344
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1327
1345
|
import_v45.z.object({
|
|
1328
1346
|
action: import_v45.z.enum(computerToolset_20260801Members),
|
|
1329
1347
|
coordinate: import_v45.z.tuple([import_v45.z.number().int(), import_v45.z.number().int()]).optional(),
|
|
@@ -1342,8 +1360,8 @@ var computerToolset_20260801InputSchema = (0, import_provider_utils4.lazySchema)
|
|
|
1342
1360
|
})
|
|
1343
1361
|
)
|
|
1344
1362
|
);
|
|
1345
|
-
var computerToolset_20260801ArgsSchema = (0,
|
|
1346
|
-
() => (0,
|
|
1363
|
+
var computerToolset_20260801ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1364
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1347
1365
|
import_v45.z.object({
|
|
1348
1366
|
configs: import_v45.z.partialRecord(
|
|
1349
1367
|
import_v45.z.enum(computerToolset_20260801Members),
|
|
@@ -1355,23 +1373,23 @@ var computerToolset_20260801ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
|
1355
1373
|
})
|
|
1356
1374
|
)
|
|
1357
1375
|
);
|
|
1358
|
-
var computerToolset_20260801 = (0,
|
|
1376
|
+
var computerToolset_20260801 = (0, import_provider_utils5.createProviderToolFactory)({
|
|
1359
1377
|
id: "anthropic.computer_toolset_20260801",
|
|
1360
1378
|
inputSchema: computerToolset_20260801InputSchema
|
|
1361
1379
|
});
|
|
1362
1380
|
|
|
1363
1381
|
// src/tool/text-editor_20250728.ts
|
|
1364
|
-
var
|
|
1382
|
+
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1365
1383
|
var import_v46 = require("zod/v4");
|
|
1366
|
-
var textEditor_20250728ArgsSchema = (0,
|
|
1367
|
-
() => (0,
|
|
1384
|
+
var textEditor_20250728ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1385
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1368
1386
|
import_v46.z.object({
|
|
1369
1387
|
maxCharacters: import_v46.z.number().optional()
|
|
1370
1388
|
})
|
|
1371
1389
|
)
|
|
1372
1390
|
);
|
|
1373
|
-
var textEditor_20250728InputSchema = (0,
|
|
1374
|
-
() => (0,
|
|
1391
|
+
var textEditor_20250728InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1392
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1375
1393
|
import_v46.z.object({
|
|
1376
1394
|
command: import_v46.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1377
1395
|
path: import_v46.z.string(),
|
|
@@ -1384,7 +1402,7 @@ var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1384
1402
|
})
|
|
1385
1403
|
)
|
|
1386
1404
|
);
|
|
1387
|
-
var factory2 = (0,
|
|
1405
|
+
var factory2 = (0, import_provider_utils6.createProviderToolFactory)({
|
|
1388
1406
|
id: "anthropic.text_editor_20250728",
|
|
1389
1407
|
inputSchema: textEditor_20250728InputSchema
|
|
1390
1408
|
});
|
|
@@ -1393,10 +1411,10 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1393
1411
|
};
|
|
1394
1412
|
|
|
1395
1413
|
// src/tool/web-search_20260209.ts
|
|
1396
|
-
var
|
|
1414
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1397
1415
|
var import_v47 = require("zod/v4");
|
|
1398
|
-
var webSearch_20260209ArgsSchema = (0,
|
|
1399
|
-
() => (0,
|
|
1416
|
+
var webSearch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1417
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1400
1418
|
import_v47.z.object({
|
|
1401
1419
|
maxUses: import_v47.z.number().optional(),
|
|
1402
1420
|
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
@@ -1411,8 +1429,8 @@ var webSearch_20260209ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1411
1429
|
})
|
|
1412
1430
|
)
|
|
1413
1431
|
);
|
|
1414
|
-
var webSearch_20260209OutputSchema = (0,
|
|
1415
|
-
() => (0,
|
|
1432
|
+
var webSearch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1433
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1416
1434
|
import_v47.z.array(
|
|
1417
1435
|
import_v47.z.object({
|
|
1418
1436
|
url: import_v47.z.string(),
|
|
@@ -1424,14 +1442,14 @@ var webSearch_20260209OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1424
1442
|
)
|
|
1425
1443
|
)
|
|
1426
1444
|
);
|
|
1427
|
-
var webSearch_20260209InputSchema = (0,
|
|
1428
|
-
() => (0,
|
|
1445
|
+
var webSearch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1446
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1429
1447
|
import_v47.z.object({
|
|
1430
1448
|
query: import_v47.z.string()
|
|
1431
1449
|
})
|
|
1432
1450
|
)
|
|
1433
1451
|
);
|
|
1434
|
-
var factory3 = (0,
|
|
1452
|
+
var factory3 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1435
1453
|
id: "anthropic.web_search_20260209",
|
|
1436
1454
|
inputSchema: webSearch_20260209InputSchema,
|
|
1437
1455
|
outputSchema: webSearch_20260209OutputSchema,
|
|
@@ -1442,10 +1460,10 @@ var webSearch_20260209 = (args = {}) => {
|
|
|
1442
1460
|
};
|
|
1443
1461
|
|
|
1444
1462
|
// src/tool/web-search_20250305.ts
|
|
1445
|
-
var
|
|
1463
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1446
1464
|
var import_v48 = require("zod/v4");
|
|
1447
|
-
var webSearch_20250305ArgsSchema = (0,
|
|
1448
|
-
() => (0,
|
|
1465
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
1466
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1449
1467
|
import_v48.z.object({
|
|
1450
1468
|
maxUses: import_v48.z.number().optional(),
|
|
1451
1469
|
allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
@@ -1460,8 +1478,8 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
|
1460
1478
|
})
|
|
1461
1479
|
)
|
|
1462
1480
|
);
|
|
1463
|
-
var webSearch_20250305OutputSchema = (0,
|
|
1464
|
-
() => (0,
|
|
1481
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1482
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1465
1483
|
import_v48.z.array(
|
|
1466
1484
|
import_v48.z.object({
|
|
1467
1485
|
url: import_v48.z.string(),
|
|
@@ -1473,14 +1491,14 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
|
1473
1491
|
)
|
|
1474
1492
|
)
|
|
1475
1493
|
);
|
|
1476
|
-
var webSearch_20250305InputSchema = (0,
|
|
1477
|
-
() => (0,
|
|
1494
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1495
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1478
1496
|
import_v48.z.object({
|
|
1479
1497
|
query: import_v48.z.string()
|
|
1480
1498
|
})
|
|
1481
1499
|
)
|
|
1482
1500
|
);
|
|
1483
|
-
var factory4 = (0,
|
|
1501
|
+
var factory4 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1484
1502
|
id: "anthropic.web_search_20250305",
|
|
1485
1503
|
inputSchema: webSearch_20250305InputSchema,
|
|
1486
1504
|
outputSchema: webSearch_20250305OutputSchema,
|
|
@@ -1491,10 +1509,10 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1491
1509
|
};
|
|
1492
1510
|
|
|
1493
1511
|
// src/tool/web-fetch-20260209.ts
|
|
1494
|
-
var
|
|
1512
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1495
1513
|
var import_v49 = require("zod/v4");
|
|
1496
|
-
var webFetch_20260209ArgsSchema = (0,
|
|
1497
|
-
() => (0,
|
|
1514
|
+
var webFetch_20260209ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
1515
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1498
1516
|
import_v49.z.object({
|
|
1499
1517
|
maxUses: import_v49.z.number().optional(),
|
|
1500
1518
|
allowedDomains: import_v49.z.array(import_v49.z.string()).optional(),
|
|
@@ -1504,8 +1522,8 @@ var webFetch_20260209ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1504
1522
|
})
|
|
1505
1523
|
)
|
|
1506
1524
|
);
|
|
1507
|
-
var webFetch_20260209OutputSchema = (0,
|
|
1508
|
-
() => (0,
|
|
1525
|
+
var webFetch_20260209OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1526
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1509
1527
|
import_v49.z.object({
|
|
1510
1528
|
type: import_v49.z.literal("web_fetch_result"),
|
|
1511
1529
|
url: import_v49.z.string(),
|
|
@@ -1530,14 +1548,14 @@ var webFetch_20260209OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1530
1548
|
})
|
|
1531
1549
|
)
|
|
1532
1550
|
);
|
|
1533
|
-
var webFetch_20260209InputSchema = (0,
|
|
1534
|
-
() => (0,
|
|
1551
|
+
var webFetch_20260209InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1552
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1535
1553
|
import_v49.z.object({
|
|
1536
1554
|
url: import_v49.z.string()
|
|
1537
1555
|
})
|
|
1538
1556
|
)
|
|
1539
1557
|
);
|
|
1540
|
-
var factory5 = (0,
|
|
1558
|
+
var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
|
|
1541
1559
|
id: "anthropic.web_fetch_20260209",
|
|
1542
1560
|
inputSchema: webFetch_20260209InputSchema,
|
|
1543
1561
|
outputSchema: webFetch_20260209OutputSchema,
|
|
@@ -1548,10 +1566,10 @@ var webFetch_20260209 = (args = {}) => {
|
|
|
1548
1566
|
};
|
|
1549
1567
|
|
|
1550
1568
|
// src/tool/web-fetch-20250910.ts
|
|
1551
|
-
var
|
|
1569
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1552
1570
|
var import_v410 = require("zod/v4");
|
|
1553
|
-
var webFetch_20250910ArgsSchema = (0,
|
|
1554
|
-
() => (0,
|
|
1571
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils10.lazySchema)(
|
|
1572
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1555
1573
|
import_v410.z.object({
|
|
1556
1574
|
maxUses: import_v410.z.number().optional(),
|
|
1557
1575
|
allowedDomains: import_v410.z.array(import_v410.z.string()).optional(),
|
|
@@ -1561,8 +1579,8 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
|
1561
1579
|
})
|
|
1562
1580
|
)
|
|
1563
1581
|
);
|
|
1564
|
-
var webFetch_20250910OutputSchema = (0,
|
|
1565
|
-
() => (0,
|
|
1582
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1583
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1566
1584
|
import_v410.z.object({
|
|
1567
1585
|
type: import_v410.z.literal("web_fetch_result"),
|
|
1568
1586
|
url: import_v410.z.string(),
|
|
@@ -1587,14 +1605,14 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
|
1587
1605
|
})
|
|
1588
1606
|
)
|
|
1589
1607
|
);
|
|
1590
|
-
var webFetch_20250910InputSchema = (0,
|
|
1591
|
-
() => (0,
|
|
1608
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1609
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1592
1610
|
import_v410.z.object({
|
|
1593
1611
|
url: import_v410.z.string()
|
|
1594
1612
|
})
|
|
1595
1613
|
)
|
|
1596
1614
|
);
|
|
1597
|
-
var factory6 = (0,
|
|
1615
|
+
var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
|
|
1598
1616
|
id: "anthropic.web_fetch_20250910",
|
|
1599
1617
|
inputSchema: webFetch_20250910InputSchema,
|
|
1600
1618
|
outputSchema: webFetch_20250910OutputSchema,
|
|
@@ -1605,7 +1623,7 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1605
1623
|
};
|
|
1606
1624
|
|
|
1607
1625
|
// src/anthropic-prepare-tools.ts
|
|
1608
|
-
var
|
|
1626
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1609
1627
|
async function prepareTools({
|
|
1610
1628
|
tools,
|
|
1611
1629
|
toolChoice,
|
|
@@ -1718,7 +1736,7 @@ async function prepareTools({
|
|
|
1718
1736
|
break;
|
|
1719
1737
|
}
|
|
1720
1738
|
case "anthropic.computer_toolset_20260801": {
|
|
1721
|
-
const args = await (0,
|
|
1739
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1722
1740
|
value: tool.args,
|
|
1723
1741
|
schema: computerToolset_20260801ArgsSchema
|
|
1724
1742
|
});
|
|
@@ -1782,7 +1800,7 @@ async function prepareTools({
|
|
|
1782
1800
|
break;
|
|
1783
1801
|
}
|
|
1784
1802
|
case "anthropic.text_editor_20250728": {
|
|
1785
|
-
const args = await (0,
|
|
1803
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1786
1804
|
value: tool.args,
|
|
1787
1805
|
schema: textEditor_20250728ArgsSchema
|
|
1788
1806
|
});
|
|
@@ -1822,7 +1840,7 @@ async function prepareTools({
|
|
|
1822
1840
|
}
|
|
1823
1841
|
case "anthropic.web_fetch_20250910": {
|
|
1824
1842
|
betas.add("web-fetch-2025-09-10");
|
|
1825
|
-
const args = await (0,
|
|
1843
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1826
1844
|
value: tool.args,
|
|
1827
1845
|
schema: webFetch_20250910ArgsSchema
|
|
1828
1846
|
});
|
|
@@ -1840,7 +1858,7 @@ async function prepareTools({
|
|
|
1840
1858
|
}
|
|
1841
1859
|
case "anthropic.web_fetch_20260209": {
|
|
1842
1860
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1843
|
-
const args = await (0,
|
|
1861
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1844
1862
|
value: tool.args,
|
|
1845
1863
|
schema: webFetch_20260209ArgsSchema
|
|
1846
1864
|
});
|
|
@@ -1857,7 +1875,7 @@ async function prepareTools({
|
|
|
1857
1875
|
break;
|
|
1858
1876
|
}
|
|
1859
1877
|
case "anthropic.web_search_20250305": {
|
|
1860
|
-
const args = await (0,
|
|
1878
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1861
1879
|
value: tool.args,
|
|
1862
1880
|
schema: webSearch_20250305ArgsSchema
|
|
1863
1881
|
});
|
|
@@ -1874,7 +1892,7 @@ async function prepareTools({
|
|
|
1874
1892
|
}
|
|
1875
1893
|
case "anthropic.web_search_20260209": {
|
|
1876
1894
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1877
|
-
const args = await (0,
|
|
1895
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1878
1896
|
value: tool.args,
|
|
1879
1897
|
schema: webSearch_20260209ArgsSchema
|
|
1880
1898
|
});
|
|
@@ -1905,7 +1923,7 @@ async function prepareTools({
|
|
|
1905
1923
|
}
|
|
1906
1924
|
case "anthropic.advisor_20260301": {
|
|
1907
1925
|
betas.add("advisor-tool-2026-03-01");
|
|
1908
|
-
const args = await (0,
|
|
1926
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1909
1927
|
value: tool.args,
|
|
1910
1928
|
schema: advisor_20260301ArgsSchema
|
|
1911
1929
|
});
|
|
@@ -2082,13 +2100,13 @@ function convertAnthropicMessagesUsage({
|
|
|
2082
2100
|
|
|
2083
2101
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2084
2102
|
var import_provider2 = require("@ai-sdk/provider");
|
|
2085
|
-
var
|
|
2103
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2086
2104
|
|
|
2087
2105
|
// src/tool/code-execution_20250522.ts
|
|
2088
|
-
var
|
|
2106
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2089
2107
|
var import_v411 = require("zod/v4");
|
|
2090
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
2091
|
-
() => (0,
|
|
2108
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2109
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2092
2110
|
import_v411.z.object({
|
|
2093
2111
|
type: import_v411.z.literal("code_execution_result"),
|
|
2094
2112
|
stdout: import_v411.z.string(),
|
|
@@ -2103,14 +2121,14 @@ var codeExecution_20250522OutputSchema = (0, import_provider_utils11.lazySchema)
|
|
|
2103
2121
|
})
|
|
2104
2122
|
)
|
|
2105
2123
|
);
|
|
2106
|
-
var codeExecution_20250522InputSchema = (0,
|
|
2107
|
-
() => (0,
|
|
2124
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2125
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2108
2126
|
import_v411.z.object({
|
|
2109
2127
|
code: import_v411.z.string()
|
|
2110
2128
|
})
|
|
2111
2129
|
)
|
|
2112
2130
|
);
|
|
2113
|
-
var factory7 = (0,
|
|
2131
|
+
var factory7 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
2114
2132
|
id: "anthropic.code_execution_20250522",
|
|
2115
2133
|
inputSchema: codeExecution_20250522InputSchema,
|
|
2116
2134
|
outputSchema: codeExecution_20250522OutputSchema
|
|
@@ -2120,10 +2138,10 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
2120
2138
|
};
|
|
2121
2139
|
|
|
2122
2140
|
// src/tool/code-execution_20250825.ts
|
|
2123
|
-
var
|
|
2141
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2124
2142
|
var import_v412 = require("zod/v4");
|
|
2125
|
-
var codeExecution_20250825OutputSchema = (0,
|
|
2126
|
-
() => (0,
|
|
2143
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2144
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2127
2145
|
import_v412.z.discriminatedUnion("type", [
|
|
2128
2146
|
import_v412.z.object({
|
|
2129
2147
|
type: import_v412.z.literal("code_execution_result"),
|
|
@@ -2180,8 +2198,8 @@ var codeExecution_20250825OutputSchema = (0, import_provider_utils12.lazySchema)
|
|
|
2180
2198
|
])
|
|
2181
2199
|
)
|
|
2182
2200
|
);
|
|
2183
|
-
var codeExecution_20250825InputSchema = (0,
|
|
2184
|
-
() => (0,
|
|
2201
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2202
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2185
2203
|
import_v412.z.discriminatedUnion("type", [
|
|
2186
2204
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2187
2205
|
import_v412.z.object({
|
|
@@ -2215,7 +2233,7 @@ var codeExecution_20250825InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
|
2215
2233
|
])
|
|
2216
2234
|
)
|
|
2217
2235
|
);
|
|
2218
|
-
var factory8 = (0,
|
|
2236
|
+
var factory8 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
|
|
2219
2237
|
id: "anthropic.code_execution_20250825",
|
|
2220
2238
|
inputSchema: codeExecution_20250825InputSchema,
|
|
2221
2239
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -2229,10 +2247,10 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
2229
2247
|
};
|
|
2230
2248
|
|
|
2231
2249
|
// src/tool/code-execution_20260120.ts
|
|
2232
|
-
var
|
|
2250
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2233
2251
|
var import_v413 = require("zod/v4");
|
|
2234
|
-
var codeExecution_20260120OutputSchema = (0,
|
|
2235
|
-
() => (0,
|
|
2252
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2253
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2236
2254
|
import_v413.z.discriminatedUnion("type", [
|
|
2237
2255
|
import_v413.z.object({
|
|
2238
2256
|
type: import_v413.z.literal("code_execution_result"),
|
|
@@ -2301,8 +2319,8 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)
|
|
|
2301
2319
|
])
|
|
2302
2320
|
)
|
|
2303
2321
|
);
|
|
2304
|
-
var codeExecution_20260120InputSchema = (0,
|
|
2305
|
-
() => (0,
|
|
2322
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2323
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2306
2324
|
import_v413.z.discriminatedUnion("type", [
|
|
2307
2325
|
import_v413.z.object({
|
|
2308
2326
|
type: import_v413.z.literal("programmatic-tool-call"),
|
|
@@ -2335,7 +2353,7 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
|
2335
2353
|
])
|
|
2336
2354
|
)
|
|
2337
2355
|
);
|
|
2338
|
-
var factory9 = (0,
|
|
2356
|
+
var factory9 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
2339
2357
|
id: "anthropic.code_execution_20260120",
|
|
2340
2358
|
inputSchema: codeExecution_20260120InputSchema,
|
|
2341
2359
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
@@ -2346,10 +2364,10 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
2346
2364
|
};
|
|
2347
2365
|
|
|
2348
2366
|
// src/tool/tool-search-regex_20251119.ts
|
|
2349
|
-
var
|
|
2367
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2350
2368
|
var import_v414 = require("zod/v4");
|
|
2351
|
-
var toolSearchRegex_20251119OutputSchema = (0,
|
|
2352
|
-
() => (0,
|
|
2369
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2370
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2353
2371
|
import_v414.z.array(
|
|
2354
2372
|
import_v414.z.object({
|
|
2355
2373
|
type: import_v414.z.literal("tool_reference"),
|
|
@@ -2358,8 +2376,8 @@ var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils14.lazySchem
|
|
|
2358
2376
|
)
|
|
2359
2377
|
)
|
|
2360
2378
|
);
|
|
2361
|
-
var toolSearchRegex_20251119InputSchema = (0,
|
|
2362
|
-
() => (0,
|
|
2379
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2380
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2363
2381
|
import_v414.z.object({
|
|
2364
2382
|
/**
|
|
2365
2383
|
* A regex pattern to search for tools.
|
|
@@ -2379,7 +2397,7 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema
|
|
|
2379
2397
|
})
|
|
2380
2398
|
)
|
|
2381
2399
|
);
|
|
2382
|
-
var factory10 = (0,
|
|
2400
|
+
var factory10 = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
2383
2401
|
id: "anthropic.tool_search_regex_20251119",
|
|
2384
2402
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
2385
2403
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
@@ -2392,7 +2410,7 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
2392
2410
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2393
2411
|
function convertToString(data) {
|
|
2394
2412
|
if (typeof data === "string") {
|
|
2395
|
-
return new TextDecoder().decode((0,
|
|
2413
|
+
return new TextDecoder().decode((0, import_provider_utils16.convertBase64ToUint8Array)(data));
|
|
2396
2414
|
}
|
|
2397
2415
|
if (data instanceof Uint8Array) {
|
|
2398
2416
|
return new TextDecoder().decode(data);
|
|
@@ -2417,7 +2435,7 @@ function getUrlString(data) {
|
|
|
2417
2435
|
}
|
|
2418
2436
|
async function extractErrorValue(value) {
|
|
2419
2437
|
if (typeof value === "string") {
|
|
2420
|
-
const result = await (0,
|
|
2438
|
+
const result = await (0, import_provider_utils16.safeParseJSON)({ text: value });
|
|
2421
2439
|
if (result.success && typeof result.value === "object" && result.value !== null) {
|
|
2422
2440
|
return result.value;
|
|
2423
2441
|
}
|
|
@@ -2436,7 +2454,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2436
2454
|
warnings,
|
|
2437
2455
|
cacheControlValidator,
|
|
2438
2456
|
toolNameMapping,
|
|
2439
|
-
toolsetNames = {}
|
|
2457
|
+
toolsetNames = {},
|
|
2458
|
+
convertMediaPart
|
|
2440
2459
|
}) {
|
|
2441
2460
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2442
2461
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -2447,7 +2466,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2447
2466
|
let lastUserMessageIndex = -1;
|
|
2448
2467
|
async function shouldEnableCitations(providerMetadata) {
|
|
2449
2468
|
var _a2, _b2;
|
|
2450
|
-
const anthropicOptions = await (0,
|
|
2469
|
+
const anthropicOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2451
2470
|
provider: "anthropic",
|
|
2452
2471
|
providerOptions: providerMetadata,
|
|
2453
2472
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2455,7 +2474,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2455
2474
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
2456
2475
|
}
|
|
2457
2476
|
async function getDocumentMetadata(providerMetadata) {
|
|
2458
|
-
const anthropicOptions = await (0,
|
|
2477
|
+
const anthropicOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2459
2478
|
provider: "anthropic",
|
|
2460
2479
|
providerOptions: providerMetadata,
|
|
2461
2480
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2475,7 +2494,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2475
2494
|
let toolChangeCount = 0;
|
|
2476
2495
|
let hasMidConversationOptions = false;
|
|
2477
2496
|
for (const { content: text, providerOptions } of block.messages) {
|
|
2478
|
-
const systemMessageOptions = await (0,
|
|
2497
|
+
const systemMessageOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2479
2498
|
provider: "anthropic",
|
|
2480
2499
|
providerOptions,
|
|
2481
2500
|
schema: anthropicSystemMessageProviderOptions
|
|
@@ -2579,6 +2598,14 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2579
2598
|
break;
|
|
2580
2599
|
}
|
|
2581
2600
|
case "file": {
|
|
2601
|
+
const customContent = await (convertMediaPart == null ? void 0 : convertMediaPart(part));
|
|
2602
|
+
if (customContent != null) {
|
|
2603
|
+
anthropicContent.push({
|
|
2604
|
+
...customContent,
|
|
2605
|
+
cache_control: cacheControl
|
|
2606
|
+
});
|
|
2607
|
+
break;
|
|
2608
|
+
}
|
|
2582
2609
|
if (part.mediaType.startsWith("image/")) {
|
|
2583
2610
|
anthropicContent.push({
|
|
2584
2611
|
type: "image",
|
|
@@ -2588,7 +2615,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2588
2615
|
} : {
|
|
2589
2616
|
type: "base64",
|
|
2590
2617
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
2591
|
-
data: (0,
|
|
2618
|
+
data: (0, import_provider_utils16.convertToBase64)(part.data)
|
|
2592
2619
|
},
|
|
2593
2620
|
cache_control: cacheControl
|
|
2594
2621
|
});
|
|
@@ -2608,7 +2635,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2608
2635
|
} : {
|
|
2609
2636
|
type: "base64",
|
|
2610
2637
|
media_type: "application/pdf",
|
|
2611
|
-
data: (0,
|
|
2638
|
+
data: (0, import_provider_utils16.convertToBase64)(part.data)
|
|
2612
2639
|
},
|
|
2613
2640
|
title: (_c = metadata.title) != null ? _c : part.filename,
|
|
2614
2641
|
...metadata.context && { context: metadata.context },
|
|
@@ -2752,7 +2779,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2752
2779
|
return void 0;
|
|
2753
2780
|
}
|
|
2754
2781
|
}
|
|
2755
|
-
}).filter(
|
|
2782
|
+
}).filter(import_provider_utils16.isNonNullable);
|
|
2756
2783
|
break;
|
|
2757
2784
|
case "text":
|
|
2758
2785
|
case "error-text":
|
|
@@ -2837,7 +2864,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2837
2864
|
}
|
|
2838
2865
|
case "reasoning": {
|
|
2839
2866
|
if (sendReasoning) {
|
|
2840
|
-
const reasoningMetadata = await (0,
|
|
2867
|
+
const reasoningMetadata = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2841
2868
|
provider: "anthropic",
|
|
2842
2869
|
providerOptions: part.providerOptions,
|
|
2843
2870
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -3035,7 +3062,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3035
3062
|
let errorInfo = {};
|
|
3036
3063
|
try {
|
|
3037
3064
|
if (typeof output.value === "string") {
|
|
3038
|
-
errorInfo = (0,
|
|
3065
|
+
errorInfo = (0, import_provider_utils16.secureJsonParse)(output.value);
|
|
3039
3066
|
} else if (typeof output.value === "object" && output.value !== null) {
|
|
3040
3067
|
errorInfo = output.value;
|
|
3041
3068
|
}
|
|
@@ -3079,7 +3106,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3079
3106
|
break;
|
|
3080
3107
|
}
|
|
3081
3108
|
if (output.value.type === "code_execution_result") {
|
|
3082
|
-
const codeExecutionOutput = await (0,
|
|
3109
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3083
3110
|
value: output.value,
|
|
3084
3111
|
schema: codeExecution_20250522OutputSchema
|
|
3085
3112
|
});
|
|
@@ -3096,7 +3123,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3096
3123
|
cache_control: cacheControl
|
|
3097
3124
|
});
|
|
3098
3125
|
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
3099
|
-
const codeExecutionOutput = await (0,
|
|
3126
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3100
3127
|
value: output.value,
|
|
3101
3128
|
schema: codeExecution_20260120OutputSchema
|
|
3102
3129
|
});
|
|
@@ -3115,7 +3142,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3115
3142
|
});
|
|
3116
3143
|
}
|
|
3117
3144
|
} else {
|
|
3118
|
-
const codeExecutionOutput = await (0,
|
|
3145
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3119
3146
|
value: output.value,
|
|
3120
3147
|
schema: codeExecution_20250825OutputSchema
|
|
3121
3148
|
});
|
|
@@ -3180,7 +3207,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3180
3207
|
});
|
|
3181
3208
|
break;
|
|
3182
3209
|
}
|
|
3183
|
-
const webFetchOutput = await (0,
|
|
3210
|
+
const webFetchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3184
3211
|
value: output.value,
|
|
3185
3212
|
schema: webFetch_20250910OutputSchema
|
|
3186
3213
|
});
|
|
@@ -3229,7 +3256,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3229
3256
|
});
|
|
3230
3257
|
break;
|
|
3231
3258
|
}
|
|
3232
|
-
const webSearchOutput = await (0,
|
|
3259
|
+
const webSearchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3233
3260
|
value: output.value,
|
|
3234
3261
|
schema: webSearch_20250305OutputSchema
|
|
3235
3262
|
});
|
|
@@ -3269,7 +3296,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3269
3296
|
});
|
|
3270
3297
|
break;
|
|
3271
3298
|
}
|
|
3272
|
-
const toolSearchOutput = await (0,
|
|
3299
|
+
const toolSearchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3273
3300
|
value: output.value,
|
|
3274
3301
|
schema: toolSearchRegex_20251119OutputSchema
|
|
3275
3302
|
});
|
|
@@ -3297,7 +3324,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3297
3324
|
});
|
|
3298
3325
|
break;
|
|
3299
3326
|
}
|
|
3300
|
-
const advisorOutput = await (0,
|
|
3327
|
+
const advisorOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3301
3328
|
value: output.value,
|
|
3302
3329
|
schema: advisor_20260301OutputSchema
|
|
3303
3330
|
});
|
|
@@ -3737,7 +3764,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3737
3764
|
var _a;
|
|
3738
3765
|
this.modelId = modelId;
|
|
3739
3766
|
this.config = config;
|
|
3740
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
3767
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils17.generateId;
|
|
3741
3768
|
}
|
|
3742
3769
|
supportsUrl(url) {
|
|
3743
3770
|
return url.protocol === "https:";
|
|
@@ -3775,7 +3802,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3775
3802
|
providerOptions,
|
|
3776
3803
|
stream
|
|
3777
3804
|
}) {
|
|
3778
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3805
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3779
3806
|
const warnings = [];
|
|
3780
3807
|
if (frequencyPenalty != null) {
|
|
3781
3808
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -3786,18 +3813,20 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3786
3813
|
if (seed != null) {
|
|
3787
3814
|
warnings.push({ type: "unsupported", feature: "seed" });
|
|
3788
3815
|
}
|
|
3789
|
-
|
|
3816
|
+
const maxTemperature = (_a = this.config.maxTemperature) != null ? _a : 1;
|
|
3817
|
+
const temperatureProvider = this.config.maxTemperature == null ? "anthropic" : this.providerOptionsName;
|
|
3818
|
+
if (temperature != null && temperature > maxTemperature) {
|
|
3790
3819
|
warnings.push({
|
|
3791
3820
|
type: "unsupported",
|
|
3792
3821
|
feature: "temperature",
|
|
3793
|
-
details: `${temperature} exceeds
|
|
3822
|
+
details: `${temperature} exceeds ${temperatureProvider} maximum of ${maxTemperature.toFixed(1)}. clamped to ${maxTemperature.toFixed(1)}`
|
|
3794
3823
|
});
|
|
3795
|
-
temperature =
|
|
3824
|
+
temperature = maxTemperature;
|
|
3796
3825
|
} else if (temperature != null && temperature < 0) {
|
|
3797
3826
|
warnings.push({
|
|
3798
3827
|
type: "unsupported",
|
|
3799
3828
|
feature: "temperature",
|
|
3800
|
-
details: `${temperature} is below
|
|
3829
|
+
details: `${temperature} is below ${temperatureProvider} minimum of 0. clamped to 0`
|
|
3801
3830
|
});
|
|
3802
3831
|
temperature = 0;
|
|
3803
3832
|
}
|
|
@@ -3811,12 +3840,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3811
3840
|
}
|
|
3812
3841
|
}
|
|
3813
3842
|
const providerOptionsName = this.providerOptionsName;
|
|
3814
|
-
const canonicalOptions = await (0,
|
|
3843
|
+
const canonicalOptions = await (0, import_provider_utils17.parseProviderOptions)({
|
|
3815
3844
|
provider: "anthropic",
|
|
3816
3845
|
providerOptions,
|
|
3817
3846
|
schema: anthropicLanguageModelOptions
|
|
3818
3847
|
});
|
|
3819
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0,
|
|
3848
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils17.parseProviderOptions)({
|
|
3820
3849
|
provider: providerOptionsName,
|
|
3821
3850
|
providerOptions,
|
|
3822
3851
|
schema: anthropicLanguageModelOptions
|
|
@@ -3872,9 +3901,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3872
3901
|
}
|
|
3873
3902
|
}
|
|
3874
3903
|
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
3875
|
-
const supportsStructuredOutput = ((
|
|
3876
|
-
const supportsStrictTools = ((
|
|
3877
|
-
const structureOutputMode = (
|
|
3904
|
+
const supportsStructuredOutput = ((_b = this.config.supportsNativeStructuredOutput) != null ? _b : true) && modelSupportsStructuredOutput;
|
|
3905
|
+
const supportsStrictTools = ((_c = this.config.supportsStrictTools) != null ? _c : true) && modelSupportsStructuredOutput;
|
|
3906
|
+
const structureOutputMode = (_d = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _d : "auto";
|
|
3878
3907
|
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
3879
3908
|
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
3880
3909
|
warnings.push({
|
|
@@ -3898,8 +3927,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3898
3927
|
});
|
|
3899
3928
|
}
|
|
3900
3929
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
3901
|
-
const cacheControlValidator = new CacheControlValidator(
|
|
3902
|
-
|
|
3930
|
+
const cacheControlValidator = new CacheControlValidator(
|
|
3931
|
+
this.config.cacheControlProviderOptionsName
|
|
3932
|
+
);
|
|
3933
|
+
const toolNameMapping = (0, import_provider_utils17.createToolNameMapping)({
|
|
3903
3934
|
tools,
|
|
3904
3935
|
providerToolNames: {
|
|
3905
3936
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -3928,11 +3959,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3928
3959
|
const toolsetNames = getAnthropicToolsetNames(tools);
|
|
3929
3960
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
3930
3961
|
prompt,
|
|
3931
|
-
sendReasoning: (
|
|
3962
|
+
sendReasoning: (_e = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _e : true,
|
|
3932
3963
|
warnings,
|
|
3933
3964
|
cacheControlValidator,
|
|
3934
3965
|
toolNameMapping,
|
|
3935
|
-
toolsetNames
|
|
3966
|
+
toolsetNames,
|
|
3967
|
+
convertMediaPart: this.config.convertMediaPart
|
|
3936
3968
|
});
|
|
3937
3969
|
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
3938
3970
|
const requestedThinking = anthropicOptions.thinking;
|
|
@@ -4042,7 +4074,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4042
4074
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
4043
4075
|
cache_control: anthropicOptions.cacheControl
|
|
4044
4076
|
},
|
|
4045
|
-
...((
|
|
4077
|
+
...((_f = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _f.userId) != null && {
|
|
4046
4078
|
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
4047
4079
|
},
|
|
4048
4080
|
// mcp servers:
|
|
@@ -4150,7 +4182,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4150
4182
|
};
|
|
4151
4183
|
thinkingBudget = 1024;
|
|
4152
4184
|
}
|
|
4153
|
-
if (baseArgs.temperature != null) {
|
|
4185
|
+
if (baseArgs.temperature != null && !this.config.supportsTemperatureAndTopPWithThinking) {
|
|
4154
4186
|
baseArgs.temperature = void 0;
|
|
4155
4187
|
warnings.push({
|
|
4156
4188
|
type: "unsupported",
|
|
@@ -4166,7 +4198,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4166
4198
|
details: "topK is not supported when thinking is enabled"
|
|
4167
4199
|
});
|
|
4168
4200
|
}
|
|
4169
|
-
if (topP != null) {
|
|
4201
|
+
if (topP != null && !this.config.supportsTemperatureAndTopPWithThinking) {
|
|
4170
4202
|
baseArgs.top_p = void 0;
|
|
4171
4203
|
warnings.push({
|
|
4172
4204
|
type: "unsupported",
|
|
@@ -4237,7 +4269,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4237
4269
|
} else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
|
|
4238
4270
|
betas.add("server-side-fallback-2026-06-01");
|
|
4239
4271
|
}
|
|
4240
|
-
const defaultEagerInputStreaming = stream && ((
|
|
4272
|
+
const defaultEagerInputStreaming = stream && ((_g = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _g : true);
|
|
4241
4273
|
const {
|
|
4242
4274
|
tools: anthropicTools2,
|
|
4243
4275
|
toolChoice: anthropicToolChoice,
|
|
@@ -4278,7 +4310,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4278
4310
|
...betas,
|
|
4279
4311
|
...toolsBetas,
|
|
4280
4312
|
...userSuppliedBetas,
|
|
4281
|
-
...(
|
|
4313
|
+
...(_h = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _h : []
|
|
4282
4314
|
]),
|
|
4283
4315
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
4284
4316
|
toolNameMapping,
|
|
@@ -4290,15 +4322,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4290
4322
|
betas,
|
|
4291
4323
|
headers
|
|
4292
4324
|
}) {
|
|
4293
|
-
return (0,
|
|
4294
|
-
await (0,
|
|
4325
|
+
return (0, import_provider_utils17.combineHeaders)(
|
|
4326
|
+
await (0, import_provider_utils17.resolve)(this.config.headers),
|
|
4295
4327
|
headers,
|
|
4296
4328
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
4297
4329
|
);
|
|
4298
4330
|
}
|
|
4299
4331
|
async getBetasFromHeaders(requestHeaders) {
|
|
4300
4332
|
var _a, _b;
|
|
4301
|
-
const configHeaders = await (0,
|
|
4333
|
+
const configHeaders = await (0, import_provider_utils17.resolve)(this.config.headers);
|
|
4302
4334
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
4303
4335
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
4304
4336
|
return new Set(
|
|
@@ -4364,12 +4396,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4364
4396
|
responseHeaders,
|
|
4365
4397
|
value: response,
|
|
4366
4398
|
rawValue: rawResponse
|
|
4367
|
-
} = await (0,
|
|
4399
|
+
} = await (0, import_provider_utils17.postJsonToApi)({
|
|
4368
4400
|
url: this.buildRequestUrl(false),
|
|
4369
4401
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
4370
4402
|
body: this.transformRequestBody(args, betas),
|
|
4371
4403
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
4372
|
-
successfulResponseHandler: (0,
|
|
4404
|
+
successfulResponseHandler: (0, import_provider_utils17.createJsonResponseHandler)(
|
|
4373
4405
|
anthropicMessagesResponseSchema
|
|
4374
4406
|
),
|
|
4375
4407
|
abortSignal: options.abortSignal,
|
|
@@ -4884,12 +4916,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4884
4916
|
body.tools
|
|
4885
4917
|
);
|
|
4886
4918
|
const url = this.buildRequestUrl(true);
|
|
4887
|
-
const { responseHeaders, value: response } = await (0,
|
|
4919
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils17.postJsonToApi)({
|
|
4888
4920
|
url,
|
|
4889
4921
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
4890
4922
|
body: this.transformRequestBody(body, betas),
|
|
4891
4923
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
4892
|
-
successfulResponseHandler: (0,
|
|
4924
|
+
successfulResponseHandler: (0, import_provider_utils17.createEventSourceResponseHandler)(
|
|
4893
4925
|
anthropicMessagesChunkSchema
|
|
4894
4926
|
),
|
|
4895
4927
|
abortSignal: options.abortSignal,
|
|
@@ -5435,7 +5467,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5435
5467
|
if (contentBlock.toolset != null) {
|
|
5436
5468
|
let memberInput = {};
|
|
5437
5469
|
try {
|
|
5438
|
-
memberInput = contentBlock.input === "" ? {} : (0,
|
|
5470
|
+
memberInput = contentBlock.input === "" ? {} : (0, import_provider_utils17.secureJsonParse)(contentBlock.input);
|
|
5439
5471
|
} catch (e) {
|
|
5440
5472
|
memberInput = void 0;
|
|
5441
5473
|
}
|
|
@@ -5458,7 +5490,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5458
5490
|
let finalInput = contentBlock.input === "" ? "{}" : contentBlock.input;
|
|
5459
5491
|
if (contentBlock.providerToolName === "code_execution") {
|
|
5460
5492
|
try {
|
|
5461
|
-
const parsed = (0,
|
|
5493
|
+
const parsed = (0, import_provider_utils17.secureJsonParse)(finalInput);
|
|
5462
5494
|
if (parsed != null && typeof parsed === "object" && "code" in parsed && !("type" in parsed)) {
|
|
5463
5495
|
finalInput = JSON.stringify({
|
|
5464
5496
|
type: "programmatic-tool-call",
|
|
@@ -6082,42 +6114,42 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
6082
6114
|
}
|
|
6083
6115
|
|
|
6084
6116
|
// src/tool/bash_20241022.ts
|
|
6085
|
-
var
|
|
6117
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
6086
6118
|
var import_v415 = require("zod/v4");
|
|
6087
|
-
var bash_20241022InputSchema = (0,
|
|
6088
|
-
() => (0,
|
|
6119
|
+
var bash_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
6120
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
6089
6121
|
import_v415.z.object({
|
|
6090
6122
|
command: import_v415.z.string(),
|
|
6091
6123
|
restart: import_v415.z.boolean().optional()
|
|
6092
6124
|
})
|
|
6093
6125
|
)
|
|
6094
6126
|
);
|
|
6095
|
-
var bash_20241022 = (0,
|
|
6127
|
+
var bash_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
6096
6128
|
id: "anthropic.bash_20241022",
|
|
6097
6129
|
inputSchema: bash_20241022InputSchema
|
|
6098
6130
|
});
|
|
6099
6131
|
|
|
6100
6132
|
// src/tool/bash_20250124.ts
|
|
6101
|
-
var
|
|
6133
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
6102
6134
|
var import_v416 = require("zod/v4");
|
|
6103
|
-
var bash_20250124InputSchema = (0,
|
|
6104
|
-
() => (0,
|
|
6135
|
+
var bash_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
6136
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
6105
6137
|
import_v416.z.object({
|
|
6106
6138
|
command: import_v416.z.string(),
|
|
6107
6139
|
restart: import_v416.z.boolean().optional()
|
|
6108
6140
|
})
|
|
6109
6141
|
)
|
|
6110
6142
|
);
|
|
6111
|
-
var bash_20250124 = (0,
|
|
6143
|
+
var bash_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
6112
6144
|
id: "anthropic.bash_20250124",
|
|
6113
6145
|
inputSchema: bash_20250124InputSchema
|
|
6114
6146
|
});
|
|
6115
6147
|
|
|
6116
6148
|
// src/tool/computer_20241022.ts
|
|
6117
|
-
var
|
|
6149
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
6118
6150
|
var import_v417 = require("zod/v4");
|
|
6119
|
-
var computer_20241022InputSchema = (0,
|
|
6120
|
-
() => (0,
|
|
6151
|
+
var computer_20241022InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
6152
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
6121
6153
|
import_v417.z.object({
|
|
6122
6154
|
action: import_v417.z.enum([
|
|
6123
6155
|
"key",
|
|
@@ -6136,16 +6168,16 @@ var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
6136
6168
|
})
|
|
6137
6169
|
)
|
|
6138
6170
|
);
|
|
6139
|
-
var computer_20241022 = (0,
|
|
6171
|
+
var computer_20241022 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
6140
6172
|
id: "anthropic.computer_20241022",
|
|
6141
6173
|
inputSchema: computer_20241022InputSchema
|
|
6142
6174
|
});
|
|
6143
6175
|
|
|
6144
6176
|
// src/tool/computer_20250124.ts
|
|
6145
|
-
var
|
|
6177
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
6146
6178
|
var import_v418 = require("zod/v4");
|
|
6147
|
-
var computer_20250124InputSchema = (0,
|
|
6148
|
-
() => (0,
|
|
6179
|
+
var computer_20250124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
6180
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
6149
6181
|
import_v418.z.object({
|
|
6150
6182
|
action: import_v418.z.enum([
|
|
6151
6183
|
"key",
|
|
@@ -6174,16 +6206,16 @@ var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
6174
6206
|
})
|
|
6175
6207
|
)
|
|
6176
6208
|
);
|
|
6177
|
-
var computer_20250124 = (0,
|
|
6209
|
+
var computer_20250124 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
6178
6210
|
id: "anthropic.computer_20250124",
|
|
6179
6211
|
inputSchema: computer_20250124InputSchema
|
|
6180
6212
|
});
|
|
6181
6213
|
|
|
6182
6214
|
// src/tool/computer_20251124.ts
|
|
6183
|
-
var
|
|
6215
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
6184
6216
|
var import_v419 = require("zod/v4");
|
|
6185
|
-
var computer_20251124InputSchema = (0,
|
|
6186
|
-
() => (0,
|
|
6217
|
+
var computer_20251124InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
6218
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
6187
6219
|
import_v419.z.object({
|
|
6188
6220
|
action: import_v419.z.enum([
|
|
6189
6221
|
"key",
|
|
@@ -6219,16 +6251,16 @@ var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
6219
6251
|
})
|
|
6220
6252
|
)
|
|
6221
6253
|
);
|
|
6222
|
-
var computer_20251124 = (0,
|
|
6254
|
+
var computer_20251124 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
6223
6255
|
id: "anthropic.computer_20251124",
|
|
6224
6256
|
inputSchema: computer_20251124InputSchema
|
|
6225
6257
|
});
|
|
6226
6258
|
|
|
6227
6259
|
// src/tool/memory_20250818.ts
|
|
6228
|
-
var
|
|
6260
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
6229
6261
|
var import_v420 = require("zod/v4");
|
|
6230
|
-
var memory_20250818InputSchema = (0,
|
|
6231
|
-
() => (0,
|
|
6262
|
+
var memory_20250818InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
6263
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
6232
6264
|
import_v420.z.discriminatedUnion("command", [
|
|
6233
6265
|
import_v420.z.object({
|
|
6234
6266
|
command: import_v420.z.literal("view"),
|
|
@@ -6264,16 +6296,16 @@ var memory_20250818InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
|
6264
6296
|
])
|
|
6265
6297
|
)
|
|
6266
6298
|
);
|
|
6267
|
-
var memory_20250818 = (0,
|
|
6299
|
+
var memory_20250818 = (0, import_provider_utils23.createProviderToolFactory)({
|
|
6268
6300
|
id: "anthropic.memory_20250818",
|
|
6269
6301
|
inputSchema: memory_20250818InputSchema
|
|
6270
6302
|
});
|
|
6271
6303
|
|
|
6272
6304
|
// src/tool/text-editor_20241022.ts
|
|
6273
|
-
var
|
|
6305
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
6274
6306
|
var import_v421 = require("zod/v4");
|
|
6275
|
-
var textEditor_20241022InputSchema = (0,
|
|
6276
|
-
() => (0,
|
|
6307
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
6308
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
6277
6309
|
import_v421.z.object({
|
|
6278
6310
|
command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6279
6311
|
path: import_v421.z.string(),
|
|
@@ -6286,16 +6318,16 @@ var textEditor_20241022InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
6286
6318
|
})
|
|
6287
6319
|
)
|
|
6288
6320
|
);
|
|
6289
|
-
var textEditor_20241022 = (0,
|
|
6321
|
+
var textEditor_20241022 = (0, import_provider_utils24.createProviderToolFactory)({
|
|
6290
6322
|
id: "anthropic.text_editor_20241022",
|
|
6291
6323
|
inputSchema: textEditor_20241022InputSchema
|
|
6292
6324
|
});
|
|
6293
6325
|
|
|
6294
6326
|
// src/tool/text-editor_20250124.ts
|
|
6295
|
-
var
|
|
6327
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
6296
6328
|
var import_v422 = require("zod/v4");
|
|
6297
|
-
var textEditor_20250124InputSchema = (0,
|
|
6298
|
-
() => (0,
|
|
6329
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
6330
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
6299
6331
|
import_v422.z.object({
|
|
6300
6332
|
command: import_v422.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6301
6333
|
path: import_v422.z.string(),
|
|
@@ -6308,16 +6340,16 @@ var textEditor_20250124InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
6308
6340
|
})
|
|
6309
6341
|
)
|
|
6310
6342
|
);
|
|
6311
|
-
var textEditor_20250124 = (0,
|
|
6343
|
+
var textEditor_20250124 = (0, import_provider_utils25.createProviderToolFactory)({
|
|
6312
6344
|
id: "anthropic.text_editor_20250124",
|
|
6313
6345
|
inputSchema: textEditor_20250124InputSchema
|
|
6314
6346
|
});
|
|
6315
6347
|
|
|
6316
6348
|
// src/tool/text-editor_20250429.ts
|
|
6317
|
-
var
|
|
6349
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
6318
6350
|
var import_v423 = require("zod/v4");
|
|
6319
|
-
var textEditor_20250429InputSchema = (0,
|
|
6320
|
-
() => (0,
|
|
6351
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils26.lazySchema)(
|
|
6352
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
6321
6353
|
import_v423.z.object({
|
|
6322
6354
|
command: import_v423.z.enum(["view", "create", "str_replace", "insert"]),
|
|
6323
6355
|
path: import_v423.z.string(),
|
|
@@ -6330,16 +6362,16 @@ var textEditor_20250429InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
6330
6362
|
})
|
|
6331
6363
|
)
|
|
6332
6364
|
);
|
|
6333
|
-
var textEditor_20250429 = (0,
|
|
6365
|
+
var textEditor_20250429 = (0, import_provider_utils26.createProviderToolFactory)({
|
|
6334
6366
|
id: "anthropic.text_editor_20250429",
|
|
6335
6367
|
inputSchema: textEditor_20250429InputSchema
|
|
6336
6368
|
});
|
|
6337
6369
|
|
|
6338
6370
|
// src/tool/tool-search-bm25_20251119.ts
|
|
6339
|
-
var
|
|
6371
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
6340
6372
|
var import_v424 = require("zod/v4");
|
|
6341
|
-
var toolSearchBm25_20251119OutputSchema = (0,
|
|
6342
|
-
() => (0,
|
|
6373
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
6374
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
6343
6375
|
import_v424.z.array(
|
|
6344
6376
|
import_v424.z.object({
|
|
6345
6377
|
type: import_v424.z.literal("tool_reference"),
|
|
@@ -6348,8 +6380,8 @@ var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils26.lazySchema
|
|
|
6348
6380
|
)
|
|
6349
6381
|
)
|
|
6350
6382
|
);
|
|
6351
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
6352
|
-
() => (0,
|
|
6383
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils27.lazySchema)(
|
|
6384
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
6353
6385
|
import_v424.z.object({
|
|
6354
6386
|
/**
|
|
6355
6387
|
* A natural language query to search for tools.
|
|
@@ -6363,7 +6395,7 @@ var toolSearchBm25_20251119InputSchema = (0, import_provider_utils26.lazySchema)
|
|
|
6363
6395
|
})
|
|
6364
6396
|
)
|
|
6365
6397
|
);
|
|
6366
|
-
var factory11 = (0,
|
|
6398
|
+
var factory11 = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
6367
6399
|
id: "anthropic.tool_search_bm25_20251119",
|
|
6368
6400
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
6369
6401
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|