@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.
@@ -42,7 +42,7 @@ import {
42
42
  zodSchema as zodSchema2
43
43
  } from "@ai-sdk/provider-utils";
44
44
  import { z as z2 } from "zod/v4";
45
- var anthropicStopDetailsSchema = z2.object({
45
+ var anthropicStopDetailsSchema = () => z2.object({
46
46
  type: z2.string(),
47
47
  category: z2.string().nullish(),
48
48
  explanation: z2.string().nullish(),
@@ -248,7 +248,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
248
248
  ),
249
249
  stop_reason: z2.string().nullish(),
250
250
  stop_sequence: z2.string().nullish(),
251
- stop_details: anthropicStopDetailsSchema.nullish(),
251
+ stop_details: anthropicStopDetailsSchema().nullish(),
252
252
  usage: z2.looseObject({
253
253
  input_tokens: z2.number(),
254
254
  output_tokens: z2.number(),
@@ -552,7 +552,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
552
552
  delta: z2.object({
553
553
  stop_reason: z2.string().nullish(),
554
554
  stop_sequence: z2.string().nullish(),
555
- stop_details: anthropicStopDetailsSchema.nullish(),
555
+ stop_details: anthropicStopDetailsSchema().nullish(),
556
556
  container: z2.object({
557
557
  expires_at: z2.string(),
558
558
  id: z2.string(),
@@ -628,314 +628,330 @@ var anthropicReasoningMetadataSchema = lazySchema2(
628
628
  );
629
629
 
630
630
  // src/anthropic-messages-options.ts
631
+ import {
632
+ lazySchema as lazySchema3,
633
+ zodSchema as zodSchema3
634
+ } from "@ai-sdk/provider-utils";
631
635
  import { z as z3 } from "zod/v4";
632
- var anthropicFilePartProviderOptions = z3.object({
633
- /**
634
- * Citation configuration for this document.
635
- * When enabled, this document will generate citations in the response.
636
- */
637
- citations: z3.object({
638
- /**
639
- * Enable citations for this document
640
- */
641
- enabled: z3.boolean()
642
- }).optional(),
643
- /**
644
- * Custom title for the document.
645
- * If not provided, the filename will be used.
646
- */
647
- title: z3.string().optional(),
648
- /**
649
- * Context about the document that will be passed to the model
650
- * but not used towards cited content.
651
- * Useful for storing document metadata as text or stringified JSON.
652
- */
653
- context: z3.string().optional()
654
- });
655
- var anthropicSystemMessageProviderOptions = z3.object({
656
- /**
657
- * Controls when a mid-conversation system message is cleared.
658
- *
659
- * The value is forwarded to Anthropic as `clear_at`. The required
660
- * `mid-conversation-system-clear-at-2026-08-21` beta is added automatically.
661
- */
662
- clearAt: z3.literal("next_user_message").optional(),
663
- /**
664
- * Sets the model effort from the next user turn until a later message
665
- * changes it. An effort-only system message with empty content can appear
666
- * first. The required `mid-conversation-output-config-2026-07-01` beta is
667
- * added automatically.
668
- */
669
- effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
670
- /**
671
- * Mid-conversation tool changes. Adds or removes tools from the
672
- * conversation's tool set between turns without invalidating the prompt
673
- * cache.
674
- *
675
- * Only supported on system messages that appear mid-conversation (not the
676
- * initial system prompt). A system message carrying tool changes must come
677
- * right before an assistant message or at the end of the messages.
678
- *
679
- * Tools referenced by a `tool_addition` must be declared in the `tools`
680
- * option (typically with `deferLoading: true` so they are not loaded until
681
- * the addition surfaces them). The required
682
- * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
683
- */
684
- toolChanges: z3.array(
685
- z3.discriminatedUnion("type", [
686
- z3.object({
687
- type: z3.literal("tool_addition"),
688
- toolName: z3.string()
689
- }),
690
- z3.object({
691
- type: z3.literal("tool_removal"),
692
- toolName: z3.string()
693
- })
694
- ])
695
- ).optional()
696
- });
697
- var anthropicThinkingBlockBinding = z3.object({
698
- /**
699
- * Controls behavior when a replayed thinking block does not match its
700
- * conversation prefix. The `drop_block` behavior drops the mismatched block
701
- * instead of returning an invalid signature error.
702
- */
703
- prefixMismatchBehavior: z3.literal("drop_block")
704
- });
705
- var anthropicProviderOptions = z3.object({
706
- /**
707
- * Whether to send reasoning to the model.
708
- *
709
- * This allows you to deactivate reasoning inputs for models that do not support them.
710
- */
711
- sendReasoning: z3.boolean().optional(),
712
- /**
713
- * Determines how structured outputs are generated.
714
- *
715
- * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
716
- * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
717
- * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Sonnet 5.5, Opus 5.5, and Fable 5.1).
718
- */
719
- structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
720
- /**
721
- * Configuration for enabling Claude's extended thinking.
722
- *
723
- * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
724
- * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
725
- *
726
- * Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
727
- * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
728
- * provider drops the unsupported setting, emits a warning, and sends an
729
- * adaptive thinking request. Use `effort` to control how much they think.
730
- *
731
- * `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
732
- * and the provider uses it in place of `disabled` for that model.
733
- */
734
- thinking: z3.union([
636
+ var anthropicFilePartProviderOptions = lazySchema3(
637
+ () => zodSchema3(
735
638
  z3.object({
736
- /** for Sonnet 4.6, Opus 4.6, and newer models */
737
- type: z3.literal("adaptive"),
738
639
  /**
739
- * Controls whether thinking content is included in the response.
740
- * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
741
- * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
742
- * - `"updates"`: Thinking summaries are emitted between tool calls.
640
+ * Citation configuration for this document.
641
+ * When enabled, this document will generate citations in the response.
743
642
  */
744
- display: z3.enum(["omitted", "summarized", "updates"]).optional(),
643
+ citations: z3.object({
644
+ /**
645
+ * Enable citations for this document
646
+ */
647
+ enabled: z3.boolean()
648
+ }).optional(),
745
649
  /**
746
- * Controls handling for thinking blocks whose conversation prefix no
747
- * longer matches. Forwarded as `block_binding`.
650
+ * Custom title for the document.
651
+ * If not provided, the filename will be used.
748
652
  */
749
- blockBinding: anthropicThinkingBlockBinding.optional()
750
- }),
751
- z3.object({
752
- /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
753
- type: z3.literal("enabled"),
754
- budgetTokens: z3.number().optional(),
653
+ title: z3.string().optional(),
755
654
  /**
756
- * Controls handling for thinking blocks whose conversation prefix no
757
- * longer matches. Forwarded as `block_binding`.
655
+ * Context about the document that will be passed to the model
656
+ * but not used towards cited content.
657
+ * Useful for storing document metadata as text or stringified JSON.
758
658
  */
759
- blockBinding: anthropicThinkingBlockBinding.optional()
760
- }),
761
- z3.object({
762
- type: z3.literal("disabled")
763
- }),
659
+ context: z3.string().optional()
660
+ })
661
+ )
662
+ );
663
+ var anthropicSystemMessageProviderOptions = lazySchema3(
664
+ () => zodSchema3(
764
665
  z3.object({
765
666
  /**
766
- * for `claude-sonnet-5-5`: no upfront thinking, but progress notes
767
- * between tool calls are returned as summarized thinking blocks.
768
- * Only supported at `low`, `medium`, and `high` effort.
667
+ * Controls when a mid-conversation system message is cleared.
668
+ *
669
+ * The value is forwarded to Anthropic as `clear_at`. The required
670
+ * `mid-conversation-system-clear-at-2026-08-21` beta is added automatically.
769
671
  */
770
- type: z3.literal("between_tools")
771
- }),
772
- z3.object({
672
+ clearAt: z3.literal("next_user_message").optional(),
773
673
  /**
774
- * Configure prefix mismatch handling without changing the model's
775
- * default thinking mode.
674
+ * Sets the model effort from the next user turn until a later message
675
+ * changes it. An effort-only system message with empty content can appear
676
+ * first. The required `mid-conversation-output-config-2026-07-01` beta is
677
+ * added automatically.
776
678
  */
777
- blockBinding: anthropicThinkingBlockBinding
679
+ effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
680
+ /**
681
+ * Mid-conversation tool changes. Adds or removes tools from the
682
+ * conversation's tool set between turns without invalidating the prompt
683
+ * cache.
684
+ *
685
+ * Only supported on system messages that appear mid-conversation (not the
686
+ * initial system prompt). A system message carrying tool changes must come
687
+ * right before an assistant message or at the end of the messages.
688
+ *
689
+ * Tools referenced by a `tool_addition` must be declared in the `tools`
690
+ * option (typically with `deferLoading: true` so they are not loaded until
691
+ * the addition surfaces them). The required
692
+ * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
693
+ */
694
+ toolChanges: z3.array(
695
+ z3.discriminatedUnion("type", [
696
+ z3.object({
697
+ type: z3.literal("tool_addition"),
698
+ toolName: z3.string()
699
+ }),
700
+ z3.object({
701
+ type: z3.literal("tool_removal"),
702
+ toolName: z3.string()
703
+ })
704
+ ])
705
+ ).optional()
778
706
  })
779
- ]).optional(),
780
- /**
781
- * Whether to disable parallel function calling during tool use. Default is false.
782
- * When set to true, Claude will use at most one tool per response.
783
- */
784
- disableParallelToolUse: z3.boolean().optional(),
785
- /**
786
- * Cache control settings for this message.
787
- * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
788
- */
789
- cacheControl: z3.object({
790
- type: z3.literal("ephemeral"),
791
- ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
792
- }).optional(),
793
- /**
794
- * Metadata to include with the request.
795
- *
796
- * See https://platform.claude.com/docs/en/api/messages/create for details.
797
- */
798
- metadata: z3.object({
707
+ )
708
+ );
709
+ var anthropicProviderOptions = lazySchema3(() => {
710
+ const anthropicThinkingBlockBinding = z3.object({
799
711
  /**
800
- * An external identifier for the user associated with the request.
801
- *
802
- * Should be a UUID, hash value, or other opaque identifier.
803
- * Must not contain PII (name, email, phone number, etc.).
712
+ * Controls behavior when a replayed thinking block does not match its
713
+ * conversation prefix. The `drop_block` behavior drops the mismatched block
714
+ * instead of returning an invalid signature error.
804
715
  */
805
- userId: z3.string().optional()
806
- }).optional(),
807
- /**
808
- * Agent Skills configuration. Skills enable Claude to perform specialized tasks
809
- * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
810
- * Requires code execution tool to be enabled.
811
- */
812
- container: z3.object({
813
- id: z3.string().optional(),
814
- skills: z3.array(
815
- z3.object({
816
- type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
817
- skillId: z3.string(),
818
- version: z3.string().optional()
819
- })
820
- ).optional()
821
- }).optional(),
822
- /**
823
- * @default 'high'
824
- */
825
- effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
826
- /**
827
- * Task budget for agentic turns. Informs the model of the total token budget
828
- * available for the current task, allowing it to prioritize work and wind down
829
- * gracefully as the budget is consumed.
830
- *
831
- * Advisory only — does not enforce a hard token limit.
832
- */
833
- taskBudget: z3.object({
834
- type: z3.literal("tokens"),
835
- total: z3.number().int().min(2e4),
836
- remaining: z3.number().int().min(0).optional()
837
- }).optional(),
838
- /**
839
- * Enable fast mode for faster inference (2.5x faster output token speeds).
840
- * Only supported with claude-opus-4-6.
841
- */
842
- speed: z3.enum(["fast", "standard"]).optional(),
843
- /**
844
- * Controls where model inference runs for this request.
845
- *
846
- * - `"global"`: Inference may run in any available geography (default).
847
- * - `"us"`: Inference runs only in US-based infrastructure.
848
- *
849
- * See https://platform.claude.com/docs/en/build-with-claude/data-residency
850
- */
851
- inferenceGeo: z3.enum(["us", "global"]).optional(),
852
- /**
853
- * Server-side fallback configuration.
854
- *
855
- * When the primary model's safety classifiers block a turn, the API
856
- * automatically retries it server-side on a fallback model. A
857
- * `content-filter` finish reason means the fallback(s) refused as well.
858
- *
859
- * - `'default'` (recommended): the API routes the retry to Anthropic's
860
- * recommended fallback model based on the refusal category. Requires the
861
- * `server-side-fallback-2026-07-01` beta, which is added automatically.
862
- * - Array form: an explicit fallback chain. Each entry is merged into the
863
- * request as a direct request to that entry's model, so it must be
864
- * formatted accordingly: `model` is required, and an entry may
865
- * additionally override `max_tokens`, `thinking`, `output_config`, and
866
- * `speed` for that attempt only (`speed` additionally requires the speed
867
- * beta). The value is passed through to the API as-is, and the
868
- * `server-side-fallback-2026-06-01` beta is added automatically.
869
- */
870
- fallbacks: z3.union([
871
- z3.literal("default"),
872
- z3.array(
873
- z3.object({
874
- model: z3.string(),
875
- max_tokens: z3.number().int().optional(),
876
- thinking: z3.record(z3.string(), z3.unknown()).optional(),
877
- output_config: z3.record(z3.string(), z3.unknown()).optional(),
878
- speed: z3.enum(["fast", "standard"]).optional()
879
- })
880
- )
881
- ]).optional(),
882
- /**
883
- * Context management configuration for automatic context window management.
884
- * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
885
- */
886
- contextManagement: z3.object({
887
- edits: z3.array(
888
- z3.discriminatedUnion("type", [
716
+ prefixMismatchBehavior: z3.literal("drop_block")
717
+ });
718
+ return zodSchema3(
719
+ z3.object({
720
+ /**
721
+ * Whether to send reasoning to the model.
722
+ *
723
+ * This allows you to deactivate reasoning inputs for models that do not support them.
724
+ */
725
+ sendReasoning: z3.boolean().optional(),
726
+ /**
727
+ * Determines how structured outputs are generated.
728
+ *
729
+ * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
730
+ * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
731
+ * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Sonnet 5.5, Opus 5.5, and Fable 5.1).
732
+ */
733
+ structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
734
+ /**
735
+ * Configuration for enabling Claude's extended thinking.
736
+ *
737
+ * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
738
+ * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
739
+ *
740
+ * Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
741
+ * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
742
+ * provider drops the unsupported setting, emits a warning, and sends an
743
+ * adaptive thinking request. Use `effort` to control how much they think.
744
+ *
745
+ * `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
746
+ * and the provider uses it in place of `disabled` for that model.
747
+ */
748
+ thinking: z3.union([
889
749
  z3.object({
890
- type: z3.literal("clear_tool_uses_20250919"),
891
- trigger: z3.discriminatedUnion("type", [
892
- z3.object({
893
- type: z3.literal("input_tokens"),
894
- value: z3.number()
895
- }),
896
- z3.object({
897
- type: z3.literal("tool_uses"),
898
- value: z3.number()
899
- })
900
- ]).optional(),
901
- keep: z3.object({
902
- type: z3.literal("tool_uses"),
903
- value: z3.number()
904
- }).optional(),
905
- clearAtLeast: z3.object({
906
- type: z3.literal("input_tokens"),
907
- value: z3.number()
908
- }).optional(),
909
- clearToolInputs: z3.boolean().optional(),
910
- excludeTools: z3.array(z3.string()).optional()
750
+ /** for Sonnet 4.6, Opus 4.6, and newer models */
751
+ type: z3.literal("adaptive"),
752
+ /**
753
+ * Controls whether thinking content is included in the response.
754
+ * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
755
+ * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
756
+ * - `"updates"`: Thinking summaries are emitted between tool calls.
757
+ */
758
+ display: z3.enum(["omitted", "summarized", "updates"]).optional(),
759
+ /**
760
+ * Controls handling for thinking blocks whose conversation prefix no
761
+ * longer matches. Forwarded as `block_binding`.
762
+ */
763
+ blockBinding: anthropicThinkingBlockBinding.optional()
911
764
  }),
912
765
  z3.object({
913
- type: z3.literal("clear_thinking_20251015"),
914
- keep: z3.union([
915
- z3.literal("all"),
916
- z3.object({
917
- type: z3.literal("thinking_turns"),
918
- value: z3.number()
919
- })
920
- ]).optional()
766
+ /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
767
+ type: z3.literal("enabled"),
768
+ budgetTokens: z3.number().optional(),
769
+ /**
770
+ * Controls handling for thinking blocks whose conversation prefix no
771
+ * longer matches. Forwarded as `block_binding`.
772
+ */
773
+ blockBinding: anthropicThinkingBlockBinding.optional()
774
+ }),
775
+ z3.object({
776
+ type: z3.literal("disabled")
777
+ }),
778
+ z3.object({
779
+ /**
780
+ * for `claude-sonnet-5-5`: no upfront thinking, but progress notes
781
+ * between tool calls are returned as summarized thinking blocks.
782
+ * Only supported at `low`, `medium`, and `high` effort.
783
+ */
784
+ type: z3.literal("between_tools")
921
785
  }),
922
786
  z3.object({
923
- type: z3.literal("compact_20260112"),
924
- trigger: z3.object({
925
- type: z3.literal("input_tokens"),
926
- value: z3.number()
927
- }).optional(),
928
- pauseAfterCompaction: z3.boolean().optional(),
929
- instructions: z3.string().optional()
787
+ /**
788
+ * Configure prefix mismatch handling without changing the model's
789
+ * default thinking mode.
790
+ */
791
+ blockBinding: anthropicThinkingBlockBinding
930
792
  })
931
- ])
932
- )
933
- }).optional(),
934
- /**
935
- * A set of beta features to enable.
936
- * Allow a provider to receive the full `betas` set if it needs it.
937
- */
938
- anthropicBeta: z3.array(z3.string()).optional()
793
+ ]).optional(),
794
+ /**
795
+ * Whether to disable parallel function calling during tool use. Default is false.
796
+ * When set to true, Claude will use at most one tool per response.
797
+ */
798
+ disableParallelToolUse: z3.boolean().optional(),
799
+ /**
800
+ * Cache control settings for this message.
801
+ * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
802
+ */
803
+ cacheControl: z3.object({
804
+ type: z3.literal("ephemeral"),
805
+ ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
806
+ }).optional(),
807
+ /**
808
+ * Metadata to include with the request.
809
+ *
810
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
811
+ */
812
+ metadata: z3.object({
813
+ /**
814
+ * An external identifier for the user associated with the request.
815
+ *
816
+ * Should be a UUID, hash value, or other opaque identifier.
817
+ * Must not contain PII (name, email, phone number, etc.).
818
+ */
819
+ userId: z3.string().optional()
820
+ }).optional(),
821
+ /**
822
+ * Agent Skills configuration. Skills enable Claude to perform specialized tasks
823
+ * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
824
+ * Requires code execution tool to be enabled.
825
+ */
826
+ container: z3.object({
827
+ id: z3.string().optional(),
828
+ skills: z3.array(
829
+ z3.object({
830
+ type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
831
+ skillId: z3.string(),
832
+ version: z3.string().optional()
833
+ })
834
+ ).optional()
835
+ }).optional(),
836
+ /**
837
+ * @default 'high'
838
+ */
839
+ effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
840
+ /**
841
+ * Task budget for agentic turns. Informs the model of the total token budget
842
+ * available for the current task, allowing it to prioritize work and wind down
843
+ * gracefully as the budget is consumed.
844
+ *
845
+ * Advisory only — does not enforce a hard token limit.
846
+ */
847
+ taskBudget: z3.object({
848
+ type: z3.literal("tokens"),
849
+ total: z3.number().int().min(2e4),
850
+ remaining: z3.number().int().min(0).optional()
851
+ }).optional(),
852
+ /**
853
+ * Enable fast mode for faster inference (2.5x faster output token speeds).
854
+ * Only supported with claude-opus-4-6.
855
+ */
856
+ speed: z3.enum(["fast", "standard"]).optional(),
857
+ /**
858
+ * Controls where model inference runs for this request.
859
+ *
860
+ * - `"global"`: Inference may run in any available geography (default).
861
+ * - `"us"`: Inference runs only in US-based infrastructure.
862
+ *
863
+ * See https://platform.claude.com/docs/en/build-with-claude/data-residency
864
+ */
865
+ inferenceGeo: z3.enum(["us", "global"]).optional(),
866
+ /**
867
+ * Server-side fallback configuration.
868
+ *
869
+ * When the primary model's safety classifiers block a turn, the API
870
+ * automatically retries it server-side on a fallback model. A
871
+ * `content-filter` finish reason means the fallback(s) refused as well.
872
+ *
873
+ * - `'default'` (recommended): the API routes the retry to Anthropic's
874
+ * recommended fallback model based on the refusal category. Requires the
875
+ * `server-side-fallback-2026-07-01` beta, which is added automatically.
876
+ * - Array form: an explicit fallback chain. Each entry is merged into the
877
+ * request as a direct request to that entry's model, so it must be
878
+ * formatted accordingly: `model` is required, and an entry may
879
+ * additionally override `max_tokens`, `thinking`, `output_config`, and
880
+ * `speed` for that attempt only (`speed` additionally requires the speed
881
+ * beta). The value is passed through to the API as-is, and the
882
+ * `server-side-fallback-2026-06-01` beta is added automatically.
883
+ */
884
+ fallbacks: z3.union([
885
+ z3.literal("default"),
886
+ z3.array(
887
+ z3.object({
888
+ model: z3.string(),
889
+ max_tokens: z3.number().int().optional(),
890
+ thinking: z3.record(z3.string(), z3.unknown()).optional(),
891
+ output_config: z3.record(z3.string(), z3.unknown()).optional(),
892
+ speed: z3.enum(["fast", "standard"]).optional()
893
+ })
894
+ )
895
+ ]).optional(),
896
+ /**
897
+ * Context management configuration for automatic context window management.
898
+ * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
899
+ */
900
+ contextManagement: z3.object({
901
+ edits: z3.array(
902
+ z3.discriminatedUnion("type", [
903
+ z3.object({
904
+ type: z3.literal("clear_tool_uses_20250919"),
905
+ trigger: z3.discriminatedUnion("type", [
906
+ z3.object({
907
+ type: z3.literal("input_tokens"),
908
+ value: z3.number()
909
+ }),
910
+ z3.object({
911
+ type: z3.literal("tool_uses"),
912
+ value: z3.number()
913
+ })
914
+ ]).optional(),
915
+ keep: z3.object({
916
+ type: z3.literal("tool_uses"),
917
+ value: z3.number()
918
+ }).optional(),
919
+ clearAtLeast: z3.object({
920
+ type: z3.literal("input_tokens"),
921
+ value: z3.number()
922
+ }).optional(),
923
+ clearToolInputs: z3.boolean().optional(),
924
+ excludeTools: z3.array(z3.string()).optional()
925
+ }),
926
+ z3.object({
927
+ type: z3.literal("clear_thinking_20251015"),
928
+ keep: z3.union([
929
+ z3.literal("all"),
930
+ z3.object({
931
+ type: z3.literal("thinking_turns"),
932
+ value: z3.number()
933
+ })
934
+ ]).optional()
935
+ }),
936
+ z3.object({
937
+ type: z3.literal("compact_20260112"),
938
+ trigger: z3.object({
939
+ type: z3.literal("input_tokens"),
940
+ value: z3.number()
941
+ }).optional(),
942
+ pauseAfterCompaction: z3.boolean().optional(),
943
+ instructions: z3.string().optional()
944
+ })
945
+ ])
946
+ )
947
+ }).optional(),
948
+ /**
949
+ * A set of beta features to enable.
950
+ * Allow a provider to receive the full `betas` set if it needs it.
951
+ */
952
+ anthropicBeta: z3.array(z3.string()).optional()
953
+ })
954
+ );
939
955
  });
940
956
 
941
957
  // src/anthropic-prepare-tools.ts
@@ -988,8 +1004,8 @@ var CacheControlValidator = class {
988
1004
  // src/tool/computer-toolset_20260801.ts
989
1005
  import {
990
1006
  createProviderDefinedToolFactory,
991
- lazySchema as lazySchema3,
992
- zodSchema as zodSchema3
1007
+ lazySchema as lazySchema4,
1008
+ zodSchema as zodSchema4
993
1009
  } from "@ai-sdk/provider-utils";
994
1010
  import { z as z4 } from "zod/v4";
995
1011
  var computerToolset_20260801Members = [
@@ -1011,8 +1027,8 @@ var computerToolset_20260801Members = [
1011
1027
  "hold_key",
1012
1028
  "wait"
1013
1029
  ];
1014
- var computerToolset_20260801InputSchema = lazySchema3(
1015
- () => zodSchema3(
1030
+ var computerToolset_20260801InputSchema = lazySchema4(
1031
+ () => zodSchema4(
1016
1032
  z4.object({
1017
1033
  action: z4.enum(computerToolset_20260801Members),
1018
1034
  coordinate: z4.tuple([z4.number().int(), z4.number().int()]).optional(),
@@ -1031,8 +1047,8 @@ var computerToolset_20260801InputSchema = lazySchema3(
1031
1047
  })
1032
1048
  )
1033
1049
  );
1034
- var computerToolset_20260801ArgsSchema = lazySchema3(
1035
- () => zodSchema3(
1050
+ var computerToolset_20260801ArgsSchema = lazySchema4(
1051
+ () => zodSchema4(
1036
1052
  z4.object({
1037
1053
  configs: z4.partialRecord(
1038
1054
  z4.enum(computerToolset_20260801Members),
@@ -1053,19 +1069,19 @@ var computerToolset_20260801 = createProviderDefinedToolFactory({
1053
1069
  // src/tool/text-editor_20250728.ts
1054
1070
  import {
1055
1071
  createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
1056
- lazySchema as lazySchema4,
1057
- zodSchema as zodSchema4
1072
+ lazySchema as lazySchema5,
1073
+ zodSchema as zodSchema5
1058
1074
  } from "@ai-sdk/provider-utils";
1059
1075
  import { z as z5 } from "zod/v4";
1060
- var textEditor_20250728ArgsSchema = lazySchema4(
1061
- () => zodSchema4(
1076
+ var textEditor_20250728ArgsSchema = lazySchema5(
1077
+ () => zodSchema5(
1062
1078
  z5.object({
1063
1079
  maxCharacters: z5.number().optional()
1064
1080
  })
1065
1081
  )
1066
1082
  );
1067
- var textEditor_20250728InputSchema = lazySchema4(
1068
- () => zodSchema4(
1083
+ var textEditor_20250728InputSchema = lazySchema5(
1084
+ () => zodSchema5(
1069
1085
  z5.object({
1070
1086
  command: z5.enum(["view", "create", "str_replace", "insert"]),
1071
1087
  path: z5.string(),
@@ -1089,12 +1105,12 @@ var textEditor_20250728 = (args = {}) => {
1089
1105
  // src/tool/web-search_20250305.ts
1090
1106
  import {
1091
1107
  createProviderDefinedToolFactoryWithOutputSchema,
1092
- lazySchema as lazySchema5,
1093
- zodSchema as zodSchema5
1108
+ lazySchema as lazySchema6,
1109
+ zodSchema as zodSchema6
1094
1110
  } from "@ai-sdk/provider-utils";
1095
1111
  import { z as z6 } from "zod/v4";
1096
- var webSearch_20250305ArgsSchema = lazySchema5(
1097
- () => zodSchema5(
1112
+ var webSearch_20250305ArgsSchema = lazySchema6(
1113
+ () => zodSchema6(
1098
1114
  z6.object({
1099
1115
  maxUses: z6.number().optional(),
1100
1116
  allowedDomains: z6.array(z6.string()).optional(),
@@ -1109,8 +1125,8 @@ var webSearch_20250305ArgsSchema = lazySchema5(
1109
1125
  })
1110
1126
  )
1111
1127
  );
1112
- var webSearch_20250305OutputSchema = lazySchema5(
1113
- () => zodSchema5(
1128
+ var webSearch_20250305OutputSchema = lazySchema6(
1129
+ () => zodSchema6(
1114
1130
  z6.array(
1115
1131
  z6.object({
1116
1132
  url: z6.string(),
@@ -1122,8 +1138,8 @@ var webSearch_20250305OutputSchema = lazySchema5(
1122
1138
  )
1123
1139
  )
1124
1140
  );
1125
- var webSearch_20250305InputSchema = lazySchema5(
1126
- () => zodSchema5(
1141
+ var webSearch_20250305InputSchema = lazySchema6(
1142
+ () => zodSchema6(
1127
1143
  z6.object({
1128
1144
  query: z6.string()
1129
1145
  })
@@ -1142,12 +1158,12 @@ var webSearch_20250305 = (args = {}) => {
1142
1158
  // src/tool/web-fetch-20250910.ts
1143
1159
  import {
1144
1160
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
1145
- lazySchema as lazySchema6,
1146
- zodSchema as zodSchema6
1161
+ lazySchema as lazySchema7,
1162
+ zodSchema as zodSchema7
1147
1163
  } from "@ai-sdk/provider-utils";
1148
1164
  import { z as z7 } from "zod/v4";
1149
- var webFetch_20250910ArgsSchema = lazySchema6(
1150
- () => zodSchema6(
1165
+ var webFetch_20250910ArgsSchema = lazySchema7(
1166
+ () => zodSchema7(
1151
1167
  z7.object({
1152
1168
  maxUses: z7.number().optional(),
1153
1169
  allowedDomains: z7.array(z7.string()).optional(),
@@ -1157,8 +1173,8 @@ var webFetch_20250910ArgsSchema = lazySchema6(
1157
1173
  })
1158
1174
  )
1159
1175
  );
1160
- var webFetch_20250910OutputSchema = lazySchema6(
1161
- () => zodSchema6(
1176
+ var webFetch_20250910OutputSchema = lazySchema7(
1177
+ () => zodSchema7(
1162
1178
  z7.object({
1163
1179
  type: z7.literal("web_fetch_result"),
1164
1180
  url: z7.string(),
@@ -1183,8 +1199,8 @@ var webFetch_20250910OutputSchema = lazySchema6(
1183
1199
  })
1184
1200
  )
1185
1201
  );
1186
- var webFetch_20250910InputSchema = lazySchema6(
1187
- () => zodSchema6(
1202
+ var webFetch_20250910InputSchema = lazySchema7(
1203
+ () => zodSchema7(
1188
1204
  z7.object({
1189
1205
  url: z7.string()
1190
1206
  })
@@ -1523,12 +1539,12 @@ import {
1523
1539
  // src/tool/code-execution_20250522.ts
1524
1540
  import {
1525
1541
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
1526
- lazySchema as lazySchema7,
1527
- zodSchema as zodSchema7
1542
+ lazySchema as lazySchema8,
1543
+ zodSchema as zodSchema8
1528
1544
  } from "@ai-sdk/provider-utils";
1529
1545
  import { z as z8 } from "zod/v4";
1530
- var codeExecution_20250522OutputSchema = lazySchema7(
1531
- () => zodSchema7(
1546
+ var codeExecution_20250522OutputSchema = lazySchema8(
1547
+ () => zodSchema8(
1532
1548
  z8.object({
1533
1549
  type: z8.literal("code_execution_result"),
1534
1550
  stdout: z8.string(),
@@ -1537,8 +1553,8 @@ var codeExecution_20250522OutputSchema = lazySchema7(
1537
1553
  })
1538
1554
  )
1539
1555
  );
1540
- var codeExecution_20250522InputSchema = lazySchema7(
1541
- () => zodSchema7(
1556
+ var codeExecution_20250522InputSchema = lazySchema8(
1557
+ () => zodSchema8(
1542
1558
  z8.object({
1543
1559
  code: z8.string()
1544
1560
  })
@@ -1557,12 +1573,12 @@ var codeExecution_20250522 = (args = {}) => {
1557
1573
  // src/tool/code-execution_20250825.ts
1558
1574
  import {
1559
1575
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
1560
- lazySchema as lazySchema8,
1561
- zodSchema as zodSchema8
1576
+ lazySchema as lazySchema9,
1577
+ zodSchema as zodSchema9
1562
1578
  } from "@ai-sdk/provider-utils";
1563
1579
  import { z as z9 } from "zod/v4";
1564
- var codeExecution_20250825OutputSchema = lazySchema8(
1565
- () => zodSchema8(
1580
+ var codeExecution_20250825OutputSchema = lazySchema9(
1581
+ () => zodSchema9(
1566
1582
  z9.discriminatedUnion("type", [
1567
1583
  z9.object({
1568
1584
  type: z9.literal("bash_code_execution_result"),
@@ -1607,8 +1623,8 @@ var codeExecution_20250825OutputSchema = lazySchema8(
1607
1623
  ])
1608
1624
  )
1609
1625
  );
1610
- var codeExecution_20250825InputSchema = lazySchema8(
1611
- () => zodSchema8(
1626
+ var codeExecution_20250825InputSchema = lazySchema9(
1627
+ () => zodSchema9(
1612
1628
  z9.discriminatedUnion("type", [
1613
1629
  z9.object({
1614
1630
  type: z9.literal("bash_code_execution"),
@@ -4359,12 +4375,12 @@ function mapAnthropicStopDetails(stopDetails) {
4359
4375
  // src/tool/bash_20241022.ts
4360
4376
  import {
4361
4377
  createProviderDefinedToolFactory as createProviderDefinedToolFactory3,
4362
- lazySchema as lazySchema9,
4363
- zodSchema as zodSchema9
4378
+ lazySchema as lazySchema10,
4379
+ zodSchema as zodSchema10
4364
4380
  } from "@ai-sdk/provider-utils";
4365
4381
  import { z as z10 } from "zod/v4";
4366
- var bash_20241022InputSchema = lazySchema9(
4367
- () => zodSchema9(
4382
+ var bash_20241022InputSchema = lazySchema10(
4383
+ () => zodSchema10(
4368
4384
  z10.object({
4369
4385
  command: z10.string(),
4370
4386
  restart: z10.boolean().optional()
@@ -4380,12 +4396,12 @@ var bash_20241022 = createProviderDefinedToolFactory3({
4380
4396
  // src/tool/bash_20250124.ts
4381
4397
  import {
4382
4398
  createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
4383
- lazySchema as lazySchema10,
4384
- zodSchema as zodSchema10
4399
+ lazySchema as lazySchema11,
4400
+ zodSchema as zodSchema11
4385
4401
  } from "@ai-sdk/provider-utils";
4386
4402
  import { z as z11 } from "zod/v4";
4387
- var bash_20250124InputSchema = lazySchema10(
4388
- () => zodSchema10(
4403
+ var bash_20250124InputSchema = lazySchema11(
4404
+ () => zodSchema11(
4389
4405
  z11.object({
4390
4406
  command: z11.string(),
4391
4407
  restart: z11.boolean().optional()
@@ -4401,12 +4417,12 @@ var bash_20250124 = createProviderDefinedToolFactory4({
4401
4417
  // src/tool/code-execution_20260120.ts
4402
4418
  import {
4403
4419
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
4404
- lazySchema as lazySchema11,
4405
- zodSchema as zodSchema11
4420
+ lazySchema as lazySchema12,
4421
+ zodSchema as zodSchema12
4406
4422
  } from "@ai-sdk/provider-utils";
4407
4423
  import { z as z12 } from "zod/v4";
4408
- var codeExecution_20260120OutputSchema = lazySchema11(
4409
- () => zodSchema11(
4424
+ var codeExecution_20260120OutputSchema = lazySchema12(
4425
+ () => zodSchema12(
4410
4426
  z12.discriminatedUnion("type", [
4411
4427
  z12.object({
4412
4428
  type: z12.literal("code_execution_result"),
@@ -4463,8 +4479,8 @@ var codeExecution_20260120OutputSchema = lazySchema11(
4463
4479
  ])
4464
4480
  )
4465
4481
  );
4466
- var codeExecution_20260120InputSchema = lazySchema11(
4467
- () => zodSchema11(
4482
+ var codeExecution_20260120InputSchema = lazySchema12(
4483
+ () => zodSchema12(
4468
4484
  z12.discriminatedUnion("type", [
4469
4485
  z12.object({
4470
4486
  type: z12.literal("programmatic-tool-call"),
@@ -4510,12 +4526,12 @@ var codeExecution_20260120 = (args = {}) => {
4510
4526
  // src/tool/computer_20241022.ts
4511
4527
  import {
4512
4528
  createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
4513
- lazySchema as lazySchema12,
4514
- zodSchema as zodSchema12
4529
+ lazySchema as lazySchema13,
4530
+ zodSchema as zodSchema13
4515
4531
  } from "@ai-sdk/provider-utils";
4516
4532
  import { z as z13 } from "zod/v4";
4517
- var computer_20241022InputSchema = lazySchema12(
4518
- () => zodSchema12(
4533
+ var computer_20241022InputSchema = lazySchema13(
4534
+ () => zodSchema13(
4519
4535
  z13.object({
4520
4536
  action: z13.enum([
4521
4537
  "key",
@@ -4543,12 +4559,12 @@ var computer_20241022 = createProviderDefinedToolFactory5({
4543
4559
  // src/tool/computer_20250124.ts
4544
4560
  import {
4545
4561
  createProviderDefinedToolFactory as createProviderDefinedToolFactory6,
4546
- lazySchema as lazySchema13,
4547
- zodSchema as zodSchema13
4562
+ lazySchema as lazySchema14,
4563
+ zodSchema as zodSchema14
4548
4564
  } from "@ai-sdk/provider-utils";
4549
4565
  import { z as z14 } from "zod/v4";
4550
- var computer_20250124InputSchema = lazySchema13(
4551
- () => zodSchema13(
4566
+ var computer_20250124InputSchema = lazySchema14(
4567
+ () => zodSchema14(
4552
4568
  z14.object({
4553
4569
  action: z14.enum([
4554
4570
  "key",
@@ -4586,12 +4602,12 @@ var computer_20250124 = createProviderDefinedToolFactory6({
4586
4602
  // src/tool/memory_20250818.ts
4587
4603
  import {
4588
4604
  createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
4589
- lazySchema as lazySchema14,
4590
- zodSchema as zodSchema14
4605
+ lazySchema as lazySchema15,
4606
+ zodSchema as zodSchema15
4591
4607
  } from "@ai-sdk/provider-utils";
4592
4608
  import { z as z15 } from "zod/v4";
4593
- var memory_20250818InputSchema = lazySchema14(
4594
- () => zodSchema14(
4609
+ var memory_20250818InputSchema = lazySchema15(
4610
+ () => zodSchema15(
4595
4611
  z15.discriminatedUnion("command", [
4596
4612
  z15.object({
4597
4613
  command: z15.literal("view"),
@@ -4636,12 +4652,12 @@ var memory_20250818 = createProviderDefinedToolFactory7({
4636
4652
  // src/tool/text-editor_20241022.ts
4637
4653
  import {
4638
4654
  createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
4639
- lazySchema as lazySchema15,
4640
- zodSchema as zodSchema15
4655
+ lazySchema as lazySchema16,
4656
+ zodSchema as zodSchema16
4641
4657
  } from "@ai-sdk/provider-utils";
4642
4658
  import { z as z16 } from "zod/v4";
4643
- var textEditor_20241022InputSchema = lazySchema15(
4644
- () => zodSchema15(
4659
+ var textEditor_20241022InputSchema = lazySchema16(
4660
+ () => zodSchema16(
4645
4661
  z16.object({
4646
4662
  command: z16.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4647
4663
  path: z16.string(),
@@ -4662,12 +4678,12 @@ var textEditor_20241022 = createProviderDefinedToolFactory8({
4662
4678
  // src/tool/text-editor_20250124.ts
4663
4679
  import {
4664
4680
  createProviderDefinedToolFactory as createProviderDefinedToolFactory9,
4665
- lazySchema as lazySchema16,
4666
- zodSchema as zodSchema16
4681
+ lazySchema as lazySchema17,
4682
+ zodSchema as zodSchema17
4667
4683
  } from "@ai-sdk/provider-utils";
4668
4684
  import { z as z17 } from "zod/v4";
4669
- var textEditor_20250124InputSchema = lazySchema16(
4670
- () => zodSchema16(
4685
+ var textEditor_20250124InputSchema = lazySchema17(
4686
+ () => zodSchema17(
4671
4687
  z17.object({
4672
4688
  command: z17.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4673
4689
  path: z17.string(),
@@ -4688,12 +4704,12 @@ var textEditor_20250124 = createProviderDefinedToolFactory9({
4688
4704
  // src/tool/text-editor_20250429.ts
4689
4705
  import {
4690
4706
  createProviderDefinedToolFactory as createProviderDefinedToolFactory10,
4691
- lazySchema as lazySchema17,
4692
- zodSchema as zodSchema17
4707
+ lazySchema as lazySchema18,
4708
+ zodSchema as zodSchema18
4693
4709
  } from "@ai-sdk/provider-utils";
4694
4710
  import { z as z18 } from "zod/v4";
4695
- var textEditor_20250429InputSchema = lazySchema17(
4696
- () => zodSchema17(
4711
+ var textEditor_20250429InputSchema = lazySchema18(
4712
+ () => zodSchema18(
4697
4713
  z18.object({
4698
4714
  command: z18.enum(["view", "create", "str_replace", "insert"]),
4699
4715
  path: z18.string(),