@ai-sdk/anthropic 2.0.109 → 2.0.110

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/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  } from "@ai-sdk/provider-utils";
12
12
 
13
13
  // src/version.ts
14
- var VERSION = true ? "2.0.109" : "0.0.0-test";
14
+ var VERSION = true ? "2.0.110" : "0.0.0-test";
15
15
 
16
16
  // src/anthropic-messages-language-model.ts
17
17
  import {
@@ -57,7 +57,7 @@ import {
57
57
  zodSchema as zodSchema2
58
58
  } from "@ai-sdk/provider-utils";
59
59
  import { z as z2 } from "zod/v4";
60
- var anthropicStopDetailsSchema = z2.object({
60
+ var anthropicStopDetailsSchema = () => z2.object({
61
61
  type: z2.string(),
62
62
  category: z2.string().nullish(),
63
63
  explanation: z2.string().nullish(),
@@ -263,7 +263,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
263
263
  ),
264
264
  stop_reason: z2.string().nullish(),
265
265
  stop_sequence: z2.string().nullish(),
266
- stop_details: anthropicStopDetailsSchema.nullish(),
266
+ stop_details: anthropicStopDetailsSchema().nullish(),
267
267
  usage: z2.looseObject({
268
268
  input_tokens: z2.number(),
269
269
  output_tokens: z2.number(),
@@ -567,7 +567,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
567
567
  delta: z2.object({
568
568
  stop_reason: z2.string().nullish(),
569
569
  stop_sequence: z2.string().nullish(),
570
- stop_details: anthropicStopDetailsSchema.nullish(),
570
+ stop_details: anthropicStopDetailsSchema().nullish(),
571
571
  container: z2.object({
572
572
  expires_at: z2.string(),
573
573
  id: z2.string(),
@@ -643,314 +643,330 @@ var anthropicReasoningMetadataSchema = lazySchema2(
643
643
  );
644
644
 
645
645
  // src/anthropic-messages-options.ts
646
+ import {
647
+ lazySchema as lazySchema3,
648
+ zodSchema as zodSchema3
649
+ } from "@ai-sdk/provider-utils";
646
650
  import { z as z3 } from "zod/v4";
647
- var anthropicFilePartProviderOptions = z3.object({
648
- /**
649
- * Citation configuration for this document.
650
- * When enabled, this document will generate citations in the response.
651
- */
652
- citations: z3.object({
653
- /**
654
- * Enable citations for this document
655
- */
656
- enabled: z3.boolean()
657
- }).optional(),
658
- /**
659
- * Custom title for the document.
660
- * If not provided, the filename will be used.
661
- */
662
- title: z3.string().optional(),
663
- /**
664
- * Context about the document that will be passed to the model
665
- * but not used towards cited content.
666
- * Useful for storing document metadata as text or stringified JSON.
667
- */
668
- context: z3.string().optional()
669
- });
670
- var anthropicSystemMessageProviderOptions = z3.object({
671
- /**
672
- * Controls when a mid-conversation system message is cleared.
673
- *
674
- * The value is forwarded to Anthropic as `clear_at`. The required
675
- * `mid-conversation-system-clear-at-2026-08-21` beta is added automatically.
676
- */
677
- clearAt: z3.literal("next_user_message").optional(),
678
- /**
679
- * Sets the model effort from the next user turn until a later message
680
- * changes it. An effort-only system message with empty content can appear
681
- * first. The required `mid-conversation-output-config-2026-07-01` beta is
682
- * added automatically.
683
- */
684
- effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
685
- /**
686
- * Mid-conversation tool changes. Adds or removes tools from the
687
- * conversation's tool set between turns without invalidating the prompt
688
- * cache.
689
- *
690
- * Only supported on system messages that appear mid-conversation (not the
691
- * initial system prompt). A system message carrying tool changes must come
692
- * right before an assistant message or at the end of the messages.
693
- *
694
- * Tools referenced by a `tool_addition` must be declared in the `tools`
695
- * option (typically with `deferLoading: true` so they are not loaded until
696
- * the addition surfaces them). The required
697
- * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
698
- */
699
- toolChanges: z3.array(
700
- z3.discriminatedUnion("type", [
701
- z3.object({
702
- type: z3.literal("tool_addition"),
703
- toolName: z3.string()
704
- }),
705
- z3.object({
706
- type: z3.literal("tool_removal"),
707
- toolName: z3.string()
708
- })
709
- ])
710
- ).optional()
711
- });
712
- var anthropicThinkingBlockBinding = z3.object({
713
- /**
714
- * Controls behavior when a replayed thinking block does not match its
715
- * conversation prefix. The `drop_block` behavior drops the mismatched block
716
- * instead of returning an invalid signature error.
717
- */
718
- prefixMismatchBehavior: z3.literal("drop_block")
719
- });
720
- var anthropicProviderOptions = z3.object({
721
- /**
722
- * Whether to send reasoning to the model.
723
- *
724
- * This allows you to deactivate reasoning inputs for models that do not support them.
725
- */
726
- sendReasoning: z3.boolean().optional(),
727
- /**
728
- * Determines how structured outputs are generated.
729
- *
730
- * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
731
- * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
732
- * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Sonnet 5.5, Opus 5.5, and Fable 5.1).
733
- */
734
- structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
735
- /**
736
- * Configuration for enabling Claude's extended thinking.
737
- *
738
- * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
739
- * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
740
- *
741
- * Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
742
- * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
743
- * provider drops the unsupported setting, emits a warning, and sends an
744
- * adaptive thinking request. Use `effort` to control how much they think.
745
- *
746
- * `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
747
- * and the provider uses it in place of `disabled` for that model.
748
- */
749
- thinking: z3.union([
651
+ var anthropicFilePartProviderOptions = lazySchema3(
652
+ () => zodSchema3(
750
653
  z3.object({
751
- /** for Sonnet 4.6, Opus 4.6, and newer models */
752
- type: z3.literal("adaptive"),
753
654
  /**
754
- * Controls whether thinking content is included in the response.
755
- * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
756
- * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
757
- * - `"updates"`: Thinking summaries are emitted between tool calls.
655
+ * Citation configuration for this document.
656
+ * When enabled, this document will generate citations in the response.
758
657
  */
759
- display: z3.enum(["omitted", "summarized", "updates"]).optional(),
658
+ citations: z3.object({
659
+ /**
660
+ * Enable citations for this document
661
+ */
662
+ enabled: z3.boolean()
663
+ }).optional(),
760
664
  /**
761
- * Controls handling for thinking blocks whose conversation prefix no
762
- * longer matches. Forwarded as `block_binding`.
665
+ * Custom title for the document.
666
+ * If not provided, the filename will be used.
763
667
  */
764
- blockBinding: anthropicThinkingBlockBinding.optional()
765
- }),
766
- z3.object({
767
- /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
768
- type: z3.literal("enabled"),
769
- budgetTokens: z3.number().optional(),
668
+ title: z3.string().optional(),
770
669
  /**
771
- * Controls handling for thinking blocks whose conversation prefix no
772
- * longer matches. Forwarded as `block_binding`.
670
+ * Context about the document that will be passed to the model
671
+ * but not used towards cited content.
672
+ * Useful for storing document metadata as text or stringified JSON.
773
673
  */
774
- blockBinding: anthropicThinkingBlockBinding.optional()
775
- }),
776
- z3.object({
777
- type: z3.literal("disabled")
778
- }),
674
+ context: z3.string().optional()
675
+ })
676
+ )
677
+ );
678
+ var anthropicSystemMessageProviderOptions = lazySchema3(
679
+ () => zodSchema3(
779
680
  z3.object({
780
681
  /**
781
- * for `claude-sonnet-5-5`: no upfront thinking, but progress notes
782
- * between tool calls are returned as summarized thinking blocks.
783
- * Only supported at `low`, `medium`, and `high` effort.
682
+ * Controls when a mid-conversation system message is cleared.
683
+ *
684
+ * The value is forwarded to Anthropic as `clear_at`. The required
685
+ * `mid-conversation-system-clear-at-2026-08-21` beta is added automatically.
784
686
  */
785
- type: z3.literal("between_tools")
786
- }),
787
- z3.object({
687
+ clearAt: z3.literal("next_user_message").optional(),
788
688
  /**
789
- * Configure prefix mismatch handling without changing the model's
790
- * default thinking mode.
689
+ * Sets the model effort from the next user turn until a later message
690
+ * changes it. An effort-only system message with empty content can appear
691
+ * first. The required `mid-conversation-output-config-2026-07-01` beta is
692
+ * added automatically.
791
693
  */
792
- blockBinding: anthropicThinkingBlockBinding
694
+ effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
695
+ /**
696
+ * Mid-conversation tool changes. Adds or removes tools from the
697
+ * conversation's tool set between turns without invalidating the prompt
698
+ * cache.
699
+ *
700
+ * Only supported on system messages that appear mid-conversation (not the
701
+ * initial system prompt). A system message carrying tool changes must come
702
+ * right before an assistant message or at the end of the messages.
703
+ *
704
+ * Tools referenced by a `tool_addition` must be declared in the `tools`
705
+ * option (typically with `deferLoading: true` so they are not loaded until
706
+ * the addition surfaces them). The required
707
+ * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
708
+ */
709
+ toolChanges: z3.array(
710
+ z3.discriminatedUnion("type", [
711
+ z3.object({
712
+ type: z3.literal("tool_addition"),
713
+ toolName: z3.string()
714
+ }),
715
+ z3.object({
716
+ type: z3.literal("tool_removal"),
717
+ toolName: z3.string()
718
+ })
719
+ ])
720
+ ).optional()
793
721
  })
794
- ]).optional(),
795
- /**
796
- * Whether to disable parallel function calling during tool use. Default is false.
797
- * When set to true, Claude will use at most one tool per response.
798
- */
799
- disableParallelToolUse: z3.boolean().optional(),
800
- /**
801
- * Cache control settings for this message.
802
- * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
803
- */
804
- cacheControl: z3.object({
805
- type: z3.literal("ephemeral"),
806
- ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
807
- }).optional(),
808
- /**
809
- * Metadata to include with the request.
810
- *
811
- * See https://platform.claude.com/docs/en/api/messages/create for details.
812
- */
813
- metadata: z3.object({
722
+ )
723
+ );
724
+ var anthropicProviderOptions = lazySchema3(() => {
725
+ const anthropicThinkingBlockBinding = z3.object({
814
726
  /**
815
- * An external identifier for the user associated with the request.
816
- *
817
- * Should be a UUID, hash value, or other opaque identifier.
818
- * Must not contain PII (name, email, phone number, etc.).
727
+ * Controls behavior when a replayed thinking block does not match its
728
+ * conversation prefix. The `drop_block` behavior drops the mismatched block
729
+ * instead of returning an invalid signature error.
819
730
  */
820
- userId: z3.string().optional()
821
- }).optional(),
822
- /**
823
- * Agent Skills configuration. Skills enable Claude to perform specialized tasks
824
- * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
825
- * Requires code execution tool to be enabled.
826
- */
827
- container: z3.object({
828
- id: z3.string().optional(),
829
- skills: z3.array(
830
- z3.object({
831
- type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
832
- skillId: z3.string(),
833
- version: z3.string().optional()
834
- })
835
- ).optional()
836
- }).optional(),
837
- /**
838
- * @default 'high'
839
- */
840
- effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
841
- /**
842
- * Task budget for agentic turns. Informs the model of the total token budget
843
- * available for the current task, allowing it to prioritize work and wind down
844
- * gracefully as the budget is consumed.
845
- *
846
- * Advisory only — does not enforce a hard token limit.
847
- */
848
- taskBudget: z3.object({
849
- type: z3.literal("tokens"),
850
- total: z3.number().int().min(2e4),
851
- remaining: z3.number().int().min(0).optional()
852
- }).optional(),
853
- /**
854
- * Enable fast mode for faster inference (2.5x faster output token speeds).
855
- * Only supported with claude-opus-4-6.
856
- */
857
- speed: z3.enum(["fast", "standard"]).optional(),
858
- /**
859
- * Controls where model inference runs for this request.
860
- *
861
- * - `"global"`: Inference may run in any available geography (default).
862
- * - `"us"`: Inference runs only in US-based infrastructure.
863
- *
864
- * See https://platform.claude.com/docs/en/build-with-claude/data-residency
865
- */
866
- inferenceGeo: z3.enum(["us", "global"]).optional(),
867
- /**
868
- * Server-side fallback configuration.
869
- *
870
- * When the primary model's safety classifiers block a turn, the API
871
- * automatically retries it server-side on a fallback model. A
872
- * `content-filter` finish reason means the fallback(s) refused as well.
873
- *
874
- * - `'default'` (recommended): the API routes the retry to Anthropic's
875
- * recommended fallback model based on the refusal category. Requires the
876
- * `server-side-fallback-2026-07-01` beta, which is added automatically.
877
- * - Array form: an explicit fallback chain. Each entry is merged into the
878
- * request as a direct request to that entry's model, so it must be
879
- * formatted accordingly: `model` is required, and an entry may
880
- * additionally override `max_tokens`, `thinking`, `output_config`, and
881
- * `speed` for that attempt only (`speed` additionally requires the speed
882
- * beta). The value is passed through to the API as-is, and the
883
- * `server-side-fallback-2026-06-01` beta is added automatically.
884
- */
885
- fallbacks: z3.union([
886
- z3.literal("default"),
887
- z3.array(
888
- z3.object({
889
- model: z3.string(),
890
- max_tokens: z3.number().int().optional(),
891
- thinking: z3.record(z3.string(), z3.unknown()).optional(),
892
- output_config: z3.record(z3.string(), z3.unknown()).optional(),
893
- speed: z3.enum(["fast", "standard"]).optional()
894
- })
895
- )
896
- ]).optional(),
897
- /**
898
- * Context management configuration for automatic context window management.
899
- * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
900
- */
901
- contextManagement: z3.object({
902
- edits: z3.array(
903
- z3.discriminatedUnion("type", [
731
+ prefixMismatchBehavior: z3.literal("drop_block")
732
+ });
733
+ return zodSchema3(
734
+ z3.object({
735
+ /**
736
+ * Whether to send reasoning to the model.
737
+ *
738
+ * This allows you to deactivate reasoning inputs for models that do not support them.
739
+ */
740
+ sendReasoning: z3.boolean().optional(),
741
+ /**
742
+ * Determines how structured outputs are generated.
743
+ *
744
+ * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
745
+ * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
746
+ * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Sonnet 5.5, Opus 5.5, and Fable 5.1).
747
+ */
748
+ structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
749
+ /**
750
+ * Configuration for enabling Claude's extended thinking.
751
+ *
752
+ * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
753
+ * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
754
+ *
755
+ * Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
756
+ * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
757
+ * provider drops the unsupported setting, emits a warning, and sends an
758
+ * adaptive thinking request. Use `effort` to control how much they think.
759
+ *
760
+ * `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
761
+ * and the provider uses it in place of `disabled` for that model.
762
+ */
763
+ thinking: z3.union([
904
764
  z3.object({
905
- type: z3.literal("clear_tool_uses_20250919"),
906
- trigger: z3.discriminatedUnion("type", [
907
- z3.object({
908
- type: z3.literal("input_tokens"),
909
- value: z3.number()
910
- }),
911
- z3.object({
912
- type: z3.literal("tool_uses"),
913
- value: z3.number()
914
- })
915
- ]).optional(),
916
- keep: z3.object({
917
- type: z3.literal("tool_uses"),
918
- value: z3.number()
919
- }).optional(),
920
- clearAtLeast: z3.object({
921
- type: z3.literal("input_tokens"),
922
- value: z3.number()
923
- }).optional(),
924
- clearToolInputs: z3.boolean().optional(),
925
- excludeTools: z3.array(z3.string()).optional()
765
+ /** for Sonnet 4.6, Opus 4.6, and newer models */
766
+ type: z3.literal("adaptive"),
767
+ /**
768
+ * Controls whether thinking content is included in the response.
769
+ * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
770
+ * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
771
+ * - `"updates"`: Thinking summaries are emitted between tool calls.
772
+ */
773
+ display: z3.enum(["omitted", "summarized", "updates"]).optional(),
774
+ /**
775
+ * Controls handling for thinking blocks whose conversation prefix no
776
+ * longer matches. Forwarded as `block_binding`.
777
+ */
778
+ blockBinding: anthropicThinkingBlockBinding.optional()
926
779
  }),
927
780
  z3.object({
928
- type: z3.literal("clear_thinking_20251015"),
929
- keep: z3.union([
930
- z3.literal("all"),
931
- z3.object({
932
- type: z3.literal("thinking_turns"),
933
- value: z3.number()
934
- })
935
- ]).optional()
781
+ /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
782
+ type: z3.literal("enabled"),
783
+ budgetTokens: z3.number().optional(),
784
+ /**
785
+ * Controls handling for thinking blocks whose conversation prefix no
786
+ * longer matches. Forwarded as `block_binding`.
787
+ */
788
+ blockBinding: anthropicThinkingBlockBinding.optional()
789
+ }),
790
+ z3.object({
791
+ type: z3.literal("disabled")
792
+ }),
793
+ z3.object({
794
+ /**
795
+ * for `claude-sonnet-5-5`: no upfront thinking, but progress notes
796
+ * between tool calls are returned as summarized thinking blocks.
797
+ * Only supported at `low`, `medium`, and `high` effort.
798
+ */
799
+ type: z3.literal("between_tools")
936
800
  }),
937
801
  z3.object({
938
- type: z3.literal("compact_20260112"),
939
- trigger: z3.object({
940
- type: z3.literal("input_tokens"),
941
- value: z3.number()
942
- }).optional(),
943
- pauseAfterCompaction: z3.boolean().optional(),
944
- instructions: z3.string().optional()
802
+ /**
803
+ * Configure prefix mismatch handling without changing the model's
804
+ * default thinking mode.
805
+ */
806
+ blockBinding: anthropicThinkingBlockBinding
945
807
  })
946
- ])
947
- )
948
- }).optional(),
949
- /**
950
- * A set of beta features to enable.
951
- * Allow a provider to receive the full `betas` set if it needs it.
952
- */
953
- anthropicBeta: z3.array(z3.string()).optional()
808
+ ]).optional(),
809
+ /**
810
+ * Whether to disable parallel function calling during tool use. Default is false.
811
+ * When set to true, Claude will use at most one tool per response.
812
+ */
813
+ disableParallelToolUse: z3.boolean().optional(),
814
+ /**
815
+ * Cache control settings for this message.
816
+ * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
817
+ */
818
+ cacheControl: z3.object({
819
+ type: z3.literal("ephemeral"),
820
+ ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
821
+ }).optional(),
822
+ /**
823
+ * Metadata to include with the request.
824
+ *
825
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
826
+ */
827
+ metadata: z3.object({
828
+ /**
829
+ * An external identifier for the user associated with the request.
830
+ *
831
+ * Should be a UUID, hash value, or other opaque identifier.
832
+ * Must not contain PII (name, email, phone number, etc.).
833
+ */
834
+ userId: z3.string().optional()
835
+ }).optional(),
836
+ /**
837
+ * Agent Skills configuration. Skills enable Claude to perform specialized tasks
838
+ * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
839
+ * Requires code execution tool to be enabled.
840
+ */
841
+ container: z3.object({
842
+ id: z3.string().optional(),
843
+ skills: z3.array(
844
+ z3.object({
845
+ type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
846
+ skillId: z3.string(),
847
+ version: z3.string().optional()
848
+ })
849
+ ).optional()
850
+ }).optional(),
851
+ /**
852
+ * @default 'high'
853
+ */
854
+ effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
855
+ /**
856
+ * Task budget for agentic turns. Informs the model of the total token budget
857
+ * available for the current task, allowing it to prioritize work and wind down
858
+ * gracefully as the budget is consumed.
859
+ *
860
+ * Advisory only — does not enforce a hard token limit.
861
+ */
862
+ taskBudget: z3.object({
863
+ type: z3.literal("tokens"),
864
+ total: z3.number().int().min(2e4),
865
+ remaining: z3.number().int().min(0).optional()
866
+ }).optional(),
867
+ /**
868
+ * Enable fast mode for faster inference (2.5x faster output token speeds).
869
+ * Only supported with claude-opus-4-6.
870
+ */
871
+ speed: z3.enum(["fast", "standard"]).optional(),
872
+ /**
873
+ * Controls where model inference runs for this request.
874
+ *
875
+ * - `"global"`: Inference may run in any available geography (default).
876
+ * - `"us"`: Inference runs only in US-based infrastructure.
877
+ *
878
+ * See https://platform.claude.com/docs/en/build-with-claude/data-residency
879
+ */
880
+ inferenceGeo: z3.enum(["us", "global"]).optional(),
881
+ /**
882
+ * Server-side fallback configuration.
883
+ *
884
+ * When the primary model's safety classifiers block a turn, the API
885
+ * automatically retries it server-side on a fallback model. A
886
+ * `content-filter` finish reason means the fallback(s) refused as well.
887
+ *
888
+ * - `'default'` (recommended): the API routes the retry to Anthropic's
889
+ * recommended fallback model based on the refusal category. Requires the
890
+ * `server-side-fallback-2026-07-01` beta, which is added automatically.
891
+ * - Array form: an explicit fallback chain. Each entry is merged into the
892
+ * request as a direct request to that entry's model, so it must be
893
+ * formatted accordingly: `model` is required, and an entry may
894
+ * additionally override `max_tokens`, `thinking`, `output_config`, and
895
+ * `speed` for that attempt only (`speed` additionally requires the speed
896
+ * beta). The value is passed through to the API as-is, and the
897
+ * `server-side-fallback-2026-06-01` beta is added automatically.
898
+ */
899
+ fallbacks: z3.union([
900
+ z3.literal("default"),
901
+ z3.array(
902
+ z3.object({
903
+ model: z3.string(),
904
+ max_tokens: z3.number().int().optional(),
905
+ thinking: z3.record(z3.string(), z3.unknown()).optional(),
906
+ output_config: z3.record(z3.string(), z3.unknown()).optional(),
907
+ speed: z3.enum(["fast", "standard"]).optional()
908
+ })
909
+ )
910
+ ]).optional(),
911
+ /**
912
+ * Context management configuration for automatic context window management.
913
+ * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
914
+ */
915
+ contextManagement: z3.object({
916
+ edits: z3.array(
917
+ z3.discriminatedUnion("type", [
918
+ z3.object({
919
+ type: z3.literal("clear_tool_uses_20250919"),
920
+ trigger: z3.discriminatedUnion("type", [
921
+ z3.object({
922
+ type: z3.literal("input_tokens"),
923
+ value: z3.number()
924
+ }),
925
+ z3.object({
926
+ type: z3.literal("tool_uses"),
927
+ value: z3.number()
928
+ })
929
+ ]).optional(),
930
+ keep: z3.object({
931
+ type: z3.literal("tool_uses"),
932
+ value: z3.number()
933
+ }).optional(),
934
+ clearAtLeast: z3.object({
935
+ type: z3.literal("input_tokens"),
936
+ value: z3.number()
937
+ }).optional(),
938
+ clearToolInputs: z3.boolean().optional(),
939
+ excludeTools: z3.array(z3.string()).optional()
940
+ }),
941
+ z3.object({
942
+ type: z3.literal("clear_thinking_20251015"),
943
+ keep: z3.union([
944
+ z3.literal("all"),
945
+ z3.object({
946
+ type: z3.literal("thinking_turns"),
947
+ value: z3.number()
948
+ })
949
+ ]).optional()
950
+ }),
951
+ z3.object({
952
+ type: z3.literal("compact_20260112"),
953
+ trigger: z3.object({
954
+ type: z3.literal("input_tokens"),
955
+ value: z3.number()
956
+ }).optional(),
957
+ pauseAfterCompaction: z3.boolean().optional(),
958
+ instructions: z3.string().optional()
959
+ })
960
+ ])
961
+ )
962
+ }).optional(),
963
+ /**
964
+ * A set of beta features to enable.
965
+ * Allow a provider to receive the full `betas` set if it needs it.
966
+ */
967
+ anthropicBeta: z3.array(z3.string()).optional()
968
+ })
969
+ );
954
970
  });
955
971
 
956
972
  // src/anthropic-prepare-tools.ts
@@ -1003,8 +1019,8 @@ var CacheControlValidator = class {
1003
1019
  // src/tool/computer-toolset_20260801.ts
1004
1020
  import {
1005
1021
  createProviderDefinedToolFactory,
1006
- lazySchema as lazySchema3,
1007
- zodSchema as zodSchema3
1022
+ lazySchema as lazySchema4,
1023
+ zodSchema as zodSchema4
1008
1024
  } from "@ai-sdk/provider-utils";
1009
1025
  import { z as z4 } from "zod/v4";
1010
1026
  var computerToolset_20260801Members = [
@@ -1026,8 +1042,8 @@ var computerToolset_20260801Members = [
1026
1042
  "hold_key",
1027
1043
  "wait"
1028
1044
  ];
1029
- var computerToolset_20260801InputSchema = lazySchema3(
1030
- () => zodSchema3(
1045
+ var computerToolset_20260801InputSchema = lazySchema4(
1046
+ () => zodSchema4(
1031
1047
  z4.object({
1032
1048
  action: z4.enum(computerToolset_20260801Members),
1033
1049
  coordinate: z4.tuple([z4.number().int(), z4.number().int()]).optional(),
@@ -1046,8 +1062,8 @@ var computerToolset_20260801InputSchema = lazySchema3(
1046
1062
  })
1047
1063
  )
1048
1064
  );
1049
- var computerToolset_20260801ArgsSchema = lazySchema3(
1050
- () => zodSchema3(
1065
+ var computerToolset_20260801ArgsSchema = lazySchema4(
1066
+ () => zodSchema4(
1051
1067
  z4.object({
1052
1068
  configs: z4.partialRecord(
1053
1069
  z4.enum(computerToolset_20260801Members),
@@ -1068,19 +1084,19 @@ var computerToolset_20260801 = createProviderDefinedToolFactory({
1068
1084
  // src/tool/text-editor_20250728.ts
1069
1085
  import {
1070
1086
  createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
1071
- lazySchema as lazySchema4,
1072
- zodSchema as zodSchema4
1087
+ lazySchema as lazySchema5,
1088
+ zodSchema as zodSchema5
1073
1089
  } from "@ai-sdk/provider-utils";
1074
1090
  import { z as z5 } from "zod/v4";
1075
- var textEditor_20250728ArgsSchema = lazySchema4(
1076
- () => zodSchema4(
1091
+ var textEditor_20250728ArgsSchema = lazySchema5(
1092
+ () => zodSchema5(
1077
1093
  z5.object({
1078
1094
  maxCharacters: z5.number().optional()
1079
1095
  })
1080
1096
  )
1081
1097
  );
1082
- var textEditor_20250728InputSchema = lazySchema4(
1083
- () => zodSchema4(
1098
+ var textEditor_20250728InputSchema = lazySchema5(
1099
+ () => zodSchema5(
1084
1100
  z5.object({
1085
1101
  command: z5.enum(["view", "create", "str_replace", "insert"]),
1086
1102
  path: z5.string(),
@@ -1104,12 +1120,12 @@ var textEditor_20250728 = (args = {}) => {
1104
1120
  // src/tool/web-search_20250305.ts
1105
1121
  import {
1106
1122
  createProviderDefinedToolFactoryWithOutputSchema,
1107
- lazySchema as lazySchema5,
1108
- zodSchema as zodSchema5
1123
+ lazySchema as lazySchema6,
1124
+ zodSchema as zodSchema6
1109
1125
  } from "@ai-sdk/provider-utils";
1110
1126
  import { z as z6 } from "zod/v4";
1111
- var webSearch_20250305ArgsSchema = lazySchema5(
1112
- () => zodSchema5(
1127
+ var webSearch_20250305ArgsSchema = lazySchema6(
1128
+ () => zodSchema6(
1113
1129
  z6.object({
1114
1130
  maxUses: z6.number().optional(),
1115
1131
  allowedDomains: z6.array(z6.string()).optional(),
@@ -1124,8 +1140,8 @@ var webSearch_20250305ArgsSchema = lazySchema5(
1124
1140
  })
1125
1141
  )
1126
1142
  );
1127
- var webSearch_20250305OutputSchema = lazySchema5(
1128
- () => zodSchema5(
1143
+ var webSearch_20250305OutputSchema = lazySchema6(
1144
+ () => zodSchema6(
1129
1145
  z6.array(
1130
1146
  z6.object({
1131
1147
  url: z6.string(),
@@ -1137,8 +1153,8 @@ var webSearch_20250305OutputSchema = lazySchema5(
1137
1153
  )
1138
1154
  )
1139
1155
  );
1140
- var webSearch_20250305InputSchema = lazySchema5(
1141
- () => zodSchema5(
1156
+ var webSearch_20250305InputSchema = lazySchema6(
1157
+ () => zodSchema6(
1142
1158
  z6.object({
1143
1159
  query: z6.string()
1144
1160
  })
@@ -1157,12 +1173,12 @@ var webSearch_20250305 = (args = {}) => {
1157
1173
  // src/tool/web-fetch-20250910.ts
1158
1174
  import {
1159
1175
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
1160
- lazySchema as lazySchema6,
1161
- zodSchema as zodSchema6
1176
+ lazySchema as lazySchema7,
1177
+ zodSchema as zodSchema7
1162
1178
  } from "@ai-sdk/provider-utils";
1163
1179
  import { z as z7 } from "zod/v4";
1164
- var webFetch_20250910ArgsSchema = lazySchema6(
1165
- () => zodSchema6(
1180
+ var webFetch_20250910ArgsSchema = lazySchema7(
1181
+ () => zodSchema7(
1166
1182
  z7.object({
1167
1183
  maxUses: z7.number().optional(),
1168
1184
  allowedDomains: z7.array(z7.string()).optional(),
@@ -1172,8 +1188,8 @@ var webFetch_20250910ArgsSchema = lazySchema6(
1172
1188
  })
1173
1189
  )
1174
1190
  );
1175
- var webFetch_20250910OutputSchema = lazySchema6(
1176
- () => zodSchema6(
1191
+ var webFetch_20250910OutputSchema = lazySchema7(
1192
+ () => zodSchema7(
1177
1193
  z7.object({
1178
1194
  type: z7.literal("web_fetch_result"),
1179
1195
  url: z7.string(),
@@ -1198,8 +1214,8 @@ var webFetch_20250910OutputSchema = lazySchema6(
1198
1214
  })
1199
1215
  )
1200
1216
  );
1201
- var webFetch_20250910InputSchema = lazySchema6(
1202
- () => zodSchema6(
1217
+ var webFetch_20250910InputSchema = lazySchema7(
1218
+ () => zodSchema7(
1203
1219
  z7.object({
1204
1220
  url: z7.string()
1205
1221
  })
@@ -1538,12 +1554,12 @@ import {
1538
1554
  // src/tool/code-execution_20250522.ts
1539
1555
  import {
1540
1556
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
1541
- lazySchema as lazySchema7,
1542
- zodSchema as zodSchema7
1557
+ lazySchema as lazySchema8,
1558
+ zodSchema as zodSchema8
1543
1559
  } from "@ai-sdk/provider-utils";
1544
1560
  import { z as z8 } from "zod/v4";
1545
- var codeExecution_20250522OutputSchema = lazySchema7(
1546
- () => zodSchema7(
1561
+ var codeExecution_20250522OutputSchema = lazySchema8(
1562
+ () => zodSchema8(
1547
1563
  z8.object({
1548
1564
  type: z8.literal("code_execution_result"),
1549
1565
  stdout: z8.string(),
@@ -1552,8 +1568,8 @@ var codeExecution_20250522OutputSchema = lazySchema7(
1552
1568
  })
1553
1569
  )
1554
1570
  );
1555
- var codeExecution_20250522InputSchema = lazySchema7(
1556
- () => zodSchema7(
1571
+ var codeExecution_20250522InputSchema = lazySchema8(
1572
+ () => zodSchema8(
1557
1573
  z8.object({
1558
1574
  code: z8.string()
1559
1575
  })
@@ -1572,12 +1588,12 @@ var codeExecution_20250522 = (args = {}) => {
1572
1588
  // src/tool/code-execution_20250825.ts
1573
1589
  import {
1574
1590
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
1575
- lazySchema as lazySchema8,
1576
- zodSchema as zodSchema8
1591
+ lazySchema as lazySchema9,
1592
+ zodSchema as zodSchema9
1577
1593
  } from "@ai-sdk/provider-utils";
1578
1594
  import { z as z9 } from "zod/v4";
1579
- var codeExecution_20250825OutputSchema = lazySchema8(
1580
- () => zodSchema8(
1595
+ var codeExecution_20250825OutputSchema = lazySchema9(
1596
+ () => zodSchema9(
1581
1597
  z9.discriminatedUnion("type", [
1582
1598
  z9.object({
1583
1599
  type: z9.literal("bash_code_execution_result"),
@@ -1622,8 +1638,8 @@ var codeExecution_20250825OutputSchema = lazySchema8(
1622
1638
  ])
1623
1639
  )
1624
1640
  );
1625
- var codeExecution_20250825InputSchema = lazySchema8(
1626
- () => zodSchema8(
1641
+ var codeExecution_20250825InputSchema = lazySchema9(
1642
+ () => zodSchema9(
1627
1643
  z9.discriminatedUnion("type", [
1628
1644
  z9.object({
1629
1645
  type: z9.literal("bash_code_execution"),
@@ -4374,12 +4390,12 @@ function mapAnthropicStopDetails(stopDetails) {
4374
4390
  // src/tool/bash_20241022.ts
4375
4391
  import {
4376
4392
  createProviderDefinedToolFactory as createProviderDefinedToolFactory3,
4377
- lazySchema as lazySchema9,
4378
- zodSchema as zodSchema9
4393
+ lazySchema as lazySchema10,
4394
+ zodSchema as zodSchema10
4379
4395
  } from "@ai-sdk/provider-utils";
4380
4396
  import { z as z10 } from "zod/v4";
4381
- var bash_20241022InputSchema = lazySchema9(
4382
- () => zodSchema9(
4397
+ var bash_20241022InputSchema = lazySchema10(
4398
+ () => zodSchema10(
4383
4399
  z10.object({
4384
4400
  command: z10.string(),
4385
4401
  restart: z10.boolean().optional()
@@ -4395,12 +4411,12 @@ var bash_20241022 = createProviderDefinedToolFactory3({
4395
4411
  // src/tool/bash_20250124.ts
4396
4412
  import {
4397
4413
  createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
4398
- lazySchema as lazySchema10,
4399
- zodSchema as zodSchema10
4414
+ lazySchema as lazySchema11,
4415
+ zodSchema as zodSchema11
4400
4416
  } from "@ai-sdk/provider-utils";
4401
4417
  import { z as z11 } from "zod/v4";
4402
- var bash_20250124InputSchema = lazySchema10(
4403
- () => zodSchema10(
4418
+ var bash_20250124InputSchema = lazySchema11(
4419
+ () => zodSchema11(
4404
4420
  z11.object({
4405
4421
  command: z11.string(),
4406
4422
  restart: z11.boolean().optional()
@@ -4416,12 +4432,12 @@ var bash_20250124 = createProviderDefinedToolFactory4({
4416
4432
  // src/tool/code-execution_20260120.ts
4417
4433
  import {
4418
4434
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
4419
- lazySchema as lazySchema11,
4420
- zodSchema as zodSchema11
4435
+ lazySchema as lazySchema12,
4436
+ zodSchema as zodSchema12
4421
4437
  } from "@ai-sdk/provider-utils";
4422
4438
  import { z as z12 } from "zod/v4";
4423
- var codeExecution_20260120OutputSchema = lazySchema11(
4424
- () => zodSchema11(
4439
+ var codeExecution_20260120OutputSchema = lazySchema12(
4440
+ () => zodSchema12(
4425
4441
  z12.discriminatedUnion("type", [
4426
4442
  z12.object({
4427
4443
  type: z12.literal("code_execution_result"),
@@ -4478,8 +4494,8 @@ var codeExecution_20260120OutputSchema = lazySchema11(
4478
4494
  ])
4479
4495
  )
4480
4496
  );
4481
- var codeExecution_20260120InputSchema = lazySchema11(
4482
- () => zodSchema11(
4497
+ var codeExecution_20260120InputSchema = lazySchema12(
4498
+ () => zodSchema12(
4483
4499
  z12.discriminatedUnion("type", [
4484
4500
  z12.object({
4485
4501
  type: z12.literal("programmatic-tool-call"),
@@ -4525,12 +4541,12 @@ var codeExecution_20260120 = (args = {}) => {
4525
4541
  // src/tool/computer_20241022.ts
4526
4542
  import {
4527
4543
  createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
4528
- lazySchema as lazySchema12,
4529
- zodSchema as zodSchema12
4544
+ lazySchema as lazySchema13,
4545
+ zodSchema as zodSchema13
4530
4546
  } from "@ai-sdk/provider-utils";
4531
4547
  import { z as z13 } from "zod/v4";
4532
- var computer_20241022InputSchema = lazySchema12(
4533
- () => zodSchema12(
4548
+ var computer_20241022InputSchema = lazySchema13(
4549
+ () => zodSchema13(
4534
4550
  z13.object({
4535
4551
  action: z13.enum([
4536
4552
  "key",
@@ -4558,12 +4574,12 @@ var computer_20241022 = createProviderDefinedToolFactory5({
4558
4574
  // src/tool/computer_20250124.ts
4559
4575
  import {
4560
4576
  createProviderDefinedToolFactory as createProviderDefinedToolFactory6,
4561
- lazySchema as lazySchema13,
4562
- zodSchema as zodSchema13
4577
+ lazySchema as lazySchema14,
4578
+ zodSchema as zodSchema14
4563
4579
  } from "@ai-sdk/provider-utils";
4564
4580
  import { z as z14 } from "zod/v4";
4565
- var computer_20250124InputSchema = lazySchema13(
4566
- () => zodSchema13(
4581
+ var computer_20250124InputSchema = lazySchema14(
4582
+ () => zodSchema14(
4567
4583
  z14.object({
4568
4584
  action: z14.enum([
4569
4585
  "key",
@@ -4601,12 +4617,12 @@ var computer_20250124 = createProviderDefinedToolFactory6({
4601
4617
  // src/tool/memory_20250818.ts
4602
4618
  import {
4603
4619
  createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
4604
- lazySchema as lazySchema14,
4605
- zodSchema as zodSchema14
4620
+ lazySchema as lazySchema15,
4621
+ zodSchema as zodSchema15
4606
4622
  } from "@ai-sdk/provider-utils";
4607
4623
  import { z as z15 } from "zod/v4";
4608
- var memory_20250818InputSchema = lazySchema14(
4609
- () => zodSchema14(
4624
+ var memory_20250818InputSchema = lazySchema15(
4625
+ () => zodSchema15(
4610
4626
  z15.discriminatedUnion("command", [
4611
4627
  z15.object({
4612
4628
  command: z15.literal("view"),
@@ -4651,12 +4667,12 @@ var memory_20250818 = createProviderDefinedToolFactory7({
4651
4667
  // src/tool/text-editor_20241022.ts
4652
4668
  import {
4653
4669
  createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
4654
- lazySchema as lazySchema15,
4655
- zodSchema as zodSchema15
4670
+ lazySchema as lazySchema16,
4671
+ zodSchema as zodSchema16
4656
4672
  } from "@ai-sdk/provider-utils";
4657
4673
  import { z as z16 } from "zod/v4";
4658
- var textEditor_20241022InputSchema = lazySchema15(
4659
- () => zodSchema15(
4674
+ var textEditor_20241022InputSchema = lazySchema16(
4675
+ () => zodSchema16(
4660
4676
  z16.object({
4661
4677
  command: z16.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4662
4678
  path: z16.string(),
@@ -4677,12 +4693,12 @@ var textEditor_20241022 = createProviderDefinedToolFactory8({
4677
4693
  // src/tool/text-editor_20250124.ts
4678
4694
  import {
4679
4695
  createProviderDefinedToolFactory as createProviderDefinedToolFactory9,
4680
- lazySchema as lazySchema16,
4681
- zodSchema as zodSchema16
4696
+ lazySchema as lazySchema17,
4697
+ zodSchema as zodSchema17
4682
4698
  } from "@ai-sdk/provider-utils";
4683
4699
  import { z as z17 } from "zod/v4";
4684
- var textEditor_20250124InputSchema = lazySchema16(
4685
- () => zodSchema16(
4700
+ var textEditor_20250124InputSchema = lazySchema17(
4701
+ () => zodSchema17(
4686
4702
  z17.object({
4687
4703
  command: z17.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4688
4704
  path: z17.string(),
@@ -4703,12 +4719,12 @@ var textEditor_20250124 = createProviderDefinedToolFactory9({
4703
4719
  // src/tool/text-editor_20250429.ts
4704
4720
  import {
4705
4721
  createProviderDefinedToolFactory as createProviderDefinedToolFactory10,
4706
- lazySchema as lazySchema17,
4707
- zodSchema as zodSchema17
4722
+ lazySchema as lazySchema18,
4723
+ zodSchema as zodSchema18
4708
4724
  } from "@ai-sdk/provider-utils";
4709
4725
  import { z as z18 } from "zod/v4";
4710
- var textEditor_20250429InputSchema = lazySchema17(
4711
- () => zodSchema17(
4726
+ var textEditor_20250429InputSchema = lazySchema18(
4727
+ () => zodSchema18(
4712
4728
  z18.object({
4713
4729
  command: z18.enum(["view", "create", "str_replace", "insert"]),
4714
4730
  path: z18.string(),